@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.
- package/agent-plugins/plugins/meetings/.codex-plugin/plugin.json +1 -1
- package/agent-plugins/plugins/meetings/skills/agentsky-meetings/SKILL.md +1 -1
- package/dist/{chunk-IZT53CAI.js → chunk-2YJE5NVV.js} +3 -175
- package/dist/{chunk-U25SCHLE.js → chunk-3TYVCKLX.js} +6 -6
- package/dist/{chunk-QTMW37EN.js → chunk-4RUMYOAH.js} +2 -2
- package/dist/{chunk-I63VASQP.js → chunk-AQ7E6RYH.js} +19 -12
- package/dist/{chunk-IJOMMFEK.js → chunk-ENG7YVFA.js} +2 -2
- package/dist/{chunk-OXCZMLEZ.js → chunk-I6R6JSZT.js} +1 -1
- package/dist/{chunk-2OIW436E.js → chunk-JSW6RJM4.js} +1 -1
- package/dist/{chunk-LM3WPNRW.js → chunk-NENCXIQO.js} +1 -1
- package/dist/chunk-NLV2DMMS.js +214 -0
- package/dist/{chunk-YYI5NQ35.js → chunk-OJ5ERABF.js} +1 -1
- package/dist/{chunk-6LQLH5CI.js → chunk-V4NPUQM2.js} +185 -5
- package/dist/{chunk-KX6JJECK.js → chunk-W24YSGH4.js} +255 -79
- package/dist/{compute-VNGFIQCD.js → compute-FTVP2A5T.js} +2 -2
- package/dist/{compute-report-AAEKLNPM.js → compute-report-743W5GPX.js} +12 -12
- package/dist/index.js +458 -173
- package/dist/{local-skills-RRJCNVLS.js → local-skills-LBCY7JDM.js} +3 -3
- package/dist/{local-skills-run-Y47FCKEL.js → local-skills-run-OZTUHDBD.js} +11 -11
- package/dist/{mcp-serve-OLHMHG4M.js → mcp-serve-5SHK5ASF.js} +5 -5
- package/dist/{trace-PXIY5WUU.js → trace-TDYK47MM.js} +3 -3
- package/dist/{trace-exclusions-HG5MF7NI.js → trace-exclusions-JEGMUPWQ.js} +2 -2
- package/dist/{trace-library-IUFJWBN3.js → trace-library-QDGMBGNH.js} +8 -8
- package/package.json +2 -2
- package/dist/chunk-AKCKFNLJ.js +0 -116
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"interface": {
|
|
11
11
|
"displayName": "Meetings",
|
|
12
12
|
"shortDescription": "Notes for every call",
|
|
13
|
-
"longDescription": "Meetings notices a call in WeChat, Tencent Meeting, Zoom, Lark, Feishu, Teams, Chrome or Safari, records both sides and transcribes it on your Mac. Each call becomes one note with a summary and action items, named from your Google or Outlook calendar or your Mac's own Calendar (where a Lark calendar can be synced) and shared with your workspace as a document, where the workspace's other plugins can pick it up. For meetings you take elsewhere, a recorder can join Zoom, Meet and Teams as “AgentSky Notetaker”. In Zoom it also records the call window, what you share and what you do in it, kept closed at the end of the note; in Lark and Feishu it records the meeting window, not yet what you share. Each recording is deleted from your Mac once its call is transcribed, unless you keep recordings for 30 days; notes are kept. The menu bar shows ● Notes while a call is recorded.",
|
|
13
|
+
"longDescription": "Meetings notices a call in WeChat, Tencent Meeting, Zoom, Lark, Feishu, Teams, a Slack huddle, Chrome or Safari, records both sides and transcribes it on your Mac. Each call becomes one note with a summary and action items, named from your Google or Outlook calendar or your Mac's own Calendar (where a Lark calendar can be synced) and shared with your workspace as a document, where the workspace's other plugins can pick it up. For meetings you take elsewhere, a recorder can join Zoom, Meet and Teams as “AgentSky Notetaker”. In Zoom it also records the call window, what you share and what you do in it, kept closed at the end of the note; in Lark and Feishu it records the meeting window, not yet what you share. Each recording is deleted from your Mac once its call is transcribed, unless you keep recordings for 30 days; notes are kept. The menu bar shows ● Notes while a call is recorded.",
|
|
14
14
|
"developerName": "AgentSky",
|
|
15
15
|
"category": "Meetings & calls",
|
|
16
16
|
"capabilities": [],
|
|
@@ -5,7 +5,7 @@ description: "AI meeting notes for every call you take on your Mac, from WeChat
|
|
|
5
5
|
|
|
6
6
|
# Meetings (AgentSky)
|
|
7
7
|
|
|
8
|
-
Meetings notices a call in WeChat, Tencent Meeting, Zoom, Lark, Feishu, Teams, Chrome or Safari, records both sides and transcribes it on your Mac. Each call becomes one note with a summary and action items, named from your Google or Outlook calendar or your Mac's own Calendar (where a Lark calendar can be synced) and shared with your workspace as a document, where the workspace's other plugins can pick it up. For meetings you take elsewhere, a recorder can join Zoom, Meet and Teams as “AgentSky Notetaker”. In Zoom it also records the call window, what you share and what you do in it, kept closed at the end of the note; in Lark and Feishu it records the meeting window, not yet what you share. Each recording is deleted from your Mac once its call is transcribed, unless you keep recordings for 30 days; notes are kept. The menu bar shows ● Notes while a call is recorded.
|
|
8
|
+
Meetings notices a call in WeChat, Tencent Meeting, Zoom, Lark, Feishu, Teams, a Slack huddle, Chrome or Safari, records both sides and transcribes it on your Mac. Each call becomes one note with a summary and action items, named from your Google or Outlook calendar or your Mac's own Calendar (where a Lark calendar can be synced) and shared with your workspace as a document, where the workspace's other plugins can pick it up. For meetings you take elsewhere, a recorder can join Zoom, Meet and Teams as “AgentSky Notetaker”. In Zoom it also records the call window, what you share and what you do in it, kept closed at the end of the note; in Lark and Feishu it records the meeting window, not yet what you share. Each recording is deleted from your Mac once its call is transcribed, unless you keep recordings for 30 days; notes are kept. The menu bar shows ● Notes while a call is recorded.
|
|
9
9
|
|
|
10
10
|
## Use it
|
|
11
11
|
|
|
@@ -2,14 +2,9 @@ import {
|
|
|
2
2
|
MCP_SERVER_NAME,
|
|
3
3
|
withoutSettingsBlock,
|
|
4
4
|
withoutTomlServer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-V4NPUQM2.js";
|
|
6
6
|
import {
|
|
7
|
-
|
|
8
|
-
api
|
|
9
|
-
} from "./chunk-LM3WPNRW.js";
|
|
10
|
-
import {
|
|
11
|
-
configPath,
|
|
12
|
-
currentUniverse
|
|
7
|
+
configPath
|
|
13
8
|
} from "./chunk-XHZJG3QT.js";
|
|
14
9
|
|
|
15
10
|
// src/setup-journal.ts
|
|
@@ -330,155 +325,6 @@ var ENTRY_REMOVERS = {
|
|
|
330
325
|
settings_block: withoutSettingsBlock
|
|
331
326
|
};
|
|
332
327
|
|
|
333
|
-
// src/workspace.ts
|
|
334
|
-
import { createInterface } from "readline";
|
|
335
|
-
var KINDS = ["TOOL_CALL", "SPEND_CAP", "CALL_COUNT", "CAPABILITY"];
|
|
336
|
-
async function workspaceSlug(explicit) {
|
|
337
|
-
if (explicit) return explicit;
|
|
338
|
-
const current = currentUniverse();
|
|
339
|
-
if (current) return current;
|
|
340
|
-
return (await api("GET", "/whoami")).universe.slug;
|
|
341
|
-
}
|
|
342
|
-
var workspacePath = (slug) => `/universes/${encodeURIComponent(slug)}`;
|
|
343
|
-
async function listMembers(slug, page = {}) {
|
|
344
|
-
const query = new URLSearchParams({ ...page.limit ? { limit: page.limit } : {}, ...page.cursor ? { cursor: page.cursor } : {} }).toString();
|
|
345
|
-
return api("GET", `${workspacePath(slug)}/members${query ? `?${query}` : ""}`);
|
|
346
|
-
}
|
|
347
|
-
function findMember(members, ref) {
|
|
348
|
-
const needle = ref.toLowerCase();
|
|
349
|
-
const found = members.find((m) => m.user_id === ref || m.email?.toLowerCase() === needle);
|
|
350
|
-
if (!found) throw new ApiError(404, "not_found", `no member ${ref} in this workspace`);
|
|
351
|
-
return found;
|
|
352
|
-
}
|
|
353
|
-
function inviteBody(emails, options) {
|
|
354
|
-
if (options.role && options.role !== "admin" && options.role !== "member") {
|
|
355
|
-
throw new ApiError(400, "invalid_request", "--role is admin or member");
|
|
356
|
-
}
|
|
357
|
-
return {
|
|
358
|
-
emails,
|
|
359
|
-
...options.role ? { role: options.role } : {},
|
|
360
|
-
...options.sendEmail ? { send_email: true } : {}
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
async function invite(slug, emails, options) {
|
|
364
|
-
return api("POST", `${workspacePath(slug)}/invites`, inviteBody(emails, options));
|
|
365
|
-
}
|
|
366
|
-
async function withdrawInvite(slug, inviteId) {
|
|
367
|
-
await api("DELETE", `${workspacePath(slug)}/invites/${encodeURIComponent(inviteId)}`);
|
|
368
|
-
}
|
|
369
|
-
async function setRole(slug, memberRef, role) {
|
|
370
|
-
if (role !== "admin" && role !== "member") throw new ApiError(400, "invalid_request", "a role is admin or member");
|
|
371
|
-
const member = findMember((await listMembers(slug)).members, memberRef);
|
|
372
|
-
await api("PATCH", `${workspacePath(slug)}/members/${encodeURIComponent(member.user_id)}`, { role });
|
|
373
|
-
return member;
|
|
374
|
-
}
|
|
375
|
-
async function removeMember(slug, memberRef) {
|
|
376
|
-
if (memberRef === "me") {
|
|
377
|
-
await leaveWorkspace(slug);
|
|
378
|
-
return null;
|
|
379
|
-
}
|
|
380
|
-
const member = findMember((await listMembers(slug)).members, memberRef);
|
|
381
|
-
await api("DELETE", `${workspacePath(slug)}/members/${encodeURIComponent(member.user_id)}`);
|
|
382
|
-
return member;
|
|
383
|
-
}
|
|
384
|
-
async function leaveWorkspace(slug) {
|
|
385
|
-
await api("DELETE", `${workspacePath(slug)}/members/me`);
|
|
386
|
-
}
|
|
387
|
-
async function joinWorkspace(token) {
|
|
388
|
-
return (await api("POST", `/invites/${encodeURIComponent(token)}`)).workspace;
|
|
389
|
-
}
|
|
390
|
-
function renderMembers(page) {
|
|
391
|
-
const lines = page.members.map((m) => `${m.role.padEnd(6)} ${m.email ?? m.user_id}${m.name ? ` (${m.name})` : ""} ${m.user_id}`);
|
|
392
|
-
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}`);
|
|
393
|
-
if (page.next_cursor) lines.push(`more: --cursor ${page.next_cursor}`);
|
|
394
|
-
return lines;
|
|
395
|
-
}
|
|
396
|
-
function policyRuleBody(options) {
|
|
397
|
-
const kind = options.kind.toUpperCase().replace(/-/g, "_");
|
|
398
|
-
if (!KINDS.includes(kind)) throw new ApiError(400, "invalid_request", `--kind is one of ${KINDS.join(", ")}`);
|
|
399
|
-
let config;
|
|
400
|
-
try {
|
|
401
|
-
config = JSON.parse(options.config);
|
|
402
|
-
} catch {
|
|
403
|
-
throw new ApiError(400, "invalid_request", "--config must be a JSON object");
|
|
404
|
-
}
|
|
405
|
-
if (!config || typeof config !== "object" || Array.isArray(config)) {
|
|
406
|
-
throw new ApiError(400, "invalid_request", "--config must be a JSON object");
|
|
407
|
-
}
|
|
408
|
-
const position = options.position === void 0 ? void 0 : Number(options.position);
|
|
409
|
-
if (position !== void 0 && !Number.isInteger(position)) throw new ApiError(400, "invalid_request", "--position is a whole number");
|
|
410
|
-
return {
|
|
411
|
-
name: options.name,
|
|
412
|
-
kind,
|
|
413
|
-
config,
|
|
414
|
-
...position !== void 0 ? { position } : {},
|
|
415
|
-
...options.disabled ? { enabled: false } : {}
|
|
416
|
-
};
|
|
417
|
-
}
|
|
418
|
-
var policiesPath = (scope) => "session" in scope ? `/sessions/${encodeURIComponent(scope.session)}/policies` : `${workspacePath(scope.slug)}/policies`;
|
|
419
|
-
async function listPolicies(scope, effective = false) {
|
|
420
|
-
if (effective && "session" in scope) return api("GET", `/sessions/${encodeURIComponent(scope.session)}/effective-policy`);
|
|
421
|
-
return api("GET", policiesPath(scope));
|
|
422
|
-
}
|
|
423
|
-
async function addPolicy(scope, options) {
|
|
424
|
-
return (await api("POST", policiesPath(scope), policyRuleBody(options))).rule;
|
|
425
|
-
}
|
|
426
|
-
async function setPolicyEnabled(scope, ruleId, enabled) {
|
|
427
|
-
return (await api("PATCH", `${policiesPath(scope)}/${encodeURIComponent(ruleId)}`, { enabled })).rule;
|
|
428
|
-
}
|
|
429
|
-
async function removePolicy(scope, ruleId) {
|
|
430
|
-
await api("DELETE", `${policiesPath(scope)}/${encodeURIComponent(ruleId)}`);
|
|
431
|
-
}
|
|
432
|
-
function renderPolicy(rule) {
|
|
433
|
-
const state = rule.enabled ? "on " : "off";
|
|
434
|
-
return `${state} ${rule.layer.padEnd(9)} ${rule.kind.padEnd(10)} ${rule.name} ${JSON.stringify(rule.config)} ${rule.id}`;
|
|
435
|
-
}
|
|
436
|
-
var REMOVED_KINDS = [
|
|
437
|
-
["sessions", "sessions and their transcripts"],
|
|
438
|
-
["agents", "agents"],
|
|
439
|
-
["artifacts", "artifacts"],
|
|
440
|
-
["files", "task files"],
|
|
441
|
-
["memory_stores", "memory stores"],
|
|
442
|
-
["routines", "routines"],
|
|
443
|
-
["channels", "channel connections"],
|
|
444
|
-
["webhooks", "webhooks"],
|
|
445
|
-
["api_keys", "API keys"],
|
|
446
|
-
["vaults", "vaults"],
|
|
447
|
-
["skills", "skills"],
|
|
448
|
-
["environments", "environments"],
|
|
449
|
-
["connections", "connected apps"],
|
|
450
|
-
["traces", "uploaded traces"],
|
|
451
|
-
["members", "other members"],
|
|
452
|
-
["invites", "pending invitations"]
|
|
453
|
-
];
|
|
454
|
-
async function deletionPreview(slug) {
|
|
455
|
-
return api("GET", `/universes/${encodeURIComponent(slug)}/deletion`);
|
|
456
|
-
}
|
|
457
|
-
function renderDeletionPreview(preview) {
|
|
458
|
-
if (!preview.can_delete) return [`${preview.workspace.slug} cannot be deleted:`, ...preview.blockers.map((b) => ` ${b.message}`)];
|
|
459
|
-
const lines = [`Deleting ${preview.workspace.slug} (${preview.workspace.name}) permanently removes:`];
|
|
460
|
-
const removed = REMOVED_KINDS.filter(([key]) => (preview.removes[key] ?? 0) > 0);
|
|
461
|
-
for (const [key, label] of removed) lines.push(` ${preview.removes[key]} ${label}`);
|
|
462
|
-
if (!removed.length) lines.push(" nothing: the workspace is empty");
|
|
463
|
-
const running = preview.removes.running_sessions ?? 0;
|
|
464
|
-
if (running) lines.push(`${running} running session${running === 1 ? " is" : "s are"} stopped first.`);
|
|
465
|
-
if (preview.wallet) lines.push(`$${(preview.wallet.balance_micros / 1e6).toFixed(2)} in its wallet goes back to ${preview.wallet.returns_to ?? "you"}.`);
|
|
466
|
-
lines.push("This cannot be undone.");
|
|
467
|
-
return lines;
|
|
468
|
-
}
|
|
469
|
-
async function deleteWorkspace(slug) {
|
|
470
|
-
return (await api("DELETE", `/universes/${encodeURIComponent(slug)}`)).deleted;
|
|
471
|
-
}
|
|
472
|
-
function typedConfirmation(slug) {
|
|
473
|
-
return new Promise((done) => {
|
|
474
|
-
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
475
|
-
rl.question(`Type ${slug} to delete it: `, (answer) => {
|
|
476
|
-
rl.close();
|
|
477
|
-
done(answer.trim() === slug);
|
|
478
|
-
});
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
|
|
482
328
|
export {
|
|
483
329
|
TOKEN_ENV,
|
|
484
330
|
shellEnvFiles,
|
|
@@ -486,23 +332,5 @@ export {
|
|
|
486
332
|
writeShellEnv,
|
|
487
333
|
SetupJournal,
|
|
488
334
|
CAPTURE_HOOK_ARGS,
|
|
489
|
-
isCaptureCommand
|
|
490
|
-
workspaceSlug,
|
|
491
|
-
listMembers,
|
|
492
|
-
invite,
|
|
493
|
-
withdrawInvite,
|
|
494
|
-
setRole,
|
|
495
|
-
removeMember,
|
|
496
|
-
leaveWorkspace,
|
|
497
|
-
joinWorkspace,
|
|
498
|
-
renderMembers,
|
|
499
|
-
listPolicies,
|
|
500
|
-
addPolicy,
|
|
501
|
-
setPolicyEnabled,
|
|
502
|
-
removePolicy,
|
|
503
|
-
renderPolicy,
|
|
504
|
-
deletionPreview,
|
|
505
|
-
renderDeletionPreview,
|
|
506
|
-
deleteWorkspace,
|
|
507
|
-
typedConfirmation
|
|
335
|
+
isCaptureCommand
|
|
508
336
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ApiError,
|
|
3
3
|
api
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NENCXIQO.js";
|
|
5
5
|
import {
|
|
6
6
|
installClaudeHooks
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ENG7YVFA.js";
|
|
8
8
|
import {
|
|
9
9
|
loadLocalSkillState,
|
|
10
10
|
revisionAt
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-4RUMYOAH.js";
|
|
12
12
|
import {
|
|
13
13
|
USER_AGENT
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JSW6RJM4.js";
|
|
15
15
|
import {
|
|
16
16
|
apiBase,
|
|
17
17
|
apiToken,
|
|
@@ -32,12 +32,12 @@ import {
|
|
|
32
32
|
savePendingSource,
|
|
33
33
|
stillExcluded,
|
|
34
34
|
writePrivateJson
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-OJ5ERABF.js";
|
|
36
36
|
import {
|
|
37
37
|
SessionSourceCollector,
|
|
38
38
|
publicRemote,
|
|
39
39
|
redactTraceText
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-W24YSGH4.js";
|
|
41
41
|
|
|
42
42
|
// src/trace-library.ts
|
|
43
43
|
import { createHash as createHash3 } from "crypto";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CAPTURE_HOOK_ARGS,
|
|
3
3
|
SetupJournal,
|
|
4
|
-
isCaptureCommand
|
|
5
|
-
|
|
6
|
-
} from "./chunk-IZT53CAI.js";
|
|
4
|
+
isCaptureCommand
|
|
5
|
+
} from "./chunk-2YJE5NVV.js";
|
|
7
6
|
import {
|
|
7
|
+
localAgentKey,
|
|
8
8
|
shortToolCount
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-NLV2DMMS.js";
|
|
10
10
|
import {
|
|
11
11
|
cachedSettingsBlock,
|
|
12
12
|
detectClaudeApp,
|
|
@@ -22,23 +22,24 @@ import {
|
|
|
22
22
|
renderSettingsBlock,
|
|
23
23
|
settingsBlockState,
|
|
24
24
|
systemCommandRunner,
|
|
25
|
+
workspaceSlug,
|
|
25
26
|
writeSettingsBlocks
|
|
26
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-V4NPUQM2.js";
|
|
27
28
|
import {
|
|
28
29
|
lastUploads,
|
|
29
30
|
loadSyncConfig
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-3TYVCKLX.js";
|
|
31
32
|
import {
|
|
32
33
|
ApiError,
|
|
33
34
|
api
|
|
34
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-NENCXIQO.js";
|
|
35
36
|
import {
|
|
36
37
|
installSkill,
|
|
37
38
|
skillState
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-I6R6JSZT.js";
|
|
39
40
|
import {
|
|
40
41
|
CLI_VERSION
|
|
41
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-JSW6RJM4.js";
|
|
42
43
|
import {
|
|
43
44
|
apiBase,
|
|
44
45
|
apiToken,
|
|
@@ -1918,7 +1919,7 @@ ${raw}` : `${line}
|
|
|
1918
1919
|
return { trigger: "codex_notify", outcome: "installed", path };
|
|
1919
1920
|
}
|
|
1920
1921
|
async function installSchedule(opts) {
|
|
1921
|
-
const lib = await import("./trace-library-
|
|
1922
|
+
const lib = await import("./trace-library-QDGMBGNH.js");
|
|
1922
1923
|
if ((opts.platform ?? process.platform) !== "darwin") {
|
|
1923
1924
|
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" };
|
|
1924
1925
|
}
|
|
@@ -1941,7 +1942,7 @@ async function installSchedule(opts) {
|
|
|
1941
1942
|
return { trigger: "schedule", outcome: "installed", path };
|
|
1942
1943
|
}
|
|
1943
1944
|
async function installCapture(opts) {
|
|
1944
|
-
const lib = await import("./trace-library-
|
|
1945
|
+
const lib = await import("./trace-library-QDGMBGNH.js");
|
|
1945
1946
|
const config = lib.loadSyncConfig();
|
|
1946
1947
|
if (!config.enabled && config.enabledAt) return { sync: "off", triggers: [] };
|
|
1947
1948
|
const configFile = lib.syncConfigPath();
|
|
@@ -2067,7 +2068,13 @@ async function repairComputer(opts) {
|
|
|
2067
2068
|
const path = mcpConfigPath(client);
|
|
2068
2069
|
const setUpBefore = opts.journal.tracks(path);
|
|
2069
2070
|
opts.journal.track(path, [MCP_ENTRY[client.id]]);
|
|
2070
|
-
|
|
2071
|
+
let key;
|
|
2072
|
+
try {
|
|
2073
|
+
key = client.id === "claude_app" ? "" : await (opts.agentKey ?? localAgentKey)(client.id);
|
|
2074
|
+
} catch {
|
|
2075
|
+
continue;
|
|
2076
|
+
}
|
|
2077
|
+
const registered = registerMcpServer(client, { token: key, mcpUrl: mcpUrlFor(apiBase(), "short"), sky: opts.sky }, runner);
|
|
2071
2078
|
if (registered.outcome === "registered") engines.push({ id: client.id, what: mark === "missing" && !setUpBefore ? "AgentSky added" : "AgentSky registration put back" });
|
|
2072
2079
|
}
|
|
2073
2080
|
for (const agent of agents) {
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
USER_AGENT
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JSW6RJM4.js";
|
|
4
4
|
import {
|
|
5
5
|
configPath
|
|
6
6
|
} from "./chunk-XHZJG3QT.js";
|
|
7
7
|
import {
|
|
8
8
|
TRACE_CONTENT_SCOPES,
|
|
9
9
|
redactTraceText
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-W24YSGH4.js";
|
|
11
11
|
|
|
12
12
|
// src/trace.ts
|
|
13
13
|
import { randomBytes } from "crypto";
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import {
|
|
2
|
+
cachedSettingsBlock,
|
|
3
|
+
mcpUrlFor,
|
|
4
|
+
workspaceSlug
|
|
5
|
+
} from "./chunk-V4NPUQM2.js";
|
|
6
|
+
import {
|
|
7
|
+
api
|
|
8
|
+
} from "./chunk-NENCXIQO.js";
|
|
9
|
+
import {
|
|
10
|
+
USER_AGENT
|
|
11
|
+
} from "./chunk-JSW6RJM4.js";
|
|
12
|
+
import {
|
|
13
|
+
apiBase,
|
|
14
|
+
apiToken,
|
|
15
|
+
configPath,
|
|
16
|
+
loadConfig
|
|
17
|
+
} from "./chunk-XHZJG3QT.js";
|
|
18
|
+
|
|
19
|
+
// src/mcp-serve.ts
|
|
20
|
+
import { createInterface } from "readline";
|
|
21
|
+
|
|
22
|
+
// src/local-agent-keys.ts
|
|
23
|
+
import { createHash } from "crypto";
|
|
24
|
+
import { mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
|
|
25
|
+
import { hostname } from "os";
|
|
26
|
+
import { dirname, join } from "path";
|
|
27
|
+
var SHELL_AGENT = "shell";
|
|
28
|
+
function agentKeysPath() {
|
|
29
|
+
return join(dirname(configPath()), "agent-keys.json");
|
|
30
|
+
}
|
|
31
|
+
function readKeys() {
|
|
32
|
+
try {
|
|
33
|
+
const parsed = JSON.parse(readFileSync(agentKeysPath(), "utf8"));
|
|
34
|
+
if (parsed?.version === 1 && parsed.keys && typeof parsed.keys === "object") return parsed;
|
|
35
|
+
} catch {
|
|
36
|
+
}
|
|
37
|
+
return { version: 1, keys: {} };
|
|
38
|
+
}
|
|
39
|
+
function writeKeys(file) {
|
|
40
|
+
const path = agentKeysPath();
|
|
41
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
42
|
+
writeFileSync(path, `${JSON.stringify(file, null, 2)}
|
|
43
|
+
`, { mode: 384 });
|
|
44
|
+
}
|
|
45
|
+
function slot(agent, workspace, account) {
|
|
46
|
+
return createHash("sha256").update([apiBase(), account, workspace, agent].join("\n")).digest("hex").slice(0, 32);
|
|
47
|
+
}
|
|
48
|
+
var AGENT_NAMES = {
|
|
49
|
+
claude_code: "Claude Code",
|
|
50
|
+
codex: "Codex",
|
|
51
|
+
cursor: "Cursor",
|
|
52
|
+
grok: "Grok",
|
|
53
|
+
hermes: "Hermes",
|
|
54
|
+
claude_app: "Claude app",
|
|
55
|
+
[SHELL_AGENT]: "new shells"
|
|
56
|
+
};
|
|
57
|
+
function agentKeyName(agent, host = hostname()) {
|
|
58
|
+
return `${AGENT_NAMES[agent] ?? agent} on ${host}`.slice(0, 60);
|
|
59
|
+
}
|
|
60
|
+
var INTERACTIVE_CLIENT_AGENTS = ["claude_code", "codex"];
|
|
61
|
+
var UNATTENDED_ENV = ["SKY_API_TOKEN", "E2B_SANDBOX", "CI", "AGENTSKY_HARNESS_TOKEN", "SKY_WORKER_TOKEN", "AGENTSKY_POD_ID", "AGENTSKY_SESSION_ID"];
|
|
62
|
+
function wantsInteractiveClientKey(agent, at) {
|
|
63
|
+
return INTERACTIVE_CLIENT_AGENTS.includes(agent) && at.stdinTTY && at.stdoutTTY && !at.unattended && !at.agentKeyOnly;
|
|
64
|
+
}
|
|
65
|
+
function runsUnattended(env = process.env) {
|
|
66
|
+
return UNATTENDED_ENV.some((name) => Boolean(env[name]?.trim()));
|
|
67
|
+
}
|
|
68
|
+
async function localAgentKey(agent, deps = {}, options = {}) {
|
|
69
|
+
if (!apiToken()) throw new Error("sky is not signed in on this computer: run `sky auth login`");
|
|
70
|
+
const workspace = await (deps.workspace ?? (() => workspaceSlug()))();
|
|
71
|
+
const account = (deps.account ?? (() => loadConfig().email ?? "signed-in"))();
|
|
72
|
+
const file = readKeys();
|
|
73
|
+
const key = slot(options.interactiveClient ? `${agent}:interactive_client` : agent, workspace, account);
|
|
74
|
+
const stored = file.keys[key];
|
|
75
|
+
if (stored?.secret) return stored.secret;
|
|
76
|
+
const mint = deps.mint ?? ((body) => api("POST", "/api_keys", body));
|
|
77
|
+
const made = await mint({ name: agentKeyName(agent), scopes: ["read", "write"], universe: workspace, access: "agent", agent, ...options.interactiveClient ? { interactive_client: true } : {} });
|
|
78
|
+
file.keys[key] = { id: made.api_key.id, secret: made.secret, workspace };
|
|
79
|
+
writeKeys(file);
|
|
80
|
+
return made.secret;
|
|
81
|
+
}
|
|
82
|
+
async function revokeLocalAgentKeys(revoke = (id) => api("POST", `/api_keys/${encodeURIComponent(id)}/revoke`)) {
|
|
83
|
+
const file = readKeys();
|
|
84
|
+
if (!Object.keys(file.keys).length) return { revoked: 0, left: 0 };
|
|
85
|
+
let revoked = 0;
|
|
86
|
+
const left = {};
|
|
87
|
+
for (const [key, stored] of Object.entries(file.keys)) {
|
|
88
|
+
try {
|
|
89
|
+
await revoke(stored.id);
|
|
90
|
+
revoked++;
|
|
91
|
+
} catch {
|
|
92
|
+
left[key] = stored;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (Object.keys(left).length) writeKeys({ version: 1, keys: left });
|
|
96
|
+
else rmSync(agentKeysPath(), { force: true });
|
|
97
|
+
return { revoked, left: Object.keys(left).length };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/mcp-serve.ts
|
|
101
|
+
var defaults = () => ({
|
|
102
|
+
fetch,
|
|
103
|
+
token: async () => apiToken() ? localAgentKey("claude_app") : void 0,
|
|
104
|
+
url: () => mcpUrlFor(apiBase(), "short"),
|
|
105
|
+
settings: cachedSettingsBlock,
|
|
106
|
+
write: (line) => process.stdout.write(`${line}
|
|
107
|
+
`)
|
|
108
|
+
});
|
|
109
|
+
function failure(id, message) {
|
|
110
|
+
return JSON.stringify({ jsonrpc: "2.0", id: id ?? null, error: { code: -32e3, message } });
|
|
111
|
+
}
|
|
112
|
+
function answersIn(body, type) {
|
|
113
|
+
const texts = type?.includes("text/event-stream") ? body.split(/\r?\n/).filter((line) => line.startsWith("data:")).map((line) => line.slice(5).trim()).filter(Boolean) : body.trim() ? [body] : [];
|
|
114
|
+
return texts.flatMap((text) => {
|
|
115
|
+
const parsed = JSON.parse(text);
|
|
116
|
+
return Array.isArray(parsed) ? parsed : [parsed];
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
async function shortToolCount(token, url = mcpUrlFor(apiBase(), "short"), fetchImpl = fetch) {
|
|
120
|
+
try {
|
|
121
|
+
const response = await fetchImpl(url, {
|
|
122
|
+
method: "POST",
|
|
123
|
+
headers: { "user-agent": USER_AGENT, authorization: `Bearer ${token}`, "content-type": "application/json", accept: "application/json, text/event-stream" },
|
|
124
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "tools/list" })
|
|
125
|
+
});
|
|
126
|
+
if (!response.ok) return null;
|
|
127
|
+
const tools = answersIn(await response.text(), response.headers.get("content-type")).find((answer) => answer.id === 1)?.result?.tools;
|
|
128
|
+
return Array.isArray(tools) ? tools.length : null;
|
|
129
|
+
} catch {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async function forwardLine(line, deps = defaults(), protocol = {}) {
|
|
134
|
+
let message;
|
|
135
|
+
try {
|
|
136
|
+
message = JSON.parse(line);
|
|
137
|
+
} catch {
|
|
138
|
+
return deps.write(failure(null, "not a JSON-RPC message"));
|
|
139
|
+
}
|
|
140
|
+
const expectsAnswer = message.id !== void 0 && message.id !== null;
|
|
141
|
+
let token;
|
|
142
|
+
try {
|
|
143
|
+
token = await deps.token();
|
|
144
|
+
} catch (error) {
|
|
145
|
+
if (expectsAnswer) deps.write(failure(message.id, `sky could not get this app a key of its own: ${(error instanceof Error ? error.message : String(error)).split("\n")[0]}`));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (!token) {
|
|
149
|
+
if (expectsAnswer) deps.write(failure(message.id, "sky is not signed in on this computer: run `sky auth login`"));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
let response;
|
|
153
|
+
try {
|
|
154
|
+
response = await deps.fetch(deps.url(), {
|
|
155
|
+
method: "POST",
|
|
156
|
+
headers: {
|
|
157
|
+
"user-agent": USER_AGENT,
|
|
158
|
+
authorization: `Bearer ${token}`,
|
|
159
|
+
"content-type": "application/json",
|
|
160
|
+
accept: "application/json, text/event-stream",
|
|
161
|
+
...protocol.version ? { "mcp-protocol-version": protocol.version } : {}
|
|
162
|
+
},
|
|
163
|
+
body: line
|
|
164
|
+
});
|
|
165
|
+
} catch (error) {
|
|
166
|
+
if (expectsAnswer) deps.write(failure(message.id, `AgentSky could not be reached: ${error instanceof Error ? error.message : String(error)}`));
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const body = await response.text();
|
|
170
|
+
if (!response.ok) {
|
|
171
|
+
if (expectsAnswer) deps.write(failure(message.id, `AgentSky answered ${response.status}`));
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
let answers;
|
|
175
|
+
try {
|
|
176
|
+
answers = answersIn(body, response.headers.get("content-type"));
|
|
177
|
+
} catch {
|
|
178
|
+
if (expectsAnswer) deps.write(failure(message.id, "AgentSky's answer was not JSON"));
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
for (const answer of answers) {
|
|
182
|
+
if (message.method === "initialize" && answer.result) {
|
|
183
|
+
const version = answer.result.protocolVersion;
|
|
184
|
+
if (typeof version === "string") protocol.version = version;
|
|
185
|
+
const settings = deps.settings();
|
|
186
|
+
if (settings) answer.result.instructions = `${answer.result.instructions ?? ""}
|
|
187
|
+
|
|
188
|
+
${settings}`.trim();
|
|
189
|
+
}
|
|
190
|
+
deps.write(JSON.stringify(answer));
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async function serveMcp(deps = defaults()) {
|
|
194
|
+
const protocol = {};
|
|
195
|
+
const lines = createInterface({ input: process.stdin, crlfDelay: Infinity });
|
|
196
|
+
let queue = Promise.resolve();
|
|
197
|
+
for await (const line of lines) {
|
|
198
|
+
if (!line.trim()) continue;
|
|
199
|
+
queue = queue.then(() => forwardLine(line, deps, protocol));
|
|
200
|
+
}
|
|
201
|
+
await queue;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export {
|
|
205
|
+
SHELL_AGENT,
|
|
206
|
+
agentKeysPath,
|
|
207
|
+
wantsInteractiveClientKey,
|
|
208
|
+
runsUnattended,
|
|
209
|
+
localAgentKey,
|
|
210
|
+
revokeLocalAgentKeys,
|
|
211
|
+
shortToolCount,
|
|
212
|
+
forwardLine,
|
|
213
|
+
serveMcp
|
|
214
|
+
};
|