@agentsky/sky 3.45.0 → 3.47.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/agent-plugins/plugins/meetings/skills/agentsky-meetings/SKILL.md +1 -1
- package/dist/{chunk-7DFFA6GA.js → chunk-2OIW436E.js} +1 -1
- package/dist/{chunk-OYSSK6GS.js → chunk-6LQLH5CI.js} +47 -17
- package/dist/{mcp-serve-DXL7IMSU.js → chunk-AKCKFNLJ.js} +18 -5
- package/dist/{chunk-TPDNO2LM.js → chunk-I63VASQP.js} +43 -13
- package/dist/{chunk-UHEJFBZJ.js → chunk-IJOMMFEK.js} +5 -5
- package/dist/{chunk-MXIAK52Z.js → chunk-IZT53CAI.js} +15 -4
- package/dist/{chunk-AM6GOGA6.js → chunk-KX6JJECK.js} +176 -57
- package/dist/{chunk-WLTOVOTW.js → chunk-LM3WPNRW.js} +1 -1
- package/dist/{chunk-OBRH43HE.js → chunk-OXCZMLEZ.js} +10 -5
- package/dist/{chunk-WSQZHRE4.js → chunk-QTMW37EN.js} +2 -2
- package/dist/{chunk-EO32DG3Z.js → chunk-U25SCHLE.js} +21 -19
- package/dist/{chunk-YYDO5WB5.js → chunk-YYI5NQ35.js} +1 -1
- package/dist/{compute-OZ4TQBKO.js → compute-VNGFIQCD.js} +2 -2
- package/dist/compute-report-AAEKLNPM.js +39 -0
- package/dist/index.js +944 -767
- package/dist/{local-skills-E45ZCYGY.js → local-skills-RRJCNVLS.js} +3 -3
- package/dist/{local-skills-run-3CCDHJ6Q.js → local-skills-run-Y47FCKEL.js} +8 -8
- package/dist/mcp-serve-OLHMHG4M.js +16 -0
- package/dist/{trace-IRBLGOPZ.js → trace-PXIY5WUU.js} +3 -3
- package/dist/{trace-exclusions-SMBZES3R.js → trace-exclusions-HG5MF7NI.js} +2 -2
- package/dist/{trace-library-CRCV5JDF.js → trace-library-IUFJWBN3.js} +10 -8
- package/package.json +1 -1
- package/dist/compute-report-SGDLKR22.js +0 -34
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
askMac,
|
|
6
6
|
callDeviceTool,
|
|
7
7
|
captureNotice,
|
|
8
|
+
forgetComputer,
|
|
8
9
|
installCapture,
|
|
9
10
|
listDeviceTools,
|
|
10
11
|
listMacs,
|
|
@@ -16,47 +17,7 @@ import {
|
|
|
16
17
|
skyCommand,
|
|
17
18
|
takeBack,
|
|
18
19
|
waitForAnswer
|
|
19
|
-
} from "./chunk-
|
|
20
|
-
import {
|
|
21
|
-
SINGLE_REQUEST_MAX_BYTES,
|
|
22
|
-
codexThreadName,
|
|
23
|
-
importPathAllowed,
|
|
24
|
-
importReadAllowed,
|
|
25
|
-
loadedSkills,
|
|
26
|
-
repositoryRoot,
|
|
27
|
-
sharedInstructionPaths,
|
|
28
|
-
skillFiles,
|
|
29
|
-
transfer,
|
|
30
|
-
uploadLargeFile,
|
|
31
|
-
workspaceState
|
|
32
|
-
} from "./chunk-EO32DG3Z.js";
|
|
33
|
-
import "./chunk-UHEJFBZJ.js";
|
|
34
|
-
import "./chunk-YYDO5WB5.js";
|
|
35
|
-
import {
|
|
36
|
-
AGENT_TYPES,
|
|
37
|
-
MODEL_SUBSCRIPTION_PLAN_PHRASE,
|
|
38
|
-
MODEL_SUBSCRIPTION_PROVIDER_NAME,
|
|
39
|
-
REASONING_EFFORT_VALUES,
|
|
40
|
-
SessionSourceCollector,
|
|
41
|
-
capabilitiesSchema,
|
|
42
|
-
customDataSchema,
|
|
43
|
-
defaultLlm,
|
|
44
|
-
external_exports,
|
|
45
|
-
githubSkillRefSchema,
|
|
46
|
-
harnessProfileSchema,
|
|
47
|
-
isModelEffortSupported,
|
|
48
|
-
mcpServersFromKept,
|
|
49
|
-
modelSubscriptionProviderFor,
|
|
50
|
-
preinstalledManifest,
|
|
51
|
-
reasoningEffortDocLine,
|
|
52
|
-
redactLine,
|
|
53
|
-
redactPlainText,
|
|
54
|
-
redactSecretValues,
|
|
55
|
-
splitMcpServers,
|
|
56
|
-
storeSkillRefSchema,
|
|
57
|
-
supersededBy,
|
|
58
|
-
unsafeNumberSpans
|
|
59
|
-
} from "./chunk-AM6GOGA6.js";
|
|
20
|
+
} from "./chunk-I63VASQP.js";
|
|
60
21
|
import {
|
|
61
22
|
SetupJournal,
|
|
62
23
|
TOKEN_ENV,
|
|
@@ -81,8 +42,12 @@ import {
|
|
|
81
42
|
withdrawInvite,
|
|
82
43
|
workspaceSlug,
|
|
83
44
|
writeShellEnv
|
|
84
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-IZT53CAI.js";
|
|
85
46
|
import {
|
|
47
|
+
shortToolCount
|
|
48
|
+
} from "./chunk-AKCKFNLJ.js";
|
|
49
|
+
import {
|
|
50
|
+
NO_TOOLS,
|
|
86
51
|
detectClaudeApp,
|
|
87
52
|
detectHermes,
|
|
88
53
|
detectLocalAgents,
|
|
@@ -98,7 +63,20 @@ import {
|
|
|
98
63
|
systemCommandRunner,
|
|
99
64
|
withoutSettingsBlock,
|
|
100
65
|
writeSettingsBlocks
|
|
101
|
-
} from "./chunk-
|
|
66
|
+
} from "./chunk-6LQLH5CI.js";
|
|
67
|
+
import {
|
|
68
|
+
SINGLE_REQUEST_MAX_BYTES,
|
|
69
|
+
codexThreadName,
|
|
70
|
+
importPathAllowed,
|
|
71
|
+
importReadAllowed,
|
|
72
|
+
loadedSkills,
|
|
73
|
+
repositoryRoot,
|
|
74
|
+
sharedInstructionPaths,
|
|
75
|
+
skillFiles,
|
|
76
|
+
transfer,
|
|
77
|
+
uploadLargeFile,
|
|
78
|
+
workspaceState
|
|
79
|
+
} from "./chunk-U25SCHLE.js";
|
|
102
80
|
import {
|
|
103
81
|
ApiError,
|
|
104
82
|
api,
|
|
@@ -112,21 +90,22 @@ import {
|
|
|
112
90
|
streamEvents,
|
|
113
91
|
uploadFile,
|
|
114
92
|
writeResponseFile
|
|
115
|
-
} from "./chunk-
|
|
93
|
+
} from "./chunk-LM3WPNRW.js";
|
|
94
|
+
import "./chunk-IJOMMFEK.js";
|
|
116
95
|
import {
|
|
117
96
|
skillTargets,
|
|
118
97
|
syncLocalSkills
|
|
119
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-QTMW37EN.js";
|
|
120
99
|
import {
|
|
121
100
|
SKILL_NAME,
|
|
122
101
|
installSkill,
|
|
123
102
|
isInstalledSkill,
|
|
124
103
|
skillPaths
|
|
125
|
-
} from "./chunk-
|
|
104
|
+
} from "./chunk-OXCZMLEZ.js";
|
|
126
105
|
import {
|
|
127
106
|
CLI_VERSION,
|
|
128
107
|
USER_AGENT
|
|
129
|
-
} from "./chunk-
|
|
108
|
+
} from "./chunk-2OIW436E.js";
|
|
130
109
|
import {
|
|
131
110
|
apiBase,
|
|
132
111
|
apiToken,
|
|
@@ -136,32 +115,35 @@ import {
|
|
|
136
115
|
loadConfig,
|
|
137
116
|
saveConfig
|
|
138
117
|
} from "./chunk-XHZJG3QT.js";
|
|
118
|
+
import "./chunk-YYI5NQ35.js";
|
|
119
|
+
import {
|
|
120
|
+
AGENT_TYPES,
|
|
121
|
+
MODEL_SUBSCRIPTION_PLAN_PHRASE,
|
|
122
|
+
MODEL_SUBSCRIPTION_PROVIDER_NAME,
|
|
123
|
+
REASONING_EFFORT_VALUES,
|
|
124
|
+
SHOW_KINDS,
|
|
125
|
+
SessionSourceCollector,
|
|
126
|
+
capabilitiesSchema,
|
|
127
|
+
customDataSchema,
|
|
128
|
+
defaultLlm,
|
|
129
|
+
external_exports,
|
|
130
|
+
githubSkillRefSchema,
|
|
131
|
+
harnessProfileSchema,
|
|
132
|
+
isModelEffortSupported,
|
|
133
|
+
mcpServersFromKept,
|
|
134
|
+
modelSubscriptionProviderFor,
|
|
135
|
+
preinstalledManifest,
|
|
136
|
+
reasoningEffortDocLine,
|
|
137
|
+
redactLine,
|
|
138
|
+
redactPlainText,
|
|
139
|
+
redactSecretValues,
|
|
140
|
+
splitMcpServers,
|
|
141
|
+
storeSkillRefSchema,
|
|
142
|
+
supersededBy,
|
|
143
|
+
unsafeNumberSpans
|
|
144
|
+
} from "./chunk-KX6JJECK.js";
|
|
139
145
|
import "./chunk-MLKGABMK.js";
|
|
140
146
|
|
|
141
|
-
// ../../packages/spec/src/session-show.ts
|
|
142
|
-
var SHOW_KINDS = ["artifact", "browser", "pull_request", "changes", "story", "schedules", "notes", "status_update", "background_tasks", "files"];
|
|
143
|
-
var SHOW_OPENS_ON = Object.fromEntries(
|
|
144
|
-
SHOW_KINDS.map((kind) => [kind, ["web", "mac"]])
|
|
145
|
-
);
|
|
146
|
-
var id = external_exports.string().min(1).max(200);
|
|
147
|
-
var bare = (kind) => external_exports.object({ kind: external_exports.literal(kind) }).strict();
|
|
148
|
-
var showResourceSchema = external_exports.discriminatedUnion("kind", [
|
|
149
|
-
external_exports.object({ kind: external_exports.literal("artifact"), id, version: external_exports.number().int().positive().optional() }).strict(),
|
|
150
|
-
external_exports.object({ kind: external_exports.literal("pull_request"), url: external_exports.string().regex(/^https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/pull\/\d+$/) }).strict(),
|
|
151
|
-
bare("browser"),
|
|
152
|
-
bare("changes"),
|
|
153
|
-
bare("story"),
|
|
154
|
-
bare("schedules"),
|
|
155
|
-
bare("notes"),
|
|
156
|
-
bare("status_update"),
|
|
157
|
-
bare("background_tasks"),
|
|
158
|
-
bare("files")
|
|
159
|
-
]);
|
|
160
|
-
var showRequestSchema = external_exports.object({
|
|
161
|
-
resource: showResourceSchema,
|
|
162
|
-
request_id: external_exports.string().regex(/^[A-Za-z0-9_-]{8,128}$/).optional()
|
|
163
|
-
}).strict();
|
|
164
|
-
|
|
165
147
|
// src/session-show.ts
|
|
166
148
|
var SHOW_KIND_CHOICES = SHOW_KINDS;
|
|
167
149
|
function showBody(options) {
|
|
@@ -181,11 +163,11 @@ async function showInPanel(session2, options) {
|
|
|
181
163
|
|
|
182
164
|
// src/artifact-lifecycle.ts
|
|
183
165
|
import { readFileSync, writeFileSync } from "fs";
|
|
184
|
-
var
|
|
166
|
+
var id = external_exports.string().min(1).max(200);
|
|
185
167
|
var request = external_exports.string().min(16).max(120);
|
|
186
168
|
var uuid = external_exports.string().uuid();
|
|
187
169
|
var integer = (value) => external_exports.number().int().nonnegative().safe().parse(Number(value));
|
|
188
|
-
var seg = (value) => encodeURIComponent(
|
|
170
|
+
var seg = (value) => encodeURIComponent(id.parse(value));
|
|
189
171
|
var output = (value) => console.log(JSON.stringify(value, null, 2));
|
|
190
172
|
function artifactActivationOperation(operation, target2, options = {}) {
|
|
191
173
|
const path2 = `/artifacts/adoptions/${seg(target2)}/activation`;
|
|
@@ -194,7 +176,7 @@ function artifactActivationOperation(operation, target2, options = {}) {
|
|
|
194
176
|
return api("POST", operation === "prepare" ? path2 : `${path2}/${operation}`, { request_id: request.parse(options.requestId) });
|
|
195
177
|
}
|
|
196
178
|
function sourceArtifactActivationOperation(operation, source, options) {
|
|
197
|
-
const selector = { target_id:
|
|
179
|
+
const selector = { target_id: id.parse(options.target), request_id: request.parse(options.requestId) };
|
|
198
180
|
const path2 = `/consumer/artifact-activations/${seg(source)}`;
|
|
199
181
|
if (operation === "proof" || operation === "history") return api("GET", `${path2}${operation === "history" ? "/history" : ""}?${new URLSearchParams({ ...selector, ...options.after === void 0 ? {} : { after: String(integer(options.after)) } })}`);
|
|
200
182
|
return api("POST", operation === "prepare" ? path2 : `${path2}/${operation}`, selector);
|
|
@@ -249,7 +231,7 @@ function registerArtifactLifecycleCommands(artifact2) {
|
|
|
249
231
|
}
|
|
250
232
|
activation.command("source-original <source> <version>").description("download exact retained raw source bytes during activation").requiredOption("--target <id>", "canonical target").requiredOption("--request-id <id>", "exact activation request").requiredOption("-o, --out <path>", "raw bytes destination").action(async (source, version, options) => {
|
|
251
233
|
const selected = external_exports.number().int().positive().safe().parse(Number(version));
|
|
252
|
-
const query = new URLSearchParams({ target_id:
|
|
234
|
+
const query = new URLSearchParams({ target_id: id.parse(options.target), request_id: request.parse(options.requestId) });
|
|
253
235
|
const result = await apiBytes("GET", `/consumer/artifact-activations/${seg(source)}/revisions/${selected}?${query}`);
|
|
254
236
|
writeFileSync(options.out, result.bytes);
|
|
255
237
|
});
|
|
@@ -263,12 +245,12 @@ function registerArtifactLifecycleCommands(artifact2) {
|
|
|
263
245
|
["claim", content.command("source-claim <source>")],
|
|
264
246
|
["settle", content.command("source-settle <source>")],
|
|
265
247
|
["close", content.command("source-close <source>")]
|
|
266
|
-
]) command.description(`${operation} one purpose-bound source admission; same caller and exact request`).requiredOption("--target <id>", "canonical target").requiredOption("--request-id <uuid>", "exact UUID content request").action(async (source, options) => output(await api("POST", `/consumer/artifact-content/${seg(source)}/${operation}`, { target_id:
|
|
248
|
+
]) command.description(`${operation} one purpose-bound source admission; same caller and exact request`).requiredOption("--target <id>", "canonical target").requiredOption("--request-id <uuid>", "exact UUID content request").action(async (source, options) => output(await api("POST", `/consumer/artifact-content/${seg(source)}/${operation}`, { target_id: id.parse(options.target), request_id: uuid.parse(options.requestId) })));
|
|
267
249
|
const artifactReclamation = artifact2.command("reclamation").description("retired owner files: durable actual-byte reclamation and original capacity release");
|
|
268
250
|
artifactReclamation.command("read <id>").description("read exact reclamation progress; owner write scope required").requiredOption("--request-id <uuid>", "exact reclamation request").action(async (target2, options) => output(await api("GET", `/artifacts/${seg(target2)}/reclamation?${new URLSearchParams({ request_id: uuid.parse(options.requestId) })}`)));
|
|
269
251
|
artifactReclamation.command("reclaim <id>").description("reclaim actual retained bytes after explicit retirement; resume the same UUID after any failure").requiredOption("--request-id <uuid>", "stable reclamation request").action(async (target2, options) => output(await api("POST", `/artifacts/${seg(target2)}/reclamation`, { request_id: uuid.parse(options.requestId) })));
|
|
270
252
|
const artifactPolicy = artifact2.command("policy").description("adopted-file owner policy, exact workspace/alias grants and public pins");
|
|
271
|
-
artifactPolicy.command("read <id>").option("--alias-id <id>", "inspect only this exact managed alias; no other grants, placement or tokens").action(async (target2, options) => output(await api("GET", `/artifacts/${seg(target2)}/policy${options.aliasId === void 0 ? "" : `?${new URLSearchParams({ alias_id:
|
|
253
|
+
artifactPolicy.command("read <id>").option("--alias-id <id>", "inspect only this exact managed alias; no other grants, placement or tokens").action(async (target2, options) => output(await api("GET", `/artifacts/${seg(target2)}/policy${options.aliasId === void 0 ? "" : `?${new URLSearchParams({ alias_id: id.parse(options.aliasId) })}`}`)));
|
|
272
254
|
artifactPolicy.command("change <id>").description("apply one owner change using exact UUID/base_policy_version/base_version; conflicts require re-read").requiredOption("--input <path>", "JSON request with share, place, alias or retire change").action(async (target2, options) => output(await api("POST", `/artifacts/${seg(target2)}/policy`, JSON.parse(readFileSync(options.input, "utf8")))));
|
|
273
255
|
artifact2.command("original <id>").description("download exact retained original bytes of an adopted file").option("--version <version>", "retained version; default current").requiredOption("-o, --out <path>", "raw bytes destination").action(async (target2, options) => {
|
|
274
256
|
const suffix = options.version === void 0 ? "" : `?version=${external_exports.number().int().positive().safe().parse(Number(options.version))}`;
|
|
@@ -286,9 +268,9 @@ function requestId(value) {
|
|
|
286
268
|
if (value.length < 16 || value.length > 120) throw new Error("request_id must contain 16 to 120 characters.");
|
|
287
269
|
return value;
|
|
288
270
|
}
|
|
289
|
-
function artifactAdoptionOperation(operation,
|
|
290
|
-
const encoded = encodeURIComponent(identifier(
|
|
291
|
-
if (operation === "request") return api("POST", "/artifacts/adoptions", { request_id: requestId(options.requestId ?? ""), source_namespace: "agent-use", source_id:
|
|
271
|
+
function artifactAdoptionOperation(operation, id2, options = {}) {
|
|
272
|
+
const encoded = encodeURIComponent(identifier(id2, operation === "request" ? 128 : 200));
|
|
273
|
+
if (operation === "request") return api("POST", "/artifacts/adoptions", { request_id: requestId(options.requestId ?? ""), source_namespace: "agent-use", source_id: id2 });
|
|
292
274
|
if (operation === "read") return api("GET", `/artifacts/adoptions/${encoded}`);
|
|
293
275
|
if (operation === "verify") return api("POST", `/artifacts/adoptions/${encoded}/verify`);
|
|
294
276
|
if (operation === "cancel") return api("POST", `/artifacts/adoptions/${encoded}/cancel`, { request_id: requestId(options.requestId ?? "") });
|
|
@@ -312,16 +294,16 @@ function registerArtifactAdoptionCommands(artifact2) {
|
|
|
312
294
|
const print = (value) => console.log(JSON.stringify(value, null, 2));
|
|
313
295
|
adoption.command("list").description("read whether new adoptions can start, and your unfinished ones").action(async () => print(await listArtifactAdoptions()));
|
|
314
296
|
const upgrade = artifact2.command("upgrade").description("upgrade one older consumer file: its history, links and sharing move to canonical ownership");
|
|
315
|
-
upgrade.command("status <source>").description("read where this file's upgrade stands").action(async (
|
|
316
|
-
upgrade.command("advance <source>").description("run the next idempotent step; repeat until stage is active").option("--accept-one-way", "accept that a complete copy cannot be undone; required to freeze and copy").action(async (
|
|
317
|
-
upgrade.command("cancel <source>").description("cancel before copying finishes; resumes an interrupted cancel").action(async (
|
|
318
|
-
adoption.command("request <source>").description("create an inactive intent; reuse request id on retry").requiredOption("--request-id <id>", "stable request id, 16 to 120 characters").action(async (
|
|
319
|
-
adoption.command("read <target>").description("read your immutable intent (write scope)").action(async (
|
|
320
|
-
adoption.command("verify <target>").description("verify prepared source provenance; target stays inactive").action(async (
|
|
321
|
-
adoption.command("cancel <target>").description("retire the canonical intent before cancel-source").requiredOption("--request-id <id>", "the intent's exact request id").action(async (
|
|
322
|
-
adoption.command("prepare <source>").description("bind source provenance for your concrete intent").requiredOption("--target <id>", "the canonical target id").requiredOption("--request-id <id>", "the intent's exact request id").action(async (
|
|
323
|
-
adoption.command("proof <source>").description("read current source proof (write scope)").requiredOption("--target <id>", "the canonical target id").requiredOption("--request-id <id>", "the intent's exact request id").action(async (
|
|
324
|
-
adoption.command("cancel-source <source>").description("clear retired intent binding; retains the epoch").requiredOption("--target <id>", "the canonical target id").requiredOption("--request-id <id>", "the intent's exact request id").action(async (
|
|
297
|
+
upgrade.command("status <source>").description("read where this file's upgrade stands").action(async (id2) => print(await artifactUpgradeOperation("status", id2)));
|
|
298
|
+
upgrade.command("advance <source>").description("run the next idempotent step; repeat until stage is active").option("--accept-one-way", "accept that a complete copy cannot be undone; required to freeze and copy").action(async (id2, opts) => print(await artifactUpgradeOperation("advance", id2, opts)));
|
|
299
|
+
upgrade.command("cancel <source>").description("cancel before copying finishes; resumes an interrupted cancel").action(async (id2) => print(await artifactUpgradeOperation("cancel", id2)));
|
|
300
|
+
adoption.command("request <source>").description("create an inactive intent; reuse request id on retry").requiredOption("--request-id <id>", "stable request id, 16 to 120 characters").action(async (id2, opts) => print(await artifactAdoptionOperation("request", id2, opts)));
|
|
301
|
+
adoption.command("read <target>").description("read your immutable intent (write scope)").action(async (id2) => print(await artifactAdoptionOperation("read", id2)));
|
|
302
|
+
adoption.command("verify <target>").description("verify prepared source provenance; target stays inactive").action(async (id2) => print(await artifactAdoptionOperation("verify", id2)));
|
|
303
|
+
adoption.command("cancel <target>").description("retire the canonical intent before cancel-source").requiredOption("--request-id <id>", "the intent's exact request id").action(async (id2, opts) => print(await artifactAdoptionOperation("cancel", id2, opts)));
|
|
304
|
+
adoption.command("prepare <source>").description("bind source provenance for your concrete intent").requiredOption("--target <id>", "the canonical target id").requiredOption("--request-id <id>", "the intent's exact request id").action(async (id2, opts) => print(await artifactAdoptionOperation("prepare", id2, opts)));
|
|
305
|
+
adoption.command("proof <source>").description("read current source proof (write scope)").requiredOption("--target <id>", "the canonical target id").requiredOption("--request-id <id>", "the intent's exact request id").action(async (id2, opts) => print(await artifactAdoptionOperation("proof", id2, opts)));
|
|
306
|
+
adoption.command("cancel-source <source>").description("clear retired intent binding; retains the epoch").requiredOption("--target <id>", "the canonical target id").requiredOption("--request-id <id>", "the intent's exact request id").action(async (id2, opts) => print(await artifactAdoptionOperation("cancel-source", id2, opts)));
|
|
325
307
|
}
|
|
326
308
|
|
|
327
309
|
// src/thread-experience.ts
|
|
@@ -661,51 +643,51 @@ function registerMacControlCommands(mac2) {
|
|
|
661
643
|
|
|
662
644
|
// src/personal-arena.ts
|
|
663
645
|
var root = "/arena/personal";
|
|
664
|
-
var match = (
|
|
646
|
+
var match = (id2) => `${root}/${encodeURIComponent(id2)}`;
|
|
665
647
|
function readPersonalArenaBoards() {
|
|
666
648
|
return api("GET", `${root}/boards`);
|
|
667
649
|
}
|
|
668
650
|
function readPersonalArena() {
|
|
669
651
|
return api("GET", root);
|
|
670
652
|
}
|
|
671
|
-
function readPersonalArenaMatch(
|
|
672
|
-
return api("GET", match(
|
|
653
|
+
function readPersonalArenaMatch(id2) {
|
|
654
|
+
return api("GET", match(id2));
|
|
673
655
|
}
|
|
674
656
|
function startPersonalArenaPreset(input) {
|
|
675
657
|
return api("POST", root, input);
|
|
676
658
|
}
|
|
677
|
-
function votePersonalArena(
|
|
678
|
-
return api("POST", `${match(
|
|
659
|
+
function votePersonalArena(id2, input) {
|
|
660
|
+
return api("POST", `${match(id2)}/vote`, input);
|
|
679
661
|
}
|
|
680
|
-
function readPersonalArenaComments(
|
|
681
|
-
return api("GET", `${match(
|
|
662
|
+
function readPersonalArenaComments(id2) {
|
|
663
|
+
return api("GET", `${match(id2)}/comment`);
|
|
682
664
|
}
|
|
683
|
-
function publishPersonalArenaComment(
|
|
684
|
-
return api("POST", `${match(
|
|
665
|
+
function publishPersonalArenaComment(id2, body, consent) {
|
|
666
|
+
return api("POST", `${match(id2)}/comment`, { body, consent });
|
|
685
667
|
}
|
|
686
|
-
function removePersonalArenaComment(
|
|
687
|
-
return api("DELETE", `${match(
|
|
668
|
+
function removePersonalArenaComment(id2) {
|
|
669
|
+
return api("DELETE", `${match(id2)}/comment`);
|
|
688
670
|
}
|
|
689
671
|
function registerPersonalArenaCommands(program2) {
|
|
690
672
|
const arena = program2.command("personal-arena").description("your Arena match, verdict and comments; preset comparisons use normal usage pricing");
|
|
691
673
|
const print = (value) => console.log(JSON.stringify(value, null, 2));
|
|
692
674
|
arena.command("boards").description("read runnable paid presets, public quotes and harness boards").action(async () => print(await readPersonalArenaBoards()));
|
|
693
675
|
arena.command("state").description("read standings and your unfinished match in the selected workspace").action(async () => print(await readPersonalArena()));
|
|
694
|
-
arena.command("read <id>").description("read your match; blind contestants stay masked until your verdict").action(async (
|
|
676
|
+
arena.command("read <id>").description("read your match; blind contestants stay masked until your verdict").action(async (id2) => print(await readPersonalArenaMatch(id2)));
|
|
695
677
|
arena.command("start <preset>").description("start a paid preset comparison; free Arena matches are retired").requiredOption("--task <text>", "task for all contestants").requiredOption("--request-id <id>", "stable retry identity, 16\u2013100 letters, digits, dashes or underscores").requiredOption("--billing <normal>", "normal usage pricing; must be normal").option("--timezone <zone>", "IANA timezone").action(async (preset, options) => {
|
|
696
678
|
if (options.billing !== "normal") throw new Error("Pass --billing normal to use normal usage pricing.");
|
|
697
679
|
print(await startPersonalArenaPreset({ ...options, preset, billing: "normal" }));
|
|
698
680
|
});
|
|
699
|
-
arena.command("vote <id>").description("record your owned match verdict and reveal contestants; cannot vote twice").option("--winner <column>", "winning column id").option("--outcome <outcome>", "win, tie or both_bad").option("--why <reasons...>", "vote reasons").option("--ranking <columns...>", "whole contestant order, best first").option("--failures <json>", "failure tags by contestant column id").option("--comment <text>", "public comment under your credited name").option("--publish-comment", "consent to publishing the comment publicly").action(async (
|
|
681
|
+
arena.command("vote <id>").description("record your owned match verdict and reveal contestants; cannot vote twice").option("--winner <column>", "winning column id").option("--outcome <outcome>", "win, tie or both_bad").option("--why <reasons...>", "vote reasons").option("--ranking <columns...>", "whole contestant order, best first").option("--failures <json>", "failure tags by contestant column id").option("--comment <text>", "public comment under your credited name").option("--publish-comment", "consent to publishing the comment publicly").action(async (id2, options) => {
|
|
700
682
|
if (options.outcome !== void 0 && !["win", "tie", "both_bad"].includes(options.outcome)) throw new Error("outcome must be win, tie or both_bad");
|
|
701
683
|
if (options.comment?.trim() && !options.publishComment) throw new Error("Pass --publish-comment to publish your comment publicly.");
|
|
702
684
|
const failures = options.failures === void 0 ? void 0 : JSON.parse(options.failures);
|
|
703
685
|
if (failures !== void 0 && (!failures || typeof failures !== "object" || Array.isArray(failures) || !Object.values(failures).every((tags) => Array.isArray(tags) && tags.every((tag) => typeof tag === "string")))) throw new Error("failures must be a JSON object of string arrays");
|
|
704
|
-
print(await votePersonalArena(
|
|
686
|
+
print(await votePersonalArena(id2, { winnerColumnId: options.winner, outcome: options.outcome, why: options.why, ranking: options.ranking, failures, comment: options.comment, commentConsent: options.publishComment }));
|
|
705
687
|
});
|
|
706
|
-
arena.command("comments <id>").description("read your comment and public comments on the decided lineup").action(async (
|
|
707
|
-
arena.command("comment <id> <body>").description("publish one public comment on your decided match").requiredOption("--consent", "consent to public display under your credited name").action(async (
|
|
708
|
-
arena.command("remove-comment <id>").description("remove your own comment; staff-hidden comments remain hidden").action(async (
|
|
688
|
+
arena.command("comments <id>").description("read your comment and public comments on the decided lineup").action(async (id2) => print(await readPersonalArenaComments(id2)));
|
|
689
|
+
arena.command("comment <id> <body>").description("publish one public comment on your decided match").requiredOption("--consent", "consent to public display under your credited name").action(async (id2, body, options) => print(await publishPersonalArenaComment(id2, body, options.consent)));
|
|
690
|
+
arena.command("remove-comment <id>").description("remove your own comment; staff-hidden comments remain hidden").action(async (id2) => print(await removePersonalArenaComment(id2)));
|
|
709
691
|
}
|
|
710
692
|
|
|
711
693
|
// src/gateway.ts
|
|
@@ -739,10 +721,10 @@ function registerGatewayCommands(gatewayCommand2) {
|
|
|
739
721
|
if (opts.json) print(discounts);
|
|
740
722
|
else console.log(renderDiscounts(discounts));
|
|
741
723
|
});
|
|
742
|
-
gatewayCommand2.command("try <kind> <id>").description("try a catalog item's sample request (kind: model or tool). Without --yes it only shows the request and its cost; with it the call is billed to your balance").option("-y, --yes", "run it and be billed").option("--request-id <id>", "reuse on retry so a tool run is not started twice").option("--json", "print as JSON").action(async (kind,
|
|
724
|
+
gatewayCommand2.command("try <kind> <id>").description("try a catalog item's sample request (kind: model or tool). Without --yes it only shows the request and its cost; with it the call is billed to your balance").option("-y, --yes", "run it and be billed").option("--request-id <id>", "reuse on retry so a tool run is not started twice").option("--json", "print as JSON").action(async (kind, id2, opts) => {
|
|
743
725
|
const chosen = kindOf(kind);
|
|
744
726
|
if (!opts.yes) {
|
|
745
|
-
const preview = await api("GET", `/gateway/try?${new URLSearchParams({ kind: chosen, id:
|
|
727
|
+
const preview = await api("GET", `/gateway/try?${new URLSearchParams({ kind: chosen, id: id2 })}`);
|
|
746
728
|
if (opts.json) print(preview);
|
|
747
729
|
else console.log(`${preview.costNote}
|
|
748
730
|
POST ${preview.request.path}
|
|
@@ -750,12 +732,12 @@ ${JSON.stringify(preview.request.body, null, 2)}
|
|
|
750
732
|
Nothing was sent. Add --yes to run it.`);
|
|
751
733
|
return;
|
|
752
734
|
}
|
|
753
|
-
const result = await api("POST", "/gateway/try", { kind: chosen, id:
|
|
735
|
+
const result = await api("POST", "/gateway/try", { kind: chosen, id: id2 }, opts.requestId ? { idempotencyKey: opts.requestId } : {});
|
|
754
736
|
if (opts.json) print(result);
|
|
755
737
|
else console.log(renderTry(result));
|
|
756
738
|
});
|
|
757
|
-
gatewayCommand2.command("run <id> <run_id>").description("read a tool run a try started; costs nothing").option("--json", "print as JSON").action(async (
|
|
758
|
-
const result = await api("GET", `/gateway/try/${encodeURIComponent(runId)}?${new URLSearchParams({ id:
|
|
739
|
+
gatewayCommand2.command("run <id> <run_id>").description("read a tool run a try started; costs nothing").option("--json", "print as JSON").action(async (id2, runId, opts) => {
|
|
740
|
+
const result = await api("GET", `/gateway/try/${encodeURIComponent(runId)}?${new URLSearchParams({ id: id2 })}`);
|
|
759
741
|
if (opts.json) print(result);
|
|
760
742
|
else console.log(renderTry(result));
|
|
761
743
|
});
|
|
@@ -911,7 +893,7 @@ async function getTask(task) {
|
|
|
911
893
|
}
|
|
912
894
|
function answerBody(answer) {
|
|
913
895
|
if ([answer.option, answer.text, answer.fileIds].filter((value) => Array.isArray(value) ? value.length > 0 : Boolean(value)).length !== 1) throw new Error("give exactly one of --option, --text or --file-ids");
|
|
914
|
-
if (answer.fileIds && (!answer.fileIds.length || answer.fileIds.length > 20 || answer.fileIds.some((
|
|
896
|
+
if (answer.fileIds && (!answer.fileIds.length || answer.fileIds.length > 20 || answer.fileIds.some((id2) => !/^file_[A-Za-z0-9_-]+$/.test(id2)))) throw new Error("give 1-20 uploaded file IDs");
|
|
915
897
|
if (answer.fileIds && !answer.expectedQuestion) throw new Error("file answers require the question from get_session_status");
|
|
916
898
|
return { ...answer.fileIds ? { file_ids: answer.fileIds, expected_question: answer.expectedQuestion } : answer.option ? { option_id: answer.option } : { text: answer.text }, ...answer.note ? { note: answer.note } : {} };
|
|
917
899
|
}
|
|
@@ -1055,11 +1037,17 @@ var PLUGIN_USES = [
|
|
|
1055
1037
|
{ use: "this_mac", label: "On this Mac" }
|
|
1056
1038
|
];
|
|
1057
1039
|
var PLUGIN_STATUS_LABEL = { added: "Added", needs_you: "Needs you", available: "Available", off: "Off" };
|
|
1040
|
+
var PLUGIN_CHIPS = [
|
|
1041
|
+
...PLUGIN_USES.filter((chip) => chip.use !== "this_mac"),
|
|
1042
|
+
{ use: "skills", label: "Skills" },
|
|
1043
|
+
{ use: "this_mac", label: "On this Mac" }
|
|
1044
|
+
];
|
|
1058
1045
|
var MULTIPLE_PROVIDERS_ID = "multiple";
|
|
1046
|
+
var AGENTSKY_PROVIDER_ID = "agentsky";
|
|
1059
1047
|
var MULTIPLE_PROVIDERS = "Multiple providers";
|
|
1060
1048
|
function priceLine(plugin, translate) {
|
|
1061
1049
|
const provider = plugin.provider.name.trim().toLowerCase();
|
|
1062
|
-
const repeats = !provider || [plugin.name, plugin.description].some((text2) => text2.trim().toLowerCase() === provider);
|
|
1050
|
+
const repeats = !provider || plugin.provider.id === AGENTSKY_PROVIDER_ID || [plugin.name, plugin.description].some((text2) => text2.trim().toLowerCase() === provider);
|
|
1063
1051
|
const price = translate ? catalogText(plugin.price.display, translate) : plugin.price.display;
|
|
1064
1052
|
const name = plugin.provider.id === MULTIPLE_PROVIDERS_ID && translate ? translate(MULTIPLE_PROVIDERS) : plugin.provider.name;
|
|
1065
1053
|
return repeats ? price : [name, price].filter(Boolean).join(" \xB7 ");
|
|
@@ -1170,30 +1158,30 @@ function skillForm(dir, fields = {}) {
|
|
|
1170
1158
|
async function uploadSkillPlugin(dir, name) {
|
|
1171
1159
|
return apiForm("POST", "/plugins", skillForm(dir, { name }));
|
|
1172
1160
|
}
|
|
1173
|
-
async function saveSkillPluginRevision(
|
|
1161
|
+
async function saveSkillPluginRevision(id2, dir, expectedLatestRevision) {
|
|
1174
1162
|
const form = skillForm(dir, { expectedLatestRevision });
|
|
1175
1163
|
form.delete("displayName");
|
|
1176
|
-
return apiForm("POST", `/plugins/${encodeURIComponent(
|
|
1164
|
+
return apiForm("POST", `/plugins/${encodeURIComponent(id2)}/revisions`, form);
|
|
1177
1165
|
}
|
|
1178
|
-
async function listPluginRevisions(
|
|
1179
|
-
return (await pluginRevisionHistory(
|
|
1166
|
+
async function listPluginRevisions(id2) {
|
|
1167
|
+
return (await pluginRevisionHistory(id2)).revisions;
|
|
1180
1168
|
}
|
|
1181
|
-
async function pluginRevisionHistory(
|
|
1182
|
-
return api("GET", `/plugins/${encodeURIComponent(
|
|
1169
|
+
async function pluginRevisionHistory(id2) {
|
|
1170
|
+
return api("GET", `/plugins/${encodeURIComponent(id2)}/revisions`);
|
|
1183
1171
|
}
|
|
1184
|
-
async function rollbackPlugin(
|
|
1185
|
-
return api("PATCH", `/plugins/${encodeURIComponent(
|
|
1172
|
+
async function rollbackPlugin(id2, revision, expectedRevision) {
|
|
1173
|
+
return api("PATCH", `/plugins/${encodeURIComponent(id2)}`, { rollback_revision: revision, expected_revision: expectedRevision });
|
|
1186
1174
|
}
|
|
1187
|
-
async function deletePluginRevision(
|
|
1188
|
-
await api("DELETE", `/plugins/${encodeURIComponent(
|
|
1175
|
+
async function deletePluginRevision(id2, revisionId) {
|
|
1176
|
+
await api("DELETE", `/plugins/${encodeURIComponent(id2)}/revisions/${encodeURIComponent(revisionId)}`);
|
|
1189
1177
|
}
|
|
1190
|
-
async function readPluginFile(
|
|
1191
|
-
const file = await api("GET", `/plugins/${encodeURIComponent(
|
|
1178
|
+
async function readPluginFile(id2, revisionId, path2) {
|
|
1179
|
+
const file = await api("GET", `/plugins/${encodeURIComponent(id2)}/revisions/${encodeURIComponent(revisionId)}/content?path=${encodeURIComponent(path2)}`);
|
|
1192
1180
|
if (!file || typeof file !== "object" || file.path !== path2 || typeof file.content !== "string") throw new ApiError(502, "invalid_response", "The skill file response did not contain the requested text file.");
|
|
1193
1181
|
if (file.content.includes("\0")) throw new ApiError(415, "unsupported_media_type", "This binary file cannot be printed as text");
|
|
1194
1182
|
return file.content;
|
|
1195
1183
|
}
|
|
1196
|
-
async function removePlugin(
|
|
1184
|
+
async function removePlugin(id2, options = {}) {
|
|
1197
1185
|
const params = new URLSearchParams();
|
|
1198
1186
|
if (options.connection) params.set("connection_id", options.connection);
|
|
1199
1187
|
if (options.disconnect) params.set("disconnect", "true");
|
|
@@ -1202,22 +1190,22 @@ async function removePlugin(id3, options = {}) {
|
|
|
1202
1190
|
if (options.uninstall) params.set("uninstall", "true");
|
|
1203
1191
|
if (options.confirm) params.set("confirm", "true");
|
|
1204
1192
|
const query = params.size ? `?${params}` : "";
|
|
1205
|
-
return api("DELETE", `/plugins/${encodeURIComponent(
|
|
1193
|
+
return api("DELETE", `/plugins/${encodeURIComponent(id2)}${query}`);
|
|
1206
1194
|
}
|
|
1207
|
-
async function showPlugin(
|
|
1208
|
-
return api("GET", `/plugins/${encodeURIComponent(
|
|
1195
|
+
async function showPlugin(id2) {
|
|
1196
|
+
return api("GET", `/plugins/${encodeURIComponent(id2)}`);
|
|
1209
1197
|
}
|
|
1210
1198
|
function target(where) {
|
|
1211
1199
|
if (Boolean(where.agent) === Boolean(where.session)) throw new Error("pass exactly one of --agent or --session");
|
|
1212
1200
|
return where.agent ? { agent_id: where.agent } : { session_id: where.session };
|
|
1213
1201
|
}
|
|
1214
|
-
async function addPlugin(
|
|
1202
|
+
async function addPlugin(id2, options) {
|
|
1215
1203
|
if (options.mcpUrl) {
|
|
1216
|
-
if (
|
|
1204
|
+
if (id2) throw new Error("pass a plugin id or --mcp-url, not both");
|
|
1217
1205
|
return api("POST", "/plugins", { mcp_url: options.mcpUrl, ...options.name ? { name: options.name } : {}, ...options.note ? { note: options.note } : {}, ...options.token ? { token: options.token } : {}, ...options.agent ? { agent_id: options.agent } : {}, ...options.skipCheck ? { skip_check: true } : {} });
|
|
1218
1206
|
}
|
|
1219
|
-
if (!
|
|
1220
|
-
return api("POST", `/plugins/${encodeURIComponent(
|
|
1207
|
+
if (!id2) throw new Error("name the plugin to add (sky plugins list --view discover), or pass --mcp-url");
|
|
1208
|
+
return api("POST", `/plugins/${encodeURIComponent(id2)}/add`, {
|
|
1221
1209
|
...options.agent ? { agent_id: options.agent } : {},
|
|
1222
1210
|
...options.session ? { session_id: options.session } : {},
|
|
1223
1211
|
...options.source ? { source: options.source } : {},
|
|
@@ -1225,38 +1213,38 @@ async function addPlugin(id3, options) {
|
|
|
1225
1213
|
...options.request ? { request_id: options.request } : {}
|
|
1226
1214
|
});
|
|
1227
1215
|
}
|
|
1228
|
-
async function updateMcpServer(
|
|
1216
|
+
async function updateMcpServer(id2, options) {
|
|
1229
1217
|
if (options.name === void 0 && options.note === void 0 && options.token === void 0) throw new Error("pass --name, --note or --token");
|
|
1230
|
-
return api("PATCH", `/plugins/${encodeURIComponent(
|
|
1218
|
+
return api("PATCH", `/plugins/${encodeURIComponent(id2)}`, {
|
|
1231
1219
|
...options.name !== void 0 ? { name: options.name } : {},
|
|
1232
1220
|
...options.note !== void 0 ? { note: options.note || null } : {},
|
|
1233
1221
|
...options.token !== void 0 ? { token: options.token } : {},
|
|
1234
1222
|
...options.skipCheck ? { skip_check: true } : {}
|
|
1235
1223
|
});
|
|
1236
1224
|
}
|
|
1237
|
-
async function setPluginOff(
|
|
1238
|
-
return api("PUT", `/plugins/${encodeURIComponent(
|
|
1225
|
+
async function setPluginOff(id2, where, off) {
|
|
1226
|
+
return api("PUT", `/plugins/${encodeURIComponent(id2)}/off`, { ...target(where), off });
|
|
1239
1227
|
}
|
|
1240
|
-
async function sharePlugin(
|
|
1241
|
-
return api("POST", `/plugins/${encodeURIComponent(
|
|
1228
|
+
async function sharePlugin(id2, options) {
|
|
1229
|
+
return api("POST", `/plugins/${encodeURIComponent(id2)}/share`, {
|
|
1242
1230
|
workspace: options.workspace,
|
|
1243
1231
|
...options.apiKey ? { api_key: options.apiKey } : {},
|
|
1244
1232
|
...options.allKeys ? { all_api_keys: true } : {},
|
|
1245
1233
|
...options.connection ? { connection_id: options.connection } : {}
|
|
1246
1234
|
});
|
|
1247
1235
|
}
|
|
1248
|
-
async function unsharePlugin(
|
|
1236
|
+
async function unsharePlugin(id2, options) {
|
|
1249
1237
|
const params = new URLSearchParams({ workspace: options.workspace });
|
|
1250
1238
|
if (options.apiKey) params.set("api_key", options.apiKey);
|
|
1251
1239
|
if (options.allKeys) params.set("all_api_keys", "true");
|
|
1252
1240
|
if (options.connection) params.set("connection_id", options.connection);
|
|
1253
|
-
return api("DELETE", `/plugins/${encodeURIComponent(
|
|
1241
|
+
return api("DELETE", `/plugins/${encodeURIComponent(id2)}/share?${params}`);
|
|
1254
1242
|
}
|
|
1255
|
-
async function setPluginWhenToUse(
|
|
1256
|
-
return api("PATCH", `/plugins/${encodeURIComponent(
|
|
1243
|
+
async function setPluginWhenToUse(id2, connection, whenToUse) {
|
|
1244
|
+
return api("PATCH", `/plugins/${encodeURIComponent(id2)}`, { connection_id: connection, when_to_use: whenToUse });
|
|
1257
1245
|
}
|
|
1258
|
-
async function answerPlugin(
|
|
1259
|
-
return api("PUT", `/plugins/${encodeURIComponent(
|
|
1246
|
+
async function answerPlugin(id2, where) {
|
|
1247
|
+
return api("PUT", `/plugins/${encodeURIComponent(id2)}/answer`, { ...target(where), ...where.connection ? { connection_id: where.connection } : {} });
|
|
1260
1248
|
}
|
|
1261
1249
|
function renderAdd(answer) {
|
|
1262
1250
|
const lines2 = [answer.status === "added" ? `Added ${answer.plugin_id}.` : `${answer.plugin_id} needs you to finish:`];
|
|
@@ -1264,8 +1252,8 @@ function renderAdd(answer) {
|
|
|
1264
1252
|
for (const step of answer.next?.steps ?? []) lines2.push(` ${step}`);
|
|
1265
1253
|
return lines2.join("\n");
|
|
1266
1254
|
}
|
|
1267
|
-
async function requestPlugin(
|
|
1268
|
-
return api("POST", `/plugins/${encodeURIComponent(
|
|
1255
|
+
async function requestPlugin(id2, session2) {
|
|
1256
|
+
return api("POST", `/plugins/${encodeURIComponent(id2)}/request`, { session_id: session2 });
|
|
1269
1257
|
}
|
|
1270
1258
|
function renderRequest2(answer) {
|
|
1271
1259
|
if (answer.status === "available") return `${answer.plugin_id} can be used now.`;
|
|
@@ -1275,17 +1263,17 @@ function renderRequest2(answer) {
|
|
|
1275
1263
|
async function draftPlugin(path2, task) {
|
|
1276
1264
|
return api("POST", "/plugins/drafts", { task_id: task, path: path2 });
|
|
1277
1265
|
}
|
|
1278
|
-
async function readPluginDraft(
|
|
1279
|
-
return api("GET", `/plugins/drafts/${encodeURIComponent(
|
|
1266
|
+
async function readPluginDraft(id2) {
|
|
1267
|
+
return api("GET", `/plugins/drafts/${encodeURIComponent(id2)}`);
|
|
1280
1268
|
}
|
|
1281
|
-
async function testPluginDraft(
|
|
1282
|
-
return api("POST", `/plugins/drafts/${encodeURIComponent(
|
|
1269
|
+
async function testPluginDraft(id2, revision) {
|
|
1270
|
+
return api("POST", `/plugins/drafts/${encodeURIComponent(id2)}/test`, { revision });
|
|
1283
1271
|
}
|
|
1284
|
-
async function readPluginTest(
|
|
1285
|
-
return api("GET", `/plugins/drafts/${encodeURIComponent(
|
|
1272
|
+
async function readPluginTest(id2, run3) {
|
|
1273
|
+
return api("GET", `/plugins/drafts/${encodeURIComponent(id2)}/tests/${encodeURIComponent(run3)}`);
|
|
1286
1274
|
}
|
|
1287
|
-
async function proposePluginDraft(
|
|
1288
|
-
return api("POST", `/plugins/drafts/${encodeURIComponent(
|
|
1275
|
+
async function proposePluginDraft(id2, revision, options = {}) {
|
|
1276
|
+
return api("POST", `/plugins/drafts/${encodeURIComponent(id2)}/propose`, { revision, target: options.target ?? "me", ...options.note ? { note: options.note } : {} });
|
|
1289
1277
|
}
|
|
1290
1278
|
function renderPropose(answer) {
|
|
1291
1279
|
if (answer.status === "installed") return `${answer.plugin?.name ?? answer.draft_id} is installed.`;
|
|
@@ -1334,9 +1322,9 @@ function renderPlugin(plugin) {
|
|
|
1334
1322
|
for (const gap of plugin.unavailable) lines2.push(` (${gap.message})`);
|
|
1335
1323
|
return lines2.join("\n");
|
|
1336
1324
|
}
|
|
1337
|
-
async function pluginShares(
|
|
1325
|
+
async function pluginShares(id2, connection) {
|
|
1338
1326
|
const query = connection ? `?${new URLSearchParams({ connection_id: connection })}` : "";
|
|
1339
|
-
return api("GET", `/plugins/${encodeURIComponent(
|
|
1327
|
+
return api("GET", `/plugins/${encodeURIComponent(id2)}/share${query}`);
|
|
1340
1328
|
}
|
|
1341
1329
|
function renderShares(answer) {
|
|
1342
1330
|
if (!answer.connections.length) return `you have no connection of ${answer.plugin_id}`;
|
|
@@ -1348,8 +1336,8 @@ function renderShares(answer) {
|
|
|
1348
1336
|
...row.workspaces.length || row.api_keys.length ? [] : [" not shared"]
|
|
1349
1337
|
]).join("\n");
|
|
1350
1338
|
}
|
|
1351
|
-
async function callPlugin(
|
|
1352
|
-
return api("POST", `/plugins/${encodeURIComponent(
|
|
1339
|
+
async function callPlugin(id2, call) {
|
|
1340
|
+
return api("POST", `/plugins/${encodeURIComponent(id2)}/call`, {
|
|
1353
1341
|
url: call.url,
|
|
1354
1342
|
...call.method ? { method: call.method } : {},
|
|
1355
1343
|
...call.headers && Object.keys(call.headers).length ? { headers: call.headers } : {},
|
|
@@ -1357,14 +1345,14 @@ async function callPlugin(id3, call) {
|
|
|
1357
1345
|
...call.connection ? { connection_id: call.connection } : {}
|
|
1358
1346
|
});
|
|
1359
1347
|
}
|
|
1360
|
-
async function callDeclaredPluginAction(
|
|
1348
|
+
async function callDeclaredPluginAction(id2, options) {
|
|
1361
1349
|
if (!options.input || typeof options.input !== "object" || Array.isArray(options.input) || Object.values(options.input).some((value) => typeof value !== "string")) throw new Error("--input must be a JSON object of text fields");
|
|
1362
|
-
const plugin = await api("GET", `/plugins/${encodeURIComponent(
|
|
1350
|
+
const plugin = await api("GET", `/plugins/${encodeURIComponent(id2)}?session_id=${encodeURIComponent(options.session)}`);
|
|
1363
1351
|
const matches = (plugin.contributions ?? []).flatMap((view2) => options.view && view2.id !== options.view ? [] : (view2.actions ?? []).filter((action2) => action2.id === options.action).map((action2) => ({ view: view2, action: action2 })));
|
|
1364
1352
|
if (matches.length !== 1) throw new Error(matches.length ? "Choose the view with --view" : "That declared action is unavailable");
|
|
1365
1353
|
const { view, action } = matches[0];
|
|
1366
1354
|
if (view.read_only) throw new Error("That view is read-only for this Session");
|
|
1367
|
-
return api("POST", `/plugins/${encodeURIComponent(
|
|
1355
|
+
return api("POST", `/plugins/${encodeURIComponent(id2)}/call`, {
|
|
1368
1356
|
operation_id: action.operation_id,
|
|
1369
1357
|
revision_id: view.revision_id,
|
|
1370
1358
|
view_id: view.id,
|
|
@@ -1381,9 +1369,9 @@ async function includedRows(include) {
|
|
|
1381
1369
|
const page = await listPluginResources({ view: "yours", source: "app", include: [include] });
|
|
1382
1370
|
return Array.isArray(page[include]) ? page[include] : [];
|
|
1383
1371
|
}
|
|
1384
|
-
async function exportPlugin(
|
|
1372
|
+
async function exportPlugin(id2, format) {
|
|
1385
1373
|
const param = ["codex", "claude", "grok"].includes(format) ? "format" : "target";
|
|
1386
|
-
return api("GET", `/plugins/${encodeURIComponent(
|
|
1374
|
+
return api("GET", `/plugins/${encodeURIComponent(id2)}/export?${param}=${encodeURIComponent(format)}`);
|
|
1387
1375
|
}
|
|
1388
1376
|
async function exportMarketplace(format, options = {}) {
|
|
1389
1377
|
return api("GET", `/plugins/marketplace.json?format=${encodeURIComponent(format)}${options.localSkills ? "&skills=local" : ""}`);
|
|
@@ -1450,7 +1438,7 @@ function registerPlatformParityCommands(program2, channel2) {
|
|
|
1450
1438
|
}
|
|
1451
1439
|
|
|
1452
1440
|
// src/setup.ts
|
|
1453
|
-
import { existsSync as existsSync8, mkdirSync as mkdirSync4, readFileSync as
|
|
1441
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync4, readdirSync as readdirSync6, readFileSync as readFileSync14, writeFileSync as writeFileSync5 } from "fs";
|
|
1454
1442
|
import { homedir as homedir8 } from "os";
|
|
1455
1443
|
import { dirname as dirname7, join as join13 } from "path";
|
|
1456
1444
|
import { createInterface as createInterface2 } from "readline";
|
|
@@ -2326,10 +2314,10 @@ function listCodexSessions(limit) {
|
|
|
2326
2314
|
}
|
|
2327
2315
|
}
|
|
2328
2316
|
walk(sessionsDir);
|
|
2329
|
-
function descendants(
|
|
2330
|
-
if (visited.has(
|
|
2331
|
-
visited.add(
|
|
2332
|
-
return records.filter((item) => item.parent ===
|
|
2317
|
+
function descendants(id2, visited) {
|
|
2318
|
+
if (visited.has(id2)) return [];
|
|
2319
|
+
visited.add(id2);
|
|
2320
|
+
return records.filter((item) => item.parent === id2).flatMap((item) => [
|
|
2333
2321
|
...item.session.files,
|
|
2334
2322
|
...descendants(item.session.sessionId, visited)
|
|
2335
2323
|
]);
|
|
@@ -2451,8 +2439,8 @@ function prepareImport(session2, summaryPath, options = {}) {
|
|
|
2451
2439
|
if (rec.type === "compacted") {
|
|
2452
2440
|
compactionCount++;
|
|
2453
2441
|
}
|
|
2454
|
-
const
|
|
2455
|
-
if (!nativeId && typeof
|
|
2442
|
+
const id2 = rec.type === "session_meta" ? rec.payload?.id : rec.sessionId;
|
|
2443
|
+
if (!nativeId && typeof id2 === "string") nativeId = id2;
|
|
2456
2444
|
const result = redactLine(raw.replace(/\r$/, ""), { requireStructured: true });
|
|
2457
2445
|
if (Object.keys(result.hits).length > 0) redactionCount++;
|
|
2458
2446
|
const line2 = result.line + "\n";
|
|
@@ -3129,7 +3117,7 @@ function findLocalSecrets(agents, home = homedir6()) {
|
|
|
3129
3117
|
}
|
|
3130
3118
|
|
|
3131
3119
|
// src/plugin-install.ts
|
|
3132
|
-
import { existsSync as existsSync6, rmSync as rmSync3 } from "fs";
|
|
3120
|
+
import { existsSync as existsSync6, readFileSync as readFileSync12, rmSync as rmSync3 } from "fs";
|
|
3133
3121
|
import { dirname as dirname6, join as join11 } from "path";
|
|
3134
3122
|
import { fileURLToPath } from "url";
|
|
3135
3123
|
var PLUGIN_ENGINES = {
|
|
@@ -3165,7 +3153,10 @@ function macPluginsDir() {
|
|
|
3165
3153
|
const dir = join11(dirname6(fileURLToPath(import.meta.url)), "..", "agent-plugins");
|
|
3166
3154
|
return existsSync6(join11(dir, ".claude-plugin", "marketplace.json")) ? dir : null;
|
|
3167
3155
|
}
|
|
3168
|
-
|
|
3156
|
+
function macPluginNames(dir) {
|
|
3157
|
+
const market2 = JSON.parse(readFileSync12(join11(dir, ".claude-plugin", "marketplace.json"), "utf8"));
|
|
3158
|
+
return (market2.plugins ?? []).map((plugin) => plugin.name).filter((name) => typeof name === "string");
|
|
3159
|
+
}
|
|
3169
3160
|
function pluginsRoot() {
|
|
3170
3161
|
return join11(dirname6(configPath()), "plugins");
|
|
3171
3162
|
}
|
|
@@ -3209,7 +3200,7 @@ async function installPlugins(opts = {}) {
|
|
|
3209
3200
|
const registered = engine.format !== "codex" && (opts.registered ?? hasMcpServer)(agent2);
|
|
3210
3201
|
const sources = [
|
|
3211
3202
|
{ dir: written.dir, market: written.market.name, plugins: written.market.plugins.map((plugin) => plugin.name).filter((name) => !(registered && name === "agentsky")) },
|
|
3212
|
-
...macDir ? [{ dir: macDir, market: "agentsky", plugins:
|
|
3203
|
+
...macDir ? [{ dir: macDir, market: "agentsky", plugins: macPluginNames(macDir) }] : []
|
|
3213
3204
|
];
|
|
3214
3205
|
const install = { agent: agent2.id, outcome: opts.dryRun ? "planned" : "installed", marketplace: written.market.name, plugins: [] };
|
|
3215
3206
|
if (registered) install.plugins.push({ name: "agentsky", outcome: "skipped", detail: "the agentsky MCP server is already registered" });
|
|
@@ -3246,7 +3237,7 @@ async function installPlugins(opts = {}) {
|
|
|
3246
3237
|
|
|
3247
3238
|
// src/subscriptions.ts
|
|
3248
3239
|
import { spawn as spawn3 } from "child_process";
|
|
3249
|
-
import { existsSync as existsSync7, readFileSync as
|
|
3240
|
+
import { existsSync as existsSync7, readFileSync as readFileSync13 } from "fs";
|
|
3250
3241
|
import { homedir as homedir7 } from "os";
|
|
3251
3242
|
import { join as join12 } from "path";
|
|
3252
3243
|
import { createInterface } from "readline";
|
|
@@ -3348,7 +3339,7 @@ function codexSignIn(env = process.env, home = homedir7()) {
|
|
|
3348
3339
|
if (!existsSync7(path2)) {
|
|
3349
3340
|
throw new ApiError(404, "no_codex_auth", `no ${path2} \u2014 run \`codex login\` first`);
|
|
3350
3341
|
}
|
|
3351
|
-
const raw =
|
|
3342
|
+
const raw = readFileSync13(path2, "utf8");
|
|
3352
3343
|
try {
|
|
3353
3344
|
const parsed = JSON.parse(raw);
|
|
3354
3345
|
return { path: path2, raw, account: parsed.tokens?.account_id };
|
|
@@ -3361,7 +3352,7 @@ function cursorSignIn(env = process.env, home = homedir7()) {
|
|
|
3361
3352
|
if (!existsSync7(path2)) {
|
|
3362
3353
|
throw new ApiError(404, "no_cursor_auth", `no ${path2} \u2014 run \`cursor-agent login\` first`);
|
|
3363
3354
|
}
|
|
3364
|
-
const raw =
|
|
3355
|
+
const raw = readFileSync13(path2, "utf8");
|
|
3365
3356
|
try {
|
|
3366
3357
|
const parsed = JSON.parse(raw);
|
|
3367
3358
|
if (typeof parsed.accessToken !== "string" || typeof parsed.refreshToken !== "string") throw new Error("shape");
|
|
@@ -3589,7 +3580,7 @@ function reportPath() {
|
|
|
3589
3580
|
}
|
|
3590
3581
|
function loadReport() {
|
|
3591
3582
|
try {
|
|
3592
|
-
const saved = JSON.parse(
|
|
3583
|
+
const saved = JSON.parse(readFileSync14(reportPath(), "utf8"));
|
|
3593
3584
|
return { agents: saved.agents ?? [], plans: saved.plans ?? [], ...saved.secrets ? { secrets: saved.secrets } : {} };
|
|
3594
3585
|
} catch {
|
|
3595
3586
|
return { agents: [], plans: [] };
|
|
@@ -3705,10 +3696,12 @@ function describe(event) {
|
|
|
3705
3696
|
case "computer":
|
|
3706
3697
|
return event.outcome === "reported" ? " this computer is listed under Settings \u203A Compute" : ` this computer could not be listed under Settings \u203A Compute: ${event.detail ?? "unknown error"}`;
|
|
3707
3698
|
case "removed": {
|
|
3708
|
-
|
|
3699
|
+
const computer = event.computer?.outcome === "removed" ? [" this computer is no longer listed under Settings \u203A Compute"] : event.computer?.outcome === "failed" ? [` this computer is still listed under Settings \u203A Compute: ${event.computer.detail ?? "unknown error"}`] : [];
|
|
3700
|
+
if (!event.results.length) return ["Setup had changed nothing on this computer.", ...computer].join("\n");
|
|
3709
3701
|
const changed = event.results.filter((item) => item.outcome !== "unchanged");
|
|
3710
3702
|
return [
|
|
3711
3703
|
...changed.map((item) => ` ${item.outcome === "entries_removed" ? "took setup's entries out of" : item.outcome === "left" ? "left" : item.outcome} ${item.path}${item.detail ? ` (${item.detail})` : ""}`),
|
|
3704
|
+
...computer,
|
|
3712
3705
|
"Removed what setup added. Your sign-in stays; `sky auth logout` removes it. Plugins an agent installed with its own command line stay in that agent."
|
|
3713
3706
|
].join("\n");
|
|
3714
3707
|
}
|
|
@@ -3728,14 +3721,15 @@ function pluginFiles(agent2) {
|
|
|
3728
3721
|
if (agent2.id === "codex" || agent2.id === "grok") return [join13(agent2.root, "config.toml")];
|
|
3729
3722
|
return [];
|
|
3730
3723
|
}
|
|
3731
|
-
function removeSetup(opts = {}) {
|
|
3724
|
+
async function removeSetup(opts = {}) {
|
|
3732
3725
|
const runner = opts.deps?.runner ?? systemCommandRunner();
|
|
3733
3726
|
const journal = opts.deps?.journal ?? new SetupJournal();
|
|
3734
3727
|
const platform = opts.deps?.platform ?? process.platform;
|
|
3728
|
+
const computer = await forgetComputer();
|
|
3735
3729
|
const results = journal.restore((label) => {
|
|
3736
3730
|
if (platform === "darwin") runner.run("launchctl", ["unload", join13(homedir8(), "Library", "LaunchAgents", `${label}.plist`)]);
|
|
3737
3731
|
});
|
|
3738
|
-
const event = { type: "removed", results };
|
|
3732
|
+
const event = { type: "removed", results, ...computer ? { computer } : {} };
|
|
3739
3733
|
if (opts.json) console.log(JSON.stringify(event));
|
|
3740
3734
|
else console.log(describe(event));
|
|
3741
3735
|
return results;
|
|
@@ -3808,17 +3802,29 @@ async function readCatalog() {
|
|
|
3808
3802
|
}
|
|
3809
3803
|
async function runSetup(opts) {
|
|
3810
3804
|
if (opts.remove) {
|
|
3811
|
-
removeSetup(opts);
|
|
3805
|
+
await removeSetup(opts);
|
|
3812
3806
|
return;
|
|
3813
3807
|
}
|
|
3814
3808
|
const journal = opts.deps?.journal ?? new SetupJournal();
|
|
3809
|
+
const afterwards = [];
|
|
3815
3810
|
try {
|
|
3816
|
-
await setUp(opts, journal);
|
|
3811
|
+
await setUp(opts, journal, afterwards);
|
|
3817
3812
|
} finally {
|
|
3813
|
+
for (const settle of afterwards) settle();
|
|
3818
3814
|
if (!opts.dryRun) journal.save();
|
|
3819
3815
|
}
|
|
3820
3816
|
}
|
|
3821
|
-
|
|
3817
|
+
function keepClaudeCodeSideEffects(agent2, journal) {
|
|
3818
|
+
journal.track(join13(agent2.root, "settings.json"));
|
|
3819
|
+
const backups = join13(agent2.root, "backups");
|
|
3820
|
+
const before = new Set(existsSync8(backups) ? readdirSync6(backups) : []);
|
|
3821
|
+
if (!existsSync8(backups)) journal.own(backups);
|
|
3822
|
+
return () => {
|
|
3823
|
+
if (!existsSync8(backups)) return;
|
|
3824
|
+
for (const name of readdirSync6(backups)) if (!before.has(name)) journal.adopt(join13(backups, name));
|
|
3825
|
+
};
|
|
3826
|
+
}
|
|
3827
|
+
async function setUp(opts, journal, afterwards = []) {
|
|
3822
3828
|
const steps = opts.steps?.length ? opts.steps : [...SETUP_STEPS];
|
|
3823
3829
|
const interactive = !opts.json && !opts.yes && !opts.dryRun;
|
|
3824
3830
|
const runner = opts.deps?.runner ?? systemCommandRunner();
|
|
@@ -3834,7 +3840,7 @@ async function setUp(opts, journal) {
|
|
|
3834
3840
|
const track = (path2, entries = []) => {
|
|
3835
3841
|
if (!opts.dryRun) journal.track(path2, entries);
|
|
3836
3842
|
};
|
|
3837
|
-
const named = opts.agents?.filter((
|
|
3843
|
+
const named = opts.agents?.filter((id2) => id2 !== "hermes" && id2 !== "claude_app");
|
|
3838
3844
|
let agents = opts.agents?.length && !named?.length ? [] : selectLocalAgents(named);
|
|
3839
3845
|
const hermes = !opts.agents?.length || opts.agents.includes("hermes") ? detectHermes() : null;
|
|
3840
3846
|
const claudeApp = !opts.agents?.length || opts.agents.includes("claude_app") ? detectClaudeApp(process.env, homedir8(), opts.deps?.platform ?? process.platform) : null;
|
|
@@ -3856,6 +3862,8 @@ async function setUp(opts, journal) {
|
|
|
3856
3862
|
await syncConfig(sources2, opts.syncAs, emit);
|
|
3857
3863
|
return;
|
|
3858
3864
|
}
|
|
3865
|
+
const claudeCode2 = agents.find((agent2) => agent2.id === "claude_code");
|
|
3866
|
+
if (claudeCode2 && !opts.dryRun) afterwards.push(keepClaudeCodeSideEffects(claudeCode2, journal));
|
|
3859
3867
|
const run3 = { agents: [], plans: [] };
|
|
3860
3868
|
let captureNotices = [];
|
|
3861
3869
|
const earlier = loadReport();
|
|
@@ -3878,7 +3886,7 @@ async function setUp(opts, journal) {
|
|
|
3878
3886
|
const workspace2 = engines.length && (has("skill") || has("capture")) ? await workspaceSlug().catch(() => null) : null;
|
|
3879
3887
|
let install = false;
|
|
3880
3888
|
if (engines.length && (has("skill") || has("capture") || has("plugins"))) {
|
|
3881
|
-
const captureNoticeLines = has("capture") && workspace2 ? captureNotice(workspace2, await (await import("./trace-library-
|
|
3889
|
+
const captureNoticeLines = has("capture") && workspace2 ? captureNotice(workspace2, await (await import("./trace-library-IUFJWBN3.js")).sourceFolders()) : [];
|
|
3882
3890
|
if (interactive) for (const line2 of captureNoticeLines) console.log(line2);
|
|
3883
3891
|
install = await agreed(installQuestion(engines.map((engine) => engine.name), { capture: captureNoticeLines.length > 0 }));
|
|
3884
3892
|
if (!interactive && captureNoticeLines.length) captureNotices = captureNoticeLines;
|
|
@@ -3887,7 +3895,12 @@ async function setUp(opts, journal) {
|
|
|
3887
3895
|
const { catalog: catalog2, detail } = await readCatalog();
|
|
3888
3896
|
emit(catalog2 ? { type: "catalog", outcome: "read", agents: catalog2.length } : { type: "catalog", outcome: "unavailable", ...detail ? { detail } : {} });
|
|
3889
3897
|
const token = apiToken();
|
|
3898
|
+
const toolless = token && !opts.dryRun && await shortToolCount(token) === 0;
|
|
3890
3899
|
const registerMcp = (client) => {
|
|
3900
|
+
if (toolless) {
|
|
3901
|
+
emit({ type: "mcp", agent: client.id, outcome: "no_tools", detail: NO_TOOLS });
|
|
3902
|
+
return;
|
|
3903
|
+
}
|
|
3891
3904
|
if (token) track(mcpConfigPath(client), [MCP_ENTRY[client.id]]);
|
|
3892
3905
|
const registered = token ? registerMcpServer(client, { token, mcpUrl: mcpUrlFor(apiBase(), "short"), dryRun: opts.dryRun, sky }, runner) : { agent: client.id, outcome: "skipped", detail: "not logged in" };
|
|
3893
3906
|
emit({ type: "mcp", agent: client.id, outcome: registered.outcome, ...registered.detail ? { detail: registered.detail } : {} });
|
|
@@ -3913,9 +3926,9 @@ async function setUp(opts, journal) {
|
|
|
3913
3926
|
for (const client of mcpOnly) registerMcp(client);
|
|
3914
3927
|
if (token) {
|
|
3915
3928
|
try {
|
|
3916
|
-
const { localSkillWorkspace } = await import("./local-skills-run-
|
|
3929
|
+
const { localSkillWorkspace } = await import("./local-skills-run-Y47FCKEL.js");
|
|
3917
3930
|
const workspace3 = await localSkillWorkspace();
|
|
3918
|
-
const { libraryRequest } = await import("./trace-library-
|
|
3931
|
+
const { libraryRequest } = await import("./trace-library-IUFJWBN3.js");
|
|
3919
3932
|
const local = await syncLocalSkills({
|
|
3920
3933
|
workspace: workspace3,
|
|
3921
3934
|
targets: skillTargets(agents, hermes?.root ?? null),
|
|
@@ -4025,7 +4038,7 @@ async function installMissingEngine(opts, journal, interactive, emit) {
|
|
|
4025
4038
|
}
|
|
4026
4039
|
for (const path2 of engineInstallPaths(engine)) journal.own(path2);
|
|
4027
4040
|
try {
|
|
4028
|
-
const path2 = await (opts.deps?.installEngine ?? ((
|
|
4041
|
+
const path2 = await (opts.deps?.installEngine ?? ((id2) => installEngine(id2)))(engine);
|
|
4029
4042
|
emit({ type: "engine", engine, outcome: "installed", path: path2 });
|
|
4030
4043
|
installed.push(...selectLocalAgents([engine]));
|
|
4031
4044
|
} catch (error) {
|
|
@@ -4267,13 +4280,13 @@ function renderMoveIn(moveIn) {
|
|
|
4267
4280
|
return [`moved: ${moveIn.landed} skill${moveIn.landed === 1 ? "" : "s"} landed`, moveIn.instructions ? `instructions ${moveIn.instructions}` : null, problem ?? null].filter(Boolean).join("; ");
|
|
4268
4281
|
}
|
|
4269
4282
|
async function cancelMove(grant) {
|
|
4270
|
-
let
|
|
4271
|
-
if (!
|
|
4283
|
+
let id2 = grant;
|
|
4284
|
+
if (!id2) {
|
|
4272
4285
|
const { moveIn } = await readMoveIn();
|
|
4273
4286
|
if (moveIn?.kind !== "moving") throw new ApiError(404, "not_found", "no move is running; name one with its grant id, or a key with --key");
|
|
4274
|
-
|
|
4287
|
+
id2 = moveIn.grantId;
|
|
4275
4288
|
}
|
|
4276
|
-
return api("POST", `/imports/move-in/${encodeURIComponent(
|
|
4289
|
+
return api("POST", `/imports/move-in/${encodeURIComponent(id2)}/cancel`, {});
|
|
4277
4290
|
}
|
|
4278
4291
|
function registerSetupCommands(setupCommand2) {
|
|
4279
4292
|
setupCommand2.command("status").description("where moving this computer's setup in stands, as the composer's card shows it").option("--json", "print as JSON").action(async (_opts, command) => {
|
|
@@ -4302,8 +4315,8 @@ async function writeLibrarySkill(directory, options = {}) {
|
|
|
4302
4315
|
const uploaded = await uploadSkillPlugin(directory, options.name);
|
|
4303
4316
|
return { ...uploaded, added: await addPlugin(`skill:${uploaded.skill.id}`, {}) };
|
|
4304
4317
|
}
|
|
4305
|
-
function deleteLibrarySkill(
|
|
4306
|
-
return removePlugin(`skill:${
|
|
4318
|
+
function deleteLibrarySkill(id2) {
|
|
4319
|
+
return removePlugin(`skill:${id2}`);
|
|
4307
4320
|
}
|
|
4308
4321
|
function registerLibrarySkillCommands(library2) {
|
|
4309
4322
|
const librarySkills = library2.command("skills").description("deprecated: the workspace's skills are `sky plugins` (skill:<id>)");
|
|
@@ -4316,13 +4329,13 @@ function registerLibrarySkillCommands(library2) {
|
|
|
4316
4329
|
deprecatedCommand("library skills upload", `upload ${directory}`);
|
|
4317
4330
|
print(await writeLibrarySkill(directory, options));
|
|
4318
4331
|
});
|
|
4319
|
-
librarySkills.command("save <id> <directory>").description("deprecated: sky plugins revisions skill:<id> --save <directory>").option("--expected-latest-revision <id>", "refuse if the current revision has changed").action(async (
|
|
4320
|
-
deprecatedCommand("library skills save", `revisions skill:${
|
|
4321
|
-
print(await writeLibrarySkill(directory, { ...options, id:
|
|
4332
|
+
librarySkills.command("save <id> <directory>").description("deprecated: sky plugins revisions skill:<id> --save <directory>").option("--expected-latest-revision <id>", "refuse if the current revision has changed").action(async (id2, directory, options) => {
|
|
4333
|
+
deprecatedCommand("library skills save", `revisions skill:${id2} --save ${directory}`);
|
|
4334
|
+
print(await writeLibrarySkill(directory, { ...options, id: id2 }));
|
|
4322
4335
|
});
|
|
4323
|
-
librarySkills.command("rm <id>").description("deprecated: sky plugins rm skill:<id>").action(async (
|
|
4324
|
-
deprecatedCommand("library skills rm", `rm skill:${
|
|
4325
|
-
print(await deleteLibrarySkill(
|
|
4336
|
+
librarySkills.command("rm <id>").description("deprecated: sky plugins rm skill:<id>").action(async (id2) => {
|
|
4337
|
+
deprecatedCommand("library skills rm", `rm skill:${id2}`);
|
|
4338
|
+
print(await deleteLibrarySkill(id2));
|
|
4326
4339
|
});
|
|
4327
4340
|
}
|
|
4328
4341
|
|
|
@@ -4342,7 +4355,7 @@ function interruptLine(res) {
|
|
|
4342
4355
|
|
|
4343
4356
|
// src/index.ts
|
|
4344
4357
|
import { createHash as createHash10 } from "crypto";
|
|
4345
|
-
import { existsSync as existsSync15, readFileSync as
|
|
4358
|
+
import { existsSync as existsSync15, readFileSync as readFileSync27, writeFileSync as writeFileSync13 } from "fs";
|
|
4346
4359
|
import { basename as basename9, resolve as resolve12 } from "path";
|
|
4347
4360
|
import { createInterface as createInterface5 } from "readline";
|
|
4348
4361
|
import { Command, Option } from "commander";
|
|
@@ -4453,7 +4466,7 @@ function renderProgressPage(page) {
|
|
|
4453
4466
|
}
|
|
4454
4467
|
|
|
4455
4468
|
// src/files.ts
|
|
4456
|
-
import { existsSync as existsSync9, readdirSync as
|
|
4469
|
+
import { existsSync as existsSync9, readdirSync as readdirSync7, readFileSync as readFileSync15, statSync as statSync5 } from "fs";
|
|
4457
4470
|
import { basename as basename4, extname as extname2, join as join14 } from "path";
|
|
4458
4471
|
var MEDIA_TYPES = {
|
|
4459
4472
|
".png": "image/png",
|
|
@@ -4479,7 +4492,7 @@ async function uploadLocalFile(path2, expiresInSeconds, onProgress = () => {
|
|
|
4479
4492
|
if (statSync5(path2).size > SINGLE_REQUEST_MAX_BYTES) {
|
|
4480
4493
|
return uploadLargeFile(path2, mediaTypeFor(path2), expiresInSeconds, onProgress);
|
|
4481
4494
|
}
|
|
4482
|
-
const bytes =
|
|
4495
|
+
const bytes = readFileSync15(path2);
|
|
4483
4496
|
return uploadFile(new Uint8Array(bytes), basename4(path2), mediaTypeFor(path2), expiresInSeconds);
|
|
4484
4497
|
}
|
|
4485
4498
|
var IGNORED_NAMES = /* @__PURE__ */ new Set([".DS_Store", "Thumbs.db", "desktop.ini"]);
|
|
@@ -4492,7 +4505,7 @@ function filesUnder(paths) {
|
|
|
4492
4505
|
return;
|
|
4493
4506
|
}
|
|
4494
4507
|
if (!stat.isDirectory()) return;
|
|
4495
|
-
for (const name of
|
|
4508
|
+
for (const name of readdirSync7(path2).sort()) walk(join14(path2, name));
|
|
4496
4509
|
};
|
|
4497
4510
|
for (const path2 of paths) walk(path2);
|
|
4498
4511
|
return found;
|
|
@@ -4591,7 +4604,13 @@ function limitFields(opts) {
|
|
|
4591
4604
|
return body;
|
|
4592
4605
|
}
|
|
4593
4606
|
function criteriaFields(opts) {
|
|
4594
|
-
const
|
|
4607
|
+
const frozen = opts.freeze ?? [];
|
|
4608
|
+
if (frozen.length && opts.unfreeze) throw new Error("pass --freeze or --unfreeze, not both");
|
|
4609
|
+
if ((frozen.length || opts.unfreeze) && !opts.check?.length) {
|
|
4610
|
+
throw new Error(`${frozen.length ? "--freeze" : "--unfreeze"} needs a --check: only a command's files are frozen`);
|
|
4611
|
+
}
|
|
4612
|
+
const files2 = frozen.length ? { files: frozen } : opts.unfreeze ? { files: [] } : {};
|
|
4613
|
+
const criteria = [...opts.criterion ?? [], ...(opts.check ?? []).map((value) => ({ ...checkCriterion(value), ...files2 }))];
|
|
4595
4614
|
return criteria.length ? criteria : null;
|
|
4596
4615
|
}
|
|
4597
4616
|
function setGoalBody(objective, opts) {
|
|
@@ -4610,6 +4629,12 @@ function editGoalBody(opts) {
|
|
|
4610
4629
|
if (!Object.keys(body).length) throw new Error("nothing to change \u2014 pass --objective, --criterion, --check, or a limit");
|
|
4611
4630
|
return body;
|
|
4612
4631
|
}
|
|
4632
|
+
var CHECK_PLACES = { session_pod: "the session's pod", separate_pod: "a separate pod" };
|
|
4633
|
+
function ranLine(verdict) {
|
|
4634
|
+
if (!verdict.ran_in) return null;
|
|
4635
|
+
const place = CHECK_PLACES[verdict.ran_in] ?? verdict.ran_in;
|
|
4636
|
+
return `ran in ${place}${verdict.source ? `, on ${verdict.source} files` : ""}`;
|
|
4637
|
+
}
|
|
4613
4638
|
function dollars2(cents) {
|
|
4614
4639
|
return `$${(Number(cents) / 100).toFixed(2)}`;
|
|
4615
4640
|
}
|
|
@@ -4634,6 +4659,9 @@ function renderGoal(goal2) {
|
|
|
4634
4659
|
const mark = verdict ? verdict.met ? "[x]" : "[ ]" : "[?]";
|
|
4635
4660
|
lines2.push(` ${mark} ${criterion.id} ${criterion.text}`);
|
|
4636
4661
|
if (criterion.command) lines2.push(` $ ${criterion.command}`);
|
|
4662
|
+
for (const file of criterion.files ?? []) lines2.push(` frozen: ${file.path} (sha256 ${file.sha256.slice(0, 12)})`);
|
|
4663
|
+
const ran = verdict && ranLine(verdict);
|
|
4664
|
+
if (ran) lines2.push(` ${ran}`);
|
|
4637
4665
|
if (verdict && !verdict.met && verdict.reason) lines2.push(` ${verdict.reason}`);
|
|
4638
4666
|
}
|
|
4639
4667
|
if (goal2.last_evaluation && goal2.last_evaluation.result !== "satisfied") {
|
|
@@ -4865,12 +4893,12 @@ function renderContextPage(page) {
|
|
|
4865
4893
|
}
|
|
4866
4894
|
|
|
4867
4895
|
// src/agent-manifest-file.ts
|
|
4868
|
-
import { readFileSync as
|
|
4896
|
+
import { readFileSync as readFileSync17, writeFileSync as writeFileSync7 } from "fs";
|
|
4869
4897
|
import { dirname as dirname9, resolve as resolve7 } from "path";
|
|
4870
4898
|
import { parse as parseToml3, stringify as stringifyToml } from "smol-toml";
|
|
4871
4899
|
|
|
4872
4900
|
// src/agent-file.ts
|
|
4873
|
-
import { existsSync as existsSync10, readFileSync as
|
|
4901
|
+
import { existsSync as existsSync10, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "fs";
|
|
4874
4902
|
import { dirname as dirname8, resolve as resolve6 } from "path";
|
|
4875
4903
|
import { parse as parseToml2 } from "smol-toml";
|
|
4876
4904
|
var fileInstructionSchema = external_exports.strictObject({
|
|
@@ -4904,7 +4932,7 @@ var agentFileSchema = external_exports.strictObject({
|
|
|
4904
4932
|
memory_mb: external_exports.number().int().optional()
|
|
4905
4933
|
});
|
|
4906
4934
|
function readAgentFile(path2) {
|
|
4907
|
-
const raw =
|
|
4935
|
+
const raw = readFileSync16(path2, "utf8");
|
|
4908
4936
|
const parsed = agentFileSchema.safeParse(parseToml2(raw));
|
|
4909
4937
|
if (!parsed.success) {
|
|
4910
4938
|
const issue = parsed.error.issues[0];
|
|
@@ -4924,7 +4952,7 @@ function readAgentFile(path2) {
|
|
|
4924
4952
|
const inline = (ref, inlineContent) => {
|
|
4925
4953
|
if (inlineContent !== void 0) return inlineContent;
|
|
4926
4954
|
if (!ref) return void 0;
|
|
4927
|
-
return
|
|
4955
|
+
return readFileSync16(resolve6(base, ref), "utf8");
|
|
4928
4956
|
};
|
|
4929
4957
|
const spec = {
|
|
4930
4958
|
name: file.name,
|
|
@@ -4949,10 +4977,10 @@ function readAgentFile(path2) {
|
|
|
4949
4977
|
};
|
|
4950
4978
|
return { file, spec };
|
|
4951
4979
|
}
|
|
4952
|
-
function stampId(path2,
|
|
4953
|
-
writeFileSync6(path2, stampIdText(
|
|
4980
|
+
function stampId(path2, id2) {
|
|
4981
|
+
writeFileSync6(path2, stampIdText(readFileSync16(path2, "utf8"), id2));
|
|
4954
4982
|
}
|
|
4955
|
-
function stampIdText(text2,
|
|
4983
|
+
function stampIdText(text2, id2) {
|
|
4956
4984
|
const out = [];
|
|
4957
4985
|
let topLevel = true;
|
|
4958
4986
|
let openString = null;
|
|
@@ -4967,7 +4995,7 @@ function stampIdText(text2, id3) {
|
|
|
4967
4995
|
if (/^\s*\[/.test(line2)) topLevel = false;
|
|
4968
4996
|
if (topLevel && /^\s*(id|slug)\s*=/.test(line2)) {
|
|
4969
4997
|
if (/^\s*id\s*=/.test(line2) && !stamped) {
|
|
4970
|
-
out.push(`id = ${JSON.stringify(
|
|
4998
|
+
out.push(`id = ${JSON.stringify(id2)}`);
|
|
4971
4999
|
stamped = true;
|
|
4972
5000
|
}
|
|
4973
5001
|
continue;
|
|
@@ -4977,9 +5005,9 @@ function stampIdText(text2, id3) {
|
|
|
4977
5005
|
if (opener && !line2.slice(opener.index + opener[0].length).includes(opener[1])) openString = opener[1];
|
|
4978
5006
|
out.push(line2);
|
|
4979
5007
|
}
|
|
4980
|
-
if (!stamped) out.splice(nameAt + 1, 0, `id = ${JSON.stringify(
|
|
5008
|
+
if (!stamped) out.splice(nameAt + 1, 0, `id = ${JSON.stringify(id2)}`);
|
|
4981
5009
|
const next = out.join("\n");
|
|
4982
|
-
if (parseToml2(next).id !==
|
|
5010
|
+
if (parseToml2(next).id !== id2) throw new Error("could not stamp the agent id into the file");
|
|
4983
5011
|
return next;
|
|
4984
5012
|
}
|
|
4985
5013
|
function scaffoldAgentFile(path2, name) {
|
|
@@ -5037,23 +5065,23 @@ function deployPatch(spec) {
|
|
|
5037
5065
|
...spec.environmentId ? { environmentId: spec.environmentId } : {}
|
|
5038
5066
|
};
|
|
5039
5067
|
}
|
|
5040
|
-
function deployReport(
|
|
5068
|
+
function deployReport(id2, spec, before, after, promptChanged) {
|
|
5041
5069
|
if (spec.agentType && after.agentType !== spec.agentType) {
|
|
5042
|
-
throw new Error(`${
|
|
5070
|
+
throw new Error(`${id2} is still ${after.agentType}: the API did not apply type = "${spec.agentType}"`);
|
|
5043
5071
|
}
|
|
5044
5072
|
if (spec.llm && after.llm !== spec.llm) {
|
|
5045
|
-
throw new Error(`${
|
|
5073
|
+
throw new Error(`${id2} still runs ${after.llm}: the API did not apply llm = "${spec.llm}"`);
|
|
5046
5074
|
}
|
|
5047
5075
|
const changed = [];
|
|
5048
5076
|
if (promptChanged) changed.push("prompt");
|
|
5049
5077
|
if (after.version !== before.version) changed.push("settings");
|
|
5050
|
-
if (!changed.length) return [`${
|
|
5051
|
-
const lines2 = [`Deployed ${
|
|
5078
|
+
if (!changed.length) return [`${id2} is up to date \u2014 nothing to deploy (version ${after.version})`];
|
|
5079
|
+
const lines2 = [`Deployed ${id2}: ${changed.join(" and ")} updated (version ${before.version} \u2192 ${after.version})`];
|
|
5052
5080
|
if (after.agentType !== before.agentType || after.llm !== before.llm) {
|
|
5053
5081
|
lines2.push(` now ${after.agentType} \xB7 ${after.llm} for new sessions (was ${before.agentType} \xB7 ${before.llm})`);
|
|
5054
5082
|
}
|
|
5055
5083
|
if (spec.skills && after.version !== before.version) {
|
|
5056
|
-
lines2.push(` Skills apply to new sessions; running sessions keep the skills they started with \u2014 start one with \`sky session create ${
|
|
5084
|
+
lines2.push(` Skills apply to new sessions; running sessions keep the skills they started with \u2014 start one with \`sky session create ${id2}\`.`);
|
|
5057
5085
|
}
|
|
5058
5086
|
return lines2;
|
|
5059
5087
|
}
|
|
@@ -5061,35 +5089,35 @@ function deployReport(id3, spec, before, after, promptChanged) {
|
|
|
5061
5089
|
// src/agent-manifest-file.ts
|
|
5062
5090
|
var MANIFEST_API_VERSION = "agentsky/v1";
|
|
5063
5091
|
function readManifestFile(path2) {
|
|
5064
|
-
return manifestFromText(
|
|
5092
|
+
return manifestFromText(readFileSync17(path2, "utf8"), dirname9(resolve7(path2)), path2);
|
|
5065
5093
|
}
|
|
5066
5094
|
function manifestFromText(text2, base, label = "agent.toml") {
|
|
5067
|
-
const { id:
|
|
5095
|
+
const { id: id2, prompt_file: promptFile, ...manifest } = parseToml3(text2);
|
|
5068
5096
|
if (manifest.apiVersion !== MANIFEST_API_VERSION) {
|
|
5069
5097
|
throw new Error(`${label}: apiVersion = "${MANIFEST_API_VERSION}" is required for sky agent apply (sky deploy reads files without it)`);
|
|
5070
5098
|
}
|
|
5071
5099
|
if (typeof promptFile === "string") {
|
|
5072
5100
|
if (manifest.prompt !== void 0) throw new Error(`${label}: set prompt or prompt_file, not both`);
|
|
5073
|
-
manifest.prompt =
|
|
5101
|
+
manifest.prompt = readFileSync17(resolve7(base, promptFile), "utf8");
|
|
5074
5102
|
}
|
|
5075
5103
|
if (Array.isArray(manifest.instructions)) {
|
|
5076
5104
|
manifest.instructions = manifest.instructions.map((entry) => {
|
|
5077
5105
|
const { file, ...rest } = entry;
|
|
5078
5106
|
if (typeof file !== "string") return rest;
|
|
5079
5107
|
if (rest.content !== void 0) throw new Error(`${label}: instruction ${String(rest.name)} sets content and file`);
|
|
5080
|
-
return { ...rest, content:
|
|
5108
|
+
return { ...rest, content: readFileSync17(resolve7(base, file), "utf8") };
|
|
5081
5109
|
});
|
|
5082
5110
|
}
|
|
5083
|
-
return { id: typeof
|
|
5111
|
+
return { id: typeof id2 === "string" && id2 ? id2 : null, manifest };
|
|
5084
5112
|
}
|
|
5085
|
-
function manifestToToml(
|
|
5113
|
+
function manifestToToml(id2, manifest) {
|
|
5086
5114
|
const { apiVersion, name, ...rest } = manifest;
|
|
5087
5115
|
return `# Apply changes with \`sky agent apply -f <this file>\`. A key left out goes back to its default.
|
|
5088
|
-
${stringifyToml({ apiVersion, name, id:
|
|
5116
|
+
${stringifyToml({ apiVersion, name, id: id2, ...rest })}
|
|
5089
5117
|
`;
|
|
5090
5118
|
}
|
|
5091
|
-
function stampManifestId(path2,
|
|
5092
|
-
writeFileSync7(path2, stampIdText(
|
|
5119
|
+
function stampManifestId(path2, id2) {
|
|
5120
|
+
writeFileSync7(path2, stampIdText(readFileSync17(path2, "utf8"), id2));
|
|
5093
5121
|
}
|
|
5094
5122
|
function lineOfField(text2, field) {
|
|
5095
5123
|
const lines2 = text2.split("\n");
|
|
@@ -5124,10 +5152,10 @@ function refusalLines(label, text2, issues) {
|
|
|
5124
5152
|
return `${label}${line2 ? `:${line2}` : ""}: ${issue.field}: ${issue.message}`;
|
|
5125
5153
|
});
|
|
5126
5154
|
}
|
|
5127
|
-
function applyReport(
|
|
5128
|
-
if (created) return [`Created ${
|
|
5129
|
-
if (changes.length === 0) return [`${
|
|
5130
|
-
const head = applied ? `Applied to ${
|
|
5155
|
+
function applyReport(id2, created, changes, applied, version) {
|
|
5156
|
+
if (created) return [`Created ${id2} from the manifest`, ...changes.map((change) => ` ${change.field}`)];
|
|
5157
|
+
if (changes.length === 0) return [`${id2} already is what the manifest declares \u2014 nothing changed${version ? ` (version ${version})` : ""}`];
|
|
5158
|
+
const head = applied ? `Applied to ${id2}${version ? ` (now version ${version})` : ""}:` : `Would change on ${id2} (dry run, nothing written):`;
|
|
5131
5159
|
return [head, ...changes.map((change) => ` ${change.field}: ${short(change.before)} \u2192 ${short(change.after)}`)];
|
|
5132
5160
|
}
|
|
5133
5161
|
function short(value) {
|
|
@@ -5136,7 +5164,7 @@ function short(value) {
|
|
|
5136
5164
|
}
|
|
5137
5165
|
|
|
5138
5166
|
// src/catalog.ts
|
|
5139
|
-
var
|
|
5167
|
+
var bare = (handle) => handle.replace(/^@/, "");
|
|
5140
5168
|
var optionalAuth = () => ({ auth: Boolean(apiToken()) });
|
|
5141
5169
|
function catalogQuery(filter) {
|
|
5142
5170
|
const params = new URLSearchParams();
|
|
@@ -5148,7 +5176,7 @@ function catalogQuery(filter) {
|
|
|
5148
5176
|
function listingBody(agentId, options) {
|
|
5149
5177
|
return {
|
|
5150
5178
|
agent_id: agentId,
|
|
5151
|
-
handle:
|
|
5179
|
+
handle: bare(options.handle),
|
|
5152
5180
|
tagline: options.tagline,
|
|
5153
5181
|
...options.description ? { description: options.description } : {},
|
|
5154
5182
|
...options.category?.length ? { categories: options.category } : {},
|
|
@@ -5161,7 +5189,7 @@ async function listCatalog(filter = {}) {
|
|
|
5161
5189
|
return (await api("GET", `/catalog/agents${catalogQuery(filter)}`, void 0, optionalAuth())).agents;
|
|
5162
5190
|
}
|
|
5163
5191
|
async function showCatalogAgent(handle) {
|
|
5164
|
-
return (await api("GET", `/catalog/agents/${encodeURIComponent(
|
|
5192
|
+
return (await api("GET", `/catalog/agents/${encodeURIComponent(bare(handle))}`, void 0, optionalAuth())).agent;
|
|
5165
5193
|
}
|
|
5166
5194
|
async function listCategories() {
|
|
5167
5195
|
return (await api("GET", "/catalog/categories", void 0, { auth: false })).categories;
|
|
@@ -5170,7 +5198,7 @@ async function publishListing(agentId, options) {
|
|
|
5170
5198
|
return (await api("POST", "/catalog/listings", listingBody(agentId, options))).agent;
|
|
5171
5199
|
}
|
|
5172
5200
|
async function removeListing(handle) {
|
|
5173
|
-
await api("DELETE", `/catalog/listings/${encodeURIComponent(
|
|
5201
|
+
await api("DELETE", `/catalog/listings/${encodeURIComponent(bare(handle))}`);
|
|
5174
5202
|
}
|
|
5175
5203
|
async function setEngineStatus(engine, status, reason) {
|
|
5176
5204
|
await api("PATCH", `/catalog/engines/${encodeURIComponent(engine)}`, { status, reason });
|
|
@@ -5200,7 +5228,7 @@ function renderCatalogAgent(agent2) {
|
|
|
5200
5228
|
|
|
5201
5229
|
// src/clone.ts
|
|
5202
5230
|
import { spawn as spawn4 } from "child_process";
|
|
5203
|
-
import { existsSync as existsSync11, readFileSync as
|
|
5231
|
+
import { existsSync as existsSync11, readFileSync as readFileSync18, writeFileSync as writeFileSync8 } from "fs";
|
|
5204
5232
|
import { homedir as homedir9 } from "os";
|
|
5205
5233
|
import { basename as basename5, join as join15 } from "path";
|
|
5206
5234
|
import { createInterface as createInterface3 } from "readline";
|
|
@@ -5211,7 +5239,7 @@ function claudeConfigRoot() {
|
|
|
5211
5239
|
}
|
|
5212
5240
|
function readIfExists(path2) {
|
|
5213
5241
|
try {
|
|
5214
|
-
return
|
|
5242
|
+
return readFileSync18(path2, "utf8");
|
|
5215
5243
|
} catch {
|
|
5216
5244
|
return void 0;
|
|
5217
5245
|
}
|
|
@@ -5597,11 +5625,11 @@ async function connect(platform, opts) {
|
|
|
5597
5625
|
...opts.session || opts.webhook ? { destination: destination(opts) } : {}
|
|
5598
5626
|
});
|
|
5599
5627
|
}
|
|
5600
|
-
async function waitConnected(
|
|
5628
|
+
async function waitConnected(id2, opts = {}) {
|
|
5601
5629
|
const deadline = Date.now() + (opts.timeoutMs ?? 10 * 6e4);
|
|
5602
5630
|
for (; ; ) {
|
|
5603
|
-
const found = (await listConnections()).find((c) => c.id ===
|
|
5604
|
-
if (!found) throw new ApiError(404, "not_found", `connection ${
|
|
5631
|
+
const found = (await listConnections()).find((c) => c.id === id2);
|
|
5632
|
+
if (!found) throw new ApiError(404, "not_found", `connection ${id2} is gone`);
|
|
5605
5633
|
if (found.status !== "PENDING") return found;
|
|
5606
5634
|
if (Date.now() > deadline) throw new ApiError(408, "connect_timeout", "the connection was not claimed within 10 minutes");
|
|
5607
5635
|
await new Promise((r) => setTimeout(r, opts.pollMs ?? 3e3));
|
|
@@ -5734,7 +5762,7 @@ async function appOfSharedConnection(connectionId, workspace2) {
|
|
|
5734
5762
|
}
|
|
5735
5763
|
|
|
5736
5764
|
// src/routine-triggers.ts
|
|
5737
|
-
var triggerPath = (
|
|
5765
|
+
var triggerPath = (id2, resource) => `/routines/${encodeURIComponent(id2)}/${resource}`;
|
|
5738
5766
|
function inboundLine(u) {
|
|
5739
5767
|
if (!u) return "no inbound URL \u2014 make one with --create";
|
|
5740
5768
|
return u.url ?? `inbound URL ${u.prefix}\u2026 made ${u.created_at.slice(0, 10)}${u.last_used_at ? `, last used ${u.last_used_at.slice(0, 16).replace("T", " ")}` : ", never used"}`;
|
|
@@ -5761,8 +5789,8 @@ function deliverBody(opts) {
|
|
|
5761
5789
|
if (!opts.connection) throw new ApiError(400, "invalid_request", "--connection is required (see `sky channel list`)");
|
|
5762
5790
|
return { type: "channel_thread", connection_id: opts.connection, ...opts.thread ? { thread_id: opts.thread } : {} };
|
|
5763
5791
|
}
|
|
5764
|
-
async function triggerRequest(
|
|
5765
|
-
const path2 = triggerPath(
|
|
5792
|
+
async function triggerRequest(id2, resource, change) {
|
|
5793
|
+
const path2 = triggerPath(id2, resource);
|
|
5766
5794
|
if (change.remove) return api("DELETE", path2);
|
|
5767
5795
|
if (change.create) return api("POST", path2);
|
|
5768
5796
|
if (change.body) return api("PUT", path2, change.body);
|
|
@@ -5772,7 +5800,7 @@ async function triggerRequest(id3, resource, change) {
|
|
|
5772
5800
|
// src/session-workspace.ts
|
|
5773
5801
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
5774
5802
|
import { createHash as createHash8, randomUUID as randomUUID5 } from "crypto";
|
|
5775
|
-
import { existsSync as existsSync12, lstatSync as lstatSync5, mkdirSync as mkdirSync5, readdirSync as
|
|
5803
|
+
import { existsSync as existsSync12, lstatSync as lstatSync5, mkdirSync as mkdirSync5, readdirSync as readdirSync8, readFileSync as readFileSync19, renameSync as renameSync2, statSync as statSync6, writeFileSync as writeFileSync9 } from "fs";
|
|
5776
5804
|
import { homedir as homedir10, hostname as hostname2, tmpdir as tmpdir3 } from "os";
|
|
5777
5805
|
import { basename as basename7, dirname as dirname10, join as join16, relative as relative4, resolve as resolve9 } from "path";
|
|
5778
5806
|
import { inflateRawSync } from "zlib";
|
|
@@ -6322,8 +6350,8 @@ ${text2}` }] }], spec: {} };
|
|
|
6322
6350
|
};
|
|
6323
6351
|
}
|
|
6324
6352
|
if (kind === "function_call" || kind === "local_shell_call" || kind === "custom_tool_call") {
|
|
6325
|
-
const
|
|
6326
|
-
if (!
|
|
6353
|
+
const id2 = callOrOwnId(payload);
|
|
6354
|
+
if (!id2) return EMPTY;
|
|
6327
6355
|
return {
|
|
6328
6356
|
events: [
|
|
6329
6357
|
{
|
|
@@ -6331,7 +6359,7 @@ ${text2}` }] }], spec: {} };
|
|
|
6331
6359
|
part: {
|
|
6332
6360
|
type: "tool_call",
|
|
6333
6361
|
index: 0,
|
|
6334
|
-
call_id:
|
|
6362
|
+
call_id: id2,
|
|
6335
6363
|
tool_name: toolName(payload),
|
|
6336
6364
|
args: callArgs(payload)
|
|
6337
6365
|
}
|
|
@@ -6341,8 +6369,8 @@ ${text2}` }] }], spec: {} };
|
|
|
6341
6369
|
};
|
|
6342
6370
|
}
|
|
6343
6371
|
if (kind === "function_call_output" || kind === "custom_tool_call_output") {
|
|
6344
|
-
const
|
|
6345
|
-
if (!
|
|
6372
|
+
const id2 = callIdOf(payload);
|
|
6373
|
+
if (!id2) return {
|
|
6346
6374
|
events: [{ type: "agent.message", parts: [{
|
|
6347
6375
|
type: "text",
|
|
6348
6376
|
index: 0,
|
|
@@ -6363,7 +6391,7 @@ ${typeof payload.output === "string" ? payload.output : JSON.stringify(payload.o
|
|
|
6363
6391
|
part: {
|
|
6364
6392
|
type: "tool_result",
|
|
6365
6393
|
index: 0,
|
|
6366
|
-
call_id:
|
|
6394
|
+
call_id: id2,
|
|
6367
6395
|
tool_name: "",
|
|
6368
6396
|
status: failed ? "error" : "ok",
|
|
6369
6397
|
result: { output: text2 }
|
|
@@ -6424,6 +6452,47 @@ function parseNative(engine, records) {
|
|
|
6424
6452
|
return parse;
|
|
6425
6453
|
}
|
|
6426
6454
|
|
|
6455
|
+
// ../../packages/conversation/src/platform-text.ts
|
|
6456
|
+
var INPUT_SCOPE = /\n\n<agentsky-input-scope>[^\n]*<\/agentsky-input-scope>(?=$|\n\n<attachments>\n)/;
|
|
6457
|
+
var SYSTEM_SECTION = /^<system-reminder>\n([\s\S]*?)\n<\/system-reminder>(?:\n\n|$)/;
|
|
6458
|
+
var APP_CONTEXT = /\s*<app_context>[\s\S]*?(?:<\/app_context>|$)/g;
|
|
6459
|
+
var HAS_APP_CONTEXT = /<app_context>/;
|
|
6460
|
+
var HARNESS_TURN = /^\s*(?:<(task-notification|local-command-caveat|local-command-stdout|local-command-stderr|command-name|command-message|command-args)>[\s\S]*?<\/\1>\s*)+$/;
|
|
6461
|
+
var RECOVERY_NOTICE_CLOSING = "Preserve completed work; do not repeat completed actions.";
|
|
6462
|
+
var RECOVERY_NOTICE_OPENING = /^(?:The subscription usage limit that stopped the previous request has reset\.|.{0,240}?Continue the interrupted task from its current state\.)/s;
|
|
6463
|
+
var EARLIER = /<earlier_conversation>\n([\s\S]*?)\n?<\/earlier_conversation>/;
|
|
6464
|
+
function earlierTurns(system) {
|
|
6465
|
+
const block = EARLIER.exec(system)?.[1];
|
|
6466
|
+
if (!block) return [];
|
|
6467
|
+
const turns = [];
|
|
6468
|
+
for (const line2 of block.split("\n")) {
|
|
6469
|
+
try {
|
|
6470
|
+
const entry = JSON.parse(line2);
|
|
6471
|
+
if (typeof entry.text !== "string" || !entry.text.trim()) continue;
|
|
6472
|
+
turns.push({ role: entry.from === "Agent" ? "agent" : "user", text: entry.text, at: typeof entry.at === "string" ? entry.at : "" });
|
|
6473
|
+
} catch {
|
|
6474
|
+
continue;
|
|
6475
|
+
}
|
|
6476
|
+
}
|
|
6477
|
+
return turns;
|
|
6478
|
+
}
|
|
6479
|
+
function isRecoveryNotice(text2) {
|
|
6480
|
+
const trimmed = text2.trim();
|
|
6481
|
+
return trimmed.endsWith(RECOVERY_NOTICE_CLOSING) && RECOVERY_NOTICE_OPENING.test(trimmed);
|
|
6482
|
+
}
|
|
6483
|
+
function personText(raw) {
|
|
6484
|
+
let text2 = raw.replace(INPUT_SCOPE, "");
|
|
6485
|
+
const earlier = [];
|
|
6486
|
+
for (let section = SYSTEM_SECTION.exec(text2); section; section = SYSTEM_SECTION.exec(text2)) {
|
|
6487
|
+
earlier.push(...earlierTurns(section[1] ?? ""));
|
|
6488
|
+
text2 = text2.slice(section[0].length);
|
|
6489
|
+
}
|
|
6490
|
+
text2 = text2.replace(INPUT_SCOPE, "");
|
|
6491
|
+
if (HAS_APP_CONTEXT.test(text2)) text2 = text2.replace(APP_CONTEXT, "").trim();
|
|
6492
|
+
if (!text2.trim() || HARNESS_TURN.test(text2) || isRecoveryNotice(text2)) text2 = "";
|
|
6493
|
+
return { text: text2, earlier };
|
|
6494
|
+
}
|
|
6495
|
+
|
|
6427
6496
|
// ../../packages/conversation/src/read.ts
|
|
6428
6497
|
var THINKING_BLOCKS = /* @__PURE__ */ new Set(["thinking", "redacted_thinking"]);
|
|
6429
6498
|
var PRESERVED_RECORDS = /* @__PURE__ */ new Set(["source-record.json", "source-attachment.json"]);
|
|
@@ -6489,7 +6558,17 @@ var Fold = class {
|
|
|
6489
6558
|
event(event, at) {
|
|
6490
6559
|
switch (event.type) {
|
|
6491
6560
|
case "user.message": {
|
|
6492
|
-
const parts =
|
|
6561
|
+
const parts = [];
|
|
6562
|
+
for (const part of event.parts) {
|
|
6563
|
+
if (part.type === "file" && PRESERVED_RECORDS.has(part.name)) continue;
|
|
6564
|
+
if (part.type !== "text") {
|
|
6565
|
+
parts.push(part);
|
|
6566
|
+
continue;
|
|
6567
|
+
}
|
|
6568
|
+
const { text: text2, earlier } = personText(part.text);
|
|
6569
|
+
if (!this.messages.length) for (const turn of earlier) this.add(this.open(turn.role, turn.at || at), { type: "text", index: 0, text: turn.text });
|
|
6570
|
+
if (text2) parts.push({ ...part, text: text2 });
|
|
6571
|
+
}
|
|
6493
6572
|
if (!parts.length) return;
|
|
6494
6573
|
const message2 = this.open("user", at);
|
|
6495
6574
|
for (const part of parts) this.add(message2, part);
|
|
@@ -7084,20 +7163,20 @@ function convertSession(from, text2, to, opts = {}) {
|
|
|
7084
7163
|
var SINGLE_IMPORT_MAX = 25 * 1024 * 1024;
|
|
7085
7164
|
var PART_SIZE = 8 * 1024 * 1024;
|
|
7086
7165
|
var SKIPPED3 = /* @__PURE__ */ new Set([".git", "node_modules"]);
|
|
7087
|
-
var workspacePath = (
|
|
7088
|
-
async function listFiles2(
|
|
7166
|
+
var workspacePath = (id2) => `/sessions/${encodeURIComponent(id2)}/workspace`;
|
|
7167
|
+
async function listFiles2(id2, path2, hidden) {
|
|
7089
7168
|
const query = new URLSearchParams();
|
|
7090
7169
|
if (path2) query.set("path", path2);
|
|
7091
7170
|
if (hidden) query.set("hidden", "true");
|
|
7092
7171
|
const qs = query.toString();
|
|
7093
|
-
return api("GET", `${workspacePath(
|
|
7172
|
+
return api("GET", `${workspacePath(id2)}/files${qs ? `?${qs}` : ""}`);
|
|
7094
7173
|
}
|
|
7095
7174
|
function entryLine(e) {
|
|
7096
7175
|
const size2 = e.type === "directory" ? "-" : String(e.size ?? 0);
|
|
7097
7176
|
return `${e.type === "directory" ? "d" : "-"} ${size2.padStart(10)} ${(e.mtime ?? "").slice(0, 16).replace("T", " ")} ${e.name}${e.type === "directory" ? "/" : ""}`;
|
|
7098
7177
|
}
|
|
7099
|
-
async function readFile(
|
|
7100
|
-
return (await apiBytes("GET", `${workspacePath(
|
|
7178
|
+
async function readFile(id2, path2) {
|
|
7179
|
+
return (await apiBytes("GET", `${workspacePath(id2)}/files/content?path=${encodeURIComponent(path2)}`)).bytes;
|
|
7101
7180
|
}
|
|
7102
7181
|
function renderChanges(changes) {
|
|
7103
7182
|
if (!changes.repos.length) return [`no git repository under ${changes.root}`];
|
|
@@ -7106,8 +7185,8 @@ function renderChanges(changes) {
|
|
|
7106
7185
|
...(r.stat ?? r.status ?? "").split("\n").filter(Boolean).map((line2) => ` ${line2}`)
|
|
7107
7186
|
]);
|
|
7108
7187
|
}
|
|
7109
|
-
async function workspacePatch(
|
|
7110
|
-
const { patch, ...meta } = await api("POST", `${workspacePath(
|
|
7188
|
+
async function workspacePatch(id2, repo) {
|
|
7189
|
+
const { patch, ...meta } = await api("POST", `${workspacePath(id2)}/patch`, { repo });
|
|
7111
7190
|
return { meta, patch: Buffer.from(patch, "base64") };
|
|
7112
7191
|
}
|
|
7113
7192
|
function folderFiles(dir) {
|
|
@@ -7118,7 +7197,7 @@ function folderFiles(dir) {
|
|
|
7118
7197
|
}
|
|
7119
7198
|
const files2 = [];
|
|
7120
7199
|
const walk = (at) => {
|
|
7121
|
-
for (const entry of
|
|
7200
|
+
for (const entry of readdirSync8(at, { withFileTypes: true })) {
|
|
7122
7201
|
if (SKIPPED3.has(entry.name)) continue;
|
|
7123
7202
|
const full = join16(at, entry.name);
|
|
7124
7203
|
if (entry.isDirectory()) walk(full);
|
|
@@ -7137,17 +7216,17 @@ function folderArchive(dir, files2) {
|
|
|
7137
7216
|
if (tar.status !== 0) throw new ApiError(400, "archive_failed", `tar failed: ${tar.stderr.toString().trim()}`);
|
|
7138
7217
|
return tar.stdout;
|
|
7139
7218
|
}
|
|
7140
|
-
async function importFolder(
|
|
7219
|
+
async function importFolder(id2, dir, opts = {}) {
|
|
7141
7220
|
const root2 = resolve9(dir);
|
|
7142
7221
|
const name = opts.name ?? basename7(root2);
|
|
7143
7222
|
const archive = opts.archive ?? folderArchive(root2, folderFiles(root2));
|
|
7144
7223
|
if (archive.length <= SINGLE_IMPORT_MAX) {
|
|
7145
|
-
const res = await apiBytes("POST", `${workspacePath(
|
|
7224
|
+
const res = await apiBytes("POST", `${workspacePath(id2)}/import?name=${encodeURIComponent(name)}`, { bytes: archive, mediaType: "application/gzip" });
|
|
7146
7225
|
return res.json();
|
|
7147
7226
|
}
|
|
7148
7227
|
const sha256 = createHash8("sha256").update(archive).digest("hex");
|
|
7149
|
-
let upload = await api("POST", `${workspacePath(
|
|
7150
|
-
const uploadPath = `${workspacePath(
|
|
7228
|
+
let upload = await api("POST", `${workspacePath(id2)}/imports`, { name, size: archive.length, sha256, part_size: PART_SIZE });
|
|
7229
|
+
const uploadPath = `${workspacePath(id2)}/imports/${encodeURIComponent(upload.id)}`;
|
|
7151
7230
|
for (let part = 0; part < upload.parts; part += 1) {
|
|
7152
7231
|
if (upload.received.includes(part)) continue;
|
|
7153
7232
|
const bytes = archive.subarray(part * upload.part_size, (part + 1) * upload.part_size);
|
|
@@ -7191,8 +7270,8 @@ function engineChange(model, thinking) {
|
|
|
7191
7270
|
};
|
|
7192
7271
|
}
|
|
7193
7272
|
var TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
|
|
7194
|
-
async function handoff(
|
|
7195
|
-
const { handoff: h } = await api("POST", `/sessions/${encodeURIComponent(
|
|
7273
|
+
async function handoff(id2, targetAgent, message2, opts = {}) {
|
|
7274
|
+
const { handoff: h } = await api("POST", `/sessions/${encodeURIComponent(id2)}/handoff`, {
|
|
7196
7275
|
target_agent: targetAgent,
|
|
7197
7276
|
message: message2,
|
|
7198
7277
|
...opts.model ? { llm: opts.model } : {},
|
|
@@ -7201,8 +7280,8 @@ async function handoff(id3, targetAgent, message2, opts = {}) {
|
|
|
7201
7280
|
if (TERMINAL.has(h.status) && h.status !== "completed") throw new ApiError(422, h.error?.code ?? "handoff_failed", h.error?.message ?? "the handoff failed");
|
|
7202
7281
|
return h;
|
|
7203
7282
|
}
|
|
7204
|
-
async function fork(
|
|
7205
|
-
let { handoff: h } = await api("POST", `/sessions/${encodeURIComponent(
|
|
7283
|
+
async function fork(id2, targetAgent, opts = {}) {
|
|
7284
|
+
let { handoff: h } = await api("POST", `/sessions/${encodeURIComponent(id2)}/fork`, {
|
|
7206
7285
|
target_agent: targetAgent,
|
|
7207
7286
|
...opts.fromMessage ? { last_message_id: opts.fromMessage } : {},
|
|
7208
7287
|
...opts.model ? { llm: opts.model } : {},
|
|
@@ -7282,13 +7361,13 @@ function landing(harness2, download, engine, folder) {
|
|
|
7282
7361
|
const moved = convertSession(harness2, transcript.data.toString("utf8"), engine, { cwd: folder });
|
|
7283
7362
|
return { engine, nativeId: moved.nativeId, files: [{ path: moved.path, data: Buffer.from(moved.content, "utf8") }], resume: `cd ${quoted} && ${moved.resume}`, converted: moved.report };
|
|
7284
7363
|
}
|
|
7285
|
-
async function continueHere(
|
|
7286
|
-
const session2 = (await api("GET", `/sessions/${encodeURIComponent(
|
|
7364
|
+
async function continueHere(id2, dir, opts = {}) {
|
|
7365
|
+
const session2 = (await api("GET", `/sessions/${encodeURIComponent(id2)}`)).session;
|
|
7287
7366
|
const harness2 = session2.agentType;
|
|
7288
7367
|
if (!isEngine(harness2)) throw new ApiError(409, "harness_unsupported", "only Claude Code and Codex sessions can continue on a computer");
|
|
7289
7368
|
const engine = opts.engine ?? harness2;
|
|
7290
7369
|
if (!isEngine(engine)) throw new ApiError(400, "invalid_request", "--engine must be claude_code or codex");
|
|
7291
|
-
let { handoff: h } = await api("POST", `/sessions/${encodeURIComponent(
|
|
7370
|
+
let { handoff: h } = await api("POST", `/sessions/${encodeURIComponent(id2)}/local-handoff`, { machine: hostname2().slice(0, 120) }, { idempotencyKey: opts.idempotencyKey ?? randomUUID5() });
|
|
7292
7371
|
opts.onStatus?.(h);
|
|
7293
7372
|
while (!TERMINAL.has(h.status)) {
|
|
7294
7373
|
await new Promise((r) => setTimeout(r, opts.pollMs ?? 2e3));
|
|
@@ -7306,7 +7385,7 @@ async function continueHere(id3, dir, opts = {}) {
|
|
|
7306
7385
|
mkdirSync5(dirname10(target2), { recursive: true });
|
|
7307
7386
|
if (existsSync12(target2)) {
|
|
7308
7387
|
if (!lstatSync5(target2).isFile()) throw new ApiError(409, "restore_blocked", `something other than a file is in the way at ${target2}`);
|
|
7309
|
-
if (
|
|
7388
|
+
if (readFileSync19(target2).equals(file.data)) continue;
|
|
7310
7389
|
renameSync2(target2, `${target2}.before-agentsky-${stamp}`);
|
|
7311
7390
|
}
|
|
7312
7391
|
writeFileSync9(target2, file.data, { mode: 384 });
|
|
@@ -7349,10 +7428,10 @@ function createEventRenderer(out = process.stdout) {
|
|
|
7349
7428
|
openStream = null;
|
|
7350
7429
|
};
|
|
7351
7430
|
return (event, data) => {
|
|
7352
|
-
const
|
|
7353
|
-
if (
|
|
7354
|
-
if (seen.has(
|
|
7355
|
-
seen.add(
|
|
7431
|
+
const id2 = typeof data.id === "string" ? data.id : void 0;
|
|
7432
|
+
if (id2) {
|
|
7433
|
+
if (seen.has(id2)) return;
|
|
7434
|
+
seen.add(id2);
|
|
7356
7435
|
}
|
|
7357
7436
|
if (event !== "agent.message") {
|
|
7358
7437
|
if (event && event !== "keepalive") closeLine();
|
|
@@ -7486,12 +7565,12 @@ function publishBody(task, options) {
|
|
|
7486
7565
|
async function publishArtifact(task, options) {
|
|
7487
7566
|
return (await api("POST", "/artifacts", publishBody(task, options))).artifact;
|
|
7488
7567
|
}
|
|
7489
|
-
async function readArtifactFile(
|
|
7490
|
-
return (await apiBytes("GET", `/artifacts/${encodeURIComponent(
|
|
7568
|
+
async function readArtifactFile(id2, path2, version) {
|
|
7569
|
+
return (await apiBytes("GET", `/artifacts/${encodeURIComponent(id2)}/files/${encodePath(path2)}${version === void 0 ? "" : `?version=${version}`}`)).bytes;
|
|
7491
7570
|
}
|
|
7492
|
-
async function saveArtifactFile(
|
|
7571
|
+
async function saveArtifactFile(id2, path2, input) {
|
|
7493
7572
|
const query = new URLSearchParams({ base_version: String(input.baseVersion), ...input.restoreVersion ? { restore_version: String(input.restoreVersion) } : {}, ...input.requestId ? { request_id: input.requestId } : {} });
|
|
7494
|
-
const sent = await apiBytes("PUT", `/artifacts/${encodeURIComponent(
|
|
7573
|
+
const sent = await apiBytes("PUT", `/artifacts/${encodeURIComponent(id2)}/files/${encodePath(path2)}?${query}`, { bytes: input.bytes ?? new Uint8Array(), mediaType: "application/octet-stream" });
|
|
7495
7574
|
return (await sent.json()).artifact;
|
|
7496
7575
|
}
|
|
7497
7576
|
async function importArtifact(input) {
|
|
@@ -7502,29 +7581,29 @@ async function importArtifact(input) {
|
|
|
7502
7581
|
for (const [field, value] of Object.entries(fields)) form.set(field, value);
|
|
7503
7582
|
return (await apiForm("POST", "/artifacts/imports", form)).artifact;
|
|
7504
7583
|
}
|
|
7505
|
-
async function exportArtifact(
|
|
7584
|
+
async function exportArtifact(id2, options = {}) {
|
|
7506
7585
|
const query = new URLSearchParams({ ...options.format ? { format: options.format } : {}, ...options.version ? { version: String(options.version) } : {} }).toString();
|
|
7507
|
-
return (await apiBytes("GET", `/artifacts/${encodeURIComponent(
|
|
7586
|
+
return (await apiBytes("GET", `/artifacts/${encodeURIComponent(id2)}/export${query ? `?${query}` : ""}`)).bytes;
|
|
7508
7587
|
}
|
|
7509
|
-
async function convertArtifactToPage(
|
|
7510
|
-
return api("POST", `/artifacts/${encodeURIComponent(
|
|
7588
|
+
async function convertArtifactToPage(id2, input) {
|
|
7589
|
+
return api("POST", `/artifacts/${encodeURIComponent(id2)}/conversions`, { to: "page", base_version: input.baseVersion, ...input.requestId ? { request_id: input.requestId } : {} });
|
|
7511
7590
|
}
|
|
7512
|
-
async function shareArtifact(
|
|
7513
|
-
return (await api("POST", `/artifacts/${encodeURIComponent(
|
|
7591
|
+
async function shareArtifact(id2, enabled, confirmSpendsOwnerCredits) {
|
|
7592
|
+
return (await api("POST", `/artifacts/${encodeURIComponent(id2)}/share`, { enabled, ...confirmSpendsOwnerCredits ? { confirm_spends_owner_credits: true } : {} })).share_url;
|
|
7514
7593
|
}
|
|
7515
|
-
async function renameArtifact(
|
|
7516
|
-
return (await api("PATCH", `/artifacts/${encodeURIComponent(
|
|
7594
|
+
async function renameArtifact(id2, name) {
|
|
7595
|
+
return (await api("PATCH", `/artifacts/${encodeURIComponent(id2)}`, { name })).artifact;
|
|
7517
7596
|
}
|
|
7518
|
-
async function copyArtifact(
|
|
7519
|
-
return (await api("POST", `/artifacts/${encodeURIComponent(
|
|
7597
|
+
async function copyArtifact(id2, input) {
|
|
7598
|
+
return (await api("POST", `/artifacts/${encodeURIComponent(id2)}/copy`, {
|
|
7520
7599
|
...input.name ? { name: input.name } : {},
|
|
7521
7600
|
...input.version ? { version: input.version } : {},
|
|
7522
7601
|
...input.taskId ? { task_id: input.taskId } : {},
|
|
7523
7602
|
request_id: input.requestId ?? crypto.randomUUID()
|
|
7524
7603
|
})).artifact;
|
|
7525
7604
|
}
|
|
7526
|
-
async function deleteArtifact(
|
|
7527
|
-
await api("DELETE", `/artifacts/${encodeURIComponent(
|
|
7605
|
+
async function deleteArtifact(id2) {
|
|
7606
|
+
await api("DELETE", `/artifacts/${encodeURIComponent(id2)}`);
|
|
7528
7607
|
}
|
|
7529
7608
|
function renderTaskFile(file) {
|
|
7530
7609
|
return `${file.path} ${file.size_bytes} bytes ${file.updated_at}${file.updated_by_session ? ` by ${file.updated_by_session}` : ""}`;
|
|
@@ -7533,10 +7612,10 @@ function renderArtifact(artifact2) {
|
|
|
7533
7612
|
const files2 = `${artifact2.files.length} ${artifact2.files.length === 1 ? "file" : "files"}`;
|
|
7534
7613
|
return `${artifact2.id} ${artifact2.name} v${artifact2.version} ${files2} entry ${artifact2.entry}${artifact2.share_url ? ` shared ${artifact2.share_url}` : ""}`;
|
|
7535
7614
|
}
|
|
7536
|
-
async function artifactComments(
|
|
7537
|
-
return api(input ? "POST" : "GET", `/artifacts/${encodeURIComponent(
|
|
7615
|
+
async function artifactComments(id2, input) {
|
|
7616
|
+
return api(input ? "POST" : "GET", `/artifacts/${encodeURIComponent(id2)}/comments`, input);
|
|
7538
7617
|
}
|
|
7539
|
-
async function artifactCommentsOperation(
|
|
7618
|
+
async function artifactCommentsOperation(id2, opts) {
|
|
7540
7619
|
const operations = [opts.text, opts.resolve, opts.reopen].filter((value) => value !== void 0).length;
|
|
7541
7620
|
if (operations > 1) throw new Error("--text, --resolve and --reopen are mutually exclusive");
|
|
7542
7621
|
const root2 = opts.resolve ?? opts.reopen;
|
|
@@ -7546,13 +7625,13 @@ async function artifactCommentsOperation(id3, opts) {
|
|
|
7546
7625
|
if (!opts.base?.trim() || !Number.isSafeInteger(base) || opts.stateVersion === void 0 || !opts.stateVersion.trim() || !Number.isSafeInteger(stateVersion) || stateVersion < 0 || stateVersion >= Number.MAX_SAFE_INTEGER) {
|
|
7547
7626
|
throw new Error("Resolution needs a safe integer --base and a non-negative integer --state-version");
|
|
7548
7627
|
}
|
|
7549
|
-
return api("PUT", `/artifacts/${encodeURIComponent(
|
|
7628
|
+
return api("PUT", `/artifacts/${encodeURIComponent(id2)}/comments/${encodeURIComponent(root2)}/resolution`, { resolved: opts.resolve !== void 0, base_version: base, base_resolution_version: stateVersion });
|
|
7550
7629
|
}
|
|
7551
7630
|
if (opts.stateVersion !== void 0) throw new Error("--state-version requires --resolve or --reopen");
|
|
7552
7631
|
if (opts.text === void 0 && (opts.base !== void 0 || opts.reply !== void 0)) throw new Error("--base and --reply require --text");
|
|
7553
7632
|
const version = Number(opts.base);
|
|
7554
7633
|
if (opts.text !== void 0 && (!opts.text.trim() || !opts.base?.trim() || !Number.isSafeInteger(version))) throw new Error("A comment needs non-empty --text and a safe integer --base");
|
|
7555
|
-
return artifactComments(
|
|
7634
|
+
return artifactComments(id2, opts.text === void 0 ? void 0 : { text: opts.text, base_version: version, ...opts.reply === void 0 ? {} : { parent_id: opts.reply } });
|
|
7556
7635
|
}
|
|
7557
7636
|
|
|
7558
7637
|
// src/task-export.ts
|
|
@@ -8069,7 +8148,7 @@ function renderAgentRecord(row) {
|
|
|
8069
8148
|
|
|
8070
8149
|
// src/vaults.ts
|
|
8071
8150
|
import { createInterface as createInterface4 } from "readline";
|
|
8072
|
-
var vaultPath = (
|
|
8151
|
+
var vaultPath = (id2) => `/vaults/${encodeURIComponent(id2)}`;
|
|
8073
8152
|
function secretLine(s) {
|
|
8074
8153
|
const target2 = s.secret_name ? `$${s.secret_name}` : s.mcp_server_url ?? "";
|
|
8075
8154
|
const sites = s.allowed_hosts === void 0 ? "" : ` sites: ${s.allowed_hosts.join(", ") || "none"}`;
|
|
@@ -8194,13 +8273,13 @@ function renderBrowserProfile(profile) {
|
|
|
8194
8273
|
}
|
|
8195
8274
|
|
|
8196
8275
|
// src/portable-import.ts
|
|
8197
|
-
import { existsSync as existsSync13, readdirSync as
|
|
8276
|
+
import { existsSync as existsSync13, readdirSync as readdirSync9, readFileSync as readFileSync20, statSync as statSync7 } from "fs";
|
|
8198
8277
|
import { basename as basename8, join as join18, resolve as resolve10 } from "path";
|
|
8199
8278
|
import { parse as parseToml4 } from "smol-toml";
|
|
8200
8279
|
var isObject = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8201
8280
|
function readJson4(path2) {
|
|
8202
8281
|
try {
|
|
8203
|
-
return JSON.parse(
|
|
8282
|
+
return JSON.parse(readFileSync20(path2, "utf-8"));
|
|
8204
8283
|
} catch {
|
|
8205
8284
|
return null;
|
|
8206
8285
|
}
|
|
@@ -8271,14 +8350,14 @@ function codexConfigServers(toml) {
|
|
|
8271
8350
|
function skillDirs(root2) {
|
|
8272
8351
|
const dir = join18(root2, "skills");
|
|
8273
8352
|
if (!existsSync13(dir) || !statSync7(dir).isDirectory()) return [];
|
|
8274
|
-
return
|
|
8353
|
+
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));
|
|
8275
8354
|
}
|
|
8276
8355
|
function planImport(path2) {
|
|
8277
8356
|
const target2 = resolve10(path2);
|
|
8278
8357
|
if (!existsSync13(target2)) throw new Error(`Nothing at ${path2}`);
|
|
8279
8358
|
if (statSync7(target2).isFile()) {
|
|
8280
8359
|
const name2 = basename8(target2).replace(/\.(json|toml)$/, "");
|
|
8281
|
-
if (target2.endsWith(".toml")) return { name: name2, format: "codex-config", skills: [], ...codexConfigServers(
|
|
8360
|
+
if (target2.endsWith(".toml")) return { name: name2, format: "codex-config", skills: [], ...codexConfigServers(readFileSync20(target2, "utf-8")) };
|
|
8282
8361
|
const value = readJson4(target2);
|
|
8283
8362
|
if (value === null) throw new Error(`${path2} is not JSON or TOML`);
|
|
8284
8363
|
return { name: name2, format: "mcp", skills: [], ...mcpJsonServers(value) };
|
|
@@ -8327,11 +8406,11 @@ async function listComparisons(opts = {}) {
|
|
|
8327
8406
|
async function createComparison(body) {
|
|
8328
8407
|
return api("POST", "/comparisons", body);
|
|
8329
8408
|
}
|
|
8330
|
-
async function getComparison(
|
|
8331
|
-
return api("GET", `/comparisons/${encodeURIComponent(
|
|
8409
|
+
async function getComparison(id2) {
|
|
8410
|
+
return api("GET", `/comparisons/${encodeURIComponent(id2)}`);
|
|
8332
8411
|
}
|
|
8333
|
-
async function pickWinner(
|
|
8334
|
-
return api("POST", `/comparisons/${encodeURIComponent(
|
|
8412
|
+
async function pickWinner(id2, opts) {
|
|
8413
|
+
return api("POST", `/comparisons/${encodeURIComponent(id2)}/pick`, opts);
|
|
8335
8414
|
}
|
|
8336
8415
|
async function listThreads2(opts = {}) {
|
|
8337
8416
|
const query = new URLSearchParams();
|
|
@@ -8343,33 +8422,33 @@ async function listThreads2(opts = {}) {
|
|
|
8343
8422
|
async function startThread(body) {
|
|
8344
8423
|
return api("POST", "/threads", body);
|
|
8345
8424
|
}
|
|
8346
|
-
var threadPath = (
|
|
8347
|
-
async function getThread(
|
|
8348
|
-
return api("GET", threadPath(
|
|
8425
|
+
var threadPath = (id2) => `/threads/${encodeURIComponent(id2)}`;
|
|
8426
|
+
async function getThread(id2) {
|
|
8427
|
+
return api("GET", threadPath(id2));
|
|
8349
8428
|
}
|
|
8350
|
-
async function organizeThread(
|
|
8351
|
-
return api("PATCH", threadPath(
|
|
8429
|
+
async function organizeThread(id2, change) {
|
|
8430
|
+
return api("PATCH", threadPath(id2), change);
|
|
8352
8431
|
}
|
|
8353
|
-
async function deleteThread(
|
|
8354
|
-
return api("DELETE", threadPath(
|
|
8432
|
+
async function deleteThread(id2) {
|
|
8433
|
+
return api("DELETE", threadPath(id2));
|
|
8355
8434
|
}
|
|
8356
|
-
async function sendThreadMessage(
|
|
8357
|
-
return api("POST", `${threadPath(
|
|
8435
|
+
async function sendThreadMessage(id2, body) {
|
|
8436
|
+
return api("POST", `${threadPath(id2)}/messages`, body);
|
|
8358
8437
|
}
|
|
8359
|
-
async function addThreadAgent(
|
|
8360
|
-
return api("POST", `${threadPath(
|
|
8438
|
+
async function addThreadAgent(id2, body) {
|
|
8439
|
+
return api("POST", `${threadPath(id2)}/agents`, body);
|
|
8361
8440
|
}
|
|
8362
|
-
async function removeThreadAgent(
|
|
8363
|
-
return api("DELETE", `${threadPath(
|
|
8441
|
+
async function removeThreadAgent(id2, columnId) {
|
|
8442
|
+
return api("DELETE", `${threadPath(id2)}/agents/${encodeURIComponent(columnId)}`);
|
|
8364
8443
|
}
|
|
8365
|
-
async function interruptThread(
|
|
8366
|
-
return api("POST", `${threadPath(
|
|
8444
|
+
async function interruptThread(id2, columnId) {
|
|
8445
|
+
return api("POST", `${threadPath(id2)}/interrupt`, columnId ? { columnId } : {});
|
|
8367
8446
|
}
|
|
8368
|
-
async function forkThread(
|
|
8369
|
-
return api("POST", `${threadPath(
|
|
8447
|
+
async function forkThread(id2, body) {
|
|
8448
|
+
return api("POST", `${threadPath(id2)}/fork`, body);
|
|
8370
8449
|
}
|
|
8371
|
-
async function changeThreadModel(
|
|
8372
|
-
return api("PATCH", `${threadPath(
|
|
8450
|
+
async function changeThreadModel(id2, change, columnId) {
|
|
8451
|
+
return api("PATCH", `${threadPath(id2)}/engine${columnId ? `?column=${encodeURIComponent(columnId)}` : ""}`, change);
|
|
8373
8452
|
}
|
|
8374
8453
|
async function searchThreads(q, opts = {}) {
|
|
8375
8454
|
const params = new URLSearchParams({ q, ...opts.threads ? { threads: opts.threads } : {}, ...opts.cursor ? { cursor: opts.cursor } : {} });
|
|
@@ -8414,10 +8493,10 @@ function renderThreadSummary(t) {
|
|
|
8414
8493
|
}
|
|
8415
8494
|
|
|
8416
8495
|
// src/library.ts
|
|
8417
|
-
import { readFileSync as
|
|
8496
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
8418
8497
|
|
|
8419
8498
|
// src/api-command.ts
|
|
8420
|
-
import { readFileSync as
|
|
8499
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
8421
8500
|
|
|
8422
8501
|
// ../../packages/spec/src/operation-search.ts
|
|
8423
8502
|
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"]);
|
|
@@ -8529,9 +8608,9 @@ function operationSearch(operations, components) {
|
|
|
8529
8608
|
// src/api-command.ts
|
|
8530
8609
|
var API_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
8531
8610
|
var SEARCH_LIMIT = 25;
|
|
8532
|
-
function readData(data, stdin = () =>
|
|
8611
|
+
function readData(data, stdin = () => readFileSync21(0, "utf8")) {
|
|
8533
8612
|
if (data === void 0) return void 0;
|
|
8534
|
-
const raw = data === "-" ? stdin() : data.startsWith("@") ?
|
|
8613
|
+
const raw = data === "-" ? stdin() : data.startsWith("@") ? readFileSync21(data.slice(1), "utf8") : data;
|
|
8535
8614
|
try {
|
|
8536
8615
|
JSON.parse(raw);
|
|
8537
8616
|
} catch {
|
|
@@ -8594,7 +8673,7 @@ async function callApi(method, path2, opts) {
|
|
|
8594
8673
|
}
|
|
8595
8674
|
|
|
8596
8675
|
// src/library.ts
|
|
8597
|
-
var artifactPath = (
|
|
8676
|
+
var artifactPath = (id2) => `/library/artifacts/${encodeURIComponent(id2)}`;
|
|
8598
8677
|
var savedVersion = external_exports.number().int().positive().max(2147483646);
|
|
8599
8678
|
var artifactResponse = external_exports.object({
|
|
8600
8679
|
id: external_exports.string().min(1).optional(),
|
|
@@ -8607,12 +8686,12 @@ function libraryArtifact(value) {
|
|
|
8607
8686
|
const parsed = artifactResponse.safeParse(value);
|
|
8608
8687
|
if (!parsed.success) throw new Error("Invalid Library artifact response.");
|
|
8609
8688
|
const row = parsed.data;
|
|
8610
|
-
const
|
|
8689
|
+
const id2 = row.id ?? row.artifactId;
|
|
8611
8690
|
const currentVersion = row.currentVersion ?? row.version;
|
|
8612
|
-
if (!
|
|
8691
|
+
if (!id2 || currentVersion === void 0 || row.id !== void 0 && row.artifactId !== void 0 && row.id !== row.artifactId || row.currentVersion !== void 0 && row.version !== void 0 && row.currentVersion !== row.version) {
|
|
8613
8692
|
throw new Error("Invalid Library artifact response.");
|
|
8614
8693
|
}
|
|
8615
|
-
return { ...row, id:
|
|
8694
|
+
return { ...row, id: id2, currentVersion };
|
|
8616
8695
|
}
|
|
8617
8696
|
async function listLibrary(query = {}) {
|
|
8618
8697
|
const params = new URLSearchParams(Object.entries(query).filter((entry) => Boolean(entry[1])));
|
|
@@ -8630,23 +8709,23 @@ async function uploadToLibrary(file, requestId2, workspace2, sessionId) {
|
|
|
8630
8709
|
const uploaded = await apiForm("POST", "/library/artifacts", form);
|
|
8631
8710
|
return { ...uploaded, artifact: libraryArtifact(uploaded.artifact) };
|
|
8632
8711
|
}
|
|
8633
|
-
async function getLibraryArtifact(
|
|
8634
|
-
const artifact2 = libraryArtifact(await api("GET", artifactPath(
|
|
8635
|
-
if (artifact2.id !==
|
|
8712
|
+
async function getLibraryArtifact(id2) {
|
|
8713
|
+
const artifact2 = libraryArtifact(await api("GET", artifactPath(id2)));
|
|
8714
|
+
if (artifact2.id !== id2) throw new Error("Invalid Library artifact response.");
|
|
8636
8715
|
return artifact2;
|
|
8637
8716
|
}
|
|
8638
|
-
async function deleteLibraryArtifact(
|
|
8639
|
-
return api("DELETE", artifactPath(
|
|
8717
|
+
async function deleteLibraryArtifact(id2, revision) {
|
|
8718
|
+
return api("DELETE", artifactPath(id2), { revision: savedVersion.parse(revision) });
|
|
8640
8719
|
}
|
|
8641
|
-
async function shareLibraryArtifact(
|
|
8642
|
-
const { currentVersion } = await getLibraryArtifact(
|
|
8643
|
-
return api("PATCH", `${artifactPath(
|
|
8720
|
+
async function shareLibraryArtifact(id2, enabled) {
|
|
8721
|
+
const { currentVersion } = await getLibraryArtifact(id2);
|
|
8722
|
+
return api("PATCH", `${artifactPath(id2)}/share`, { enabled, revision: currentVersion });
|
|
8644
8723
|
}
|
|
8645
|
-
async function placeLibraryArtifact(
|
|
8646
|
-
return api("PATCH", `${artifactPath(
|
|
8724
|
+
async function placeLibraryArtifact(id2, workspace2) {
|
|
8725
|
+
return api("PATCH", `${artifactPath(id2)}/workspace`, { workspace: workspace2 });
|
|
8647
8726
|
}
|
|
8648
|
-
async function downloadLibraryArtifact(
|
|
8649
|
-
return apiBytes("GET", `${artifactPath(
|
|
8727
|
+
async function downloadLibraryArtifact(id2, version) {
|
|
8728
|
+
return apiBytes("GET", `${artifactPath(id2)}/download${version ? `?version=${version}` : ""}`);
|
|
8650
8729
|
}
|
|
8651
8730
|
function renderLibraryArtifact(artifact2) {
|
|
8652
8731
|
const version = artifact2.currentVersion ? `v${artifact2.currentVersion}` : "";
|
|
@@ -8755,7 +8834,7 @@ function registerLibraryLinkCommands(library2) {
|
|
|
8755
8834
|
});
|
|
8756
8835
|
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) => {
|
|
8757
8836
|
if (opts.file !== void 0 === (opts.data !== void 0)) throw new Error("Choose exactly one of --file or --data.");
|
|
8758
|
-
const body = opts.file !== void 0 ? { text: new TextDecoder("utf-8", { fatal: true }).decode(
|
|
8837
|
+
const body = opts.file !== void 0 ? { text: new TextDecoder("utf-8", { fatal: true }).decode(readFileSync22(opts.file)) } : JSON.parse(readData(opts.data));
|
|
8759
8838
|
if (!body || typeof body !== "object" || Array.isArray(body)) throw new Error("--data must be a JSON object with one native save field.");
|
|
8760
8839
|
if ("revision" in body && body.revision !== opts.revision) throw new Error("--data revision must match --revision.");
|
|
8761
8840
|
console.log(JSON.stringify(await saveSharedLibraryFile(opts.token, sharedLibrarySaveSchema.parse({ ...body, revision: opts.revision })), null, 2));
|
|
@@ -8789,8 +8868,8 @@ async function listTodos(query = {}) {
|
|
|
8789
8868
|
const params = new URLSearchParams(Object.entries({ ...query, today }).filter((entry) => Boolean(entry[1])));
|
|
8790
8869
|
return api("GET", `/library/todos?${params}`);
|
|
8791
8870
|
}
|
|
8792
|
-
async function setTodoDone(
|
|
8793
|
-
return api("PATCH", `/library/todos/${encodeURIComponent(
|
|
8871
|
+
async function setTodoDone(id2, done) {
|
|
8872
|
+
return api("PATCH", `/library/todos/${encodeURIComponent(id2)}`, { done });
|
|
8794
8873
|
}
|
|
8795
8874
|
function renderTodo(todo) {
|
|
8796
8875
|
const facts = [todo.assignee ? `@${todo.assignee}` : null, todo.due ? todo.overdue ? `${todo.due} overdue` : todo.due : null, `${todo.source.name}:${todo.line}`].filter(Boolean).join(" ");
|
|
@@ -8807,8 +8886,8 @@ async function listItems(query) {
|
|
|
8807
8886
|
if (query.cursor) params.set("cursor", query.cursor);
|
|
8808
8887
|
return api("GET", `/action-items${params.size ? `?${params}` : ""}`);
|
|
8809
8888
|
}
|
|
8810
|
-
async function actOnItem(
|
|
8811
|
-
return api("POST", `/action-items/${encodeURIComponent(
|
|
8889
|
+
async function actOnItem(id2, opts) {
|
|
8890
|
+
return api("POST", `/action-items/${encodeURIComponent(id2)}/act`, {
|
|
8812
8891
|
...opts.option ? { option_id: opts.option } : {},
|
|
8813
8892
|
...opts.text ? { text: opts.text } : {},
|
|
8814
8893
|
...opts.engine ? { agent_type: opts.engine } : {},
|
|
@@ -8836,8 +8915,8 @@ async function listAsks(query) {
|
|
|
8836
8915
|
if (query.direction) params.set("direction", query.direction);
|
|
8837
8916
|
return api("GET", `/asks${params.size ? `?${params}` : ""}`);
|
|
8838
8917
|
}
|
|
8839
|
-
async function answerAsk(
|
|
8840
|
-
return api("POST", `/asks/${encodeURIComponent(
|
|
8918
|
+
async function answerAsk(id2, opts) {
|
|
8919
|
+
return api("POST", `/asks/${encodeURIComponent(id2)}/answer`, {
|
|
8841
8920
|
...opts.option ? { option_id: opts.option } : {},
|
|
8842
8921
|
...opts.text ? { text: opts.text } : {},
|
|
8843
8922
|
...opts.engine ? { agent_type: opts.engine } : {},
|
|
@@ -8859,7 +8938,7 @@ function renderAnswered(result) {
|
|
|
8859
8938
|
}
|
|
8860
8939
|
|
|
8861
8940
|
// src/signing.ts
|
|
8862
|
-
import { readFileSync as
|
|
8941
|
+
import { readFileSync as readFileSync23, writeFileSync as writeFileSync11 } from "fs";
|
|
8863
8942
|
function signedText(file, opts) {
|
|
8864
8943
|
if (file && opts.artifact) throw new Error("Give a file or --artifact, not both.");
|
|
8865
8944
|
if (opts.artifact) {
|
|
@@ -8868,7 +8947,7 @@ function signedText(file, opts) {
|
|
|
8868
8947
|
return { source: { artifact_id: opts.artifact, version } };
|
|
8869
8948
|
}
|
|
8870
8949
|
if (!file) throw new Error("Give the Markdown file to sign, or --artifact and --artifact-version.");
|
|
8871
|
-
return { document:
|
|
8950
|
+
return { document: readFileSync23(file, "utf8") };
|
|
8872
8951
|
}
|
|
8873
8952
|
async function requestSignature(file, opts) {
|
|
8874
8953
|
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.");
|
|
@@ -8891,18 +8970,18 @@ async function listRequests(query) {
|
|
|
8891
8970
|
if (query.link) params.set("link", query.link);
|
|
8892
8971
|
return api("GET", `/signing-requests${params.size ? `?${params}` : ""}`);
|
|
8893
8972
|
}
|
|
8894
|
-
async function readRequest(
|
|
8895
|
-
return api("GET", `/signing-requests/${encodeURIComponent(
|
|
8973
|
+
async function readRequest(id2) {
|
|
8974
|
+
return api("GET", `/signing-requests/${encodeURIComponent(id2)}`);
|
|
8896
8975
|
}
|
|
8897
|
-
async function readDocument(
|
|
8898
|
-
return api("GET", `/signing-requests/${encodeURIComponent(
|
|
8976
|
+
async function readDocument(id2) {
|
|
8977
|
+
return api("GET", `/signing-requests/${encodeURIComponent(id2)}/document`);
|
|
8899
8978
|
}
|
|
8900
|
-
async function saveCopy(
|
|
8901
|
-
const { bytes } = await apiBytes("GET", `/signing-requests/${encodeURIComponent(
|
|
8979
|
+
async function saveCopy(id2, file) {
|
|
8980
|
+
const { bytes } = await apiBytes("GET", `/signing-requests/${encodeURIComponent(id2)}/copy`);
|
|
8902
8981
|
writeFileSync11(file, bytes);
|
|
8903
8982
|
}
|
|
8904
|
-
async function cancelRequest(
|
|
8905
|
-
return api("POST", `/signing-requests/${encodeURIComponent(
|
|
8983
|
+
async function cancelRequest(id2) {
|
|
8984
|
+
return api("POST", `/signing-requests/${encodeURIComponent(id2)}/cancel`);
|
|
8906
8985
|
}
|
|
8907
8986
|
function renderRequest3(request3) {
|
|
8908
8987
|
const who = request3.signer ? `for ${request3.signer.name} <${request3.signer.email}>` : "for anyone with the link";
|
|
@@ -8956,7 +9035,7 @@ function renderItem2(item) {
|
|
|
8956
9035
|
}
|
|
8957
9036
|
|
|
8958
9037
|
// src/design-systems.ts
|
|
8959
|
-
import { readdirSync as
|
|
9038
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync24, statSync as statSync8 } from "fs";
|
|
8960
9039
|
import { join as join19, relative as relative5, sep as sep4 } from "path";
|
|
8961
9040
|
var TEXT2 = /\.(mdx?|markdown|txt|json|m?js|cjs|jsx|tsx?|css|html?|svg|xml|csv|ya?ml|toml)$/i;
|
|
8962
9041
|
var MEDIA = {
|
|
@@ -8976,21 +9055,21 @@ var MEDIA = {
|
|
|
8976
9055
|
async function listDesignSystems() {
|
|
8977
9056
|
return (await api("GET", "/artifacts?kind=design_system")).artifacts;
|
|
8978
9057
|
}
|
|
8979
|
-
async function getDesignSystem(
|
|
8980
|
-
return (await api("GET", `/artifacts/${encodeURIComponent(
|
|
9058
|
+
async function getDesignSystem(id2) {
|
|
9059
|
+
return (await api("GET", `/artifacts/${encodeURIComponent(id2)}/design-system`)).design_system;
|
|
8981
9060
|
}
|
|
8982
9061
|
async function importDesignSystem(task, files2, title) {
|
|
8983
9062
|
return (await api("POST", "/artifacts/design-systems", { task_id: task, files: files2, ...title ? { title } : {} })).artifact;
|
|
8984
9063
|
}
|
|
8985
|
-
async function saveDesignTokens(
|
|
8986
|
-
return (await api("PUT", `/artifacts/${encodeURIComponent(
|
|
9064
|
+
async function saveDesignTokens(id2, baseVersion, tokens, note) {
|
|
9065
|
+
return (await api("PUT", `/artifacts/${encodeURIComponent(id2)}/design-system/tokens`, {
|
|
8987
9066
|
base_version: baseVersion,
|
|
8988
9067
|
tokens,
|
|
8989
9068
|
...note ? { note } : {}
|
|
8990
9069
|
})).artifact;
|
|
8991
9070
|
}
|
|
8992
|
-
async function saveDesignSystemFile(
|
|
8993
|
-
return (await api("PUT", `/artifacts/${encodeURIComponent(
|
|
9071
|
+
async function saveDesignSystemFile(id2, path2, baseVersion, change, note) {
|
|
9072
|
+
return (await api("PUT", `/artifacts/${encodeURIComponent(id2)}/design-system/files/${path2.split("/").map(encodeURIComponent).join("/")}`, {
|
|
8994
9073
|
base_version: baseVersion,
|
|
8995
9074
|
...change,
|
|
8996
9075
|
...note ? { note } : {}
|
|
@@ -8999,7 +9078,7 @@ async function saveDesignSystemFile(id3, path2, baseVersion, change, note) {
|
|
|
8999
9078
|
function fileTableFrom(dir) {
|
|
9000
9079
|
const files2 = {};
|
|
9001
9080
|
const walk = (current) => {
|
|
9002
|
-
for (const name of
|
|
9081
|
+
for (const name of readdirSync10(current)) {
|
|
9003
9082
|
if (name.startsWith(".") || name === "node_modules") continue;
|
|
9004
9083
|
const path2 = join19(current, name);
|
|
9005
9084
|
if (statSync8(path2).isDirectory()) {
|
|
@@ -9007,7 +9086,7 @@ function fileTableFrom(dir) {
|
|
|
9007
9086
|
continue;
|
|
9008
9087
|
}
|
|
9009
9088
|
const key = relative5(dir, path2).split(sep4).join("/");
|
|
9010
|
-
const bytes =
|
|
9089
|
+
const bytes = readFileSync24(path2);
|
|
9011
9090
|
files2[key] = TEXT2.test(name) ? bytes.toString("utf8") : `data:${MEDIA[name.split(".").pop()?.toLowerCase() ?? ""] ?? "application/octet-stream"};base64,${bytes.toString("base64")}`;
|
|
9012
9091
|
}
|
|
9013
9092
|
};
|
|
@@ -9026,12 +9105,12 @@ function renderDesignSystem(system) {
|
|
|
9026
9105
|
for (const token of tokens?.dropped ?? []) lines2.push(`not read: ${token.family} ${token.name || "(unnamed)"}: ${token.reason}`);
|
|
9027
9106
|
return lines2.join("\n");
|
|
9028
9107
|
}
|
|
9029
|
-
async function designComments(
|
|
9030
|
-
return api(input ? "POST" : "GET", `/artifacts/${encodeURIComponent(
|
|
9108
|
+
async function designComments(id2, input) {
|
|
9109
|
+
return api(input ? "POST" : "GET", `/artifacts/${encodeURIComponent(id2)}/design-system/comments`, input);
|
|
9031
9110
|
}
|
|
9032
9111
|
|
|
9033
9112
|
// src/tool-command.ts
|
|
9034
|
-
import { readFileSync as
|
|
9113
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
9035
9114
|
async function rpc(method, params) {
|
|
9036
9115
|
const res = await apiRaw("POST", "/mcp", {
|
|
9037
9116
|
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
|
|
@@ -9057,8 +9136,8 @@ async function listTools(opts = {}) {
|
|
|
9057
9136
|
}
|
|
9058
9137
|
for (const tool2 of tools) console.log(`${tool2.name} ${(tool2.description ?? "").split("\n")[0]}`);
|
|
9059
9138
|
}
|
|
9060
|
-
async function callTool(name, opts = {}, stdin = () =>
|
|
9061
|
-
const raw = opts.json === void 0 ? "{}" : opts.json === "-" ? stdin() : opts.json.startsWith("@") ?
|
|
9139
|
+
async function callTool(name, opts = {}, stdin = () => readFileSync25(0, "utf8")) {
|
|
9140
|
+
const raw = opts.json === void 0 ? "{}" : opts.json === "-" ? stdin() : opts.json.startsWith("@") ? readFileSync25(opts.json.slice(1), "utf8") : opts.json;
|
|
9062
9141
|
let args;
|
|
9063
9142
|
try {
|
|
9064
9143
|
args = JSON.parse(raw);
|
|
@@ -9120,7 +9199,7 @@ function referralLinkBody(opts) {
|
|
|
9120
9199
|
return body;
|
|
9121
9200
|
}
|
|
9122
9201
|
var createReferralLink = (opts) => api("POST", "/billing/referral-links", referralLinkBody(opts));
|
|
9123
|
-
var disableReferralLink = (
|
|
9202
|
+
var disableReferralLink = (id2) => api("POST", `/billing/referral-links/${encodeURIComponent(id2)}/disable`);
|
|
9124
9203
|
function renderReferralLinks(dashboard) {
|
|
9125
9204
|
const lines2 = [`priced from ${dashboard.source_plan.name}: customers pay at least ${Math.round(dashboard.source_plan.multiplier * 100)}% of public price`];
|
|
9126
9205
|
for (const link2 of dashboard.links) {
|
|
@@ -9241,7 +9320,7 @@ function withOldCommandNames(root2, argv) {
|
|
|
9241
9320
|
}
|
|
9242
9321
|
|
|
9243
9322
|
// src/harness.ts
|
|
9244
|
-
import { existsSync as existsSync14, mkdirSync as mkdirSync7, readFileSync as
|
|
9323
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync7, readFileSync as readFileSync26, writeFileSync as writeFileSync12 } from "fs";
|
|
9245
9324
|
import { dirname as dirname12, join as join20, resolve as resolve11 } from "path";
|
|
9246
9325
|
var HARNESS_FILE = "harness.json";
|
|
9247
9326
|
function harnessFilePath(dir) {
|
|
@@ -9253,7 +9332,7 @@ function readHarnessFile(dir) {
|
|
|
9253
9332
|
throw new Error(`no ${HARNESS_FILE} found in ${resolve11(dir)} \u2014 run \`sky harness init\` first`);
|
|
9254
9333
|
}
|
|
9255
9334
|
try {
|
|
9256
|
-
return JSON.parse(
|
|
9335
|
+
return JSON.parse(readFileSync26(path2, "utf8"));
|
|
9257
9336
|
} catch (err) {
|
|
9258
9337
|
throw new Error(`could not parse ${path2}: ${err instanceof Error ? err.message : String(err)}`);
|
|
9259
9338
|
}
|
|
@@ -9692,7 +9771,7 @@ agent.command("create").description("create an agent spec \u2014 no runtime; `sk
|
|
|
9692
9771
|
).option("--name <name>", "agent name").option(
|
|
9693
9772
|
"--capability <id>",
|
|
9694
9773
|
"grant a built-in capability (repeatable; ids at /docs/capabilities; none by default)",
|
|
9695
|
-
(
|
|
9774
|
+
(id2, all) => [...all, id2],
|
|
9696
9775
|
[]
|
|
9697
9776
|
).option("-f, --file <path>", "create from an agent.toml").action(
|
|
9698
9777
|
run2(
|
|
@@ -9730,8 +9809,8 @@ agent.command("list").action(
|
|
|
9730
9809
|
})
|
|
9731
9810
|
);
|
|
9732
9811
|
agent.command("show <id>").action(
|
|
9733
|
-
run2(async (
|
|
9734
|
-
const { agent: a } = await api("GET", `/agents/${encodeURIComponent(
|
|
9812
|
+
run2(async (id2) => {
|
|
9813
|
+
const { agent: a } = await api("GET", `/agents/${encodeURIComponent(id2)}`);
|
|
9735
9814
|
console.log(`${a.id} \u2014 ${a.displayName}${a.archived ? " (archived)" : ""}`);
|
|
9736
9815
|
console.log(` type ${a.agentType} \xB7 ${a.llm}`);
|
|
9737
9816
|
if (a.reasoningEffort) console.log(` effort ${a.reasoningEffort}`);
|
|
@@ -9754,9 +9833,9 @@ agent.command("apply").description(`make an agent what a manifest file declares
|
|
|
9754
9833
|
}
|
|
9755
9834
|
if (!opts.file) throw new Error("pass -f <manifest file>, or --template <ref>");
|
|
9756
9835
|
const path2 = resolve12(opts.file);
|
|
9757
|
-
const { id:
|
|
9836
|
+
const { id: id2, manifest } = readManifestFile(path2);
|
|
9758
9837
|
try {
|
|
9759
|
-
if (!
|
|
9838
|
+
if (!id2) {
|
|
9760
9839
|
if (opts.dryRun) {
|
|
9761
9840
|
console.log(`No agent id in ${opts.file}: sky agent apply would create a new agent.`);
|
|
9762
9841
|
return;
|
|
@@ -9767,19 +9846,19 @@ agent.command("apply").description(`make an agent what a manifest file declares
|
|
|
9767
9846
|
return;
|
|
9768
9847
|
}
|
|
9769
9848
|
const query = opts.dryRun ? "?dry_run=true" : "";
|
|
9770
|
-
const result = await api("PUT", `/agents/${encodeURIComponent(
|
|
9771
|
-
for (const line2 of applyReport(
|
|
9849
|
+
const result = await api("PUT", `/agents/${encodeURIComponent(id2)}/manifest${query}`, manifest);
|
|
9850
|
+
for (const line2 of applyReport(id2, false, result.changes, result.applied, result.version)) console.log(line2);
|
|
9772
9851
|
} catch (error) {
|
|
9773
9852
|
const issues = error instanceof ApiError && Array.isArray(error.details.issues) ? error.details.issues : [];
|
|
9774
9853
|
if (!issues.length) throw error;
|
|
9775
|
-
throw new Error(refusalLines(opts.file,
|
|
9854
|
+
throw new Error(refusalLines(opts.file, readFileSync27(path2, "utf8"), issues).join("\n"));
|
|
9776
9855
|
}
|
|
9777
9856
|
})
|
|
9778
9857
|
);
|
|
9779
9858
|
agent.command("export <id>").description("write an agent as a manifest file that `sky agent apply` reads back unchanged").option("-o, --output <path>", "file to write; omitted prints it").action(
|
|
9780
|
-
run2(async (
|
|
9781
|
-
const { manifest, version } = await api("GET", `/agents/${encodeURIComponent(
|
|
9782
|
-
const text2 = manifestToToml(
|
|
9859
|
+
run2(async (id2, opts) => {
|
|
9860
|
+
const { manifest, version } = await api("GET", `/agents/${encodeURIComponent(id2)}/manifest`);
|
|
9861
|
+
const text2 = manifestToToml(id2, manifest);
|
|
9783
9862
|
if (!opts.output) {
|
|
9784
9863
|
process.stdout.write(text2);
|
|
9785
9864
|
return;
|
|
@@ -9801,25 +9880,25 @@ agent.command("record").description("how each harness and model did, as the sess
|
|
|
9801
9880
|
})
|
|
9802
9881
|
);
|
|
9803
9882
|
agent.command("archive <id>").description("retire the spec \u2014 read-only, running sessions unaffected (admin scope)").action(
|
|
9804
|
-
run2(async (
|
|
9805
|
-
await api("POST", `/agents/${encodeURIComponent(
|
|
9806
|
-
console.log(`Archived ${
|
|
9883
|
+
run2(async (id2) => {
|
|
9884
|
+
await api("POST", `/agents/${encodeURIComponent(id2)}/archive`);
|
|
9885
|
+
console.log(`Archived ${id2} \u2014 sessions keep running; new sessions are rejected.`);
|
|
9807
9886
|
})
|
|
9808
9887
|
);
|
|
9809
9888
|
agent.command("destroy <id>").description("delete the spec with no live sessions, or archive to preserve deleted session history (admin scope)").action(
|
|
9810
|
-
run2(async (
|
|
9811
|
-
const result = await api("DELETE", `/agents/${encodeURIComponent(
|
|
9812
|
-
if (result.outcome === "deleted") console.log(`Deleted ${
|
|
9813
|
-
else if (result.outcome === "archived") console.log(`Archived ${
|
|
9889
|
+
run2(async (id2) => {
|
|
9890
|
+
const result = await api("DELETE", `/agents/${encodeURIComponent(id2)}`);
|
|
9891
|
+
if (result.outcome === "deleted") console.log(`Deleted ${id2}`);
|
|
9892
|
+
else if (result.outcome === "archived") console.log(`Archived ${id2} \u2014 deleted session history is preserved.`);
|
|
9814
9893
|
else throw new Error("The server did not report whether the agent was deleted or archived.");
|
|
9815
9894
|
})
|
|
9816
9895
|
);
|
|
9817
9896
|
agent.command("message <id> [text]").description("send one message to the default session and stream the turn until idle").option("--detach", "don't follow the stream; exit once the message is accepted").option("--file <path...>", "attach local files (uploaded first, sent as document blocks); a file_\u2026 id attaches that stored file").option("--file-id <id...>", "attach files already uploaded (`sky files upload`), by id, without uploading again").option("--image <path...>", "attach local images (uploaded first, sent as image blocks)").option("--system <text>", "per-turn system text sent alongside the message").option("--plan", "plan mode: the agent inspects and answers with a plan, then waits for you to choose to implement it").option("--build", "build mode for this turn, overriding a session left in plan mode").action(
|
|
9818
9897
|
run2(
|
|
9819
|
-
async (
|
|
9898
|
+
async (id2, text2, opts) => sendAndFollow(await resolveSessionRef(id2), text2 ?? "", opts)
|
|
9820
9899
|
)
|
|
9821
9900
|
);
|
|
9822
|
-
agent.command("chat <id>").description("interactive REPL with the default session").option("--system <text>", "per-turn system text sent with the first message").action(run2(async (
|
|
9901
|
+
agent.command("chat <id>").description("interactive REPL with the default session").option("--system <text>", "per-turn system text sent with the first message").action(run2(async (id2, opts) => chatLoop(await resolveSessionRef(id2), opts)));
|
|
9823
9902
|
var session = program.command("session").description("sessions: the running instances of an agent");
|
|
9824
9903
|
session.command("remind <session> <request>").description("send the person a waiting connect request is for a fresh private link (it never comes to you)").action(
|
|
9825
9904
|
run2(async (sessionId, requestId2) => {
|
|
@@ -9897,10 +9976,10 @@ session.command("list [agent]").option("--limit <n>", "how many of the newest se
|
|
|
9897
9976
|
})
|
|
9898
9977
|
);
|
|
9899
9978
|
session.command("show <id>").action(
|
|
9900
|
-
run2(async (
|
|
9979
|
+
run2(async (id2) => {
|
|
9901
9980
|
const { session: s } = await api(
|
|
9902
9981
|
"GET",
|
|
9903
|
-
`/sessions/${encodeURIComponent(
|
|
9982
|
+
`/sessions/${encodeURIComponent(id2)}`
|
|
9904
9983
|
);
|
|
9905
9984
|
console.log(`${s.id}${s.default ? " [default]" : ""}`);
|
|
9906
9985
|
console.log(` agent ${s.agentId ?? "-"}`);
|
|
@@ -9910,29 +9989,29 @@ session.command("show <id>").action(
|
|
|
9910
9989
|
if (s.executor) console.log(` runs ${s.executor.kind}${s.executor.movedTo ? ` \u2192 ${s.executor.movedTo}` : ""}`);
|
|
9911
9990
|
})
|
|
9912
9991
|
);
|
|
9913
|
-
function failWithInterruptHint(error,
|
|
9992
|
+
function failWithInterruptHint(error, id2) {
|
|
9914
9993
|
if (error instanceof ApiError && error.code === "session_running") {
|
|
9915
9994
|
console.error(
|
|
9916
|
-
`sky: session is running \u2014 \`sky session interrupt ${
|
|
9995
|
+
`sky: session is running \u2014 \`sky session interrupt ${id2}\`, wait for idle, then retry`
|
|
9917
9996
|
);
|
|
9918
9997
|
process.exit(1);
|
|
9919
9998
|
}
|
|
9920
9999
|
throw error;
|
|
9921
10000
|
}
|
|
9922
10001
|
session.command("archive <id>").description("irreversibly archive: no new messages, pod torn down, history stays readable").action(
|
|
9923
|
-
run2(async (
|
|
9924
|
-
await api("POST", `/sessions/${encodeURIComponent(
|
|
9925
|
-
(error) => failWithInterruptHint(error,
|
|
10002
|
+
run2(async (id2) => {
|
|
10003
|
+
await api("POST", `/sessions/${encodeURIComponent(id2)}/archive`).catch(
|
|
10004
|
+
(error) => failWithInterruptHint(error, id2)
|
|
9926
10005
|
);
|
|
9927
|
-
console.log(`Archived ${
|
|
10006
|
+
console.log(`Archived ${id2} \u2014 terminated; history stays readable. This is irreversible.`);
|
|
9928
10007
|
})
|
|
9929
10008
|
);
|
|
9930
10009
|
session.command("delete <id>").description("permanently delete the session, its events, and its sandbox").action(
|
|
9931
|
-
run2(async (
|
|
9932
|
-
await api("DELETE", `/sessions/${encodeURIComponent(
|
|
9933
|
-
(error) => failWithInterruptHint(error,
|
|
10010
|
+
run2(async (id2) => {
|
|
10011
|
+
await api("DELETE", `/sessions/${encodeURIComponent(id2)}`).catch(
|
|
10012
|
+
(error) => failWithInterruptHint(error, id2)
|
|
9934
10013
|
);
|
|
9935
|
-
console.log(`Deleted ${
|
|
10014
|
+
console.log(`Deleted ${id2}`);
|
|
9936
10015
|
})
|
|
9937
10016
|
);
|
|
9938
10017
|
session.command("message <ref> [text]").description("send one message (session id, or agent id = its default session)").option("--detach", "don't follow the stream; exit once the message is accepted").option("--file <path...>", "attach local files (uploaded first, sent as document blocks); a file_\u2026 id attaches that stored file").option("--file-id <id...>", "attach files already uploaded (`sky files upload`), by id, without uploading again").option("--image <path...>", "attach local images (uploaded first, sent as image blocks)").option("--system <text>", "per-turn system text sent alongside the message").option("--plan", "plan mode: the agent inspects and answers with a plan, then waits for you to choose to implement it").option("--build", "build mode for this turn, overriding a session left in plan mode").option("--run <id>", "send to one Agent's run in the session (run_\u2026, from `sky session overview` or `sky api GET /runs?session_id=\u2026`) instead of the session's own turn").action(
|
|
@@ -9944,10 +10023,10 @@ session.command("chat <ref>").description("interactive REPL over the standing st
|
|
|
9944
10023
|
session.command("interrupt <ref>").description("abort the in-flight turn: your own run, one named run (--run), or every run (--all)").option("--run <id>", "stop this run of the session (several people's agents can run at once)").option("--all", "stop every active run in the session (session owner and workspace owners/admins only)").action(
|
|
9945
10024
|
run2(async (ref, opts) => {
|
|
9946
10025
|
if (opts.run && opts.all) throw new Error("pass --run <id> or --all, not both");
|
|
9947
|
-
const
|
|
10026
|
+
const id2 = await resolveSessionRef(ref);
|
|
9948
10027
|
const res = await api(
|
|
9949
10028
|
"POST",
|
|
9950
|
-
`/sessions/${encodeURIComponent(
|
|
10029
|
+
`/sessions/${encodeURIComponent(id2)}/interrupt`,
|
|
9951
10030
|
interruptBody(opts)
|
|
9952
10031
|
);
|
|
9953
10032
|
console.log(interruptLine(res));
|
|
@@ -9970,11 +10049,11 @@ session.command("read <ref>").description("what the agent has said since the las
|
|
|
9970
10049
|
);
|
|
9971
10050
|
session.command("share <ref>").description("print the session's share link, turning sharing on; --view makes it read-only, --off turns it off").option("--view", "a view-only link: holders read the conversation").option("--browser-visible", "explicitly include the live browser, view only; rotates an older text-only link").option("--rotate", "replace the link; the old one stops working").option("--off", "turn sharing off; the link stops working at once").action(
|
|
9972
10051
|
run2(async (ref, opts) => {
|
|
9973
|
-
const
|
|
9974
|
-
const path2 = `/sessions/${encodeURIComponent(
|
|
10052
|
+
const id2 = await resolveSessionRef(ref);
|
|
10053
|
+
const path2 = `/sessions/${encodeURIComponent(id2)}/share`;
|
|
9975
10054
|
if (opts.off) {
|
|
9976
10055
|
await api("DELETE", path2);
|
|
9977
|
-
console.log(`Sharing is off for ${
|
|
10056
|
+
console.log(`Sharing is off for ${id2}`);
|
|
9978
10057
|
return;
|
|
9979
10058
|
}
|
|
9980
10059
|
const link2 = await api("POST", path2, {
|
|
@@ -9988,11 +10067,11 @@ session.command("share <ref>").description("print the session's share link, turn
|
|
|
9988
10067
|
var personLine = (person) => [person.user_id, person.name?.trim() || person.email?.split("@")[0] || "-", person.email ?? ""].join(" ");
|
|
9989
10068
|
session.command("people <ref>").description("everyone who may send the session turns (the people @ can name and it can be assigned to), and who has it open now").option("--json", "print the API's answers as JSON").action(
|
|
9990
10069
|
run2(async (ref, opts) => {
|
|
9991
|
-
const
|
|
10070
|
+
const id2 = encodeURIComponent(await resolveSessionRef(ref));
|
|
9992
10071
|
const [people, present, assigned] = await Promise.all([
|
|
9993
|
-
api("GET", `/sessions/${
|
|
9994
|
-
api("GET", `/sessions/${
|
|
9995
|
-
api("GET", `/sessions/${
|
|
10072
|
+
api("GET", `/sessions/${id2}/people`),
|
|
10073
|
+
api("GET", `/sessions/${id2}/presence`),
|
|
10074
|
+
api("GET", `/sessions/${id2}/assign`)
|
|
9996
10075
|
]);
|
|
9997
10076
|
if (opts.json) {
|
|
9998
10077
|
console.log(JSON.stringify({ people: people.people, present: present.people, assignee: assigned.assignee }, null, 2));
|
|
@@ -10008,32 +10087,32 @@ session.command("people <ref>").description("everyone who may send the session t
|
|
|
10008
10087
|
session.command("assign <ref> [userId]").description("assign the session to one of its people (a user id from `sky session people`): they see it waiting on them and are notified; --clear unassigns it").option("--clear", "clear the assignment").action(
|
|
10009
10088
|
run2(async (ref, userId, opts) => {
|
|
10010
10089
|
if (Boolean(userId) === Boolean(opts.clear)) throw new Error("pass a user id, or --clear");
|
|
10011
|
-
const
|
|
10012
|
-
const { assignee } = await api("PUT", `/sessions/${encodeURIComponent(
|
|
10013
|
-
console.log(assignee ? `Assigned ${
|
|
10090
|
+
const id2 = await resolveSessionRef(ref);
|
|
10091
|
+
const { assignee } = await api("PUT", `/sessions/${encodeURIComponent(id2)}/assign`, { user_id: opts.clear ? null : userId });
|
|
10092
|
+
console.log(assignee ? `Assigned ${id2} to ${personLine(assignee).split(" ")[1]}` : `${id2} is not assigned to anyone`);
|
|
10014
10093
|
})
|
|
10015
10094
|
);
|
|
10016
10095
|
session.command("usage <ref>").description("session charges and authenticated native usage measurements").option("--limit <n>", "entries to list (default 20)").option("--json", "print the API's answer as JSON").action(
|
|
10017
10096
|
run2(async (ref, opts) => {
|
|
10018
|
-
const
|
|
10019
|
-
const usage = await api("GET", `/sessions/${encodeURIComponent(
|
|
10097
|
+
const id2 = await resolveSessionRef(ref);
|
|
10098
|
+
const usage = await api("GET", `/sessions/${encodeURIComponent(id2)}/usage?limit=${encodeURIComponent(opts.limit ?? "20")}`);
|
|
10020
10099
|
if (opts.json) {
|
|
10021
10100
|
console.log(JSON.stringify(usage, null, 2));
|
|
10022
10101
|
return;
|
|
10023
10102
|
}
|
|
10024
10103
|
const t = usage.totals;
|
|
10025
|
-
console.log(`${
|
|
10104
|
+
console.log(`${id2}: $${t.billedCostUsd.toFixed(4)} billed, ${t.turns} model usage records, ${t.inputTokens} in / ${t.outputTokens} out tokens`);
|
|
10026
10105
|
for (const entry of usage.entries) {
|
|
10027
10106
|
console.log(` ${entry.at} ${entry.kind.padEnd(16)} ${(entry.model ?? "").padEnd(24)} $${entry.billedCostUsd.toFixed(4)}`);
|
|
10028
10107
|
}
|
|
10029
10108
|
})
|
|
10030
10109
|
);
|
|
10031
10110
|
var sessionResources = session.command("resources").description("files and GitHub repositories mounted into a session's working directory");
|
|
10032
|
-
var resourcesPath = (
|
|
10111
|
+
var resourcesPath = (id2) => `/sessions/${encodeURIComponent(id2)}/resources`;
|
|
10033
10112
|
sessionResources.command("list <ref>").description("the session's resources, oldest first").action(
|
|
10034
10113
|
run2(async (ref) => {
|
|
10035
|
-
const
|
|
10036
|
-
const { data } = await api("GET", resourcesPath(
|
|
10114
|
+
const id2 = await resolveSessionRef(ref);
|
|
10115
|
+
const { data } = await api("GET", resourcesPath(id2));
|
|
10037
10116
|
if (!data.length) {
|
|
10038
10117
|
console.log("No resources. `sky session resources add <session> <path>` mounts a file.");
|
|
10039
10118
|
return;
|
|
@@ -10043,28 +10122,28 @@ sessionResources.command("list <ref>").description("the session's resources, old
|
|
|
10043
10122
|
);
|
|
10044
10123
|
sessionResources.command("get <ref> <rid>").description("one resource, as JSON").action(
|
|
10045
10124
|
run2(async (ref, rid) => {
|
|
10046
|
-
const
|
|
10047
|
-
console.log(JSON.stringify(await api("GET", `${resourcesPath(
|
|
10125
|
+
const id2 = await resolveSessionRef(ref);
|
|
10126
|
+
console.log(JSON.stringify(await api("GET", `${resourcesPath(id2)}/${encodeURIComponent(rid)}`), null, 2));
|
|
10048
10127
|
})
|
|
10049
10128
|
);
|
|
10050
10129
|
sessionResources.command("add <ref> <path>").description("upload a local file and mount it read-only: path[:/mount] \u2014 on disk before the next turn").action(
|
|
10051
10130
|
run2(async (ref, spec) => {
|
|
10052
|
-
const
|
|
10053
|
-
const added = await api("POST", resourcesPath(
|
|
10131
|
+
const id2 = await resolveSessionRef(ref);
|
|
10132
|
+
const added = await api("POST", resourcesPath(id2), await fileResource(spec));
|
|
10054
10133
|
console.log(renderResource(added));
|
|
10055
10134
|
})
|
|
10056
10135
|
);
|
|
10057
10136
|
sessionResources.command("rm <ref> <rid>").description("remove a mounted file (repositories stay for the session's lifetime)").action(
|
|
10058
10137
|
run2(async (ref, rid) => {
|
|
10059
|
-
const
|
|
10060
|
-
const gone = await api("DELETE", `${resourcesPath(
|
|
10138
|
+
const id2 = await resolveSessionRef(ref);
|
|
10139
|
+
const gone = await api("DELETE", `${resourcesPath(id2)}/${encodeURIComponent(rid)}`);
|
|
10061
10140
|
console.log(`Removed ${gone.id}`);
|
|
10062
10141
|
})
|
|
10063
10142
|
);
|
|
10064
10143
|
sessionResources.command("rotate <ref> <rid> <token>").description("replace a repository's token; the sandbox's egress policy is updated in place").action(
|
|
10065
10144
|
run2(async (ref, rid, token) => {
|
|
10066
|
-
const
|
|
10067
|
-
const updated = await api("POST", `${resourcesPath(
|
|
10145
|
+
const id2 = await resolveSessionRef(ref);
|
|
10146
|
+
const updated = await api("POST", `${resourcesPath(id2)}/${encodeURIComponent(rid)}`, {
|
|
10068
10147
|
authorization_token: token
|
|
10069
10148
|
});
|
|
10070
10149
|
console.log(`Rotated ${updated.id}`);
|
|
@@ -10072,14 +10151,14 @@ sessionResources.command("rotate <ref> <rid> <token>").description("replace a re
|
|
|
10072
10151
|
);
|
|
10073
10152
|
var runQuery = (opts) => opts.run ? `?run_id=${encodeURIComponent(opts.run)}` : "";
|
|
10074
10153
|
var sessionPorts = session.command("ports").description("local servers in the session's pod, each exposed on an origin of its own");
|
|
10075
|
-
var portsPath = (
|
|
10154
|
+
var portsPath = (id2) => `/sessions/${encodeURIComponent(id2)}/ports`;
|
|
10076
10155
|
function renderPort(p) {
|
|
10077
10156
|
return `${String(p.port).padEnd(5)} ${p.visibility.padEnd(7)} ${p.url}`;
|
|
10078
10157
|
}
|
|
10079
10158
|
sessionPorts.command("list <ref>").description("the session's exposed ports, oldest first").option("--run <run>", "one of your own executions in the session: its own pod's ports").action(
|
|
10080
10159
|
run2(async (ref, opts) => {
|
|
10081
|
-
const
|
|
10082
|
-
const { ports } = await api("GET", `${portsPath(
|
|
10160
|
+
const id2 = await resolveSessionRef(ref);
|
|
10161
|
+
const { ports } = await api("GET", `${portsPath(id2)}${runQuery(opts)}`);
|
|
10083
10162
|
if (!ports.length) {
|
|
10084
10163
|
console.log("No exposed ports. `sky session ports expose <session> <port>` exposes one.");
|
|
10085
10164
|
return;
|
|
@@ -10089,30 +10168,30 @@ sessionPorts.command("list <ref>").description("the session's exposed ports, old
|
|
|
10089
10168
|
);
|
|
10090
10169
|
sessionPorts.command("expose <ref> <port>").description("expose a port the agent's local server listens on; prints its address").option("--run <run>", "one of your own executions in the session: its own pod's ports").option("--public", "anyone with the address may open it; without it the port is private (only entry links admit a browser), and an already public port is made private again").action(
|
|
10091
10170
|
run2(async (ref, port, opts) => {
|
|
10092
|
-
const
|
|
10093
|
-
const exposed = await api("PUT", `${portsPath(
|
|
10171
|
+
const id2 = await resolveSessionRef(ref);
|
|
10172
|
+
const exposed = await api("PUT", `${portsPath(id2)}/${encodeURIComponent(port)}${runQuery(opts)}`, { visibility: opts.public ? "public" : "private" });
|
|
10094
10173
|
console.log(renderPort(exposed));
|
|
10095
10174
|
})
|
|
10096
10175
|
);
|
|
10097
10176
|
sessionPorts.command("open <ref> <port>").description("print an entry link for an exposed port \u2014 single-use and good for a minute on a private port").option("--run <run>", "one of your own executions in the session: its own pod's ports").action(
|
|
10098
10177
|
run2(async (ref, port, opts) => {
|
|
10099
|
-
const
|
|
10100
|
-
const grant = await api("POST", `${portsPath(
|
|
10178
|
+
const id2 = await resolveSessionRef(ref);
|
|
10179
|
+
const grant = await api("POST", `${portsPath(id2)}/${encodeURIComponent(port)}/grants${runQuery(opts)}`, {});
|
|
10101
10180
|
console.log(grant.url);
|
|
10102
10181
|
})
|
|
10103
10182
|
);
|
|
10104
10183
|
sessionPorts.command("revoke <ref> <port>").description("stop exposing a port; its address answers 404 from then on").option("--run <run>", "one of your own executions in the session: its own pod's ports").action(
|
|
10105
10184
|
run2(async (ref, port, opts) => {
|
|
10106
|
-
const
|
|
10107
|
-
await api("DELETE", `${portsPath(
|
|
10185
|
+
const id2 = await resolveSessionRef(ref);
|
|
10186
|
+
await api("DELETE", `${portsPath(id2)}/${encodeURIComponent(port)}${runQuery(opts)}`);
|
|
10108
10187
|
console.log(`Revoked port ${port}`);
|
|
10109
10188
|
})
|
|
10110
10189
|
);
|
|
10111
10190
|
session.command("access <ref>").description("who may use the session; --private/--members, --add-viewer/--remove-viewer and --share-logins change it (owner)").option("--private", "only you can use it").option("--members", "every member of its workspace can read and prompt it").option("--add-viewer <email...>", "people who may read its messages from any workspace").option("--browser-visible", "include the live browser for the addresses added in this change, view only").option("--remove-viewer <email...>", "take viewers off").option("--share-logins [site...]", "everyone who may send turns here acts as you with your saved logins: these sites, or every site except Google").option("--no-share-logins", "stop sharing your logins here and restart the session's computer").action(
|
|
10112
10191
|
run2(async (ref, opts) => {
|
|
10113
|
-
const
|
|
10192
|
+
const id2 = await resolveSessionRef(ref);
|
|
10114
10193
|
const patch = accessPatch(opts);
|
|
10115
|
-
const path2 = `/sessions/${encodeURIComponent(
|
|
10194
|
+
const path2 = `/sessions/${encodeURIComponent(id2)}/access`;
|
|
10116
10195
|
const access = await api(Object.keys(patch).length ? "PATCH" : "GET", path2, Object.keys(patch).length ? patch : void 0);
|
|
10117
10196
|
for (const line2 of renderAccess(access)) console.log(line2);
|
|
10118
10197
|
})
|
|
@@ -10126,35 +10205,35 @@ session.command("shared").description("sessions other people shared with you to
|
|
|
10126
10205
|
);
|
|
10127
10206
|
session.command("model <ref> [model]").description("show the session's model and thinking level, or switch them; the next turn uses the new ones").option("--thinking <level>", `thinking level for the next turns; "default" returns to the agent's own`).action(
|
|
10128
10207
|
run2(async (ref, model, opts) => {
|
|
10129
|
-
const
|
|
10208
|
+
const id2 = await resolveSessionRef(ref);
|
|
10130
10209
|
const change = engineChange(model, opts.thinking);
|
|
10131
|
-
const { session: s } = change ? await api("PATCH", `/sessions/${encodeURIComponent(
|
|
10132
|
-
console.log(`${
|
|
10210
|
+
const { session: s } = change ? await api("PATCH", `/sessions/${encodeURIComponent(id2)}`, change) : await api("GET", `/sessions/${encodeURIComponent(id2)}`);
|
|
10211
|
+
console.log(`${id2}: ${s.llm}${s.reasoningEffort ? ` \xB7 thinking ${s.reasoningEffort}` : ""}${change ? " (from the next turn)" : ""}`);
|
|
10133
10212
|
})
|
|
10134
10213
|
);
|
|
10135
|
-
session.command("permission <ref> [mode]").description("show a cloud chat's permission
|
|
10214
|
+
session.command("permission <ref> [mode]").description("show a cloud chat's permission preset, or set it: allow_all, ask_kept (sends, deletes for good, spending, secrets and access changes ask) or ask_every (every act asks); the owner only. ask and allow are read as ask_every and allow_all").action(
|
|
10136
10215
|
run2(async (ref, mode) => {
|
|
10137
|
-
if (mode !== void 0 &&
|
|
10138
|
-
const
|
|
10139
|
-
const path2 = `/sessions/${encodeURIComponent(
|
|
10216
|
+
if (mode !== void 0 && !["allow_all", "ask_kept", "ask_every", "ask", "allow"].includes(mode)) throw new Error("mode must be allow_all, ask_kept or ask_every");
|
|
10217
|
+
const id2 = await resolveSessionRef(ref);
|
|
10218
|
+
const path2 = `/sessions/${encodeURIComponent(id2)}`;
|
|
10140
10219
|
if (mode) await api("PATCH", path2, { metadata: { permission_mode: mode } });
|
|
10141
10220
|
const { session: s } = await api("GET", `${path2}?include=permission_mode`);
|
|
10142
10221
|
const shown = s.permission_mode;
|
|
10143
10222
|
const stricter = shown.mode === "allow" && shown.effective === "always_ask" ? " (the agent's own setting asks)" : "";
|
|
10144
|
-
console.log(`${
|
|
10223
|
+
console.log(`${id2}: ${shown.mode === "ask" ? "ask" : "allow all"}${stricter}${shown.available ? "" : " (ask is not available on this chat)"}`);
|
|
10145
10224
|
})
|
|
10146
10225
|
);
|
|
10147
10226
|
session.command("handoff <ref> <targetAgent> <message>").description("switch the agent (id or catalog handle) and engine that take the session's next turn, in the same session; <message> is that turn").option("--model <id>", "the model the agent runs").option("--thinking <level>", "its thinking level, or default").action(
|
|
10148
10227
|
run2(async (ref, targetAgent, message2, opts) => {
|
|
10149
|
-
const
|
|
10150
|
-
const done = await handoff(
|
|
10151
|
-
console.log(`${done.target_session ??
|
|
10228
|
+
const id2 = await resolveSessionRef(ref);
|
|
10229
|
+
const done = await handoff(id2, targetAgent, message2, { model: opts.model, thinking: opts.thinking });
|
|
10230
|
+
console.log(`${done.target_session ?? id2} (${done.resolved_mode === "native_fork" ? "same engine, native conversation continued" : "new engine, from a written summary"})`);
|
|
10152
10231
|
})
|
|
10153
10232
|
);
|
|
10154
10233
|
session.command("fork <ref> <targetAgent>").description("fork the session into a new one on another agent (agent id or catalog handle); prints the new session, the original stays as it is").option("--from-message <id>", "copy the conversation up to and including this reply only").option("--model <id>", "the model the new session runs").option("--thinking <level>", "the new session's thinking level, or default").option("--no-wait", "return once the fork is accepted").action(
|
|
10155
10234
|
run2(async (ref, targetAgent, opts) => {
|
|
10156
|
-
const
|
|
10157
|
-
const done = await fork(
|
|
10235
|
+
const id2 = await resolveSessionRef(ref);
|
|
10236
|
+
const done = await fork(id2, targetAgent, {
|
|
10158
10237
|
fromMessage: opts.fromMessage,
|
|
10159
10238
|
model: opts.model,
|
|
10160
10239
|
thinking: opts.thinking,
|
|
@@ -10167,8 +10246,8 @@ session.command("fork <ref> <targetAgent>").description("fork the session into a
|
|
|
10167
10246
|
);
|
|
10168
10247
|
session.command("continue-here <ref>").description("move an idle Claude Code or Codex session you own onto this computer and print how to resume it; the cloud session then takes no more turns until `session return-to-cloud`").option("--dir <folder>", "where the session's workspace goes", ".").option("--engine <engine>", "continue in claude_code or codex; the other engine gets the same conversation as its own session, without the first engine's reasoning").action(
|
|
10169
10248
|
run2(async (ref, opts) => {
|
|
10170
|
-
const
|
|
10171
|
-
const moved = await continueHere(
|
|
10249
|
+
const id2 = await resolveSessionRef(ref);
|
|
10250
|
+
const moved = await continueHere(id2, opts.dir, { engine: opts.engine, onStatus: (h) => console.error(`${h.id}: ${h.status}`) });
|
|
10172
10251
|
if (!moved.workspaceCarried) console.error("The workspace was not copied with this move; copy what you need with sky session workspace ls and cat.");
|
|
10173
10252
|
if (moved.converted) {
|
|
10174
10253
|
const { toolCalls, summarised } = moved.converted;
|
|
@@ -10179,17 +10258,17 @@ session.command("continue-here <ref>").description("move an idle Claude Code or
|
|
|
10179
10258
|
);
|
|
10180
10259
|
session.command("return-to-cloud <ref>").description("bring a session continued on a computer back to the cloud; anything done on the computer since stays there").action(
|
|
10181
10260
|
run2(async (ref) => {
|
|
10182
|
-
const
|
|
10183
|
-
await api("POST", `/sessions/${encodeURIComponent(
|
|
10184
|
-
console.log(`${
|
|
10261
|
+
const id2 = await resolveSessionRef(ref);
|
|
10262
|
+
await api("POST", `/sessions/${encodeURIComponent(id2)}/return-to-cloud`);
|
|
10263
|
+
console.log(`${id2} is back in the cloud`);
|
|
10185
10264
|
})
|
|
10186
10265
|
);
|
|
10187
10266
|
session.command("cloud-copy <ref>").description("what is kept in the cloud for a chat synced from your own computer: its working folder and native session").option("--json", "print the raw answer").action(
|
|
10188
10267
|
run2(async (ref, opts) => {
|
|
10189
|
-
const
|
|
10268
|
+
const id2 = await resolveSessionRef(ref);
|
|
10190
10269
|
const read = async (path2) => {
|
|
10191
10270
|
try {
|
|
10192
|
-
return await api("GET", `/sessions/${encodeURIComponent(
|
|
10271
|
+
return await api("GET", `/sessions/${encodeURIComponent(id2)}/mirror/${path2}`);
|
|
10193
10272
|
} catch (error) {
|
|
10194
10273
|
if (error instanceof ApiError && error.status === 404) return null;
|
|
10195
10274
|
throw error;
|
|
@@ -10285,7 +10364,7 @@ sessionSandbox.command("exec <ref> <command...>").description("run a shell comma
|
|
|
10285
10364
|
);
|
|
10286
10365
|
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(
|
|
10287
10366
|
run2(async (ref, path2, file, opts) => {
|
|
10288
|
-
const bytes = file ?
|
|
10367
|
+
const bytes = file ? readFileSync27(file) : readFileSync27(0);
|
|
10289
10368
|
const { path: at, size: size2 } = await api(
|
|
10290
10369
|
"PUT",
|
|
10291
10370
|
`/sessions/${encodeURIComponent(await resolveSessionRef(ref))}/sandbox/files`,
|
|
@@ -10295,8 +10374,8 @@ sessionSandbox.command("write <ref> <path> [file]").description("write a file in
|
|
|
10295
10374
|
})
|
|
10296
10375
|
);
|
|
10297
10376
|
session.command("show-in-panel <id>").description("show something in the session's right panel, for whoever is watching on the web or the Mac").requiredOption("--kind <kind>", SHOW_KIND_CHOICES.join(", ")).option("--id <id>", "the artifact id").option("--artifact-version <n>", "an artifact's version; default the latest", Number).option("--url <url>", "the GitHub pull request URL").action(
|
|
10298
|
-
run2(async (
|
|
10299
|
-
const res = await showInPanel(
|
|
10377
|
+
run2(async (id2, opts) => {
|
|
10378
|
+
const res = await showInPanel(id2, opts);
|
|
10300
10379
|
console.log(res.opens_on?.length === 1 ? `shown (opens on the ${res.opens_on[0]} only)` : "shown");
|
|
10301
10380
|
})
|
|
10302
10381
|
);
|
|
@@ -10309,8 +10388,8 @@ session.command("overview <ref>").description("where a session stands: its goal
|
|
|
10309
10388
|
var sessionBrowser = session.command("browser").description("the sandbox browser for a session (start, show status, stop)");
|
|
10310
10389
|
sessionBrowser.command("show <ref>").description("show the sandbox browser status for a session").option("--json", "print as JSON").action(
|
|
10311
10390
|
run2(async (ref, opts) => {
|
|
10312
|
-
const
|
|
10313
|
-
const { browser } = await api("GET", `/sessions/${encodeURIComponent(
|
|
10391
|
+
const id2 = await resolveSessionRef(ref);
|
|
10392
|
+
const { browser } = await api("GET", `/sessions/${encodeURIComponent(id2)}/browser`);
|
|
10314
10393
|
if (opts.json) {
|
|
10315
10394
|
console.log(JSON.stringify(browser, null, 2));
|
|
10316
10395
|
return;
|
|
@@ -10325,8 +10404,8 @@ sessionBrowser.command("show <ref>").description("show the sandbox browser statu
|
|
|
10325
10404
|
);
|
|
10326
10405
|
sessionBrowser.command("start <ref>").description("start a browser for a session (provisions it if not running)").option("--json", "print as JSON").action(
|
|
10327
10406
|
run2(async (ref, opts) => {
|
|
10328
|
-
const
|
|
10329
|
-
const { browser } = await api("POST", `/sessions/${encodeURIComponent(
|
|
10407
|
+
const id2 = await resolveSessionRef(ref);
|
|
10408
|
+
const { browser } = await api("POST", `/sessions/${encodeURIComponent(id2)}/browser`, {});
|
|
10330
10409
|
if (opts.json) {
|
|
10331
10410
|
console.log(JSON.stringify(browser, null, 2));
|
|
10332
10411
|
return;
|
|
@@ -10337,8 +10416,8 @@ sessionBrowser.command("start <ref>").description("start a browser for a session
|
|
|
10337
10416
|
);
|
|
10338
10417
|
sessionBrowser.command("stop <ref>").description("stop the browser for a session").action(
|
|
10339
10418
|
run2(async (ref) => {
|
|
10340
|
-
const
|
|
10341
|
-
const { browser } = await api("DELETE", `/sessions/${encodeURIComponent(
|
|
10419
|
+
const id2 = await resolveSessionRef(ref);
|
|
10420
|
+
const { browser } = await api("DELETE", `/sessions/${encodeURIComponent(id2)}/browser`);
|
|
10342
10421
|
const b = browser;
|
|
10343
10422
|
console.log(b ? b.status ?? "stopped" : "stopped");
|
|
10344
10423
|
})
|
|
@@ -10366,8 +10445,8 @@ sessionBrowser.command("screenshot <ref>").description("save a picture of the se
|
|
|
10366
10445
|
);
|
|
10367
10446
|
sessionBrowser.command("open <ref> <urls...>").description("open pages in the browser of a session you own, at once or at its next start").option("--json", "print as JSON").action(
|
|
10368
10447
|
run2(async (ref, urls, opts) => {
|
|
10369
|
-
const
|
|
10370
|
-
const result = await api("POST", `/sessions/${encodeURIComponent(
|
|
10448
|
+
const id2 = await resolveSessionRef(ref);
|
|
10449
|
+
const result = await api("POST", `/sessions/${encodeURIComponent(id2)}/browser-tabs`, { urls });
|
|
10371
10450
|
if (opts.json) {
|
|
10372
10451
|
console.log(JSON.stringify(result, null, 2));
|
|
10373
10452
|
return;
|
|
@@ -10531,14 +10610,14 @@ registerGatewayCommands(gatewayCommand);
|
|
|
10531
10610
|
registerSearchMediaCommands(program);
|
|
10532
10611
|
var emailCommand = program.command("email").description("send transactional email from your workspace, within its daily limit");
|
|
10533
10612
|
registerEmailCommands(emailCommand);
|
|
10534
|
-
session.command("secrets <id>").description("whether the conversation has a vault a pasted credential can be saved in, and the names it holds (never values)").action(run2(async (
|
|
10535
|
-
console.log(JSON.stringify(await api("GET", `/sessions/${encodeURIComponent(await resolveSessionRef(
|
|
10613
|
+
session.command("secrets <id>").description("whether the conversation has a vault a pasted credential can be saved in, and the names it holds (never values)").action(run2(async (id2) => {
|
|
10614
|
+
console.log(JSON.stringify(await api("GET", `/sessions/${encodeURIComponent(await resolveSessionRef(id2))}/secrets`), null, 2));
|
|
10536
10615
|
}));
|
|
10537
10616
|
session.command("secret-add <id> <name>").description("save a credential (value from stdin or a hidden prompt) in the conversation's own vault, as the composer's guard does; prints the reference to send instead of the value").requiredOption("--host <host>", "the host the credential may be sent to").option("--header <name>", "the header it is sent in (default: Authorization)").option("--template <template>", "how the header value is built, e.g. 'Bearer {secret}'").action(
|
|
10538
|
-
run2(async (
|
|
10617
|
+
run2(async (id2, name, opts) => {
|
|
10539
10618
|
const value = await readSecretValue(`Value for ${name}: `);
|
|
10540
10619
|
if (!value) throw new ApiError(400, "no_value", "no value provided");
|
|
10541
|
-
const saved = await api("POST", `/sessions/${encodeURIComponent(await resolveSessionRef(
|
|
10620
|
+
const saved = await api("POST", `/sessions/${encodeURIComponent(await resolveSessionRef(id2))}/secrets`, {
|
|
10542
10621
|
name,
|
|
10543
10622
|
value,
|
|
10544
10623
|
host: opts.host,
|
|
@@ -10549,22 +10628,25 @@ session.command("secret-add <id> <name>").description("save a credential (value
|
|
|
10549
10628
|
})
|
|
10550
10629
|
);
|
|
10551
10630
|
var secrets = program.command("secrets").description("agent secrets (values write-only)");
|
|
10552
|
-
secrets.command("set <id> <pairs...>").description("set KEY=VALUE pairs on the agent").action(
|
|
10553
|
-
run2(async (
|
|
10631
|
+
secrets.command("set <id> <pairs...>").description("set KEY=VALUE pairs on the agent: --host sends each as a placeholder the platform fills for those hosts; --agent-reads hands the agent the text").option("--host <host...>", "hosts the platform sends the value to (the sandbox sees only a placeholder)").option("--header <name>", "header to send it in (default Authorization)").option("--template <template>", 'header value, with {secret} for the value (default "Bearer {secret}")').option("--agent-reads", "the agent reads the text itself (a CLI token it must hold)").action(
|
|
10632
|
+
run2(async (id2, pairs, opts) => {
|
|
10633
|
+
if (!opts.host?.length && !opts.agentReads) throw new Error("say how the secret reaches the agent: --host <host...> or --agent-reads");
|
|
10634
|
+
if (opts.host?.length && opts.agentReads) throw new Error("--host or --agent-reads, not both");
|
|
10554
10635
|
for (const pair of pairs) {
|
|
10555
10636
|
const eq = pair.indexOf("=");
|
|
10556
10637
|
if (eq < 1) throw new Error(`expected KEY=VALUE, got ${pair}`);
|
|
10557
10638
|
const key = pair.slice(0, eq);
|
|
10558
|
-
await api("PUT", `/agents/${encodeURIComponent(
|
|
10559
|
-
value: pair.slice(eq + 1)
|
|
10639
|
+
await api("PUT", `/agents/${encodeURIComponent(id2)}/secrets/${encodeURIComponent(key)}`, {
|
|
10640
|
+
value: pair.slice(eq + 1),
|
|
10641
|
+
...opts.agentReads ? { agent_reads: true } : { allowed_hosts: opts.host, ...opts.header ? { header_name: opts.header } : {}, ...opts.template ? { value_template: opts.template } : {} }
|
|
10560
10642
|
});
|
|
10561
10643
|
console.log(`set ${key}`);
|
|
10562
10644
|
}
|
|
10563
10645
|
})
|
|
10564
10646
|
);
|
|
10565
10647
|
secrets.command("list <id>").action(
|
|
10566
|
-
run2(async (
|
|
10567
|
-
const { secrets: keys2 } = await api("GET", `/agents/${encodeURIComponent(
|
|
10648
|
+
run2(async (id2) => {
|
|
10649
|
+
const { secrets: keys2 } = await api("GET", `/agents/${encodeURIComponent(id2)}/secrets`);
|
|
10568
10650
|
if (!keys2.length) console.log("no secrets set");
|
|
10569
10651
|
for (const s of keys2) {
|
|
10570
10652
|
console.log(`\u25CF ${s.key}${s.description ? ` \u2014 ${s.description}` : ""}`);
|
|
@@ -10572,10 +10654,10 @@ secrets.command("list <id>").action(
|
|
|
10572
10654
|
})
|
|
10573
10655
|
);
|
|
10574
10656
|
secrets.command("unset <id> <key>").action(
|
|
10575
|
-
run2(async (
|
|
10657
|
+
run2(async (id2, key) => {
|
|
10576
10658
|
await api(
|
|
10577
10659
|
"DELETE",
|
|
10578
|
-
`/agents/${encodeURIComponent(
|
|
10660
|
+
`/agents/${encodeURIComponent(id2)}/secrets/${encodeURIComponent(key)}`
|
|
10579
10661
|
);
|
|
10580
10662
|
console.log(`unset ${key}`);
|
|
10581
10663
|
})
|
|
@@ -10874,43 +10956,43 @@ files.command("list").description("list your uploads, or one session's files wit
|
|
|
10874
10956
|
);
|
|
10875
10957
|
files.command("get <id>").description("show one file's metadata").action(
|
|
10876
10958
|
run2(
|
|
10877
|
-
async (
|
|
10959
|
+
async (id2) => console.log(JSON.stringify(await api("GET", `/files/${encodeURIComponent(id2)}`), null, 2))
|
|
10878
10960
|
)
|
|
10879
10961
|
);
|
|
10880
10962
|
files.command("rm <id>").description("delete a file (a session that already received it keeps its copy)").action(
|
|
10881
|
-
run2(async (
|
|
10882
|
-
await api("DELETE", `/files/${encodeURIComponent(
|
|
10883
|
-
console.log(`Deleted ${
|
|
10963
|
+
run2(async (id2) => {
|
|
10964
|
+
await api("DELETE", `/files/${encodeURIComponent(id2)}`);
|
|
10965
|
+
console.log(`Deleted ${id2}`);
|
|
10884
10966
|
})
|
|
10885
10967
|
);
|
|
10886
10968
|
files.command("link <id>").description("a link anyone can download the file with, with no key; it ends when your key is revoked or you lose access to the file").option("--expires <seconds>", "how long the link lasts (60\u2013604800; default an hour)").action(
|
|
10887
|
-
run2(async (
|
|
10969
|
+
run2(async (id2, opts) => {
|
|
10888
10970
|
const expires = opts.expires === void 0 ? void 0 : Number(opts.expires);
|
|
10889
10971
|
if (expires !== void 0 && (!Number.isSafeInteger(expires) || expires < 60 || expires > 604800)) throw new Error("--expires must be an integer from 60 to 604800");
|
|
10890
|
-
const link2 = await api("POST", `/files/${encodeURIComponent(
|
|
10972
|
+
const link2 = await api("POST", `/files/${encodeURIComponent(id2)}/links`, expires === void 0 ? {} : { expires_in_seconds: expires });
|
|
10891
10973
|
console.log(`${link2.url}
|
|
10892
10974
|
expires ${link2.expires_at}${link2.id ? `
|
|
10893
|
-
revoke with: sky files unlink ${
|
|
10975
|
+
revoke with: sky files unlink ${id2} ${link2.id}` : ""}`);
|
|
10894
10976
|
})
|
|
10895
10977
|
);
|
|
10896
10978
|
files.command("links <id>").description("the download links made for a file: who made each, when it ends, and whether it is active, expired or revoked").option("--json", "print the answer as JSON").action(
|
|
10897
|
-
run2(async (
|
|
10898
|
-
const listed = await api("GET", `/files/${encodeURIComponent(
|
|
10979
|
+
run2(async (id2, opts) => {
|
|
10980
|
+
const listed = await api("GET", `/files/${encodeURIComponent(id2)}/links`);
|
|
10899
10981
|
if (opts.json) return void console.log(JSON.stringify(listed, null, 2));
|
|
10900
10982
|
if (!listed.data.length) return void console.log("no links");
|
|
10901
10983
|
for (const link2 of listed.data) console.log(`${link2.id} ${link2.status} expires ${link2.expires_at} by ${link2.created_by}`);
|
|
10902
10984
|
})
|
|
10903
10985
|
);
|
|
10904
10986
|
files.command("unlink <id> <linkId>").description("revoke one download link of a file at once; the file and its other links stay").action(
|
|
10905
|
-
run2(async (
|
|
10906
|
-
const link2 = await api("DELETE", `/files/${encodeURIComponent(
|
|
10987
|
+
run2(async (id2, linkId) => {
|
|
10988
|
+
const link2 = await api("DELETE", `/files/${encodeURIComponent(id2)}/links/${encodeURIComponent(linkId)}`);
|
|
10907
10989
|
console.log(`Revoked ${link2.id}`);
|
|
10908
10990
|
})
|
|
10909
10991
|
);
|
|
10910
10992
|
files.command("send <id> <session>").description("send a file into a session: it is copied read-only into the session's workspace before its next turn").option("--path <mountPath>", "where it lands under /workspace (default: a path of its own, printed)").action(
|
|
10911
|
-
run2(async (
|
|
10912
|
-
const resource = await api("POST", `/files/${encodeURIComponent(
|
|
10913
|
-
console.log(`Sent ${
|
|
10993
|
+
run2(async (id2, session2, opts) => {
|
|
10994
|
+
const resource = await api("POST", `/files/${encodeURIComponent(id2)}/send`, { session_id: await resolveSessionRef(session2), ...opts.path ? { mount_path: opts.path } : {} });
|
|
10995
|
+
console.log(`Sent ${id2} to ${session2}${resource.mount_path ? ` at ${resource.mount_path}` : ""}`);
|
|
10914
10996
|
})
|
|
10915
10997
|
);
|
|
10916
10998
|
files.command("search <query>").description('search your uploads by name and by the text inside them: plain words, "an exact phrase" or /a regex/').option("--limit <n>", "page size (default 20, at most 100)").option("--cursor <cursor>", "continue from a previous page").option("--json", "print the answer as JSON").action(
|
|
@@ -10923,12 +11005,12 @@ files.command("search <query>").description('search your uploads by name and by
|
|
|
10923
11005
|
})
|
|
10924
11006
|
);
|
|
10925
11007
|
files.command("read <id>").description("print part of a file's text (up to 256 KiB a call); --base64 for a file that is not text").option("--offset <bytes>", "the byte to start at (default 0)").option("--max-bytes <n>", "how many bytes at most (default 65536, up to 262144)").option("--base64", "print the bytes as base64").action(
|
|
10926
|
-
run2(async (
|
|
11008
|
+
run2(async (id2, opts) => {
|
|
10927
11009
|
const params = new URLSearchParams();
|
|
10928
11010
|
if (opts.offset) params.set("offset", opts.offset);
|
|
10929
11011
|
if (opts.maxBytes) params.set("max_bytes", opts.maxBytes);
|
|
10930
11012
|
if (opts.base64) params.set("encoding", "base64");
|
|
10931
|
-
const part = await api("GET", `/files/${encodeURIComponent(
|
|
11013
|
+
const part = await api("GET", `/files/${encodeURIComponent(id2)}/text${params.size ? `?${params}` : ""}`);
|
|
10932
11014
|
process.stdout.write(part.content);
|
|
10933
11015
|
if (part.next_offset !== null) console.error(`
|
|
10934
11016
|
\u2026 more: --offset ${part.next_offset}`);
|
|
@@ -10937,14 +11019,14 @@ files.command("read <id>").description("print part of a file's text (up to 256 K
|
|
|
10937
11019
|
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(
|
|
10938
11020
|
run2(async (filename, opts) => {
|
|
10939
11021
|
if (opts.text !== void 0 && opts.textFile !== void 0) throw new Error("give --text or --text-file, not both");
|
|
10940
|
-
const content = opts.text ??
|
|
11022
|
+
const content = opts.text ?? readFileSync27(!opts.textFile || opts.textFile === "-" ? 0 : opts.textFile, "utf8");
|
|
10941
11023
|
const file = await api("POST", "/files/text", { filename, content, ...opts.mimeType ? { mime_type: opts.mimeType } : {}, ...opts.expires ? { expires_in_seconds: Number(opts.expires) } : {} });
|
|
10942
11024
|
console.log(`${file.id} ${file.filename} ${file.mime_type} ${file.size_bytes} bytes`);
|
|
10943
11025
|
})
|
|
10944
11026
|
);
|
|
10945
11027
|
files.command("download <id>").description("download a session file's bytes").requiredOption("-o, --out <path>", "where to write the bytes").action(
|
|
10946
|
-
run2(async (
|
|
10947
|
-
const written = await downloadFileTo(
|
|
11028
|
+
run2(async (id2, opts) => {
|
|
11029
|
+
const written = await downloadFileTo(id2, opts.out);
|
|
10948
11030
|
console.log(`Wrote ${written} bytes to ${opts.out}`);
|
|
10949
11031
|
})
|
|
10950
11032
|
);
|
|
@@ -10999,7 +11081,7 @@ session.command("file-get <session> <path>").description("read one shared file o
|
|
|
10999
11081
|
);
|
|
11000
11082
|
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(
|
|
11001
11083
|
run2(async (sessionId, path2, local) => {
|
|
11002
|
-
const { file, conflict } = await writeTaskFile(sessionId, path2,
|
|
11084
|
+
const { file, conflict } = await writeTaskFile(sessionId, path2, readFileSync27(local), mediaTypeFor(local));
|
|
11003
11085
|
console.log(`${renderTaskFile(file)}${conflict ? " (replaced a version you had not seen)" : ""}`);
|
|
11004
11086
|
})
|
|
11005
11087
|
);
|
|
@@ -11121,10 +11203,10 @@ session.command("verdict <session> <did-the-job>").description("record whether t
|
|
|
11121
11203
|
var plugins = program.command("plugins").description("Claude Code plugins in the workspace: install from GitHub, list, remove");
|
|
11122
11204
|
plugins.command("templates <plugin>").description("the agents a plugin pack ships (its agents/*.md), each a template `sky agent apply --template <ref>` creates an agent from").option("--json", "print the list as JSON").action(
|
|
11123
11205
|
run2(async (plugin, opts) => {
|
|
11124
|
-
const
|
|
11125
|
-
const listed = await api("GET", `/plugins/${encodeURIComponent(
|
|
11206
|
+
const id2 = plugin.includes(":") ? plugin : `bundle:${plugin}`;
|
|
11207
|
+
const listed = await api("GET", `/plugins/${encodeURIComponent(id2)}/agent-templates`);
|
|
11126
11208
|
if (opts.json) return void console.log(JSON.stringify(listed, null, 2));
|
|
11127
|
-
if (!listed.templates.length) return void console.log(`${
|
|
11209
|
+
if (!listed.templates.length) return void console.log(`${id2} ships no agent templates${listed.revision ? ` in revision ${listed.revision}` : ""}.`);
|
|
11128
11210
|
for (const template of listed.templates) console.log(`${template.ref}
|
|
11129
11211
|
${template.description || template.name}`);
|
|
11130
11212
|
})
|
|
@@ -11152,14 +11234,14 @@ plugins.command("list").description("the workspace's installed plugin bundles; w
|
|
|
11152
11234
|
})
|
|
11153
11235
|
);
|
|
11154
11236
|
plugins.command("show <id>").description("one plugin by id (app:gmail, tool:exa.web, chat:slack, bundle:<name>, skill:<id>, mcp:<id>, mac:meetings, browser:mine): provider, price, what it gives agents and what it needs").option("--json", "print the plugin as JSON").action(
|
|
11155
|
-
run2(async (
|
|
11156
|
-
const plugin = await showPlugin(
|
|
11237
|
+
run2(async (id2, opts) => {
|
|
11238
|
+
const plugin = await showPlugin(id2);
|
|
11157
11239
|
console.log(opts.json ? JSON.stringify(plugin) : renderPlugin(plugin));
|
|
11158
11240
|
})
|
|
11159
11241
|
);
|
|
11160
11242
|
plugins.command("check <id>").description("probe an installed plugin pack's remote MCP servers again (bundle:<name>), after a token was fixed or a server came back").option("--json", "print the answer as JSON").action(
|
|
11161
|
-
run2(async (
|
|
11162
|
-
const ref =
|
|
11243
|
+
run2(async (id2, opts) => {
|
|
11244
|
+
const ref = id2.startsWith("bundle:") ? id2 : `bundle:${id2}`;
|
|
11163
11245
|
const answer = await api("POST", `/plugins/${encodeURIComponent(ref)}/check`);
|
|
11164
11246
|
if (opts.json) {
|
|
11165
11247
|
console.log(JSON.stringify(answer, null, 2));
|
|
@@ -11183,9 +11265,9 @@ plugins.command("install <source>").description("install or update a plugin: git
|
|
|
11183
11265
|
})
|
|
11184
11266
|
);
|
|
11185
11267
|
plugins.command("add [id]").description("add or connect a plugin by id (tool:exa.web, skill:<id>, bundle:<name>, app:gmail, chat:slack); prints the address a person opens when they must sign in or pair").option("--agent <id>", "a chat app: the agent whose default chat answers it; with --mcp-url: the agent that uses the server").option("--session <id>", "a chat app: the chat that answers it").option("--source <source>", "a plugin bundle no marketplace lists: github:owner/repo[/path][@ref]").option("--mcp-url <url>", "add a custom MCP server instead of a listed plugin").option("--name <name>", "with --mcp-url: what to call the server").option("--note <note>", "with --mcp-url: what the server is for, shown on its card").option("--token <token>", "with --mcp-url: its bearer token, kept in the workspace's vault").option("--skip-check", "with --mcp-url: save a token the server refuses").option("--task <id>", "an app: with --request, answer that task's connect request with a once-only link the person opens without signing in").option("--request <id>", "with --task: the connect_app request").option("--json", "print the answer as JSON").action(
|
|
11186
|
-
run2(async (
|
|
11268
|
+
run2(async (id2, opts) => {
|
|
11187
11269
|
if (Boolean(opts.task) !== Boolean(opts.request)) throw new Error("--task and --request go together");
|
|
11188
|
-
const answer = await addPlugin(
|
|
11270
|
+
const answer = await addPlugin(id2, opts);
|
|
11189
11271
|
console.log(opts.json ? JSON.stringify(answer) : renderAdd(answer));
|
|
11190
11272
|
})
|
|
11191
11273
|
);
|
|
@@ -11210,8 +11292,8 @@ plugins.command("rm <id>").description("remove a plugin or disconnect it, by id
|
|
|
11210
11292
|
})
|
|
11211
11293
|
);
|
|
11212
11294
|
plugins.command("update <id>").description("change a custom MCP server (mcp:<id>): the name and note people see, or its token (replaced in place; running chats take it without a restart)").option("--name <name>", "what to call the server").option("--note <note>", "what the server is for; an empty note clears it").option("--token <token>", "the new bearer token; the server is called with it first").option("--skip-check", "save a token the server refuses").option("--json", "print the answer as JSON").action(
|
|
11213
|
-
run2(async (
|
|
11214
|
-
const answer = await updateMcpServer(
|
|
11295
|
+
run2(async (id2, opts) => {
|
|
11296
|
+
const answer = await updateMcpServer(id2, opts);
|
|
11215
11297
|
if (opts.json) return void console.log(JSON.stringify(answer));
|
|
11216
11298
|
console.log(`Saved ${answer.name} (${answer.plugin_id})${answer.token_changed ? `; token changed${answer.check ? `, check: ${answer.check}` : ""}` : ""}.`);
|
|
11217
11299
|
})
|
|
@@ -11224,18 +11306,18 @@ plugins.command("upload <dir>").description("upload a skill directory (SKILL.md
|
|
|
11224
11306
|
})
|
|
11225
11307
|
);
|
|
11226
11308
|
plugins.command("revisions <id>").description("saved versions of a skill or bundle plugin; --save and --rm apply to skills").option("--save <dir>", "save this skill directory as a new version (a complete snapshot)").option("--expected-latest-revision <id>", "with --save: refuse if the latest version has changed").option("--rm <revisionId>", "delete this version").option("--json", "print as JSON").action(
|
|
11227
|
-
run2(async (
|
|
11309
|
+
run2(async (id2, opts) => {
|
|
11228
11310
|
if (opts.save && opts.rm) throw new Error("pass --save or --rm, not both");
|
|
11229
11311
|
if (opts.save) {
|
|
11230
|
-
const { revision } = await saveSkillPluginRevision(
|
|
11231
|
-
return void console.log(opts.json ? JSON.stringify(revision) : `Saved ${revision.id} of ${
|
|
11312
|
+
const { revision } = await saveSkillPluginRevision(id2, opts.save, opts.expectedLatestRevision);
|
|
11313
|
+
return void console.log(opts.json ? JSON.stringify(revision) : `Saved ${revision.id} of ${id2}`);
|
|
11232
11314
|
}
|
|
11233
11315
|
if (opts.rm) {
|
|
11234
|
-
await deletePluginRevision(
|
|
11235
|
-
return void console.log(`Deleted ${opts.rm} of ${
|
|
11316
|
+
await deletePluginRevision(id2, opts.rm);
|
|
11317
|
+
return void console.log(`Deleted ${opts.rm} of ${id2}`);
|
|
11236
11318
|
}
|
|
11237
|
-
const history3 = await pluginRevisionHistory(
|
|
11238
|
-
if (
|
|
11319
|
+
const history3 = await pluginRevisionHistory(id2);
|
|
11320
|
+
if (id2.startsWith("bundle:")) return void console.log(JSON.stringify(history3, null, 2));
|
|
11239
11321
|
const rows = history3.revisions;
|
|
11240
11322
|
if (opts.json) return void console.log(JSON.stringify(rows, null, 2));
|
|
11241
11323
|
if (!rows.length) return void console.log("no versions");
|
|
@@ -11243,21 +11325,21 @@ plugins.command("revisions <id>").description("saved versions of a skill or bund
|
|
|
11243
11325
|
})
|
|
11244
11326
|
);
|
|
11245
11327
|
plugins.command("cat <id> <revisionId> <path>").description("print one file (e.g. SKILL.md) of a skill plugin's version").action(
|
|
11246
|
-
run2(async (
|
|
11247
|
-
process.stdout.write(await readPluginFile(
|
|
11328
|
+
run2(async (id2, revisionId, path2) => {
|
|
11329
|
+
process.stdout.write(await readPluginFile(id2, revisionId, path2));
|
|
11248
11330
|
})
|
|
11249
11331
|
);
|
|
11250
11332
|
for (const [verb, off] of [["off", true], ["on", false]]) {
|
|
11251
11333
|
plugins.command(`${verb} <id>`).description(off ? "switch a plugin off for one agent (--agent) or one chat (--session); the workspace and every other chat keep it" : "undo `sky plugins off` for that agent or chat").option("--agent <id>", "the agent").option("--session <id>", "the chat").option("--json", "print the answer as JSON").action(
|
|
11252
|
-
run2(async (
|
|
11253
|
-
const answer = await setPluginOff(
|
|
11334
|
+
run2(async (id2, opts) => {
|
|
11335
|
+
const answer = await setPluginOff(id2, opts, off);
|
|
11254
11336
|
console.log(opts.json ? JSON.stringify(answer) : renderOff(answer));
|
|
11255
11337
|
})
|
|
11256
11338
|
);
|
|
11257
11339
|
}
|
|
11258
11340
|
plugins.command("request <id>").description("ask the chat's owner for what a plugin still needs in one chat: switch it back on, add it, or sign in").requiredOption("--session <id>", "the chat that needs it").option("--json", "print the answer as JSON").action(
|
|
11259
|
-
run2(async (
|
|
11260
|
-
const answer = await requestPlugin(
|
|
11341
|
+
run2(async (id2, opts) => {
|
|
11342
|
+
const answer = await requestPlugin(id2, opts.session);
|
|
11261
11343
|
console.log(opts.json ? JSON.stringify(answer) : renderRequest2(answer));
|
|
11262
11344
|
})
|
|
11263
11345
|
);
|
|
@@ -11268,55 +11350,55 @@ var pluginsDraft = plugins.command("draft").description("draft a plugin from a f
|
|
|
11268
11350
|
console.log(opts.json ? JSON.stringify(answer) : renderDraft(answer));
|
|
11269
11351
|
})
|
|
11270
11352
|
);
|
|
11271
|
-
pluginsDraft.command("show <id>").description("read one of your plugin drafts: its latest revision, effects, problems and every revision").action(run2(async (
|
|
11353
|
+
pluginsDraft.command("show <id>").description("read one of your plugin drafts: its latest revision, effects, problems and every revision").action(run2(async (id2) => console.log(JSON.stringify(await readPluginDraft(id2), null, 2))));
|
|
11272
11354
|
var pluginsTest = plugins.command("test").description("test one revision of your plugin draft: each tool sample runs with its writes rehearsed, never sent").argument("[id]", "the draft id (draft:<id>)").option("--revision <sha256>", "the revision drafting answered").option("--json", "print the answer as JSON").action(
|
|
11273
|
-
run2(async (
|
|
11274
|
-
if (!
|
|
11275
|
-
const answer = await testPluginDraft(
|
|
11355
|
+
run2(async (id2, opts) => {
|
|
11356
|
+
if (!id2 || !opts.revision) throw new Error("Usage: sky plugins test <draft id> --revision <sha256:...>");
|
|
11357
|
+
const answer = await testPluginDraft(id2, opts.revision);
|
|
11276
11358
|
console.log(opts.json ? JSON.stringify(answer) : renderTest(answer));
|
|
11277
11359
|
})
|
|
11278
11360
|
);
|
|
11279
11361
|
plugins.command("propose <id>").description("propose a tested revision of your plugin draft to its person: one card with Install and Not now; only the person installs").requiredOption("--revision <sha256>", "a revision with a passing test run").option("--target <target>", "me (the only one available yet)", "me").option("--note <text>", "one line for the card").option("--json", "print the answer as JSON").action(
|
|
11280
|
-
run2(async (
|
|
11281
|
-
const answer = await proposePluginDraft(
|
|
11362
|
+
run2(async (id2, opts) => {
|
|
11363
|
+
const answer = await proposePluginDraft(id2, opts.revision, { target: opts.target, note: opts.note });
|
|
11282
11364
|
console.log(opts.json ? JSON.stringify(answer) : renderPropose(answer));
|
|
11283
11365
|
})
|
|
11284
11366
|
);
|
|
11285
|
-
pluginsTest.command("show <id> <run>").description("read one test run of your plugin draft").action(run2(async (
|
|
11367
|
+
pluginsTest.command("show <id> <run>").description("read one test run of your plugin draft").action(run2(async (id2, runId) => console.log(renderTest(await readPluginTest(id2, runId)))));
|
|
11286
11368
|
plugins.command("share <id>").description("share your app connection (app:<slug>) with a workspace's chats, or with --api-key let one of its keys call through it").requiredOption("--workspace <slug>", "the workspace").option("--api-key <id>", "one API key of that workspace (select the workspace with --workspace on sky too)").option("--all-keys", "every API key of that workspace, instead of one").option("--connection <id>", "which connection, when you have several for the app").action(
|
|
11287
|
-
run2(async (
|
|
11288
|
-
console.log(JSON.stringify(await sharePlugin(
|
|
11369
|
+
run2(async (id2, opts) => {
|
|
11370
|
+
console.log(JSON.stringify(await sharePlugin(id2, opts)));
|
|
11289
11371
|
})
|
|
11290
11372
|
);
|
|
11291
11373
|
plugins.command("when-to-use <id> [note]").description('say when agents should use one of your accounts of an app (app:<slug>), e.g. "work email"; --clear removes it').requiredOption("--connection <id>", "the account (sky plugins list --include connections)").option("--clear", "remove the note").action(
|
|
11292
|
-
run2(async (
|
|
11374
|
+
run2(async (id2, note, opts) => {
|
|
11293
11375
|
if (!opts.clear && !note?.trim()) throw new Error("Give the note, or --clear to remove it.");
|
|
11294
|
-
console.log(JSON.stringify(await setPluginWhenToUse(
|
|
11376
|
+
console.log(JSON.stringify(await setPluginWhenToUse(id2, opts.connection, opts.clear ? null : note.trim())));
|
|
11295
11377
|
})
|
|
11296
11378
|
);
|
|
11297
11379
|
plugins.command("shares <id>").description("where your connections of an app (app:<slug>) are shared: each workspace and API key, with the calls made through it").option("--connection <id>", "only this connection").option("--json", "print the answer as JSON").action(
|
|
11298
|
-
run2(async (
|
|
11299
|
-
const answer = await pluginShares(
|
|
11380
|
+
run2(async (id2, opts) => {
|
|
11381
|
+
const answer = await pluginShares(id2, opts.connection);
|
|
11300
11382
|
console.log(opts.json ? JSON.stringify(answer) : renderShares(answer));
|
|
11301
11383
|
})
|
|
11302
11384
|
);
|
|
11303
11385
|
plugins.command("call <id>").description("call an app API through a connection, or a declared action of an installed Plugin").option("--url <url>", "the https address for an app call").option("--action <id>", "a declared Plugin view action").option("--view <id>", "the view when an action id occurs in several views").option("--session <id>", "the Session the Plugin action addresses").option("--input <json>", "text fields for the declared action", "{}").option("--request-id <id>", "reuse this id with the same action input when retrying").option("--method <method>", "GET, POST, \u2026", "GET").option("--header <name:value...>", "a request header (repeatable)").option("--body <text>", "the request body").option("--connection <id>", "which connection, when the key can use several of the app").action(
|
|
11304
|
-
run2(async (
|
|
11386
|
+
run2(async (id2, opts) => {
|
|
11305
11387
|
if (opts.action) {
|
|
11306
11388
|
if (opts.url || !opts.session) throw new Error("Use --action with --session, and omit --url");
|
|
11307
|
-
console.log(JSON.stringify(await callDeclaredPluginAction(
|
|
11389
|
+
console.log(JSON.stringify(await callDeclaredPluginAction(id2, { action: opts.action, view: opts.view, session: opts.session, input: JSON.parse(opts.input), requestId: opts.requestId })));
|
|
11308
11390
|
return;
|
|
11309
11391
|
}
|
|
11310
11392
|
if (!opts.url) throw new Error("An app call requires --url");
|
|
11311
11393
|
const headers = Object.fromEntries((opts.header ?? []).map((pair) => [pair.slice(0, pair.indexOf(":")).trim(), pair.slice(pair.indexOf(":") + 1).trim()]).filter(([name]) => name));
|
|
11312
|
-
console.log(JSON.stringify(await callPlugin(
|
|
11394
|
+
console.log(JSON.stringify(await callPlugin(id2, { url: opts.url, method: opts.method, headers, body: opts.body, connection: opts.connection })));
|
|
11313
11395
|
})
|
|
11314
11396
|
);
|
|
11315
11397
|
plugins.command("export <id>").description("write a plugin (plugin:files, plugin:artifacts, plugin:browser-use, bundle:<name>, skill:<id>, mcp:<id>; apps and tools export the AgentSky plugin) as Claude Code, Codex or Grok's own package, or as config for any MCP client").option("--target <target>", "the agent platform: claude-code | codex | grok | mcp").option("--format <format>", "the older spelling of --target: codex | claude | grok").option("--out <dir>", "the folder to write it to (default: ./<name>)").option("--json", "print the files as JSON instead of writing them").action(
|
|
11316
|
-
run2(async (
|
|
11398
|
+
run2(async (id2, opts) => {
|
|
11317
11399
|
const target2 = opts.target ?? opts.format;
|
|
11318
11400
|
if (!target2) throw new Error("Pass --target claude-code, codex, grok or mcp");
|
|
11319
|
-
const exported = await exportPlugin(
|
|
11401
|
+
const exported = await exportPlugin(id2, target2);
|
|
11320
11402
|
if (opts.json) return void console.log(JSON.stringify(exported));
|
|
11321
11403
|
const dir = opts.out ?? exported.name;
|
|
11322
11404
|
const written = writeExportFiles(dir, exported.files);
|
|
@@ -11355,18 +11437,18 @@ plugins.command("marketplace").description("write your workspace's plugins as a
|
|
|
11355
11437
|
})
|
|
11356
11438
|
);
|
|
11357
11439
|
plugins.command("unshare <id>").description("stop sharing your app connection (app:<slug>) with a workspace's chats, or with --api-key take back that key's access").requiredOption("--workspace <slug>", "the workspace").option("--api-key <id>", "one API key of that workspace (select the workspace with --workspace on sky too)").option("--all-keys", "the grant to every API key of that workspace").option("--connection <id>", "which connection, when you have several for the app (an owner or admin may name a member's)").action(
|
|
11358
|
-
run2(async (
|
|
11359
|
-
console.log(JSON.stringify(await unsharePlugin(
|
|
11440
|
+
run2(async (id2, opts) => {
|
|
11441
|
+
console.log(JSON.stringify(await unsharePlugin(id2, opts)));
|
|
11360
11442
|
})
|
|
11361
11443
|
);
|
|
11362
11444
|
plugins.command("answer <id>").description("choose which agent answers a chat app (chat:<platform>): --agent uses its default chat, or --session names one").option("--agent <id>", "the agent").option("--session <id>", "the chat").option("--connection <id>", "which chat-app connection, when you have several").action(
|
|
11363
|
-
run2(async (
|
|
11364
|
-
const answer = await answerPlugin(
|
|
11445
|
+
run2(async (id2, opts) => {
|
|
11446
|
+
const answer = await answerPlugin(id2, opts);
|
|
11365
11447
|
console.log(`${answer.plugin_id} (${answer.connection_id}) is answered by ${answer.session_id}.`);
|
|
11366
11448
|
})
|
|
11367
11449
|
);
|
|
11368
|
-
plugins.command("rollback <id> <revision>").description("restore a saved bundle version while checking its current active revision").requiredOption("--expected-revision <id>", "active_revision from sky plugins revisions bundle:<name>").action(run2(async (
|
|
11369
|
-
console.log(JSON.stringify(await rollbackPlugin(
|
|
11450
|
+
plugins.command("rollback <id> <revision>").description("restore a saved bundle version while checking its current active revision").requiredOption("--expected-revision <id>", "active_revision from sky plugins revisions bundle:<name>").action(run2(async (id2, revision, opts) => {
|
|
11451
|
+
console.log(JSON.stringify(await rollbackPlugin(id2, revision, opts.expectedRevision)));
|
|
11370
11452
|
}));
|
|
11371
11453
|
for (const [verb, enabled] of [["enable", true], ["disable", false]]) {
|
|
11372
11454
|
plugins.command(`${verb} <name>`).description(enabled ? "switch a plugin back on for the workspace: a plugin pack's skills attach to new sessions again; a pre-installed view or chat app (view:story, chat:slack) is on again, and installed again if it was uninstalled" : "switch a plugin off for the workspace: a plugin pack's skills stop attaching and its sessions refuse to start; a pre-installed view leaves the panel and a chat app stops answering, keeping everything they made").action(
|
|
@@ -11450,7 +11532,7 @@ skills.command("mine").description("your own skills, which follow you to every w
|
|
|
11450
11532
|
);
|
|
11451
11533
|
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(
|
|
11452
11534
|
run2(async (opts) => {
|
|
11453
|
-
const { loadLocalSkillState } = await import("./local-skills-
|
|
11535
|
+
const { loadLocalSkillState } = await import("./local-skills-RRJCNVLS.js");
|
|
11454
11536
|
const state = loadLocalSkillState();
|
|
11455
11537
|
if (opts.json) return void console.log(JSON.stringify(state, null, 2));
|
|
11456
11538
|
const names = Object.keys(state.skills).sort();
|
|
@@ -11466,7 +11548,7 @@ skills.command("local").description("the skills sky installed in this computer's
|
|
|
11466
11548
|
);
|
|
11467
11549
|
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(
|
|
11468
11550
|
run2(async (opts) => {
|
|
11469
|
-
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-
|
|
11551
|
+
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-Y47FCKEL.js");
|
|
11470
11552
|
const result = await refreshLocalSkills({ workspace: opts.workspace, dryRun: opts.dryRun });
|
|
11471
11553
|
if (opts.json) return void console.log(JSON.stringify(result, null, 2));
|
|
11472
11554
|
if (!result.checked) return void console.log("no engine that reads skills is installed on this computer");
|
|
@@ -11477,20 +11559,20 @@ ${lines2.join("\n")}` : `Skills from ${result.workspace} are current.`);
|
|
|
11477
11559
|
);
|
|
11478
11560
|
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(
|
|
11479
11561
|
run2(async (name) => {
|
|
11480
|
-
const { pinLocalSkill } = await import("./local-skills-
|
|
11562
|
+
const { pinLocalSkill } = await import("./local-skills-RRJCNVLS.js");
|
|
11481
11563
|
const pinned = pinLocalSkill(name);
|
|
11482
11564
|
console.log(`${name} stays at ${pinned.revision_id} on this computer`);
|
|
11483
11565
|
})
|
|
11484
11566
|
);
|
|
11485
11567
|
skills.command("unpin <name>").description("let a pinned skill follow its updates again from the next sync").action(
|
|
11486
11568
|
run2(async (name) => {
|
|
11487
|
-
const { unpinLocalSkill } = await import("./local-skills-
|
|
11569
|
+
const { unpinLocalSkill } = await import("./local-skills-RRJCNVLS.js");
|
|
11488
11570
|
console.log(unpinLocalSkill(name) ? `${name} follows its updates again` : `${name} was not pinned`);
|
|
11489
11571
|
})
|
|
11490
11572
|
);
|
|
11491
11573
|
skills.command("save <file>").description("save a SKILL.md as your own skill; the same name adds a version").action(
|
|
11492
11574
|
run2(async (file) => {
|
|
11493
|
-
const { skill } = await api("POST", "/skills/personal", { skill_md:
|
|
11575
|
+
const { skill } = await api("POST", "/skills/personal", { skill_md: readFileSync27(file, "utf8") });
|
|
11494
11576
|
console.log(`recorded as ${skill.id}`);
|
|
11495
11577
|
})
|
|
11496
11578
|
);
|
|
@@ -11552,7 +11634,7 @@ var routing = program.command("routing").description("who a question or piece of
|
|
|
11552
11634
|
routing.command("show").description("the current policy").action(run2(async () => console.log(JSON.stringify(await api("GET", "/routing_policy"), null, 2))));
|
|
11553
11635
|
routing.command("set <file>").description("save a new version of the policy from a JSON file; owner or admin").action(
|
|
11554
11636
|
run2(async (file) => {
|
|
11555
|
-
const saved = await api("PUT", "/routing_policy", JSON.parse(
|
|
11637
|
+
const saved = await api("PUT", "/routing_policy", JSON.parse(readFileSync27(file, "utf8")));
|
|
11556
11638
|
console.log(`version ${saved.version}`);
|
|
11557
11639
|
})
|
|
11558
11640
|
);
|
|
@@ -11582,20 +11664,20 @@ reflections.command("list").description("the workspace's proposals, newest first
|
|
|
11582
11664
|
}
|
|
11583
11665
|
})
|
|
11584
11666
|
);
|
|
11585
|
-
reflections.command("approve <id>").description("write the proposal through the skill or memory store").action(run2(async (
|
|
11586
|
-
reflections.command("reject <id>").description("decline the proposal; nothing is written").action(run2(async (
|
|
11667
|
+
reflections.command("approve <id>").description("write the proposal through the skill or memory store").action(run2(async (id2) => printDecision(await api("POST", `/reflection_proposals/${encodeURIComponent(id2)}/approve`))));
|
|
11668
|
+
reflections.command("reject <id>").description("decline the proposal; nothing is written").action(run2(async (id2) => printDecision(await api("POST", `/reflection_proposals/${encodeURIComponent(id2)}/reject`))));
|
|
11587
11669
|
reflections.command("settle <id>").description("settle a conflict between two skills: keep one, keep both with narrower when-to-use, or merge; owner or admin").requiredOption("--action <action>", "keep_one, narrow or merge").option("--keep <skill>", "the skill id to keep (keep_one, merge)").option("--when-to-use <skill=text...>", "a skill id and its narrower description (narrow); defaults to what the review suggested").option("--skill-md <file>", "the merged SKILL.md (merge); defaults to what the review wrote").action(
|
|
11588
|
-
run2(async (
|
|
11670
|
+
run2(async (id2, opts) => {
|
|
11589
11671
|
const whenToUse = opts.whenToUse?.length ? Object.fromEntries(opts.whenToUse.map((entry) => {
|
|
11590
11672
|
const at = entry.indexOf("=");
|
|
11591
11673
|
if (at < 1) throw new Error(`--when-to-use takes <skill id>=<text>, not "${entry}"`);
|
|
11592
11674
|
return [entry.slice(0, at), entry.slice(at + 1)];
|
|
11593
11675
|
})) : void 0;
|
|
11594
|
-
const body = { action: opts.action, ...opts.keep ? { keep: opts.keep } : {}, ...whenToUse ? { when_to_use: whenToUse } : {}, ...opts.skillMd ? { skill_md:
|
|
11595
|
-
printDecision(await api("POST", `/reflection_proposals/${encodeURIComponent(
|
|
11676
|
+
const body = { action: opts.action, ...opts.keep ? { keep: opts.keep } : {}, ...whenToUse ? { when_to_use: whenToUse } : {}, ...opts.skillMd ? { skill_md: readFileSync27(opts.skillMd, "utf8") } : {} };
|
|
11677
|
+
printDecision(await api("POST", `/reflection_proposals/${encodeURIComponent(id2)}/settle`, body));
|
|
11596
11678
|
})
|
|
11597
11679
|
);
|
|
11598
|
-
reflections.command("rollback <id>").description("undo an automatic skill change or a settled conflict, restoring what was there before").action(run2(async (
|
|
11680
|
+
reflections.command("rollback <id>").description("undo an automatic skill change or a settled conflict, restoring what was there before").action(run2(async (id2) => printDecision(await api("POST", `/reflection_proposals/${encodeURIComponent(id2)}/rollback`))));
|
|
11599
11681
|
var library = program.command("library").description("your artifact Library on agentsky.dev: files and sites your agents saved or you uploaded");
|
|
11600
11682
|
library.command("list").description("your Library, newest first").option("--search <text>", "only names that match").option("--cursor <cursor>", "the next page").option("--json", "print as JSON").action(
|
|
11601
11683
|
run2(async (opts) => {
|
|
@@ -11611,37 +11693,37 @@ library.command("list").description("your Library, newest first").option("--sear
|
|
|
11611
11693
|
);
|
|
11612
11694
|
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(
|
|
11613
11695
|
run2(async (path2, opts) => {
|
|
11614
|
-
const bytes =
|
|
11696
|
+
const bytes = readFileSync27(path2);
|
|
11615
11697
|
const { artifact: artifact2 } = await uploadToLibrary({ bytes, name: basename9(path2), mediaType: "application/octet-stream" }, crypto.randomUUID(), opts.workspace, opts.session);
|
|
11616
11698
|
console.log(renderLibraryArtifact(artifact2));
|
|
11617
11699
|
})
|
|
11618
11700
|
);
|
|
11619
|
-
library.command("show <id>").description("one artifact and its saved versions").action(run2(async (
|
|
11620
|
-
console.log(JSON.stringify(await getLibraryArtifact(
|
|
11701
|
+
library.command("show <id>").description("one artifact and its saved versions").action(run2(async (id2) => {
|
|
11702
|
+
console.log(JSON.stringify(await getLibraryArtifact(id2), null, 2));
|
|
11621
11703
|
}));
|
|
11622
11704
|
library.command("delete <id>").description("delete your artifact with all its versions").action(
|
|
11623
|
-
run2(async (
|
|
11624
|
-
const { currentVersion } = await getLibraryArtifact(
|
|
11625
|
-
await deleteLibraryArtifact(
|
|
11626
|
-
console.log(`deleted ${
|
|
11705
|
+
run2(async (id2) => {
|
|
11706
|
+
const { currentVersion } = await getLibraryArtifact(id2);
|
|
11707
|
+
await deleteLibraryArtifact(id2, currentVersion ?? 0);
|
|
11708
|
+
console.log(`deleted ${id2}`);
|
|
11627
11709
|
})
|
|
11628
11710
|
);
|
|
11629
11711
|
for (const [verb, enabled, description] of [
|
|
11630
11712
|
["share", true, "turn on the artifact's public link"],
|
|
11631
11713
|
["unshare", false, "turn off the artifact's public link"]
|
|
11632
11714
|
]) {
|
|
11633
|
-
library.command(`${verb} <id>`).description(description).action(run2(async (
|
|
11634
|
-
const state = await shareLibraryArtifact(
|
|
11635
|
-
console.log(state.url ?? `${verb}: ${
|
|
11715
|
+
library.command(`${verb} <id>`).description(description).action(run2(async (id2) => {
|
|
11716
|
+
const state = await shareLibraryArtifact(id2, enabled);
|
|
11717
|
+
console.log(state.url ?? `${verb}: ${id2}`);
|
|
11636
11718
|
}));
|
|
11637
11719
|
}
|
|
11638
|
-
library.command("place <id> <workspace>").description('place your artifact in a workspace, or "me" to take it back to you alone').action(run2(async (
|
|
11639
|
-
await placeLibraryArtifact(
|
|
11640
|
-
console.log(`placed ${
|
|
11720
|
+
library.command("place <id> <workspace>").description('place your artifact in a workspace, or "me" to take it back to you alone').action(run2(async (id2, workspace2) => {
|
|
11721
|
+
await placeLibraryArtifact(id2, workspace2 === "me" ? null : workspace2);
|
|
11722
|
+
console.log(`placed ${id2}`);
|
|
11641
11723
|
}));
|
|
11642
11724
|
library.command("download <id> <out>").description("save one version's bytes to a file").option("--version <n>", "a saved version (the current one when omitted)").action(
|
|
11643
|
-
run2(async (
|
|
11644
|
-
const { bytes } = await downloadLibraryArtifact(
|
|
11725
|
+
run2(async (id2, out, opts) => {
|
|
11726
|
+
const { bytes } = await downloadLibraryArtifact(id2, opts.version ? Number(opts.version) : void 0);
|
|
11645
11727
|
writeFileSync13(out, bytes);
|
|
11646
11728
|
console.log(`wrote ${bytes.length} bytes to ${out}`);
|
|
11647
11729
|
})
|
|
@@ -11666,8 +11748,8 @@ for (const [verb, done, description] of [
|
|
|
11666
11748
|
["done", true, "tick a to-do; its document saves a new version"],
|
|
11667
11749
|
["reopen", false, "untick a to-do; its document saves a new version"]
|
|
11668
11750
|
]) {
|
|
11669
|
-
todos.command(`${verb} <id>`).description(description).action(run2(async (
|
|
11670
|
-
const { todo, revision } = await setTodoDone(
|
|
11751
|
+
todos.command(`${verb} <id>`).description(description).action(run2(async (id2) => {
|
|
11752
|
+
const { todo, revision } = await setTodoDone(id2, done);
|
|
11671
11753
|
console.log(`${renderTodo(todo)} (version ${revision})`);
|
|
11672
11754
|
}));
|
|
11673
11755
|
}
|
|
@@ -11719,8 +11801,8 @@ items.command("list").description("needs you first, then working, proposed and d
|
|
|
11719
11801
|
})
|
|
11720
11802
|
);
|
|
11721
11803
|
items.command("act <id>").description("run an item's action; one that sends something or spends money stays with you in the app").option("--option <id>", "the option to answer with").option("--text <text>", "the answer, where free text is allowed").option("--engine <agentType>", "who starts, for a Start").option("--model <llm>", "the model they run").option("--json", "print as JSON").action(
|
|
11722
|
-
run2(async (
|
|
11723
|
-
const result = await actOnItem(
|
|
11804
|
+
run2(async (id2, opts) => {
|
|
11805
|
+
const result = await actOnItem(id2, opts);
|
|
11724
11806
|
console.log(opts.json ? JSON.stringify(result, null, 2) : renderActed(result));
|
|
11725
11807
|
})
|
|
11726
11808
|
);
|
|
@@ -11745,8 +11827,8 @@ asks.command("list").description("what waits on you: who is waiting, what is nee
|
|
|
11745
11827
|
})
|
|
11746
11828
|
);
|
|
11747
11829
|
asks.command("answer <id>").description("answer one; a payment, signature, plugin install or other approval stays with you in the app").option("--option <id>", "the option to answer with").option("--text <text>", "the answer, where free text is allowed").option("--engine <agentType>", "who starts, for a Start").option("--model <llm>", "the model they run").option("--json", "print as JSON").action(
|
|
11748
|
-
run2(async (
|
|
11749
|
-
const result = await answerAsk(
|
|
11830
|
+
run2(async (id2, opts) => {
|
|
11831
|
+
const result = await answerAsk(id2, opts);
|
|
11750
11832
|
console.log(opts.json ? JSON.stringify(result, null, 2) : renderAnswered(result));
|
|
11751
11833
|
})
|
|
11752
11834
|
);
|
|
@@ -11766,27 +11848,27 @@ signing.command("list").description("this workspace's signing requests").option(
|
|
|
11766
11848
|
})
|
|
11767
11849
|
);
|
|
11768
11850
|
signing.command("get <id>").description("a request's status and, once signed, its signature record").option("--json", "print as JSON").action(
|
|
11769
|
-
run2(async (
|
|
11770
|
-
const request3 = await readRequest(
|
|
11851
|
+
run2(async (id2, opts) => {
|
|
11852
|
+
const request3 = await readRequest(id2);
|
|
11771
11853
|
console.log(opts.json ? JSON.stringify(request3, null, 2) : renderRequest3(request3));
|
|
11772
11854
|
})
|
|
11773
11855
|
);
|
|
11774
|
-
signing.command("copy <id> <file>").description("save the signed document and its record as a PDF").action(run2(async (
|
|
11775
|
-
await saveCopy(
|
|
11856
|
+
signing.command("copy <id> <file>").description("save the signed document and its record as a PDF").action(run2(async (id2, file) => {
|
|
11857
|
+
await saveCopy(id2, file);
|
|
11776
11858
|
console.log(file);
|
|
11777
11859
|
}));
|
|
11778
|
-
signing.command("document <id>").description("the document exactly as it is to be signed or was signed").action(run2(async (
|
|
11779
|
-
signing.command("block <id>").description("the HTML block to embed in an artifact page; read it again after signing for the stamp").action(run2(async (
|
|
11860
|
+
signing.command("document <id>").description("the document exactly as it is to be signed or was signed").action(run2(async (id2) => console.log((await readDocument(id2)).body)));
|
|
11861
|
+
signing.command("block <id>").description("the HTML block to embed in an artifact page; read it again after signing for the stamp").action(run2(async (id2) => console.log((await readRequest(id2)).block_html)));
|
|
11780
11862
|
signing.command("cancel <id>").description("withdraw a request nobody has signed").option("--json", "print as JSON").action(
|
|
11781
|
-
run2(async (
|
|
11782
|
-
const request3 = await cancelRequest(
|
|
11863
|
+
run2(async (id2, opts) => {
|
|
11864
|
+
const request3 = await cancelRequest(id2);
|
|
11783
11865
|
console.log(opts.json ? JSON.stringify(request3, null, 2) : renderRequest3(request3));
|
|
11784
11866
|
})
|
|
11785
11867
|
);
|
|
11786
11868
|
var artifact = program.command("artifact").description("artifacts: publish a session's shared files as a named, shareable result");
|
|
11787
11869
|
artifact.command("bundle <id>").description("export an artifact with every committed version as an agentsky.artifact.v1 bundle (sky session import-artifact takes it)").option("--out <file>", "write the bundle here instead of printing it").option("--reference", "carry each body by hash only (a copy inside this deployment)").option("--include-deleted", "export a deleted artifact too").action(
|
|
11788
|
-
run2(async (
|
|
11789
|
-
emitBundle(await api("GET", `/artifacts/${encodeURIComponent(
|
|
11870
|
+
run2(async (id2, opts) => {
|
|
11871
|
+
emitBundle(await api("GET", `/artifacts/${encodeURIComponent(id2)}/bundle${bundleQuery({ content: opts.reference ? "reference" : void 0, include_deleted: opts.includeDeleted ? "true" : void 0 })}`), opts.out, `artifact ${id2}`);
|
|
11790
11872
|
})
|
|
11791
11873
|
);
|
|
11792
11874
|
registerArtifactAdoptionCommands(artifact);
|
|
@@ -11803,9 +11885,9 @@ artifact.command("publish <session>").description("publish paths from the sessio
|
|
|
11803
11885
|
})
|
|
11804
11886
|
);
|
|
11805
11887
|
artifact.command("get <id> <path>").description("read one file of an artifact; prints it, or writes it with -o").option("-o, --out <path>", "where to write the bytes").option("--version <n>", "read the file as that version held it (default: the current version)", Number).action(
|
|
11806
|
-
run2(async (
|
|
11888
|
+
run2(async (id2, path2, opts) => {
|
|
11807
11889
|
if (opts.version !== void 0 && (!Number.isSafeInteger(opts.version) || opts.version < 1)) throw new Error("--version must be a positive integer");
|
|
11808
|
-
const bytes = await readArtifactFile(
|
|
11890
|
+
const bytes = await readArtifactFile(id2, path2, opts.version);
|
|
11809
11891
|
if (opts.out) {
|
|
11810
11892
|
writeFileSync13(opts.out, bytes);
|
|
11811
11893
|
console.log(`Wrote ${bytes.length} bytes to ${opts.out}`);
|
|
@@ -11813,64 +11895,64 @@ artifact.command("get <id> <path>").description("read one file of an artifact; p
|
|
|
11813
11895
|
})
|
|
11814
11896
|
);
|
|
11815
11897
|
artifact.command("save <id> <path>").description("save one file as the artifact's next version; a newer version in between is refused").requiredOption("--base <version>", "the version you read").option("--file <file>", "the file's new bytes").option("--restore <version>", "put back the file as it was in this version").option("--request-id <id>", "send the same value when retrying").action(
|
|
11816
|
-
run2(async (
|
|
11898
|
+
run2(async (id2, path2, opts) => {
|
|
11817
11899
|
if (Boolean(opts.file) === Boolean(opts.restore)) throw new Error("send --file or --restore");
|
|
11818
|
-
console.log(renderArtifact(await saveArtifactFile(
|
|
11900
|
+
console.log(renderArtifact(await saveArtifactFile(id2, path2, {
|
|
11819
11901
|
baseVersion: Number(opts.base),
|
|
11820
11902
|
requestId: opts.requestId,
|
|
11821
|
-
...opts.file ? { bytes:
|
|
11903
|
+
...opts.file ? { bytes: readFileSync27(opts.file) } : { restoreVersion: Number(opts.restore) }
|
|
11822
11904
|
})));
|
|
11823
11905
|
})
|
|
11824
11906
|
);
|
|
11825
|
-
artifact.command("update <id>").description("rename an artifact; its links, versions and files stay").requiredOption("--name <name>", "the new name").action(run2(async (
|
|
11826
|
-
console.log(renderArtifact(await renameArtifact(
|
|
11907
|
+
artifact.command("update <id>").description("rename an artifact; its links, versions and files stay").requiredOption("--name <name>", "the new name").action(run2(async (id2, opts) => {
|
|
11908
|
+
console.log(renderArtifact(await renameArtifact(id2, opts.name)));
|
|
11827
11909
|
}));
|
|
11828
|
-
artifact.command("copy <id>").description("copy one version into a new artifact with its own files and no public link").option("--name <name>", "the copy's name").option("--artifact-version <version>", "the version to copy; the current one by default").option("--task <session>", "the session the copy lands in, in any workspace you can act in; the source's own by default").option("--request-id <id>", "send the same value when retrying").action(run2(async (
|
|
11829
|
-
console.log(renderArtifact(await copyArtifact(
|
|
11910
|
+
artifact.command("copy <id>").description("copy one version into a new artifact with its own files and no public link").option("--name <name>", "the copy's name").option("--artifact-version <version>", "the version to copy; the current one by default").option("--task <session>", "the session the copy lands in, in any workspace you can act in; the source's own by default").option("--request-id <id>", "send the same value when retrying").action(run2(async (id2, opts) => {
|
|
11911
|
+
console.log(renderArtifact(await copyArtifact(id2, { name: opts.name, version: opts.artifactVersion ? Number(opts.artifactVersion) : void 0, taskId: opts.task, requestId: opts.requestId })));
|
|
11830
11912
|
}));
|
|
11831
11913
|
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(
|
|
11832
11914
|
run2(async (file, opts) => {
|
|
11833
11915
|
if (Boolean(file) === Boolean(opts.url)) throw new Error("name a file or --url");
|
|
11834
|
-
console.log(renderArtifact(await importArtifact({ ...file ? { file: { name: basename9(file), bytes:
|
|
11916
|
+
console.log(renderArtifact(await importArtifact({ ...file ? { file: { name: basename9(file), bytes: readFileSync27(file) } } : { url: opts.url }, name: opts.name, taskId: opts.task, requestId: opts.requestId })));
|
|
11835
11917
|
})
|
|
11836
11918
|
);
|
|
11837
11919
|
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(
|
|
11838
|
-
run2(async (
|
|
11839
|
-
const bytes = await exportArtifact(
|
|
11920
|
+
run2(async (id2, opts) => {
|
|
11921
|
+
const bytes = await exportArtifact(id2, { format: opts.format, version: opts.artifactVersion === void 0 ? void 0 : Number(opts.artifactVersion) });
|
|
11840
11922
|
writeFileSync13(opts.out, bytes);
|
|
11841
11923
|
console.log(`Wrote ${bytes.length} bytes to ${opts.out}`);
|
|
11842
11924
|
})
|
|
11843
11925
|
);
|
|
11844
11926
|
artifact.command("convert <id>").description("make a Markdown, Word or PDF artifact into a page, as its next version; restoring the earlier version undoes it").requiredOption("--base <version>", "the version you read").option("--request-id <id>", "send the same value when retrying").action(
|
|
11845
|
-
run2(async (
|
|
11846
|
-
const { artifact: converted, loss } = await convertArtifactToPage(
|
|
11927
|
+
run2(async (id2, opts) => {
|
|
11928
|
+
const { artifact: converted, loss } = await convertArtifactToPage(id2, { baseVersion: Number(opts.base), requestId: opts.requestId });
|
|
11847
11929
|
console.log(renderArtifact(converted));
|
|
11848
11930
|
if (loss) console.log(loss);
|
|
11849
11931
|
})
|
|
11850
11932
|
);
|
|
11851
11933
|
artifact.command("share <id>").description("turn on a public link anyone can open; --off turns it off (the old link stops working)").option("--off", "stop sharing").option("--confirm-spends-owner-credits", "for a page whose agentsky.json names agents or APIs: agree that anyone who opens the link uses your credits").action(
|
|
11852
|
-
run2(async (
|
|
11853
|
-
const url = await shareArtifact(
|
|
11854
|
-
console.log(url ?? `Stopped sharing ${
|
|
11934
|
+
run2(async (id2, opts) => {
|
|
11935
|
+
const url = await shareArtifact(id2, !opts.off, opts.confirmSpendsOwnerCredits);
|
|
11936
|
+
console.log(url ?? `Stopped sharing ${id2}`);
|
|
11855
11937
|
})
|
|
11856
11938
|
);
|
|
11857
11939
|
var artifactPage = artifact.command("page").description("what a published page with an agentsky.json can spend");
|
|
11858
|
-
artifactPage.command("get <id>").description("whether its link spends your credits, what a message can cost, its limit and what it has spent").action(run2(async (
|
|
11859
|
-
console.log(JSON.stringify(await pageBackendOperation("get",
|
|
11940
|
+
artifactPage.command("get <id>").description("whether its link spends your credits, what a message can cost, its limit and what it has spent").action(run2(async (id2) => {
|
|
11941
|
+
console.log(JSON.stringify(await pageBackendOperation("get", id2), null, 2));
|
|
11860
11942
|
}));
|
|
11861
|
-
artifactPage.command("limit <id> <cents>").description("set the most the page may spend, in US cents").action(run2(async (
|
|
11862
|
-
console.log(JSON.stringify(await pageBackendOperation("limit",
|
|
11943
|
+
artifactPage.command("limit <id> <cents>").description("set the most the page may spend, in US cents").action(run2(async (id2, cents) => {
|
|
11944
|
+
console.log(JSON.stringify(await pageBackendOperation("limit", id2, cents), null, 2));
|
|
11863
11945
|
}));
|
|
11864
|
-
artifactPage.command("confirm <id>").description("agree that anyone who opens this page's link uses your credits").action(run2(async (
|
|
11865
|
-
console.log(JSON.stringify(await pageBackendOperation("confirm",
|
|
11946
|
+
artifactPage.command("confirm <id>").description("agree that anyone who opens this page's link uses your credits").action(run2(async (id2) => {
|
|
11947
|
+
console.log(JSON.stringify(await pageBackendOperation("confirm", id2), null, 2));
|
|
11866
11948
|
}));
|
|
11867
|
-
artifact.command("comments <id>").description("read private discussion, add feedback, or resolve/reopen a root thread").option("--text <text>", "comment text").option("--base <version>", "the artifact version you read").option("--reply <id>", "reply to this comment in the same artifact and version").option("--resolve <id>", "resolve this root thread; requires --base and --state-version").option("--reopen <id>", "reopen this root thread; requires --base and --state-version").option("--state-version <version>", "the root's resolution.version, or 0 when absent").action(run2(async (
|
|
11868
|
-
console.log(JSON.stringify(await artifactCommentsOperation(
|
|
11949
|
+
artifact.command("comments <id>").description("read private discussion, add feedback, or resolve/reopen a root thread").option("--text <text>", "comment text").option("--base <version>", "the artifact version you read").option("--reply <id>", "reply to this comment in the same artifact and version").option("--resolve <id>", "resolve this root thread; requires --base and --state-version").option("--reopen <id>", "reopen this root thread; requires --base and --state-version").option("--state-version <version>", "the root's resolution.version, or 0 when absent").action(run2(async (id2, opts) => {
|
|
11950
|
+
console.log(JSON.stringify(await artifactCommentsOperation(id2, opts), null, 2));
|
|
11869
11951
|
}));
|
|
11870
11952
|
artifact.command("rm <id>").description("delete an artifact").action(
|
|
11871
|
-
run2(async (
|
|
11872
|
-
await deleteArtifact(
|
|
11873
|
-
console.log(`Deleted ${
|
|
11953
|
+
run2(async (id2) => {
|
|
11954
|
+
await deleteArtifact(id2);
|
|
11955
|
+
console.log(`Deleted ${id2}`);
|
|
11874
11956
|
})
|
|
11875
11957
|
);
|
|
11876
11958
|
var designSystem = program.command("design-system").description("design systems: brand books, tokens and components agents design with");
|
|
@@ -11882,8 +11964,8 @@ designSystem.command("list").description("the workspace's design systems").actio
|
|
|
11882
11964
|
})
|
|
11883
11965
|
);
|
|
11884
11966
|
designSystem.command("show <id>").description("a design system's tokens, components and assets; --readme prints its brand book instead").option("--readme", "print project/README.md").action(
|
|
11885
|
-
run2(async (
|
|
11886
|
-
const system = await getDesignSystem(
|
|
11967
|
+
run2(async (id2, opts) => {
|
|
11968
|
+
const system = await getDesignSystem(id2);
|
|
11887
11969
|
console.log(opts.readme ? system.readme ?? "this design system has no README.md" : renderDesignSystem(system));
|
|
11888
11970
|
})
|
|
11889
11971
|
);
|
|
@@ -11893,21 +11975,21 @@ designSystem.command("import <session> <folder>").description("import a local de
|
|
|
11893
11975
|
})
|
|
11894
11976
|
);
|
|
11895
11977
|
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(
|
|
11896
|
-
run2(async (
|
|
11897
|
-
const tokens = JSON.parse(
|
|
11898
|
-
console.log(renderArtifact(await saveDesignTokens(
|
|
11978
|
+
run2(async (id2, file, opts) => {
|
|
11979
|
+
const tokens = JSON.parse(readFileSync27(resolve12(file), "utf8"));
|
|
11980
|
+
console.log(renderArtifact(await saveDesignTokens(id2, opts.base, tokens, opts.note)));
|
|
11899
11981
|
})
|
|
11900
11982
|
);
|
|
11901
11983
|
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(
|
|
11902
|
-
run2(async (
|
|
11984
|
+
run2(async (id2, path2, file, opts) => {
|
|
11903
11985
|
if (file === void 0 === (opts.restore === void 0)) throw Error("Give a local [file] to save, or --restore <version>.");
|
|
11904
|
-
const change = opts.restore === void 0 ? { content:
|
|
11905
|
-
console.log(renderArtifact(await saveDesignSystemFile(
|
|
11986
|
+
const change = opts.restore === void 0 ? { content: readFileSync27(resolve12(file), "utf8") } : { restore_version: opts.restore };
|
|
11987
|
+
console.log(renderArtifact(await saveDesignSystemFile(id2, path2, opts.base, change, opts.note)));
|
|
11906
11988
|
})
|
|
11907
11989
|
);
|
|
11908
|
-
designSystem.command("comments <id>").description("read design-system comments, or add one with --text and --base").option("--text <text>", "comment to add").option("--target <target>", "overview, color:<name> or component:<name>", "overview").option("--base <version>", "the version you viewed", Number).action(run2(async (
|
|
11990
|
+
designSystem.command("comments <id>").description("read design-system comments, or add one with --text and --base").option("--text <text>", "comment to add").option("--target <target>", "overview, color:<name> or component:<name>", "overview").option("--base <version>", "the version you viewed", Number).action(run2(async (id2, opts) => {
|
|
11909
11991
|
if (opts.text !== void 0 && !Number.isSafeInteger(opts.base)) throw Error("Adding a comment requires --base <version>.");
|
|
11910
|
-
console.log(JSON.stringify(await designComments(
|
|
11992
|
+
console.log(JSON.stringify(await designComments(id2, opts.text === void 0 ? void 0 : { text: opts.text, target: opts.target, base_version: opts.base }), null, 2));
|
|
11911
11993
|
}));
|
|
11912
11994
|
function routineRunOutcome(run3) {
|
|
11913
11995
|
const failure = run3.error ?? run3.turn_error;
|
|
@@ -11959,15 +12041,15 @@ routine.command("list").option("--session <id>", "only the routines that run in
|
|
|
11959
12041
|
})
|
|
11960
12042
|
);
|
|
11961
12043
|
routine.command("show <id>").action(
|
|
11962
|
-
run2(async (
|
|
12044
|
+
run2(async (id2) => {
|
|
11963
12045
|
const { routine: r } = await api(
|
|
11964
12046
|
"GET",
|
|
11965
|
-
`/routines/${encodeURIComponent(
|
|
12047
|
+
`/routines/${encodeURIComponent(id2)}`
|
|
11966
12048
|
);
|
|
11967
12049
|
console.log(routineLine(r));
|
|
11968
12050
|
const { items: items2 } = await api(
|
|
11969
12051
|
"GET",
|
|
11970
|
-
`/routine-runs?routine=${encodeURIComponent(
|
|
12052
|
+
`/routine-runs?routine=${encodeURIComponent(id2)}&limit=5`
|
|
11971
12053
|
);
|
|
11972
12054
|
for (const runRow of items2) {
|
|
11973
12055
|
console.log(` ${runRow.created_at} ${runRow.trigger_context.type.padEnd(8)} ${routineRunOutcome(runRow)}`);
|
|
@@ -11975,21 +12057,21 @@ routine.command("show <id>").action(
|
|
|
11975
12057
|
})
|
|
11976
12058
|
);
|
|
11977
12059
|
routine.command("edit <id>").description("change a routine's name, message, schedule or budget; omitted flags keep their value").option("--name <name>", "the routine's name").option("--description <text>", 'what it is for ("" clears it)').option("--message <text>", "the user message delivered on every fire").option("--cron <expression>", '5-field POSIX cron, e.g. "0 9 * * 1-5"').option("--timezone <tz>", "IANA timezone for --cron (default UTC)").option("--manual", "remove the schedule: it runs only when fired").option("--budget-cents <n>", "per-run spend cap in whole US cents").option("--no-budget", "remove the per-run spend cap").action(
|
|
11978
|
-
run2(async (
|
|
12060
|
+
run2(async (id2, opts) => {
|
|
11979
12061
|
const { routine: r } = await api(
|
|
11980
12062
|
"PATCH",
|
|
11981
|
-
`/routines/${encodeURIComponent(
|
|
12063
|
+
`/routines/${encodeURIComponent(id2)}`,
|
|
11982
12064
|
routinePatchBody(opts)
|
|
11983
12065
|
);
|
|
11984
12066
|
console.log(routineLine(r));
|
|
11985
12067
|
})
|
|
11986
12068
|
);
|
|
11987
12069
|
routine.command("run <id>").description("fire now, outside the schedule (works while paused); --input gives this run what to work on").option("--input <text>", "what this run should work on, added to its first message for this run only").option("--idempotency-key <key>", "a repeat with the same key returns the first run").action(
|
|
11988
|
-
run2(async (
|
|
12070
|
+
run2(async (id2, opts) => {
|
|
11989
12071
|
const body = { ...opts.input !== void 0 ? { input: opts.input } : {}, ...opts.idempotencyKey ? { idempotency_key: opts.idempotencyKey } : {} };
|
|
11990
12072
|
const { run: fired } = await api(
|
|
11991
12073
|
"POST",
|
|
11992
|
-
`/routines/${encodeURIComponent(
|
|
12074
|
+
`/routines/${encodeURIComponent(id2)}/run`,
|
|
11993
12075
|
...Object.keys(body).length ? [body] : []
|
|
11994
12076
|
);
|
|
11995
12077
|
if (fired.error) console.log(`Run ${fired.id} failed: ${fired.error.type} \u2014 ${fired.error.message}`);
|
|
@@ -12002,25 +12084,25 @@ for (const [verb, blurb] of [
|
|
|
12002
12084
|
["archive", "terminal: the schedule stops and the routine becomes immutable"]
|
|
12003
12085
|
]) {
|
|
12004
12086
|
routine.command(`${verb} <id>`).description(blurb).action(
|
|
12005
|
-
run2(async (
|
|
12087
|
+
run2(async (id2) => {
|
|
12006
12088
|
const { routine: r } = await api(
|
|
12007
12089
|
"POST",
|
|
12008
|
-
`/routines/${encodeURIComponent(
|
|
12090
|
+
`/routines/${encodeURIComponent(id2)}/${verb}`
|
|
12009
12091
|
);
|
|
12010
12092
|
console.log(`${r.id}: ${r.archived_at ? "archived" : r.status}`);
|
|
12011
12093
|
})
|
|
12012
12094
|
);
|
|
12013
12095
|
}
|
|
12014
12096
|
routine.command("rm <id>").description("delete a routine: it never runs again and is archived; --permanent removes it for good (its creator or a workspace owner or admin). Sessions it started are kept").option("--permanent", "remove it for good instead of archiving it").action(
|
|
12015
|
-
run2(async (
|
|
12016
|
-
await api("DELETE", `/routines/${encodeURIComponent(
|
|
12017
|
-
console.log(opts.permanent ? `Deleted routine ${
|
|
12097
|
+
run2(async (id2, opts) => {
|
|
12098
|
+
await api("DELETE", `/routines/${encodeURIComponent(id2)}${opts.permanent ? "?permanent=true" : ""}`);
|
|
12099
|
+
console.log(opts.permanent ? `Deleted routine ${id2} for good. Sessions it started are kept.` : `Archived routine ${id2}. It will not run again; sessions it started are kept.`);
|
|
12018
12100
|
})
|
|
12019
12101
|
);
|
|
12020
12102
|
routine.command("runs [id]").description("every fire attempt, newest first \u2014 of one routine, or all of them").option("--failed", "only runs that failed to start").option("--limit <n>", "how many (default 20)").action(
|
|
12021
|
-
run2(async (
|
|
12103
|
+
run2(async (id2, opts) => {
|
|
12022
12104
|
const params = new URLSearchParams({ limit: opts.limit ?? "20" });
|
|
12023
|
-
if (
|
|
12105
|
+
if (id2) params.set("routine", id2);
|
|
12024
12106
|
if (opts.failed) params.set("has_error", "true");
|
|
12025
12107
|
const { items: items2 } = await api("GET", `/routine-runs?${params}`);
|
|
12026
12108
|
if (!items2.length) console.log("no runs");
|
|
@@ -12030,32 +12112,32 @@ routine.command("runs [id]").description("every fire attempt, newest first \u201
|
|
|
12030
12112
|
})
|
|
12031
12113
|
);
|
|
12032
12114
|
routine.command("inbound-url <id>").description("a URL that starts a run when posted to, for services that can't hold an API token").option("--create", "make one (replaces any earlier URL); the URL is printed once").option("--rm", "remove it; posting to it stops working").action(
|
|
12033
|
-
run2(async (
|
|
12034
|
-
const res = await triggerRequest(
|
|
12115
|
+
run2(async (id2, opts) => {
|
|
12116
|
+
const res = await triggerRequest(id2, "inbound-url", { create: opts.create, remove: opts.rm });
|
|
12035
12117
|
console.log(opts.rm ? res.removed ? "Removed the inbound URL" : "There was no inbound URL" : inboundLine(res.inbound_url ?? null));
|
|
12036
12118
|
})
|
|
12037
12119
|
);
|
|
12038
12120
|
routine.command("precheck <id> [url]").description("run scheduled fires only when the content at an https URL changed; no url shows the precheck").option("--rm", "remove it: every scheduled fire runs again").action(
|
|
12039
|
-
run2(async (
|
|
12040
|
-
const res = await triggerRequest(
|
|
12121
|
+
run2(async (id2, url, opts) => {
|
|
12122
|
+
const res = await triggerRequest(id2, "precheck", { body: url ? { url } : void 0, remove: opts.rm });
|
|
12041
12123
|
console.log(opts.rm ? res.removed ? "Removed the precheck" : "There was no precheck" : precheckLine(res.precheck ?? null));
|
|
12042
12124
|
})
|
|
12043
12125
|
);
|
|
12044
12126
|
routine.command("result-email <id> [state]").description("email you each run's result: on or off; no state shows the setting (new-session routines only)").action(
|
|
12045
|
-
run2(async (
|
|
12127
|
+
run2(async (id2, state) => {
|
|
12046
12128
|
if (state && state !== "on" && state !== "off") throw new ApiError(400, "invalid_request", "state is on or off");
|
|
12047
12129
|
const res = await api(
|
|
12048
12130
|
state === "on" ? "PUT" : state === "off" ? "DELETE" : "GET",
|
|
12049
|
-
triggerPath(
|
|
12131
|
+
triggerPath(id2, "result-email")
|
|
12050
12132
|
);
|
|
12051
12133
|
console.log(`result email ${res.result_email.enabled ? "on" : "off"}`);
|
|
12052
12134
|
})
|
|
12053
12135
|
);
|
|
12054
12136
|
routine.command("chat-trigger <id>").description("start a run from your own message in a connected chat; no flags shows the trigger").option("--connection <id>", "the chat connection (see `sky channel list`)").option("--thread <id>", "only this conversation (default: every conversation on the connection)").option("--prefix <text>", "only messages starting with this; the rest of the message is the run's input").option("--rm", "remove the trigger").action(
|
|
12055
|
-
run2(async (
|
|
12137
|
+
run2(async (id2, opts) => {
|
|
12056
12138
|
const setting = Boolean(opts.connection || opts.thread || opts.prefix);
|
|
12057
12139
|
const res = await triggerRequest(
|
|
12058
|
-
|
|
12140
|
+
id2,
|
|
12059
12141
|
"channel-trigger",
|
|
12060
12142
|
{ body: setting ? triggerBody(opts) : void 0, remove: opts.rm }
|
|
12061
12143
|
);
|
|
@@ -12063,10 +12145,10 @@ routine.command("chat-trigger <id>").description("start a run from your own mess
|
|
|
12063
12145
|
})
|
|
12064
12146
|
);
|
|
12065
12147
|
routine.command("deliver-to <id>").description("post each run's answer to a conversation in a connected chat; no flags shows where").option("--connection <id>", "the chat connection (see `sky channel list`)").option("--thread <id>", "the conversation (default: the chat itself)").option("--rm", "stop posting answers").action(
|
|
12066
|
-
run2(async (
|
|
12148
|
+
run2(async (id2, opts) => {
|
|
12067
12149
|
const setting = Boolean(opts.connection || opts.thread);
|
|
12068
12150
|
const res = await triggerRequest(
|
|
12069
|
-
|
|
12151
|
+
id2,
|
|
12070
12152
|
"deliver-to",
|
|
12071
12153
|
{ body: setting ? deliverBody(opts) : void 0, remove: opts.rm }
|
|
12072
12154
|
);
|
|
@@ -12095,7 +12177,91 @@ providers.command("unbind <namespace>").description("serve a namespace from the
|
|
|
12095
12177
|
printProviders([provider]);
|
|
12096
12178
|
})
|
|
12097
12179
|
);
|
|
12098
|
-
var meetings = program.command("meetings").description("meeting auto-join: a recorder for the video meetings on your calendar");
|
|
12180
|
+
var meetings = program.command("meetings").description("start video meetings, and meeting auto-join: a recorder for the video meetings on your calendar");
|
|
12181
|
+
function printMeetings(rows) {
|
|
12182
|
+
for (const row of rows) console.log(`${row.start} ${row.topic} ${row.join_url}${row.invitees.length ? ` (${row.invitees.join(", ")})` : ""}${row.notetaker ? "" : " [not recorded]"}`);
|
|
12183
|
+
}
|
|
12184
|
+
meetings.command("start [topic]").description("start a Zoom meeting now or at a time, invite people from your calendar, and record it for a meeting note (everyone invited gets an email; the meeting is recorded unless --no-notes)").option("--invite <emails>", "comma-separated emails to invite").option("--at <time>", "when it starts, ISO 8601 with offset; default now").option("--minutes <n>", "how long it is booked for", "30").option("--no-notes", "do not record it for a meeting note").option("--no-calendar", "do not put it on your calendar").option("--session <id>", "the chat to deliver the meeting note back to").option("--task <id>", "the task the meeting is for").action(
|
|
12185
|
+
run2(async (topic, opts) => {
|
|
12186
|
+
const invitees = (opts.invite ?? "").split(/[\s,;]+/).map((email) => email.trim()).filter(Boolean);
|
|
12187
|
+
const answer = await api("POST", "/meetings", {
|
|
12188
|
+
...topic ? { topic } : {},
|
|
12189
|
+
invitees,
|
|
12190
|
+
...opts.at ? { start: opts.at } : {},
|
|
12191
|
+
duration_minutes: Number.parseInt(opts.minutes, 10),
|
|
12192
|
+
notetaker: opts.notes,
|
|
12193
|
+
calendar: opts.calendar,
|
|
12194
|
+
...opts.session ? { session_id: opts.session } : {},
|
|
12195
|
+
...opts.task ? { task_id: opts.task } : {}
|
|
12196
|
+
});
|
|
12197
|
+
console.log(answer.meeting.join_url);
|
|
12198
|
+
if (answer.passcode) console.log(`Passcode: ${answer.passcode}`);
|
|
12199
|
+
console.log(answer.calendar.written ? "Invitation sent from your calendar." : `No invitation sent${answer.calendar.reason ? `: ${answer.calendar.reason}` : ""}.`);
|
|
12200
|
+
})
|
|
12201
|
+
);
|
|
12202
|
+
meetings.command("list").description("the meetings you started, newest first").option("--limit <n>", "how many", "20").action(
|
|
12203
|
+
run2(async (opts) => {
|
|
12204
|
+
const { meetings: rows } = await api("GET", `/meetings?limit=${encodeURIComponent(opts.limit)}`);
|
|
12205
|
+
printMeetings(rows);
|
|
12206
|
+
})
|
|
12207
|
+
);
|
|
12208
|
+
function printMeetingRecords(rows, detail = false) {
|
|
12209
|
+
for (const row of rows) {
|
|
12210
|
+
const kinds = [...new Set(row.links.map((link2) => link2.kind))].join(",");
|
|
12211
|
+
console.log(`${row.id} ${row.state} ${row.start} ${row.title ?? "(no title)"}${kinds ? ` [${kinds}]` : ""}${row.summary ? `
|
|
12212
|
+
${row.summary}` : ""}`);
|
|
12213
|
+
if (!detail) continue;
|
|
12214
|
+
if (row.attendees.length) console.log(` with ${row.attendees.map((person) => person.name ?? person.email).join(", ")}`);
|
|
12215
|
+
for (const link2 of row.links) console.log(` ${link2.id} ${link2.kind} ${link2.ref}${link2.label ? ` ${link2.label}` : ""}`);
|
|
12216
|
+
}
|
|
12217
|
+
}
|
|
12218
|
+
meetings.command("records").description("every meeting of yours, one per real meeting, with its invitations, recorders, notes, action items, chats and tasks").option("--upcoming", "only meetings still to come, soonest first").option("--done", "only meetings that took place, newest first").option("--thread <id>", "only the meetings of one thread").option("--limit <n>", "how many", "30").action(
|
|
12219
|
+
run2(async (opts) => {
|
|
12220
|
+
const query = new URLSearchParams({ limit: opts.limit, ...opts.upcoming ? { state: "upcoming" } : opts.done ? { state: "done" } : {}, ...opts.thread ? { thread_id: opts.thread } : {} });
|
|
12221
|
+
const { meetings: rows } = await api("GET", `/meeting-records?${query}`);
|
|
12222
|
+
printMeetingRecords(rows);
|
|
12223
|
+
})
|
|
12224
|
+
);
|
|
12225
|
+
meetings.command("record <id>").description("one meeting and everything linked to it").action(
|
|
12226
|
+
run2(async (id2) => {
|
|
12227
|
+
const { meeting } = await api("GET", `/meeting-records/${encodeURIComponent(id2)}`);
|
|
12228
|
+
printMeetingRecords([meeting], true);
|
|
12229
|
+
})
|
|
12230
|
+
);
|
|
12231
|
+
meetings.command("resolve").description("find or file a meeting by its invitation UID or join link, and attach a task or chat to it").requiredOption("--start <time>", "when it starts, ISO 8601 with offset").option("--uid <ical uid>", "the invitation's iCalendar UID").option("--url <join link>", "the meeting's join link").option("--title <title>", "its title").option("--task <id>", "attach this task").option("--session <id>", "attach this chat").action(
|
|
12232
|
+
run2(async (opts) => {
|
|
12233
|
+
const links2 = [...opts.task ? [{ kind: "task", ref: opts.task }] : [], ...opts.session ? [{ kind: "session", ref: opts.session }] : []];
|
|
12234
|
+
const { meeting } = await api("POST", "/meeting-records/resolve", {
|
|
12235
|
+
start: opts.start,
|
|
12236
|
+
...opts.uid ? { ical_uid: opts.uid } : {},
|
|
12237
|
+
...opts.url ? { join_url: opts.url } : {},
|
|
12238
|
+
...opts.title ? { title: opts.title } : {},
|
|
12239
|
+
...links2.length ? { links: links2 } : {}
|
|
12240
|
+
});
|
|
12241
|
+
printMeetingRecords([meeting], true);
|
|
12242
|
+
})
|
|
12243
|
+
);
|
|
12244
|
+
meetings.command("link <id> <kind> <ref>").description("attach something to a meeting: kind is task, session, file, action_item, follow_up_mail\u2026").option("--label <text>", "a label for it").action(
|
|
12245
|
+
run2(async (id2, kind, ref, opts) => {
|
|
12246
|
+
const { meeting } = await api("POST", `/meeting-records/${encodeURIComponent(id2)}/links`, { kind, ref, ...opts.label ? { label: opts.label } : {} });
|
|
12247
|
+
printMeetingRecords([meeting], true);
|
|
12248
|
+
})
|
|
12249
|
+
);
|
|
12250
|
+
meetings.command("unlink <id> <link_id>").description("detach one link from a meeting; the linked thing is untouched").action(
|
|
12251
|
+
run2(async (id2, linkId) => {
|
|
12252
|
+
const { meeting } = await api("DELETE", `/meeting-records/${encodeURIComponent(id2)}/links/${encodeURIComponent(linkId)}`);
|
|
12253
|
+
printMeetingRecords([meeting], true);
|
|
12254
|
+
})
|
|
12255
|
+
);
|
|
12256
|
+
meetings.command("brief <id>").description("before a meeting: who is coming, the earlier meetings with them, and what they left open").action(
|
|
12257
|
+
run2(async (id2) => {
|
|
12258
|
+
const brief = await api("GET", `/meeting-records/${encodeURIComponent(id2)}/brief`);
|
|
12259
|
+
printMeetingRecords([brief.meeting], true);
|
|
12260
|
+
for (const row of brief.earlier) console.log(`earlier: ${row.start} ${row.title ?? "(no title)"} (${row.why})${row.summary ? ` \u2014 ${row.summary}` : ""}`);
|
|
12261
|
+
for (const item of brief.open_action_items) console.log(`open: ${item.label ?? item.ref}`);
|
|
12262
|
+
if (brief.tasks.length) console.log(`tasks: ${brief.tasks.join(", ")}`);
|
|
12263
|
+
})
|
|
12264
|
+
);
|
|
12099
12265
|
function printRecorders(bookings) {
|
|
12100
12266
|
for (const row of bookings) console.log(`${row.id} ${row.state} ${row.start} ${row.title ?? "(no title)"}${row.reason ? ` (${row.reason})` : ""}`);
|
|
12101
12267
|
}
|
|
@@ -12113,8 +12279,8 @@ meetings.command("auto-join [state]").description("show meeting auto-join, or tu
|
|
|
12113
12279
|
})
|
|
12114
12280
|
);
|
|
12115
12281
|
meetings.command("cancel-recorder <id>").description("withdraw one recorder: deleted if it has not joined, told to leave if it may have").action(
|
|
12116
|
-
run2(async (
|
|
12117
|
-
const { booking } = await api("POST", `/meeting-auto-join/bookings/${encodeURIComponent(
|
|
12282
|
+
run2(async (id2) => {
|
|
12283
|
+
const { booking } = await api("POST", `/meeting-auto-join/bookings/${encodeURIComponent(id2)}/cancel`);
|
|
12118
12284
|
printRecorders([booking]);
|
|
12119
12285
|
})
|
|
12120
12286
|
);
|
|
@@ -12221,7 +12387,7 @@ skyManager.command("rules").description("print your rules, each marked enforced
|
|
|
12221
12387
|
);
|
|
12222
12388
|
skyManager.command("rules-set <file>").description("replace your rules from a JSON file holding the list").action(
|
|
12223
12389
|
run2(async (file) => {
|
|
12224
|
-
const { rules } = await api("PUT", "/sky/rules", { rules: JSON.parse(
|
|
12390
|
+
const { rules } = await api("PUT", "/sky/rules", { rules: JSON.parse(readFileSync27(file, "utf8")) });
|
|
12225
12391
|
console.log(`Saved ${rules.length} rules`);
|
|
12226
12392
|
})
|
|
12227
12393
|
);
|
|
@@ -12262,7 +12428,7 @@ function goalPath(sessionId, suffix = "") {
|
|
|
12262
12428
|
return `/sessions/${encodeURIComponent(sessionId)}/goal${suffix}`;
|
|
12263
12429
|
}
|
|
12264
12430
|
function withGoalWriteOptions(command) {
|
|
12265
|
-
return command.option("--criterion <text>", "a requirement the grader checks (repeatable)", collect).option("--check <command>", 'a shell command that must exit 0, optionally "<text> :: <command>" (repeatable)', collect).option("--max-iterations <n>", "self-started turns before the goal stops (default 20)").option("--max-spend-cents <n>", 'spend ceiling in whole US cents, or "none"').option("--max-tokens <n>", 'token ceiling (uncached input + output), or "none"').option("--max-minutes <n>", `wall-clock ceiling from the goal's start, or "none"`).option("--idempotency-key <key>", "make a retried request safe to repeat");
|
|
12431
|
+
return command.option("--criterion <text>", "a requirement the grader checks (repeatable)", collect).option("--check <command>", 'a shell command that must exit 0, optionally "<text> :: <command>" (repeatable)', collect).option("--freeze <path>", "a task file under task/ the checks run, kept at the bytes it has now (repeatable)", collect).option("--unfreeze", "remove the files the given checks were frozen to").option("--max-iterations <n>", "self-started turns before the goal stops (default 20)").option("--max-spend-cents <n>", 'spend ceiling in whole US cents, or "none"').option("--max-tokens <n>", 'token ceiling (uncached input + output), or "none"').option("--max-minutes <n>", `wall-clock ceiling from the goal's start, or "none"`).option("--idempotency-key <key>", "make a retried request safe to repeat");
|
|
12266
12432
|
}
|
|
12267
12433
|
var goal = program.command("goal").description("give a session a standing objective it keeps working toward until the criteria are met");
|
|
12268
12434
|
goal.command("get <session>").description("show the session's goal, its limits, and what the last check found").option("--json", "print the raw goal object").action(
|
|
@@ -12463,9 +12629,9 @@ email: ${emailStatus}` : url);
|
|
|
12463
12629
|
})
|
|
12464
12630
|
);
|
|
12465
12631
|
referralLinks.command("disable <id>").description("stop a link being redeemed; customers already enrolled keep their price").action(
|
|
12466
|
-
run2(async (
|
|
12467
|
-
await disableReferralLink(
|
|
12468
|
-
console.log(`Disabled ${
|
|
12632
|
+
run2(async (id2) => {
|
|
12633
|
+
await disableReferralLink(id2);
|
|
12634
|
+
console.log(`Disabled ${id2}`);
|
|
12469
12635
|
})
|
|
12470
12636
|
);
|
|
12471
12637
|
var keys = program.command("keys").description("your own API keys: list, create, revoke, restore (admin scope)");
|
|
@@ -12484,8 +12650,8 @@ keys.command("create <name>").description("make a key; its secret is printed onc
|
|
|
12484
12650
|
})
|
|
12485
12651
|
);
|
|
12486
12652
|
keys.command("reveal <id>").description("print a key's secret again").action(
|
|
12487
|
-
run2(async (
|
|
12488
|
-
const { secret } = await api("POST", `/api_keys/${encodeURIComponent(
|
|
12653
|
+
run2(async (id2) => {
|
|
12654
|
+
const { secret } = await api("POST", `/api_keys/${encodeURIComponent(id2)}/reveal`);
|
|
12489
12655
|
console.log(secret);
|
|
12490
12656
|
})
|
|
12491
12657
|
);
|
|
@@ -12494,8 +12660,8 @@ for (const [verb, blurb] of [
|
|
|
12494
12660
|
["restore", "a revoked key works again"]
|
|
12495
12661
|
]) {
|
|
12496
12662
|
keys.command(`${verb} <id>`).description(blurb).action(
|
|
12497
|
-
run2(async (
|
|
12498
|
-
const { api_key: key } = await api("POST", `/api_keys/${encodeURIComponent(
|
|
12663
|
+
run2(async (id2) => {
|
|
12664
|
+
const { api_key: key } = await api("POST", `/api_keys/${encodeURIComponent(id2)}/${verb}`);
|
|
12499
12665
|
console.log(renderApiKey(key));
|
|
12500
12666
|
})
|
|
12501
12667
|
);
|
|
@@ -12617,7 +12783,7 @@ events.command("digests").description("whether your own digests run in this work
|
|
|
12617
12783
|
);
|
|
12618
12784
|
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(
|
|
12619
12785
|
run2(async (file) => {
|
|
12620
|
-
const text2 = file && file !== "-" ?
|
|
12786
|
+
const text2 = file && file !== "-" ? readFileSync27(file, "utf8") : readFileSync27(0, "utf8");
|
|
12621
12787
|
const parsed = JSON.parse(text2);
|
|
12622
12788
|
const body = Array.isArray(parsed) ? { events: parsed } : parsed;
|
|
12623
12789
|
const result = await api("POST", "/events", body);
|
|
@@ -12625,14 +12791,14 @@ events.command("push [file]").description("write events from your own program in
|
|
|
12625
12791
|
})
|
|
12626
12792
|
);
|
|
12627
12793
|
events.command("show <id>").description("one event in full").action(
|
|
12628
|
-
run2(async (
|
|
12629
|
-
console.log(JSON.stringify(await api("GET", `/events/${encodeURIComponent(
|
|
12794
|
+
run2(async (id2) => {
|
|
12795
|
+
console.log(JSON.stringify(await api("GET", `/events/${encodeURIComponent(id2)}`), null, 2));
|
|
12630
12796
|
})
|
|
12631
12797
|
);
|
|
12632
12798
|
events.command("body <id>").description("an event's stored body, whole: a connector reply, a context result, a request or a large payload").option("--part <part>", "response (default), request or payload").option("--text", "the extracted text instead of the raw bytes").option("--out <file>", "write the bytes to a file instead of stdout").action(
|
|
12633
|
-
run2(async (
|
|
12799
|
+
run2(async (id2, opts) => {
|
|
12634
12800
|
const params = new URLSearchParams({ part: opts.part ?? "response", as: opts.text ? "text" : "raw" });
|
|
12635
|
-
const res = await apiRaw("GET", `/events/${encodeURIComponent(
|
|
12801
|
+
const res = await apiRaw("GET", `/events/${encodeURIComponent(id2)}/body?${params}`);
|
|
12636
12802
|
if (!res.ok) await parseError(res);
|
|
12637
12803
|
if (opts.out) {
|
|
12638
12804
|
const bytes = await writeResponseFile(res, opts.out);
|
|
@@ -12659,21 +12825,21 @@ webhook.command("create <url>").description("register an endpoint; its signing s
|
|
|
12659
12825
|
})
|
|
12660
12826
|
);
|
|
12661
12827
|
webhook.command("enable <id>").description("re-enable an endpoint that was disabled after failed deliveries").action(
|
|
12662
|
-
run2(async (
|
|
12663
|
-
const { webhook: updated } = await api("PATCH", `/webhooks/${encodeURIComponent(
|
|
12828
|
+
run2(async (id2) => {
|
|
12829
|
+
const { webhook: updated } = await api("PATCH", `/webhooks/${encodeURIComponent(id2)}`, { status: "active" });
|
|
12664
12830
|
console.log(webhookLine(updated));
|
|
12665
12831
|
})
|
|
12666
12832
|
);
|
|
12667
12833
|
webhook.command("replay <id>").description("requeue an endpoint's failed deliveries under their own ids (admin key; enable a disabled endpoint first)").option("--since <time>", "only deliveries filed as failed at or after this ISO time").option("--delivery <id...>", "only these delivery ids").action(
|
|
12668
|
-
run2(async (
|
|
12669
|
-
const { replayed } = await api("POST", `/webhooks/${encodeURIComponent(
|
|
12834
|
+
run2(async (id2, opts) => {
|
|
12835
|
+
const { replayed } = await api("POST", `/webhooks/${encodeURIComponent(id2)}/deliveries/replay`, { ...opts.since ? { since: opts.since } : {}, ...opts.delivery?.length ? { ids: opts.delivery } : {} });
|
|
12670
12836
|
console.log(`Requeued ${replayed} deliveries`);
|
|
12671
12837
|
})
|
|
12672
12838
|
);
|
|
12673
12839
|
webhook.command("rm <id>").description("delete an endpoint").action(
|
|
12674
|
-
run2(async (
|
|
12675
|
-
await api("DELETE", `/webhooks/${encodeURIComponent(
|
|
12676
|
-
console.log(`Deleted ${
|
|
12840
|
+
run2(async (id2) => {
|
|
12841
|
+
await api("DELETE", `/webhooks/${encodeURIComponent(id2)}`);
|
|
12842
|
+
console.log(`Deleted ${id2}`);
|
|
12677
12843
|
})
|
|
12678
12844
|
);
|
|
12679
12845
|
var channel = program.command("channel").description("chat surfaces (Slack, Telegram, Discord, WhatsApp, iMessage, \u2026) routed to a session");
|
|
@@ -12924,9 +13090,9 @@ ruleCommand.command("permissions").description("what an agent may do without ask
|
|
|
12924
13090
|
})
|
|
12925
13091
|
);
|
|
12926
13092
|
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(
|
|
12927
|
-
run2(async (
|
|
13093
|
+
run2(async (id2, opts) => {
|
|
12928
13094
|
const body = { ...opts.on ? { enabled: true } : opts.off ? { enabled: false } : {}, ...opts.name ? { name: opts.name } : {}, ...opts.config ? { config: JSON.parse(opts.config) } : {} };
|
|
12929
|
-
console.log(JSON.stringify(await api("PATCH", `/rules/${encodeURIComponent(
|
|
13095
|
+
console.log(JSON.stringify(await api("PATCH", `/rules/${encodeURIComponent(id2)}`, body), null, 2));
|
|
12930
13096
|
})
|
|
12931
13097
|
);
|
|
12932
13098
|
ruleCommand.command("history").description("who changed which rule, newest first, with the rule before and after").option("--rule <id>", "one rule's changes only").option("--limit <n>", "how many, 1 to 200 (50 when left out)").option("--json", "print as JSON, with each rule before and after").action(
|
|
@@ -12943,8 +13109,8 @@ ruleCommand.command("history").description("who changed which rule, newest first
|
|
|
12943
13109
|
ruleCommand.command("undo <change>").description("put a rule back as it was before one change (its id from: sky rule history)").action(run2(async (change) => {
|
|
12944
13110
|
console.log(JSON.stringify(await api("POST", `/rules/history/${encodeURIComponent(change)}/undo`), null, 2));
|
|
12945
13111
|
}));
|
|
12946
|
-
ruleCommand.command("rm <id>").description("remove a rule").action(run2(async (
|
|
12947
|
-
console.log(JSON.stringify(await api("DELETE", `/rules/${encodeURIComponent(
|
|
13112
|
+
ruleCommand.command("rm <id>").description("remove a rule").action(run2(async (id2) => {
|
|
13113
|
+
console.log(JSON.stringify(await api("DELETE", `/rules/${encodeURIComponent(id2)}`), null, 2));
|
|
12948
13114
|
}));
|
|
12949
13115
|
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(
|
|
12950
13116
|
run2(async (opts) => {
|
|
@@ -13014,14 +13180,14 @@ vendor.command("add <vendor>").description("connect a vendor account by pasting
|
|
|
13014
13180
|
})
|
|
13015
13181
|
);
|
|
13016
13182
|
vendor.command("rm <id>").description("disconnect a vendor account").action(
|
|
13017
|
-
run2(async (
|
|
13018
|
-
await api("DELETE", `/external_accounts/${encodeURIComponent(
|
|
13019
|
-
console.log(`Removed ${
|
|
13183
|
+
run2(async (id2) => {
|
|
13184
|
+
await api("DELETE", `/external_accounts/${encodeURIComponent(id2)}`);
|
|
13185
|
+
console.log(`Removed ${id2}`);
|
|
13020
13186
|
})
|
|
13021
13187
|
);
|
|
13022
13188
|
vendor.command("usage <id>").description("the agents and sessions that used this vendor account").option("--json", "print as JSON").action(
|
|
13023
|
-
run2(async (
|
|
13024
|
-
const { usage } = await api("GET", `/external_accounts/${encodeURIComponent(
|
|
13189
|
+
run2(async (id2, opts) => {
|
|
13190
|
+
const { usage } = await api("GET", `/external_accounts/${encodeURIComponent(id2)}/usage`);
|
|
13025
13191
|
if (opts.json) {
|
|
13026
13192
|
console.log(JSON.stringify(usage, null, 2));
|
|
13027
13193
|
return;
|
|
@@ -13043,22 +13209,22 @@ program.command("capabilities").description("deprecated: sky plugins list --view
|
|
|
13043
13209
|
);
|
|
13044
13210
|
var mcpCommand = program.command("mcp").description("the AgentSky MCP server on this computer");
|
|
13045
13211
|
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 () => {
|
|
13046
|
-
const { serveMcp } = await import("./mcp-serve-
|
|
13212
|
+
const { serveMcp } = await import("./mcp-serve-OLHMHG4M.js");
|
|
13047
13213
|
await serveMcp();
|
|
13048
13214
|
}));
|
|
13049
13215
|
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)");
|
|
13050
13216
|
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) => {
|
|
13051
|
-
const { listComputeMachines, renderMachines } = await import("./compute-
|
|
13217
|
+
const { listComputeMachines, renderMachines } = await import("./compute-VNGFIQCD.js");
|
|
13052
13218
|
const machines = await listComputeMachines();
|
|
13053
13219
|
console.log(opts.json ? JSON.stringify({ machines }, null, 2) : renderMachines(machines));
|
|
13054
13220
|
}));
|
|
13055
13221
|
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) => {
|
|
13056
|
-
const { requestRepair } = await import("./compute-
|
|
13222
|
+
const { requestRepair } = await import("./compute-VNGFIQCD.js");
|
|
13057
13223
|
const answer = await requestRepair(machine);
|
|
13058
13224
|
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).`);
|
|
13059
13225
|
}));
|
|
13060
13226
|
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) => {
|
|
13061
|
-
const { removeMachine } = await import("./compute-
|
|
13227
|
+
const { removeMachine } = await import("./compute-VNGFIQCD.js");
|
|
13062
13228
|
await removeMachine(machine);
|
|
13063
13229
|
console.log(`Forgot ${machine}. It reports again on its next run unless \`sky setup --remove\` ran there.`);
|
|
13064
13230
|
}));
|
|
@@ -13114,8 +13280,8 @@ mac.command("ask <machine> <kind>").description("ask a Mac to lend a folder, a b
|
|
|
13114
13280
|
})
|
|
13115
13281
|
);
|
|
13116
13282
|
mac.command("ask-status <id>").description("where an ask stands: pending, asking, granted, denied, unavailable or expired").option("--wait <seconds>", "wait up to this long (at most 25) for the person to answer", "0").option("--json", "print as JSON").action(
|
|
13117
|
-
run2(async (
|
|
13118
|
-
const answer = await readReachRequest(
|
|
13283
|
+
run2(async (id2, opts) => {
|
|
13284
|
+
const answer = await readReachRequest(id2, Number(opts.wait) || 0);
|
|
13119
13285
|
if (opts.json) {
|
|
13120
13286
|
console.log(JSON.stringify(answer, null, 2));
|
|
13121
13287
|
return;
|
|
@@ -13137,7 +13303,7 @@ function emitBundle(bundle, out, what) {
|
|
|
13137
13303
|
console.log(`Exported ${what} to ${out}`);
|
|
13138
13304
|
}
|
|
13139
13305
|
function bundleBody(file, requestId2, extra = {}) {
|
|
13140
|
-
const text2 =
|
|
13306
|
+
const text2 = readFileSync27(file, "utf8");
|
|
13141
13307
|
let bundle;
|
|
13142
13308
|
try {
|
|
13143
13309
|
bundle = JSON.parse(text2);
|
|
@@ -13184,7 +13350,7 @@ db.command("get <namespace> <key>").description("print a value as JSON (--with-v
|
|
|
13184
13350
|
);
|
|
13185
13351
|
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(
|
|
13186
13352
|
run2(async (namespace, key, json, opts) => {
|
|
13187
|
-
const text2 = json ??
|
|
13353
|
+
const text2 = json ?? readFileSync27(0, "utf8");
|
|
13188
13354
|
let value;
|
|
13189
13355
|
try {
|
|
13190
13356
|
value = JSON.parse(text2);
|
|
@@ -13230,6 +13396,17 @@ auditCommand.command("export").description("print the workspace's audit facts in
|
|
|
13230
13396
|
} while (cursor);
|
|
13231
13397
|
})
|
|
13232
13398
|
);
|
|
13399
|
+
auditCommand.command("verify").description("check the workspace's audit log has not been edited, cut or reordered: recomputes its hash chain and exits 1 at the first broken link").action(
|
|
13400
|
+
run2(async () => {
|
|
13401
|
+
const verdict = await api("GET", "/audit/verify");
|
|
13402
|
+
if (verdict.ok) {
|
|
13403
|
+
console.log(`ok: ${verdict.links} audit records, chain intact`);
|
|
13404
|
+
return;
|
|
13405
|
+
}
|
|
13406
|
+
console.error(`broken at link ${verdict.broken?.seq} (${verdict.broken?.reason})${verdict.broken?.event_id ? `, event ${verdict.broken.event_id}` : ""}; ${verdict.links} records verified before it`);
|
|
13407
|
+
process.exitCode = 1;
|
|
13408
|
+
})
|
|
13409
|
+
);
|
|
13233
13410
|
var site = program.command("site").description("stable public addresses for shared artifacts and deployed apps; a session's port is a live app, see sky session ports");
|
|
13234
13411
|
var siteLine = (s) => `${s.name} ${s.url} ${s.kind === "app" ? `app, deploy ${s.deploy?.id ?? "-"}` : `artifact ${s.artifact_id}`}`;
|
|
13235
13412
|
site.command("ls").description("the workspace's sites").option("--json", "print as JSON").action(
|
|
@@ -13523,7 +13700,7 @@ var tool = program.command("tool").description("list and call the tools of Agent
|
|
|
13523
13700
|
tool.command("list").description("every tool this key can call, one per line").option("--json", "print the tools with their input schemas as JSON").action(run2(async (opts) => listTools(opts)));
|
|
13524
13701
|
tool.command("call <name>").description("call one tool; its arguments go in --json").option("--json <arguments>", "the tool's arguments as a JSON object: inline, @file, or - for stdin").action(run2(async (name, opts) => callTool(name, opts)));
|
|
13525
13702
|
agent.command("edit <id>").description("change an agent's name, description, engine, model or thinking level (as its Library folder does); instruction files and custom data through agent.toml and `sky deploy`").option("--name <name>", "new name").option("--description <text>", "new description (at most 500 characters)").option("--engine <agentType>", "engine, e.g. CLAUDE_CODE, CODEX, HERMES").option("--model <llm>", "model id, e.g. anthropic/claude-sonnet-4-5").option("--thinking <effort>", 'reasoning effort, or "default" to clear the pin').action(
|
|
13526
|
-
run2(async (
|
|
13703
|
+
run2(async (id2, opts) => {
|
|
13527
13704
|
const body = {
|
|
13528
13705
|
...opts.name ? { displayName: opts.name } : {},
|
|
13529
13706
|
...opts.description !== void 0 ? { description: opts.description } : {},
|
|
@@ -13532,7 +13709,7 @@ agent.command("edit <id>").description("change an agent's name, description, eng
|
|
|
13532
13709
|
...opts.thinking ? { reasoningEffort: opts.thinking === "default" ? null : opts.thinking } : {}
|
|
13533
13710
|
};
|
|
13534
13711
|
if (!Object.keys(body).length) throw new Error("pass at least one of --name, --description, --engine, --model, --thinking");
|
|
13535
|
-
const { agent: a } = await api("PATCH", `/agents/${encodeURIComponent(
|
|
13712
|
+
const { agent: a } = await api("PATCH", `/agents/${encodeURIComponent(id2)}`, body);
|
|
13536
13713
|
console.log(`${a.id} \u2014 ${a.displayName} \xB7 ${a.agentType} \xB7 ${a.llm}${a.reasoningEffort ? ` \xB7 ${a.reasoningEffort}` : ""}`);
|
|
13537
13714
|
})
|
|
13538
13715
|
);
|
|
@@ -13600,7 +13777,7 @@ notes.command("rm <storeId> <noteId>").description("delete one note from a works
|
|
|
13600
13777
|
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(
|
|
13601
13778
|
run2(async (storeId, file, opts) => {
|
|
13602
13779
|
if (!opts.path === !opts.note) throw new Error("pass exactly one of --path (new note) or --note (update)");
|
|
13603
|
-
const content =
|
|
13780
|
+
const content = readFileSync27(file, "utf8");
|
|
13604
13781
|
const target2 = `/memory_stores/${encodeURIComponent(storeId)}/memories${opts.note ? `/${encodeURIComponent(opts.note)}` : ""}`;
|
|
13605
13782
|
const { memory: memory2 } = await api("POST", target2, { content, ...opts.path ? { path: opts.path } : {} });
|
|
13606
13783
|
console.log(`Saved ${memory2.path} (${memory2.id})`);
|
|
@@ -13618,7 +13795,7 @@ notes.command("export <storeId>").description("every current note of a store as
|
|
|
13618
13795
|
);
|
|
13619
13796
|
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(
|
|
13620
13797
|
run2(async (storeId, file, opts) => {
|
|
13621
|
-
const receipt = await importMemoryStore(storeId, parseMemoryExport(
|
|
13798
|
+
const receipt = await importMemoryStore(storeId, parseMemoryExport(readFileSync27(file, "utf8")), opts.requestId);
|
|
13622
13799
|
console.log(`Imported ${receipt.imported} notes`);
|
|
13623
13800
|
})
|
|
13624
13801
|
);
|
|
@@ -13716,7 +13893,7 @@ harness.command("connect").description("run an ACP agent (the command after --)
|
|
|
13716
13893
|
}));
|
|
13717
13894
|
var traceCmd = program.command("trace").description("correlate this machine's agent work with the cloud sessions it starts (metadata only unless you choose content)");
|
|
13718
13895
|
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) => {
|
|
13719
|
-
const { readState, writeState, record: record3, installClaudeHooks, parseContentScopes, chosenPaths, fileEvent } = await import("./trace-
|
|
13896
|
+
const { readState, writeState, record: record3, installClaudeHooks, parseContentScopes, chosenPaths, fileEvent } = await import("./trace-PXIY5WUU.js");
|
|
13720
13897
|
if (readState()) throw new Error("a trace is already running here \u2014 `sky trace stop` it first");
|
|
13721
13898
|
const scopes = parseContentScopes(opts.capture);
|
|
13722
13899
|
const chosen = chosenPaths(opts.file ?? [], opts.dir ?? []);
|
|
@@ -13751,7 +13928,7 @@ traceCmd.command("start").description("start a trace: a grant for this machine,
|
|
|
13751
13928
|
}));
|
|
13752
13929
|
traceCmd.command("hook").description("record one Claude Code hook event read from stdin (run by the installed hooks; never fails, prints nothing)").action(async () => {
|
|
13753
13930
|
try {
|
|
13754
|
-
const { readState, record: record3, flush, grantSender, eventsForClaudeHook, contentForClaudeHook, clearState } = await import("./trace-
|
|
13931
|
+
const { readState, record: record3, flush, grantSender, eventsForClaudeHook, contentForClaudeHook, clearState } = await import("./trace-PXIY5WUU.js");
|
|
13755
13932
|
const chunks = [];
|
|
13756
13933
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
13757
13934
|
const input = JSON.parse(Buffer.concat(chunks).toString("utf8") || "{}");
|
|
@@ -13764,14 +13941,14 @@ traceCmd.command("hook").description("record one Claude Code hook event read fro
|
|
|
13764
13941
|
}
|
|
13765
13942
|
});
|
|
13766
13943
|
traceCmd.command("flush").description("send what the spool holds, retrying with backoff").action(run2(async () => {
|
|
13767
|
-
const { readState, flush, grantSender } = await import("./trace-
|
|
13944
|
+
const { readState, flush, grantSender } = await import("./trace-PXIY5WUU.js");
|
|
13768
13945
|
const state = readState();
|
|
13769
13946
|
if (!state) throw new Error("no trace is running here");
|
|
13770
13947
|
const outcome = await flush(grantSender(state), { attempts: 4 });
|
|
13771
13948
|
console.log(`sent ${outcome.sent}, refused ${outcome.refused}, given up ${outcome.expired}, still pending ${outcome.pending}${outcome.stopped ? ` (stopped: ${outcome.stopped})` : ""}`);
|
|
13772
13949
|
}));
|
|
13773
13950
|
traceCmd.command("status").description("the running trace and its spool").action(run2(async () => {
|
|
13774
|
-
const { readState, spoolStatus } = await import("./trace-
|
|
13951
|
+
const { readState, spoolStatus } = await import("./trace-PXIY5WUU.js");
|
|
13775
13952
|
const state = readState();
|
|
13776
13953
|
if (!state) {
|
|
13777
13954
|
console.log("No trace is running here.");
|
|
@@ -13780,9 +13957,9 @@ traceCmd.command("status").description("the running trace and its spool").action
|
|
|
13780
13957
|
const spool = spoolStatus();
|
|
13781
13958
|
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`);
|
|
13782
13959
|
}));
|
|
13783
|
-
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 (
|
|
13784
|
-
const { readState } = await import("./trace-
|
|
13785
|
-
const ref =
|
|
13960
|
+
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-PXIY5WUU.js");
|
|
13962
|
+
const ref = id2 ?? readState()?.trace_id;
|
|
13786
13963
|
if (!ref) throw new Error("name a trace, or start one here");
|
|
13787
13964
|
const bundle = await api("GET", `/traces/${ref}`);
|
|
13788
13965
|
if (opts.json) {
|
|
@@ -13808,7 +13985,7 @@ traceCmd.command("show [id]").description("the trace bundle: spans, the sessions
|
|
|
13808
13985
|
for (const gap of bundle.gaps) console.log(` gap: ${gap.span_id} ${gap.reason}`);
|
|
13809
13986
|
}));
|
|
13810
13987
|
traceCmd.command("stop").description("end the root span, send what is left, and revoke this machine's grant").action(run2(async () => {
|
|
13811
|
-
const { readState, record: record3, flush, grantSender, clearState } = await import("./trace-
|
|
13988
|
+
const { readState, record: record3, flush, grantSender, clearState } = await import("./trace-PXIY5WUU.js");
|
|
13812
13989
|
const state = readState();
|
|
13813
13990
|
if (!state) throw new Error("no trace is running here");
|
|
13814
13991
|
if (state.root_span) record3(() => [{ span_id: state.root_span, kind: "end", outcome: "completed" }]);
|
|
@@ -13821,7 +13998,7 @@ var recordCmd = traceCmd.command("record").description("record every Claude Code
|
|
|
13821
13998
|
const { homedir: homedir11 } = await import("os");
|
|
13822
13999
|
const { join: join21 } = await import("path");
|
|
13823
14000
|
const vault2 = await import("./trace-vault-IUNYRVGZ.js");
|
|
13824
|
-
const { installClaudeHooks, uninstallClaudeHooks } = await import("./trace-
|
|
14001
|
+
const { installClaudeHooks, uninstallClaudeHooks } = await import("./trace-PXIY5WUU.js");
|
|
13825
14002
|
const command = "sky trace record hook";
|
|
13826
14003
|
const config = vault2.loadVaultConfig();
|
|
13827
14004
|
const settings = resolve12(opts.settings ?? config.settings ?? join21(process.env.CLAUDE_CONFIG_DIR ?? join21(homedir11(), ".claude"), "settings.json"));
|
|
@@ -13886,7 +14063,7 @@ recordCmd.command("seal <session-dir>").description("seal the cut segments of on
|
|
|
13886
14063
|
}
|
|
13887
14064
|
});
|
|
13888
14065
|
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) => {
|
|
13889
|
-
const lib = await import("./trace-library-
|
|
14066
|
+
const lib = await import("./trace-library-IUFJWBN3.js");
|
|
13890
14067
|
if (opts.hook) {
|
|
13891
14068
|
try {
|
|
13892
14069
|
let raw = payload ?? "";
|
|
@@ -13911,7 +14088,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13911
14088
|
return;
|
|
13912
14089
|
}
|
|
13913
14090
|
if (opts.exclude || opts.unexclude) {
|
|
13914
|
-
const { changeExclusions, macSettingsPath } = await import("./trace-exclusions-
|
|
14091
|
+
const { changeExclusions, macSettingsPath } = await import("./trace-exclusions-HG5MF7NI.js");
|
|
13915
14092
|
const { dirname: dirname13 } = await import("path");
|
|
13916
14093
|
const changed = changeExclusions(dirname13(lib.syncConfigPath()), { add: opts.exclude, remove: opts.unexclude });
|
|
13917
14094
|
console.log(changed.exclusions.folders.length ? "Sync never uploads sessions that ran in:" : "No folder is excluded.");
|
|
@@ -13968,11 +14145,11 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13968
14145
|
console.log(`Sweeping every 15 minutes (${plist}); a full re-read runs weekly. Log: ${log}`);
|
|
13969
14146
|
}
|
|
13970
14147
|
if (opts.status) {
|
|
13971
|
-
const { readFileSync:
|
|
14148
|
+
const { readFileSync: readFileSync28 } = await import("fs");
|
|
13972
14149
|
const { join: join21 } = await import("path");
|
|
13973
14150
|
let state = { sessions: {} };
|
|
13974
14151
|
try {
|
|
13975
|
-
state = JSON.parse(
|
|
14152
|
+
state = JSON.parse(readFileSync28(join21(lib.syncConfigPath(), "..", "trace-sync-state.json"), "utf8"));
|
|
13976
14153
|
} catch {
|
|
13977
14154
|
}
|
|
13978
14155
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -13982,7 +14159,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13982
14159
|
}
|
|
13983
14160
|
console.log(`Trace sync is ${config.enabled ? "on" : "off"}${config.enabledAt ? ` (since ${config.enabledAt})` : ""}. Last full sweep: ${state.lastFullAt ?? "never"}.`);
|
|
13984
14161
|
for (const [label, count] of [...counts].sort((a, b) => b[1] - a[1])) console.log(` ${count} ${label}`);
|
|
13985
|
-
const { loadExclusions } = await import("./trace-exclusions-
|
|
14162
|
+
const { loadExclusions } = await import("./trace-exclusions-HG5MF7NI.js");
|
|
13986
14163
|
for (const folder of loadExclusions(join21(lib.syncConfigPath(), "..")).folders) console.log(` excluded: ${folder}`);
|
|
13987
14164
|
return;
|
|
13988
14165
|
}
|
|
@@ -13999,7 +14176,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13999
14176
|
return;
|
|
14000
14177
|
}
|
|
14001
14178
|
if (!opts.dryRun) {
|
|
14002
|
-
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-
|
|
14179
|
+
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-Y47FCKEL.js");
|
|
14003
14180
|
try {
|
|
14004
14181
|
const skills2 = await refreshLocalSkills({ hook: Boolean(opts.session?.length) });
|
|
14005
14182
|
if (skills2 && !opts.quiet) for (const line2 of describeLocalSkills(skills2)) console.log(line2);
|
|
@@ -14014,7 +14191,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
14014
14191
|
for (const error of report.errors.slice(0, 20)) console.error(` ${error}`);
|
|
14015
14192
|
}
|
|
14016
14193
|
if (!opts.session && !opts.dryRun) {
|
|
14017
|
-
const { upkeepComputer } = await import("./compute-report-
|
|
14194
|
+
const { upkeepComputer } = await import("./compute-report-AAEKLNPM.js");
|
|
14018
14195
|
const said = await upkeepComputer().catch((error) => `AgentSky could not check this computer's setup: ${error instanceof Error ? error.message : String(error)}`);
|
|
14019
14196
|
if (said) console.log(said);
|
|
14020
14197
|
}
|
|
@@ -14023,7 +14200,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
14023
14200
|
});
|
|
14024
14201
|
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) => {
|
|
14025
14202
|
if (opts.on && opts.off) throw new Error("choose --on or --off");
|
|
14026
|
-
const { libraryRequest } = await import("./trace-library-
|
|
14203
|
+
const { libraryRequest } = await import("./trace-library-IUFJWBN3.js");
|
|
14027
14204
|
const workspace2 = opts.workspace ?? currentUniverse();
|
|
14028
14205
|
if (!workspace2) throw new Error("name a workspace with --workspace");
|
|
14029
14206
|
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);
|
|
@@ -14040,7 +14217,7 @@ traceCmd.command("search <query...>").description("search every session in a wor
|
|
|
14040
14217
|
console.log(opts.json ? JSON.stringify(page, null, 2) : renderContextPage(page));
|
|
14041
14218
|
}));
|
|
14042
14219
|
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) => {
|
|
14043
|
-
const { libraryRequest } = await import("./trace-library-
|
|
14220
|
+
const { libraryRequest } = await import("./trace-library-IUFJWBN3.js");
|
|
14044
14221
|
const workspace2 = opts.workspace ?? currentUniverse();
|
|
14045
14222
|
if (!workspace2) throw new Error("name a workspace with --workspace");
|
|
14046
14223
|
const page = await libraryRequest("GET", `/trace-library?limit=${opts.limit}`, workspace2);
|
|
@@ -14108,8 +14285,8 @@ compare.command("list").description("your workspace comparisons, most recently u
|
|
|
14108
14285
|
})
|
|
14109
14286
|
);
|
|
14110
14287
|
compare.command("show <id>").description("one comparison: request, agents, status, and the vote verdict").option("--json", "print as JSON").action(
|
|
14111
|
-
run2(async (
|
|
14112
|
-
const detail = await getComparison(
|
|
14288
|
+
run2(async (id2, opts) => {
|
|
14289
|
+
const detail = await getComparison(id2);
|
|
14113
14290
|
if (opts.json) {
|
|
14114
14291
|
console.log(JSON.stringify(detail, null, 2));
|
|
14115
14292
|
return;
|
|
@@ -14128,11 +14305,11 @@ compare.command("show <id>").description("one comparison: request, agents, statu
|
|
|
14128
14305
|
})
|
|
14129
14306
|
);
|
|
14130
14307
|
compare.command("pick <id>").description('record the winning column \u2014 or a tie or "both_bad" \u2014 for this comparison').option("--winner <columnId>", "the columnId of the winning column").option("--tie", "record a tie instead of a winner").option("--both-bad", "record that neither agent did the job").option("--json", "print the verdict as JSON").action(
|
|
14131
|
-
run2(async (
|
|
14308
|
+
run2(async (id2, opts) => {
|
|
14132
14309
|
const choices = [opts.winner, opts.tie, opts.bothBad].filter(Boolean).length;
|
|
14133
14310
|
if (choices !== 1) throw new ApiError(400, "invalid_request", "Provide exactly one of --winner, --tie or --both-bad.");
|
|
14134
14311
|
const outcome = opts.tie ? "tie" : opts.bothBad ? "both_bad" : void 0;
|
|
14135
|
-
const result = await pickWinner(
|
|
14312
|
+
const result = await pickWinner(id2, { winnerColumnId: opts.winner, outcome });
|
|
14136
14313
|
if (opts.json) {
|
|
14137
14314
|
console.log(JSON.stringify(result, null, 2));
|
|
14138
14315
|
return;
|
|
@@ -14206,8 +14383,8 @@ thread.command("start <text>").description("start a thread and send it its first
|
|
|
14206
14383
|
})
|
|
14207
14384
|
);
|
|
14208
14385
|
thread.command("show <id>").description("one thread with every agent and the session each one runs in").option("--json", "print as JSON").action(
|
|
14209
|
-
run2(async (
|
|
14210
|
-
const detail = await getThread(
|
|
14386
|
+
run2(async (id2, opts) => {
|
|
14387
|
+
const detail = await getThread(id2);
|
|
14211
14388
|
if (opts.json) {
|
|
14212
14389
|
console.log(JSON.stringify(detail, null, 2));
|
|
14213
14390
|
return;
|
|
@@ -14216,9 +14393,9 @@ thread.command("show <id>").description("one thread with every agent and the ses
|
|
|
14216
14393
|
for (const col of detail.columns) console.log(` agent ${col.id} session ${col.sessionId} ${col.blind ? "(hidden until the vote)" : `${col.agentType}/${col.llm}`} ${col.status ?? col.podStatus ?? ""}`);
|
|
14217
14394
|
})
|
|
14218
14395
|
);
|
|
14219
|
-
thread.command("rename <id> <title>").description("rename a thread").action(run2(async (
|
|
14220
|
-
await organizeThread(
|
|
14221
|
-
console.log(`renamed ${
|
|
14396
|
+
thread.command("rename <id> <title>").description("rename a thread").action(run2(async (id2, title) => {
|
|
14397
|
+
await organizeThread(id2, { title });
|
|
14398
|
+
console.log(`renamed ${id2}`);
|
|
14222
14399
|
}));
|
|
14223
14400
|
for (const [verb, change, description] of [
|
|
14224
14401
|
["pin", { pinned: true }, "pin a thread to the top of the rail"],
|
|
@@ -14228,18 +14405,18 @@ for (const [verb, change, description] of [
|
|
|
14228
14405
|
["mark-read", { seen: true }, "mark a thread read"],
|
|
14229
14406
|
["mark-unread", { seen: false }, "mark a thread unread"]
|
|
14230
14407
|
]) {
|
|
14231
|
-
thread.command(`${verb} <id>`).description(description).action(run2(async (
|
|
14232
|
-
await organizeThread(
|
|
14233
|
-
console.log(`${verb}: ${
|
|
14408
|
+
thread.command(`${verb} <id>`).description(description).action(run2(async (id2) => {
|
|
14409
|
+
await organizeThread(id2, change);
|
|
14410
|
+
console.log(`${verb}: ${id2}`);
|
|
14234
14411
|
}));
|
|
14235
14412
|
}
|
|
14236
|
-
thread.command("delete <id>").description("delete a thread with its sessions").action(run2(async (
|
|
14237
|
-
await deleteThread(
|
|
14238
|
-
console.log(`deleted ${
|
|
14413
|
+
thread.command("delete <id>").description("delete a thread with its sessions").action(run2(async (id2) => {
|
|
14414
|
+
await deleteThread(id2);
|
|
14415
|
+
console.log(`deleted ${id2}`);
|
|
14239
14416
|
}));
|
|
14240
14417
|
thread.command("send <id> <text>").description("send one message to every agent of the thread, or to the ones --agent names").option("--agent <columnId...>", "only these agents (column ids from `sky thread show`)").option("--json", "print each agent's outcome as JSON").action(
|
|
14241
|
-
run2(async (
|
|
14242
|
-
const { results } = await sendThreadMessage(
|
|
14418
|
+
run2(async (id2, text2, opts) => {
|
|
14419
|
+
const { results } = await sendThreadMessage(id2, { text: text2, deliveryId: crypto.randomUUID(), ...opts.agent?.length ? { columnIds: opts.agent } : {} });
|
|
14243
14420
|
if (opts.json) {
|
|
14244
14421
|
console.log(JSON.stringify(results, null, 2));
|
|
14245
14422
|
return;
|
|
@@ -14248,23 +14425,23 @@ thread.command("send <id> <text>").description("send one message to every agent
|
|
|
14248
14425
|
})
|
|
14249
14426
|
);
|
|
14250
14427
|
thread.command("add-agent <id>").description("add an agent to the thread, in a session of its own").requiredOption("--agent <type>", "the agent's harness type").option("--llm <model>", "the model").option("--effort <level>", "thinking level").action(
|
|
14251
|
-
run2(async (
|
|
14252
|
-
const { columns } = await addThreadAgent(
|
|
14428
|
+
run2(async (id2, opts) => {
|
|
14429
|
+
const { columns } = await addThreadAgent(id2, { requestId: `sky-agent-${crypto.randomUUID()}`, agentType: opts.agent, ...opts.llm ? { llm: opts.llm } : {}, ...opts.effort ? { reasoningEffort: opts.effort } : {} });
|
|
14253
14430
|
for (const col of columns) console.log(`added agent ${col.columnId} session ${col.sessionId}`);
|
|
14254
14431
|
})
|
|
14255
14432
|
);
|
|
14256
|
-
thread.command("remove-agent <id> <columnId>").description("take one agent out of the thread; its session is left as it is").action(run2(async (
|
|
14257
|
-
await removeThreadAgent(
|
|
14433
|
+
thread.command("remove-agent <id> <columnId>").description("take one agent out of the thread; its session is left as it is").action(run2(async (id2, columnId) => {
|
|
14434
|
+
await removeThreadAgent(id2, columnId);
|
|
14258
14435
|
console.log(`removed ${columnId}`);
|
|
14259
14436
|
}));
|
|
14260
|
-
thread.command("stop <id>").description("stop what the thread's agents are doing").option("--agent <columnId>", "stop only this agent").action(run2(async (
|
|
14261
|
-
await interruptThread(
|
|
14262
|
-
console.log(`stopped ${
|
|
14437
|
+
thread.command("stop <id>").description("stop what the thread's agents are doing").option("--agent <columnId>", "stop only this agent").action(run2(async (id2, opts) => {
|
|
14438
|
+
await interruptThread(id2, opts.agent);
|
|
14439
|
+
console.log(`stopped ${id2}`);
|
|
14263
14440
|
}));
|
|
14264
14441
|
thread.command("fork <id>").description("continue one agent's conversation in a thread of its own").option("--agent <columnId>", "the agent to fork (the first when omitted)").option("--at <messageId>", "carry the conversation only up to this message").option("--to <type:model>", "continue on another agent or model").action(
|
|
14265
|
-
run2(async (
|
|
14442
|
+
run2(async (id2, opts) => {
|
|
14266
14443
|
const [agentType, llm] = (opts.to ?? "").split(":");
|
|
14267
|
-
const { playgroundId } = await forkThread(
|
|
14444
|
+
const { playgroundId } = await forkThread(id2, {
|
|
14268
14445
|
requestId: `sky-fork-${crypto.randomUUID()}`,
|
|
14269
14446
|
...opts.agent ? { columnId: opts.agent } : {},
|
|
14270
14447
|
...opts.at ? { messageId: opts.at } : {},
|
|
@@ -14274,9 +14451,9 @@ thread.command("fork <id>").description("continue one agent's conversation in a
|
|
|
14274
14451
|
})
|
|
14275
14452
|
);
|
|
14276
14453
|
thread.command("model <id>").description("change the model or thinking level one agent of the thread runs on, from its next turn").option("--agent <columnId>", "the agent (the first when omitted)").option("--llm <model>", "the new model").option("--effort <level>", 'the new thinking level, or "default"').action(
|
|
14277
|
-
run2(async (
|
|
14454
|
+
run2(async (id2, opts) => {
|
|
14278
14455
|
if (!opts.llm && !opts.effort) throw new ApiError(400, "invalid_request", "Provide --llm or --effort.");
|
|
14279
|
-
const result = await changeThreadModel(
|
|
14456
|
+
const result = await changeThreadModel(id2, { ...opts.llm ? { llm: opts.llm } : {}, ...opts.effort ? { reasoningEffort: opts.effort === "default" ? null : opts.effort } : {} }, opts.agent);
|
|
14280
14457
|
console.log(`now ${result.llm}${result.reasoningEffort ? ` (${result.reasoningEffort})` : ""}`);
|
|
14281
14458
|
})
|
|
14282
14459
|
);
|
|
@@ -14314,10 +14491,10 @@ project.command("use [repo]").description("remember a repository (owner/name) fo
|
|
|
14314
14491
|
})
|
|
14315
14492
|
);
|
|
14316
14493
|
session.command("feedback <id>").description("read the thumbs-up/down feedback on this session's messages").option("--json", "print as JSON").action(
|
|
14317
|
-
run2(async (
|
|
14494
|
+
run2(async (id2, opts) => {
|
|
14318
14495
|
const result = await api(
|
|
14319
14496
|
"GET",
|
|
14320
|
-
`/sessions/${encodeURIComponent(
|
|
14497
|
+
`/sessions/${encodeURIComponent(id2)}/feedback`
|
|
14321
14498
|
);
|
|
14322
14499
|
if (opts.json) {
|
|
14323
14500
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -14332,8 +14509,8 @@ session.command("feedback <id>").description("read the thumbs-up/down feedback o
|
|
|
14332
14509
|
})
|
|
14333
14510
|
);
|
|
14334
14511
|
session.command("side-chat <id>").description("ask a question about this session's transcript (answered beside it, never sent to the agent)").requiredOption("--question <text>", "the question to ask").requiredOption("--transcript <text>", "the session transcript or relevant excerpt").option("--quote <text>", "a specific passage the question targets").option("--json", "print as JSON").action(
|
|
14335
|
-
run2(async (
|
|
14336
|
-
const result = await api("POST", `/sessions/${encodeURIComponent(
|
|
14512
|
+
run2(async (id2, opts) => {
|
|
14513
|
+
const result = await api("POST", `/sessions/${encodeURIComponent(id2)}/side-chat`, {
|
|
14337
14514
|
transcript: opts.transcript,
|
|
14338
14515
|
history: [],
|
|
14339
14516
|
question: opts.question,
|
|
@@ -14349,10 +14526,10 @@ session.command("side-chat <id>").description("ask a question about this session
|
|
|
14349
14526
|
})
|
|
14350
14527
|
);
|
|
14351
14528
|
session.command("code-review <id>").description("run the code-review assistant on this session's diff or file").requiredOption("--diff <text>", "the diff or file content to review").option("--filename <name>", "the filename for language-aware review").option("--json", "print as JSON").action(
|
|
14352
|
-
run2(async (
|
|
14529
|
+
run2(async (id2, opts) => {
|
|
14353
14530
|
const result = await api(
|
|
14354
14531
|
"POST",
|
|
14355
|
-
`/sessions/${encodeURIComponent(
|
|
14532
|
+
`/sessions/${encodeURIComponent(id2)}/code-review`,
|
|
14356
14533
|
{ diff: opts.diff, ...opts.filename ? { filename: opts.filename } : {} }
|
|
14357
14534
|
);
|
|
14358
14535
|
if (opts.json) {
|
|
@@ -14370,8 +14547,8 @@ session.command("code-review <id>").description("run the code-review assistant o
|
|
|
14370
14547
|
})
|
|
14371
14548
|
);
|
|
14372
14549
|
session.command("snapshot <id>").usage("<id> --thread <threadId> [--revoke] [--json]").description("read or revoke the public share link for a session; --thread is required").requiredOption("--thread <threadId>", "(required) the thread/comparison that owns this session").option("--revoke", "revoke the snapshot link instead of reading it").option("--json", "print as JSON").action(
|
|
14373
|
-
run2(async (
|
|
14374
|
-
const path2 = `/sessions/${encodeURIComponent(
|
|
14550
|
+
run2(async (id2, opts) => {
|
|
14551
|
+
const path2 = `/sessions/${encodeURIComponent(id2)}/snapshot?thread=${encodeURIComponent(opts.thread)}`;
|
|
14375
14552
|
const result = await api(opts.revoke ? "DELETE" : "GET", path2);
|
|
14376
14553
|
if (opts.json) {
|
|
14377
14554
|
console.log(JSON.stringify(result, null, 2));
|