@shanepadgett/tau-agent 0.33.0 → 0.33.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Script Runner
|
|
2
2
|
|
|
3
|
-
Gives the agent a first-class `script_runner` tool for running Python and TypeScript instead of falling back to bash. The agent picks whichever language is more efficient for the task.
|
|
3
|
+
Gives the agent a first-class `script_runner` tool for running Python 3 and TypeScript instead of falling back to bash. The agent picks whichever language is more efficient for the task.
|
|
4
4
|
|
|
5
5
|
When a run fails, the tool keeps the script and returns a `scriptId`. The agent retries with targeted `{oldText, newText}` edits against what it just wrote instead of resending the whole script, saving output tokens and keeping duplicate scripts out of context. Only the source the agent already sent is referenced; no file path is exposed.
|
|
6
6
|
|
|
7
|
-
Languages are detected from the environment: Python via `python3
|
|
7
|
+
Languages are detected from the environment: Python 3 via `python3`, TypeScript via Node with `--experimental-strip-types` (Node 22.6 or newer). The tool registers only the languages actually available and is hidden from the prompt entirely when neither is present.
|
|
@@ -16,10 +16,10 @@ import {
|
|
|
16
16
|
import { Text } from "@earendil-works/pi-tui";
|
|
17
17
|
import { Type } from "typebox";
|
|
18
18
|
|
|
19
|
-
type Language = "
|
|
19
|
+
type Language = "python3" | "typescript";
|
|
20
20
|
|
|
21
21
|
interface Runtimes {
|
|
22
|
-
|
|
22
|
+
python3: string | undefined;
|
|
23
23
|
typescript: string | undefined;
|
|
24
24
|
}
|
|
25
25
|
|
|
@@ -32,26 +32,23 @@ const TIMEOUT_MS = 120_000;
|
|
|
32
32
|
const MAX_STORED = 8;
|
|
33
33
|
|
|
34
34
|
function detectRuntimes(): Runtimes {
|
|
35
|
-
let
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} catch {
|
|
42
|
-
// runtime not installed
|
|
43
|
-
}
|
|
35
|
+
let python3: string | undefined;
|
|
36
|
+
try {
|
|
37
|
+
execFileSync("python3", ["--version"], { stdio: ["ignore", "pipe", "ignore"] });
|
|
38
|
+
python3 = "python3";
|
|
39
|
+
} catch {
|
|
40
|
+
// runtime not installed
|
|
44
41
|
}
|
|
45
42
|
const [major, minor] = process.versions.node.split(".").map(Number);
|
|
46
43
|
let typescript: string | undefined;
|
|
47
44
|
if (major > 22 || (major === 22 && minor >= 6)) {
|
|
48
45
|
typescript = process.execPath;
|
|
49
46
|
}
|
|
50
|
-
return {
|
|
47
|
+
return { python3, typescript };
|
|
51
48
|
}
|
|
52
49
|
|
|
53
50
|
function capitalize(lang: Language): string {
|
|
54
|
-
return lang === "
|
|
51
|
+
return lang === "python3" ? "Python 3" : "TypeScript";
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
function newScriptId(): string {
|
|
@@ -95,8 +92,8 @@ function renderEditsPreview(edits: ReadonlyArray<{ oldText: string; newText: str
|
|
|
95
92
|
|
|
96
93
|
export default function scriptRunnerExtension(pi: ExtensionAPI): void {
|
|
97
94
|
const runtimes = detectRuntimes();
|
|
98
|
-
const detected = (["
|
|
99
|
-
(lang): lang is Language => (lang === "
|
|
95
|
+
const detected = (["python3", "typescript"] as const).filter(
|
|
96
|
+
(lang): lang is Language => (lang === "python3" ? runtimes.python3 : runtimes.typescript) !== undefined,
|
|
100
97
|
);
|
|
101
98
|
if (detected.length === 0) return;
|
|
102
99
|
|
|
@@ -115,9 +112,9 @@ export default function scriptRunnerExtension(pi: ExtensionAPI): void {
|
|
|
115
112
|
}
|
|
116
113
|
|
|
117
114
|
function resolveCommand(language: Language): string {
|
|
118
|
-
if (language === "
|
|
119
|
-
const cmd = runtimes.
|
|
120
|
-
if (!cmd) throw new Error("Python is not available on this machine.");
|
|
115
|
+
if (language === "python3") {
|
|
116
|
+
const cmd = runtimes.python3;
|
|
117
|
+
if (!cmd) throw new Error("Python 3 is not available on this machine.");
|
|
121
118
|
return cmd;
|
|
122
119
|
}
|
|
123
120
|
const cmd = runtimes.typescript;
|
|
@@ -139,9 +136,9 @@ export default function scriptRunnerExtension(pi: ExtensionAPI): void {
|
|
|
139
136
|
signal: AbortSignal | undefined,
|
|
140
137
|
): Promise<ExecResult> {
|
|
141
138
|
const dir = await ensureTempDir();
|
|
142
|
-
const file = join(dir, language === "
|
|
139
|
+
const file = join(dir, language === "python3" ? "_run.py" : "_run.ts");
|
|
143
140
|
await writeFile(file, source, "utf8");
|
|
144
|
-
const args = language === "
|
|
141
|
+
const args = language === "python3" ? [file] : ["--experimental-strip-types", file];
|
|
145
142
|
const result = await pi.exec(command, args, { cwd, signal, timeout: TIMEOUT_MS });
|
|
146
143
|
return {
|
|
147
144
|
...result,
|
|
@@ -92,7 +92,7 @@ Supplies the agent with the current local date and an initial root directory sna
|
|
|
92
92
|
|
|
93
93
|
## script-runner
|
|
94
94
|
|
|
95
|
-
Gives the agent a first-class `script_runner` tool to execute Python and TypeScript instead of bash. On failure it returns a `scriptId`; the agent retries with targeted `{oldText,newText}` edits against the script it already wrote rather than resending the whole script. Languages are detected from the environment (Python via `python3
|
|
95
|
+
Gives the agent a first-class `script_runner` tool to execute Python 3 and TypeScript instead of bash. On failure it returns a `scriptId`; the agent retries with targeted `{oldText,newText}` edits against the script it already wrote rather than resending the whole script. Languages are detected from the environment (Python 3 via `python3`; TypeScript via Node `--experimental-strip-types`, Node 22.6+). The tool registers only available languages and is hidden from the prompt if neither is present.
|
|
96
96
|
|
|
97
97
|
## silent-command-runner
|
|
98
98
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shanepadgett/tau-agent",
|
|
3
|
-
"version": "0.33.
|
|
3
|
+
"version": "0.33.1",
|
|
4
4
|
"description": "Tau is a custom agentic harness built with pi extensions",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@ast-grep/wasm": "0.45.0",
|
|
38
|
-
"@shanepadgett/tau-tui": "0.33.
|
|
38
|
+
"@shanepadgett/tau-tui": "0.33.1",
|
|
39
39
|
"@vscode/tree-sitter-wasm": "0.3.1",
|
|
40
40
|
"image-size": "2.0.2",
|
|
41
41
|
"smol-toml": "1.7.0",
|