frely-cli 0.23.10 → 0.23.12

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.
Files changed (55) hide show
  1. package/dist/agent/local/approvals.js +14 -18
  2. package/dist/agent/local/approvals.js.map +1 -1
  3. package/dist/agent/run-store.d.ts +85 -0
  4. package/dist/agent/run-store.js +155 -0
  5. package/dist/agent/run-store.js.map +1 -0
  6. package/dist/agent/run.d.ts +45 -0
  7. package/dist/agent/run.js +254 -0
  8. package/dist/agent/run.js.map +1 -0
  9. package/dist/agent/workspace-read.d.ts +78 -0
  10. package/dist/agent/workspace-read.js +292 -0
  11. package/dist/agent/workspace-read.js.map +1 -0
  12. package/dist/agent-help.d.ts +44 -8
  13. package/dist/agent-help.js +9 -3
  14. package/dist/agent-help.js.map +1 -1
  15. package/dist/approval-code.d.ts +4 -0
  16. package/dist/approval-code.js +15 -0
  17. package/dist/approval-code.js.map +1 -0
  18. package/dist/cloud.d.ts +8 -51
  19. package/dist/cloud.js +33 -284
  20. package/dist/cloud.js.map +1 -1
  21. package/dist/controller/approval-wait.d.ts +21 -0
  22. package/dist/controller/approval-wait.js +28 -0
  23. package/dist/controller/approval-wait.js.map +1 -0
  24. package/dist/controller/client.d.ts +6 -3
  25. package/dist/controller/client.js +7 -8
  26. package/dist/controller/client.js.map +1 -1
  27. package/dist/controller/commands.d.ts +3 -6
  28. package/dist/controller/commands.js +30 -31
  29. package/dist/controller/commands.js.map +1 -1
  30. package/dist/controller/session.d.ts +7 -2
  31. package/dist/controller/session.js +79 -22
  32. package/dist/controller/session.js.map +1 -1
  33. package/dist/index.js +83 -16
  34. package/dist/index.js.map +1 -1
  35. package/dist/mcp-authorization.d.ts +3 -3
  36. package/dist/mcp-authorization.js +13 -15
  37. package/dist/mcp-authorization.js.map +1 -1
  38. package/dist/mcp-command.js +3 -2
  39. package/dist/mcp-command.js.map +1 -1
  40. package/dist/share/control.d.ts +10 -1
  41. package/dist/share/control.js +45 -2
  42. package/dist/share/control.js.map +1 -1
  43. package/dist/share/run.d.ts +0 -5
  44. package/dist/share/run.js +3 -14
  45. package/dist/share/run.js.map +1 -1
  46. package/dist/skill/access.d.ts +28 -4
  47. package/dist/skill/access.js +78 -17
  48. package/dist/skill/access.js.map +1 -1
  49. package/dist/skill/entry.d.ts +1 -1
  50. package/dist/skill/entry.js +1 -1
  51. package/dist/skill/router.d.ts +76 -0
  52. package/dist/skill/router.js +99 -42
  53. package/dist/skill/router.js.map +1 -1
  54. package/package.json +1 -1
  55. package/skills/frely-cli/SKILL.md +2 -2
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/agent/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,yBAAyB,EACzB,gBAAgB,GAEjB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,QAAQ,EACR,SAAS,EACT,eAAe,EACf,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,UAAU,EACV,SAAS,EACT,QAAQ,GAET,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAmB,MAAM,qBAAqB,CAAC;AAEvF,MAAM,cAAc,GAAG,GAAG,GAAG,IAAI,CAAC;AAClC,MAAM,eAAe,GAAG,oHAAoH,CAAC;AAW7I,MAAM,CAAC,MAAM,cAAc,GAAY;IACrC,WAAW,EAAE,CAAC,cAAc,EAAE,EAAE,CAAC,yBAAyB,CAAC,EAAE,cAAc,EAAE,CAAC;IAC9E,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QAC3D,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC;YACxC,cAAc;YACd,IAAI;YACJ,MAAM;YAC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,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;IACjE,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,eAAe,GAAG,QAAQ,EAAE,CAAC;AACzE,CAAC;AAED,+FAA+F;AAC/F,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAa,EAAE,OAAgB,cAAc;IAC5E,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;IAChD,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,UAAU,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;AACnD,CAAC"}
@@ -0,0 +1,78 @@
1
+ import type { CallerToolDefinition } from "../skill/router.js";
2
+ /** One tool result is cut at this size (the Agent runtime rejects larger caller tool outputs). */
3
+ export declare const TOOL_OUTPUT_LIMIT_BYTES: number;
4
+ export declare const DEFAULT_TOTAL_READ_BYTES: number;
5
+ export declare const DEFAULT_MAX_ROUNDS = 16;
6
+ export interface ReadLimits {
7
+ /** Total tool output handed to the Agent in one run. */
8
+ readonly totalBytes: number;
9
+ /** Rounds in which tool calls are answered; later calls get "budget exhausted". */
10
+ readonly maxRounds: number;
11
+ }
12
+ export declare const DEFAULT_READ_LIMITS: ReadLimits;
13
+ export interface FileRead {
14
+ readonly path: string;
15
+ readonly bytes: number;
16
+ }
17
+ /**
18
+ * Read-only tools, with the same names and parameters as the FrelyMCP workspace tools. They run on this computer; the Agent only sees
19
+ * what a call returns.
20
+ */
21
+ export declare const READ_TOOLS: readonly CallerToolDefinition[];
22
+ /**
23
+ * Why a workspace path never leaves this computer, or null. Applies to every read-only tool result: git internals, environment files,
24
+ * key material, package-manager credentials. Gitignored files and binaries are checked separately (they need git and the file content).
25
+ */
26
+ export declare function localDenyReason(relativePath: string): string | null;
27
+ /** Which of these workspace-relative paths git ignores. Outside a git repository nothing is ignored. */
28
+ export declare function gitIgnoredPaths(root: string, paths: readonly string[]): Promise<Set<string>>;
29
+ /** The repository root for `--read` without a directory: the git top level of the current directory, else the directory itself. */
30
+ export declare function defaultReadRoot(cwd: string): Promise<string>;
31
+ export declare class WorkspaceReadBridge {
32
+ private readonly workspace;
33
+ readonly limits: ReadLimits;
34
+ private used;
35
+ private roundsAnswered;
36
+ private readonly reads;
37
+ private constructor();
38
+ static open(root: string, limits?: ReadLimits): Promise<WorkspaceReadBridge>;
39
+ get root(): string;
40
+ /** Restore the counters of an earlier part of the same run (resume). */
41
+ restore(state: {
42
+ readonly usedBytes: number;
43
+ readonly roundsAnswered: number;
44
+ readonly filesRead: readonly FileRead[];
45
+ }): void;
46
+ state(): {
47
+ usedBytes: number;
48
+ roundsAnswered: number;
49
+ filesRead: FileRead[];
50
+ };
51
+ filesRead(): FileRead[];
52
+ /** True once the Agent has used up the round budget; its next tool calls only get "budget exhausted". */
53
+ get roundBudgetSpent(): boolean;
54
+ /** Answer one round of calls. Never throws: a failure is the tool's output. Returns `onRead(path)` events through `log`. */
55
+ answerRound(calls: readonly {
56
+ callId: string;
57
+ name: string;
58
+ arguments: string;
59
+ }[], log?: (path: string) => void): Promise<{
60
+ callId: string;
61
+ output: string;
62
+ }[]>;
63
+ private exhaustedMessage;
64
+ private run;
65
+ private sanitize;
66
+ private noteRead;
67
+ private dispatch;
68
+ private ignored;
69
+ /** Drop denied and gitignored entries from a listing. */
70
+ private visible;
71
+ /**
72
+ * A path tree of the files the Agent may read, cut at `maxBytes`: the first thing it gets, so it can choose what to open. Uses
73
+ * `git ls-files` (tracked and untracked, not ignored) in a repository, else a bounded walk.
74
+ */
75
+ overview(maxBytes?: number): Promise<string>;
76
+ }
77
+ /** Cut at a byte limit on a character boundary, saying so, so the Agent knows to ask for a line range. */
78
+ export declare function limitBytes(text: string, limit: number): string;
@@ -0,0 +1,292 @@
1
+ import { execFile, spawn } from "node:child_process";
2
+ import { basename } from "node:path";
3
+ import { promisify } from "node:util";
4
+ import { Workspace } from "../runtime/workspace.js";
5
+ const execute = promisify(execFile);
6
+ /** One tool result is cut at this size (the Agent runtime rejects larger caller tool outputs). */
7
+ export const TOOL_OUTPUT_LIMIT_BYTES = 64 * 1024;
8
+ export const DEFAULT_TOTAL_READ_BYTES = 1024 * 1024;
9
+ export const DEFAULT_MAX_ROUNDS = 16;
10
+ const OVERVIEW_LIMIT_BYTES = 8 * 1024;
11
+ const DENIED = "denied by local policy";
12
+ export const DEFAULT_READ_LIMITS = Object.freeze({ totalBytes: DEFAULT_TOTAL_READ_BYTES, maxRounds: DEFAULT_MAX_ROUNDS });
13
+ /**
14
+ * Read-only tools, with the same names and parameters as the FrelyMCP workspace tools. They run on this computer; the Agent only sees
15
+ * what a call returns.
16
+ */
17
+ export const READ_TOOLS = Object.freeze([
18
+ tool("workspace_info", "Describe the workspace and the limits of these read-only tools.", {}),
19
+ tool("list_directory", "List a directory of the workspace (path relative to the workspace root).", { path: { type: "string" } }),
20
+ tool("find_files", "Find files by glob pattern, for example **/*.ts.", { path: { type: "string" }, pattern: { type: "string" }, maxResults: { type: "integer" } }, ["pattern"]),
21
+ tool("search_files", "Search file contents for text (or a regular expression).", {
22
+ path: { type: "string" }, query: { type: "string" }, regex: { type: "boolean" }, caseSensitive: { type: "boolean" }, maxResults: { type: "integer" }, contextLines: { type: "integer" },
23
+ }, ["query"]),
24
+ tool("read_file", "Read a text file (up to 64 KiB per call; use startLine/endLine for the rest).", { path: { type: "string" }, startLine: { type: "integer" }, endLine: { type: "integer" } }, ["path"]),
25
+ tool("read_file_lines", "Read a line range of a text file.", { path: { type: "string" }, startLine: { type: "integer" }, endLine: { type: "integer" } }, ["path", "startLine"]),
26
+ tool("stat_path", "Size and type of a file or directory.", { path: { type: "string" } }, ["path"]),
27
+ ]);
28
+ function tool(name, description, properties, required = []) {
29
+ return { type: "function", name, description, parameters: { type: "object", properties, required, additionalProperties: false } };
30
+ }
31
+ /**
32
+ * Why a workspace path never leaves this computer, or null. Applies to every read-only tool result: git internals, environment files,
33
+ * key material, package-manager credentials. Gitignored files and binaries are checked separately (they need git and the file content).
34
+ */
35
+ export function localDenyReason(relativePath) {
36
+ const segments = relativePath.split(/[\\/]+/u).filter((segment) => segment !== "" && segment !== ".");
37
+ if (segments.some((segment) => segment.toLowerCase() === ".git"))
38
+ return DENIED;
39
+ const name = (segments.at(-1) ?? "").toLowerCase();
40
+ if (name === ".env" || name.startsWith(".env.") || name.startsWith(".env-"))
41
+ return DENIED;
42
+ if (/\.(pem|key|p12)$/u.test(name))
43
+ return DENIED;
44
+ if (/^id_/u.test(name))
45
+ return DENIED;
46
+ if (name === ".npmrc" || name === ".netrc" || name === ".pypirc")
47
+ return DENIED;
48
+ return null;
49
+ }
50
+ /** Which of these workspace-relative paths git ignores. Outside a git repository nothing is ignored. */
51
+ export async function gitIgnoredPaths(root, paths) {
52
+ if (paths.length === 0)
53
+ return new Set();
54
+ return new Promise((resolve) => {
55
+ const child = spawn("git", ["-C", root, "check-ignore", "--stdin", "-z"], { stdio: ["pipe", "pipe", "ignore"], windowsHide: true });
56
+ const chunks = [];
57
+ child.stdout.on("data", (chunk) => chunks.push(chunk));
58
+ child.once("error", () => resolve(new Set()));
59
+ child.once("close", (code) => resolve(code === 0 ? new Set(Buffer.concat(chunks).toString("utf8").split("\0").filter(Boolean)) : new Set()));
60
+ child.stdin.once("error", () => undefined);
61
+ child.stdin.end(paths.join("\0") + "\0");
62
+ });
63
+ }
64
+ /** The repository root for `--read` without a directory: the git top level of the current directory, else the directory itself. */
65
+ export async function defaultReadRoot(cwd) {
66
+ try {
67
+ const { stdout } = await execute("git", ["-C", cwd, "rev-parse", "--show-toplevel"], { windowsHide: true });
68
+ const top = stdout.trim();
69
+ return top === "" ? cwd : top;
70
+ }
71
+ catch {
72
+ return cwd;
73
+ }
74
+ }
75
+ export class WorkspaceReadBridge {
76
+ workspace;
77
+ limits;
78
+ used = 0;
79
+ roundsAnswered = 0;
80
+ reads = new Map();
81
+ constructor(workspace, limits) {
82
+ this.workspace = workspace;
83
+ this.limits = limits;
84
+ }
85
+ static async open(root, limits = DEFAULT_READ_LIMITS) {
86
+ return new WorkspaceReadBridge(await Workspace.open(root), limits);
87
+ }
88
+ get root() { return this.workspace.root; }
89
+ /** Restore the counters of an earlier part of the same run (resume). */
90
+ restore(state) {
91
+ this.used = state.usedBytes;
92
+ this.roundsAnswered = state.roundsAnswered;
93
+ for (const file of state.filesRead)
94
+ this.reads.set(file.path, file.bytes);
95
+ }
96
+ state() {
97
+ return { usedBytes: this.used, roundsAnswered: this.roundsAnswered, filesRead: this.filesRead() };
98
+ }
99
+ filesRead() {
100
+ return [...this.reads].map(([path, bytes]) => ({ path, bytes }));
101
+ }
102
+ /** True once the Agent has used up the round budget; its next tool calls only get "budget exhausted". */
103
+ get roundBudgetSpent() { return this.roundsAnswered >= this.limits.maxRounds; }
104
+ /** Answer one round of calls. Never throws: a failure is the tool's output. Returns `onRead(path)` events through `log`. */
105
+ async answerRound(calls, log = () => undefined) {
106
+ const exhausted = this.roundBudgetSpent;
107
+ if (!exhausted)
108
+ this.roundsAnswered += 1;
109
+ const outputs = [];
110
+ for (const call of calls) {
111
+ outputs.push({ callId: call.callId, output: exhausted || this.used >= this.limits.totalBytes ? this.exhaustedMessage() : await this.run(call, log) });
112
+ }
113
+ return outputs;
114
+ }
115
+ exhaustedMessage() {
116
+ return "budget exhausted: no more files can be read in this run. Answer with what you have already read.";
117
+ }
118
+ async run(call, log) {
119
+ let args;
120
+ try {
121
+ const parsed = call.arguments.trim() === "" ? {} : JSON.parse(call.arguments);
122
+ if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed))
123
+ throw new Error("not an object");
124
+ args = parsed;
125
+ }
126
+ catch {
127
+ return "error: arguments must be a JSON object";
128
+ }
129
+ let output;
130
+ try {
131
+ output = await this.dispatch(call.name, args, log);
132
+ }
133
+ catch (error) {
134
+ output = `error: ${this.sanitize(error instanceof Error ? error.message : "tool failed")}`;
135
+ }
136
+ output = limitBytes(output, Math.min(TOOL_OUTPUT_LIMIT_BYTES, Math.max(0, this.limits.totalBytes - this.used)));
137
+ this.used += Buffer.byteLength(output, "utf8");
138
+ return output;
139
+ }
140
+ sanitize(message) {
141
+ return message.split(this.workspace.root).join(".");
142
+ }
143
+ noteRead(path, bytes, log) {
144
+ if (!this.reads.has(path))
145
+ log(path);
146
+ this.reads.set(path, (this.reads.get(path) ?? 0) + bytes);
147
+ }
148
+ async dispatch(name, args, log) {
149
+ switch (name) {
150
+ case "workspace_info":
151
+ return JSON.stringify({
152
+ workspace: basename(this.workspace.root),
153
+ tools: READ_TOOLS.map((entry) => entry.name),
154
+ limits: { toolOutputBytes: TOOL_OUTPUT_LIMIT_BYTES, totalBytes: this.limits.totalBytes, rounds: this.limits.maxRounds },
155
+ note: "Read-only. Git internals, .env files, key files, files ignored by git and binary files are not readable.",
156
+ });
157
+ case "list_directory": {
158
+ const path = pathArg(args, "path", ".");
159
+ if (localDenyReason(path) !== null || await this.ignored(path))
160
+ return DENIED;
161
+ const info = await this.workspace.statPath(path);
162
+ if (info.type !== "directory")
163
+ return JSON.stringify(info);
164
+ const entries = await this.workspace.listDirectory(path);
165
+ const kept = await this.visible(entries.map((entry) => ({ entry, path: joinPath(path, entry.name) })));
166
+ return JSON.stringify(kept.map(({ entry }) => entry));
167
+ }
168
+ case "stat_path": {
169
+ const path = pathArg(args, "path");
170
+ if (localDenyReason(path) !== null || await this.ignored(path))
171
+ return DENIED;
172
+ return JSON.stringify(await this.workspace.statPath(path));
173
+ }
174
+ case "find_files": {
175
+ const path = pathArg(args, "path", ".");
176
+ if (localDenyReason(path) !== null)
177
+ return DENIED;
178
+ const found = await this.workspace.findFiles(path, stringArg(args, "pattern"), intArg(args, "maxResults", 100, 1, 1000));
179
+ return JSON.stringify((await this.visible(found.map((file) => ({ file, path: file })))).map(({ file }) => file));
180
+ }
181
+ case "search_files": {
182
+ const path = pathArg(args, "path", ".");
183
+ if (localDenyReason(path) !== null)
184
+ return DENIED;
185
+ const hits = await this.workspace.searchFiles(path, stringArg(args, "query"), {
186
+ regex: args.regex === true,
187
+ caseSensitive: args.caseSensitive === true,
188
+ maxResults: intArg(args, "maxResults", 50, 1, 500),
189
+ contextLines: intArg(args, "contextLines", 0, 0, 10),
190
+ });
191
+ const kept = await this.visible(hits.map((hit) => ({ hit, path: hit.path })));
192
+ for (const { hit } of kept)
193
+ this.noteRead(hit.path, Buffer.byteLength(hit.text, "utf8"), log);
194
+ return JSON.stringify(kept.map(({ hit }) => hit));
195
+ }
196
+ case "read_file":
197
+ case "read_file_lines": {
198
+ const path = pathArg(args, "path");
199
+ if (localDenyReason(path) !== null || await this.ignored(path))
200
+ return DENIED;
201
+ const file = await this.workspace.readFileBytes(path);
202
+ if (file.data.subarray(0, 8000).includes(0))
203
+ return `${DENIED} (binary file)`;
204
+ const ranged = name === "read_file_lines" || args.startLine !== undefined || args.endLine !== undefined;
205
+ const text = ranged
206
+ ? (await this.workspace.readFileLines(path, intArg(args, "startLine", 1, 1, Number.MAX_SAFE_INTEGER), args.endLine === undefined ? undefined : intArg(args, "endLine", 1, 1, Number.MAX_SAFE_INTEGER))).content
207
+ : file.data.toString("utf8");
208
+ const returned = limitBytes(text, TOOL_OUTPUT_LIMIT_BYTES);
209
+ this.noteRead(path, Buffer.byteLength(returned, "utf8"), log);
210
+ return returned;
211
+ }
212
+ default:
213
+ return `error: unknown tool ${name.slice(0, 64)}`;
214
+ }
215
+ }
216
+ async ignored(path) {
217
+ if (path === "." || path === "")
218
+ return false;
219
+ return (await gitIgnoredPaths(this.workspace.root, [normalize(path)])).size > 0;
220
+ }
221
+ /** Drop denied and gitignored entries from a listing. */
222
+ async visible(entries) {
223
+ const allowed = entries.filter((entry) => localDenyReason(entry.path) === null);
224
+ const ignored = await gitIgnoredPaths(this.workspace.root, allowed.map((entry) => normalize(entry.path)));
225
+ return allowed.filter((entry) => !ignored.has(normalize(entry.path)));
226
+ }
227
+ /**
228
+ * A path tree of the files the Agent may read, cut at `maxBytes`: the first thing it gets, so it can choose what to open. Uses
229
+ * `git ls-files` (tracked and untracked, not ignored) in a repository, else a bounded walk.
230
+ */
231
+ async overview(maxBytes = OVERVIEW_LIMIT_BYTES) {
232
+ let files;
233
+ try {
234
+ const { stdout } = await execute("git", ["-C", this.workspace.root, "ls-files", "-z", "--cached", "--others", "--exclude-standard"], { maxBuffer: 16 * 1024 * 1024, windowsHide: true });
235
+ files = stdout.split("\0").filter(Boolean);
236
+ }
237
+ catch {
238
+ files = await this.workspace.findFiles(".", "*", 2000).catch(() => []);
239
+ }
240
+ files = [...new Set(files)].filter((file) => localDenyReason(file) === null).sort();
241
+ const lines = [];
242
+ let size = 0;
243
+ for (const file of files) {
244
+ size += Buffer.byteLength(file, "utf8") + 1;
245
+ if (size > maxBytes)
246
+ break;
247
+ lines.push(file);
248
+ }
249
+ const more = files.length - lines.length;
250
+ return `${lines.join("\n")}${more > 0 ? `\n... and ${more} more files` : ""}`;
251
+ }
252
+ }
253
+ function joinPath(base, name) {
254
+ return base === "." || base === "" ? name : `${base.replace(/[\\/]+$/u, "")}/${name}`;
255
+ }
256
+ function normalize(path) {
257
+ return path.split(/[\\/]+/u).filter((segment) => segment !== "" && segment !== ".").join("/");
258
+ }
259
+ function pathArg(args, name, fallback) {
260
+ const value = args[name];
261
+ if (value === undefined && fallback !== undefined)
262
+ return fallback;
263
+ if (typeof value !== "string" || value === "" || value.includes("\0"))
264
+ throw new Error(`${name} must be a non-empty path.`);
265
+ return value;
266
+ }
267
+ function stringArg(args, name) {
268
+ const value = args[name];
269
+ if (typeof value !== "string" || value === "")
270
+ throw new Error(`${name} is required.`);
271
+ return value;
272
+ }
273
+ function intArg(args, name, fallback, min, max) {
274
+ const value = args[name];
275
+ if (value === undefined)
276
+ return fallback;
277
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < min || value > max)
278
+ throw new Error(`${name} must be an integer from ${min} to ${max}.`);
279
+ return value;
280
+ }
281
+ /** Cut at a byte limit on a character boundary, saying so, so the Agent knows to ask for a line range. */
282
+ export function limitBytes(text, limit) {
283
+ if (Buffer.byteLength(text, "utf8") <= limit)
284
+ return text;
285
+ const note = "\n[truncated: output limit reached; use read_file_lines for the rest]";
286
+ const room = Math.max(0, limit - Buffer.byteLength(note, "utf8"));
287
+ let cut = Buffer.from(text, "utf8").subarray(0, room).toString("utf8");
288
+ if (cut.endsWith("�"))
289
+ cut = cut.slice(0, -1);
290
+ return limit === 0 ? "" : cut + note;
291
+ }
292
+ //# sourceMappingURL=workspace-read.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-read.js","sourceRoot":"","sources":["../../src/agent/workspace-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGpD,MAAM,OAAO,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAEpC,kGAAkG;AAClG,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,CAAC;AACjD,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,GAAG,IAAI,CAAC;AACpD,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AACrC,MAAM,oBAAoB,GAAG,CAAC,GAAG,IAAI,CAAC;AACtC,MAAM,MAAM,GAAG,wBAAwB,CAAC;AASxC,MAAM,CAAC,MAAM,mBAAmB,GAAe,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,wBAAwB,EAAE,SAAS,EAAE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AC;QAAE,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9C,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC;AACvC,CAAC"}
@@ -168,10 +168,28 @@ export declare const COMMANDS: readonly [{
168
168
  readonly purpose: "Install the public Agent's trigger Skill; an API key goes only through stdin to secure storage.";
169
169
  }, {
170
170
  readonly id: "agent.run";
171
- readonly usage: "frely agent run <username/name> (--input <text>|--input-stdin) [--json]";
171
+ readonly usage: "frely agent run <username/name> (--input <text>|--input-stdin) [--read [<dir>] [--read-max-bytes <n>] [--read-max-rounds <n>]] [--progress-summary|--no-progress-summary] [--json]";
172
172
  readonly auth: "installed-api-key-or-account";
173
173
  readonly effect: "remote-call";
174
- readonly purpose: "Send the complete relevant user request to the installed Agent through model-scoped MCP. Usage may be billed.";
174
+ readonly purpose: "Send the complete relevant user request to the installed Agent through model-scoped MCP. Usage may be billed. The call runs in a background worker and is recorded on this computer (run id on stderr), so a cut-off command loses nothing: use `frely agent result`. A long call keeps running at Frely and the worker waits for it (reading is free); `frely agent result` shows its newest progress line while it runs. --no-progress-summary asks the Agent not to write progress lines (use it when the user says so, for example in AGENTS.md); without a flag the account setting applies. With --read the Agent may read files of <dir> (default: the git root of the current directory) through read-only tools that run here: only files it asks for leave this computer; .git, .env*, key files, git-ignored and binary files are refused; defaults 1 MiB read and 16 rounds per run; each round is billed, and the result lists filesRead.";
175
+ }, {
176
+ readonly id: "agent.result";
177
+ readonly usage: "frely agent result (<runId>|--last) [--wait] [--resume] [--json]";
178
+ readonly auth: "none";
179
+ readonly effect: "read";
180
+ readonly purpose: "Show a run of `frely agent run` from this computer: running (rounds done, files read so far), completed (the full text) or failed/interrupted. --wait blocks until it ends. --resume continues an interrupted or failed run from the rounds already done; the interrupted round is billed again.";
181
+ }, {
182
+ readonly id: "agent.runs";
183
+ readonly usage: "frely agent runs [--json]";
184
+ readonly auth: "none";
185
+ readonly effect: "read";
186
+ readonly purpose: "List the recent agent runs on this computer (kept 7 days).";
187
+ }, {
188
+ readonly id: "agent.cancel";
189
+ readonly usage: "frely agent cancel (<runId>|--last) [--json]";
190
+ readonly auth: "none";
191
+ readonly effect: "local-process";
192
+ readonly purpose: "Stop a running agent run; the server stops and settles what was already used (a long call is canceled at Frely too).";
175
193
  }, {
176
194
  readonly id: "agent.status";
177
195
  readonly usage: "frely agent status (<username/name>|--api-key-stdin [--relay <url>]) [--json]";
@@ -240,10 +258,10 @@ export declare const COMMANDS: readonly [{
240
258
  readonly purpose: "List configured local Providers.";
241
259
  }, {
242
260
  readonly id: "share";
243
- readonly usage: "frely share <port> [--ttl <hours>] [--rewrite-host] [--yes] [--json]";
261
+ readonly usage: "frely share <port> [--ttl <hours>] [--rewrite-host] [--json]";
244
262
  readonly auth: "account";
245
263
  readonly effect: "remote-write";
246
- readonly purpose: "Make a web service on this computer (http://127.0.0.1:<port>) reachable from the Internet by a private link through Frely's relay, until Ctrl+C or expiry (at most 24 hours). Asks first. The relay allowance is a plan limit per UTC week; --rewrite-host sends Host: localhost to dev servers that refuse other names. Not the same as `frely provider share` (local models) or `frely tunnel` (command sandbox).";
264
+ readonly purpose: "Make a web service on this computer (http://127.0.0.1:<port>) reachable from the Internet by a private link through Frely's relay, until Ctrl+C or expiry (at most 24 hours). Needs the owner's approval in the browser each time (an approval link and code are printed; the command waits and continues by itself). The relay allowance is a plan limit per UTC week; --rewrite-host sends Host: localhost to dev servers that refuse other names. Not the same as `frely provider share` (local models) or `frely tunnel` (command sandbox).";
247
265
  }, {
248
266
  readonly id: "service.share";
249
267
  readonly usage: "frely service share --type mcp|a2a --port <n> [--label <text>] [--background] [--json]";
@@ -595,10 +613,28 @@ export declare function agentHelp(): {
595
613
  readonly purpose: "Install the public Agent's trigger Skill; an API key goes only through stdin to secure storage.";
596
614
  }, {
597
615
  readonly id: "agent.run";
598
- readonly usage: "frely agent run <username/name> (--input <text>|--input-stdin) [--json]";
616
+ readonly usage: "frely agent run <username/name> (--input <text>|--input-stdin) [--read [<dir>] [--read-max-bytes <n>] [--read-max-rounds <n>]] [--progress-summary|--no-progress-summary] [--json]";
599
617
  readonly auth: "installed-api-key-or-account";
600
618
  readonly effect: "remote-call";
601
- readonly purpose: "Send the complete relevant user request to the installed Agent through model-scoped MCP. Usage may be billed.";
619
+ readonly purpose: "Send the complete relevant user request to the installed Agent through model-scoped MCP. Usage may be billed. The call runs in a background worker and is recorded on this computer (run id on stderr), so a cut-off command loses nothing: use `frely agent result`. A long call keeps running at Frely and the worker waits for it (reading is free); `frely agent result` shows its newest progress line while it runs. --no-progress-summary asks the Agent not to write progress lines (use it when the user says so, for example in AGENTS.md); without a flag the account setting applies. With --read the Agent may read files of <dir> (default: the git root of the current directory) through read-only tools that run here: only files it asks for leave this computer; .git, .env*, key files, git-ignored and binary files are refused; defaults 1 MiB read and 16 rounds per run; each round is billed, and the result lists filesRead.";
620
+ }, {
621
+ readonly id: "agent.result";
622
+ readonly usage: "frely agent result (<runId>|--last) [--wait] [--resume] [--json]";
623
+ readonly auth: "none";
624
+ readonly effect: "read";
625
+ readonly purpose: "Show a run of `frely agent run` from this computer: running (rounds done, files read so far), completed (the full text) or failed/interrupted. --wait blocks until it ends. --resume continues an interrupted or failed run from the rounds already done; the interrupted round is billed again.";
626
+ }, {
627
+ readonly id: "agent.runs";
628
+ readonly usage: "frely agent runs [--json]";
629
+ readonly auth: "none";
630
+ readonly effect: "read";
631
+ readonly purpose: "List the recent agent runs on this computer (kept 7 days).";
632
+ }, {
633
+ readonly id: "agent.cancel";
634
+ readonly usage: "frely agent cancel (<runId>|--last) [--json]";
635
+ readonly auth: "none";
636
+ readonly effect: "local-process";
637
+ readonly purpose: "Stop a running agent run; the server stops and settles what was already used (a long call is canceled at Frely too).";
602
638
  }, {
603
639
  readonly id: "agent.status";
604
640
  readonly usage: "frely agent status (<username/name>|--api-key-stdin [--relay <url>]) [--json]";
@@ -667,10 +703,10 @@ export declare function agentHelp(): {
667
703
  readonly purpose: "List configured local Providers.";
668
704
  }, {
669
705
  readonly id: "share";
670
- readonly usage: "frely share <port> [--ttl <hours>] [--rewrite-host] [--yes] [--json]";
706
+ readonly usage: "frely share <port> [--ttl <hours>] [--rewrite-host] [--json]";
671
707
  readonly auth: "account";
672
708
  readonly effect: "remote-write";
673
- readonly purpose: "Make a web service on this computer (http://127.0.0.1:<port>) reachable from the Internet by a private link through Frely's relay, until Ctrl+C or expiry (at most 24 hours). Asks first. The relay allowance is a plan limit per UTC week; --rewrite-host sends Host: localhost to dev servers that refuse other names. Not the same as `frely provider share` (local models) or `frely tunnel` (command sandbox).";
709
+ readonly purpose: "Make a web service on this computer (http://127.0.0.1:<port>) reachable from the Internet by a private link through Frely's relay, until Ctrl+C or expiry (at most 24 hours). Needs the owner's approval in the browser each time (an approval link and code are printed; the command waits and continues by itself). The relay allowance is a plan limit per UTC week; --rewrite-host sends Host: localhost to dev servers that refuse other names. Not the same as `frely provider share` (local models) or `frely tunnel` (command sandbox).";
674
710
  }, {
675
711
  readonly id: "service.share";
676
712
  readonly usage: "frely service share --type mcp|a2a --port <n> [--label <text>] [--background] [--json]";
@@ -28,7 +28,10 @@ export const COMMANDS = [
28
28
  { id: "remote.call", usage: "frely remote call <username/name> <tool> [--json '<object>' | --input <file>] [--replace]", auth: "cloud-oauth", effect: "remote-call", purpose: "Call one tool of a remote MCP product and print the result as JSON (exit code 1 when the tool reports an error). Each call is billed or needs a pass exactly as in an MCP client; ask the user before a call that writes data they did not ask for." },
29
29
  { id: "remote.config", usage: "frely remote config <username/name> [--write <file>] [--replace]", auth: "cloud-oauth", effect: "remote-write", purpose: "Get a new key for one remote MCP product (it replaces the previous one) and print the mcpServers JSON that MCP clients take for it; with --write the entry is merged into that JSON file (created 0600) instead of printed. The key works only for this MCP." },
30
30
  { id: "agent.install", usage: "frely agent install <username/name[@version]> [--host chatgpt|codex|claude-code|pi|generic] [--scope global|project] [--dir <project>] [--api-key-stdin] [--json]", auth: "optional-api-key", effect: "local-write", purpose: "Install the public Agent's trigger Skill; an API key goes only through stdin to secure storage." },
31
- { id: "agent.run", usage: "frely agent run <username/name> (--input <text>|--input-stdin) [--json]", auth: "installed-api-key-or-account", effect: "remote-call", purpose: "Send the complete relevant user request to the installed Agent through model-scoped MCP. Usage may be billed." },
31
+ { id: "agent.run", usage: "frely agent run <username/name> (--input <text>|--input-stdin) [--read [<dir>] [--read-max-bytes <n>] [--read-max-rounds <n>]] [--progress-summary|--no-progress-summary] [--json]", auth: "installed-api-key-or-account", effect: "remote-call", purpose: "Send the complete relevant user request to the installed Agent through model-scoped MCP. Usage may be billed. The call runs in a background worker and is recorded on this computer (run id on stderr), so a cut-off command loses nothing: use `frely agent result`. A long call keeps running at Frely and the worker waits for it (reading is free); `frely agent result` shows its newest progress line while it runs. --no-progress-summary asks the Agent not to write progress lines (use it when the user says so, for example in AGENTS.md); without a flag the account setting applies. With --read the Agent may read files of <dir> (default: the git root of the current directory) through read-only tools that run here: only files it asks for leave this computer; .git, .env*, key files, git-ignored and binary files are refused; defaults 1 MiB read and 16 rounds per run; each round is billed, and the result lists filesRead." },
32
+ { id: "agent.result", usage: "frely agent result (<runId>|--last) [--wait] [--resume] [--json]", auth: "none", effect: "read", purpose: "Show a run of `frely agent run` from this computer: running (rounds done, files read so far), completed (the full text) or failed/interrupted. --wait blocks until it ends. --resume continues an interrupted or failed run from the rounds already done; the interrupted round is billed again." },
33
+ { id: "agent.runs", usage: "frely agent runs [--json]", auth: "none", effect: "read", purpose: "List the recent agent runs on this computer (kept 7 days)." },
34
+ { id: "agent.cancel", usage: "frely agent cancel (<runId>|--last) [--json]", auth: "none", effect: "local-process", purpose: "Stop a running agent run; the server stops and settles what was already used (a long call is canceled at Frely too)." },
32
35
  { id: "agent.status", usage: "frely agent status (<username/name>|--api-key-stdin [--relay <url>]) [--json]", auth: "none-or-api-key", effect: "read", purpose: "Inspect an installed Agent Skill and, for API-key installs, its Key budget. With --api-key-stdin, read that Key's budget without installing or logging in." },
33
36
  { id: "agent.remove", usage: "frely agent remove <username/name> [--json]", auth: "none", effect: "local-write", purpose: "Remove an installed Agent Skill and its saved API key." },
34
37
  { id: "agent.local.add", usage: "frely agent local add <username/name | https://github.com/owner/repo> [--name <folder-name>]", auth: "optional-account", effect: "local-write", purpose: "Download an Agent's repository into its own folder under ~/frely-agents and run its setup inside the sandbox. The sandbox can write only that folder, cannot read credential folders and can reach only Frely's API plus the sites the repository lists in frely.yaml, each of which the owner approves once through a link (exit code 3 with the link when nobody can wait; approve, then run the same command again). Needs a frely.yaml with a local.run command." },
@@ -40,7 +43,7 @@ export const COMMANDS = [
40
43
  { id: "agent.local.key", usage: "frely agent local key --api-key-stdin | --clear", auth: "account", effect: "local-write", purpose: "Save the Frely API key that local Agents use for model calls; it goes only through stdin to secure storage. FRELY_API_KEY overrides it." },
41
44
  { id: "provider.share", usage: "frely provider share [ollama|openai-compatible] [--url <loopback-v1-url>] [--models <a,b>] [--slot <slot-id>] [--name <name>]", auth: "account", effect: "remote-write", purpose: "Publish a local model Provider. If a prepared Provider on this device is not finished, resume it instead. Prints this week's remaining relay allowance; relayed traffic counts against the weekly relay allowance." },
42
45
  { id: "provider.list", usage: "frely provider list [--json]", auth: "account", effect: "read", purpose: "List configured local Providers." },
43
- { id: "share", usage: "frely share <port> [--ttl <hours>] [--rewrite-host] [--yes] [--json]", auth: "account", effect: "remote-write", purpose: "Make a web service on this computer (http://127.0.0.1:<port>) reachable from the Internet by a private link through Frely's relay, until Ctrl+C or expiry (at most 24 hours). Asks first. The relay allowance is a plan limit per UTC week; --rewrite-host sends Host: localhost to dev servers that refuse other names. Not the same as `frely provider share` (local models) or `frely tunnel` (command sandbox)." },
46
+ { id: "share", usage: "frely share <port> [--ttl <hours>] [--rewrite-host] [--json]", auth: "account", effect: "remote-write", purpose: "Make a web service on this computer (http://127.0.0.1:<port>) reachable from the Internet by a private link through Frely's relay, until Ctrl+C or expiry (at most 24 hours). Needs the owner's approval in the browser each time (an approval link and code are printed; the command waits and continues by itself). The relay allowance is a plan limit per UTC week; --rewrite-host sends Host: localhost to dev servers that refuse other names. Not the same as `frely provider share` (local models) or `frely tunnel` (command sandbox)." },
44
47
  { id: "service.share", usage: "frely service share --type mcp|a2a --port <n> [--label <text>] [--background] [--json]", auth: "account", effect: "remote-write", purpose: "Connect an MCP server or A2A Agent that runs on this computer (127.0.0.1:<port>) to Frely so you can sell it, without a public address: only Frely's own cloud can reach it, the port never leaves this computer, and Frely never supplies a target. Runs until Ctrl+C, or with --background the device background service keeps it connected. Prints this week's remaining relay allowance; relayed traffic counts against the weekly relay allowance." },
45
48
  { id: "service.manage", usage: "frely service list [--json] | stop <id|label> | remove <id|label>", auth: "account", effect: "remote-write", purpose: "List registered services, stop one on this computer (it stays registered), or remove it from Frely (products that pointed at it become unreachable)." },
46
49
  { id: "tunnel", usage: "frely tunnel <host>:<port> [--local-port N]", auth: "none", effect: "local-execution", purpose: "Run inside a sandboxed command (run_command): listen on 127.0.0.1:<local-port> (default: the same port) and forward each TCP connection to host:port through the command sandbox's proxy, so database and redis clients connect to 127.0.0.1 without turning the sandbox off. Start it in the same command as the client, for example `frely tunnel db.example.com:5432 & sleep 1; psql -h 127.0.0.1 ...`. Prints the local address and runs until killed." },
@@ -139,7 +142,10 @@ const SHORT_USAGE = {
139
142
  "item.run": "frely item run <script> [args...]",
140
143
  "item.trust": "frely item trust <folder> [--check]",
141
144
  "agent.install": "frely agent install <username/name> [--host <host>] [--api-key-stdin]",
142
- "agent.run": "frely agent run <username/name> (--input <text>|--input-stdin)",
145
+ "agent.run": "frely agent run <username/name> (--input <text>|--input-stdin) [--read [<dir>]]",
146
+ "agent.result": "frely agent result (<runId>|--last) [--wait] [--resume]",
147
+ "agent.runs": "frely agent runs",
148
+ "agent.cancel": "frely agent cancel (<runId>|--last)",
143
149
  "agent.status": "frely agent status <username/name>",
144
150
  "agent.remove": "frely agent remove <username/name>",
145
151
  "agent.local": "frely agent local add|start|stop|logs|list|remove|key",