deepline 0.1.64 → 0.1.65
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/cli/index.js +236 -199
- package/dist/cli/index.mjs +120 -83
- package/dist/index.js +48 -11
- package/dist/index.mjs +44 -7
- package/dist/repo/sdk/src/http.ts +44 -0
- package/dist/repo/sdk/src/release.ts +2 -2
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
// src/cli/index.ts
|
|
4
4
|
import { mkdtemp, rm, writeFile as writeFile4 } from "fs/promises";
|
|
5
|
-
import { join as
|
|
5
|
+
import { join as join12 } from "path";
|
|
6
6
|
import { tmpdir as tmpdir4 } from "os";
|
|
7
7
|
import { Command as Command3 } from "commander";
|
|
8
8
|
|
|
@@ -199,12 +199,17 @@ function resolveConfig(options) {
|
|
|
199
199
|
};
|
|
200
200
|
}
|
|
201
201
|
|
|
202
|
+
// src/http.ts
|
|
203
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
204
|
+
import { homedir as homedir2 } from "os";
|
|
205
|
+
import { join as join2 } from "path";
|
|
206
|
+
|
|
202
207
|
// src/release.ts
|
|
203
208
|
var SDK_RELEASE = {
|
|
204
|
-
version: "0.1.
|
|
209
|
+
version: "0.1.65",
|
|
205
210
|
apiContract: "2026-05-play-bootstrap-dataset-summary",
|
|
206
211
|
supportPolicy: {
|
|
207
|
-
latest: "0.1.
|
|
212
|
+
latest: "0.1.65",
|
|
208
213
|
minimumSupported: "0.1.53",
|
|
209
214
|
deprecatedBelow: "0.1.53"
|
|
210
215
|
}
|
|
@@ -220,19 +225,51 @@ var COORDINATOR_URL_OVERRIDE_HEADER = "x-deepline-coordinator-url";
|
|
|
220
225
|
var WORKER_CALLBACK_URL_OVERRIDE_HEADER = "x-deepline-worker-callback-url";
|
|
221
226
|
|
|
222
227
|
// src/http.ts
|
|
228
|
+
var MAX_DIAGNOSTIC_HEADER_LENGTH = 120;
|
|
223
229
|
var HttpClient = class {
|
|
224
230
|
constructor(config) {
|
|
225
231
|
this.config = config;
|
|
226
232
|
}
|
|
227
233
|
config;
|
|
234
|
+
cleanDiagnosticHeader(value) {
|
|
235
|
+
const normalized = String(value ?? "").replace(/[\u0000-\u001f\u007f]/g, " ").trim().slice(0, MAX_DIAGNOSTIC_HEADER_LENGTH);
|
|
236
|
+
return normalized || null;
|
|
237
|
+
}
|
|
238
|
+
readSkillsVersionHeader() {
|
|
239
|
+
const explicit = this.cleanDiagnosticHeader(
|
|
240
|
+
process.env.DEEPLINE_SKILLS_VERSION
|
|
241
|
+
);
|
|
242
|
+
if (explicit) return explicit;
|
|
243
|
+
try {
|
|
244
|
+
const versionPath = join2(
|
|
245
|
+
process.env.HOME?.trim() || homedir2(),
|
|
246
|
+
".local",
|
|
247
|
+
"deepline",
|
|
248
|
+
baseUrlSlug(this.config.baseUrl),
|
|
249
|
+
"sdk-skills",
|
|
250
|
+
".version"
|
|
251
|
+
);
|
|
252
|
+
if (!existsSync2(versionPath)) return null;
|
|
253
|
+
return this.cleanDiagnosticHeader(readFileSync2(versionPath, "utf-8"));
|
|
254
|
+
} catch {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
228
258
|
authHeaders(extra) {
|
|
229
259
|
const headers = {
|
|
230
260
|
Authorization: `Bearer ${this.config.apiKey}`,
|
|
231
261
|
"User-Agent": `deepline-ts-sdk/${SDK_VERSION}`,
|
|
262
|
+
"X-Deepline-Client-Family": "sdk",
|
|
263
|
+
"X-Deepline-CLI-Family": "sdk",
|
|
264
|
+
"X-Deepline-CLI-Version": SDK_VERSION,
|
|
232
265
|
"X-Deepline-SDK-Version": SDK_VERSION,
|
|
233
266
|
"X-Deepline-API-Contract": SDK_API_CONTRACT,
|
|
234
267
|
...extra
|
|
235
268
|
};
|
|
269
|
+
const skillsVersion = this.readSkillsVersionHeader();
|
|
270
|
+
if (skillsVersion) {
|
|
271
|
+
headers["X-Deepline-Skills-Version"] = skillsVersion;
|
|
272
|
+
}
|
|
236
273
|
const bypassToken = typeof process !== "undefined" ? process.env?.VERCEL_PROTECTION_BYPASS_TOKEN : void 0;
|
|
237
274
|
if (bypassToken) {
|
|
238
275
|
headers["x-vercel-protection-bypass"] = bypassToken;
|
|
@@ -1722,9 +1759,9 @@ async function enforceSdkCompatibility(baseUrl) {
|
|
|
1722
1759
|
|
|
1723
1760
|
// src/cli/commands/auth.ts
|
|
1724
1761
|
import {
|
|
1725
|
-
existsSync as
|
|
1762
|
+
existsSync as existsSync4,
|
|
1726
1763
|
mkdirSync as mkdirSync3,
|
|
1727
|
-
readFileSync as
|
|
1764
|
+
readFileSync as readFileSync4,
|
|
1728
1765
|
rmSync,
|
|
1729
1766
|
writeFileSync as writeFileSync3
|
|
1730
1767
|
} from "fs";
|
|
@@ -1732,10 +1769,10 @@ import { hostname } from "os";
|
|
|
1732
1769
|
import { dirname as dirname3 } from "path";
|
|
1733
1770
|
|
|
1734
1771
|
// src/cli/utils.ts
|
|
1735
|
-
import { existsSync as
|
|
1772
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync3, writeFileSync as writeFileSync2 } from "fs";
|
|
1736
1773
|
import { mkdir, writeFile } from "fs/promises";
|
|
1737
|
-
import { homedir as
|
|
1738
|
-
import { dirname as dirname2, join as
|
|
1774
|
+
import { homedir as homedir3 } from "os";
|
|
1775
|
+
import { dirname as dirname2, join as join3, resolve as resolve2 } from "path";
|
|
1739
1776
|
import * as childProcess from "child_process";
|
|
1740
1777
|
import { parse } from "csv-parse/sync";
|
|
1741
1778
|
import { stringify } from "csv-stringify/sync";
|
|
@@ -1748,13 +1785,13 @@ function getAuthedHttpClient() {
|
|
|
1748
1785
|
async function writeOutputFile(filename, content) {
|
|
1749
1786
|
const outputDir = resolve2(process.cwd(), "deepline", "data");
|
|
1750
1787
|
await mkdir(outputDir, { recursive: true });
|
|
1751
|
-
const fullPath =
|
|
1788
|
+
const fullPath = join3(outputDir, filename);
|
|
1752
1789
|
await writeFile(fullPath, content, "utf-8");
|
|
1753
1790
|
return fullPath;
|
|
1754
1791
|
}
|
|
1755
1792
|
function browserFocusStateFile() {
|
|
1756
|
-
const homeDir = process.env.HOME ||
|
|
1757
|
-
return
|
|
1793
|
+
const homeDir = process.env.HOME || homedir3();
|
|
1794
|
+
return join3(
|
|
1758
1795
|
homeDir,
|
|
1759
1796
|
".local",
|
|
1760
1797
|
"deepline",
|
|
@@ -1768,8 +1805,8 @@ function claimBrowserFocus(now = Date.now()) {
|
|
|
1768
1805
|
try {
|
|
1769
1806
|
mkdirSync2(dirname2(statePath), { recursive: true });
|
|
1770
1807
|
let lastFocusedAt = 0;
|
|
1771
|
-
if (
|
|
1772
|
-
const payload = JSON.parse(
|
|
1808
|
+
if (existsSync3(statePath)) {
|
|
1809
|
+
const payload = JSON.parse(readFileSync3(statePath, "utf-8"));
|
|
1773
1810
|
const value = payload.lastFocusedAt ?? payload.last_focused_at;
|
|
1774
1811
|
if (typeof value === "number" && Number.isFinite(value)) {
|
|
1775
1812
|
lastFocusedAt = value;
|
|
@@ -1815,7 +1852,7 @@ function readDefaultMacBrowserBundleId(runner = defaultBrowserCommandRunner) {
|
|
|
1815
1852
|
"/usr/bin/defaults",
|
|
1816
1853
|
[
|
|
1817
1854
|
"read",
|
|
1818
|
-
`${
|
|
1855
|
+
`${homedir3()}/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist`,
|
|
1819
1856
|
"LSHandlers"
|
|
1820
1857
|
],
|
|
1821
1858
|
{ encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] }
|
|
@@ -1974,11 +2011,11 @@ function collectLocalEnvInfo() {
|
|
|
1974
2011
|
return {
|
|
1975
2012
|
os: `${process.platform} ${process.arch}`,
|
|
1976
2013
|
node_version: process.version,
|
|
1977
|
-
home_dir:
|
|
2014
|
+
home_dir: homedir3()
|
|
1978
2015
|
};
|
|
1979
2016
|
}
|
|
1980
2017
|
function readCsvRows(csvPath) {
|
|
1981
|
-
const raw =
|
|
2018
|
+
const raw = readFileSync3(resolve2(csvPath), "utf-8");
|
|
1982
2019
|
return parse(raw, {
|
|
1983
2020
|
columns: true,
|
|
1984
2021
|
skip_empty_lines: true
|
|
@@ -2186,7 +2223,7 @@ function pendingClaimTokenPath(baseUrl) {
|
|
|
2186
2223
|
function savePendingClaimToken(baseUrl, claimToken) {
|
|
2187
2224
|
const filePath = pendingClaimTokenPath(baseUrl);
|
|
2188
2225
|
const dir = dirname3(filePath);
|
|
2189
|
-
if (!
|
|
2226
|
+
if (!existsSync4(dir)) {
|
|
2190
2227
|
mkdirSync3(dir, { recursive: true });
|
|
2191
2228
|
}
|
|
2192
2229
|
writeFileSync3(filePath, `${claimToken}
|
|
@@ -2194,9 +2231,9 @@ function savePendingClaimToken(baseUrl, claimToken) {
|
|
|
2194
2231
|
}
|
|
2195
2232
|
function readPendingClaimToken(baseUrl) {
|
|
2196
2233
|
const filePath = pendingClaimTokenPath(baseUrl);
|
|
2197
|
-
if (!
|
|
2234
|
+
if (!existsSync4(filePath)) return "";
|
|
2198
2235
|
try {
|
|
2199
|
-
return
|
|
2236
|
+
return readFileSync4(filePath, "utf-8").trim();
|
|
2200
2237
|
} catch {
|
|
2201
2238
|
return "";
|
|
2202
2239
|
}
|
|
@@ -4309,23 +4346,23 @@ Examples:
|
|
|
4309
4346
|
// src/cli/commands/play.ts
|
|
4310
4347
|
import { createHash as createHash3 } from "crypto";
|
|
4311
4348
|
import {
|
|
4312
|
-
existsSync as
|
|
4313
|
-
readFileSync as
|
|
4349
|
+
existsSync as existsSync7,
|
|
4350
|
+
readFileSync as readFileSync6,
|
|
4314
4351
|
readdirSync,
|
|
4315
4352
|
realpathSync,
|
|
4316
4353
|
writeFileSync as writeFileSync6
|
|
4317
4354
|
} from "fs";
|
|
4318
|
-
import { basename as basename3, dirname as dirname8, join as
|
|
4355
|
+
import { basename as basename3, dirname as dirname8, join as join7, resolve as resolve10 } from "path";
|
|
4319
4356
|
|
|
4320
4357
|
// src/plays/bundle-play-file.ts
|
|
4321
4358
|
import { tmpdir as tmpdir2 } from "os";
|
|
4322
|
-
import { dirname as dirname7, join as
|
|
4359
|
+
import { dirname as dirname7, join as join6, resolve as resolve8 } from "path";
|
|
4323
4360
|
import { fileURLToPath } from "url";
|
|
4324
|
-
import { existsSync as
|
|
4361
|
+
import { existsSync as existsSync6 } from "fs";
|
|
4325
4362
|
|
|
4326
4363
|
// ../shared_libs/plays/bundling/index.ts
|
|
4327
4364
|
import { createHash } from "crypto";
|
|
4328
|
-
import { existsSync as
|
|
4365
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5 } from "fs";
|
|
4329
4366
|
import { mkdir as mkdir3, readFile, realpath, stat, writeFile as writeFile3 } from "fs/promises";
|
|
4330
4367
|
import { tmpdir } from "os";
|
|
4331
4368
|
import {
|
|
@@ -4333,7 +4370,7 @@ import {
|
|
|
4333
4370
|
dirname as dirname5,
|
|
4334
4371
|
extname,
|
|
4335
4372
|
isAbsolute,
|
|
4336
|
-
join as
|
|
4373
|
+
join as join4,
|
|
4337
4374
|
resolve as resolve6
|
|
4338
4375
|
} from "path";
|
|
4339
4376
|
import { builtinModules } from "module";
|
|
@@ -4394,7 +4431,7 @@ function buildPlayContractCompatibility(input) {
|
|
|
4394
4431
|
var PLAY_BUNDLE_CACHE_VERSION = 24;
|
|
4395
4432
|
var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
|
|
4396
4433
|
var MAX_ESM_WORKERS_BUNDLE_BYTES = 115e4;
|
|
4397
|
-
var PLAY_ARTIFACT_CACHE_DIR =
|
|
4434
|
+
var PLAY_ARTIFACT_CACHE_DIR = join4(
|
|
4398
4435
|
tmpdir(),
|
|
4399
4436
|
`deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION}`
|
|
4400
4437
|
);
|
|
@@ -4614,7 +4651,7 @@ function extractDefinedPlayName(sourceCode) {
|
|
|
4614
4651
|
}
|
|
4615
4652
|
function readPackageVersionFromPackageJson(packageJsonPath, packageName) {
|
|
4616
4653
|
try {
|
|
4617
|
-
const packageJson = JSON.parse(
|
|
4654
|
+
const packageJson = JSON.parse(readFileSync5(packageJsonPath, "utf-8"));
|
|
4618
4655
|
if (packageJson.name === packageName && typeof packageJson.version === "string") {
|
|
4619
4656
|
return packageJson.version;
|
|
4620
4657
|
}
|
|
@@ -4626,13 +4663,13 @@ function readPackageVersionFromPackageJson(packageJsonPath, packageName) {
|
|
|
4626
4663
|
function findPackageJsonPathFrom(startDir, packageName) {
|
|
4627
4664
|
let current = resolve6(startDir);
|
|
4628
4665
|
while (true) {
|
|
4629
|
-
const packageJsonPath =
|
|
4666
|
+
const packageJsonPath = join4(
|
|
4630
4667
|
current,
|
|
4631
4668
|
"node_modules",
|
|
4632
4669
|
packageName,
|
|
4633
4670
|
"package.json"
|
|
4634
4671
|
);
|
|
4635
|
-
if (
|
|
4672
|
+
if (existsSync5(packageJsonPath)) {
|
|
4636
4673
|
return packageJsonPath;
|
|
4637
4674
|
}
|
|
4638
4675
|
const parent = dirname5(current);
|
|
@@ -4657,16 +4694,16 @@ function findPackageJsonPath(packageName, fromFile, adapter) {
|
|
|
4657
4694
|
const packageJsonPath = findPackageJsonPathFrom(normalized, packageName);
|
|
4658
4695
|
if (packageJsonPath) return packageJsonPath;
|
|
4659
4696
|
}
|
|
4660
|
-
const adapterNodeModulesPackageJson =
|
|
4697
|
+
const adapterNodeModulesPackageJson = join4(
|
|
4661
4698
|
adapter.nodeModulesDir,
|
|
4662
4699
|
packageName,
|
|
4663
4700
|
"package.json"
|
|
4664
4701
|
);
|
|
4665
|
-
return
|
|
4702
|
+
return existsSync5(adapterNodeModulesPackageJson) ? adapterNodeModulesPackageJson : null;
|
|
4666
4703
|
}
|
|
4667
4704
|
function localSdkAliasPlugin(adapter, options) {
|
|
4668
4705
|
const entryFile = options?.workersRuntime ? adapter.sdkWorkersEntryFile : adapter.sdkEntryFile;
|
|
4669
|
-
if (!
|
|
4706
|
+
if (!existsSync5(entryFile)) {
|
|
4670
4707
|
return null;
|
|
4671
4708
|
}
|
|
4672
4709
|
return {
|
|
@@ -4676,7 +4713,7 @@ function localSdkAliasPlugin(adapter, options) {
|
|
|
4676
4713
|
path: entryFile
|
|
4677
4714
|
}));
|
|
4678
4715
|
buildContext.onResolve({ filter: /^deepline\/helpers$/ }, () => ({
|
|
4679
|
-
path:
|
|
4716
|
+
path: join4(adapter.sdkSourceRoot, "helpers.ts")
|
|
4680
4717
|
}));
|
|
4681
4718
|
}
|
|
4682
4719
|
};
|
|
@@ -4907,7 +4944,7 @@ async function resolveLocalImport(fromFile, specifier) {
|
|
|
4907
4944
|
...SOURCE_EXTENSIONS.map((extension) => `${base}${extension}`)
|
|
4908
4945
|
);
|
|
4909
4946
|
candidates.push(
|
|
4910
|
-
...SOURCE_EXTENSIONS.map((extension) =>
|
|
4947
|
+
...SOURCE_EXTENSIONS.map((extension) => join4(base, `index${extension}`))
|
|
4911
4948
|
);
|
|
4912
4949
|
} else if ([".js", ".jsx", ".mjs", ".cjs"].includes(explicitExtension)) {
|
|
4913
4950
|
const stem = base.slice(0, -explicitExtension.length);
|
|
@@ -4926,9 +4963,9 @@ async function resolveLocalImport(fromFile, specifier) {
|
|
|
4926
4963
|
}
|
|
4927
4964
|
function resolvePackageImport(specifier, fromFile, adapter) {
|
|
4928
4965
|
const packageName = getPackageName(specifier);
|
|
4929
|
-
if (packageName === "deepline" &&
|
|
4966
|
+
if (packageName === "deepline" && existsSync5(adapter.sdkPackageJson)) {
|
|
4930
4967
|
const packageJson = JSON.parse(
|
|
4931
|
-
|
|
4968
|
+
readFileSync5(adapter.sdkPackageJson, "utf-8")
|
|
4932
4969
|
);
|
|
4933
4970
|
return {
|
|
4934
4971
|
name: "deepline",
|
|
@@ -5075,7 +5112,7 @@ async function computeWorkersHarnessFingerprintWithAdapter(adapter) {
|
|
|
5075
5112
|
const parts = [];
|
|
5076
5113
|
for (const name of tsFiles) {
|
|
5077
5114
|
const contents = await readFile(
|
|
5078
|
-
|
|
5115
|
+
join4(adapter.workersHarnessFilesDir, name),
|
|
5079
5116
|
"utf-8"
|
|
5080
5117
|
);
|
|
5081
5118
|
parts.push({ name, hash: sha256(contents) });
|
|
@@ -5083,7 +5120,7 @@ async function computeWorkersHarnessFingerprintWithAdapter(adapter) {
|
|
|
5083
5120
|
return sha256(JSON.stringify(parts));
|
|
5084
5121
|
}
|
|
5085
5122
|
function artifactCachePath(graphHash, artifactKind, adapter) {
|
|
5086
|
-
return
|
|
5123
|
+
return join4(
|
|
5087
5124
|
adapter.cacheDir ?? PLAY_ARTIFACT_CACHE_DIR,
|
|
5088
5125
|
`${graphHash}.${artifactKind}.json`
|
|
5089
5126
|
);
|
|
@@ -5521,7 +5558,7 @@ import {
|
|
|
5521
5558
|
dirname as dirname6,
|
|
5522
5559
|
extname as extname2,
|
|
5523
5560
|
isAbsolute as isAbsolute2,
|
|
5524
|
-
join as
|
|
5561
|
+
join as join5,
|
|
5525
5562
|
relative,
|
|
5526
5563
|
resolve as resolve7
|
|
5527
5564
|
} from "path";
|
|
@@ -5751,7 +5788,7 @@ async function resolveLocalImport2(fromFile, specifier) {
|
|
|
5751
5788
|
...SOURCE_EXTENSIONS2.map((extension) => `${base}${extension}`)
|
|
5752
5789
|
);
|
|
5753
5790
|
candidates.push(
|
|
5754
|
-
...SOURCE_EXTENSIONS2.map((extension) =>
|
|
5791
|
+
...SOURCE_EXTENSIONS2.map((extension) => join5(base, `index${extension}`))
|
|
5755
5792
|
);
|
|
5756
5793
|
} else if ([".js", ".jsx", ".mjs", ".cjs"].includes(explicitExtension)) {
|
|
5757
5794
|
const stem = base.slice(0, -explicitExtension.length);
|
|
@@ -5854,11 +5891,11 @@ var PLAY_BUNDLE_CACHE_VERSION2 = 30;
|
|
|
5854
5891
|
var MODULE_DIR = dirname7(fileURLToPath(import.meta.url));
|
|
5855
5892
|
var SDK_PACKAGE_ROOT = resolve8(MODULE_DIR, "..", "..");
|
|
5856
5893
|
var SOURCE_REPO_ROOT = resolve8(SDK_PACKAGE_ROOT, "..");
|
|
5857
|
-
var HAS_SOURCE_BUNDLING_SOURCES =
|
|
5894
|
+
var HAS_SOURCE_BUNDLING_SOURCES = existsSync6(
|
|
5858
5895
|
resolve8(SOURCE_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
|
|
5859
5896
|
);
|
|
5860
5897
|
var PACKAGED_REPO_ROOT = resolve8(SDK_PACKAGE_ROOT, "dist", "repo");
|
|
5861
|
-
var HAS_PACKAGED_BUNDLING_SOURCES =
|
|
5898
|
+
var HAS_PACKAGED_BUNDLING_SOURCES = existsSync6(
|
|
5862
5899
|
resolve8(PACKAGED_REPO_ROOT, "apps", "play-runner-workers", "src", "entry.ts")
|
|
5863
5900
|
);
|
|
5864
5901
|
var PROJECT_ROOT = HAS_SOURCE_BUNDLING_SOURCES ? SOURCE_REPO_ROOT : HAS_PACKAGED_BUNDLING_SOURCES ? PACKAGED_REPO_ROOT : resolve8(SDK_PACKAGE_ROOT, "..");
|
|
@@ -5904,14 +5941,14 @@ function createSdkPlayBundlingAdapter() {
|
|
|
5904
5941
|
return {
|
|
5905
5942
|
projectRoot: PROJECT_ROOT,
|
|
5906
5943
|
nodeModulesDir: resolve8(PROJECT_ROOT, "node_modules"),
|
|
5907
|
-
cacheDir:
|
|
5944
|
+
cacheDir: join6(
|
|
5908
5945
|
tmpdir2(),
|
|
5909
5946
|
`deepline-play-artifacts-v${PLAY_BUNDLE_CACHE_VERSION2}`
|
|
5910
5947
|
),
|
|
5911
5948
|
sdkSourceRoot: SDK_SOURCE_ROOT,
|
|
5912
5949
|
sdkPackageJson: SDK_PACKAGE_JSON,
|
|
5913
5950
|
sdkEntryFile: SDK_ENTRY_FILE,
|
|
5914
|
-
sdkTypesEntryFile: HAS_SOURCE_BUNDLING_SOURCES || !
|
|
5951
|
+
sdkTypesEntryFile: HAS_SOURCE_BUNDLING_SOURCES || !existsSync6(SDK_TYPES_ENTRY_FILE) ? SDK_ENTRY_FILE : SDK_TYPES_ENTRY_FILE,
|
|
5915
5952
|
sdkWorkersEntryFile: SDK_WORKERS_ENTRY_FILE,
|
|
5916
5953
|
workersHarnessEntryFile: WORKERS_HARNESS_ENTRY_FILE,
|
|
5917
5954
|
workersHarnessFilesDir: WORKERS_HARNESS_FILES_DIR,
|
|
@@ -7885,8 +7922,8 @@ function materializeRemotePlaySource(input) {
|
|
|
7885
7922
|
return null;
|
|
7886
7923
|
}
|
|
7887
7924
|
const outputPath = input.outPath ?? defaultMaterializedPlayPath(input.playName);
|
|
7888
|
-
if (
|
|
7889
|
-
const existingSource =
|
|
7925
|
+
if (existsSync7(outputPath)) {
|
|
7926
|
+
const existingSource = readFileSync6(outputPath, "utf-8");
|
|
7890
7927
|
if (existingSource === input.sourceCode) {
|
|
7891
7928
|
return { path: outputPath, status: "unchanged", created: false };
|
|
7892
7929
|
}
|
|
@@ -7938,7 +7975,7 @@ function extractPlayName(code, filePath) {
|
|
|
7938
7975
|
throw buildMissingDefinePlayError(filePath);
|
|
7939
7976
|
}
|
|
7940
7977
|
function isFileTarget(target) {
|
|
7941
|
-
return
|
|
7978
|
+
return existsSync7(resolve10(target));
|
|
7942
7979
|
}
|
|
7943
7980
|
function looksLikeRunId(target) {
|
|
7944
7981
|
return /^play\/[^/]+\/run\/[^/]+/.test(target.trim());
|
|
@@ -7967,7 +8004,7 @@ function parsePositiveInteger3(value, flagName) {
|
|
|
7967
8004
|
return parsed;
|
|
7968
8005
|
}
|
|
7969
8006
|
function parseJsonInput(raw) {
|
|
7970
|
-
const source = raw.startsWith("@") ?
|
|
8007
|
+
const source = raw.startsWith("@") ? readFileSync6(resolve10(raw.slice(1)), "utf-8") : raw;
|
|
7971
8008
|
const parsed = JSON.parse(source);
|
|
7972
8009
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
7973
8010
|
throw new Error("--input must be a JSON object.");
|
|
@@ -8069,7 +8106,7 @@ function fileInputBindingsFromStaticPipeline(staticPipeline) {
|
|
|
8069
8106
|
function isLocalFilePathValue(value) {
|
|
8070
8107
|
if (typeof value !== "string" || !value.trim()) return false;
|
|
8071
8108
|
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(value.trim())) return false;
|
|
8072
|
-
return
|
|
8109
|
+
return existsSync7(resolve10(value));
|
|
8073
8110
|
}
|
|
8074
8111
|
function inputContainsLocalFilePath(value) {
|
|
8075
8112
|
if (isLocalFilePathValue(value)) {
|
|
@@ -8130,7 +8167,7 @@ async function stageFileInputArgs(input) {
|
|
|
8130
8167
|
};
|
|
8131
8168
|
}
|
|
8132
8169
|
function stageFile(logicalPath, absolutePath) {
|
|
8133
|
-
const buffer =
|
|
8170
|
+
const buffer = readFileSync6(absolutePath);
|
|
8134
8171
|
return {
|
|
8135
8172
|
logicalPath,
|
|
8136
8173
|
contentBase64: buffer.toString("base64"),
|
|
@@ -10366,7 +10403,7 @@ async function handlePlayCheck(args) {
|
|
|
10366
10403
|
return 1;
|
|
10367
10404
|
}
|
|
10368
10405
|
const absolutePlayPath = resolve10(options.target);
|
|
10369
|
-
const sourceCode =
|
|
10406
|
+
const sourceCode = readFileSync6(absolutePlayPath, "utf-8");
|
|
10370
10407
|
let graph;
|
|
10371
10408
|
try {
|
|
10372
10409
|
graph = await collectBundledPlayGraph(absolutePlayPath);
|
|
@@ -10450,7 +10487,7 @@ async function handleFileBackedRun(options) {
|
|
|
10450
10487
|
const sourceCode = traceCliSync(
|
|
10451
10488
|
"cli.play_file_read_source",
|
|
10452
10489
|
{ targetKind: "file" },
|
|
10453
|
-
() =>
|
|
10490
|
+
() => readFileSync6(absolutePlayPath, "utf-8")
|
|
10454
10491
|
);
|
|
10455
10492
|
const runtimeInput = options.input ? { ...options.input } : {};
|
|
10456
10493
|
let graph;
|
|
@@ -10737,7 +10774,7 @@ async function handlePlayRun(args) {
|
|
|
10737
10774
|
const resolved = resolve10(options.target.path);
|
|
10738
10775
|
console.error(`File not found: ${resolved}`);
|
|
10739
10776
|
const dir = dirname8(resolved);
|
|
10740
|
-
if (
|
|
10777
|
+
if (existsSync7(dir)) {
|
|
10741
10778
|
const base = basename3(resolved);
|
|
10742
10779
|
try {
|
|
10743
10780
|
const siblings = readdirSync(dir).filter(
|
|
@@ -10746,7 +10783,7 @@ async function handlePlayRun(args) {
|
|
|
10746
10783
|
if (siblings.length > 0) {
|
|
10747
10784
|
console.error(`Did you mean one of these?`);
|
|
10748
10785
|
for (const s of siblings.slice(0, 5)) {
|
|
10749
|
-
console.error(` ${
|
|
10786
|
+
console.error(` ${join7(dir, s)}`);
|
|
10750
10787
|
}
|
|
10751
10788
|
}
|
|
10752
10789
|
} catch {
|
|
@@ -11084,7 +11121,7 @@ async function handlePlayGet(args) {
|
|
|
11084
11121
|
outPath = resolve10(args[++index]);
|
|
11085
11122
|
}
|
|
11086
11123
|
}
|
|
11087
|
-
const playName = isFileTarget(target) ? extractPlayName(
|
|
11124
|
+
const playName = isFileTarget(target) ? extractPlayName(readFileSync6(resolve10(target), "utf-8"), resolve10(target)) : parseReferencedPlayTarget2(target).playName;
|
|
11088
11125
|
const detail = isFileTarget(target) ? await client.getPlay(playName) : await assertCanonicalNamedPlayReference(client, target);
|
|
11089
11126
|
const resolvedSource = detail.play.workingRevision?.sourceCode ?? detail.play.liveRevision?.sourceCode ?? detail.play.currentRevision?.sourceCode ?? detail.play.sourceCode ?? "";
|
|
11090
11127
|
const materializedFile = outPath ? materializeRemotePlaySource({
|
|
@@ -12068,12 +12105,12 @@ Examples:
|
|
|
12068
12105
|
import { Option } from "commander";
|
|
12069
12106
|
import { chmodSync, mkdtempSync, writeFileSync as writeFileSync8 } from "fs";
|
|
12070
12107
|
import { tmpdir as tmpdir3 } from "os";
|
|
12071
|
-
import { join as
|
|
12108
|
+
import { join as join9 } from "path";
|
|
12072
12109
|
|
|
12073
12110
|
// src/tool-output.ts
|
|
12074
12111
|
import { mkdirSync as mkdirSync4, writeFileSync as writeFileSync7 } from "fs";
|
|
12075
|
-
import { homedir as
|
|
12076
|
-
import { join as
|
|
12112
|
+
import { homedir as homedir4 } from "os";
|
|
12113
|
+
import { join as join8 } from "path";
|
|
12077
12114
|
function isPlainObject(value) {
|
|
12078
12115
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
12079
12116
|
}
|
|
@@ -12169,19 +12206,19 @@ function tryConvertToList(payload, options) {
|
|
|
12169
12206
|
return null;
|
|
12170
12207
|
}
|
|
12171
12208
|
function ensureOutputDir() {
|
|
12172
|
-
const outputDir =
|
|
12209
|
+
const outputDir = join8(homedir4(), ".local", "share", "deepline", "data");
|
|
12173
12210
|
mkdirSync4(outputDir, { recursive: true });
|
|
12174
12211
|
return outputDir;
|
|
12175
12212
|
}
|
|
12176
12213
|
function writeJsonOutputFile(payload, stem) {
|
|
12177
12214
|
const outputDir = ensureOutputDir();
|
|
12178
|
-
const outputPath =
|
|
12215
|
+
const outputPath = join8(outputDir, `${stem}_${Date.now()}.json`);
|
|
12179
12216
|
writeFileSync7(outputPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
12180
12217
|
return outputPath;
|
|
12181
12218
|
}
|
|
12182
12219
|
function writeCsvOutputFile(rows, stem) {
|
|
12183
12220
|
const outputDir = ensureOutputDir();
|
|
12184
|
-
const outputPath =
|
|
12221
|
+
const outputPath = join8(outputDir, `${stem}_${Date.now()}.csv`);
|
|
12185
12222
|
const seen = /* @__PURE__ */ new Set();
|
|
12186
12223
|
const columns = [];
|
|
12187
12224
|
for (const row of rows) {
|
|
@@ -13272,9 +13309,9 @@ function powerShellQuote(value) {
|
|
|
13272
13309
|
function seedToolListScript(input) {
|
|
13273
13310
|
const stem = safeFileStem(input.toolId);
|
|
13274
13311
|
const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
|
|
13275
|
-
const scriptDir = mkdtempSync(
|
|
13312
|
+
const scriptDir = mkdtempSync(join9(tmpdir3(), "deepline-workflow-seed-"));
|
|
13276
13313
|
chmodSync(scriptDir, 448);
|
|
13277
|
-
const scriptPath =
|
|
13314
|
+
const scriptPath = join9(scriptDir, fileName);
|
|
13278
13315
|
const projectDir = `deepline/projects/${stem}-workflow`;
|
|
13279
13316
|
const playName = `${stem}-workflow`;
|
|
13280
13317
|
const sampleRows = input.rows.length > 0 ? `${JSON.stringify(input.rows.slice(0, 2)).replace(/\]$/, "")}, ...]` : "[]";
|
|
@@ -13565,8 +13602,8 @@ async function executeTool(args) {
|
|
|
13565
13602
|
|
|
13566
13603
|
// src/cli/commands/update.ts
|
|
13567
13604
|
import { spawn } from "child_process";
|
|
13568
|
-
import { existsSync as
|
|
13569
|
-
import { dirname as dirname9, join as
|
|
13605
|
+
import { existsSync as existsSync8 } from "fs";
|
|
13606
|
+
import { dirname as dirname9, join as join10, resolve as resolve11 } from "path";
|
|
13570
13607
|
function posixShellQuote(value) {
|
|
13571
13608
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
13572
13609
|
}
|
|
@@ -13587,7 +13624,7 @@ function buildSourceUpdateCommand(sourceRoot) {
|
|
|
13587
13624
|
function findRepoBackedSdkRoot(startPath) {
|
|
13588
13625
|
let current = resolve11(startPath);
|
|
13589
13626
|
while (true) {
|
|
13590
|
-
if (
|
|
13627
|
+
if (existsSync8(join10(current, "sdk", "package.json")) && existsSync8(join10(current, "sdk", "bin", "deepline-dev.ts"))) {
|
|
13591
13628
|
return current;
|
|
13592
13629
|
}
|
|
13593
13630
|
const parent = dirname9(current);
|
|
@@ -13693,15 +13730,15 @@ Examples:
|
|
|
13693
13730
|
// src/cli/skills-sync.ts
|
|
13694
13731
|
import { spawn as spawn2, spawnSync } from "child_process";
|
|
13695
13732
|
import {
|
|
13696
|
-
existsSync as
|
|
13733
|
+
existsSync as existsSync9,
|
|
13697
13734
|
mkdirSync as mkdirSync5,
|
|
13698
13735
|
readdirSync as readdirSync2,
|
|
13699
|
-
readFileSync as
|
|
13736
|
+
readFileSync as readFileSync7,
|
|
13700
13737
|
statSync as statSync2,
|
|
13701
13738
|
writeFileSync as writeFileSync9
|
|
13702
13739
|
} from "fs";
|
|
13703
|
-
import { homedir as
|
|
13704
|
-
import { dirname as dirname10, join as
|
|
13740
|
+
import { homedir as homedir5 } from "os";
|
|
13741
|
+
import { dirname as dirname10, join as join11 } from "path";
|
|
13705
13742
|
var CHECK_TIMEOUT_MS2 = 3e3;
|
|
13706
13743
|
var SDK_SKILL_NAME = "deepline-sdk";
|
|
13707
13744
|
var SKILL_AGENTS = ["codex", "claude-code", "cursor"];
|
|
@@ -13711,8 +13748,8 @@ function shouldSkipSkillsSync() {
|
|
|
13711
13748
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
13712
13749
|
}
|
|
13713
13750
|
function sdkSkillsVersionPath(baseUrl) {
|
|
13714
|
-
const home = process.env.HOME?.trim() ||
|
|
13715
|
-
return
|
|
13751
|
+
const home = process.env.HOME?.trim() || homedir5();
|
|
13752
|
+
return join11(
|
|
13716
13753
|
home,
|
|
13717
13754
|
".local",
|
|
13718
13755
|
"deepline",
|
|
@@ -13723,9 +13760,9 @@ function sdkSkillsVersionPath(baseUrl) {
|
|
|
13723
13760
|
}
|
|
13724
13761
|
function readLocalSkillsVersion(baseUrl) {
|
|
13725
13762
|
const path = sdkSkillsVersionPath(baseUrl);
|
|
13726
|
-
if (!
|
|
13763
|
+
if (!existsSync9(path)) return "";
|
|
13727
13764
|
try {
|
|
13728
|
-
return
|
|
13765
|
+
return readFileSync7(path, "utf-8").trim();
|
|
13729
13766
|
} catch {
|
|
13730
13767
|
return "";
|
|
13731
13768
|
}
|
|
@@ -13737,10 +13774,10 @@ function writeLocalSkillsVersion(baseUrl, version) {
|
|
|
13737
13774
|
`, "utf-8");
|
|
13738
13775
|
}
|
|
13739
13776
|
function installedSdkSkillHasStalePositionalExecuteExamples() {
|
|
13740
|
-
const home = process.env.HOME?.trim() ||
|
|
13777
|
+
const home = process.env.HOME?.trim() || homedir5();
|
|
13741
13778
|
const roots = [
|
|
13742
|
-
|
|
13743
|
-
|
|
13779
|
+
join11(home, ".claude", "skills", SDK_SKILL_NAME),
|
|
13780
|
+
join11(home, ".agents", "skills", SDK_SKILL_NAME)
|
|
13744
13781
|
];
|
|
13745
13782
|
const staleMarkers = [
|
|
13746
13783
|
"ctx.tools.execute(key",
|
|
@@ -13751,21 +13788,21 @@ function installedSdkSkillHasStalePositionalExecuteExamples() {
|
|
|
13751
13788
|
];
|
|
13752
13789
|
const scan = (dir) => {
|
|
13753
13790
|
for (const entry of readdirSync2(dir)) {
|
|
13754
|
-
const path =
|
|
13791
|
+
const path = join11(dir, entry);
|
|
13755
13792
|
const stat3 = statSync2(path);
|
|
13756
13793
|
if (stat3.isDirectory()) {
|
|
13757
13794
|
if (scan(path)) return true;
|
|
13758
13795
|
continue;
|
|
13759
13796
|
}
|
|
13760
13797
|
if (!entry.endsWith(".md")) continue;
|
|
13761
|
-
const text =
|
|
13798
|
+
const text = readFileSync7(path, "utf-8");
|
|
13762
13799
|
if (staleMarkers.some((marker) => text.includes(marker))) return true;
|
|
13763
13800
|
}
|
|
13764
13801
|
return false;
|
|
13765
13802
|
};
|
|
13766
13803
|
for (const root of roots) {
|
|
13767
13804
|
try {
|
|
13768
|
-
if (
|
|
13805
|
+
if (existsSync9(root) && scan(root)) return true;
|
|
13769
13806
|
} catch {
|
|
13770
13807
|
continue;
|
|
13771
13808
|
}
|
|
@@ -13967,8 +14004,8 @@ function shouldDeferSkillsSyncForCommand() {
|
|
|
13967
14004
|
return (command === "play" || command === "plays") && subcommand === "run" && args.includes("--json");
|
|
13968
14005
|
}
|
|
13969
14006
|
async function runPlayRunnerHealthCheck() {
|
|
13970
|
-
const dir = await mkdtemp(
|
|
13971
|
-
const file =
|
|
14007
|
+
const dir = await mkdtemp(join12(tmpdir4(), "deepline-health-play-"));
|
|
14008
|
+
const file = join12(dir, "health-check.play.ts");
|
|
13972
14009
|
try {
|
|
13973
14010
|
await writeFile4(
|
|
13974
14011
|
file,
|