@impulselab/hepha 0.2.661 → 0.2.663

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1963,6 +1963,7 @@ var HOST_TOOL_NAMES = {
1963
1963
  DATABASE_WRITE: "database_write",
1964
1964
  DETECT_PROJECT_DATABASE: "detect_project_database",
1965
1965
  BIND_PROJECT_DATABASE: "bind_project_database",
1966
+ REQUEST_DATABASE_URL: "request_database_url",
1966
1967
  // docs/integrations/provisioning.md
1967
1968
  PROVISION_SERVICE: "provision_service",
1968
1969
  // Historical: the agent-addressed family the tools above replaced. No agent
@@ -2065,93 +2066,6 @@ function toolActivityHostname(url) {
2065
2066
  }
2066
2067
  }
2067
2068
 
2068
- // ../../packages/agents/src/tool-activity/browser/browser-label.ts
2069
- function browserLabel(state, labels) {
2070
- if (state.hasFailed) return labelOnly(labels.failed);
2071
- return labelOnly(state.isRunning ? labels.running : labels.done);
2072
- }
2073
-
2074
- // ../../packages/agents/src/tool-activity/browser/browser-activity-constants.ts
2075
- var BROWSER_ACT_VERBS = Object.assign(/* @__PURE__ */ Object.create(null), {
2076
- click: { done: "Clicked", gerund: "Clicking", bare: "click" },
2077
- dblclick: {
2078
- done: "Double-clicked",
2079
- gerund: "Double-clicking",
2080
- bare: "double-click"
2081
- },
2082
- fill: { done: "Filled", gerund: "Filling", bare: "fill" },
2083
- type: { done: "Typed into", gerund: "Typing into", bare: "type into" },
2084
- select: { done: "Selected in", gerund: "Selecting in", bare: "select in" },
2085
- check: { done: "Checked", gerund: "Checking", bare: "check" },
2086
- uncheck: { done: "Unchecked", gerund: "Unchecking", bare: "uncheck" },
2087
- hover: { done: "Hovered", gerund: "Hovering", bare: "hover" },
2088
- press: {
2089
- done: "Pressed a key on",
2090
- gerund: "Pressing a key on",
2091
- bare: "press a key on"
2092
- },
2093
- scroll: { done: "Scrolled", gerund: "Scrolling", bare: "scroll" },
2094
- upload: {
2095
- done: "Uploaded a file to",
2096
- gerund: "Uploading a file to",
2097
- bare: "upload a file to"
2098
- }
2099
- });
2100
- var BROWSER_HISTORY_LABELS = Object.assign(/* @__PURE__ */ Object.create(null), {
2101
- back: { done: "Went back", gerund: "Going back", bare: "go back" },
2102
- forward: {
2103
- done: "Went forward",
2104
- gerund: "Going forward",
2105
- bare: "go forward"
2106
- },
2107
- reload: {
2108
- done: "Reloaded the page",
2109
- gerund: "Reloading the page",
2110
- bare: "reload the page"
2111
- }
2112
- });
2113
-
2114
- // ../../packages/agents/src/tool-activity/browser/describe-browser-act.ts
2115
- function describeBrowserAct(record, state) {
2116
- const action = toolInput.str(record.action) ?? "click";
2117
- const verb = (Object.hasOwn(BROWSER_ACT_VERBS, action) ? BROWSER_ACT_VERBS[action] : void 0) ?? {
2118
- done: "Acted on",
2119
- gerund: "Acting on",
2120
- bare: "act on"
2121
- };
2122
- const target = toolInput.trimmed(record.name) ?? toolInput.trimmed(record.selector) ?? toolInput.trimmed(record.ref) ?? toolInput.trimmed(record.role);
2123
- const subject = target ? toolInput.truncate(target, 60) : "an element";
2124
- return browserLabel(state, {
2125
- failed: `Could not ${verb.bare} ${subject}`,
2126
- running: `${verb.gerund} ${subject}`,
2127
- done: `${verb.done} ${subject}`
2128
- });
2129
- }
2130
-
2131
- // ../../packages/agents/src/tool-activity/browser/describe-browser-navigate.ts
2132
- function describeBrowserNavigate(record, state) {
2133
- const action = toolInput.str(record.action);
2134
- if (action && action !== "goto") {
2135
- const move = Object.hasOwn(BROWSER_HISTORY_LABELS, action) ? BROWSER_HISTORY_LABELS[action] : void 0;
2136
- return move ? browserLabel(state, {
2137
- failed: `Could not ${move.bare}`,
2138
- running: move.gerund,
2139
- done: move.done
2140
- }) : browserLabel(state, {
2141
- failed: "Could not move in the browser",
2142
- running: "Moving in the browser",
2143
- done: "Moved in the browser"
2144
- });
2145
- }
2146
- const host = toolActivityHostname(toolInput.str(record.url));
2147
- const subject = host ?? "a page";
2148
- return browserLabel(state, {
2149
- failed: `Could not open ${subject}`,
2150
- running: `Opening ${subject}`,
2151
- done: `Opened ${subject}`
2152
- });
2153
- }
2154
-
2155
2069
  // ../../packages/agents/src/tool-activity/capture/capture-label.ts
