@agentsky/sky 2.11.0 → 2.12.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.
@@ -0,0 +1,168 @@
1
+ import {
2
+ USER_AGENT,
3
+ apiBase,
4
+ apiToken,
5
+ currentUniverse
6
+ } from "./chunk-RF5JICNX.js";
7
+
8
+ // src/api.ts
9
+ var ApiError = class extends Error {
10
+ constructor(status, code, message) {
11
+ super(message);
12
+ this.status = status;
13
+ this.code = code;
14
+ }
15
+ status;
16
+ code;
17
+ };
18
+ function authHeaders() {
19
+ const token = apiToken();
20
+ if (!token) {
21
+ throw new ApiError(401, "not_logged_in", "not logged in \u2014 run `sky auth login`");
22
+ }
23
+ const headers = { authorization: `Bearer ${token}` };
24
+ const universe = currentUniverse();
25
+ if (universe) headers["x-universe"] = universe;
26
+ return headers;
27
+ }
28
+ async function parseError(res) {
29
+ let code = "http_error";
30
+ let message = `${res.status} ${res.statusText}`;
31
+ try {
32
+ const body = await res.json();
33
+ if (body.error?.message) {
34
+ code = body.error.code ?? code;
35
+ message = body.error.message;
36
+ }
37
+ } catch {
38
+ }
39
+ throw new ApiError(res.status, code, message);
40
+ }
41
+ async function api(method, path, body, opts = {}) {
42
+ const res = await fetch(`${apiBase()}${path}`, {
43
+ method,
44
+ headers: {
45
+ "user-agent": USER_AGENT,
46
+ ...opts.auth === false ? {} : authHeaders(),
47
+ ...body !== void 0 ? { "content-type": "application/json" } : {},
48
+ ...opts.idempotencyKey ? { "idempotency-key": opts.idempotencyKey } : {}
49
+ },
50
+ body: body !== void 0 ? JSON.stringify(body) : void 0
51
+ });
52
+ if (!res.ok) await parseError(res);
53
+ if (res.status === 204) return void 0;
54
+ return await res.json();
55
+ }
56
+ async function postEvents(sessionId, events, idempotencyKey) {
57
+ const res = await fetch(`${apiBase()}/sessions/${encodeURIComponent(sessionId)}/events`, {
58
+ method: "POST",
59
+ headers: {
60
+ "user-agent": USER_AGENT,
61
+ ...authHeaders(),
62
+ "content-type": "application/json",
63
+ ...idempotencyKey ? { "idempotency-key": idempotencyKey } : {}
64
+ },
65
+ body: JSON.stringify({ events })
66
+ });
67
+ if (!res.ok) await parseError(res);
68
+ return await res.json();
69
+ }
70
+ async function uploadFile(bytes, filename, mediaType, expiresInSeconds) {
71
+ const form = new FormData();
72
+ form.append("file", new Blob([new Uint8Array(bytes)], { type: mediaType }), filename);
73
+ if (expiresInSeconds) form.append("expires_in_seconds", String(expiresInSeconds));
74
+ const res = await fetch(`${apiBase()}/files`, {
75
+ method: "POST",
76
+ headers: { "user-agent": USER_AGENT, ...authHeaders() },
77
+ body: form
78
+ });
79
+ if (!res.ok) await parseError(res);
80
+ return await res.json();
81
+ }
82
+ async function apiForm(method, path, form) {
83
+ const res = await fetch(`${apiBase()}${path}`, {
84
+ method,
85
+ headers: { "user-agent": USER_AGENT, ...authHeaders() },
86
+ body: form
87
+ });
88
+ if (!res.ok) await parseError(res);
89
+ return await res.json();
90
+ }
91
+ async function downloadFile(fileId) {
92
+ const res = await fetch(`${apiBase()}/files/${encodeURIComponent(fileId)}/content`, {
93
+ headers: { "user-agent": USER_AGENT, ...authHeaders() }
94
+ });
95
+ if (!res.ok) await parseError(res);
96
+ return { bytes: new Uint8Array(await res.arrayBuffer()), mediaType: res.headers.get("content-type") ?? "application/octet-stream" };
97
+ }
98
+ async function apiBytes(method, path, body) {
99
+ const res = await fetch(`${apiBase()}${path}`, {
100
+ method,
101
+ headers: {
102
+ "user-agent": USER_AGENT,
103
+ ...authHeaders(),
104
+ ...body ? { "content-type": body.mediaType } : {}
105
+ },
106
+ body: body ? new Uint8Array(body.bytes) : void 0
107
+ });
108
+ if (!res.ok) await parseError(res);
109
+ const bytes = new Uint8Array(await res.arrayBuffer());
110
+ return {
111
+ bytes,
112
+ mediaType: res.headers.get("content-type") ?? "application/octet-stream",
113
+ json: () => JSON.parse(new TextDecoder().decode(bytes))
114
+ };
115
+ }
116
+ async function resolveSessionRef(ref) {
117
+ if (ref.startsWith("sess-")) return ref;
118
+ const { agent } = await api(
119
+ "GET",
120
+ `/agents/${encodeURIComponent(ref)}`
121
+ ).catch(async () => {
122
+ await api("GET", `/sessions/${encodeURIComponent(ref)}`);
123
+ return { agent: { id: ref, defaultSessionId: ref } };
124
+ });
125
+ if (!agent.defaultSessionId) {
126
+ throw new ApiError(
127
+ 404,
128
+ "no_sessions",
129
+ `agent ${agent.id} has no sessions \u2014 create one: sky session create ${agent.id}`
130
+ );
131
+ }
132
+ return agent.defaultSessionId;
133
+ }
134
+ async function* streamEvents(sessionId, signal) {
135
+ const { parseSseStream } = await import("./src-S777KCS5.js");
136
+ const res = await fetch(
137
+ `${apiBase()}/sessions/${encodeURIComponent(sessionId)}/stream`,
138
+ {
139
+ headers: { "user-agent": USER_AGENT, ...authHeaders(), accept: "text/event-stream" },
140
+ signal
141
+ }
142
+ );
143
+ if (!res.ok) await parseError(res);
144
+ if (!res.body) throw new ApiError(502, "no_body", "stream returned no body");
145
+ try {
146
+ for await (const frame of parseSseStream(res.body)) {
147
+ if (!frame.data) continue;
148
+ try {
149
+ yield { id: frame.id, event: frame.event, data: JSON.parse(frame.data) };
150
+ } catch {
151
+ }
152
+ }
153
+ } catch (error) {
154
+ if (!(error instanceof DOMException && error.name === "AbortError")) throw error;
155
+ }
156
+ }
157
+
158
+ export {
159
+ ApiError,
160
+ api,
161
+ postEvents,
162
+ uploadFile,
163
+ apiForm,
164
+ downloadFile,
165
+ apiBytes,
166
+ resolveSessionRef,
167
+ streamEvents
168
+ };
@@ -38,7 +38,7 @@ function currentUniverse() {
38
38
  }
