@agentsky/sky 3.44.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-CXRMG3HQ.js → chunk-2OIW436E.js} +1 -1
- package/dist/{chunk-BCSZO4BR.js → chunk-6LQLH5CI.js} +47 -17
- package/dist/{mcp-serve-EJ7YKBMM.js → chunk-AKCKFNLJ.js} +18 -5
- package/dist/{chunk-HGLVOMHL.js → chunk-I63VASQP.js} +43 -13
- package/dist/{chunk-KTSUD2BU.js → chunk-IJOMMFEK.js} +5 -5
- package/dist/{chunk-EBCVJDIL.js → chunk-IZT53CAI.js} +15 -4
- package/dist/{chunk-BIZJ4VZL.js → chunk-KX6JJECK.js} +188 -58
- package/dist/{chunk-W2WEEVIM.js → chunk-LM3WPNRW.js} +1 -1
- package/dist/{chunk-F6V2GGMP.js → chunk-OXCZMLEZ.js} +10 -5
- package/dist/{chunk-ZVNQJPMS.js → chunk-QTMW37EN.js} +2 -2
- package/dist/{chunk-3FQZZNQP.js → chunk-U25SCHLE.js} +75 -23
- package/dist/{chunk-UJ7IXSJX.js → chunk-YYI5NQ35.js} +1 -1
- package/dist/{compute-KNUZU4AO.js → compute-VNGFIQCD.js} +2 -2
- package/dist/compute-report-AAEKLNPM.js +39 -0
- package/dist/index.js +1009 -772
- package/dist/{local-skills-HHTAWGYV.js → local-skills-RRJCNVLS.js} +3 -3
- package/dist/{local-skills-run-OYPW36ZG.js → local-skills-run-Y47FCKEL.js} +8 -8
- package/dist/mcp-serve-OLHMHG4M.js +16 -0
- package/dist/{trace-754MK5OE.js → trace-PXIY5WUU.js} +3 -3
- package/dist/{trace-exclusions-MYECULMA.js → trace-exclusions-HG5MF7NI.js} +2 -2
- package/dist/{trace-library-WE3C5OBP.js → trace-library-IUFJWBN3.js} +14 -8
- package/package.json +1 -1
- package/dist/compute-report-AT642XES.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-3FQZZNQP.js";
|
|
33
|
-
import "./chunk-KTSUD2BU.js";
|
|
34
|
-
import "./chunk-UJ7IXSJX.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-BIZJ4VZL.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";
|
|
46
|
+
import {
|
|
47
|
+
shortToolCount
|
|
48
|
+
} from "./chunk-AKCKFNLJ.js";
|
|
85
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,15 +4629,26 @@ 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
|
}
|
|
4641
|
+
function driverLine(goal2) {
|
|
4642
|
+
if (goal2.driver) return `driven by: ${goal2.driver.name ?? goal2.driver.id} (${goal2.driver.kind}), stated ${goal2.driver.stated_at}`;
|
|
4643
|
+
return "driven by: nobody is named";
|
|
4644
|
+
}
|
|
4616
4645
|
function renderGoal(goal2) {
|
|
4617
4646
|
if (!goal2) return 'No goal. Set one: sky goal set <session> "<objective>"';
|
|
4618
4647
|
const lines2 = [];
|
|
4619
4648
|
const state = goal2.status === "stopped" && goal2.stop_reason ? `stopped (${goal2.stop_reason})` : goal2.status;
|
|
4620
4649
|
lines2.push(`${goal2.id} ${state} iteration ${goal2.iteration}/${goal2.max_iterations}`);
|
|
4621
4650
|
lines2.push(`objective: ${goal2.objective}`);
|
|
4651
|
+
if (goal2.driver !== void 0) lines2.push(driverLine(goal2));
|
|
4622
4652
|
const spend = goal2.max_spend ? `${dollars2(goal2.consumed_spend.amount)} of ${dollars2(goal2.max_spend.amount)}` : dollars2(goal2.consumed_spend.amount);
|
|
4623
4653
|
const tokens = goal2.max_tokens === null ? `${goal2.consumed_tokens}` : `${goal2.consumed_tokens} of ${goal2.max_tokens}`;
|
|
4624
4654
|
lines2.push(`spent: ${spend} tokens: ${tokens}${goal2.deadline_at ? ` deadline: ${goal2.deadline_at}` : ""}`);
|
|
@@ -4629,6 +4659,9 @@ function renderGoal(goal2) {
|
|
|
4629
4659
|
const mark = verdict ? verdict.met ? "[x]" : "[ ]" : "[?]";
|
|
4630
4660
|
lines2.push(` ${mark} ${criterion.id} ${criterion.text}`);
|
|
4631
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}`);
|
|
4632
4665
|
if (verdict && !verdict.met && verdict.reason) lines2.push(` ${verdict.reason}`);
|
|
4633
4666
|
}
|
|
4634
4667
|
if (goal2.last_evaluation && goal2.last_evaluation.result !== "satisfied") {
|
|
@@ -4860,12 +4893,12 @@ function renderContextPage(page) {
|
|
|
4860
4893
|
}
|
|
4861
4894
|
|
|
4862
4895
|
// src/agent-manifest-file.ts
|
|
4863
|
-
import { readFileSync as
|
|
4896
|
+
import { readFileSync as readFileSync17, writeFileSync as writeFileSync7 } from "fs";
|
|
4864
4897
|
import { dirname as dirname9, resolve as resolve7 } from "path";
|
|
4865
4898
|
import { parse as parseToml3, stringify as stringifyToml } from "smol-toml";
|
|
4866
4899
|
|
|
4867
4900
|
// src/agent-file.ts
|
|
4868
|
-
import { existsSync as existsSync10, readFileSync as
|
|
4901
|
+
import { existsSync as existsSync10, readFileSync as readFileSync16, writeFileSync as writeFileSync6 } from "fs";
|
|
4869
4902
|
import { dirname as dirname8, resolve as resolve6 } from "path";
|
|
4870
4903
|
import { parse as parseToml2 } from "smol-toml";
|
|
4871
4904
|
var fileInstructionSchema = external_exports.strictObject({
|
|
@@ -4899,7 +4932,7 @@ var agentFileSchema = external_exports.strictObject({
|
|
|
4899
4932
|
memory_mb: external_exports.number().int().optional()
|
|
4900
4933
|
});
|
|
4901
4934
|
function readAgentFile(path2) {
|
|
4902
|
-
const raw =
|
|
4935
|
+
const raw = readFileSync16(path2, "utf8");
|
|
4903
4936
|
const parsed = agentFileSchema.safeParse(parseToml2(raw));
|
|
4904
4937
|
if (!parsed.success) {
|
|
4905
4938
|
const issue = parsed.error.issues[0];
|
|
@@ -4919,7 +4952,7 @@ function readAgentFile(path2) {
|
|
|
4919
4952
|
const inline = (ref, inlineContent) => {
|
|
4920
4953
|
if (inlineContent !== void 0) return inlineContent;
|
|
4921
4954
|
if (!ref) return void 0;
|
|
4922
|
-
return
|
|
4955
|
+
return readFileSync16(resolve6(base, ref), "utf8");
|
|
4923
4956
|
};
|
|
4924
4957
|
const spec = {
|
|
4925
4958
|
name: file.name,
|
|
@@ -4944,10 +4977,10 @@ function readAgentFile(path2) {
|
|
|
4944
4977
|
};
|
|
4945
4978
|
return { file, spec };
|
|
4946
4979
|
}
|
|
4947
|
-
function stampId(path2,
|
|
4948
|
-
writeFileSync6(path2, stampIdText(
|
|
4980
|
+
function stampId(path2, id2) {
|
|
4981
|
+
writeFileSync6(path2, stampIdText(readFileSync16(path2, "utf8"), id2));
|
|
4949
4982
|
}
|
|
4950
|
-
function stampIdText(text2,
|
|
4983
|
+
function stampIdText(text2, id2) {
|
|
4951
4984
|
const out = [];
|
|
4952
4985
|
let topLevel = true;
|
|
4953
4986
|
let openString = null;
|
|
@@ -4962,7 +4995,7 @@ function stampIdText(text2, id3) {
|
|
|
4962
4995
|
if (/^\s*\[/.test(line2)) topLevel = false;
|
|
4963
4996
|
if (topLevel && /^\s*(id|slug)\s*=/.test(line2)) {
|
|
4964
4997
|
if (/^\s*id\s*=/.test(line2) && !stamped) {
|
|
4965
|
-
out.push(`id = ${JSON.stringify(
|
|
4998
|
+
out.push(`id = ${JSON.stringify(id2)}`);
|
|
4966
4999
|
stamped = true;
|
|
4967
5000
|
}
|
|
4968
5001
|
continue;
|
|
@@ -4972,9 +5005,9 @@ function stampIdText(text2, id3) {
|
|
|
4972
5005
|
if (opener && !line2.slice(opener.index + opener[0].length).includes(opener[1])) openString = opener[1];
|
|
4973
5006
|
out.push(line2);
|
|
4974
5007
|
}
|
|
4975
|
-
if (!stamped) out.splice(nameAt + 1, 0, `id = ${JSON.stringify(
|
|
5008
|
+
if (!stamped) out.splice(nameAt + 1, 0, `id = ${JSON.stringify(id2)}`);
|
|
4976
5009
|
const next = out.join("\n");
|
|
4977
|
-
if (parseToml2(next).id !==
|
|
5010
|
+
if (parseToml2(next).id !== id2) throw new Error("could not stamp the agent id into the file");
|
|
4978
5011
|
return next;
|
|
4979
5012
|
}
|
|
4980
5013
|
function scaffoldAgentFile(path2, name) {
|
|
@@ -4994,7 +5027,11 @@ name = "${name}"
|
|
|
4994
5027
|
# skillId = "skill_..."
|
|
4995
5028
|
|
|
4996
5029
|
prompt = """
|
|
4997
|
-
You are ${name}
|
|
5030
|
+
You are ${name}. Your first sentence is the one job you do.
|
|
5031
|
+
|
|
5032
|
+
You do not take a second job, narrate your progress, or message anyone when there is nothing to report.
|
|
5033
|
+
|
|
5034
|
+
How: do the work, then say the result, a blocker only the person can clear, or that a commitment was missed. Otherwise stay quiet.
|
|
4998
5035
|
"""
|
|
4999
5036
|
`
|
|
5000
5037
|
);
|
|
@@ -5028,23 +5065,23 @@ function deployPatch(spec) {
|
|
|
5028
5065
|
...spec.environmentId ? { environmentId: spec.environmentId } : {}
|
|
5029
5066
|
};
|
|
5030
5067
|
}
|
|
5031
|
-
function deployReport(
|
|
5068
|
+
function deployReport(id2, spec, before, after, promptChanged) {
|
|
5032
5069
|
if (spec.agentType && after.agentType !== spec.agentType) {
|
|
5033
|
-
throw new Error(`${
|
|
5070
|
+
throw new Error(`${id2} is still ${after.agentType}: the API did not apply type = "${spec.agentType}"`);
|
|
5034
5071
|
}
|
|
5035
5072
|
if (spec.llm && after.llm !== spec.llm) {
|
|
5036
|
-
throw new Error(`${
|
|
5073
|
+
throw new Error(`${id2} still runs ${after.llm}: the API did not apply llm = "${spec.llm}"`);
|
|
5037
5074
|
}
|
|
5038
5075
|
const changed = [];
|
|
5039
5076
|
if (promptChanged) changed.push("prompt");
|
|
5040
5077
|
if (after.version !== before.version) changed.push("settings");
|
|
5041
|
-
if (!changed.length) return [`${
|
|
5042
|
-
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})`];
|
|
5043
5080
|
if (after.agentType !== before.agentType || after.llm !== before.llm) {
|
|
5044
5081
|
lines2.push(` now ${after.agentType} \xB7 ${after.llm} for new sessions (was ${before.agentType} \xB7 ${before.llm})`);
|
|
5045
5082
|
}
|
|
5046
5083
|
if (spec.skills && after.version !== before.version) {
|
|
5047
|
-
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}\`.`);
|
|
5048
5085
|
}
|
|
5049
5086
|
return lines2;
|
|
5050
5087
|
}
|
|
@@ -5052,35 +5089,35 @@ function deployReport(id3, spec, before, after, promptChanged) {
|
|
|
5052
5089
|
// src/agent-manifest-file.ts
|
|
5053
5090
|
var MANIFEST_API_VERSION = "agentsky/v1";
|
|
5054
5091
|
function readManifestFile(path2) {
|
|
5055
|
-
return manifestFromText(
|
|
5092
|
+
return manifestFromText(readFileSync17(path2, "utf8"), dirname9(resolve7(path2)), path2);
|
|
5056
5093
|
}
|
|
5057
5094
|
function manifestFromText(text2, base, label = "agent.toml") {
|
|
5058
|
-
const { id:
|
|
5095
|
+
const { id: id2, prompt_file: promptFile, ...manifest } = parseToml3(text2);
|
|
5059
5096
|
if (manifest.apiVersion !== MANIFEST_API_VERSION) {
|
|
5060
5097
|
throw new Error(`${label}: apiVersion = "${MANIFEST_API_VERSION}" is required for sky agent apply (sky deploy reads files without it)`);
|
|
5061
5098
|
}
|
|
5062
5099
|
if (typeof promptFile === "string") {
|
|
5063
5100
|
if (manifest.prompt !== void 0) throw new Error(`${label}: set prompt or prompt_file, not both`);
|
|
5064
|
-
manifest.prompt =
|
|
5101
|
+
manifest.prompt = readFileSync17(resolve7(base, promptFile), "utf8");
|
|
5065
5102
|
}
|
|
5066
5103
|
if (Array.isArray(manifest.instructions)) {
|
|
5067
5104
|
manifest.instructions = manifest.instructions.map((entry) => {
|
|
5068
5105
|
const { file, ...rest } = entry;
|
|
5069
5106
|
if (typeof file !== "string") return rest;
|
|
5070
5107
|
if (rest.content !== void 0) throw new Error(`${label}: instruction ${String(rest.name)} sets content and file`);
|
|
5071
|
-
return { ...rest, content:
|
|
5108
|
+
return { ...rest, content: readFileSync17(resolve7(base, file), "utf8") };
|
|
5072
5109
|
});
|
|
5073
5110
|
}
|
|
5074
|
-
return { id: typeof
|
|
5111
|
+
return { id: typeof id2 === "string" && id2 ? id2 : null, manifest };
|
|
5075
5112
|
}
|
|
5076
|
-
function manifestToToml(
|
|
5113
|
+
function manifestToToml(id2, manifest) {
|
|
5077
5114
|
const { apiVersion, name, ...rest } = manifest;
|
|
5078
5115
|
return `# Apply changes with \`sky agent apply -f <this file>\`. A key left out goes back to its default.
|
|
5079
|
-
${stringifyToml({ apiVersion, name, id:
|
|
5116
|
+
${stringifyToml({ apiVersion, name, id: id2, ...rest })}
|
|
5080
5117
|
`;
|
|
5081
5118
|
}
|
|
5082
|
-
function stampManifestId(path2,
|
|
5083
|
-
writeFileSync7(path2, stampIdText(
|
|
5119
|
+
function stampManifestId(path2, id2) {
|
|
5120
|
+
writeFileSync7(path2, stampIdText(readFileSync17(path2, "utf8"), id2));
|
|
5084
5121
|
}
|
|
5085
5122
|
function lineOfField(text2, field) {
|
|
5086
5123
|
const lines2 = text2.split("\n");
|
|
@@ -5115,10 +5152,10 @@ function refusalLines(label, text2, issues) {
|
|
|
5115
5152
|
return `${label}${line2 ? `:${line2}` : ""}: ${issue.field}: ${issue.message}`;
|
|
5116
5153
|
});
|
|
5117
5154
|
}
|
|
5118
|
-
function applyReport(
|
|
5119
|
-
if (created) return [`Created ${
|
|
5120
|
-
if (changes.length === 0) return [`${
|
|
5121
|
-
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):`;
|
|
5122
5159
|
return [head, ...changes.map((change) => ` ${change.field}: ${short(change.before)} \u2192 ${short(change.after)}`)];
|
|
5123
5160
|
}
|
|
5124
5161
|
function short(value) {
|
|
@@ -5127,7 +5164,7 @@ function short(value) {
|
|
|
5127
5164
|
}
|
|
5128
5165
|
|
|
5129
5166
|
// src/catalog.ts
|
|
5130
|
-
var
|
|
5167
|
+
var bare = (handle) => handle.replace(/^@/, "");
|
|
5131
5168
|
var optionalAuth = () => ({ auth: Boolean(apiToken()) });
|
|
5132
5169
|
function catalogQuery(filter) {
|
|
5133
5170
|
const params = new URLSearchParams();
|
|
@@ -5139,7 +5176,7 @@ function catalogQuery(filter) {
|
|
|
5139
5176
|
function listingBody(agentId, options) {
|
|
5140
5177
|
return {
|
|
5141
5178
|
agent_id: agentId,
|
|
5142
|
-
handle:
|
|
5179
|
+
handle: bare(options.handle),
|
|
5143
5180
|
tagline: options.tagline,
|
|
5144
5181
|
...options.description ? { description: options.description } : {},
|
|
5145
5182
|
...options.category?.length ? { categories: options.category } : {},
|
|
@@ -5152,7 +5189,7 @@ async function listCatalog(filter = {}) {
|
|
|
5152
5189
|
return (await api("GET", `/catalog/agents${catalogQuery(filter)}`, void 0, optionalAuth())).agents;
|
|
5153
5190
|
}
|
|
5154
5191
|
async function showCatalogAgent(handle) {
|
|
5155
|
-
return (await api("GET", `/catalog/agents/${encodeURIComponent(
|
|
5192
|
+
return (await api("GET", `/catalog/agents/${encodeURIComponent(bare(handle))}`, void 0, optionalAuth())).agent;
|
|
5156
5193
|
}
|
|
5157
5194
|
async function listCategories() {
|
|
5158
5195
|
return (await api("GET", "/catalog/categories", void 0, { auth: false })).categories;
|
|
@@ -5161,7 +5198,7 @@ async function publishListing(agentId, options) {
|
|
|
5161
5198
|
return (await api("POST", "/catalog/listings", listingBody(agentId, options))).agent;
|
|
5162
5199
|
}
|
|
5163
5200
|
async function removeListing(handle) {
|
|
5164
|
-
await api("DELETE", `/catalog/listings/${encodeURIComponent(
|
|
5201
|
+
await api("DELETE", `/catalog/listings/${encodeURIComponent(bare(handle))}`);
|
|
5165
5202
|
}
|
|
5166
5203
|
async function setEngineStatus(engine, status, reason) {
|
|
5167
5204
|
await api("PATCH", `/catalog/engines/${encodeURIComponent(engine)}`, { status, reason });
|
|
@@ -5191,7 +5228,7 @@ function renderCatalogAgent(agent2) {
|
|
|
5191
5228
|
|
|
5192
5229
|
// src/clone.ts
|
|
5193
5230
|
import { spawn as spawn4 } from "child_process";
|
|
5194
|
-
import { existsSync as existsSync11, readFileSync as
|
|
5231
|
+
import { existsSync as existsSync11, readFileSync as readFileSync18, writeFileSync as writeFileSync8 } from "fs";
|
|
5195
5232
|
import { homedir as homedir9 } from "os";
|
|
5196
5233
|
import { basename as basename5, join as join15 } from "path";
|
|
5197
5234
|
import { createInterface as createInterface3 } from "readline";
|
|
@@ -5202,7 +5239,7 @@ function claudeConfigRoot() {
|
|
|
5202
5239
|
}
|
|
5203
5240
|
function readIfExists(path2) {
|
|
5204
5241
|
try {
|
|
5205
|
-
return
|
|
5242
|
+
return readFileSync18(path2, "utf8");
|
|
5206
5243
|
} catch {
|
|
5207
5244
|
return void 0;
|
|
5208
5245
|
}
|
|
@@ -5588,11 +5625,11 @@ async function connect(platform, opts) {
|
|
|
5588
5625
|
...opts.session || opts.webhook ? { destination: destination(opts) } : {}
|
|
5589
5626
|
});
|
|
5590
5627
|
}
|
|
5591
|
-
async function waitConnected(
|
|
5628
|
+
async function waitConnected(id2, opts = {}) {
|
|
5592
5629
|
const deadline = Date.now() + (opts.timeoutMs ?? 10 * 6e4);
|
|
5593
5630
|
for (; ; ) {
|
|
5594
|
-
const found = (await listConnections()).find((c) => c.id ===
|
|
5595
|
-
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`);
|
|
5596
5633
|
if (found.status !== "PENDING") return found;
|
|
5597
5634
|
if (Date.now() > deadline) throw new ApiError(408, "connect_timeout", "the connection was not claimed within 10 minutes");
|
|
5598
5635
|
await new Promise((r) => setTimeout(r, opts.pollMs ?? 3e3));
|
|
@@ -5725,7 +5762,7 @@ async function appOfSharedConnection(connectionId, workspace2) {
|
|
|
5725
5762
|
}
|
|
5726
5763
|
|
|
5727
5764
|
// src/routine-triggers.ts
|
|
5728
|
-
var triggerPath = (
|
|
5765
|
+
var triggerPath = (id2, resource) => `/routines/${encodeURIComponent(id2)}/${resource}`;
|
|
5729
5766
|
function inboundLine(u) {
|
|
5730
5767
|
if (!u) return "no inbound URL \u2014 make one with --create";
|
|
5731
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"}`;
|
|
@@ -5752,8 +5789,8 @@ function deliverBody(opts) {
|
|
|
5752
5789
|
if (!opts.connection) throw new ApiError(400, "invalid_request", "--connection is required (see `sky channel list`)");
|
|
5753
5790
|
return { type: "channel_thread", connection_id: opts.connection, ...opts.thread ? { thread_id: opts.thread } : {} };
|
|
5754
5791
|
}
|
|
5755
|
-
async function triggerRequest(
|
|
5756
|
-
const path2 = triggerPath(
|
|
5792
|
+
async function triggerRequest(id2, resource, change) {
|
|
5793
|
+
const path2 = triggerPath(id2, resource);
|
|
5757
5794
|
if (change.remove) return api("DELETE", path2);
|
|
5758
5795
|
if (change.create) return api("POST", path2);
|
|
5759
5796
|
if (change.body) return api("PUT", path2, change.body);
|
|
@@ -5763,7 +5800,7 @@ async function triggerRequest(id3, resource, change) {
|
|
|
5763
5800
|
// src/session-workspace.ts
|
|
5764
5801
|
import { spawnSync as spawnSync2 } from "child_process";
|
|
5765
5802
|
import { createHash as createHash8, randomUUID as randomUUID5 } from "crypto";
|
|
5766
|
-
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";
|
|
5767
5804
|
import { homedir as homedir10, hostname as hostname2, tmpdir as tmpdir3 } from "os";
|
|
5768
5805
|
import { basename as basename7, dirname as dirname10, join as join16, relative as relative4, resolve as resolve9 } from "path";
|
|
5769
5806
|
import { inflateRawSync } from "zlib";
|
|
@@ -6313,8 +6350,8 @@ ${text2}` }] }], spec: {} };
|
|
|
6313
6350
|
};
|
|
6314
6351
|
}
|
|
6315
6352
|
if (kind === "function_call" || kind === "local_shell_call" || kind === "custom_tool_call") {
|
|
6316
|
-
const
|
|
6317
|
-
if (!
|
|
6353
|
+
const id2 = callOrOwnId(payload);
|
|
6354
|
+
if (!id2) return EMPTY;
|
|
6318
6355
|
return {
|
|
6319
6356
|
events: [
|
|
6320
6357
|
{
|
|
@@ -6322,7 +6359,7 @@ ${text2}` }] }], spec: {} };
|
|
|
6322
6359
|
part: {
|
|
6323
6360
|
type: "tool_call",
|
|
6324
6361
|
index: 0,
|
|
6325
|
-
call_id:
|
|
6362
|
+
call_id: id2,
|
|
6326
6363
|
tool_name: toolName(payload),
|
|
6327
6364
|
args: callArgs(payload)
|
|
6328
6365
|
}
|
|
@@ -6332,8 +6369,8 @@ ${text2}` }] }], spec: {} };
|
|
|
6332
6369
|
};
|
|
6333
6370
|
}
|
|
6334
6371
|
if (kind === "function_call_output" || kind === "custom_tool_call_output") {
|
|
6335
|
-
const
|
|
6336
|
-
if (!
|
|
6372
|
+
const id2 = callIdOf(payload);
|
|
6373
|
+
if (!id2) return {
|
|
6337
6374
|
events: [{ type: "agent.message", parts: [{
|
|
6338
6375
|
type: "text",
|
|
6339
6376
|
index: 0,
|
|
@@ -6354,7 +6391,7 @@ ${typeof payload.output === "string" ? payload.output : JSON.stringify(payload.o
|
|
|
6354
6391
|
part: {
|
|
6355
6392
|
type: "tool_result",
|
|
6356
6393
|
index: 0,
|
|
6357
|
-
call_id:
|
|
6394
|
+
call_id: id2,
|
|
6358
6395
|
tool_name: "",
|
|
6359
6396
|
status: failed ? "error" : "ok",
|
|
6360
6397
|
result: { output: text2 }
|
|
@@ -6415,6 +6452,47 @@ function parseNative(engine, records) {
|
|
|
6415
6452
|
return parse;
|
|
6416
6453
|
}
|
|
6417
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
|
+
|
|
6418
6496
|
// ../../packages/conversation/src/read.ts
|
|
6419
6497
|
var THINKING_BLOCKS = /* @__PURE__ */ new Set(["thinking", "redacted_thinking"]);
|
|
6420
6498
|
var PRESERVED_RECORDS = /* @__PURE__ */ new Set(["source-record.json", "source-attachment.json"]);
|
|
@@ -6480,7 +6558,17 @@ var Fold = class {
|
|
|
6480
6558
|
event(event, at) {
|
|
6481
6559
|
switch (event.type) {
|
|
6482
6560
|
case "user.message": {
|
|
6483
|
-
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
|
+
}
|
|
6484
6572
|
if (!parts.length) return;
|
|
6485
6573
|
const message2 = this.open("user", at);
|
|
6486
6574
|
for (const part of parts) this.add(message2, part);
|
|
@@ -7075,20 +7163,20 @@ function convertSession(from, text2, to, opts = {}) {
|
|
|
7075
7163
|
var SINGLE_IMPORT_MAX = 25 * 1024 * 1024;
|
|
7076
7164
|
var PART_SIZE = 8 * 1024 * 1024;
|
|
7077
7165
|
var SKIPPED3 = /* @__PURE__ */ new Set([".git", "node_modules"]);
|
|
7078
|
-
var workspacePath = (
|
|
7079
|
-
async function listFiles2(
|
|
7166
|
+
var workspacePath = (id2) => `/sessions/${encodeURIComponent(id2)}/workspace`;
|
|
7167
|
+
async function listFiles2(id2, path2, hidden) {
|
|
7080
7168
|
const query = new URLSearchParams();
|
|
7081
7169
|
if (path2) query.set("path", path2);
|
|
7082
7170
|
if (hidden) query.set("hidden", "true");
|
|
7083
7171
|
const qs = query.toString();
|
|
7084
|
-
return api("GET", `${workspacePath(
|
|
7172
|
+
return api("GET", `${workspacePath(id2)}/files${qs ? `?${qs}` : ""}`);
|
|
7085
7173
|
}
|
|
7086
7174
|
function entryLine(e) {
|
|
7087
7175
|
const size2 = e.type === "directory" ? "-" : String(e.size ?? 0);
|
|
7088
7176
|
return `${e.type === "directory" ? "d" : "-"} ${size2.padStart(10)} ${(e.mtime ?? "").slice(0, 16).replace("T", " ")} ${e.name}${e.type === "directory" ? "/" : ""}`;
|
|
7089
7177
|
}
|
|
7090
|
-
async function readFile(
|
|
7091
|
-
return (await apiBytes("GET", `${workspacePath(
|
|
7178
|
+
async function readFile(id2, path2) {
|
|
7179
|
+
return (await apiBytes("GET", `${workspacePath(id2)}/files/content?path=${encodeURIComponent(path2)}`)).bytes;
|
|
7092
7180
|
}
|
|
7093
7181
|
function renderChanges(changes) {
|
|
7094
7182
|
if (!changes.repos.length) return [`no git repository under ${changes.root}`];
|
|
@@ -7097,8 +7185,8 @@ function renderChanges(changes) {
|
|
|
7097
7185
|
...(r.stat ?? r.status ?? "").split("\n").filter(Boolean).map((line2) => ` ${line2}`)
|
|
7098
7186
|
]);
|
|
7099
7187
|
}
|
|
7100
|
-
async function workspacePatch(
|
|
7101
|
-
const { patch, ...meta } = await api("POST", `${workspacePath(
|
|
7188
|
+
async function workspacePatch(id2, repo) {
|
|
7189
|
+
const { patch, ...meta } = await api("POST", `${workspacePath(id2)}/patch`, { repo });
|
|
7102
7190
|
return { meta, patch: Buffer.from(patch, "base64") };
|
|
7103
7191
|
}
|
|
7104
7192
|
function folderFiles(dir) {
|
|
@@ -7109,7 +7197,7 @@ function folderFiles(dir) {
|
|
|
7109
7197
|
}
|
|
7110
7198
|
const files2 = [];
|
|
7111
7199
|
const walk = (at) => {
|
|
7112
|
-
for (const entry of
|
|
7200
|
+
for (const entry of readdirSync8(at, { withFileTypes: true })) {
|
|
7113
7201
|
if (SKIPPED3.has(entry.name)) continue;
|
|
7114
7202
|
const full = join16(at, entry.name);
|
|
7115
7203
|
if (entry.isDirectory()) walk(full);
|
|
@@ -7128,17 +7216,17 @@ function folderArchive(dir, files2) {
|
|
|
7128
7216
|
if (tar.status !== 0) throw new ApiError(400, "archive_failed", `tar failed: ${tar.stderr.toString().trim()}`);
|
|
7129
7217
|
return tar.stdout;
|
|
7130
7218
|
}
|
|
7131
|
-
async function importFolder(
|
|
7219
|
+
async function importFolder(id2, dir, opts = {}) {
|
|
7132
7220
|
const root2 = resolve9(dir);
|
|
7133
7221
|
const name = opts.name ?? basename7(root2);
|
|
7134
7222
|
const archive = opts.archive ?? folderArchive(root2, folderFiles(root2));
|
|
7135
7223
|
if (archive.length <= SINGLE_IMPORT_MAX) {
|
|
7136
|
-
const res = await apiBytes("POST", `${workspacePath(
|
|
7224
|
+
const res = await apiBytes("POST", `${workspacePath(id2)}/import?name=${encodeURIComponent(name)}`, { bytes: archive, mediaType: "application/gzip" });
|
|
7137
7225
|
return res.json();
|
|
7138
7226
|
}
|
|
7139
7227
|
const sha256 = createHash8("sha256").update(archive).digest("hex");
|
|
7140
|
-
let upload = await api("POST", `${workspacePath(
|
|
7141
|
-
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)}`;
|
|
7142
7230
|
for (let part = 0; part < upload.parts; part += 1) {
|
|
7143
7231
|
if (upload.received.includes(part)) continue;
|
|
7144
7232
|
const bytes = archive.subarray(part * upload.part_size, (part + 1) * upload.part_size);
|
|
@@ -7182,8 +7270,8 @@ function engineChange(model, thinking) {
|
|
|
7182
7270
|
};
|
|
7183
7271
|
}
|
|
7184
7272
|
var TERMINAL = /* @__PURE__ */ new Set(["completed", "failed", "cancelled"]);
|
|
7185
|
-
async function handoff(
|
|
7186
|
-
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`, {
|
|
7187
7275
|
target_agent: targetAgent,
|
|
7188
7276
|
message: message2,
|
|
7189
7277
|
...opts.model ? { llm: opts.model } : {},
|
|
@@ -7192,8 +7280,8 @@ async function handoff(id3, targetAgent, message2, opts = {}) {
|
|
|
7192
7280
|
if (TERMINAL.has(h.status) && h.status !== "completed") throw new ApiError(422, h.error?.code ?? "handoff_failed", h.error?.message ?? "the handoff failed");
|
|
7193
7281
|
return h;
|
|
7194
7282
|
}
|
|
7195
|
-
async function fork(
|
|
7196
|
-
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`, {
|
|
7197
7285
|
target_agent: targetAgent,
|
|
7198
7286
|
...opts.fromMessage ? { last_message_id: opts.fromMessage } : {},
|
|
7199
7287
|
...opts.model ? { llm: opts.model } : {},
|
|
@@ -7273,13 +7361,13 @@ function landing(harness2, download, engine, folder) {
|
|
|
7273
7361
|
const moved = convertSession(harness2, transcript.data.toString("utf8"), engine, { cwd: folder });
|
|
7274
7362
|
return { engine, nativeId: moved.nativeId, files: [{ path: moved.path, data: Buffer.from(moved.content, "utf8") }], resume: `cd ${quoted} && ${moved.resume}`, converted: moved.report };
|
|
7275
7363
|
}
|
|
7276
|
-
async function continueHere(
|
|
7277
|
-
const session2 = (await api("GET", `/sessions/${encodeURIComponent(
|
|
7364
|
+
async function continueHere(id2, dir, opts = {}) {
|
|
7365
|
+
const session2 = (await api("GET", `/sessions/${encodeURIComponent(id2)}`)).session;
|
|
7278
7366
|
const harness2 = session2.agentType;
|
|
7279
7367
|
if (!isEngine(harness2)) throw new ApiError(409, "harness_unsupported", "only Claude Code and Codex sessions can continue on a computer");
|
|
7280
7368
|
const engine = opts.engine ?? harness2;
|
|
7281
7369
|
if (!isEngine(engine)) throw new ApiError(400, "invalid_request", "--engine must be claude_code or codex");
|
|
7282
|
-
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() });
|
|
7283
7371
|
opts.onStatus?.(h);
|
|
7284
7372
|
while (!TERMINAL.has(h.status)) {
|
|
7285
7373
|
await new Promise((r) => setTimeout(r, opts.pollMs ?? 2e3));
|
|
@@ -7297,7 +7385,7 @@ async function continueHere(id3, dir, opts = {}) {
|
|
|
7297
7385
|
mkdirSync5(dirname10(target2), { recursive: true });
|
|
7298
7386
|
if (existsSync12(target2)) {
|
|
7299
7387
|
if (!lstatSync5(target2).isFile()) throw new ApiError(409, "restore_blocked", `something other than a file is in the way at ${target2}`);
|
|
7300
|
-
if (
|
|
7388
|
+
if (readFileSync19(target2).equals(file.data)) continue;
|
|
7301
7389
|
renameSync2(target2, `${target2}.before-agentsky-${stamp}`);
|
|
7302
7390
|
}
|
|
7303
7391
|
writeFileSync9(target2, file.data, { mode: 384 });
|
|
@@ -7340,10 +7428,10 @@ function createEventRenderer(out = process.stdout) {
|
|
|
7340
7428
|
openStream = null;
|
|
7341
7429
|
};
|
|
7342
7430
|
return (event, data) => {
|
|
7343
|
-
const
|
|
7344
|
-
if (
|
|
7345
|
-
if (seen.has(
|
|
7346
|
-
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);
|
|
7347
7435
|
}
|
|
7348
7436
|
if (event !== "agent.message") {
|
|
7349
7437
|
if (event && event !== "keepalive") closeLine();
|
|
@@ -7477,12 +7565,12 @@ function publishBody(task, options) {
|
|
|
7477
7565
|
async function publishArtifact(task, options) {
|
|
7478
7566
|
return (await api("POST", "/artifacts", publishBody(task, options))).artifact;
|
|
7479
7567
|
}
|
|
7480
|
-
async function readArtifactFile(
|
|
7481
|
-
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;
|
|
7482
7570
|
}
|
|
7483
|
-
async function saveArtifactFile(
|
|
7571
|
+
async function saveArtifactFile(id2, path2, input) {
|
|
7484
7572
|
const query = new URLSearchParams({ base_version: String(input.baseVersion), ...input.restoreVersion ? { restore_version: String(input.restoreVersion) } : {}, ...input.requestId ? { request_id: input.requestId } : {} });
|
|
7485
|
-
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" });
|
|
7486
7574
|
return (await sent.json()).artifact;
|
|
7487
7575
|
}
|
|
7488
7576
|
async function importArtifact(input) {
|
|
@@ -7493,29 +7581,29 @@ async function importArtifact(input) {
|
|
|
7493
7581
|
for (const [field, value] of Object.entries(fields)) form.set(field, value);
|
|
7494
7582
|
return (await apiForm("POST", "/artifacts/imports", form)).artifact;
|
|
7495
7583
|
}
|
|
7496
|
-
async function exportArtifact(
|
|
7584
|
+
async function exportArtifact(id2, options = {}) {
|
|
7497
7585
|
const query = new URLSearchParams({ ...options.format ? { format: options.format } : {}, ...options.version ? { version: String(options.version) } : {} }).toString();
|
|
7498
|
-
return (await apiBytes("GET", `/artifacts/${encodeURIComponent(
|
|
7586
|
+
return (await apiBytes("GET", `/artifacts/${encodeURIComponent(id2)}/export${query ? `?${query}` : ""}`)).bytes;
|
|
7499
7587
|
}
|
|
7500
|
-
async function convertArtifactToPage(
|
|
7501
|
-
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 } : {} });
|
|
7502
7590
|
}
|
|
7503
|
-
async function shareArtifact(
|
|
7504
|
-
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;
|
|
7505
7593
|
}
|
|
7506
|
-
async function renameArtifact(
|
|
7507
|
-
return (await api("PATCH", `/artifacts/${encodeURIComponent(
|
|
7594
|
+
async function renameArtifact(id2, name) {
|
|
7595
|
+
return (await api("PATCH", `/artifacts/${encodeURIComponent(id2)}`, { name })).artifact;
|
|
7508
7596
|
}
|
|
7509
|
-
async function copyArtifact(
|
|
7510
|
-
return (await api("POST", `/artifacts/${encodeURIComponent(
|
|
7597
|
+
async function copyArtifact(id2, input) {
|
|
7598
|
+
return (await api("POST", `/artifacts/${encodeURIComponent(id2)}/copy`, {
|
|
7511
7599
|
...input.name ? { name: input.name } : {},
|
|
7512
7600
|
...input.version ? { version: input.version } : {},
|
|
7513
7601
|
...input.taskId ? { task_id: input.taskId } : {},
|
|
7514
7602
|
request_id: input.requestId ?? crypto.randomUUID()
|
|
7515
7603
|
})).artifact;
|
|
7516
7604
|
}
|
|
7517
|
-
async function deleteArtifact(
|
|
7518
|
-
await api("DELETE", `/artifacts/${encodeURIComponent(
|
|
7605
|
+
async function deleteArtifact(id2) {
|
|
7606
|
+
await api("DELETE", `/artifacts/${encodeURIComponent(id2)}`);
|
|
7519
7607
|
}
|
|
7520
7608
|
function renderTaskFile(file) {
|
|
7521
7609
|
return `${file.path} ${file.size_bytes} bytes ${file.updated_at}${file.updated_by_session ? ` by ${file.updated_by_session}` : ""}`;
|
|
@@ -7524,10 +7612,10 @@ function renderArtifact(artifact2) {
|
|
|
7524
7612
|
const files2 = `${artifact2.files.length} ${artifact2.files.length === 1 ? "file" : "files"}`;
|
|
7525
7613
|
return `${artifact2.id} ${artifact2.name} v${artifact2.version} ${files2} entry ${artifact2.entry}${artifact2.share_url ? ` shared ${artifact2.share_url}` : ""}`;
|
|
7526
7614
|
}
|
|
7527
|
-
async function artifactComments(
|
|
7528
|
-
return api(input ? "POST" : "GET", `/artifacts/${encodeURIComponent(
|
|
7615
|
+
async function artifactComments(id2, input) {
|
|
7616
|
+
return api(input ? "POST" : "GET", `/artifacts/${encodeURIComponent(id2)}/comments`, input);
|
|
7529
7617
|
}
|
|
7530
|
-
async function artifactCommentsOperation(
|
|
7618
|
+
async function artifactCommentsOperation(id2, opts) {
|
|
7531
7619
|
const operations = [opts.text, opts.resolve, opts.reopen].filter((value) => value !== void 0).length;
|
|
7532
7620
|
if (operations > 1) throw new Error("--text, --resolve and --reopen are mutually exclusive");
|
|
7533
7621
|
const root2 = opts.resolve ?? opts.reopen;
|
|
@@ -7537,13 +7625,13 @@ async function artifactCommentsOperation(id3, opts) {
|
|
|
7537
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) {
|
|
7538
7626
|
throw new Error("Resolution needs a safe integer --base and a non-negative integer --state-version");
|
|
7539
7627
|
}
|
|
7540
|
-
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 });
|
|
7541
7629
|
}
|
|
7542
7630
|
if (opts.stateVersion !== void 0) throw new Error("--state-version requires --resolve or --reopen");
|
|
7543
7631
|
if (opts.text === void 0 && (opts.base !== void 0 || opts.reply !== void 0)) throw new Error("--base and --reply require --text");
|
|
7544
7632
|
const version = Number(opts.base);
|
|
7545
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");
|
|
7546
|
-
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 } });
|
|
7547
7635
|
}
|
|
7548
7636
|
|
|
7549
7637
|
// src/task-export.ts
|
|
@@ -8060,7 +8148,7 @@ function renderAgentRecord(row) {
|
|
|
8060
8148
|
|
|
8061
8149
|
// src/vaults.ts
|
|
8062
8150
|
import { createInterface as createInterface4 } from "readline";
|
|
8063
|
-
var vaultPath = (
|
|
8151
|
+
var vaultPath = (id2) => `/vaults/${encodeURIComponent(id2)}`;
|
|
8064
8152
|
function secretLine(s) {
|
|
8065
8153
|
const target2 = s.secret_name ? `$${s.secret_name}` : s.mcp_server_url ?? "";
|
|
8066
8154
|
const sites = s.allowed_hosts === void 0 ? "" : ` sites: ${s.allowed_hosts.join(", ") || "none"}`;
|
|
@@ -8185,13 +8273,13 @@ function renderBrowserProfile(profile) {
|
|
|
8185
8273
|
}
|
|
8186
8274
|
|
|
8187
8275
|
// src/portable-import.ts
|
|
8188
|
-
import { existsSync as existsSync13, readdirSync as
|
|
8276
|
+
import { existsSync as existsSync13, readdirSync as readdirSync9, readFileSync as readFileSync20, statSync as statSync7 } from "fs";
|
|
8189
8277
|
import { basename as basename8, join as join18, resolve as resolve10 } from "path";
|
|
8190
8278
|
import { parse as parseToml4 } from "smol-toml";
|
|
8191
8279
|
var isObject = (value) => Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
8192
8280
|
function readJson4(path2) {
|
|
8193
8281
|
try {
|
|
8194
|
-
return JSON.parse(
|
|
8282
|
+
return JSON.parse(readFileSync20(path2, "utf-8"));
|
|
8195
8283
|
} catch {
|
|
8196
8284
|
return null;
|
|
8197
8285
|
}
|
|
@@ -8262,14 +8350,14 @@ function codexConfigServers(toml) {
|
|
|
8262
8350
|
function skillDirs(root2) {
|
|
8263
8351
|
const dir = join18(root2, "skills");
|
|
8264
8352
|
if (!existsSync13(dir) || !statSync7(dir).isDirectory()) return [];
|
|
8265
|
-
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));
|
|
8266
8354
|
}
|
|
8267
8355
|
function planImport(path2) {
|
|
8268
8356
|
const target2 = resolve10(path2);
|
|
8269
8357
|
if (!existsSync13(target2)) throw new Error(`Nothing at ${path2}`);
|
|
8270
8358
|
if (statSync7(target2).isFile()) {
|
|
8271
8359
|
const name2 = basename8(target2).replace(/\.(json|toml)$/, "");
|
|
8272
|
-
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")) };
|
|
8273
8361
|
const value = readJson4(target2);
|
|
8274
8362
|
if (value === null) throw new Error(`${path2} is not JSON or TOML`);
|
|
8275
8363
|
return { name: name2, format: "mcp", skills: [], ...mcpJsonServers(value) };
|
|
@@ -8318,11 +8406,11 @@ async function listComparisons(opts = {}) {
|
|
|
8318
8406
|
async function createComparison(body) {
|
|
8319
8407
|
return api("POST", "/comparisons", body);
|
|
8320
8408
|
}
|
|
8321
|
-
async function getComparison(
|
|
8322
|
-
return api("GET", `/comparisons/${encodeURIComponent(
|
|
8409
|
+
async function getComparison(id2) {
|
|
8410
|
+
return api("GET", `/comparisons/${encodeURIComponent(id2)}`);
|
|
8323
8411
|
}
|
|
8324
|
-
async function pickWinner(
|
|
8325
|
-
return api("POST", `/comparisons/${encodeURIComponent(
|
|
8412
|
+
async function pickWinner(id2, opts) {
|
|
8413
|
+
return api("POST", `/comparisons/${encodeURIComponent(id2)}/pick`, opts);
|
|
8326
8414
|
}
|
|
8327
8415
|
async function listThreads2(opts = {}) {
|
|
8328
8416
|
const query = new URLSearchParams();
|
|
@@ -8334,33 +8422,33 @@ async function listThreads2(opts = {}) {
|
|
|
8334
8422
|
async function startThread(body) {
|
|
8335
8423
|
return api("POST", "/threads", body);
|
|
8336
8424
|
}
|
|
8337
|
-
var threadPath = (
|
|
8338
|
-
async function getThread(
|
|
8339
|
-
return api("GET", threadPath(
|
|
8425
|
+
var threadPath = (id2) => `/threads/${encodeURIComponent(id2)}`;
|
|
8426
|
+
async function getThread(id2) {
|
|
8427
|
+
return api("GET", threadPath(id2));
|
|
8340
8428
|
}
|
|
8341
|
-
async function organizeThread(
|
|
8342
|
-
return api("PATCH", threadPath(
|
|
8429
|
+
async function organizeThread(id2, change) {
|
|
8430
|
+
return api("PATCH", threadPath(id2), change);
|
|
8343
8431
|
}
|
|
8344
|
-
async function deleteThread(
|
|
8345
|
-
return api("DELETE", threadPath(
|
|
8432
|
+
async function deleteThread(id2) {
|
|
8433
|
+
return api("DELETE", threadPath(id2));
|
|
8346
8434
|
}
|
|
8347
|
-
async function sendThreadMessage(
|
|
8348
|
-
return api("POST", `${threadPath(
|
|
8435
|
+
async function sendThreadMessage(id2, body) {
|
|
8436
|
+
return api("POST", `${threadPath(id2)}/messages`, body);
|
|
8349
8437
|
}
|
|
8350
|
-
async function addThreadAgent(
|
|
8351
|
-
return api("POST", `${threadPath(
|
|
8438
|
+
async function addThreadAgent(id2, body) {
|
|
8439
|
+
return api("POST", `${threadPath(id2)}/agents`, body);
|
|
8352
8440
|
}
|
|
8353
|
-
async function removeThreadAgent(
|
|
8354
|
-
return api("DELETE", `${threadPath(
|
|
8441
|
+
async function removeThreadAgent(id2, columnId) {
|
|
8442
|
+
return api("DELETE", `${threadPath(id2)}/agents/${encodeURIComponent(columnId)}`);
|
|
8355
8443
|
}
|
|
8356
|
-
async function interruptThread(
|
|
8357
|
-
return api("POST", `${threadPath(
|
|
8444
|
+
async function interruptThread(id2, columnId) {
|
|
8445
|
+
return api("POST", `${threadPath(id2)}/interrupt`, columnId ? { columnId } : {});
|
|
8358
8446
|
}
|
|
8359
|
-
async function forkThread(
|
|
8360
|
-
return api("POST", `${threadPath(
|
|
8447
|
+
async function forkThread(id2, body) {
|
|
8448
|
+
return api("POST", `${threadPath(id2)}/fork`, body);
|
|
8361
8449
|
}
|
|
8362
|
-
async function changeThreadModel(
|
|
8363
|
-
return api("PATCH", `${threadPath(
|
|
8450
|
+
async function changeThreadModel(id2, change, columnId) {
|
|
8451
|
+
return api("PATCH", `${threadPath(id2)}/engine${columnId ? `?column=${encodeURIComponent(columnId)}` : ""}`, change);
|
|
8364
8452
|
}
|
|
8365
8453
|
async function searchThreads(q, opts = {}) {
|
|
8366
8454
|
const params = new URLSearchParams({ q, ...opts.threads ? { threads: opts.threads } : {}, ...opts.cursor ? { cursor: opts.cursor } : {} });
|
|
@@ -8405,10 +8493,10 @@ function renderThreadSummary(t) {
|
|
|
8405
8493
|
}
|
|
8406
8494
|
|
|
8407
8495
|
// src/library.ts
|
|
8408
|
-
import { readFileSync as
|
|
8496
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
8409
8497
|
|
|
8410
8498
|
// src/api-command.ts
|
|
8411
|
-
import { readFileSync as
|
|
8499
|
+
import { readFileSync as readFileSync21 } from "fs";
|
|
8412
8500
|
|
|
8413
8501
|
// ../../packages/spec/src/operation-search.ts
|
|
8414
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"]);
|
|
@@ -8520,9 +8608,9 @@ function operationSearch(operations, components) {
|
|
|
8520
8608
|
// src/api-command.ts
|
|
8521
8609
|
var API_METHODS = ["GET", "POST", "PUT", "PATCH", "DELETE"];
|
|
8522
8610
|
var SEARCH_LIMIT = 25;
|
|
8523
|
-
function readData(data, stdin = () =>
|
|
8611
|
+
function readData(data, stdin = () => readFileSync21(0, "utf8")) {
|
|
8524
8612
|
if (data === void 0) return void 0;
|
|
8525
|
-
const raw = data === "-" ? stdin() : data.startsWith("@") ?
|
|
8613
|
+
const raw = data === "-" ? stdin() : data.startsWith("@") ? readFileSync21(data.slice(1), "utf8") : data;
|
|
8526
8614
|
try {
|
|
8527
8615
|
JSON.parse(raw);
|
|
8528
8616
|
} catch {
|
|
@@ -8585,7 +8673,7 @@ async function callApi(method, path2, opts) {
|
|
|
8585
8673
|
}
|
|
8586
8674
|
|
|
8587
8675
|
// src/library.ts
|
|
8588
|
-
var artifactPath = (
|
|
8676
|
+
var artifactPath = (id2) => `/library/artifacts/${encodeURIComponent(id2)}`;
|
|
8589
8677
|
var savedVersion = external_exports.number().int().positive().max(2147483646);
|
|
8590
8678
|
var artifactResponse = external_exports.object({
|
|
8591
8679
|
id: external_exports.string().min(1).optional(),
|
|
@@ -8598,12 +8686,12 @@ function libraryArtifact(value) {
|
|
|
8598
8686
|
const parsed = artifactResponse.safeParse(value);
|
|
8599
8687
|
if (!parsed.success) throw new Error("Invalid Library artifact response.");
|
|
8600
8688
|
const row = parsed.data;
|
|
8601
|
-
const
|
|
8689
|
+
const id2 = row.id ?? row.artifactId;
|
|
8602
8690
|
const currentVersion = row.currentVersion ?? row.version;
|
|
8603
|
-
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) {
|
|
8604
8692
|
throw new Error("Invalid Library artifact response.");
|
|
8605
8693
|
}
|
|
8606
|
-
return { ...row, id:
|
|
8694
|
+
return { ...row, id: id2, currentVersion };
|
|
8607
8695
|
}
|
|
8608
8696
|
async function listLibrary(query = {}) {
|
|
8609
8697
|
const params = new URLSearchParams(Object.entries(query).filter((entry) => Boolean(entry[1])));
|
|
@@ -8621,23 +8709,23 @@ async function uploadToLibrary(file, requestId2, workspace2, sessionId) {
|
|
|
8621
8709
|
const uploaded = await apiForm("POST", "/library/artifacts", form);
|
|
8622
8710
|
return { ...uploaded, artifact: libraryArtifact(uploaded.artifact) };
|
|
8623
8711
|
}
|
|
8624
|
-
async function getLibraryArtifact(
|
|
8625
|
-
const artifact2 = libraryArtifact(await api("GET", artifactPath(
|
|
8626
|
-
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.");
|
|
8627
8715
|
return artifact2;
|
|
8628
8716
|
}
|
|
8629
|
-
async function deleteLibraryArtifact(
|
|
8630
|
-
return api("DELETE", artifactPath(
|
|
8717
|
+
async function deleteLibraryArtifact(id2, revision) {
|
|
8718
|
+
return api("DELETE", artifactPath(id2), { revision: savedVersion.parse(revision) });
|
|
8631
8719
|
}
|
|
8632
|
-
async function shareLibraryArtifact(
|
|
8633
|
-
const { currentVersion } = await getLibraryArtifact(
|
|
8634
|
-
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 });
|
|
8635
8723
|
}
|
|
8636
|
-
async function placeLibraryArtifact(
|
|
8637
|
-
return api("PATCH", `${artifactPath(
|
|
8724
|
+
async function placeLibraryArtifact(id2, workspace2) {
|
|
8725
|
+
return api("PATCH", `${artifactPath(id2)}/workspace`, { workspace: workspace2 });
|
|
8638
8726
|
}
|
|
8639
|
-
async function downloadLibraryArtifact(
|
|
8640
|
-
return apiBytes("GET", `${artifactPath(
|
|
8727
|
+
async function downloadLibraryArtifact(id2, version) {
|
|
8728
|
+
return apiBytes("GET", `${artifactPath(id2)}/download${version ? `?version=${version}` : ""}`);
|
|
8641
8729
|
}
|
|
8642
8730
|
function renderLibraryArtifact(artifact2) {
|
|
8643
8731
|
const version = artifact2.currentVersion ? `v${artifact2.currentVersion}` : "";
|
|
@@ -8746,7 +8834,7 @@ function registerLibraryLinkCommands(library2) {
|
|
|
8746
8834
|
});
|
|
8747
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) => {
|
|
8748
8836
|
if (opts.file !== void 0 === (opts.data !== void 0)) throw new Error("Choose exactly one of --file or --data.");
|
|
8749
|
-
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));
|
|
8750
8838
|
if (!body || typeof body !== "object" || Array.isArray(body)) throw new Error("--data must be a JSON object with one native save field.");
|
|
8751
8839
|
if ("revision" in body && body.revision !== opts.revision) throw new Error("--data revision must match --revision.");
|
|
8752
8840
|
console.log(JSON.stringify(await saveSharedLibraryFile(opts.token, sharedLibrarySaveSchema.parse({ ...body, revision: opts.revision })), null, 2));
|
|
@@ -8780,8 +8868,8 @@ async function listTodos(query = {}) {
|
|
|
8780
8868
|
const params = new URLSearchParams(Object.entries({ ...query, today }).filter((entry) => Boolean(entry[1])));
|
|
8781
8869
|
return api("GET", `/library/todos?${params}`);
|
|
8782
8870
|
}
|
|
8783
|
-
async function setTodoDone(
|
|
8784
|
-
return api("PATCH", `/library/todos/${encodeURIComponent(
|
|
8871
|
+
async function setTodoDone(id2, done) {
|
|
8872
|
+
return api("PATCH", `/library/todos/${encodeURIComponent(id2)}`, { done });
|
|
8785
8873
|
}
|
|
8786
8874
|
function renderTodo(todo) {
|
|
8787
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(" ");
|
|
@@ -8798,8 +8886,8 @@ async function listItems(query) {
|
|
|
8798
8886
|
if (query.cursor) params.set("cursor", query.cursor);
|
|
8799
8887
|
return api("GET", `/action-items${params.size ? `?${params}` : ""}`);
|
|
8800
8888
|
}
|
|
8801
|
-
async function actOnItem(
|
|
8802
|
-
return api("POST", `/action-items/${encodeURIComponent(
|
|
8889
|
+
async function actOnItem(id2, opts) {
|
|
8890
|
+
return api("POST", `/action-items/${encodeURIComponent(id2)}/act`, {
|
|
8803
8891
|
...opts.option ? { option_id: opts.option } : {},
|
|
8804
8892
|
...opts.text ? { text: opts.text } : {},
|
|
8805
8893
|
...opts.engine ? { agent_type: opts.engine } : {},
|
|
@@ -8824,10 +8912,11 @@ async function listAsks(query) {
|
|
|
8824
8912
|
if (query.source) params.set("source_id", query.source);
|
|
8825
8913
|
if (query.limit) params.set("limit", query.limit);
|
|
8826
8914
|
if (query.cursor) params.set("cursor", query.cursor);
|
|
8915
|
+
if (query.direction) params.set("direction", query.direction);
|
|
8827
8916
|
return api("GET", `/asks${params.size ? `?${params}` : ""}`);
|
|
8828
8917
|
}
|
|
8829
|
-
async function answerAsk(
|
|
8830
|
-
return api("POST", `/asks/${encodeURIComponent(
|
|
8918
|
+
async function answerAsk(id2, opts) {
|
|
8919
|
+
return api("POST", `/asks/${encodeURIComponent(id2)}/answer`, {
|
|
8831
8920
|
...opts.option ? { option_id: opts.option } : {},
|
|
8832
8921
|
...opts.text ? { text: opts.text } : {},
|
|
8833
8922
|
...opts.engine ? { agent_type: opts.engine } : {},
|
|
@@ -8838,15 +8927,18 @@ function renderAsk(ask3) {
|
|
|
8838
8927
|
const choices = ask3.answer.options.length ? ` (${ask3.answer.options.map((option) => `${option.id}: ${option.label}`).join(", ")})` : "";
|
|
8839
8928
|
const by = ask3.answer.answered_by === "person" ? ", only you, in the app" : "";
|
|
8840
8929
|
const why = ask3.why ? ` \u2014 ${ask3.why}` : "";
|
|
8930
|
+
const member = (end) => end.name ?? (end.kind === "person" ? "you" : end.kind);
|
|
8931
|
+
const ends = ask3.from && ask3.to ? `
|
|
8932
|
+
${member(ask3.from)} \u2192 ${member(ask3.to)} ${ask3.direction}, waits on ${member(ask3.waits_on === "from" ? ask3.from : ask3.to)}` : "";
|
|
8841
8933
|
return `${ask3.who.name}: ${ask3.need}${why}
|
|
8842
|
-
${ask3.id} [${ask3.answer.label}${by}]${choices}`;
|
|
8934
|
+
${ask3.id} [${ask3.answer.label}${by}]${choices}${ends}`;
|
|
8843
8935
|
}
|
|
8844
8936
|
function renderAnswered(result) {
|
|
8845
8937
|
return [result.answered, result.session_id, result.url].filter(Boolean).join(" ");
|
|
8846
8938
|
}
|
|
8847
8939
|
|
|
8848
8940
|
// src/signing.ts
|
|
8849
|
-
import { readFileSync as
|
|
8941
|
+
import { readFileSync as readFileSync23, writeFileSync as writeFileSync11 } from "fs";
|
|
8850
8942
|
function signedText(file, opts) {
|
|
8851
8943
|
if (file && opts.artifact) throw new Error("Give a file or --artifact, not both.");
|
|
8852
8944
|
if (opts.artifact) {
|
|
@@ -8855,7 +8947,7 @@ function signedText(file, opts) {
|
|
|
8855
8947
|
return { source: { artifact_id: opts.artifact, version } };
|
|
8856
8948
|
}
|
|
8857
8949
|
if (!file) throw new Error("Give the Markdown file to sign, or --artifact and --artifact-version.");
|
|
8858
|
-
return { document:
|
|
8950
|
+
return { document: readFileSync23(file, "utf8") };
|
|
8859
8951
|
}
|
|
8860
8952
|
async function requestSignature(file, opts) {
|
|
8861
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.");
|
|
@@ -8878,18 +8970,18 @@ async function listRequests(query) {
|
|
|
8878
8970
|
if (query.link) params.set("link", query.link);
|
|
8879
8971
|
return api("GET", `/signing-requests${params.size ? `?${params}` : ""}`);
|
|
8880
8972
|
}
|
|
8881
|
-
async function readRequest(
|
|
8882
|
-
return api("GET", `/signing-requests/${encodeURIComponent(
|
|
8973
|
+
async function readRequest(id2) {
|
|
8974
|
+
return api("GET", `/signing-requests/${encodeURIComponent(id2)}`);
|
|
8883
8975
|
}
|
|
8884
|
-
async function readDocument(
|
|
8885
|
-
return api("GET", `/signing-requests/${encodeURIComponent(
|
|
8976
|
+
async function readDocument(id2) {
|
|
8977
|
+
return api("GET", `/signing-requests/${encodeURIComponent(id2)}/document`);
|
|
8886
8978
|
}
|
|
8887
|
-
async function saveCopy(
|
|
8888
|
-
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`);
|
|
8889
8981
|
writeFileSync11(file, bytes);
|
|
8890
8982
|
}
|
|
8891
|
-
async function cancelRequest(
|
|
8892
|
-
return api("POST", `/signing-requests/${encodeURIComponent(
|
|
8983
|
+
async function cancelRequest(id2) {
|
|
8984
|
+
return api("POST", `/signing-requests/${encodeURIComponent(id2)}/cancel`);
|
|
8893
8985
|
}
|
|
8894
8986
|
function renderRequest3(request3) {
|
|
8895
8987
|
const who = request3.signer ? `for ${request3.signer.name} <${request3.signer.email}>` : "for anyone with the link";
|
|
@@ -8943,7 +9035,7 @@ function renderItem2(item) {
|
|
|
8943
9035
|
}
|
|
8944
9036
|
|
|
8945
9037
|
// src/design-systems.ts
|
|
8946
|
-
import { readdirSync as
|
|
9038
|
+
import { readdirSync as readdirSync10, readFileSync as readFileSync24, statSync as statSync8 } from "fs";
|
|
8947
9039
|
import { join as join19, relative as relative5, sep as sep4 } from "path";
|
|
8948
9040
|
var TEXT2 = /\.(mdx?|markdown|txt|json|m?js|cjs|jsx|tsx?|css|html?|svg|xml|csv|ya?ml|toml)$/i;
|
|
8949
9041
|
var MEDIA = {
|
|
@@ -8963,21 +9055,21 @@ var MEDIA = {
|
|
|
8963
9055
|
async function listDesignSystems() {
|
|
8964
9056
|
return (await api("GET", "/artifacts?kind=design_system")).artifacts;
|
|
8965
9057
|
}
|
|
8966
|
-
async function getDesignSystem(
|
|
8967
|
-
return (await api("GET", `/artifacts/${encodeURIComponent(
|
|
9058
|
+
async function getDesignSystem(id2) {
|
|
9059
|
+
return (await api("GET", `/artifacts/${encodeURIComponent(id2)}/design-system`)).design_system;
|
|
8968
9060
|
}
|
|
8969
9061
|
async function importDesignSystem(task, files2, title) {
|
|
8970
9062
|
return (await api("POST", "/artifacts/design-systems", { task_id: task, files: files2, ...title ? { title } : {} })).artifact;
|
|
8971
9063
|
}
|
|
8972
|
-
async function saveDesignTokens(
|
|
8973
|
-
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`, {
|
|
8974
9066
|
base_version: baseVersion,
|
|
8975
9067
|
tokens,
|
|
8976
9068
|
...note ? { note } : {}
|
|
8977
9069
|
})).artifact;
|
|
8978
9070
|
}
|
|
8979
|
-
async function saveDesignSystemFile(
|
|
8980
|
-
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("/")}`, {
|
|
8981
9073
|
base_version: baseVersion,
|
|
8982
9074
|
...change,
|
|
8983
9075
|
...note ? { note } : {}
|
|
@@ -8986,7 +9078,7 @@ async function saveDesignSystemFile(id3, path2, baseVersion, change, note) {
|
|
|
8986
9078
|
function fileTableFrom(dir) {
|
|
8987
9079
|
const files2 = {};
|
|
8988
9080
|
const walk = (current) => {
|
|
8989
|
-
for (const name of
|
|
9081
|
+
for (const name of readdirSync10(current)) {
|
|
8990
9082
|
if (name.startsWith(".") || name === "node_modules") continue;
|
|
8991
9083
|
const path2 = join19(current, name);
|
|
8992
9084
|
if (statSync8(path2).isDirectory()) {
|
|
@@ -8994,7 +9086,7 @@ function fileTableFrom(dir) {
|
|
|
8994
9086
|
continue;
|
|
8995
9087
|
}
|
|
8996
9088
|
const key = relative5(dir, path2).split(sep4).join("/");
|
|
8997
|
-
const bytes =
|
|
9089
|
+
const bytes = readFileSync24(path2);
|
|
8998
9090
|
files2[key] = TEXT2.test(name) ? bytes.toString("utf8") : `data:${MEDIA[name.split(".").pop()?.toLowerCase() ?? ""] ?? "application/octet-stream"};base64,${bytes.toString("base64")}`;
|
|
8999
9091
|
}
|
|
9000
9092
|
};
|
|
@@ -9013,12 +9105,12 @@ function renderDesignSystem(system) {
|
|
|
9013
9105
|
for (const token of tokens?.dropped ?? []) lines2.push(`not read: ${token.family} ${token.name || "(unnamed)"}: ${token.reason}`);
|
|
9014
9106
|
return lines2.join("\n");
|
|
9015
9107
|
}
|
|
9016
|
-
async function designComments(
|
|
9017
|
-
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);
|
|
9018
9110
|
}
|
|
9019
9111
|
|
|
9020
9112
|
// src/tool-command.ts
|
|
9021
|
-
import { readFileSync as
|
|
9113
|
+
import { readFileSync as readFileSync25 } from "fs";
|
|
9022
9114
|
async function rpc(method, params) {
|
|
9023
9115
|
const res = await apiRaw("POST", "/mcp", {
|
|
9024
9116
|
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method, params }),
|
|
@@ -9044,8 +9136,8 @@ async function listTools(opts = {}) {
|
|
|
9044
9136
|
}
|
|
9045
9137
|
for (const tool2 of tools) console.log(`${tool2.name} ${(tool2.description ?? "").split("\n")[0]}`);
|
|
9046
9138
|
}
|
|
9047
|
-
async function callTool(name, opts = {}, stdin = () =>
|
|
9048
|
-
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;
|
|
9049
9141
|
let args;
|
|
9050
9142
|
try {
|
|
9051
9143
|
args = JSON.parse(raw);
|
|
@@ -9107,7 +9199,7 @@ function referralLinkBody(opts) {
|
|
|
9107
9199
|
return body;
|
|
9108
9200
|
}
|
|
9109
9201
|
var createReferralLink = (opts) => api("POST", "/billing/referral-links", referralLinkBody(opts));
|
|
9110
|
-
var disableReferralLink = (
|
|
9202
|
+
var disableReferralLink = (id2) => api("POST", `/billing/referral-links/${encodeURIComponent(id2)}/disable`);
|
|
9111
9203
|
function renderReferralLinks(dashboard) {
|
|
9112
9204
|
const lines2 = [`priced from ${dashboard.source_plan.name}: customers pay at least ${Math.round(dashboard.source_plan.multiplier * 100)}% of public price`];
|
|
9113
9205
|
for (const link2 of dashboard.links) {
|
|
@@ -9228,7 +9320,7 @@ function withOldCommandNames(root2, argv) {
|
|
|
9228
9320
|
}
|
|
9229
9321
|
|
|
9230
9322
|
// src/harness.ts
|
|
9231
|
-
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";
|
|
9232
9324
|
import { dirname as dirname12, join as join20, resolve as resolve11 } from "path";
|
|
9233
9325
|
var HARNESS_FILE = "harness.json";
|
|
9234
9326
|
function harnessFilePath(dir) {
|
|
@@ -9240,7 +9332,7 @@ function readHarnessFile(dir) {
|
|
|
9240
9332
|
throw new Error(`no ${HARNESS_FILE} found in ${resolve11(dir)} \u2014 run \`sky harness init\` first`);
|
|
9241
9333
|
}
|
|
9242
9334
|
try {
|
|
9243
|
-
return JSON.parse(
|
|
9335
|
+
return JSON.parse(readFileSync26(path2, "utf8"));
|
|
9244
9336
|
} catch (err) {
|
|
9245
9337
|
throw new Error(`could not parse ${path2}: ${err instanceof Error ? err.message : String(err)}`);
|
|
9246
9338
|
}
|
|
@@ -9679,7 +9771,7 @@ agent.command("create").description("create an agent spec \u2014 no runtime; `sk
|
|
|
9679
9771
|
).option("--name <name>", "agent name").option(
|
|
9680
9772
|
"--capability <id>",
|
|
9681
9773
|
"grant a built-in capability (repeatable; ids at /docs/capabilities; none by default)",
|
|
9682
|
-
(
|
|
9774
|
+
(id2, all) => [...all, id2],
|
|
9683
9775
|
[]
|
|
9684
9776
|
).option("-f, --file <path>", "create from an agent.toml").action(
|
|
9685
9777
|
run2(
|
|
@@ -9717,8 +9809,8 @@ agent.command("list").action(
|
|
|
9717
9809
|
})
|
|
9718
9810
|
);
|
|
9719
9811
|
agent.command("show <id>").action(
|
|
9720
|
-
run2(async (
|
|
9721
|
-
const { agent: a } = await api("GET", `/agents/${encodeURIComponent(
|
|
9812
|
+
run2(async (id2) => {
|
|
9813
|
+
const { agent: a } = await api("GET", `/agents/${encodeURIComponent(id2)}`);
|
|
9722
9814
|
console.log(`${a.id} \u2014 ${a.displayName}${a.archived ? " (archived)" : ""}`);
|
|
9723
9815
|
console.log(` type ${a.agentType} \xB7 ${a.llm}`);
|
|
9724
9816
|
if (a.reasoningEffort) console.log(` effort ${a.reasoningEffort}`);
|
|
@@ -9741,9 +9833,9 @@ agent.command("apply").description(`make an agent what a manifest file declares
|
|
|
9741
9833
|
}
|
|
9742
9834
|
if (!opts.file) throw new Error("pass -f <manifest file>, or --template <ref>");
|
|
9743
9835
|
const path2 = resolve12(opts.file);
|
|
9744
|
-
const { id:
|
|
9836
|
+
const { id: id2, manifest } = readManifestFile(path2);
|
|
9745
9837
|
try {
|
|
9746
|
-
if (!
|
|
9838
|
+
if (!id2) {
|
|
9747
9839
|
if (opts.dryRun) {
|
|
9748
9840
|
console.log(`No agent id in ${opts.file}: sky agent apply would create a new agent.`);
|
|
9749
9841
|
return;
|
|
@@ -9754,19 +9846,19 @@ agent.command("apply").description(`make an agent what a manifest file declares
|
|
|
9754
9846
|
return;
|
|
9755
9847
|
}
|
|
9756
9848
|
const query = opts.dryRun ? "?dry_run=true" : "";
|
|
9757
|
-
const result = await api("PUT", `/agents/${encodeURIComponent(
|
|
9758
|
-
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);
|
|
9759
9851
|
} catch (error) {
|
|
9760
9852
|
const issues = error instanceof ApiError && Array.isArray(error.details.issues) ? error.details.issues : [];
|
|
9761
9853
|
if (!issues.length) throw error;
|
|
9762
|
-
throw new Error(refusalLines(opts.file,
|
|
9854
|
+
throw new Error(refusalLines(opts.file, readFileSync27(path2, "utf8"), issues).join("\n"));
|
|
9763
9855
|
}
|
|
9764
9856
|
})
|
|
9765
9857
|
);
|
|
9766
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(
|
|
9767
|
-
run2(async (
|
|
9768
|
-
const { manifest, version } = await api("GET", `/agents/${encodeURIComponent(
|
|
9769
|
-
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);
|
|
9770
9862
|
if (!opts.output) {
|
|
9771
9863
|
process.stdout.write(text2);
|
|
9772
9864
|
return;
|
|
@@ -9788,25 +9880,25 @@ agent.command("record").description("how each harness and model did, as the sess
|
|
|
9788
9880
|
})
|
|
9789
9881
|
);
|
|
9790
9882
|
agent.command("archive <id>").description("retire the spec \u2014 read-only, running sessions unaffected (admin scope)").action(
|
|
9791
|
-
run2(async (
|
|
9792
|
-
await api("POST", `/agents/${encodeURIComponent(
|
|
9793
|
-
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.`);
|
|
9794
9886
|
})
|
|
9795
9887
|
);
|
|
9796
9888
|
agent.command("destroy <id>").description("delete the spec with no live sessions, or archive to preserve deleted session history (admin scope)").action(
|
|
9797
|
-
run2(async (
|
|
9798
|
-
const result = await api("DELETE", `/agents/${encodeURIComponent(
|
|
9799
|
-
if (result.outcome === "deleted") console.log(`Deleted ${
|
|
9800
|
-
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.`);
|
|
9801
9893
|
else throw new Error("The server did not report whether the agent was deleted or archived.");
|
|
9802
9894
|
})
|
|
9803
9895
|
);
|
|
9804
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(
|
|
9805
9897
|
run2(
|
|
9806
|
-
async (
|
|
9898
|
+
async (id2, text2, opts) => sendAndFollow(await resolveSessionRef(id2), text2 ?? "", opts)
|
|
9807
9899
|
)
|
|
9808
9900
|
);
|
|
9809
|
-
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)));
|
|
9810
9902
|
var session = program.command("session").description("sessions: the running instances of an agent");
|
|
9811
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(
|
|
9812
9904
|
run2(async (sessionId, requestId2) => {
|
|
@@ -9884,10 +9976,10 @@ session.command("list [agent]").option("--limit <n>", "how many of the newest se
|
|
|
9884
9976
|
})
|
|
9885
9977
|
);
|
|
9886
9978
|
session.command("show <id>").action(
|
|
9887
|
-
run2(async (
|
|
9979
|
+
run2(async (id2) => {
|
|
9888
9980
|
const { session: s } = await api(
|
|
9889
9981
|
"GET",
|
|
9890
|
-
`/sessions/${encodeURIComponent(
|
|
9982
|
+
`/sessions/${encodeURIComponent(id2)}`
|
|
9891
9983
|
);
|
|
9892
9984
|
console.log(`${s.id}${s.default ? " [default]" : ""}`);
|
|
9893
9985
|
console.log(` agent ${s.agentId ?? "-"}`);
|
|
@@ -9897,29 +9989,29 @@ session.command("show <id>").action(
|
|
|
9897
9989
|
if (s.executor) console.log(` runs ${s.executor.kind}${s.executor.movedTo ? ` \u2192 ${s.executor.movedTo}` : ""}`);
|
|
9898
9990
|
})
|
|
9899
9991
|
);
|
|
9900
|
-
function failWithInterruptHint(error,
|
|
9992
|
+
function failWithInterruptHint(error, id2) {
|
|
9901
9993
|
if (error instanceof ApiError && error.code === "session_running") {
|
|
9902
9994
|
console.error(
|
|
9903
|
-
`sky: session is running \u2014 \`sky session interrupt ${
|
|
9995
|
+
`sky: session is running \u2014 \`sky session interrupt ${id2}\`, wait for idle, then retry`
|
|
9904
9996
|
);
|
|
9905
9997
|
process.exit(1);
|
|
9906
9998
|
}
|
|
9907
9999
|
throw error;
|
|
9908
10000
|
}
|
|
9909
10001
|
session.command("archive <id>").description("irreversibly archive: no new messages, pod torn down, history stays readable").action(
|
|
9910
|
-
run2(async (
|
|
9911
|
-
await api("POST", `/sessions/${encodeURIComponent(
|
|
9912
|
-
(error) => failWithInterruptHint(error,
|
|
10002
|
+
run2(async (id2) => {
|
|
10003
|
+
await api("POST", `/sessions/${encodeURIComponent(id2)}/archive`).catch(
|
|
10004
|
+
(error) => failWithInterruptHint(error, id2)
|
|
9913
10005
|
);
|
|
9914
|
-
console.log(`Archived ${
|
|
10006
|
+
console.log(`Archived ${id2} \u2014 terminated; history stays readable. This is irreversible.`);
|
|
9915
10007
|
})
|
|
9916
10008
|
);
|
|
9917
10009
|
session.command("delete <id>").description("permanently delete the session, its events, and its sandbox").action(
|
|
9918
|
-
run2(async (
|
|
9919
|
-
await api("DELETE", `/sessions/${encodeURIComponent(
|
|
9920
|
-
(error) => failWithInterruptHint(error,
|
|
10010
|
+
run2(async (id2) => {
|
|
10011
|
+
await api("DELETE", `/sessions/${encodeURIComponent(id2)}`).catch(
|
|
10012
|
+
(error) => failWithInterruptHint(error, id2)
|
|
9921
10013
|
);
|
|
9922
|
-
console.log(`Deleted ${
|
|
10014
|
+
console.log(`Deleted ${id2}`);
|
|
9923
10015
|
})
|
|
9924
10016
|
);
|
|
9925
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(
|
|
@@ -9931,10 +10023,10 @@ session.command("chat <ref>").description("interactive REPL over the standing st
|
|
|
9931
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(
|
|
9932
10024
|
run2(async (ref, opts) => {
|
|
9933
10025
|
if (opts.run && opts.all) throw new Error("pass --run <id> or --all, not both");
|
|
9934
|
-
const
|
|
10026
|
+
const id2 = await resolveSessionRef(ref);
|
|
9935
10027
|
const res = await api(
|
|
9936
10028
|
"POST",
|
|
9937
|
-
`/sessions/${encodeURIComponent(
|
|
10029
|
+
`/sessions/${encodeURIComponent(id2)}/interrupt`,
|
|
9938
10030
|
interruptBody(opts)
|
|
9939
10031
|
);
|
|
9940
10032
|
console.log(interruptLine(res));
|
|
@@ -9957,11 +10049,11 @@ session.command("read <ref>").description("what the agent has said since the las
|
|
|
9957
10049
|
);
|
|
9958
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(
|
|
9959
10051
|
run2(async (ref, opts) => {
|
|
9960
|
-
const
|
|
9961
|
-
const path2 = `/sessions/${encodeURIComponent(
|
|
10052
|
+
const id2 = await resolveSessionRef(ref);
|
|
10053
|
+
const path2 = `/sessions/${encodeURIComponent(id2)}/share`;
|
|
9962
10054
|
if (opts.off) {
|
|
9963
10055
|
await api("DELETE", path2);
|
|
9964
|
-
console.log(`Sharing is off for ${
|
|
10056
|
+
console.log(`Sharing is off for ${id2}`);
|
|
9965
10057
|
return;
|
|
9966
10058
|
}
|
|
9967
10059
|
const link2 = await api("POST", path2, {
|
|
@@ -9975,11 +10067,11 @@ session.command("share <ref>").description("print the session's share link, turn
|
|
|
9975
10067
|
var personLine = (person) => [person.user_id, person.name?.trim() || person.email?.split("@")[0] || "-", person.email ?? ""].join(" ");
|
|
9976
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(
|
|
9977
10069
|
run2(async (ref, opts) => {
|
|
9978
|
-
const
|
|
10070
|
+
const id2 = encodeURIComponent(await resolveSessionRef(ref));
|
|
9979
10071
|
const [people, present, assigned] = await Promise.all([
|
|
9980
|
-
api("GET", `/sessions/${
|
|
9981
|
-
api("GET", `/sessions/${
|
|
9982
|
-
api("GET", `/sessions/${
|
|
10072
|
+
api("GET", `/sessions/${id2}/people`),
|
|
10073
|
+
api("GET", `/sessions/${id2}/presence`),
|
|
10074
|
+
api("GET", `/sessions/${id2}/assign`)
|
|
9983
10075
|
]);
|
|
9984
10076
|
if (opts.json) {
|
|
9985
10077
|
console.log(JSON.stringify({ people: people.people, present: present.people, assignee: assigned.assignee }, null, 2));
|
|
@@ -9995,32 +10087,32 @@ session.command("people <ref>").description("everyone who may send the session t
|
|
|
9995
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(
|
|
9996
10088
|
run2(async (ref, userId, opts) => {
|
|
9997
10089
|
if (Boolean(userId) === Boolean(opts.clear)) throw new Error("pass a user id, or --clear");
|
|
9998
|
-
const
|
|
9999
|
-
const { assignee } = await api("PUT", `/sessions/${encodeURIComponent(
|
|
10000
|
-
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`);
|
|
10001
10093
|
})
|
|
10002
10094
|
);
|
|
10003
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(
|
|
10004
10096
|
run2(async (ref, opts) => {
|
|
10005
|
-
const
|
|
10006
|
-
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")}`);
|
|
10007
10099
|
if (opts.json) {
|
|
10008
10100
|
console.log(JSON.stringify(usage, null, 2));
|
|
10009
10101
|
return;
|
|
10010
10102
|
}
|
|
10011
10103
|
const t = usage.totals;
|
|
10012
|
-
console.log(`${
|
|
10104
|
+
console.log(`${id2}: $${t.billedCostUsd.toFixed(4)} billed, ${t.turns} model usage records, ${t.inputTokens} in / ${t.outputTokens} out tokens`);
|
|
10013
10105
|
for (const entry of usage.entries) {
|
|
10014
10106
|
console.log(` ${entry.at} ${entry.kind.padEnd(16)} ${(entry.model ?? "").padEnd(24)} $${entry.billedCostUsd.toFixed(4)}`);
|
|
10015
10107
|
}
|
|
10016
10108
|
})
|
|
10017
10109
|
);
|
|
10018
10110
|
var sessionResources = session.command("resources").description("files and GitHub repositories mounted into a session's working directory");
|
|
10019
|
-
var resourcesPath = (
|
|
10111
|
+
var resourcesPath = (id2) => `/sessions/${encodeURIComponent(id2)}/resources`;
|
|
10020
10112
|
sessionResources.command("list <ref>").description("the session's resources, oldest first").action(
|
|
10021
10113
|
run2(async (ref) => {
|
|
10022
|
-
const
|
|
10023
|
-
const { data } = await api("GET", resourcesPath(
|
|
10114
|
+
const id2 = await resolveSessionRef(ref);
|
|
10115
|
+
const { data } = await api("GET", resourcesPath(id2));
|
|
10024
10116
|
if (!data.length) {
|
|
10025
10117
|
console.log("No resources. `sky session resources add <session> <path>` mounts a file.");
|
|
10026
10118
|
return;
|
|
@@ -10030,28 +10122,28 @@ sessionResources.command("list <ref>").description("the session's resources, old
|
|
|
10030
10122
|
);
|
|
10031
10123
|
sessionResources.command("get <ref> <rid>").description("one resource, as JSON").action(
|
|
10032
10124
|
run2(async (ref, rid) => {
|
|
10033
|
-
const
|
|
10034
|
-
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));
|
|
10035
10127
|
})
|
|
10036
10128
|
);
|
|
10037
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(
|
|
10038
10130
|
run2(async (ref, spec) => {
|
|
10039
|
-
const
|
|
10040
|
-
const added = await api("POST", resourcesPath(
|
|
10131
|
+
const id2 = await resolveSessionRef(ref);
|
|
10132
|
+
const added = await api("POST", resourcesPath(id2), await fileResource(spec));
|
|
10041
10133
|
console.log(renderResource(added));
|
|
10042
10134
|
})
|
|
10043
10135
|
);
|
|
10044
10136
|
sessionResources.command("rm <ref> <rid>").description("remove a mounted file (repositories stay for the session's lifetime)").action(
|
|
10045
10137
|
run2(async (ref, rid) => {
|
|
10046
|
-
const
|
|
10047
|
-
const gone = await api("DELETE", `${resourcesPath(
|
|
10138
|
+
const id2 = await resolveSessionRef(ref);
|
|
10139
|
+
const gone = await api("DELETE", `${resourcesPath(id2)}/${encodeURIComponent(rid)}`);
|
|
10048
10140
|
console.log(`Removed ${gone.id}`);
|
|
10049
10141
|
})
|
|
10050
10142
|
);
|
|
10051
10143
|
sessionResources.command("rotate <ref> <rid> <token>").description("replace a repository's token; the sandbox's egress policy is updated in place").action(
|
|
10052
10144
|
run2(async (ref, rid, token) => {
|
|
10053
|
-
const
|
|
10054
|
-
const updated = await api("POST", `${resourcesPath(
|
|
10145
|
+
const id2 = await resolveSessionRef(ref);
|
|
10146
|
+
const updated = await api("POST", `${resourcesPath(id2)}/${encodeURIComponent(rid)}`, {
|
|
10055
10147
|
authorization_token: token
|
|
10056
10148
|
});
|
|
10057
10149
|
console.log(`Rotated ${updated.id}`);
|
|
@@ -10059,14 +10151,14 @@ sessionResources.command("rotate <ref> <rid> <token>").description("replace a re
|
|
|
10059
10151
|
);
|
|
10060
10152
|
var runQuery = (opts) => opts.run ? `?run_id=${encodeURIComponent(opts.run)}` : "";
|
|
10061
10153
|
var sessionPorts = session.command("ports").description("local servers in the session's pod, each exposed on an origin of its own");
|
|
10062
|
-
var portsPath = (
|
|
10154
|
+
var portsPath = (id2) => `/sessions/${encodeURIComponent(id2)}/ports`;
|
|
10063
10155
|
function renderPort(p) {
|
|
10064
10156
|
return `${String(p.port).padEnd(5)} ${p.visibility.padEnd(7)} ${p.url}`;
|
|
10065
10157
|
}
|
|
10066
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(
|
|
10067
10159
|
run2(async (ref, opts) => {
|
|
10068
|
-
const
|
|
10069
|
-
const { ports } = await api("GET", `${portsPath(
|
|
10160
|
+
const id2 = await resolveSessionRef(ref);
|
|
10161
|
+
const { ports } = await api("GET", `${portsPath(id2)}${runQuery(opts)}`);
|
|
10070
10162
|
if (!ports.length) {
|
|
10071
10163
|
console.log("No exposed ports. `sky session ports expose <session> <port>` exposes one.");
|
|
10072
10164
|
return;
|
|
@@ -10076,30 +10168,30 @@ sessionPorts.command("list <ref>").description("the session's exposed ports, old
|
|
|
10076
10168
|
);
|
|
10077
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(
|
|
10078
10170
|
run2(async (ref, port, opts) => {
|
|
10079
|
-
const
|
|
10080
|
-
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" });
|
|
10081
10173
|
console.log(renderPort(exposed));
|
|
10082
10174
|
})
|
|
10083
10175
|
);
|
|
10084
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(
|
|
10085
10177
|
run2(async (ref, port, opts) => {
|
|
10086
|
-
const
|
|
10087
|
-
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)}`, {});
|
|
10088
10180
|
console.log(grant.url);
|
|
10089
10181
|
})
|
|
10090
10182
|
);
|
|
10091
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(
|
|
10092
10184
|
run2(async (ref, port, opts) => {
|
|
10093
|
-
const
|
|
10094
|
-
await api("DELETE", `${portsPath(
|
|
10185
|
+
const id2 = await resolveSessionRef(ref);
|
|
10186
|
+
await api("DELETE", `${portsPath(id2)}/${encodeURIComponent(port)}${runQuery(opts)}`);
|
|
10095
10187
|
console.log(`Revoked port ${port}`);
|
|
10096
10188
|
})
|
|
10097
10189
|
);
|
|
10098
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(
|
|
10099
10191
|
run2(async (ref, opts) => {
|
|
10100
|
-
const
|
|
10192
|
+
const id2 = await resolveSessionRef(ref);
|
|
10101
10193
|
const patch = accessPatch(opts);
|
|
10102
|
-
const path2 = `/sessions/${encodeURIComponent(
|
|
10194
|
+
const path2 = `/sessions/${encodeURIComponent(id2)}/access`;
|
|
10103
10195
|
const access = await api(Object.keys(patch).length ? "PATCH" : "GET", path2, Object.keys(patch).length ? patch : void 0);
|
|
10104
10196
|
for (const line2 of renderAccess(access)) console.log(line2);
|
|
10105
10197
|
})
|
|
@@ -10113,35 +10205,35 @@ session.command("shared").description("sessions other people shared with you to
|
|
|
10113
10205
|
);
|
|
10114
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(
|
|
10115
10207
|
run2(async (ref, model, opts) => {
|
|
10116
|
-
const
|
|
10208
|
+
const id2 = await resolveSessionRef(ref);
|
|
10117
10209
|
const change = engineChange(model, opts.thinking);
|
|
10118
|
-
const { session: s } = change ? await api("PATCH", `/sessions/${encodeURIComponent(
|
|
10119
|
-
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)" : ""}`);
|
|
10120
10212
|
})
|
|
10121
10213
|
);
|
|
10122
|
-
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(
|
|
10123
10215
|
run2(async (ref, mode) => {
|
|
10124
|
-
if (mode !== void 0 &&
|
|
10125
|
-
const
|
|
10126
|
-
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)}`;
|
|
10127
10219
|
if (mode) await api("PATCH", path2, { metadata: { permission_mode: mode } });
|
|
10128
10220
|
const { session: s } = await api("GET", `${path2}?include=permission_mode`);
|
|
10129
10221
|
const shown = s.permission_mode;
|
|
10130
10222
|
const stricter = shown.mode === "allow" && shown.effective === "always_ask" ? " (the agent's own setting asks)" : "";
|
|
10131
|
-
console.log(`${
|
|
10223
|
+
console.log(`${id2}: ${shown.mode === "ask" ? "ask" : "allow all"}${stricter}${shown.available ? "" : " (ask is not available on this chat)"}`);
|
|
10132
10224
|
})
|
|
10133
10225
|
);
|
|
10134
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(
|
|
10135
10227
|
run2(async (ref, targetAgent, message2, opts) => {
|
|
10136
|
-
const
|
|
10137
|
-
const done = await handoff(
|
|
10138
|
-
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"})`);
|
|
10139
10231
|
})
|
|
10140
10232
|
);
|
|
10141
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(
|
|
10142
10234
|
run2(async (ref, targetAgent, opts) => {
|
|
10143
|
-
const
|
|
10144
|
-
const done = await fork(
|
|
10235
|
+
const id2 = await resolveSessionRef(ref);
|
|
10236
|
+
const done = await fork(id2, targetAgent, {
|
|
10145
10237
|
fromMessage: opts.fromMessage,
|
|
10146
10238
|
model: opts.model,
|
|
10147
10239
|
thinking: opts.thinking,
|
|
@@ -10154,8 +10246,8 @@ session.command("fork <ref> <targetAgent>").description("fork the session into a
|
|
|
10154
10246
|
);
|
|
10155
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(
|
|
10156
10248
|
run2(async (ref, opts) => {
|
|
10157
|
-
const
|
|
10158
|
-
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}`) });
|
|
10159
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.");
|
|
10160
10252
|
if (moved.converted) {
|
|
10161
10253
|
const { toolCalls, summarised } = moved.converted;
|
|
@@ -10166,17 +10258,17 @@ session.command("continue-here <ref>").description("move an idle Claude Code or
|
|
|
10166
10258
|
);
|
|
10167
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(
|
|
10168
10260
|
run2(async (ref) => {
|
|
10169
|
-
const
|
|
10170
|
-
await api("POST", `/sessions/${encodeURIComponent(
|
|
10171
|
-
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`);
|
|
10172
10264
|
})
|
|
10173
10265
|
);
|
|
10174
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(
|
|
10175
10267
|
run2(async (ref, opts) => {
|
|
10176
|
-
const
|
|
10268
|
+
const id2 = await resolveSessionRef(ref);
|
|
10177
10269
|
const read = async (path2) => {
|
|
10178
10270
|
try {
|
|
10179
|
-
return await api("GET", `/sessions/${encodeURIComponent(
|
|
10271
|
+
return await api("GET", `/sessions/${encodeURIComponent(id2)}/mirror/${path2}`);
|
|
10180
10272
|
} catch (error) {
|
|
10181
10273
|
if (error instanceof ApiError && error.status === 404) return null;
|
|
10182
10274
|
throw error;
|
|
@@ -10272,7 +10364,7 @@ sessionSandbox.command("exec <ref> <command...>").description("run a shell comma
|
|
|
10272
10364
|
);
|
|
10273
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(
|
|
10274
10366
|
run2(async (ref, path2, file, opts) => {
|
|
10275
|
-
const bytes = file ?
|
|
10367
|
+
const bytes = file ? readFileSync27(file) : readFileSync27(0);
|
|
10276
10368
|
const { path: at, size: size2 } = await api(
|
|
10277
10369
|
"PUT",
|
|
10278
10370
|
`/sessions/${encodeURIComponent(await resolveSessionRef(ref))}/sandbox/files`,
|
|
@@ -10282,8 +10374,8 @@ sessionSandbox.command("write <ref> <path> [file]").description("write a file in
|
|
|
10282
10374
|
})
|
|
10283
10375
|
);
|
|
10284
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(
|
|
10285
|
-
run2(async (
|
|
10286
|
-
const res = await showInPanel(
|
|
10377
|
+
run2(async (id2, opts) => {
|
|
10378
|
+
const res = await showInPanel(id2, opts);
|
|
10287
10379
|
console.log(res.opens_on?.length === 1 ? `shown (opens on the ${res.opens_on[0]} only)` : "shown");
|
|
10288
10380
|
})
|
|
10289
10381
|
);
|
|
@@ -10296,8 +10388,8 @@ session.command("overview <ref>").description("where a session stands: its goal
|
|
|
10296
10388
|
var sessionBrowser = session.command("browser").description("the sandbox browser for a session (start, show status, stop)");
|
|
10297
10389
|
sessionBrowser.command("show <ref>").description("show the sandbox browser status for a session").option("--json", "print as JSON").action(
|
|
10298
10390
|
run2(async (ref, opts) => {
|
|
10299
|
-
const
|
|
10300
|
-
const { browser } = await api("GET", `/sessions/${encodeURIComponent(
|
|
10391
|
+
const id2 = await resolveSessionRef(ref);
|
|
10392
|
+
const { browser } = await api("GET", `/sessions/${encodeURIComponent(id2)}/browser`);
|
|
10301
10393
|
if (opts.json) {
|
|
10302
10394
|
console.log(JSON.stringify(browser, null, 2));
|
|
10303
10395
|
return;
|
|
@@ -10312,8 +10404,8 @@ sessionBrowser.command("show <ref>").description("show the sandbox browser statu
|
|
|
10312
10404
|
);
|
|
10313
10405
|
sessionBrowser.command("start <ref>").description("start a browser for a session (provisions it if not running)").option("--json", "print as JSON").action(
|
|
10314
10406
|
run2(async (ref, opts) => {
|
|
10315
|
-
const
|
|
10316
|
-
const { browser } = await api("POST", `/sessions/${encodeURIComponent(
|
|
10407
|
+
const id2 = await resolveSessionRef(ref);
|
|
10408
|
+
const { browser } = await api("POST", `/sessions/${encodeURIComponent(id2)}/browser`, {});
|
|
10317
10409
|
if (opts.json) {
|
|
10318
10410
|
console.log(JSON.stringify(browser, null, 2));
|
|
10319
10411
|
return;
|
|
@@ -10324,8 +10416,8 @@ sessionBrowser.command("start <ref>").description("start a browser for a session
|
|
|
10324
10416
|
);
|
|
10325
10417
|
sessionBrowser.command("stop <ref>").description("stop the browser for a session").action(
|
|
10326
10418
|
run2(async (ref) => {
|
|
10327
|
-
const
|
|
10328
|
-
const { browser } = await api("DELETE", `/sessions/${encodeURIComponent(
|
|
10419
|
+
const id2 = await resolveSessionRef(ref);
|
|
10420
|
+
const { browser } = await api("DELETE", `/sessions/${encodeURIComponent(id2)}/browser`);
|
|
10329
10421
|
const b = browser;
|
|
10330
10422
|
console.log(b ? b.status ?? "stopped" : "stopped");
|
|
10331
10423
|
})
|
|
@@ -10353,8 +10445,8 @@ sessionBrowser.command("screenshot <ref>").description("save a picture of the se
|
|
|
10353
10445
|
);
|
|
10354
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(
|
|
10355
10447
|
run2(async (ref, urls, opts) => {
|
|
10356
|
-
const
|
|
10357
|
-
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 });
|
|
10358
10450
|
if (opts.json) {
|
|
10359
10451
|
console.log(JSON.stringify(result, null, 2));
|
|
10360
10452
|
return;
|
|
@@ -10518,14 +10610,14 @@ registerGatewayCommands(gatewayCommand);
|
|
|
10518
10610
|
registerSearchMediaCommands(program);
|
|
10519
10611
|
var emailCommand = program.command("email").description("send transactional email from your workspace, within its daily limit");
|
|
10520
10612
|
registerEmailCommands(emailCommand);
|
|
10521
|
-
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 (
|
|
10522
|
-
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));
|
|
10523
10615
|
}));
|
|
10524
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(
|
|
10525
|
-
run2(async (
|
|
10617
|
+
run2(async (id2, name, opts) => {
|
|
10526
10618
|
const value = await readSecretValue(`Value for ${name}: `);
|
|
10527
10619
|
if (!value) throw new ApiError(400, "no_value", "no value provided");
|
|
10528
|
-
const saved = await api("POST", `/sessions/${encodeURIComponent(await resolveSessionRef(
|
|
10620
|
+
const saved = await api("POST", `/sessions/${encodeURIComponent(await resolveSessionRef(id2))}/secrets`, {
|
|
10529
10621
|
name,
|
|
10530
10622
|
value,
|
|
10531
10623
|
host: opts.host,
|
|
@@ -10536,22 +10628,25 @@ session.command("secret-add <id> <name>").description("save a credential (value
|
|
|
10536
10628
|
})
|
|
10537
10629
|
);
|
|
10538
10630
|
var secrets = program.command("secrets").description("agent secrets (values write-only)");
|
|
10539
|
-
secrets.command("set <id> <pairs...>").description("set KEY=VALUE pairs on the agent").action(
|
|
10540
|
-
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");
|
|
10541
10635
|
for (const pair of pairs) {
|
|
10542
10636
|
const eq = pair.indexOf("=");
|
|
10543
10637
|
if (eq < 1) throw new Error(`expected KEY=VALUE, got ${pair}`);
|
|
10544
10638
|
const key = pair.slice(0, eq);
|
|
10545
|
-
await api("PUT", `/agents/${encodeURIComponent(
|
|
10546
|
-
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 } : {} }
|
|
10547
10642
|
});
|
|
10548
10643
|
console.log(`set ${key}`);
|
|
10549
10644
|
}
|
|
10550
10645
|
})
|
|
10551
10646
|
);
|
|
10552
10647
|
secrets.command("list <id>").action(
|
|
10553
|
-
run2(async (
|
|
10554
|
-
const { secrets: keys2 } = await api("GET", `/agents/${encodeURIComponent(
|
|
10648
|
+
run2(async (id2) => {
|
|
10649
|
+
const { secrets: keys2 } = await api("GET", `/agents/${encodeURIComponent(id2)}/secrets`);
|
|
10555
10650
|
if (!keys2.length) console.log("no secrets set");
|
|
10556
10651
|
for (const s of keys2) {
|
|
10557
10652
|
console.log(`\u25CF ${s.key}${s.description ? ` \u2014 ${s.description}` : ""}`);
|
|
@@ -10559,10 +10654,10 @@ secrets.command("list <id>").action(
|
|
|
10559
10654
|
})
|
|
10560
10655
|
);
|
|
10561
10656
|
secrets.command("unset <id> <key>").action(
|
|
10562
|
-
run2(async (
|
|
10657
|
+
run2(async (id2, key) => {
|
|
10563
10658
|
await api(
|
|
10564
10659
|
"DELETE",
|
|
10565
|
-
`/agents/${encodeURIComponent(
|
|
10660
|
+
`/agents/${encodeURIComponent(id2)}/secrets/${encodeURIComponent(key)}`
|
|
10566
10661
|
);
|
|
10567
10662
|
console.log(`unset ${key}`);
|
|
10568
10663
|
})
|
|
@@ -10861,43 +10956,43 @@ files.command("list").description("list your uploads, or one session's files wit
|
|
|
10861
10956
|
);
|
|
10862
10957
|
files.command("get <id>").description("show one file's metadata").action(
|
|
10863
10958
|
run2(
|
|
10864
|
-
async (
|
|
10959
|
+
async (id2) => console.log(JSON.stringify(await api("GET", `/files/${encodeURIComponent(id2)}`), null, 2))
|
|
10865
10960
|
)
|
|
10866
10961
|
);
|
|
10867
10962
|
files.command("rm <id>").description("delete a file (a session that already received it keeps its copy)").action(
|
|
10868
|
-
run2(async (
|
|
10869
|
-
await api("DELETE", `/files/${encodeURIComponent(
|
|
10870
|
-
console.log(`Deleted ${
|
|
10963
|
+
run2(async (id2) => {
|
|
10964
|
+
await api("DELETE", `/files/${encodeURIComponent(id2)}`);
|
|
10965
|
+
console.log(`Deleted ${id2}`);
|
|
10871
10966
|
})
|
|
10872
10967
|
);
|
|
10873
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(
|
|
10874
|
-
run2(async (
|
|
10969
|
+
run2(async (id2, opts) => {
|
|
10875
10970
|
const expires = opts.expires === void 0 ? void 0 : Number(opts.expires);
|
|
10876
10971
|
if (expires !== void 0 && (!Number.isSafeInteger(expires) || expires < 60 || expires > 604800)) throw new Error("--expires must be an integer from 60 to 604800");
|
|
10877
|
-
const link2 = await api("POST", `/files/${encodeURIComponent(
|
|
10972
|
+
const link2 = await api("POST", `/files/${encodeURIComponent(id2)}/links`, expires === void 0 ? {} : { expires_in_seconds: expires });
|
|
10878
10973
|
console.log(`${link2.url}
|
|
10879
10974
|
expires ${link2.expires_at}${link2.id ? `
|
|
10880
|
-
revoke with: sky files unlink ${
|
|
10975
|
+
revoke with: sky files unlink ${id2} ${link2.id}` : ""}`);
|
|
10881
10976
|
})
|
|
10882
10977
|
);
|
|
10883
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(
|
|
10884
|
-
run2(async (
|
|
10885
|
-
const listed = await api("GET", `/files/${encodeURIComponent(
|
|
10979
|
+
run2(async (id2, opts) => {
|
|
10980
|
+
const listed = await api("GET", `/files/${encodeURIComponent(id2)}/links`);
|
|
10886
10981
|
if (opts.json) return void console.log(JSON.stringify(listed, null, 2));
|
|
10887
10982
|
if (!listed.data.length) return void console.log("no links");
|
|
10888
10983
|
for (const link2 of listed.data) console.log(`${link2.id} ${link2.status} expires ${link2.expires_at} by ${link2.created_by}`);
|
|
10889
10984
|
})
|
|
10890
10985
|
);
|
|
10891
10986
|
files.command("unlink <id> <linkId>").description("revoke one download link of a file at once; the file and its other links stay").action(
|
|
10892
|
-
run2(async (
|
|
10893
|
-
const link2 = await api("DELETE", `/files/${encodeURIComponent(
|
|
10987
|
+
run2(async (id2, linkId) => {
|
|
10988
|
+
const link2 = await api("DELETE", `/files/${encodeURIComponent(id2)}/links/${encodeURIComponent(linkId)}`);
|
|
10894
10989
|
console.log(`Revoked ${link2.id}`);
|
|
10895
10990
|
})
|
|
10896
10991
|
);
|
|
10897
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(
|
|
10898
|
-
run2(async (
|
|
10899
|
-
const resource = await api("POST", `/files/${encodeURIComponent(
|
|
10900
|
-
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}` : ""}`);
|
|
10901
10996
|
})
|
|
10902
10997
|
);
|
|
10903
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(
|
|
@@ -10910,12 +11005,12 @@ files.command("search <query>").description('search your uploads by name and by
|
|
|
10910
11005
|
})
|
|
10911
11006
|
);
|
|
10912
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(
|
|
10913
|
-
run2(async (
|
|
11008
|
+
run2(async (id2, opts) => {
|
|
10914
11009
|
const params = new URLSearchParams();
|
|
10915
11010
|
if (opts.offset) params.set("offset", opts.offset);
|
|
10916
11011
|
if (opts.maxBytes) params.set("max_bytes", opts.maxBytes);
|
|
10917
11012
|
if (opts.base64) params.set("encoding", "base64");
|
|
10918
|
-
const part = await api("GET", `/files/${encodeURIComponent(
|
|
11013
|
+
const part = await api("GET", `/files/${encodeURIComponent(id2)}/text${params.size ? `?${params}` : ""}`);
|
|
10919
11014
|
process.stdout.write(part.content);
|
|
10920
11015
|
if (part.next_offset !== null) console.error(`
|
|
10921
11016
|
\u2026 more: --offset ${part.next_offset}`);
|
|
@@ -10924,14 +11019,14 @@ files.command("read <id>").description("print part of a file's text (up to 256 K
|
|
|
10924
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(
|
|
10925
11020
|
run2(async (filename, opts) => {
|
|
10926
11021
|
if (opts.text !== void 0 && opts.textFile !== void 0) throw new Error("give --text or --text-file, not both");
|
|
10927
|
-
const content = opts.text ??
|
|
11022
|
+
const content = opts.text ?? readFileSync27(!opts.textFile || opts.textFile === "-" ? 0 : opts.textFile, "utf8");
|
|
10928
11023
|
const file = await api("POST", "/files/text", { filename, content, ...opts.mimeType ? { mime_type: opts.mimeType } : {}, ...opts.expires ? { expires_in_seconds: Number(opts.expires) } : {} });
|
|
10929
11024
|
console.log(`${file.id} ${file.filename} ${file.mime_type} ${file.size_bytes} bytes`);
|
|
10930
11025
|
})
|
|
10931
11026
|
);
|
|
10932
11027
|
files.command("download <id>").description("download a session file's bytes").requiredOption("-o, --out <path>", "where to write the bytes").action(
|
|
10933
|
-
run2(async (
|
|
10934
|
-
const written = await downloadFileTo(
|
|
11028
|
+
run2(async (id2, opts) => {
|
|
11029
|
+
const written = await downloadFileTo(id2, opts.out);
|
|
10935
11030
|
console.log(`Wrote ${written} bytes to ${opts.out}`);
|
|
10936
11031
|
})
|
|
10937
11032
|
);
|
|
@@ -10986,7 +11081,7 @@ session.command("file-get <session> <path>").description("read one shared file o
|
|
|
10986
11081
|
);
|
|
10987
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(
|
|
10988
11083
|
run2(async (sessionId, path2, local) => {
|
|
10989
|
-
const { file, conflict } = await writeTaskFile(sessionId, path2,
|
|
11084
|
+
const { file, conflict } = await writeTaskFile(sessionId, path2, readFileSync27(local), mediaTypeFor(local));
|
|
10990
11085
|
console.log(`${renderTaskFile(file)}${conflict ? " (replaced a version you had not seen)" : ""}`);
|
|
10991
11086
|
})
|
|
10992
11087
|
);
|
|
@@ -11108,10 +11203,10 @@ session.command("verdict <session> <did-the-job>").description("record whether t
|
|
|
11108
11203
|
var plugins = program.command("plugins").description("Claude Code plugins in the workspace: install from GitHub, list, remove");
|
|
11109
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(
|
|
11110
11205
|
run2(async (plugin, opts) => {
|
|
11111
|
-
const
|
|
11112
|
-
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`);
|
|
11113
11208
|
if (opts.json) return void console.log(JSON.stringify(listed, null, 2));
|
|
11114
|
-
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}` : ""}.`);
|
|
11115
11210
|
for (const template of listed.templates) console.log(`${template.ref}
|
|
11116
11211
|
${template.description || template.name}`);
|
|
11117
11212
|
})
|
|
@@ -11139,14 +11234,14 @@ plugins.command("list").description("the workspace's installed plugin bundles; w
|
|
|
11139
11234
|
})
|
|
11140
11235
|
);
|
|
11141
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(
|
|
11142
|
-
run2(async (
|
|
11143
|
-
const plugin = await showPlugin(
|
|
11237
|
+
run2(async (id2, opts) => {
|
|
11238
|
+
const plugin = await showPlugin(id2);
|
|
11144
11239
|
console.log(opts.json ? JSON.stringify(plugin) : renderPlugin(plugin));
|
|
11145
11240
|
})
|
|
11146
11241
|
);
|
|
11147
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(
|
|
11148
|
-
run2(async (
|
|
11149
|
-
const ref =
|
|
11243
|
+
run2(async (id2, opts) => {
|
|
11244
|
+
const ref = id2.startsWith("bundle:") ? id2 : `bundle:${id2}`;
|
|
11150
11245
|
const answer = await api("POST", `/plugins/${encodeURIComponent(ref)}/check`);
|
|
11151
11246
|
if (opts.json) {
|
|
11152
11247
|
console.log(JSON.stringify(answer, null, 2));
|
|
@@ -11170,9 +11265,9 @@ plugins.command("install <source>").description("install or update a plugin: git
|
|
|
11170
11265
|
})
|
|
11171
11266
|
);
|
|
11172
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(
|
|
11173
|
-
run2(async (
|
|
11268
|
+
run2(async (id2, opts) => {
|
|
11174
11269
|
if (Boolean(opts.task) !== Boolean(opts.request)) throw new Error("--task and --request go together");
|
|
11175
|
-
const answer = await addPlugin(
|
|
11270
|
+
const answer = await addPlugin(id2, opts);
|
|
11176
11271
|
console.log(opts.json ? JSON.stringify(answer) : renderAdd(answer));
|
|
11177
11272
|
})
|
|
11178
11273
|
);
|
|
@@ -11197,8 +11292,8 @@ plugins.command("rm <id>").description("remove a plugin or disconnect it, by id
|
|
|
11197
11292
|
})
|
|
11198
11293
|
);
|
|
11199
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(
|
|
11200
|
-
run2(async (
|
|
11201
|
-
const answer = await updateMcpServer(
|
|
11295
|
+
run2(async (id2, opts) => {
|
|
11296
|
+
const answer = await updateMcpServer(id2, opts);
|
|
11202
11297
|
if (opts.json) return void console.log(JSON.stringify(answer));
|
|
11203
11298
|
console.log(`Saved ${answer.name} (${answer.plugin_id})${answer.token_changed ? `; token changed${answer.check ? `, check: ${answer.check}` : ""}` : ""}.`);
|
|
11204
11299
|
})
|
|
@@ -11211,18 +11306,18 @@ plugins.command("upload <dir>").description("upload a skill directory (SKILL.md
|
|
|
11211
11306
|
})
|
|
11212
11307
|
);
|
|
11213
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(
|
|
11214
|
-
run2(async (
|
|
11309
|
+
run2(async (id2, opts) => {
|
|
11215
11310
|
if (opts.save && opts.rm) throw new Error("pass --save or --rm, not both");
|
|
11216
11311
|
if (opts.save) {
|
|
11217
|
-
const { revision } = await saveSkillPluginRevision(
|
|
11218
|
-
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}`);
|
|
11219
11314
|
}
|
|
11220
11315
|
if (opts.rm) {
|
|
11221
|
-
await deletePluginRevision(
|
|
11222
|
-
return void console.log(`Deleted ${opts.rm} of ${
|
|
11316
|
+
await deletePluginRevision(id2, opts.rm);
|
|
11317
|
+
return void console.log(`Deleted ${opts.rm} of ${id2}`);
|
|
11223
11318
|
}
|
|
11224
|
-
const history3 = await pluginRevisionHistory(
|
|
11225
|
-
if (
|
|
11319
|
+
const history3 = await pluginRevisionHistory(id2);
|
|
11320
|
+
if (id2.startsWith("bundle:")) return void console.log(JSON.stringify(history3, null, 2));
|
|
11226
11321
|
const rows = history3.revisions;
|
|
11227
11322
|
if (opts.json) return void console.log(JSON.stringify(rows, null, 2));
|
|
11228
11323
|
if (!rows.length) return void console.log("no versions");
|
|
@@ -11230,21 +11325,21 @@ plugins.command("revisions <id>").description("saved versions of a skill or bund
|
|
|
11230
11325
|
})
|
|
11231
11326
|
);
|
|
11232
11327
|
plugins.command("cat <id> <revisionId> <path>").description("print one file (e.g. SKILL.md) of a skill plugin's version").action(
|
|
11233
|
-
run2(async (
|
|
11234
|
-
process.stdout.write(await readPluginFile(
|
|
11328
|
+
run2(async (id2, revisionId, path2) => {
|
|
11329
|
+
process.stdout.write(await readPluginFile(id2, revisionId, path2));
|
|
11235
11330
|
})
|
|
11236
11331
|
);
|
|
11237
11332
|
for (const [verb, off] of [["off", true], ["on", false]]) {
|
|
11238
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(
|
|
11239
|
-
run2(async (
|
|
11240
|
-
const answer = await setPluginOff(
|
|
11334
|
+
run2(async (id2, opts) => {
|
|
11335
|
+
const answer = await setPluginOff(id2, opts, off);
|
|
11241
11336
|
console.log(opts.json ? JSON.stringify(answer) : renderOff(answer));
|
|
11242
11337
|
})
|
|
11243
11338
|
);
|
|
11244
11339
|
}
|
|
11245
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(
|
|
11246
|
-
run2(async (
|
|
11247
|
-
const answer = await requestPlugin(
|
|
11341
|
+
run2(async (id2, opts) => {
|
|
11342
|
+
const answer = await requestPlugin(id2, opts.session);
|
|
11248
11343
|
console.log(opts.json ? JSON.stringify(answer) : renderRequest2(answer));
|
|
11249
11344
|
})
|
|
11250
11345
|
);
|
|
@@ -11255,55 +11350,55 @@ var pluginsDraft = plugins.command("draft").description("draft a plugin from a f
|
|
|
11255
11350
|
console.log(opts.json ? JSON.stringify(answer) : renderDraft(answer));
|
|
11256
11351
|
})
|
|
11257
11352
|
);
|
|
11258
|
-
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))));
|
|
11259
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(
|
|
11260
|
-
run2(async (
|
|
11261
|
-
if (!
|
|
11262
|
-
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);
|
|
11263
11358
|
console.log(opts.json ? JSON.stringify(answer) : renderTest(answer));
|
|
11264
11359
|
})
|
|
11265
11360
|
);
|
|
11266
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(
|
|
11267
|
-
run2(async (
|
|
11268
|
-
const answer = await proposePluginDraft(
|
|
11362
|
+
run2(async (id2, opts) => {
|
|
11363
|
+
const answer = await proposePluginDraft(id2, opts.revision, { target: opts.target, note: opts.note });
|
|
11269
11364
|
console.log(opts.json ? JSON.stringify(answer) : renderPropose(answer));
|
|
11270
11365
|
})
|
|
11271
11366
|
);
|
|
11272
|
-
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)))));
|
|
11273
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(
|
|
11274
|
-
run2(async (
|
|
11275
|
-
console.log(JSON.stringify(await sharePlugin(
|
|
11369
|
+
run2(async (id2, opts) => {
|
|
11370
|
+
console.log(JSON.stringify(await sharePlugin(id2, opts)));
|
|
11276
11371
|
})
|
|
11277
11372
|
);
|
|
11278
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(
|
|
11279
|
-
run2(async (
|
|
11374
|
+
run2(async (id2, note, opts) => {
|
|
11280
11375
|
if (!opts.clear && !note?.trim()) throw new Error("Give the note, or --clear to remove it.");
|
|
11281
|
-
console.log(JSON.stringify(await setPluginWhenToUse(
|
|
11376
|
+
console.log(JSON.stringify(await setPluginWhenToUse(id2, opts.connection, opts.clear ? null : note.trim())));
|
|
11282
11377
|
})
|
|
11283
11378
|
);
|
|
11284
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(
|
|
11285
|
-
run2(async (
|
|
11286
|
-
const answer = await pluginShares(
|
|
11380
|
+
run2(async (id2, opts) => {
|
|
11381
|
+
const answer = await pluginShares(id2, opts.connection);
|
|
11287
11382
|
console.log(opts.json ? JSON.stringify(answer) : renderShares(answer));
|
|
11288
11383
|
})
|
|
11289
11384
|
);
|
|
11290
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(
|
|
11291
|
-
run2(async (
|
|
11386
|
+
run2(async (id2, opts) => {
|
|
11292
11387
|
if (opts.action) {
|
|
11293
11388
|
if (opts.url || !opts.session) throw new Error("Use --action with --session, and omit --url");
|
|
11294
|
-
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 })));
|
|
11295
11390
|
return;
|
|
11296
11391
|
}
|
|
11297
11392
|
if (!opts.url) throw new Error("An app call requires --url");
|
|
11298
11393
|
const headers = Object.fromEntries((opts.header ?? []).map((pair) => [pair.slice(0, pair.indexOf(":")).trim(), pair.slice(pair.indexOf(":") + 1).trim()]).filter(([name]) => name));
|
|
11299
|
-
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 })));
|
|
11300
11395
|
})
|
|
11301
11396
|
);
|
|
11302
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(
|
|
11303
|
-
run2(async (
|
|
11398
|
+
run2(async (id2, opts) => {
|
|
11304
11399
|
const target2 = opts.target ?? opts.format;
|
|
11305
11400
|
if (!target2) throw new Error("Pass --target claude-code, codex, grok or mcp");
|
|
11306
|
-
const exported = await exportPlugin(
|
|
11401
|
+
const exported = await exportPlugin(id2, target2);
|
|
11307
11402
|
if (opts.json) return void console.log(JSON.stringify(exported));
|
|
11308
11403
|
const dir = opts.out ?? exported.name;
|
|
11309
11404
|
const written = writeExportFiles(dir, exported.files);
|
|
@@ -11342,18 +11437,18 @@ plugins.command("marketplace").description("write your workspace's plugins as a
|
|
|
11342
11437
|
})
|
|
11343
11438
|
);
|
|
11344
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(
|
|
11345
|
-
run2(async (
|
|
11346
|
-
console.log(JSON.stringify(await unsharePlugin(
|
|
11440
|
+
run2(async (id2, opts) => {
|
|
11441
|
+
console.log(JSON.stringify(await unsharePlugin(id2, opts)));
|
|
11347
11442
|
})
|
|
11348
11443
|
);
|
|
11349
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(
|
|
11350
|
-
run2(async (
|
|
11351
|
-
const answer = await answerPlugin(
|
|
11445
|
+
run2(async (id2, opts) => {
|
|
11446
|
+
const answer = await answerPlugin(id2, opts);
|
|
11352
11447
|
console.log(`${answer.plugin_id} (${answer.connection_id}) is answered by ${answer.session_id}.`);
|
|
11353
11448
|
})
|
|
11354
11449
|
);
|
|
11355
|
-
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 (
|
|
11356
|
-
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)));
|
|
11357
11452
|
}));
|
|
11358
11453
|
for (const [verb, enabled] of [["enable", true], ["disable", false]]) {
|
|
11359
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(
|
|
@@ -11437,7 +11532,7 @@ skills.command("mine").description("your own skills, which follow you to every w
|
|
|
11437
11532
|
);
|
|
11438
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(
|
|
11439
11534
|
run2(async (opts) => {
|
|
11440
|
-
const { loadLocalSkillState } = await import("./local-skills-
|
|
11535
|
+
const { loadLocalSkillState } = await import("./local-skills-RRJCNVLS.js");
|
|
11441
11536
|
const state = loadLocalSkillState();
|
|
11442
11537
|
if (opts.json) return void console.log(JSON.stringify(state, null, 2));
|
|
11443
11538
|
const names = Object.keys(state.skills).sort();
|
|
@@ -11453,7 +11548,7 @@ skills.command("local").description("the skills sky installed in this computer's
|
|
|
11453
11548
|
);
|
|
11454
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(
|
|
11455
11550
|
run2(async (opts) => {
|
|
11456
|
-
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-
|
|
11551
|
+
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-Y47FCKEL.js");
|
|
11457
11552
|
const result = await refreshLocalSkills({ workspace: opts.workspace, dryRun: opts.dryRun });
|
|
11458
11553
|
if (opts.json) return void console.log(JSON.stringify(result, null, 2));
|
|
11459
11554
|
if (!result.checked) return void console.log("no engine that reads skills is installed on this computer");
|
|
@@ -11464,20 +11559,20 @@ ${lines2.join("\n")}` : `Skills from ${result.workspace} are current.`);
|
|
|
11464
11559
|
);
|
|
11465
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(
|
|
11466
11561
|
run2(async (name) => {
|
|
11467
|
-
const { pinLocalSkill } = await import("./local-skills-
|
|
11562
|
+
const { pinLocalSkill } = await import("./local-skills-RRJCNVLS.js");
|
|
11468
11563
|
const pinned = pinLocalSkill(name);
|
|
11469
11564
|
console.log(`${name} stays at ${pinned.revision_id} on this computer`);
|
|
11470
11565
|
})
|
|
11471
11566
|
);
|
|
11472
11567
|
skills.command("unpin <name>").description("let a pinned skill follow its updates again from the next sync").action(
|
|
11473
11568
|
run2(async (name) => {
|
|
11474
|
-
const { unpinLocalSkill } = await import("./local-skills-
|
|
11569
|
+
const { unpinLocalSkill } = await import("./local-skills-RRJCNVLS.js");
|
|
11475
11570
|
console.log(unpinLocalSkill(name) ? `${name} follows its updates again` : `${name} was not pinned`);
|
|
11476
11571
|
})
|
|
11477
11572
|
);
|
|
11478
11573
|
skills.command("save <file>").description("save a SKILL.md as your own skill; the same name adds a version").action(
|
|
11479
11574
|
run2(async (file) => {
|
|
11480
|
-
const { skill } = await api("POST", "/skills/personal", { skill_md:
|
|
11575
|
+
const { skill } = await api("POST", "/skills/personal", { skill_md: readFileSync27(file, "utf8") });
|
|
11481
11576
|
console.log(`recorded as ${skill.id}`);
|
|
11482
11577
|
})
|
|
11483
11578
|
);
|
|
@@ -11532,15 +11627,14 @@ skills.command("usage").description("view and miss counts per skill name in this
|
|
|
11532
11627
|
}
|
|
11533
11628
|
})
|
|
11534
11629
|
);
|
|
11535
|
-
|
|
11536
|
-
const { reflection_proposal: p } = await api("POST", `/reflection_proposals/${encodeURIComponent(id3)}/${verb}`);
|
|
11630
|
+
function printDecision({ reflection_proposal: p }) {
|
|
11537
11631
|
console.log(`${p.id} ${p.status}`);
|
|
11538
11632
|
}
|
|
11539
11633
|
var routing = program.command("routing").description("who a question or piece of work goes to, and under which rules");
|
|
11540
11634
|
routing.command("show").description("the current policy").action(run2(async () => console.log(JSON.stringify(await api("GET", "/routing_policy"), null, 2))));
|
|
11541
11635
|
routing.command("set <file>").description("save a new version of the policy from a JSON file; owner or admin").action(
|
|
11542
11636
|
run2(async (file) => {
|
|
11543
|
-
const saved = await api("PUT", "/routing_policy", JSON.parse(
|
|
11637
|
+
const saved = await api("PUT", "/routing_policy", JSON.parse(readFileSync27(file, "utf8")));
|
|
11544
11638
|
console.log(`version ${saved.version}`);
|
|
11545
11639
|
})
|
|
11546
11640
|
);
|
|
@@ -11564,15 +11658,26 @@ reflections.command("list").description("the workspace's proposals, newest first
|
|
|
11564
11658
|
if (opts.json) return void console.log(JSON.stringify(list, null, 2));
|
|
11565
11659
|
if (!list.length) return void console.log(`no ${opts.status} proposals`);
|
|
11566
11660
|
for (const p of list) {
|
|
11567
|
-
const target2 = p.kind === "save_lesson" ? p.path : p.kind === "create_skill" ? `new skill ${p.payload.name}` : `skill ${p.target_skill_id}`;
|
|
11661
|
+
const target2 = p.kind === "save_lesson" ? p.path : p.kind === "create_skill" ? `new skill ${p.payload.name}` : p.kind === "flag_conflict" || p.kind === "merge_skills" ? `skills ${p.payload.keep} and ${p.payload.drop}` : `skill ${p.target_skill_id}`;
|
|
11568
11662
|
console.log(`${p.id} ${p.kind} ${target2} from ${p.session_id}
|
|
11569
11663
|
${p.payload.why ?? ""}`);
|
|
11570
11664
|
}
|
|
11571
11665
|
})
|
|
11572
11666
|
);
|
|
11573
|
-
reflections.command("approve <id>").description("write the proposal through the skill or memory store").action(run2(async (
|
|
11574
|
-
reflections.command("reject <id>").description("decline the proposal; nothing is written").action(run2(async (
|
|
11575
|
-
reflections.command("
|
|
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`))));
|
|
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(
|
|
11670
|
+
run2(async (id2, opts) => {
|
|
11671
|
+
const whenToUse = opts.whenToUse?.length ? Object.fromEntries(opts.whenToUse.map((entry) => {
|
|
11672
|
+
const at = entry.indexOf("=");
|
|
11673
|
+
if (at < 1) throw new Error(`--when-to-use takes <skill id>=<text>, not "${entry}"`);
|
|
11674
|
+
return [entry.slice(0, at), entry.slice(at + 1)];
|
|
11675
|
+
})) : void 0;
|
|
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));
|
|
11678
|
+
})
|
|
11679
|
+
);
|
|
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`))));
|
|
11576
11681
|
var library = program.command("library").description("your artifact Library on agentsky.dev: files and sites your agents saved or you uploaded");
|
|
11577
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(
|
|
11578
11683
|
run2(async (opts) => {
|
|
@@ -11588,37 +11693,37 @@ library.command("list").description("your Library, newest first").option("--sear
|
|
|
11588
11693
|
);
|
|
11589
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(
|
|
11590
11695
|
run2(async (path2, opts) => {
|
|
11591
|
-
const bytes =
|
|
11696
|
+
const bytes = readFileSync27(path2);
|
|
11592
11697
|
const { artifact: artifact2 } = await uploadToLibrary({ bytes, name: basename9(path2), mediaType: "application/octet-stream" }, crypto.randomUUID(), opts.workspace, opts.session);
|
|
11593
11698
|
console.log(renderLibraryArtifact(artifact2));
|
|
11594
11699
|
})
|
|
11595
11700
|
);
|
|
11596
|
-
library.command("show <id>").description("one artifact and its saved versions").action(run2(async (
|
|
11597
|
-
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));
|
|
11598
11703
|
}));
|
|
11599
11704
|
library.command("delete <id>").description("delete your artifact with all its versions").action(
|
|
11600
|
-
run2(async (
|
|
11601
|
-
const { currentVersion } = await getLibraryArtifact(
|
|
11602
|
-
await deleteLibraryArtifact(
|
|
11603
|
-
console.log(`deleted ${
|
|
11705
|
+
run2(async (id2) => {
|
|
11706
|
+
const { currentVersion } = await getLibraryArtifact(id2);
|
|
11707
|
+
await deleteLibraryArtifact(id2, currentVersion ?? 0);
|
|
11708
|
+
console.log(`deleted ${id2}`);
|
|
11604
11709
|
})
|
|
11605
11710
|
);
|
|
11606
11711
|
for (const [verb, enabled, description] of [
|
|
11607
11712
|
["share", true, "turn on the artifact's public link"],
|
|
11608
11713
|
["unshare", false, "turn off the artifact's public link"]
|
|
11609
11714
|
]) {
|
|
11610
|
-
library.command(`${verb} <id>`).description(description).action(run2(async (
|
|
11611
|
-
const state = await shareLibraryArtifact(
|
|
11612
|
-
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}`);
|
|
11613
11718
|
}));
|
|
11614
11719
|
}
|
|
11615
|
-
library.command("place <id> <workspace>").description('place your artifact in a workspace, or "me" to take it back to you alone').action(run2(async (
|
|
11616
|
-
await placeLibraryArtifact(
|
|
11617
|
-
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}`);
|
|
11618
11723
|
}));
|
|
11619
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(
|
|
11620
|
-
run2(async (
|
|
11621
|
-
const { bytes } = await downloadLibraryArtifact(
|
|
11725
|
+
run2(async (id2, out, opts) => {
|
|
11726
|
+
const { bytes } = await downloadLibraryArtifact(id2, opts.version ? Number(opts.version) : void 0);
|
|
11622
11727
|
writeFileSync13(out, bytes);
|
|
11623
11728
|
console.log(`wrote ${bytes.length} bytes to ${out}`);
|
|
11624
11729
|
})
|
|
@@ -11643,8 +11748,8 @@ for (const [verb, done, description] of [
|
|
|
11643
11748
|
["done", true, "tick a to-do; its document saves a new version"],
|
|
11644
11749
|
["reopen", false, "untick a to-do; its document saves a new version"]
|
|
11645
11750
|
]) {
|
|
11646
|
-
todos.command(`${verb} <id>`).description(description).action(run2(async (
|
|
11647
|
-
const { todo, revision } = await setTodoDone(
|
|
11751
|
+
todos.command(`${verb} <id>`).description(description).action(run2(async (id2) => {
|
|
11752
|
+
const { todo, revision } = await setTodoDone(id2, done);
|
|
11648
11753
|
console.log(`${renderTodo(todo)} (version ${revision})`);
|
|
11649
11754
|
}));
|
|
11650
11755
|
}
|
|
@@ -11671,7 +11776,7 @@ tracking.command("show <board>").description("one board's items").option("--json
|
|
|
11671
11776
|
console.log(renderBoard(found.board));
|
|
11672
11777
|
for (const item of found.items) console.log(renderItem2(item));
|
|
11673
11778
|
}));
|
|
11674
|
-
tracking.command("set <board> <item>").description("state where an item stands; it reads as stated until the routine checks it").option("--title <title>", "the outcome in plain words; needed for a new item").option("--stage <stage>", "planned, in_progress, awaiting_merge, merged or live; needed for a new item").option("--lane <lane>", "the product or area").option("--now <text>", "where it stands").option("--gap <text>", "what is missing").option("--owner <name>", "who has it").option("--ask <text>", "with --needs-you: the one thing the person must do").option("--needs-you", "only the person can move it").option("--no-needs-you", "the person no longer needs to act").option("--stuck", "no live owner or trigger is moving it").option("--no-stuck", "it is moving again").option("--link <label=url...>", "https links, as label=url").action(run2(async (board, item, opts) => {
|
|
11779
|
+
tracking.command("set <board> <item>").description("state where an item stands; it reads as stated until the routine checks it").option("--title <title>", "the outcome in plain words; needed for a new item").option("--stage <stage>", "planned, in_progress, awaiting_merge, merged, deployed or live; needed for a new item").option("--lane <lane>", "the product or area").option("--now <text>", "where it stands").option("--gap <text>", "what is missing").option("--owner <name>", "who has it").option("--ask <text>", "with --needs-you: the one thing the person must do").option("--needs-you", "only the person can move it").option("--no-needs-you", "the person no longer needs to act").option("--stuck", "no live owner or trigger is moving it").option("--no-stuck", "it is moving again").option("--link <label=url...>", "https links, as label=url").action(run2(async (board, item, opts) => {
|
|
11675
11780
|
console.log(renderItem2((await setTrackingItem(board, item, opts)).item));
|
|
11676
11781
|
}));
|
|
11677
11782
|
tracking.command("remove <board> <item>").description("take an item off the board").action(run2(async (board, item) => {
|
|
@@ -11696,8 +11801,8 @@ items.command("list").description("needs you first, then working, proposed and d
|
|
|
11696
11801
|
})
|
|
11697
11802
|
);
|
|
11698
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(
|
|
11699
|
-
run2(async (
|
|
11700
|
-
const result = await actOnItem(
|
|
11804
|
+
run2(async (id2, opts) => {
|
|
11805
|
+
const result = await actOnItem(id2, opts);
|
|
11701
11806
|
console.log(opts.json ? JSON.stringify(result, null, 2) : renderActed(result));
|
|
11702
11807
|
})
|
|
11703
11808
|
);
|
|
@@ -11708,7 +11813,7 @@ items.command("propose <documentId> <title>").description("offer work on a docum
|
|
|
11708
11813
|
})
|
|
11709
11814
|
);
|
|
11710
11815
|
var asks = program.command("asks").description("asks: everything waiting on you, one each, and answering one from here");
|
|
11711
|
-
asks.command("list").description("what waits on you: who is waiting, what is needed, and how to answer").option("--kind <kind...>", "only these kinds, such as question, spend or failure").option("--source <id>", "only this session's or document's asks").option("--limit <n>", "up to 100").option("--cursor <cursor>", "next_cursor from the previous page; repeat the same filters").option("--json", "print as JSON").action(
|
|
11816
|
+
asks.command("list").description("what waits on you: who is waiting, what is needed, and how to answer").option("--kind <kind...>", "only these kinds, such as question, spend or failure").option("--source <id>", "only this session's or document's asks").option("--limit <n>", "up to 100").option("--cursor <cursor>", "next_cursor from the previous page; repeat the same filters").option("--direction <direction>", "name both ends of each ask: incoming, outgoing or all").option("--json", "print as JSON").action(
|
|
11712
11817
|
run2(async (opts) => {
|
|
11713
11818
|
const page = await listAsks(opts);
|
|
11714
11819
|
if (opts.json) {
|
|
@@ -11722,8 +11827,8 @@ asks.command("list").description("what waits on you: who is waiting, what is nee
|
|
|
11722
11827
|
})
|
|
11723
11828
|
);
|
|
11724
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(
|
|
11725
|
-
run2(async (
|
|
11726
|
-
const result = await answerAsk(
|
|
11830
|
+
run2(async (id2, opts) => {
|
|
11831
|
+
const result = await answerAsk(id2, opts);
|
|
11727
11832
|
console.log(opts.json ? JSON.stringify(result, null, 2) : renderAnswered(result));
|
|
11728
11833
|
})
|
|
11729
11834
|
);
|
|
@@ -11743,27 +11848,27 @@ signing.command("list").description("this workspace's signing requests").option(
|
|
|
11743
11848
|
})
|
|
11744
11849
|
);
|
|
11745
11850
|
signing.command("get <id>").description("a request's status and, once signed, its signature record").option("--json", "print as JSON").action(
|
|
11746
|
-
run2(async (
|
|
11747
|
-
const request3 = await readRequest(
|
|
11851
|
+
run2(async (id2, opts) => {
|
|
11852
|
+
const request3 = await readRequest(id2);
|
|
11748
11853
|
console.log(opts.json ? JSON.stringify(request3, null, 2) : renderRequest3(request3));
|
|
11749
11854
|
})
|
|
11750
11855
|
);
|
|
11751
|
-
signing.command("copy <id> <file>").description("save the signed document and its record as a PDF").action(run2(async (
|
|
11752
|
-
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);
|
|
11753
11858
|
console.log(file);
|
|
11754
11859
|
}));
|
|
11755
|
-
signing.command("document <id>").description("the document exactly as it is to be signed or was signed").action(run2(async (
|
|
11756
|
-
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)));
|
|
11757
11862
|
signing.command("cancel <id>").description("withdraw a request nobody has signed").option("--json", "print as JSON").action(
|
|
11758
|
-
run2(async (
|
|
11759
|
-
const request3 = await cancelRequest(
|
|
11863
|
+
run2(async (id2, opts) => {
|
|
11864
|
+
const request3 = await cancelRequest(id2);
|
|
11760
11865
|
console.log(opts.json ? JSON.stringify(request3, null, 2) : renderRequest3(request3));
|
|
11761
11866
|
})
|
|
11762
11867
|
);
|
|
11763
11868
|
var artifact = program.command("artifact").description("artifacts: publish a session's shared files as a named, shareable result");
|
|
11764
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(
|
|
11765
|
-
run2(async (
|
|
11766
|
-
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}`);
|
|
11767
11872
|
})
|
|
11768
11873
|
);
|
|
11769
11874
|
registerArtifactAdoptionCommands(artifact);
|
|
@@ -11780,9 +11885,9 @@ artifact.command("publish <session>").description("publish paths from the sessio
|
|
|
11780
11885
|
})
|
|
11781
11886
|
);
|
|
11782
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(
|
|
11783
|
-
run2(async (
|
|
11888
|
+
run2(async (id2, path2, opts) => {
|
|
11784
11889
|
if (opts.version !== void 0 && (!Number.isSafeInteger(opts.version) || opts.version < 1)) throw new Error("--version must be a positive integer");
|
|
11785
|
-
const bytes = await readArtifactFile(
|
|
11890
|
+
const bytes = await readArtifactFile(id2, path2, opts.version);
|
|
11786
11891
|
if (opts.out) {
|
|
11787
11892
|
writeFileSync13(opts.out, bytes);
|
|
11788
11893
|
console.log(`Wrote ${bytes.length} bytes to ${opts.out}`);
|
|
@@ -11790,64 +11895,64 @@ artifact.command("get <id> <path>").description("read one file of an artifact; p
|
|
|
11790
11895
|
})
|
|
11791
11896
|
);
|
|
11792
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(
|
|
11793
|
-
run2(async (
|
|
11898
|
+
run2(async (id2, path2, opts) => {
|
|
11794
11899
|
if (Boolean(opts.file) === Boolean(opts.restore)) throw new Error("send --file or --restore");
|
|
11795
|
-
console.log(renderArtifact(await saveArtifactFile(
|
|
11900
|
+
console.log(renderArtifact(await saveArtifactFile(id2, path2, {
|
|
11796
11901
|
baseVersion: Number(opts.base),
|
|
11797
11902
|
requestId: opts.requestId,
|
|
11798
|
-
...opts.file ? { bytes:
|
|
11903
|
+
...opts.file ? { bytes: readFileSync27(opts.file) } : { restoreVersion: Number(opts.restore) }
|
|
11799
11904
|
})));
|
|
11800
11905
|
})
|
|
11801
11906
|
);
|
|
11802
|
-
artifact.command("update <id>").description("rename an artifact; its links, versions and files stay").requiredOption("--name <name>", "the new name").action(run2(async (
|
|
11803
|
-
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)));
|
|
11804
11909
|
}));
|
|
11805
|
-
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 (
|
|
11806
|
-
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 })));
|
|
11807
11912
|
}));
|
|
11808
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(
|
|
11809
11914
|
run2(async (file, opts) => {
|
|
11810
11915
|
if (Boolean(file) === Boolean(opts.url)) throw new Error("name a file or --url");
|
|
11811
|
-
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 })));
|
|
11812
11917
|
})
|
|
11813
11918
|
);
|
|
11814
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(
|
|
11815
|
-
run2(async (
|
|
11816
|
-
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) });
|
|
11817
11922
|
writeFileSync13(opts.out, bytes);
|
|
11818
11923
|
console.log(`Wrote ${bytes.length} bytes to ${opts.out}`);
|
|
11819
11924
|
})
|
|
11820
11925
|
);
|
|
11821
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(
|
|
11822
|
-
run2(async (
|
|
11823
|
-
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 });
|
|
11824
11929
|
console.log(renderArtifact(converted));
|
|
11825
11930
|
if (loss) console.log(loss);
|
|
11826
11931
|
})
|
|
11827
11932
|
);
|
|
11828
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(
|
|
11829
|
-
run2(async (
|
|
11830
|
-
const url = await shareArtifact(
|
|
11831
|
-
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}`);
|
|
11832
11937
|
})
|
|
11833
11938
|
);
|
|
11834
11939
|
var artifactPage = artifact.command("page").description("what a published page with an agentsky.json can spend");
|
|
11835
|
-
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 (
|
|
11836
|
-
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));
|
|
11837
11942
|
}));
|
|
11838
|
-
artifactPage.command("limit <id> <cents>").description("set the most the page may spend, in US cents").action(run2(async (
|
|
11839
|
-
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));
|
|
11840
11945
|
}));
|
|
11841
|
-
artifactPage.command("confirm <id>").description("agree that anyone who opens this page's link uses your credits").action(run2(async (
|
|
11842
|
-
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));
|
|
11843
11948
|
}));
|
|
11844
|
-
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 (
|
|
11845
|
-
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));
|
|
11846
11951
|
}));
|
|
11847
11952
|
artifact.command("rm <id>").description("delete an artifact").action(
|
|
11848
|
-
run2(async (
|
|
11849
|
-
await deleteArtifact(
|
|
11850
|
-
console.log(`Deleted ${
|
|
11953
|
+
run2(async (id2) => {
|
|
11954
|
+
await deleteArtifact(id2);
|
|
11955
|
+
console.log(`Deleted ${id2}`);
|
|
11851
11956
|
})
|
|
11852
11957
|
);
|
|
11853
11958
|
var designSystem = program.command("design-system").description("design systems: brand books, tokens and components agents design with");
|
|
@@ -11859,8 +11964,8 @@ designSystem.command("list").description("the workspace's design systems").actio
|
|
|
11859
11964
|
})
|
|
11860
11965
|
);
|
|
11861
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(
|
|
11862
|
-
run2(async (
|
|
11863
|
-
const system = await getDesignSystem(
|
|
11967
|
+
run2(async (id2, opts) => {
|
|
11968
|
+
const system = await getDesignSystem(id2);
|
|
11864
11969
|
console.log(opts.readme ? system.readme ?? "this design system has no README.md" : renderDesignSystem(system));
|
|
11865
11970
|
})
|
|
11866
11971
|
);
|
|
@@ -11870,21 +11975,21 @@ designSystem.command("import <session> <folder>").description("import a local de
|
|
|
11870
11975
|
})
|
|
11871
11976
|
);
|
|
11872
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(
|
|
11873
|
-
run2(async (
|
|
11874
|
-
const tokens = JSON.parse(
|
|
11875
|
-
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)));
|
|
11876
11981
|
})
|
|
11877
11982
|
);
|
|
11878
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(
|
|
11879
|
-
run2(async (
|
|
11984
|
+
run2(async (id2, path2, file, opts) => {
|
|
11880
11985
|
if (file === void 0 === (opts.restore === void 0)) throw Error("Give a local [file] to save, or --restore <version>.");
|
|
11881
|
-
const change = opts.restore === void 0 ? { content:
|
|
11882
|
-
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)));
|
|
11883
11988
|
})
|
|
11884
11989
|
);
|
|
11885
|
-
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) => {
|
|
11886
11991
|
if (opts.text !== void 0 && !Number.isSafeInteger(opts.base)) throw Error("Adding a comment requires --base <version>.");
|
|
11887
|
-
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));
|
|
11888
11993
|
}));
|
|
11889
11994
|
function routineRunOutcome(run3) {
|
|
11890
11995
|
const failure = run3.error ?? run3.turn_error;
|
|
@@ -11936,15 +12041,15 @@ routine.command("list").option("--session <id>", "only the routines that run in
|
|
|
11936
12041
|
})
|
|
11937
12042
|
);
|
|
11938
12043
|
routine.command("show <id>").action(
|
|
11939
|
-
run2(async (
|
|
12044
|
+
run2(async (id2) => {
|
|
11940
12045
|
const { routine: r } = await api(
|
|
11941
12046
|
"GET",
|
|
11942
|
-
`/routines/${encodeURIComponent(
|
|
12047
|
+
`/routines/${encodeURIComponent(id2)}`
|
|
11943
12048
|
);
|
|
11944
12049
|
console.log(routineLine(r));
|
|
11945
12050
|
const { items: items2 } = await api(
|
|
11946
12051
|
"GET",
|
|
11947
|
-
`/routine-runs?routine=${encodeURIComponent(
|
|
12052
|
+
`/routine-runs?routine=${encodeURIComponent(id2)}&limit=5`
|
|
11948
12053
|
);
|
|
11949
12054
|
for (const runRow of items2) {
|
|
11950
12055
|
console.log(` ${runRow.created_at} ${runRow.trigger_context.type.padEnd(8)} ${routineRunOutcome(runRow)}`);
|
|
@@ -11952,21 +12057,21 @@ routine.command("show <id>").action(
|
|
|
11952
12057
|
})
|
|
11953
12058
|
);
|
|
11954
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(
|
|
11955
|
-
run2(async (
|
|
12060
|
+
run2(async (id2, opts) => {
|
|
11956
12061
|
const { routine: r } = await api(
|
|
11957
12062
|
"PATCH",
|
|
11958
|
-
`/routines/${encodeURIComponent(
|
|
12063
|
+
`/routines/${encodeURIComponent(id2)}`,
|
|
11959
12064
|
routinePatchBody(opts)
|
|
11960
12065
|
);
|
|
11961
12066
|
console.log(routineLine(r));
|
|
11962
12067
|
})
|
|
11963
12068
|
);
|
|
11964
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(
|
|
11965
|
-
run2(async (
|
|
12070
|
+
run2(async (id2, opts) => {
|
|
11966
12071
|
const body = { ...opts.input !== void 0 ? { input: opts.input } : {}, ...opts.idempotencyKey ? { idempotency_key: opts.idempotencyKey } : {} };
|
|
11967
12072
|
const { run: fired } = await api(
|
|
11968
12073
|
"POST",
|
|
11969
|
-
`/routines/${encodeURIComponent(
|
|
12074
|
+
`/routines/${encodeURIComponent(id2)}/run`,
|
|
11970
12075
|
...Object.keys(body).length ? [body] : []
|
|
11971
12076
|
);
|
|
11972
12077
|
if (fired.error) console.log(`Run ${fired.id} failed: ${fired.error.type} \u2014 ${fired.error.message}`);
|
|
@@ -11979,25 +12084,25 @@ for (const [verb, blurb] of [
|
|
|
11979
12084
|
["archive", "terminal: the schedule stops and the routine becomes immutable"]
|
|
11980
12085
|
]) {
|
|
11981
12086
|
routine.command(`${verb} <id>`).description(blurb).action(
|
|
11982
|
-
run2(async (
|
|
12087
|
+
run2(async (id2) => {
|
|
11983
12088
|
const { routine: r } = await api(
|
|
11984
12089
|
"POST",
|
|
11985
|
-
`/routines/${encodeURIComponent(
|
|
12090
|
+
`/routines/${encodeURIComponent(id2)}/${verb}`
|
|
11986
12091
|
);
|
|
11987
12092
|
console.log(`${r.id}: ${r.archived_at ? "archived" : r.status}`);
|
|
11988
12093
|
})
|
|
11989
12094
|
);
|
|
11990
12095
|
}
|
|
11991
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(
|
|
11992
|
-
run2(async (
|
|
11993
|
-
await api("DELETE", `/routines/${encodeURIComponent(
|
|
11994
|
-
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.`);
|
|
11995
12100
|
})
|
|
11996
12101
|
);
|
|
11997
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(
|
|
11998
|
-
run2(async (
|
|
12103
|
+
run2(async (id2, opts) => {
|
|
11999
12104
|
const params = new URLSearchParams({ limit: opts.limit ?? "20" });
|
|
12000
|
-
if (
|
|
12105
|
+
if (id2) params.set("routine", id2);
|
|
12001
12106
|
if (opts.failed) params.set("has_error", "true");
|
|
12002
12107
|
const { items: items2 } = await api("GET", `/routine-runs?${params}`);
|
|
12003
12108
|
if (!items2.length) console.log("no runs");
|
|
@@ -12007,32 +12112,32 @@ routine.command("runs [id]").description("every fire attempt, newest first \u201
|
|
|
12007
12112
|
})
|
|
12008
12113
|
);
|
|
12009
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(
|
|
12010
|
-
run2(async (
|
|
12011
|
-
const res = await triggerRequest(
|
|
12115
|
+
run2(async (id2, opts) => {
|
|
12116
|
+
const res = await triggerRequest(id2, "inbound-url", { create: opts.create, remove: opts.rm });
|
|
12012
12117
|
console.log(opts.rm ? res.removed ? "Removed the inbound URL" : "There was no inbound URL" : inboundLine(res.inbound_url ?? null));
|
|
12013
12118
|
})
|
|
12014
12119
|
);
|
|
12015
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(
|
|
12016
|
-
run2(async (
|
|
12017
|
-
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 });
|
|
12018
12123
|
console.log(opts.rm ? res.removed ? "Removed the precheck" : "There was no precheck" : precheckLine(res.precheck ?? null));
|
|
12019
12124
|
})
|
|
12020
12125
|
);
|
|
12021
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(
|
|
12022
|
-
run2(async (
|
|
12127
|
+
run2(async (id2, state) => {
|
|
12023
12128
|
if (state && state !== "on" && state !== "off") throw new ApiError(400, "invalid_request", "state is on or off");
|
|
12024
12129
|
const res = await api(
|
|
12025
12130
|
state === "on" ? "PUT" : state === "off" ? "DELETE" : "GET",
|
|
12026
|
-
triggerPath(
|
|
12131
|
+
triggerPath(id2, "result-email")
|
|
12027
12132
|
);
|
|
12028
12133
|
console.log(`result email ${res.result_email.enabled ? "on" : "off"}`);
|
|
12029
12134
|
})
|
|
12030
12135
|
);
|
|
12031
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(
|
|
12032
|
-
run2(async (
|
|
12137
|
+
run2(async (id2, opts) => {
|
|
12033
12138
|
const setting = Boolean(opts.connection || opts.thread || opts.prefix);
|
|
12034
12139
|
const res = await triggerRequest(
|
|
12035
|
-
|
|
12140
|
+
id2,
|
|
12036
12141
|
"channel-trigger",
|
|
12037
12142
|
{ body: setting ? triggerBody(opts) : void 0, remove: opts.rm }
|
|
12038
12143
|
);
|
|
@@ -12040,10 +12145,10 @@ routine.command("chat-trigger <id>").description("start a run from your own mess
|
|
|
12040
12145
|
})
|
|
12041
12146
|
);
|
|
12042
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(
|
|
12043
|
-
run2(async (
|
|
12148
|
+
run2(async (id2, opts) => {
|
|
12044
12149
|
const setting = Boolean(opts.connection || opts.thread);
|
|
12045
12150
|
const res = await triggerRequest(
|
|
12046
|
-
|
|
12151
|
+
id2,
|
|
12047
12152
|
"deliver-to",
|
|
12048
12153
|
{ body: setting ? deliverBody(opts) : void 0, remove: opts.rm }
|
|
12049
12154
|
);
|
|
@@ -12072,7 +12177,91 @@ providers.command("unbind <namespace>").description("serve a namespace from the
|
|
|
12072
12177
|
printProviders([provider]);
|
|
12073
12178
|
})
|
|
12074
12179
|
);
|
|
12075
|
-
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
|
+
);
|
|
12076
12265
|
function printRecorders(bookings) {
|
|
12077
12266
|
for (const row of bookings) console.log(`${row.id} ${row.state} ${row.start} ${row.title ?? "(no title)"}${row.reason ? ` (${row.reason})` : ""}`);
|
|
12078
12267
|
}
|
|
@@ -12090,8 +12279,8 @@ meetings.command("auto-join [state]").description("show meeting auto-join, or tu
|
|
|
12090
12279
|
})
|
|
12091
12280
|
);
|
|
12092
12281
|
meetings.command("cancel-recorder <id>").description("withdraw one recorder: deleted if it has not joined, told to leave if it may have").action(
|
|
12093
|
-
run2(async (
|
|
12094
|
-
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`);
|
|
12095
12284
|
printRecorders([booking]);
|
|
12096
12285
|
})
|
|
12097
12286
|
);
|
|
@@ -12153,6 +12342,30 @@ skyManager.command("progress").description("what every thread is doing, one sent
|
|
|
12153
12342
|
console.log(opts.json ? JSON.stringify(page, null, 2) : renderProgressPage(page));
|
|
12154
12343
|
})
|
|
12155
12344
|
);
|
|
12345
|
+
var LADDER_WORDS = { merged: "merged", deployed: "deployed", live: "checked live", closed: "stable" };
|
|
12346
|
+
skyManager.command("autopilot").description("what your agents carry: each change on the ladder merged \u2192 deployed \u2192 checked live \u2192 stable, open waits, decisions made for you today, and what only you can do").option("--json", "print the API's answer as JSON").action(
|
|
12347
|
+
run2(async (opts) => {
|
|
12348
|
+
const answer = await api("GET", "/sky/autopilot");
|
|
12349
|
+
if (opts.json) return void console.log(JSON.stringify(answer, null, 2));
|
|
12350
|
+
const lines2 = [];
|
|
12351
|
+
lines2.push(`Needs you (${answer.needs_you.length + answer.work.filter((item) => item.needs_you).length})`);
|
|
12352
|
+
for (const ask3 of answer.needs_you) lines2.push(` ${ask3.session_title ?? "Session"}: ${ask3.question} ${ask3.link}`);
|
|
12353
|
+
for (const item of answer.work.filter((entry) => entry.needs_you)) lines2.push(` ${item.title}: ${item.ask}`);
|
|
12354
|
+
lines2.push(`Work (${answer.work.length})`);
|
|
12355
|
+
for (const item of answer.work) lines2.push(` [${LADDER_WORDS[item.stage] ?? item.stage}${item.evidence === "verified" ? "" : ", stated"}] ${item.title}${item.now ? ` \u2014 ${item.now}` : ""}`);
|
|
12356
|
+
lines2.push(`Waiting (${answer.waits.length})`);
|
|
12357
|
+
for (const wait of answer.waits) lines2.push(` ${wait.session_title ?? "Session"}: ${wait.what}${wait.last_seen ? ` (${wait.last_seen})` : ""}`);
|
|
12358
|
+
lines2.push(`Decided for you today (${answer.decisions.length}); veto with: sky manager veto <id>`);
|
|
12359
|
+
for (const decision of answer.decisions) lines2.push(` ${decision.id}${decision.status === "vetoed" ? " (vetoed)" : ""}: ${decision.what} \u2014 ${decision.why}`);
|
|
12360
|
+
console.log(lines2.join("\n"));
|
|
12361
|
+
})
|
|
12362
|
+
);
|
|
12363
|
+
skyManager.command("veto <decision>").description("veto a decision an agent made for you; its session is told to undo it").action(
|
|
12364
|
+
run2(async (decision) => {
|
|
12365
|
+
const answer = await api("POST", `/sky/decisions/${encodeURIComponent(decision)}/veto`);
|
|
12366
|
+
console.log(`Vetoed ${answer.decision.id}: ${answer.decision.what}${answer.delivered ? "" : " (the session could not be reached; the veto stands)"}`);
|
|
12367
|
+
})
|
|
12368
|
+
);
|
|
12156
12369
|
skyManager.command("watching").description("list every open matter and when Sky looks next").option("--json", "print the raw list").action(
|
|
12157
12370
|
run2(async (opts) => {
|
|
12158
12371
|
const { follow_ups } = await api("GET", "/sky/follow-ups");
|
|
@@ -12174,7 +12387,7 @@ skyManager.command("rules").description("print your rules, each marked enforced
|
|
|
12174
12387
|
);
|
|
12175
12388
|
skyManager.command("rules-set <file>").description("replace your rules from a JSON file holding the list").action(
|
|
12176
12389
|
run2(async (file) => {
|
|
12177
|
-
const { rules } = await api("PUT", "/sky/rules", { rules: JSON.parse(
|
|
12390
|
+
const { rules } = await api("PUT", "/sky/rules", { rules: JSON.parse(readFileSync27(file, "utf8")) });
|
|
12178
12391
|
console.log(`Saved ${rules.length} rules`);
|
|
12179
12392
|
})
|
|
12180
12393
|
);
|
|
@@ -12215,7 +12428,7 @@ function goalPath(sessionId, suffix = "") {
|
|
|
12215
12428
|
return `/sessions/${encodeURIComponent(sessionId)}/goal${suffix}`;
|
|
12216
12429
|
}
|
|
12217
12430
|
function withGoalWriteOptions(command) {
|
|
12218
|
-
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");
|
|
12219
12432
|
}
|
|
12220
12433
|
var goal = program.command("goal").description("give a session a standing objective it keeps working toward until the criteria are met");
|
|
12221
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(
|
|
@@ -12267,6 +12480,19 @@ for (const [verb, method, suffix, blurb] of [
|
|
|
12267
12480
|
})
|
|
12268
12481
|
);
|
|
12269
12482
|
}
|
|
12483
|
+
goal.command("drive <session>").description("say who is meant to carry the goal forward: the session's own agent, or a person; it changes no limit or permission").option("--person [user]", "a person drives: you, or the workspace member with this user id").action(
|
|
12484
|
+
run2(async (ref, opts) => {
|
|
12485
|
+
const body = opts.person === void 0 ? void 0 : { kind: "person", ...opts.person === true ? {} : { id: opts.person } };
|
|
12486
|
+
const { goal: changed } = await api("PUT", `/sessions/${encodeURIComponent(await resolveSessionRef(ref))}/goal/driver`, body);
|
|
12487
|
+
console.log(`${changed.id}: ${driverLine(changed)}`);
|
|
12488
|
+
})
|
|
12489
|
+
);
|
|
12490
|
+
goal.command("drive-end <session>").description("end the statement of who drives the goal; the goal itself is untouched and keeps running").action(
|
|
12491
|
+
run2(async (ref) => {
|
|
12492
|
+
const { goal: changed } = await api("DELETE", `/sessions/${encodeURIComponent(await resolveSessionRef(ref))}/goal/driver`);
|
|
12493
|
+
console.log(`${changed.id}: ${driverLine(changed)}`);
|
|
12494
|
+
})
|
|
12495
|
+
);
|
|
12270
12496
|
catalog.command("show <handle>").description("what one agent does, and how to hire it").option("--json", "print the raw listing").action(
|
|
12271
12497
|
run2(async (handle, opts) => {
|
|
12272
12498
|
const agent2 = await showCatalogAgent(handle);
|
|
@@ -12403,9 +12629,9 @@ email: ${emailStatus}` : url);
|
|
|
12403
12629
|
})
|
|
12404
12630
|
);
|
|
12405
12631
|
referralLinks.command("disable <id>").description("stop a link being redeemed; customers already enrolled keep their price").action(
|
|
12406
|
-
run2(async (
|
|
12407
|
-
await disableReferralLink(
|
|
12408
|
-
console.log(`Disabled ${
|
|
12632
|
+
run2(async (id2) => {
|
|
12633
|
+
await disableReferralLink(id2);
|
|
12634
|
+
console.log(`Disabled ${id2}`);
|
|
12409
12635
|
})
|
|
12410
12636
|
);
|
|
12411
12637
|
var keys = program.command("keys").description("your own API keys: list, create, revoke, restore (admin scope)");
|
|
@@ -12424,8 +12650,8 @@ keys.command("create <name>").description("make a key; its secret is printed onc
|
|
|
12424
12650
|
})
|
|
12425
12651
|
);
|
|
12426
12652
|
keys.command("reveal <id>").description("print a key's secret again").action(
|
|
12427
|
-
run2(async (
|
|
12428
|
-
const { secret } = await api("POST", `/api_keys/${encodeURIComponent(
|
|
12653
|
+
run2(async (id2) => {
|
|
12654
|
+
const { secret } = await api("POST", `/api_keys/${encodeURIComponent(id2)}/reveal`);
|
|
12429
12655
|
console.log(secret);
|
|
12430
12656
|
})
|
|
12431
12657
|
);
|
|
@@ -12434,8 +12660,8 @@ for (const [verb, blurb] of [
|
|
|
12434
12660
|
["restore", "a revoked key works again"]
|
|
12435
12661
|
]) {
|
|
12436
12662
|
keys.command(`${verb} <id>`).description(blurb).action(
|
|
12437
|
-
run2(async (
|
|
12438
|
-
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}`);
|
|
12439
12665
|
console.log(renderApiKey(key));
|
|
12440
12666
|
})
|
|
12441
12667
|
);
|
|
@@ -12557,7 +12783,7 @@ events.command("digests").description("whether your own digests run in this work
|
|
|
12557
12783
|
);
|
|
12558
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(
|
|
12559
12785
|
run2(async (file) => {
|
|
12560
|
-
const text2 = file && file !== "-" ?
|
|
12786
|
+
const text2 = file && file !== "-" ? readFileSync27(file, "utf8") : readFileSync27(0, "utf8");
|
|
12561
12787
|
const parsed = JSON.parse(text2);
|
|
12562
12788
|
const body = Array.isArray(parsed) ? { events: parsed } : parsed;
|
|
12563
12789
|
const result = await api("POST", "/events", body);
|
|
@@ -12565,14 +12791,14 @@ events.command("push [file]").description("write events from your own program in
|
|
|
12565
12791
|
})
|
|
12566
12792
|
);
|
|
12567
12793
|
events.command("show <id>").description("one event in full").action(
|
|
12568
|
-
run2(async (
|
|
12569
|
-
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));
|
|
12570
12796
|
})
|
|
12571
12797
|
);
|
|
12572
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(
|
|
12573
|
-
run2(async (
|
|
12799
|
+
run2(async (id2, opts) => {
|
|
12574
12800
|
const params = new URLSearchParams({ part: opts.part ?? "response", as: opts.text ? "text" : "raw" });
|
|
12575
|
-
const res = await apiRaw("GET", `/events/${encodeURIComponent(
|
|
12801
|
+
const res = await apiRaw("GET", `/events/${encodeURIComponent(id2)}/body?${params}`);
|
|
12576
12802
|
if (!res.ok) await parseError(res);
|
|
12577
12803
|
if (opts.out) {
|
|
12578
12804
|
const bytes = await writeResponseFile(res, opts.out);
|
|
@@ -12599,21 +12825,21 @@ webhook.command("create <url>").description("register an endpoint; its signing s
|
|
|
12599
12825
|
})
|
|
12600
12826
|
);
|
|
12601
12827
|
webhook.command("enable <id>").description("re-enable an endpoint that was disabled after failed deliveries").action(
|
|
12602
|
-
run2(async (
|
|
12603
|
-
const { webhook: updated } = await api("PATCH", `/webhooks/${encodeURIComponent(
|
|
12828
|
+
run2(async (id2) => {
|
|
12829
|
+
const { webhook: updated } = await api("PATCH", `/webhooks/${encodeURIComponent(id2)}`, { status: "active" });
|
|
12604
12830
|
console.log(webhookLine(updated));
|
|
12605
12831
|
})
|
|
12606
12832
|
);
|
|
12607
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(
|
|
12608
|
-
run2(async (
|
|
12609
|
-
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 } : {} });
|
|
12610
12836
|
console.log(`Requeued ${replayed} deliveries`);
|
|
12611
12837
|
})
|
|
12612
12838
|
);
|
|
12613
12839
|
webhook.command("rm <id>").description("delete an endpoint").action(
|
|
12614
|
-
run2(async (
|
|
12615
|
-
await api("DELETE", `/webhooks/${encodeURIComponent(
|
|
12616
|
-
console.log(`Deleted ${
|
|
12840
|
+
run2(async (id2) => {
|
|
12841
|
+
await api("DELETE", `/webhooks/${encodeURIComponent(id2)}`);
|
|
12842
|
+
console.log(`Deleted ${id2}`);
|
|
12617
12843
|
})
|
|
12618
12844
|
);
|
|
12619
12845
|
var channel = program.command("channel").description("chat surfaces (Slack, Telegram, Discord, WhatsApp, iMessage, \u2026) routed to a session");
|
|
@@ -12864,9 +13090,9 @@ ruleCommand.command("permissions").description("what an agent may do without ask
|
|
|
12864
13090
|
})
|
|
12865
13091
|
);
|
|
12866
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(
|
|
12867
|
-
run2(async (
|
|
13093
|
+
run2(async (id2, opts) => {
|
|
12868
13094
|
const body = { ...opts.on ? { enabled: true } : opts.off ? { enabled: false } : {}, ...opts.name ? { name: opts.name } : {}, ...opts.config ? { config: JSON.parse(opts.config) } : {} };
|
|
12869
|
-
console.log(JSON.stringify(await api("PATCH", `/rules/${encodeURIComponent(
|
|
13095
|
+
console.log(JSON.stringify(await api("PATCH", `/rules/${encodeURIComponent(id2)}`, body), null, 2));
|
|
12870
13096
|
})
|
|
12871
13097
|
);
|
|
12872
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(
|
|
@@ -12883,8 +13109,8 @@ ruleCommand.command("history").description("who changed which rule, newest first
|
|
|
12883
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) => {
|
|
12884
13110
|
console.log(JSON.stringify(await api("POST", `/rules/history/${encodeURIComponent(change)}/undo`), null, 2));
|
|
12885
13111
|
}));
|
|
12886
|
-
ruleCommand.command("rm <id>").description("remove a rule").action(run2(async (
|
|
12887
|
-
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));
|
|
12888
13114
|
}));
|
|
12889
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(
|
|
12890
13116
|
run2(async (opts) => {
|
|
@@ -12954,14 +13180,14 @@ vendor.command("add <vendor>").description("connect a vendor account by pasting
|
|
|
12954
13180
|
})
|
|
12955
13181
|
);
|
|
12956
13182
|
vendor.command("rm <id>").description("disconnect a vendor account").action(
|
|
12957
|
-
run2(async (
|
|
12958
|
-
await api("DELETE", `/external_accounts/${encodeURIComponent(
|
|
12959
|
-
console.log(`Removed ${
|
|
13183
|
+
run2(async (id2) => {
|
|
13184
|
+
await api("DELETE", `/external_accounts/${encodeURIComponent(id2)}`);
|
|
13185
|
+
console.log(`Removed ${id2}`);
|
|
12960
13186
|
})
|
|
12961
13187
|
);
|
|
12962
13188
|
vendor.command("usage <id>").description("the agents and sessions that used this vendor account").option("--json", "print as JSON").action(
|
|
12963
|
-
run2(async (
|
|
12964
|
-
const { usage } = await api("GET", `/external_accounts/${encodeURIComponent(
|
|
13189
|
+
run2(async (id2, opts) => {
|
|
13190
|
+
const { usage } = await api("GET", `/external_accounts/${encodeURIComponent(id2)}/usage`);
|
|
12965
13191
|
if (opts.json) {
|
|
12966
13192
|
console.log(JSON.stringify(usage, null, 2));
|
|
12967
13193
|
return;
|
|
@@ -12983,22 +13209,22 @@ program.command("capabilities").description("deprecated: sky plugins list --view
|
|
|
12983
13209
|
);
|
|
12984
13210
|
var mcpCommand = program.command("mcp").description("the AgentSky MCP server on this computer");
|
|
12985
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 () => {
|
|
12986
|
-
const { serveMcp } = await import("./mcp-serve-
|
|
13212
|
+
const { serveMcp } = await import("./mcp-serve-OLHMHG4M.js");
|
|
12987
13213
|
await serveMcp();
|
|
12988
13214
|
}));
|
|
12989
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)");
|
|
12990
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) => {
|
|
12991
|
-
const { listComputeMachines, renderMachines } = await import("./compute-
|
|
13217
|
+
const { listComputeMachines, renderMachines } = await import("./compute-VNGFIQCD.js");
|
|
12992
13218
|
const machines = await listComputeMachines();
|
|
12993
13219
|
console.log(opts.json ? JSON.stringify({ machines }, null, 2) : renderMachines(machines));
|
|
12994
13220
|
}));
|
|
12995
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) => {
|
|
12996
|
-
const { requestRepair } = await import("./compute-
|
|
13222
|
+
const { requestRepair } = await import("./compute-VNGFIQCD.js");
|
|
12997
13223
|
const answer = await requestRepair(machine);
|
|
12998
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).`);
|
|
12999
13225
|
}));
|
|
13000
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) => {
|
|
13001
|
-
const { removeMachine } = await import("./compute-
|
|
13227
|
+
const { removeMachine } = await import("./compute-VNGFIQCD.js");
|
|
13002
13228
|
await removeMachine(machine);
|
|
13003
13229
|
console.log(`Forgot ${machine}. It reports again on its next run unless \`sky setup --remove\` ran there.`);
|
|
13004
13230
|
}));
|
|
@@ -13054,8 +13280,8 @@ mac.command("ask <machine> <kind>").description("ask a Mac to lend a folder, a b
|
|
|
13054
13280
|
})
|
|
13055
13281
|
);
|
|
13056
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(
|
|
13057
|
-
run2(async (
|
|
13058
|
-
const answer = await readReachRequest(
|
|
13283
|
+
run2(async (id2, opts) => {
|
|
13284
|
+
const answer = await readReachRequest(id2, Number(opts.wait) || 0);
|
|
13059
13285
|
if (opts.json) {
|
|
13060
13286
|
console.log(JSON.stringify(answer, null, 2));
|
|
13061
13287
|
return;
|
|
@@ -13077,7 +13303,7 @@ function emitBundle(bundle, out, what) {
|
|
|
13077
13303
|
console.log(`Exported ${what} to ${out}`);
|
|
13078
13304
|
}
|
|
13079
13305
|
function bundleBody(file, requestId2, extra = {}) {
|
|
13080
|
-
const text2 =
|
|
13306
|
+
const text2 = readFileSync27(file, "utf8");
|
|
13081
13307
|
let bundle;
|
|
13082
13308
|
try {
|
|
13083
13309
|
bundle = JSON.parse(text2);
|
|
@@ -13124,7 +13350,7 @@ db.command("get <namespace> <key>").description("print a value as JSON (--with-v
|
|
|
13124
13350
|
);
|
|
13125
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(
|
|
13126
13352
|
run2(async (namespace, key, json, opts) => {
|
|
13127
|
-
const text2 = json ??
|
|
13353
|
+
const text2 = json ?? readFileSync27(0, "utf8");
|
|
13128
13354
|
let value;
|
|
13129
13355
|
try {
|
|
13130
13356
|
value = JSON.parse(text2);
|
|
@@ -13170,6 +13396,17 @@ auditCommand.command("export").description("print the workspace's audit facts in
|
|
|
13170
13396
|
} while (cursor);
|
|
13171
13397
|
})
|
|
13172
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
|
+
);
|
|
13173
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");
|
|
13174
13411
|
var siteLine = (s) => `${s.name} ${s.url} ${s.kind === "app" ? `app, deploy ${s.deploy?.id ?? "-"}` : `artifact ${s.artifact_id}`}`;
|
|
13175
13412
|
site.command("ls").description("the workspace's sites").option("--json", "print as JSON").action(
|
|
@@ -13463,7 +13700,7 @@ var tool = program.command("tool").description("list and call the tools of Agent
|
|
|
13463
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)));
|
|
13464
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)));
|
|
13465
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(
|
|
13466
|
-
run2(async (
|
|
13703
|
+
run2(async (id2, opts) => {
|
|
13467
13704
|
const body = {
|
|
13468
13705
|
...opts.name ? { displayName: opts.name } : {},
|
|
13469
13706
|
...opts.description !== void 0 ? { description: opts.description } : {},
|
|
@@ -13472,7 +13709,7 @@ agent.command("edit <id>").description("change an agent's name, description, eng
|
|
|
13472
13709
|
...opts.thinking ? { reasoningEffort: opts.thinking === "default" ? null : opts.thinking } : {}
|
|
13473
13710
|
};
|
|
13474
13711
|
if (!Object.keys(body).length) throw new Error("pass at least one of --name, --description, --engine, --model, --thinking");
|
|
13475
|
-
const { agent: a } = await api("PATCH", `/agents/${encodeURIComponent(
|
|
13712
|
+
const { agent: a } = await api("PATCH", `/agents/${encodeURIComponent(id2)}`, body);
|
|
13476
13713
|
console.log(`${a.id} \u2014 ${a.displayName} \xB7 ${a.agentType} \xB7 ${a.llm}${a.reasoningEffort ? ` \xB7 ${a.reasoningEffort}` : ""}`);
|
|
13477
13714
|
})
|
|
13478
13715
|
);
|
|
@@ -13540,7 +13777,7 @@ notes.command("rm <storeId> <noteId>").description("delete one note from a works
|
|
|
13540
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(
|
|
13541
13778
|
run2(async (storeId, file, opts) => {
|
|
13542
13779
|
if (!opts.path === !opts.note) throw new Error("pass exactly one of --path (new note) or --note (update)");
|
|
13543
|
-
const content =
|
|
13780
|
+
const content = readFileSync27(file, "utf8");
|
|
13544
13781
|
const target2 = `/memory_stores/${encodeURIComponent(storeId)}/memories${opts.note ? `/${encodeURIComponent(opts.note)}` : ""}`;
|
|
13545
13782
|
const { memory: memory2 } = await api("POST", target2, { content, ...opts.path ? { path: opts.path } : {} });
|
|
13546
13783
|
console.log(`Saved ${memory2.path} (${memory2.id})`);
|
|
@@ -13558,7 +13795,7 @@ notes.command("export <storeId>").description("every current note of a store as
|
|
|
13558
13795
|
);
|
|
13559
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(
|
|
13560
13797
|
run2(async (storeId, file, opts) => {
|
|
13561
|
-
const receipt = await importMemoryStore(storeId, parseMemoryExport(
|
|
13798
|
+
const receipt = await importMemoryStore(storeId, parseMemoryExport(readFileSync27(file, "utf8")), opts.requestId);
|
|
13562
13799
|
console.log(`Imported ${receipt.imported} notes`);
|
|
13563
13800
|
})
|
|
13564
13801
|
);
|
|
@@ -13656,7 +13893,7 @@ harness.command("connect").description("run an ACP agent (the command after --)
|
|
|
13656
13893
|
}));
|
|
13657
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)");
|
|
13658
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) => {
|
|
13659
|
-
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");
|
|
13660
13897
|
if (readState()) throw new Error("a trace is already running here \u2014 `sky trace stop` it first");
|
|
13661
13898
|
const scopes = parseContentScopes(opts.capture);
|
|
13662
13899
|
const chosen = chosenPaths(opts.file ?? [], opts.dir ?? []);
|
|
@@ -13691,7 +13928,7 @@ traceCmd.command("start").description("start a trace: a grant for this machine,
|
|
|
13691
13928
|
}));
|
|
13692
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 () => {
|
|
13693
13930
|
try {
|
|
13694
|
-
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");
|
|
13695
13932
|
const chunks = [];
|
|
13696
13933
|
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
13697
13934
|
const input = JSON.parse(Buffer.concat(chunks).toString("utf8") || "{}");
|
|
@@ -13704,14 +13941,14 @@ traceCmd.command("hook").description("record one Claude Code hook event read fro
|
|
|
13704
13941
|
}
|
|
13705
13942
|
});
|
|
13706
13943
|
traceCmd.command("flush").description("send what the spool holds, retrying with backoff").action(run2(async () => {
|
|
13707
|
-
const { readState, flush, grantSender } = await import("./trace-
|
|
13944
|
+
const { readState, flush, grantSender } = await import("./trace-PXIY5WUU.js");
|
|
13708
13945
|
const state = readState();
|
|
13709
13946
|
if (!state) throw new Error("no trace is running here");
|
|
13710
13947
|
const outcome = await flush(grantSender(state), { attempts: 4 });
|
|
13711
13948
|
console.log(`sent ${outcome.sent}, refused ${outcome.refused}, given up ${outcome.expired}, still pending ${outcome.pending}${outcome.stopped ? ` (stopped: ${outcome.stopped})` : ""}`);
|
|
13712
13949
|
}));
|
|
13713
13950
|
traceCmd.command("status").description("the running trace and its spool").action(run2(async () => {
|
|
13714
|
-
const { readState, spoolStatus } = await import("./trace-
|
|
13951
|
+
const { readState, spoolStatus } = await import("./trace-PXIY5WUU.js");
|
|
13715
13952
|
const state = readState();
|
|
13716
13953
|
if (!state) {
|
|
13717
13954
|
console.log("No trace is running here.");
|
|
@@ -13720,9 +13957,9 @@ traceCmd.command("status").description("the running trace and its spool").action
|
|
|
13720
13957
|
const spool = spoolStatus();
|
|
13721
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`);
|
|
13722
13959
|
}));
|
|
13723
|
-
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 (
|
|
13724
|
-
const { readState } = await import("./trace-
|
|
13725
|
-
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;
|
|
13726
13963
|
if (!ref) throw new Error("name a trace, or start one here");
|
|
13727
13964
|
const bundle = await api("GET", `/traces/${ref}`);
|
|
13728
13965
|
if (opts.json) {
|
|
@@ -13748,7 +13985,7 @@ traceCmd.command("show [id]").description("the trace bundle: spans, the sessions
|
|
|
13748
13985
|
for (const gap of bundle.gaps) console.log(` gap: ${gap.span_id} ${gap.reason}`);
|
|
13749
13986
|
}));
|
|
13750
13987
|
traceCmd.command("stop").description("end the root span, send what is left, and revoke this machine's grant").action(run2(async () => {
|
|
13751
|
-
const { readState, record: record3, flush, grantSender, clearState } = await import("./trace-
|
|
13988
|
+
const { readState, record: record3, flush, grantSender, clearState } = await import("./trace-PXIY5WUU.js");
|
|
13752
13989
|
const state = readState();
|
|
13753
13990
|
if (!state) throw new Error("no trace is running here");
|
|
13754
13991
|
if (state.root_span) record3(() => [{ span_id: state.root_span, kind: "end", outcome: "completed" }]);
|
|
@@ -13761,7 +13998,7 @@ var recordCmd = traceCmd.command("record").description("record every Claude Code
|
|
|
13761
13998
|
const { homedir: homedir11 } = await import("os");
|
|
13762
13999
|
const { join: join21 } = await import("path");
|
|
13763
14000
|
const vault2 = await import("./trace-vault-IUNYRVGZ.js");
|
|
13764
|
-
const { installClaudeHooks, uninstallClaudeHooks } = await import("./trace-
|
|
14001
|
+
const { installClaudeHooks, uninstallClaudeHooks } = await import("./trace-PXIY5WUU.js");
|
|
13765
14002
|
const command = "sky trace record hook";
|
|
13766
14003
|
const config = vault2.loadVaultConfig();
|
|
13767
14004
|
const settings = resolve12(opts.settings ?? config.settings ?? join21(process.env.CLAUDE_CONFIG_DIR ?? join21(homedir11(), ".claude"), "settings.json"));
|
|
@@ -13826,7 +14063,7 @@ recordCmd.command("seal <session-dir>").description("seal the cut segments of on
|
|
|
13826
14063
|
}
|
|
13827
14064
|
});
|
|
13828
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) => {
|
|
13829
|
-
const lib = await import("./trace-library-
|
|
14066
|
+
const lib = await import("./trace-library-IUFJWBN3.js");
|
|
13830
14067
|
if (opts.hook) {
|
|
13831
14068
|
try {
|
|
13832
14069
|
let raw = payload ?? "";
|
|
@@ -13851,7 +14088,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13851
14088
|
return;
|
|
13852
14089
|
}
|
|
13853
14090
|
if (opts.exclude || opts.unexclude) {
|
|
13854
|
-
const { changeExclusions, macSettingsPath } = await import("./trace-exclusions-
|
|
14091
|
+
const { changeExclusions, macSettingsPath } = await import("./trace-exclusions-HG5MF7NI.js");
|
|
13855
14092
|
const { dirname: dirname13 } = await import("path");
|
|
13856
14093
|
const changed = changeExclusions(dirname13(lib.syncConfigPath()), { add: opts.exclude, remove: opts.unexclude });
|
|
13857
14094
|
console.log(changed.exclusions.folders.length ? "Sync never uploads sessions that ran in:" : "No folder is excluded.");
|
|
@@ -13908,11 +14145,11 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13908
14145
|
console.log(`Sweeping every 15 minutes (${plist}); a full re-read runs weekly. Log: ${log}`);
|
|
13909
14146
|
}
|
|
13910
14147
|
if (opts.status) {
|
|
13911
|
-
const { readFileSync:
|
|
14148
|
+
const { readFileSync: readFileSync28 } = await import("fs");
|
|
13912
14149
|
const { join: join21 } = await import("path");
|
|
13913
14150
|
let state = { sessions: {} };
|
|
13914
14151
|
try {
|
|
13915
|
-
state = JSON.parse(
|
|
14152
|
+
state = JSON.parse(readFileSync28(join21(lib.syncConfigPath(), "..", "trace-sync-state.json"), "utf8"));
|
|
13916
14153
|
} catch {
|
|
13917
14154
|
}
|
|
13918
14155
|
const counts = /* @__PURE__ */ new Map();
|
|
@@ -13922,7 +14159,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13922
14159
|
}
|
|
13923
14160
|
console.log(`Trace sync is ${config.enabled ? "on" : "off"}${config.enabledAt ? ` (since ${config.enabledAt})` : ""}. Last full sweep: ${state.lastFullAt ?? "never"}.`);
|
|
13924
14161
|
for (const [label, count] of [...counts].sort((a, b) => b[1] - a[1])) console.log(` ${count} ${label}`);
|
|
13925
|
-
const { loadExclusions } = await import("./trace-exclusions-
|
|
14162
|
+
const { loadExclusions } = await import("./trace-exclusions-HG5MF7NI.js");
|
|
13926
14163
|
for (const folder of loadExclusions(join21(lib.syncConfigPath(), "..")).folders) console.log(` excluded: ${folder}`);
|
|
13927
14164
|
return;
|
|
13928
14165
|
}
|
|
@@ -13939,7 +14176,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13939
14176
|
return;
|
|
13940
14177
|
}
|
|
13941
14178
|
if (!opts.dryRun) {
|
|
13942
|
-
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-
|
|
14179
|
+
const { describeLocalSkills, refreshLocalSkills } = await import("./local-skills-run-Y47FCKEL.js");
|
|
13943
14180
|
try {
|
|
13944
14181
|
const skills2 = await refreshLocalSkills({ hook: Boolean(opts.session?.length) });
|
|
13945
14182
|
if (skills2 && !opts.quiet) for (const line2 of describeLocalSkills(skills2)) console.log(line2);
|
|
@@ -13950,11 +14187,11 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13950
14187
|
if (!opts.quiet || report.failed) {
|
|
13951
14188
|
if (report.legacySources) console.log(`Kept ${report.legacySources} unbound legacy source archives locally; no ownership was inferred.`);
|
|
13952
14189
|
const where = Object.entries(report.byWorkspace).map(([workspace2, count]) => `${count} \u2192 ${workspace2}`).join(", ");
|
|
13953
|
-
console.log(`${opts.dryRun ? "Would upload" : "Uploaded"} ${report.uploaded}${where ? ` (${where})` : ""}; unchanged ${report.unchanged}; saved as sessions ${report.sessions}; excluded ${report.excluded}; kept local ${report.local}; empty ${report.empty}; another member's ${report.owned}; failed ${report.failed}. Scanned ${report.scanned}, ${report.changed} changed.`);
|
|
14190
|
+
console.log(`${opts.dryRun ? "Would upload" : "Uploaded"} ${report.uploaded}${where ? ` (${where})` : ""}; unchanged ${report.unchanged}; saved as sessions ${report.sessions}; excluded ${report.excluded}; left out as paused ${report.paused}; kept local ${report.local}; empty ${report.empty}; another member's ${report.owned}; failed ${report.failed}. Scanned ${report.scanned}, ${report.changed} changed.`);
|
|
13954
14191
|
for (const error of report.errors.slice(0, 20)) console.error(` ${error}`);
|
|
13955
14192
|
}
|
|
13956
14193
|
if (!opts.session && !opts.dryRun) {
|
|
13957
|
-
const { upkeepComputer } = await import("./compute-report-
|
|
14194
|
+
const { upkeepComputer } = await import("./compute-report-AAEKLNPM.js");
|
|
13958
14195
|
const said = await upkeepComputer().catch((error) => `AgentSky could not check this computer's setup: ${error instanceof Error ? error.message : String(error)}`);
|
|
13959
14196
|
if (said) console.log(said);
|
|
13960
14197
|
}
|
|
@@ -13963,7 +14200,7 @@ traceCmd.command("sync [payload]").description("upload this machine's agent sess
|
|
|
13963
14200
|
});
|
|
13964
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) => {
|
|
13965
14202
|
if (opts.on && opts.off) throw new Error("choose --on or --off");
|
|
13966
|
-
const { libraryRequest } = await import("./trace-library-
|
|
14203
|
+
const { libraryRequest } = await import("./trace-library-IUFJWBN3.js");
|
|
13967
14204
|
const workspace2 = opts.workspace ?? currentUniverse();
|
|
13968
14205
|
if (!workspace2) throw new Error("name a workspace with --workspace");
|
|
13969
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);
|
|
@@ -13980,7 +14217,7 @@ traceCmd.command("search <query...>").description("search every session in a wor
|
|
|
13980
14217
|
console.log(opts.json ? JSON.stringify(page, null, 2) : renderContextPage(page));
|
|
13981
14218
|
}));
|
|
13982
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) => {
|
|
13983
|
-
const { libraryRequest } = await import("./trace-library-
|
|
14220
|
+
const { libraryRequest } = await import("./trace-library-IUFJWBN3.js");
|
|
13984
14221
|
const workspace2 = opts.workspace ?? currentUniverse();
|
|
13985
14222
|
if (!workspace2) throw new Error("name a workspace with --workspace");
|
|
13986
14223
|
const page = await libraryRequest("GET", `/trace-library?limit=${opts.limit}`, workspace2);
|
|
@@ -14048,8 +14285,8 @@ compare.command("list").description("your workspace comparisons, most recently u
|
|
|
14048
14285
|
})
|
|
14049
14286
|
);
|
|
14050
14287
|
compare.command("show <id>").description("one comparison: request, agents, status, and the vote verdict").option("--json", "print as JSON").action(
|
|
14051
|
-
run2(async (
|
|
14052
|
-
const detail = await getComparison(
|
|
14288
|
+
run2(async (id2, opts) => {
|
|
14289
|
+
const detail = await getComparison(id2);
|
|
14053
14290
|
if (opts.json) {
|
|
14054
14291
|
console.log(JSON.stringify(detail, null, 2));
|
|
14055
14292
|
return;
|
|
@@ -14068,11 +14305,11 @@ compare.command("show <id>").description("one comparison: request, agents, statu
|
|
|
14068
14305
|
})
|
|
14069
14306
|
);
|
|
14070
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(
|
|
14071
|
-
run2(async (
|
|
14308
|
+
run2(async (id2, opts) => {
|
|
14072
14309
|
const choices = [opts.winner, opts.tie, opts.bothBad].filter(Boolean).length;
|
|
14073
14310
|
if (choices !== 1) throw new ApiError(400, "invalid_request", "Provide exactly one of --winner, --tie or --both-bad.");
|
|
14074
14311
|
const outcome = opts.tie ? "tie" : opts.bothBad ? "both_bad" : void 0;
|
|
14075
|
-
const result = await pickWinner(
|
|
14312
|
+
const result = await pickWinner(id2, { winnerColumnId: opts.winner, outcome });
|
|
14076
14313
|
if (opts.json) {
|
|
14077
14314
|
console.log(JSON.stringify(result, null, 2));
|
|
14078
14315
|
return;
|
|
@@ -14146,8 +14383,8 @@ thread.command("start <text>").description("start a thread and send it its first
|
|
|
14146
14383
|
})
|
|
14147
14384
|
);
|
|
14148
14385
|
thread.command("show <id>").description("one thread with every agent and the session each one runs in").option("--json", "print as JSON").action(
|
|
14149
|
-
run2(async (
|
|
14150
|
-
const detail = await getThread(
|
|
14386
|
+
run2(async (id2, opts) => {
|
|
14387
|
+
const detail = await getThread(id2);
|
|
14151
14388
|
if (opts.json) {
|
|
14152
14389
|
console.log(JSON.stringify(detail, null, 2));
|
|
14153
14390
|
return;
|
|
@@ -14156,9 +14393,9 @@ thread.command("show <id>").description("one thread with every agent and the ses
|
|
|
14156
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 ?? ""}`);
|
|
14157
14394
|
})
|
|
14158
14395
|
);
|
|
14159
|
-
thread.command("rename <id> <title>").description("rename a thread").action(run2(async (
|
|
14160
|
-
await organizeThread(
|
|
14161
|
-
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}`);
|
|
14162
14399
|
}));
|
|
14163
14400
|
for (const [verb, change, description] of [
|
|
14164
14401
|
["pin", { pinned: true }, "pin a thread to the top of the rail"],
|
|
@@ -14168,18 +14405,18 @@ for (const [verb, change, description] of [
|
|
|
14168
14405
|
["mark-read", { seen: true }, "mark a thread read"],
|
|
14169
14406
|
["mark-unread", { seen: false }, "mark a thread unread"]
|
|
14170
14407
|
]) {
|
|
14171
|
-
thread.command(`${verb} <id>`).description(description).action(run2(async (
|
|
14172
|
-
await organizeThread(
|
|
14173
|
-
console.log(`${verb}: ${
|
|
14408
|
+
thread.command(`${verb} <id>`).description(description).action(run2(async (id2) => {
|
|
14409
|
+
await organizeThread(id2, change);
|
|
14410
|
+
console.log(`${verb}: ${id2}`);
|
|
14174
14411
|
}));
|
|
14175
14412
|
}
|
|
14176
|
-
thread.command("delete <id>").description("delete a thread with its sessions").action(run2(async (
|
|
14177
|
-
await deleteThread(
|
|
14178
|
-
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}`);
|
|
14179
14416
|
}));
|
|
14180
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(
|
|
14181
|
-
run2(async (
|
|
14182
|
-
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 } : {} });
|
|
14183
14420
|
if (opts.json) {
|
|
14184
14421
|
console.log(JSON.stringify(results, null, 2));
|
|
14185
14422
|
return;
|
|
@@ -14188,23 +14425,23 @@ thread.command("send <id> <text>").description("send one message to every agent
|
|
|
14188
14425
|
})
|
|
14189
14426
|
);
|
|
14190
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(
|
|
14191
|
-
run2(async (
|
|
14192
|
-
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 } : {} });
|
|
14193
14430
|
for (const col of columns) console.log(`added agent ${col.columnId} session ${col.sessionId}`);
|
|
14194
14431
|
})
|
|
14195
14432
|
);
|
|
14196
|
-
thread.command("remove-agent <id> <columnId>").description("take one agent out of the thread; its session is left as it is").action(run2(async (
|
|
14197
|
-
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);
|
|
14198
14435
|
console.log(`removed ${columnId}`);
|
|
14199
14436
|
}));
|
|
14200
|
-
thread.command("stop <id>").description("stop what the thread's agents are doing").option("--agent <columnId>", "stop only this agent").action(run2(async (
|
|
14201
|
-
await interruptThread(
|
|
14202
|
-
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}`);
|
|
14203
14440
|
}));
|
|
14204
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(
|
|
14205
|
-
run2(async (
|
|
14442
|
+
run2(async (id2, opts) => {
|
|
14206
14443
|
const [agentType, llm] = (opts.to ?? "").split(":");
|
|
14207
|
-
const { playgroundId } = await forkThread(
|
|
14444
|
+
const { playgroundId } = await forkThread(id2, {
|
|
14208
14445
|
requestId: `sky-fork-${crypto.randomUUID()}`,
|
|
14209
14446
|
...opts.agent ? { columnId: opts.agent } : {},
|
|
14210
14447
|
...opts.at ? { messageId: opts.at } : {},
|
|
@@ -14214,9 +14451,9 @@ thread.command("fork <id>").description("continue one agent's conversation in a
|
|
|
14214
14451
|
})
|
|
14215
14452
|
);
|
|
14216
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(
|
|
14217
|
-
run2(async (
|
|
14454
|
+
run2(async (id2, opts) => {
|
|
14218
14455
|
if (!opts.llm && !opts.effort) throw new ApiError(400, "invalid_request", "Provide --llm or --effort.");
|
|
14219
|
-
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);
|
|
14220
14457
|
console.log(`now ${result.llm}${result.reasoningEffort ? ` (${result.reasoningEffort})` : ""}`);
|
|
14221
14458
|
})
|
|
14222
14459
|
);
|
|
@@ -14254,10 +14491,10 @@ project.command("use [repo]").description("remember a repository (owner/name) fo
|
|
|
14254
14491
|
})
|
|
14255
14492
|
);
|
|
14256
14493
|
session.command("feedback <id>").description("read the thumbs-up/down feedback on this session's messages").option("--json", "print as JSON").action(
|
|
14257
|
-
run2(async (
|
|
14494
|
+
run2(async (id2, opts) => {
|
|
14258
14495
|
const result = await api(
|
|
14259
14496
|
"GET",
|
|
14260
|
-
`/sessions/${encodeURIComponent(
|
|
14497
|
+
`/sessions/${encodeURIComponent(id2)}/feedback`
|
|
14261
14498
|
);
|
|
14262
14499
|
if (opts.json) {
|
|
14263
14500
|
console.log(JSON.stringify(result, null, 2));
|
|
@@ -14272,8 +14509,8 @@ session.command("feedback <id>").description("read the thumbs-up/down feedback o
|
|
|
14272
14509
|
})
|
|
14273
14510
|
);
|
|
14274
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(
|
|
14275
|
-
run2(async (
|
|
14276
|
-
const result = await api("POST", `/sessions/${encodeURIComponent(
|
|
14512
|
+
run2(async (id2, opts) => {
|
|
14513
|
+
const result = await api("POST", `/sessions/${encodeURIComponent(id2)}/side-chat`, {
|
|
14277
14514
|
transcript: opts.transcript,
|
|
14278
14515
|
history: [],
|
|
14279
14516
|
question: opts.question,
|
|
@@ -14289,10 +14526,10 @@ session.command("side-chat <id>").description("ask a question about this session
|
|
|
14289
14526
|
})
|
|
14290
14527
|
);
|
|
14291
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(
|
|
14292
|
-
run2(async (
|
|
14529
|
+
run2(async (id2, opts) => {
|
|
14293
14530
|
const result = await api(
|
|
14294
14531
|
"POST",
|
|
14295
|
-
`/sessions/${encodeURIComponent(
|
|
14532
|
+
`/sessions/${encodeURIComponent(id2)}/code-review`,
|
|
14296
14533
|
{ diff: opts.diff, ...opts.filename ? { filename: opts.filename } : {} }
|
|
14297
14534
|
);
|
|
14298
14535
|
if (opts.json) {
|
|
@@ -14310,8 +14547,8 @@ session.command("code-review <id>").description("run the code-review assistant o
|
|
|
14310
14547
|
})
|
|
14311
14548
|
);
|
|
14312
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(
|
|
14313
|
-
run2(async (
|
|
14314
|
-
const path2 = `/sessions/${encodeURIComponent(
|
|
14550
|
+
run2(async (id2, opts) => {
|
|
14551
|
+
const path2 = `/sessions/${encodeURIComponent(id2)}/snapshot?thread=${encodeURIComponent(opts.thread)}`;
|
|
14315
14552
|
const result = await api(opts.revoke ? "DELETE" : "GET", path2);
|
|
14316
14553
|
if (opts.json) {
|
|
14317
14554
|
console.log(JSON.stringify(result, null, 2));
|