ptywright 0.6.0 → 0.6.2
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/agent.mjs +1 -1
- package/dist/bin/ptywright.mjs +1 -1
- package/dist/{cli-IXmvK56U.mjs → cli-CRGGdNy8.mjs} +2 -2
- package/dist/cli.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/mcp.mjs +1 -1
- package/dist/{runner-GIEf0C6d.mjs → runner-CF2ieCkx.mjs} +95 -8
- package/dist/{server-ceZ1-s_J.mjs → server-DpsZDVu2.mjs} +1 -1
- package/package.json +1 -1
package/dist/agent.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as formatAgentLaunchPlan, i as runAgentSpecPath, n as replayAgentRecordPath, r as runAgentSpec, t as defaultSpecNameForPath } from "./runner-
|
|
1
|
+
import { a as formatAgentLaunchPlan, i as runAgentSpecPath, n as replayAgentRecordPath, r as runAgentSpec, t as defaultSpecNameForPath } from "./runner-CF2ieCkx.mjs";
|
|
2
2
|
export { defaultSpecNameForPath, formatAgentLaunchPlan, replayAgentRecordPath, runAgentSpec, runAgentSpecPath };
|
package/dist/bin/ptywright.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { n as loadPtywrightConfig } from "./config-bGg636EW.mjs";
|
|
2
|
-
import { C as writeAgentManifestPath, D as escapeHtml, E as escapeAttribute, O as normalizeAgentFlowSpec, S as validateAgentManifestFiles, T as readAgentCassettePath, _ as formatArgv, b as isAgentManifestLike, c as launchAgentBrowser, d as AGENT_RUN_RECORD_SCHEMA_URL, f as agentRunModeSchema, g as writeAgentRunRecordPath, h as readAgentRunRecordPath, i as runAgentSpecPath, k as sanitizeArtifactName, l as createAgentTemplateSpec, m as isAgentRunRecordLike, n as replayAgentRecordPath, o as resolveAgentLaunchTarget, p as formatAgentArgv, s as normalizeAgentFlowSpecWithConfig, u as loadAgentSpec, v as AGENT_MANIFEST_FILE_NAME, w as isAgentCassetteLike, x as readAgentManifestPath, y as agentManifestPath } from "./runner-
|
|
2
|
+
import { C as writeAgentManifestPath, D as escapeHtml, E as escapeAttribute, O as normalizeAgentFlowSpec, S as validateAgentManifestFiles, T as readAgentCassettePath, _ as formatArgv, b as isAgentManifestLike, c as launchAgentBrowser, d as AGENT_RUN_RECORD_SCHEMA_URL, f as agentRunModeSchema, g as writeAgentRunRecordPath, h as readAgentRunRecordPath, i as runAgentSpecPath, k as sanitizeArtifactName, l as createAgentTemplateSpec, m as isAgentRunRecordLike, n as replayAgentRecordPath, o as resolveAgentLaunchTarget, p as formatAgentArgv, s as normalizeAgentFlowSpecWithConfig, u as loadAgentSpec, v as AGENT_MANIFEST_FILE_NAME, w as isAgentCassetteLike, x as readAgentManifestPath, y as agentManifestPath } from "./runner-CF2ieCkx.mjs";
|
|
3
3
|
import { a as sameArgv, i as diffCommandMaps, r as formatZodIssues } from "./manifest_files-DW80c1H7.mjs";
|
|
4
4
|
import { i as portableCliPath, n as mergeProcessEnv, o as relativeHref, s as samePath } from "./env-DPYHo-zH.mjs";
|
|
5
5
|
import { d as resolvePtyBackend, u as createDefaultPtyAdapter } from "./runner-BHXXwxYp.mjs";
|
|
6
|
-
import { a as resolveScriptManifestPath, c as relocateScriptManifestCommands, d as resolveScriptRunSummaryPath, f as runScriptPath, i as readScriptManifestPath, l as resolveManifestPrimaryPath$1, n as runAllScripts, o as validateScriptManifest, r as findScriptSummaryManifest, t as createPtywrightServer, u as readScriptRunSummaryPath } from "./server-
|
|
6
|
+
import { a as resolveScriptManifestPath, c as relocateScriptManifestCommands, d as resolveScriptRunSummaryPath, f as runScriptPath, i as readScriptManifestPath, l as resolveManifestPrimaryPath$1, n as runAllScripts, o as validateScriptManifest, r as findScriptSummaryManifest, t as createPtywrightServer, u as readScriptRunSummaryPath } from "./server-DpsZDVu2.mjs";
|
|
7
7
|
import { c as createPtyCassetteReplay, i as formatPtyCassetteInspectLines, l as readPtyCassettePath, o as inspectPtyCassettePath, r as createPtyCassetteRecorder, t as wrapPtyLike, v as validatePtyCassette } from "./pty_like-DWIlWGgA.mjs";
|
|
8
8
|
import { existsSync, mkdirSync, readFileSync, readdirSync, statSync, writeFileSync } from "node:fs";
|
|
9
9
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
package/dist/cli.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as main } from "./cli-
|
|
1
|
+
import { t as main } from "./cli-CRGGdNy8.mjs";
|
|
2
2
|
export { main };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as createPtywrightServer } from "./server-
|
|
1
|
+
import { t as createPtywrightServer } from "./server-DpsZDVu2.mjs";
|
|
2
2
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
3
|
//#region src/index.ts
|
|
4
4
|
const { server, sessions } = createPtywrightServer();
|
package/dist/mcp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createPtywrightServer } from "./server-
|
|
1
|
+
import { t as createPtywrightServer } from "./server-DpsZDVu2.mjs";
|
|
2
2
|
export { createPtywrightServer };
|
|
@@ -1865,18 +1865,85 @@ function renderStableFrameDom(frame, targetCols) {
|
|
|
1865
1865
|
let html = "";
|
|
1866
1866
|
let totalRows = 0;
|
|
1867
1867
|
let wideBlockId = 0;
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1868
|
+
let codeRunCols = 0;
|
|
1869
|
+
let codeRunRows = [];
|
|
1870
|
+
const renderPlainRow = (line) => {
|
|
1871
|
+
for (const row of wrapStableLogicalLine(line, targetCols)) {
|
|
1872
|
+
html += renderStableFrameRow(row, targetCols, totalRows);
|
|
1873
|
+
totalRows += 1;
|
|
1874
|
+
}
|
|
1875
|
+
};
|
|
1876
|
+
const flushCodeRun = () => {
|
|
1877
|
+
if (codeRunRows.length === 0) return;
|
|
1878
|
+
if (codeRunCols > targetCols) {
|
|
1871
1879
|
wideBlockId += 1;
|
|
1872
|
-
|
|
1873
|
-
html +=
|
|
1880
|
+
const blockCols = Math.max(targetCols, codeRunCols);
|
|
1881
|
+
html += `<div class="term-wide-row-block" data-aitty-wide-block="true" data-aitty-wide-block-id="${wideBlockId}" data-aitty-wide-block-kind="guttered-code" style="--aitty-wide-block-cols: ${blockCols}">`;
|
|
1882
|
+
for (const row of codeRunRows) {
|
|
1883
|
+
html += renderStableFrameRow(row, blockCols, totalRows);
|
|
1884
|
+
totalRows += 1;
|
|
1885
|
+
}
|
|
1874
1886
|
html += "</div>";
|
|
1875
|
-
} else
|
|
1876
|
-
|
|
1887
|
+
} else for (const row of codeRunRows) renderPlainRow(row);
|
|
1888
|
+
codeRunCols = 0;
|
|
1889
|
+
codeRunRows = [];
|
|
1890
|
+
};
|
|
1891
|
+
for (const line of frame.lines) {
|
|
1892
|
+
const lineText = stableLineText(line);
|
|
1893
|
+
const lineCols = cellsDisplayWidth(line.cells);
|
|
1894
|
+
if (isGutteredCodeLine(lineText) || isDiffLikeLine(lineText)) {
|
|
1895
|
+
codeRunRows.push(line);
|
|
1896
|
+
codeRunCols = Math.max(codeRunCols, lineCols);
|
|
1897
|
+
continue;
|
|
1898
|
+
}
|
|
1899
|
+
flushCodeRun();
|
|
1900
|
+
renderPlainRow(line);
|
|
1877
1901
|
}
|
|
1902
|
+
flushCodeRun();
|
|
1878
1903
|
return `<div class="term-grid" data-cols="${targetCols}" data-rows="${totalRows}" style="--term-cols: ${targetCols}; --term-rows: ${totalRows};">${html}</div>`;
|
|
1879
1904
|
}
|
|
1905
|
+
function stableLineText(line) {
|
|
1906
|
+
return line.cells.map((cell) => cell.text).join("").trimEnd();
|
|
1907
|
+
}
|
|
1908
|
+
function isGutteredCodeLine(text) {
|
|
1909
|
+
const normalized = text.replace(/[│┃┆┊▏▕]/g, " ").trimStart();
|
|
1910
|
+
return /^\d+\s+(?:[+-]|\s{2,}\S)/.test(normalized);
|
|
1911
|
+
}
|
|
1912
|
+
function isDiffLikeLine(text) {
|
|
1913
|
+
const normalized = text.replace(/[│┃┆┊▏▕]/g, " ").trimStart();
|
|
1914
|
+
if (normalized === "") return false;
|
|
1915
|
+
if (/^(?:diff --git|index [0-9a-f]{6,}\.\.|@@\s|[-+]{3}\s)/.test(normalized)) return true;
|
|
1916
|
+
if (/^\d+\s+[+-]/.test(normalized)) return true;
|
|
1917
|
+
const signed = normalized.match(/^[+-]\s*(.*)$/);
|
|
1918
|
+
if (!signed) return false;
|
|
1919
|
+
return isCodeLikeText(signed[1] ?? "");
|
|
1920
|
+
}
|
|
1921
|
+
function isCodeLikeText(text) {
|
|
1922
|
+
return /[{}()[\];=<>]/.test(text) || /\b(?:async|await|class|const|def|export|from|function|if|import|interface|let|return|type|var)\b/.test(text) || /(?:^|\s)(?:--?[a-z][\w-]*|#[\w-]+|\/[A-Za-z0-9._/-]+)(?:\s|$)/.test(text);
|
|
1923
|
+
}
|
|
1924
|
+
function wrapStableLogicalLine(line, targetCols) {
|
|
1925
|
+
if (cellsDisplayWidth(line.cells) <= targetCols) return [line];
|
|
1926
|
+
const rows = [];
|
|
1927
|
+
let cells = [];
|
|
1928
|
+
let cols = 0;
|
|
1929
|
+
const flush = () => {
|
|
1930
|
+
rows.push({
|
|
1931
|
+
cells,
|
|
1932
|
+
live: line.live,
|
|
1933
|
+
physicalRows: 1
|
|
1934
|
+
});
|
|
1935
|
+
cells = [];
|
|
1936
|
+
cols = 0;
|
|
1937
|
+
};
|
|
1938
|
+
for (const cell of line.cells) {
|
|
1939
|
+
if (cols > 0 && cols + cell.width > targetCols) flush();
|
|
1940
|
+
cells.push(cell);
|
|
1941
|
+
cols += cell.width;
|
|
1942
|
+
if (cols >= targetCols) flush();
|
|
1943
|
+
}
|
|
1944
|
+
if (cells.length > 0 || rows.length === 0) flush();
|
|
1945
|
+
return rows;
|
|
1946
|
+
}
|
|
1880
1947
|
function renderStableFrameRow(line, lineCols, lineIndex) {
|
|
1881
1948
|
return `<div class="${line.live ? "term-row" : "term-row term-scrollback-row"}"${line.live ? ` data-aitty-live-grid-row="${lineIndex + 1}"` : ""} data-aitty-line-cols="${lineCols}">${renderStableFrameCells(line.cells, lineCols)}</div>`;
|
|
1882
1949
|
}
|
|
@@ -1944,10 +2011,30 @@ function styleDeclarations(style) {
|
|
|
1944
2011
|
}
|
|
1945
2012
|
function colorToCss(color) {
|
|
1946
2013
|
if (color.mode === "default") return null;
|
|
1947
|
-
if (color.mode === "palette") return
|
|
2014
|
+
if (color.mode === "palette") return paletteColorToCss(color.value);
|
|
1948
2015
|
const value = color.value;
|
|
1949
2016
|
return `rgb(${value >> 16 & 255},${value >> 8 & 255},${value & 255})`;
|
|
1950
2017
|
}
|
|
2018
|
+
function paletteColorToCss(value) {
|
|
2019
|
+
if (value >= 0 && value <= 15) return `var(--term-color-${value})`;
|
|
2020
|
+
if (value >= 16 && value <= 231) {
|
|
2021
|
+
const index = value - 16;
|
|
2022
|
+
const steps = [
|
|
2023
|
+
0,
|
|
2024
|
+
95,
|
|
2025
|
+
135,
|
|
2026
|
+
175,
|
|
2027
|
+
215,
|
|
2028
|
+
255
|
|
2029
|
+
];
|
|
2030
|
+
return `rgb(${steps[Math.floor(index / 36)] ?? 0},${steps[Math.floor(index % 36 / 6)] ?? 0},${steps[index % 6] ?? 0})`;
|
|
2031
|
+
}
|
|
2032
|
+
if (value >= 232 && value <= 255) {
|
|
2033
|
+
const channel = 8 + (value - 232) * 10;
|
|
2034
|
+
return `rgb(${channel},${channel},${channel})`;
|
|
2035
|
+
}
|
|
2036
|
+
return `var(--term-color-${value})`;
|
|
2037
|
+
}
|
|
1951
2038
|
function widthDeclaration(width) {
|
|
1952
2039
|
if (width <= 1) return "width: var(--term-cell-width, 1ch)";
|
|
1953
2040
|
return `width: calc(var(--term-cell-width, 1ch) * ${width})`;
|