@agentsky/sky 3.45.0 → 3.47.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.
@@ -16,7 +16,7 @@ Meetings notices a call in WeChat, Tencent Meeting, Zoom, Lark, Feishu, Teams, C
16
16
  - `name_call_note` records who a call was with when the note could not tell.
17
17
  - `publish_call_note` shares it as the workspace's Library document; `run_call_follow_up` runs the person's chosen follow-up agent on it.
18
18
  - Delete a note (`delete_call_note`) only when the person asks for it: it cannot be undone.
19
- - For meetings away from your Mac, a recorder can join the video meetings on the person's calendars. Read it with `read_meeting_auto_join` or `sky meetings auto-join`. It records video, audio and a transcript, everyone in the call sees it and is told in the chat, and the workspace pays for each recording, so tell the person this and have their go-ahead before `set_meeting_auto_join`. `cancel_meeting_recorder` withdraws one recorder.
19
+ - For meetings away from your Mac, a recorder can join the video meetings on the person's calendars. Read it with `read_meeting_auto_join` or `sky meetings auto-join`. It records video, audio and a transcript, everyone in the call sees it and is told in the chat, and the workspace pays for each recording, so tell the person this and have their go-ahead before `set_meeting_auto_join`. `cancel_meeting_recorder` withdraws one recorder. To start a video meeting now or at a time, use `create_meeting` (or `sky meetings start`): it creates a Zoom link anyone can start, invites people by email from the person's calendar and records it for a meeting note unless `notetaker` is false; pass `session_id` so the note comes back to this chat, and tell the person the invitees get an email and the meeting is recorded.
20
20
 
21
21
  ## When a call fails
22
22
 
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var CLI_VERSION = "3.45.0";
2
+ var CLI_VERSION = "3.47.0";
3
3
  var USER_AGENT = `sky-cli/${CLI_VERSION} (${process.platform}; node/${process.versions.node})`;
4
4
 
5
5
  export {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  api
3
- } from "./chunk-WLTOVOTW.js";
3
+ } from "./chunk-LM3WPNRW.js";
4
4
  import {
5
5
  SKILL_NAME
6
- } from "./chunk-OBRH43HE.js";
6
+ } from "./chunk-OXCZMLEZ.js";
7
7
  import {
8
8
  configPath
9
9
  } from "./chunk-XHZJG3QT.js";
@@ -92,13 +92,6 @@ function mcpUrlFor(apiBase, list = "every") {
92
92
  return mcpUrlWithToolList(`${apiBase.replace(/\/$/, "")}/mcp`, list);
93
93
  }
94
94
  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
