@agentsky/sky 3.47.0 → 3.48.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.
Files changed (25) hide show
  1. package/agent-plugins/plugins/meetings/.codex-plugin/plugin.json +1 -1
  2. package/agent-plugins/plugins/meetings/skills/agentsky-meetings/SKILL.md +1 -1
  3. package/dist/{chunk-IZT53CAI.js → chunk-2YJE5NVV.js} +3 -175
  4. package/dist/{chunk-U25SCHLE.js → chunk-3TYVCKLX.js} +6 -6
  5. package/dist/{chunk-QTMW37EN.js → chunk-4RUMYOAH.js} +2 -2
  6. package/dist/{chunk-I63VASQP.js → chunk-AQ7E6RYH.js} +19 -12
  7. package/dist/{chunk-IJOMMFEK.js → chunk-ENG7YVFA.js} +2 -2
  8. package/dist/{chunk-OXCZMLEZ.js → chunk-I6R6JSZT.js} +1 -1
  9. package/dist/{chunk-2OIW436E.js → chunk-JSW6RJM4.js} +1 -1
  10. package/dist/{chunk-LM3WPNRW.js → chunk-NENCXIQO.js} +1 -1
  11. package/dist/chunk-NLV2DMMS.js +214 -0
  12. package/dist/{chunk-YYI5NQ35.js → chunk-OJ5ERABF.js} +1 -1
  13. package/dist/{chunk-6LQLH5CI.js → chunk-V4NPUQM2.js} +185 -5
  14. package/dist/{chunk-KX6JJECK.js → chunk-W24YSGH4.js} +255 -79
  15. package/dist/{compute-VNGFIQCD.js → compute-FTVP2A5T.js} +2 -2
  16. package/dist/{compute-report-AAEKLNPM.js → compute-report-743W5GPX.js} +12 -12
  17. package/dist/index.js +458 -173
  18. package/dist/{local-skills-RRJCNVLS.js → local-skills-LBCY7JDM.js} +3 -3
  19. package/dist/{local-skills-run-Y47FCKEL.js → local-skills-run-OZTUHDBD.js} +11 -11
  20. package/dist/{mcp-serve-OLHMHG4M.js → mcp-serve-5SHK5ASF.js} +5 -5
  21. package/dist/{trace-PXIY5WUU.js → trace-TDYK47MM.js} +3 -3
  22. package/dist/{trace-exclusions-HG5MF7NI.js → trace-exclusions-JEGMUPWQ.js} +2 -2
  23. package/dist/{trace-library-IUFJWBN3.js → trace-library-QDGMBGNH.js} +8 -8
  24. package/package.json +2 -2
  25. package/dist/chunk-AKCKFNLJ.js +0 -116
@@ -1,11 +1,13 @@
1
1
  import {
2
+ ApiError,
2
3
  api
3
- } from "./chunk-LM3WPNRW.js";
4
+ } from "./chunk-NENCXIQO.js";
4
5
  import {
5
6
  SKILL_NAME
6
- } from "./chunk-OXCZMLEZ.js";
7
+ } from "./chunk-I6R6JSZT.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";
@@ -314,8 +465,19 @@ function registerHermes(client, opts) {
314
465
  doc.setIn(["mcp_servers", MCP_SERVER_NAME], doc.createNode(entry));
315
466
  return written(client, path, doc.toString());
316
467
  }
317
- function refreshMcpRegistrations(opts, clients = detectMcpClients(), runner = systemCommandRunner(), env = process.env, home = homedir2()) {
318
- return clients.filter((client) => client.id !== "claude_app" && hasMcpServer(client, env, home)).map((client) => registerMcpServer(client, { token: opts.token, mcpUrl: mcpUrlFor(opts.apiBase, registeredToolList(client, env, home)) }, runner, env, home));
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;
319
481
  }
320
482
 
321
483
  // src/settings-block.ts
@@ -562,6 +724,24 @@ function settingsBlockState(block, file) {
562
724
  export {
563
725
  detectLocalAgents,
564
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,
565
745
  MCP_SERVER_NAME,
566
746
  detectHermes,
567
747
  detectClaudeApp,