39
39
 
40
40
  // src/version.ts
41
- var CLI_VERSION = "2.11.0";
41
+ var CLI_VERSION = "2.12.0";
42
42
  var USER_AGENT = `sky-cli/${CLI_VERSION} (${process.platform}; node/${process.versions.node})`;
43
43
 
44
44
  export {
@@ -18978,6 +18978,8 @@ var REASONING_EFFORT_VALUES = [
18978
18978
  ];
18979
18979
  var MODEL_REASONING_EFFORTS = {
18980
18980
  "claude-haiku-4-5": [],
18981
+ "gemini-4-argon": ["low", "medium", "high"],
18982
+ "gemini-3.5-flash-lite": ["low", "medium", "high"],
18981
18983
  "gemini-3.8-flash": ["low", "medium", "high"],
18982
18984
  "gemini-3.5-flash": ["low", "medium", "high"],
18983
18985
  "glm-5.3": ["low", "high", "max"],
@@ -19043,7 +19045,7 @@ function reasoningEffortsForModel(agentType, model) {
19043
19045
  const levels = REASONING_EFFORTS[agentType];
19044
19046
  if (levels === null) return null;
19045
19047
  if (normalized === "gpt-6.1-sol" && (agentType === "codex" || agentType === "hermes")) return ["low", "medium", "high", "xhigh", "max"];
19046
- if (agentType === "opencode" && (normalized === "muse-spark-1.1" || normalized === "muse-spark-1.2")) return ["minimal", "low", "medium", "high", "xhigh"];
19048
+ if (agentType === "opencode" && (normalized === "muse-spark-1.1" || normalized === "muse-wonder-1.0" || normalized === "muse-spark-1.3" || normalized === "muse-spark-1.2")) return ["minimal", "low", "medium", "high", "xhigh"];
19047
19049
  const modelLevels = normalized ? MODEL_REASONING_EFFORTS[normalized] : void 0;
19048
19050
  return modelLevels ? levels.filter((level) => modelLevels.includes(level)) : levels;
19049
19051
  }
@@ -20073,7 +20075,7 @@ var ACP_PLATFORM_MODELS = {
20073
20075
  docker_cagent: ["deepseek-v4-pro", "deepseek-flash", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "glm-5.3", "glm-5.3-flash", "kimi-k3", "kimi-k2.7-code", "grok-4.7", "grok-4.6", "claude-opus-5", "claude-fable-5-1", "claude-sonnet-5-5", "claude-sonnet-5", "claude-haiku-5-5", "claude-haiku-4-5"],
20074
20076
  fast_agent: ["deepseek-v4-pro", "deepseek-flash", "gpt-6-astra", "glm-5.3", "glm-5.3-flash", "kimi-k3", "kimi-k2.7-code", "grok-4.7", "grok-4.6", "claude-sonnet-5-5", "claude-sonnet-5"],
20075
20077
  goose: ["deepseek-v4-pro", "deepseek-flash", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "glm-5.3", "glm-5.3-flash", "kimi-k3", "kimi-k2.7-code", "grok-4.7", "grok-4.6", "claude-opus-5", "claude-fable-5-1", "claude-sonnet-5-5", "claude-sonnet-5", "claude-haiku-5-5", "claude-haiku-4-5"],
20076
- muse_code: ["muse-spark-1.2"],
20078
+ muse_code: ["muse-spark-1.2", "muse-spark-1.3", "muse-wonder-1.0"],
20077
20079
  grok_build: ["grok-4.7", "grok-4.6", "deepseek-v4-pro", "deepseek-flash", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "glm-5.3", "glm-5.3-flash", "kimi-k3", "kimi-k2.7-code"],
20078
20080
  kilo: ["deepseek-v4-pro", "deepseek-flash", "gpt-5.6-sol", "gpt-5.6-terra", "gpt-5.6-luna", "gpt-6-astra", "glm-5.3", "glm-5.3-flash", "kimi-k3", "kimi-k2.7-code", "grok-4.7", "grok-4.6", "claude-opus-5", "claude-fable-5-1", "claude-sonnet-5-5", "claude-sonnet-5", "claude-haiku-5-5", "claude-haiku-4-5"],
20079
20081
  minimax_code: ["minimax-m3", "deepseek-v4-pro", "deepseek-flash", "gpt-5.6-terra", "gpt-6-astra", "claude-fable-5-1", "claude-sonnet-5-5", "claude-sonnet-5", "claude-haiku-5-5", "claude-haiku-4-5", "glm-5.3", "glm-5.3-flash", "kimi-k3", "kimi-k2.7-code", "grok-4.7", "grok-4.6", "gpt-6.1-sol", "gpt-6-sol", "gpt-6-luna", "gpt-5.6-sol", "claude-opus-5", "claude-opus-5-5", "gpt-5.5", "claude-fable-5", "claude-opus-4-8", "claude-sonnet-4-6", "deepseek-v4-flash"],
@@ -20086,6 +20088,9 @@ var ACP_PLATFORM_MODELS = {
20086
20088
  vtcode: ["deepseek-v4-pro"]
20087
20089
  };
20088
20090
 
20091
+ // ../../packages/spec/src/catalog-models.ts
20092
+ var CATALOG_MODELS = [];
20093
+
20089
20094
  // ../../packages/spec/src/acp-setup.ts
20090
20095
  var ACP_ACCOUNT_PROFILES = {
20091
20096
  "agoragentic_acp": {
@@ -22004,6 +22009,8 @@ var GATEWAY_CAPABILITY_IDS = [
22004
22009
  "meta.transcribe",
22005
22010
  "minimax.tts",
22006
22011
  "elevenlabs.sound",
22012
+ "elevenlabs.tts",
22013
+ "elevenlabs.music",
22007
22014
  "zai.transcribe",
22008
22015
  "openai.transcribe",
22009
22016
  "fish-audio.tts",
@@ -22076,6 +22083,8 @@ var allowedLlms = {
22076
22083
  "gpt-5.6-terra",
22077
22084
  "gpt-5.6-luna",
22078
22085
  "gpt-6-astra",
22086
+ "gemini-4-argon",
22087
+ "gemini-3.5-flash-lite",
22079
22088
  "gemini-3.8-flash",
22080
22089
  "glm-5.3",
22081
22090
  "glm-5.3-flash",
@@ -22140,6 +22149,8 @@ var allowedLlms = {
22140
22149
  "gpt-6-luna",
22141
22150
  "deepseek-v4-pro",
22142
22151
  "deepseek-flash",
22152
+ "gemini-4-argon",
22153
+ "gemini-3.5-flash-lite",
22143
22154
  "gemini-3.8-flash",
22144
22155
  "glm-5.3",
22145
22156
  "glm-5.3-flash",
@@ -22164,6 +22175,8 @@ var allowedLlms = {
22164
22175
  "gpt-6.1-sol",
22165
22176
  "gpt-6-sol",
22166
22177
  "gpt-6-luna",
22178
+ "gemini-4-argon",
22179
+ "gemini-3.5-flash-lite",
22167
22180
  "gemini-3.8-flash",
22168
22181
  "deepseek-v4-pro",
22169
22182
  "deepseek-flash",
@@ -22173,6 +22186,8 @@ var allowedLlms = {
22173
22186
  "kimi-k2.7-code",
22174
22187
  "grok-4.6",
22175
22188
  "muse-spark-1.1",
22189
+ "muse-wonder-1.0",
22190
+ "muse-spark-1.3",
22176
22191
  "muse-spark-1.2",
22177
22192
  "claude-opus-5-5",
22178
22193
  "claude-opus-5",
@@ -22245,6 +22260,8 @@ var allowedLlms = {
22245
22260
  "grok-4.7",
22246
22261
  "grok-4.6",
22247
22262
  "muse-spark-1.1",
22263
+ "muse-wonder-1.0",
22264
+ "muse-spark-1.3",
22248
22265
  "muse-spark-1.2",
22249
22266
  "claude-opus-5-5",
22250
22267
  "claude-opus-5",
@@ -22274,6 +22291,11 @@ var SUPERSEDED_LLMS = {
22274
22291
  function supersededBy(llm) {
22275
22292
  return SUPERSEDED_LLMS[llm] ?? null;
22276
22293
  }
22294
+ var CATALOG_HARNESSES = ["pi", "hermes", "openclaw", "opencode"];
22295
+ var CATALOG_BY_ID = new Map(CATALOG_MODELS.map((model) => [model.id, model]));
22296
+ function runsCatalogModel(agentType, llm) {
22297
+ return CATALOG_BY_ID.has(llm) && CATALOG_HARNESSES.includes(agentType);
22298
+ }
22277
22299
  var selectableLlms = Object.fromEntries(
22278
22300
  AGENT_TYPES.map((agentType) => [
22279
22301
  agentType,
@@ -22284,7 +22306,7 @@ var SELECTABLE_LLMS = [
22284
22306
  ...new Set(AGENT_TYPES.flatMap((agentType) => selectableLlms[agentType]))
22285
22307
  ];
22286
22308
  function isCompatible(agentType, llm) {
22287
- return allowedLlms[agentType].includes(llm);
22309
+ return allowedLlms[agentType].includes(llm) || runsCatalogModel(agentType, llm);
22288
22310
  }
22289
22311
  function defaultLlm(agentType) {
22290
22312
  return allowedLlms[agentType][0];