deepline 0.1.64 → 0.1.66

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/dist/index.js CHANGED
@@ -234,12 +234,17 @@ function resolveConfig(options) {
234
234
  };
235
235
  }
236
236
 
237
+ // src/http.ts
238
+ var import_node_fs2 = require("fs");
239
+ var import_node_os2 = require("os");
240
+ var import_node_path2 = require("path");
241
+
237
242
  // src/release.ts
238
243
  var SDK_RELEASE = {
239
- version: "0.1.64",
244
+ version: "0.1.66",
240
245
  apiContract: "2026-05-play-bootstrap-dataset-summary",
241
246
  supportPolicy: {
242
- latest: "0.1.64",
247
+ latest: "0.1.66",
243
248
  minimumSupported: "0.1.53",
244
249
  deprecatedBelow: "0.1.53"
245
250
  }
@@ -255,19 +260,51 @@ var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
255
260
  var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
256
261
 
257
262
  // src/http.ts
263
+ var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
258
264
  var HttpClient = class {
259
265
  constructor(config) {
260
266
  this.config = config;
261
267
  }
262
268
  config;
269
+ cleanDiagnosticHeader(value) {
270
+ const normalized = String(value ?? "").replace(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, MAX_DIAGNOSTIC_HEADER_LENGTH);
271
+ return normalized || null;
272
+ }
273
+ readSkillsVersionHeader() {
274
+ const explicit = this.cleanDiagnosticHeader(
275
+ process.env.DEEPLINE_SKILLS_VERSION
276
+ );
277
+ if (explicit) return explicit;
278
+ try {
279
+ const versionPath = (0, import_node_path2.join)(
280
+ process.env.HOME?.trim() || (0, import_node_os2.homedir)(),
281
+ ".local",
282
+ "deepline",
283
+ baseUrlSlug(this.config.baseUrl),
284
+ "sdk-skills",
285
+ ".version"
286
+ );
287
+ if (!(0, import_node_fs2.existsSync)(versionPath)) return null;
288
+ return this.cleanDiagnosticHeader((0, import_node_fs2.readFileSync)(versionPath, "utf-8"));
289
+ } catch {
290
+ return null;
291
+ }
292
+ }
263
293
  authHeaders(extra) {
264
294
  const headers = {
265
295
  Authorization: `Bearer ${this.config.apiKey}`,
266
296
  "User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
297
+ "X-Deepline-Client-Family": "sdk",
298
+ "X-Deepline-CLI-Family": "sdk",
299
+ "X-Deepline-CLI-Version": SDK_VERSION,
267
300
  "X-Deepline-SDK-Version": SDK_VERSION,
268
301
  "X-Deepline-API-Contract": SDK_API_CONTRACT,
269
302
  ...extra
270
303
  };
304
+ const skillsVersion = this.readSkillsVersionHeader();
305
+ if (skillsVersion) {
306
+ headers["X-Deepline-Skills-Version"] = skillsVersion;
307
+ }
271
308
  const bypassToken = typeof process !== "undefined" ? process.env?.VERCEL_PROTECTION_BYPASS_TOKEN : void 0;
272
309
  if (bypassToken) {
273
310
  headers["x-vercel-protection-bypass"] = bypassToken;
@@ -2701,9 +2738,9 @@ function getDefinedPlayMetadata(value) {
2701
2738
  }
2702
2739
 
2703
2740
  // src/tool-output.ts
2704
- var import_node_fs2 = require("fs");
2705
- var import_node_os2 = require("os");
2706
- var import_node_path2 = require("path");
2741
+ var import_node_fs3 = require("fs");
2742
+ var import_node_os3 = require("os");
2743
+ var import_node_path3 = require("path");
2707
2744
  function isPlainObject(value) {
2708
2745
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
2709
2746
  }
@@ -2799,19 +2836,19 @@ function tryConvertToList(payload, options) {
2799
2836
  return null;
2800
2837
  }
2801
2838
  function ensureOutputDir() {
2802
- const outputDir = (0, import_node_path2.join)((0, import_node_os2.homedir)(), ".local", "share", "deepline", "data");
2803
- (0, import_node_fs2.mkdirSync)(outputDir, { recursive: true });
2839
+ const outputDir = (0, import_node_path3.join)((0, import_node_os3.homedir)(), ".local", "share", "deepline", "data");
2840
+ (0, import_node_fs3.mkdirSync)(outputDir, { recursive: true });
2804
2841
  return outputDir;
2805
2842
  }
2806
2843
  function writeJsonOutputFile(payload, stem) {
2807
2844
  const outputDir = ensureOutputDir();
2808
- const outputPath = (0, import_node_path2.join)(outputDir, `${stem}_${Date.now()}.json`);
2809
- (0, import_node_fs2.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
2845
+ const outputPath = (0, import_node_path3.join)(outputDir, `${stem}_${Date.now()}.json`);
2846
+ (0, import_node_fs3.writeFileSync)(outputPath, JSON.stringify(payload, null, 2), "utf-8");
2810
2847
  return outputPath;
2811
2848
  }
2812
2849
  function writeCsvOutputFile(rows, stem) {
2813
2850
  const outputDir = ensureOutputDir();
2814
- const outputPath = (0, import_node_path2.join)(outputDir, `${stem}_${Date.now()}.csv`);
2851
+ const outputPath = (0, import_node_path3.join)(outputDir, `${stem}_${Date.now()}.csv`);
2815
2852
  const seen = /* @__PURE__ */ new Set();
2816
2853
  const columns = [];
2817
2854
  for (const row of rows) {
@@ -2834,7 +2871,7 @@ function writeCsvOutputFile(rows, stem) {
2834
2871
  for (const row of rows) {
2835
2872
  lines.push(columns.map((column) => escapeCell(row[column])).join(","));
2836
2873
  }
2837
- (0, import_node_fs2.writeFileSync)(outputPath, `${lines.join("\n")}
2874
+ (0, import_node_fs3.writeFileSync)(outputPath, `${lines.join("\n")}
2838
2875
  `, "utf-8");
2839
2876
  const previewRows = rows.slice(0, 5);
2840
2877
  const previewColumns = columns.slice(0, 5);
package/dist/index.mjs CHANGED
@@ -172,12 +172,17 @@ function resolveConfig(options) {
172
172
  };
173
173
  }
174
174
 
175
+ // src/http.ts
176
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
177
+ import { homedir as homedir2 } from "os";
178
+ import { join as join2 } from "path";
179
+
175
180
  // src/release.ts
176
181
  var SDK_RELEASE = {
177
- version: "0.1.64",
182
+ version: "0.1.66",
178
183
  apiContract: "2026-05-play-bootstrap-dataset-summary",
179
184
  supportPolicy: {
180
- latest: "0.1.64",
185
+ latest: "0.1.66",
181
186
  minimumSupported: "0.1.53",
182
187
  deprecatedBelow: "0.1.53"
183
188
  }
@@ -193,19 +198,51 @@ var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
193
198
  var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
194
199
 
195
200
  // src/http.ts
201
+ var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
196
202
  var HttpClient = class {
197
203
  constructor(config) {
198
204
  this.config = config;
199
205
  }
200
206
  config;
207
+ cleanDiagnosticHeader(value) {
208
+ const normalized = String(value ?? "").replace(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, MAX_DIAGNOSTIC_HEADER_LENGTH);
209
+ return normalized || null;
210
+ }
211
+ readSkillsVersionHeader() {
212
+ const explicit = this.cleanDiagnosticHeader(
213
+ process.env.DEEPLINE_SKILLS_VERSION
214
+ );
215
+ if (explicit) return explicit;
216
+ try {
217
+ const versionPath = join2(
218
+ process.env.HOME?.trim() || homedir2(),
219
+ ".local",
220
+ "deepline",
221
+ baseUrlSlug(this.config.baseUrl),
222
+ "sdk-skills",
223
+ ".version"
224
+ );
225
+ if (!existsSync2(versionPath)) return null;
226
+ return this.cleanDiagnosticHeader(readFileSync2(versionPath, "utf-8"));
227
+ } catch {
228
+ return null;
229
+ }
230
+ }
201
231
  authHeaders(extra) {
202
232
  const headers = {
203
233
  Authorization: `Bearer ${this.config.apiKey}`,
204
234
  "User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
235
+ "X-Deepline-Client-Family": "sdk",
236
+ "X-Deepline-CLI-Family": "sdk",
237
+ "X-Deepline-CLI-Version": SDK_VERSION,
205
238
  "X-Deepline-SDK-Version": SDK_VERSION,
206
239
  "X-Deepline-API-Contract": SDK_API_CONTRACT,
207
240
  ...extra
208
241
  };
242
+ const skillsVersion = this.readSkillsVersionHeader();
243
+ if (skillsVersion) {
244
+ headers["X-Deepline-Skills-Version"] = skillsVersion;
245
+ }
209
246
  const bypassToken = typeof process !== "undefined" ? process.env?.VERCEL_PROTECTION_BYPASS_TOKEN : void 0;
210
247
  if (bypassToken) {
211
248
  headers["x-vercel-protection-bypass"] = bypassToken;
@@ -2640,8 +2677,8 @@ function getDefinedPlayMetadata(value) {
2640
2677
 
2641
2678
  // src/tool-output.ts
2642
2679
  import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2 } from "fs";
2643
- import { homedir as homedir2 } from "os";
2644
- import { join as join2 } from "path";
2680
+ import { homedir as homedir3 } from "os";
2681
+ import { join as join3 } from "path";
2645
2682
  function isPlainObject(value) {
2646
2683
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
2647
2684
  }
@@ -2737,19 +2774,19 @@ function tryConvertToList(payload, options) {
2737
2774
  return null;
2738
2775
  }
2739
2776
  function ensureOutputDir() {
2740
- const outputDir = join2(homedir2(), ".local", "share", "deepline", "data");
2777
+ const outputDir = join3(homedir3(), ".local", "share", "deepline", "data");
2741
2778
  mkdirSync2(outputDir, { recursive: true });
2742
2779
  return outputDir;
2743
2780
  }
2744
2781
  function writeJsonOutputFile(payload, stem) {
2745
2782
  const outputDir = ensureOutputDir();
2746
- const outputPath = join2(outputDir, `${stem}_${Date.now()}.json`);
2783
+ const outputPath = join3(outputDir, `${stem}_${Date.now()}.json`);
2747
2784
  writeFileSync2(outputPath, JSON.stringify(payload, null, 2), "utf-8");
2748
2785
  return outputPath;
2749
2786
  }
2750
2787
  function writeCsvOutputFile(rows, stem) {
2751
2788
  const outputDir = ensureOutputDir();
2752
- const outputPath = join2(outputDir, `${stem}_${Date.now()}.csv`);
2789
+ const outputPath = join3(outputDir, `${stem}_${Date.now()}.csv`);
2753
2790
  const seen = /* @__PURE__ */ new Set();
2754
2791
  const columns = [];
2755
2792
  for (const row of rows) {