95
  if (agent === "grok") {
103
96
  return {
104
97
  command: "grok",
@@ -108,10 +101,12 @@ function mcpCommands(agent, opts) {
108
101
  }
109
102
  return null;
110
103
  }
104
+ 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
105
  function redact(text2, token) {
112
106
  return text2.split(token).join(`${token.slice(0, 10)}\u2026`);
113
107
  }
114
- function registerMcpServer(client, opts, runner = systemCommandRunner()) {
108
+ function registerMcpServer(client, opts, runner = systemCommandRunner(), env = process.env, home = homedir2()) {
109
+ if (client.id === "claude_code") return registerClaudeCode(client, opts, mcpConfigPath(client, env, home));
115
110
  if (client.id === "codex") return registerCodex(client, opts);
116
111
  if (client.id === "cursor") return registerCursor(client, opts);
117
112
  if (client.id === "hermes") return registerHermes(client, opts);
@@ -197,14 +192,30 @@ function tomlTableKey(name) {
197
192
  return `(?:${escaped}|"${escaped}"|'${escaped}')`;
198
193
  }
199
194
  function withoutTomlServer(text2, name) {
195
+ return withTomlServer(text2, name, null);
196
+ }
197
+ function withTomlServer(text2, name, block) {
200
198
  const ours = new RegExp(`^\\s*\\[\\s*mcp_servers\\s*\\.\\s*${tomlTableKey(name)}\\s*(?:\\.[^\\]]*)?\\]\\s*(?:#.*)?$`);
201
199
  let skipping = false;
200
+ let placed = false;
202
201
  const kept = [];
203
202
  for (const line of text2.split(/\r?\n/)) {
204
- if (/^\s*\[/.test(line)) skipping = ours.test(line);
203
+ if (/^\s*\[/.test(line)) {
204
+ const was = skipping;
205
+ skipping = ours.test(line);
206
+ if (was && !skipping && block !== null) kept.push("");
207
+ }
208
+ if (skipping && !placed && block !== null) {
209
+ kept.push(block);
210
+ placed = true;
211
+ }
205
212
  if (!skipping) kept.push(line);
206
213
  }
207
- return kept.join("\n").replace(/\n+$/, "");
214
+ const rest = kept.join("\n").replace(/\n+$/, "");
215
+ if (block === null || placed) return rest;
216
+ return rest ? `${rest}
217
+
218
+ ${block}` : block;
208
219
  }
209
220
  function registerCodex(client, opts) {
210
221
  const path = mcpConfigPath(client);
@@ -221,11 +232,9 @@ function registerCodex(client, opts) {
221
232
  } catch (err) {
222
233
  return { agent: client.id, outcome: "failed", detail: `${path} is not valid TOML, left as it was (${String(err).split("\n")[0]})` };
223
234
  }
224
- const rest = withoutTomlServer(raw, MCP_SERVER_NAME);
225
- const text2 = `${rest ? `${rest}
226
-
227
- ` : ""}${block}
235
+ const text2 = `${withTomlServer(raw, MCP_SERVER_NAME, block)}
228
236
  `;
237
+ if (text2 === raw) return { agent: client.id, outcome: "registered", detail: "already registered" };
229
238
  try {
230
239
  const after = parseToml(text2);
231
240
  const others = Object.keys(before.mcp_servers ?? {}).filter((name) => name !== MCP_SERVER_NAME);
@@ -235,6 +244,26 @@ function registerCodex(client, opts) {
235
244
  }
236
245
  return written(client, path, text2);
237
246
  }
247
+ function registerClaudeCode(client, opts, path) {
248
+ const entry = { type: "http", url: opts.mcpUrl, headers: { Authorization: `Bearer ${opts.token}` } };
249
+ if (opts.dryRun) return planned(client, path, JSON.stringify({ [MCP_SERVER_NAME]: entry }, null, 2), opts);
250
+ const raw = readText(path);
251
+ let existing = {};
252
+ if (raw !== null && raw.trim()) {
253
+ try {
254
+ const parsed = JSON.parse(raw);
255
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("not an object");
256
+ existing = parsed;
257
+ } catch (err) {
258
+ return { agent: client.id, outcome: "failed", detail: `${path} is not valid JSON, left as it was (${String(err).split("\n")[0]})` };
259
+ }
260
+ }
261
+ if (JSON.stringify(existing.mcpServers?.[MCP_SERVER_NAME]) === JSON.stringify(entry)) return { agent: client.id, outcome: "registered", detail: "already registered" };
262
+ const indent = raw ? /^[{[]\r?\n([ \t]+)/.exec(raw)?.[1] ?? 2 : 2;
263
+ const ending = raw === null || raw.endsWith("\n") ? "\n" : "";
264
+ const updated = { ...existing, mcpServers: { ...existing.mcpServers ?? {}, [MCP_SERVER_NAME]: entry } };
265
+ return written(client, path, `${JSON.stringify(updated, null, indent)}${ending}`);
266
+ }
238
267
  function registerCursor(client, opts) {
239
268
  const path = mcpConfigPath(client);
240
269
  const entry = { url: opts.mcpUrl, headers: { Authorization: `Bearer ${opts.token}` } };
@@ -286,7 +315,7 @@ function registerHermes(client, opts) {
286
315
  return written(client, path, doc.toString());
287
316
  }
288
317
  function refreshMcpRegistrations(opts, clients = detectMcpClients(), runner = systemCommandRunner(), env = process.env, home = homedir2()) {
289
- 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));
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));
290
319
  }
291
320
 
292
321
  // src/settings-block.ts
@@ -539,6 +568,7 @@ export {
539
568
  detectMcpClients,
540
569
  systemCommandRunner,
541
570
  mcpUrlFor,
571
+ NO_TOOLS,
542
572
  registerMcpServer,
543
573
  mcpConfigPath,
544
574
  registeredToolList,
@@ -1,17 +1,14 @@
1
1
  import {
2
2
  cachedSettingsBlock,
3
3
  mcpUrlFor
4
- } from "./chunk-OYSSK6GS.js";
5
- import "./chunk-WLTOVOTW.js";
6
- import "./chunk-OBRH43HE.js";
4
+ } from "./chunk-6LQLH5CI.js";
7
5
  import {
8
6
  USER_AGENT
9
- } from "./chunk-7DFFA6GA.js";
7
+ } from "./chunk-2OIW436E.js";
10
8
  import {
11
9
  apiBase,
12
10
  apiToken
13
11
  } from "./chunk-XHZJG3QT.js";
14
- import "./chunk-MLKGABMK.js";
15
12
 
16
13
  // src/mcp-serve.ts
17
14
  import { createInterface } from "readline";
@@ -33,6 +30,20 @@ function answersIn(body, type) {
33
30
  return Array.isArray(parsed) ? parsed : [parsed];
34
31
  });
35
32
  }
33
+ async function shortToolCount(token, url = mcpUrlFor(apiBase(), "short"), fetchImpl = fetch) {
34
+ try {
35
+ const response = await fetchImpl(url, {
36
+ method: "POST",
37
+ headers: { "user-agent": USER_AGENT, authorization: `Bearer ${token}`, "content-type": "application/json", accept: "application/json, text/event-stream" },
38
+ body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/list" })
39
+ });
40
+ if (!response.ok) return null;
41
+ const tools = answersIn(await response.text(), response.headers.get("content-type")).find((answer) => answer.id === 1)?.result?.tools;
42
+ return Array.isArray(tools) ? tools.length : null;
43
+ } catch {
44
+ return null;
45
+ }
46
+ }
36
47
  async function forwardLine(line, deps = defaults(), protocol = {}) {
37
48
  let message;
38
49
  try {
@@ -97,7 +108,9 @@ async function serveMcp(deps = defaults()) {
97
108
  }
98
109
  await queue;
99
110
  }
111
+
100
112
  export {
113
+ shortToolCount,
101
114
  forwardLine,
102
115
  serveMcp
103
116
  };
@@ -1,13 +1,12 @@
1
- import {
2
- lastUploads,
3
- loadSyncConfig
4
- } from "./chunk-EO32DG3Z.js";
5
1
  import {
6
2
  CAPTURE_HOOK_ARGS,
7
3
  SetupJournal,
8
4
  isCaptureCommand,
9
5
  workspaceSlug
10
- } from "./chunk-MXIAK52Z.js";
6
+ } from "./chunk-IZT53CAI.js";
7
+ import {
8
+ shortToolCount
9
+ } from "./chunk-AKCKFNLJ.js";
11
10
  import {
12
11
  cachedSettingsBlock,
13
12
  detectClaudeApp,
@@ -24,18 +23,22 @@ import {
24
23
  settingsBlockState,
25
24
  systemCommandRunner,
26
25
  writeSettingsBlocks
27
- } from "./chunk-OYSSK6GS.js";
26
+ } from "./chunk-6LQLH5CI.js";
27
+ import {
28
+ lastUploads,
29
+ loadSyncConfig
30
+ } from "./chunk-U25SCHLE.js";
28
31
  import {
29
32
  ApiError,
30
33
  api
31
- } from "./chunk-WLTOVOTW.js";
34
+ } from "./chunk-LM3WPNRW.js";
32
35
  import {
33
36
  installSkill,
34
37
  skillState
35
- } from "./chunk-OBRH43HE.js";
38
+ } from "./chunk-OXCZMLEZ.js";
36
39
  import {
37
40
  CLI_VERSION
38
- } from "./chunk-7DFFA6GA.js";
41
+ } from "./chunk-2OIW436E.js";
39
42
  import {
40
43
  apiBase,
41
44
  apiToken,
@@ -1915,7 +1918,7 @@ ${raw}` : `${line}
1915
1918
  return { trigger: "codex_notify", outcome: "installed", path };
1916
1919
  }
1917
1920
  async function installSchedule(opts) {
1918
- const lib = await import("./trace-library-CRCV5JDF.js");
1921
+ const lib = await import("./trace-library-IUFJWBN3.js");
1919
1922
  if ((opts.platform ?? process.platform) !== "darwin") {
1920
1923
  return { trigger: "schedule", outcome: "skipped", detail: "the 15-minute sweep is macOS only; on Linux add `*/15 * * * * sky trace sync --quiet` to your crontab. The hooks still capture each session" };
1921
1924
  }
@@ -1938,12 +1941,17 @@ async function installSchedule(opts) {
1938
1941
  return { trigger: "schedule", outcome: "installed", path };
1939
1942
  }
1940
1943
  async function installCapture(opts) {
1941
- const lib = await import("./trace-library-CRCV5JDF.js");
1944
+ const lib = await import("./trace-library-IUFJWBN3.js");
1942
1945
  const config = lib.loadSyncConfig();
1943
1946
  if (!config.enabled && config.enabledAt) return { sync: "off", triggers: [] };
1944
1947
  const configFile = lib.syncConfigPath();
1945
1948
  if (!opts.dryRun) {
1946
- for (const name of ["trace-sync-state.json", "trace-pending", "trace-sync.lock"]) opts.journal.own(join2(lib.syncDir(), name));
1949
+ const madeBySetup = opts.journal.created(configFile);
1950
+ for (const name of lib.SYNC_STATE_NAMES) {
1951
+ const path = join2(lib.syncDir(), name);
1952
+ if (madeBySetup) opts.journal.adopt(path);
1953
+ else opts.journal.own(path);
1954
+ }
1947
1955
  if (!config.enabled || !config.fallback && !config.rules.length) {
1948
1956
  opts.journal.track(configFile, ["sync_config"]);
1949
1957
  lib.saveSyncConfig({ ...config, enabled: true, enabledAt: (opts.now ?? (() => /* @__PURE__ */ new Date()))().toISOString(), fallback: config.fallback ?? opts.workspace });
@@ -1965,12 +1973,17 @@ var CAPTURED = ["claude_code", "codex"];
1965
1973
  function computerPath() {
1966
1974
  return join3(dirname2(configPath()), "computer.json");
1967
1975
  }
1968
- function machineKey(journal) {
1976
+ function savedMachineKey() {
1969
1977
  try {
1970
1978
  const saved = JSON.parse(readFileSync3(computerPath(), "utf8")).id;
1971
1979
  if (typeof saved === "string" && /^[A-Za-z0-9_-]{8,64}$/.test(saved)) return saved;
1972
1980
  } catch {
1973
1981
  }
1982
+ return null;
1983
+ }
1984
+ function machineKey(journal) {
1985
+ const saved = savedMachineKey();
1986
+ if (saved) return saved;
1974
1987
  const id = randomBytes(12).toString("hex");
1975
1988
  journal?.own(computerPath());
1976
1989
  mkdirSync2(dirname2(computerPath()), { recursive: true });
@@ -2045,9 +2058,12 @@ async function repairComputer(opts) {
2045
2058
  const runner = opts.runner ?? systemCommandRunner();
2046
2059
  const { agents, clients } = computerClients(opts.platform);
2047
2060
  const engines = [];
2061
+ let toolless;
2048
2062
  for (const client of clients) {
2049
2063
  const mark = pluginsMark(client);
2050
2064
  if (mark === "current") continue;
2065
+ toolless ??= await shortToolCount(token) === 0;
2066
+ if (toolless) break;
2051
2067
  const path = mcpConfigPath(client);
2052
2068
  const setUpBefore = opts.journal.tracks(path);
2053
2069
  opts.journal.track(path, [MCP_ENTRY[client.id]]);
@@ -2084,6 +2100,18 @@ async function reportComputer(opts) {
2084
2100
  await api("PUT", path, computerReport(repaired, opts.platform));
2085
2101
  return { repaired };
2086
2102
  }
2103
+ async function forgetComputer() {
2104
+ const key = savedMachineKey();
2105
+ if (!key) return null;
2106
+ if (!apiToken()) return { outcome: "failed", detail: "not signed in; remove it under Settings \u203A Compute" };
2107
+ try {
2108
+ const answer = await api("DELETE", `/compute/machines/${encodeURIComponent(key)}`);
2109
+ return { outcome: answer.removed === false ? "not_listed" : "removed" };
2110
+ } catch (error) {
2111
+ if (error instanceof ApiError && error.status === 404) return { outcome: "not_listed" };
2112
+ return { outcome: "failed", detail: `${error instanceof Error ? error.message : String(error)}; remove it under Settings \u203A Compute` };
2113
+ }
2114
+ }
2087
2115
  function describeRepair(repair) {
2088
2116
  return `AgentSky repaired this computer: ${repair.engines.map((engine) => `${engine.id} (${engine.what})`).join(", ") || "everything was already current"}.`;
2089
2117
  }
@@ -2113,12 +2141,14 @@ export {
2113
2141
  skyCommand,
2114
2142
  installCapture,
2115
2143
  MCP_ENTRY,
2144
+ savedMachineKey,
2116
2145
  machineKey,
2117
2146
  computerClients,
2118
2147
  engineReports,
2119
2148
  computerReport,
2120
2149
  repairComputer,
2121
2150
  reportComputer,
2151
+ forgetComputer,
2122
2152
  describeRepair,
2123
2153
  upkeepComputer
2124
2154
  };
@@ -1,13 +1,13 @@
1
- import {
2
- TRACE_CONTENT_SCOPES,
3
- redactTraceText
4
- } from "./chunk-AM6GOGA6.js";
5
1
  import {
6
2
  USER_AGENT
7
- } from "./chunk-7DFFA6GA.js";
3
+ } from "./chunk-2OIW436E.js";
8
4
  import {
9
5
  configPath
10
6
  } from "./chunk-XHZJG3QT.js";
7
+ import {
8
+ TRACE_CONTENT_SCOPES,
9
+ redactTraceText
10
+ } from "./chunk-KX6JJECK.js";
11
11
 
12
12
  // src/trace.ts
13
13
  import { randomBytes } from "crypto";
@@ -2,11 +2,11 @@ import {
2
2
  MCP_SERVER_NAME,
3
3
  withoutSettingsBlock,
4
4
  withoutTomlServer
5
- } from "./chunk-OYSSK6GS.js";
5
+ } from "./chunk-6LQLH5CI.js";
6
6
  import {
7
7
  ApiError,
8
8
  api
9
- } from "./chunk-WLTOVOTW.js";
9
+ } from "./chunk-LM3WPNRW.js";
10
10
  import {
11
11
  configPath,
12
12
  currentUniverse
@@ -138,6 +138,17 @@ var SetupJournal = class {
138
138
  this.createdDirs(path);
139
139
  this.data.owned.push(path);
140
140
  }
141
+ /** Whether setup created `path`: it did not exist the first time setup wrote it. */
142
+ created(path) {
143
+ return this.data.files[path]?.original === null || this.data.owned.includes(path);
144
+ }
145
+ /** Own a path whatever it holds now: only for what exists because of something setup created (capture's own state),
146
+ * or what a command setup ran created during the run. */
147
+ adopt(path) {
148
+ if (this.owns(path) || this.data.files[path]) return;
149
+ this.createdDirs(path);
150
+ this.data.owned.push(path);
151
+ }
141
152
  /** Whether `path` is, or lies inside, a path setup owns outright. */
142
153
  owns(path) {
143
154
  return this.data.owned.some((owned) => path === owned || path.startsWith(`${owned}${sep}`));
@@ -268,8 +279,8 @@ function withoutJsonServer(text) {
268
279
  }
269
280
  if (!config?.mcpServers || !(MCP_SERVER_NAME in config.mcpServers)) return text;
270
281
  delete config.mcpServers[MCP_SERVER_NAME];
271
- return `${JSON.stringify(config, null, 2)}
272
- `;
282
+ const indent = /^[{[]\r?\n([ \t]+)/.exec(text)?.[1] ?? 2;
283
+ return `${JSON.stringify(config, null, indent)}${text.endsWith("\n") ? "\n" : ""}`;
273
284
  }
274
285
  function withoutTomlServerText(text) {
275
286
  const rest = withoutTomlServer(text, MCP_SERVER_NAME);