2156
2070
  function captureLabel(labels, state, options) {
2157
2071
  if (options.isOption) {
@@ -2170,227 +2084,344 @@ function captureLabel(labels, state, options) {
2170
2084
  );
2171
2085
  }
2172
2086
 
2173
- // ../../packages/agents/src/tool-activity/capture/capture-target.ts
2174
- function captureTarget(url) {
2175
- if (!url) {
2176
- return void 0;
2087
+ // ../../packages/agents/src/tool-activity/capture/describe-annotate-image.ts
2088
+ function describeAnnotateImage(record, state) {
2089
+ return captureLabel(
2090
+ {
2091
+ optionFailed: "Failed to annotate a silent image",
2092
+ optionRunning: "Annotating a silent image",
2093
+ optionDone: "Annotated a silent image",
2094
+ failed: () => "Failed to annotate an image",
2095
+ running: () => "Annotating an image",
2096
+ done: () => "Annotated an image"
2097
+ },
2098
+ state,
2099
+ { isOption: record.silent === true, subject: null }
2100
+ );
2101
+ }
2102
+
2103
+ // ../../packages/core/src/source-scan/end-of-comment.ts
2104
+ function endOfComment(source, at) {
2105
+ if (source[at] !== "/") return at;
2106
+ if (source[at + 1] === "/") {
2107
+ const line = source.indexOf("\n", at);
2108
+ return line === -1 ? source.length : line - 1;
2177
2109
  }
2178
- try {
2179
- const parsed = new URL(url);
2180
- if (parsed.protocol === "file:") {
2181
- return toolActivityBasename(parsed.pathname) ?? url;
2110
+ if (source[at + 1] === "*") {
2111
+ const block = source.indexOf("*/", at + 2);
2112
+ return block === -1 ? source.length : block + 1;
2113
+ }
2114
+ return at;
2115
+ }
2116
+
2117
+ // ../../packages/core/src/source-scan/end-of-string-literal.ts
2118
+ function endOfStringLiteral(source, open) {
2119
+ const quote = source[open];
2120
+ for (let at = open + 1; at < source.length; at += 1) {
2121
+ if (source[at] === "\\") at += 1;
2122
+ else if (source[at] === quote) return at;
2123
+ }
2124
+ return source.length;
2125
+ }
2126
+
2127
+ // ../../packages/core/src/source-scan/end-of-skippable.ts
2128
+ function endOfSkippable(source, at) {
2129
+ const char = source[at];
2130
+ if (char === "'" || char === '"' || char === "`") {
2131
+ return endOfStringLiteral(source, at);
2132
+ }
2133
+ return endOfComment(source, at);
2134
+ }
2135
+
2136
+ // ../../packages/core/src/source-scan/end-of-object-literal.ts
2137
+ function endOfObjectLiteral(source, open) {
2138
+ let depth = 0;
2139
+ for (let at = open; at < source.length; at += 1) {
2140
+ const skipped = endOfSkippable(source, at);
2141
+ if (skipped !== at) {
2142
+ at = skipped;
2143
+ continue;
2182
2144
  }
2183
- return parsed.host || parsed.hostname;
2184
- } catch {
2185
- return toolActivityBasename(url) ?? url;
2145
+ if (source[at] === "{") depth += 1;
2146
+ else if (source[at] === "}" && (depth -= 1) === 0) return at + 1;
2186
2147
  }
2148
+ return -1;
2187
2149
  }
2188
2150
 
2189
- // ../../packages/agents/src/tool-activity/capture/capture-label-constants.ts
2190
- var CAPTURE_LABEL_MAX = 60;
2151
+ // ../../packages/core/src/source-scan/has-spread-in-code.ts
2152
+ function hasSpreadInCode(literal) {
2153
+ for (let at = 0; at < literal.length; at += 1) {
2154
+ const skipped = endOfSkippable(literal, at);
2155
+ if (skipped !== at) {
2156
+ at = skipped;
2157
+ continue;
2158
+ }
2159
+ if (literal.startsWith("...", at)) return true;
2160
+ }
2161
+ return false;
2162
+ }
2191
2163
 
2192
- // ../../packages/agents/src/tool-activity/capture/describe-take-screenshot.ts
2193
- function describeTakeScreenshot(record, state) {
2194
- const target = captureTarget(toolInput.str(record.url));
2195
- return captureLabel(
2196
- {
2197
- optionFailed: "Failed to take a silent screenshot",
2198
- optionRunning: "Taking a silent screenshot",
2199
- optionDone: "Took a silent screenshot",
2200
- failed: (subject) => subject ? `Failed to screenshot ${subject}` : "Failed to take a screenshot",
2201
- running: (subject) => subject ? `Taking a screenshot of ${subject}` : "Taking a screenshot",
2202
- done: (subject) => subject ? `Took a screenshot of ${subject}` : "Took a screenshot"
2203
- },
2204
- state,
2205
- {
2206
- isOption: record.silent === true,
2207
- subject: target ? toolInput.truncate(target, CAPTURE_LABEL_MAX) : null
2164
+ // ../../packages/core/src/source-scan/meta-declaration-open.ts
2165
+ function metaDeclarationOpen(script) {
2166
+ const anchor = /export[ \t]+const[ \t]+meta[ \t]*=\s*\{/y;
2167
+ let at = 0;
2168
+ while (at < script.length) {
2169
+ if (/\s/.test(script[at] ?? "")) {
2170
+ at += 1;
2171
+ continue;
2208
2172
  }
2209
- );
2173
+ const comment = endOfComment(script, at);
2174
+ if (comment !== at) {
2175
+ at = comment + 1;
2176
+ continue;
2177
+ }
2178
+ anchor.lastIndex = at;
2179
+ return anchor.test(script) ? script.indexOf("{", at) : -1;
2180
+ }
2181
+ return -1;
2210
2182
  }
2211
2183
 
2212
- // ../../packages/agents/src/tool-activity/browser/browser-tool-activity-describers.ts
2213
- var browserToolActivityDescribers = [
2214
- [HOST_TOOL_NAMES.BROWSER_NAVIGATE, describeBrowserNavigate],
2215
- [HOST_TOOL_NAMES.BROWSER_ACT, describeBrowserAct],
2216
- [
2217
- // The goal is the only thing worth reading: the steps are in the result.
2218
- HOST_TOOL_NAMES.BROWSER_AUTOPILOT,
2219
- (record, state) => {
2220
- const goal = toolInput.str(record.goal);
2221
- return browserLabel(state, {
2222
- failed: goal ? `Could not: ${goal}` : "Could not drive the browser",
2223
- running: goal ? `Driving the browser: ${goal}` : "Driving the browser",
2224
- done: goal ? `Drove the browser: ${goal}` : "Drove the browser"
2225
- });
2184
+ // ../../packages/core/src/source-scan/unescape-string-literal.ts
2185
+ function unescapeStringLiteral(body) {
2186
+ const single = {
2187
+ n: "\n",
2188
+ t: " ",
2189
+ r: "\r",
2190
+ b: "\b",
2191
+ f: "\f",
2192
+ v: "\v",
2193
+ "0": "\0"
2194
+ };
2195
+ return body.replace(
2196
+ /\\(u\{([0-9a-fA-F]+)\}|u([0-9a-fA-F]{4})|x([0-9a-fA-F]{2})|.)/gs,
2197
+ (_, escape, braced, unicode, hex) => {
2198
+ const code = braced ?? unicode ?? hex;
2199
+ if (code === void 0) return single[escape] ?? escape;
2200
+ const point = Number.parseInt(code, 16);
2201
+ return point <= 1114111 ? String.fromCodePoint(point) : `\\${escape}`;
2226
2202
  }
2227
- ],
2228
- [
2229
- HOST_TOOL_NAMES.BROWSER_SNAPSHOT,
2230
- (_record, state) => browserLabel(state, {
2231
- failed: "Could not read the page",
2232
- running: "Reading the page",
2233
- done: "Read the page"
2234
- })
2235
- ],
2236
- [
2237
- HOST_TOOL_NAMES.BROWSER_WAIT,
2238
- (_record, state) => browserLabel(state, {
2239
- failed: "Gave up waiting for the page",
2240
- running: "Waiting for the page",
2241
- done: "Waited for the page"
2242
- })
2243
- ],
2244
- [
2245
- HOST_TOOL_NAMES.BROWSER_INSPECT,
2246
- (_record, state) => browserLabel(state, {
2247
- failed: "Could not read the console and network",
2248
- running: "Reading the console and network",
2249
- done: "Read the console and network"
2250
- })
2251
- ],
2252
- [
2253
- HOST_TOOL_NAMES.BROWSER_SCREENSHOT,
2254
- (record, state) => describeTakeScreenshot(record, state)
2255
- ],
2256
- [
2257
- HOST_TOOL_NAMES.BROWSER_RECORD_START,
2258
- (_record, state) => browserLabel(state, {
2259
- failed: "Could not start recording",
2260
- running: "Starting a recording",
2261
- done: "Started recording the browser"
2262
- })
2263
- ],
2264
- [
2265
- HOST_TOOL_NAMES.BROWSER_RECORD_STOP,
2266
- (_record, state) => browserLabel(state, {
2267
- failed: "Could not finish the recording",
2268
- running: "Finishing the recording",
2269
- done: "Recorded the browser"
2270
- })
2271
- ],
2272
- [
2273
- HOST_TOOL_NAMES.BROWSER_CLOSE,
2274
- (_record, state) => browserLabel(state, {
2275
- failed: "Could not close the browser",
2276
- running: "Closing the browser",
2277
- done: "Closed the browser"
2278
- })
2279
- ],
2280
- [
2281
- HOST_TOOL_NAMES.BROWSER_SESSIONS_LIST,
2282
- (_record, state) => browserLabel(state, {
2283
- failed: "Could not read your captured logins",
2284
- running: "Listing your captured logins",
2285
- done: "Listed your captured logins"
2286
- })
2287
- ],
2288
- [
2289
- // The site, never what the vault holds for it.
2290
- HOST_TOOL_NAMES.BROWSER_USE_SESSION,
2291
- (record, state) => {
2292
- const domain = toolInput.str(record.domain);
2293
- return browserLabel(state, {
2294
- failed: domain ? `Could not sign in to ${domain} as you` : "Could not load a captured login",
2295
- running: domain ? `Signing in to ${domain} as you` : "Loading a captured login",
2296
- done: domain ? `Signed in to ${domain} as you` : "Loaded a captured login"
2297
- });
2203
+ );
2204
+ }
2205
+
2206
+ // ../../packages/core/src/source-scan/quoted-field-at.ts
2207
+ function quotedFieldAt(literal, at, field) {
2208
+ const key = /^(['"])?/.exec(literal.slice(at));
2209
+ const quoted = key?.[1] ?? "";
2210
+ const start = at + quoted.length;
2211
+ if (!literal.startsWith(field, start)) return void 0;
2212
+ if (!quoted && /[A-Za-z0-9_$]/.test(literal[at - 1] ?? "")) return void 0;
2213
+ const after = literal.slice(start + field.length);
2214
+ const opener = new RegExp(`^${quoted}\\s*:\\s*['"\`]`).exec(after);
2215
+ if (!opener) return void 0;
2216
+ const quote = start + field.length + opener[0].length - 1;
2217
+ const close = endOfStringLiteral(literal, quote);
2218
+ let tail = close + 1;
2219
+ for (; ; ) {
2220
+ while (/\s/.test(literal[tail] ?? "")) tail += 1;
2221
+ const skipped = endOfSkippable(literal, tail);
2222
+ if (skipped === tail) break;
2223
+ tail = skipped + 1;
2224
+ }
2225
+ if (literal[tail] !== "," && literal[tail] !== "}") return void 0;
2226
+ if (literal[quote] === "`" && /\$\{/.test(literal.slice(quote, close))) {
2227
+ return void 0;
2228
+ }
2229
+ return unescapeStringLiteral(literal.slice(quote + 1, close));
2230
+ }
2231
+
2232
+ // ../../packages/core/src/source-scan/top-level-string-field.ts
2233
+ function topLevelStringField(literal, field) {
2234
+ let depth = 0;
2235
+ let found;
2236
+ for (let at = 0; at < literal.length; at += 1) {
2237
+ if (depth === 1) {
2238
+ const value = quotedFieldAt(literal, at, field);
2239
+ if (value !== void 0) found = value;
2298
2240
  }
2299
- ],
2300
- [
2301
- HOST_TOOL_NAMES.BROWSER_FORGET_SESSION,
2302
- (_record, state) => browserLabel(state, {
2303
- failed: "Could not forget the captured logins",
2304
- running: "Forgetting the captured logins",
2305
- done: "Forgot the captured logins"
2306
- })
2307
- ],
2308
- [
2309
- HOST_TOOL_NAMES.REPL_EVAL,
2310
- (_record, state) => browserLabel(state, {
2311
- failed: "JavaScript in the REPL failed",
2312
- running: "Running JavaScript in the REPL",
2313
- done: "Ran JavaScript in the REPL"
2314
- })
2315
- ],
2316
- [
2317
- HOST_TOOL_NAMES.REPL_RESET,
2318
- (_record, state) => browserLabel(state, {
2319
- failed: "Could not reset the REPL",
2320
- running: "Resetting the REPL",
2321
- done: "Reset the REPL"
2322
- })
2323
- ]
2324
- ];
2241
+ const skipped = endOfSkippable(literal, at);
2242
+ if (skipped !== at) {
2243
+ at = skipped;
2244
+ continue;
2245
+ }
2246
+ const char = literal[at];
2247
+ if (char === "{" || char === "[") depth += 1;
2248
+ else if (char === "}" || char === "]") depth -= 1;
2249
+ }
2250
+ return found;
2251
+ }
2325
2252
 
2326
- // ../../packages/agents/src/tool-activity/design/design-tool-activity-describers.ts
2327
- var designToolActivityDescribers = [
2328
- [
2329
- HOST_TOOL_NAMES.PUBLISH_DESIGN,
2330
- (record) => {
2331
- const count = Array.isArray(record.directions) ? record.directions.length : 0;
2332
- return labelOnly(
2333
- count > 1 ? `Published ${count} design directions` : "Published a design"
2334
- );
2253
+ // ../../packages/core/src/source-scan/meta-name-in-script.ts
2254
+ function metaNameInScript(script) {
2255
+ const open = metaDeclarationOpen(script);
2256
+ if (open === -1) return void 0;
2257
+ const end = endOfObjectLiteral(script, open);
2258
+ if (end === -1) return void 0;
2259
+ const literal = script.slice(open, end);
2260
+ if (hasSpreadInCode(literal)) return void 0;
2261
+ const name = topLevelStringField(literal, "name");
2262
+ return name?.trim() && topLevelStringField(literal, "description")?.trim() ? name.slice(0, 80) : void 0;
2263
+ }
2264
+
2265
+ // ../../packages/agents/src/tool-activity/canonical/workflow-script-name.ts
2266
+ function workflowScriptName(script) {
2267
+ return metaNameInScript(script);
2268
+ }
2269
+
2270
+ // ../../packages/agents/src/tool-activity/canonical/describe-workflow.ts
2271
+ function describeWorkflow(record) {
2272
+ const name = workflowScriptName(toolInput.str(record.script) ?? "");
2273
+ return labelOnly(name ? `Ran workflow "${name}"` : "Ran a workflow");
2274
+ }
2275
+
2276
+ // ../../packages/agents/src/tool-activity/capture/capture-label-constants.ts
2277
+ var CAPTURE_LABEL_MAX = 60;
2278
+
2279
+ // ../../packages/agents/src/tool-activity/capture/describe-attach-image.ts
2280
+ function describeAttachImage(record, state) {
2281
+ const file = toolActivityBasename(toolInput.str(record.path));
2282
+ return captureLabel(
2283
+ {
2284
+ optionFailed: "Failed to attach a silent image",
2285
+ optionRunning: "Attaching a silent image",
2286
+ optionDone: "Attached a silent image",
2287
+ failed: (subject) => subject ? `Failed to attach ${subject}` : "Failed to attach an image",
2288
+ running: (subject) => subject ? `Attaching ${subject}` : "Attaching an image",
2289
+ done: (subject) => subject ? `Attached ${subject}` : "Attached an image"
2290
+ },
2291
+ state,
2292
+ {
2293
+ isOption: record.silent === true,
2294
+ subject: file ? toolInput.truncate(file, CAPTURE_LABEL_MAX) : null
2335
2295
  }
2336
- ],
2337
- [
2338
- HOST_TOOL_NAMES.SET_LIVE_DESIGN,
2339
- (record) => {
2340
- const version = toolInput.trimmed(record.version);
2341
- return labelOnly(
2342
- version ? `Pointed the design link at v${version}` : "Moved the design link"
2343
- );
2296
+ );
2297
+ }
2298
+
2299
+ // ../../packages/agents/src/tool-activity/capture/describe-generate-image.ts
2300
+ function describeGenerateImage(_record, state) {
2301
+ return captureLabel(
2302
+ {
2303
+ optionFailed: "Failed to generate an image",
2304
+ optionRunning: "Generating an image",
2305
+ optionDone: "Generated an image",
2306
+ failed: () => "Failed to generate an image",
2307
+ running: () => "Generating an image",
2308
+ done: () => "Generated an image"
2309
+ },
2310
+ state,
2311
+ { isOption: false, subject: null }
2312
+ );
2313
+ }
2314
+
2315
+ // ../../packages/agents/src/tool-activity/capture/capture-target.ts
2316
+ function captureTarget(url) {
2317
+ if (!url) {
2318
+ return void 0;
2319
+ }
2320
+ try {
2321
+ const parsed = new URL(url);
2322
+ if (parsed.protocol === "file:") {
2323
+ return toolActivityBasename(parsed.pathname) ?? url;
2344
2324
  }
2345
- ]
2346
- ];
2325
+ return parsed.host || parsed.hostname;
2326
+ } catch {
2327
+ return toolActivityBasename(url) ?? url;
2328
+ }
2329
+ }
2347
2330
 
2348
- // ../../packages/agents/src/tool-activity/slides/slides-tool-activity-describers.ts
2349
- var slidesToolActivityDescribers = [
2350
- [HOST_TOOL_NAMES.DECK_LIST, () => labelOnly("Listed the decks")],
2351
- [
2352
- HOST_TOOL_NAMES.DECK_CREATE,
2353
- (record) => {
2354
- const title = toolInput.trimmed(record.title);
2355
- return labelOnly(
2356
- title ? `Created the deck \u201C${title}\u201D` : "Created a deck"
2357
- );
2331
+ // ../../packages/agents/src/tool-activity/capture/describe-record-video.ts
2332
+ function describeRecordVideo(record, state) {
2333
+ const target = captureTarget(toolInput.str(record.url));
2334
+ return captureLabel(
2335
+ {
2336
+ // record_video has no option variant: a strip thumb is a still image.
2337
+ optionFailed: "Failed to record a video",
2338
+ optionRunning: "Recording a video",
2339
+ optionDone: "Recorded a video",
2340
+ failed: (subject) => subject ? `Failed to record a video of ${subject}` : "Failed to record a video",
2341
+ running: (subject) => subject ? `Recording a video of ${subject}` : "Recording a video",
2342
+ done: (subject) => subject ? `Recorded a video of ${subject}` : "Recorded a video"
2343
+ },
2344
+ state,
2345
+ {
2346
+ isOption: false,
2347
+ subject: target ? toolInput.truncate(target, CAPTURE_LABEL_MAX) : null
2358
2348
  }
2359
- ],
2360
- [HOST_TOOL_NAMES.DECK_READ, () => labelOnly("Read the deck")],
2361
- [
2362
- HOST_TOOL_NAMES.DECK_WRITE_SLIDE,
2363
- (record) => labelOnly(
2364
- toolInput.trimmed(record.slideId) ? "Rewrote a slide" : "Added a slide"
2365
- )
2366
- ],
2367
- [HOST_TOOL_NAMES.DECK_MOVE_SLIDE, () => labelOnly("Moved a slide")],
2368
- [HOST_TOOL_NAMES.DECK_DELETE_SLIDE, () => labelOnly("Deleted a slide")],
2369
- [HOST_TOOL_NAMES.DECK_RENDER, () => labelOnly("Rendered the deck")]
2370
- ];
2349
+ );
2350
+ }
2371
2351
 
2372
- // ../../packages/agents/src/tool-activity/video/video-tool-activity-describers.ts
2373
- var videoToolActivityDescribers = [
2374
- [HOST_TOOL_NAMES.VIDEO_LIST, () => labelOnly("Listed the videos")],
2375
- [HOST_TOOL_NAMES.VIDEO_CREATE, () => labelOnly("Created a video")],
2376
- [HOST_TOOL_NAMES.VIDEO_READ, () => labelOnly("Read the video")],
2377
- [
2378
- HOST_TOOL_NAMES.VIDEO_SOURCE_RESTORE,
2379
- () => labelOnly("Restored the video source")
2380
- ],
2381
- [HOST_TOOL_NAMES.VIDEO_PUBLISH, () => labelOnly("Published a video version")],
2382
- [HOST_TOOL_NAMES.GENERATE_VOICE, () => labelOnly("Generated narration")],
2383
- [HOST_TOOL_NAMES.GENERATE_MUSIC, () => labelOnly("Generated music")],
2384
- [
2385
- HOST_TOOL_NAMES.GENERATE_SOUND_EFFECT,
2386
- () => labelOnly("Generated a sound effect")
2387
- ],
2388
- [HOST_TOOL_NAMES.LIST_VOICES, () => labelOnly("Listed the voices")],
2389
- [HOST_TOOL_NAMES.VIDEO_SET_VOICES, () => labelOnly("Set the voices")]
2390
- ];
2352
+ // ../../packages/agents/src/tool-activity/capture/describe-take-screenshot.ts
2353
+ function describeTakeScreenshot(record, state) {
2354
+ const target = captureTarget(toolInput.str(record.url));
2355
+ return captureLabel(
2356
+ {
2357
+ optionFailed: "Failed to take a silent screenshot",
2358
+ optionRunning: "Taking a silent screenshot",
2359
+ optionDone: "Took a silent screenshot",
2360
+ failed: (subject) => subject ? `Failed to screenshot ${subject}` : "Failed to take a screenshot",
2361
+ running: (subject) => subject ? `Taking a screenshot of ${subject}` : "Taking a screenshot",
2362
+ done: (subject) => subject ? `Took a screenshot of ${subject}` : "Took a screenshot"
2363
+ },
2364
+ state,
2365
+ {
2366
+ isOption: record.silent === true,
2367
+ subject: target ? toolInput.truncate(target, CAPTURE_LABEL_MAX) : null
2368
+ }
2369
+ );
2370
+ }
2391
2371
 
2392
- // ../../packages/agents/src/tool-activity/video/labs-tool-activity-describers.ts
2393
- var labsToolActivityDescribers = [...slidesToolActivityDescribers, ...videoToolActivityDescribers];
2372
+ // ../../packages/agents/src/tool-activity/canonical/describe-memory-search.ts
2373
+ function describeMemorySearch(record) {
2374
+ const query = toolInput.str(record.query);
2375
+ return labelOnly(
2376
+ query ? `Searched its memory: ${toolInput.truncate(query, 60)}` : "Searched its memory"
2377
+ );
2378
+ }
2379
+
2380
+ // ../../packages/agents/src/tool-activity/canonical/describe-report-finding.ts
2381
+ function describeReportFinding(record) {
2382
+ const title = toolInput.str(record.title);
2383
+ const severity = toolInput.str(record.severity);
2384
+ if (!title) {
2385
+ return labelOnly("Reported a finding");
2386
+ }
2387
+ const prefix = severity ? `${severity}: ` : "";
2388
+ return labelOnly(
2389
+ `Reported a finding, ${prefix}${toolInput.truncate(title, 60)}`
2390
+ );
2391
+ }
2392
+
2393
+ // ../../packages/agents/src/tool-activity/canonical/describe-report-dev-server.ts
2394
+ function describeReportDevServer(record) {
2395
+ const status = toolInput.str(record.status);
2396
+ const port = toolInput.str(record.port) ?? String(record.port ?? "");
2397
+ if (status && port) {
2398
+ return labelOnly(`Reported the dev server ${status} on port ${port}`);
2399
+ }
2400
+ if (status) {
2401
+ return labelOnly(`Reported the dev server ${status}`);
2402
+ }
2403
+ return labelOnly("Reported the dev server");
2404
+ }
2405
+
2406
+ // ../../packages/agents/src/tool-activity/canonical/describe-request-env-vars.ts
2407
+ function describeRequestEnvVars(record) {
2408
+ const asked = Array.isArray(record.variables) ? record.variables.length : null;
2409
+ return labelOnly(
2410
+ asked ? `Requested ${asked} environment variable${asked === 1 ? "" : "s"}` : "Requested environment variables"
2411
+ );
2412
+ }
2413
+
2414
+ // ../../packages/agents/src/tool-activity/deliverable/describe-attach-file.ts
2415
+ function describeAttachFile(record, state) {
2416
+ const file = toolActivityBasename(toolInput.str(record.path));
2417
+ const subject = file ?? "a file";
2418
+ if (state.hasFailed) {
2419
+ return labelOnly(`Failed to deliver ${subject}`);
2420
+ }
2421
+ return labelOnly(
2422
+ state.isRunning ? `Delivering ${subject}` : `Delivered ${subject}`
2423
+ );
2424
+ }
2394
2425
 
2395
2426
  // ../../packages/agents/src/tool-activity/automation/linear-issue-label.ts
2396
2427
  function linearIssueLabel(verb, issue) {
@@ -2416,436 +2447,619 @@ var automationToolActivityDescribers = [
2416
2447
  }
2417
2448
  ],
2418
2449
  [
2419
- HOST_TOOL_NAMES.UPDATE_AUTOMATION,
2420
- (record) => {
2421
- const name = toolInput.trimmed(record.name);
2422
- return labelOnly(
2423
- name ? `Updated automation ${name}` : "Updated an automation"
2424
- );
2425
- }
2450
+ HOST_TOOL_NAMES.UPDATE_AUTOMATION,
2451
+ (record) => {
2452
+ const name = toolInput.trimmed(record.name);
2453
+ return labelOnly(
2454
+ name ? `Updated automation ${name}` : "Updated an automation"
2455
+ );
2456
+ }
2457
+ ],
2458
+ [HOST_TOOL_NAMES.LINEAR_LIST_ISSUES, () => labelOnly("Listed Linear issues")],
2459
+ [
2460
+ HOST_TOOL_NAMES.LINEAR_GET_ISSUE,
2461
+ (record) => linearIssueLabel("Read Linear issue", record.issue)
2462
+ ],
2463
+ [
2464
+ HOST_TOOL_NAMES.LINEAR_CREATE_ISSUE,
2465
+ () => labelOnly("Created a Linear issue")
2466
+ ],
2467
+ [
2468
+ HOST_TOOL_NAMES.LINEAR_UPDATE_ISSUE,
2469
+ (record) => linearIssueLabel("Updated Linear issue", record.issue)
2470
+ ],
2471
+ [
2472
+ HOST_TOOL_NAMES.LINEAR_COMMENT_ISSUE,
2473
+ (record) => linearIssueLabel("Commented on Linear issue", record.issue)
2474
+ ]
2475
+ ];
2476
+
2477
+ // ../../packages/agents/src/tool-activity/state-label.ts
2478
+ function stateLabel(state, labels) {
2479
+ if (state.hasFailed) return labelOnly(labels.failed);
2480
+ return labelOnly(state.isRunning ? labels.running : labels.done);
2481
+ }
2482
+
2483
+ // ../../packages/agents/src/tool-activity/browser/browser-activity-constants.ts
2484
+ var BROWSER_ACT_VERBS = Object.assign(/* @__PURE__ */ Object.create(null), {
2485
+ click: { done: "Clicked", gerund: "Clicking", bare: "click" },
2486
+ dblclick: {
2487
+ done: "Double-clicked",
2488
+ gerund: "Double-clicking",
2489
+ bare: "double-click"
2490
+ },
2491
+ fill: { done: "Filled", gerund: "Filling", bare: "fill" },
2492
+ type: { done: "Typed into", gerund: "Typing into", bare: "type into" },
2493
+ select: { done: "Selected in", gerund: "Selecting in", bare: "select in" },
2494
+ check: { done: "Checked", gerund: "Checking", bare: "check" },
2495
+ uncheck: { done: "Unchecked", gerund: "Unchecking", bare: "uncheck" },
2496
+ hover: { done: "Hovered", gerund: "Hovering", bare: "hover" },
2497
+ press: {
2498
+ done: "Pressed a key on",
2499
+ gerund: "Pressing a key on",
2500
+ bare: "press a key on"
2501
+ },
2502
+ scroll: { done: "Scrolled", gerund: "Scrolling", bare: "scroll" },
2503
+ upload: {
2504
+ done: "Uploaded a file to",
2505
+ gerund: "Uploading a file to",
2506
+ bare: "upload a file to"
2507
+ }
2508
+ });
2509
+ var BROWSER_HISTORY_LABELS = Object.assign(/* @__PURE__ */ Object.create(null), {
2510
+ back: { done: "Went back", gerund: "Going back", bare: "go back" },
2511
+ forward: {
2512
+ done: "Went forward",
2513
+ gerund: "Going forward",
2514
+ bare: "go forward"
2515
+ },
2516
+ reload: {
2517
+ done: "Reloaded the page",
2518
+ gerund: "Reloading the page",
2519
+ bare: "reload the page"
2520
+ }
2521
+ });
2522
+
2523
+ // ../../packages/agents/src/tool-activity/browser/describe-browser-act.ts
2524
+ function describeBrowserAct(record, state) {
2525
+ const action = toolInput.str(record.action) ?? "click";
2526
+ const verb = (Object.hasOwn(BROWSER_ACT_VERBS, action) ? BROWSER_ACT_VERBS[action] : void 0) ?? {
2527
+ done: "Acted on",
2528
+ gerund: "Acting on",
2529
+ bare: "act on"
2530
+ };
2531
+ const target = toolInput.trimmed(record.name) ?? toolInput.trimmed(record.selector) ?? toolInput.trimmed(record.ref) ?? toolInput.trimmed(record.role);
2532
+ const subject = target ? toolInput.truncate(target, 60) : "an element";
2533
+ return stateLabel(state, {
2534
+ failed: `Could not ${verb.bare} ${subject}`,
2535
+ running: `${verb.gerund} ${subject}`,
2536
+ done: `${verb.done} ${subject}`
2537
+ });
2538
+ }
2539
+
2540
+ // ../../packages/agents/src/tool-activity/browser/describe-browser-navigate.ts
2541
+ function describeBrowserNavigate(record, state) {
2542
+ const action = toolInput.str(record.action);
2543
+ if (action && action !== "goto") {
2544
+ const move = Object.hasOwn(BROWSER_HISTORY_LABELS, action) ? BROWSER_HISTORY_LABELS[action] : void 0;
2545
+ return move ? stateLabel(state, {
2546
+ failed: `Could not ${move.bare}`,
2547
+ running: move.gerund,
2548
+ done: move.done
2549
+ }) : stateLabel(state, {
2550
+ failed: "Could not move in the browser",
2551
+ running: "Moving in the browser",
2552
+ done: "Moved in the browser"
2553
+ });
2554
+ }
2555
+ const host = toolActivityHostname(toolInput.str(record.url));
2556
+ const subject = host ?? "a page";
2557
+ return stateLabel(state, {
2558
+ failed: `Could not open ${subject}`,
2559
+ running: `Opening ${subject}`,
2560
+ done: `Opened ${subject}`
2561
+ });
2562
+ }
2563
+
2564
+ // ../../packages/agents/src/tool-activity/browser/browser-tool-activity-describers.ts
2565
+ var browserToolActivityDescribers = [
2566
+ [HOST_TOOL_NAMES.BROWSER_NAVIGATE, describeBrowserNavigate],
2567
+ [HOST_TOOL_NAMES.BROWSER_ACT, describeBrowserAct],
2568
+ [
2569
+ // The goal is the only thing worth reading: the steps are in the result.
2570
+ HOST_TOOL_NAMES.BROWSER_AUTOPILOT,
2571
+ (record, state) => {
2572
+ const goal = toolInput.str(record.goal);
2573
+ return stateLabel(state, {
2574
+ failed: goal ? `Could not: ${goal}` : "Could not drive the browser",
2575
+ running: goal ? `Driving the browser: ${goal}` : "Driving the browser",
2576
+ done: goal ? `Drove the browser: ${goal}` : "Drove the browser"
2577
+ });
2578
+ }
2579
+ ],
2580
+ [
2581
+ HOST_TOOL_NAMES.BROWSER_SNAPSHOT,
2582
+ (_record, state) => stateLabel(state, {
2583
+ failed: "Could not read the page",
2584
+ running: "Reading the page",
2585
+ done: "Read the page"
2586
+ })
2426
2587
  ],
2427
- [HOST_TOOL_NAMES.LINEAR_LIST_ISSUES, () => labelOnly("Listed Linear issues")],
2428
2588
  [
2429
- HOST_TOOL_NAMES.LINEAR_GET_ISSUE,
2430
- (record) => linearIssueLabel("Read Linear issue", record.issue)
2589
+ HOST_TOOL_NAMES.BROWSER_WAIT,
2590
+ (_record, state) => stateLabel(state, {
2591
+ failed: "Gave up waiting for the page",
2592
+ running: "Waiting for the page",
2593
+ done: "Waited for the page"
2594
+ })
2431
2595
  ],
2432
2596
  [
2433
- HOST_TOOL_NAMES.LINEAR_CREATE_ISSUE,
2434
- () => labelOnly("Created a Linear issue")
2597
+ HOST_TOOL_NAMES.BROWSER_INSPECT,
2598
+ (_record, state) => stateLabel(state, {
2599
+ failed: "Could not read the console and network",
2600
+ running: "Reading the console and network",
2601
+ done: "Read the console and network"
2602
+ })
2435
2603
  ],
2436
2604
  [
2437
- HOST_TOOL_NAMES.LINEAR_UPDATE_ISSUE,
2438
- (record) => linearIssueLabel("Updated Linear issue", record.issue)
2605
+ HOST_TOOL_NAMES.BROWSER_SCREENSHOT,
2606
+ (record, state) => describeTakeScreenshot(record, state)
2439
2607
  ],
2440
2608
  [
2441
- HOST_TOOL_NAMES.LINEAR_COMMENT_ISSUE,
2442
- (record) => linearIssueLabel("Commented on Linear issue", record.issue)
2443
- ]
2444
- ];
2445
-
2446
- // ../../packages/agents/src/tool-activity/review/review-tool-activity-describers.ts
2447
- var reviewToolActivityDescribers = [
2448
- [
2449
- HOST_TOOL_NAMES.REVIEW_SCOPE,
2450
- (record) => {
2451
- const base = toolInput.str(record.base);
2452
- const head = toolInput.str(record.head);
2453
- return labelOnly(
2454
- base && head ? `Scoped the review of ${toolInput.truncate(`${base}...${head}`, 60)}` : "Scoped the review"
2455
- );
2456
- }
2609
+ HOST_TOOL_NAMES.BROWSER_RECORD_START,
2610
+ (_record, state) => stateLabel(state, {
2611
+ failed: "Could not start recording",
2612
+ running: "Starting a recording",
2613
+ done: "Started recording the browser"
2614
+ })
2457
2615
  ],
2458
2616
  [
2459
- HOST_TOOL_NAMES.FILTER_REVIEW_FINDINGS,
2460
- (record) => {
2461
- const count = Array.isArray(record.findings) ? record.findings.length : 0;
2462
- return labelOnly(
2463
- count > 0 ? `Fact-checked ${count} review finding${count === 1 ? "" : "s"}` : "Fact-checked the review findings"
2464
- );
2465
- }
2617
+ HOST_TOOL_NAMES.BROWSER_RECORD_STOP,
2618
+ (_record, state) => stateLabel(state, {
2619
+ failed: "Could not finish the recording",
2620
+ running: "Finishing the recording",
2621
+ done: "Recorded the browser"
2622
+ })
2466
2623
  ],
2467
2624
  [
2468
- HOST_TOOL_NAMES.SUBMIT_REVIEW_SUMMARY,
2469
- () => labelOnly("Drew the change summary")
2470
- ]
2471
- ];
2472
-
2473
- // ../../packages/agents/src/tool-activity/factory/factory-tool-activity-describers.ts
2474
- var factoryToolActivityDescribers = [
2475
- [HOST_TOOL_NAMES.SUBMIT_SPECS, () => labelOnly("Submitted the specs")],
2476
- [HOST_TOOL_NAMES.SET_BRAND_KIT, () => labelOnly("Set the brand kit")],
2477
- [HOST_TOOL_NAMES.PLAN_TICKETS, () => labelOnly("Planned the tickets")],
2478
- [HOST_TOOL_NAMES.PLAN_FOLLOW_UPS, () => labelOnly("Planned follow-ups")],
2479
- [
2480
- HOST_TOOL_NAMES.MARK_PROVISIONING_STEP,
2481
- (record) => {
2482
- const name = toolInput.trimmed(record.name);
2483
- const status = toolInput.trimmed(record.status);
2484
- return labelOnly(
2485
- name && status ? `Marked provisioning step ${name} ${status}` : "Reported a provisioning step"
2486
- );
2487
- }
2625
+ HOST_TOOL_NAMES.BROWSER_CLOSE,
2626
+ (_record, state) => stateLabel(state, {
2627
+ failed: "Could not close the browser",
2628
+ running: "Closing the browser",
2629
+ done: "Closed the browser"
2630
+ })
2488
2631
  ],
2489
- [HOST_TOOL_NAMES.DECIDE_MERGE, () => labelOnly("Settled the ticket's PR")],
2490
- [HOST_TOOL_NAMES.DECIDE_QA, () => labelOnly("Settled the QA verdict")],
2491
2632
  [
2492
- HOST_TOOL_NAMES.READ_FACTORY_SPECS,
2493
- () => labelOnly("Read the signed specs")
2633
+ HOST_TOOL_NAMES.BROWSER_SESSIONS_LIST,
2634
+ (_record, state) => stateLabel(state, {
2635
+ failed: "Could not read your captured logins",
2636
+ running: "Listing your captured logins",
2637
+ done: "Listed your captured logins"
2638
+ })
2494
2639
  ],
2495
2640
  [
2496
- HOST_TOOL_NAMES.REPORT_RELEASE_QA_FLOWS,
2497
- () => labelOnly("Recorded the release QA flows")
2641
+ // The site, never what the vault holds for it.
2642
+ HOST_TOOL_NAMES.BROWSER_USE_SESSION,
2643
+ (record, state) => {
2644
+ const domain = toolInput.str(record.domain);
2645
+ return stateLabel(state, {
2646
+ failed: domain ? `Could not sign in to ${domain} as you` : "Could not load a captured login",
2647
+ running: domain ? `Signing in to ${domain} as you` : "Loading a captured login",
2648
+ done: domain ? `Signed in to ${domain} as you` : "Loaded a captured login"
2649
+ });
2650
+ }
2498
2651
  ],
2499
2652
  [
2500
- HOST_TOOL_NAMES.REPORT_RELEASE_QA_RESULTS,
2501
- () => labelOnly("Reported release QA results")
2653
+ HOST_TOOL_NAMES.BROWSER_FORGET_SESSION,
2654
+ (_record, state) => stateLabel(state, {
2655
+ failed: "Could not forget the captured logins",
2656
+ running: "Forgetting the captured logins",
2657
+ done: "Forgot the captured logins"
2658
+ })
2502
2659
  ],
2503
2660
  [
2504
- HOST_TOOL_NAMES.REPORT_QA_FLOW_RESULT,
2505
- () => labelOnly("Reported a QA flow result")
2661
+ HOST_TOOL_NAMES.REPL_EVAL,
2662
+ (_record, state) => stateLabel(state, {
2663
+ failed: "JavaScript in the REPL failed",
2664
+ running: "Running JavaScript in the REPL",
2665
+ done: "Ran JavaScript in the REPL"
2666
+ })
2506
2667
  ],
2507
2668
  [
2508
- HOST_TOOL_NAMES.DECIDE_RELEASE_QA,
2509
- () => labelOnly("Settled the release QA round")
2669
+ HOST_TOOL_NAMES.REPL_RESET,
2670
+ (_record, state) => stateLabel(state, {
2671
+ failed: "Could not reset the REPL",
2672
+ running: "Resetting the REPL",
2673
+ done: "Reset the REPL"
2674
+ })
2510
2675
  ]
2511
2676
  ];
2512
2677
 
2513
2678
  // ../../packages/agents/src/tool-activity/canonical/integration-tool-activity-describers.ts
2514
- var integrationToolActivityDescribers = [
2515
- [
2516
- HOST_TOOL_NAMES.READ_VERCEL_DEPLOYMENT,
2517
- (record) => labelOnly(
2518
- `Read Vercel deployment for ${toolInput.str(record.sha)?.slice(0, 7) ?? "a commit"}`
2519
- )
2520
- ],
2521
- [
2522
- HOST_TOOL_NAMES.PROVISION_SERVICE,
2523
- (record) => {
2524
- const service = toolInput.str(record.service);
2525
- return labelOnly(
2526
- service ? `Requested approval to provision ${service}` : "Requested approval to provision a service"
2527
- );
2528
- }
2529
- ],
2530
- [
2531
- "tool_search",
2532
- (record) => {
2533
- const query = toolInput.str(record.query);
2534
- return labelOnly(
2535
- query ? `Searched integrations for "${toolInput.truncate(query, 60)}"` : "Searched the connected integrations"
2536
- );
2537
- }
2538
- ],
2539
- [
2540
- "tool_execute",
2541
- (record) => {
2542
- const target = toolInput.str(record.tool);
2543
- return labelOnly(
2544
- target ? `Ran ${toolInput.truncate(target, 60)}` : "Ran an integration tool"
2545
- );
2546
- }
2547
- ]
2548
- ];
2549
-
2550
- // ../../packages/agents/src/tool-activity/capture/describe-annotate-image.ts
2551
- function describeAnnotateImage(record, state) {
2552
- return captureLabel(
2553
- {
2554
- optionFailed: "Failed to annotate a silent image",
2555
- optionRunning: "Annotating a silent image",
2556
- optionDone: "Annotated a silent image",
2557
- failed: () => "Failed to annotate an image",
2558
- running: () => "Annotating an image",
2559
- done: () => "Annotated an image"
2560
- },
2561
- state,
2562
- { isOption: record.silent === true, subject: null }
2563
- );
2564
- }
2565
-
2566
- // ../../packages/core/src/source-scan/end-of-comment.ts
2567
- function endOfComment(source, at) {
2568
- if (source[at] !== "/") return at;
2569
- if (source[at + 1] === "/") {
2570
- const line = source.indexOf("\n", at);
2571
- return line === -1 ? source.length : line - 1;
2572
- }
2573
- if (source[at + 1] === "*") {
2574
- const block = source.indexOf("*/", at + 2);
2575
- return block === -1 ? source.length : block + 1;
2576
- }
2577
- return at;
2578
- }
2579
-
2580
- // ../../packages/core/src/source-scan/end-of-string-literal.ts
2581
- function endOfStringLiteral(source, open) {
2582
- const quote = source[open];
2583
- for (let at = open + 1; at < source.length; at += 1) {
2584
- if (source[at] === "\\") at += 1;
2585
- else if (source[at] === quote) return at;
2586
- }
2587
- return source.length;
2588
- }
2589
-
2590
- // ../../packages/core/src/source-scan/end-of-skippable.ts
2591
- function endOfSkippable(source, at) {
2592
- const char = source[at];
2593
- if (char === "'" || char === '"' || char === "`") {
2594
- return endOfStringLiteral(source, at);
2595
- }
2596
- return endOfComment(source, at);
2597
- }
2598
-
2599
- // ../../packages/core/src/source-scan/end-of-object-literal.ts
2600
- function endOfObjectLiteral(source, open) {
2601
- let depth = 0;
2602
- for (let at = open; at < source.length; at += 1) {
2603
- const skipped = endOfSkippable(source, at);
2604
- if (skipped !== at) {
2605
- at = skipped;
2606
- continue;
2607
- }
2608
- if (source[at] === "{") depth += 1;
2609
- else if (source[at] === "}" && (depth -= 1) === 0) return at + 1;
2610
- }
2611
- return -1;
2612
- }
2613
-
2614
- // ../../packages/core/src/source-scan/has-spread-in-code.ts
2615
- function hasSpreadInCode(literal) {
2616
- for (let at = 0; at < literal.length; at += 1) {
2617
- const skipped = endOfSkippable(literal, at);
2618
- if (skipped !== at) {
2619
- at = skipped;
2620
- continue;
2621
- }
2622
- if (literal.startsWith("...", at)) return true;
2623
- }
2624
- return false;
2625
- }
2626
-
2627
- // ../../packages/core/src/source-scan/meta-declaration-open.ts
2628
- function metaDeclarationOpen(script) {
2629
- const anchor = /export[ \t]+const[ \t]+meta[ \t]*=\s*\{/y;
2630
- let at = 0;
2631
- while (at < script.length) {
2632
- if (/\s/.test(script[at] ?? "")) {
2633
- at += 1;
2634
- continue;
2679
+ var integrationToolActivityDescribers = [
2680
+ [
2681
+ HOST_TOOL_NAMES.READ_VERCEL_DEPLOYMENT,
2682
+ (record) => labelOnly(
2683
+ `Read Vercel deployment for ${toolInput.str(record.sha)?.slice(0, 7) ?? "a commit"}`
2684
+ )
2685
+ ],
2686
+ [
2687
+ HOST_TOOL_NAMES.PROVISION_SERVICE,
2688
+ (record) => {
2689
+ const service = toolInput.str(record.service);
2690
+ return labelOnly(
2691
+ service ? `Requested approval to provision ${service}` : "Requested approval to provision a service"
2692
+ );
2635
2693
  }
2636
- const comment = endOfComment(script, at);
2637
- if (comment !== at) {
2638
- at = comment + 1;
2639
- continue;
2694
+ ],
2695
+ [
2696
+ "tool_search",
2697
+ (record) => {
2698
+ const query = toolInput.str(record.query);
2699
+ return labelOnly(
2700
+ query ? `Searched integrations for "${toolInput.truncate(query, 60)}"` : "Searched the connected integrations"
2701
+ );
2640
2702
  }
2641
- anchor.lastIndex = at;
2642
- return anchor.test(script) ? script.indexOf("{", at) : -1;
2643
- }
2644
- return -1;
2645
- }
2646
-
2647
- // ../../packages/core/src/source-scan/unescape-string-literal.ts
2648
- function unescapeStringLiteral(body) {
2649
- const single = {
2650
- n: "\n",
2651
- t: " ",
2652
- r: "\r",
2653
- b: "\b",
2654
- f: "\f",
2655
- v: "\v",
2656
- "0": "\0"
2657
- };
2658
- return body.replace(
2659
- /\\(u\{([0-9a-fA-F]+)\}|u([0-9a-fA-F]{4})|x([0-9a-fA-F]{2})|.)/gs,
2660
- (_, escape, braced, unicode, hex) => {
2661
- const code = braced ?? unicode ?? hex;
2662
- if (code === void 0) return single[escape] ?? escape;
2663
- const point = Number.parseInt(code, 16);
2664
- return point <= 1114111 ? String.fromCodePoint(point) : `\\${escape}`;
2703
+ ],
2704
+ [
2705
+ "tool_execute",
2706
+ (record) => {
2707
+ const target = toolInput.str(record.tool);
2708
+ return labelOnly(
2709
+ target ? `Ran ${toolInput.truncate(target, 60)}` : "Ran an integration tool"
2710
+ );
2665
2711
  }
2666
- );
2667
- }
2668
-
2669
- // ../../packages/core/src/source-scan/quoted-field-at.ts
2670
- function quotedFieldAt(literal, at, field) {
2671
- const key = /^(['"])?/.exec(literal.slice(at));
2672
- const quoted = key?.[1] ?? "";
2673
- const start = at + quoted.length;
2674
- if (!literal.startsWith(field, start)) return void 0;
2675
- if (!quoted && /[A-Za-z0-9_$]/.test(literal[at - 1] ?? "")) return void 0;
2676
- const after = literal.slice(start + field.length);
2677
- const opener = new RegExp(`^${quoted}\\s*:\\s*['"\`]`).exec(after);
2678
- if (!opener) return void 0;
2679
- const quote = start + field.length + opener[0].length - 1;
2680
- const close = endOfStringLiteral(literal, quote);
2681
- let tail = close + 1;
2682
- for (; ; ) {
2683
- while (/\s/.test(literal[tail] ?? "")) tail += 1;
2684
- const skipped = endOfSkippable(literal, tail);
2685
- if (skipped === tail) break;
2686
- tail = skipped + 1;
2687
- }
2688
- if (literal[tail] !== "," && literal[tail] !== "}") return void 0;
2689
- if (literal[quote] === "`" && /\$\{/.test(literal.slice(quote, close))) {
2690
- return void 0;
2691
- }
2692
- return unescapeStringLiteral(literal.slice(quote + 1, close));
2693
- }
2712
+ ]
2713
+ ];
2694
2714
 
2695
- // ../../packages/core/src/source-scan/top-level-string-field.ts
2696
- function topLevelStringField(literal, field) {
2697
- let depth = 0;
2698
- let found;
2699
- for (let at = 0; at < literal.length; at += 1) {
2700
- if (depth === 1) {
2701
- const value = quotedFieldAt(literal, at, field);
2702
- if (value !== void 0) found = value;
2715
+ // ../../packages/agents/src/tool-activity/database/database-tool-activity-describers.ts
2716
+ var databaseToolActivityDescribers = [
2717
+ [
2718
+ HOST_TOOL_NAMES.DETECT_PROJECT_DATABASE,
2719
+ () => labelOnly("Recorded the project database")
2720
+ ],
2721
+ [
2722
+ HOST_TOOL_NAMES.BIND_PROJECT_DATABASE,
2723
+ () => labelOnly("Requested approval to bind the project database")
2724
+ ],
2725
+ [
2726
+ HOST_TOOL_NAMES.REQUEST_DATABASE_URL,
2727
+ () => labelOnly("Asked for the production database URL")
2728
+ ],
2729
+ [
2730
+ HOST_TOOL_NAMES.DATABASE_QUERY,
2731
+ (record) => {
2732
+ const branch = toolInput.trimmed(record.branch) ?? "production";
2733
+ const sql = toolInput.verbatim(record.sql);
2734
+ return sql ? { text: `Read the database (${branch})`, command: sql } : labelOnly(`Read the database (${branch})`);
2703
2735
  }
2704
- const skipped = endOfSkippable(literal, at);
2705
- if (skipped !== at) {
2706
- at = skipped;
2707
- continue;
2736
+ ],
2737
+ [
2738
+ HOST_TOOL_NAMES.DATABASE_WRITE,
2739
+ (record) => {
2740
+ const branch = toolInput.trimmed(record.branch) ?? "production";
2741
+ const sql = toolInput.verbatim(record.sql);
2742
+ return sql ? {
2743
+ text: `Requested approval to write to the database (${branch})`,
2744
+ command: sql
2745
+ } : labelOnly(`Requested approval to write to the database (${branch})`);
2708
2746
  }
2709
- const char = literal[at];
2710
- if (char === "{" || char === "[") depth += 1;
2711
- else if (char === "}" || char === "]") depth -= 1;
2712
- }
2713
- return found;
2714
- }
2715
-
2716
- // ../../packages/core/src/source-scan/meta-name-in-script.ts
2717
- function metaNameInScript(script) {
2718
- const open = metaDeclarationOpen(script);
2719
- if (open === -1) return void 0;
2720
- const end = endOfObjectLiteral(script, open);
2721
- if (end === -1) return void 0;
2722
- const literal = script.slice(open, end);
2723
- if (hasSpreadInCode(literal)) return void 0;
2724
- const name = topLevelStringField(literal, "name");
2725
- return name?.trim() && topLevelStringField(literal, "description")?.trim() ? name.slice(0, 80) : void 0;
2726
- }
2727
-
2728
- // ../../packages/agents/src/tool-activity/canonical/workflow-script-name.ts
2729
- function workflowScriptName(script) {
2730
- return metaNameInScript(script);
2731
- }
2732
-
2733
- // ../../packages/agents/src/tool-activity/canonical/describe-workflow.ts
2734
- function describeWorkflow(record) {
2735
- const name = workflowScriptName(toolInput.str(record.script) ?? "");
2736
- return labelOnly(name ? `Ran workflow "${name}"` : "Ran a workflow");
2737
- }
2747
+ ]
2748
+ ];
2738
2749
 
2739
- // ../../packages/agents/src/tool-activity/capture/describe-attach-image.ts
2740
- function describeAttachImage(record, state) {
2741
- const file = toolActivityBasename(toolInput.str(record.path));
2742
- return captureLabel(
2743
- {
2744
- optionFailed: "Failed to attach a silent image",
2745
- optionRunning: "Attaching a silent image",
2746
- optionDone: "Attached a silent image",
2747
- failed: (subject) => subject ? `Failed to attach ${subject}` : "Failed to attach an image",
2748
- running: (subject) => subject ? `Attaching ${subject}` : "Attaching an image",
2749
- done: (subject) => subject ? `Attached ${subject}` : "Attached an image"
2750
- },
2751
- state,
2752
- {
2753
- isOption: record.silent === true,
2754
- subject: file ? toolInput.truncate(file, CAPTURE_LABEL_MAX) : null
2750
+ // ../../packages/agents/src/tool-activity/design/design-tool-activity-describers.ts
2751
+ var designToolActivityDescribers = [
2752
+ [
2753
+ HOST_TOOL_NAMES.PUBLISH_DESIGN,
2754
+ (record) => {
2755
+ const count = Array.isArray(record.directions) ? record.directions.length : 0;
2756
+ return labelOnly(
2757
+ count > 1 ? `Published ${count} design directions` : "Published a design"
2758
+ );
2755
2759
  }
2756
- );
2757
- }
2758
-
2759
- // ../../packages/agents/src/tool-activity/capture/describe-generate-image.ts
2760
- function describeGenerateImage(_record, state) {
2761
- return captureLabel(
2762
- {
2763
- optionFailed: "Failed to generate an image",
2764
- optionRunning: "Generating an image",
2765
- optionDone: "Generated an image",
2766
- failed: () => "Failed to generate an image",
2767
- running: () => "Generating an image",
2768
- done: () => "Generated an image"
2769
- },
2770
- state,
2771
- { isOption: false, subject: null }
2772
- );
2773
- }
2774
-
2775
- // ../../packages/agents/src/tool-activity/capture/describe-record-video.ts
2776
- function describeRecordVideo(record, state) {
2777
- const target = captureTarget(toolInput.str(record.url));
2778
- return captureLabel(
2779
- {
2780
- // record_video has no option variant: a strip thumb is a still image.
2781
- optionFailed: "Failed to record a video",
2782
- optionRunning: "Recording a video",
2783
- optionDone: "Recorded a video",
2784
- failed: (subject) => subject ? `Failed to record a video of ${subject}` : "Failed to record a video",
2785
- running: (subject) => subject ? `Recording a video of ${subject}` : "Recording a video",
2786
- done: (subject) => subject ? `Recorded a video of ${subject}` : "Recorded a video"
2787
- },
2788
- state,
2789
- {
2790
- isOption: false,
2791
- subject: target ? toolInput.truncate(target, CAPTURE_LABEL_MAX) : null
2760
+ ],
2761
+ [
2762
+ HOST_TOOL_NAMES.SET_LIVE_DESIGN,
2763
+ (record) => {
2764
+ const version = toolInput.trimmed(record.version);
2765
+ return labelOnly(
2766
+ version ? `Pointed the design link at v${version}` : "Moved the design link"
2767
+ );
2792
2768
  }
2793
- );
2794
- }
2769
+ ]
2770
+ ];
2795
2771
 
2796
- // ../../packages/agents/src/tool-activity/canonical/describe-memory-search.ts
2797
- function describeMemorySearch(record) {
2798
- const query = toolInput.str(record.query);
2799
- return labelOnly(
2800
- query ? `Searched its memory: ${toolInput.truncate(query, 60)}` : "Searched its memory"
2801
- );
2802
- }
2772
+ // ../../packages/agents/src/tool-activity/factory/factory-tool-activity-describers.ts
2773
+ var factoryToolActivityDescribers = [
2774
+ [HOST_TOOL_NAMES.SUBMIT_SPECS, () => labelOnly("Submitted the specs")],
2775
+ [HOST_TOOL_NAMES.SET_BRAND_KIT, () => labelOnly("Set the brand kit")],
2776
+ [HOST_TOOL_NAMES.PLAN_TICKETS, () => labelOnly("Planned the tickets")],
2777
+ [HOST_TOOL_NAMES.PLAN_FOLLOW_UPS, () => labelOnly("Planned follow-ups")],
2778
+ [
2779
+ HOST_TOOL_NAMES.MARK_PROVISIONING_STEP,
2780
+ (record) => {
2781
+ const name = toolInput.trimmed(record.name);
2782
+ const status = toolInput.trimmed(record.status);
2783
+ return labelOnly(
2784
+ name && status ? `Marked provisioning step ${name} ${status}` : "Reported a provisioning step"
2785
+ );
2786
+ }
2787
+ ],
2788
+ [HOST_TOOL_NAMES.DECIDE_MERGE, () => labelOnly("Settled the ticket's PR")],
2789
+ [HOST_TOOL_NAMES.DECIDE_QA, () => labelOnly("Settled the QA verdict")],
2790
+ [
2791
+ HOST_TOOL_NAMES.READ_FACTORY_SPECS,
2792
+ () => labelOnly("Read the signed specs")
2793
+ ],
2794
+ [
2795
+ HOST_TOOL_NAMES.REPORT_RELEASE_QA_FLOWS,
2796
+ () => labelOnly("Recorded the release QA flows")
2797
+ ],
2798
+ [
2799
+ HOST_TOOL_NAMES.REPORT_RELEASE_QA_RESULTS,
2800
+ () => labelOnly("Reported release QA results")
2801
+ ],
2802
+ [
2803
+ HOST_TOOL_NAMES.REPORT_QA_FLOW_RESULT,
2804
+ () => labelOnly("Reported a QA flow result")
2805
+ ],
2806
+ [
2807
+ HOST_TOOL_NAMES.DECIDE_RELEASE_QA,
2808
+ () => labelOnly("Settled the release QA round")
2809
+ ]
2810
+ ];
2803
2811
 
2804
- // ../../packages/agents/src/tool-activity/canonical/describe-report-finding.ts
2805
- function describeReportFinding(record) {
2806
- const title = toolInput.str(record.title);
2807
- const severity = toolInput.str(record.severity);
2808
- if (!title) {
2809
- return labelOnly("Reported a finding");
2812
+ // ../../packages/agents/src/tool-activity/git/git-verbs-constants.ts
2813
+ var GIT_VERBS = {
2814
+ LIST: { done: "Listed", running: "Listing", failed: "Could not list" },
2815
+ CLONE: { done: "Cloned", running: "Cloning", failed: "Could not clone" },
2816
+ FETCH: { done: "Fetched", running: "Fetching", failed: "Could not fetch" },
2817
+ CREATE: { done: "Created", running: "Creating", failed: "Could not create" },
2818
+ SET_UP: {
2819
+ done: "Set up",
2820
+ running: "Setting up",
2821
+ failed: "Could not set up"
2822
+ },
2823
+ COMMIT: {
2824
+ done: "Committed",
2825
+ running: "Committing",
2826
+ failed: "Could not commit"
2827
+ },
2828
+ PUSH: { done: "Pushed", running: "Pushing", failed: "Could not push" },
2829
+ OPEN: { done: "Opened", running: "Opening", failed: "Could not open" },
2830
+ SUBMIT: {
2831
+ done: "Submitted",
2832
+ running: "Submitting",
2833
+ failed: "Could not submit"
2834
+ },
2835
+ RESTACK: {
2836
+ done: "Restacked",
2837
+ running: "Restacking",
2838
+ failed: "Could not restack"
2839
+ },
2840
+ CONTINUE_RESTACK: {
2841
+ done: "Continued restacking",
2842
+ running: "Continuing to restack",
2843
+ failed: "Could not continue restacking"
2844
+ },
2845
+ REVIEW: {
2846
+ done: "Reviewed",
2847
+ running: "Reviewing",
2848
+ failed: "Could not review"
2849
+ },
2850
+ COMMENT: {
2851
+ done: "Commented",
2852
+ running: "Commenting",
2853
+ failed: "Could not comment"
2854
+ },
2855
+ REPLY: { done: "Replied", running: "Replying", failed: "Could not reply" },
2856
+ RESOLVE: {
2857
+ done: "Resolved",
2858
+ running: "Resolving",
2859
+ failed: "Could not resolve"
2860
+ },
2861
+ ASK_MERGE: {
2862
+ done: "Asked to merge",
2863
+ running: "Asking to merge",
2864
+ failed: "Could not ask to merge"
2865
+ },
2866
+ ASK_DEPLOY: {
2867
+ done: "Asked to deploy",
2868
+ running: "Asking to deploy",
2869
+ failed: "Could not ask to deploy"
2810
2870
  }
2811
- const prefix = severity ? `${severity}: ` : "";
2812
- return labelOnly(
2813
- `Reported a finding, ${prefix}${toolInput.truncate(title, 60)}`
2814
- );
2815
- }
2871
+ };
2816
2872
 
2817
- // ../../packages/agents/src/tool-activity/canonical/describe-report-dev-server.ts
2818
- function describeReportDevServer(record) {
2819
- const status = toolInput.str(record.status);
2820
- const port = toolInput.str(record.port) ?? String(record.port ?? "");
2821
- if (status && port) {
2822
- return labelOnly(`Reported the dev server ${status} on port ${port}`);
2823
- }
2824
- if (status) {
2825
- return labelOnly(`Reported the dev server ${status}`);
2826
- }
2827
- return labelOnly("Reported the dev server");
2873
+ // ../../packages/agents/src/tool-activity/git/requested-repos.ts
2874
+ function requestedRepos(input) {
2875
+ const seen = /* @__PURE__ */ new Set();
2876
+ const names = [];
2877
+ for (const raw of [input.repoFullName, ...input.repoFullNames ?? []]) {
2878
+ const name = raw?.trim();
2879
+ if (!name || seen.has(name.toLowerCase())) continue;
2880
+ seen.add(name.toLowerCase());
2881
+ names.push(name);
2882
+ }
2883
+ return names;
2884
+ }
2885
+
2886
+ // ../../packages/agents/src/tool-activity/git/verb-label.ts
2887
+ function verbLabel(state, verbs, target) {
2888
+ return stateLabel(state, {
2889
+ done: `${verbs.done} ${target}`,
2890
+ running: `${verbs.running} ${target}`,
2891
+ failed: `${verbs.failed} ${target}`
2892
+ });
2828
2893
  }
2829
2894
 
2830
- // ../../packages/agents/src/tool-activity/canonical/describe-request-env-vars.ts
2831
- function describeRequestEnvVars(record) {
2832
- const asked = Array.isArray(record.variables) ? record.variables.length : null;
2833
- return labelOnly(
2834
- asked ? `Requested ${asked} environment variable${asked === 1 ? "" : "s"}` : "Requested environment variables"
2835
- );
2836
- }
2895
+ // ../../packages/agents/src/tool-activity/git/describe-clone-repo.ts
2896
+ function describeCloneRepo(record, state) {
2897
+ const names = requestedRepos({
2898
+ repoFullName: typeof record.repoFullName === "string" ? record.repoFullName : void 0,
2899
+ repoFullNames: Array.isArray(record.repoFullNames) ? record.repoFullNames.filter((name) => typeof name === "string") : void 0
2900
+ });
2901
+ const target = names.length > 1 ? `${names.length} repositories` : names[0] ?? "the repository";
2902
+ return verbLabel(state, GIT_VERBS.CLONE, target);
2903
+ }
2904
+
2905
+ // ../../packages/agents/src/tool-activity/git/git-tool-names-constants.ts
2906
+ var GIT_TOOL_NAMES = {
2907
+ LIST_REPOS: "list_repos",
2908
+ CLONE_REPO: "clone_repo",
2909
+ FETCH_PR_REF: "fetch_pr_ref",
2910
+ CLONE_TEMPLATE: "clone_template",
2911
+ CREATE_REPO: "create_repo",
2912
+ CREATE_BRANCH: "create_branch",
2913
+ GIT_COMMIT: "git_commit",
2914
+ GIT_PUSH: "git_push",
2915
+ OPEN_PULL_REQUEST: "open_pull_request",
2916
+ GRAPHITE_SUBMIT: "graphite_submit",
2917
+ GITHUB_RESTACK: "github_restack",
2918
+ GRAPHITE_RESTACK: "graphite_restack",
2919
+ SUBMIT_PR_REVIEW: "submit_pr_review",
2920
+ ADD_PR_COMMENT: "add_pr_comment",
2921
+ RESOLVE_REVIEW_THREAD: "resolve_review_thread",
2922
+ REQUEST_MERGE: "request_merge",
2923
+ REQUEST_DEPLOY: "request_deploy"
2924
+ };
2837
2925
 
2838
- // ../../packages/agents/src/tool-activity/deliverable/describe-attach-file.ts
2839
- function describeAttachFile(record, state) {
2840
- const file = toolActivityBasename(toolInput.str(record.path));
2841
- const subject = file ?? "a file";
2842
- if (state.hasFailed) {
2843
- return labelOnly(`Failed to deliver ${subject}`);
2926
+ // ../../packages/agents/src/tool-activity/git/git-target.ts
2927
+ var gitTarget = {
2928
+ pullRequest: (value) => typeof value === "number" && Number.isInteger(value) && value > 0 ? `PR #${value}` : null,
2929
+ onPullRequest: (value) => `on ${gitTarget.pullRequest(value) ?? "a pull request"}`,
2930
+ named: (value) => {
2931
+ const text = toolInput.trimmed(value);
2932
+ return text ? toolInput.truncate(text, 60) : null;
2933
+ },
2934
+ quoted: (value) => {
2935
+ const text = toolInput.trimmed(value)?.split("\n")[0]?.trim();
2936
+ return text ? `"${toolInput.truncate(text, 60)}"` : null;
2844
2937
  }
2845
- return labelOnly(
2846
- state.isRunning ? `Delivering ${subject}` : `Delivered ${subject}`
2847
- );
2848
- }
2938
+ };
2939
+
2940
+ // ../../packages/agents/src/tool-activity/git/git-tool-activity-describers.ts
2941
+ var gitToolActivityDescribers = [
2942
+ [
2943
+ GIT_TOOL_NAMES.LIST_REPOS,
2944
+ (_, state) => verbLabel(state, GIT_VERBS.LIST, "the repositories")
2945
+ ],
2946
+ [GIT_TOOL_NAMES.CLONE_REPO, describeCloneRepo],
2947
+ [
2948
+ GIT_TOOL_NAMES.FETCH_PR_REF,
2949
+ (record, state) => verbLabel(
2950
+ state,
2951
+ GIT_VERBS.FETCH,
2952
+ gitTarget.pullRequest(record.pullNumber) ?? "a pull request"
2953
+ )
2954
+ ],
2955
+ [
2956
+ GIT_TOOL_NAMES.CLONE_TEMPLATE,
2957
+ (_, state) => verbLabel(state, GIT_VERBS.CLONE, "the project template")
2958
+ ],
2959
+ [
2960
+ GIT_TOOL_NAMES.CREATE_REPO,
2961
+ (record, state) => {
2962
+ const name = gitTarget.named(record.name);
2963
+ return verbLabel(
2964
+ state,
2965
+ GIT_VERBS.CREATE,
2966
+ name ? `repository ${name}` : "the repository"
2967
+ );
2968
+ }
2969
+ ],
2970
+ [
2971
+ GIT_TOOL_NAMES.CREATE_BRANCH,
2972
+ // It may resume an existing branch or prefix the name, so neither is claimed.
2973
+ (_, state) => verbLabel(state, GIT_VERBS.SET_UP, "the working branch")
2974
+ ],
2975
+ [
2976
+ GIT_TOOL_NAMES.GIT_COMMIT,
2977
+ (record, state) => verbLabel(
2978
+ state,
2979
+ GIT_VERBS.COMMIT,
2980
+ gitTarget.quoted(record.message) ?? "changes"
2981
+ )
2982
+ ],
2983
+ [
2984
+ GIT_TOOL_NAMES.GIT_PUSH,
2985
+ (record, state) => verbLabel(
2986
+ state,
2987
+ GIT_VERBS.PUSH,
2988
+ gitTarget.named(record.branch) ?? "a branch"
2989
+ )
2990
+ ],
2991
+ [
2992
+ GIT_TOOL_NAMES.OPEN_PULL_REQUEST,
2993
+ (record, state) => {
2994
+ const title = gitTarget.quoted(record.title);
2995
+ return verbLabel(
2996
+ state,
2997
+ GIT_VERBS.OPEN,
2998
+ title ? `PR ${title}` : "a pull request"
2999
+ );
3000
+ }
3001
+ ],
3002
+ [
3003
+ GIT_TOOL_NAMES.GRAPHITE_SUBMIT,
3004
+ (_, state) => verbLabel(state, GIT_VERBS.SUBMIT, "the Graphite stack")
3005
+ ],
3006
+ [
3007
+ GIT_TOOL_NAMES.GITHUB_RESTACK,
3008
+ (record, state) => verbLabel(
3009
+ state,
3010
+ record.continue === true ? GIT_VERBS.CONTINUE_RESTACK : GIT_VERBS.RESTACK,
3011
+ gitTarget.pullRequest(record.prNumber) ?? "the stack"
3012
+ )
3013
+ ],
3014
+ [
3015
+ GIT_TOOL_NAMES.GRAPHITE_RESTACK,
3016
+ (record, state) => verbLabel(
3017
+ state,
3018
+ record.continue === true ? GIT_VERBS.CONTINUE_RESTACK : GIT_VERBS.RESTACK,
3019
+ "the Graphite stack"
3020
+ )
3021
+ ],
3022
+ [
3023
+ GIT_TOOL_NAMES.SUBMIT_PR_REVIEW,
3024
+ (record, state) => verbLabel(
3025
+ state,
3026
+ GIT_VERBS.REVIEW,
3027
+ gitTarget.pullRequest(record.pullNumber) ?? "a pull request"
3028
+ )
3029
+ ],
3030
+ [
3031
+ GIT_TOOL_NAMES.ADD_PR_COMMENT,
3032
+ (record, state) => typeof record.inReplyTo === "number" ? verbLabel(
3033
+ state,
3034
+ GIT_VERBS.REPLY,
3035
+ `to a review comment ${gitTarget.onPullRequest(record.pullNumber)}`
3036
+ ) : verbLabel(
3037
+ state,
3038
+ GIT_VERBS.COMMENT,
3039
+ gitTarget.onPullRequest(record.pullNumber)
3040
+ )
3041
+ ],
3042
+ [
3043
+ GIT_TOOL_NAMES.RESOLVE_REVIEW_THREAD,
3044
+ (record, state) => verbLabel(
3045
+ state,
3046
+ GIT_VERBS.RESOLVE,
3047
+ `a review thread ${gitTarget.onPullRequest(record.pullNumber)}`
3048
+ )
3049
+ ],
3050
+ [
3051
+ GIT_TOOL_NAMES.REQUEST_MERGE,
3052
+ (record, state) => verbLabel(
3053
+ state,
3054
+ GIT_VERBS.ASK_MERGE,
3055
+ gitTarget.pullRequest(record.prNumber) ?? "a pull request"
3056
+ )
3057
+ ],
3058
+ [
3059
+ GIT_TOOL_NAMES.REQUEST_DEPLOY,
3060
+ (_, state) => verbLabel(state, GIT_VERBS.ASK_DEPLOY, "to production")
3061
+ ]
3062
+ ];
2849
3063
 
2850
3064
  // ../../packages/agents/src/tool-activity/interactive-view/describe-interactive-view.ts
2851
3065
  function describeInteractiveView(verb) {
@@ -2879,6 +3093,128 @@ var interactiveViewToolActivityDescribers = [
2879
3093
  ]
2880
3094
  ];
2881
3095
 
3096
+ // ../../packages/agents/src/tool-activity/native/describe-tool-search.ts
3097
+ function describeToolSearch(record, state) {
3098
+ const query = toolInput.trimmed(record.query);
3099
+ if (!query?.startsWith("select:")) {
3100
+ const target2 = query ? `the tools for "${toolInput.truncate(query, 60)}"` : "the available tools";
3101
+ return stateLabel(state, {
3102
+ done: `Searched ${target2}`,
3103
+ running: `Searching ${target2}`,
3104
+ failed: `Could not search ${target2}`
3105
+ });
3106
+ }
3107
+ const names = query.slice("select:".length).split(",").map((name) => name.trim()).filter(Boolean);
3108
+ const target = names.length === 1 ? `the ${toolInput.truncate(names[0] ?? "", 60)} tool` : `${names.length} tools`;
3109
+ return stateLabel(state, {
3110
+ done: `Loaded ${target}`,
3111
+ running: `Loading ${target}`,
3112
+ failed: `Could not load ${target}`
3113
+ });
3114
+ }
3115
+
3116
+ // ../../packages/agents/src/tool-activity/native/native-tool-activity-describers.ts
3117
+ var nativeToolActivityDescribers = [
3118
+ ["toolsearch", describeToolSearch],
3119
+ [
3120
+ "readlints",
3121
+ (_, state) => stateLabel(state, {
3122
+ done: "Read the lint diagnostics",
3123
+ running: "Reading the lint diagnostics",
3124
+ failed: "Could not read the lint diagnostics"
3125
+ })
3126
+ ]
3127
+ ];
3128
+
3129
+ // ../../packages/agents/src/tool-activity/review/review-tool-activity-describers.ts
3130
+ var reviewToolActivityDescribers = [
3131
+ [
3132
+ HOST_TOOL_NAMES.REVIEW_SCOPE,
3133
+ (record) => {
3134
+ const base = toolInput.str(record.base);
3135
+ const head = toolInput.str(record.head);
3136
+ return labelOnly(
3137
+ base && head ? `Scoped the review of ${toolInput.truncate(`${base}...${head}`, 60)}` : "Scoped the review"
3138
+ );
3139
+ }
3140
+ ],
3141
+ [
3142
+ HOST_TOOL_NAMES.FILTER_REVIEW_FINDINGS,
3143
+ (record) => {
3144
+ const count = Array.isArray(record.findings) ? record.findings.length : 0;
3145
+ return labelOnly(
3146
+ count > 0 ? `Fact-checked ${count} review finding${count === 1 ? "" : "s"}` : "Fact-checked the review findings"
3147
+ );
3148
+ }
3149
+ ],
3150
+ [
3151
+ HOST_TOOL_NAMES.SUBMIT_REVIEW_SUMMARY,
3152
+ () => labelOnly("Drew the change summary")
3153
+ ]
3154
+ ];
3155
+
3156
+ // ../../packages/agents/src/tool-activity/slides/slides-tool-activity-describers.ts
3157
+ var slidesToolActivityDescribers = [
3158
+ [HOST_TOOL_NAMES.DECK_LIST, () => labelOnly("Listed the decks")],
3159
+ [
3160
+ HOST_TOOL_NAMES.DECK_CREATE,
3161
+ (record) => {
3162
+ const title = toolInput.trimmed(record.title);
3163
+ return labelOnly(
3164
+ title ? `Created the deck \u201C${title}\u201D` : "Created a deck"
3165
+ );
3166
+ }
3167
+ ],
3168
+ [HOST_TOOL_NAMES.DECK_READ, () => labelOnly("Read the deck")],
3169
+ [
3170
+ HOST_TOOL_NAMES.DECK_WRITE_SLIDE,
3171
+ (record) => labelOnly(
3172
+ toolInput.trimmed(record.slideId) ? "Rewrote a slide" : "Added a slide"
3173
+ )
3174
+ ],
3175
+ [HOST_TOOL_NAMES.DECK_MOVE_SLIDE, () => labelOnly("Moved a slide")],
3176
+ [HOST_TOOL_NAMES.DECK_DELETE_SLIDE, () => labelOnly("Deleted a slide")],
3177
+ [HOST_TOOL_NAMES.DECK_RENDER, () => labelOnly("Rendered the deck")]
3178
+ ];
3179
+
3180
+ // ../../packages/agents/src/tool-activity/video/video-tool-activity-describers.ts
3181
+ var videoToolActivityDescribers = [
3182
+ [HOST_TOOL_NAMES.VIDEO_LIST, () => labelOnly("Listed the videos")],
3183
+ [HOST_TOOL_NAMES.VIDEO_CREATE, () => labelOnly("Created a video")],
3184
+ [HOST_TOOL_NAMES.VIDEO_READ, () => labelOnly("Read the video")],
3185
+ [
3186
+ HOST_TOOL_NAMES.VIDEO_SOURCE_RESTORE,
3187
+ () => labelOnly("Restored the video source")
3188
+ ],
3189
+ [HOST_TOOL_NAMES.VIDEO_PUBLISH, () => labelOnly("Published a video version")],
3190
+ [HOST_TOOL_NAMES.GENERATE_VOICE, () => labelOnly("Generated narration")],
3191
+ [HOST_TOOL_NAMES.GENERATE_MUSIC, () => labelOnly("Generated music")],
3192
+ [
3193
+ HOST_TOOL_NAMES.GENERATE_SOUND_EFFECT,
3194
+ () => labelOnly("Generated a sound effect")
3195
+ ],
3196
+ [HOST_TOOL_NAMES.LIST_VOICES, () => labelOnly("Listed the voices")],
3197
+ [HOST_TOOL_NAMES.VIDEO_SET_VOICES, () => labelOnly("Set the voices")]
3198
+ ];
3199
+
3200
+ // ../../packages/agents/src/tool-activity/video/labs-tool-activity-describers.ts
3201
+ var labsToolActivityDescribers = [...slidesToolActivityDescribers, ...videoToolActivityDescribers];
3202
+
3203
+ // ../../packages/agents/src/tool-activity/domain/domain-tool-activity-describers.ts
3204
+ var domainToolActivityDescribers = [
3205
+ ...integrationToolActivityDescribers,
3206
+ ...browserToolActivityDescribers,
3207
+ ...designToolActivityDescribers,
3208
+ ...labsToolActivityDescribers,
3209
+ ...automationToolActivityDescribers,
3210
+ ...reviewToolActivityDescribers,
3211
+ ...databaseToolActivityDescribers,
3212
+ ...factoryToolActivityDescribers,
3213
+ ...interactiveViewToolActivityDescribers,
3214
+ ...gitToolActivityDescribers,
3215
+ ...nativeToolActivityDescribers
3216
+ ];
3217
+
2882
3218
  // ../../packages/agents/src/teams/agent-task-update-constants.ts
2883
3219
  var AGENT_TASK_UPDATE_ACTIONS = {
2884
3220
  BLOCK: "block",
@@ -3039,33 +3375,6 @@ var canonicalToolActivityDescribers = new Map([
3039
3375
  () => labelOnly("Recorded the dev environment sizing")
3040
3376
  ],
3041
3377
  [HOST_TOOL_NAMES.BAKE_DEV_ENV, () => labelOnly("Baked the dev environment")],
3042
- [
3043
- HOST_TOOL_NAMES.DETECT_PROJECT_DATABASE,
3044
- () => labelOnly("Recorded the project database")
3045
- ],
3046
- [
3047
- HOST_TOOL_NAMES.BIND_PROJECT_DATABASE,
3048
- () => labelOnly("Requested approval to bind the project database")
3049
- ],
3050
- [
3051
- HOST_TOOL_NAMES.DATABASE_QUERY,
3052
- (record) => {
3053
- const branch = toolInput.trimmed(record.branch) ?? "production";
3054
- const sql = toolInput.verbatim(record.sql);
3055
- return sql ? { text: `Read the database (${branch})`, command: sql } : labelOnly(`Read the database (${branch})`);
3056
- }
3057
- ],
3058
- [
3059
- HOST_TOOL_NAMES.DATABASE_WRITE,
3060
- (record) => {
3061
- const branch = toolInput.trimmed(record.branch) ?? "production";
3062
- const sql = toolInput.verbatim(record.sql);
3063
- return sql ? {
3064
- text: `Requested approval to write to the database (${branch})`,
3065
- command: sql
3066
- } : labelOnly(`Requested approval to write to the database (${branch})`);
3067
- }
3068
- ],
3069
3378
  [HOST_TOOL_NAMES.TAKE_SCREENSHOT, describeTakeScreenshot],
3070
3379
  [HOST_TOOL_NAMES.RECORD_VIDEO, describeRecordVideo],
3071
3380
  [HOST_TOOL_NAMES.ATTACH_IMAGE, describeAttachImage],
@@ -3180,14 +3489,7 @@ var canonicalToolActivityDescribers = new Map([
3180
3489
  ],
3181
3490
  [HOST_TOOL_NAMES.GENERATE_IMAGE, describeGenerateImage],
3182
3491
  [HOST_TOOL_NAMES.ANNOTATE_IMAGE, describeAnnotateImage],
3183
- ...integrationToolActivityDescribers,
3184
- ...browserToolActivityDescribers,
3185
- ...designToolActivityDescribers,
3186
- ...labsToolActivityDescribers,
3187
- ...automationToolActivityDescribers,
3188
- ...reviewToolActivityDescribers,
3189
- ...factoryToolActivityDescribers,
3190
- ...interactiveViewToolActivityDescribers
3492
+ ...domainToolActivityDescribers
3191
3493
  ]);
3192
3494
 
3193
3495
  // ../../packages/agents/src/tool-activity/browser/soft-fail-browser-tools-constants.ts
@@ -3230,12 +3532,27 @@ function softFailedCapture(toolName, output) {
3230
3532
  return output.trimStart().startsWith(`${toolName} failed`);
3231
3533
  }
3232
3534
 
3535
+ // ../../packages/agents/src/tool-activity/git/git-success-prefix-constants.ts
3536
+ var GIT_SUCCESS_PREFIX = {
3537
+ [GIT_TOOL_NAMES.GIT_COMMIT]: "Committed",
3538
+ [GIT_TOOL_NAMES.GIT_PUSH]: "Pushed to"
3539
+ };
3540
+
3541
+ // ../../packages/agents/src/tool-activity/git/soft-failed-git.ts
3542
+ function softFailedGit(toolName, output) {
3543
+ const prefix = GIT_SUCCESS_PREFIX[toolName];
3544
+ if (prefix === void 0 || typeof output !== "string") {
3545
+ return false;
3546
+ }
3547
+ return !output.trimStart().startsWith(prefix);
3548
+ }
3549
+
3233
3550
  // ../../packages/agents/src/tool-activity/tool-activity-state-for.ts
3234
3551
  function toolActivityStateFor(toolName, options) {
3235
3552
  const isRunning = options?.status === "running";
3236
3553
  return {
3237
3554
  isRunning,
3238
- hasFailed: options?.status === "failed" || !isRunning && (softFailedCapture(toolName, options?.output) || softFailedBrowser(toolName, options?.output))
3555
+ hasFailed: options?.status === "failed" || !isRunning && (softFailedCapture(toolName, options?.output) || softFailedBrowser(toolName, options?.output) || softFailedGit(toolName, options?.output))
3239
3556
  };
3240
3557
  }
3241
3558