deepline 0.1.198 → 0.1.199
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/bundling-sources/sdk/src/release.ts +2 -2
- package/dist/cli/index.js +276 -49
- package/dist/cli/index.mjs +276 -49
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
|
@@ -106,10 +106,10 @@ export const SDK_RELEASE = {
|
|
|
106
106
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
107
107
|
// fields shipped in 0.1.153.
|
|
108
108
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
109
|
-
version: '0.1.
|
|
109
|
+
version: '0.1.199',
|
|
110
110
|
apiContract: '2026-06-dataset-handle-results-hard-cutover',
|
|
111
111
|
supportPolicy: {
|
|
112
|
-
latest: '0.1.
|
|
112
|
+
latest: '0.1.199',
|
|
113
113
|
minimumSupported: '0.1.53',
|
|
114
114
|
deprecatedBelow: '0.1.53',
|
|
115
115
|
commandMinimumSupported: [
|
package/dist/cli/index.js
CHANGED
|
@@ -623,10 +623,10 @@ var SDK_RELEASE = {
|
|
|
623
623
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
624
624
|
// fields shipped in 0.1.153.
|
|
625
625
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
626
|
-
version: "0.1.
|
|
626
|
+
version: "0.1.199",
|
|
627
627
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
628
628
|
supportPolicy: {
|
|
629
|
-
latest: "0.1.
|
|
629
|
+
latest: "0.1.199",
|
|
630
630
|
minimumSupported: "0.1.53",
|
|
631
631
|
deprecatedBelow: "0.1.53",
|
|
632
632
|
commandMinimumSupported: [
|
|
@@ -10716,14 +10716,219 @@ function parseReferencedPlayTarget2(target) {
|
|
|
10716
10716
|
function isPrebuiltReferenceTarget(target) {
|
|
10717
10717
|
return target.trim().toLowerCase().startsWith("prebuilt/");
|
|
10718
10718
|
}
|
|
10719
|
+
function buildBarePrebuiltReferenceMessage(input2) {
|
|
10720
|
+
return `Prebuilt play "${input2.requested}" must be referenced as "${input2.reference}". Use the prebuilt/ namespace anywhere you run, describe, get, or link to Deepline-managed plays.`;
|
|
10721
|
+
}
|
|
10719
10722
|
function buildBarePrebuiltReferenceError(input2) {
|
|
10720
|
-
return new Error(
|
|
10721
|
-
|
|
10723
|
+
return new Error(buildBarePrebuiltReferenceMessage(input2));
|
|
10724
|
+
}
|
|
10725
|
+
function isPlayNotFoundError(error) {
|
|
10726
|
+
return error instanceof DeeplineError && (error.statusCode === 404 || error.code === "PLAY_NOT_FOUND" || error.code === "NOT_FOUND");
|
|
10727
|
+
}
|
|
10728
|
+
function isExplicitMissingPlayReferenceError(error) {
|
|
10729
|
+
if (!(error instanceof DeeplineError)) {
|
|
10730
|
+
return false;
|
|
10731
|
+
}
|
|
10732
|
+
if (error.statusCode !== 404 && error.code !== "PLAY_NOT_FOUND") {
|
|
10733
|
+
return false;
|
|
10734
|
+
}
|
|
10735
|
+
return /^play not found\b/i.test(error.message.trim());
|
|
10736
|
+
}
|
|
10737
|
+
function normalizePlayReferenceForMatch(value) {
|
|
10738
|
+
return value.trim().toLowerCase().replace(/^prebuilt\//, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
10739
|
+
}
|
|
10740
|
+
function playReferenceMatchTokens(value) {
|
|
10741
|
+
return normalizePlayReferenceForMatch(value).split("-").filter((token) => token.length > 1 && token !== "to" && token !== "and");
|
|
10742
|
+
}
|
|
10743
|
+
function playSuggestionReference(play) {
|
|
10744
|
+
if (play.reference?.trim()) {
|
|
10745
|
+
return play.reference.trim();
|
|
10746
|
+
}
|
|
10747
|
+
const ownerSlug = play.ownerSlug?.trim();
|
|
10748
|
+
return ownerSlug ? `${ownerSlug}/${play.name}` : play.name;
|
|
10749
|
+
}
|
|
10750
|
+
function scorePlayReferenceSuggestion(requested, play) {
|
|
10751
|
+
const parsed = parseReferencedPlayTarget2(requested);
|
|
10752
|
+
const requestedTrimmed = requested.trim();
|
|
10753
|
+
const requestedRef = requestedTrimmed.toLowerCase();
|
|
10754
|
+
const requestedName = parsed.unqualifiedPlayName;
|
|
10755
|
+
const requestedNorm = normalizePlayReferenceForMatch(requestedTrimmed);
|
|
10756
|
+
const requestedNameNorm = normalizePlayReferenceForMatch(requestedName);
|
|
10757
|
+
if (!requestedNorm && !requestedNameNorm) {
|
|
10758
|
+
return null;
|
|
10759
|
+
}
|
|
10760
|
+
const reference = playSuggestionReference(play);
|
|
10761
|
+
const referenceNorm = normalizePlayReferenceForMatch(reference);
|
|
10762
|
+
const nameNorm = normalizePlayReferenceForMatch(play.name);
|
|
10763
|
+
const candidateNamespace = reference.includes("/") ? reference.split("/")[0]?.toLowerCase() : null;
|
|
10764
|
+
const requestedNamespace = parsed.ownerSlug?.toLowerCase() ?? null;
|
|
10765
|
+
const aliases = (play.aliases ?? []).map(normalizePlayReferenceForMatch);
|
|
10766
|
+
const searchable = [referenceNorm, nameNorm, ...aliases].filter(Boolean);
|
|
10767
|
+
const requestedTokens = playReferenceMatchTokens(requestedName);
|
|
10768
|
+
const candidateTokens = [
|
|
10769
|
+
...new Set(
|
|
10770
|
+
[reference, play.name, ...play.aliases ?? []].flatMap(
|
|
10771
|
+
playReferenceMatchTokens
|
|
10772
|
+
)
|
|
10773
|
+
)
|
|
10774
|
+
];
|
|
10775
|
+
const hasTokenContainment = requestedTokens.length > 0 && requestedTokens.every((token) => candidateTokens.includes(token));
|
|
10776
|
+
let score = 0;
|
|
10777
|
+
if (reference.toLowerCase() === requestedRef) {
|
|
10778
|
+
score = 120;
|
|
10779
|
+
} else if (requestedNamespace && candidateNamespace === requestedNamespace && nameNorm === requestedNameNorm) {
|
|
10780
|
+
score = 110;
|
|
10781
|
+
} else if (nameNorm === requestedNameNorm || aliases.includes(requestedNameNorm)) {
|
|
10782
|
+
score = play.origin === "prebuilt" ? 100 : 95;
|
|
10783
|
+
} else if (requestedNamespace && candidateNamespace === requestedNamespace && searchable.some(
|
|
10784
|
+
(value) => value.includes(requestedNameNorm) || requestedNameNorm.includes(value)
|
|
10785
|
+
)) {
|
|
10786
|
+
score = 85;
|
|
10787
|
+
} else if (searchable.some(
|
|
10788
|
+
(value) => value.includes(requestedNorm) || requestedNorm.includes(value)
|
|
10789
|
+
)) {
|
|
10790
|
+
score = 70;
|
|
10791
|
+
} else if (requestedNameNorm && searchable.some(
|
|
10792
|
+
(value) => value.includes(requestedNameNorm) || requestedNameNorm.includes(value)
|
|
10793
|
+
)) {
|
|
10794
|
+
score = 60;
|
|
10795
|
+
} else if (hasTokenContainment) {
|
|
10796
|
+
score = requestedNamespace && candidateNamespace === requestedNamespace ? 58 : 50;
|
|
10797
|
+
}
|
|
10798
|
+
if (score <= 0) {
|
|
10799
|
+
return null;
|
|
10800
|
+
}
|
|
10801
|
+
if (play.origin === "prebuilt") {
|
|
10802
|
+
score += 3;
|
|
10803
|
+
}
|
|
10804
|
+
return {
|
|
10805
|
+
reference,
|
|
10806
|
+
name: play.name,
|
|
10807
|
+
origin: play.origin ?? null,
|
|
10808
|
+
score
|
|
10809
|
+
};
|
|
10810
|
+
}
|
|
10811
|
+
function rankPlayReferenceSuggestions(input2) {
|
|
10812
|
+
const byReference = /* @__PURE__ */ new Map();
|
|
10813
|
+
for (const play of input2.plays) {
|
|
10814
|
+
const suggestion = scorePlayReferenceSuggestion(input2.requested, play);
|
|
10815
|
+
if (!suggestion) continue;
|
|
10816
|
+
const existing = byReference.get(suggestion.reference);
|
|
10817
|
+
if (!existing || suggestion.score > existing.score) {
|
|
10818
|
+
byReference.set(suggestion.reference, suggestion);
|
|
10819
|
+
}
|
|
10820
|
+
}
|
|
10821
|
+
return [...byReference.values()].sort((left, right) => {
|
|
10822
|
+
if (right.score !== left.score) return right.score - left.score;
|
|
10823
|
+
if (left.origin === "prebuilt" && right.origin !== "prebuilt") return -1;
|
|
10824
|
+
if (right.origin === "prebuilt" && left.origin !== "prebuilt") return 1;
|
|
10825
|
+
return left.reference.localeCompare(right.reference);
|
|
10826
|
+
}).slice(0, input2.limit ?? 5);
|
|
10827
|
+
}
|
|
10828
|
+
function searchQueryForMissingPlayReference(target) {
|
|
10829
|
+
return parseReferencedPlayTarget2(target).unqualifiedPlayName.replace(/[-_./]+/g, " ").replace(/\s+/g, " ").trim();
|
|
10830
|
+
}
|
|
10831
|
+
function shellQuote2(value) {
|
|
10832
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
10833
|
+
}
|
|
10834
|
+
function buildPlayReferenceNotFoundMessage(input2) {
|
|
10835
|
+
const lines = [`Play not found: ${input2.requested}`];
|
|
10836
|
+
if (input2.suggestions.length > 0) {
|
|
10837
|
+
lines.push("", "Did you mean one of these?");
|
|
10838
|
+
for (const suggestion of input2.suggestions) {
|
|
10839
|
+
lines.push("", ` ${suggestion.reference}`);
|
|
10840
|
+
if (input2.command === "run") {
|
|
10841
|
+
lines.push(
|
|
10842
|
+
` deepline plays run ${suggestion.reference} --input '{...}' --watch`
|
|
10843
|
+
);
|
|
10844
|
+
} else if (input2.command === "get") {
|
|
10845
|
+
lines.push(` deepline plays get ${suggestion.reference} --json`);
|
|
10846
|
+
} else if (input2.command === "check") {
|
|
10847
|
+
lines.push(` deepline plays check ${suggestion.reference} --json`);
|
|
10848
|
+
} else if (input2.command === "versions") {
|
|
10849
|
+
lines.push(
|
|
10850
|
+
` deepline plays versions --name ${suggestion.reference} --json`
|
|
10851
|
+
);
|
|
10852
|
+
} else {
|
|
10853
|
+
lines.push(
|
|
10854
|
+
` deepline plays describe ${suggestion.reference} --json`
|
|
10855
|
+
);
|
|
10856
|
+
}
|
|
10857
|
+
}
|
|
10858
|
+
}
|
|
10859
|
+
const searchQuery = searchQueryForMissingPlayReference(input2.requested);
|
|
10860
|
+
if (searchQuery) {
|
|
10861
|
+
lines.push(
|
|
10862
|
+
"",
|
|
10863
|
+
"Search visible plays:",
|
|
10864
|
+
` deepline plays search ${shellQuote2(searchQuery)} --all --json`
|
|
10865
|
+
);
|
|
10866
|
+
}
|
|
10867
|
+
return lines.join("\n");
|
|
10868
|
+
}
|
|
10869
|
+
async function buildPlayReferenceNotFoundError(input2) {
|
|
10870
|
+
let suggestions = [];
|
|
10871
|
+
try {
|
|
10872
|
+
const searchQuery = searchQueryForMissingPlayReference(input2.target);
|
|
10873
|
+
const searchMatches = searchQuery ? await input2.client.searchPlays({
|
|
10874
|
+
query: searchQuery,
|
|
10875
|
+
scope: "all",
|
|
10876
|
+
compact: true
|
|
10877
|
+
}) : [];
|
|
10878
|
+
const plays = searchMatches.length > 0 ? searchMatches : await input2.client.listPlays();
|
|
10879
|
+
suggestions = rankPlayReferenceSuggestions({
|
|
10880
|
+
requested: input2.target,
|
|
10881
|
+
plays,
|
|
10882
|
+
limit: 5
|
|
10883
|
+
});
|
|
10884
|
+
} catch {
|
|
10885
|
+
suggestions = [];
|
|
10886
|
+
}
|
|
10887
|
+
const sourceError = input2.sourceError instanceof DeeplineError ? input2.sourceError : null;
|
|
10888
|
+
const code = sourceError?.code && sourceError.code !== "API_ERROR" ? sourceError.code : "PLAY_NOT_FOUND";
|
|
10889
|
+
return new DeeplineError(
|
|
10890
|
+
buildPlayReferenceNotFoundMessage({
|
|
10891
|
+
requested: input2.target,
|
|
10892
|
+
command: input2.command,
|
|
10893
|
+
suggestions
|
|
10894
|
+
}),
|
|
10895
|
+
sourceError?.statusCode ?? 404,
|
|
10896
|
+
code,
|
|
10897
|
+
sourceError?.details
|
|
10722
10898
|
);
|
|
10723
10899
|
}
|
|
10724
|
-
async function
|
|
10900
|
+
async function isMissingRunPlayReferenceError(input2) {
|
|
10901
|
+
if (isExplicitMissingPlayReferenceError(input2.error)) {
|
|
10902
|
+
return true;
|
|
10903
|
+
}
|
|
10904
|
+
if (!(input2.error instanceof DeeplineError) || input2.error.statusCode !== 404 || !/^no artifact-backed revision found for play:/i.test(
|
|
10905
|
+
input2.error.message.trim()
|
|
10906
|
+
)) {
|
|
10907
|
+
return false;
|
|
10908
|
+
}
|
|
10909
|
+
try {
|
|
10910
|
+
await input2.client.getPlay(parseReferencedPlayTarget2(input2.playName).playName);
|
|
10911
|
+
return false;
|
|
10912
|
+
} catch (lookupError) {
|
|
10913
|
+
return isPlayNotFoundError(lookupError);
|
|
10914
|
+
}
|
|
10915
|
+
}
|
|
10916
|
+
async function assertCanonicalNamedPlayReference(client2, target, options = {}) {
|
|
10725
10917
|
const parsed = parseReferencedPlayTarget2(target);
|
|
10726
|
-
|
|
10918
|
+
let detail;
|
|
10919
|
+
try {
|
|
10920
|
+
detail = await client2.getPlay(parsed.playName);
|
|
10921
|
+
} catch (error) {
|
|
10922
|
+
if (isPlayNotFoundError(error)) {
|
|
10923
|
+
throw await buildPlayReferenceNotFoundError({
|
|
10924
|
+
client: client2,
|
|
10925
|
+
target,
|
|
10926
|
+
command: options.command ?? "describe",
|
|
10927
|
+
sourceError: error
|
|
10928
|
+
});
|
|
10929
|
+
}
|
|
10930
|
+
throw error;
|
|
10931
|
+
}
|
|
10727
10932
|
if (detail.play.ownerType === "deepline" && !isPrebuiltReferenceTarget(target)) {
|
|
10728
10933
|
throw buildBarePrebuiltReferenceError({
|
|
10729
10934
|
requested: target,
|
|
@@ -13459,10 +13664,7 @@ async function exportPlayStatusRows(client2, status, outPath, options = {}) {
|
|
|
13459
13664
|
availableRows,
|
|
13460
13665
|
datasetPath: options.datasetPath
|
|
13461
13666
|
});
|
|
13462
|
-
return {
|
|
13463
|
-
path: writeCanonicalRowsCsv(guarded2, outPath),
|
|
13464
|
-
rowsInfo: guarded2
|
|
13465
|
-
};
|
|
13667
|
+
return { path: writeCanonicalRowsCsv(guarded2, outPath), rowsInfo: guarded2 };
|
|
13466
13668
|
}
|
|
13467
13669
|
if (rowsInfo.complete) {
|
|
13468
13670
|
const guarded2 = assertDatasetHasExportableRows({
|
|
@@ -13471,7 +13673,10 @@ async function exportPlayStatusRows(client2, status, outPath, options = {}) {
|
|
|
13471
13673
|
availableRows,
|
|
13472
13674
|
datasetPath: options.datasetPath
|
|
13473
13675
|
});
|
|
13474
|
-
return {
|
|
13676
|
+
return {
|
|
13677
|
+
path: writeCanonicalRowsCsv(guarded2, outPath),
|
|
13678
|
+
rowsInfo: guarded2
|
|
13679
|
+
};
|
|
13475
13680
|
}
|
|
13476
13681
|
if (attempt < attempts && retryDelayMs > 0) {
|
|
13477
13682
|
await sleep5(retryDelayMs);
|
|
@@ -13605,17 +13810,25 @@ function normalizePlayValidationError(error) {
|
|
|
13605
13810
|
error instanceof DeeplineError ? error.details : void 0
|
|
13606
13811
|
);
|
|
13607
13812
|
}
|
|
13608
|
-
function normalizePlayStartError(error, playName) {
|
|
13813
|
+
async function normalizePlayStartError(client2, error, playName, options = {}) {
|
|
13609
13814
|
const activeRuns = extractActiveRunsFromError(error);
|
|
13610
|
-
if (activeRuns.length
|
|
13611
|
-
return
|
|
13815
|
+
if (activeRuns.length > 0) {
|
|
13816
|
+
return new DeeplineError(
|
|
13817
|
+
formatActiveRunConflictError({ playName, activeRuns }),
|
|
13818
|
+
error instanceof DeeplineError ? error.statusCode : 409,
|
|
13819
|
+
"ACTIVE_RUN_EXISTS",
|
|
13820
|
+
error instanceof DeeplineError ? error.details : void 0
|
|
13821
|
+
);
|
|
13612
13822
|
}
|
|
13613
|
-
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
|
|
13617
|
-
|
|
13618
|
-
|
|
13823
|
+
if (options.suggestMissingPlay && await isMissingRunPlayReferenceError({ client: client2, error, playName })) {
|
|
13824
|
+
return buildPlayReferenceNotFoundError({
|
|
13825
|
+
client: client2,
|
|
13826
|
+
target: playName,
|
|
13827
|
+
command: "run",
|
|
13828
|
+
sourceError: error
|
|
13829
|
+
});
|
|
13830
|
+
}
|
|
13831
|
+
return normalizePlayValidationError(error);
|
|
13619
13832
|
}
|
|
13620
13833
|
function renderServerResultView(value) {
|
|
13621
13834
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -14128,7 +14341,9 @@ async function handlePlayCheck(args) {
|
|
|
14128
14341
|
if (!isFileTarget(options.target)) {
|
|
14129
14342
|
const client3 = new DeeplineClient();
|
|
14130
14343
|
try {
|
|
14131
|
-
await assertCanonicalNamedPlayReference(client3, options.target
|
|
14344
|
+
await assertCanonicalNamedPlayReference(client3, options.target, {
|
|
14345
|
+
command: "check"
|
|
14346
|
+
});
|
|
14132
14347
|
const play = await client3.describePlay(
|
|
14133
14348
|
parseReferencedPlayTarget2(options.target).playName,
|
|
14134
14349
|
{ compact: true }
|
|
@@ -14398,8 +14613,8 @@ async function handleFileBackedRun(options) {
|
|
|
14398
14613
|
waitTimeoutMs: options.waitTimeoutMs,
|
|
14399
14614
|
noOpen: options.noOpen,
|
|
14400
14615
|
progress
|
|
14401
|
-
}).catch((error) => {
|
|
14402
|
-
throw normalizePlayStartError(error, playName);
|
|
14616
|
+
}).catch(async (error) => {
|
|
14617
|
+
throw await normalizePlayStartError(client2, error, playName);
|
|
14403
14618
|
})
|
|
14404
14619
|
);
|
|
14405
14620
|
if (finalStatus.status === "completed") {
|
|
@@ -14429,8 +14644,8 @@ async function handleFileBackedRun(options) {
|
|
|
14429
14644
|
const started = await traceCliSpan(
|
|
14430
14645
|
"cli.play_start_unwatched",
|
|
14431
14646
|
{ targetKind: "file", playName },
|
|
14432
|
-
() => client2.startPlayRun(startRequest).catch((error) => {
|
|
14433
|
-
throw normalizePlayStartError(error, playName);
|
|
14647
|
+
() => client2.startPlayRun(startRequest).catch(async (error) => {
|
|
14648
|
+
throw await normalizePlayStartError(client2, error, playName);
|
|
14434
14649
|
})
|
|
14435
14650
|
);
|
|
14436
14651
|
const resolvedDashboardUrl = buildPlayDashboardUrl(client2.baseUrl, playName);
|
|
@@ -14488,7 +14703,9 @@ async function handleNamedRun(options) {
|
|
|
14488
14703
|
return traceCliSpan(
|
|
14489
14704
|
"cli.play_load_definition",
|
|
14490
14705
|
{ targetKind: "name", playName, skipped: false },
|
|
14491
|
-
() => assertCanonicalNamedPlayReference(client2, playName
|
|
14706
|
+
() => assertCanonicalNamedPlayReference(client2, playName, {
|
|
14707
|
+
command: "run"
|
|
14708
|
+
})
|
|
14492
14709
|
);
|
|
14493
14710
|
})() : (recordCliTrace({
|
|
14494
14711
|
phase: "cli.play_load_definition",
|
|
@@ -14557,8 +14774,10 @@ async function handleNamedRun(options) {
|
|
|
14557
14774
|
waitTimeoutMs: options.waitTimeoutMs,
|
|
14558
14775
|
noOpen: options.noOpen,
|
|
14559
14776
|
progress
|
|
14560
|
-
}).catch((error) => {
|
|
14561
|
-
throw normalizePlayStartError(error, playName
|
|
14777
|
+
}).catch(async (error) => {
|
|
14778
|
+
throw await normalizePlayStartError(client2, error, playName, {
|
|
14779
|
+
suggestMissingPlay: true
|
|
14780
|
+
});
|
|
14562
14781
|
})
|
|
14563
14782
|
);
|
|
14564
14783
|
if (finalStatus.status === "completed") {
|
|
@@ -14588,8 +14807,10 @@ async function handleNamedRun(options) {
|
|
|
14588
14807
|
const started = await traceCliSpan(
|
|
14589
14808
|
"cli.play_start_unwatched",
|
|
14590
14809
|
{ targetKind: "name", playName },
|
|
14591
|
-
() => client2.startPlayRun(startRequest).catch((error) => {
|
|
14592
|
-
throw normalizePlayStartError(error, playName
|
|
14810
|
+
() => client2.startPlayRun(startRequest).catch(async (error) => {
|
|
14811
|
+
throw await normalizePlayStartError(client2, error, playName, {
|
|
14812
|
+
suggestMissingPlay: true
|
|
14813
|
+
});
|
|
14593
14814
|
})
|
|
14594
14815
|
);
|
|
14595
14816
|
const resolvedDashboardUrl = buildPlayDashboardUrl(client2.baseUrl, playName);
|
|
@@ -15028,7 +15249,9 @@ async function handlePlayGet(args) {
|
|
|
15028
15249
|
}
|
|
15029
15250
|
}
|
|
15030
15251
|
const playName = isFileTarget(target) ? extractPlayName((0, import_node_fs10.readFileSync)((0, import_node_path11.resolve)(target), "utf-8"), (0, import_node_path11.resolve)(target)) : parseReferencedPlayTarget2(target).playName;
|
|
15031
|
-
const detail = isFileTarget(target) ? await client2.getPlay(playName) : await assertCanonicalNamedPlayReference(client2, target
|
|
15252
|
+
const detail = isFileTarget(target) ? await client2.getPlay(playName) : await assertCanonicalNamedPlayReference(client2, target, {
|
|
15253
|
+
command: "get"
|
|
15254
|
+
});
|
|
15032
15255
|
const resolvedSource = detail.play.workingRevision?.sourceCode ?? detail.play.liveRevision?.sourceCode ?? detail.play.currentRevision?.sourceCode ?? detail.play.sourceCode ?? "";
|
|
15033
15256
|
const materializedFile = outPath ? materializeRemotePlaySource({
|
|
15034
15257
|
target,
|
|
@@ -15110,7 +15333,9 @@ async function handlePlayVersions(args) {
|
|
|
15110
15333
|
}
|
|
15111
15334
|
const client2 = new DeeplineClient();
|
|
15112
15335
|
const jsonOutput = argsWantJson(args);
|
|
15113
|
-
await assertCanonicalNamedPlayReference(client2, playName
|
|
15336
|
+
await assertCanonicalNamedPlayReference(client2, playName, {
|
|
15337
|
+
command: "versions"
|
|
15338
|
+
});
|
|
15114
15339
|
const versions = await client2.listPlayVersions(
|
|
15115
15340
|
parseReferencedPlayTarget2(playName).playName
|
|
15116
15341
|
);
|
|
@@ -15506,7 +15731,9 @@ async function handlePlayDescribe(args) {
|
|
|
15506
15731
|
return 2;
|
|
15507
15732
|
}
|
|
15508
15733
|
const client2 = new DeeplineClient();
|
|
15509
|
-
await assertCanonicalNamedPlayReference(client2, playName
|
|
15734
|
+
await assertCanonicalNamedPlayReference(client2, playName, {
|
|
15735
|
+
command: "describe"
|
|
15736
|
+
});
|
|
15510
15737
|
const play = await client2.describePlay(
|
|
15511
15738
|
parseReferencedPlayTarget2(playName).playName,
|
|
15512
15739
|
{
|
|
@@ -24014,7 +24241,7 @@ var EXIT_AUTH2 = 1;
|
|
|
24014
24241
|
var EXIT_SERVER3 = 2;
|
|
24015
24242
|
var MAX_PROMPT_LENGTH = 8e3;
|
|
24016
24243
|
var MAX_BODY_BYTES = 64 * 1024;
|
|
24017
|
-
function
|
|
24244
|
+
function shellQuote3(arg) {
|
|
24018
24245
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
24019
24246
|
}
|
|
24020
24247
|
function hasClaudeBinary() {
|
|
@@ -24187,7 +24414,7 @@ async function handleQuickstart(options) {
|
|
|
24187
24414
|
}
|
|
24188
24415
|
progress.complete();
|
|
24189
24416
|
const { prompt, workflowId } = outcome;
|
|
24190
|
-
const claudeCommand = `claude ${
|
|
24417
|
+
const claudeCommand = `claude ${shellQuote3(prompt)}`;
|
|
24191
24418
|
const claudeAvailable = hasClaudeBinary();
|
|
24192
24419
|
const willLaunch = options.launch !== false && !jsonOutput && interactive && claudeAvailable;
|
|
24193
24420
|
printCommandEnvelope(
|
|
@@ -26109,7 +26336,7 @@ function parseExecuteOptions(args) {
|
|
|
26109
26336
|
function safeFileStem(value) {
|
|
26110
26337
|
return value.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "tool";
|
|
26111
26338
|
}
|
|
26112
|
-
function
|
|
26339
|
+
function shellQuote4(value) {
|
|
26113
26340
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
26114
26341
|
}
|
|
26115
26342
|
function powerShellQuote(value) {
|
|
@@ -26179,7 +26406,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
26179
26406
|
path: scriptPath,
|
|
26180
26407
|
sourceCode: script,
|
|
26181
26408
|
projectDir,
|
|
26182
|
-
macCopyCommand: `mkdir -p ${
|
|
26409
|
+
macCopyCommand: `mkdir -p ${shellQuote4(projectDir)} && cp ${shellQuote4(scriptPath)} ${shellQuote4(`${projectDir}/${fileName}`)}`,
|
|
26183
26410
|
windowsCopyCommand: `New-Item -ItemType Directory -Force -Path ${powerShellQuote(projectDir.replace(/\//g, "\\"))} | Out-Null; Copy-Item -LiteralPath ${powerShellQuote(scriptPath)} -Destination ${powerShellQuote(`${projectDir.replace(/\//g, "\\")}\\${fileName}`)}`
|
|
26184
26411
|
};
|
|
26185
26412
|
}
|
|
@@ -26202,7 +26429,7 @@ function buildToolExecuteBaseEnvelope(input2) {
|
|
|
26202
26429
|
envelope,
|
|
26203
26430
|
"output"
|
|
26204
26431
|
);
|
|
26205
|
-
const inspectCommand = `deepline tools execute ${input2.toolId} --input ${
|
|
26432
|
+
const inspectCommand = `deepline tools execute ${input2.toolId} --input ${shellQuote4(JSON.stringify(input2.params))} --json`;
|
|
26206
26433
|
const actions = input2.listConversion ? [
|
|
26207
26434
|
{
|
|
26208
26435
|
label: "next",
|
|
@@ -27271,7 +27498,7 @@ function hasCommand(command) {
|
|
|
27271
27498
|
});
|
|
27272
27499
|
return result.status === 0;
|
|
27273
27500
|
}
|
|
27274
|
-
function
|
|
27501
|
+
function shellQuote5(arg) {
|
|
27275
27502
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
27276
27503
|
}
|
|
27277
27504
|
function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES) {
|
|
@@ -27279,7 +27506,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
27279
27506
|
const npxInstall = {
|
|
27280
27507
|
command: "npx",
|
|
27281
27508
|
args: npxArgs,
|
|
27282
|
-
manualCommand: `npx ${npxArgs.map(
|
|
27509
|
+
manualCommand: `npx ${npxArgs.map(shellQuote5).join(" ")}`
|
|
27283
27510
|
};
|
|
27284
27511
|
if (hasCommand("bunx")) {
|
|
27285
27512
|
const bunxArgs = buildBunxSkillsInstallArgs(baseUrl, skillNames);
|
|
@@ -27287,7 +27514,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
27287
27514
|
{
|
|
27288
27515
|
command: "bunx",
|
|
27289
27516
|
args: bunxArgs,
|
|
27290
|
-
manualCommand: `bunx ${bunxArgs.map(
|
|
27517
|
+
manualCommand: `bunx ${bunxArgs.map(shellQuote5).join(" ")}`
|
|
27291
27518
|
},
|
|
27292
27519
|
npxInstall
|
|
27293
27520
|
];
|
|
@@ -27454,14 +27681,14 @@ function posixShellQuote(value) {
|
|
|
27454
27681
|
function windowsCmdQuote(value) {
|
|
27455
27682
|
return `"${value.replace(/"/g, '""')}"`;
|
|
27456
27683
|
}
|
|
27457
|
-
function
|
|
27684
|
+
function shellQuote6(value) {
|
|
27458
27685
|
if (process.platform === "win32") {
|
|
27459
27686
|
return /^[A-Za-z0-9_./:@%+=,-]+$/.test(value) ? value : windowsCmdQuote(value);
|
|
27460
27687
|
}
|
|
27461
27688
|
return posixShellQuote(value);
|
|
27462
27689
|
}
|
|
27463
27690
|
function buildSourceUpdateCommand(sourceRoot) {
|
|
27464
|
-
const quotedRoot =
|
|
27691
|
+
const quotedRoot = shellQuote6(sourceRoot);
|
|
27465
27692
|
const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
|
|
27466
27693
|
return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
|
|
27467
27694
|
}
|
|
@@ -27473,7 +27700,7 @@ function buildSidecarProjectConfigCommand(versionDir, nodeBin) {
|
|
|
27473
27700
|
"fs.mkdirSync(dir,{recursive:true});",
|
|
27474
27701
|
`fs.writeFileSync(path.join(dir,'package.json'),${JSON.stringify(NPM_SDK_SIDECAR_PACKAGE_JSON)});`
|
|
27475
27702
|
].join("");
|
|
27476
|
-
return `${
|
|
27703
|
+
return `${shellQuote6(nodeBin)} -e ${shellQuote6(script)} ${shellQuote6(versionDir)}`;
|
|
27477
27704
|
}
|
|
27478
27705
|
function sidecarStateDir(input2) {
|
|
27479
27706
|
const scope = input2.env.DEEPLINE_CONFIG_SCOPE?.trim();
|
|
@@ -27512,7 +27739,7 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
27512
27739
|
const packageSpec = options.packageSpec || "deepline@latest";
|
|
27513
27740
|
const npmCommand = "npm";
|
|
27514
27741
|
const versionDir = (0, import_node_path19.join)(stateDir, "versions", "<version>");
|
|
27515
|
-
const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${
|
|
27742
|
+
const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote6(versionDir)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote6).join(" ")} ${shellQuote6(packageSpec)}`;
|
|
27516
27743
|
return {
|
|
27517
27744
|
kind: "python-sidecar",
|
|
27518
27745
|
stateDir,
|
|
@@ -27592,7 +27819,7 @@ function resolveUpdatePlan(options = {}) {
|
|
|
27592
27819
|
command,
|
|
27593
27820
|
args,
|
|
27594
27821
|
...installPrefix ? { installPrefix } : {},
|
|
27595
|
-
manualCommand: `${command} ${args.map(
|
|
27822
|
+
manualCommand: `${command} ${args.map(shellQuote6).join(" ")}`
|
|
27596
27823
|
};
|
|
27597
27824
|
}
|
|
27598
27825
|
var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
|
|
@@ -27753,9 +27980,9 @@ function writeSidecarLauncher(input2) {
|
|
|
27753
27980
|
input2.path,
|
|
27754
27981
|
[
|
|
27755
27982
|
"#!/usr/bin/env sh",
|
|
27756
|
-
`export DEEPLINE_HOST_URL=${
|
|
27757
|
-
`export DEEPLINE_CONFIG_SCOPE=${
|
|
27758
|
-
`exec ${
|
|
27983
|
+
`export DEEPLINE_HOST_URL=${shellQuote6(input2.hostUrl)}`,
|
|
27984
|
+
`export DEEPLINE_CONFIG_SCOPE=${shellQuote6(input2.scope)}`,
|
|
27985
|
+
`exec ${shellQuote6(input2.nodeBin)} ${shellQuote6(input2.entryPath)} "$@"`,
|
|
27759
27986
|
""
|
|
27760
27987
|
].join("\n"),
|
|
27761
27988
|
{ encoding: "utf8", mode: 493 }
|
package/dist/cli/index.mjs
CHANGED
|
@@ -608,10 +608,10 @@ var SDK_RELEASE = {
|
|
|
608
608
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
609
609
|
// fields shipped in 0.1.153.
|
|
610
610
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
611
|
-
version: "0.1.
|
|
611
|
+
version: "0.1.199",
|
|
612
612
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
613
613
|
supportPolicy: {
|
|
614
|
-
latest: "0.1.
|
|
614
|
+
latest: "0.1.199",
|
|
615
615
|
minimumSupported: "0.1.53",
|
|
616
616
|
deprecatedBelow: "0.1.53",
|
|
617
617
|
commandMinimumSupported: [
|
|
@@ -10745,14 +10745,219 @@ function parseReferencedPlayTarget2(target) {
|
|
|
10745
10745
|
function isPrebuiltReferenceTarget(target) {
|
|
10746
10746
|
return target.trim().toLowerCase().startsWith("prebuilt/");
|
|
10747
10747
|
}
|
|
10748
|
+
function buildBarePrebuiltReferenceMessage(input2) {
|
|
10749
|
+
return `Prebuilt play "${input2.requested}" must be referenced as "${input2.reference}". Use the prebuilt/ namespace anywhere you run, describe, get, or link to Deepline-managed plays.`;
|
|
10750
|
+
}
|
|
10748
10751
|
function buildBarePrebuiltReferenceError(input2) {
|
|
10749
|
-
return new Error(
|
|
10750
|
-
|
|
10752
|
+
return new Error(buildBarePrebuiltReferenceMessage(input2));
|
|
10753
|
+
}
|
|
10754
|
+
function isPlayNotFoundError(error) {
|
|
10755
|
+
return error instanceof DeeplineError && (error.statusCode === 404 || error.code === "PLAY_NOT_FOUND" || error.code === "NOT_FOUND");
|
|
10756
|
+
}
|
|
10757
|
+
function isExplicitMissingPlayReferenceError(error) {
|
|
10758
|
+
if (!(error instanceof DeeplineError)) {
|
|
10759
|
+
return false;
|
|
10760
|
+
}
|
|
10761
|
+
if (error.statusCode !== 404 && error.code !== "PLAY_NOT_FOUND") {
|
|
10762
|
+
return false;
|
|
10763
|
+
}
|
|
10764
|
+
return /^play not found\b/i.test(error.message.trim());
|
|
10765
|
+
}
|
|
10766
|
+
function normalizePlayReferenceForMatch(value) {
|
|
10767
|
+
return value.trim().toLowerCase().replace(/^prebuilt\//, "").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
10768
|
+
}
|
|
10769
|
+
function playReferenceMatchTokens(value) {
|
|
10770
|
+
return normalizePlayReferenceForMatch(value).split("-").filter((token) => token.length > 1 && token !== "to" && token !== "and");
|
|
10771
|
+
}
|
|
10772
|
+
function playSuggestionReference(play) {
|
|
10773
|
+
if (play.reference?.trim()) {
|
|
10774
|
+
return play.reference.trim();
|
|
10775
|
+
}
|
|
10776
|
+
const ownerSlug = play.ownerSlug?.trim();
|
|
10777
|
+
return ownerSlug ? `${ownerSlug}/${play.name}` : play.name;
|
|
10778
|
+
}
|
|
10779
|
+
function scorePlayReferenceSuggestion(requested, play) {
|
|
10780
|
+
const parsed = parseReferencedPlayTarget2(requested);
|
|
10781
|
+
const requestedTrimmed = requested.trim();
|
|
10782
|
+
const requestedRef = requestedTrimmed.toLowerCase();
|
|
10783
|
+
const requestedName = parsed.unqualifiedPlayName;
|
|
10784
|
+
const requestedNorm = normalizePlayReferenceForMatch(requestedTrimmed);
|
|
10785
|
+
const requestedNameNorm = normalizePlayReferenceForMatch(requestedName);
|
|
10786
|
+
if (!requestedNorm && !requestedNameNorm) {
|
|
10787
|
+
return null;
|
|
10788
|
+
}
|
|
10789
|
+
const reference = playSuggestionReference(play);
|
|
10790
|
+
const referenceNorm = normalizePlayReferenceForMatch(reference);
|
|
10791
|
+
const nameNorm = normalizePlayReferenceForMatch(play.name);
|
|
10792
|
+
const candidateNamespace = reference.includes("/") ? reference.split("/")[0]?.toLowerCase() : null;
|
|
10793
|
+
const requestedNamespace = parsed.ownerSlug?.toLowerCase() ?? null;
|
|
10794
|
+
const aliases = (play.aliases ?? []).map(normalizePlayReferenceForMatch);
|
|
10795
|
+
const searchable = [referenceNorm, nameNorm, ...aliases].filter(Boolean);
|
|
10796
|
+
const requestedTokens = playReferenceMatchTokens(requestedName);
|
|
10797
|
+
const candidateTokens = [
|
|
10798
|
+
...new Set(
|
|
10799
|
+
[reference, play.name, ...play.aliases ?? []].flatMap(
|
|
10800
|
+
playReferenceMatchTokens
|
|
10801
|
+
)
|
|
10802
|
+
)
|
|
10803
|
+
];
|
|
10804
|
+
const hasTokenContainment = requestedTokens.length > 0 && requestedTokens.every((token) => candidateTokens.includes(token));
|
|
10805
|
+
let score = 0;
|
|
10806
|
+
if (reference.toLowerCase() === requestedRef) {
|
|
10807
|
+
score = 120;
|
|
10808
|
+
} else if (requestedNamespace && candidateNamespace === requestedNamespace && nameNorm === requestedNameNorm) {
|
|
10809
|
+
score = 110;
|
|
10810
|
+
} else if (nameNorm === requestedNameNorm || aliases.includes(requestedNameNorm)) {
|
|
10811
|
+
score = play.origin === "prebuilt" ? 100 : 95;
|
|
10812
|
+
} else if (requestedNamespace && candidateNamespace === requestedNamespace && searchable.some(
|
|
10813
|
+
(value) => value.includes(requestedNameNorm) || requestedNameNorm.includes(value)
|
|
10814
|
+
)) {
|
|
10815
|
+
score = 85;
|
|
10816
|
+
} else if (searchable.some(
|
|
10817
|
+
(value) => value.includes(requestedNorm) || requestedNorm.includes(value)
|
|
10818
|
+
)) {
|
|
10819
|
+
score = 70;
|
|
10820
|
+
} else if (requestedNameNorm && searchable.some(
|
|
10821
|
+
(value) => value.includes(requestedNameNorm) || requestedNameNorm.includes(value)
|
|
10822
|
+
)) {
|
|
10823
|
+
score = 60;
|
|
10824
|
+
} else if (hasTokenContainment) {
|
|
10825
|
+
score = requestedNamespace && candidateNamespace === requestedNamespace ? 58 : 50;
|
|
10826
|
+
}
|
|
10827
|
+
if (score <= 0) {
|
|
10828
|
+
return null;
|
|
10829
|
+
}
|
|
10830
|
+
if (play.origin === "prebuilt") {
|
|
10831
|
+
score += 3;
|
|
10832
|
+
}
|
|
10833
|
+
return {
|
|
10834
|
+
reference,
|
|
10835
|
+
name: play.name,
|
|
10836
|
+
origin: play.origin ?? null,
|
|
10837
|
+
score
|
|
10838
|
+
};
|
|
10839
|
+
}
|
|
10840
|
+
function rankPlayReferenceSuggestions(input2) {
|
|
10841
|
+
const byReference = /* @__PURE__ */ new Map();
|
|
10842
|
+
for (const play of input2.plays) {
|
|
10843
|
+
const suggestion = scorePlayReferenceSuggestion(input2.requested, play);
|
|
10844
|
+
if (!suggestion) continue;
|
|
10845
|
+
const existing = byReference.get(suggestion.reference);
|
|
10846
|
+
if (!existing || suggestion.score > existing.score) {
|
|
10847
|
+
byReference.set(suggestion.reference, suggestion);
|
|
10848
|
+
}
|
|
10849
|
+
}
|
|
10850
|
+
return [...byReference.values()].sort((left, right) => {
|
|
10851
|
+
if (right.score !== left.score) return right.score - left.score;
|
|
10852
|
+
if (left.origin === "prebuilt" && right.origin !== "prebuilt") return -1;
|
|
10853
|
+
if (right.origin === "prebuilt" && left.origin !== "prebuilt") return 1;
|
|
10854
|
+
return left.reference.localeCompare(right.reference);
|
|
10855
|
+
}).slice(0, input2.limit ?? 5);
|
|
10856
|
+
}
|
|
10857
|
+
function searchQueryForMissingPlayReference(target) {
|
|
10858
|
+
return parseReferencedPlayTarget2(target).unqualifiedPlayName.replace(/[-_./]+/g, " ").replace(/\s+/g, " ").trim();
|
|
10859
|
+
}
|
|
10860
|
+
function shellQuote2(value) {
|
|
10861
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
10862
|
+
}
|
|
10863
|
+
function buildPlayReferenceNotFoundMessage(input2) {
|
|
10864
|
+
const lines = [`Play not found: ${input2.requested}`];
|
|
10865
|
+
if (input2.suggestions.length > 0) {
|
|
10866
|
+
lines.push("", "Did you mean one of these?");
|
|
10867
|
+
for (const suggestion of input2.suggestions) {
|
|
10868
|
+
lines.push("", ` ${suggestion.reference}`);
|
|
10869
|
+
if (input2.command === "run") {
|
|
10870
|
+
lines.push(
|
|
10871
|
+
` deepline plays run ${suggestion.reference} --input '{...}' --watch`
|
|
10872
|
+
);
|
|
10873
|
+
} else if (input2.command === "get") {
|
|
10874
|
+
lines.push(` deepline plays get ${suggestion.reference} --json`);
|
|
10875
|
+
} else if (input2.command === "check") {
|
|
10876
|
+
lines.push(` deepline plays check ${suggestion.reference} --json`);
|
|
10877
|
+
} else if (input2.command === "versions") {
|
|
10878
|
+
lines.push(
|
|
10879
|
+
` deepline plays versions --name ${suggestion.reference} --json`
|
|
10880
|
+
);
|
|
10881
|
+
} else {
|
|
10882
|
+
lines.push(
|
|
10883
|
+
` deepline plays describe ${suggestion.reference} --json`
|
|
10884
|
+
);
|
|
10885
|
+
}
|
|
10886
|
+
}
|
|
10887
|
+
}
|
|
10888
|
+
const searchQuery = searchQueryForMissingPlayReference(input2.requested);
|
|
10889
|
+
if (searchQuery) {
|
|
10890
|
+
lines.push(
|
|
10891
|
+
"",
|
|
10892
|
+
"Search visible plays:",
|
|
10893
|
+
` deepline plays search ${shellQuote2(searchQuery)} --all --json`
|
|
10894
|
+
);
|
|
10895
|
+
}
|
|
10896
|
+
return lines.join("\n");
|
|
10897
|
+
}
|
|
10898
|
+
async function buildPlayReferenceNotFoundError(input2) {
|
|
10899
|
+
let suggestions = [];
|
|
10900
|
+
try {
|
|
10901
|
+
const searchQuery = searchQueryForMissingPlayReference(input2.target);
|
|
10902
|
+
const searchMatches = searchQuery ? await input2.client.searchPlays({
|
|
10903
|
+
query: searchQuery,
|
|
10904
|
+
scope: "all",
|
|
10905
|
+
compact: true
|
|
10906
|
+
}) : [];
|
|
10907
|
+
const plays = searchMatches.length > 0 ? searchMatches : await input2.client.listPlays();
|
|
10908
|
+
suggestions = rankPlayReferenceSuggestions({
|
|
10909
|
+
requested: input2.target,
|
|
10910
|
+
plays,
|
|
10911
|
+
limit: 5
|
|
10912
|
+
});
|
|
10913
|
+
} catch {
|
|
10914
|
+
suggestions = [];
|
|
10915
|
+
}
|
|
10916
|
+
const sourceError = input2.sourceError instanceof DeeplineError ? input2.sourceError : null;
|
|
10917
|
+
const code = sourceError?.code && sourceError.code !== "API_ERROR" ? sourceError.code : "PLAY_NOT_FOUND";
|
|
10918
|
+
return new DeeplineError(
|
|
10919
|
+
buildPlayReferenceNotFoundMessage({
|
|
10920
|
+
requested: input2.target,
|
|
10921
|
+
command: input2.command,
|
|
10922
|
+
suggestions
|
|
10923
|
+
}),
|
|
10924
|
+
sourceError?.statusCode ?? 404,
|
|
10925
|
+
code,
|
|
10926
|
+
sourceError?.details
|
|
10751
10927
|
);
|
|
10752
10928
|
}
|
|
10753
|
-
async function
|
|
10929
|
+
async function isMissingRunPlayReferenceError(input2) {
|
|
10930
|
+
if (isExplicitMissingPlayReferenceError(input2.error)) {
|
|
10931
|
+
return true;
|
|
10932
|
+
}
|
|
10933
|
+
if (!(input2.error instanceof DeeplineError) || input2.error.statusCode !== 404 || !/^no artifact-backed revision found for play:/i.test(
|
|
10934
|
+
input2.error.message.trim()
|
|
10935
|
+
)) {
|
|
10936
|
+
return false;
|
|
10937
|
+
}
|
|
10938
|
+
try {
|
|
10939
|
+
await input2.client.getPlay(parseReferencedPlayTarget2(input2.playName).playName);
|
|
10940
|
+
return false;
|
|
10941
|
+
} catch (lookupError) {
|
|
10942
|
+
return isPlayNotFoundError(lookupError);
|
|
10943
|
+
}
|
|
10944
|
+
}
|
|
10945
|
+
async function assertCanonicalNamedPlayReference(client2, target, options = {}) {
|
|
10754
10946
|
const parsed = parseReferencedPlayTarget2(target);
|
|
10755
|
-
|
|
10947
|
+
let detail;
|
|
10948
|
+
try {
|
|
10949
|
+
detail = await client2.getPlay(parsed.playName);
|
|
10950
|
+
} catch (error) {
|
|
10951
|
+
if (isPlayNotFoundError(error)) {
|
|
10952
|
+
throw await buildPlayReferenceNotFoundError({
|
|
10953
|
+
client: client2,
|
|
10954
|
+
target,
|
|
10955
|
+
command: options.command ?? "describe",
|
|
10956
|
+
sourceError: error
|
|
10957
|
+
});
|
|
10958
|
+
}
|
|
10959
|
+
throw error;
|
|
10960
|
+
}
|
|
10756
10961
|
if (detail.play.ownerType === "deepline" && !isPrebuiltReferenceTarget(target)) {
|
|
10757
10962
|
throw buildBarePrebuiltReferenceError({
|
|
10758
10963
|
requested: target,
|
|
@@ -13488,10 +13693,7 @@ async function exportPlayStatusRows(client2, status, outPath, options = {}) {
|
|
|
13488
13693
|
availableRows,
|
|
13489
13694
|
datasetPath: options.datasetPath
|
|
13490
13695
|
});
|
|
13491
|
-
return {
|
|
13492
|
-
path: writeCanonicalRowsCsv(guarded2, outPath),
|
|
13493
|
-
rowsInfo: guarded2
|
|
13494
|
-
};
|
|
13696
|
+
return { path: writeCanonicalRowsCsv(guarded2, outPath), rowsInfo: guarded2 };
|
|
13495
13697
|
}
|
|
13496
13698
|
if (rowsInfo.complete) {
|
|
13497
13699
|
const guarded2 = assertDatasetHasExportableRows({
|
|
@@ -13500,7 +13702,10 @@ async function exportPlayStatusRows(client2, status, outPath, options = {}) {
|
|
|
13500
13702
|
availableRows,
|
|
13501
13703
|
datasetPath: options.datasetPath
|
|
13502
13704
|
});
|
|
13503
|
-
return {
|
|
13705
|
+
return {
|
|
13706
|
+
path: writeCanonicalRowsCsv(guarded2, outPath),
|
|
13707
|
+
rowsInfo: guarded2
|
|
13708
|
+
};
|
|
13504
13709
|
}
|
|
13505
13710
|
if (attempt < attempts && retryDelayMs > 0) {
|
|
13506
13711
|
await sleep5(retryDelayMs);
|
|
@@ -13634,17 +13839,25 @@ function normalizePlayValidationError(error) {
|
|
|
13634
13839
|
error instanceof DeeplineError ? error.details : void 0
|
|
13635
13840
|
);
|
|
13636
13841
|
}
|
|
13637
|
-
function normalizePlayStartError(error, playName) {
|
|
13842
|
+
async function normalizePlayStartError(client2, error, playName, options = {}) {
|
|
13638
13843
|
const activeRuns = extractActiveRunsFromError(error);
|
|
13639
|
-
if (activeRuns.length
|
|
13640
|
-
return
|
|
13844
|
+
if (activeRuns.length > 0) {
|
|
13845
|
+
return new DeeplineError(
|
|
13846
|
+
formatActiveRunConflictError({ playName, activeRuns }),
|
|
13847
|
+
error instanceof DeeplineError ? error.statusCode : 409,
|
|
13848
|
+
"ACTIVE_RUN_EXISTS",
|
|
13849
|
+
error instanceof DeeplineError ? error.details : void 0
|
|
13850
|
+
);
|
|
13641
13851
|
}
|
|
13642
|
-
|
|
13643
|
-
|
|
13644
|
-
|
|
13645
|
-
|
|
13646
|
-
|
|
13647
|
-
|
|
13852
|
+
if (options.suggestMissingPlay && await isMissingRunPlayReferenceError({ client: client2, error, playName })) {
|
|
13853
|
+
return buildPlayReferenceNotFoundError({
|
|
13854
|
+
client: client2,
|
|
13855
|
+
target: playName,
|
|
13856
|
+
command: "run",
|
|
13857
|
+
sourceError: error
|
|
13858
|
+
});
|
|
13859
|
+
}
|
|
13860
|
+
return normalizePlayValidationError(error);
|
|
13648
13861
|
}
|
|
13649
13862
|
function renderServerResultView(value) {
|
|
13650
13863
|
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
@@ -14157,7 +14370,9 @@ async function handlePlayCheck(args) {
|
|
|
14157
14370
|
if (!isFileTarget(options.target)) {
|
|
14158
14371
|
const client3 = new DeeplineClient();
|
|
14159
14372
|
try {
|
|
14160
|
-
await assertCanonicalNamedPlayReference(client3, options.target
|
|
14373
|
+
await assertCanonicalNamedPlayReference(client3, options.target, {
|
|
14374
|
+
command: "check"
|
|
14375
|
+
});
|
|
14161
14376
|
const play = await client3.describePlay(
|
|
14162
14377
|
parseReferencedPlayTarget2(options.target).playName,
|
|
14163
14378
|
{ compact: true }
|
|
@@ -14427,8 +14642,8 @@ async function handleFileBackedRun(options) {
|
|
|
14427
14642
|
waitTimeoutMs: options.waitTimeoutMs,
|
|
14428
14643
|
noOpen: options.noOpen,
|
|
14429
14644
|
progress
|
|
14430
|
-
}).catch((error) => {
|
|
14431
|
-
throw normalizePlayStartError(error, playName);
|
|
14645
|
+
}).catch(async (error) => {
|
|
14646
|
+
throw await normalizePlayStartError(client2, error, playName);
|
|
14432
14647
|
})
|
|
14433
14648
|
);
|
|
14434
14649
|
if (finalStatus.status === "completed") {
|
|
@@ -14458,8 +14673,8 @@ async function handleFileBackedRun(options) {
|
|
|
14458
14673
|
const started = await traceCliSpan(
|
|
14459
14674
|
"cli.play_start_unwatched",
|
|
14460
14675
|
{ targetKind: "file", playName },
|
|
14461
|
-
() => client2.startPlayRun(startRequest).catch((error) => {
|
|
14462
|
-
throw normalizePlayStartError(error, playName);
|
|
14676
|
+
() => client2.startPlayRun(startRequest).catch(async (error) => {
|
|
14677
|
+
throw await normalizePlayStartError(client2, error, playName);
|
|
14463
14678
|
})
|
|
14464
14679
|
);
|
|
14465
14680
|
const resolvedDashboardUrl = buildPlayDashboardUrl(client2.baseUrl, playName);
|
|
@@ -14517,7 +14732,9 @@ async function handleNamedRun(options) {
|
|
|
14517
14732
|
return traceCliSpan(
|
|
14518
14733
|
"cli.play_load_definition",
|
|
14519
14734
|
{ targetKind: "name", playName, skipped: false },
|
|
14520
|
-
() => assertCanonicalNamedPlayReference(client2, playName
|
|
14735
|
+
() => assertCanonicalNamedPlayReference(client2, playName, {
|
|
14736
|
+
command: "run"
|
|
14737
|
+
})
|
|
14521
14738
|
);
|
|
14522
14739
|
})() : (recordCliTrace({
|
|
14523
14740
|
phase: "cli.play_load_definition",
|
|
@@ -14586,8 +14803,10 @@ async function handleNamedRun(options) {
|
|
|
14586
14803
|
waitTimeoutMs: options.waitTimeoutMs,
|
|
14587
14804
|
noOpen: options.noOpen,
|
|
14588
14805
|
progress
|
|
14589
|
-
}).catch((error) => {
|
|
14590
|
-
throw normalizePlayStartError(error, playName
|
|
14806
|
+
}).catch(async (error) => {
|
|
14807
|
+
throw await normalizePlayStartError(client2, error, playName, {
|
|
14808
|
+
suggestMissingPlay: true
|
|
14809
|
+
});
|
|
14591
14810
|
})
|
|
14592
14811
|
);
|
|
14593
14812
|
if (finalStatus.status === "completed") {
|
|
@@ -14617,8 +14836,10 @@ async function handleNamedRun(options) {
|
|
|
14617
14836
|
const started = await traceCliSpan(
|
|
14618
14837
|
"cli.play_start_unwatched",
|
|
14619
14838
|
{ targetKind: "name", playName },
|
|
14620
|
-
() => client2.startPlayRun(startRequest).catch((error) => {
|
|
14621
|
-
throw normalizePlayStartError(error, playName
|
|
14839
|
+
() => client2.startPlayRun(startRequest).catch(async (error) => {
|
|
14840
|
+
throw await normalizePlayStartError(client2, error, playName, {
|
|
14841
|
+
suggestMissingPlay: true
|
|
14842
|
+
});
|
|
14622
14843
|
})
|
|
14623
14844
|
);
|
|
14624
14845
|
const resolvedDashboardUrl = buildPlayDashboardUrl(client2.baseUrl, playName);
|
|
@@ -15057,7 +15278,9 @@ async function handlePlayGet(args) {
|
|
|
15057
15278
|
}
|
|
15058
15279
|
}
|
|
15059
15280
|
const playName = isFileTarget(target) ? extractPlayName(readFileSync7(resolve8(target), "utf-8"), resolve8(target)) : parseReferencedPlayTarget2(target).playName;
|
|
15060
|
-
const detail = isFileTarget(target) ? await client2.getPlay(playName) : await assertCanonicalNamedPlayReference(client2, target
|
|
15281
|
+
const detail = isFileTarget(target) ? await client2.getPlay(playName) : await assertCanonicalNamedPlayReference(client2, target, {
|
|
15282
|
+
command: "get"
|
|
15283
|
+
});
|
|
15061
15284
|
const resolvedSource = detail.play.workingRevision?.sourceCode ?? detail.play.liveRevision?.sourceCode ?? detail.play.currentRevision?.sourceCode ?? detail.play.sourceCode ?? "";
|
|
15062
15285
|
const materializedFile = outPath ? materializeRemotePlaySource({
|
|
15063
15286
|
target,
|
|
@@ -15139,7 +15362,9 @@ async function handlePlayVersions(args) {
|
|
|
15139
15362
|
}
|
|
15140
15363
|
const client2 = new DeeplineClient();
|
|
15141
15364
|
const jsonOutput = argsWantJson(args);
|
|
15142
|
-
await assertCanonicalNamedPlayReference(client2, playName
|
|
15365
|
+
await assertCanonicalNamedPlayReference(client2, playName, {
|
|
15366
|
+
command: "versions"
|
|
15367
|
+
});
|
|
15143
15368
|
const versions = await client2.listPlayVersions(
|
|
15144
15369
|
parseReferencedPlayTarget2(playName).playName
|
|
15145
15370
|
);
|
|
@@ -15535,7 +15760,9 @@ async function handlePlayDescribe(args) {
|
|
|
15535
15760
|
return 2;
|
|
15536
15761
|
}
|
|
15537
15762
|
const client2 = new DeeplineClient();
|
|
15538
|
-
await assertCanonicalNamedPlayReference(client2, playName
|
|
15763
|
+
await assertCanonicalNamedPlayReference(client2, playName, {
|
|
15764
|
+
command: "describe"
|
|
15765
|
+
});
|
|
15539
15766
|
const play = await client2.describePlay(
|
|
15540
15767
|
parseReferencedPlayTarget2(playName).playName,
|
|
15541
15768
|
{
|
|
@@ -24050,7 +24277,7 @@ var EXIT_AUTH2 = 1;
|
|
|
24050
24277
|
var EXIT_SERVER3 = 2;
|
|
24051
24278
|
var MAX_PROMPT_LENGTH = 8e3;
|
|
24052
24279
|
var MAX_BODY_BYTES = 64 * 1024;
|
|
24053
|
-
function
|
|
24280
|
+
function shellQuote3(arg) {
|
|
24054
24281
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
24055
24282
|
}
|
|
24056
24283
|
function hasClaudeBinary() {
|
|
@@ -24223,7 +24450,7 @@ async function handleQuickstart(options) {
|
|
|
24223
24450
|
}
|
|
24224
24451
|
progress.complete();
|
|
24225
24452
|
const { prompt, workflowId } = outcome;
|
|
24226
|
-
const claudeCommand = `claude ${
|
|
24453
|
+
const claudeCommand = `claude ${shellQuote3(prompt)}`;
|
|
24227
24454
|
const claudeAvailable = hasClaudeBinary();
|
|
24228
24455
|
const willLaunch = options.launch !== false && !jsonOutput && interactive && claudeAvailable;
|
|
24229
24456
|
printCommandEnvelope(
|
|
@@ -26157,7 +26384,7 @@ function parseExecuteOptions(args) {
|
|
|
26157
26384
|
function safeFileStem(value) {
|
|
26158
26385
|
return value.trim().replace(/[^a-zA-Z0-9_-]+/g, "-").replace(/^-+|-+$/g, "").slice(0, 64) || "tool";
|
|
26159
26386
|
}
|
|
26160
|
-
function
|
|
26387
|
+
function shellQuote4(value) {
|
|
26161
26388
|
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
26162
26389
|
}
|
|
26163
26390
|
function powerShellQuote(value) {
|
|
@@ -26227,7 +26454,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
26227
26454
|
path: scriptPath,
|
|
26228
26455
|
sourceCode: script,
|
|
26229
26456
|
projectDir,
|
|
26230
|
-
macCopyCommand: `mkdir -p ${
|
|
26457
|
+
macCopyCommand: `mkdir -p ${shellQuote4(projectDir)} && cp ${shellQuote4(scriptPath)} ${shellQuote4(`${projectDir}/${fileName}`)}`,
|
|
26231
26458
|
windowsCopyCommand: `New-Item -ItemType Directory -Force -Path ${powerShellQuote(projectDir.replace(/\//g, "\\"))} | Out-Null; Copy-Item -LiteralPath ${powerShellQuote(scriptPath)} -Destination ${powerShellQuote(`${projectDir.replace(/\//g, "\\")}\\${fileName}`)}`
|
|
26232
26459
|
};
|
|
26233
26460
|
}
|
|
@@ -26250,7 +26477,7 @@ function buildToolExecuteBaseEnvelope(input2) {
|
|
|
26250
26477
|
envelope,
|
|
26251
26478
|
"output"
|
|
26252
26479
|
);
|
|
26253
|
-
const inspectCommand = `deepline tools execute ${input2.toolId} --input ${
|
|
26480
|
+
const inspectCommand = `deepline tools execute ${input2.toolId} --input ${shellQuote4(JSON.stringify(input2.params))} --json`;
|
|
26254
26481
|
const actions = input2.listConversion ? [
|
|
26255
26482
|
{
|
|
26256
26483
|
label: "next",
|
|
@@ -27328,7 +27555,7 @@ function hasCommand(command) {
|
|
|
27328
27555
|
});
|
|
27329
27556
|
return result.status === 0;
|
|
27330
27557
|
}
|
|
27331
|
-
function
|
|
27558
|
+
function shellQuote5(arg) {
|
|
27332
27559
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
27333
27560
|
}
|
|
27334
27561
|
function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES) {
|
|
@@ -27336,7 +27563,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
27336
27563
|
const npxInstall = {
|
|
27337
27564
|
command: "npx",
|
|
27338
27565
|
args: npxArgs,
|
|
27339
|
-
manualCommand: `npx ${npxArgs.map(
|
|
27566
|
+
manualCommand: `npx ${npxArgs.map(shellQuote5).join(" ")}`
|
|
27340
27567
|
};
|
|
27341
27568
|
if (hasCommand("bunx")) {
|
|
27342
27569
|
const bunxArgs = buildBunxSkillsInstallArgs(baseUrl, skillNames);
|
|
@@ -27344,7 +27571,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
27344
27571
|
{
|
|
27345
27572
|
command: "bunx",
|
|
27346
27573
|
args: bunxArgs,
|
|
27347
|
-
manualCommand: `bunx ${bunxArgs.map(
|
|
27574
|
+
manualCommand: `bunx ${bunxArgs.map(shellQuote5).join(" ")}`
|
|
27348
27575
|
},
|
|
27349
27576
|
npxInstall
|
|
27350
27577
|
];
|
|
@@ -27511,14 +27738,14 @@ function posixShellQuote(value) {
|
|
|
27511
27738
|
function windowsCmdQuote(value) {
|
|
27512
27739
|
return `"${value.replace(/"/g, '""')}"`;
|
|
27513
27740
|
}
|
|
27514
|
-
function
|
|
27741
|
+
function shellQuote6(value) {
|
|
27515
27742
|
if (process.platform === "win32") {
|
|
27516
27743
|
return /^[A-Za-z0-9_./:@%+=,-]+$/.test(value) ? value : windowsCmdQuote(value);
|
|
27517
27744
|
}
|
|
27518
27745
|
return posixShellQuote(value);
|
|
27519
27746
|
}
|
|
27520
27747
|
function buildSourceUpdateCommand(sourceRoot) {
|
|
27521
|
-
const quotedRoot =
|
|
27748
|
+
const quotedRoot = shellQuote6(sourceRoot);
|
|
27522
27749
|
const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
|
|
27523
27750
|
return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
|
|
27524
27751
|
}
|
|
@@ -27530,7 +27757,7 @@ function buildSidecarProjectConfigCommand(versionDir, nodeBin) {
|
|
|
27530
27757
|
"fs.mkdirSync(dir,{recursive:true});",
|
|
27531
27758
|
`fs.writeFileSync(path.join(dir,'package.json'),${JSON.stringify(NPM_SDK_SIDECAR_PACKAGE_JSON)});`
|
|
27532
27759
|
].join("");
|
|
27533
|
-
return `${
|
|
27760
|
+
return `${shellQuote6(nodeBin)} -e ${shellQuote6(script)} ${shellQuote6(versionDir)}`;
|
|
27534
27761
|
}
|
|
27535
27762
|
function sidecarStateDir(input2) {
|
|
27536
27763
|
const scope = input2.env.DEEPLINE_CONFIG_SCOPE?.trim();
|
|
@@ -27569,7 +27796,7 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
27569
27796
|
const packageSpec = options.packageSpec || "deepline@latest";
|
|
27570
27797
|
const npmCommand = "npm";
|
|
27571
27798
|
const versionDir = join14(stateDir, "versions", "<version>");
|
|
27572
|
-
const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${
|
|
27799
|
+
const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote6(versionDir)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote6).join(" ")} ${shellQuote6(packageSpec)}`;
|
|
27573
27800
|
return {
|
|
27574
27801
|
kind: "python-sidecar",
|
|
27575
27802
|
stateDir,
|
|
@@ -27649,7 +27876,7 @@ function resolveUpdatePlan(options = {}) {
|
|
|
27649
27876
|
command,
|
|
27650
27877
|
args,
|
|
27651
27878
|
...installPrefix ? { installPrefix } : {},
|
|
27652
|
-
manualCommand: `${command} ${args.map(
|
|
27879
|
+
manualCommand: `${command} ${args.map(shellQuote6).join(" ")}`
|
|
27653
27880
|
};
|
|
27654
27881
|
}
|
|
27655
27882
|
var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
|
|
@@ -27810,9 +28037,9 @@ function writeSidecarLauncher(input2) {
|
|
|
27810
28037
|
input2.path,
|
|
27811
28038
|
[
|
|
27812
28039
|
"#!/usr/bin/env sh",
|
|
27813
|
-
`export DEEPLINE_HOST_URL=${
|
|
27814
|
-
`export DEEPLINE_CONFIG_SCOPE=${
|
|
27815
|
-
`exec ${
|
|
28040
|
+
`export DEEPLINE_HOST_URL=${shellQuote6(input2.hostUrl)}`,
|
|
28041
|
+
`export DEEPLINE_CONFIG_SCOPE=${shellQuote6(input2.scope)}`,
|
|
28042
|
+
`exec ${shellQuote6(input2.nodeBin)} ${shellQuote6(input2.entryPath)} "$@"`,
|
|
27816
28043
|
""
|
|
27817
28044
|
].join("\n"),
|
|
27818
28045
|
{ encoding: "utf8", mode: 493 }
|
package/dist/index.js
CHANGED
|
@@ -422,10 +422,10 @@ var SDK_RELEASE = {
|
|
|
422
422
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
423
423
|
// fields shipped in 0.1.153.
|
|
424
424
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
425
|
-
version: "0.1.
|
|
425
|
+
version: "0.1.199",
|
|
426
426
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
427
427
|
supportPolicy: {
|
|
428
|
-
latest: "0.1.
|
|
428
|
+
latest: "0.1.199",
|
|
429
429
|
minimumSupported: "0.1.53",
|
|
430
430
|
deprecatedBelow: "0.1.53",
|
|
431
431
|
commandMinimumSupported: [
|
package/dist/index.mjs
CHANGED
|
@@ -352,10 +352,10 @@ var SDK_RELEASE = {
|
|
|
352
352
|
// 0.1.154 removes the short-lived generated enrich StepOptions recompute
|
|
353
353
|
// fields shipped in 0.1.153.
|
|
354
354
|
// 0.1.175 ships loud `deepline enrich` empty-waterfall reporting.
|
|
355
|
-
version: "0.1.
|
|
355
|
+
version: "0.1.199",
|
|
356
356
|
apiContract: "2026-06-dataset-handle-results-hard-cutover",
|
|
357
357
|
supportPolicy: {
|
|
358
|
-
latest: "0.1.
|
|
358
|
+
latest: "0.1.199",
|
|
359
359
|
minimumSupported: "0.1.53",
|
|
360
360
|
deprecatedBelow: "0.1.53",
|
|
361
361
|
commandMinimumSupported: [
|