@agentsky/sky 3.45.0 → 3.47.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-plugins/plugins/meetings/.codex-plugin/plugin.json +1 -1
- package/agent-plugins/plugins/meetings/skills/agentsky-meetings/SKILL.md +2 -2
- package/dist/{chunk-7DFFA6GA.js → chunk-BIWRJ65N.js} +1 -1
- package/dist/{chunk-WSQZHRE4.js → chunk-C3RW65GZ.js} +2 -2
- package/dist/{chunk-WLTOVOTW.js → chunk-DAVMU66H.js} +1 -1
- package/dist/{chunk-TPDNO2LM.js → chunk-FDR6JOIJ.js} +53 -16
- package/dist/{chunk-UHEJFBZJ.js → chunk-IZCS7FH3.js} +5 -5
- package/dist/{chunk-OBRH43HE.js → chunk-LMYRAGDR.js} +10 -5
- package/dist/chunk-MSEGJ7V5.js +214 -0
- package/dist/{chunk-YYDO5WB5.js → chunk-OJ5ERABF.js} +1 -1
- package/dist/{chunk-OYSSK6GS.js → chunk-SJIBWHJU.js} +229 -19
- package/dist/{chunk-AM6GOGA6.js → chunk-W24YSGH4.js} +368 -73
- package/dist/{chunk-EO32DG3Z.js → chunk-Y7JBA7AC.js} +21 -19
- package/dist/{chunk-MXIAK52Z.js → chunk-YUZWSDVE.js} +16 -177
- package/dist/{compute-OZ4TQBKO.js → compute-FAXL7DAK.js} +2 -2
- package/dist/compute-report-XQJSIK6B.js +39 -0
- package/dist/index.js +1324 -862
- package/dist/{local-skills-E45ZCYGY.js → local-skills-DRZH2R3Q.js} +3 -3
- package/dist/{local-skills-run-3CCDHJ6Q.js → local-skills-run-MH2TI2UC.js} +11 -11
- package/dist/mcp-serve-JJD6JGYS.js +16 -0
- package/dist/{trace-IRBLGOPZ.js → trace-RMYKGACV.js} +3 -3
- package/dist/{trace-exclusions-SMBZES3R.js → trace-exclusions-JEGMUPWQ.js} +2 -2
- package/dist/{trace-library-CRCV5JDF.js → trace-library-QLCECTIS.js} +10 -8
- package/package.json +2 -2
- package/dist/compute-report-SGDLKR22.js +0 -34
- package/dist/mcp-serve-DXL7IMSU.js +0 -103
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ApiError,
|
|
2
3
|
api
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-DAVMU66H.js";
|
|
4
5
|
import {
|
|
5
6
|
SKILL_NAME
|
|
6
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LMYRAGDR.js";
|
|
7
8
|
import {
|
|
8
|
-
configPath
|
|
9
|
+
configPath,
|
|
10
|
+
currentUniverse
|
|
9
11
|
} from "./chunk-XHZJG3QT.js";
|
|
10
12
|
|
|
11
13
|
// src/local-agents.ts
|
|
@@ -37,6 +39,155 @@ function selectLocalAgents(ids, env = process.env, home = homedir()) {
|
|
|
37
39
|
});
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
// src/workspace.ts
|
|
43
|
+
import { createInterface } from "readline";
|
|
44
|
+
var KINDS = ["TOOL_CALL", "SPEND_CAP", "CALL_COUNT", "CAPABILITY"];
|
|
45
|
+
async function workspaceSlug(explicit) {
|
|
46
|
+
if (explicit) return explicit;
|
|
47
|
+
const current = currentUniverse();
|
|
48
|
+
if (current) return current;
|
|
49
|
+
return (await api("GET", "/whoami")).universe.slug;
|
|
50
|
+
}
|
|
51
|
+
var workspacePath = (slug) => `/universes/${encodeURIComponent(slug)}`;
|
|
52
|
+
async function listMembers(slug, page = {}) {
|
|
53
|
+
const query = new URLSearchParams({ ...page.limit ? { limit: page.limit } : {}, ...page.cursor ? { cursor: page.cursor } : {} }).toString();
|
|
54
|
+
return api("GET", `${workspacePath(slug)}/members${query ? `?${query}` : ""}`);
|
|
55
|
+
}
|
|
56
|
+
function findMember(members, ref) {
|
|
57
|
+
const needle = ref.toLowerCase();
|
|
58
|
+
const found = members.find((m) => m.user_id === ref || m.email?.toLowerCase() === needle);
|
|
59
|
+
if (!found) throw new ApiError(404, "not_found", `no member ${ref} in this workspace`);
|
|
60
|
+
return found;
|
|
61
|
+
}
|
|
62
|
+
function inviteBody(emails, options) {
|
|
63
|
+
if (options.role && options.role !== "admin" && options.role !== "member") {
|
|
64
|
+
throw new ApiError(400, "invalid_request", "--role is admin or member");
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
emails,
|
|
68
|
+
...options.role ? { role: options.role } : {},
|
|
69
|
+
...options.sendEmail ? { send_email: true } : {}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
async function invite(slug, emails, options) {
|
|
73
|
+
return api("POST", `${workspacePath(slug)}/invites`, inviteBody(emails, options));
|
|
74
|
+
}
|
|
75
|
+
async function withdrawInvite(slug, inviteId) {
|
|
76
|
+
await api("DELETE", `${workspacePath(slug)}/invites/${encodeURIComponent(inviteId)}`);
|
|
77
|
+
}
|
|
78
|
+
async function setRole(slug, memberRef, role) {
|
|
79
|
+
if (role !== "admin" && role !== "member") throw new ApiError(400, "invalid_request", "a role is admin or member");
|
|
80
|
+
const member = findMember((await listMembers(slug)).members, memberRef);
|
|
81
|
+
await api("PATCH", `${workspacePath(slug)}/members/${encodeURIComponent(member.user_id)}`, { role });
|
|
82
|
+
return member;
|
|
83
|
+
}
|
|
84
|
+
async function removeMember(slug, memberRef) {
|
|
85
|
+
if (memberRef === "me") {
|
|
86
|
+
await leaveWorkspace(slug);
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
const member = findMember((await listMembers(slug)).members, memberRef);
|
|
90
|
+
await api("DELETE", `${workspacePath(slug)}/members/${encodeURIComponent(member.user_id)}`);
|
|
91
|
+
return member;
|
|
92
|
+
}
|
|
93
|
+
async function leaveWorkspace(slug) {
|
|
94
|
+
await api("DELETE", `${workspacePath(slug)}/members/me`);
|
|
95
|
+
}
|
|
96
|
+
async function joinWorkspace(token) {
|
|
97
|
+
return (await api("POST", `/invites/${encodeURIComponent(token)}`)).workspace;
|
|
98
|
+
}
|
|
99
|
+
function renderMembers(page) {
|
|
100
|
+
const lines = page.members.map((m) => `${m.role.padEnd(6)} ${m.email ?? m.user_id}${m.name ? ` (${m.name})` : ""} ${m.user_id}`);
|
|
101
|
+
for (const i of page.invites) lines.push(`invited ${i.email} as ${i.role} by ${i.invited_by} until ${i.expires_at.slice(0, 10)} ${i.id}`);
|
|
102
|
+
if (page.next_cursor) lines.push(`more: --cursor ${page.next_cursor}`);
|
|
103
|
+
return lines;
|
|
104
|
+
}
|
|
105
|
+
function policyRuleBody(options) {
|
|
106
|
+
const kind = options.kind.toUpperCase().replace(/-/g, "_");
|
|
107
|
+
if (!KINDS.includes(kind)) throw new ApiError(400, "invalid_request", `--kind is one of ${KINDS.join(", ")}`);
|
|
108
|
+
let config;
|
|
109
|
+
try {
|
|
110
|
+
config = JSON.parse(options.config);
|
|
111
|
+
} catch {
|
|
112
|
+
throw new ApiError(400, "invalid_request", "--config must be a JSON object");
|
|
113
|
+
}
|
|
114
|
+
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
115
|
+
throw new ApiError(400, "invalid_request", "--config must be a JSON object");
|
|
116
|
+
}
|
|
117
|
+
const position = options.position === void 0 ? void 0 : Number(options.position);
|
|
118
|
+
if (position !== void 0 && !Number.isInteger(position)) throw new ApiError(400, "invalid_request", "--position is a whole number");
|
|
119
|
+
return {
|
|
120
|
+
name: options.name,
|
|
121
|
+
kind,
|
|
122
|
+
config,
|
|
123
|
+
...position !== void 0 ? { position } : {},
|
|
124
|
+
...options.disabled ? { enabled: false } : {}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
var policiesPath = (scope) => "session" in scope ? `/sessions/${encodeURIComponent(scope.session)}/policies` : `${workspacePath(scope.slug)}/policies`;
|
|
128
|
+
async function listPolicies(scope, effective = false) {
|
|
129
|
+
if (effective && "session" in scope) return api("GET", `/sessions/${encodeURIComponent(scope.session)}/effective-policy`);
|
|
130
|
+
return api("GET", policiesPath(scope));
|
|
131
|
+
}
|
|
132
|
+
async function addPolicy(scope, options) {
|
|
133
|
+
return (await api("POST", policiesPath(scope), policyRuleBody(options))).rule;
|
|
134
|
+
}
|
|
135
|
+
async function setPolicyEnabled(scope, ruleId, enabled) {
|
|
136
|
+
return (await api("PATCH", `${policiesPath(scope)}/${encodeURIComponent(ruleId)}`, { enabled })).rule;
|
|
137
|
+
}
|
|
138
|
+
async function removePolicy(scope, ruleId) {
|
|
139
|
+
await api("DELETE", `${policiesPath(scope)}/${encodeURIComponent(ruleId)}`);
|
|
140
|
+
}
|
|
141
|
+
function renderPolicy(rule) {
|
|
142
|
+
const state = rule.enabled ? "on " : "off";
|
|
143
|
+
return `${state} ${rule.layer.padEnd(9)} ${rule.kind.padEnd(10)} ${rule.name} ${JSON.stringify(rule.config)} ${rule.id}`;
|
|
144
|
+
}
|
|
145
|
+
var REMOVED_KINDS = [
|
|
146
|
+
["sessions", "sessions and their transcripts"],
|
|
147
|
+
["agents", "agents"],
|
|
148
|
+
["artifacts", "artifacts"],
|
|
149
|
+
["files", "task files"],
|
|
150
|
+
["memory_stores", "memory stores"],
|
|
151
|
+
["routines", "routines"],
|
|
152
|
+
["channels", "channel connections"],
|
|
153
|
+
["webhooks", "webhooks"],
|
|
154
|
+
["api_keys", "API keys"],
|
|
155
|
+
["vaults", "vaults"],
|
|
156
|
+
["skills", "skills"],
|
|
157
|
+
["environments", "environments"],
|
|
158
|
+
["connections", "connected apps"],
|
|
159
|
+
["traces", "uploaded traces"],
|
|
160
|
+
["members", "other members"],
|
|
161
|
+
["invites", "pending invitations"]
|
|
162
|
+
];
|
|
163
|
+
async function deletionPreview(slug) {
|
|
164
|
+
return api("GET", `/universes/${encodeURIComponent(slug)}/deletion`);
|
|
165
|
+
}
|
|
166
|
+
function renderDeletionPreview(preview) {
|
|
167
|
+
if (!preview.can_delete) return [`${preview.workspace.slug} cannot be deleted:`, ...preview.blockers.map((b) => ` ${b.message}`)];
|
|
168
|
+
const lines = [`Deleting ${preview.workspace.slug} (${preview.workspace.name}) permanently removes:`];
|
|
169
|
+
const removed = REMOVED_KINDS.filter(([key]) => (preview.removes[key] ?? 0) > 0);
|
|
170
|
+
for (const [key, label] of removed) lines.push(` ${preview.removes[key]} ${label}`);
|
|
171
|
+
if (!removed.length) lines.push(" nothing: the workspace is empty");
|
|
172
|
+
const running = preview.removes.running_sessions ?? 0;
|
|
173
|
+
if (running) lines.push(`${running} running session${running === 1 ? " is" : "s are"} stopped first.`);
|
|
174
|
+
if (preview.wallet) lines.push(`$${(preview.wallet.balance_micros / 1e6).toFixed(2)} in its wallet goes back to ${preview.wallet.returns_to ?? "you"}.`);
|
|
175
|
+
lines.push("This cannot be undone.");
|
|
176
|
+
return lines;
|
|
177
|
+
}
|
|
178
|
+
async function deleteWorkspace(slug) {
|
|
179
|
+
return (await api("DELETE", `/universes/${encodeURIComponent(slug)}`)).deleted;
|
|
180
|
+
}
|
|
181
|
+
function typedConfirmation(slug) {
|
|
182
|
+
return new Promise((done) => {
|
|
183
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
184
|
+
rl.question(`Type ${slug} to delete it: `, (answer) => {
|
|
185
|
+
rl.close();
|
|
186
|
+
done(answer.trim() === slug);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
|
|
40
191
|
// src/mcp-register.ts
|
|
41
192
|
import { existsSync as existsSync2, readFileSync, writeFileSync } from "fs";
|
|
42
193
|
import { spawnSync } from "child_process";
|
|
@@ -92,13 +243,6 @@ function mcpUrlFor(apiBase, list = "every") {
|
|
|
92
243
|
return mcpUrlWithToolList(`${apiBase.replace(/\/$/, "")}/mcp`, list);
|
|
93
244
|
}
|
|
94
245
|
function mcpCommands(agent, opts) {
|
|
95
|
-
if (agent === "claude_code") {
|
|
96
|
-
return {
|
|
97
|
-
command: "claude",
|
|
98
|
-
remove: ["mcp", "remove", "--scope", "user", MCP_SERVER_NAME],
|
|
99
|
-
add: ["mcp", "add", "--scope", "user", "--transport", "http", MCP_SERVER_NAME, opts.mcpUrl, "--header", `Authorization: Bearer ${opts.token}`]
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
246
|
if (agent === "grok") {
|
|
103
247
|
return {
|
|
104
248
|
command: "grok",
|
|
@@ -108,10 +252,12 @@ function mcpCommands(agent, opts) {
|
|
|
108
252
|
}
|
|
109
253
|
return null;
|
|
110
254
|
}
|
|
255
|
+
var NO_TOOLS = "this sign-in gets no AgentSky tools (a workspace's own key has none); sign in as yourself with `sky auth login` and run setup again";
|
|
111
256
|
function redact(text2, token) {
|
|
112
257
|
return text2.split(token).join(`${token.slice(0, 10)}\u2026`);
|
|
113
258
|
}
|
|
114
|
-
function registerMcpServer(client, opts, runner = systemCommandRunner()) {
|
|
259
|
+
function registerMcpServer(client, opts, runner = systemCommandRunner(), env = process.env, home = homedir2()) {
|
|
260
|
+
if (client.id === "claude_code") return registerClaudeCode(client, opts, mcpConfigPath(client, env, home));
|
|
115
261
|
if (client.id === "codex") return registerCodex(client, opts);
|
|
116
262
|
if (client.id === "cursor") return registerCursor(client, opts);
|
|
117
263
|
if (client.id === "hermes") return registerHermes(client, opts);
|
|
@@ -197,14 +343,30 @@ function tomlTableKey(name) {
|
|
|
197
343
|
return `(?:${escaped}|"${escaped}"|'${escaped}')`;
|
|
198
344
|
}
|
|
199
345
|
function withoutTomlServer(text2, name) {
|
|
346
|
+
return withTomlServer(text2, name, null);
|
|
347
|
+
}
|
|
348
|
+
function withTomlServer(text2, name, block) {
|
|
200
349
|
const ours = new RegExp(`^\\s*\\[\\s*mcp_servers\\s*\\.\\s*${tomlTableKey(name)}\\s*(?:\\.[^\\]]*)?\\]\\s*(?:#.*)?$`);
|
|
201
350
|
let skipping = false;
|
|
351
|
+
let placed = false;
|
|
202
352
|
const kept = [];
|
|
203
353
|
for (const line of text2.split(/\r?\n/)) {
|
|
204
|
-
if (/^\s*\[/.test(line))
|
|
354
|
+
if (/^\s*\[/.test(line)) {
|
|
355
|
+
const was = skipping;
|
|
356
|
+
skipping = ours.test(line);
|
|
357
|
+
if (was && !skipping && block !== null) kept.push("");
|
|
358
|
+
}
|
|
359
|
+
if (skipping && !placed && block !== null) {
|
|
360
|
+
kept.push(block);
|
|
361
|
+
placed = true;
|
|
362
|
+
}
|
|
205
363
|
if (!skipping) kept.push(line);
|
|
206
364
|
}
|
|
207
|
-
|
|
365
|
+
const rest = kept.join("\n").replace(/\n+$/, "");
|
|
366
|
+
if (block === null || placed) return rest;
|
|
367
|
+
return rest ? `${rest}
|
|
368
|
+
|
|
369
|
+
${block}` : block;
|
|
208
370
|
}
|
|
209
371
|
function registerCodex(client, opts) {
|
|
210
372
|
const path = mcpConfigPath(client);
|
|
@@ -221,11 +383,9 @@ function registerCodex(client, opts) {
|
|
|
221
383
|
} catch (err) {
|
|
222
384
|
return { agent: client.id, outcome: "failed", detail: `${path} is not valid TOML, left as it was (${String(err).split("\n")[0]})` };
|
|
223
385
|
}
|
|
224
|
-
const
|
|
225
|
-
const text2 = `${rest ? `${rest}
|
|
226
|
-
|
|
227
|
-
` : ""}${block}
|
|
386
|
+
const text2 = `${withTomlServer(raw, MCP_SERVER_NAME, block)}
|
|
228
387
|
`;
|
|
388
|
+
if (text2 === raw) return { agent: client.id, outcome: "registered", detail: "already registered" };
|
|
229
389
|
try {
|
|
230
390
|
const after = parseToml(text2);
|
|
231
391
|
const others = Object.keys(before.mcp_servers ?? {}).filter((name) => name !== MCP_SERVER_NAME);
|
|
@@ -235,6 +395,26 @@ function registerCodex(client, opts) {
|
|
|
235
395
|
}
|
|
236
396
|
return written(client, path, text2);
|
|
237
397
|
}
|
|
398
|
+
function registerClaudeCode(client, opts, path) {
|
|
399
|
+
const entry = { type: "http", url: opts.mcpUrl, headers: { Authorization: `Bearer ${opts.token}` } };
|
|
400
|
+
if (opts.dryRun) return planned(client, path, JSON.stringify({ [MCP_SERVER_NAME]: entry }, null, 2), opts);
|
|
401
|
+
const raw = readText(path);
|
|
402
|
+
let existing = {};
|
|
403
|
+
if (raw !== null && raw.trim()) {
|
|
404
|
+
try {
|
|
405
|
+
const parsed = JSON.parse(raw);
|
|
406
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("not an object");
|
|
407
|
+
existing = parsed;
|
|
408
|
+
} catch (err) {
|
|
409
|
+
return { agent: client.id, outcome: "failed", detail: `${path} is not valid JSON, left as it was (${String(err).split("\n")[0]})` };
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
if (JSON.stringify(existing.mcpServers?.[MCP_SERVER_NAME]) === JSON.stringify(entry)) return { agent: client.id, outcome: "registered", detail: "already registered" };
|
|
413
|
+
const indent = raw ? /^[{[]\r?\n([ \t]+)/.exec(raw)?.[1] ?? 2 : 2;
|
|
414
|
+
const ending = raw === null || raw.endsWith("\n") ? "\n" : "";
|
|
415
|
+
const updated = { ...existing, mcpServers: { ...existing.mcpServers ?? {}, [MCP_SERVER_NAME]: entry } };
|
|
416
|
+
return written(client, path, `${JSON.stringify(updated, null, indent)}${ending}`);
|
|
417
|
+
}
|
|
238
418
|
function registerCursor(client, opts) {
|
|
239
419
|
const path = mcpConfigPath(client);
|
|
240
420
|
const entry = { url: opts.mcpUrl, headers: { Authorization: `Bearer ${opts.token}` } };
|
|
@@ -285,8 +465,19 @@ function registerHermes(client, opts) {
|
|
|
285
465
|
doc.setIn(["mcp_servers", MCP_SERVER_NAME], doc.createNode(entry));
|
|
286
466
|
return written(client, path, doc.toString());
|
|
287
467
|
}
|
|
288
|
-
function refreshMcpRegistrations(opts, clients = detectMcpClients(), runner = systemCommandRunner(), env = process.env, home = homedir2()) {
|
|
289
|
-
|
|
468
|
+
async function refreshMcpRegistrations(opts, clients = detectMcpClients(), runner = systemCommandRunner(), env = process.env, home = homedir2()) {
|
|
469
|
+
const registrations = [];
|
|
470
|
+
for (const client of clients.filter((candidate) => candidate.id !== "claude_app" && hasMcpServer(candidate, env, home))) {
|
|
471
|
+
let token;
|
|
472
|
+
try {
|
|
473
|
+
token = await opts.token(client);
|
|
474
|
+
} catch (error) {
|
|
475
|
+
registrations.push({ agent: client.id, outcome: "failed", detail: `no key of its own could be made (${(error instanceof Error ? error.message : String(error)).split("\n")[0]})` });
|
|
476
|
+
continue;
|
|
477
|
+
}
|
|
478
|
+
registrations.push(registerMcpServer(client, { token, mcpUrl: mcpUrlFor(opts.apiBase, registeredToolList(client, env, home)) }, runner, env, home));
|
|
479
|
+
}
|
|
480
|
+
return registrations;
|
|
290
481
|
}
|
|
291
482
|
|
|
292
483
|
// src/settings-block.ts
|
|
@@ -533,12 +724,31 @@ function settingsBlockState(block, file) {
|
|
|
533
724
|
export {
|
|
534
725
|
detectLocalAgents,
|
|
535
726
|
selectLocalAgents,
|
|
727
|
+
workspaceSlug,
|
|
728
|
+
listMembers,
|
|
729
|
+
invite,
|
|
730
|
+
withdrawInvite,
|
|
731
|
+
setRole,
|
|
732
|
+
removeMember,
|
|
733
|
+
leaveWorkspace,
|
|
734
|
+
joinWorkspace,
|
|
735
|
+
renderMembers,
|
|
736
|
+
listPolicies,
|
|
737
|
+
addPolicy,
|
|
738
|
+
setPolicyEnabled,
|
|
739
|
+
removePolicy,
|
|
740
|
+
renderPolicy,
|
|
741
|
+
deletionPreview,
|
|
742
|
+
renderDeletionPreview,
|
|
743
|
+
deleteWorkspace,
|
|
744
|
+
typedConfirmation,
|
|
536
745
|
MCP_SERVER_NAME,
|
|
537
746
|
detectHermes,
|
|
538
747
|
detectClaudeApp,
|
|
539
748
|
detectMcpClients,
|
|
540
749
|
systemCommandRunner,
|
|
541
750
|
mcpUrlFor,
|
|
751
|
+
NO_TOOLS,
|
|
542
752
|
registerMcpServer,
|
|
543
753
|
mcpConfigPath,
|
|
544
754
|
registeredToolList,
|