@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
package/dist/index.js
CHANGED
|
@@ -17,53 +17,59 @@ import {
|
|
|
17
17
|
skyCommand,
|
|
18
18
|
takeBack,
|
|
19
19
|
waitForAnswer
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-AQ7E6RYH.js";
|
|
21
21
|
import {
|
|
22
22
|
SetupJournal,
|
|
23
23
|
TOKEN_ENV,
|
|
24
|
-
addPolicy,
|
|
25
|
-
deleteWorkspace,
|
|
26
|
-
deletionPreview,
|
|
27
|
-
invite,
|
|
28
|
-
joinWorkspace,
|
|
29
|
-
leaveWorkspace,
|
|
30
|
-
listMembers,
|
|
31
|
-
listPolicies,
|
|
32
|
-
removeMember,
|
|
33
|
-
removePolicy,
|
|
34
|
-
renderDeletionPreview,
|
|
35
|
-
renderMembers,
|
|
36
|
-
renderPolicy,
|
|
37
|
-
setPolicyEnabled,
|
|
38
|
-
setRole,
|
|
39
24
|
shellEnvFiles,
|
|
40
25
|
shellStartupFiles,
|
|
41
|
-
typedConfirmation,
|
|
42
|
-
withdrawInvite,
|
|
43
|
-
workspaceSlug,
|
|
44
26
|
writeShellEnv
|
|
45
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-2YJE5NVV.js";
|
|
46
28
|
import {
|
|
47
|
-
|
|
48
|
-
|
|
29
|
+
SHELL_AGENT,
|
|
30
|
+
agentKeysPath,
|
|
31
|
+
localAgentKey,
|
|
32
|
+
revokeLocalAgentKeys,
|
|
33
|
+
runsUnattended,
|
|
34
|
+
shortToolCount,
|
|
35
|
+
wantsInteractiveClientKey
|
|
36
|
+
} from "./chunk-NLV2DMMS.js";
|
|
49
37
|
import {
|
|
50
38
|
NO_TOOLS,
|
|
39
|
+
addPolicy,
|
|
40
|
+
deleteWorkspace,
|
|
41
|
+
deletionPreview,
|
|
51
42
|
detectClaudeApp,
|
|
52
43
|
detectHermes,
|
|
53
44
|
detectLocalAgents,
|
|
54
45
|
detectMcpClients,
|
|
55
46
|
hasMcpServer,
|
|
47
|
+
invite,
|
|
48
|
+
joinWorkspace,
|
|
49
|
+
leaveWorkspace,
|
|
50
|
+
listMembers,
|
|
51
|
+
listPolicies,
|
|
56
52
|
mcpConfigPath,
|
|
57
53
|
mcpUrlFor,
|
|
58
54
|
readWorkspaceSettings,
|
|
59
55
|
refreshMcpRegistrations,
|
|
60
56
|
registerMcpServer,
|
|
57
|
+
removeMember,
|
|
58
|
+
removePolicy,
|
|
59
|
+
renderDeletionPreview,
|
|
60
|
+
renderMembers,
|
|
61
|
+
renderPolicy,
|
|
61
62
|
renderSettingsBlock,
|
|
62
63
|
selectLocalAgents,
|
|
64
|
+
setPolicyEnabled,
|
|
65
|
+
setRole,
|
|
63
66
|
systemCommandRunner,
|
|
67
|
+
typedConfirmation,
|
|
68
|
+
withdrawInvite,
|
|
64
69
|
withoutSettingsBlock,
|
|
70
|
+
workspaceSlug,
|
|
65
71
|
writeSettingsBlocks
|
|
66
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-V4NPUQM2.js";
|
|
67
73
|
import {
|
|
68
74
|
SINGLE_REQUEST_MAX_BYTES,
|
|
69
75
|
codexThreadName,
|
|
@@ -76,7 +82,7 @@ import {
|
|
|
76
82
|
transfer,
|
|
77
83
|
uploadLargeFile,
|
|
78
84
|
workspaceState
|
|
79
|
-
} from "./chunk-
|
|
85
|
+
} from "./chunk-3TYVCKLX.js";
|
|
80
86
|
import {
|
|
81
87
|
ApiError,
|
|
82
88
|
api,
|
|
@@ -90,22 +96,22 @@ import {
|
|
|
90
96
|
streamEvents,
|
|
91
97
|
uploadFile,
|
|
92
98
|
writeResponseFile
|
|
93
|
-
} from "./chunk-
|
|
94
|
-
import "./chunk-
|
|
99
|
+
} from "./chunk-NENCXIQO.js";
|
|
100
|
+
import "./chunk-ENG7YVFA.js";
|
|
95
101
|
import {
|
|
96
102
|
skillTargets,
|
|
97
103
|
syncLocalSkills
|
|
98
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-4RUMYOAH.js";
|
|
99
105
|
import {
|
|
100
106
|
SKILL_NAME,
|
|
101
107
|
installSkill,
|
|
102
108
|
isInstalledSkill,
|
|
103
109
|
skillPaths
|
|
104
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-I6R6JSZT.js";
|
|
105
111
|
import {
|
|
106
112
|
CLI_VERSION,
|
|
107
113
|
USER_AGENT
|
|
108
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-JSW6RJM4.js";
|
|
109
115
|
import {
|
|
110
116
|
apiBase,
|
|
111
117
|
apiToken,
|
|
@@ -115,7 +121,7 @@ import {
|
|
|
115
121
|
loadConfig,
|
|
116
122
|
saveConfig
|
|
117
123
|
} from "./chunk-XHZJG3QT.js";
|
|
118
|
-
import "./chunk-
|
|
124
|
+
import "./chunk-OJ5ERABF.js";
|
|
119
125
|
import {
|
|
120
126
|
AGENT_TYPES,
|
|
121
127
|
MODEL_SUBSCRIPTION_PLAN_PHRASE,
|
|
@@ -141,7 +147,7 @@ import {
|
|
|
141
147
|
storeSkillRefSchema,
|
|
142
148
|
supersededBy,
|
|
143
149
|
unsafeNumberSpans
|
|
144
|
-
} from "./chunk-
|
|
150
|
+
} from "./chunk-W24YSGH4.js";
|
|
145
151
|
import "./chunk-MLKGABMK.js";
|
|
146
152
|
|
|
147
153
|
// src/session-show.ts
|
|
@@ -1024,7 +1030,7 @@ var PORTABLE_PARTS = [
|
|
|
1024
1030
|
var PORTABLE_PLUGINS = PORTABLE_PARTS.map((part) => {
|
|
1025
1031
|
const manifest = preinstalledManifest(part.id);
|
|
1026
1032
|
if (!manifest) throw new Error(`${part.id} is portable but not in the pre-installed catalog`);
|
|
1027
|
-
return { id: manifest.id, name: manifest.name, description: manifest.description,
|
|
1033
|
+
return { id: manifest.id, name: manifest.name, description: manifest.description, permission: manifest.permission, ships: manifest.ships, requires: manifest.requires ?? [], tools: part.tools, instructions: part.instructions };
|
|
1028
1034
|
});
|
|
1029
1035
|
|
|
1030
1036
|
// ../../packages/uikit-components/src/plugins.ts
|
|
@@ -2052,18 +2058,18 @@ async function packEnvironment(cwd, resources, platform = IMPORT_PLATFORM) {
|
|
|
2052
2058
|
hash.update(chunk);
|
|
2053
2059
|
});
|
|
2054
2060
|
gzip.pipe(sink);
|
|
2055
|
-
const done = new Promise((
|
|
2056
|
-
sink.on("finish", () =>
|
|
2061
|
+
const done = new Promise((resolve14, reject) => {
|
|
2062
|
+
sink.on("finish", () => resolve14());
|
|
2057
2063
|
sink.on("error", reject);
|
|
2058
2064
|
gzip.on("error", reject);
|
|
2059
2065
|
});
|
|
2060
|
-
const write = (chunk) => new Promise((
|
|
2066
|
+
const write = (chunk) => new Promise((resolve14, reject) => {
|
|
2061
2067
|
if (bytes > MAX_ENVIRONMENT_BYTES) {
|
|
2062
2068
|
reject(new Error(`The working folder packs to more than ${MAX_ENVIRONMENT_BYTES / 1024 ** 3} GiB; import it with --no-environment.`));
|
|
2063
2069
|
return;
|
|
2064
2070
|
}
|
|
2065
|
-
if (gzip.write(chunk))
|
|
2066
|
-
else gzip.once("drain",
|
|
2071
|
+
if (gzip.write(chunk)) resolve14();
|
|
2072
|
+
else gzip.once("drain", resolve14);
|
|
2067
2073
|
});
|
|
2068
2074
|
try {
|
|
2069
2075
|
for (const rel of listed) {
|
|
@@ -2395,7 +2401,7 @@ var MAX_LISTED_ARTIFACTS = 99;
|
|
|
2395
2401
|
function leftOutLine(left) {
|
|
2396
2402
|
const counts = /* @__PURE__ */ new Map();
|
|
2397
2403
|
for (const file of left) counts.set(file.reason, (counts.get(file.reason) ?? 0) + 1);
|
|
2398
|
-
const files2 = [...counts].map(([
|
|
2404
|
+
const files2 = [...counts].map(([reason2, n]) => `${n} ${n === 1 ? "file" : "files"} (${reason2})`).join(", ");
|
|
2399
2405
|
return `Not transferred: ${files2 ? `${files2}; ` : ""}runtime state such as running processes, installed tools and environment variables; and reasoning the source harness stored unreadably.`;
|
|
2400
2406
|
}
|
|
2401
2407
|
function prepareImport(session2, summaryPath, options = {}) {
|
|
@@ -2583,22 +2589,36 @@ import { hostname } from "os";
|
|
|
2583
2589
|
import { spawn } from "child_process";
|
|
2584
2590
|
|
|
2585
2591
|
// src/local-access.ts
|
|
2586
|
-
|
|
2592
|
+
var reason = (error) => (error instanceof Error ? error.message : String(error)).split("\n")[0];
|
|
2593
|
+
async function syncLocalAccess(signedIn, clients = detectMcpClients(), deps = {}) {
|
|
2587
2594
|
const lines2 = [];
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
const name = clients.find((client) => client.id === registered.agent)?.name ?? registered.agent;
|
|
2594
|
-
lines2.push(registered.outcome === "registered" ? ` agentsky MCP server for ${name} now uses this login` : ` agentsky MCP server for ${name} not updated: ${registered.detail ?? registered.outcome} \u2014 run \`sky setup skill\``);
|
|
2595
|
-
}
|
|
2595
|
+
if (!signedIn) {
|
|
2596
|
+
const shell = writeShellEnv(void 0);
|
|
2597
|
+
lines2.push(shell.outcome === "failed" ? ` ${TOKEN_ENV} not updated for new shells: ${shell.detail}` : ` new shells no longer get ${TOKEN_ENV}`);
|
|
2598
|
+
const holding = clients.filter((client) => hasMcpServer(client)).map((client) => client.name);
|
|
2599
|
+
if (holding.length) lines2.push(` the agentsky MCP server in ${holding.join(", ")} still holds a key sky made for it: revoke it in Developer \u2192 API keys, or \`sky auth login\` replaces it`);
|
|
2596
2600
|
return lines2;
|
|
2597
2601
|
}
|
|
2598
|
-
|
|
2599
|
-
|
|
2602
|
+
try {
|
|
2603
|
+
const shell = writeShellEnv(await localAgentKey(SHELL_AGENT, deps));
|
|
2604
|
+
lines2.push(shell.outcome === "failed" ? ` ${TOKEN_ENV} not updated for new shells: ${shell.detail}` : ` new shells get ${TOKEN_ENV}: a key of their own, not this login's`);
|
|
2605
|
+
} catch (error) {
|
|
2606
|
+
lines2.push(` ${TOKEN_ENV} not updated for new shells: ${reason(error)}`);
|
|
2607
|
+
}
|
|
2608
|
+
for (const registered of await refreshMcpRegistrations({ token: (client) => localAgentKey(client.id, deps), apiBase: apiBase() }, clients)) {
|
|
2609
|
+
const name = clients.find((client) => client.id === registered.agent)?.name ?? registered.agent;
|
|
2610
|
+
lines2.push(registered.outcome === "registered" ? ` agentsky MCP server for ${name} now uses a key of its own` : ` agentsky MCP server for ${name} not updated: ${registered.detail ?? registered.outcome} \u2014 run \`sky setup skill\``);
|
|
2611
|
+
}
|
|
2600
2612
|
return lines2;
|
|
2601
2613
|
}
|
|
2614
|
+
async function withdrawLocalAgentKeys(revoke) {
|
|
2615
|
+
const { revoked, left } = await revokeLocalAgentKeys(revoke).catch(() => ({ revoked: 0, left: -1 }));
|
|
2616
|
+
if (left === -1) return [" the keys sky made for local agents could not be revoked: revoke them in Developer \u2192 API keys"];
|
|
2617
|
+
return [
|
|
2618
|
+
...revoked ? [` revoked ${revoked} key${revoked === 1 ? "" : "s"} sky made for local agents`] : [],
|
|
2619
|
+
...left ? [` ${left} key${left === 1 ? "" : "s"} sky made for local agents could not be revoked: revoke ${left === 1 ? "it" : "them"} in Developer \u2192 API keys`] : []
|
|
2620
|
+
];
|
|
2621
|
+
}
|
|
2602
2622
|
|
|
2603
2623
|
// src/login.ts
|
|
2604
2624
|
function b64url(buf) {
|
|
@@ -2626,11 +2646,11 @@ async function login(opts) {
|
|
|
2626
2646
|
console.log(
|
|
2627
2647
|
`Logged in as ${result.user.email ?? "you"}${result.universe ? ` (universe: ${result.universe.slug})` : ""}`
|
|
2628
2648
|
);
|
|
2629
|
-
for (const line2 of syncLocalAccess(
|
|
2649
|
+
for (const line2 of await syncLocalAccess(true)) console.log(line2);
|
|
2630
2650
|
}
|
|
2631
2651
|
async function browserLogin(verifier, challenge) {
|
|
2632
2652
|
const state = b64url(randomBytes(16));
|
|
2633
|
-
const code = await new Promise((
|
|
2653
|
+
const code = await new Promise((resolve14, reject) => {
|
|
2634
2654
|
const server = createServer((req, res) => {
|
|
2635
2655
|
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
2636
2656
|
if (url.pathname !== "/callback") {
|
|
@@ -2643,7 +2663,7 @@ async function browserLogin(verifier, challenge) {
|
|
|
2643
2663
|
if (url.searchParams.get("state") !== state || !got) {
|
|
2644
2664
|
reject(new Error("login callback state mismatch"));
|
|
2645
2665
|
} else {
|
|
2646
|
-
|
|
2666
|
+
resolve14(got);
|
|
2647
2667
|
}
|
|
2648
2668
|
server.close();
|
|
2649
2669
|
});
|
|
@@ -2719,7 +2739,7 @@ function engineInstallPaths(engine, home = homedir4()) {
|
|
|
2719
2739
|
return engine === "claude_code" ? [join7(bin, "claude"), join7(home, ".local", "share", "claude")] : [join7(bin, "codex")];
|
|
2720
2740
|
}
|
|
2721
2741
|
function run(command, args, env) {
|
|
2722
|
-
return new Promise((
|
|
2742
|
+
return new Promise((resolve14, reject) => {
|
|
2723
2743
|
const child = spawn2(command, args, { stdio: ["ignore", "pipe", "pipe"], env });
|
|
2724
2744
|
let output2 = "";
|
|
2725
2745
|
const keep = (chunk) => {
|
|
@@ -2734,7 +2754,7 @@ function run(command, args, env) {
|
|
|
2734
2754
|
});
|
|
2735
2755
|
child.on("close", (code) => {
|
|
2736
2756
|
clearTimeout(timer);
|
|
2737
|
-
if (code === 0)
|
|
2757
|
+
if (code === 0) resolve14();
|
|
2738
2758
|
else reject(new Error(output2.trim().split("\n").slice(-3).join("\n") || `${command} exited with ${code}`));
|
|
2739
2759
|
});
|
|
2740
2760
|
});
|
|
@@ -3802,6 +3822,8 @@ async function readCatalog() {
|
|
|
3802
3822
|
}
|
|
3803
3823
|
async function runSetup(opts) {
|
|
3804
3824
|
if (opts.remove) {
|
|
3825
|
+
if (apiToken()) await revokeLocalAgentKeys().catch(() => {
|
|
3826
|
+
});
|
|
3805
3827
|
await removeSetup(opts);
|
|
3806
3828
|
return;
|
|
3807
3829
|
}
|
|
@@ -3886,7 +3908,7 @@ async function setUp(opts, journal, afterwards = []) {
|
|
|
3886
3908
|
const workspace2 = engines.length && (has("skill") || has("capture")) ? await workspaceSlug().catch(() => null) : null;
|
|
3887
3909
|
let install = false;
|
|
3888
3910
|
if (engines.length && (has("skill") || has("capture") || has("plugins"))) {
|
|
3889
|
-
const captureNoticeLines = has("capture") && workspace2 ? captureNotice(workspace2, await (await import("./trace-library-
|
|
3911
|
+
const captureNoticeLines = has("capture") && workspace2 ? captureNotice(workspace2, await (await import("./trace-library-QDGMBGNH.js")).sourceFolders()) : [];
|
|
3890
3912
|
if (interactive) for (const line2 of captureNoticeLines) console.log(line2);
|
|
3891
3913
|
install = await agreed(installQuestion(engines.map((engine) => engine.name), { capture: captureNoticeLines.length > 0 }));
|
|
3892
3914
|
if (!interactive && captureNoticeLines.length) captureNotices = captureNoticeLines;
|
|
@@ -3895,14 +3917,26 @@ async function setUp(opts, journal, afterwards = []) {
|
|
|
3895
3917
|
const { catalog: catalog2, detail } = await readCatalog();
|
|
3896
3918
|
emit(catalog2 ? { type: "catalog", outcome: "read", agents: catalog2.length } : { type: "catalog", outcome: "unavailable", ...detail ? { detail } : {} });
|
|
3897
3919
|
const token = apiToken();
|
|
3920
|
+
if (token) track(agentKeysPath());
|
|
3921
|
+
const at = { stdinTTY: Boolean(process.stdin.isTTY), stdoutTTY: Boolean(process.stdout.isTTY), unattended: runsUnattended() || Boolean(opts.json), agentKeyOnly: Boolean(opts.agentKeyOnly) };
|
|
3922
|
+
const keyFor = async (agent2) => opts.dryRun ? "ast_a-key-of-its-own" : (opts.deps?.agentKey ?? localAgentKey)(agent2, {}, { interactiveClient: wantsInteractiveClientKey(agent2, at) });
|
|
3898
3923
|
const toolless = token && !opts.dryRun && await shortToolCount(token) === 0;
|
|
3899
|
-
const registerMcp = (client) => {
|
|
3924
|
+
const registerMcp = async (client) => {
|
|
3900
3925
|
if (toolless) {
|
|
3901
3926
|
emit({ type: "mcp", agent: client.id, outcome: "no_tools", detail: NO_TOOLS });
|
|
3902
3927
|
return;
|
|
3903
3928
|
}
|
|
3904
3929
|
if (token) track(mcpConfigPath(client), [MCP_ENTRY[client.id]]);
|
|
3905
|
-
|
|
3930
|
+
let registered;
|
|
3931
|
+
if (!token) registered = { agent: client.id, outcome: "skipped", detail: "not logged in" };
|
|
3932
|
+
else {
|
|
3933
|
+
try {
|
|
3934
|
+
const key2 = client.id === "claude_app" ? "" : await keyFor(client.id);
|
|
3935
|
+
registered = registerMcpServer(client, { token: key2, mcpUrl: mcpUrlFor(apiBase(), "short"), dryRun: opts.dryRun, sky }, runner);
|
|
3936
|
+
} catch (error) {
|
|
3937
|
+
registered = { agent: client.id, outcome: "failed", detail: `no key of its own could be made (${message(error)})` };
|
|
3938
|
+
}
|
|
3939
|
+
}
|
|
3906
3940
|
emit({ type: "mcp", agent: client.id, outcome: registered.outcome, ...registered.detail ? { detail: registered.detail } : {} });
|
|
3907
3941
|
};
|
|
3908
3942
|
for (const agent2 of agents) {
|
|
@@ -3921,14 +3955,14 @@ async function setUp(opts, journal, afterwards = []) {
|
|
|
3921
3955
|
run3.agents.push({ id: agent2.id, skill: "failed" });
|
|
3922
3956
|
continue;
|
|
3923
3957
|
}
|
|
3924
|
-
registerMcp(agent2);
|
|
3958
|
+
await registerMcp(agent2);
|
|
3925
3959
|
}
|
|
3926
|
-
for (const client of mcpOnly) registerMcp(client);
|
|
3960
|
+
for (const client of mcpOnly) await registerMcp(client);
|
|
3927
3961
|
if (token) {
|
|
3928
3962
|
try {
|
|
3929
|
-
const { localSkillWorkspace } = await import("./local-skills-run-
|
|
3963
|
+
const { localSkillWorkspace } = await import("./local-skills-run-OZTUHDBD.js");
|
|
3930
3964
|
const workspace3 = await localSkillWorkspace();
|
|
3931
|
-
const { libraryRequest } = await import("./trace-library-
|
|
3965
|
+
const { libraryRequest } = await import("./trace-library-QDGMBGNH.js");
|
|
3932
3966
|
const local = await syncLocalSkills({
|
|
3933
3967
|
workspace: workspace3,
|
|
3934
3968
|
targets: skillTargets(agents, hermes?.root ?? null),
|
|
@@ -3947,7 +3981,12 @@ async function setUp(opts, journal, afterwards = []) {
|
|
|
3947
3981
|
track(sh);
|
|
3948
3982
|
track(fish);
|
|
3949
3983
|
for (const file of shellStartupFiles()) track(file.path, ["shell_line"]);
|
|
3950
|
-
|
|
3984
|
+
let shell;
|
|
3985
|
+
try {
|
|
3986
|
+
shell = writeShellEnv(await keyFor(SHELL_AGENT), { dryRun: opts.dryRun });
|
|
3987
|
+
} catch (error) {
|
|
3988
|
+
shell = { outcome: "failed", files: [sh, fish], detail: `no key of its own could be made (${message(error)})` };
|
|
3989
|
+
}
|
|
3951
3990
|
emit({ type: "env", variable: TOKEN_ENV, outcome: shell.outcome, files: shell.files, ...shell.detail ? { detail: shell.detail } : {} });
|
|
3952
3991
|
}
|
|
3953
3992
|
if (token && workspace2) {
|
|
@@ -4355,8 +4394,8 @@ function interruptLine(res) {
|
|
|
4355
4394
|
|
|
4356
4395
|
// src/index.ts
|
|
4357
4396
|
import { createHash as createHash10 } from "crypto";
|
|
4358
|
-
import { existsSync as existsSync15, readFileSync as
|
|
4359
|
-
import { basename as basename9, resolve as
|
|
4397
|
+
import { existsSync as existsSync15, readFileSync as readFileSync28, writeFileSync as writeFileSync13 } from "fs";
|
|
4398
|
+
import { basename as basename9, resolve as resolve13 } from "path";
|
|
4360
4399
|
import { createInterface as createInterface5 } from "readline";
|
|
4361
4400
|
import { Command, Option } from "commander";
|
|
4362
4401
|
|
|
@@ -5200,8 +5239,8 @@ async function publishListing(agentId, options) {
|
|
|
5200
5239
|
async function removeListing(handle) {
|
|
5201
5240
|
await api("DELETE", `/catalog/listings/${encodeURIComponent(bare(handle))}`);
|
|
5202
5241
|
}
|
|
5203
|
-
async function setEngineStatus(engine, status,
|
|
5204
|
-
await api("PATCH", `/catalog/engines/${encodeURIComponent(engine)}`, { status, reason });
|
|
5242
|
+
async function setEngineStatus(engine, status, reason2) {
|
|
5243
|
+
await api("PATCH", `/catalog/engines/${encodeURIComponent(engine)}`, { status, reason: reason2 });
|
|
5205
5244
|
const state = await api("GET", "/catalog/engines", void 0, { auth: false });
|
|
5206
5245
|
if (state.delisted.includes(engine) !== (status === "delisted")) {
|
|
5207
5246
|
throw new Error("The catalog does not show the requested state; check whether another operator changed it.");
|
|
@@ -5678,7 +5717,7 @@ function connectionLine2(c) {
|
|
|
5678
5717
|
return `${c.id} ${c.app_name} (${c.app}) ${c.label} since ${c.created_at.slice(0, 10)}`;
|
|
5679
5718
|
}
|
|
5680
5719
|
function browserReturn(start, opts = {}) {
|
|
5681
|
-
return new Promise((
|
|
5720
|
+
return new Promise((resolve14, reject) => {
|
|
5682
5721
|
const server = createServer2((req, res) => {
|
|
5683
5722
|
const url = new URL(req.url ?? "/", "http://127.0.0.1");
|
|
5684
5723
|
if (url.pathname !== "/done" && url.pathname !== "/failed") {
|
|
@@ -5692,7 +5731,7 @@ function browserReturn(start, opts = {}) {
|
|
|
5692
5731
|
if (ok) {
|
|
5693
5732
|
const accountId = url.searchParams.get("account_id");
|
|
5694
5733
|
const source = url.searchParams.get("account_source");
|
|
5695
|
-
|
|
5734
|
+
resolve14({ ...accountId ? { account_id: accountId } : {}, ...source === "google_native" || source === "pipedream" ? { account_source: source } : {} });
|
|
5696
5735
|
} else reject(new ApiError(400, "connect_failed", "the app was not connected"));
|
|
5697
5736
|
});
|
|
5698
5737
|
server.listen(0, "127.0.0.1", () => {
|
|
@@ -5761,6 +5800,36 @@ async function appOfSharedConnection(connectionId, workspace2) {
|
|
|
5761
5800
|
return shared.id.slice("app:".length);
|
|
5762
5801
|
}
|
|
5763
5802
|
|
|
5803
|
+
// src/agent-slack.ts
|
|
5804
|
+
import { readFileSync as readFileSync19 } from "fs";
|
|
5805
|
+
import { homedir as homedir10 } from "os";
|
|
5806
|
+
import { resolve as resolve9 } from "path";
|
|
5807
|
+
var teamQuery = (team, wait) => {
|
|
5808
|
+
const query = new URLSearchParams({ ...team ? { team_id: team } : {}, ...wait ? { wait: String(wait) } : {} }).toString();
|
|
5809
|
+
return query ? `?${query}` : "";
|
|
5810
|
+
};
|
|
5811
|
+
function slackCliRefreshToken(team) {
|
|
5812
|
+
const file = resolve9(homedir10(), ".slack", "credentials.json");
|
|
5813
|
+
const logins = JSON.parse(readFileSync19(file, "utf8"));
|
|
5814
|
+
const found = Object.entries(logins).filter(([key, login2]) => login2.refresh_token && (!team || key === team || login2.team_id === team));
|
|
5815
|
+
if (found.length !== 1) {
|
|
5816
|
+
throw new Error(found.length ? `Several Slack CLI logins; name one: --from-slack-cli ${found.map(([key]) => key).join("|")}` : `No Slack CLI login${team ? ` for ${team}` : ""} in ${file}`);
|
|
5817
|
+
}
|
|
5818
|
+
return found[0][1].refresh_token;
|
|
5819
|
+
}
|
|
5820
|
+
async function saveSlackToken(refreshToken) {
|
|
5821
|
+
return api("PUT", "/channels/slack/config-token", { refresh_token: refreshToken });
|
|
5822
|
+
}
|
|
5823
|
+
async function publishToSlack(agentId, input) {
|
|
5824
|
+
return api("POST", "/channels/agent-bots/slack", { agent_id: agentId, team_id: input.team, session_id: input.session, prompts: input.prompts });
|
|
5825
|
+
}
|
|
5826
|
+
async function slackBot(agentId, team, wait) {
|
|
5827
|
+
return api("GET", `/channels/agent-bots/slack/${encodeURIComponent(agentId)}${teamQuery(team, wait)}`);
|
|
5828
|
+
}
|
|
5829
|
+
async function unpublishFromSlack(agentId, team) {
|
|
5830
|
+
return api("DELETE", `/channels/agent-bots/slack/${encodeURIComponent(agentId)}${teamQuery(team)}`);
|
|
5831
|
+
}
|
|
5832
|
+
|
|
5764
5833
|
// src/routine-triggers.ts
|
|
5765
5834
|
var triggerPath = (id2, resource) => `/routines/${encodeURIComponent(id2)}/${resource}`;
|
|
5766
5835
|
function inboundLine(u) {
|
|
@@ -5800,9 +5869,9 @@ async function triggerRequest(id2, resource, change) {
|
|
|
5800
5869
|
// src/session-workspace.ts
|
|
5801
5870
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
5802
5871
|
import { createHash as createHash8, randomUUID as randomUUID5 } from "crypto";
|
|
5803
|
-
import { existsSync as existsSync12, lstatSync as lstatSync5, mkdirSync as mkdirSync5, readdirSync as readdirSync8, readFileSync as
|
|
5804
|
-
import { homedir as
|
|
5805
|
-
import { basename as basename7, dirname as dirname10, join as join16, relative as relative4, resolve as
|
|
5872
|
+
import { existsSync as existsSync12, lstatSync as lstatSync5, mkdirSync as mkdirSync5, readdirSync as readdirSync8, readFileSync as readFileSync20, renameSync as renameSync2, statSync as statSync6, writeFileSync as writeFileSync9 } from "fs";
|
|
5873
|
+
import { homedir as homedir11, hostname as hostname2, tmpdir as tmpdir3 } from "os";
|
|
5874
|
+
import { basename as basename7, dirname as dirname10, join as join16, relative as relative4, resolve as resolve10 } from "path";
|
|
5806
5875
|
import { inflateRawSync } from "zlib";
|
|
5807
5876
|
|
|
5808
5877
|
// ../../packages/spec/src/native/triage.ts
|
|
@@ -6035,7 +6104,7 @@ function unsupportedBlock(content) {
|
|
|
6035
6104
|
return typeof type === "string" && !RENDERED_BLOCKS.has(type);
|
|
6036
6105
|
});
|
|
6037
6106
|
}
|
|
6038
|
-
function preservedAsJson(label, filename, payload,
|
|
6107
|
+
function preservedAsJson(label, filename, payload, reason2) {
|
|
6039
6108
|
const text2 = JSON.stringify(payload);
|
|
6040
6109
|
const bytes = new TextEncoder().encode(text2);
|
|
6041
6110
|
let binary = "";
|
|
@@ -6045,7 +6114,7 @@ function preservedAsJson(label, filename, payload, reason) {
|
|
|
6045
6114
|
{ type: "text", index: 0, text: label },
|
|
6046
6115
|
{ type: "file", index: 1, name: filename, media_type: "application/json", data: btoa(binary), size_bytes: bytes.length }
|
|
6047
6116
|
] }],
|
|
6048
|
-
notes: [{ kind: "unsupported", reason }]
|
|
6117
|
+
notes: [{ kind: "unsupported", reason: reason2 }]
|
|
6049
6118
|
};
|
|
6050
6119
|
}
|
|
6051
6120
|
function decodeLine(line2) {
|
|
@@ -7217,7 +7286,7 @@ function folderArchive(dir, files2) {
|
|
|
7217
7286
|
return tar.stdout;
|
|
7218
7287
|
}
|
|
7219
7288
|
async function importFolder(id2, dir, opts = {}) {
|
|
7220
|
-
const root2 =
|
|
7289
|
+
const root2 = resolve10(dir);
|
|
7221
7290
|
const name = opts.name ?? basename7(root2);
|
|
7222
7291
|
const archive = opts.archive ?? folderArchive(root2, folderFiles(root2));
|
|
7223
7292
|
if (archive.length <= SINGLE_IMPORT_MAX) {
|
|
@@ -7376,16 +7445,16 @@ async function continueHere(id2, dir, opts = {}) {
|
|
|
7376
7445
|
h = next;
|
|
7377
7446
|
}
|
|
7378
7447
|
if (h.status !== "completed") throw new ApiError(422, h.error?.code ?? "handoff_failed", h.error?.message ?? "the session could not be moved; it stays in the cloud");
|
|
7379
|
-
const folder =
|
|
7448
|
+
const folder = resolve10(dir);
|
|
7380
7449
|
const landed = landing(harness2, conversationFiles(await verifiedDownload(`/session-handoffs/${encodeURIComponent(h.id)}/checkpoint`), harness2), engine, folder);
|
|
7381
|
-
const root2 = engine === "codex" ? process.env.CODEX_HOME || join16(
|
|
7450
|
+
const root2 = engine === "codex" ? process.env.CODEX_HOME || join16(homedir11(), ".codex") : process.env.CLAUDE_CONFIG_DIR || join16(homedir11(), ".claude");
|
|
7382
7451
|
const stamp = Date.now();
|
|
7383
7452
|
for (const file of landed.files) {
|
|
7384
7453
|
const target2 = join16(root2, file.path);
|
|
7385
7454
|
mkdirSync5(dirname10(target2), { recursive: true });
|
|
7386
7455
|
if (existsSync12(target2)) {
|
|
7387
7456
|
if (!lstatSync5(target2).isFile()) throw new ApiError(409, "restore_blocked", `something other than a file is in the way at ${target2}`);
|
|
7388
|
-
if (
|
|
7457
|
+
if (readFileSync20(target2).equals(file.data)) continue;
|
|
7389
7458
|
renameSync2(target2, `${target2}.before-agentsky-${stamp}`);
|
|
7390
7459
|
}
|
|
7391
7460
|
writeFileSync9(target2, file.data, { mode: 384 });
|
|
@@ -7405,8 +7474,8 @@ async function continueHere(id2, dir, opts = {}) {
|
|
|
7405
7474
|
async function browserCommand(sessionId, method, params = {}, commandId) {
|
|
7406
7475
|
return api("POST", `/sessions/${encodeURIComponent(sessionId)}/browser/commands`, { method, params, ...commandId ? { command_id: commandId } : {} });
|
|
7407
7476
|
}
|
|
7408
|
-
async function takeOver(sessionId,
|
|
7409
|
-
return api("POST", `/sessions/${encodeURIComponent(sessionId)}/browser/take-over`,
|
|
7477
|
+
async function takeOver(sessionId, reason2) {
|
|
7478
|
+
return api("POST", `/sessions/${encodeURIComponent(sessionId)}/browser/take-over`, reason2 ? { reason: reason2 } : {});
|
|
7410
7479
|
}
|
|
7411
7480
|
async function handBack(sessionId) {
|
|
7412
7481
|
return api("POST", `/sessions/${encodeURIComponent(sessionId)}/browser/hand-back`, {});
|
|
@@ -7527,7 +7596,7 @@ async function readTurn(sessionId, opts = {}) {
|
|
|
7527
7596
|
for (; ; ) {
|
|
7528
7597
|
const reading = latestTurn(await history2(sessionId));
|
|
7529
7598
|
if (reading.finished || !opts.wait || Date.now() >= deadline) return reading;
|
|
7530
|
-
await new Promise((
|
|
7599
|
+
await new Promise((resolve14) => setTimeout(resolve14, opts.intervalMs ?? 3e3));
|
|
7531
7600
|
}
|
|
7532
7601
|
}
|
|
7533
7602
|
|
|
@@ -8273,13 +8342,13 @@ function renderBrowserProfile(profile) {
|
|
|
8273
8342
|
}
|
|
8274
8343
|
|
|
8275
8344
|
// src/portable-import.ts
|
|
8276
|
-
import { existsSync as existsSync13, readdirSync as readdirSync9, readFileSync as
|
|
8277
|
-
import { basename as basename8, join as join18, resolve as
|
|
8345
|
+
import { existsSync as existsSync13, readdirSync as readdirSync9, readFileSync as readFileSync21, statSync as statSync7 } from "fs";
|
|
8346
|
+
import { basename as basename8, join as join18, resolve as resolve11 } from "path";
|
|
8278
8347
|
import { parse as parseToml4 } from "smol-toml";
|
|
8279
8348
|
var isObject = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8280
8349
|
function readJson4(path2) {
|
|
8281
8350
|
try {
|
|
8282
|
-
return JSON.parse(
|
|
8351
|
+
return JSON.parse(readFileSync21(path2, "utf-8"));
|
|
8283
8352
|
} catch {
|
|
8284
8353
|
return null;
|
|
8285
8354
|
}
|
|
@@ -8353,11 +8422,11 @@ function skillDirs(root2) {
|
|
|
8353
8422
|
return readdirSync9(dir, { withFileTypes: true }).filter((entry) => entry.isDirectory() && existsSync13(join18(dir, entry.name, "SKILL.md"))).map((entry) => ({ name: entry.name, dir: join18(dir, entry.name) })).sort((a, b) => a.name.localeCompare(b.name));
|
|
8354
8423
|
}
|
|
8355
8424
|
function planImport(path2) {
|
|
8356
|
-
const target2 =
|
|
8425
|
+
const target2 = resolve11(path2);
|
|
8357
8426
|
if (!existsSync13(target2)) throw new Error(`Nothing at ${path2}`);
|
|
8358
8427
|
if (statSync7(target2).isFile()) {
|
|
8359
8428
|
const name2 = basename8(target2).replace(/\.(json|toml)$/, "");
|
|
8360
|
-
if (target2.endsWith(".toml")) return { name: name2, format: "codex-config", skills: [], ...codexConfigServers(
|
|
8429
|
+
if (target2.endsWith(".toml")) return { name: name2, format: "codex-config", skills: [], ...codexConfigServers(readFileSync21(target2, "utf-8")) };
|
|
8361
8430
|
const value = readJson4(target2);
|
|
8362
8431
|
if (value === null) throw new Error(`${path2} is not JSON or TOML`);
|
|
8363
8432
|
return { name: name2, format: "mcp", skills: [], ...mcpJsonServers(value) };
|
|
@@ -8493,10 +8562,10 @@ function renderThreadSummary(t) {
|
|
|
8493
8562
|
}
|
|
8494
8563
|
|
|
8495
8564
|
// src/library.ts
|
|
8496
|
-
import { readFileSync as
|
|
8565
|
+
import { readFileSync as readFileSync23 } from "fs";
|
|
8497
8566
|
|
|
8498
8567
|
// src/api-command.ts
|
|
8499
|
-
import { readFileSync as
|
|
8568
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
8500
8569
|
|
|
8501
8570
|
// ../../packages/spec/src/operation-search.ts
|
|
8502
8571
|
var STOP_WORDS = /* @__PURE__ */ new Set(["a", "an", "and", "are", "by", "can", "do", "for", "from", "how", "i", "in", "is", "it", "my", "of", "on", "or", "the", "to", "use", "what", "when", "with"]);
|
|
@@ -8608,9 +8677,9 @@ function operationSearch(operations, components) {
|
|
|
8608
8677
|
// src/api-command.ts
|
|
8609
8678
|
var API_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
8610
8679
|
var SEARCH_LIMIT = 25;
|
|
8611
|
-
function readData(data, stdin = () =>
|
|
8680
|
+
function readData(data, stdin = () => readFileSync22(0, "utf8")) {
|
|
8612
8681
|
if (data === void 0) return void 0;
|
|
8613
|
-
const raw = data === "-" ? stdin() : data.startsWith("@") ?
|
|
8682
|
+
const raw = data === "-" ? stdin() : data.startsWith("@") ? readFileSync22(data.slice(1), "utf8") : data;
|
|
8614
8683
|
try {
|
|
8615
8684
|
JSON.parse(raw);
|
|
8616
8685
|
} catch {
|
|
@@ -8834,7 +8903,7 @@ function registerLibraryLinkCommands(library2) {
|
|
|
8834
8903
|
});
|
|
8835
8904
|
libraryLinks.command("save").description("save through a live recipient edit grant; --revision is the opaque source revision from links read").requiredOption("--token <token>", "43-character token from the authenticated shared URL (public URLs have no writer)").requiredOption("--revision <revision>", "native source revision from links read; stale revisions fail without retry").option("--file <path>", "UTF-8 text file to save").option("--data <json>", "instead of --file, JSON/ @file / - containing exactly one text/html/office/docx/restoreRevision and optional requestId").action(async (opts) => {
|
|
8836
8905
|
if (opts.file !== void 0 === (opts.data !== void 0)) throw new Error("Choose exactly one of --file or --data.");
|
|
8837
|
-
const body = opts.file !== void 0 ? { text: new TextDecoder("utf-8", { fatal: true }).decode(
|
|
8906
|
+
const body = opts.file !== void 0 ? { text: new TextDecoder("utf-8", { fatal: true }).decode(readFileSync23(opts.file)) } : JSON.parse(readData(opts.data));
|
|
8838
8907
|
if (!body || typeof body !== "object" || Array.isArray(body)) throw new Error("--data must be a JSON object with one native save field.");
|
|
8839
8908
|
if ("revision" in body && body.revision !== opts.revision) throw new Error("--data revision must match --revision.");
|
|
8840
8909
|
console.log(JSON.stringify(await saveSharedLibraryFile(opts.token, sharedLibrarySaveSchema.parse({ ...body, revision: opts.revision })), null, 2));
|
|
@@ -8937,8 +9006,46 @@ function renderAnswered(result) {
|
|
|
8937
9006
|
return [result.answered, result.session_id, result.url].filter(Boolean).join(" ");
|
|
8938
9007
|
}
|
|
8939
9008
|
|
|
9009
|
+
// src/approvals.ts
|
|
9010
|
+
async function listApprovals() {
|
|
9011
|
+
return (await api("GET", "/confirmations?status=pending")).confirmations;
|
|
9012
|
+
}
|
|
9013
|
+
async function readApproval(id2) {
|
|
9014
|
+
return (await api("GET", `/confirmations/${encodeURIComponent(id2)}`)).confirmation;
|
|
9015
|
+
}
|
|
9016
|
+
function renderApproval(approval) {
|
|
9017
|
+
const from = approval.session_id ? `from session ${approval.session_id}` : "from an agent on your key";
|
|
9018
|
+
return `${approval.summary}
|
|
9019
|
+
${approval.id} ${from} expires ${approval.expires_at}`;
|
|
9020
|
+
}
|
|
9021
|
+
function approvalCode(detail) {
|
|
9022
|
+
return detail.digest.slice(0, 6).toUpperCase();
|
|
9023
|
+
}
|
|
9024
|
+
function renderDecision(detail) {
|
|
9025
|
+
const parameters = JSON.stringify(detail.parameters, null, 2) ?? "{}";
|
|
9026
|
+
return [
|
|
9027
|
+
`${detail.summary}`,
|
|
9028
|
+
` ${detail.target} (${detail.tool})${detail.session_id ? `, asked in session ${detail.session_id}` : ""}`,
|
|
9029
|
+
...detail.amount !== null ? [` Amount: ${detail.amount}`] : [],
|
|
9030
|
+
...detail.recipients?.length ? [` To: ${detail.recipients.join(", ")}`] : [],
|
|
9031
|
+
` Expires ${detail.expires_at}`,
|
|
9032
|
+
" Parameters:",
|
|
9033
|
+
...parameters.split("\n").map((line2) => ` ${line2}`),
|
|
9034
|
+
"Approve runs it once, as you, and prints what it answered. Reject means it never runs."
|
|
9035
|
+
];
|
|
9036
|
+
}
|
|
9037
|
+
function refusalToDecide(env) {
|
|
9038
|
+
if (!env.stdinTTY || !env.stdoutTTY) return "sky approvals decide needs you at an interactive terminal: it does not read a piped answer, so an agent cannot approve for you. Run it yourself, or approve under Needs you in AgentSky.";
|
|
9039
|
+
if (env.tokenFromEnv) return "SKY_API_TOKEN is set, so sky would decide with that key, not your own sign-in. Unset it and run sky approvals decide again.";
|
|
9040
|
+
if (!env.signedIn) return "sky is not signed in on this computer: run `sky auth login`, then decide again.";
|
|
9041
|
+
return null;
|
|
9042
|
+
}
|
|
9043
|
+
async function decideApproval(detail, decision) {
|
|
9044
|
+
return api("POST", `/confirmations/${encodeURIComponent(detail.id)}/${decision}`, decision === "approve" ? { digest: detail.digest } : {});
|
|
9045
|
+
}
|
|
9046
|
+
|
|
8940
9047
|
// src/signing.ts
|
|
8941
|
-
import { readFileSync as
|
|
9048
|
+
import { readFileSync as readFileSync24, writeFileSync as writeFileSync11 } from "fs";
|
|
8942
9049
|
function signedText(file, opts) {
|
|
8943
9050
|
if (file && opts.artifact) throw new Error("Give a file or --artifact, not both.");
|
|
8944
9051
|
if (opts.artifact) {
|
|
@@ -8947,7 +9054,7 @@ function signedText(file, opts) {
|
|
|
8947
9054
|
return { source: { artifact_id: opts.artifact, version } };
|
|
8948
9055
|
}
|
|
8949
9056
|
if (!file) throw new Error("Give the Markdown file to sign, or --artifact and --artifact-version.");
|
|
8950
|
-
return { document:
|
|
9057
|
+
return { document: readFileSync24(file, "utf8") };
|
|
8951
9058
|
}
|
|
8952
9059
|
async function requestSignature(file, opts) {
|
|
8953
9060
|
if (!opts.link && !(opts.signerName && opts.signerEmail)) throw new Error("Give --signer-name and --signer-email, or --link so anyone with the link can sign.");
|
|
@@ -9035,7 +9142,7 @@ function renderItem2(item) {
|
|
|
9035
9142
|
}
|
|
9036
9143
|
|
|
9037
9144
|
// src/design-systems.ts
|
|
9038
|
-
import { readdirSync as readdirSync10, readFileSync as
|
|
9145
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync25, statSync as statSync8 } from "fs";
|
|
9039
9146
|
import { join as join19, relative as relative5, sep as sep4 } from "path";
|
|
9040
9147
|
var TEXT2 = /\.(mdx?|markdown|txt|json|m?js|cjs|jsx|tsx?|css|html?|svg|xml|csv|ya?ml|toml)$/i;
|
|
9041
9148
|
var MEDIA = {
|
|
@@ -9086,7 +9193,7 @@ function fileTableFrom(dir) {
|
|
|
9086
9193
|
continue;
|
|
9087
9194
|
}
|
|
9088
9195
|
const key = relative5(dir, path2).split(sep4).join("/");
|
|
9089
|
-
const bytes =
|
|
9196
|
+
const bytes = readFileSync25(path2);
|
|
9090
9197
|
files2[key] = TEXT2.test(name) ? bytes.toString("utf8") : `data:${MEDIA[name.split(".").pop()?.toLowerCase() ?? ""] ?? "application/octet-stream"};base64,${bytes.toString("base64")}`;
|
|
9091
9198
|
}
|
|
9092
9199
|
};
|
|
@@ -9110,7 +9217,7 @@ async function designComments(id2, input) {
|
|
|
9110
9217
|
}
|
|
9111
9218
|
|
|
9112
9219
|
// src/tool-command.ts
|
|
9113
|
-
import { readFileSync as
|
|
9220
|
+
import { readFileSync as readFileSync26 } from "fs";
|
|
9114
9221
|
async function rpc(method, params) {
|
|
9115
9222
|
const res = await apiRaw("POST", "/mcp", {
|
|
9116
9223
|
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
|
|
@@ -9136,8 +9243,8 @@ async function listTools(opts = {}) {
|
|
|
9136
9243
|
}
|
|
9137
9244
|
for (const tool2 of tools) console.log(`${tool2.name} ${(tool2.description ?? "").split("\n")[0]}`);
|
|
9138
9245
|
}
|
|
9139
|
-
async function callTool(name, opts = {}, stdin = () =>
|
|
9140
|
-
const raw = opts.json === void 0 ? "{}" : opts.json === "-" ? stdin() : opts.json.startsWith("@") ?
|
|
9246
|
+
async function callTool(name, opts = {}, stdin = () => readFileSync26(0, "utf8")) {
|
|
9247
|
+
const raw = opts.json === void 0 ? "{}" : opts.json === "-" ? stdin() : opts.json.startsWith("@") ? readFileSync26(opts.json.slice(1), "utf8") : opts.json;
|
|
9141
9248
|
let args;
|
|
9142
9249
|
try {
|
|
9143
9250
|
args = JSON.parse(raw);
|
|
@@ -9320,19 +9427,19 @@ function withOldCommandNames(root2, argv) {
|
|
|
9320
9427
|
}
|
|
9321
9428
|
|
|
9322
9429
|
// src/harness.ts
|
|
9323
|
-
import { existsSync as existsSync14, mkdirSync as mkdirSync7, readFileSync as
|
|
9324
|
-
import { dirname as dirname12, join as join20, resolve as
|
|
9430
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync7, readFileSync as readFileSync27, writeFileSync as writeFileSync12 } from "fs";
|
|
9431
|
+
import { dirname as dirname12, join as join20, resolve as resolve12 } from "path";
|
|
9325
9432
|
var HARNESS_FILE = "harness.json";
|
|
9326
9433
|
function harnessFilePath(dir) {
|
|
9327
|
-
return join20(
|
|
9434
|
+
return join20(resolve12(dir), HARNESS_FILE);
|
|
9328
9435
|
}
|
|
9329
9436
|
function readHarnessFile(dir) {
|
|
9330
9437
|
const path2 = harnessFilePath(dir);
|
|
9331
9438
|
if (!existsSync14(path2)) {
|
|
9332
|
-
throw new Error(`no ${HARNESS_FILE} found in ${
|
|
9439
|
+
throw new Error(`no ${HARNESS_FILE} found in ${resolve12(dir)} \u2014 run \`sky harness init\` first`);
|
|
9333
9440
|
}
|
|
9334
9441
|
try {
|
|
9335
|
-
return JSON.parse(
|
|
9442
|
+
return JSON.parse(readFileSync27(path2, "utf8"));
|
|
9336
9443
|
} catch (err) {
|
|
9337
9444
|
throw new Error(`could not parse ${path2}: ${err instanceof Error ? err.message : String(err)}`);
|
|
9338
9445
|
}
|
|
@@ -9529,9 +9636,10 @@ var auth = program.command("auth").description("login, logout, whoami, model sub
|
|
|
9529
9636
|
auth.command("login").description("authorize this machine via the browser").option("--no-browser", "print a URL and poll instead of opening a browser").action(run2(async (opts) => login({ noBrowser: opts.browser === false })));
|
|
9530
9637
|
auth.command("logout").description("forget the stored token (revoke it in Developer \u2192 API keys)").action(
|
|
9531
9638
|
run2(async () => {
|
|
9639
|
+
const withdrawn = await withdrawLocalAgentKeys();
|
|
9532
9640
|
saveConfig({ ...loadConfig(), token: void 0, email: void 0 });
|
|
9533
9641
|
console.log(`Logged out. (Token revocation: Developer \u2192 API keys.)`);
|
|
9534
|
-
for (const line2 of syncLocalAccess(
|
|
9642
|
+
for (const line2 of [...withdrawn, ...await syncLocalAccess(false)]) console.log(line2);
|
|
9535
9643
|
})
|
|
9536
9644
|
);
|
|
9537
9645
|
auth.command("whoami").description("who the current token acts as").action(
|
|
@@ -9832,7 +9940,7 @@ agent.command("apply").description(`make an agent what a manifest file declares
|
|
|
9832
9940
|
return;
|
|
9833
9941
|
}
|
|
9834
9942
|
if (!opts.file) throw new Error("pass -f <manifest file>, or --template <ref>");
|
|
9835
|
-
const path2 =
|
|
9943
|
+
const path2 = resolve13(opts.file);
|
|
9836
9944
|
const { id: id2, manifest } = readManifestFile(path2);
|
|
9837
9945
|
try {
|
|
9838
9946
|
if (!id2) {
|
|
@@ -9851,7 +9959,7 @@ agent.command("apply").description(`make an agent what a manifest file declares
|
|
|
9851
9959
|
} catch (error) {
|
|
9852
9960
|
const issues = error instanceof ApiError && Array.isArray(error.details.issues) ? error.details.issues : [];
|
|
9853
9961
|
if (!issues.length) throw error;
|
|
9854
|
-
throw new Error(refusalLines(opts.file,
|
|
9962
|
+
throw new Error(refusalLines(opts.file, readFileSync28(path2, "utf8"), issues).join("\n"));
|
|
9855
9963
|
}
|
|
9856
9964
|
})
|
|
9857
9965
|
);
|
|
@@ -9863,10 +9971,44 @@ agent.command("export <id>").description("write an agent as a manifest file that
|
|
|
9863
9971
|
process.stdout.write(text2);
|
|
9864
9972
|
return;
|
|
9865
9973
|
}
|
|
9866
|
-
writeFileSync13(
|
|
9974
|
+
writeFileSync13(resolve13(opts.output), text2);
|
|
9867
9975
|
console.log(`Wrote ${opts.output} (version ${version}) \u2014 change it and run \`sky agent apply -f ${opts.output}\`.`);
|
|
9868
9976
|
})
|
|
9869
9977
|
);
|
|
9978
|
+
var agentSlack = agent.command("slack").description("make an agent its own Slack bot, with its own name, avatar, DM and assistant panel");
|
|
9979
|
+
agentSlack.command("token").description("save the Slack app-configuration token agents' Slack apps are created with (refresh token, rotated by AgentSky from then on)").option("--refresh-token <token>", "a Slack app-configuration refresh token (xoxe-\u2026)").option("--from-slack-cli [team]", "take it from this computer's Slack CLI login (~/.slack/credentials.json); hands that login over, so run `slack login` again afterwards").action(
|
|
9980
|
+
run2(async (opts) => {
|
|
9981
|
+
const refreshToken = opts.refreshToken ?? (opts.fromSlackCli ? slackCliRefreshToken(typeof opts.fromSlackCli === "string" ? opts.fromSlackCli : void 0) : void 0);
|
|
9982
|
+
if (!refreshToken) throw new Error("Pass --refresh-token or --from-slack-cli");
|
|
9983
|
+
const saved = await saveSlackToken(refreshToken);
|
|
9984
|
+
console.log(`Saved the Slack app-configuration token for ${saved.team_id}; AgentSky rotates it from now on.${opts.fromSlackCli ? " The Slack CLI's own login is handed over: run `slack login` before using the Slack CLI again." : ""}`);
|
|
9985
|
+
})
|
|
9986
|
+
);
|
|
9987
|
+
agentSlack.command("publish <agent>").description("make the agent its own Slack bot; the first time, opens the one Allow in Slack and waits for it").option("--team <id>", "the Slack workspace, when the workspace saved tokens for several").option("--session <id>", "the chat that answers (defaults to the agent's default chat)").option("--prompt <text...>", "up to four prompts the assistant panel suggests").option("--no-open", "print the install link instead of opening it").option("--no-wait", "return without waiting for the install").option("--json", "print the answer as JSON").action(
|
|
9988
|
+
run2(async (agentId, opts) => {
|
|
9989
|
+
let bot = await publishToSlack(agentId, { team: opts.team, session: opts.session, prompts: opts.prompt });
|
|
9990
|
+
if (bot.status === "needs_you" && bot.next?.url) {
|
|
9991
|
+
console.error(`Allow it in Slack: ${bot.next.url}`);
|
|
9992
|
+
if (opts.open !== false) openBrowser(bot.next.url);
|
|
9993
|
+
for (let round = 0; opts.wait !== false && bot.status !== "published" && round < 5; round++) bot = await slackBot(agentId, opts.team, 120);
|
|
9994
|
+
}
|
|
9995
|
+
if (opts.json) return void console.log(JSON.stringify(bot, null, 2));
|
|
9996
|
+
console.log(bot.status === "published" ? `Published: ${bot.open_url} (Slack app ${bot.slack_app_id}${bot.icon === "not_set" ? "; avatar not set" : ""})` : `Waiting for the Allow in Slack: ${bot.next?.url ?? ""}`);
|
|
9997
|
+
})
|
|
9998
|
+
);
|
|
9999
|
+
agentSlack.command("status <agent>").description("whether the agent's Slack bot is installed, or the link that installs it").option("--team <id>", "the Slack workspace, when the agent is in several").option("--json", "print the answer as JSON").action(
|
|
10000
|
+
run2(async (agentId, opts) => {
|
|
10001
|
+
const bot = await slackBot(agentId, opts.team);
|
|
10002
|
+
if (opts.json) return void console.log(JSON.stringify(bot, null, 2));
|
|
10003
|
+
console.log(bot.status === "published" ? `Published: ${bot.open_url}` : `Waiting for the Allow in Slack: ${bot.next?.url ?? ""}`);
|
|
10004
|
+
})
|
|
10005
|
+
);
|
|
10006
|
+
agentSlack.command("unpublish <agent>").description("uninstall and delete the agent's Slack app; the agent itself is unchanged").option("--team <id>", "the Slack workspace, when the agent is in several").action(
|
|
10007
|
+
run2(async (agentId, opts) => {
|
|
10008
|
+
const done = await unpublishFromSlack(agentId, opts.team);
|
|
10009
|
+
console.log(`Removed from Slack: ${done.slack_app_ids.join(", ")}`);
|
|
10010
|
+
})
|
|
10011
|
+
);
|
|
9870
10012
|
agent.command("record").description("how each harness and model did, as the session record tells it: sessions, decisions people recorded, spend").option("--since <date>", "ISO 8601 start (default: 30 days before --until)").option("--until <date>", "ISO 8601 end (default: now)").option("--json", "print the record as JSON").action(
|
|
9871
10013
|
run2(async (opts) => {
|
|
9872
10014
|
const record3 = await readAgentRecord(opts);
|
|
@@ -10364,7 +10506,7 @@ sessionSandbox.command("exec <ref> <command...>").description("run a shell comma
|
|
|
10364
10506
|
);
|
|
10365
10507
|
sessionSandbox.command("write <ref> <path> [file]").description("write a file in the workspace from a local file, or from stdin when none is given").option("--run <run>", "one of your own executions in the session: write on its own pod").action(
|
|
10366
10508
|
run2(async (ref, path2, file, opts) => {
|
|
10367
|
-
const bytes = file ?
|
|
10509
|
+
const bytes = file ? readFileSync28(file) : readFileSync28(0);
|
|
10368
10510
|
const { path: at, size: size2 } = await api(
|
|
10369
10511
|
"PUT",
|
|
10370
10512
|
`/sessions/${encodeURIComponent(await resolveSessionRef(ref))}/sandbox/files`,
|
|
@@ -10590,13 +10732,13 @@ program.command("skill").description("the AgentSky skill for the agents on this
|
|
|
10590
10732
|
})
|
|
10591
10733
|
);
|
|
10592
10734
|
var setupCommand = program.command("setup [steps...]").description("bring this machine's agents to AgentSky: the skill and its MCP server, capture of their sessions, your plans, your skills and instructions, your tool keys").addHelpText("after", `
|
|
10593
|
-
Steps (all when none is named): ${SETUP_STEPS.join(" | ")}`).option("--key <key>", "a setup key from agentsky.dev/setup").option("--agent <id...>", "only these agents: claude_code | codex | cursor | grok | hermes").option("--secret <name...>", 'save these tool keys to your vault, "gcloud" for your gcloud login (asked one by one when omitted)').option("--no-claude", "leave the Claude plan alone").option("--plan <name...>", "connect only these plans: claude | chatgpt | cursor").option("--keep-instructions", "leave instructions the workspace already holds as they are").option("--sync <account>", "with import: send only what changed since this account's last sync, and leave what was edited in the workspace").option("--remove", "put back every file setup changed on this computer, and turn capture off").option("--dry-run", "say what would be done; write and send nothing").option("-y, --yes", "do not ask before each step").option("--json", "print progress as one JSON object per line; never asks").action(
|
|
10735
|
+
Steps (all when none is named): ${SETUP_STEPS.join(" | ")}`).option("--key <key>", "a setup key from agentsky.dev/setup").option("--agent <id...>", "only these agents: claude_code | codex | cursor | grok | hermes").option("--secret <name...>", 'save these tool keys to your vault, "gcloud" for your gcloud login (asked one by one when omitted)').option("--no-claude", "leave the Claude plan alone").option("--plan <name...>", "connect only these plans: claude | chatgpt | cursor").option("--keep-instructions", "leave instructions the workspace already holds as they are").option("--sync <account>", "with import: send only what changed since this account's last sync, and leave what was edited in the workspace").option("--remove", "put back every file setup changed on this computer, and turn capture off").option("--agent-key", "give Claude Code and Codex an ordinary agent key: their app will not ask you to approve a call").option("--dry-run", "say what would be done; write and send nothing").option("-y, --yes", "do not ask before each step").option("--json", "print progress as one JSON object per line; never asks").action(
|
|
10594
10736
|
run2(async (steps, opts) => {
|
|
10595
10737
|
if (opts.remove && (steps.length || opts.dryRun)) throw new Error("--remove takes no steps and no --dry-run: it puts back everything setup changed");
|
|
10596
10738
|
const unknown = steps.find((step) => !SETUP_STEPS.includes(step));
|
|
10597
10739
|
if (unknown) throw new Error(`unknown step ${unknown} \u2014 expected ${SETUP_STEPS.join(" | ")}`);
|
|
10598
10740
|
try {
|
|
10599
|
-
await runSetup({ steps, remove: opts.remove, keepInstructions: opts.keepInstructions, syncAs: opts.sync, key: opts.key, agents: opts.agent, secrets: opts.secret, claude: opts.claude, plans: opts.plan, dryRun: opts.dryRun, yes: opts.yes, json: opts.json });
|
|
10741
|
+
await runSetup({ steps, remove: opts.remove, agentKeyOnly: opts.agentKey, keepInstructions: opts.keepInstructions, syncAs: opts.sync, key: opts.key, agents: opts.agent, secrets: opts.secret, claude: opts.claude, plans: opts.plan, dryRun: opts.dryRun, yes: opts.yes, json: opts.json });
|
|
10600
10742
|
} catch (error) {
|
|
10601
10743
|
if (!opts.json) throw error;
|
|
10602
10744
|
console.log(JSON.stringify({ type: "error", code: error instanceof ApiError ? error.code : "failed", message: error instanceof Error ? error.message : String(error) }));
|
|
@@ -10686,7 +10828,7 @@ async function launchFromFile(path2, spec, opts) {
|
|
|
10686
10828
|
}
|
|
10687
10829
|
program.command("launch").description("scaffold ./agent.toml if absent, create the agent and its first session (idle until the first message), print its address").option("-f, --file <path>", "agent file", "agent.toml").option("--type <type>", "override the file's harness: hermes | claude_code | codex | openclaw | pi | dsh | kimi_code | opencode").option("--llm <llm>", "override the file's model (must suit the harness)").option("--start", "boot the first session now instead of on the first message").action(
|
|
10688
10830
|
run2(async (opts) => {
|
|
10689
|
-
const path2 =
|
|
10831
|
+
const path2 = resolve13(opts.file);
|
|
10690
10832
|
if (!existsSync15(path2)) {
|
|
10691
10833
|
const name = basename9(process.cwd()).replace(/[^a-zA-Z0-9 _-]/g, "") || "my-agent";
|
|
10692
10834
|
scaffoldAgentFile(path2, name);
|
|
@@ -10702,7 +10844,7 @@ program.command("launch").description("scaffold ./agent.toml if absent, create t
|
|
|
10702
10844
|
);
|
|
10703
10845
|
program.command("deploy").description("re-apply ./agent.toml to the existing agent (idempotent: an unchanged file changes nothing)").option("-f, --file <path>", "agent file", "agent.toml").action(
|
|
10704
10846
|
run2(async (opts) => {
|
|
10705
|
-
const path2 =
|
|
10847
|
+
const path2 = resolve13(opts.file);
|
|
10706
10848
|
const { file, spec } = readAgentFile(path2);
|
|
10707
10849
|
if (!file.id) {
|
|
10708
10850
|
console.log("No agent id in the file yet \u2014 running launch instead.");
|
|
@@ -10795,11 +10937,11 @@ program.command("import").description("import a local Claude Code or Codex sessi
|
|
|
10795
10937
|
console.log();
|
|
10796
10938
|
const rl = createInterface5({ input: process.stdin, output: process.stdout });
|
|
10797
10939
|
const answer = await new Promise(
|
|
10798
|
-
(
|
|
10940
|
+
(resolve14) => rl.question(
|
|
10799
10941
|
`Import which session? [1-${candidates.length}, or comma-separated, or "all"]: `,
|
|
10800
10942
|
(a) => {
|
|
10801
10943
|
rl.close();
|
|
10802
|
-
|
|
10944
|
+
resolve14(a.trim());
|
|
10803
10945
|
}
|
|
10804
10946
|
)
|
|
10805
10947
|
);
|
|
@@ -10822,9 +10964,9 @@ program.command("import").description("import a local Claude Code or Codex sessi
|
|
|
10822
10964
|
if (!autoConfirm) {
|
|
10823
10965
|
if (nonInteractive) throw new Error("Use --yes to confirm this transfer in a non-interactive terminal.");
|
|
10824
10966
|
const prompt = createInterface5({ input: process.stdin, output: process.stdout });
|
|
10825
|
-
const answer = await new Promise((
|
|
10967
|
+
const answer = await new Promise((resolve14) => prompt.question("Upload these selected conversations? [y/N] ", (value) => {
|
|
10826
10968
|
prompt.close();
|
|
10827
|
-
|
|
10969
|
+
resolve14(value);
|
|
10828
10970
|
}));
|
|
10829
10971
|
if (!/^y(?:es)?$/i.test(answer.trim())) {
|
|
10830
10972
|
console.log("Cancelled. Nothing uploaded.");
|
|
@@ -11019,7 +11161,7 @@ files.command("read <id>").description("print part of a file's text (up to 256 K
|
|
|
11019
11161
|
files.command("write <filename>").description("write a small file (up to 256 KiB) from --text, --text-file or stdin; larger files go through sky files upload").option("--text <text>", "the content").option("--text-file <path>", "read the content from a file (- for stdin)").option("--mime-type <type>", "its media type (default text/plain)").option("--expires <seconds>", "expire the file after this many seconds (3600\u20137776000)").action(
|
|
11020
11162
|
run2(async (filename, opts) => {
|
|
11021
11163
|
if (opts.text !== void 0 && opts.textFile !== void 0) throw new Error("give --text or --text-file, not both");
|
|
11022
|
-
const content = opts.text ??
|
|
11164
|
+
const content = opts.text ?? readFileSync28(!opts.textFile || opts.textFile === "-" ? 0 : opts.textFile, "utf8");
|
|
11023
11165
|
const file = await api("POST", "/files/text", { filename, content, ...opts.mimeType ? { mime_type: opts.mimeType } : {}, ...opts.expires ? { expires_in_seconds: Number(opts.expires) } : {} });
|
|
11024
11166
|
console.log(`${file.id} ${file.filename} ${file.mime_type} ${file.size_bytes} bytes`);
|
|
11025
11167
|
})
|
|
@@ -11081,7 +11223,7 @@ session.command("file-get <session> <path>").description("read one shared file o
|
|
|
11081
11223
|
);
|
|
11082
11224
|
session.command("file-put <session> <path> <local>").description("write a local file to <path> in the session's shared files (every run of the session sees it)").action(
|
|
11083
11225
|
run2(async (sessionId, path2, local) => {
|
|
11084
|
-
const { file, conflict } = await writeTaskFile(sessionId, path2,
|
|
11226
|
+
const { file, conflict } = await writeTaskFile(sessionId, path2, readFileSync28(local), mediaTypeFor(local));
|
|
11085
11227
|
console.log(`${renderTaskFile(file)}${conflict ? " (replaced a version you had not seen)" : ""}`);
|
|
11086
11228
|
})
|
|
11087
11229
|
);
|
|
@@ -11271,14 +11413,14 @@ plugins.command("add [id]").description("add or connect a plugin by id (tool:exa
|
|
|
11271
11413
|
console.log(opts.json ? JSON.stringify(answer) : renderAdd(answer));
|
|
11272
11414
|
})
|
|
11273
11415
|
);
|
|
11274
|
-
plugins.command("search <intent>").description("search the whole plugin catalog by what you want to do; shows how each plugin ships, its
|
|
11416
|
+
plugins.command("search <intent>").description("search the whole plugin catalog by what you want to do; shows how each plugin ships, its permission, its price and whether it is installed and enabled. Installs nothing").option("--limit <n>", "how many (default 10, at most 50)").option("--json", "print the answer as JSON").action(
|
|
11275
11417
|
run2(async (intent, opts) => {
|
|
11276
11418
|
const params = new URLSearchParams({ q: intent });
|
|
11277
11419
|
if (opts.limit) params.set("limit", opts.limit);
|
|
11278
11420
|
const found = await api("GET", `/plugins/catalog/search?${params}`);
|
|
11279
11421
|
if (opts.json) return void console.log(JSON.stringify(found, null, 2));
|
|
11280
11422
|
if (!found.data.length) return void console.log("no plugin fits");
|
|
11281
|
-
for (const hit of found.data) console.log(`${hit.plugin_id} ${hit.name} [${hit.ships}, ${hit.price.display}, ${hit.
|
|
11423
|
+
for (const hit of found.data) console.log(`${hit.plugin_id} ${hit.name} [${hit.ships}, ${hit.price.display}, ${hit.permission}, ${hit.enabled ? "on" : hit.installed ? "installed, not on" : "not installed"}] ${hit.description}`);
|
|
11282
11424
|
})
|
|
11283
11425
|
);
|
|
11284
11426
|
plugins.command("rm <id>").description("remove a plugin or disconnect it, by id (app:gmail, tool:exa.web, chat:slack, skill:<id>, mcp:<id>); a bare name removes that plugin bundle's skills (a skill a session still holds is switched off)").option("--connection <id>", "which connection, when you have several for the app or chat app").option("--disconnect", "app:<slug>: disconnect that account at the provider (you may use it elsewhere)").option("--agent <id>", "mcp:<id>: only this agent stops using the server; other agents and the token stay").option("--all-agents", "mcp:<id>: remove it from every agent that uses it, when there are several").option("--uninstall", "chat:<platform>: uninstall the pre-installed chat app from the workspace (owner or admin); connections are kept").option("--confirm", "uninstall a core plugin others need (plugin:files): they become export-only until it is installed again").option("--json", "print the answer as JSON").action(
|
|
@@ -11532,7 +11674,7 @@ skills.command("mine").description("your own skills, which follow you to every w
|
|
|
11532
11674
|
);
|
|
11533
11675
|
skills.command("local").description("the skills sky installed in this computer's engines (Claude Code, Codex, Cursor, Grok, Hermes), with each one's revision, layer and pin").option("--json", "print as JSON").action(
|
|
11534
11676
|
run2(async (opts) => {
|
|
11535
|
-
const { loadLocalSkillState } = await import("./local-skills-
|
|
11677
|
+
const { loadLocalSkillState } = await import("./local-skills-LBCY7JDM.js");
|
|
11536
11678
|
const state = loadLocalSkillState();
|
|
11537
11679
|
if (opts.json) return void console.log(JSON.stringify(state, null, 2));
|
|
11538
11680
|
const names = Object.keys(state.skills).sort();
|
|
@@ -11548,7 +11690,7 @@ skills.command("local").description("the skills sky installed in this computer's
|
|
|
11548
11690
|
);
|
|
11549
11691
|
skills.command("sync").description("install the workspace's skills and your own skills and changes in this computer's engines now; capture does this every 15 minutes").option("--workspace <slug>", "the workspace whose skills to install (default: where capture sends sessions, else your default)").option("--dry-run", "show what would change without writing").option("--json", "print the result as JSON").action(
|
|
11550
11692
|
run2(async (opts) => {
|
|
11551
|
-
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-
|
|
11693
|
+
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-OZTUHDBD.js");
|
|
11552
11694
|
const result = await refreshLocalSkills({ workspace: opts.workspace, dryRun: opts.dryRun });
|
|
11553
11695
|
if (opts.json) return void console.log(JSON.stringify(result, null, 2));
|
|
11554
11696
|
if (!result.checked) return void console.log("no engine that reads skills is installed on this computer");
|
|
@@ -11559,20 +11701,20 @@ ${lines2.join("\n")}` : `Skills from ${result.workspace} are current.`);
|
|
|
11559
11701
|
);
|
|
11560
11702
|
skills.command("pin <name>").description("keep a skill installed on this computer at the revision it has now; syncs leave it until you unpin it").action(
|
|
11561
11703
|
run2(async (name) => {
|
|
11562
|
-
const { pinLocalSkill } = await import("./local-skills-
|
|
11704
|
+
const { pinLocalSkill } = await import("./local-skills-LBCY7JDM.js");
|
|
11563
11705
|
const pinned = pinLocalSkill(name);
|
|
11564
11706
|
console.log(`${name} stays at ${pinned.revision_id} on this computer`);
|
|
11565
11707
|
})
|
|
11566
11708
|
);
|
|
11567
11709
|
skills.command("unpin <name>").description("let a pinned skill follow its updates again from the next sync").action(
|
|
11568
11710
|
run2(async (name) => {
|
|
11569
|
-
const { unpinLocalSkill } = await import("./local-skills-
|
|
11711
|
+
const { unpinLocalSkill } = await import("./local-skills-LBCY7JDM.js");
|
|
11570
11712
|
console.log(unpinLocalSkill(name) ? `${name} follows its updates again` : `${name} was not pinned`);
|
|
11571
11713
|
})
|
|
11572
11714
|
);
|
|
11573
11715
|
skills.command("save <file>").description("save a SKILL.md as your own skill; the same name adds a version").action(
|
|
11574
11716
|
run2(async (file) => {
|
|
11575
|
-
const { skill } = await api("POST", "/skills/personal", { skill_md:
|
|
11717
|
+
const { skill } = await api("POST", "/skills/personal", { skill_md: readFileSync28(file, "utf8") });
|
|
11576
11718
|
console.log(`recorded as ${skill.id}`);
|
|
11577
11719
|
})
|
|
11578
11720
|
);
|
|
@@ -11634,7 +11776,7 @@ var routing = program.command("routing").description("who a question or piece of
|
|
|
11634
11776
|
routing.command("show").description("the current policy").action(run2(async () => console.log(JSON.stringify(await api("GET", "/routing_policy"), null, 2))));
|
|
11635
11777
|
routing.command("set <file>").description("save a new version of the policy from a JSON file; owner or admin").action(
|
|
11636
11778
|
run2(async (file) => {
|
|
11637
|
-
const saved = await api("PUT", "/routing_policy", JSON.parse(
|
|
11779
|
+
const saved = await api("PUT", "/routing_policy", JSON.parse(readFileSync28(file, "utf8")));
|
|
11638
11780
|
console.log(`version ${saved.version}`);
|
|
11639
11781
|
})
|
|
11640
11782
|
);
|
|
@@ -11673,7 +11815,7 @@ reflections.command("settle <id>").description("settle a conflict between two sk
|
|
|
11673
11815
|
if (at < 1) throw new Error(`--when-to-use takes <skill id>=<text>, not "${entry}"`);
|
|
11674
11816
|
return [entry.slice(0, at), entry.slice(at + 1)];
|
|
11675
11817
|
})) : void 0;
|
|
11676
|
-
const body = { action: opts.action, ...opts.keep ? { keep: opts.keep } : {}, ...whenToUse ? { when_to_use: whenToUse } : {}, ...opts.skillMd ? { skill_md:
|
|
11818
|
+
const body = { action: opts.action, ...opts.keep ? { keep: opts.keep } : {}, ...whenToUse ? { when_to_use: whenToUse } : {}, ...opts.skillMd ? { skill_md: readFileSync28(opts.skillMd, "utf8") } : {} };
|
|
11677
11819
|
printDecision(await api("POST", `/reflection_proposals/${encodeURIComponent(id2)}/settle`, body));
|
|
11678
11820
|
})
|
|
11679
11821
|
);
|
|
@@ -11693,7 +11835,7 @@ library.command("list").description("your Library, newest first").option("--sear
|
|
|
11693
11835
|
);
|
|
11694
11836
|
library.command("upload <path>").description("save a file from this computer to your Library").option("--workspace <key>", "place it in this workspace").option("--session <id>", "save it as a result of this conversation of yours; the same name there saves a new version").action(
|
|
11695
11837
|
run2(async (path2, opts) => {
|
|
11696
|
-
const bytes =
|
|
11838
|
+
const bytes = readFileSync28(path2);
|
|
11697
11839
|
const { artifact: artifact2 } = await uploadToLibrary({ bytes, name: basename9(path2), mediaType: "application/octet-stream" }, crypto.randomUUID(), opts.workspace, opts.session);
|
|
11698
11840
|
console.log(renderLibraryArtifact(artifact2));
|
|
11699
11841
|
})
|
|
@@ -11832,6 +11974,34 @@ asks.command("answer <id>").description("answer one; a payment, signature, plugi
|
|
|
11832
11974
|
console.log(opts.json ? JSON.stringify(result, null, 2) : renderAnswered(result));
|
|
11833
11975
|
})
|
|
11834
11976
|
);
|
|
11977
|
+
async function listApprovalsCommand(opts) {
|
|
11978
|
+
const list = await listApprovals();
|
|
11979
|
+
if (opts.json) return void console.log(JSON.stringify(list, null, 2));
|
|
11980
|
+
if (!list.length) return void console.log("No agent is waiting for your approval.");
|
|
11981
|
+
for (const approval of list) console.log(renderApproval(approval));
|
|
11982
|
+
console.log("Decide one here with: sky approvals decide <id>");
|
|
11983
|
+
}
|
|
11984
|
+
var approvals = program.command("approvals").description("the calls agents are waiting for you to approve, and deciding one here without opening AgentSky").option("--json", "print as JSON").action(run2(listApprovalsCommand));
|
|
11985
|
+
approvals.command("list").description("the calls waiting for you: what each does, who asked and when it expires").option("--json", "print as JSON").action(run2(listApprovalsCommand));
|
|
11986
|
+
approvals.command("decide <id>").description("show one call in full, then approve it (it runs once, as you) or reject it after typing its code; at an interactive terminal only").option("--reject", "reject it instead: it never runs").action(
|
|
11987
|
+
run2(async (id2, opts) => {
|
|
11988
|
+
const refusal = refusalToDecide({ stdinTTY: Boolean(process.stdin.isTTY), stdoutTTY: Boolean(process.stdout.isTTY), tokenFromEnv: Boolean(process.env.SKY_API_TOKEN), signedIn: Boolean(loadConfig().token) });
|
|
11989
|
+
if (refusal) throw new Error(refusal);
|
|
11990
|
+
const detail = await readApproval(id2);
|
|
11991
|
+
if (detail.status !== "pending") throw new Error(`${id2} is ${detail.status}: there is nothing to decide.`);
|
|
11992
|
+
if (!detail.complete && !opts.reject) throw new Error("This call is too large to show in full, so it cannot be approved here. Reject it, or ask the agent for a smaller call.");
|
|
11993
|
+
for (const line2 of renderDecision(detail)) console.log(line2);
|
|
11994
|
+
const code = approvalCode(detail);
|
|
11995
|
+
const verb = opts.reject ? "reject" : "approve";
|
|
11996
|
+
const rl = createInterface5({ input: process.stdin, output: process.stdout });
|
|
11997
|
+
const typed = await new Promise((resolve14) => rl.question(`Type ${code} to ${verb} it, or press Enter to leave it waiting: `, resolve14));
|
|
11998
|
+
rl.close();
|
|
11999
|
+
if (typed.trim().toUpperCase() !== code) return void console.log("Not decided: it is still waiting.");
|
|
12000
|
+
const decided = await decideApproval(detail, verb);
|
|
12001
|
+
console.log(`${verb === "approve" ? "Approved" : "Rejected"}: ${decided.confirmation.status}${decided.confirmation.outcome ? ` (status ${decided.confirmation.outcome.status})` : ""}`);
|
|
12002
|
+
if (decided.result !== null && decided.result !== void 0) console.log(JSON.stringify(decided.result, null, 2));
|
|
12003
|
+
})
|
|
12004
|
+
);
|
|
11835
12005
|
var signing = program.command("signing").description("signing: ask someone to sign a document and read what they signed; no command signs");
|
|
11836
12006
|
signing.command("request [file]").description("ask someone to sign a Markdown file, or one version of an artifact; they need no account, and only they can sign, in their own browser").option("--artifact <id>", "sign a version of this artifact instead of a file: a page or Markdown result, frozen now").option("--artifact-version <n>", "the artifact version to sign").requiredOption("--title <title>", "the document's title").option("--signer-name <name>", "who signs; required unless --link").option("--signer-email <email>", "the address that proves them; required unless --link").option("--link", "anyone with the link gives a name and email and signs their own copy").option("--mark <mark>", "typed (default) or drawn").option("--proof <proof>", "email_code (default) or account").option("--legal-name <name>", "the organization they sign for").option("--replaces <id>", "the request this is a new version of").option("--expires-in-days <n>", "days until the request lapses (default 30)").option("--json", "print as JSON").action(
|
|
11837
12007
|
run2(async (file, opts) => {
|
|
@@ -11900,7 +12070,7 @@ artifact.command("save <id> <path>").description("save one file as the artifact'
|
|
|
11900
12070
|
console.log(renderArtifact(await saveArtifactFile(id2, path2, {
|
|
11901
12071
|
baseVersion: Number(opts.base),
|
|
11902
12072
|
requestId: opts.requestId,
|
|
11903
|
-
...opts.file ? { bytes:
|
|
12073
|
+
...opts.file ? { bytes: readFileSync28(opts.file) } : { restoreVersion: Number(opts.restore) }
|
|
11904
12074
|
})));
|
|
11905
12075
|
})
|
|
11906
12076
|
);
|
|
@@ -11913,7 +12083,7 @@ artifact.command("copy <id>").description("copy one version into a new artifact
|
|
|
11913
12083
|
artifact.command("import [file]").description("bring in a file or, with --url, a public web page as a new artifact; its original is version 1's file").option("--url <url>", "a public https page to snapshot").option("--name <name>", "the artifact's name (default: the file's name or the page's title)").option("--task <session>", "the session whose shared folder holds it (default: your own imports folder)").option("--request-id <id>", "send the same value when retrying").action(
|
|
11914
12084
|
run2(async (file, opts) => {
|
|
11915
12085
|
if (Boolean(file) === Boolean(opts.url)) throw new Error("name a file or --url");
|
|
11916
|
-
console.log(renderArtifact(await importArtifact({ ...file ? { file: { name: basename9(file), bytes:
|
|
12086
|
+
console.log(renderArtifact(await importArtifact({ ...file ? { file: { name: basename9(file), bytes: readFileSync28(file) } } : { url: opts.url }, name: opts.name, taskId: opts.task, requestId: opts.requestId })));
|
|
11917
12087
|
})
|
|
11918
12088
|
);
|
|
11919
12089
|
artifact.command("export <id>").description("download an artifact in one of its formats (pdf, png, docx, html, markdown, csv, xlsx...); no --format is every file as a zip").option("--format <format>", "a format `sky artifact inspect` lists under export_formats").option("--artifact-version <version>", "an earlier version").requiredOption("-o, --out <path>", "where to write the bytes").action(
|
|
@@ -11971,19 +12141,19 @@ designSystem.command("show <id>").description("a design system's tokens, compone
|
|
|
11971
12141
|
);
|
|
11972
12142
|
designSystem.command("import <session> <folder>").description("import a local design-system folder (one holding project/, or project/ itself) into a session and publish it").option("--title <title>", "the system's name; defaults to the title in design-system.json").action(
|
|
11973
12143
|
run2(async (task, folder, opts) => {
|
|
11974
|
-
console.log(renderArtifact(await importDesignSystem(task, fileTableFrom(
|
|
12144
|
+
console.log(renderArtifact(await importDesignSystem(task, fileTableFrom(resolve13(folder)), opts.title)));
|
|
11975
12145
|
})
|
|
11976
12146
|
);
|
|
11977
12147
|
designSystem.command("tokens <id> <file>").description("save a tokens.json file as the system's next version; --base is the version you edited").requiredOption("--base <version>", "the version the file was edited from", (value) => Number(value)).option("--note <note>", "one line saying what changed").action(
|
|
11978
12148
|
run2(async (id2, file, opts) => {
|
|
11979
|
-
const tokens = JSON.parse(
|
|
12149
|
+
const tokens = JSON.parse(readFileSync28(resolve13(file), "utf8"));
|
|
11980
12150
|
console.log(renderArtifact(await saveDesignTokens(id2, opts.base, tokens, opts.note)));
|
|
11981
12151
|
})
|
|
11982
12152
|
);
|
|
11983
12153
|
designSystem.command("write <id> <path> [file]").description("save one of the system's editable files (path such as project/README.md) from a local file as its next version, or put back an earlier version's copy with --restore").requiredOption("--base <version>", "the version the file was edited from", (value) => Number(value)).option("--restore <version>", "restore the file as it was in this version instead of reading [file]", (value) => Number(value)).option("--note <note>", "one line saying what changed").action(
|
|
11984
12154
|
run2(async (id2, path2, file, opts) => {
|
|
11985
12155
|
if (file === void 0 === (opts.restore === void 0)) throw Error("Give a local [file] to save, or --restore <version>.");
|
|
11986
|
-
const change = opts.restore === void 0 ? { content:
|
|
12156
|
+
const change = opts.restore === void 0 ? { content: readFileSync28(resolve13(file), "utf8") } : { restore_version: opts.restore };
|
|
11987
12157
|
console.log(renderArtifact(await saveDesignSystemFile(id2, path2, opts.base, change, opts.note)));
|
|
11988
12158
|
})
|
|
11989
12159
|
);
|
|
@@ -12387,7 +12557,7 @@ skyManager.command("rules").description("print your rules, each marked enforced
|
|
|
12387
12557
|
);
|
|
12388
12558
|
skyManager.command("rules-set <file>").description("replace your rules from a JSON file holding the list").action(
|
|
12389
12559
|
run2(async (file) => {
|
|
12390
|
-
const { rules } = await api("PUT", "/sky/rules", { rules: JSON.parse(
|
|
12560
|
+
const { rules } = await api("PUT", "/sky/rules", { rules: JSON.parse(readFileSync28(file, "utf8")) });
|
|
12391
12561
|
console.log(`Saved ${rules.length} rules`);
|
|
12392
12562
|
})
|
|
12393
12563
|
);
|
|
@@ -12783,7 +12953,7 @@ events.command("digests").description("whether your own digests run in this work
|
|
|
12783
12953
|
);
|
|
12784
12954
|
events.command("push [file]").description("write events from your own program into the log: a JSON file (or stdin) holding {events: [...]} or an array; idempotent per idempotency_key").action(
|
|
12785
12955
|
run2(async (file) => {
|
|
12786
|
-
const text2 = file && file !== "-" ?
|
|
12956
|
+
const text2 = file && file !== "-" ? readFileSync28(file, "utf8") : readFileSync28(0, "utf8");
|
|
12787
12957
|
const parsed = JSON.parse(text2);
|
|
12788
12958
|
const body = Array.isArray(parsed) ? { events: parsed } : parsed;
|
|
12789
12959
|
const result = await api("POST", "/events", body);
|
|
@@ -13042,10 +13212,10 @@ hookRule.command("list").description("the workspace's hook rules in evaluation o
|
|
|
13042
13212
|
);
|
|
13043
13213
|
hookRule.command("set").description("replace the entire ordered list of workspace-level hook rules (owner only); pass JSON rules on stdin or --rules").option("--workspace <slug>", "act on this workspace's hooks instead of the top-level hook_rules").option("--rules <json>", "JSON array of rule objects (overrides stdin)").action(
|
|
13044
13214
|
run2(async (opts) => {
|
|
13045
|
-
const raw = opts.rules ?? await new Promise((
|
|
13215
|
+
const raw = opts.rules ?? await new Promise((resolve14) => {
|
|
13046
13216
|
const chunks = [];
|
|
13047
13217
|
process.stdin.on("data", (d) => chunks.push(d));
|
|
13048
|
-
process.stdin.on("end", () =>
|
|
13218
|
+
process.stdin.on("end", () => resolve14(Buffer.concat(chunks).toString()));
|
|
13049
13219
|
});
|
|
13050
13220
|
const rules = JSON.parse(raw);
|
|
13051
13221
|
const slug = opts.workspace ?? await workspaceSlug();
|
|
@@ -13085,10 +13255,53 @@ ruleCommand.command("permissions").description("what an agent may do without ask
|
|
|
13085
13255
|
console.log(JSON.stringify(data, null, 2));
|
|
13086
13256
|
return;
|
|
13087
13257
|
}
|
|
13088
|
-
for (const row of data.permissions) console.log(`${row.permission.padEnd(5)} ${row.
|
|
13258
|
+
for (const row of data.permissions) console.log(`${row.permission.padEnd(5)} ${row.source === "default" ? "default " : row.source.padEnd(9)} ${row.locked ? "(fixed) " : ""}${row.target}${row.requested ? ` (the agent asks for ${row.requested}; waits for the workspace's owner or an admin)` : ""}`);
|
|
13089
13259
|
if (!data.can_edit) console.log("only the workspace's owner or an admin changes the workspace's; add your own with: sky rule add --kind permission --person");
|
|
13090
13260
|
})
|
|
13091
13261
|
);
|
|
13262
|
+
var permissionCommand = program.command("permission").description("who may do what with an operation, tool, plugin or one thing (session:<id>, artifact:<id>, \u2026), and change it");
|
|
13263
|
+
var linkText = (link2) => `${link2.acts} from ${typeof link2.from === "string" ? link2.from : JSON.stringify(link2.from)} (${link2.source.store} ${link2.source.id})`;
|
|
13264
|
+
permissionCommand.command("show <target>").description("an operation's permission, or who may do what with one thing and why").option("--agent <id>", "for an operation: what applies to this agent's sessions").option("--json", "print as JSON").action(
|
|
13265
|
+
run2(async (target2, opts) => {
|
|
13266
|
+
const query = new URLSearchParams({ target: target2, ...opts.agent ? { agent: opts.agent } : {} }).toString();
|
|
13267
|
+
const data = await api("GET", `/permissions?${query}`);
|
|
13268
|
+
if (opts.json) {
|
|
13269
|
+
console.log(JSON.stringify(data, null, 2));
|
|
13270
|
+
return;
|
|
13271
|
+
}
|
|
13272
|
+
if (data.form === "operation") {
|
|
13273
|
+
for (const row of data.permissions ?? []) console.log(`${row.permission.padEnd(5)} ${row.source.padEnd(9)} ${row.locked ? "(fixed) " : ""}${row.target}`);
|
|
13274
|
+
return;
|
|
13275
|
+
}
|
|
13276
|
+
if (data.answer === "unknown") {
|
|
13277
|
+
console.log(`unknown: ${data.reason ?? "store_unavailable"}`);
|
|
13278
|
+
return;
|
|
13279
|
+
}
|
|
13280
|
+
if (data.you) console.log(`you: ${data.you.level}${data.you.chain.length ? ` \u2190 ${data.you.chain.map(linkText).join(" \u2190 ")}` : ""}`);
|
|
13281
|
+
for (const row of data.members ?? []) console.log(`${row.level.padEnd(6)} ${row.member.id}`);
|
|
13282
|
+
for (const grant of data.grants ?? []) console.log(`${grant.id} ${grant.acts.padEnd(6)} ${grant.to}`);
|
|
13283
|
+
})
|
|
13284
|
+
);
|
|
13285
|
+
permissionCommand.command("set <target>").description("give or refuse: --permission for an operation, tool or plugin; --acts for one thing").option("--to <whom>", "an operation: workspace (default), me, agent:<id> or session:<id>; a session: workspace or email:<address>").option("--permission <p>", "allow, ask or deny (an operation, tool or plugin)").option("--acts <level>", "view, use, edit, manage, or none to refuse (a thing)").option("--bounds <json>", `an allow's bounds, e.g. '{"max_per_action":5}'`).option("--until <when>", "when an allow ends, a date and time").action(
|
|
13286
|
+
run2(async (target2, opts) => {
|
|
13287
|
+
const body = { target: target2, ...opts.to ? { to: opts.to } : {}, ...opts.permission ? { permission: opts.permission } : {}, ...opts.acts ? { acts: opts.acts } : {}, ...opts.bounds ? { bounds: JSON.parse(opts.bounds) } : {}, ...opts.until ? { until: opts.until } : {} };
|
|
13288
|
+
console.log(JSON.stringify(await api("POST", "/permissions", body), null, 2));
|
|
13289
|
+
})
|
|
13290
|
+
);
|
|
13291
|
+
permissionCommand.command("remove <id>").description("withdraw a permission: the id set answered, or a rule or grant id from show").action(run2(async (id2) => {
|
|
13292
|
+
console.log(JSON.stringify(await api("DELETE", `/permissions/${encodeURIComponent(id2)}`), null, 2));
|
|
13293
|
+
}));
|
|
13294
|
+
permissionCommand.command("check <target>").description("may this member do this act now, and why").option("--act <act>", "a thing's act: view (default), use, edit, manage or decide").option("--member <whom>", "me (default); a thing: person:<user id> or email:<address>; an operation: agent:<id>").option("--json", "print as JSON").action(
|
|
13295
|
+
run2(async (target2, opts) => {
|
|
13296
|
+
const data = await api("POST", "/permissions/check", { target: target2, ...opts.act ? { act: opts.act } : {}, ...opts.member ? { member: opts.member } : {} });
|
|
13297
|
+
if (opts.json) {
|
|
13298
|
+
console.log(JSON.stringify(data, null, 2));
|
|
13299
|
+
return;
|
|
13300
|
+
}
|
|
13301
|
+
console.log(`${data.answer}${data.reason ? ` (${data.reason})` : ""}${data.ask_whom ? ` \u2014 ask ${data.ask_whom.kind}:${data.ask_whom.id}` : ""}`);
|
|
13302
|
+
for (const link2 of data.chain ?? []) console.log(` \u2190 ${linkText(link2)}`);
|
|
13303
|
+
})
|
|
13304
|
+
);
|
|
13092
13305
|
ruleCommand.command("set <id>").description("change a rule: --on, --off, --name or --config JSON").option("--on", "switch it on").option("--off", "switch it off (a Sky rule is removed)").option("--name <name>", "rename it").option("--config <json>", "replace its configuration").action(
|
|
13093
13306
|
run2(async (id2, opts) => {
|
|
13094
13307
|
const body = { ...opts.on ? { enabled: true } : opts.off ? { enabled: false } : {}, ...opts.name ? { name: opts.name } : {}, ...opts.config ? { config: JSON.parse(opts.config) } : {} };
|
|
@@ -13112,6 +13325,21 @@ ruleCommand.command("undo <change>").description("put a rule back as it was befo
|
|
|
13112
13325
|
ruleCommand.command("rm <id>").description("remove a rule").action(run2(async (id2) => {
|
|
13113
13326
|
console.log(JSON.stringify(await api("DELETE", `/rules/${encodeURIComponent(id2)}`), null, 2));
|
|
13114
13327
|
}));
|
|
13328
|
+
ruleCommand.command("draft <text>").description('read one sentence ("ask me before sending anything to a customer") into the delegation it means; writes nothing').action(
|
|
13329
|
+
run2(async (text2) => {
|
|
13330
|
+
const data = await api("POST", "/rules/drafts", { text: text2 });
|
|
13331
|
+
console.log(data.preview);
|
|
13332
|
+
if (!data.advice) console.log(`
|
|
13333
|
+
To adopt it: sky rule adopt ${JSON.stringify(text2)}`);
|
|
13334
|
+
})
|
|
13335
|
+
);
|
|
13336
|
+
ruleCommand.command("adopt <text>").description("write the delegation one sentence means, as your own row; it only asks or refuses more").action(
|
|
13337
|
+
run2(async (text2) => {
|
|
13338
|
+
const data = await api("POST", "/rules/drafts/adopt", { text: text2 });
|
|
13339
|
+
console.log(`${data.preview}
|
|
13340
|
+
(delegation ${data.delegation_id})`);
|
|
13341
|
+
})
|
|
13342
|
+
);
|
|
13115
13343
|
ruleCommand.command("explain").description("which rule decides a tool call (--tool, --app or --capability) or a spend (--spend with --session), and what it overruled").option("--tool <name>", "a tool name, e.g. Bash").option("--command <text>", "the tool's command").option("--app <slug>", "a connected app, e.g. slack").option("--capability <id>", "a capability id").option("--session <id>", "with this session's own rules and budget").option("--spend", "explain the spend decision instead").action(
|
|
13116
13344
|
run2(async (opts) => {
|
|
13117
13345
|
const body = opts.spend ? { decision: "spend", session_id: opts.session } : { decision: "tool_call", ...opts.session ? { session_id: opts.session } : {}, ...opts.tool ? { tool: opts.tool } : {}, ...opts.command ? { command: opts.command } : {}, ...opts.app ? { connector_app: opts.app } : {}, ...opts.capability ? { capability_id: opts.capability } : {} };
|
|
@@ -13162,11 +13390,11 @@ vendor.command("add <vendor>").description("connect a vendor account by pasting
|
|
|
13162
13390
|
run2(async (vendorId, opts) => {
|
|
13163
13391
|
let credential = opts.credential ?? "";
|
|
13164
13392
|
if (!credential) {
|
|
13165
|
-
credential = await new Promise((
|
|
13393
|
+
credential = await new Promise((resolve14) => {
|
|
13166
13394
|
const rl = createInterface5({ input: process.stdin, output: process.stderr });
|
|
13167
13395
|
rl.question(`${vendorId} credential: `, (a) => {
|
|
13168
13396
|
rl.close();
|
|
13169
|
-
|
|
13397
|
+
resolve14(a.trim());
|
|
13170
13398
|
});
|
|
13171
13399
|
});
|
|
13172
13400
|
}
|
|
@@ -13199,6 +13427,63 @@ vendor.command("usage <id>").description("the agents and sessions that used this
|
|
|
13199
13427
|
for (const t of tasks) console.log(` task ${t.session_id} ${t.title ?? "(untitled)"} ${t.last_used_at.slice(0, 10)}`);
|
|
13200
13428
|
})
|
|
13201
13429
|
);
|
|
13430
|
+
var purchaseMoney = (p) => new Intl.NumberFormat("en-US", { style: "currency", currency: p.currency.toUpperCase() }).format(p.amount / 100);
|
|
13431
|
+
var purchaseLine = (p) => `${p.id} ${p.status.padEnd(17)} ${purchaseMoney(p).padStart(10)} ${p.merchant_name}${p.card_last4 ? ` \u2022\u2022 ${p.card_last4}` : ""}${p.decline_code ? ` (${p.decline_code})` : ""}`;
|
|
13432
|
+
var purchase = program.command("purchase").description("what your agents asked to buy; you approve every purchase yourself");
|
|
13433
|
+
purchase.command("list").description("purchases your agents asked for, newest first").option("--json", "print as JSON").action(
|
|
13434
|
+
run2(async (opts) => {
|
|
13435
|
+
const { purchases: list } = await api("GET", "/purchases");
|
|
13436
|
+
if (opts.json) {
|
|
13437
|
+
console.log(JSON.stringify(list, null, 2));
|
|
13438
|
+
return;
|
|
13439
|
+
}
|
|
13440
|
+
if (!list.length) console.log("no purchases");
|
|
13441
|
+
for (const p of list) console.log(purchaseLine(p));
|
|
13442
|
+
})
|
|
13443
|
+
);
|
|
13444
|
+
purchase.command("show <id>").description("one purchase and where it stands").option("--json", "print as JSON").action(
|
|
13445
|
+
run2(async (id2, opts) => {
|
|
13446
|
+
const { purchase: p } = await api("GET", `/purchases/${encodeURIComponent(id2)}`);
|
|
13447
|
+
if (opts.json) {
|
|
13448
|
+
console.log(JSON.stringify(p, null, 2));
|
|
13449
|
+
return;
|
|
13450
|
+
}
|
|
13451
|
+
console.log(purchaseLine(p));
|
|
13452
|
+
if (p.approval_url) console.log(`Approve it in Link: ${p.approval_url}`);
|
|
13453
|
+
})
|
|
13454
|
+
);
|
|
13455
|
+
purchase.command("cancel <id>").description("cancel a purchase that is not paid yet; its card stops working").action(
|
|
13456
|
+
run2(async (id2) => {
|
|
13457
|
+
const { purchase: p } = await api("POST", `/purchases/${encodeURIComponent(id2)}/cancel`);
|
|
13458
|
+
console.log(purchaseLine(p));
|
|
13459
|
+
})
|
|
13460
|
+
);
|
|
13461
|
+
var payments = program.command("payments").description("how your agents may ask to pay");
|
|
13462
|
+
payments.command("link").description("your Link wallet connection").option("--json", "print as JSON").action(
|
|
13463
|
+
run2(async (opts) => {
|
|
13464
|
+
const wallet = await api("GET", "/payments/link");
|
|
13465
|
+
if (opts.json) {
|
|
13466
|
+
console.log(JSON.stringify(wallet, null, 2));
|
|
13467
|
+
return;
|
|
13468
|
+
}
|
|
13469
|
+
if (!wallet.available) console.log("Paying with Link is not available yet");
|
|
13470
|
+
else console.log(wallet.connected ? `Connected${wallet.email ? ` as ${wallet.email}` : ""} since ${wallet.connected_at?.slice(0, 10)}` : "Not connected. Run: sky payments connect");
|
|
13471
|
+
})
|
|
13472
|
+
);
|
|
13473
|
+
payments.command("connect").description("connect your Link wallet; you sign in to Link yourself").option("--no-open", "print the link instead of opening it").action(
|
|
13474
|
+
run2(async (opts) => {
|
|
13475
|
+
const { url } = await api("POST", "/payments/link/connect", {});
|
|
13476
|
+
console.log(`Open this page and sign in to Link:
|
|
13477
|
+
${url}`);
|
|
13478
|
+
if (opts.open !== false) openBrowser(url);
|
|
13479
|
+
})
|
|
13480
|
+
);
|
|
13481
|
+
payments.command("disconnect").description("disconnect your Link wallet; agents can no longer ask to pay with it").action(
|
|
13482
|
+
run2(async () => {
|
|
13483
|
+
await api("DELETE", "/payments/link");
|
|
13484
|
+
console.log("Link disconnected");
|
|
13485
|
+
})
|
|
13486
|
+
);
|
|
13202
13487
|
program.command("capabilities").description("deprecated: sky plugins list --view yours").option("--attention", "only what needs you: a sign-in or a permission").option("--json", "print as JSON").action(
|
|
13203
13488
|
run2(async (opts) => {
|
|
13204
13489
|
deprecatedCommand("capabilities", "list --view yours");
|
|
@@ -13209,22 +13494,22 @@ program.command("capabilities").description("deprecated: sky plugins list --view
|
|
|
13209
13494
|
);
|
|
13210
13495
|
var mcpCommand = program.command("mcp").description("the AgentSky MCP server on this computer");
|
|
13211
13496
|
mcpCommand.command("serve").description("serve the AgentSky MCP server's short tool list over stdio, for a program that starts its servers itself (the Claude app's chat, as `sky setup` registers it); each request is sent with the token sky holds at that moment").action(run2(async () => {
|
|
13212
|
-
const { serveMcp } = await import("./mcp-serve-
|
|
13497
|
+
const { serveMcp } = await import("./mcp-serve-5SHK5ASF.js");
|
|
13213
13498
|
await serveMcp();
|
|
13214
13499
|
}));
|
|
13215
13500
|
var compute = program.command("compute").description("the computers you set up with sky: the engines on each and whether each has the workspace's plugins, skills, capture and settings (the Compute group in Settings)");
|
|
13216
13501
|
compute.command("list", { isDefault: true }).description("every computer you set up with sky, newest report first, with what is not current on each engine").option("--json", "print the list as JSON").action(run2(async (opts) => {
|
|
13217
|
-
const { listComputeMachines, renderMachines } = await import("./compute-
|
|
13502
|
+
const { listComputeMachines, renderMachines } = await import("./compute-FTVP2A5T.js");
|
|
13218
13503
|
const machines = await listComputeMachines();
|
|
13219
13504
|
console.log(opts.json ? JSON.stringify({ machines }, null, 2) : renderMachines(machines));
|
|
13220
13505
|
}));
|
|
13221
13506
|
compute.command("repair <machine>").description("ask one of your computers to put its AgentSky setup right on its next scheduled run").option("--json", "print the answer as JSON").action(run2(async (machine, opts) => {
|
|
13222
|
-
const { requestRepair } = await import("./compute-
|
|
13507
|
+
const { requestRepair } = await import("./compute-FTVP2A5T.js");
|
|
13223
13508
|
const answer = await requestRepair(machine);
|
|
13224
13509
|
console.log(opts.json ? JSON.stringify({ machine: answer }, null, 2) : `${answer.name} repairs on its next run (at most 15 minutes while it is on).`);
|
|
13225
13510
|
}));
|
|
13226
13511
|
compute.command("remove <machine>").description("forget one of your computers; nothing on it changes (run `sky setup --remove` there to take AgentSky out)").action(run2(async (machine) => {
|
|
13227
|
-
const { removeMachine } = await import("./compute-
|
|
13512
|
+
const { removeMachine } = await import("./compute-FTVP2A5T.js");
|
|
13228
13513
|
await removeMachine(machine);
|
|
13229
13514
|
console.log(`Forgot ${machine}. It reports again on its next run unless \`sky setup --remove\` ran there.`);
|
|
13230
13515
|
}));
|
|
@@ -13303,7 +13588,7 @@ function emitBundle(bundle, out, what) {
|
|
|
13303
13588
|
console.log(`Exported ${what} to ${out}`);
|
|
13304
13589
|
}
|
|
13305
13590
|
function bundleBody(file, requestId2, extra = {}) {
|
|
13306
|
-
const text2 =
|
|
13591
|
+
const text2 = readFileSync28(file, "utf8");
|
|
13307
13592
|
let bundle;
|
|
13308
13593
|
try {
|
|
13309
13594
|
bundle = JSON.parse(text2);
|
|
@@ -13350,7 +13635,7 @@ db.command("get <namespace> <key>").description("print a value as JSON (--with-v
|
|
|
13350
13635
|
);
|
|
13351
13636
|
db.command("put <namespace> <key> [json]").description("store a JSON value (from the argument, or stdin when none is given)").option("--if-version <version>", 'write only while the key holds this version; "" writes only when it is absent').action(
|
|
13352
13637
|
run2(async (namespace, key, json, opts) => {
|
|
13353
|
-
const text2 = json ??
|
|
13638
|
+
const text2 = json ?? readFileSync28(0, "utf8");
|
|
13354
13639
|
let value;
|
|
13355
13640
|
try {
|
|
13356
13641
|
value = JSON.parse(text2);
|
|
@@ -13486,10 +13771,10 @@ browserProfile.command("import").description("import saved browser state into yo
|
|
|
13486
13771
|
const { readFileSync: rf } = await import("fs");
|
|
13487
13772
|
raw = rf(opts.file, "utf8");
|
|
13488
13773
|
} else {
|
|
13489
|
-
raw = await new Promise((
|
|
13774
|
+
raw = await new Promise((resolve14) => {
|
|
13490
13775
|
const chunks = [];
|
|
13491
13776
|
process.stdin.on("data", (d) => chunks.push(d));
|
|
13492
|
-
process.stdin.on("end", () =>
|
|
13777
|
+
process.stdin.on("end", () => resolve14(Buffer.concat(chunks).toString()));
|
|
13493
13778
|
});
|
|
13494
13779
|
}
|
|
13495
13780
|
const state = JSON.parse(raw);
|
|
@@ -13777,7 +14062,7 @@ notes.command("rm <storeId> <noteId>").description("delete one note from a works
|
|
|
13777
14062
|
notes.command("save <storeId> <file>").description("write a note from a local file: --path creates one, --note saves a new version of one").option("--path <path>", "path of a new note, e.g. /projects/launch.md").option("--note <noteId>", "the note to update").action(
|
|
13778
14063
|
run2(async (storeId, file, opts) => {
|
|
13779
14064
|
if (!opts.path === !opts.note) throw new Error("pass exactly one of --path (new note) or --note (update)");
|
|
13780
|
-
const content =
|
|
14065
|
+
const content = readFileSync28(file, "utf8");
|
|
13781
14066
|
const target2 = `/memory_stores/${encodeURIComponent(storeId)}/memories${opts.note ? `/${encodeURIComponent(opts.note)}` : ""}`;
|
|
13782
14067
|
const { memory: memory2 } = await api("POST", target2, { content, ...opts.path ? { path: opts.path } : {} });
|
|
13783
14068
|
console.log(`Saved ${memory2.path} (${memory2.id})`);
|
|
@@ -13795,7 +14080,7 @@ notes.command("export <storeId>").description("every current note of a store as
|
|
|
13795
14080
|
);
|
|
13796
14081
|
notes.command("import <storeId> <file>").description("create a store's notes from an export file in atomic batches of 100; rerunning the same import replays it instead of writing twice").option("--request-id <prefix>", "the replay key prefix for this import (default: derived from the file)").action(
|
|
13797
14082
|
run2(async (storeId, file, opts) => {
|
|
13798
|
-
const receipt = await importMemoryStore(storeId, parseMemoryExport(
|
|
14083
|
+
const receipt = await importMemoryStore(storeId, parseMemoryExport(readFileSync28(file, "utf8")), opts.requestId);
|
|
13799
14084
|
console.log(`Imported ${receipt.imported} notes`);
|
|
13800
14085
|
})
|
|
13801
14086
|
);
|
|
@@ -13893,7 +14178,7 @@ harness.command("connect").description("run an ACP agent (the command after --)
|
|
|
13893
14178
|
}));
|
|
13894
14179
|
var traceCmd = program.command("trace").description("correlate this machine's agent work with the cloud sessions it starts (metadata only unless you choose content)");
|
|
13895
14180
|
traceCmd.command("start").description("start a trace: a grant for this machine, a root span, and the spool the hooks write to").option("--name <name>", "a name for the task").option("--source <source>", "how this machine reports itself", "claude-code").option("--hooks [settings]", "also install the Claude Code hooks (default: ./.claude/settings.local.json)").option("--capture <scopes>", "also send content, redacted on this machine first: any of prompts,tool_output,files").option("--file <path>", "a file the files scope may send (repeatable)", collect).option("--dir <path>", "a folder whose files the files scope may send when a file tool touches them (repeatable)", collect).action(run2(async (opts) => {
|
|
13896
|
-
const { readState, writeState, record: record3, installClaudeHooks, parseContentScopes, chosenPaths, fileEvent } = await import("./trace-
|
|
14181
|
+
const { readState, writeState, record: record3, installClaudeHooks, parseContentScopes, chosenPaths, fileEvent } = await import("./trace-TDYK47MM.js");
|
|
13897
14182
|
if (readState()) throw new Error("a trace is already running here \u2014 `sky trace stop` it first");
|
|
13898
14183
|
const scopes = parseContentScopes(opts.capture);
|
|
13899
14184
|
const chosen = chosenPaths(opts.file ?? [], opts.dir ?? []);
|
|
@@ -13922,13 +14207,13 @@ traceCmd.command("start").description("start a trace: a grant for this machine,
|
|
|
13922
14207
|
]);
|
|
13923
14208
|
console.log(`Tracing ${trace.id} as ${opts.source} until ${grant.expires_at}`);
|
|
13924
14209
|
console.log(scopes.length ? ` content: ${scopes.join(", ")} (redacted here before it leaves)` : " metadata only");
|
|
13925
|
-
if (opts.hooks) console.log(` hooks: ${installClaudeHooks(
|
|
14210
|
+
if (opts.hooks) console.log(` hooks: ${installClaudeHooks(resolve13(typeof opts.hooks === "string" ? opts.hooks : ".claude/settings.local.json"))}`);
|
|
13926
14211
|
console.log(` a session started elsewhere joins it with metadata {"trace_id": "${trace.id}"}`);
|
|
13927
14212
|
console.log(` sky trace show ${trace.id}`);
|
|
13928
14213
|
}));
|
|
13929
14214
|
traceCmd.command("hook").description("record one Claude Code hook event read from stdin (run by the installed hooks; never fails, prints nothing)").action(async () => {
|
|
13930
14215
|
try {
|
|
13931
|
-
const { readState, record: record3, flush, grantSender, eventsForClaudeHook, contentForClaudeHook, clearState } = await import("./trace-
|
|
14216
|
+
const { readState, record: record3, flush, grantSender, eventsForClaudeHook, contentForClaudeHook, clearState } = await import("./trace-TDYK47MM.js");
|
|
13932
14217
|
const chunks = [];
|
|
13933
14218
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
13934
14219
|
const input = JSON.parse(Buffer.concat(chunks).toString("utf8") || "{}");
|
|
@@ -13941,14 +14226,14 @@ traceCmd.command("hook").description("record one Claude Code hook event read fro
|
|
|
13941
14226
|
}
|
|
13942
14227
|
});
|
|
13943
14228
|
traceCmd.command("flush").description("send what the spool holds, retrying with backoff").action(run2(async () => {
|
|
13944
|
-
const { readState, flush, grantSender } = await import("./trace-
|
|
14229
|
+
const { readState, flush, grantSender } = await import("./trace-TDYK47MM.js");
|
|
13945
14230
|
const state = readState();
|
|
13946
14231
|
if (!state) throw new Error("no trace is running here");
|
|
13947
14232
|
const outcome = await flush(grantSender(state), { attempts: 4 });
|
|
13948
14233
|
console.log(`sent ${outcome.sent}, refused ${outcome.refused}, given up ${outcome.expired}, still pending ${outcome.pending}${outcome.stopped ? ` (stopped: ${outcome.stopped})` : ""}`);
|
|
13949
14234
|
}));
|
|
13950
14235
|
traceCmd.command("status").description("the running trace and its spool").action(run2(async () => {
|
|
13951
|
-
const { readState, spoolStatus } = await import("./trace-
|
|
14236
|
+
const { readState, spoolStatus } = await import("./trace-TDYK47MM.js");
|
|
13952
14237
|
const state = readState();
|
|
13953
14238
|
if (!state) {
|
|
13954
14239
|
console.log("No trace is running here.");
|
|
@@ -13958,7 +14243,7 @@ traceCmd.command("status").description("the running trace and its spool").action
|
|
|
13958
14243
|
console.log(`${state.trace_id} as ${state.source}: ${spool.pending} pending, ${spool.dropped_full} dropped (spool full), ${spool.dropped_expired} given up, ${spool.refused} refused`);
|
|
13959
14244
|
}));
|
|
13960
14245
|
traceCmd.command("show [id]").description("the trace bundle: spans, the sessions they reach, cost counted once per session").option("--json", "print the bundle as JSON").action(run2(async (id2, opts) => {
|
|
13961
|
-
const { readState } = await import("./trace-
|
|
14246
|
+
const { readState } = await import("./trace-TDYK47MM.js");
|
|
13962
14247
|
const ref = id2 ?? readState()?.trace_id;
|
|
13963
14248
|
if (!ref) throw new Error("name a trace, or start one here");
|
|
13964
14249
|
const bundle = await api("GET", `/traces/${ref}`);
|
|
@@ -13985,7 +14270,7 @@ traceCmd.command("show [id]").description("the trace bundle: spans, the sessions
|
|
|
13985
14270
|
for (const gap of bundle.gaps) console.log(` gap: ${gap.span_id} ${gap.reason}`);
|
|
13986
14271
|
}));
|
|
13987
14272
|
traceCmd.command("stop").description("end the root span, send what is left, and revoke this machine's grant").action(run2(async () => {
|
|
13988
|
-
const { readState, record: record3, flush, grantSender, clearState } = await import("./trace-
|
|
14273
|
+
const { readState, record: record3, flush, grantSender, clearState } = await import("./trace-TDYK47MM.js");
|
|
13989
14274
|
const state = readState();
|
|
13990
14275
|
if (!state) throw new Error("no trace is running here");
|
|
13991
14276
|
if (state.root_span) record3(() => [{ span_id: state.root_span, kind: "end", outcome: "completed" }]);
|
|
@@ -13995,13 +14280,13 @@ traceCmd.command("stop").description("end the root span, send what is left, and
|
|
|
13995
14280
|
console.log(`Stopped ${state.trace_id}${outcome.pending ? ` (${outcome.pending} events could not be sent)` : ""}`);
|
|
13996
14281
|
}));
|
|
13997
14282
|
var recordCmd = traceCmd.command("record").description("record every Claude Code session on this machine with its environment into your own vault (~/.trace-vault); nothing is uploaded").option("--enable", "install the recording hooks and start recording new sessions").option("--disable", "remove the recording hooks; what was recorded stays in the vault").option("--vault <dir>", "with --enable: where to keep the vault (default ~/.trace-vault)").option("--max-size <size>", "keep the vault under this size (e.g. 20G); past it the oldest stored file contents are deleted first, never transcripts; 0 removes the cap").option("--settings <path>", "with --enable or --disable: the Claude Code settings file for the hooks (default ~/.claude/settings.json)").action(run2(async (opts) => {
|
|
13998
|
-
const { homedir:
|
|
14283
|
+
const { homedir: homedir12 } = await import("os");
|
|
13999
14284
|
const { join: join21 } = await import("path");
|
|
14000
14285
|
const vault2 = await import("./trace-vault-IUNYRVGZ.js");
|
|
14001
|
-
const { installClaudeHooks, uninstallClaudeHooks } = await import("./trace-
|
|
14286
|
+
const { installClaudeHooks, uninstallClaudeHooks } = await import("./trace-TDYK47MM.js");
|
|
14002
14287
|
const command = "sky trace record hook";
|
|
14003
14288
|
const config = vault2.loadVaultConfig();
|
|
14004
|
-
const settings =
|
|
14289
|
+
const settings = resolve13(opts.settings ?? config.settings ?? join21(process.env.CLAUDE_CONFIG_DIR ?? join21(homedir12(), ".claude"), "settings.json"));
|
|
14005
14290
|
if (opts.enable && opts.disable) throw new Error("choose --enable or --disable");
|
|
14006
14291
|
const maxBytes = opts.maxSize === void 0 ? config.max_bytes : opts.maxSize.trim() === "0" ? void 0 : vault2.parseSize(opts.maxSize);
|
|
14007
14292
|
if (opts.maxSize !== void 0 && !opts.enable && !opts.disable) {
|
|
@@ -14013,7 +14298,7 @@ var recordCmd = traceCmd.command("record").description("record every Claude Code
|
|
|
14013
14298
|
if (opts.enable) {
|
|
14014
14299
|
const switchedOff = await api("GET", "/preferences", void 0, { signal: AbortSignal.timeout(5e3) }).then((answer) => answer.preferences.task_collection === false, () => false);
|
|
14015
14300
|
if (switchedOff) throw new Error(`Task collection is turned off for your account, so recording stays off. Turn it back on first: sky api PATCH /preferences -d '{"task_collection": true}'`);
|
|
14016
|
-
const next = { enabled: true, vault:
|
|
14301
|
+
const next = { enabled: true, vault: resolve13(opts.vault ?? config.vault ?? join21(homedir12(), ".trace-vault")), settings, enabled_at: (/* @__PURE__ */ new Date()).toISOString(), max_bytes: maxBytes };
|
|
14017
14302
|
vault2.saveVaultConfig(next);
|
|
14018
14303
|
installClaudeHooks(settings, command, vault2.recordHooksConfig(command));
|
|
14019
14304
|
console.log(`Recording Claude Code sessions into ${next.vault}`);
|
|
@@ -14057,13 +14342,13 @@ recordCmd.command("hook").description("seal one segment at a Claude Code hook bo
|
|
|
14057
14342
|
recordCmd.command("seal <session-dir>").description("seal the cut segments of one recorded session (started by the hook in the background)").action(async (session2) => {
|
|
14058
14343
|
const vault2 = await import("./trace-vault-IUNYRVGZ.js");
|
|
14059
14344
|
try {
|
|
14060
|
-
await vault2.sealPending(
|
|
14345
|
+
await vault2.sealPending(resolve13(session2), { maxBytes: vault2.loadVaultConfig().max_bytes });
|
|
14061
14346
|
} catch (error) {
|
|
14062
|
-
vault2.markPartial(
|
|
14347
|
+
vault2.markPartial(resolve13(session2, "..", "..", ".."), session2.split(/[\\/]/).filter(Boolean).pop(), error);
|
|
14063
14348
|
}
|
|
14064
14349
|
});
|
|
14065
14350
|
traceCmd.command("sync [payload]").description("upload this machine's agent sessions (Claude Code, Codex, Cursor, Gemini CLI and every other agent `--agents` lists) to the matching workspace's trace library, redacted here first").option("--enable", "turn sync on for this machine").option("--disable", "turn sync off; nothing more is uploaded").option("--route <match=workspace>", "send sessions whose folder path contains <match> to <workspace> (repeatable; replaces the saved rules)", collect).option("--default <workspace>", "where a session no rule matches goes").option("--keep-local", "keep sessions no rule matches on this machine (the default)").option("--exclude <folder>", "never upload a session that ran in <folder> or below it, to the library or as a session (repeatable; shared with the AgentSky Mac app when it is installed)", collect).option("--unexclude <folder>", "stop excluding <folder> (repeatable)", collect).option("--session <ref>", "only this session: its id or transcript path (repeatable)", collect).option("--import <export>", "add a downloaded cloud export (claude.ai, ChatGPT, Gemini, Grok, DeepSeek \u2026: its .zip, folder or file) so sync uploads it (repeatable)", collect).option("--agents", "list the agents sync reads and which are on this machine").option("--full", "re-read every session, not only files that changed").option("--limit <n>", "at most this many changed sessions this run", (v) => Number.parseInt(v, 10)).option("--dry-run", "show what would be uploaded without uploading").option("--hook", "run from a Claude Code SessionEnd hook or Codex notify: upload that session in the background and return at once").option("--install-schedule", "also sweep every 15 minutes (macOS launchd)").option("--install-hooks", "also sync at the end of every Claude Code and Codex turn (their hook and notify settings)").option("--status", "what sync has done on this machine").option("--quiet", "print only failures").action(async (payload, opts) => {
|
|
14066
|
-
const lib = await import("./trace-library-
|
|
14351
|
+
const lib = await import("./trace-library-QDGMBGNH.js");
|
|
14067
14352
|
if (opts.hook) {
|
|
14068
14353
|
try {
|
|
14069
14354
|
let raw = payload ?? "";
|
|
@@ -14088,7 +14373,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
14088
14373
|
return;
|
|
14089
14374
|
}
|
|
14090
14375
|
if (opts.exclude || opts.unexclude) {
|
|
14091
|
-
const { changeExclusions, macSettingsPath } = await import("./trace-exclusions-
|
|
14376
|
+
const { changeExclusions, macSettingsPath } = await import("./trace-exclusions-JEGMUPWQ.js");
|
|
14092
14377
|
const { dirname: dirname13 } = await import("path");
|
|
14093
14378
|
const changed = changeExclusions(dirname13(lib.syncConfigPath()), { add: opts.exclude, remove: opts.unexclude });
|
|
14094
14379
|
console.log(changed.exclusions.folders.length ? "Sync never uploads sessions that ran in:" : "No folder is excluded.");
|
|
@@ -14133,9 +14418,9 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
14133
14418
|
if (opts.installHooks) for (const line2 of lib.installSyncHooks()) console.log(line2);
|
|
14134
14419
|
if (opts.installSchedule) {
|
|
14135
14420
|
const { join: join21 } = await import("path");
|
|
14136
|
-
const { homedir:
|
|
14421
|
+
const { homedir: homedir12 } = await import("os");
|
|
14137
14422
|
const { execFileSync } = await import("child_process");
|
|
14138
|
-
const log = join21(
|
|
14423
|
+
const log = join21(homedir12(), ".config", "sky", "trace-sync.log");
|
|
14139
14424
|
const plist = lib.installLaunchd([process.execPath, process.argv[1], "trace", "sync", "--quiet"], log);
|
|
14140
14425
|
try {
|
|
14141
14426
|
execFileSync("launchctl", ["unload", plist], { stdio: "ignore" });
|
|
@@ -14145,11 +14430,11 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
14145
14430
|
console.log(`Sweeping every 15 minutes (${plist}); a full re-read runs weekly. Log: ${log}`);
|
|
14146
14431
|
}
|
|
14147
14432
|
if (opts.status) {
|
|
14148
|
-
const { readFileSync:
|
|
14433
|
+
const { readFileSync: readFileSync29 } = await import("fs");
|
|
14149
14434
|
const { join: join21 } = await import("path");
|
|
14150
14435
|
let state = { sessions: {} };
|
|
14151
14436
|
try {
|
|
14152
|
-
state = JSON.parse(
|
|
14437
|
+
state = JSON.parse(readFileSync29(join21(lib.syncConfigPath(), "..", "trace-sync-state.json"), "utf8"));
|
|
14153
14438
|
} catch {
|
|
14154
14439
|
}
|
|
14155
14440
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -14159,7 +14444,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
14159
14444
|
}
|
|
14160
14445
|
console.log(`Trace sync is ${config.enabled ? "on" : "off"}${config.enabledAt ? ` (since ${config.enabledAt})` : ""}. Last full sweep: ${state.lastFullAt ?? "never"}.`);
|
|
14161
14446
|
for (const [label, count] of [...counts].sort((a, b) => b[1] - a[1])) console.log(` ${count} ${label}`);
|
|
14162
|
-
const { loadExclusions } = await import("./trace-exclusions-
|
|
14447
|
+
const { loadExclusions } = await import("./trace-exclusions-JEGMUPWQ.js");
|
|
14163
14448
|
for (const folder of loadExclusions(join21(lib.syncConfigPath(), "..")).folders) console.log(` excluded: ${folder}`);
|
|
14164
14449
|
return;
|
|
14165
14450
|
}
|
|
@@ -14176,7 +14461,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
14176
14461
|
return;
|
|
14177
14462
|
}
|
|
14178
14463
|
if (!opts.dryRun) {
|
|
14179
|
-
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-
|
|
14464
|
+
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-OZTUHDBD.js");
|
|
14180
14465
|
try {
|
|
14181
14466
|
const skills2 = await refreshLocalSkills({ hook: Boolean(opts.session?.length) });
|
|
14182
14467
|
if (skills2 && !opts.quiet) for (const line2 of describeLocalSkills(skills2)) console.log(line2);
|
|
@@ -14191,7 +14476,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
14191
14476
|
for (const error of report.errors.slice(0, 20)) console.error(` ${error}`);
|
|
14192
14477
|
}
|
|
14193
14478
|
if (!opts.session && !opts.dryRun) {
|
|
14194
|
-
const { upkeepComputer } = await import("./compute-report-
|
|
14479
|
+
const { upkeepComputer } = await import("./compute-report-743W5GPX.js");
|
|
14195
14480
|
const said = await upkeepComputer().catch((error) => `AgentSky could not check this computer's setup: ${error instanceof Error ? error.message : String(error)}`);
|
|
14196
14481
|
if (said) console.log(said);
|
|
14197
14482
|
}
|
|
@@ -14200,7 +14485,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
14200
14485
|
});
|
|
14201
14486
|
traceCmd.command("mac <machine>").description("which workspace's trace library one of your Macs fills; the AgentSky Mac app uploads that Mac's agent sessions there, redacted on the Mac first, exactly as `sky trace sync` would (machine ids: `sky api GET /desktop/machines`)").option("--on", "send this Mac's sessions to --workspace (or the current workspace), moving them from any other").option("--off", "stop this Mac's uploads to --workspace (or the current workspace)").option("--workspace <slug>", "the workspace to turn on or off (default: the current one)").option("--json", "print the answer as JSON").action(run2(async (machine, opts) => {
|
|
14202
14487
|
if (opts.on && opts.off) throw new Error("choose --on or --off");
|
|
14203
|
-
const { libraryRequest } = await import("./trace-library-
|
|
14488
|
+
const { libraryRequest } = await import("./trace-library-QDGMBGNH.js");
|
|
14204
14489
|
const workspace2 = opts.workspace ?? currentUniverse();
|
|
14205
14490
|
if (!workspace2) throw new Error("name a workspace with --workspace");
|
|
14206
14491
|
const answer = opts.on || opts.off ? await libraryRequest("PUT", `/trace-library/devices/${encodeURIComponent(machine)}`, workspace2, { enabled: Boolean(opts.on) }) : await libraryRequest("GET", `/trace-library/devices/${encodeURIComponent(machine)}`, workspace2);
|
|
@@ -14217,7 +14502,7 @@ traceCmd.command("search <query...>").description("search every session in a wor
|
|
|
14217
14502
|
console.log(opts.json ? JSON.stringify(page, null, 2) : renderContextPage(page));
|
|
14218
14503
|
}));
|
|
14219
14504
|
traceCmd.command("library").description("list the sessions in a workspace's trace library, most recently updated first").option("--workspace <slug>", "the workspace (default: the current one)").option("--limit <n>", "how many", (v) => Number.parseInt(v, 10), 20).option("--json", "print the page as JSON").action(run2(async (opts) => {
|
|
14220
|
-
const { libraryRequest } = await import("./trace-library-
|
|
14505
|
+
const { libraryRequest } = await import("./trace-library-QDGMBGNH.js");
|
|
14221
14506
|
const workspace2 = opts.workspace ?? currentUniverse();
|
|
14222
14507
|
if (!workspace2) throw new Error("name a workspace with --workspace");
|
|
14223
14508
|
const page = await libraryRequest("GET", `/trace-library?limit=${opts.limit}`, workspace2);
|