@rallycry/conveyor-agent 10.12.1 → 10.13.1

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,1103 @@ 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()
2299
+ });
2300
+ var GenerateTaskIconRequestSchema = z3.object({
2301
+ sessionId: z3.string(),
2302
+ prompt: z3.string().min(1),
2303
+ aspectRatio: z3.string().optional()
2304
+ });
2305
+ var SearchFaIconsRequestSchema = z3.object({
2306
+ sessionId: z3.string(),
2307
+ query: z3.string().min(1),
2308
+ first: z3.number().int().positive().optional()
2419
2309
  });
2420
- var PtyEndedRequestSchema = z2.object({
2421
- sessionId: z2.string()
2310
+ var PickFaIconRequestSchema = z3.object({
2311
+ sessionId: z3.string(),
2312
+ fontAwesomeId: z3.string().min(1),
2313
+ fontAwesomeStyle: z3.string().optional()
2422
2314
  });
2423
- var PtyInputRequestSchema = z2.object({
2424
- sessionId: z2.string(),
2425
- data: z2.string().max(PTY_FRAME_MAX_CHARS)
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()
2426
2321
  });
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)
2322
+ var AddDependencyRequestSchema = z3.object({
2323
+ sessionId: z3.string(),
2324
+ dependsOnSlugOrId: z3.string()
2431
2325
  });
2432
- var PtyAttachRequestSchema = z2.object({
2433
- sessionId: z2.string()
2326
+ var RemoveDependencyRequestSchema = z3.object({
2327
+ sessionId: z3.string(),
2328
+ dependsOnSlugOrId: z3.string()
2434
2329
  });
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()
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 GetProjectOnboardingStatusRequestSchema = z4.object({
2595
+ projectId: z4.string()
2540
2596
  });
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()
2597
+ var CreateProjectTaskRequestSchema = z4.object({
2598
+ projectId: z4.string(),
2599
+ title: z4.string().min(1),
2600
+ description: z4.string().optional(),
2601
+ plan: z4.string().optional(),
2602
+ status: z4.string().optional(),
2603
+ // Assign to a sub-project board. Validated to belong to `projectId` in the handler.
2604
+ subProjectId: z4.string().nullable().optional(),
2605
+ requestingUserId: z4.string().optional()
2550
2606
  });
2551
- var PostToProjectTaskChatRequestSchema = z3.object({
2552
- projectId: z3.string(),
2553
- taskId: z3.string(),
2554
- content: z3.string(),
2555
- requestingUserId: z3.string().optional()
2607
+ var UpdateProjectTaskRequestSchema = z4.object({
2608
+ projectId: z4.string(),
2609
+ taskId: z4.string(),
2610
+ title: z4.string().optional(),
2611
+ plan: z4.string().optional(),
2612
+ // Canonical risk level, or null to clear. Resolved to the project's
2613
+ // configured Risk row (by rank) in the handler.
2614
+ risk: riskLevelSchema.nullable().optional(),
2615
+ assignedUserId: z4.string().nullish(),
2616
+ // Move to a different sub-project board, or null to move to the parent board.
2617
+ // Validated to belong to `projectId` in the handler.
2618
+ subProjectId: z4.string().nullable().optional(),
2619
+ requestingUserId: z4.string().optional()
2620
+ }).strict().refine(
2621
+ (v) => v.title !== void 0 || v.plan !== void 0 || v.risk !== void 0 || v.assignedUserId !== void 0 || v.subProjectId !== void 0,
2622
+ {
2623
+ message: "update_task requires at least one field to change (title, plan, risk, assignedUserId, or subProjectId)"
2624
+ }
2625
+ );
2626
+ var TransitionProjectTaskStatusRequestSchema = z4.object({
2627
+ projectId: z4.string(),
2628
+ taskId: z4.string(),
2629
+ toStatus: z4.string(),
2630
+ expectedFromStatus: z4.string().optional(),
2631
+ // Optional raise-only risk to attempt alongside the transition
2632
+ // (approve → low, request_changes → medium by default).
2633
+ risk: riskLevelSchema.optional(),
2634
+ requestingUserId: z4.string().optional()
2556
2635
  });
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()
2636
+ var MoveProjectCardRequestSchema = z4.object({
2637
+ projectId: z4.string(),
2638
+ taskId: z4.string(),
2639
+ destinationProjectId: z4.string(),
2640
+ requestingUserId: z4.string().optional()
2562
2641
  });
2563
- var GetProjectTaskSessionsRequestSchema = z3.object({
2564
- projectId: z3.string(),
2565
- taskId: z3.string()
2642
+ var PostToProjectTaskChatRequestSchema = z4.object({
2643
+ projectId: z4.string(),
2644
+ taskId: z4.string(),
2645
+ content: z4.string(),
2646
+ requestingUserId: z4.string().optional()
2566
2647
  });
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()
2648
+ var GetProjectTaskCliRequestSchema = z4.object({
2649
+ projectId: z4.string(),
2650
+ taskId: z4.string(),
2651
+ limit: z4.number().int().positive().optional().default(50),
2652
+ source: z4.string().optional()
2585
2653
  });
2586
- var StopProjectBuildRequestSchema = z3.object({
2587
- projectId: z3.string(),
2588
- taskId: z3.string(),
2589
- requestingUserId: z3.string().optional()
2654
+ var GetProjectTaskSessionsRequestSchema = z4.object({
2655
+ projectId: z4.string(),
2656
+ taskId: z4.string()
2657
+ });
2658
+ var QueryProjectGcpLogsRequestSchema = z4.object({
2659
+ projectId: z4.string(),
2660
+ env: z4.enum(["prod", "dev", "claudespace"]).optional(),
2661
+ severity: z4.enum(["DEBUG", "INFO", "NOTICE", "WARNING", "ERROR", "CRITICAL", "ALERT", "EMERGENCY"]).optional(),
2662
+ services: z4.array(z4.string().min(1).max(200)).max(25).optional(),
2663
+ sqlInstances: z4.array(z4.string().min(1).max(200)).max(25).optional(),
2664
+ allServices: z4.boolean().optional(),
2665
+ search: z4.string().max(256).optional(),
2666
+ filter: z4.string().max(1e3).optional(),
2667
+ startTime: z4.string().optional(),
2668
+ endTime: z4.string().optional(),
2669
+ limit: z4.number().int().min(1).max(200).optional().default(50),
2670
+ pageToken: z4.string().max(4096).optional()
2671
+ });
2672
+ var StartProjectBuildRequestSchema = z4.object({
2673
+ projectId: z4.string(),
2674
+ taskId: z4.string(),
2675
+ requestingUserId: z4.string().optional()
2676
+ });
2677
+ var StopProjectBuildRequestSchema = z4.object({
2678
+ projectId: z4.string(),
2679
+ taskId: z4.string(),
2680
+ requestingUserId: z4.string().optional()
2590
2681
  });
2591
- var StartProjectWorkspaceRequestSchema = z3.object({
2592
- projectId: z3.string(),
2593
- requestingUserId: z3.string().optional()
2682
+ var StartProjectWorkspaceRequestSchema = z4.object({
2683
+ projectId: z4.string(),
2684
+ requestingUserId: z4.string().optional()
2594
2685
  });
2595
- var StopProjectWorkspaceRequestSchema = z3.object({
2596
- projectId: z3.string(),
2597
- destroy: z3.boolean().optional(),
2598
- requestingUserId: z3.string().optional()
2686
+ var StopProjectWorkspaceRequestSchema = z4.object({
2687
+ projectId: z4.string(),
2688
+ destroy: z4.boolean().optional(),
2689
+ requestingUserId: z4.string().optional()
2599
2690
  });
2600
- var ListMyLiveSessionsRequestSchema = z3.object({
2601
- projectId: z3.string(),
2691
+ var ListMyLiveSessionsRequestSchema = z4.object({
2692
+ projectId: z4.string(),
2602
2693
  /** Admin-only: list another member's sessions instead of the caller's. */
2603
- targetUserId: z3.string().optional()
2694
+ targetUserId: z4.string().optional()
2604
2695
  });
2605
- var ListProjectSessionGroupsRequestSchema = z3.object({
2606
- projectId: z3.string()
2696
+ var ListProjectSessionGroupsRequestSchema = z4.object({
2697
+ projectId: z4.string()
2607
2698
  });
2608
- var GetProjectAvailableTuisRequestSchema = z3.object({
2609
- projectId: z3.string()
2699
+ var GetProjectAvailableTuisRequestSchema = z4.object({
2700
+ projectId: z4.string()
2610
2701
  });
2611
- var StartAdhocSessionRequestSchema = z3.object({
2612
- projectId: z3.string(),
2613
- label: z3.string().max(200).optional(),
2702
+ var StartAdhocSessionRequestSchema = z4.object({
2703
+ projectId: z4.string(),
2704
+ label: z4.string().max(200).optional(),
2614
2705
  /** Coding-agent key to launch under — validated pick-time (ownership + TUI availability) in the handler. */
2615
- codingAgentKeyId: z3.string().optional(),
2706
+ codingAgentKeyId: z4.string().optional(),
2707
+ /** Model override (Claude model id) — overrides the launch key's own model. */
2708
+ model: z4.string().max(200).optional(),
2616
2709
  /**
2617
2710
  * Session role. Constrained: other task-less modes fall through to the pm
2618
2711
  * runner in the pod entrypoint, and "review" would crash without a task.
2619
2712
  */
2620
- mode: z3.enum(["adhoc", "pm"]).optional(),
2713
+ mode: z4.enum(["adhoc", "pm"]).optional(),
2621
2714
  /** 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()
2715
+ branch: z4.string().max(300).optional(),
2716
+ requestingUserId: z4.string().optional()
2645
2717
  });
2646
- var ListProjectSubtasksRequestSchema = z3.object({
2647
- projectId: z3.string(),
2648
- taskId: z3.string()
2718
+ var StopAdhocSessionRequestSchema = z4.object({
2719
+ projectId: z4.string(),
2720
+ workspaceId: z4.string(),
2721
+ destroy: z4.boolean().optional(),
2722
+ requestingUserId: z4.string().optional()
2649
2723
  });
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(),
2724
+ var ResumeAdhocSessionRequestSchema = z4.object({
2725
+ projectId: z4.string(),
2726
+ workspaceId: z4.string(),
2727
+ requestingUserId: z4.string().optional()
2728
+ });
2729
+ var CreateProjectReleaseRequestSchema = z4.object({
2730
+ projectId: z4.string(),
2731
+ taskIds: z4.array(z4.string()).optional(),
2732
+ requestingUserId: z4.string().optional()
2733
+ });
2734
+ var ApproveProjectMergePRRequestSchema = z4.object({
2735
+ projectId: z4.string(),
2736
+ childTaskId: z4.string(),
2737
+ requestingUserId: z4.string().optional()
2738
+ });
2739
+ var ListProjectSubtasksRequestSchema = z4.object({
2740
+ projectId: z4.string(),
2741
+ taskId: z4.string()
2742
+ });
2743
+ var CreateProjectSubtaskRequestSchema = z4.object({
2744
+ projectId: z4.string(),
2745
+ parentTaskId: z4.string(),
2746
+ title: z4.string().min(1),
2747
+ description: z4.string().optional(),
2748
+ plan: z4.string().optional(),
2749
+ ordinal: z4.number().int().nonnegative().optional(),
2750
+ storyPointValue: z4.number().int().positive().optional(),
2751
+ followParentStatus: z4.boolean().optional(),
2659
2752
  /** Sibling subtask ids or slugs this subtask blocks on (explicit dependency
2660
2753
  * 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()
2754
+ dependsOn: z4.array(z4.string().min(1)).max(32).optional(),
2755
+ requestingUserId: z4.string().optional()
2663
2756
  });
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()
2757
+ var UpdateProjectSubtaskRequestSchema = z4.object({
2758
+ projectId: z4.string(),
2759
+ subtaskId: z4.string(),
2760
+ title: z4.string().optional(),
2761
+ description: z4.string().optional(),
2762
+ plan: z4.string().optional(),
2763
+ status: z4.string().optional(),
2764
+ ordinal: z4.number().int().nonnegative().optional(),
2765
+ storyPointValue: z4.number().int().positive().optional(),
2766
+ followParentStatus: z4.boolean().optional(),
2767
+ requestingUserId: z4.string().optional()
2675
2768
  });
2676
- var DeleteProjectSubtaskRequestSchema = z3.object({
2677
- projectId: z3.string(),
2678
- subtaskId: z3.string(),
2679
- requestingUserId: z3.string().optional()
2769
+ var DeleteProjectSubtaskRequestSchema = z4.object({
2770
+ projectId: z4.string(),
2771
+ subtaskId: z4.string(),
2772
+ requestingUserId: z4.string().optional()
2680
2773
  });
2681
- var GetProjectTaskChatRequestSchema = z3.object({
2682
- projectId: z3.string(),
2683
- taskId: z3.string(),
2684
- limit: z3.number().int().positive().optional().default(20)
2774
+ var GetProjectTaskChatRequestSchema = z4.object({
2775
+ projectId: z4.string(),
2776
+ taskId: z4.string(),
2777
+ limit: z4.number().int().positive().optional().default(20)
2685
2778
  });
2686
- var AddProjectTaskDependencyRequestSchema = z3.object({
2687
- projectId: z3.string(),
2688
- taskId: z3.string(),
2689
- dependsOnSlugOrId: z3.string(),
2690
- requestingUserId: z3.string().optional()
2779
+ var AddProjectTaskDependencyRequestSchema = z4.object({
2780
+ projectId: z4.string(),
2781
+ taskId: z4.string(),
2782
+ dependsOnSlugOrId: z4.string(),
2783
+ requestingUserId: z4.string().optional()
2691
2784
  });
2692
- var RemoveProjectTaskDependencyRequestSchema = z3.object({
2693
- projectId: z3.string(),
2694
- taskId: z3.string(),
2695
- dependsOnSlugOrId: z3.string(),
2696
- requestingUserId: z3.string().optional()
2785
+ var RemoveProjectTaskDependencyRequestSchema = z4.object({
2786
+ projectId: z4.string(),
2787
+ taskId: z4.string(),
2788
+ dependsOnSlugOrId: z4.string(),
2789
+ requestingUserId: z4.string().optional()
2697
2790
  });
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()
2791
+ var VoteProjectSuggestionRequestSchema = z4.object({
2792
+ projectId: z4.string(),
2793
+ suggestionId: z4.string(),
2794
+ value: z4.union([z4.literal(1), z4.literal(-1)]),
2795
+ requestingUserId: z4.string().optional()
2703
2796
  });
2704
- var GetProjectTaskDependenciesRequestSchema = z3.object({
2705
- projectId: z3.string(),
2706
- taskId: z3.string()
2797
+ var GetProjectTaskDependenciesRequestSchema = z4.object({
2798
+ projectId: z4.string(),
2799
+ taskId: z4.string()
2707
2800
  });
2708
- var ListProjectTaskFilesRequestSchema = z3.object({
2709
- projectId: z3.string(),
2710
- taskId: z3.string()
2801
+ var ListProjectTaskFilesRequestSchema = z4.object({
2802
+ projectId: z4.string(),
2803
+ taskId: z4.string()
2711
2804
  });
2712
- var GetProjectAttachmentRequestSchema = z3.object({
2713
- projectId: z3.string(),
2714
- taskId: z3.string(),
2715
- fileId: z3.string(),
2805
+ var GetProjectAttachmentRequestSchema = z4.object({
2806
+ projectId: z4.string(),
2807
+ taskId: z4.string(),
2808
+ fileId: z4.string(),
2716
2809
  /** Byte offset into text content (paging large logs/JSON). Default 0. */
2717
- offset: z3.number().int().nonnegative().optional(),
2810
+ offset: z4.number().int().nonnegative().optional(),
2718
2811
  /** Max bytes of text content to return from `offset`. Server default applies. */
2719
- maxBytes: z3.number().int().positive().optional()
2812
+ maxBytes: z4.number().int().positive().optional()
2720
2813
  });
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()
2814
+ var RequestProjectFileUploadRequestSchema = z4.object({
2815
+ projectId: z4.string(),
2816
+ taskId: z4.string(),
2817
+ fileName: z4.string().min(1).max(255),
2818
+ mimeType: z4.string().min(1).max(128),
2819
+ fileSize: z4.number().int().positive().max(MAX_FILE_SIZE_BYTES),
2820
+ requestingUserId: z4.string().optional()
2728
2821
  });
2729
- var ConfirmProjectFileUploadRequestSchema = z3.object({
2730
- projectId: z3.string(),
2731
- taskId: z3.string(),
2732
- fileId: z3.string(),
2822
+ var ConfirmProjectFileUploadRequestSchema = z4.object({
2823
+ projectId: z4.string(),
2824
+ taskId: z4.string(),
2825
+ fileId: z4.string(),
2733
2826
  /** 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()
2827
+ comment: z4.string().max(2e3).optional(),
2828
+ requestingUserId: z4.string().optional()
2769
2829
  });
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()
2830
+ var CreateProjectPullRequestRequestSchema = z4.object({
2831
+ projectId: z4.string(),
2832
+ taskId: z4.string(),
2833
+ title: z4.string().min(1),
2834
+ body: z4.string(),
2835
+ head: z4.string().optional(),
2836
+ base: z4.string().optional(),
2837
+ requestingUserId: z4.string().optional()
2775
2838
  });
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()
2839
+ var ListProjectMembersRequestSchema = z4.object({
2840
+ projectId: z4.string()
2782
2841
  });
2783
- var RemoveProjectManualTestRequestSchema = z3.object({
2784
- projectId: z3.string(),
2785
- taskId: z3.string(),
2786
- title: z3.string().min(1),
2787
- requestingUserId: z3.string().optional()
2842
+ var AddProjectTaskReviewerRequestSchema = z4.object({
2843
+ projectId: z4.string(),
2844
+ taskId: z4.string(),
2845
+ userId: z4.string(),
2846
+ requestingUserId: z4.string().optional()
2788
2847
  });
2789
- var ApproveProjectManualTestRequestSchema = z3.object({
2790
- projectId: z3.string(),
2791
- taskId: z3.string(),
2792
- title: z3.string().min(1),
2793
- requestingUserId: z3.string().optional()
2848
+ var RemoveProjectTaskReviewerRequestSchema = z4.object({
2849
+ projectId: z4.string(),
2850
+ taskId: z4.string(),
2851
+ userId: z4.string(),
2852
+ requestingUserId: z4.string().optional()
2794
2853
  });
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()
2854
+ var ListProjectManualTestsRequestSchema = z4.object({
2855
+ projectId: z4.string(),
2856
+ taskId: z4.string()
2801
2857
  });
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()
2858
+ var QueryProjectManualTestsRequestSchema = z4.object({
2859
+ projectId: z4.string(),
2860
+ cardStatuses: z4.array(z4.string()).optional(),
2861
+ testStatuses: z4.array(z4.enum(["open", "approved", "rejected"])).optional()
2808
2862
  });
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()
2863
+ var SetProjectManualTestsRequestSchema = z4.object({
2864
+ projectId: z4.string(),
2865
+ taskId: z4.string(),
2866
+ items: z4.array(z4.object({ title: z4.string().min(1) })).min(1),
2867
+ requestingUserId: z4.string().optional()
2813
2868
  });
2814
- var hexColor = z4.string().regex(/^#[0-9a-fA-F]{6}$/, "Expected #RRGGBB hex color");
2815
- var CreateProjectTagRequestSchema = z4.object({
2869
+ var EditProjectManualTestRequestSchema = z4.object({
2816
2870
  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(),
2871
+ taskId: z4.string(),
2872
+ title: z4.string().min(1),
2873
+ newTitle: z4.string().min(1),
2821
2874
  requestingUserId: z4.string().optional()
2822
2875
  });
2823
- var UpdateProjectTagRequestSchema = z4.object({
2876
+ var RemoveProjectManualTestRequestSchema = z4.object({
2824
2877
  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(),
2878
+ taskId: z4.string(),
2879
+ title: z4.string().min(1),
2831
2880
  requestingUserId: z4.string().optional()
2832
2881
  });
2833
- var PostToProjectChatRequestSchema = z4.object({
2882
+ var ApproveProjectManualTestRequestSchema = z4.object({
2834
2883
  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()
2884
+ taskId: z4.string(),
2885
+ title: z4.string().min(1),
2886
+ requestingUserId: z4.string().optional()
2839
2887
  });
2840
- var StartTagAuditRequestSchema = z4.object({
2888
+ var RejectProjectManualTestRequestSchema = z4.object({
2841
2889
  projectId: z4.string(),
2890
+ taskId: z4.string(),
2891
+ title: z4.string().min(1),
2892
+ reason: z4.string().min(1).max(2e3),
2842
2893
  requestingUserId: z4.string().optional()
2843
2894
  });
2844
- var StartTaskAuditRequestSchema = z4.object({
2895
+ var CreateProjectSuggestionRequestSchema = z4.object({
2845
2896
  projectId: z4.string(),
2846
- taskIds: z4.array(z4.string()).min(1).max(20),
2897
+ title: z4.string().min(1),
2898
+ description: z4.string().optional(),
2899
+ tagNames: z4.array(z4.string()).optional(),
2847
2900
  requestingUserId: z4.string().optional()
2848
2901
  });
2849
- var GetActiveAuditSessionsRequestSchema = z4.object({
2850
- projectId: z4.string()
2902
+ var ProjectTagContextPathSchema = z5.object({
2903
+ type: z5.enum(["rule", "doc", "file", "folder"]),
2904
+ path: z5.string().min(1).max(500),
2905
+ label: z5.string().max(100).optional()
2851
2906
  });
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()
2907
+ var hexColor = z5.string().regex(/^#[0-9a-fA-F]{6}$/, "Expected #RRGGBB hex color");
2908
+ var CreateProjectTagRequestSchema = z5.object({
2909
+ projectId: z5.string(),
2910
+ name: z5.string().min(1).max(50),
2911
+ color: hexColor.optional(),
2912
+ description: z5.string().max(500).optional(),
2913
+ contextPaths: z5.array(ProjectTagContextPathSchema).max(20).optional(),
2914
+ requestingUserId: z5.string().optional()
2915
+ });
2916
+ var UpdateProjectTagRequestSchema = z5.object({
2917
+ projectId: z5.string(),
2918
+ tagId: z5.string(),
2919
+ name: z5.string().min(1).max(50).optional(),
2920
+ color: hexColor.optional(),
2921
+ description: z5.string().max(500).optional(),
2922
+ /** Full replacement of the tag's context links when provided. */
2923
+ contextPaths: z5.array(ProjectTagContextPathSchema).max(20).optional(),
2924
+ requestingUserId: z5.string().optional()
2925
+ });
2926
+ var PostToProjectChatRequestSchema = z5.object({
2927
+ projectId: z5.string(),
2928
+ content: z5.string().min(1).max(2e4),
2929
+ requestingUserId: z5.string().optional(),
2930
+ /** Marks the post so the server can persist it beyond chat (tag-audit summaries land in tag history). */
2931
+ kind: z5.enum(["tag_audit_summary"]).optional()
2932
+ });
2933
+ var StartTagAuditRequestSchema = z5.object({
2934
+ projectId: z5.string(),
2935
+ requestingUserId: z5.string().optional()
2936
+ });
2937
+ var StartTaskAuditRequestSchema = z5.object({
2938
+ projectId: z5.string(),
2939
+ taskIds: z5.array(z5.string()).min(1).max(20),
2940
+ requestingUserId: z5.string().optional()
2941
+ });
2942
+ var GetActiveAuditSessionsRequestSchema = z5.object({
2943
+ projectId: z5.string()
2944
+ });
2945
+ var ReportTaskAuditResultRequestSchema = z5.object({
2946
+ projectId: z5.string(),
2947
+ taskId: z5.string(),
2948
+ summary: z5.string(),
2949
+ turnGrades: z5.array(
2950
+ z5.object({
2951
+ turnIndex: z5.number(),
2952
+ phase: z5.enum(["planning", "building", "human"]),
2953
+ grade: z5.enum(["correct", "neutral", "blunder"]),
2954
+ reasoning: z5.string(),
2955
+ eventType: z5.string(),
2956
+ eventSummary: z5.string()
2864
2957
  })
2865
2958
  ),
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()
2959
+ planningAccuracy: z5.number().nullable(),
2960
+ buildingAccuracy: z5.number().nullable(),
2961
+ humanAccuracy: z5.number().nullable(),
2962
+ planningCorrect: z5.number(),
2963
+ planningNeutral: z5.number(),
2964
+ planningBlunder: z5.number(),
2965
+ buildingCorrect: z5.number(),
2966
+ buildingNeutral: z5.number(),
2967
+ buildingBlunder: z5.number(),
2968
+ humanCorrect: z5.number(),
2969
+ humanNeutral: z5.number(),
2970
+ humanBlunder: z5.number(),
2971
+ humanEvaluations: z5.array(
2972
+ z5.object({
2973
+ messageIndex: z5.number(),
2974
+ rating: z5.union([z5.literal(-1), z5.literal(0), z5.literal(1)]),
2975
+ reasoning: z5.string()
2883
2976
  })
2884
2977
  ).optional(),
2885
- suggestionIds: z4.array(z4.string()),
2886
- auditCostUsd: z4.number().nullable(),
2887
- model: z4.string().nullable(),
2978
+ suggestionIds: z5.array(z5.string()),
2979
+ auditCostUsd: z5.number().nullable(),
2980
+ model: z5.string().nullable(),
2888
2981
  /** When set, the audit is marked failed with this message instead. */
2889
- error: z4.string().optional()
2982
+ error: z5.string().optional()
2890
2983
  });
2891
- var GetTaskAuditsRequestSchema = z4.object({
2892
- projectId: z4.string(),
2893
- limit: z4.number().int().positive().max(200).optional().default(50)
2984
+ var GetTaskAuditsRequestSchema = z5.object({
2985
+ projectId: z5.string(),
2986
+ limit: z5.number().int().positive().max(200).optional().default(50)
2894
2987
  });
2895
- var GetTaskAuditRequestSchema = z4.object({
2896
- projectId: z4.string(),
2897
- auditId: z4.string()
2988
+ var GetTaskAuditRequestSchema = z5.object({
2989
+ projectId: z5.string(),
2990
+ auditId: z5.string()
2898
2991
  });
2899
- var GetTaskAuditAggregatesRequestSchema = z4.object({
2900
- projectId: z4.string()
2992
+ var GetTaskAuditAggregatesRequestSchema = z5.object({
2993
+ projectId: z5.string()
2901
2994
  });
2902
- var DeleteTaskAuditRequestSchema = z4.object({
2903
- projectId: z4.string(),
2904
- auditId: z4.string(),
2905
- requestingUserId: z4.string().optional()
2995
+ var DeleteTaskAuditRequestSchema = z5.object({
2996
+ projectId: z5.string(),
2997
+ auditId: z5.string(),
2998
+ requestingUserId: z5.string().optional()
2906
2999
  });
2907
- var MarkInitialPromptSubmittedRequestSchema = z4.object({
2908
- sessionId: z4.string()
3000
+ var MarkInitialPromptSubmittedRequestSchema = z5.object({
3001
+ sessionId: z5.string()
2909
3002
  });
2910
3003
  var AGENT_STATUS_REASON_USER_QUESTION = "user_question";
2911
3004
  var TASK_CHAT_HISTORY_LIMIT = 20;
@@ -4064,7 +4157,7 @@ var PtyOutputCoalescer = class {
4064
4157
 
4065
4158
  // src/harness/pty/tool-server.ts
4066
4159
  import { createServer as createServer2 } from "http";
4067
- import { z as z5 } from "zod";
4160
+ import { z as z6 } from "zod";
4068
4161
  import { writeFile as writeFile3 } from "fs/promises";
4069
4162
  import { join as join2 } from "path";
4070
4163
  import { randomBytes } from "crypto";
@@ -4121,7 +4214,7 @@ var PtyToolServer = class {
4121
4214
  const mcp = new McpServer({ name: this.name, version: "1.0.0" });
4122
4215
  const register = mcp.registerTool.bind(mcp);
4123
4216
  for (const tool2 of this.tools) {
4124
- const inputSchema = tool2.strict ? z5.strictObject(tool2.schema) : tool2.schema;
4217
+ const inputSchema = tool2.strict ? z6.strictObject(tool2.schema) : tool2.schema;
4125
4218
  register(
4126
4219
  tool2.name,
4127
4220
  {
@@ -6086,7 +6179,7 @@ function formatEntry(entry) {
6086
6179
  const suffix = entry.summary ? ` \u2014 ${entry.summary}` : "";
6087
6180
  return `- \`${entry.path}\`${suffix}`;
6088
6181
  }
6089
- function formatResolvedTags(resolved) {
6182
+ function formatResolvedTags(resolved, subProject) {
6090
6183
  const parts = [
6091
6184
  `
6092
6185
  ## Reference Guides (load on demand)`,
@@ -6101,50 +6194,69 @@ function formatResolvedTags(resolved) {
6101
6194
  parts.push(formatEntry(entry));
6102
6195
  }
6103
6196
  }
6197
+ if (subProject && subProject.entries.length > 0) {
6198
+ parts.push(`
6199
+ ### Sub-project: "${subProject.name}"`);
6200
+ for (const entry of subProject.entries) {
6201
+ parts.push(formatEntry(entry));
6202
+ }
6203
+ }
6104
6204
  return parts.join("\n");
6105
6205
  }
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 } };
6206
+ async function resolveEntries(contextPaths) {
6207
+ if (!contextPaths?.length) return [];
6208
+ const sorted = [...contextPaths].sort(
6209
+ (a, b) => (TYPE_PRIORITY[a.type] ?? 99) - (TYPE_PRIORITY[b.type] ?? 99)
6210
+ );
6211
+ const results = [];
6212
+ for (const entry of sorted) {
6213
+ results.push(await resolveEntry(entry));
6114
6214
  }
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
- }
6215
+ return results;
6216
+ }
6217
+ function countResolved(entries) {
6218
+ const injected = entries.filter((e) => e.summary !== null).length;
6219
+ return { injected, skipped: entries.length - injected };
6220
+ }
6221
+ async function resolveAssignedTags(assignedTags) {
6222
+ const resolved = [];
6223
+ let injected = 0;
6224
+ let skipped = 0;
6225
+ for (const tag of assignedTags) {
6226
+ const entries = await resolveEntries(tag.contextPaths);
6227
+ const counts = countResolved(entries);
6228
+ injected += counts.injected;
6229
+ skipped += counts.skipped;
6230
+ resolved.push({ tagName: tag.name, description: tag.description, entries });
6125
6231
  }
6126
- if (allEntries.length === 0) {
6232
+ return { resolved, injected, skipped };
6233
+ }
6234
+ async function resolveTagContext(projectTags, taskTagIds, _model, _betas, _runnerMode, subProject) {
6235
+ const taskTagIdSet = new Set(taskTagIds);
6236
+ const assignedTags = (projectTags ?? []).filter((t) => taskTagIdSet.has(t.id));
6237
+ const hasTagPaths = assignedTags.some((t) => t.contextPaths?.length);
6238
+ const hasSubProjectPaths = (subProject?.contextPaths?.length ?? 0) > 0;
6239
+ if (!hasTagPaths && !hasSubProjectPaths) {
6127
6240
  return { injectedSection: "", stats: { injected: 0, skipped: 0 } };
6128
6241
  }
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
- }
6242
+ const {
6243
+ resolved,
6244
+ injected: tagInjected,
6245
+ skipped: tagSkipped
6246
+ } = await resolveAssignedTags(assignedTags);
6247
+ let subProjectResolved = null;
6248
+ let subInjected = 0;
6249
+ let subSkipped = 0;
6250
+ if (subProject && hasSubProjectPaths) {
6251
+ const entries = await resolveEntries(subProject.contextPaths);
6252
+ const counts = countResolved(entries);
6253
+ subInjected = counts.injected;
6254
+ subSkipped = counts.skipped;
6255
+ subProjectResolved = { name: subProject.name, entries };
6144
6256
  }
6145
6257
  return {
6146
- injectedSection: formatResolvedTags(resolved),
6147
- stats: { injected, skipped }
6258
+ injectedSection: formatResolvedTags(resolved, subProjectResolved),
6259
+ stats: { injected: tagInjected + subInjected, skipped: tagSkipped + subSkipped }
6148
6260
  };
6149
6261
  }
6150
6262
 
@@ -6806,13 +6918,16 @@ Address the requested changes. Do NOT re-investigate the codebase from scratch o
6806
6918
  return parts.join("\n");
6807
6919
  }
6808
6920
  async function resolveTaskTagContext(context, runnerMode) {
6809
- if (!context.projectTags?.length || !context.taskTagIds?.length) return null;
6921
+ const hasTags = !!context.projectTags?.length && !!context.taskTagIds?.length;
6922
+ const hasSubProjectPaths = !!context.subProject?.contextPaths?.length;
6923
+ if (!hasTags && !hasSubProjectPaths) return null;
6810
6924
  const { injectedSection } = await resolveTagContext(
6811
6925
  context.projectTags,
6812
- context.taskTagIds,
6926
+ context.taskTagIds ?? [],
6813
6927
  context.model,
6814
6928
  context.agentSettings?.betas,
6815
- runnerMode
6929
+ runnerMode,
6930
+ context.subProject ?? null
6816
6931
  );
6817
6932
  return injectedSection || null;
6818
6933
  }
@@ -6825,6 +6940,16 @@ ${context.projectDescription}` : "";
6825
6940
  parts.push(`
6826
6941
  ## Project: ${context.projectName}${descLine}`);
6827
6942
  }
6943
+ if (context.subProject?.rootPath) {
6944
+ parts.push(
6945
+ `
6946
+ ## Sub-project scope: ${context.subProject.name}`,
6947
+ `This task belongs to the "${context.subProject.name}" sub-project, which owns \`${context.subProject.rootPath}\`.`,
6948
+ `- Read and reference the whole repository freely.`,
6949
+ `- Substantive code changes belong under \`${context.subProject.rootPath}\`. Trivial wiring elsewhere (exports, route registration) is fine when required.`,
6950
+ `- If the work genuinely requires substantive changes outside that folder, do NOT make them here \u2014 create a task on the parent project board (as part of a pack with this one) describing the needed change.`
6951
+ );
6952
+ }
6828
6953
  if (context.description) {
6829
6954
  parts.push(`
6830
6955
  ## Description
@@ -7104,7 +7229,7 @@ async function buildInitialPrompt(mode, context, isAuto, agentMode) {
7104
7229
  }
7105
7230
 
7106
7231
  // src/tools/task-context-tools.ts
7107
- import { z as z6 } from "zod";
7232
+ import { z as z7 } from "zod";
7108
7233
 
7109
7234
  // src/tools/helpers.ts
7110
7235
  function textResult(text) {
@@ -7138,8 +7263,8 @@ function buildReadTaskChatTool(connection) {
7138
7263
  "read_task_chat",
7139
7264
  "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
7265
  {
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.")
7266
+ limit: z7.number().optional().describe("Number of recent messages to fetch (default 20)"),
7267
+ task_id: z7.string().optional().describe("Child task ID to read chat from. Omit to read the current task's chat.")
7143
7268
  },
7144
7269
  async ({ limit, task_id }) => {
7145
7270
  try {
@@ -7183,7 +7308,7 @@ function buildGetTaskTool(connection) {
7183
7308
  "get_task",
7184
7309
  "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
7310
  {
7186
- slug_or_id: z6.string().describe("The task slug (e.g. 'my-task') or CUID")
7311
+ slug_or_id: z7.string().describe("The task slug (e.g. 'my-task') or CUID")
7187
7312
  },
7188
7313
  async ({ slug_or_id }) => {
7189
7314
  try {
@@ -7206,9 +7331,9 @@ function buildGetExecutionLogsTool(connection) {
7206
7331
  "get_execution_logs",
7207
7332
  "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
7333
  {
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).")
7334
+ task_id: z7.string().optional().describe("Task ID or slug. Omit to read logs from the current task."),
7335
+ source: z7.enum(["agent", "application"]).optional().describe("Filter by log source. Omit for all logs."),
7336
+ limit: z7.number().optional().describe("Max number of log entries to return (default 50, max 500).")
7212
7337
  },
7213
7338
  async ({ task_id, source, limit }) => {
7214
7339
  try {
@@ -7268,7 +7393,7 @@ function buildGetAttachmentTool(connection) {
7268
7393
  return defineTool(
7269
7394
  "get_attachment",
7270
7395
  "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") },
7396
+ { fileId: z7.string().describe("The file ID to retrieve") },
7272
7397
  async ({ fileId }) => {
7273
7398
  try {
7274
7399
  const file = await connection.call("getTaskFile", {
@@ -7306,7 +7431,7 @@ function buildTaskContextTools(connection) {
7306
7431
  }
7307
7432
 
7308
7433
  // src/tools/dependency-suggestion-tools.ts
7309
- import { z as z7 } from "zod";
7434
+ import { z as z8 } from "zod";
7310
7435
  function buildGetDependenciesTool(connection) {
7311
7436
  return defineTool(
7312
7437
  "get_dependencies",
@@ -7332,10 +7457,10 @@ function buildGetSuggestionsTool(connection) {
7332
7457
  "get_suggestions",
7333
7458
  "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
7459
  {
7335
- status: z7.string().optional().describe(
7460
+ status: z8.string().optional().describe(
7336
7461
  "Filter by status: Planning, Open, InProgress, ReviewPR, ReviewDev, ReviewLive, Complete, Cancelled"
7337
7462
  ),
7338
- limit: z7.number().int().min(1).max(100).optional().describe("Max results (default 20)")
7463
+ limit: z8.number().int().min(1).max(100).optional().describe("Max results (default 20)")
7339
7464
  },
7340
7465
  async ({ status, limit }) => {
7341
7466
  try {
@@ -7359,14 +7484,14 @@ function buildGetSuggestionsTool(connection) {
7359
7484
  }
7360
7485
 
7361
7486
  // src/tools/mutation-tools.ts
7362
- import { z as z8 } from "zod";
7487
+ import { z as z9 } from "zod";
7363
7488
  function buildPostToChatTool(connection) {
7364
7489
  return defineTool(
7365
7490
  "post_to_chat",
7366
7491
  "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
7492
  {
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.")
7493
+ message: z9.string().describe("The message to post to the team"),
7494
+ task_id: z9.string().optional().describe("Child task ID to post to. Omit to post to the current task's chat.")
7370
7495
  },
7371
7496
  async ({ message, task_id }) => {
7372
7497
  try {
@@ -7404,8 +7529,8 @@ function buildForceUpdateTaskStatusTool(connection) {
7404
7529
  "force_update_task_status",
7405
7530
  "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
7531
  {
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.")
7532
+ status: z9.enum(["InProgress", "ReviewPR", "ReviewDev", "Complete"]).describe("The new status for the task"),
7533
+ task_id: z9.string().optional().describe("Child task ID to update. Omit to update the current task.")
7409
7534
  },
7410
7535
  async ({ status, task_id }) => {
7411
7536
  try {
@@ -7436,18 +7561,18 @@ function buildCreatePullRequestTool(connection, config) {
7436
7561
  "create_pull_request",
7437
7562
  "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
7563
  {
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(
7564
+ title: z9.string().describe("The PR title"),
7565
+ body: z9.string().describe("The PR description/body in markdown"),
7566
+ branch: z9.string().optional().describe(
7442
7567
  "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
7568
  ),
7444
- baseBranch: z8.string().optional().describe(
7569
+ baseBranch: z9.string().optional().describe(
7445
7570
  "The base branch to target for the PR (e.g. 'main', 'develop'). Defaults to the project's configured dev branch."
7446
7571
  ),
7447
- commitMessage: z8.string().optional().describe(
7572
+ commitMessage: z9.string().optional().describe(
7448
7573
  "Commit message for staging uncommitted changes. If not provided, a default message based on the PR title will be used."
7449
7574
  ),
7450
- skipVerify: z8.boolean().optional().describe(
7575
+ skipVerify: z9.boolean().optional().describe(
7451
7576
  "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
7577
  )
7453
7578
  },
@@ -7529,7 +7654,7 @@ function buildAddDependencyTool(connection) {
7529
7654
  "add_dependency",
7530
7655
  "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
7656
  {
7532
- depends_on_slug_or_id: z8.string().describe("Slug or ID of the task this task depends on")
7657
+ depends_on_slug_or_id: z9.string().describe("Slug or ID of the task this task depends on")
7533
7658
  },
7534
7659
  async ({ depends_on_slug_or_id }) => {
7535
7660
  try {
@@ -7551,7 +7676,7 @@ function buildRemoveDependencyTool(connection) {
7551
7676
  "remove_dependency",
7552
7677
  "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
7678
  {
7554
- depends_on_slug_or_id: z8.string().describe("Slug or ID of the task to remove as dependency")
7679
+ depends_on_slug_or_id: z9.string().describe("Slug or ID of the task to remove as dependency")
7555
7680
  },
7556
7681
  async ({ depends_on_slug_or_id }) => {
7557
7682
  try {
@@ -7573,10 +7698,10 @@ function buildCreateFollowUpTaskTool(connection) {
7573
7698
  "create_follow_up_task",
7574
7699
  "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
7700
  {
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)")
7701
+ title: z9.string().describe("Follow-up task title"),
7702
+ description: z9.string().optional().describe("Brief description of the follow-up work"),
7703
+ plan: z9.string().optional().describe("Implementation plan if known"),
7704
+ story_point_value: z9.number().optional().describe("Story point estimate (1=Common, 2=Magic, 3=Rare, 5=Unique)")
7580
7705
  },
7581
7706
  async ({ title, description, plan, story_point_value }) => {
7582
7707
  try {
@@ -7603,11 +7728,11 @@ function buildCreateSuggestionTool(connection) {
7603
7728
  "create_suggestion",
7604
7729
  "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
7730
  {
7606
- title: z8.string().describe("Short title for the suggestion"),
7607
- description: z8.string().optional().describe(
7731
+ title: z9.string().describe("Short title for the suggestion"),
7732
+ description: z9.string().optional().describe(
7608
7733
  "1-2 sentence description of what should change and why. Keep concise and project-focused."
7609
7734
  ),
7610
- tag_names: z8.array(z8.string()).optional().describe("Tag names to categorize the suggestion")
7735
+ tag_names: z9.array(z9.string()).optional().describe("Tag names to categorize the suggestion")
7611
7736
  },
7612
7737
  async ({ title, description, tag_names }) => {
7613
7738
  try {
@@ -7636,8 +7761,8 @@ function buildVoteSuggestionTool(connection) {
7636
7761
  "vote_suggestion",
7637
7762
  "Vote +1 or -1 on a project suggestion. Use to express support or disagreement with a specific suggestion returned by get_suggestions.",
7638
7763
  {
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")
7764
+ suggestion_id: z9.string().describe("The suggestion ID to vote on"),
7765
+ value: z9.number().refine((v) => v === 1 || v === -1, { message: "Value must be 1 or -1" }).describe("+1 to upvote, -1 to downvote")
7641
7766
  },
7642
7767
  async ({ suggestion_id, value }) => {
7643
7768
  try {
@@ -7670,7 +7795,7 @@ function buildMutationTools(connection, config) {
7670
7795
  // src/tools/attachment-tools.ts
7671
7796
  import { readFile as readFile3, stat as stat4 } from "fs/promises";
7672
7797
  import { basename, extname, isAbsolute, join as join6 } from "path";
7673
- import { z as z9 } from "zod";
7798
+ import { z as z10 } from "zod";
7674
7799
  var IMAGE_MIME_BY_EXT = {
7675
7800
  ".png": "image/png",
7676
7801
  ".jpg": "image/jpeg",
@@ -7683,8 +7808,8 @@ function buildUploadAttachmentTool(connection, config) {
7683
7808
  "upload_attachment",
7684
7809
  "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
7810
  {
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)")
7811
+ path: z10.string().describe("Path to the image file \u2014 absolute, or relative to the workspace root"),
7812
+ title: z10.string().optional().describe("Short caption posted with the image (defaults to the file name)")
7688
7813
  },
7689
7814
  async ({ path: path4, title }) => {
7690
7815
  try {
@@ -7740,7 +7865,7 @@ function buildUploadAttachmentTool(connection, config) {
7740
7865
  }
7741
7866
 
7742
7867
  // src/tools/checklist-tools.ts
7743
- import { z as z10 } from "zod";
7868
+ import { z as z11 } from "zod";
7744
7869
  function buildListManualTestsTool(connection) {
7745
7870
  return defineTool(
7746
7871
  "list_manual_tests",
@@ -7792,8 +7917,8 @@ function buildQueryManualTestsTool(connection) {
7792
7917
  "query_manual_tests",
7793
7918
  "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
7919
  {
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")
7920
+ cardStatuses: z11.array(z11.string()).optional().describe('Filter tasks by card status, e.g. ["ReviewDev", "ReviewLive"]'),
7921
+ testStatuses: z11.array(z11.enum(["open", "approved", "rejected"])).optional().describe("Filter tests by status: open | approved | rejected")
7797
7922
  },
7798
7923
  async ({ cardStatuses, testStatuses }) => {
7799
7924
  try {
@@ -7817,7 +7942,7 @@ function buildSetManualTestsTool(connection) {
7817
7942
  "set_manual_tests",
7818
7943
  "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
7944
  {
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")
7945
+ 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
7946
  },
7822
7947
  async ({ items }) => {
7823
7948
  try {
@@ -7840,8 +7965,8 @@ function buildEditManualTestTool(connection) {
7840
7965
  "edit_manual_test",
7841
7966
  "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
7967
  {
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")
7968
+ title: z11.string().min(1).describe("The current title of the manual test to edit"),
7969
+ newTitle: z11.string().min(1).describe("The new title for the manual test")
7845
7970
  },
7846
7971
  async ({ title, newTitle }) => {
7847
7972
  try {
@@ -7863,7 +7988,7 @@ function buildRemoveManualTestTool(connection) {
7863
7988
  "remove_manual_test",
7864
7989
  "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
7990
  {
7866
- title: z10.string().min(1).describe("The title of the manual test to remove")
7991
+ title: z11.string().min(1).describe("The title of the manual test to remove")
7867
7992
  },
7868
7993
  async ({ title }) => {
7869
7994
  try {
@@ -7884,7 +8009,7 @@ function buildApproveManualTestTool(connection) {
7884
8009
  "approve_manual_test",
7885
8010
  "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
8011
  {
7887
- title: z10.string().min(1).describe("The title of the manual test to approve")
8012
+ title: z11.string().min(1).describe("The title of the manual test to approve")
7888
8013
  },
7889
8014
  async ({ title }) => {
7890
8015
  try {
@@ -7905,8 +8030,8 @@ function buildRejectManualTestTool(connection) {
7905
8030
  "reject_manual_test",
7906
8031
  "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
8032
  {
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")
8033
+ title: z11.string().min(1).describe("The title of the manual test to reject"),
8034
+ reason: z11.string().min(1).max(2e3).describe("Why the test failed \u2014 what went wrong, shown to the team")
7910
8035
  },
7911
8036
  async ({ title, reason }) => {
7912
8037
  try {
@@ -7943,7 +8068,7 @@ function buildCommonTools(connection, config) {
7943
8068
  }
7944
8069
 
7945
8070
  // src/tools/pm-tools.ts
7946
- import { z as z11 } from "zod";
8071
+ import { z as z12 } from "zod";
7947
8072
  var SP_DESCRIPTION = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
7948
8073
  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
8074
  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 +8077,8 @@ function buildUpdateTaskTool(connection) {
7952
8077
  "update_task_plan",
7953
8078
  "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
8079
  {
7955
- plan: z11.string().optional().describe("The task plan in markdown"),
7956
- description: z11.string().optional().describe("Updated task description")
8080
+ plan: z12.string().optional().describe("The task plan in markdown"),
8081
+ description: z12.string().optional().describe("Updated task description")
7957
8082
  },
7958
8083
  async ({ plan, description }) => {
7959
8084
  try {
@@ -7974,13 +8099,13 @@ function buildCreateSubtaskTool(connection) {
7974
8099
  "create_subtask",
7975
8100
  "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
8101
  {
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)
8102
+ title: z12.string().describe("Subtask title"),
8103
+ description: z12.string().optional().describe("Brief description"),
8104
+ plan: z12.string().optional().describe("Implementation plan in markdown"),
8105
+ ordinal: z12.number().optional().describe("Step/order number (0-based)"),
8106
+ storyPointValue: z12.number().optional().describe(SP_DESCRIPTION),
8107
+ followParentStatus: z12.boolean().optional().describe(FOLLOW_PARENT_STATUS_DESCRIPTION),
8108
+ dependsOn: z12.array(z12.string()).optional().describe(DEPENDS_ON_DESCRIPTION)
7984
8109
  },
7985
8110
  async ({
7986
8111
  title,
@@ -8016,20 +8141,20 @@ function buildUpdateSubtaskTool(connection) {
8016
8141
  "update_subtask",
8017
8142
  "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
8143
  {
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(
8144
+ subtaskId: z12.string().describe("The subtask ID to update"),
8145
+ title: z12.string().optional(),
8146
+ description: z12.string().optional(),
8147
+ plan: z12.string().optional(),
8148
+ status: z12.enum(["Planning", "Open"]).optional().describe(
8024
8149
  '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
8150
  ),
8026
- agentIdOrName: z11.string().optional().describe(
8151
+ agentIdOrName: z12.string().optional().describe(
8027
8152
  "Assign a project agent to the child (agent id or exact name from the Project Agents list). Required before start_child_cloud_build."
8028
8153
  ),
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(
8154
+ ordinal: z12.number().optional(),
8155
+ storyPointValue: z12.number().optional().describe(SP_DESCRIPTION),
8156
+ followParentStatus: z12.boolean().optional().describe(FOLLOW_PARENT_STATUS_DESCRIPTION),
8157
+ dependsOn: z12.array(z12.string()).optional().describe(
8033
8158
  `${DEPENDS_ON_DESCRIPTION} Replaces the full dependency set \u2014 pass [] to clear all, omit to leave unchanged.`
8034
8159
  )
8035
8160
  },
@@ -8068,7 +8193,7 @@ function buildDeleteSubtaskTool(connection) {
8068
8193
  return defineTool(
8069
8194
  "delete_subtask",
8070
8195
  "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") },
8196
+ { subtaskId: z12.string().describe("The subtask ID to delete") },
8072
8197
  async ({ subtaskId }) => {
8073
8198
  try {
8074
8199
  await connection.call("deleteSubtask", {
@@ -8087,7 +8212,7 @@ function buildListSubtasksTool(connection) {
8087
8212
  "list_subtasks",
8088
8213
  "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
8214
  {
8090
- verbose: z11.boolean().optional().describe(
8215
+ verbose: z12.boolean().optional().describe(
8091
8216
  "Return full task rows including description and plan text (large \u2014 can exceed tool result limits on big packs). Default: compact orchestration view."
8092
8217
  )
8093
8218
  },
@@ -8111,7 +8236,7 @@ function buildPackTools(connection) {
8111
8236
  "start_child_cloud_build",
8112
8237
  "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
8238
  {
8114
- childTaskId: z11.string().describe("The child task ID to start a cloud build for")
8239
+ childTaskId: z12.string().describe("The child task ID to start a cloud build for")
8115
8240
  },
8116
8241
  async ({ childTaskId }) => {
8117
8242
  try {
@@ -8131,7 +8256,7 @@ function buildPackTools(connection) {
8131
8256
  "stop_child_build",
8132
8257
  "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
8258
  {
8134
- childTaskId: z11.string().describe("The child task ID whose build should be stopped")
8259
+ childTaskId: z12.string().describe("The child task ID whose build should be stopped")
8135
8260
  },
8136
8261
  async ({ childTaskId }) => {
8137
8262
  try {
@@ -8151,7 +8276,7 @@ function buildPackTools(connection) {
8151
8276
  "approve_and_merge_pr",
8152
8277
  "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
8278
  {
8154
- childTaskId: z11.string().describe("The child task ID whose PR should be approved and merged")
8279
+ childTaskId: z12.string().describe("The child task ID whose PR should be approved and merged")
8155
8280
  },
8156
8281
  async ({ childTaskId }) => {
8157
8282
  try {
@@ -8189,7 +8314,7 @@ function buildPmTools(connection, options) {
8189
8314
  }
8190
8315
 
8191
8316
  // src/tools/discovery-tools.ts
8192
- import { z as z12 } from "zod";
8317
+ import { z as z13 } from "zod";
8193
8318
  var SP_DESCRIPTION2 = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique). The key is 'storyPointValue' \u2014 not 'storyPoints'.";
8194
8319
  var VALID_PROPERTY_KEYS = "title, storyPointValue, tagNames, githubPRUrl, githubBranch";
8195
8320
  function buildDiscoveryTools(connection) {
@@ -8198,11 +8323,11 @@ function buildDiscoveryTools(connection) {
8198
8323
  "update_task_properties",
8199
8324
  "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
8325
  {
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')")
8326
+ title: z13.string().optional().describe("The new task title"),
8327
+ storyPointValue: z13.number().optional().describe(SP_DESCRIPTION2),
8328
+ tagNames: z13.array(z13.string()).optional().describe("Array of tag names to assign"),
8329
+ githubPRUrl: z13.string().url().optional().describe("GitHub pull request URL to link to this task"),
8330
+ githubBranch: z13.string().optional().describe("Set the GitHub branch name for this task (e.g. 'conveyor/my-feature-abc123')")
8206
8331
  },
8207
8332
  async ({ title, storyPointValue, tagNames, githubPRUrl, githubBranch }) => {
8208
8333
  try {
@@ -8243,20 +8368,25 @@ function buildDiscoveryTools(connection) {
8243
8368
  }
8244
8369
 
8245
8370
  // src/tools/code-review-tools.ts
8246
- import { z as z13 } from "zod";
8371
+ import { z as z14 } from "zod";
8247
8372
  async function endReviewSession(connection, reason) {
8248
8373
  await connection.call("endReviewSession", {
8249
8374
  sessionId: connection.sessionId,
8250
8375
  reason
8251
8376
  });
8252
8377
  }
8378
+ function riskFromIssues(issues) {
8379
+ if (issues.some((i) => i.severity === "critical")) return "critical";
8380
+ if (issues.some((i) => i.severity === "major")) return "high";
8381
+ return "medium";
8382
+ }
8253
8383
  function buildCodeReviewTools(connection) {
8254
8384
  return [
8255
8385
  defineTool(
8256
8386
  "approve_code_review",
8257
8387
  "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
8388
  {
8259
- summary: z13.string().describe("Brief summary of what was reviewed and why it looks good")
8389
+ summary: z14.string().describe("Brief summary of what was reviewed and why it looks good")
8260
8390
  },
8261
8391
  async ({ summary }) => {
8262
8392
  const content = `**Code Review: Approved** :white_check_mark:
@@ -8265,7 +8395,8 @@ ${summary}`;
8265
8395
  await connection.call("submitCodeReviewResult", {
8266
8396
  sessionId: connection.sessionId,
8267
8397
  approved: true,
8268
- content
8398
+ content,
8399
+ risk: "low"
8269
8400
  });
8270
8401
  connection.sendEvent({
8271
8402
  type: "code_review_complete",
@@ -8280,15 +8411,15 @@ ${summary}`;
8280
8411
  "request_code_changes",
8281
8412
  "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
8413
  {
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")
8414
+ issues: z14.array(
8415
+ z14.object({
8416
+ file: z14.string().describe("File path where the issue was found"),
8417
+ line: z14.number().optional().describe("Line number (if applicable)"),
8418
+ severity: z14.enum(["critical", "major", "minor"]).describe("Issue severity"),
8419
+ description: z14.string().describe("What is wrong and how to fix it")
8289
8420
  })
8290
8421
  ).describe("List of issues found during review"),
8291
- summary: z13.string().describe("Brief overall summary of the review findings")
8422
+ summary: z14.string().describe("Brief overall summary of the review findings")
8292
8423
  },
8293
8424
  async ({ issues, summary }) => {
8294
8425
  const issueLines = issues.map((issue) => {
@@ -8303,7 +8434,8 @@ ${issueLines}`;
8303
8434
  await connection.call("submitCodeReviewResult", {
8304
8435
  sessionId: connection.sessionId,
8305
8436
  approved: false,
8306
- content
8437
+ content,
8438
+ risk: riskFromIssues(issues)
8307
8439
  });
8308
8440
  connection.sendEvent({
8309
8441
  type: "code_review_complete",
@@ -10153,6 +10285,93 @@ function readAgentVersion() {
10153
10285
  // src/execution/usage-sampler.ts
10154
10286
  import { existsSync as existsSync3 } from "fs";
10155
10287
 
10288
+ // src/usage/reset-parse.ts
10289
+ var MONTHS = ["jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec"];
10290
+ function tzOffsetMs(utcMs, tz) {
10291
+ const dtf = new Intl.DateTimeFormat("en-US", {
10292
+ timeZone: tz,
10293
+ hour12: false,
10294
+ year: "numeric",
10295
+ month: "2-digit",
10296
+ day: "2-digit",
10297
+ hour: "2-digit",
10298
+ minute: "2-digit",
10299
+ second: "2-digit"
10300
+ });
10301
+ const map = {};
10302
+ for (const part of dtf.formatToParts(new Date(utcMs))) {
10303
+ if (part.type !== "literal") map[part.type] = part.value;
10304
+ }
10305
+ const hour = map.hour === "24" ? 0 : Number(map.hour);
10306
+ const asUtc = Date.UTC(
10307
+ Number(map.year),
10308
+ Number(map.month) - 1,
10309
+ Number(map.day),
10310
+ hour,
10311
+ Number(map.minute),
10312
+ Number(map.second)
10313
+ );
10314
+ return asUtc - utcMs;
10315
+ }
10316
+ function zonedWallClockToUtc(y, mo, d, h, mi, tz) {
10317
+ if (tz === "UTC" || tz === "Etc/UTC") return Date.UTC(y, mo, d, h, mi);
10318
+ const naiveUtc = Date.UTC(y, mo, d, h, mi);
10319
+ const firstGuess = naiveUtc - tzOffsetMs(naiveUtc, tz);
10320
+ return naiveUtc - tzOffsetMs(firstGuess, tz);
10321
+ }
10322
+ function localTimeZone() {
10323
+ try {
10324
+ return Intl.DateTimeFormat().resolvedOptions().timeZone || "UTC";
10325
+ } catch {
10326
+ return "UTC";
10327
+ }
10328
+ }
10329
+ function parseResetInstant(rowText, now, defaultTz = localTimeZone()) {
10330
+ const m = /resets\s+(?:by\s+)?(?:([a-z]{3})\s+(\d{1,2})(?:,|\s+at)?\s+)?(\d{1,2})(?::(\d{2}))?\s*(am|pm)(?:\s*\(([^)]+)\))?/i.exec(
10331
+ rowText
10332
+ );
10333
+ if (!m) return null;
10334
+ const [, monStr, dayStr, hourStr, minStr, meridiem, tzRaw] = m;
10335
+ const tz = tzRaw ? tzRaw.trim() : defaultTz;
10336
+ let hour = Number(hourStr) % 12;
10337
+ if (/pm/i.test(meridiem)) hour += 12;
10338
+ const minute = minStr ? Number(minStr) : 0;
10339
+ const nowDate = new Date(now);
10340
+ try {
10341
+ if (monStr && dayStr) {
10342
+ const month = MONTHS.indexOf(monStr.toLowerCase());
10343
+ if (month < 0) return null;
10344
+ const day = Number(dayStr);
10345
+ let utc2 = zonedWallClockToUtc(nowDate.getUTCFullYear(), month, day, hour, minute, tz);
10346
+ if (utc2 < now - 24 * 60 * 60 * 1e3) {
10347
+ utc2 = zonedWallClockToUtc(nowDate.getUTCFullYear() + 1, month, day, hour, minute, tz);
10348
+ }
10349
+ return new Date(utc2).toISOString();
10350
+ }
10351
+ let utc = zonedWallClockToUtc(
10352
+ nowDate.getUTCFullYear(),
10353
+ nowDate.getUTCMonth(),
10354
+ nowDate.getUTCDate(),
10355
+ hour,
10356
+ minute,
10357
+ tz
10358
+ );
10359
+ if (utc <= now) {
10360
+ utc = zonedWallClockToUtc(
10361
+ nowDate.getUTCFullYear(),
10362
+ nowDate.getUTCMonth(),
10363
+ nowDate.getUTCDate() + 1,
10364
+ hour,
10365
+ minute,
10366
+ tz
10367
+ );
10368
+ }
10369
+ return new Date(utc).toISOString();
10370
+ } catch {
10371
+ return null;
10372
+ }
10373
+ }
10374
+
10156
10375
  // src/usage/parse-usage.ts
10157
10376
  var ESC = "\\u001b";
10158
10377
  var ANSI_CSI2 = new RegExp(`${ESC}\\[[0-9;?]*[ -/]*[@-~]`, "g");
@@ -10161,22 +10380,27 @@ var BAR_GLYPHS = /[─-▟]/g;
10161
10380
  function normalizeUsageText(stdout) {
10162
10381
  return stdout.replace(ANSI_CSI2, "").replace(ANSI_OSC, "").replace(BAR_GLYPHS, " ").replace(/\r/g, "");
10163
10382
  }
10164
- function parseUsageGauges(stdout) {
10383
+ function parseUsageGauges(stdout, now = Date.now(), defaultTz) {
10165
10384
  const text = normalizeUsageText(stdout);
10166
10385
  const rows = [
10167
10386
  ...text.matchAll(
10168
- /Current (session|week)\s*(\([^)\n]*\))?[^%\n]*?(\d+(?:\.\d+)?)\s*%(?:\s*used)?/gi
10387
+ /Current (session|week)\s*(\([^)\n]*\))?[^%\n]*?(\d+(?:\.\d+)?)\s*%(?:\s*used)?([^\n]*?)(?=Current\s+(?:session|week)\b|\n|$)/gi
10169
10388
  )
10170
10389
  ];
10171
10390
  const gauges = rows.map((m) => ({
10172
10391
  label: `Current ${m[1].toLowerCase()}${m[2] ? ` ${m[2]}` : ""}`,
10173
- utilization: Number(m[3]) / 100
10392
+ utilization: Number(m[3]) / 100,
10393
+ resetsAt: parseResetInstant(m[4] ?? "", now, defaultTz)
10174
10394
  }));
10175
10395
  const session = gauges.find((g) => g.label.startsWith("Current session"));
10176
10396
  const weekly = gauges.filter((g) => g.label.startsWith("Current week"));
10397
+ const weeklyResets = weekly.map((g) => g.resetsAt).filter((r) => r !== null);
10177
10398
  return {
10178
10399
  sessionUsage: session ? session.utilization : null,
10179
10400
  weeklyUsage: weekly.length ? Math.max(...weekly.map((g) => g.utilization)) : null,
10401
+ sessionResetsAt: session?.resetsAt ?? null,
10402
+ // Soonest weekly reset (all weekly rows share one instant in practice).
10403
+ weeklyResetsAt: weeklyResets.length ? new Date(Math.min(...weeklyResets.map((r) => new Date(r).getTime()))).toISOString() : null,
10180
10404
  gauges
10181
10405
  };
10182
10406
  }
@@ -10311,13 +10535,14 @@ async function sampleKeyUsage(token, probe = () => runUsageProbe(), hasSubscript
10311
10535
  return [];
10312
10536
  }
10313
10537
  const stdout = await probe();
10314
- const { sessionUsage, weeklyUsage, gauges } = parseUsageGauges(stdout);
10538
+ const { sessionUsage, weeklyUsage, sessionResetsAt, weeklyResetsAt, gauges } = parseUsageGauges(stdout);
10315
10539
  const samples = [];
10316
10540
  if (sessionUsage !== null) {
10317
10541
  samples.push({
10318
10542
  rateLimitType: "five_hour",
10319
10543
  utilization: sessionUsage,
10320
10544
  status: "allowed",
10545
+ resetsAt: sessionResetsAt,
10321
10546
  gauges
10322
10547
  });
10323
10548
  }
@@ -10326,6 +10551,7 @@ async function sampleKeyUsage(token, probe = () => runUsageProbe(), hasSubscript
10326
10551
  rateLimitType: "seven_day",
10327
10552
  utilization: weeklyUsage,
10328
10553
  status: "allowed",
10554
+ resetsAt: weeklyResetsAt,
10329
10555
  gauges
10330
10556
  });
10331
10557
  }
@@ -11294,6 +11520,7 @@ var SessionRunner = class _SessionRunner {
11294
11520
  rateLimitType: sample.rateLimitType,
11295
11521
  utilization: sample.utilization,
11296
11522
  status: sample.status,
11523
+ resetsAt: sample.resetsAt ?? void 0,
11297
11524
  gauges: sample.gauges
11298
11525
  });
11299
11526
  }
@@ -11834,4 +12061,4 @@ export {
11834
12061
  runStartCommand,
11835
12062
  unshallowRepo
11836
12063
  };
11837
- //# sourceMappingURL=chunk-K23F674K.js.map
12064
+ //# sourceMappingURL=chunk-NMZNCP66.js.map