@impulselab/hepha 0.2.384 → 0.2.386
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 +1014 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.js
CHANGED
|
@@ -544,9 +544,9 @@ var ArgsParser = class {
|
|
|
544
544
|
if (raw === void 0) {
|
|
545
545
|
return void 0;
|
|
546
546
|
}
|
|
547
|
-
const
|
|
548
|
-
const value = Number(
|
|
549
|
-
if (
|
|
547
|
+
const trimmed2 = raw.trim();
|
|
548
|
+
const value = Number(trimmed2);
|
|
549
|
+
if (trimmed2 === "" || !Number.isFinite(value)) {
|
|
550
550
|
throw new CliError(`--${name} expects a number, got "${raw}".`, 2);
|
|
551
551
|
}
|
|
552
552
|
if (!Number.isInteger(value)) {
|
|
@@ -975,9 +975,9 @@ async function approvalsCommand(parsed) {
|
|
|
975
975
|
async function listCatalogBranches(parsed, asJson) {
|
|
976
976
|
args.expect(parsed, { positional: 1 });
|
|
977
977
|
const repoFullName = args.required(parsed, 0, "owner/repo");
|
|
978
|
-
const
|
|
979
|
-
const [owner, repo] =
|
|
980
|
-
if (
|
|
978
|
+
const segments2 = repoFullName.split("/");
|
|
979
|
+
const [owner, repo] = segments2;
|
|
980
|
+
if (segments2.length !== 2 || !owner || !repo) {
|
|
981
981
|
throw new CliError(
|
|
982
982
|
`Expected a repository as "owner/repo", got "${repoFullName}".`,
|
|
983
983
|
2
|
|
@@ -1713,8 +1713,8 @@ var ADVISOR_NOTE_STATUS = {
|
|
|
1713
1713
|
|
|
1714
1714
|
// src/lib/truncate/truncate.ts
|
|
1715
1715
|
function truncate(text, max = 2e3) {
|
|
1716
|
-
const
|
|
1717
|
-
return
|
|
1716
|
+
const trimmed2 = out.safe(text).trim();
|
|
1717
|
+
return trimmed2.length > max ? `${trimmed2.slice(0, max)}\u2026` : trimmed2;
|
|
1718
1718
|
}
|
|
1719
1719
|
|
|
1720
1720
|
// src/lib/event/format-advisor-part.ts
|
|
@@ -1735,8 +1735,1004 @@ function formatAdvisorPart(part) {
|
|
|
1735
1735
|
}
|
|
1736
1736
|
}
|
|
1737
1737
|
|
|
1738
|
+
// ../../packages/realtime/src/events/deliverable/deliverable-download-path.ts
|
|
1739
|
+
function deliverableDownloadPath(sessionId, pathname, options) {
|
|
1740
|
+
const query = new URLSearchParams({ pathname });
|
|
1741
|
+
if (options?.inline) {
|
|
1742
|
+
query.set("disposition", "inline");
|
|
1743
|
+
}
|
|
1744
|
+
return `/api/sessions/${sessionId}/deliverables?${query.toString()}`;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
// ../../packages/realtime/src/events/attachment/format-attachment-size.ts
|
|
1748
|
+
function formatAttachmentSize(bytes) {
|
|
1749
|
+
if (bytes < 1024) {
|
|
1750
|
+
return `${bytes} B`;
|
|
1751
|
+
}
|
|
1752
|
+
const kb = bytes / 1024;
|
|
1753
|
+
if (kb < 1024) {
|
|
1754
|
+
return `${kb.toFixed(0)} KB`;
|
|
1755
|
+
}
|
|
1756
|
+
return `${(kb / 1024).toFixed(1)} MB`;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
// src/lib/event/format-deliverable-part.ts
|
|
1760
|
+
function formatDeliverablePart(part, sessionId, baseUrl) {
|
|
1761
|
+
const entries = part.archive ? `, ${part.archive.entryCount} entries` : "";
|
|
1762
|
+
const size = `${formatAttachmentSize(part.sizeBytes)}${entries}`;
|
|
1763
|
+
const caption = part.caption ? ` - ${out.cell(part.caption)}` : "";
|
|
1764
|
+
const link = `${baseUrl}${deliverableDownloadPath(sessionId, part.pathname)}`;
|
|
1765
|
+
return `${out.paint("attach", "dim")} ${out.cell(part.name)} ${out.paint(`(${size})`, "dim")}${caption}
|
|
1766
|
+
${out.cell(link)}`;
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
// ../../packages/agents/src/turns/turn-constants.ts
|
|
1770
|
+
var SESSION_TERMINATION_MODES = {
|
|
1771
|
+
DESTROY: "destroy",
|
|
1772
|
+
DETACH: "detach",
|
|
1773
|
+
STOP: "stop",
|
|
1774
|
+
SUSPEND_TURN: "suspend-turn"
|
|
1775
|
+
};
|
|
1776
|
+
var ALL_SESSION_TERMINATION_MODES = Object.values(
|
|
1777
|
+
SESSION_TERMINATION_MODES
|
|
1778
|
+
);
|
|
1779
|
+
var HOST_TOOL_NAMES = {
|
|
1780
|
+
ADVISE: "advise",
|
|
1781
|
+
ASK_USER: "ask_user",
|
|
1782
|
+
SAVE_DEV_ENV_MANIFEST: "save_dev_env_manifest",
|
|
1783
|
+
REQUEST_DEV_ENV_CREDENTIALS: "request_dev_env_credentials",
|
|
1784
|
+
GENERATE_DEV_ENV_SECRET: "generate_dev_env_secret",
|
|
1785
|
+
SET_DEV_ENV_SIZING: "set_dev_env_sizing",
|
|
1786
|
+
BAKE_DEV_ENV: "bake_dev_env",
|
|
1787
|
+
PROPOSE_PLAN: "propose_plan",
|
|
1788
|
+
REPORT_CONFIDENCE: "report_confidence",
|
|
1789
|
+
REQUEST_GUARDRAIL_APPROVAL: "request_guardrail_approval",
|
|
1790
|
+
// Somnium, mid-run: the automatic recall only fires on a session's FIRST
|
|
1791
|
+
// prompt, so the agent reads on demand and writes what it learns.
|
|
1792
|
+
MEMORY_SEARCH: "memory_search",
|
|
1793
|
+
MEMORY_WRITE: "memory_write",
|
|
1794
|
+
SKILL_SEARCH: "skill_search",
|
|
1795
|
+
SKILL_LOAD: "skill_load",
|
|
1796
|
+
SAVE_SKILL: "save_skill",
|
|
1797
|
+
RECORD_REVIEW_LESSON: "record_review_lesson",
|
|
1798
|
+
// Proposes an EDIT to a skill already in the registry: a version above the
|
|
1799
|
+
// skill's current one, invisible to sessions until a human approves it
|
|
1800
|
+
// (docs/08-skills/01-registry.md).
|
|
1801
|
+
PROPOSE_SKILL_EDIT: "propose_skill_edit",
|
|
1802
|
+
DELIVERABLE_PUBLISH: "deliverable_publish",
|
|
1803
|
+
// Design mode: pull a round of static bundles out of the sandbox, store them
|
|
1804
|
+
// as immutable versions, and hand back the public link the panel mirrors.
|
|
1805
|
+
PUBLISH_DESIGN: "publish_design",
|
|
1806
|
+
SET_LIVE_DESIGN: "set_live_design",
|
|
1807
|
+
// Advisory dynamic playbook (WS6): the agent defines its own ordered steps
|
|
1808
|
+
// (set_steps) and fills each step's todo checklist (set_todos). Replaces the
|
|
1809
|
+
// fixed 5-phase set_phase pointer; neither parks the turn, the runner park
|
|
1810
|
+
// logic is untouched. A step's status is derived from its todos.
|
|
1811
|
+
SET_STEPS: "set_steps",
|
|
1812
|
+
SET_TODOS: "set_todos",
|
|
1813
|
+
// The chat's title is generated from the FIRST prompt by the platform's
|
|
1814
|
+
// small model. This lets the agent correct it mid-run when the real scope
|
|
1815
|
+
// turns out to be something else, and only then (see the pipeline
|
|
1816
|
+
// templates). Refused once a human has renamed the chat; never parks.
|
|
1817
|
+
RENAME_SESSION: "rename_session",
|
|
1818
|
+
// Files an issue in Hephaistos' own Linear tracker; never parks the turn.
|
|
1819
|
+
REPORT_HARNESS_ISSUE: "report_harness_issue",
|
|
1820
|
+
RUN_VALIDATION: "run_validation",
|
|
1821
|
+
// Media tool (Stage 1): generate images host-side via the AI Gateway; the
|
|
1822
|
+
// result renders inline in the thread. Always available, never parks the
|
|
1823
|
+
// turn.
|
|
1824
|
+
GENERATE_IMAGE: "generate_image",
|
|
1825
|
+
// In-sandbox annotation (#43): renders the source image + an SVG overlay in
|
|
1826
|
+
// the sandbox's chromium and screenshots it. NEVER host-side, the previous
|
|
1827
|
+
// @napi-rs/canvas implementation broke the glibc Trigger.dev worker deploy.
|
|
1828
|
+
ANNOTATE_IMAGE: "annotate_image",
|
|
1829
|
+
// WS8: the admin-configured image_generator registry, the agent reads the
|
|
1830
|
+
// enabled {model, description} rows to pick a model for generate_image.
|
|
1831
|
+
GET_IMAGE_GENERATORS: "get_image_generators",
|
|
1832
|
+
// Capture tools (Stage 2): drive a headless chromium INSIDE the session's
|
|
1833
|
+
// sandbox to screenshot / record a running app URL (or a file:// the agent
|
|
1834
|
+
// rendered), then attach the result inline. Provision the sandbox on demand
|
|
1835
|
+
// (WS7), always exposed.
|
|
1836
|
+
TAKE_SCREENSHOT: "take_screenshot",
|
|
1837
|
+
RECORD_VIDEO: "record_video",
|
|
1838
|
+
// Interactive browser control: ONE persistent chromium per sandbox, one
|
|
1839
|
+
// context per session, driven by the in-sandbox daemon (packages/tasks
|
|
1840
|
+
// lib/browser). The snapshot is an accessibility tree with `ref=eN` handles
|
|
1841
|
+
// the act tool targets, no coordinates, no throwaway playwright script.
|
|
1842
|
+
BROWSER_NAVIGATE: "browser_navigate",
|
|
1843
|
+
BROWSER_SNAPSHOT: "browser_snapshot",
|
|
1844
|
+
BROWSER_ACT: "browser_act",
|
|
1845
|
+
BROWSER_WAIT: "browser_wait",
|
|
1846
|
+
BROWSER_INSPECT: "browser_inspect",
|
|
1847
|
+
BROWSER_SCREENSHOT: "browser_screenshot",
|
|
1848
|
+
// A recording is a PAIR: playwright only films a context it created with
|
|
1849
|
+
// recording on, so start recycles the context and stop hands back the clip.
|
|
1850
|
+
BROWSER_RECORD_START: "browser_record_start",
|
|
1851
|
+
BROWSER_RECORD_STOP: "browser_record_stop",
|
|
1852
|
+
BROWSER_CLOSE: "browser_close",
|
|
1853
|
+
// The escape hatch: JS evaluated in a Node context that SURVIVES between
|
|
1854
|
+
// calls, with the live page bound into it.
|
|
1855
|
+
REPL_EVAL: "repl_eval",
|
|
1856
|
+
REPL_RESET: "repl_reset",
|
|
1857
|
+
// WS5: upload a PNG the agent produced in the sandbox (script/python/write)
|
|
1858
|
+
// as a media reference, silent for ask_user option images, inline otherwise.
|
|
1859
|
+
ATTACH_IMAGE: "attach_image",
|
|
1860
|
+
// Browser-session vault: sites a human captured with the Hephaistos
|
|
1861
|
+
// extension, applied to the live browser one domain at a time, on demand.
|
|
1862
|
+
BROWSER_SESSIONS_LIST: "browser_sessions_list",
|
|
1863
|
+
BROWSER_USE_SESSION: "browser_use_session",
|
|
1864
|
+
BROWSER_FORGET_SESSION: "browser_forget_session",
|
|
1865
|
+
// Outbound files: any format the human should keep, uploaded from the sandbox
|
|
1866
|
+
// to durable storage and downloadable once the sandbox is gone.
|
|
1867
|
+
ATTACH_FILE: "attach_file",
|
|
1868
|
+
// Delegation: a task is the work, a session is one attempt at it. The agent
|
|
1869
|
+
// describes the task and the PLATFORM dispatches it; these address the task,
|
|
1870
|
+
// never a runner. Fire-and-forget, none of them park the turn.
|
|
1871
|
+
CREATE_TASK: "create_task",
|
|
1872
|
+
LIST_TASKS: "list_tasks",
|
|
1873
|
+
UPDATE_TASK: "update_task",
|
|
1874
|
+
PEEK_TASK: "peek_task",
|
|
1875
|
+
SEND_TO_TASK: "send_to_task",
|
|
1876
|
+
STOP_TASK: "stop_task",
|
|
1877
|
+
PICKUP_TASK: "pickup_task",
|
|
1878
|
+
// docs/integrations/database-access.md; detect is environment-setup only.
|
|
1879
|
+
DATABASE_QUERY: "database_query",
|
|
1880
|
+
DATABASE_WRITE: "database_write",
|
|
1881
|
+
DETECT_PROJECT_DATABASE: "detect_project_database",
|
|
1882
|
+
BIND_PROJECT_DATABASE: "bind_project_database",
|
|
1883
|
+
// Historical: the agent-addressed family the tools above replaced. No agent
|
|
1884
|
+
// can call them, but old transcripts still render rows named after them.
|
|
1885
|
+
SPAWN_AGENT: "spawn_agent",
|
|
1886
|
+
LIST_AGENTS: "list_agents",
|
|
1887
|
+
PEEK_AGENT: "peek_agent",
|
|
1888
|
+
SEND_TO_AGENT: "send_to_agent",
|
|
1889
|
+
STOP_AGENT: "stop_agent"
|
|
1890
|
+
};
|
|
1891
|
+
var ALL_HOST_TOOL_NAMES = Object.values(HOST_TOOL_NAMES);
|
|
1892
|
+
var TURN_CLOSING_TOOL_NAMES = [
|
|
1893
|
+
HOST_TOOL_NAMES.UPDATE_TASK,
|
|
1894
|
+
HOST_TOOL_NAMES.CREATE_TASK
|
|
1895
|
+
];
|
|
1896
|
+
var WORKSPACE_TOOL_NAMES = {
|
|
1897
|
+
BASH: "workspace_bash",
|
|
1898
|
+
READ: "workspace_read",
|
|
1899
|
+
WRITE: "workspace_write",
|
|
1900
|
+
EDIT: "workspace_edit",
|
|
1901
|
+
GLOB: "workspace_glob",
|
|
1902
|
+
GREP: "workspace_grep",
|
|
1903
|
+
TASK_OUTPUT: "workspace_task_output",
|
|
1904
|
+
TASK_STOP: "workspace_task_stop"
|
|
1905
|
+
};
|
|
1906
|
+
var AGENT_MESSAGE_DELIVERY_MODES = {
|
|
1907
|
+
INTERRUPT: "interrupt",
|
|
1908
|
+
AFTER_TOOL: "after_tool",
|
|
1909
|
+
QUEUE: "queue"
|
|
1910
|
+
};
|
|
1911
|
+
var ALL_AGENT_MESSAGE_DELIVERY_MODES = Object.values(
|
|
1912
|
+
AGENT_MESSAGE_DELIVERY_MODES
|
|
1913
|
+
);
|
|
1914
|
+
var DEFAULT_AGENT_MESSAGE_DELIVERY_MODE = AGENT_MESSAGE_DELIVERY_MODES.AFTER_TOOL;
|
|
1915
|
+
|
|
1916
|
+
// ../../packages/agents/src/tool-activity/canonical/canonical-tool-name-constants.ts
|
|
1917
|
+
var NATIVE_EQUIVALENT = {
|
|
1918
|
+
[WORKSPACE_TOOL_NAMES.BASH]: "bash",
|
|
1919
|
+
[WORKSPACE_TOOL_NAMES.READ]: "read",
|
|
1920
|
+
[WORKSPACE_TOOL_NAMES.WRITE]: "write",
|
|
1921
|
+
[WORKSPACE_TOOL_NAMES.EDIT]: "edit",
|
|
1922
|
+
[WORKSPACE_TOOL_NAMES.GLOB]: "glob",
|
|
1923
|
+
[WORKSPACE_TOOL_NAMES.GREP]: "grep"
|
|
1924
|
+
};
|
|
1925
|
+
|
|
1926
|
+
// ../../packages/agents/src/tool-activity/tool-input/is-record.ts
|
|
1927
|
+
function isRecord(value) {
|
|
1928
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1929
|
+
}
|
|
1930
|
+
|
|
1931
|
+
// ../../packages/agents/src/tool-activity/tool-input/str.ts
|
|
1932
|
+
function str(value) {
|
|
1933
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
1934
|
+
}
|
|
1935
|
+
|
|
1936
|
+
// ../../packages/agents/src/tool-activity/tool-input/trimmed.ts
|
|
1937
|
+
function trimmed(value) {
|
|
1938
|
+
const text = str(value)?.trim();
|
|
1939
|
+
return text ? text : null;
|
|
1940
|
+
}
|
|
1941
|
+
|
|
1942
|
+
// ../../packages/agents/src/tool-activity/tool-input/truncate.ts
|
|
1943
|
+
function truncate2(value, max) {
|
|
1944
|
+
const text = value.trim();
|
|
1945
|
+
return text.length > max ? `${text.slice(0, max - 1)}\u2026` : text;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
// ../../packages/agents/src/tool-activity/tool-input/verbatim.ts
|
|
1949
|
+
function verbatim(value) {
|
|
1950
|
+
const text = str(value);
|
|
1951
|
+
return text && text.trim().length > 0 ? text : null;
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
// ../../packages/agents/src/tool-activity/tool-input.ts
|
|
1955
|
+
var toolInput = { isRecord, str, trimmed, truncate: truncate2, verbatim };
|
|
1956
|
+
|
|
1957
|
+
// ../../packages/agents/src/tool-activity/label-only.ts
|
|
1958
|
+
function labelOnly(text) {
|
|
1959
|
+
return { text, command: null };
|
|
1960
|
+
}
|
|
1961
|
+
|
|
1962
|
+
// ../../packages/agents/src/tool-activity/tool-activity-basename.ts
|
|
1963
|
+
function toolActivityBasename(path2) {
|
|
1964
|
+
if (!path2) {
|
|
1965
|
+
return void 0;
|
|
1966
|
+
}
|
|
1967
|
+
const segments2 = path2.split(/[/\\]/).filter(Boolean);
|
|
1968
|
+
return segments2.at(-1) ?? path2;
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
// ../../packages/agents/src/tool-activity/tool-activity-hostname.ts
|
|
1972
|
+
function toolActivityHostname(url) {
|
|
1973
|
+
if (!url) {
|
|
1974
|
+
return void 0;
|
|
1975
|
+
}
|
|
1976
|
+
try {
|
|
1977
|
+
return new URL(url).hostname;
|
|
1978
|
+
} catch {
|
|
1979
|
+
return url.replace(/^https?:\/\//, "").split("/")[0] || void 0;
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
|
|
1983
|
+
// ../../packages/agents/src/tool-activity/browser/browser-label.ts
|
|
1984
|
+
function browserLabel(state, labels) {
|
|
1985
|
+
if (state.hasFailed) return labelOnly(labels.failed);
|
|
1986
|
+
return labelOnly(state.isRunning ? labels.running : labels.done);
|
|
1987
|
+
}
|
|
1988
|
+
|
|
1989
|
+
// ../../packages/agents/src/tool-activity/browser/browser-activity-constants.ts
|
|
1990
|
+
var BROWSER_ACT_VERBS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
1991
|
+
click: { done: "Clicked", gerund: "Clicking", bare: "click" },
|
|
1992
|
+
dblclick: {
|
|
1993
|
+
done: "Double-clicked",
|
|
1994
|
+
gerund: "Double-clicking",
|
|
1995
|
+
bare: "double-click"
|
|
1996
|
+
},
|
|
1997
|
+
fill: { done: "Filled", gerund: "Filling", bare: "fill" },
|
|
1998
|
+
type: { done: "Typed into", gerund: "Typing into", bare: "type into" },
|
|
1999
|
+
select: { done: "Selected in", gerund: "Selecting in", bare: "select in" },
|
|
2000
|
+
check: { done: "Checked", gerund: "Checking", bare: "check" },
|
|
2001
|
+
uncheck: { done: "Unchecked", gerund: "Unchecking", bare: "uncheck" },
|
|
2002
|
+
hover: { done: "Hovered", gerund: "Hovering", bare: "hover" },
|
|
2003
|
+
press: {
|
|
2004
|
+
done: "Pressed a key on",
|
|
2005
|
+
gerund: "Pressing a key on",
|
|
2006
|
+
bare: "press a key on"
|
|
2007
|
+
},
|
|
2008
|
+
scroll: { done: "Scrolled", gerund: "Scrolling", bare: "scroll" },
|
|
2009
|
+
upload: {
|
|
2010
|
+
done: "Uploaded a file to",
|
|
2011
|
+
gerund: "Uploading a file to",
|
|
2012
|
+
bare: "upload a file to"
|
|
2013
|
+
}
|
|
2014
|
+
});
|
|
2015
|
+
var BROWSER_HISTORY_LABELS = Object.assign(/* @__PURE__ */ Object.create(null), {
|
|
2016
|
+
back: { done: "Went back", gerund: "Going back", bare: "go back" },
|
|
2017
|
+
forward: {
|
|
2018
|
+
done: "Went forward",
|
|
2019
|
+
gerund: "Going forward",
|
|
2020
|
+
bare: "go forward"
|
|
2021
|
+
},
|
|
2022
|
+
reload: {
|
|
2023
|
+
done: "Reloaded the page",
|
|
2024
|
+
gerund: "Reloading the page",
|
|
2025
|
+
bare: "reload the page"
|
|
2026
|
+
}
|
|
2027
|
+
});
|
|
2028
|
+
|
|
2029
|
+
// ../../packages/agents/src/tool-activity/browser/describe-browser-act.ts
|
|
2030
|
+
function describeBrowserAct(record, state) {
|
|
2031
|
+
const action = toolInput.str(record.action) ?? "click";
|
|
2032
|
+
const verb = (Object.hasOwn(BROWSER_ACT_VERBS, action) ? BROWSER_ACT_VERBS[action] : void 0) ?? {
|
|
2033
|
+
done: "Acted on",
|
|
2034
|
+
gerund: "Acting on",
|
|
2035
|
+
bare: "act on"
|
|
2036
|
+
};
|
|
2037
|
+
const target = toolInput.trimmed(record.name) ?? toolInput.trimmed(record.selector) ?? toolInput.trimmed(record.ref) ?? toolInput.trimmed(record.role);
|
|
2038
|
+
const subject = target ? toolInput.truncate(target, 60) : "an element";
|
|
2039
|
+
return browserLabel(state, {
|
|
2040
|
+
failed: `Could not ${verb.bare} ${subject}`,
|
|
2041
|
+
running: `${verb.gerund} ${subject}`,
|
|
2042
|
+
done: `${verb.done} ${subject}`
|
|
2043
|
+
});
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
// ../../packages/agents/src/tool-activity/browser/describe-browser-navigate.ts
|
|
2047
|
+
function describeBrowserNavigate(record, state) {
|
|
2048
|
+
const action = toolInput.str(record.action);
|
|
2049
|
+
if (action && action !== "goto") {
|
|
2050
|
+
const move = Object.hasOwn(BROWSER_HISTORY_LABELS, action) ? BROWSER_HISTORY_LABELS[action] : void 0;
|
|
2051
|
+
return move ? browserLabel(state, {
|
|
2052
|
+
failed: `Could not ${move.bare}`,
|
|
2053
|
+
running: move.gerund,
|
|
2054
|
+
done: move.done
|
|
2055
|
+
}) : browserLabel(state, {
|
|
2056
|
+
failed: "Could not move in the browser",
|
|
2057
|
+
running: "Moving in the browser",
|
|
2058
|
+
done: "Moved in the browser"
|
|
2059
|
+
});
|
|
2060
|
+
}
|
|
2061
|
+
const host = toolActivityHostname(toolInput.str(record.url));
|
|
2062
|
+
const subject = host ?? "a page";
|
|
2063
|
+
return browserLabel(state, {
|
|
2064
|
+
failed: `Could not open ${subject}`,
|
|
2065
|
+
running: `Opening ${subject}`,
|
|
2066
|
+
done: `Opened ${subject}`
|
|
2067
|
+
});
|
|
2068
|
+
}
|
|
2069
|
+
|
|
2070
|
+
// ../../packages/agents/src/tool-activity/capture/capture-label.ts
|
|
2071
|
+
function captureLabel(labels, state, options) {
|
|
2072
|
+
if (options.isOption) {
|
|
2073
|
+
if (state.hasFailed) {
|
|
2074
|
+
return labelOnly(labels.optionFailed);
|
|
2075
|
+
}
|
|
2076
|
+
return labelOnly(
|
|
2077
|
+
state.isRunning ? labels.optionRunning : labels.optionDone
|
|
2078
|
+
);
|
|
2079
|
+
}
|
|
2080
|
+
if (state.hasFailed) {
|
|
2081
|
+
return labelOnly(labels.failed(options.subject));
|
|
2082
|
+
}
|
|
2083
|
+
return labelOnly(
|
|
2084
|
+
state.isRunning ? labels.running(options.subject) : labels.done(options.subject)
|
|
2085
|
+
);
|
|
2086
|
+
}
|
|
2087
|
+
|
|
2088
|
+
// ../../packages/agents/src/tool-activity/capture/capture-target.ts
|
|
2089
|
+
function captureTarget(url) {
|
|
2090
|
+
if (!url) {
|
|
2091
|
+
return void 0;
|
|
2092
|
+
}
|
|
2093
|
+
try {
|
|
2094
|
+
const parsed = new URL(url);
|
|
2095
|
+
if (parsed.protocol === "file:") {
|
|
2096
|
+
return toolActivityBasename(parsed.pathname) ?? url;
|
|
2097
|
+
}
|
|
2098
|
+
return parsed.host || parsed.hostname;
|
|
2099
|
+
} catch {
|
|
2100
|
+
return toolActivityBasename(url) ?? url;
|
|
2101
|
+
}
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
// ../../packages/agents/src/tool-activity/capture/capture-label-constants.ts
|
|
2105
|
+
var CAPTURE_LABEL_MAX = 60;
|
|
2106
|
+
|
|
2107
|
+
// ../../packages/agents/src/tool-activity/capture/describe-take-screenshot.ts
|
|
2108
|
+
function describeTakeScreenshot(record, state) {
|
|
2109
|
+
const target = captureTarget(toolInput.str(record.url));
|
|
2110
|
+
return captureLabel(
|
|
2111
|
+
{
|
|
2112
|
+
optionFailed: "Failed to take an option screenshot",
|
|
2113
|
+
optionRunning: "Taking an option screenshot",
|
|
2114
|
+
optionDone: "Took an option screenshot",
|
|
2115
|
+
failed: (subject) => subject ? `Failed to screenshot ${subject}` : "Failed to take a screenshot",
|
|
2116
|
+
running: (subject) => subject ? `Taking a screenshot of ${subject}` : "Taking a screenshot",
|
|
2117
|
+
done: (subject) => subject ? `Took a screenshot of ${subject}` : "Took a screenshot"
|
|
2118
|
+
},
|
|
2119
|
+
state,
|
|
2120
|
+
{
|
|
2121
|
+
isOption: record.silent === true,
|
|
2122
|
+
subject: target ? toolInput.truncate(target, CAPTURE_LABEL_MAX) : null
|
|
2123
|
+
}
|
|
2124
|
+
);
|
|
2125
|
+
}
|
|
2126
|
+
|
|
2127
|
+
// ../../packages/agents/src/tool-activity/browser/browser-tool-activity-describers.ts
|
|
2128
|
+
var browserToolActivityDescribers = [
|
|
2129
|
+
[HOST_TOOL_NAMES.BROWSER_NAVIGATE, describeBrowserNavigate],
|
|
2130
|
+
[HOST_TOOL_NAMES.BROWSER_ACT, describeBrowserAct],
|
|
2131
|
+
[
|
|
2132
|
+
HOST_TOOL_NAMES.BROWSER_SNAPSHOT,
|
|
2133
|
+
(_record, state) => browserLabel(state, {
|
|
2134
|
+
failed: "Could not read the page",
|
|
2135
|
+
running: "Reading the page",
|
|
2136
|
+
done: "Read the page"
|
|
2137
|
+
})
|
|
2138
|
+
],
|
|
2139
|
+
[
|
|
2140
|
+
HOST_TOOL_NAMES.BROWSER_WAIT,
|
|
2141
|
+
(_record, state) => browserLabel(state, {
|
|
2142
|
+
failed: "Gave up waiting for the page",
|
|
2143
|
+
running: "Waiting for the page",
|
|
2144
|
+
done: "Waited for the page"
|
|
2145
|
+
})
|
|
2146
|
+
],
|
|
2147
|
+
[
|
|
2148
|
+
HOST_TOOL_NAMES.BROWSER_INSPECT,
|
|
2149
|
+
(_record, state) => browserLabel(state, {
|
|
2150
|
+
failed: "Could not read the console and network",
|
|
2151
|
+
running: "Reading the console and network",
|
|
2152
|
+
done: "Read the console and network"
|
|
2153
|
+
})
|
|
2154
|
+
],
|
|
2155
|
+
[
|
|
2156
|
+
HOST_TOOL_NAMES.BROWSER_SCREENSHOT,
|
|
2157
|
+
(record, state) => describeTakeScreenshot(record, state)
|
|
2158
|
+
],
|
|
2159
|
+
[
|
|
2160
|
+
HOST_TOOL_NAMES.BROWSER_RECORD_START,
|
|
2161
|
+
(_record, state) => browserLabel(state, {
|
|
2162
|
+
failed: "Could not start recording",
|
|
2163
|
+
running: "Starting a recording",
|
|
2164
|
+
done: "Started recording the browser"
|
|
2165
|
+
})
|
|
2166
|
+
],
|
|
2167
|
+
[
|
|
2168
|
+
HOST_TOOL_NAMES.BROWSER_RECORD_STOP,
|
|
2169
|
+
(_record, state) => browserLabel(state, {
|
|
2170
|
+
failed: "Could not finish the recording",
|
|
2171
|
+
running: "Finishing the recording",
|
|
2172
|
+
done: "Recorded the browser"
|
|
2173
|
+
})
|
|
2174
|
+
],
|
|
2175
|
+
[
|
|
2176
|
+
HOST_TOOL_NAMES.BROWSER_CLOSE,
|
|
2177
|
+
(_record, state) => browserLabel(state, {
|
|
2178
|
+
failed: "Could not close the browser",
|
|
2179
|
+
running: "Closing the browser",
|
|
2180
|
+
done: "Closed the browser"
|
|
2181
|
+
})
|
|
2182
|
+
],
|
|
2183
|
+
[
|
|
2184
|
+
HOST_TOOL_NAMES.BROWSER_SESSIONS_LIST,
|
|
2185
|
+
(_record, state) => browserLabel(state, {
|
|
2186
|
+
failed: "Could not read your captured logins",
|
|
2187
|
+
running: "Listing your captured logins",
|
|
2188
|
+
done: "Listed your captured logins"
|
|
2189
|
+
})
|
|
2190
|
+
],
|
|
2191
|
+
[
|
|
2192
|
+
// The site, never what the vault holds for it.
|
|
2193
|
+
HOST_TOOL_NAMES.BROWSER_USE_SESSION,
|
|
2194
|
+
(record, state) => {
|
|
2195
|
+
const domain = toolInput.str(record.domain);
|
|
2196
|
+
return browserLabel(state, {
|
|
2197
|
+
failed: domain ? `Could not sign in to ${domain} as you` : "Could not load a captured login",
|
|
2198
|
+
running: domain ? `Signing in to ${domain} as you` : "Loading a captured login",
|
|
2199
|
+
done: domain ? `Signed in to ${domain} as you` : "Loaded a captured login"
|
|
2200
|
+
});
|
|
2201
|
+
}
|
|
2202
|
+
],
|
|
2203
|
+
[
|
|
2204
|
+
HOST_TOOL_NAMES.BROWSER_FORGET_SESSION,
|
|
2205
|
+
(_record, state) => browserLabel(state, {
|
|
2206
|
+
failed: "Could not forget the captured logins",
|
|
2207
|
+
running: "Forgetting the captured logins",
|
|
2208
|
+
done: "Forgot the captured logins"
|
|
2209
|
+
})
|
|
2210
|
+
],
|
|
2211
|
+
[
|
|
2212
|
+
HOST_TOOL_NAMES.REPL_EVAL,
|
|
2213
|
+
(_record, state) => browserLabel(state, {
|
|
2214
|
+
failed: "JavaScript in the REPL failed",
|
|
2215
|
+
running: "Running JavaScript in the REPL",
|
|
2216
|
+
done: "Ran JavaScript in the REPL"
|
|
2217
|
+
})
|
|
2218
|
+
],
|
|
2219
|
+
[
|
|
2220
|
+
HOST_TOOL_NAMES.REPL_RESET,
|
|
2221
|
+
(_record, state) => browserLabel(state, {
|
|
2222
|
+
failed: "Could not reset the REPL",
|
|
2223
|
+
running: "Resetting the REPL",
|
|
2224
|
+
done: "Reset the REPL"
|
|
2225
|
+
})
|
|
2226
|
+
]
|
|
2227
|
+
];
|
|
2228
|
+
|
|
2229
|
+
// ../../packages/agents/src/tool-activity/capture/describe-annotate-image.ts
|
|
2230
|
+
function describeAnnotateImage(record, state) {
|
|
2231
|
+
return captureLabel(
|
|
2232
|
+
{
|
|
2233
|
+
optionFailed: "Failed to annotate an option image",
|
|
2234
|
+
optionRunning: "Annotating an option image",
|
|
2235
|
+
optionDone: "Annotated an option image",
|
|
2236
|
+
failed: () => "Failed to annotate an image",
|
|
2237
|
+
running: () => "Annotating an image",
|
|
2238
|
+
done: () => "Annotated an image"
|
|
2239
|
+
},
|
|
2240
|
+
state,
|
|
2241
|
+
{ isOption: record.silent === true, subject: null }
|
|
2242
|
+
);
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
// ../../packages/agents/src/tool-activity/capture/describe-attach-image.ts
|
|
2246
|
+
function describeAttachImage(record, state) {
|
|
2247
|
+
const file = toolActivityBasename(toolInput.str(record.path));
|
|
2248
|
+
return captureLabel(
|
|
2249
|
+
{
|
|
2250
|
+
optionFailed: "Failed to attach an option image",
|
|
2251
|
+
optionRunning: "Attaching an option image",
|
|
2252
|
+
optionDone: "Attached an option image",
|
|
2253
|
+
failed: (subject) => subject ? `Failed to attach ${subject}` : "Failed to attach an image",
|
|
2254
|
+
running: (subject) => subject ? `Attaching ${subject}` : "Attaching an image",
|
|
2255
|
+
done: (subject) => subject ? `Attached ${subject}` : "Attached an image"
|
|
2256
|
+
},
|
|
2257
|
+
state,
|
|
2258
|
+
{
|
|
2259
|
+
isOption: record.silent === true,
|
|
2260
|
+
subject: file ? toolInput.truncate(file, CAPTURE_LABEL_MAX) : null
|
|
2261
|
+
}
|
|
2262
|
+
);
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
// ../../packages/agents/src/tool-activity/capture/describe-generate-image.ts
|
|
2266
|
+
function describeGenerateImage(_record, state) {
|
|
2267
|
+
return captureLabel(
|
|
2268
|
+
{
|
|
2269
|
+
optionFailed: "Failed to generate an image",
|
|
2270
|
+
optionRunning: "Generating an image",
|
|
2271
|
+
optionDone: "Generated an image",
|
|
2272
|
+
failed: () => "Failed to generate an image",
|
|
2273
|
+
running: () => "Generating an image",
|
|
2274
|
+
done: () => "Generated an image"
|
|
2275
|
+
},
|
|
2276
|
+
state,
|
|
2277
|
+
{ isOption: false, subject: null }
|
|
2278
|
+
);
|
|
2279
|
+
}
|
|
2280
|
+
|
|
2281
|
+
// ../../packages/agents/src/tool-activity/capture/describe-record-video.ts
|
|
2282
|
+
function describeRecordVideo(record, state) {
|
|
2283
|
+
const target = captureTarget(toolInput.str(record.url));
|
|
2284
|
+
return captureLabel(
|
|
2285
|
+
{
|
|
2286
|
+
// record_video has no option variant: a strip thumb is a still image.
|
|
2287
|
+
optionFailed: "Failed to record a video",
|
|
2288
|
+
optionRunning: "Recording a video",
|
|
2289
|
+
optionDone: "Recorded a video",
|
|
2290
|
+
failed: (subject) => subject ? `Failed to record a video of ${subject}` : "Failed to record a video",
|
|
2291
|
+
running: (subject) => subject ? `Recording a video of ${subject}` : "Recording a video",
|
|
2292
|
+
done: (subject) => subject ? `Recorded a video of ${subject}` : "Recorded a video"
|
|
2293
|
+
},
|
|
2294
|
+
state,
|
|
2295
|
+
{
|
|
2296
|
+
isOption: false,
|
|
2297
|
+
subject: target ? toolInput.truncate(target, CAPTURE_LABEL_MAX) : null
|
|
2298
|
+
}
|
|
2299
|
+
);
|
|
2300
|
+
}
|
|
2301
|
+
|
|
2302
|
+
// ../../packages/agents/src/tool-activity/canonical/describe-memory-search.ts
|
|
2303
|
+
function describeMemorySearch(record) {
|
|
2304
|
+
const query = toolInput.str(record.query);
|
|
2305
|
+
return labelOnly(
|
|
2306
|
+
query ? `Searched its memory: ${toolInput.truncate(query, 60)}` : "Searched its memory"
|
|
2307
|
+
);
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
// ../../packages/agents/src/tool-activity/deliverable/describe-attach-file.ts
|
|
2311
|
+
function describeAttachFile(record, state) {
|
|
2312
|
+
const file = toolActivityBasename(toolInput.str(record.path));
|
|
2313
|
+
const subject = file ?? "a file";
|
|
2314
|
+
if (state.hasFailed) {
|
|
2315
|
+
return labelOnly(`Failed to deliver ${subject}`);
|
|
2316
|
+
}
|
|
2317
|
+
return labelOnly(
|
|
2318
|
+
state.isRunning ? `Delivering ${subject}` : `Delivered ${subject}`
|
|
2319
|
+
);
|
|
2320
|
+
}
|
|
2321
|
+
|
|
2322
|
+
// ../../packages/agents/src/teams/agent-task-update-constants.ts
|
|
2323
|
+
var AGENT_TASK_UPDATE_ACTIONS = {
|
|
2324
|
+
BLOCK: "block",
|
|
2325
|
+
COMPLETE: "complete",
|
|
2326
|
+
FAIL: "fail",
|
|
2327
|
+
HEARTBEAT: "heartbeat",
|
|
2328
|
+
PROGRESS: "progress",
|
|
2329
|
+
RELEASE: "release"
|
|
2330
|
+
};
|
|
2331
|
+
var OPEN_AGENT_TASK_UPDATE_ACTIONS = [
|
|
2332
|
+
AGENT_TASK_UPDATE_ACTIONS.HEARTBEAT,
|
|
2333
|
+
AGENT_TASK_UPDATE_ACTIONS.PROGRESS,
|
|
2334
|
+
AGENT_TASK_UPDATE_ACTIONS.RELEASE
|
|
2335
|
+
];
|
|
2336
|
+
|
|
2337
|
+
// ../../packages/agents/src/tool-activity/canonical/update-task-labels.ts
|
|
2338
|
+
var updateTaskLabels = new Map(
|
|
2339
|
+
Object.entries({
|
|
2340
|
+
[AGENT_TASK_UPDATE_ACTIONS.BLOCK]: "Blocked a task",
|
|
2341
|
+
[AGENT_TASK_UPDATE_ACTIONS.COMPLETE]: "Completed a task",
|
|
2342
|
+
[AGENT_TASK_UPDATE_ACTIONS.FAIL]: "Marked a task failed",
|
|
2343
|
+
[AGENT_TASK_UPDATE_ACTIONS.HEARTBEAT]: "Kept a task alive",
|
|
2344
|
+
[AGENT_TASK_UPDATE_ACTIONS.PROGRESS]: "Reported progress on a task",
|
|
2345
|
+
[AGENT_TASK_UPDATE_ACTIONS.RELEASE]: "Released a blocked task"
|
|
2346
|
+
})
|
|
2347
|
+
);
|
|
2348
|
+
|
|
2349
|
+
// ../../packages/agents/src/tool-activity/canonical/canonical-tool-activity-describers.ts
|
|
2350
|
+
var canonicalToolActivityDescribers = new Map([
|
|
2351
|
+
[HOST_TOOL_NAMES.ADVISE, () => labelOnly("Advised the watched session")],
|
|
2352
|
+
[
|
|
2353
|
+
"read",
|
|
2354
|
+
(record) => labelOnly(
|
|
2355
|
+
`Read ${toolActivityBasename(toolInput.str(record.file_path) ?? toolInput.str(record.path)) ?? "a file"}`
|
|
2356
|
+
)
|
|
2357
|
+
],
|
|
2358
|
+
[
|
|
2359
|
+
"write",
|
|
2360
|
+
(record) => labelOnly(
|
|
2361
|
+
`Wrote ${toolActivityBasename(toolInput.str(record.file_path) ?? toolInput.str(record.path)) ?? "a file"}`
|
|
2362
|
+
)
|
|
2363
|
+
],
|
|
2364
|
+
[
|
|
2365
|
+
"edit",
|
|
2366
|
+
(record) => labelOnly(
|
|
2367
|
+
`Edited ${toolActivityBasename(toolInput.str(record.file_path) ?? toolInput.str(record.path)) ?? "a file"}`
|
|
2368
|
+
)
|
|
2369
|
+
],
|
|
2370
|
+
[
|
|
2371
|
+
"bash",
|
|
2372
|
+
(record) => {
|
|
2373
|
+
const command = toolInput.verbatim(record.command) ?? toolInput.verbatim(record.cmd);
|
|
2374
|
+
const intent = toolInput.trimmed(record.description);
|
|
2375
|
+
if (!command && !intent) {
|
|
2376
|
+
return labelOnly("Ran a command");
|
|
2377
|
+
}
|
|
2378
|
+
return { text: intent, command };
|
|
2379
|
+
}
|
|
2380
|
+
],
|
|
2381
|
+
[
|
|
2382
|
+
WORKSPACE_TOOL_NAMES.TASK_OUTPUT,
|
|
2383
|
+
() => labelOnly("Read a background command's output")
|
|
2384
|
+
],
|
|
2385
|
+
[
|
|
2386
|
+
WORKSPACE_TOOL_NAMES.TASK_STOP,
|
|
2387
|
+
() => labelOnly("Stopped a background command")
|
|
2388
|
+
],
|
|
2389
|
+
[
|
|
2390
|
+
"grep",
|
|
2391
|
+
(record) => {
|
|
2392
|
+
const pattern = toolInput.str(record.pattern) ?? toolInput.str(record.query);
|
|
2393
|
+
return labelOnly(
|
|
2394
|
+
pattern ? `Searched "${toolInput.truncate(pattern, 60)}"` : "Searched"
|
|
2395
|
+
);
|
|
2396
|
+
}
|
|
2397
|
+
],
|
|
2398
|
+
[
|
|
2399
|
+
"glob",
|
|
2400
|
+
(record) => {
|
|
2401
|
+
const pattern = toolInput.str(record.pattern) ?? toolInput.str(record.glob);
|
|
2402
|
+
return labelOnly(
|
|
2403
|
+
pattern ? `Matched ${toolInput.truncate(pattern, 60)}` : "Matched files"
|
|
2404
|
+
);
|
|
2405
|
+
}
|
|
2406
|
+
],
|
|
2407
|
+
[
|
|
2408
|
+
"ls",
|
|
2409
|
+
(record) => {
|
|
2410
|
+
const path2 = toolInput.str(record.path) ?? toolInput.str(record.dir);
|
|
2411
|
+
return labelOnly(path2 ? `Listed ${path2}` : "Listed a directory");
|
|
2412
|
+
}
|
|
2413
|
+
],
|
|
2414
|
+
[
|
|
2415
|
+
"webfetch",
|
|
2416
|
+
(record) => {
|
|
2417
|
+
const host = toolActivityHostname(toolInput.str(record.url));
|
|
2418
|
+
return labelOnly(host ? `Fetched ${host}` : "Fetched a page");
|
|
2419
|
+
}
|
|
2420
|
+
],
|
|
2421
|
+
[
|
|
2422
|
+
"websearch",
|
|
2423
|
+
(record) => {
|
|
2424
|
+
const query = toolInput.str(record.query) ?? toolInput.str(record.q);
|
|
2425
|
+
return labelOnly(
|
|
2426
|
+
query ? `Searched the web for "${toolInput.truncate(query, 60)}"` : "Searched the web"
|
|
2427
|
+
);
|
|
2428
|
+
}
|
|
2429
|
+
],
|
|
2430
|
+
["task", () => labelOnly("Ran a subagent")],
|
|
2431
|
+
[
|
|
2432
|
+
HOST_TOOL_NAMES.SET_STEPS,
|
|
2433
|
+
(record) => {
|
|
2434
|
+
const steps = Array.isArray(record.steps) ? record.steps.length : null;
|
|
2435
|
+
return labelOnly(
|
|
2436
|
+
steps ? `Planned ${steps} step${steps === 1 ? "" : "s"}` : "Planned the work"
|
|
2437
|
+
);
|
|
2438
|
+
}
|
|
2439
|
+
],
|
|
2440
|
+
[
|
|
2441
|
+
HOST_TOOL_NAMES.SET_TODOS,
|
|
2442
|
+
(record) => {
|
|
2443
|
+
const step = toolInput.trimmed(record.step);
|
|
2444
|
+
return labelOnly(step ? `Updated the plan: ${step}` : "Updated the plan");
|
|
2445
|
+
}
|
|
2446
|
+
],
|
|
2447
|
+
[
|
|
2448
|
+
HOST_TOOL_NAMES.SAVE_DEV_ENV_MANIFEST,
|
|
2449
|
+
() => labelOnly("Saved the dev environment manifest")
|
|
2450
|
+
],
|
|
2451
|
+
[
|
|
2452
|
+
HOST_TOOL_NAMES.REQUEST_DEV_ENV_CREDENTIALS,
|
|
2453
|
+
(record) => {
|
|
2454
|
+
const asked = Array.isArray(record.credentials) ? record.credentials.length : null;
|
|
2455
|
+
return labelOnly(
|
|
2456
|
+
asked ? `Requested ${asked} credential${asked === 1 ? "" : "s"}` : "Requested credentials"
|
|
2457
|
+
);
|
|
2458
|
+
}
|
|
2459
|
+
],
|
|
2460
|
+
[
|
|
2461
|
+
HOST_TOOL_NAMES.GENERATE_DEV_ENV_SECRET,
|
|
2462
|
+
(record) => labelOnly(
|
|
2463
|
+
typeof record.name === "string" ? `Generated ${record.name}` : "Generated a dev environment secret"
|
|
2464
|
+
)
|
|
2465
|
+
],
|
|
2466
|
+
[
|
|
2467
|
+
HOST_TOOL_NAMES.SET_DEV_ENV_SIZING,
|
|
2468
|
+
() => labelOnly("Recorded the dev environment sizing")
|
|
2469
|
+
],
|
|
2470
|
+
[HOST_TOOL_NAMES.BAKE_DEV_ENV, () => labelOnly("Baked the dev environment")],
|
|
2471
|
+
[
|
|
2472
|
+
HOST_TOOL_NAMES.DETECT_PROJECT_DATABASE,
|
|
2473
|
+
() => labelOnly("Recorded the project database")
|
|
2474
|
+
],
|
|
2475
|
+
[
|
|
2476
|
+
HOST_TOOL_NAMES.BIND_PROJECT_DATABASE,
|
|
2477
|
+
() => labelOnly("Requested approval to bind the project database")
|
|
2478
|
+
],
|
|
2479
|
+
[
|
|
2480
|
+
HOST_TOOL_NAMES.DATABASE_QUERY,
|
|
2481
|
+
(record) => {
|
|
2482
|
+
const branch = toolInput.trimmed(record.branch) ?? "production";
|
|
2483
|
+
const sql = toolInput.verbatim(record.sql);
|
|
2484
|
+
return sql ? { text: `Read the database (${branch})`, command: sql } : labelOnly(`Read the database (${branch})`);
|
|
2485
|
+
}
|
|
2486
|
+
],
|
|
2487
|
+
[
|
|
2488
|
+
HOST_TOOL_NAMES.DATABASE_WRITE,
|
|
2489
|
+
(record) => {
|
|
2490
|
+
const branch = toolInput.trimmed(record.branch) ?? "production";
|
|
2491
|
+
const sql = toolInput.verbatim(record.sql);
|
|
2492
|
+
return sql ? {
|
|
2493
|
+
text: `Requested approval to write to the database (${branch})`,
|
|
2494
|
+
command: sql
|
|
2495
|
+
} : labelOnly(`Requested approval to write to the database (${branch})`);
|
|
2496
|
+
}
|
|
2497
|
+
],
|
|
2498
|
+
[HOST_TOOL_NAMES.TAKE_SCREENSHOT, describeTakeScreenshot],
|
|
2499
|
+
[HOST_TOOL_NAMES.RECORD_VIDEO, describeRecordVideo],
|
|
2500
|
+
[HOST_TOOL_NAMES.ATTACH_IMAGE, describeAttachImage],
|
|
2501
|
+
[HOST_TOOL_NAMES.ATTACH_FILE, describeAttachFile],
|
|
2502
|
+
[
|
|
2503
|
+
HOST_TOOL_NAMES.GET_IMAGE_GENERATORS,
|
|
2504
|
+
() => labelOnly("Listed the image models")
|
|
2505
|
+
],
|
|
2506
|
+
[
|
|
2507
|
+
HOST_TOOL_NAMES.ASK_USER,
|
|
2508
|
+
(record) => {
|
|
2509
|
+
const asked = Array.isArray(record.questions) ? record.questions.length : null;
|
|
2510
|
+
return labelOnly(
|
|
2511
|
+
asked ? `Asked ${asked} question${asked === 1 ? "" : "s"}` : "Asked a question"
|
|
2512
|
+
);
|
|
2513
|
+
}
|
|
2514
|
+
],
|
|
2515
|
+
[
|
|
2516
|
+
HOST_TOOL_NAMES.PROPOSE_PLAN,
|
|
2517
|
+
(record) => {
|
|
2518
|
+
const title = toolInput.trimmed(record.title);
|
|
2519
|
+
return labelOnly(
|
|
2520
|
+
title ? `Proposed a plan: ${toolInput.truncate(title, 60)}` : "Proposed a plan"
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
],
|
|
2524
|
+
[
|
|
2525
|
+
HOST_TOOL_NAMES.REQUEST_GUARDRAIL_APPROVAL,
|
|
2526
|
+
() => labelOnly("Asked for an approval")
|
|
2527
|
+
],
|
|
2528
|
+
[
|
|
2529
|
+
HOST_TOOL_NAMES.REPORT_CONFIDENCE,
|
|
2530
|
+
() => labelOnly("Reported its confidence")
|
|
2531
|
+
],
|
|
2532
|
+
[
|
|
2533
|
+
HOST_TOOL_NAMES.REPORT_HARNESS_ISSUE,
|
|
2534
|
+
(record) => {
|
|
2535
|
+
const title = toolInput.trimmed(record.title);
|
|
2536
|
+
return labelOnly(
|
|
2537
|
+
title ? `Reported a harness issue: ${toolInput.truncate(title, 60)}` : "Reported a harness issue"
|
|
2538
|
+
);
|
|
2539
|
+
}
|
|
2540
|
+
],
|
|
2541
|
+
[HOST_TOOL_NAMES.MEMORY_SEARCH, describeMemorySearch],
|
|
2542
|
+
[HOST_TOOL_NAMES.MEMORY_WRITE, () => labelOnly("Wrote to its memory")],
|
|
2543
|
+
[
|
|
2544
|
+
HOST_TOOL_NAMES.RUN_VALIDATION,
|
|
2545
|
+
(record) => {
|
|
2546
|
+
const command = toolInput.verbatim(record.command);
|
|
2547
|
+
return command ? { text: "Ran a validation command", command } : labelOnly("Ran a validation command");
|
|
2548
|
+
}
|
|
2549
|
+
],
|
|
2550
|
+
[
|
|
2551
|
+
HOST_TOOL_NAMES.CREATE_TASK,
|
|
2552
|
+
(record) => {
|
|
2553
|
+
const title = toolInput.trimmed(record.title);
|
|
2554
|
+
return labelOnly(
|
|
2555
|
+
title ? `Created task "${toolInput.truncate(title, 60)}"` : "Created a team task"
|
|
2556
|
+
);
|
|
2557
|
+
}
|
|
2558
|
+
],
|
|
2559
|
+
[HOST_TOOL_NAMES.LIST_TASKS, () => labelOnly("Listed the team tasks")],
|
|
2560
|
+
[HOST_TOOL_NAMES.PICKUP_TASK, () => labelOnly("Picked up a team task")],
|
|
2561
|
+
[
|
|
2562
|
+
HOST_TOOL_NAMES.UPDATE_TASK,
|
|
2563
|
+
(record) => {
|
|
2564
|
+
const action = toolInput.str(record.action);
|
|
2565
|
+
return labelOnly(
|
|
2566
|
+
(action ? updateTaskLabels.get(action) : null) ?? "Updated a team task"
|
|
2567
|
+
);
|
|
2568
|
+
}
|
|
2569
|
+
],
|
|
2570
|
+
[
|
|
2571
|
+
HOST_TOOL_NAMES.DELIVERABLE_PUBLISH,
|
|
2572
|
+
() => labelOnly("Published a deliverable")
|
|
2573
|
+
],
|
|
2574
|
+
[
|
|
2575
|
+
HOST_TOOL_NAMES.PUBLISH_DESIGN,
|
|
2576
|
+
(record) => {
|
|
2577
|
+
const count = Array.isArray(record.directions) ? record.directions.length : 0;
|
|
2578
|
+
return labelOnly(
|
|
2579
|
+
count > 1 ? `Published ${count} design directions` : "Published a design"
|
|
2580
|
+
);
|
|
2581
|
+
}
|
|
2582
|
+
],
|
|
2583
|
+
[
|
|
2584
|
+
HOST_TOOL_NAMES.SET_LIVE_DESIGN,
|
|
2585
|
+
(record) => {
|
|
2586
|
+
const version = toolInput.trimmed(record.version);
|
|
2587
|
+
return labelOnly(
|
|
2588
|
+
version ? `Pointed the design link at v${version}` : "Moved the design link"
|
|
2589
|
+
);
|
|
2590
|
+
}
|
|
2591
|
+
],
|
|
2592
|
+
[
|
|
2593
|
+
HOST_TOOL_NAMES.RENAME_SESSION,
|
|
2594
|
+
(record) => {
|
|
2595
|
+
const title = toolInput.trimmed(record.title);
|
|
2596
|
+
return labelOnly(
|
|
2597
|
+
title ? `Renamed the chat "${toolInput.truncate(title, 60)}"` : "Renamed the chat"
|
|
2598
|
+
);
|
|
2599
|
+
}
|
|
2600
|
+
],
|
|
2601
|
+
[
|
|
2602
|
+
"tool_search",
|
|
2603
|
+
(record) => {
|
|
2604
|
+
const query = toolInput.str(record.query);
|
|
2605
|
+
return labelOnly(
|
|
2606
|
+
query ? `Searched integrations for "${toolInput.truncate(query, 60)}"` : "Searched the connected integrations"
|
|
2607
|
+
);
|
|
2608
|
+
}
|
|
2609
|
+
],
|
|
2610
|
+
[
|
|
2611
|
+
"tool_execute",
|
|
2612
|
+
(record) => {
|
|
2613
|
+
const target = toolInput.str(record.tool);
|
|
2614
|
+
return labelOnly(
|
|
2615
|
+
target ? `Ran ${toolInput.truncate(target, 60)}` : "Ran an integration tool"
|
|
2616
|
+
);
|
|
2617
|
+
}
|
|
2618
|
+
],
|
|
2619
|
+
[HOST_TOOL_NAMES.GENERATE_IMAGE, describeGenerateImage],
|
|
2620
|
+
[HOST_TOOL_NAMES.ANNOTATE_IMAGE, describeAnnotateImage],
|
|
2621
|
+
...browserToolActivityDescribers
|
|
2622
|
+
]);
|
|
2623
|
+
|
|
2624
|
+
// ../../packages/agents/src/tool-activity/browser/soft-fail-browser-tools-constants.ts
|
|
2625
|
+
var SOFT_FAIL_BROWSER_TOOLS = /* @__PURE__ */ new Set([
|
|
2626
|
+
HOST_TOOL_NAMES.BROWSER_NAVIGATE,
|
|
2627
|
+
HOST_TOOL_NAMES.BROWSER_SNAPSHOT,
|
|
2628
|
+
HOST_TOOL_NAMES.BROWSER_ACT,
|
|
2629
|
+
HOST_TOOL_NAMES.BROWSER_WAIT,
|
|
2630
|
+
HOST_TOOL_NAMES.BROWSER_INSPECT,
|
|
2631
|
+
HOST_TOOL_NAMES.BROWSER_SCREENSHOT,
|
|
2632
|
+
HOST_TOOL_NAMES.BROWSER_RECORD_START,
|
|
2633
|
+
HOST_TOOL_NAMES.BROWSER_RECORD_STOP,
|
|
2634
|
+
HOST_TOOL_NAMES.BROWSER_CLOSE,
|
|
2635
|
+
HOST_TOOL_NAMES.REPL_EVAL,
|
|
2636
|
+
HOST_TOOL_NAMES.REPL_RESET
|
|
2637
|
+
]);
|
|
2638
|
+
|
|
2639
|
+
// ../../packages/agents/src/tool-activity/browser/soft-failed-browser.ts
|
|
2640
|
+
function softFailedBrowser(toolName, output) {
|
|
2641
|
+
return SOFT_FAIL_BROWSER_TOOLS.has(toolName) && typeof output === "string" && /^(?:browser|repl)_[a-z_]+ failed:/.test(output.trimStart());
|
|
2642
|
+
}
|
|
2643
|
+
|
|
2644
|
+
// ../../packages/agents/src/tool-activity/capture/soft-fail-capture-tools-constants.ts
|
|
2645
|
+
var SOFT_FAIL_CAPTURE_TOOLS = /* @__PURE__ */ new Set([
|
|
2646
|
+
HOST_TOOL_NAMES.TAKE_SCREENSHOT,
|
|
2647
|
+
HOST_TOOL_NAMES.RECORD_VIDEO,
|
|
2648
|
+
HOST_TOOL_NAMES.ATTACH_IMAGE,
|
|
2649
|
+
HOST_TOOL_NAMES.ATTACH_FILE,
|
|
2650
|
+
HOST_TOOL_NAMES.GENERATE_IMAGE,
|
|
2651
|
+
HOST_TOOL_NAMES.ANNOTATE_IMAGE
|
|
2652
|
+
]);
|
|
2653
|
+
|
|
2654
|
+
// ../../packages/agents/src/tool-activity/capture/soft-failed-capture.ts
|
|
2655
|
+
function softFailedCapture(toolName, output) {
|
|
2656
|
+
if (!SOFT_FAIL_CAPTURE_TOOLS.has(toolName) || typeof output !== "string") {
|
|
2657
|
+
return false;
|
|
2658
|
+
}
|
|
2659
|
+
return output.trimStart().startsWith(`${toolName} failed`);
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
// ../../packages/agents/src/tool-activity/tool-activity-state-for.ts
|
|
2663
|
+
function toolActivityStateFor(toolName, options) {
|
|
2664
|
+
const isRunning = options?.status === "running";
|
|
2665
|
+
return {
|
|
2666
|
+
isRunning,
|
|
2667
|
+
hasFailed: options?.status === "failed" || !isRunning && (softFailedCapture(toolName, options?.output) || softFailedBrowser(toolName, options?.output))
|
|
2668
|
+
};
|
|
2669
|
+
}
|
|
2670
|
+
|
|
2671
|
+
// ../../packages/agents/src/tool-activity/skill/skill-call-constants.ts
|
|
2672
|
+
var SKILL_NAME_KEYS = [
|
|
2673
|
+
"skill",
|
|
2674
|
+
"skill_name",
|
|
2675
|
+
"skillName",
|
|
2676
|
+
"name",
|
|
2677
|
+
"command"
|
|
2678
|
+
];
|
|
2679
|
+
|
|
2680
|
+
// ../../packages/agents/src/tool-activity/skill/skill-name-from-input.ts
|
|
2681
|
+
function skillNameFromInput(input) {
|
|
2682
|
+
if (!toolInput.isRecord(input)) {
|
|
2683
|
+
return null;
|
|
2684
|
+
}
|
|
2685
|
+
for (const key of SKILL_NAME_KEYS) {
|
|
2686
|
+
const value = input[key];
|
|
2687
|
+
if (typeof value === "string" && value.trim().length > 0) {
|
|
2688
|
+
return value.trim().split(/\s+/u)[0] ?? null;
|
|
2689
|
+
}
|
|
2690
|
+
}
|
|
2691
|
+
return null;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
// ../../packages/agents/src/tool-activity/skill/string-field.ts
|
|
2695
|
+
function stringField(input, key) {
|
|
2696
|
+
return toolInput.isRecord(input) ? toolInput.trimmed(input[key]) : null;
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
// ../../packages/agents/src/tool-activity/skill/registry-calls.ts
|
|
2700
|
+
var registryCalls = {
|
|
2701
|
+
[HOST_TOOL_NAMES.SKILL_SEARCH]: (input) => ({
|
|
2702
|
+
kind: "search",
|
|
2703
|
+
query: stringField(input, "query")
|
|
2704
|
+
}),
|
|
2705
|
+
[HOST_TOOL_NAMES.SKILL_LOAD]: (input) => ({
|
|
2706
|
+
kind: "load",
|
|
2707
|
+
name: skillNameFromInput(input),
|
|
2708
|
+
via: "tool"
|
|
2709
|
+
}),
|
|
2710
|
+
[HOST_TOOL_NAMES.SAVE_SKILL]: (input) => ({
|
|
2711
|
+
kind: "save",
|
|
2712
|
+
name: stringField(input, "name")
|
|
2713
|
+
}),
|
|
2714
|
+
[HOST_TOOL_NAMES.PROPOSE_SKILL_EDIT]: (input) => ({
|
|
2715
|
+
kind: "edit",
|
|
2716
|
+
name: stringField(input, "name")
|
|
2717
|
+
}),
|
|
2718
|
+
[HOST_TOOL_NAMES.RECORD_REVIEW_LESSON]: (input) => ({
|
|
2719
|
+
kind: "lesson",
|
|
2720
|
+
scope: stringField(input, "scope")
|
|
2721
|
+
})
|
|
2722
|
+
};
|
|
2723
|
+
|
|
2724
|
+
// src/lib/event/format-tool-part.ts
|
|
2725
|
+
function formatToolPart(part) {
|
|
2726
|
+
const { hasFailed } = toolActivityStateFor(part.toolName, {
|
|
2727
|
+
status: part.status,
|
|
2728
|
+
output: part.output
|
|
2729
|
+
});
|
|
2730
|
+
const status = hasFailed ? "failed" : part.status;
|
|
2731
|
+
return `${out.paint("tool", "dim")} ${out.cell(part.toolName)} ${out.paint(`(${status})`, "dim")}`;
|
|
2732
|
+
}
|
|
2733
|
+
|
|
1738
2734
|
// src/lib/event/format-event.ts
|
|
1739
|
-
function formatEvent(event) {
|
|
2735
|
+
function formatEvent(event, baseUrl) {
|
|
1740
2736
|
const part = event.part;
|
|
1741
2737
|
switch (part.kind) {
|
|
1742
2738
|
case "text":
|
|
@@ -1750,7 +2746,7 @@ function formatEvent(event) {
|
|
|
1750
2746
|
case "reasoning":
|
|
1751
2747
|
return out.paint(`think ${truncate(part.text, 400)}`, "dim");
|
|
1752
2748
|
case "tool":
|
|
1753
|
-
return
|
|
2749
|
+
return formatToolPart(part);
|
|
1754
2750
|
case "file_change":
|
|
1755
2751
|
return `${out.paint("file", "dim")} ${part.changeType.padEnd(8)} ${out.cell(part.path)}`;
|
|
1756
2752
|
case "question":
|
|
@@ -1776,6 +2772,8 @@ function formatEvent(event) {
|
|
|
1776
2772
|
}
|
|
1777
2773
|
case "advisor":
|
|
1778
2774
|
return formatAdvisorPart(part);
|
|
2775
|
+
case "deliverable":
|
|
2776
|
+
return formatDeliverablePart(part, event.sessionId, baseUrl);
|
|
1779
2777
|
case "error":
|
|
1780
2778
|
return out.paint(`error ${truncate(part.message)}`, "red");
|
|
1781
2779
|
case "external_event":
|
|
@@ -1797,13 +2795,13 @@ function formatEvent(event) {
|
|
|
1797
2795
|
}
|
|
1798
2796
|
|
|
1799
2797
|
// src/lib/session/consume-session-events.ts
|
|
1800
|
-
function consumeSessionEvents(events, cursor, quiet) {
|
|
2798
|
+
function consumeSessionEvents(events, cursor, quiet, baseUrl) {
|
|
1801
2799
|
for (const event of events) {
|
|
1802
2800
|
cursor = Math.max(cursor, event.sequence);
|
|
1803
2801
|
if (quiet) {
|
|
1804
2802
|
continue;
|
|
1805
2803
|
}
|
|
1806
|
-
const line = formatEvent(event);
|
|
2804
|
+
const line = formatEvent(event, baseUrl);
|
|
1807
2805
|
if (line) {
|
|
1808
2806
|
out.line(line);
|
|
1809
2807
|
}
|
|
@@ -2004,6 +3002,7 @@ async function followSession(sessionId, options = {}, dependencies = defaultFoll
|
|
|
2004
3002
|
outageStartedAt: null
|
|
2005
3003
|
};
|
|
2006
3004
|
const maxOutageMs = resolveFollowOutageBudget();
|
|
3005
|
+
const { baseUrl } = config.load();
|
|
2007
3006
|
for (; ; ) {
|
|
2008
3007
|
const page = await requestWithFollowRetry({
|
|
2009
3008
|
retry,
|
|
@@ -2029,7 +3028,7 @@ async function followSession(sessionId, options = {}, dependencies = defaultFoll
|
|
|
2029
3028
|
}
|
|
2030
3029
|
)
|
|
2031
3030
|
});
|
|
2032
|
-
cursor = consumeSessionEvents(page.items, cursor, options.quiet);
|
|
3031
|
+
cursor = consumeSessionEvents(page.items, cursor, options.quiet, baseUrl);
|
|
2033
3032
|
if (page.nextCursor !== null) {
|
|
2034
3033
|
cursor = Math.max(cursor, page.nextCursor);
|
|
2035
3034
|
}
|
|
@@ -2378,8 +3377,9 @@ async function showLogs(parsed) {
|
|
|
2378
3377
|
out.json(page);
|
|
2379
3378
|
return;
|
|
2380
3379
|
}
|
|
3380
|
+
const { baseUrl } = config.load();
|
|
2381
3381
|
for (const event of page.items) {
|
|
2382
|
-
const line = formatEvent(event);
|
|
3382
|
+
const line = formatEvent(event, baseUrl);
|
|
2383
3383
|
if (line) {
|
|
2384
3384
|
out.line(line);
|
|
2385
3385
|
}
|