@grackle-ai/runtime-sdk 0.82.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/async-queue.d.ts +13 -0
- package/dist/async-queue.d.ts.map +1 -0
- package/dist/async-queue.js +48 -0
- package/dist/async-queue.js.map +1 -0
- package/dist/base-runtime.d.ts +30 -0
- package/dist/base-runtime.d.ts.map +1 -0
- package/dist/base-runtime.js +23 -0
- package/dist/base-runtime.js.map +1 -0
- package/dist/base-session.d.ts +104 -0
- package/dist/base-session.d.ts.map +1 -0
- package/dist/base-session.js +198 -0
- package/dist/base-session.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +4 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +10 -0
- package/dist/logger.js.map +1 -0
- package/dist/runtime-installer.d.ts +43 -0
- package/dist/runtime-installer.d.ts.map +1 -0
- package/dist/runtime-installer.js +275 -0
- package/dist/runtime-installer.js.map +1 -0
- package/dist/runtime-utils.d.ts +97 -0
- package/dist/runtime-utils.d.ts.map +1 -0
- package/dist/runtime-utils.js +291 -0
- package/dist/runtime-utils.js.map +1 -0
- package/dist/runtime.d.ts +63 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/runtime.js +2 -0
- package/dist/runtime.js.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/worktree.d.ts +30 -0
- package/dist/worktree.d.ts.map +1 -0
- package/dist/worktree.js +115 -0
- package/dist/worktree.js.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
import { execFile } from "node:child_process";
|
|
3
|
+
import { promisify } from "node:util";
|
|
4
|
+
import { ensureWorktree } from "./worktree.js";
|
|
5
|
+
import { logger } from "./logger.js";
|
|
6
|
+
/** Default implementation that shells out to the real git binary. */
|
|
7
|
+
export const NODE_GIT_REPOSITORY = (() => {
|
|
8
|
+
const execFileAsync = promisify(execFile);
|
|
9
|
+
return {
|
|
10
|
+
async isRepo(dir) {
|
|
11
|
+
try {
|
|
12
|
+
await execFileAsync("git", ["rev-parse", "--git-dir"], { cwd: dir });
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
async toplevel(dir) {
|
|
20
|
+
try {
|
|
21
|
+
const { stdout } = await execFileAsync("git", ["rev-parse", "--show-toplevel"], { cwd: dir });
|
|
22
|
+
return stdout.trim();
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
async checkoutBranch(repoPath, branch) {
|
|
29
|
+
try {
|
|
30
|
+
// "--" prevents branch names starting with "-" from being interpreted as flags
|
|
31
|
+
await execFileAsync("git", ["checkout", "--", branch], { cwd: repoPath });
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// Branch doesn't exist yet — create it
|
|
35
|
+
await execFileAsync("git", ["checkout", "-b", branch], { cwd: repoPath });
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
/** Default implementation using real Node.js fs. */
|
|
41
|
+
export const NODE_WORKSPACE_LOCATOR = {
|
|
42
|
+
exists: existsSync,
|
|
43
|
+
readDirectory(path) {
|
|
44
|
+
try {
|
|
45
|
+
return readdirSync(path);
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
return [];
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Find the git repository root from a set of well-known workspace paths.
|
|
54
|
+
*
|
|
55
|
+
* Checks (in order):
|
|
56
|
+
* 1. The provided basePath (if given)
|
|
57
|
+
* 2. /workspace (Docker convention)
|
|
58
|
+
* 3. /workspaces/* (GitHub Codespaces convention — picks the first git repo found)
|
|
59
|
+
*
|
|
60
|
+
* Returns the first path that exists and is a git repository, or undefined.
|
|
61
|
+
*/
|
|
62
|
+
export async function findGitRepoPath(basePath, git = NODE_GIT_REPOSITORY, locator = NODE_WORKSPACE_LOCATOR) {
|
|
63
|
+
// Try the explicitly provided path first, resolving to the actual repo root
|
|
64
|
+
if (basePath && locator.exists(basePath) && await git.isRepo(basePath)) {
|
|
65
|
+
return (await git.toplevel(basePath)) ?? basePath;
|
|
66
|
+
}
|
|
67
|
+
// Docker convention
|
|
68
|
+
if (locator.exists("/workspace") && await git.isRepo("/workspace")) {
|
|
69
|
+
return (await git.toplevel("/workspace")) ?? "/workspace";
|
|
70
|
+
}
|
|
71
|
+
// GitHub Codespaces convention: /workspaces/<repo-name>
|
|
72
|
+
if (locator.exists("/workspaces")) {
|
|
73
|
+
const entries = locator.readDirectory("/workspaces");
|
|
74
|
+
for (const entry of entries) {
|
|
75
|
+
const candidate = `/workspaces/${entry}`;
|
|
76
|
+
if (locator.exists(candidate) && await git.isRepo(candidate)) {
|
|
77
|
+
return (await git.toplevel(candidate)) ?? candidate;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return undefined;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Find any existing workspace directory (git repo or not) for fallback use.
|
|
85
|
+
* Used when worktree setup fails and we just need a working directory.
|
|
86
|
+
*/
|
|
87
|
+
function findWorkspaceDir(basePath, requireNonEmpty, locator = NODE_WORKSPACE_LOCATOR) {
|
|
88
|
+
const candidates = [basePath, "/workspace"];
|
|
89
|
+
// Also check /workspaces/* for Codespaces
|
|
90
|
+
if (locator.exists("/workspaces")) {
|
|
91
|
+
for (const entry of locator.readDirectory("/workspaces")) {
|
|
92
|
+
candidates.push(`/workspaces/${entry}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (const dir of candidates) {
|
|
96
|
+
if (dir && locator.exists(dir)) {
|
|
97
|
+
if (requireNonEmpty) {
|
|
98
|
+
if (locator.readDirectory(dir).length === 0) {
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return dir;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Resolve the working directory for an agent session.
|
|
109
|
+
*
|
|
110
|
+
* Tries worktree creation first (when branch + basePath are provided and
|
|
111
|
+
* useWorktrees is not false), auto-detecting the git repo if the provided
|
|
112
|
+
* basePath is not a git repo. Falls back to workspace directories on failure.
|
|
113
|
+
*
|
|
114
|
+
* When useWorktrees is explicitly false, checks out the branch directly in the
|
|
115
|
+
* main working tree instead of creating a worktree. When useWorktrees is
|
|
116
|
+
* undefined (proto3 unset), it defaults to true.
|
|
117
|
+
*/
|
|
118
|
+
export async function resolveWorkingDirectory(options) {
|
|
119
|
+
const { branch, workingDirectory, useWorktrees = true, eventQueue, requireNonEmpty, git = NODE_GIT_REPOSITORY, locator = NODE_WORKSPACE_LOCATOR, } = options;
|
|
120
|
+
const ts = () => new Date().toISOString();
|
|
121
|
+
if (branch && workingDirectory && useWorktrees) {
|
|
122
|
+
// Worktrees enabled — create a worktree for the branch.
|
|
123
|
+
// Auto-detect the actual git repo path — the server may send a default
|
|
124
|
+
// like "/workspace" that doesn't match the actual layout (e.g. Codespaces
|
|
125
|
+
// use /workspaces/<repo>).
|
|
126
|
+
const repoPath = await findGitRepoPath(workingDirectory, git, locator);
|
|
127
|
+
if (repoPath) {
|
|
128
|
+
try {
|
|
129
|
+
const wt = await ensureWorktree(repoPath, branch);
|
|
130
|
+
eventQueue.push({ type: "system", timestamp: ts(), content: `Worktree ready: ${wt.worktreePath} (branch: ${branch}, created: ${String(wt.created)}, synced: ${String(wt.synced)})` });
|
|
131
|
+
return wt.worktreePath;
|
|
132
|
+
}
|
|
133
|
+
catch (wtErr) {
|
|
134
|
+
eventQueue.push({ type: "system", timestamp: ts(), content: `Worktree setup failed (${wtErr instanceof Error ? wtErr.message : String(wtErr)}), falling back to workspace` });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
eventQueue.push({ type: "system", timestamp: ts(), content: `No git repo found at ${workingDirectory} or well-known paths, falling back to workspace` });
|
|
139
|
+
}
|
|
140
|
+
// Worktree failed — fall back to best available workspace
|
|
141
|
+
const fallback = findWorkspaceDir(workingDirectory, requireNonEmpty, locator);
|
|
142
|
+
if (fallback) {
|
|
143
|
+
return fallback;
|
|
144
|
+
}
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
if (branch && !useWorktrees) {
|
|
148
|
+
// Worktrees disabled — check out the branch in the main working tree.
|
|
149
|
+
// Use workingDirectory as the repo hint if provided.
|
|
150
|
+
const repoPath = await findGitRepoPath(workingDirectory, git, locator);
|
|
151
|
+
if (repoPath) {
|
|
152
|
+
try {
|
|
153
|
+
await git.checkoutBranch(repoPath, branch);
|
|
154
|
+
eventQueue.push({ type: "system", timestamp: ts(), content: `Checked out branch '${branch}' in main working tree: ${repoPath}` });
|
|
155
|
+
return repoPath;
|
|
156
|
+
}
|
|
157
|
+
catch (checkoutErr) {
|
|
158
|
+
eventQueue.push({ type: "system", timestamp: ts(), content: `Branch checkout failed (${checkoutErr instanceof Error ? checkoutErr.message : String(checkoutErr)}), falling back to workspace` });
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
eventQueue.push({ type: "system", timestamp: ts(), content: `No git repo found${workingDirectory ? ` at ${workingDirectory}` : ""} for branch checkout, falling back to workspace` });
|
|
163
|
+
}
|
|
164
|
+
// Checkout failed — fall back to best available workspace
|
|
165
|
+
const fallback = findWorkspaceDir(workingDirectory, requireNonEmpty, locator);
|
|
166
|
+
if (fallback) {
|
|
167
|
+
return fallback;
|
|
168
|
+
}
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
// No branch requested — just find a workspace directory
|
|
172
|
+
return findWorkspaceDir(workingDirectory, requireNonEmpty, locator);
|
|
173
|
+
}
|
|
174
|
+
// ─── ACP MCP server conversion ─────────────────────────────
|
|
175
|
+
/**
|
|
176
|
+
* Convert Grackle MCP server configs (keyed object) to ACP format (named array).
|
|
177
|
+
*
|
|
178
|
+
* Grackle format: `{ "name": { command, args, env, ... } }`
|
|
179
|
+
* ACP format: `[{ name, type: "stdio"|"http", command, args, env, ... }]`
|
|
180
|
+
*/
|
|
181
|
+
export function convertMcpServers(servers) {
|
|
182
|
+
if (!servers) {
|
|
183
|
+
return [];
|
|
184
|
+
}
|
|
185
|
+
return Object.entries(servers)
|
|
186
|
+
.filter(([, config]) => typeof config === "object" && config !== null && !Array.isArray(config))
|
|
187
|
+
.map(([name, config]) => {
|
|
188
|
+
const cfg = config;
|
|
189
|
+
// Detect transport: HTTP servers have type:"http" or a url field; everything else is stdio
|
|
190
|
+
const isHttp = cfg.type === "http" || cfg.url;
|
|
191
|
+
const result = {
|
|
192
|
+
name,
|
|
193
|
+
type: isHttp ? "http" : "stdio",
|
|
194
|
+
};
|
|
195
|
+
if (isHttp) {
|
|
196
|
+
// HTTP transport: url is required, headers must be array of {name, value}
|
|
197
|
+
result.url = cfg.url;
|
|
198
|
+
if (cfg.headers && typeof cfg.headers === "object" && !Array.isArray(cfg.headers)) {
|
|
199
|
+
result.headers = Object.entries(cfg.headers)
|
|
200
|
+
.map(([k, v]) => ({ name: k, value: v }));
|
|
201
|
+
}
|
|
202
|
+
else if (Array.isArray(cfg.headers)) {
|
|
203
|
+
result.headers = cfg.headers;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
// Stdio transport: command, args, env required
|
|
208
|
+
result.command = (cfg.command || "");
|
|
209
|
+
result.args = Array.isArray(cfg.args) ? cfg.args : [];
|
|
210
|
+
// env must be array of {name, value} — convert from object if needed
|
|
211
|
+
if (cfg.env && typeof cfg.env === "object" && !Array.isArray(cfg.env)) {
|
|
212
|
+
result.env = Object.entries(cfg.env)
|
|
213
|
+
.map(([k, v]) => ({ name: k, value: v }));
|
|
214
|
+
}
|
|
215
|
+
else if (Array.isArray(cfg.env)) {
|
|
216
|
+
result.env = cfg.env;
|
|
217
|
+
}
|
|
218
|
+
else {
|
|
219
|
+
result.env = [];
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return result;
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Load MCP server configurations from the shared GRACKLE_MCP_CONFIG file and spawn options.
|
|
227
|
+
*
|
|
228
|
+
* Also reads `disallowedTools` and filters matching tools from MCP server configs.
|
|
229
|
+
* When `brokerConfig` is provided, injects an HTTP-based Grackle MCP server entry.
|
|
230
|
+
*/
|
|
231
|
+
export function resolveMcpServers(spawnMcpServers, brokerConfig) {
|
|
232
|
+
let servers = {};
|
|
233
|
+
let disallowedTools = [];
|
|
234
|
+
const mcpConfigPath = process.env.GRACKLE_MCP_CONFIG;
|
|
235
|
+
if (mcpConfigPath && existsSync(mcpConfigPath)) {
|
|
236
|
+
try {
|
|
237
|
+
const mcpConfig = JSON.parse(readFileSync(mcpConfigPath, "utf8"));
|
|
238
|
+
if (mcpConfig.mcpServers && typeof mcpConfig.mcpServers === "object") {
|
|
239
|
+
servers = { ...servers, ...mcpConfig.mcpServers };
|
|
240
|
+
}
|
|
241
|
+
if (Array.isArray(mcpConfig.disallowedTools)) {
|
|
242
|
+
disallowedTools = mcpConfig.disallowedTools.filter((t) => typeof t === "string");
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
catch { /* ignore malformed config */ }
|
|
246
|
+
}
|
|
247
|
+
if (spawnMcpServers) {
|
|
248
|
+
servers = { ...servers, ...spawnMcpServers };
|
|
249
|
+
}
|
|
250
|
+
// Inject the Grackle MCP server entry when broker config is provided
|
|
251
|
+
if (!servers.grackle && brokerConfig) {
|
|
252
|
+
servers.grackle = {
|
|
253
|
+
type: "http",
|
|
254
|
+
url: brokerConfig.url,
|
|
255
|
+
headers: { Authorization: `Bearer ${brokerConfig.token}` },
|
|
256
|
+
// tools: ["*"] is required by Copilot SDK (MCPServerConfigBase.tools is mandatory).
|
|
257
|
+
// Claude Agent SDK ignores unknown fields, Codex CLI flattens to --config.
|
|
258
|
+
tools: ["*"],
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
// Filter disallowed tools from MCP server configs. The disallowedTools list
|
|
262
|
+
// uses the format "mcp__<serverName>__<toolName>", matching Claude Code's convention.
|
|
263
|
+
if (disallowedTools.length > 0) {
|
|
264
|
+
for (const [serverName, serverConfig] of Object.entries(servers)) {
|
|
265
|
+
if (typeof serverConfig !== "object" || serverConfig === null) {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
const cfg = serverConfig;
|
|
269
|
+
if (!Array.isArray(cfg.tools)) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
const prefix = `mcp__${serverName}__`;
|
|
273
|
+
const blocked = new Set(disallowedTools.filter((t) => t.startsWith(prefix)).map((t) => t.slice(prefix.length)));
|
|
274
|
+
if (blocked.size > 0) {
|
|
275
|
+
cfg.tools = cfg.tools.filter((t) => !blocked.has(t));
|
|
276
|
+
if (cfg.tools.length === 0) {
|
|
277
|
+
delete servers[serverName];
|
|
278
|
+
logger.info({ serverName, blocked: [...blocked] }, "Removed MCP server (all tools disallowed)");
|
|
279
|
+
}
|
|
280
|
+
else {
|
|
281
|
+
logger.info({ serverName, blocked: [...blocked] }, "Filtered disallowed tools from MCP server");
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
servers: Object.keys(servers).length > 0 ? servers : undefined,
|
|
288
|
+
disallowedTools,
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=runtime-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-utils.js","sour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,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,EAAE,2CAA2C,CAAC,CAAC;gBAClG,CAAC;qBAAM,CAAC;oBACN,MAAM,CAAC,IAAI,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,GAAG,OAAO,CAAC,EAAE,EAAE,2CAA2C,CAAC,CAAC;gBAClG,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;QAC9D,eAAe;KAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { AgentEventType, SessionStatus, PipeMode } from "@grackle-ai/common";
|
|
2
|
+
/** A single event emitted by an agent during execution. */
|
|
3
|
+
export interface AgentEvent {
|
|
4
|
+
type: AgentEventType;
|
|
5
|
+
timestamp: string;
|
|
6
|
+
content: string;
|
|
7
|
+
raw?: unknown;
|
|
8
|
+
}
|
|
9
|
+
/** Parameters for spawning a new agent session. */
|
|
10
|
+
export interface SpawnOptions {
|
|
11
|
+
sessionId: string;
|
|
12
|
+
prompt: string;
|
|
13
|
+
model: string;
|
|
14
|
+
maxTurns: number;
|
|
15
|
+
branch?: string;
|
|
16
|
+
workingDirectory?: string;
|
|
17
|
+
useWorktrees?: boolean;
|
|
18
|
+
systemContext?: string;
|
|
19
|
+
workspaceId?: string;
|
|
20
|
+
taskId?: string;
|
|
21
|
+
/** MCP server configurations to pass to the agent SDK. */
|
|
22
|
+
mcpServers?: Record<string, unknown>;
|
|
23
|
+
/** SDK hook callbacks (e.g. Stop hooks). Only supported by the Claude Code runtime; other runtimes ignore this field. */
|
|
24
|
+
hooks?: Record<string, unknown>;
|
|
25
|
+
/** MCP broker connection details. Both url and token must be present together. */
|
|
26
|
+
mcpBroker?: {
|
|
27
|
+
url: string;
|
|
28
|
+
token: string;
|
|
29
|
+
};
|
|
30
|
+
/** Script source code for script personas (e.g. GenAIScript). */
|
|
31
|
+
scriptContent?: string;
|
|
32
|
+
/** Pipe mode for parent↔child IPC ("sync", "async", "detach", or undefined for no pipe). */
|
|
33
|
+
pipe?: PipeMode;
|
|
34
|
+
}
|
|
35
|
+
/** Parameters for resuming an existing agent session. */
|
|
36
|
+
export interface ResumeOptions {
|
|
37
|
+
sessionId: string;
|
|
38
|
+
runtimeSessionId: string;
|
|
39
|
+
}
|
|
40
|
+
/** Handle for an in-progress agent session with streaming, input, and kill capabilities. */
|
|
41
|
+
export interface AgentSession {
|
|
42
|
+
id: string;
|
|
43
|
+
runtimeName: string;
|
|
44
|
+
runtimeSessionId: string;
|
|
45
|
+
status: SessionStatus;
|
|
46
|
+
/** Yield events as the agent runs. */
|
|
47
|
+
stream(): AsyncIterable<AgentEvent>;
|
|
48
|
+
/** Send user input to a session that is waiting for it. */
|
|
49
|
+
sendInput(text: string): void;
|
|
50
|
+
/** Forcefully terminate the session with an optional reason. */
|
|
51
|
+
kill(reason?: string): void;
|
|
52
|
+
/** Drain any buffered events that were not yet consumed by the stream. */
|
|
53
|
+
drainBufferedEvents(): AgentEvent[];
|
|
54
|
+
}
|
|
55
|
+
/** Contract for pluggable agent runtime implementations (e.g. Claude Code, stub). */
|
|
56
|
+
export interface AgentRuntime {
|
|
57
|
+
name: string;
|
|
58
|
+
/** Create and start a new agent session. */
|
|
59
|
+
spawn(opts: SpawnOptions): AgentSession;
|
|
60
|
+
/** Resume a previously suspended session. */
|
|
61
|
+
resume(opts: ResumeOptions): AgentSession;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=runtime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CA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IAAI,aAAa,CAAC,UAAU,CAAC,CAAC;IACpC,2DAA2D;IAC3D,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,gEAAgE;IAChE,IAAI,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,0EAA0E;IAC1E,mBAAmB,IAAI,UAAU,EAAE,CAAC;CACrC;AAED,qFAAqF;AACrF,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,KAAK,CAAC,IAAI,EAAE,YAAY,GAAG,YAAY,CAAC;IACxC,6CAA6C;IAC7C,MAAM,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,CAAC;CAC3C"}
|
package/dist/runtime.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.57.7"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Abstraction over git command execution used by worktree operations. */
|
|
2
|
+
export interface GitExecutor {
|
|
3
|
+
/** Run a git command and return stdout/stderr. */
|
|
4
|
+
exec(args: string[], options: {
|
|
5
|
+
cwd: string;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
}): Promise<{
|
|
8
|
+
stdout: string;
|
|
9
|
+
stderr: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
/** Filesystem operations used by worktree functions. */
|
|
13
|
+
export interface WorktreeFileSystem {
|
|
14
|
+
/** Check whether a path exists. */
|
|
15
|
+
existsSync(path: string): boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface WorktreeResult {
|
|
18
|
+
worktreePath: string;
|
|
19
|
+
branch: string;
|
|
20
|
+
created: boolean;
|
|
21
|
+
/** True if `git fetch origin` succeeded before worktree creation. */
|
|
22
|
+
synced: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** @internal Sanitize a branch name for use in file paths. Exported for testing. */
|
|
25
|
+
export declare function sanitizeBranch(branch: string): string;
|
|
26
|
+
/** @internal Compute the worktree directory path for a given branch. Exported for testing. */
|
|
27
|
+
export declare function worktreeDir(basePath: string, branch: string): string;
|
|
28
|
+
export declare function ensureWorktree(basePath: string, branch: string, git?: GitExecutor, fileSystem?: WorktreeFileSystem): Promise<WorktreeResult>;
|
|
29
|
+
export declare function removeWorktree(basePath: string, branch: string, git?: GitExecutor): Promise<void>;
|
|
30
|
+
//# sourceMappingURL=worktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../src/worktree.ts"],"names":[],"mappings":"AAWA,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/G;AAWD,wDAAwD;AACxD,MAAM,WAAW,kBAAkB;IACjC,mCAAmC;IACnC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;CACnC;AAOD,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,qEAAqE;IACrE,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,oFAAoF;AACpF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAUpE;AAmCD,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,GAAE,WAA+B,EACpC,UAAU,GAAE,kBAA8C,GACzD,OAAO,CAAC,cAAc,CAAC,CAwCzB;AAED,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,EACd,GAAG,GAAE,WAA+B,GACnC,OAAO,CAAC,IAAI,CAAC,CAOf"}
|
package/dist/worktree.js
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { promisify } from "node:util";
|
|
3
|
+
import { existsSync as existsSyncNode } from "node:fs";
|
|
4
|
+
import { resolve, dirname } from "node:path";
|
|
5
|
+
import { logger } from "./logger.js";
|
|
6
|
+
const execRaw = promisify(execFile);
|
|
7
|
+
/** Timeout for `git fetch origin` in milliseconds. */
|
|
8
|
+
const FETCH_TIMEOUT_MS = 30_000;
|
|
9
|
+
/** Default implementation that shells out to the real git binary. */
|
|
10
|
+
const NODE_GIT_EXECUTOR = {
|
|
11
|
+
async exec(args, options) {
|
|
12
|
+
const shell = process.env.SHELL || true;
|
|
13
|
+
const result = await execRaw("git", args, { ...options, shell });
|
|
14
|
+
return { stdout: String(result.stdout), stderr: String(result.stderr) };
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
/** Default implementation using real Node.js fs. */
|
|
18
|
+
const NODE_WORKTREE_FILE_SYSTEM = {
|
|
19
|
+
existsSync: existsSyncNode,
|
|
20
|
+
};
|
|
21
|
+
/** @internal Sanitize a branch name for use in file paths. Exported for testing. */
|
|
22
|
+
export function sanitizeBranch(branch) {
|
|
23
|
+
return branch.replace(/[^a-zA-Z0-9/_-]/g, "-");
|
|
24
|
+
}
|
|
25
|
+
/** @internal Compute the worktree directory path for a given branch. Exported for testing. */
|
|
26
|
+
export function worktreeDir(basePath, branch) {
|
|
27
|
+
const sanitized = sanitizeBranch(branch).replace(/\//g, "-");
|
|
28
|
+
const parent = dirname(basePath);
|
|
29
|
+
// When repo is at a root-level path (e.g. /workspace in Docker),
|
|
30
|
+
// dirname returns "/" which is typically not writable. Fall back to $HOME.
|
|
31
|
+
if (parent === "/" || parent === "\\") {
|
|
32
|
+
const home = process.env.HOME || process.env.USERPROFILE || basePath;
|
|
33
|
+
return resolve(home, ".grackle-worktrees", sanitized);
|
|
34
|
+
}
|
|
35
|
+
return resolve(parent, ".grackle-worktrees", sanitized);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Fetch from origin and detect the default branch name.
|
|
39
|
+
*
|
|
40
|
+
* Returns `synced: true` with a `startPoint` like `origin/main` on success,
|
|
41
|
+
* or `synced: false` with no start point on failure (so the caller can still
|
|
42
|
+
* create the worktree from local HEAD).
|
|
43
|
+
*/
|
|
44
|
+
async function fetchAndDetectDefault(basePath, git) {
|
|
45
|
+
try {
|
|
46
|
+
await git.exec(["fetch", "origin"], { cwd: basePath, timeout: FETCH_TIMEOUT_MS });
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
logger.warn({ err }, "git fetch origin failed — worktree will branch from local HEAD");
|
|
50
|
+
return { synced: false, startPoint: undefined };
|
|
51
|
+
}
|
|
52
|
+
// Detect the remote's default branch (e.g. refs/remotes/origin/main)
|
|
53
|
+
let defaultBranch = "origin/main";
|
|
54
|
+
try {
|
|
55
|
+
const { stdout } = await git.exec(["symbolic-ref", "refs/remotes/origin/HEAD"], { cwd: basePath });
|
|
56
|
+
const trimmed = stdout.trim(); // e.g. "refs/remotes/origin/main"
|
|
57
|
+
if (trimmed.startsWith("refs/remotes/")) {
|
|
58
|
+
defaultBranch = trimmed.slice("refs/remotes/".length); // "origin/main"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
logger.warn("Could not detect default branch via symbolic-ref, falling back to origin/main");
|
|
63
|
+
}
|
|
64
|
+
return { synced: true, startPoint: defaultBranch };
|
|
65
|
+
}
|
|
66
|
+
export async function ensureWorktree(basePath, branch, git = NODE_GIT_EXECUTOR, fileSystem = NODE_WORKTREE_FILE_SYSTEM) {
|
|
67
|
+
// Pre-check: verify basePath is a git repository
|
|
68
|
+
try {
|
|
69
|
+
await git.exec(["rev-parse", "--git-dir"], { cwd: basePath });
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
throw new Error(`Not a git repository: ${basePath}`);
|
|
73
|
+
}
|
|
74
|
+
// Pre-check: verify the git repo is writable (worktrees modify .git internals)
|
|
75
|
+
try {
|
|
76
|
+
await git.exec(["status", "--porcelain"], { cwd: basePath });
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
throw new Error(`Git repo not writable: ${basePath} (${err instanceof Error ? err.message : String(err)})`);
|
|
80
|
+
}
|
|
81
|
+
const wtPath = worktreeDir(basePath, branch);
|
|
82
|
+
if (fileSystem.existsSync(wtPath)) {
|
|
83
|
+
return { worktreePath: wtPath, branch, created: false, synced: false };
|
|
84
|
+
}
|
|
85
|
+
// Fetch origin so the new worktree branches from an up-to-date commit
|
|
86
|
+
const { synced, startPoint } = await fetchAndDetectDefault(basePath, git);
|
|
87
|
+
// Try creating a new branch worktree first
|
|
88
|
+
try {
|
|
89
|
+
const addArgs = startPoint
|
|
90
|
+
? ["worktree", "add", "-b", branch, wtPath, startPoint]
|
|
91
|
+
: ["worktree", "add", "-b", branch, wtPath];
|
|
92
|
+
await git.exec(addArgs, { cwd: basePath });
|
|
93
|
+
return { worktreePath: wtPath, branch, created: true, synced };
|
|
94
|
+
}
|
|
95
|
+
catch {
|
|
96
|
+
// Branch may already exist — try without -b
|
|
97
|
+
try {
|
|
98
|
+
await git.exec(["worktree", "add", wtPath, branch], { cwd: basePath });
|
|
99
|
+
return { worktreePath: wtPath, branch, created: true, synced };
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
throw new Error(`Failed to create worktree for branch ${branch}: ${err instanceof Error ? err.message : String(err)}`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
export async function removeWorktree(basePath, branch, git = NODE_GIT_EXECUTOR) {
|
|
107
|
+
const wtPath = worktreeDir(basePath, branch);
|
|
108
|
+
try {
|
|
109
|
+
await git.exec(["worktree", "remove", wtPath, "--force"], { cwd: basePath });
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
// Already removed or doesn't exist — that's fine
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=worktree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.js","sourceRoot":"","sources":["../src/worktree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAErC,MAAM,OAAO,GAAkC,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEnE,sDAAsD;AACtD,MAAM,gBAAgB,GAAW,MAAM,CAAC;AAQxC,qEAAqE;AACrE,MAAM,iBAAiB,GAAgB;IACrC,KAAK,CAAC,IAAI,CAAC,IAAc,EAAE,OAA0C;QACnE,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC;QACxC,MAAM,MAAM,GAAG,MAAM,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AI,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;YACvE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QACjE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,wCAAwC,MAAM,KAAK,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACzH,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAgB,EAChB,MAAc,EACd,MAAmB,iBAAiB;IAEpC,MAAM,MAAM,GAAG,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC7C,IAAI,CAAC;QACH,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/E,CAAC;IAAC,MAAM,CAAC;QACP,iDAAiD;IACnD,CAAC;AACH,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@grackle-ai/runtime-sdk",
|
|
3
|
+
"version": "0.82.2",
|
|
4
|
+
"description": "Grackle runtime SDK — interfaces, base classes, shared utilities, and runtime installer",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/nick-pape/grackle.git",
|
|
9
|
+
"directory": "packages/runtime-sdk"
|
|
10
|
+
},
|
|
11
|
+
"keywords": [
|
|
12
|
+
"grackle",
|
|
13
|
+
"runtime",
|
|
14
|
+
"sdk",
|
|
15
|
+
"agent"
|
|
16
|
+
],
|
|
17
|
+
"homepage": "https://github.com/nick-pape/grackle#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/nick-pape/grackle/issues"
|
|
20
|
+
},
|
|
21
|
+
"engines": {
|
|
22
|
+
"node": ">=22.0.0"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"files": [
|
|
28
|
+
"dist/"
|
|
29
|
+
],
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@modelcontextprotocol/sdk": "^1.27.0",
|
|
32
|
+
"pino": "^10.3.1",
|
|
33
|
+
"@grackle-ai/common": "0.82.2"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@rushstack/heft": "1.2.7",
|
|
37
|
+
"@types/node": "^22.0.0",
|
|
38
|
+
"vitest": "^3.1.1",
|
|
39
|
+
"@grackle-ai/heft-rig": "0.0.1"
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build": "heft build --clean",
|
|
43
|
+
"test": "vitest run",
|
|
44
|
+
"clean": "heft clean",
|
|
45
|
+
"_phase:build": "heft run --only build -- --clean",
|
|
46
|
+
"_phase:test": "vitest run"
|
|
47
|
+
}
|
|
48
|
+
}
|