deepline 0.3.286 → 0.3.287
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/client.ts +47 -24
- package/dist/bundling-sources/sdk/src/index.ts +4 -0
- package/dist/bundling-sources/sdk/src/release.ts +7 -1
- package/dist/bundling-sources/sdk/src/types.ts +36 -0
- package/dist/bundling-sources/shared_libs/play-runtime/cell-provenance.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/live-state-contract.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +38 -3
- package/dist/bundling-sources/shared_libs/play-runtime/run-observation.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +43 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +88 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +3 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +53 -25
- package/dist/bundling-sources/shared_libs/play-runtime/step-progress.ts +83 -1
- package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +2 -0
- package/dist/cli/index.js +579 -628
- package/dist/cli/index.mjs +456 -506
- package/dist/{client-B7ic-kY5.d.ts → client-FR_u0dxT.d.ts} +38 -1
- package/dist/{client-Dzf_KovW.d.mts → client-phK1Ixcl.d.mts} +38 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +48 -25
- package/dist/index.mjs +48 -25
- package/dist/install-integrity.json +2 -2
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +1 -1
- package/dist/release.d.mts +5 -1
- package/dist/release.d.ts +5 -1
- package/dist/release.js +6 -1
- package/dist/release.mjs +6 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
|
@@ -1951,7 +1951,7 @@ configureProxyFromEnv();
|
|
|
1951
1951
|
|
|
1952
1952
|
// src/cli/index.ts
|
|
1953
1953
|
import { mkdtemp as mkdtemp3, rm as rm3, writeFile as writeFile6 } from "fs/promises";
|
|
1954
|
-
import { join as
|
|
1954
|
+
import { join as join29 } from "path";
|
|
1955
1955
|
import { tmpdir as tmpdir6 } from "os";
|
|
1956
1956
|
import { Command as Command6 } from "commander";
|
|
1957
1957
|
|
|
@@ -3510,7 +3510,7 @@ var SDK_RELEASE = {
|
|
|
3510
3510
|
// getters keep their established compatibility behavior.
|
|
3511
3511
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
3512
3512
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
3513
|
-
version: "0.3.
|
|
3513
|
+
version: "0.3.287",
|
|
3514
3514
|
updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
|
|
3515
3515
|
packageCapabilities: {
|
|
3516
3516
|
updatePreferences: 1
|
|
@@ -3544,6 +3544,11 @@ var SDK_RELEASE = {
|
|
|
3544
3544
|
minimumSupported: "0.1.53",
|
|
3545
3545
|
deprecatedBelow: "0.3.1",
|
|
3546
3546
|
commandIntroducedIn: [
|
|
3547
|
+
{
|
|
3548
|
+
command: "search",
|
|
3549
|
+
introducedIn: "0.3.91",
|
|
3550
|
+
reason: "deepline search was added in SDK CLI 0.3.91 as the one search across tools, monitors, and plays. On an older version run deepline tools search or deepline plays search, or update."
|
|
3551
|
+
},
|
|
3547
3552
|
{
|
|
3548
3553
|
command: "notifications",
|
|
3549
3554
|
introducedIn: "0.2.40",
|
|
@@ -7209,6 +7214,27 @@ function chunkRegisterPlayArtifacts(artifacts) {
|
|
|
7209
7214
|
}
|
|
7210
7215
|
return chunks;
|
|
7211
7216
|
}
|
|
7217
|
+
function searchParams(options) {
|
|
7218
|
+
const params = new URLSearchParams();
|
|
7219
|
+
params.set("q", options.query?.trim() ?? "");
|
|
7220
|
+
params.set(
|
|
7221
|
+
"include_search_debug",
|
|
7222
|
+
options.includeSearchDebug ? "true" : "false"
|
|
7223
|
+
);
|
|
7224
|
+
params.set("search_mode", options.searchMode ?? "v2");
|
|
7225
|
+
if (options.limit !== void 0) params.set("limit", String(options.limit));
|
|
7226
|
+
if (options.offset !== void 0) {
|
|
7227
|
+
params.set("offset", String(options.offset));
|
|
7228
|
+
}
|
|
7229
|
+
if (options.categories?.trim()) {
|
|
7230
|
+
params.set("categories", options.categories.trim());
|
|
7231
|
+
}
|
|
7232
|
+
if (options.searchTerms?.trim()) {
|
|
7233
|
+
params.set("search_terms", options.searchTerms.trim());
|
|
7234
|
+
}
|
|
7235
|
+
if (options.task?.trim()) params.set("task", options.task.trim());
|
|
7236
|
+
return params;
|
|
7237
|
+
}
|
|
7212
7238
|
var RUNS_FAILED_LOG_LIMIT = 20;
|
|
7213
7239
|
var RUN_LOGS_PAGE_LIMIT = 1e3;
|
|
7214
7240
|
function requireTargetBillingIdempotencyKey(value) {
|
|
@@ -7689,33 +7715,30 @@ var DeeplineClient = class _DeeplineClient {
|
|
|
7689
7715
|
* tool metadata, categories, agent guidance, and input schema fields.
|
|
7690
7716
|
*/
|
|
7691
7717
|
async searchTools(options = {}) {
|
|
7692
|
-
const params = new URLSearchParams();
|
|
7693
|
-
const query = options.query?.trim() ?? "";
|
|
7694
|
-
params.set("q", query);
|
|
7695
|
-
params.set(
|
|
7696
|
-
"include_search_debug",
|
|
7697
|
-
options.includeSearchDebug ? "true" : "false"
|
|
7698
|
-
);
|
|
7699
|
-
params.set("search_mode", options.searchMode ?? "v2");
|
|
7700
|
-
if (options.limit !== void 0) {
|
|
7701
|
-
params.set("limit", String(options.limit));
|
|
7702
|
-
}
|
|
7703
|
-
if (options.offset !== void 0) {
|
|
7704
|
-
params.set("offset", String(options.offset));
|
|
7705
|
-
}
|
|
7706
|
-
if (options.categories?.trim()) {
|
|
7707
|
-
params.set("categories", options.categories.trim());
|
|
7708
|
-
}
|
|
7709
|
-
if (options.searchTerms?.trim()) {
|
|
7710
|
-
params.set("search_terms", options.searchTerms.trim());
|
|
7711
|
-
}
|
|
7712
|
-
if (options.task?.trim()) {
|
|
7713
|
-
params.set("task", options.task.trim());
|
|
7714
|
-
}
|
|
7715
7718
|
return this.http.get(
|
|
7716
|
-
`/api/v2/tools/search?${
|
|
7719
|
+
`/api/v2/tools/search?${searchParams(options).toString()}`
|
|
7717
7720
|
);
|
|
7718
7721
|
}
|
|
7722
|
+
/**
|
|
7723
|
+
* Search everything Deepline can run or deploy in one ranked list: tools,
|
|
7724
|
+
* monitor types, prebuilt plays, and your workspace's own plays.
|
|
7725
|
+
*
|
|
7726
|
+
* @example
|
|
7727
|
+
* ```typescript
|
|
7728
|
+
* const { results } = await client.search({
|
|
7729
|
+
* query: 'find work email',
|
|
7730
|
+
* types: ['tools', 'prebuilts'],
|
|
7731
|
+
* });
|
|
7732
|
+
* ```
|
|
7733
|
+
*/
|
|
7734
|
+
async search(options = {}) {
|
|
7735
|
+
const params = searchParams(options);
|
|
7736
|
+
if (options.types?.length) params.set("types", options.types.join(","));
|
|
7737
|
+
if (options.exclude?.length) {
|
|
7738
|
+
params.set("exclude", options.exclude.join(","));
|
|
7739
|
+
}
|
|
7740
|
+
return this.http.get(`/api/v2/search?${params.toString()}`);
|
|
7741
|
+
}
|
|
7719
7742
|
/**
|
|
7720
7743
|
* Get detailed metadata for a single tool.
|
|
7721
7744
|
*
|
|
@@ -22630,12 +22653,12 @@ ${JSON.stringify(value, null, 2)}` : `${key}: ${String(value)}`
|
|
|
22630
22653
|
// src/cli/commands/play.ts
|
|
22631
22654
|
import {
|
|
22632
22655
|
existsSync as existsSync11,
|
|
22633
|
-
mkdirSync as
|
|
22634
|
-
readFileSync as
|
|
22656
|
+
mkdirSync as mkdirSync10,
|
|
22657
|
+
readFileSync as readFileSync14,
|
|
22635
22658
|
readdirSync as readdirSync3,
|
|
22636
22659
|
realpathSync as realpathSync3,
|
|
22637
22660
|
statSync as statSync4,
|
|
22638
|
-
writeFileSync as
|
|
22661
|
+
writeFileSync as writeFileSync15
|
|
22639
22662
|
} from "fs";
|
|
22640
22663
|
import {
|
|
22641
22664
|
lstat,
|
|
@@ -22647,9 +22670,9 @@ import {
|
|
|
22647
22670
|
} from "fs/promises";
|
|
22648
22671
|
import {
|
|
22649
22672
|
basename as basename4,
|
|
22650
|
-
dirname as
|
|
22673
|
+
dirname as dirname12,
|
|
22651
22674
|
isAbsolute as isAbsolute5,
|
|
22652
|
-
join as
|
|
22675
|
+
join as join17,
|
|
22653
22676
|
relative as relative5,
|
|
22654
22677
|
resolve as resolve15
|
|
22655
22678
|
} from "path";
|
|
@@ -27715,24 +27738,198 @@ function formatRunHitCountLines(tables) {
|
|
|
27715
27738
|
return lines;
|
|
27716
27739
|
}
|
|
27717
27740
|
|
|
27741
|
+
// src/cli/search-ref.ts
|
|
27742
|
+
import { mkdirSync as mkdirSync9, readFileSync as readFileSync12, writeFileSync as writeFileSync12 } from "fs";
|
|
27743
|
+
import { dirname as dirname8, join as join9 } from "path";
|
|
27744
|
+
var SEARCH_REF_TTL_MS = 15 * 6e4;
|
|
27745
|
+
function lastSearchPath() {
|
|
27746
|
+
return join9(sdkCliStateDirPath(resolveConfig().baseUrl), "last-search.json");
|
|
27747
|
+
}
|
|
27748
|
+
function rememberSearchRef(searchRef) {
|
|
27749
|
+
try {
|
|
27750
|
+
mkdirSync9(dirname8(lastSearchPath()), { recursive: true });
|
|
27751
|
+
writeFileSync12(
|
|
27752
|
+
lastSearchPath(),
|
|
27753
|
+
JSON.stringify({ searchRef, at: Date.now() }),
|
|
27754
|
+
{ mode: 384 }
|
|
27755
|
+
);
|
|
27756
|
+
} catch {
|
|
27757
|
+
}
|
|
27758
|
+
}
|
|
27759
|
+
function recentSearchRef() {
|
|
27760
|
+
try {
|
|
27761
|
+
const saved = JSON.parse(readFileSync12(lastSearchPath(), "utf8"));
|
|
27762
|
+
return typeof saved.searchRef === "string" && typeof saved.at === "number" && Date.now() - saved.at < SEARCH_REF_TTL_MS ? saved.searchRef : void 0;
|
|
27763
|
+
} catch {
|
|
27764
|
+
return void 0;
|
|
27765
|
+
}
|
|
27766
|
+
}
|
|
27767
|
+
|
|
27768
|
+
// src/cli/commands/search.ts
|
|
27769
|
+
var SEARCH_TYPES = [
|
|
27770
|
+
"tools",
|
|
27771
|
+
"plays",
|
|
27772
|
+
"monitors",
|
|
27773
|
+
"prebuilts",
|
|
27774
|
+
"custom"
|
|
27775
|
+
];
|
|
27776
|
+
var USAGE = "Usage: deepline search [query] [--type <types>] [--categories <categories>] [--search_terms <terms>] [--json]";
|
|
27777
|
+
function parseTypes(flag, raw) {
|
|
27778
|
+
const names = (raw ?? "").split(",").map((name) => name.trim().toLowerCase()).filter(Boolean);
|
|
27779
|
+
const unknown = names.filter(
|
|
27780
|
+
(name) => !SEARCH_TYPES.includes(name)
|
|
27781
|
+
);
|
|
27782
|
+
if (unknown.length > 0) {
|
|
27783
|
+
throw new Error(
|
|
27784
|
+
`Unknown ${flag} ${unknown.join(", ")}. Use any of: ${SEARCH_TYPES.join(", ")}.`
|
|
27785
|
+
);
|
|
27786
|
+
}
|
|
27787
|
+
return names;
|
|
27788
|
+
}
|
|
27789
|
+
function optionalInteger(raw) {
|
|
27790
|
+
return raw === void 0 ? void 0 : Number.parseInt(raw, 10);
|
|
27791
|
+
}
|
|
27792
|
+
function appendCsv(value, previous) {
|
|
27793
|
+
return previous ? `${previous},${value}` : value;
|
|
27794
|
+
}
|
|
27795
|
+
function addSearchOptions(command) {
|
|
27796
|
+
return command.option(
|
|
27797
|
+
"--categories <categories>",
|
|
27798
|
+
"Comma-separated tool categories; may be used without a query"
|
|
27799
|
+
).option(
|
|
27800
|
+
"--search_terms <terms>",
|
|
27801
|
+
"Comma-separated structured search terms; may be used without a query"
|
|
27802
|
+
).option("--search-terms <terms>", "Alias for --search_terms").option(
|
|
27803
|
+
"--task <sentence>",
|
|
27804
|
+
"What you are trying to accomplish: input you have -> result you need"
|
|
27805
|
+
).option("--limit <count>", "Maximum ranked results to return (1-50)").option("--offset <count>", "Zero-based ranked result offset").option("--search-mode <mode>", "Ranked search mode: v1 or v2").option("--include-search-debug", "Include ranked search debug metadata").option("--json", "Emit JSON output instead of the readable default");
|
|
27806
|
+
}
|
|
27807
|
+
async function runSearch(queryInput, options, types, exclude = []) {
|
|
27808
|
+
const query = queryInput?.trim() ?? "";
|
|
27809
|
+
const searchTerms = options.searchTerms ?? options.search_terms;
|
|
27810
|
+
if (!query && !options.categories?.trim() && !searchTerms?.trim()) {
|
|
27811
|
+
console.error(USAGE);
|
|
27812
|
+
return 1;
|
|
27813
|
+
}
|
|
27814
|
+
const { search_ref: searchRef, ...result } = await new DeeplineClient().search({
|
|
27815
|
+
query,
|
|
27816
|
+
types,
|
|
27817
|
+
exclude,
|
|
27818
|
+
categories: options.categories,
|
|
27819
|
+
searchTerms,
|
|
27820
|
+
task: options.task,
|
|
27821
|
+
limit: optionalInteger(options.limit),
|
|
27822
|
+
offset: optionalInteger(options.offset),
|
|
27823
|
+
searchMode: options.searchMode === "v1" || options.searchMode === "v2" ? options.searchMode : void 0,
|
|
27824
|
+
includeSearchDebug: Boolean(options.includeSearchDebug)
|
|
27825
|
+
});
|
|
27826
|
+
if (searchRef) rememberSearchRef(searchRef);
|
|
27827
|
+
printCommandEnvelope(result, {
|
|
27828
|
+
json: options.json === true
|
|
27829
|
+
});
|
|
27830
|
+
return 0;
|
|
27831
|
+
}
|
|
27832
|
+
function registerDeprecatedSearchCommand(parent, typesFor) {
|
|
27833
|
+
const name = `deepline ${parent.name()} search`;
|
|
27834
|
+
addSearchOptions(
|
|
27835
|
+
parent.command("search [query]").description(`Deprecated. Use deepline search --type <types>.`).addHelpText(
|
|
27836
|
+
"after",
|
|
27837
|
+
`
|
|
27838
|
+
Notes:
|
|
27839
|
+
Deprecated alias for the unified search. It runs deepline search with the
|
|
27840
|
+
matching --type and returns the same results envelope.
|
|
27841
|
+
|
|
27842
|
+
Examples:
|
|
27843
|
+
deepline search email --type ${typesFor({}).join(",")}
|
|
27844
|
+
`
|
|
27845
|
+
).option("--all", "Include plays your workspace created").option("--compact", "Accepted for compatibility; results are compact")
|
|
27846
|
+
).action(async (query, options) => {
|
|
27847
|
+
const types = typesFor(options);
|
|
27848
|
+
console.error(
|
|
27849
|
+
`${name} is deprecated. Use: deepline search${query ? ` ${JSON.stringify(query)}` : ""} --type ${types.join(",")}`
|
|
27850
|
+
);
|
|
27851
|
+
process.exitCode = await runSearch(query, options, types);
|
|
27852
|
+
});
|
|
27853
|
+
}
|
|
27854
|
+
function registerSearchCommand(program) {
|
|
27855
|
+
addSearchOptions(
|
|
27856
|
+
program.command("search [query]").description(
|
|
27857
|
+
"Search tools, monitors, and plays together, ranked by intent."
|
|
27858
|
+
).addHelpText(
|
|
27859
|
+
"after",
|
|
27860
|
+
`
|
|
27861
|
+
Notes:
|
|
27862
|
+
One ranked search across everything Deepline can run, deploy, or explain.
|
|
27863
|
+
Every result carries a kind: tool, monitor_type, prebuilt_play, custom_play
|
|
27864
|
+
(a play your workspace created), or doc. Narrow with --type, a
|
|
27865
|
+
comma-separated list of:
|
|
27866
|
+
tools atomic provider operations (deepline tools execute)
|
|
27867
|
+
monitors monitor types you can deploy
|
|
27868
|
+
prebuilts Deepline-maintained plays
|
|
27869
|
+
custom plays your workspace created
|
|
27870
|
+
plays prebuilts and custom together
|
|
27871
|
+
--exclude takes the same names and leaves those kinds out instead.
|
|
27872
|
+
Ranking uses a third-party AI relevance model. For plays your workspace
|
|
27873
|
+
created it is sent only the play name and description, never play code.
|
|
27874
|
+
Both flags may be repeated: --type tools --type prebuilts.
|
|
27875
|
+
Provide a query, or omit it only when --categories and/or --search_terms is
|
|
27876
|
+
supplied. Use --limit and --offset to page (limit 1-50, offset zero-based);
|
|
27877
|
+
JSON includes next_offset. Pass --task with one sentence on what you are
|
|
27878
|
+
trying to accomplish: the input you have and the result you need. It
|
|
27879
|
+
materially improves ranking, especially for short queries.
|
|
27880
|
+
Search prints a readable result list by default, piped or not, and that is
|
|
27881
|
+
the recommended form. Pass --json only when a program parses the result.
|
|
27882
|
+
|
|
27883
|
+
Examples:
|
|
27884
|
+
deepline search "find work email"
|
|
27885
|
+
deepline search "find work email" --type tools --limit 10
|
|
27886
|
+
deepline search "company to contacts" --type plays
|
|
27887
|
+
deepline search "enrich a company" --exclude monitors,custom
|
|
27888
|
+
deepline search linkedin --task "I have 200 LinkedIn profile URLs and need each person's current title and company"
|
|
27889
|
+
deepline search --type tools --categories company_search --search_terms "investors,funding"
|
|
27890
|
+
`
|
|
27891
|
+
).option(
|
|
27892
|
+
"--type <types>",
|
|
27893
|
+
`Kinds to search, comma-separated or repeated: ${SEARCH_TYPES.join(", ")}`,
|
|
27894
|
+
appendCsv
|
|
27895
|
+
).option(
|
|
27896
|
+
"--exclude <types>",
|
|
27897
|
+
"Kinds to leave out, comma-separated or repeated; the opposite of --type",
|
|
27898
|
+
appendCsv
|
|
27899
|
+
)
|
|
27900
|
+
).action(async (query, options) => {
|
|
27901
|
+
let types;
|
|
27902
|
+
let exclude;
|
|
27903
|
+
try {
|
|
27904
|
+
types = parseTypes("--type", options.type);
|
|
27905
|
+
exclude = parseTypes("--exclude", options.exclude);
|
|
27906
|
+
} catch (error) {
|
|
27907
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
27908
|
+
process.exitCode = 1;
|
|
27909
|
+
return;
|
|
27910
|
+
}
|
|
27911
|
+
process.exitCode = await runSearch(query, options, types, exclude);
|
|
27912
|
+
});
|
|
27913
|
+
}
|
|
27914
|
+
|
|
27718
27915
|
// src/plays/bundle-play-file.ts
|
|
27719
27916
|
import { tmpdir as tmpdir3 } from "os";
|
|
27720
|
-
import { dirname as
|
|
27917
|
+
import { dirname as dirname11, join as join12, resolve as resolve11 } from "path";
|
|
27721
27918
|
import { fileURLToPath } from "url";
|
|
27722
27919
|
import { existsSync as existsSync10 } from "fs";
|
|
27723
27920
|
import { realpath as realpath2 } from "fs/promises";
|
|
27724
27921
|
|
|
27725
27922
|
// ../plays/bundling/index.ts
|
|
27726
27923
|
import { createHash as createHash3 } from "crypto";
|
|
27727
|
-
import { existsSync as existsSync9, readFileSync as
|
|
27924
|
+
import { existsSync as existsSync9, readFileSync as readFileSync13 } from "fs";
|
|
27728
27925
|
import { mkdir as mkdir3, readFile as readFile2, realpath, stat, writeFile as writeFile4 } from "fs/promises";
|
|
27729
27926
|
import { tmpdir as tmpdir2 } from "os";
|
|
27730
27927
|
import {
|
|
27731
27928
|
basename as basename2,
|
|
27732
|
-
dirname as
|
|
27929
|
+
dirname as dirname9,
|
|
27733
27930
|
extname,
|
|
27734
27931
|
isAbsolute as isAbsolute3,
|
|
27735
|
-
join as
|
|
27932
|
+
join as join10,
|
|
27736
27933
|
relative as relative2,
|
|
27737
27934
|
resolve as resolve9,
|
|
27738
27935
|
sep
|
|
@@ -29604,7 +29801,7 @@ var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
|
|
|
29604
29801
|
|
|
29605
29802
|
// ../plays/bundling/index.ts
|
|
29606
29803
|
var PLAY_BUNDLE_CACHE_NAMESPACE = "deepline-play-artifacts-docflow-jsdoc";
|
|
29607
|
-
var PLAY_ARTIFACT_CACHE_DIR =
|
|
29804
|
+
var PLAY_ARTIFACT_CACHE_DIR = join10(tmpdir2(), PLAY_BUNDLE_CACHE_NAMESPACE);
|
|
29608
29805
|
var SOURCE_EXTENSIONS = [
|
|
29609
29806
|
".ts",
|
|
29610
29807
|
".tsx",
|
|
@@ -30223,10 +30420,10 @@ import { createHash as createHash4 } from "crypto";
|
|
|
30223
30420
|
import { readFile as readFile3, stat as stat2 } from "fs/promises";
|
|
30224
30421
|
import {
|
|
30225
30422
|
basename as basename3,
|
|
30226
|
-
dirname as
|
|
30423
|
+
dirname as dirname10,
|
|
30227
30424
|
extname as extname2,
|
|
30228
30425
|
isAbsolute as isAbsolute4,
|
|
30229
|
-
join as
|
|
30426
|
+
join as join11,
|
|
30230
30427
|
relative as relative3,
|
|
30231
30428
|
resolve as resolve10
|
|
30232
30429
|
} from "path";
|
|
@@ -30248,7 +30445,7 @@ var EXPLICIT_IMPORT_EXTENSIONS2 = /* @__PURE__ */ new Set([
|
|
|
30248
30445
|
]);
|
|
30249
30446
|
|
|
30250
30447
|
// src/plays/bundle-play-file.ts
|
|
30251
|
-
var MODULE_DIR =
|
|
30448
|
+
var MODULE_DIR = dirname11(fileURLToPath(import.meta.url));
|
|
30252
30449
|
var SDK_PACKAGE_ROOT = resolve11(MODULE_DIR, "..", "..");
|
|
30253
30450
|
var SOURCE_REPO_ROOT = resolve11(SDK_PACKAGE_ROOT, "..", "..");
|
|
30254
30451
|
var HAS_SOURCE_BUNDLING_SOURCES = existsSync10(
|
|
@@ -30275,7 +30472,7 @@ var SDK_ENTRY_FILE = resolve11(SDK_SOURCE_ROOT, "index.ts");
|
|
|
30275
30472
|
var SDK_TYPES_ENTRY_FILE = HAS_SOURCE_BUNDLING_SOURCES ? SDK_ENTRY_FILE : resolve11(SDK_PACKAGE_ROOT, "dist", "index.d.ts");
|
|
30276
30473
|
|
|
30277
30474
|
// src/cli/run-dataset-csv.ts
|
|
30278
|
-
import { writeFileSync as
|
|
30475
|
+
import { writeFileSync as writeFileSync13 } from "fs";
|
|
30279
30476
|
import { resolve as resolve12 } from "path";
|
|
30280
30477
|
|
|
30281
30478
|
// ../plays/table-csv.ts
|
|
@@ -30384,7 +30581,7 @@ var RunDatasetCsv = class _RunDatasetCsv {
|
|
|
30384
30581
|
write(outPath) {
|
|
30385
30582
|
const absolutePath = resolve12(outPath);
|
|
30386
30583
|
const { rows, columns } = this.#projection;
|
|
30387
|
-
|
|
30584
|
+
writeFileSync13(
|
|
30388
30585
|
absolutePath,
|
|
30389
30586
|
tableCsvText(
|
|
30390
30587
|
columns,
|
|
@@ -31023,7 +31220,7 @@ function extractCanonicalRowsInfo(statusOrResult) {
|
|
|
31023
31220
|
}
|
|
31024
31221
|
|
|
31025
31222
|
// src/cli/run-dataset-selection.ts
|
|
31026
|
-
import { writeFileSync as
|
|
31223
|
+
import { writeFileSync as writeFileSync14 } from "fs";
|
|
31027
31224
|
import { resolve as resolve13 } from "path";
|
|
31028
31225
|
var Run = class _Run {
|
|
31029
31226
|
#datasets;
|
|
@@ -31151,7 +31348,7 @@ var RunDataset = class _RunDataset {
|
|
|
31151
31348
|
}
|
|
31152
31349
|
if (options.format === "json") {
|
|
31153
31350
|
const absolutePath = resolve13(outPath);
|
|
31154
|
-
|
|
31351
|
+
writeFileSync14(
|
|
31155
31352
|
absolutePath,
|
|
31156
31353
|
`${JSON.stringify(orderRunExportJson(this.rows), null, 2)}
|
|
31157
31354
|
`,
|
|
@@ -32115,10 +32312,10 @@ function normalizeFixtureScopeValue(value, maxLength) {
|
|
|
32115
32312
|
import { randomUUID as randomUUID6 } from "crypto";
|
|
32116
32313
|
import { mkdtemp as mkdtemp2, realpath as realpath3, rm as rm2 } from "fs/promises";
|
|
32117
32314
|
import { tmpdir as tmpdir4 } from "os";
|
|
32118
|
-
import { join as
|
|
32315
|
+
import { join as join16, resolve as resolve14 } from "path";
|
|
32119
32316
|
|
|
32120
32317
|
// ../plays/deploy/run-deployment.ts
|
|
32121
|
-
import { join as
|
|
32318
|
+
import { join as join15 } from "path";
|
|
32122
32319
|
import { mkdir as mkdir4, mkdtemp, rm } from "fs/promises";
|
|
32123
32320
|
|
|
32124
32321
|
// ../plays/deployment-status.ts
|
|
@@ -32292,7 +32489,7 @@ var DeployApiClient = class {
|
|
|
32292
32489
|
// ../plays/deploy/manifest.ts
|
|
32293
32490
|
var import_picomatch = __toESM(require_picomatch2(), 1);
|
|
32294
32491
|
import { readdir, readFile as readFile4, stat as stat3 } from "fs/promises";
|
|
32295
|
-
import { join as
|
|
32492
|
+
import { join as join13, relative as relative4 } from "path";
|
|
32296
32493
|
var DEFAULT_PLAY_GLOBS = ["**/*.play.ts"];
|
|
32297
32494
|
var DEFAULT_MONITOR_GLOBS = ["**/*.monitor.json"];
|
|
32298
32495
|
var MAX_DISCOVERED_FILES = 200;
|
|
@@ -32355,7 +32552,7 @@ var DEFAULT_MANIFEST_FILE = "deepline.json";
|
|
|
32355
32552
|
async function readDeeplineManifest(projectRoot, manifestFile = DEFAULT_MANIFEST_FILE) {
|
|
32356
32553
|
let raw = null;
|
|
32357
32554
|
try {
|
|
32358
|
-
raw = await readFile4(
|
|
32555
|
+
raw = await readFile4(join13(projectRoot, manifestFile), "utf8");
|
|
32359
32556
|
} catch (error) {
|
|
32360
32557
|
const code = error.code;
|
|
32361
32558
|
if (code !== "ENOENT" && code !== "ENOTDIR") {
|
|
@@ -32386,7 +32583,7 @@ async function discoverDeploymentFiles(input2) {
|
|
|
32386
32583
|
const entries = await readdir(dir, { withFileTypes: true });
|
|
32387
32584
|
for (const entry of entries) {
|
|
32388
32585
|
if (entry.name.startsWith(".") && entry.name !== ".") continue;
|
|
32389
|
-
const absolute =
|
|
32586
|
+
const absolute = join13(dir, entry.name);
|
|
32390
32587
|
if (entry.isDirectory()) {
|
|
32391
32588
|
if (IGNORED_DIRECTORIES.has(entry.name)) continue;
|
|
32392
32589
|
await walk(absolute);
|
|
@@ -32417,7 +32614,7 @@ var discoverPlayFiles = discoverDeploymentFiles;
|
|
|
32417
32614
|
|
|
32418
32615
|
// ../plays/deploy/monitor-files.ts
|
|
32419
32616
|
import { readFile as readFile5 } from "fs/promises";
|
|
32420
|
-
import { join as
|
|
32617
|
+
import { join as join14 } from "path";
|
|
32421
32618
|
async function readMonitorFiles(input2) {
|
|
32422
32619
|
const files = await discoverDeploymentFiles(input2);
|
|
32423
32620
|
if (files.length > 100) {
|
|
@@ -32428,7 +32625,7 @@ async function readMonitorFiles(input2) {
|
|
|
32428
32625
|
return Promise.all(
|
|
32429
32626
|
files.map(async (file) => {
|
|
32430
32627
|
const sourcePath = input2.rootDirectory ? `${input2.rootDirectory}/${file}` : file;
|
|
32431
|
-
const raw = await readFile5(
|
|
32628
|
+
const raw = await readFile5(join14(input2.projectRoot, file), "utf8");
|
|
32432
32629
|
try {
|
|
32433
32630
|
return { file: sourcePath, definition: JSON.parse(raw) };
|
|
32434
32631
|
} catch {
|
|
@@ -32721,7 +32918,7 @@ async function runDeployment(params, hooks) {
|
|
|
32721
32918
|
};
|
|
32722
32919
|
};
|
|
32723
32920
|
await mkdir4(hooks.workRoot, { recursive: true });
|
|
32724
|
-
const workDir = await mkdtemp(
|
|
32921
|
+
const workDir = await mkdtemp(join15(hooks.workRoot, "deploy-"));
|
|
32725
32922
|
const postCheck = async (postCheckOnce, input2) => {
|
|
32726
32923
|
let lastError;
|
|
32727
32924
|
for (let attempt = 0; ; attempt += 1) {
|
|
@@ -32847,7 +33044,7 @@ async function runDeployment(params, hooks) {
|
|
|
32847
33044
|
if (superseded) return superseded;
|
|
32848
33045
|
}
|
|
32849
33046
|
const { repoRoot } = await source.open(workDir);
|
|
32850
|
-
const projectRoot = target.rootDirectory ?
|
|
33047
|
+
const projectRoot = target.rootDirectory ? join15(repoRoot, target.rootDirectory) : repoRoot;
|
|
32851
33048
|
const manifestFile = target.manifestPath || DEFAULT_MANIFEST_FILE;
|
|
32852
33049
|
let manifest;
|
|
32853
33050
|
let playFiles;
|
|
@@ -32941,7 +33138,7 @@ async function runDeployment(params, hooks) {
|
|
|
32941
33138
|
annotations.push(annotationForFailure({ file, message }));
|
|
32942
33139
|
};
|
|
32943
33140
|
for (const file of playFiles) {
|
|
32944
|
-
const entryFile =
|
|
33141
|
+
const entryFile = join15(projectRoot, file);
|
|
32945
33142
|
const result = await hooks.bundle(entryFile, {
|
|
32946
33143
|
sourceIdentityRoot: projectRoot
|
|
32947
33144
|
});
|
|
@@ -33441,7 +33638,7 @@ async function handlePlaysDeploy(directory, options) {
|
|
|
33441
33638
|
...options.commit ? { commit: options.commit } : {}
|
|
33442
33639
|
});
|
|
33443
33640
|
const { bundleDeployPlayFile } = await loadPlayBundler();
|
|
33444
|
-
const workRoot = await mkdtemp2(
|
|
33641
|
+
const workRoot = await mkdtemp2(join16(tmpdir4(), "deepline-deploy-"));
|
|
33445
33642
|
const consoleInfo = console.info;
|
|
33446
33643
|
console.info = console.error;
|
|
33447
33644
|
try {
|
|
@@ -34077,8 +34274,8 @@ async function pathExistsIncludingSymlink(path) {
|
|
|
34077
34274
|
}
|
|
34078
34275
|
}
|
|
34079
34276
|
function runIdFileTempPath(destination) {
|
|
34080
|
-
return
|
|
34081
|
-
|
|
34277
|
+
return join17(
|
|
34278
|
+
dirname12(destination),
|
|
34082
34279
|
`.${basename4(destination)}.${process.pid}.${randomUUID7()}.tmp`
|
|
34083
34280
|
);
|
|
34084
34281
|
}
|
|
@@ -34172,7 +34369,7 @@ async function writePlayRunIdFile(destination, runId, options = {}) {
|
|
|
34172
34369
|
}
|
|
34173
34370
|
}
|
|
34174
34371
|
if (process.platform !== "win32") {
|
|
34175
|
-
const directory = await open(
|
|
34372
|
+
const directory = await open(dirname12(destination), "r");
|
|
34176
34373
|
try {
|
|
34177
34374
|
await directory.sync();
|
|
34178
34375
|
} finally {
|
|
@@ -34369,7 +34566,7 @@ function buildPlayReferenceNotFoundMessage(input2) {
|
|
|
34369
34566
|
lines.push(
|
|
34370
34567
|
"",
|
|
34371
34568
|
"Search visible plays:",
|
|
34372
|
-
` deepline plays
|
|
34569
|
+
` deepline search --type plays ${shellQuote4(searchQuery)} --json`
|
|
34373
34570
|
);
|
|
34374
34571
|
}
|
|
34375
34572
|
return lines.join("\n");
|
|
@@ -34505,12 +34702,12 @@ function materializeRemotePlaySource(input2) {
|
|
|
34505
34702
|
`Refusing to materialize unsafe Play source path ${JSON.stringify(logicalPath)}.`
|
|
34506
34703
|
);
|
|
34507
34704
|
}
|
|
34508
|
-
|
|
34705
|
+
mkdirSync10(dirname12(outputPath2), { recursive: true });
|
|
34509
34706
|
if (!existsSync11(outputPath2)) {
|
|
34510
|
-
|
|
34707
|
+
writeFileSync15(outputPath2, sourceCode, "utf-8");
|
|
34511
34708
|
created += 1;
|
|
34512
|
-
} else if (
|
|
34513
|
-
|
|
34709
|
+
} else if (readFileSync14(outputPath2, "utf-8") !== sourceCode) {
|
|
34710
|
+
writeFileSync15(outputPath2, sourceCode, "utf-8");
|
|
34514
34711
|
updated += 1;
|
|
34515
34712
|
}
|
|
34516
34713
|
}
|
|
@@ -34523,14 +34720,14 @@ function materializeRemotePlaySource(input2) {
|
|
|
34523
34720
|
}
|
|
34524
34721
|
const outputPath = input2.outPath ?? defaultMaterializedPlayPath(input2.playName);
|
|
34525
34722
|
if (existsSync11(outputPath)) {
|
|
34526
|
-
const existingSource =
|
|
34723
|
+
const existingSource = readFileSync14(outputPath, "utf-8");
|
|
34527
34724
|
if (existingSource === entrySource) {
|
|
34528
34725
|
return { path: outputPath, status: "unchanged", created: false };
|
|
34529
34726
|
}
|
|
34530
|
-
|
|
34727
|
+
writeFileSync15(outputPath, entrySource, "utf-8");
|
|
34531
34728
|
return { path: outputPath, status: "updated", created: false };
|
|
34532
34729
|
}
|
|
34533
|
-
|
|
34730
|
+
writeFileSync15(outputPath, entrySource, "utf-8");
|
|
34534
34731
|
return { path: outputPath, status: "created", created: true };
|
|
34535
34732
|
}
|
|
34536
34733
|
function formatLoadedPlayMessage(materializedFile) {
|
|
@@ -34604,7 +34801,7 @@ function parsePositiveInteger3(value, flagName) {
|
|
|
34604
34801
|
return parsed;
|
|
34605
34802
|
}
|
|
34606
34803
|
function parseJsonInput(raw, flag = "--input") {
|
|
34607
|
-
const source = raw.startsWith("@") ?
|
|
34804
|
+
const source = raw.startsWith("@") ? readFileSync14(resolve15(raw.slice(1)), "utf-8") : raw;
|
|
34608
34805
|
let parsed;
|
|
34609
34806
|
try {
|
|
34610
34807
|
parsed = JSON.parse(source);
|
|
@@ -34780,7 +34977,7 @@ function preflightLocalFileInputs(runtimeInput) {
|
|
|
34780
34977
|
function preflightCsvDataInput(ref, absolutePath) {
|
|
34781
34978
|
let content;
|
|
34782
34979
|
try {
|
|
34783
|
-
content =
|
|
34980
|
+
content = readFileSync14(absolutePath, "utf-8");
|
|
34784
34981
|
} catch (error) {
|
|
34785
34982
|
throw new DeeplineError(
|
|
34786
34983
|
`Input ${ref.inputPath} CSV ${ref.value} is not readable: ${error instanceof Error ? error.message : String(error)}. No run was created.`,
|
|
@@ -34811,7 +35008,7 @@ async function stageFileInputArgs(input2) {
|
|
|
34811
35008
|
const absolutePath = resolve15(value);
|
|
34812
35009
|
return {
|
|
34813
35010
|
logicalPath: basename4(absolutePath),
|
|
34814
|
-
read: async () =>
|
|
35011
|
+
read: async () => readFileSync14(absolutePath)
|
|
34815
35012
|
};
|
|
34816
35013
|
},
|
|
34817
35014
|
onStaging: (fileCount) => input2.progress.phase(
|
|
@@ -34820,7 +35017,7 @@ async function stageFileInputArgs(input2) {
|
|
|
34820
35017
|
});
|
|
34821
35018
|
}
|
|
34822
35019
|
function stageFile(logicalPath, absolutePath) {
|
|
34823
|
-
const buffer =
|
|
35020
|
+
const buffer = readFileSync14(absolutePath);
|
|
34824
35021
|
return {
|
|
34825
35022
|
logicalPath,
|
|
34826
35023
|
contentBase64: buffer.toString("base64"),
|
|
@@ -39311,7 +39508,7 @@ async function handlePlayCheck(args) {
|
|
|
39311
39508
|
}
|
|
39312
39509
|
}
|
|
39313
39510
|
const absolutePlayPath = resolve15(options.target);
|
|
39314
|
-
const sourceCode =
|
|
39511
|
+
const sourceCode = readFileSync14(absolutePlayPath, "utf-8");
|
|
39315
39512
|
const exportNames = resolvePlayCheckExportNames(sourceCode);
|
|
39316
39513
|
const outcomes = [];
|
|
39317
39514
|
for (const exportName of exportNames) {
|
|
@@ -39440,7 +39637,7 @@ async function handleFileBackedRun(options, hooks) {
|
|
|
39440
39637
|
const sourceCode = traceCliSync(
|
|
39441
39638
|
"cli.play_file_read_source",
|
|
39442
39639
|
{ targetKind: "file" },
|
|
39443
|
-
() =>
|
|
39640
|
+
() => readFileSync14(absolutePlayPath, "utf-8")
|
|
39444
39641
|
);
|
|
39445
39642
|
const runtimeInput = options.input ? { ...options.input } : {};
|
|
39446
39643
|
try {
|
|
@@ -39859,7 +40056,7 @@ async function handlePlayRun(args, hooks) {
|
|
|
39859
40056
|
}
|
|
39860
40057
|
const resolved = resolve15(options.target.path);
|
|
39861
40058
|
console.error(`File not found: ${resolved}`);
|
|
39862
|
-
const dir =
|
|
40059
|
+
const dir = dirname12(resolved);
|
|
39863
40060
|
if (existsSync11(dir)) {
|
|
39864
40061
|
const base = basename4(resolved);
|
|
39865
40062
|
try {
|
|
@@ -39869,7 +40066,7 @@ async function handlePlayRun(args, hooks) {
|
|
|
39869
40066
|
if (siblings.length > 0) {
|
|
39870
40067
|
console.error(`Did you mean one of these?`);
|
|
39871
40068
|
for (const s of siblings.slice(0, 5)) {
|
|
39872
|
-
console.error(` ${
|
|
40069
|
+
console.error(` ${join17(dir, s)}`);
|
|
39873
40070
|
}
|
|
39874
40071
|
}
|
|
39875
40072
|
} catch {
|
|
@@ -40674,7 +40871,7 @@ async function handleRunLogs(args) {
|
|
|
40674
40871
|
if (outPath) {
|
|
40675
40872
|
const result2 = await client2.runs.logs(runId, { all: true });
|
|
40676
40873
|
const logs = result2.entries.filter((line) => logLevelReaches(classifyLogLine(line).level, logLevel)).map((line) => classifyLogLine(line).line);
|
|
40677
|
-
|
|
40874
|
+
writeFileSync15(outPath, `${logs.join("\n")}${logs.length > 0 ? "\n" : ""}`);
|
|
40678
40875
|
printCommandEnvelope(
|
|
40679
40876
|
{
|
|
40680
40877
|
runId: result2.runId,
|
|
@@ -41301,7 +41498,7 @@ async function handleRunExport(args) {
|
|
|
41301
41498
|
payload.actions
|
|
41302
41499
|
);
|
|
41303
41500
|
if (metadataOutPath) {
|
|
41304
|
-
|
|
41501
|
+
writeFileSync15(
|
|
41305
41502
|
metadataOutPath,
|
|
41306
41503
|
`${JSON.stringify(payload, null, 2)}
|
|
41307
41504
|
`,
|
|
@@ -41373,7 +41570,7 @@ async function handlePlayGet(args) {
|
|
|
41373
41570
|
);
|
|
41374
41571
|
return 2;
|
|
41375
41572
|
}
|
|
41376
|
-
const playName = isFileTarget(target) ? extractPlayName(
|
|
41573
|
+
const playName = isFileTarget(target) ? extractPlayName(readFileSync14(resolve15(target), "utf-8"), resolve15(target)) : parseReferencedPlayTarget2(target).playName;
|
|
41377
41574
|
const includeSource = sourceOutput || outPath !== null;
|
|
41378
41575
|
const detail = isFileTarget(target) ? await client2.getPlay(
|
|
41379
41576
|
playName,
|
|
@@ -41664,23 +41861,6 @@ async function handlePlayPin(args, pinned) {
|
|
|
41664
41861
|
else console.log(`${result.pinned ? "Pinned" : "Unpinned"} ${result.name}.`);
|
|
41665
41862
|
return 0;
|
|
41666
41863
|
}
|
|
41667
|
-
function parsePlaySearchOptions(args) {
|
|
41668
|
-
const query = args[0]?.trim();
|
|
41669
|
-
if (!query) {
|
|
41670
|
-
throw new Error(
|
|
41671
|
-
"Usage: deepline plays search <query> [--all] [--compact] [--json]"
|
|
41672
|
-
);
|
|
41673
|
-
}
|
|
41674
|
-
return {
|
|
41675
|
-
query,
|
|
41676
|
-
jsonOutput: argsWantJson(args),
|
|
41677
|
-
compact: args.includes("--compact"),
|
|
41678
|
-
scope: args.includes("--all") && !args.includes("--prebuilt") ? "all" : "prebuilt"
|
|
41679
|
-
};
|
|
41680
|
-
}
|
|
41681
|
-
function playSearchDisclaimer(scope) {
|
|
41682
|
-
return scope === "all" ? "Prebuilt-first search: Deepline-managed prebuilts are trusted, robust plays with maintained contracts, so they are listed before plays you created. Use created-play results only when you are specifically looking for one." : "Prebuilt-first search: Deepline-managed prebuilts are trusted, robust plays with maintained contracts. Plays you created are omitted by default; add --all only when you are specifically looking for one.";
|
|
41683
|
-
}
|
|
41684
41864
|
function csvColumnLines(csvInput) {
|
|
41685
41865
|
const rowSchema = isRecord7(csvInput.rowInputSchema) ? csvInput.rowInputSchema : {};
|
|
41686
41866
|
const columns = isRecord7(rowSchema.properties) ? Object.keys(rowSchema.properties) : [];
|
|
@@ -41779,45 +41959,6 @@ function printPlayDescription(play) {
|
|
|
41779
41959
|
console.log(` Check starter: ${cloneEditStarter.checkCommand}`);
|
|
41780
41960
|
}
|
|
41781
41961
|
}
|
|
41782
|
-
function inputFieldNames(schema) {
|
|
41783
|
-
const fields2 = Array.isArray(schema?.fields) ? schema.fields : [];
|
|
41784
|
-
return fields2.map(
|
|
41785
|
-
(field) => field && typeof field === "object" ? String(field.name ?? "").trim() : ""
|
|
41786
|
-
).filter(Boolean);
|
|
41787
|
-
}
|
|
41788
|
-
function printCompactPlaySearchResult(play) {
|
|
41789
|
-
const reference = formatPlayListReference(play);
|
|
41790
|
-
const aliases = play.aliases.slice(0, 6).join(", ");
|
|
41791
|
-
console.log(`Play: ${reference}`);
|
|
41792
|
-
if (play.displayName && play.displayName !== play.name) {
|
|
41793
|
-
console.log(` Display name: ${play.displayName}`);
|
|
41794
|
-
}
|
|
41795
|
-
if (play.description) {
|
|
41796
|
-
console.log(` Description: ${play.description}`);
|
|
41797
|
-
}
|
|
41798
|
-
if (aliases) {
|
|
41799
|
-
console.log(` Aliases: ${aliases}`);
|
|
41800
|
-
}
|
|
41801
|
-
const fields2 = inputFieldNames(play.inputSchema);
|
|
41802
|
-
if (fields2.length > 0) {
|
|
41803
|
-
console.log(` Inputs: ${fields2.join(", ")}`);
|
|
41804
|
-
} else if (play.inputSchema) {
|
|
41805
|
-
console.log(" Inputs: see describe");
|
|
41806
|
-
}
|
|
41807
|
-
console.log(` Describe: deepline plays describe ${reference} --json`);
|
|
41808
|
-
console.log(` Run: ${play.runCommand}`);
|
|
41809
|
-
}
|
|
41810
|
-
function compactPlaySchema(schema) {
|
|
41811
|
-
if (!schema) return null;
|
|
41812
|
-
const fields2 = Array.isArray(schema.fields) ? schema.fields.map(
|
|
41813
|
-
(field) => field && typeof field === "object" ? {
|
|
41814
|
-
name: String(field.name ?? ""),
|
|
41815
|
-
type: field.type ?? void 0,
|
|
41816
|
-
required: field.required ?? void 0
|
|
41817
|
-
} : null
|
|
41818
|
-
).filter((field) => Boolean(field?.name)) : [];
|
|
41819
|
-
return fields2.length > 0 ? { fields: fields2 } : schema;
|
|
41820
|
-
}
|
|
41821
41962
|
function summarizePlayGrepResult(play) {
|
|
41822
41963
|
const reference = formatPlayListReference(play);
|
|
41823
41964
|
return {
|
|
@@ -41830,61 +41971,6 @@ function summarizePlayGrepResult(play) {
|
|
|
41830
41971
|
function formatPlayGrepMatches(matches) {
|
|
41831
41972
|
return matches.map((match) => `${match.field}: ${match.terms.join(", ")}`).join("; ");
|
|
41832
41973
|
}
|
|
41833
|
-
async function handlePlaySearch(args) {
|
|
41834
|
-
let options;
|
|
41835
|
-
try {
|
|
41836
|
-
options = parsePlaySearchOptions(args);
|
|
41837
|
-
} catch (error) {
|
|
41838
|
-
console.error(error instanceof Error ? error.message : String(error));
|
|
41839
|
-
return 1;
|
|
41840
|
-
}
|
|
41841
|
-
const client2 = new DeeplineClient();
|
|
41842
|
-
const plays = await client2.searchPlays({
|
|
41843
|
-
query: options.query,
|
|
41844
|
-
compact: options.compact,
|
|
41845
|
-
scope: options.scope
|
|
41846
|
-
});
|
|
41847
|
-
const disclaimer = playSearchDisclaimer(options.scope);
|
|
41848
|
-
if (options.jsonOutput) {
|
|
41849
|
-
const jsonPlays = options.scope === "prebuilt" ? plays.map((play) => ({
|
|
41850
|
-
...play,
|
|
41851
|
-
inputSchema: compactPlaySchema(play.inputSchema)
|
|
41852
|
-
})) : plays;
|
|
41853
|
-
printCompactJson({
|
|
41854
|
-
disclaimer,
|
|
41855
|
-
search_policy: {
|
|
41856
|
-
default_scope: "prebuilt",
|
|
41857
|
-
included_origins: options.scope === "all" ? ["prebuilt", "owned"] : ["prebuilt"],
|
|
41858
|
-
owned_plays_omitted: options.scope === "prebuilt",
|
|
41859
|
-
include_owned_flag: "--all"
|
|
41860
|
-
},
|
|
41861
|
-
plays: jsonPlays,
|
|
41862
|
-
total: jsonPlays.length,
|
|
41863
|
-
truncated: false
|
|
41864
|
-
});
|
|
41865
|
-
return 0;
|
|
41866
|
-
}
|
|
41867
|
-
const displayPlays = options.scope === "prebuilt" ? plays.slice(0, 5) : plays;
|
|
41868
|
-
process.stdout.write(`${disclaimer}
|
|
41869
|
-
`);
|
|
41870
|
-
process.stdout.write(
|
|
41871
|
-
`${plays.length} plays found${options.scope === "prebuilt" && plays.length > displayPlays.length ? `; showing top ${displayPlays.length}` : ""}:
|
|
41872
|
-
|
|
41873
|
-
`
|
|
41874
|
-
);
|
|
41875
|
-
for (const play of displayPlays) {
|
|
41876
|
-
if (options.scope === "prebuilt") {
|
|
41877
|
-
printCompactPlaySearchResult(play);
|
|
41878
|
-
} else {
|
|
41879
|
-
printPlayDescription(play);
|
|
41880
|
-
}
|
|
41881
|
-
console.log("");
|
|
41882
|
-
}
|
|
41883
|
-
if (options.scope === "prebuilt" && plays.length > displayPlays.length) {
|
|
41884
|
-
console.log("Use --json for the full machine-readable result set.");
|
|
41885
|
-
}
|
|
41886
|
-
return 0;
|
|
41887
|
-
}
|
|
41888
41974
|
async function handlePlayGrep(args) {
|
|
41889
41975
|
const query = args[0]?.trim();
|
|
41890
41976
|
if (!query) {
|
|
@@ -41942,7 +42028,7 @@ async function handlePlayDescribe(args) {
|
|
|
41942
42028
|
const definedName = isFileTarget(playName) ? (() => {
|
|
41943
42029
|
try {
|
|
41944
42030
|
return extractPlayName(
|
|
41945
|
-
|
|
42031
|
+
readFileSync14(resolve15(playName), "utf-8"),
|
|
41946
42032
|
playName
|
|
41947
42033
|
);
|
|
41948
42034
|
} catch {
|
|
@@ -42487,7 +42573,7 @@ Authoring:
|
|
|
42487
42573
|
Play work unless the caller explicitly asks to leave the inferred graph.
|
|
42488
42574
|
|
|
42489
42575
|
Common commands:
|
|
42490
|
-
deepline
|
|
42576
|
+
deepline search --type prebuilts email --json
|
|
42491
42577
|
deepline plays describe prebuilt/person-linkedin-to-email --json
|
|
42492
42578
|
deepline plays check prebuilt/name-and-domain-to-email-waterfall-batch
|
|
42493
42579
|
deepline plays run prebuilt/person-linkedin-to-email --input '{"linkedin_url":"..."}'
|
|
@@ -42794,7 +42880,7 @@ Notes:
|
|
|
42794
42880
|
Examples:
|
|
42795
42881
|
deepline plays list
|
|
42796
42882
|
deepline plays list --tag smb --json
|
|
42797
|
-
deepline
|
|
42883
|
+
deepline search --type prebuilts email --json
|
|
42798
42884
|
`
|
|
42799
42885
|
).option("--limit <count>", "Page size").option("--cursor <cursor>", "Continue a previous page").option("--show-cost", "Include the per-row or per-run cost estimate").option("--json", "Emit JSON output. Also automatic when stdout is piped").option(
|
|
42800
42886
|
"--categories <categories>",
|
|
@@ -42863,40 +42949,10 @@ Examples:
|
|
|
42863
42949
|
false
|
|
42864
42950
|
);
|
|
42865
42951
|
});
|
|
42866
|
-
|
|
42867
|
-
|
|
42868
|
-
|
|
42869
|
-
)
|
|
42870
|
-
"--all",
|
|
42871
|
-
"Also include plays you created after Deepline-managed prebuilts"
|
|
42872
|
-
).addHelpText(
|
|
42873
|
-
"after",
|
|
42874
|
-
`
|
|
42875
|
-
Notes:
|
|
42876
|
-
Ranked discovery for workflows. Search defaults to Deepline-managed prebuilts
|
|
42877
|
-
because they are trusted, robust plays with maintained contracts. Use describe
|
|
42878
|
-
on a result before running it.
|
|
42879
|
-
Add --all only when you are specifically looking for a play you created.
|
|
42880
|
-
Use plays grep to search active org-owned Plays through Convex's indexed
|
|
42881
|
-
authored corpus. It does not search prebuilt or archived Plays.
|
|
42882
|
-
|
|
42883
|
-
Examples:
|
|
42884
|
-
deepline plays search email
|
|
42885
|
-
deepline plays search email --all
|
|
42886
|
-
deepline plays grep "linkedin to email" --json
|
|
42887
|
-
deepline plays describe prebuilt/person-linkedin-to-email --json
|
|
42888
|
-
deepline plays describe prebuilt/person-linkedin-to-email --json inputSchema,runCommand
|
|
42889
|
-
`
|
|
42890
|
-
).option("--compact", "Emit compact schemas").option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (query, options) => {
|
|
42891
|
-
process.exitCode = await handlePlaySearch([
|
|
42892
|
-
query,
|
|
42893
|
-
...options.prebuilt ? ["--prebuilt"] : [],
|
|
42894
|
-
...options.all ? ["--all"] : [],
|
|
42895
|
-
...options.compact ? ["--compact"] : [],
|
|
42896
|
-
...options.json ? ["--json"] : []
|
|
42897
|
-
]);
|
|
42898
|
-
});
|
|
42899
|
-
addPlaySearchCommand(play.command("search <query>"));
|
|
42952
|
+
registerDeprecatedSearchCommand(
|
|
42953
|
+
play,
|
|
42954
|
+
(options) => options.all ? ["plays"] : ["prebuilts"]
|
|
42955
|
+
);
|
|
42900
42956
|
play.command("grep <query>").description(
|
|
42901
42957
|
"Search active org-owned Plays through Convex full-text search."
|
|
42902
42958
|
).addHelpText(
|
|
@@ -44321,23 +44377,23 @@ import { spawnSync as spawnSync3 } from "child_process";
|
|
|
44321
44377
|
import {
|
|
44322
44378
|
existsSync as existsSync15,
|
|
44323
44379
|
lstatSync as lstatSync2,
|
|
44324
|
-
mkdirSync as
|
|
44325
|
-
readFileSync as
|
|
44380
|
+
mkdirSync as mkdirSync13,
|
|
44381
|
+
readFileSync as readFileSync18,
|
|
44326
44382
|
realpathSync as realpathSync5,
|
|
44327
|
-
writeFileSync as
|
|
44383
|
+
writeFileSync as writeFileSync18
|
|
44328
44384
|
} from "fs";
|
|
44329
44385
|
import { homedir as homedir9 } from "os";
|
|
44330
|
-
import { dirname as
|
|
44386
|
+
import { dirname as dirname16, join as join21, resolve as resolve17 } from "path";
|
|
44331
44387
|
|
|
44332
44388
|
// src/cli/installation-lifecycle.ts
|
|
44333
44389
|
import {
|
|
44334
44390
|
existsSync as existsSync12,
|
|
44335
44391
|
lstatSync,
|
|
44336
|
-
readFileSync as
|
|
44392
|
+
readFileSync as readFileSync15,
|
|
44337
44393
|
realpathSync as realpathSync4,
|
|
44338
44394
|
rmSync as rmSync4
|
|
44339
44395
|
} from "fs";
|
|
44340
|
-
import { basename as basename5, dirname as
|
|
44396
|
+
import { basename as basename5, dirname as dirname13, join as join18, relative as relative6, resolve as resolve16 } from "path";
|
|
44341
44397
|
var nodeFileSystem = {
|
|
44342
44398
|
exists: existsSync12,
|
|
44343
44399
|
isSymbolicLink(path) {
|
|
@@ -44349,7 +44405,7 @@ var nodeFileSystem = {
|
|
|
44349
44405
|
},
|
|
44350
44406
|
read(path) {
|
|
44351
44407
|
try {
|
|
44352
|
-
return
|
|
44408
|
+
return readFileSync15(path, "utf8");
|
|
44353
44409
|
} catch {
|
|
44354
44410
|
return "";
|
|
44355
44411
|
}
|
|
@@ -44393,25 +44449,25 @@ var CliInstallation = class _CliInstallation {
|
|
|
44393
44449
|
});
|
|
44394
44450
|
}
|
|
44395
44451
|
static isNpmPackagePath(path) {
|
|
44396
|
-
return path?.includes(`${
|
|
44452
|
+
return path?.includes(`${join18("node_modules", "deepline")}`) ?? false;
|
|
44397
44453
|
}
|
|
44398
44454
|
launcher(path) {
|
|
44399
44455
|
return inspectLauncher(path, this.input.fileSystem);
|
|
44400
44456
|
}
|
|
44401
44457
|
retiredArtifacts() {
|
|
44402
|
-
const hostDir =
|
|
44458
|
+
const hostDir = join18(
|
|
44403
44459
|
this.input.home,
|
|
44404
44460
|
".local",
|
|
44405
44461
|
"deepline",
|
|
44406
44462
|
this.input.baseUrlSlug
|
|
44407
44463
|
);
|
|
44408
|
-
const legacyLauncherPath =
|
|
44464
|
+
const legacyLauncherPath = join18(
|
|
44409
44465
|
this.input.home,
|
|
44410
44466
|
".local",
|
|
44411
44467
|
"bin",
|
|
44412
44468
|
"deepline"
|
|
44413
44469
|
);
|
|
44414
|
-
const installerCommandPath = this.input.fileSystem.read(
|
|
44470
|
+
const installerCommandPath = this.input.fileSystem.read(join18(hostDir, "sdk", ".command-path")).trim();
|
|
44415
44471
|
const ownedInstallerCommand = isOwnedInstallerCommandPath({
|
|
44416
44472
|
hostDir,
|
|
44417
44473
|
commandPath: installerCommandPath
|
|
@@ -44419,16 +44475,16 @@ var CliInstallation = class _CliInstallation {
|
|
|
44419
44475
|
const legacyLauncher = this.launcher(legacyLauncherPath);
|
|
44420
44476
|
const candidates = [
|
|
44421
44477
|
...legacyLauncher.ownership === "installer_legacy" ? [legacyLauncherPath] : [],
|
|
44422
|
-
|
|
44423
|
-
|
|
44424
|
-
|
|
44425
|
-
|
|
44426
|
-
|
|
44427
|
-
|
|
44428
|
-
|
|
44478
|
+
join18(this.input.home, ".local", "bin", "deepline-real"),
|
|
44479
|
+
join18(hostDir, "bin", "deepline"),
|
|
44480
|
+
join18(hostDir, "bin", "deepline-real"),
|
|
44481
|
+
join18(hostDir, "cli", ".install-method"),
|
|
44482
|
+
join18(hostDir, "cli", ".version"),
|
|
44483
|
+
join18(hostDir, "sdk", ".install-method"),
|
|
44484
|
+
join18(hostDir, "sdk", ".command-path"),
|
|
44429
44485
|
...ownedInstallerCommand ? [
|
|
44430
44486
|
installerCommandPath,
|
|
44431
|
-
|
|
44487
|
+
join18(dirname13(installerCommandPath), "deepline-sdk")
|
|
44432
44488
|
] : []
|
|
44433
44489
|
];
|
|
44434
44490
|
return {
|
|
@@ -44459,9 +44515,9 @@ function isOwnedInstallerCommandPath(input2) {
|
|
|
44459
44515
|
|
|
44460
44516
|
// src/cli/commands/skills.ts
|
|
44461
44517
|
import { spawn as spawn3 } from "child_process";
|
|
44462
|
-
import { existsSync as existsSync14, mkdirSync as
|
|
44518
|
+
import { existsSync as existsSync14, mkdirSync as mkdirSync12, readFileSync as readFileSync17, writeFileSync as writeFileSync17 } from "fs";
|
|
44463
44519
|
import { homedir as homedir8 } from "os";
|
|
44464
|
-
import { dirname as
|
|
44520
|
+
import { dirname as dirname15, join as join20 } from "path";
|
|
44465
44521
|
|
|
44466
44522
|
// contracts/install-commands.json
|
|
44467
44523
|
var install_commands_default = {
|
|
@@ -44580,15 +44636,15 @@ import { gunzipSync } from "zlib";
|
|
|
44580
44636
|
import {
|
|
44581
44637
|
appendFileSync,
|
|
44582
44638
|
existsSync as existsSync13,
|
|
44583
|
-
mkdirSync as
|
|
44639
|
+
mkdirSync as mkdirSync11,
|
|
44584
44640
|
readdirSync as readdirSync4,
|
|
44585
|
-
readFileSync as
|
|
44641
|
+
readFileSync as readFileSync16,
|
|
44586
44642
|
renameSync,
|
|
44587
44643
|
rmSync as rmSync5,
|
|
44588
44644
|
unlinkSync as unlinkSync2,
|
|
44589
|
-
writeFileSync as
|
|
44645
|
+
writeFileSync as writeFileSync16
|
|
44590
44646
|
} from "fs";
|
|
44591
|
-
import { dirname as
|
|
44647
|
+
import { dirname as dirname14, join as join19 } from "path";
|
|
44592
44648
|
|
|
44593
44649
|
// src/cli/windows-arg-escape.ts
|
|
44594
44650
|
var CMD_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
|
|
@@ -44998,7 +45054,7 @@ function shouldSkipSkillsSync() {
|
|
|
44998
45054
|
return value === "1" || value === "true" || value === "yes" || value === "on";
|
|
44999
45055
|
}
|
|
45000
45056
|
function unavailableSkillsNoticePath(baseUrl) {
|
|
45001
|
-
return
|
|
45057
|
+
return join19(sdkCliStateDirPath(baseUrl), "skills-sync-unavailable-version");
|
|
45002
45058
|
}
|
|
45003
45059
|
var SKILLS_SYNC_IN_PROGRESS_TTL_MS = 10 * 60 * 1e3;
|
|
45004
45060
|
var SKILLS_SYNC_IN_PROGRESS_PID_CAP_MS = 6 * 60 * 60 * 1e3;
|
|
@@ -45008,21 +45064,21 @@ function sortedLeaseAgents(agents) {
|
|
|
45008
45064
|
return [...new Set(expanded)].sort((a, b) => a.localeCompare(b));
|
|
45009
45065
|
}
|
|
45010
45066
|
function inProgressSkillsSyncPath(baseUrl, agent) {
|
|
45011
|
-
return
|
|
45067
|
+
return join19(
|
|
45012
45068
|
sdkCliStateDirPath(baseUrl),
|
|
45013
45069
|
`skills-sync-in-progress-${agentLeaseSegment(agent)}`
|
|
45014
45070
|
);
|
|
45015
45071
|
}
|
|
45016
45072
|
function readInProgressSkillsSyncLeaseFromDir(dir) {
|
|
45017
|
-
const claim = readMarkedSkillsSyncVersion(
|
|
45073
|
+
const claim = readMarkedSkillsSyncVersion(join19(dir, "claim"));
|
|
45018
45074
|
const [version = "", startedAt = ""] = claim.split(" ");
|
|
45019
|
-
const pidRaw = readMarkedSkillsSyncVersion(
|
|
45075
|
+
const pidRaw = readMarkedSkillsSyncVersion(join19(dir, "pid"));
|
|
45020
45076
|
return {
|
|
45021
45077
|
claimToken: version && startedAt ? `${version} ${startedAt}` : "",
|
|
45022
45078
|
version,
|
|
45023
45079
|
startedAt: Number(startedAt),
|
|
45024
45080
|
pid: /^\d+$/.test(pidRaw) ? Number(pidRaw) : null,
|
|
45025
|
-
owner: readMarkedSkillsSyncVersion(
|
|
45081
|
+
owner: readMarkedSkillsSyncVersion(join19(dir, "owner"))
|
|
45026
45082
|
};
|
|
45027
45083
|
}
|
|
45028
45084
|
function readInProgressSkillsSyncLease(baseUrl, agent) {
|
|
@@ -45079,10 +45135,10 @@ function claimOneInProgressSkillsSync(baseUrl, remoteVersion, agent, owner) {
|
|
|
45079
45135
|
const create = () => {
|
|
45080
45136
|
const claimToken = `${remoteVersion} ${Date.now()}`;
|
|
45081
45137
|
const staging = `${dir}.staging-${process.pid}-${Date.now()}`;
|
|
45082
|
-
|
|
45083
|
-
|
|
45138
|
+
mkdirSync11(staging);
|
|
45139
|
+
writeFileSync16(join19(staging, "claim"), `${claimToken}
|
|
45084
45140
|
`, "utf-8");
|
|
45085
|
-
|
|
45141
|
+
writeFileSync16(join19(staging, "owner"), `${owner}
|
|
45086
45142
|
`, "utf-8");
|
|
45087
45143
|
try {
|
|
45088
45144
|
renameSync(staging, dir);
|
|
@@ -45096,7 +45152,7 @@ function claimOneInProgressSkillsSync(baseUrl, remoteVersion, agent, owner) {
|
|
|
45096
45152
|
return { state: "claimed", claimToken };
|
|
45097
45153
|
};
|
|
45098
45154
|
try {
|
|
45099
|
-
|
|
45155
|
+
mkdirSync11(dirname14(dir), { recursive: true });
|
|
45100
45156
|
return create();
|
|
45101
45157
|
} catch (error) {
|
|
45102
45158
|
if (errorCode(error) !== "EEXIST") return { state: "unavailable" };
|
|
@@ -45155,8 +45211,8 @@ function recordOwnPidOnInProgressSkillsSync(baseUrl, leases) {
|
|
|
45155
45211
|
for (const [agent, lease] of leases) {
|
|
45156
45212
|
if (!lease.claimToken) continue;
|
|
45157
45213
|
try {
|
|
45158
|
-
|
|
45159
|
-
|
|
45214
|
+
writeFileSync16(
|
|
45215
|
+
join19(inProgressSkillsSyncPath(baseUrl, agent), "pid"),
|
|
45160
45216
|
`${process.pid}
|
|
45161
45217
|
`,
|
|
45162
45218
|
"utf-8"
|
|
@@ -45225,7 +45281,7 @@ function skillsInstallLeasePath(baseUrl, agents) {
|
|
|
45225
45281
|
return sortedLeaseAgents(agents).map((agent) => inProgressSkillsSyncPath(baseUrl, agent)).join(", ");
|
|
45226
45282
|
}
|
|
45227
45283
|
function deferredSkillsNoticePath(baseUrl, agents) {
|
|
45228
|
-
return
|
|
45284
|
+
return join19(
|
|
45229
45285
|
sdkCliStateDirPath(baseUrl),
|
|
45230
45286
|
`skills-sync-notice-${sortedLeaseAgents(agents).map(agentLeaseSegment).join("-")}`
|
|
45231
45287
|
);
|
|
@@ -45234,7 +45290,7 @@ function deferSkillsNotice(baseUrl, agents) {
|
|
|
45234
45290
|
const path = deferredSkillsNoticePath(baseUrl, agents);
|
|
45235
45291
|
return (text) => {
|
|
45236
45292
|
try {
|
|
45237
|
-
|
|
45293
|
+
mkdirSync11(dirname14(path), { recursive: true });
|
|
45238
45294
|
appendFileSync(path, `${text.trimEnd()}
|
|
45239
45295
|
`, "utf-8");
|
|
45240
45296
|
} catch {
|
|
@@ -45248,7 +45304,7 @@ function flushDeferredSkillsNotices(baseUrl, agents) {
|
|
|
45248
45304
|
if (!tombstone) return;
|
|
45249
45305
|
let text = "";
|
|
45250
45306
|
try {
|
|
45251
|
-
text =
|
|
45307
|
+
text = readFileSync16(tombstone, "utf-8");
|
|
45252
45308
|
} catch {
|
|
45253
45309
|
return;
|
|
45254
45310
|
} finally {
|
|
@@ -45276,7 +45332,7 @@ function spawnDetachedSkillsSyncChild(argv, onSpawnError) {
|
|
|
45276
45332
|
child.unref();
|
|
45277
45333
|
}
|
|
45278
45334
|
function failedSkillsSyncPath(baseUrl, agents) {
|
|
45279
|
-
return
|
|
45335
|
+
return join19(
|
|
45280
45336
|
sdkCliStateDirPath(baseUrl),
|
|
45281
45337
|
`skills-sync-failed-${sortedLeaseAgents(agents).map(agentLeaseSegment).join("-")}-version`
|
|
45282
45338
|
);
|
|
@@ -45286,15 +45342,15 @@ function hasMarkedSkillsSyncVersion(path, version) {
|
|
|
45286
45342
|
}
|
|
45287
45343
|
function readMarkedSkillsSyncVersion(path) {
|
|
45288
45344
|
try {
|
|
45289
|
-
return existsSync13(path) ?
|
|
45345
|
+
return existsSync13(path) ? readFileSync16(path, "utf-8").trim() : "";
|
|
45290
45346
|
} catch {
|
|
45291
45347
|
return "";
|
|
45292
45348
|
}
|
|
45293
45349
|
}
|
|
45294
45350
|
function writeMarkedSkillsSyncVersion(path, version) {
|
|
45295
45351
|
try {
|
|
45296
|
-
|
|
45297
|
-
|
|
45352
|
+
mkdirSync11(dirname14(path), { recursive: true });
|
|
45353
|
+
writeFileSync16(path, `${version}
|
|
45298
45354
|
`, "utf-8");
|
|
45299
45355
|
return true;
|
|
45300
45356
|
} catch {
|
|
@@ -45403,7 +45459,7 @@ function safeSkillFilePath(value) {
|
|
|
45403
45459
|
}
|
|
45404
45460
|
function installedSkillFiles(root, prefix = "") {
|
|
45405
45461
|
const files = [];
|
|
45406
|
-
for (const entry of readdirSync4(
|
|
45462
|
+
for (const entry of readdirSync4(join19(root, prefix), {
|
|
45407
45463
|
withFileTypes: true
|
|
45408
45464
|
})) {
|
|
45409
45465
|
const relativePath = prefix ? `${prefix}/${entry.name}` : entry.name;
|
|
@@ -45523,11 +45579,11 @@ async function verifyDefaultAgentSkillsInstall(baseUrl, remoteVersion, skillName
|
|
|
45523
45579
|
controller.abort();
|
|
45524
45580
|
}
|
|
45525
45581
|
const home = homedir7();
|
|
45526
|
-
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR?.trim() ||
|
|
45582
|
+
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR?.trim() || join19(home, ".claude");
|
|
45527
45583
|
for (const [name, { files }] of published) {
|
|
45528
45584
|
for (const root of [
|
|
45529
|
-
|
|
45530
|
-
|
|
45585
|
+
join19(home, ".agents", "skills", name),
|
|
45586
|
+
join19(claudeConfigDir, "skills", name)
|
|
45531
45587
|
]) {
|
|
45532
45588
|
const installed = installedSkillFiles(root);
|
|
45533
45589
|
if (installed.length !== files.length || installed.some((file, index2) => file !== files[index2])) {
|
|
@@ -45535,7 +45591,7 @@ async function verifyDefaultAgentSkillsInstall(baseUrl, remoteVersion, skillName
|
|
|
45535
45591
|
}
|
|
45536
45592
|
for (const file of files) {
|
|
45537
45593
|
const publishedContent = expected.get(`${name}/${file}`);
|
|
45538
|
-
if (!publishedContent || !
|
|
45594
|
+
if (!publishedContent || !readFileSync16(join19(root, file)).equals(publishedContent)) {
|
|
45539
45595
|
throw new Error(`installed content differs for ${name}/${file}`);
|
|
45540
45596
|
}
|
|
45541
45597
|
}
|
|
@@ -45589,7 +45645,7 @@ function probeInstallers(timeoutMs) {
|
|
|
45589
45645
|
};
|
|
45590
45646
|
}
|
|
45591
45647
|
function noInstallerProbePath(baseUrl) {
|
|
45592
|
-
return
|
|
45648
|
+
return join19(
|
|
45593
45649
|
sdkCliStateDirPath(baseUrl),
|
|
45594
45650
|
"skills-sync-no-installer-unknown.json"
|
|
45595
45651
|
);
|
|
@@ -45597,7 +45653,7 @@ function noInstallerProbePath(baseUrl) {
|
|
|
45597
45653
|
function dueUnknownInstallerProbes(baseUrl, remoteVersion) {
|
|
45598
45654
|
const path = noInstallerProbePath(baseUrl);
|
|
45599
45655
|
try {
|
|
45600
|
-
const cached = JSON.parse(
|
|
45656
|
+
const cached = JSON.parse(readFileSync16(path, "utf-8"));
|
|
45601
45657
|
if (cached.version === remoteVersion && typeof cached.checkedAt === "number" && cached.checkedAt <= Date.now() && Date.now() - cached.checkedAt < NEGATIVE_INSTALLER_PROBE_TTL_MS && (cached.probes?.bunx === "missing" || cached.probes?.bunx === "failed") && (cached.probes?.npx === "missing" || cached.probes?.npx === "failed")) {
|
|
45602
45658
|
return cached.probes;
|
|
45603
45659
|
}
|
|
@@ -45606,8 +45662,8 @@ function dueUnknownInstallerProbes(baseUrl, remoteVersion) {
|
|
|
45606
45662
|
const probes = probeInstallers(INSTALLER_PROBE_TIMEOUT_MS);
|
|
45607
45663
|
if (probes.bunx !== "available" && probes.npx !== "available") {
|
|
45608
45664
|
try {
|
|
45609
|
-
|
|
45610
|
-
|
|
45665
|
+
mkdirSync11(dirname14(path), { recursive: true });
|
|
45666
|
+
writeFileSync16(
|
|
45611
45667
|
path,
|
|
45612
45668
|
JSON.stringify({
|
|
45613
45669
|
version: remoteVersion,
|
|
@@ -46058,13 +46114,13 @@ function detectSkillsAgents(input2) {
|
|
|
46058
46114
|
];
|
|
46059
46115
|
const detected = AGENT_MARKERS.filter(
|
|
46060
46116
|
(marker) => roots.some(
|
|
46061
|
-
(root) => marker.paths.some((path) => existsSync14(
|
|
46117
|
+
(root) => marker.paths.some((path) => existsSync14(join20(root, path)))
|
|
46062
46118
|
)
|
|
46063
46119
|
).map((marker) => marker.agent);
|
|
46064
46120
|
return detected.length > 0 ? detected : ["*"];
|
|
46065
46121
|
}
|
|
46066
46122
|
function skillsStatePathForScope(baseUrl, scope, root) {
|
|
46067
|
-
return scope === "local" && root ?
|
|
46123
|
+
return scope === "local" && root ? join20(root, ".deepline", "setup", "skills.json") : join20(sdkCliStateDirPath(baseUrl), "skills-install.json");
|
|
46068
46124
|
}
|
|
46069
46125
|
function buildSkillsPlan(input2) {
|
|
46070
46126
|
const scopeArgs = input2.scope === "global" ? ["--global"] : [];
|
|
@@ -46131,7 +46187,7 @@ function isSkillsPlanCurrent(plan, state) {
|
|
|
46131
46187
|
}
|
|
46132
46188
|
function readSkillsInstallState(path) {
|
|
46133
46189
|
try {
|
|
46134
|
-
const parsed = JSON.parse(
|
|
46190
|
+
const parsed = JSON.parse(readFileSync17(path, "utf8"));
|
|
46135
46191
|
return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
46136
46192
|
} catch {
|
|
46137
46193
|
return null;
|
|
@@ -46335,8 +46391,8 @@ async function runSkillsInstallWithLease(input2) {
|
|
|
46335
46391
|
`
|
|
46336
46392
|
);
|
|
46337
46393
|
}
|
|
46338
|
-
|
|
46339
|
-
|
|
46394
|
+
mkdirSync12(dirname15(plan.statePath), { recursive: true });
|
|
46395
|
+
writeFileSync17(
|
|
46340
46396
|
plan.statePath,
|
|
46341
46397
|
`${JSON.stringify(
|
|
46342
46398
|
{
|
|
@@ -46525,7 +46581,7 @@ function phasesFromLegacyStatus(status) {
|
|
|
46525
46581
|
function readSetupState(input2) {
|
|
46526
46582
|
try {
|
|
46527
46583
|
const parsed = JSON.parse(
|
|
46528
|
-
|
|
46584
|
+
readFileSync18(
|
|
46529
46585
|
setupStatePath(input2.baseUrl, input2.scope, input2.root),
|
|
46530
46586
|
"utf8"
|
|
46531
46587
|
)
|
|
@@ -46614,7 +46670,7 @@ function buildPendingAuthorizationOutput(input2) {
|
|
|
46614
46670
|
};
|
|
46615
46671
|
}
|
|
46616
46672
|
function setupStatePath(baseUrl, scope, root) {
|
|
46617
|
-
return scope === "local" && root ?
|
|
46673
|
+
return scope === "local" && root ? join21(root, ".deepline", "setup", "state.json") : join21(sdkCliStateDirPath(baseUrl), "setup.json");
|
|
46618
46674
|
}
|
|
46619
46675
|
async function captureStdout(run) {
|
|
46620
46676
|
let stdout = "";
|
|
@@ -46643,7 +46699,7 @@ function asRecord4(value) {
|
|
|
46643
46699
|
}
|
|
46644
46700
|
function safeRead(path) {
|
|
46645
46701
|
try {
|
|
46646
|
-
return
|
|
46702
|
+
return readFileSync18(path, "utf8");
|
|
46647
46703
|
} catch {
|
|
46648
46704
|
return "";
|
|
46649
46705
|
}
|
|
@@ -46695,7 +46751,7 @@ function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
|
46695
46751
|
if (prefix.status !== 0) return null;
|
|
46696
46752
|
const root = String(prefix.stdout ?? "").trim();
|
|
46697
46753
|
if (!root) return null;
|
|
46698
|
-
const candidates = platform3 === "win32" ? [
|
|
46754
|
+
const candidates = platform3 === "win32" ? [join21(root, "deepline.cmd"), join21(root, "deepline")] : [join21(root, "bin", "deepline")];
|
|
46699
46755
|
return candidates.find((candidate) => pathExists(candidate)) ?? null;
|
|
46700
46756
|
}
|
|
46701
46757
|
function inspectGlobalCliAvailability(input2) {
|
|
@@ -46721,7 +46777,7 @@ function isKnownDeeplineCommand(path) {
|
|
|
46721
46777
|
} catch {
|
|
46722
46778
|
}
|
|
46723
46779
|
if (entrypoint && resolvedPath === entrypoint) return true;
|
|
46724
|
-
if (resolvedPath.includes(`${
|
|
46780
|
+
if (resolvedPath.includes(`${join21("node_modules", "deepline")}`)) return true;
|
|
46725
46781
|
const content = safeRead(path);
|
|
46726
46782
|
return content.includes("node_modules/deepline") || content.includes("node_modules\\deepline") || content.includes("DEEPLINE_CONFIG_SCOPE") || content.includes("deepline-real");
|
|
46727
46783
|
}
|
|
@@ -46731,7 +46787,7 @@ function inspectPathConflict() {
|
|
|
46731
46787
|
try {
|
|
46732
46788
|
if (lstatSync2(commandPath).isSymbolicLink()) {
|
|
46733
46789
|
const target = realpathSync5(commandPath);
|
|
46734
|
-
if (target.includes(`${
|
|
46790
|
+
if (target.includes(`${join21("node_modules", "deepline")}`)) return null;
|
|
46735
46791
|
}
|
|
46736
46792
|
} catch {
|
|
46737
46793
|
}
|
|
@@ -46739,8 +46795,8 @@ function inspectPathConflict() {
|
|
|
46739
46795
|
}
|
|
46740
46796
|
function writeSetupState(input2) {
|
|
46741
46797
|
const path = setupStatePath(input2.baseUrl, input2.scope, input2.root);
|
|
46742
|
-
|
|
46743
|
-
|
|
46798
|
+
mkdirSync13(dirname16(path), { recursive: true });
|
|
46799
|
+
writeFileSync18(
|
|
46744
46800
|
path,
|
|
46745
46801
|
`${JSON.stringify(
|
|
46746
46802
|
{
|
|
@@ -46780,7 +46836,7 @@ function failSetupPhase(phases, phase, code) {
|
|
|
46780
46836
|
phases[phase] = { status: "failed", code };
|
|
46781
46837
|
}
|
|
46782
46838
|
function rollbackCommand(scope, root) {
|
|
46783
|
-
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(
|
|
46839
|
+
const prefix = scope === "local" && root ? ` --prefix ${JSON.stringify(join21(root, ".deepline", "runtime"))}` : "";
|
|
46784
46840
|
const allowScriptsFlag = npmSupportsAllowScripts(readNpmVersion(process.env)) ? " --allow-scripts=esbuild" : "";
|
|
46785
46841
|
return `npm install -g${prefix} --no-audit --no-fund --include=optional${allowScriptsFlag} deepline@${SDK_VERSION}`;
|
|
46786
46842
|
}
|
|
@@ -46875,7 +46931,7 @@ function buildDoctorAssessment(input2) {
|
|
|
46875
46931
|
const pathGlobalCli = globalCli?.path ?? null;
|
|
46876
46932
|
const cliPath = input2.scope === "global" ? pathGlobalCli : runningCliPath;
|
|
46877
46933
|
const cliScopeOk = input2.scope === "global" ? Boolean(pathGlobalCli) : Boolean(
|
|
46878
|
-
input2.root && runningCliPath?.includes(
|
|
46934
|
+
input2.root && runningCliPath?.includes(join21(input2.root, ".deepline", "runtime"))
|
|
46879
46935
|
);
|
|
46880
46936
|
const checks = {
|
|
46881
46937
|
cli: {
|
|
@@ -47491,19 +47547,19 @@ Examples:
|
|
|
47491
47547
|
}
|
|
47492
47548
|
|
|
47493
47549
|
// src/cli/commands/settings.ts
|
|
47494
|
-
import { readFileSync as
|
|
47550
|
+
import { readFileSync as readFileSync22 } from "fs";
|
|
47495
47551
|
|
|
47496
47552
|
// src/cli/update-preferences.ts
|
|
47497
47553
|
import {
|
|
47498
47554
|
existsSync as existsSync16,
|
|
47499
|
-
mkdirSync as
|
|
47500
|
-
readFileSync as
|
|
47555
|
+
mkdirSync as mkdirSync14,
|
|
47556
|
+
readFileSync as readFileSync19,
|
|
47501
47557
|
renameSync as renameSync2,
|
|
47502
47558
|
rmSync as rmSync6,
|
|
47503
|
-
writeFileSync as
|
|
47559
|
+
writeFileSync as writeFileSync19
|
|
47504
47560
|
} from "fs";
|
|
47505
47561
|
import { homedir as homedir10 } from "os";
|
|
47506
|
-
import { dirname as
|
|
47562
|
+
import { dirname as dirname17, join as join22 } from "path";
|
|
47507
47563
|
var UPDATE_PREFERENCES_SCHEMA_VERSION = 1;
|
|
47508
47564
|
var CLI_UPDATE_MESSAGES = [
|
|
47509
47565
|
{
|
|
@@ -47532,7 +47588,7 @@ function unreadablePreferences(path, error) {
|
|
|
47532
47588
|
};
|
|
47533
47589
|
}
|
|
47534
47590
|
function cliUpdatePreferencesPath(homeDir2 = homedir10()) {
|
|
47535
|
-
return
|
|
47591
|
+
return join22(
|
|
47536
47592
|
homeDir2,
|
|
47537
47593
|
".local",
|
|
47538
47594
|
"deepline",
|
|
@@ -47544,7 +47600,7 @@ function readCliUpdatePreferences(homeDir2 = homedir10()) {
|
|
|
47544
47600
|
const path = cliUpdatePreferencesPath(homeDir2);
|
|
47545
47601
|
if (!existsSync16(path)) return defaultPreferences();
|
|
47546
47602
|
try {
|
|
47547
|
-
const parsed = JSON.parse(
|
|
47603
|
+
const parsed = JSON.parse(readFileSync19(path, "utf8"));
|
|
47548
47604
|
return {
|
|
47549
47605
|
schemaVersion: UPDATE_PREFERENCES_SCHEMA_VERSION,
|
|
47550
47606
|
autoUpdateEnabled: typeof parsed.autoUpdateEnabled === "boolean" ? parsed.autoUpdateEnabled : true,
|
|
@@ -47560,9 +47616,9 @@ function readCliUpdatePreferences(homeDir2 = homedir10()) {
|
|
|
47560
47616
|
function writeCliUpdatePreferences(preferences, homeDir2 = homedir10()) {
|
|
47561
47617
|
const path = cliUpdatePreferencesPath(homeDir2);
|
|
47562
47618
|
const tempPath = `${path}.${process.pid}.tmp`;
|
|
47563
|
-
|
|
47619
|
+
mkdirSync14(dirname17(path), { recursive: true });
|
|
47564
47620
|
try {
|
|
47565
|
-
|
|
47621
|
+
writeFileSync19(tempPath, `${JSON.stringify(preferences, null, 2)}
|
|
47566
47622
|
`, {
|
|
47567
47623
|
encoding: "utf8",
|
|
47568
47624
|
mode: 384
|
|
@@ -47621,28 +47677,28 @@ function consumePendingCliUpdateMessages(homeDir2 = homedir10()) {
|
|
|
47621
47677
|
import { spawn as spawn4, spawnSync as spawnSync4 } from "child_process";
|
|
47622
47678
|
import {
|
|
47623
47679
|
existsSync as existsSync18,
|
|
47624
|
-
mkdirSync as
|
|
47680
|
+
mkdirSync as mkdirSync15,
|
|
47625
47681
|
realpathSync as realpathSync6,
|
|
47626
|
-
readFileSync as
|
|
47682
|
+
readFileSync as readFileSync21,
|
|
47627
47683
|
renameSync as renameSync3,
|
|
47628
47684
|
rmSync as rmSync7,
|
|
47629
47685
|
unlinkSync as unlinkSync3,
|
|
47630
|
-
writeFileSync as
|
|
47686
|
+
writeFileSync as writeFileSync20
|
|
47631
47687
|
} from "fs";
|
|
47632
47688
|
import { homedir as homedir11 } from "os";
|
|
47633
47689
|
import {
|
|
47634
47690
|
basename as basename6,
|
|
47635
|
-
dirname as
|
|
47691
|
+
dirname as dirname18,
|
|
47636
47692
|
isAbsolute as isAbsolute7,
|
|
47637
|
-
join as
|
|
47693
|
+
join as join24,
|
|
47638
47694
|
relative as relative8,
|
|
47639
47695
|
resolve as resolve19
|
|
47640
47696
|
} from "path";
|
|
47641
47697
|
|
|
47642
47698
|
// src/cli/install-integrity.ts
|
|
47643
47699
|
import { createRequire } from "module";
|
|
47644
|
-
import { existsSync as existsSync17, readFileSync as
|
|
47645
|
-
import { isAbsolute as isAbsolute6, join as
|
|
47700
|
+
import { existsSync as existsSync17, readFileSync as readFileSync20, statSync as statSync5 } from "fs";
|
|
47701
|
+
import { isAbsolute as isAbsolute6, join as join23, relative as relative7, resolve as resolve18 } from "path";
|
|
47646
47702
|
var SDK_SIDECAR_CRITICAL_PACKAGE_FILES = [
|
|
47647
47703
|
"dist/cli/index.mjs",
|
|
47648
47704
|
"dist/index.mjs",
|
|
@@ -47677,7 +47733,7 @@ function resolveContainedPath(root, value) {
|
|
|
47677
47733
|
return target;
|
|
47678
47734
|
}
|
|
47679
47735
|
function parseJson(path) {
|
|
47680
|
-
return JSON.parse(
|
|
47736
|
+
return JSON.parse(readFileSync20(path, "utf8"));
|
|
47681
47737
|
}
|
|
47682
47738
|
function isFile(path) {
|
|
47683
47739
|
try {
|
|
@@ -47687,7 +47743,7 @@ function isFile(path) {
|
|
|
47687
47743
|
}
|
|
47688
47744
|
}
|
|
47689
47745
|
function readManifest(packageRoot) {
|
|
47690
|
-
const packageJsonPath =
|
|
47746
|
+
const packageJsonPath = join23(packageRoot, "package.json");
|
|
47691
47747
|
let packageJson;
|
|
47692
47748
|
try {
|
|
47693
47749
|
packageJson = parseJson(packageJsonPath);
|
|
@@ -47761,8 +47817,8 @@ function readManifest(packageRoot) {
|
|
|
47761
47817
|
return { mode: "manifest", manifest };
|
|
47762
47818
|
}
|
|
47763
47819
|
function inspectSdkSidecarInstall(versionDir) {
|
|
47764
|
-
const nodeModulesRoot =
|
|
47765
|
-
const packageRoot =
|
|
47820
|
+
const nodeModulesRoot = join23(versionDir, "node_modules");
|
|
47821
|
+
const packageRoot = join23(nodeModulesRoot, "deepline");
|
|
47766
47822
|
const manifestResult = readManifest(packageRoot);
|
|
47767
47823
|
if ("invalidReason" in manifestResult) {
|
|
47768
47824
|
return {
|
|
@@ -47773,8 +47829,8 @@ function inspectSdkSidecarInstall(versionDir) {
|
|
|
47773
47829
|
};
|
|
47774
47830
|
}
|
|
47775
47831
|
const missing = [
|
|
47776
|
-
...manifestResult.manifest.packageFiles.filter((path) => !isFile(
|
|
47777
|
-
...manifestResult.manifest.dependencyFiles.filter((path) => !isFile(
|
|
47832
|
+
...manifestResult.manifest.packageFiles.filter((path) => !isFile(join23(packageRoot, path))).map((path) => `deepline/${path}`),
|
|
47833
|
+
...manifestResult.manifest.dependencyFiles.filter((path) => !isFile(join23(nodeModulesRoot, path))).map((path) => `node_modules/${path}`)
|
|
47778
47834
|
];
|
|
47779
47835
|
return {
|
|
47780
47836
|
ok: missing.length === 0,
|
|
@@ -47785,7 +47841,7 @@ function inspectSdkSidecarInstall(versionDir) {
|
|
|
47785
47841
|
}
|
|
47786
47842
|
function probeSdkSidecarEsbuild(versionDir) {
|
|
47787
47843
|
try {
|
|
47788
|
-
const requireFromInstall = createRequire(
|
|
47844
|
+
const requireFromInstall = createRequire(join23(versionDir, "package.json"));
|
|
47789
47845
|
const esbuild = requireFromInstall("esbuild");
|
|
47790
47846
|
if (typeof esbuild.transformSync !== "function") {
|
|
47791
47847
|
return "esbuild does not export transformSync";
|
|
@@ -47854,7 +47910,7 @@ function sidecarStateDir(input2) {
|
|
|
47854
47910
|
if (!scope || scope.includes("/") || scope.includes("\\")) {
|
|
47855
47911
|
return null;
|
|
47856
47912
|
}
|
|
47857
|
-
return
|
|
47913
|
+
return join24(input2.homeDir, ".local", "deepline", scope, "sdk-cli");
|
|
47858
47914
|
}
|
|
47859
47915
|
function sidecarRegistryUrl(hostUrl) {
|
|
47860
47916
|
let url;
|
|
@@ -47881,7 +47937,7 @@ function publicNpmFallbackRegistryUrl(hostUrl) {
|
|
|
47881
47937
|
}
|
|
47882
47938
|
function readOptionalText(path) {
|
|
47883
47939
|
try {
|
|
47884
|
-
return
|
|
47940
|
+
return readFileSync21(path, "utf8").trim();
|
|
47885
47941
|
} catch {
|
|
47886
47942
|
return "";
|
|
47887
47943
|
}
|
|
@@ -47896,12 +47952,12 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
47896
47952
|
if (!relativeEntrypoint || relativeEntrypoint.startsWith("..") || isAbsolute7(relativeEntrypoint)) {
|
|
47897
47953
|
return null;
|
|
47898
47954
|
}
|
|
47899
|
-
const installMethod = readOptionalText(
|
|
47955
|
+
const installMethod = readOptionalText(join24(stateDir, ".install-method"));
|
|
47900
47956
|
if (installMethod !== "python-sidecar") return null;
|
|
47901
47957
|
const scope = options.env.DEEPLINE_CONFIG_SCOPE?.trim() || "";
|
|
47902
47958
|
const hostUrl = options.env.DEEPLINE_HOST_URL?.trim() || "";
|
|
47903
|
-
const nodeBin = readOptionalText(
|
|
47904
|
-
const sidecarPath = readOptionalText(
|
|
47959
|
+
const nodeBin = readOptionalText(join24(stateDir, ".node-bin")) || process.execPath;
|
|
47960
|
+
const sidecarPath = readOptionalText(join24(stateDir, ".command-path")) || join24(
|
|
47905
47961
|
stateDir,
|
|
47906
47962
|
"bin",
|
|
47907
47963
|
process.platform === "win32" ? "deepline-sdk.cmd" : "deepline-sdk"
|
|
@@ -47909,7 +47965,7 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
47909
47965
|
const packageSpec = options.packageSpec || "deepline@latest";
|
|
47910
47966
|
const npmCommand = "npm";
|
|
47911
47967
|
const registryUrl = sidecarRegistryUrl(hostUrl);
|
|
47912
|
-
const versionDir =
|
|
47968
|
+
const versionDir = join24(stateDir, "versions", "<version>");
|
|
47913
47969
|
const manualCommand = `${buildSidecarProjectConfigCommand(versionDir, nodeBin)} && ${npmCommand} install --prefix ${shellQuote6(versionDir)} --registry ${shellQuote6(registryUrl)} ${NPM_SDK_INSTALL_COMMON_FLAGS.map(shellQuote6).join(" ")} ${shellQuote6(packageSpec)}`;
|
|
47914
47970
|
return {
|
|
47915
47971
|
kind: "python-sidecar",
|
|
@@ -47927,14 +47983,14 @@ function resolvePythonSidecarUpdatePlan(options) {
|
|
|
47927
47983
|
function findRepoBackedSdkRoot(startPath) {
|
|
47928
47984
|
let current = resolve19(startPath);
|
|
47929
47985
|
while (true) {
|
|
47930
|
-
if (existsSync18(
|
|
47931
|
-
const parent2 =
|
|
47932
|
-
return basename6(parent2) === "packages" && basename6(current) === "sdk" ?
|
|
47986
|
+
if (existsSync18(join24(current, "package.json")) && existsSync18(join24(current, "bin", "deepline-dev.ts"))) {
|
|
47987
|
+
const parent2 = dirname18(current);
|
|
47988
|
+
return basename6(parent2) === "packages" && basename6(current) === "sdk" ? dirname18(parent2) : parent2;
|
|
47933
47989
|
}
|
|
47934
|
-
if (existsSync18(
|
|
47990
|
+
if (existsSync18(join24(current, "sdk", "package.json")) && existsSync18(join24(current, "sdk", "bin", "deepline-dev.ts"))) {
|
|
47935
47991
|
return current;
|
|
47936
47992
|
}
|
|
47937
|
-
const parent =
|
|
47993
|
+
const parent = dirname18(current);
|
|
47938
47994
|
if (parent === current) return null;
|
|
47939
47995
|
current = parent;
|
|
47940
47996
|
}
|
|
@@ -47959,7 +48015,7 @@ function inferNpmGlobalPrefixFromEntrypoint(entrypoint, env) {
|
|
|
47959
48015
|
const directPrefix = prefixParts.join("/").toLowerCase();
|
|
47960
48016
|
const knownWindowsPrefixes = [
|
|
47961
48017
|
env.npm_config_prefix,
|
|
47962
|
-
env.APPDATA ?
|
|
48018
|
+
env.APPDATA ? join24(env.APPDATA, "npm") : void 0
|
|
47963
48019
|
].filter((value) => Boolean(value)).map((value) => resolve19(value).replace(/\\/g, "/").toLowerCase());
|
|
47964
48020
|
if (!knownWindowsPrefixes.includes(
|
|
47965
48021
|
resolve19(directPrefix).replace(/\\/g, "/").toLowerCase()
|
|
@@ -48013,7 +48069,7 @@ function resolveUpdatePlan(options = {}) {
|
|
|
48013
48069
|
const env = options.env ?? process.env;
|
|
48014
48070
|
const homeDir2 = options.homeDir ?? homedir11();
|
|
48015
48071
|
const entrypoint = options.entrypoint ?? (process.argv[1] ? resolve19(process.argv[1]) : "");
|
|
48016
|
-
const sourceRoot = entrypoint ? findRepoBackedSdkRoot(
|
|
48072
|
+
const sourceRoot = entrypoint ? findRepoBackedSdkRoot(dirname18(entrypoint)) : null;
|
|
48017
48073
|
if (sourceRoot) {
|
|
48018
48074
|
return {
|
|
48019
48075
|
kind: "source",
|
|
@@ -48066,9 +48122,9 @@ var AUTO_UPDATE_FAILURE_FILE = ".auto-update-failure.json";
|
|
|
48066
48122
|
function autoUpdateFailurePath(plan) {
|
|
48067
48123
|
if (plan.kind === "source" || plan.kind === "homebrew") return null;
|
|
48068
48124
|
if (plan.kind === "python-sidecar") {
|
|
48069
|
-
return
|
|
48125
|
+
return join24(plan.stateDir, AUTO_UPDATE_FAILURE_FILE);
|
|
48070
48126
|
}
|
|
48071
|
-
return
|
|
48127
|
+
return join24(
|
|
48072
48128
|
homedir11(),
|
|
48073
48129
|
".local",
|
|
48074
48130
|
"deepline",
|
|
@@ -48086,7 +48142,7 @@ function readAutoUpdateFailure(plan) {
|
|
|
48086
48142
|
if (!path) return null;
|
|
48087
48143
|
try {
|
|
48088
48144
|
const parsed = JSON.parse(
|
|
48089
|
-
|
|
48145
|
+
readFileSync21(path, "utf8")
|
|
48090
48146
|
);
|
|
48091
48147
|
if ((parsed.kind === "npm-global" || parsed.kind === "python-sidecar") && typeof parsed.packageSpec === "string" && typeof parsed.failedAt === "string" && typeof parsed.exitCode === "number" && typeof parsed.manualCommand === "string") {
|
|
48092
48148
|
return parsed;
|
|
@@ -48107,8 +48163,8 @@ function writeAutoUpdateFailure(plan, exitCode) {
|
|
|
48107
48163
|
manualCommand: plan.manualCommand
|
|
48108
48164
|
};
|
|
48109
48165
|
try {
|
|
48110
|
-
|
|
48111
|
-
|
|
48166
|
+
mkdirSync15(dirname18(path), { recursive: true });
|
|
48167
|
+
writeFileSync20(path, `${JSON.stringify(marker, null, 2)}
|
|
48112
48168
|
`, "utf8");
|
|
48113
48169
|
} catch {
|
|
48114
48170
|
}
|
|
@@ -48155,7 +48211,7 @@ function safeVersionSegment(value) {
|
|
|
48155
48211
|
return /^[0-9A-Za-z._-]+$/.test(normalized) ? normalized : "";
|
|
48156
48212
|
}
|
|
48157
48213
|
function entryPathInVersionDir(versionDir) {
|
|
48158
|
-
return
|
|
48214
|
+
return join24(
|
|
48159
48215
|
versionDir,
|
|
48160
48216
|
"node_modules",
|
|
48161
48217
|
"deepline",
|
|
@@ -48165,14 +48221,14 @@ function entryPathInVersionDir(versionDir) {
|
|
|
48165
48221
|
);
|
|
48166
48222
|
}
|
|
48167
48223
|
function installedPackageVersion(versionDir) {
|
|
48168
|
-
const packageJsonPath =
|
|
48224
|
+
const packageJsonPath = join24(
|
|
48169
48225
|
versionDir,
|
|
48170
48226
|
"node_modules",
|
|
48171
48227
|
"deepline",
|
|
48172
48228
|
"package.json"
|
|
48173
48229
|
);
|
|
48174
48230
|
try {
|
|
48175
|
-
const parsed = JSON.parse(
|
|
48231
|
+
const parsed = JSON.parse(readFileSync21(packageJsonPath, "utf8"));
|
|
48176
48232
|
return typeof parsed.version === "string" ? safeVersionSegment(parsed.version) : "";
|
|
48177
48233
|
} catch {
|
|
48178
48234
|
return "";
|
|
@@ -48287,20 +48343,20 @@ async function runNpmInstallWithRegistryFallback(input2) {
|
|
|
48287
48343
|
return first.exitCode;
|
|
48288
48344
|
}
|
|
48289
48345
|
function writeSidecarLauncher(input2) {
|
|
48290
|
-
|
|
48291
|
-
const packageRoot =
|
|
48292
|
-
const versionDir =
|
|
48346
|
+
mkdirSync15(dirname18(input2.path), { recursive: true });
|
|
48347
|
+
const packageRoot = dirname18(dirname18(dirname18(input2.entryPath)));
|
|
48348
|
+
const versionDir = dirname18(dirname18(packageRoot));
|
|
48293
48349
|
const esbuildProbe = "const {createRequire}=require('node:module');const path=require('node:path');const req=createRequire(path.join(process.argv[1],'package.json'));const result=req('esbuild').transformSync('const value: number = 1;',{loader:'ts'});if(!result||typeof result.code!=='string')process.exit(3);";
|
|
48294
48350
|
const criticalPaths = [
|
|
48295
48351
|
...SDK_SIDECAR_CRITICAL_PACKAGE_FILES.map(
|
|
48296
|
-
(path) =>
|
|
48352
|
+
(path) => join24(packageRoot, path)
|
|
48297
48353
|
),
|
|
48298
48354
|
...SDK_SIDECAR_CRITICAL_DEPENDENCY_FILES.map(
|
|
48299
|
-
(path) =>
|
|
48355
|
+
(path) => join24(versionDir, "node_modules", path)
|
|
48300
48356
|
)
|
|
48301
48357
|
];
|
|
48302
48358
|
if (process.platform === "win32") {
|
|
48303
|
-
|
|
48359
|
+
writeFileSync20(
|
|
48304
48360
|
input2.path,
|
|
48305
48361
|
[
|
|
48306
48362
|
`@set DEEPLINE_HOST_URL=${input2.hostUrl.replace(/\r?\n/g, "")}`,
|
|
@@ -48323,7 +48379,7 @@ function writeSidecarLauncher(input2) {
|
|
|
48323
48379
|
);
|
|
48324
48380
|
return;
|
|
48325
48381
|
}
|
|
48326
|
-
|
|
48382
|
+
writeFileSync20(
|
|
48327
48383
|
input2.path,
|
|
48328
48384
|
[
|
|
48329
48385
|
"#!/usr/bin/env sh",
|
|
@@ -48350,17 +48406,17 @@ function writeSidecarLauncher(input2) {
|
|
|
48350
48406
|
);
|
|
48351
48407
|
}
|
|
48352
48408
|
async function runPythonSidecarUpdatePlan(plan) {
|
|
48353
|
-
const versionsDir =
|
|
48354
|
-
const tempDir =
|
|
48409
|
+
const versionsDir = join24(plan.stateDir, "versions");
|
|
48410
|
+
const tempDir = join24(
|
|
48355
48411
|
versionsDir,
|
|
48356
48412
|
`.tmp-sdk-update-${process.pid}-${Date.now()}`
|
|
48357
48413
|
);
|
|
48358
48414
|
rmSync7(tempDir, { recursive: true, force: true });
|
|
48359
|
-
|
|
48360
|
-
|
|
48415
|
+
mkdirSync15(tempDir, { recursive: true });
|
|
48416
|
+
writeFileSync20(join24(tempDir, "package.json"), NPM_SDK_SIDECAR_PACKAGE_JSON);
|
|
48361
48417
|
const env = {
|
|
48362
48418
|
...process.env,
|
|
48363
|
-
PATH: `${
|
|
48419
|
+
PATH: `${dirname18(plan.nodeBin)}${process.platform === "win32" ? ";" : ":"}${process.env.PATH ?? ""}`
|
|
48364
48420
|
};
|
|
48365
48421
|
const installResult = await runCommand(
|
|
48366
48422
|
plan.npmCommand,
|
|
@@ -48397,7 +48453,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
48397
48453
|
rmSync7(tempDir, { recursive: true, force: true });
|
|
48398
48454
|
return 1;
|
|
48399
48455
|
}
|
|
48400
|
-
const finalDir =
|
|
48456
|
+
const finalDir = join24(versionsDir, installedVersion);
|
|
48401
48457
|
const finalEntryPath = entryPathInVersionDir(finalDir);
|
|
48402
48458
|
const finalFailure = sidecarInstallFailure(finalDir);
|
|
48403
48459
|
let backupDir = null;
|
|
@@ -48406,7 +48462,7 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
48406
48462
|
} else {
|
|
48407
48463
|
let shouldPublishTemp = true;
|
|
48408
48464
|
if (existsSync18(finalDir)) {
|
|
48409
|
-
backupDir =
|
|
48465
|
+
backupDir = join24(
|
|
48410
48466
|
versionsDir,
|
|
48411
48467
|
`.backup-${installedVersion}-${process.pid}-${Date.now()}`
|
|
48412
48468
|
);
|
|
@@ -48480,28 +48536,28 @@ async function runPythonSidecarUpdatePlan(plan) {
|
|
|
48480
48536
|
nodeBin: plan.nodeBin,
|
|
48481
48537
|
entryPath: finalEntryPath
|
|
48482
48538
|
});
|
|
48483
|
-
|
|
48484
|
-
|
|
48539
|
+
writeFileSync20(
|
|
48540
|
+
join24(plan.stateDir, ".version"),
|
|
48485
48541
|
`${installedVersion}
|
|
48486
48542
|
`,
|
|
48487
48543
|
"utf8"
|
|
48488
48544
|
);
|
|
48489
|
-
|
|
48490
|
-
|
|
48545
|
+
writeFileSync20(
|
|
48546
|
+
join24(plan.stateDir, ".install-method"),
|
|
48491
48547
|
"python-sidecar\n",
|
|
48492
48548
|
"utf8"
|
|
48493
48549
|
);
|
|
48494
|
-
|
|
48495
|
-
|
|
48550
|
+
writeFileSync20(
|
|
48551
|
+
join24(plan.stateDir, ".command-path"),
|
|
48496
48552
|
`${plan.sidecarPath}
|
|
48497
48553
|
`,
|
|
48498
48554
|
"utf8"
|
|
48499
48555
|
);
|
|
48500
|
-
|
|
48501
|
-
|
|
48556
|
+
writeFileSync20(join24(plan.stateDir, ".runner"), "node\n", "utf8");
|
|
48557
|
+
writeFileSync20(join24(plan.stateDir, ".node-bin"), `${plan.nodeBin}
|
|
48502
48558
|
`, "utf8");
|
|
48503
|
-
|
|
48504
|
-
|
|
48559
|
+
writeFileSync20(
|
|
48560
|
+
join24(plan.stateDir, ".entry-path"),
|
|
48505
48561
|
`${finalEntryPath}
|
|
48506
48562
|
`,
|
|
48507
48563
|
"utf8"
|
|
@@ -49212,7 +49268,7 @@ function collectEvent(value, previous = []) {
|
|
|
49212
49268
|
function collectNotificationTarget(value, previous = []) {
|
|
49213
49269
|
return [...previous, value];
|
|
49214
49270
|
}
|
|
49215
|
-
async function readNotificationConfigurationChange(source, read2 = (path, encoding) =>
|
|
49271
|
+
async function readNotificationConfigurationChange(source, read2 = (path, encoding) => readFileSync22(path, encoding)) {
|
|
49216
49272
|
const label = source === "-" ? "stdin" : source;
|
|
49217
49273
|
let text;
|
|
49218
49274
|
try {
|
|
@@ -49554,13 +49610,12 @@ import { Option as Option5 } from "commander";
|
|
|
49554
49610
|
import {
|
|
49555
49611
|
chmodSync,
|
|
49556
49612
|
existsSync as existsSync20,
|
|
49557
|
-
mkdirSync as mkdirSync17,
|
|
49558
49613
|
mkdtempSync,
|
|
49559
|
-
readFileSync as
|
|
49560
|
-
writeFileSync as
|
|
49614
|
+
readFileSync as readFileSync24,
|
|
49615
|
+
writeFileSync as writeFileSync23
|
|
49561
49616
|
} from "fs";
|
|
49562
49617
|
import { tmpdir as tmpdir5 } from "os";
|
|
49563
|
-
import {
|
|
49618
|
+
import { join as join27, resolve as resolve20 } from "path";
|
|
49564
49619
|
|
|
49565
49620
|
// src/cli/tool-call-recovery.ts
|
|
49566
49621
|
import { createHash as createHash7, randomUUID as randomUUID9 } from "crypto";
|
|
@@ -49585,12 +49640,12 @@ function stableStringify(value) {
|
|
|
49585
49640
|
import {
|
|
49586
49641
|
existsSync as existsSync19,
|
|
49587
49642
|
linkSync,
|
|
49588
|
-
mkdirSync as
|
|
49589
|
-
readFileSync as
|
|
49643
|
+
mkdirSync as mkdirSync16,
|
|
49644
|
+
readFileSync as readFileSync23,
|
|
49590
49645
|
unlinkSync as unlinkSync4,
|
|
49591
|
-
writeFileSync as
|
|
49646
|
+
writeFileSync as writeFileSync21
|
|
49592
49647
|
} from "fs";
|
|
49593
|
-
import { dirname as
|
|
49648
|
+
import { dirname as dirname19, join as join25 } from "path";
|
|
49594
49649
|
var ToolCallRecovery = class _ToolCallRecovery {
|
|
49595
49650
|
constructor(idempotencyKey, path) {
|
|
49596
49651
|
this.idempotencyKey = idempotencyKey;
|
|
@@ -49610,20 +49665,20 @@ var ToolCallRecovery = class _ToolCallRecovery {
|
|
|
49610
49665
|
function pendingToolExecutionPath(input2) {
|
|
49611
49666
|
const config = resolveConfig();
|
|
49612
49667
|
const fingerprint = createHash7("sha256").update(config.baseUrl).update("\0").update(createHash7("sha256").update(config.apiKey).digest("hex")).update("\0").update(input2.toolId).update("\0").update(stableStringify(input2.params)).update("\0").update(input2.responseIntent).digest("hex");
|
|
49613
|
-
return
|
|
49668
|
+
return join25(
|
|
49614
49669
|
sdkCliStateDirPath(config.baseUrl),
|
|
49615
49670
|
`pending-tool-execution-${fingerprint}.json`
|
|
49616
49671
|
);
|
|
49617
49672
|
}
|
|
49618
49673
|
function loadOrCreatePendingToolExecution(path) {
|
|
49619
|
-
|
|
49674
|
+
mkdirSync16(dirname19(path), { recursive: true });
|
|
49620
49675
|
if (existsSync19(path)) {
|
|
49621
49676
|
return readPendingToolExecution(path);
|
|
49622
49677
|
}
|
|
49623
49678
|
const idempotencyKey = randomUUID9();
|
|
49624
49679
|
const temporaryPath = `${path}.${process.pid}.${randomUUID9()}.tmp`;
|
|
49625
49680
|
try {
|
|
49626
|
-
|
|
49681
|
+
writeFileSync21(temporaryPath, `${JSON.stringify({ idempotencyKey })}
|
|
49627
49682
|
`, {
|
|
49628
49683
|
encoding: "utf8",
|
|
49629
49684
|
flag: "wx",
|
|
@@ -49639,7 +49694,7 @@ function loadOrCreatePendingToolExecution(path) {
|
|
|
49639
49694
|
}
|
|
49640
49695
|
}
|
|
49641
49696
|
function readPendingToolExecution(path) {
|
|
49642
|
-
const saved = JSON.parse(
|
|
49697
|
+
const saved = JSON.parse(readFileSync23(path, "utf8"));
|
|
49643
49698
|
if (typeof saved.idempotencyKey !== "string") {
|
|
49644
49699
|
throw new Error(
|
|
49645
49700
|
`Cannot resume the saved tool execution at ${path}: invalid recovery key.`
|
|
@@ -49675,13 +49730,13 @@ async function completePendingToolExecution(path, idempotencyKey) {
|
|
|
49675
49730
|
// src/tool-output.ts
|
|
49676
49731
|
import {
|
|
49677
49732
|
closeSync as closeSync3,
|
|
49678
|
-
mkdirSync as
|
|
49733
|
+
mkdirSync as mkdirSync17,
|
|
49679
49734
|
openSync as openSync3,
|
|
49680
|
-
writeFileSync as
|
|
49735
|
+
writeFileSync as writeFileSync22,
|
|
49681
49736
|
writeSync
|
|
49682
49737
|
} from "fs";
|
|
49683
49738
|
import { homedir as homedir12 } from "os";
|
|
49684
|
-
import { dirname as
|
|
49739
|
+
import { dirname as dirname20, join as join26 } from "path";
|
|
49685
49740
|
function isPlainObject(value) {
|
|
49686
49741
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
49687
49742
|
}
|
|
@@ -49808,19 +49863,19 @@ function projectRowOutput(conversion) {
|
|
|
49808
49863
|
};
|
|
49809
49864
|
}
|
|
49810
49865
|
function ensureOutputDir() {
|
|
49811
|
-
const outputDir =
|
|
49812
|
-
|
|
49866
|
+
const outputDir = join26(homedir12(), ".local", "share", "deepline", "data");
|
|
49867
|
+
mkdirSync17(outputDir, { recursive: true });
|
|
49813
49868
|
return outputDir;
|
|
49814
49869
|
}
|
|
49815
49870
|
function writeJsonOutputFile(payload, stem) {
|
|
49816
49871
|
const outputDir = ensureOutputDir();
|
|
49817
|
-
const outputPath =
|
|
49818
|
-
|
|
49872
|
+
const outputPath = join26(outputDir, `${stem}_${Date.now()}.json`);
|
|
49873
|
+
writeFileSync22(outputPath, JSON.stringify(payload, null, 2), "utf-8");
|
|
49819
49874
|
return outputPath;
|
|
49820
49875
|
}
|
|
49821
49876
|
function writeCsvOutputFile(rows, stem, options) {
|
|
49822
|
-
const outputPath = options?.outPath ? options.outPath :
|
|
49823
|
-
|
|
49877
|
+
const outputPath = options?.outPath ? options.outPath : join26(ensureOutputDir(), `${stem}_${Date.now()}.csv`);
|
|
49878
|
+
mkdirSync17(dirname20(outputPath), { recursive: true });
|
|
49824
49879
|
const columns = columnsForRows(rows);
|
|
49825
49880
|
const escapeCell = (value) => {
|
|
49826
49881
|
const normalized = value == null ? "" : typeof value === "string" || typeof value === "number" || typeof value === "boolean" ? String(value) : JSON.stringify(value);
|
|
@@ -50122,7 +50177,7 @@ function zeroMatchToolGuidance(options) {
|
|
|
50122
50177
|
...query ? [
|
|
50123
50178
|
{
|
|
50124
50179
|
label: "Use ranked semantic search for intent-style queries",
|
|
50125
|
-
command: `deepline
|
|
50180
|
+
command: `deepline search --type tools -- ${shellCommandArg(query)}`
|
|
50126
50181
|
},
|
|
50127
50182
|
...options.mode === "all" ? [
|
|
50128
50183
|
{
|
|
@@ -50138,7 +50193,7 @@ function zeroMatchToolGuidance(options) {
|
|
|
50138
50193
|
...query ? [
|
|
50139
50194
|
{
|
|
50140
50195
|
label: "Search composed Deepline plays separately",
|
|
50141
|
-
command: `deepline
|
|
50196
|
+
command: `deepline search --type prebuilts -- ${shellCommandArg(query)}`
|
|
50142
50197
|
}
|
|
50143
50198
|
] : []
|
|
50144
50199
|
];
|
|
@@ -50415,62 +50470,6 @@ async function listTools(category, options = {}) {
|
|
|
50415
50470
|
}
|
|
50416
50471
|
return listToolCategories(emitJson, compact);
|
|
50417
50472
|
}
|
|
50418
|
-
var SEARCH_REF_TTL_MS = 15 * 6e4;
|
|
50419
|
-
function lastSearchPath() {
|
|
50420
|
-
return join26(sdkCliStateDirPath(resolveConfig().baseUrl), "last-search.json");
|
|
50421
|
-
}
|
|
50422
|
-
function rememberSearchRef(searchRef) {
|
|
50423
|
-
try {
|
|
50424
|
-
mkdirSync17(dirname20(lastSearchPath()), { recursive: true });
|
|
50425
|
-
writeFileSync22(
|
|
50426
|
-
lastSearchPath(),
|
|
50427
|
-
JSON.stringify({ searchRef, at: Date.now() }),
|
|
50428
|
-
{ mode: 384 }
|
|
50429
|
-
);
|
|
50430
|
-
} catch {
|
|
50431
|
-
}
|
|
50432
|
-
}
|
|
50433
|
-
function recentSearchRef() {
|
|
50434
|
-
try {
|
|
50435
|
-
const saved = JSON.parse(readFileSync23(lastSearchPath(), "utf8"));
|
|
50436
|
-
return typeof saved.searchRef === "string" && typeof saved.at === "number" && Date.now() - saved.at < SEARCH_REF_TTL_MS ? saved.searchRef : void 0;
|
|
50437
|
-
} catch {
|
|
50438
|
-
return void 0;
|
|
50439
|
-
}
|
|
50440
|
-
}
|
|
50441
|
-
async function searchTools(queryInput, options = {}) {
|
|
50442
|
-
const query = queryInput?.trim() ?? "";
|
|
50443
|
-
const hasStructuredSearch = Boolean(
|
|
50444
|
-
options.categories?.trim() || options.searchTerms?.trim()
|
|
50445
|
-
);
|
|
50446
|
-
if (!query && !hasStructuredSearch) {
|
|
50447
|
-
console.error(
|
|
50448
|
-
"Usage: deepline tools search [query] --categories <categories> [--search_terms <terms>] [--json]"
|
|
50449
|
-
);
|
|
50450
|
-
return 1;
|
|
50451
|
-
}
|
|
50452
|
-
const client2 = new DeeplineClient();
|
|
50453
|
-
const { search_ref: searchRef, ...result } = await client2.searchTools({
|
|
50454
|
-
query,
|
|
50455
|
-
categories: options.categories,
|
|
50456
|
-
searchTerms: options.searchTerms,
|
|
50457
|
-
task: options.task,
|
|
50458
|
-
limit: options.limit,
|
|
50459
|
-
offset: options.offset,
|
|
50460
|
-
searchMode: options.searchMode,
|
|
50461
|
-
includeSearchDebug: options.includeSearchDebug
|
|
50462
|
-
});
|
|
50463
|
-
if (searchRef) rememberSearchRef(searchRef);
|
|
50464
|
-
const shouldCompact = options.compact || !options.json;
|
|
50465
|
-
const payload = shouldCompact && Array.isArray(result.tools) ? {
|
|
50466
|
-
...result,
|
|
50467
|
-
tools: result.tools.slice(0, 8).map(compactTool)
|
|
50468
|
-
} : result;
|
|
50469
|
-
printCommandEnvelope(payload, {
|
|
50470
|
-
json: options.json === true
|
|
50471
|
-
});
|
|
50472
|
-
return 0;
|
|
50473
|
-
}
|
|
50474
50473
|
async function grepTools(queryInput, options = {}) {
|
|
50475
50474
|
const query = queryInput.trim();
|
|
50476
50475
|
if (!query) {
|
|
@@ -50606,7 +50605,7 @@ function playReferenceForTool(tool) {
|
|
|
50606
50605
|
return null;
|
|
50607
50606
|
}
|
|
50608
50607
|
function playSearchCommandForToolId(toolId) {
|
|
50609
|
-
return `deepline
|
|
50608
|
+
return `deepline search --type prebuilts ${JSON.stringify(toolId.replace(/_/g, " "))} --json`;
|
|
50610
50609
|
}
|
|
50611
50610
|
function playRunCommandForTool(tool, toolId, input2) {
|
|
50612
50611
|
const playReference = playReferenceForTool(tool);
|
|
@@ -50620,7 +50619,7 @@ function playLikeToolExecuteErrorMessage(toolId, tool) {
|
|
|
50620
50619
|
return [
|
|
50621
50620
|
`${toolId} is a workflow/play entry, not an atomic provider tool.`,
|
|
50622
50621
|
nextStep,
|
|
50623
|
-
'Or search provider tools only with: deepline tools
|
|
50622
|
+
'Or search provider tools only with: deepline search --type tools "<query>" --json'
|
|
50624
50623
|
].join("\n");
|
|
50625
50624
|
}
|
|
50626
50625
|
function printPlayLikeToolExecuteError(toolId, tool) {
|
|
@@ -50637,7 +50636,7 @@ Concepts:
|
|
|
50637
50636
|
through the plays namespace.
|
|
50638
50637
|
|
|
50639
50638
|
Common commands:
|
|
50640
|
-
deepline tools
|
|
50639
|
+
deepline search --type tools email --json
|
|
50641
50640
|
deepline tools describe hunter_email_verifier --json
|
|
50642
50641
|
deepline tools describe hunter_email_verifier --pricing-only --json
|
|
50643
50642
|
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
@@ -50670,7 +50669,7 @@ Examples:
|
|
|
50670
50669
|
deepline tools list email_finder
|
|
50671
50670
|
deepline tools list email_finder --json
|
|
50672
50671
|
deepline tools list --categories email_finder --json
|
|
50673
|
-
deepline tools
|
|
50672
|
+
deepline search --type tools email --json
|
|
50674
50673
|
`
|
|
50675
50674
|
).option(
|
|
50676
50675
|
"--categories <categories>",
|
|
@@ -50682,58 +50681,7 @@ Examples:
|
|
|
50682
50681
|
json: Boolean(options.json)
|
|
50683
50682
|
});
|
|
50684
50683
|
});
|
|
50685
|
-
|
|
50686
|
-
"Search available tools by intent query or structured filters."
|
|
50687
|
-
).addHelpText(
|
|
50688
|
-
"after",
|
|
50689
|
-
`
|
|
50690
|
-
Notes:
|
|
50691
|
-
Ranked discovery for atomic provider/API operations. Results include tool ids
|
|
50692
|
-
that can be passed to deepline tools describe or deepline tools execute.
|
|
50693
|
-
Provide a query, or omit it only when --categories and/or --search_terms is
|
|
50694
|
-
supplied. Providing neither is a usage error. Both filters accept
|
|
50695
|
-
comma-separated values. Use --limit and --offset to page through ranked
|
|
50696
|
-
results (limit 1-50, offset is zero-based); JSON includes next_offset.
|
|
50697
|
-
Pass --task with one sentence on what you are trying to accomplish right
|
|
50698
|
-
now: the input you have and the result you need, not a restatement of the
|
|
50699
|
-
query. It materially improves ranking, especially for short queries.
|
|
50700
|
-
Use a provider name in the query; --prefix is not a supported option.
|
|
50701
|
-
The grep alias is the same ranked retrieval surface with a more literal name
|
|
50702
|
-
for agents that are filtering a registry rather than choosing a workflow.
|
|
50703
|
-
Search prints a readable result list by default, piped or not, and that is
|
|
50704
|
-
the recommended form. Pass --json only when a program parses the result.
|
|
50705
|
-
|
|
50706
|
-
Examples:
|
|
50707
|
-
deepline tools search email --limit 10
|
|
50708
|
-
deepline tools search email --limit 10 --offset 10
|
|
50709
|
-
deepline tools search linkedin --task "I have 200 LinkedIn profile URLs and need each person's current title and company"
|
|
50710
|
-
deepline tools search --categories company_search --search_terms "investors,funding"
|
|
50711
|
-
deepline tools grep "company enrichment" --categories enrichment --json
|
|
50712
|
-
deepline tools search verifier --search-mode v2 --json
|
|
50713
|
-
`
|
|
50714
|
-
).option(
|
|
50715
|
-
"--categories <categories>",
|
|
50716
|
-
"Comma-separated categories; may be used without a query"
|
|
50717
|
-
).option(
|
|
50718
|
-
"--search_terms <terms>",
|
|
50719
|
-
"Comma-separated structured search terms; may be used without a query"
|
|
50720
|
-
).option("--search-terms <terms>", "Alias for --search_terms").option(
|
|
50721
|
-
"--task <sentence>",
|
|
50722
|
-
"What you are trying to accomplish: input you have -> result you need"
|
|
50723
|
-
).option("--limit <count>", "Maximum ranked results to return (1-50)").option("--offset <count>", "Zero-based ranked result offset").option("--search-mode <mode>", "Ranked search mode: v1 or v2").option("--include-search-debug", "Include ranked search debug metadata").option("--compact", "Drop verbose fields from JSON output").option("--json", "Emit JSON output instead of the readable default").action(async (query, options) => {
|
|
50724
|
-
process.exitCode = await searchTools(query, {
|
|
50725
|
-
json: options.json,
|
|
50726
|
-
compact: options.compact,
|
|
50727
|
-
limit: options.limit !== void 0 ? Number.parseInt(options.limit, 10) : void 0,
|
|
50728
|
-
offset: options.offset !== void 0 ? Number.parseInt(options.offset, 10) : void 0,
|
|
50729
|
-
categories: options.categories,
|
|
50730
|
-
searchTerms: options.searchTerms ?? options.search_terms,
|
|
50731
|
-
task: options.task,
|
|
50732
|
-
searchMode: options.searchMode === "v1" || options.searchMode === "v2" ? options.searchMode : void 0,
|
|
50733
|
-
includeSearchDebug: Boolean(options.includeSearchDebug)
|
|
50734
|
-
});
|
|
50735
|
-
});
|
|
50736
|
-
addToolSearchCommand(tools.command("search [query]"));
|
|
50684
|
+
registerDeprecatedSearchCommand(tools, () => ["tools", "monitors"]);
|
|
50737
50685
|
tools.command("grep <query>").description(
|
|
50738
50686
|
"Literal grep over tool ids, descriptions, categories, and input fields."
|
|
50739
50687
|
).addHelpText(
|
|
@@ -52139,7 +52087,7 @@ function readJsonArgument(raw, flagName) {
|
|
|
52139
52087
|
throw new Error(`Invalid ${flagName} value: empty @file path.`);
|
|
52140
52088
|
}
|
|
52141
52089
|
try {
|
|
52142
|
-
return
|
|
52090
|
+
return readFileSync24(resolveAtFilePath(filePath), "utf8").replace(
|
|
52143
52091
|
/^\uFEFF/,
|
|
52144
52092
|
""
|
|
52145
52093
|
);
|
|
@@ -52298,9 +52246,9 @@ function starterScriptJson(script) {
|
|
|
52298
52246
|
function seedToolListScript(input2) {
|
|
52299
52247
|
const stem = safeFileStem(input2.toolId);
|
|
52300
52248
|
const fileName = `${stem}-workflow-seed-${Date.now()}.play.ts`;
|
|
52301
|
-
const scriptDir = mkdtempSync(
|
|
52249
|
+
const scriptDir = mkdtempSync(join27(tmpdir5(), "deepline-workflow-seed-"));
|
|
52302
52250
|
chmodSync(scriptDir, 448);
|
|
52303
|
-
const scriptPath =
|
|
52251
|
+
const scriptPath = join27(scriptDir, fileName);
|
|
52304
52252
|
const projectDir = `deepline/projects/${stem}-workflow`;
|
|
52305
52253
|
const playName = `${stem}-workflow`;
|
|
52306
52254
|
const sampleRows = input2.rows.length > 0 ? `${JSON.stringify(input2.rows.slice(0, 2)).replace(/\]$/, "")}, ...]` : "[]";
|
|
@@ -52343,7 +52291,7 @@ export default definePlay(${JSON.stringify(playName)}, async (ctx) => {
|
|
|
52343
52291
|
description: ${JSON.stringify(`Seed ${input2.toolId} rows into a Deepline workflow-ready dataset.`)},
|
|
52344
52292
|
});
|
|
52345
52293
|
`;
|
|
52346
|
-
|
|
52294
|
+
writeFileSync23(scriptPath, script, { encoding: "utf-8", mode: 384 });
|
|
52347
52295
|
return {
|
|
52348
52296
|
path: scriptPath,
|
|
52349
52297
|
sourceCode: script,
|
|
@@ -52813,7 +52761,7 @@ Examples:
|
|
|
52813
52761
|
|
|
52814
52762
|
// src/cli/commands/workflow.ts
|
|
52815
52763
|
import { mkdir as mkdir5, readFile as readFile7, writeFile as writeFile5 } from "fs/promises";
|
|
52816
|
-
import { dirname as
|
|
52764
|
+
import { dirname as dirname22, join as join28, resolve as resolve21 } from "path";
|
|
52817
52765
|
|
|
52818
52766
|
// src/cli/workflow-to-play.ts
|
|
52819
52767
|
import { createHash as createHash8 } from "crypto";
|
|
@@ -54457,8 +54405,8 @@ async function transformOne(api, workflowId, outDir, publish) {
|
|
|
54457
54405
|
revision.config,
|
|
54458
54406
|
{ workflowName: workflow.name, version: revision.version }
|
|
54459
54407
|
);
|
|
54460
|
-
const file =
|
|
54461
|
-
await mkdir5(
|
|
54408
|
+
const file = join28(resolve21(outDir), `${compiled.playName}.play.ts`);
|
|
54409
|
+
await mkdir5(dirname22(file), { recursive: true });
|
|
54462
54410
|
await writeFile5(file, compiled.sourceCode, "utf8");
|
|
54463
54411
|
let published = false;
|
|
54464
54412
|
if (publish) {
|
|
@@ -54719,6 +54667,7 @@ Notes:
|
|
|
54719
54667
|
function registerDeeplineCommandGroups(program) {
|
|
54720
54668
|
registerAuthCommands(program);
|
|
54721
54669
|
registerProviderCommands(program);
|
|
54670
|
+
registerSearchCommand(program);
|
|
54722
54671
|
registerToolsCommands(program);
|
|
54723
54672
|
registerExecutionsCommands(program);
|
|
54724
54673
|
registerPlayCommands(program);
|
|
@@ -54969,10 +54918,11 @@ function shouldDeferSkillsSyncForCommand() {
|
|
|
54969
54918
|
const args = process.argv.slice(2);
|
|
54970
54919
|
const command = args[0];
|
|
54971
54920
|
const subcommand = args[1];
|
|
54972
|
-
if (command === "tools" && ["list", "
|
|
54921
|
+
if (command === "tools" && ["list", "grep", "describe", "get"].includes(subcommand ?? "")) {
|
|
54973
54922
|
return true;
|
|
54974
54923
|
}
|
|
54975
54924
|
if (command === "providers" && subcommand === "list") return true;
|
|
54925
|
+
if (command === "search") return true;
|
|
54976
54926
|
return (command === "play" || command === "plays") && subcommand === "run" && args.includes("--json");
|
|
54977
54927
|
}
|
|
54978
54928
|
function isDeprecatedCommandInvocation() {
|
|
@@ -55003,8 +54953,8 @@ function topLevelCommandKnown(program, commandName) {
|
|
|
55003
54953
|
);
|
|
55004
54954
|
}
|
|
55005
54955
|
async function runPlayRunnerHealthCheck() {
|
|
55006
|
-
const dir = await mkdtemp3(
|
|
55007
|
-
const file =
|
|
54956
|
+
const dir = await mkdtemp3(join29(tmpdir6(), "deepline-health-play-"));
|
|
54957
|
+
const file = join29(dir, "health-check.play.ts");
|
|
55008
54958
|
try {
|
|
55009
54959
|
await writeFile6(
|
|
55010
54960
|
file,
|
|
@@ -55225,7 +55175,7 @@ Common commands:
|
|
|
55225
55175
|
deepline health
|
|
55226
55176
|
deepline auth status --json
|
|
55227
55177
|
deepline sessions send --current-session --json
|
|
55228
|
-
deepline
|
|
55178
|
+
deepline search --type prebuilts email --json
|
|
55229
55179
|
deepline plays describe prebuilt/person-linkedin-to-email --json
|
|
55230
55180
|
deepline plays run my.play.ts --input '{"domain":"stripe.com"}'
|
|
55231
55181
|
deepline secrets check HUBSPOT_TOKEN
|