@agentsky/sky 2.15.0 → 2.17.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.
@@ -3,9 +3,12 @@ import {
3
3
  apiBase,
4
4
  apiToken,
5
5
  currentUniverse
6
- } from "./chunk-R5FKQQMG.js";
6
+ } from "./chunk-H7SWXCH7.js";
7
7
 
8
8
  // src/api.ts
9
+ import { createWriteStream, writeFileSync } from "fs";
10
+ import { Readable } from "stream";
11
+ import { pipeline } from "stream/promises";
9
12
  var ApiError = class extends Error {
10
13
  constructor(status, code, message) {
11
14
  super(message);
@@ -88,12 +91,21 @@ async function apiForm(method, path, form) {
88
91
  if (!res.ok) await parseError(res);
89
92
  return await res.json();
90
93
  }
91
- async function downloadFile(fileId) {
94
+ async function downloadFileTo(fileId, outPath) {
92
95
  const res = await fetch(`${apiBase()}/files/${encodeURIComponent(fileId)}/content`, {
93
96
  headers: { "user-agent": USER_AGENT, ...authHeaders() }
94
97
  });
95
98
  if (!res.ok) await parseError(res);
96
- return { bytes: new Uint8Array(await res.arrayBuffer()), mediaType: res.headers.get("content-type") ?? "application/octet-stream" };
99
+ if (!res.body) {
100
+ writeFileSync(outPath, new Uint8Array(0));
101
+ return 0;
102
+ }
103
+ let written = 0;
104
+ const counted = Readable.fromWeb(res.body).on("data", (chunk) => {
105
+ written += chunk.length;
106
+ });
107
+ await pipeline(counted, createWriteStream(outPath));
108
+ return written;
97
109
  }
98
110
  async function apiBytes(method, path, body) {
99
111
  const res = await fetch(`${apiBase()}${path}`, {
@@ -132,7 +144,7 @@ async function resolveSessionRef(ref) {
132
144
  return agent.defaultSessionId;
133
145
  }
134
146
  async function* streamEvents(sessionId, signal) {
135
- const { parseSseStream } = await import("./src-KLP774OA.js");
147
+ const { parseSseStream } = await import("./src-TJJKOFXZ.js");
136
148
  const res = await fetch(
137
149
  `${apiBase()}/sessions/${encodeURIComponent(sessionId)}/stream`,
138
150
  {
@@ -161,7 +173,7 @@ export {
161
173
  postEvents,
162
174
  uploadFile,
163
175
  apiForm,
164
- downloadFile,
176
+ downloadFileTo,
165
177
  apiBytes,
166
178
  resolveSessionRef,
167
179
  streamEvents
@@ -38,7 +38,7 @@ function currentUniverse() {
38
38
  }
39
39
 
40
40
  // src/version.ts
41
- var CLI_VERSION = "2.15.0";
41
+ var CLI_VERSION = "2.17.0";
42
42
  var USER_AGENT = `sky-cli/${CLI_VERSION} (${process.platform}; node/${process.versions.node})`;
43
43
 
44
44
  export {
@@ -19407,6 +19407,18 @@ function rewriteCodeExpression(value, declaration) {
19407
19407
  const full = semicolon ? `${awaitPrefix}${rewritten};` : `${awaitPrefix}${rewritten}`;
19408
19408
  return value.replace(value.trim(), full);
19409
19409
  }
19410
+ function redactSecretValues(text) {
19411
+ const hits = {};
19412
+ let out = text;
19413
+ for (const p of compiled) {
19414
+ p.re.lastIndex = 0;
19415
+ out = out.replace(p.re, (...m) => {
19416
+ hits[p.name] = (hits[p.name] ?? 0) + 1;
19417
+ return p.replacement.replace(/\$(\d)/g, (_, i) => String(m[Number(i)] ?? ""));
19418
+ });
19419
+ }
19420
+ return { text: out, hits };
19421
+ }
19410
19422
  function redactPlainText(text) {
19411
19423
  const hits = {};
19412
19424
  let out = redactFieldAssignments(text, () => {
@@ -23649,6 +23661,7 @@ export {
23649
23661
  isModelEffortSupported,
23650
23662
  reasoningEffortDocLine,
23651
23663
  sessionResourcesParamSchema,
23664
+ redactSecretValues,
23652
23665
  redactLine,
23653
23666
  TRACE_CONTENT_SCOPES,
23654
23667
  redactTraceText,