youmd 0.8.28 → 0.9.0
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/commands/orchestrate.d.ts +12 -0
- package/dist/commands/orchestrate.d.ts.map +1 -0
- package/dist/commands/orchestrate.js +273 -0
- package/dist/commands/orchestrate.js.map +1 -0
- package/dist/commands/remote.d.ts +8 -0
- package/dist/commands/remote.d.ts.map +1 -1
- package/dist/commands/remote.js +8 -0
- package/dist/commands/remote.js.map +1 -1
- package/dist/commands/stack.d.ts.map +1 -1
- package/dist/commands/stack.js +37 -3
- package/dist/commands/stack.js.map +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/storage.d.ts +7 -0
- package/dist/commands/storage.d.ts.map +1 -0
- package/dist/commands/storage.js +220 -0
- package/dist/commands/storage.js.map +1 -0
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +17 -0
- package/dist/commands/sync.js.map +1 -1
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/api.d.ts +32 -0
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/lib/api.js +21 -0
- package/dist/lib/api.js.map +1 -1
- package/dist/lib/config.d.ts +15 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/daemon.d.ts +19 -0
- package/dist/lib/daemon.d.ts.map +1 -1
- package/dist/lib/daemon.js +72 -1
- package/dist/lib/daemon.js.map +1 -1
- package/dist/lib/foldermd.d.ts +70 -0
- package/dist/lib/foldermd.d.ts.map +1 -0
- package/dist/lib/foldermd.js +226 -0
- package/dist/lib/foldermd.js.map +1 -0
- package/dist/lib/orchestrator/loop.d.ts +55 -0
- package/dist/lib/orchestrator/loop.d.ts.map +1 -0
- package/dist/lib/orchestrator/loop.js +248 -0
- package/dist/lib/orchestrator/loop.js.map +1 -0
- package/dist/lib/orchestrator/supervisor.d.ts +80 -0
- package/dist/lib/orchestrator/supervisor.d.ts.map +1 -0
- package/dist/lib/orchestrator/supervisor.js +315 -0
- package/dist/lib/orchestrator/supervisor.js.map +1 -0
- package/dist/lib/orchestrator/tools.d.ts +16 -0
- package/dist/lib/orchestrator/tools.d.ts.map +1 -0
- package/dist/lib/orchestrator/tools.js +258 -0
- package/dist/lib/orchestrator/tools.js.map +1 -0
- package/dist/lib/remote-executor.d.ts +15 -1
- package/dist/lib/remote-executor.d.ts.map +1 -1
- package/dist/lib/remote-executor.js +195 -0
- package/dist/lib/remote-executor.js.map +1 -1
- package/dist/mcp/registry.d.ts.map +1 -1
- package/dist/mcp/registry.js +89 -0
- package/dist/mcp/registry.js.map +1 -1
- package/package.json +1 -1
- package/scripts/skillstack-sync/com.you.orchestrator-watch.plist +38 -0
- package/scripts/skillstack-sync/install-daemons-linux.sh +168 -0
- package/scripts/skillstack-sync/install-daemons.sh +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supervisor.js","sourceRoot":"","sources":["../../../src/lib/orchestrator/supervisor.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,EAAE;AACF,4FAA4F;AAC5F,wFAAwF;AACxF,0FAA0F;AAC1F,6FAA6F;AAC7F,wFAAwF;AACxF,EAAE;AACF,8FAA8F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkC9F,wDAEC;AAmCD,kCAiBC;AAcD,gCASC;AAGD,wCAWC;AAoCD,kCAoFC;AAED,8BAEC;AAGD,0CAUC;AAGD,gCAqBC;AAQD,oEAGC;AAGD,oCAYC;AAGD,oCAWC;AApUD,6DAA+C;AAC/C,uCAAyB;AACzB,2CAA6B;AAC7B,sCAAqD;AA0BrD,mEAAmE;AACtD,QAAA,wBAAwB,GAAmB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAExF,SAAgB,sBAAsB,CAAC,MAAoB;IACzD,OAAO,gCAAwB,CAAC,QAAQ,CAAC,MA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AAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QAC1E,OAAO,GAAG,GAAG,KAAK,GAAG,QAAQ,CAAC;IAChC,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;IAC7C,IAAI,OAAO,GAAG,CAAC;QAAE,WAAW,CAAC,IAAI,CAAC,CAAC;IACnC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { LoopTool, ModelCaller } from "./loop";
|
|
2
|
+
/** Resolve a You.md project name to a directory under known roots, else treat as a path. */
|
|
3
|
+
export declare function resolveProjectDir(project: string | undefined, fallbackCwd: string): string;
|
|
4
|
+
export interface BuildToolsOptions {
|
|
5
|
+
host?: string;
|
|
6
|
+
/** Default cwd for spawns when no project/dir is supplied. */
|
|
7
|
+
cwd?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Build the orchestrator tool set (process supervision over worker harnesses). */
|
|
10
|
+
export declare function buildOrchestratorTools(opts?: BuildToolsOptions): LoopTool[];
|
|
11
|
+
/**
|
|
12
|
+
* A harness/model-agnostic model caller: try the You.md chat proxy (no key needed), fall back to
|
|
13
|
+
* the user's OpenRouter key if present. Mirrors the proven onboarding.ts pattern.
|
|
14
|
+
*/
|
|
15
|
+
export declare function makeModelCaller(): ModelCaller;
|
|
16
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/lib/orchestrator/tools.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAe,WAAW,EAAE,MAAM,QAAQ,CAAC;AAiB5D,4FAA4F;AAC5F,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAe1F;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AA4BD,mFAAmF;AACnF,wBAAgB,sBAAsB,CAAC,IAAI,GAAE,iBAAsB,GAAG,QAAQ,EAAE,CA2G/E;AAED;;;GAGG;AACH,wBAAgB,eAAe,IAAI,WAAW,CA4C7C"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// tools.ts — orchestrator tool registry + model caller for the You agent loop.
|
|
3
|
+
//
|
|
4
|
+
// Wires the deterministic supervisor (spawn/list/tail/stop other harnesses) into LoopTools the
|
|
5
|
+
// iterative loop can drive, and provides a harness/model-agnostic model caller that reuses the
|
|
6
|
+
// existing /api/v1/chat proxy (with an OpenRouter fallback), so no new LLM plumbing is needed.
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.resolveProjectDir = resolveProjectDir;
|
|
42
|
+
exports.buildOrchestratorTools = buildOrchestratorTools;
|
|
43
|
+
exports.makeModelCaller = makeModelCaller;
|
|
44
|
+
const os = __importStar(require("os"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
const supervisor_1 = require("./supervisor");
|
|
47
|
+
const config_1 = require("../config");
|
|
48
|
+
const remote_command_1 = require("../remote-command");
|
|
49
|
+
const api_1 = require("../api");
|
|
50
|
+
const SITE = process.env.YOU_APP_URL || process.env.YOUMD_APP_URL || "https://you.md";
|
|
51
|
+
const CHAT_PROXY_URL = `${SITE}/api/v1/chat`;
|
|
52
|
+
const OPENROUTER_URL = "https://openrouter.ai/api/v1/chat/completions";
|
|
53
|
+
const OPENROUTER_MODEL = process.env.YOU_ORCHESTRATOR_MODEL || "anthropic/claude-sonnet-4.6";
|
|
54
|
+
/** Resolve a You.md project name to a directory under known roots, else treat as a path. */
|
|
55
|
+
function resolveProjectDir(project, fallbackCwd) {
|
|
56
|
+
if (!project)
|
|
57
|
+
return fallbackCwd;
|
|
58
|
+
if (path.isAbsolute(project))
|
|
59
|
+
return project;
|
|
60
|
+
// Common workspace roots; the daemon/machine layer keeps these in sync.
|
|
61
|
+
const home = os.homedir();
|
|
62
|
+
const candidates = [
|
|
63
|
+
path.join(process.cwd(), project),
|
|
64
|
+
path.join(home, "Desktop", "CODE_YOU", project),
|
|
65
|
+
path.join(home, "Desktop", "CODE_2025", project),
|
|
66
|
+
path.join(home, "Desktop", "CODE_2026", project),
|
|
67
|
+
path.join(home, project),
|
|
68
|
+
];
|
|
69
|
+
// We do not stat here (supervisor validates); return the first plausible candidate that the
|
|
70
|
+
// caller can override. The supervisor returns a clear error if it does not exist.
|
|
71
|
+
return candidates[0];
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Dispatch a whitelisted agent action to a REMOTE machine over the bus and wait (bounded) for
|
|
75
|
+
* the result. This is how the conductor delegates across machines autonomously inside the loop.
|
|
76
|
+
* Returns a human-readable string for the loop to reason over.
|
|
77
|
+
*/
|
|
78
|
+
async function runRemoteAgentAction(machine, action, args, timeoutMs = 90000) {
|
|
79
|
+
if (!(0, config_1.isAuthenticated)()) {
|
|
80
|
+
return "error: not authenticated — run `you login` to dispatch across machines";
|
|
81
|
+
}
|
|
82
|
+
const dispatched = await (0, remote_command_1.dispatchRemoteCommand)({ machine, action, args, sourceAgent: "you orchestrator" });
|
|
83
|
+
if (!dispatched.ok)
|
|
84
|
+
return `error dispatching ${action} to ${machine}: ${dispatched.error}`;
|
|
85
|
+
const result = await (0, remote_command_1.pollForResult)({ requestId: dispatched.data.requestId, timeoutMs });
|
|
86
|
+
if (!result) {
|
|
87
|
+
return `dispatched ${action} to ${machine} (request ${dispatched.data.requestId}) — no result within ${Math.round(timeoutMs / 1000)}s; the target may be offline or its daemon not running. Try agent.list later.`;
|
|
88
|
+
}
|
|
89
|
+
if (result.ok)
|
|
90
|
+
return `[${machine}] ${action} ok:\n${result.output || "(no output)"}`;
|
|
91
|
+
return `[${machine}] ${action} ${result.status}: ${result.error ?? "failed"}\n${result.output || ""}`.trim();
|
|
92
|
+
}
|
|
93
|
+
/** Build the orchestrator tool set (process supervision over worker harnesses). */
|
|
94
|
+
function buildOrchestratorTools(opts = {}) {
|
|
95
|
+
const host = opts.host || os.hostname();
|
|
96
|
+
const cwd = opts.cwd || process.cwd();
|
|
97
|
+
return [
|
|
98
|
+
{
|
|
99
|
+
name: "spawn_agent",
|
|
100
|
+
description: "Launch a worker agent harness on a task in a project (delegate the actual work). Add `machine` to run it on another computer (that host must have YOU_REMOTE_AGENT_HOST=1).",
|
|
101
|
+
parameters: {
|
|
102
|
+
harness: "claude | codex | cursor (custom = local only)",
|
|
103
|
+
goal: "the task prompt for the worker",
|
|
104
|
+
project: "(optional) You.md project name or absolute path to run in",
|
|
105
|
+
dir: "(optional, local only) explicit working directory (overrides project)",
|
|
106
|
+
machine: "(optional) remote machine hostname to run on instead of this host",
|
|
107
|
+
},
|
|
108
|
+
run: async (args) => {
|
|
109
|
+
const harness = String(args.harness || "claude");
|
|
110
|
+
const goal = String(args.goal || "").trim();
|
|
111
|
+
if (!goal)
|
|
112
|
+
return "error: spawn_agent requires a non-empty goal";
|
|
113
|
+
if (args.machine) {
|
|
114
|
+
return runRemoteAgentAction(String(args.machine), "agent.spawn", {
|
|
115
|
+
harness,
|
|
116
|
+
goal,
|
|
117
|
+
project: args.project ? String(args.project) : undefined,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
const dir = args.dir
|
|
121
|
+
? String(args.dir)
|
|
122
|
+
: resolveProjectDir(args.project ? String(args.project) : undefined, cwd);
|
|
123
|
+
const res = (0, supervisor_1.spawnWorker)({
|
|
124
|
+
harness,
|
|
125
|
+
goal,
|
|
126
|
+
cwd: dir,
|
|
127
|
+
project: args.project ? String(args.project) : undefined,
|
|
128
|
+
host,
|
|
129
|
+
});
|
|
130
|
+
if (!res.ok || !res.worker)
|
|
131
|
+
return `error: ${res.error}`;
|
|
132
|
+
return `launched ${harness} worker ${res.worker.id} (pid ${res.worker.pid}) in ${dir}`;
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
name: "list_agents",
|
|
137
|
+
description: "List worker agents and their status on this host, or on a remote `machine`.",
|
|
138
|
+
parameters: { machine: "(optional) remote machine hostname" },
|
|
139
|
+
run: async (args) => {
|
|
140
|
+
if (args.machine)
|
|
141
|
+
return runRemoteAgentAction(String(args.machine), "agent.list", {});
|
|
142
|
+
const workers = (0, supervisor_1.refreshWorkers)();
|
|
143
|
+
if (workers.length === 0)
|
|
144
|
+
return "no workers yet";
|
|
145
|
+
return workers
|
|
146
|
+
.map((w) => `${w.id} [${w.status}] ${w.harness} project=${w.project ?? "-"} :: ${w.goal.slice(0, 80)}`)
|
|
147
|
+
.join("\n");
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
name: "get_agent_output",
|
|
152
|
+
description: "Tail a worker agent's captured output (local, or on a remote `machine`).",
|
|
153
|
+
parameters: {
|
|
154
|
+
id: "worker id",
|
|
155
|
+
lines: "(optional) number of lines to tail (default 40)",
|
|
156
|
+
machine: "(optional) remote machine hostname",
|
|
157
|
+
},
|
|
158
|
+
run: async (args) => {
|
|
159
|
+
const id = String(args.id || "").trim();
|
|
160
|
+
if (!id)
|
|
161
|
+
return "error: get_agent_output requires id";
|
|
162
|
+
const lines = Number(args.lines) > 0 ? Number(args.lines) : 40;
|
|
163
|
+
if (args.machine)
|
|
164
|
+
return runRemoteAgentAction(String(args.machine), "agent.output", { id, lines });
|
|
165
|
+
const res = (0, supervisor_1.getWorkerOutput)(id, lines);
|
|
166
|
+
return res.ok ? res.output || "(empty)" : `error: ${res.error}`;
|
|
167
|
+
},
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "stop_agent",
|
|
171
|
+
description: "Stop a running worker agent (local, or on a remote `machine`).",
|
|
172
|
+
parameters: { id: "worker id", machine: "(optional) remote machine hostname" },
|
|
173
|
+
run: async (args) => {
|
|
174
|
+
const id = String(args.id || "").trim();
|
|
175
|
+
if (!id)
|
|
176
|
+
return "error: stop_agent requires id";
|
|
177
|
+
if (args.machine)
|
|
178
|
+
return runRemoteAgentAction(String(args.machine), "agent.stop", { id });
|
|
179
|
+
const res = (0, supervisor_1.stopWorker)(id);
|
|
180
|
+
return res.ok ? `stopped ${id}` : `error: ${res.error}`;
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
name: "list_machines",
|
|
185
|
+
description: "List the user's synced machines (candidates to delegate work to).",
|
|
186
|
+
parameters: {},
|
|
187
|
+
run: async () => {
|
|
188
|
+
if (!(0, config_1.isAuthenticated)())
|
|
189
|
+
return "error: not authenticated — run `you login`";
|
|
190
|
+
const res = await (0, api_1.getMachineProofs)({ limit: 25 });
|
|
191
|
+
const machines = res.ok ? res.data?.machines || [] : [];
|
|
192
|
+
if (machines.length === 0)
|
|
193
|
+
return "no synced machines yet";
|
|
194
|
+
const self = host.toLowerCase();
|
|
195
|
+
return machines
|
|
196
|
+
.map((m) => {
|
|
197
|
+
const name = m.hostName || "(unknown)";
|
|
198
|
+
const tag = name.toLowerCase() === self ? " (this host)" : "";
|
|
199
|
+
return `${name}${tag} — ${m.status ?? "?"}, last seen ${m.generatedAt ?? "?"}`;
|
|
200
|
+
})
|
|
201
|
+
.join("\n");
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
];
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* A harness/model-agnostic model caller: try the You.md chat proxy (no key needed), fall back to
|
|
208
|
+
* the user's OpenRouter key if present. Mirrors the proven onboarding.ts pattern.
|
|
209
|
+
*/
|
|
210
|
+
function makeModelCaller() {
|
|
211
|
+
return async (messages) => {
|
|
212
|
+
// Try the proxy first.
|
|
213
|
+
try {
|
|
214
|
+
const res = await fetch(CHAT_PROXY_URL, {
|
|
215
|
+
method: "POST",
|
|
216
|
+
headers: { "Content-Type": "application/json" },
|
|
217
|
+
body: JSON.stringify({ messages }),
|
|
218
|
+
signal: AbortSignal.timeout(60000),
|
|
219
|
+
});
|
|
220
|
+
if (res.ok) {
|
|
221
|
+
const data = (await res.json());
|
|
222
|
+
if (data.content)
|
|
223
|
+
return data.content;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
// fall through to direct call
|
|
228
|
+
}
|
|
229
|
+
const cfg = (0, config_1.readGlobalConfig)();
|
|
230
|
+
const key = cfg.openrouterKey || process.env.OPENROUTER_API_KEY;
|
|
231
|
+
if (!key)
|
|
232
|
+
throw new Error("orchestrator model unavailable (no chat proxy, no OpenRouter key)");
|
|
233
|
+
const res = await fetch(OPENROUTER_URL, {
|
|
234
|
+
method: "POST",
|
|
235
|
+
headers: {
|
|
236
|
+
Authorization: `Bearer ${key}`,
|
|
237
|
+
"Content-Type": "application/json",
|
|
238
|
+
"HTTP-Referer": "https://you.md",
|
|
239
|
+
"X-Title": "you.md orchestrator",
|
|
240
|
+
},
|
|
241
|
+
body: JSON.stringify({
|
|
242
|
+
model: OPENROUTER_MODEL,
|
|
243
|
+
messages,
|
|
244
|
+
max_tokens: 1024,
|
|
245
|
+
temperature: 0.3,
|
|
246
|
+
}),
|
|
247
|
+
signal: AbortSignal.timeout(60000),
|
|
248
|
+
});
|
|
249
|
+
if (!res.ok)
|
|
250
|
+
throw new Error(`OpenRouter error ${res.status}: ${await res.text()}`);
|
|
251
|
+
const data = (await res.json());
|
|
252
|
+
const content = data.choices?.[0]?.message?.content;
|
|
253
|
+
if (!content)
|
|
254
|
+
throw new Error("empty model response");
|
|
255
|
+
return content;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/lib/orchestrator/tools.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,EAAE;AACF,+FAA+F;AAC/F,+FAA+F;AAC/F,+FAA+F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsB/F,8CAeC;AAmCD,wDA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,EAAE,EAAE,CAAC,CAAC;QACpF,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAA0D,CAAC;QACzF,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC;QACpD,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;QACtD,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
export type RemoteActionMutating = "no" | "reversible";
|
|
25
25
|
/** The exact set of actions a remote machine may trigger. The keys ARE the
|
|
26
26
|
* security boundary — extending it requires a code change + review. */
|
|
27
|
-
export declare const ALLOWED_REMOTE_ACTIONS: readonly ["git.status", "git.last_activity", "git.commit_push", "git.pull", "agent.status"];
|
|
27
|
+
export declare const ALLOWED_REMOTE_ACTIONS: readonly ["git.status", "git.last_activity", "git.commit_push", "git.pull", "agent.status", "agent.spawn", "agent.list", "agent.output", "agent.stop"];
|
|
28
28
|
export type RemoteAction = (typeof ALLOWED_REMOTE_ACTIONS)[number];
|
|
29
29
|
export interface RemoteActionSpec {
|
|
30
30
|
/** Whether the action requires a resolved project directory. */
|
|
@@ -35,6 +35,20 @@ export interface RemoteActionSpec {
|
|
|
35
35
|
description: string;
|
|
36
36
|
}
|
|
37
37
|
export declare const ACTION_SPECS: Record<RemoteAction, RemoteActionSpec>;
|
|
38
|
+
/**
|
|
39
|
+
* Whether THIS host accepts remote requests to launch/stop autonomous worker agents.
|
|
40
|
+
* Off by default: a host enrolled in the brain is remotely observable (git/status/agent.list)
|
|
41
|
+
* but will NOT run a remotely-triggered coding agent unless its owner explicitly opts in. The
|
|
42
|
+
* y.computer / VPS provision flow sets this deliberately when standing up a worker host.
|
|
43
|
+
*/
|
|
44
|
+
export declare function remoteAgentHostEnabled(): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Build a secret-minimized environment for a REMOTELY-triggered worker so it does not inherit the
|
|
47
|
+
* resident daemon's own credentials (you.md token, OpenRouter, folder.md, vault) — a remote issuer
|
|
48
|
+
* should not be able to launch an agent that can read those off process.env. Defense-in-depth, not
|
|
49
|
+
* a full sandbox: the worker harness keeps its own auth (e.g. ANTHROPIC_API_KEY) so it still runs.
|
|
50
|
+
*/
|
|
51
|
+
export declare function remoteWorkerEnv(base?: NodeJS.ProcessEnv): NodeJS.ProcessEnv;
|
|
38
52
|
export declare function isAllowedRemoteAction(action: unknown): action is RemoteAction;
|
|
39
53
|
export interface RemoteGitState {
|
|
40
54
|
branch: string | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote-executor.d.ts","sourceRoot":"","sources":["../../src/lib/remote-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"remote-executor.d.ts","sourceRoot":"","sources":["../../src/lib/remote-executor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAuBH,+EAA+E;AAC/E,MAAM,MAAM,oBAAoB,GAAG,IAAI,GAAG,YAAY,CAAC;AAEvD;wEACwE;AACxE,eAAO,MAAM,sBAAsB,wJAezB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE,MAAM,WAAW,gBAAgB;IAC/B,gEAAgE;IAChE,YAAY,EAAE,OAAO,CAAC;IACtB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,gBAAgB,CAyD/D,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAWhD;AAKD;;;;;GAKG;AACH,wBAAgB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E,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAcD;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAAC,gBAAgB,CAAC,CAwQ3B"}
|
|
@@ -56,6 +56,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
56
56
|
})();
|
|
57
57
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
58
|
exports.ACTION_SPECS = exports.ALLOWED_REMOTE_ACTIONS = void 0;
|
|
59
|
+
exports.remoteAgentHostEnabled = remoteAgentHostEnabled;
|
|
60
|
+
exports.remoteWorkerEnv = remoteWorkerEnv;
|
|
59
61
|
exports.isAllowedRemoteAction = isAllowedRemoteAction;
|
|
60
62
|
exports.redactSecrets = redactSecrets;
|
|
61
63
|
exports.truncateOutput = truncateOutput;
|
|
@@ -66,6 +68,8 @@ const os = __importStar(require("os"));
|
|
|
66
68
|
const path = __importStar(require("path"));
|
|
67
69
|
const child_process_1 = require("child_process");
|
|
68
70
|
const project_1 = require("./project");
|
|
71
|
+
const supervisor_1 = require("./orchestrator/supervisor");
|
|
72
|
+
const config_1 = require("./config");
|
|
69
73
|
/** The exact set of actions a remote machine may trigger. The keys ARE the
|
|
70
74
|
* security boundary — extending it requires a code change + review. */
|
|
71
75
|
exports.ALLOWED_REMOTE_ACTIONS = [
|
|
@@ -74,6 +78,15 @@ exports.ALLOWED_REMOTE_ACTIONS = [
|
|
|
74
78
|
"git.commit_push",
|
|
75
79
|
"git.pull",
|
|
76
80
|
"agent.status",
|
|
81
|
+
// ── Cross-machine orchestration (the You agent conductor driving a remote host) ──
|
|
82
|
+
// agent.spawn / agent.stop launch/stop a WORKER harness on the target — a real
|
|
83
|
+
// privilege escalation beyond the git whitelist, so they require the target host to
|
|
84
|
+
// opt in via YOU_REMOTE_AGENT_HOST=1 (see remoteAgentHostEnabled). list/output are
|
|
85
|
+
// read-only and need no extra opt-in.
|
|
86
|
+
"agent.spawn",
|
|
87
|
+
"agent.list",
|
|
88
|
+
"agent.output",
|
|
89
|
+
"agent.stop",
|
|
77
90
|
];
|
|
78
91
|
exports.ACTION_SPECS = {
|
|
79
92
|
"git.status": {
|
|
@@ -106,7 +119,80 @@ exports.ACTION_SPECS = {
|
|
|
106
119
|
timeoutMs: 15000,
|
|
107
120
|
description: "report host/runtime + last agent-bus heartbeat hint",
|
|
108
121
|
},
|
|
122
|
+
"agent.spawn": {
|
|
123
|
+
// needsProject is false here so the host opt-in gate is checked FIRST (inside the case);
|
|
124
|
+
// the project dir is resolved + contained inside the case, after the gate.
|
|
125
|
+
needsProject: false,
|
|
126
|
+
mutating: "reversible",
|
|
127
|
+
timeoutMs: 15000,
|
|
128
|
+
description: "launch a worker harness (claude|codex|cursor) on a task in a project (opt-in host)",
|
|
129
|
+
},
|
|
130
|
+
"agent.list": {
|
|
131
|
+
needsProject: false,
|
|
132
|
+
mutating: "no",
|
|
133
|
+
timeoutMs: 10000,
|
|
134
|
+
description: "list worker agents and their status on this host",
|
|
135
|
+
},
|
|
136
|
+
"agent.output": {
|
|
137
|
+
needsProject: false,
|
|
138
|
+
mutating: "no",
|
|
139
|
+
timeoutMs: 10000,
|
|
140
|
+
description: "tail a worker agent's captured output",
|
|
141
|
+
},
|
|
142
|
+
"agent.stop": {
|
|
143
|
+
needsProject: false,
|
|
144
|
+
mutating: "reversible",
|
|
145
|
+
timeoutMs: 10000,
|
|
146
|
+
description: "stop a running worker agent (opt-in host)",
|
|
147
|
+
},
|
|
109
148
|
};
|
|
149
|
+
/**
|
|
150
|
+
* Whether THIS host accepts remote requests to launch/stop autonomous worker agents.
|
|
151
|
+
* Off by default: a host enrolled in the brain is remotely observable (git/status/agent.list)
|
|
152
|
+
* but will NOT run a remotely-triggered coding agent unless its owner explicitly opts in. The
|
|
153
|
+
* y.computer / VPS provision flow sets this deliberately when standing up a worker host.
|
|
154
|
+
*/
|
|
155
|
+
function remoteAgentHostEnabled() {
|
|
156
|
+
const v = (process.env.YOU_REMOTE_AGENT_HOST || process.env.YOUMD_REMOTE_AGENT_HOST || "").trim().toLowerCase();
|
|
157
|
+
if (v === "1" || v === "true" || v === "yes")
|
|
158
|
+
return true;
|
|
159
|
+
if (v === "0" || v === "false" || v === "no")
|
|
160
|
+
return false; // explicit env override wins
|
|
161
|
+
// Persisted opt-in: the resident daemon's process env carries no shell exports, so the
|
|
162
|
+
// durable flag in config is the real enablement path (set via `you orchestrate host on`).
|
|
163
|
+
try {
|
|
164
|
+
return (0, config_1.readGlobalConfig)().remoteAgentHost === true;
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** Worker harnesses a REMOTE issuer may request. `custom` (arbitrary argv) is intentionally excluded. */
|
|
171
|
+
const REMOTE_SPAWNABLE_HARNESSES = ["claude", "codex", "cursor"];
|
|
172
|
+
/**
|
|
173
|
+
* Build a secret-minimized environment for a REMOTELY-triggered worker so it does not inherit the
|
|
174
|
+
* resident daemon's own credentials (you.md token, OpenRouter, folder.md, vault) — a remote issuer
|
|
175
|
+
* should not be able to launch an agent that can read those off process.env. Defense-in-depth, not
|
|
176
|
+
* a full sandbox: the worker harness keeps its own auth (e.g. ANTHROPIC_API_KEY) so it still runs.
|
|
177
|
+
*/
|
|
178
|
+
function remoteWorkerEnv(base = process.env) {
|
|
179
|
+
const env = { ...base };
|
|
180
|
+
const explicitDrop = [
|
|
181
|
+
"YOU_API_KEY", "YOUMD_API_KEY",
|
|
182
|
+
"OPENROUTER_API_KEY",
|
|
183
|
+
"FOLDER_API_KEY", "FOLDERMD_API_KEY",
|
|
184
|
+
"YOU_REMOTE_AGENT_HOST", "YOUMD_REMOTE_AGENT_HOST",
|
|
185
|
+
];
|
|
186
|
+
for (const k of explicitDrop)
|
|
187
|
+
delete env[k];
|
|
188
|
+
// Drop obvious secret-shaped vars (tokens/secrets/passwords/private keys). Keeps *_API_KEY
|
|
189
|
+
// like ANTHROPIC_API_KEY so the harness can authenticate.
|
|
190
|
+
for (const k of Object.keys(env)) {
|
|
191
|
+
if (/(_SECRET$|^SECRET|_TOKEN$|TOKEN$|PASSWORD|PASSWD|PRIVATE_KEY)/i.test(k))
|
|
192
|
+
delete env[k];
|
|
193
|
+
}
|
|
194
|
+
return env;
|
|
195
|
+
}
|
|
110
196
|
function isAllowedRemoteAction(action) {
|
|
111
197
|
return (typeof action === "string" &&
|
|
112
198
|
exports.ALLOWED_REMOTE_ACTIONS.includes(action));
|
|
@@ -126,6 +212,10 @@ const SECRET_PATTERNS = [
|
|
|
126
212
|
/\bBearer\s+[A-Za-z0-9._-]{12,}\b/gi,
|
|
127
213
|
// URLs with embedded credentials (https://user:pass@host)
|
|
128
214
|
/(https?:\/\/)[^/\s:@]+:[^/\s@]+@/gi,
|
|
215
|
+
// JWTs (header.payload.signature)
|
|
216
|
+
/\beyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}\b/g,
|
|
217
|
+
// PEM private key blocks
|
|
218
|
+
/-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?-----END [A-Z ]*PRIVATE KEY-----/g,
|
|
129
219
|
];
|
|
130
220
|
function redactSecrets(text) {
|
|
131
221
|
let out = text;
|
|
@@ -409,6 +499,7 @@ async function executeRemoteAction(opts) {
|
|
|
409
499
|
`host: ${os.hostname()}`,
|
|
410
500
|
`runtime: node ${process.version}`,
|
|
411
501
|
`pid: ${process.pid}`,
|
|
502
|
+
`remote-agent-host: ${remoteAgentHostEnabled() ? "enabled" : "disabled"}`,
|
|
412
503
|
].join("\n");
|
|
413
504
|
return {
|
|
414
505
|
ok: true,
|
|
@@ -419,6 +510,110 @@ async function executeRemoteAction(opts) {
|
|
|
419
510
|
secretValuesExposed: false,
|
|
420
511
|
};
|
|
421
512
|
}
|
|
513
|
+
case "agent.spawn": {
|
|
514
|
+
// Higher-privilege: requires explicit host opt-in (this launches an autonomous worker).
|
|
515
|
+
if (!remoteAgentHostEnabled()) {
|
|
516
|
+
return reject(action, "this host does not accept remote agent spawns (set YOU_REMOTE_AGENT_HOST=1 to enable)");
|
|
517
|
+
}
|
|
518
|
+
const harness = String(args.harness ?? "claude");
|
|
519
|
+
if (!REMOTE_SPAWNABLE_HARNESSES.includes(harness)) {
|
|
520
|
+
return reject(action, `harness not allowed for remote spawn: ${harness}`);
|
|
521
|
+
}
|
|
522
|
+
const goal = typeof args.goal === "string" ? args.goal.trim() : "";
|
|
523
|
+
if (!goal) {
|
|
524
|
+
return reject(action, "agent.spawn requires a non-empty goal");
|
|
525
|
+
}
|
|
526
|
+
// Resolve + contain the project dir AFTER the opt-in/harness/goal gates.
|
|
527
|
+
const resolvedSpawn = resolveProjectDir(args.project, { startDir: opts.startDir });
|
|
528
|
+
if (!resolvedSpawn.ok) {
|
|
529
|
+
return reject(action, resolvedSpawn.reason);
|
|
530
|
+
}
|
|
531
|
+
const res = (0, supervisor_1.spawnWorker)({
|
|
532
|
+
harness,
|
|
533
|
+
goal,
|
|
534
|
+
cwd: resolvedSpawn.dir,
|
|
535
|
+
project: typeof args.project === "string" ? args.project : undefined,
|
|
536
|
+
host: os.hostname(),
|
|
537
|
+
env: remoteWorkerEnv(), // strip the daemon's own secrets from the remote worker
|
|
538
|
+
});
|
|
539
|
+
if (!res.ok || !res.worker) {
|
|
540
|
+
return {
|
|
541
|
+
ok: false,
|
|
542
|
+
action,
|
|
543
|
+
exitCode: null,
|
|
544
|
+
output: cleanOutput("", res.error ?? "spawn failed"),
|
|
545
|
+
error: res.error ?? "spawn failed",
|
|
546
|
+
status: "error",
|
|
547
|
+
secretValuesExposed: false,
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
return {
|
|
551
|
+
ok: true,
|
|
552
|
+
action,
|
|
553
|
+
exitCode: 0,
|
|
554
|
+
output: cleanOutput(`launched ${harness} worker ${res.worker.id} (pid ${res.worker.pid}) in ${resolvedSpawn.dir}`, ""),
|
|
555
|
+
status: "ok",
|
|
556
|
+
secretValuesExposed: false,
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
case "agent.list": {
|
|
560
|
+
// Worker logs/goals can contain sensitive output; do not expose them remotely unless the
|
|
561
|
+
// host owner opted in (same gate as spawn/stop). agent.status is the unauthenticated probe.
|
|
562
|
+
if (!remoteAgentHostEnabled()) {
|
|
563
|
+
return reject(action, "this host does not expose worker agents remotely (set YOU_REMOTE_AGENT_HOST=1 to enable)");
|
|
564
|
+
}
|
|
565
|
+
const workers = (0, supervisor_1.refreshWorkers)();
|
|
566
|
+
const summary = workers.length === 0
|
|
567
|
+
? "no workers"
|
|
568
|
+
: workers
|
|
569
|
+
.map((w) => `${w.id} [${w.status}] ${w.harness} ${w.project ?? "-"} :: ${w.goal.slice(0, 60)}`)
|
|
570
|
+
.join("\n");
|
|
571
|
+
return {
|
|
572
|
+
ok: true,
|
|
573
|
+
action,
|
|
574
|
+
exitCode: 0,
|
|
575
|
+
output: cleanOutput(summary, ""),
|
|
576
|
+
status: "ok",
|
|
577
|
+
secretValuesExposed: false,
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
case "agent.output": {
|
|
581
|
+
if (!remoteAgentHostEnabled()) {
|
|
582
|
+
return reject(action, "this host does not expose worker output remotely (set YOU_REMOTE_AGENT_HOST=1 to enable)");
|
|
583
|
+
}
|
|
584
|
+
const id = typeof args.id === "string" ? args.id.trim() : "";
|
|
585
|
+
if (!id)
|
|
586
|
+
return reject(action, "agent.output requires a worker id");
|
|
587
|
+
const lines = Number(args.lines) > 0 ? Number(args.lines) : 40;
|
|
588
|
+
const res = (0, supervisor_1.getWorkerOutput)(id, lines);
|
|
589
|
+
return {
|
|
590
|
+
ok: res.ok,
|
|
591
|
+
action,
|
|
592
|
+
exitCode: res.ok ? 0 : null,
|
|
593
|
+
output: cleanOutput(res.ok ? res.output ?? "" : "", res.ok ? "" : res.error ?? ""),
|
|
594
|
+
status: res.ok ? "ok" : "error",
|
|
595
|
+
...(res.ok ? {} : { error: res.error }),
|
|
596
|
+
secretValuesExposed: false,
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
case "agent.stop": {
|
|
600
|
+
if (!remoteAgentHostEnabled()) {
|
|
601
|
+
return reject(action, "this host does not accept remote agent control (set YOU_REMOTE_AGENT_HOST=1 to enable)");
|
|
602
|
+
}
|
|
603
|
+
const id = typeof args.id === "string" ? args.id.trim() : "";
|
|
604
|
+
if (!id)
|
|
605
|
+
return reject(action, "agent.stop requires a worker id");
|
|
606
|
+
const res = (0, supervisor_1.stopWorker)(id);
|
|
607
|
+
return {
|
|
608
|
+
ok: res.ok,
|
|
609
|
+
action,
|
|
610
|
+
exitCode: res.ok ? 0 : null,
|
|
611
|
+
output: cleanOutput(res.ok ? `stopped ${id}` : "", res.ok ? "" : res.error ?? ""),
|
|
612
|
+
status: res.ok ? "ok" : "error",
|
|
613
|
+
...(res.ok ? {} : { error: res.error }),
|
|
614
|
+
secretValuesExposed: false,
|
|
615
|
+
};
|
|
616
|
+
}
|
|
422
617
|
}
|
|
423
618
|
}
|
|
424
619
|
catch (err) {
|