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