deepline 0.1.27 → 0.1.28
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/README.md +6 -1
- package/dist/cli/index.js +171 -47
- package/dist/cli/index.mjs +169 -45
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.mjs +1 -1
- package/dist/repo/sdk/src/version.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ Config resolution order: explicit options > env vars > checkout `.env.worktree`
|
|
|
60
60
|
```bash
|
|
61
61
|
bun sdk/bin/deepline-dev.ts health
|
|
62
62
|
bun sdk/bin/deepline-dev.ts auth register|status
|
|
63
|
-
bun sdk/bin/deepline-dev.ts tools list|
|
|
63
|
+
bun sdk/bin/deepline-dev.ts tools list|describe|execute
|
|
64
64
|
bun sdk/bin/deepline-dev.ts plays run <file.play.ts> [--input '{}'] [--<input> value] [--watch]
|
|
65
65
|
bun sdk/bin/deepline-dev.ts plays run <name> [--input '{}'] [--<input> value] [--watch]
|
|
66
66
|
bun sdk/bin/deepline-dev.ts plays get <file.play.ts|name> [--json]
|
|
@@ -70,8 +70,13 @@ bun sdk/bin/deepline-dev.ts runs get <run-id> [--json]
|
|
|
70
70
|
bun sdk/bin/deepline-dev.ts runs tail <run-id> [--json]
|
|
71
71
|
bun sdk/bin/deepline-dev.ts runs stop <run-id> [--reason "..."] [--json]
|
|
72
72
|
bun sdk/bin/deepline-dev.ts plays publish <play-file.ts|name> [--latest|--revision-id <id>] [--json]
|
|
73
|
+
bun sdk/bin/deepline-dev.ts update
|
|
73
74
|
```
|
|
74
75
|
|
|
76
|
+
`tools describe` and `tools execute` are canonical. `tools get` and `tools run`
|
|
77
|
+
remain compatibility aliases. Unknown `plays run` flags such as
|
|
78
|
+
`--csv leads.csv` or `--limit 5` are passed into the play input object.
|
|
79
|
+
|
|
75
80
|
## Public play entrypoints
|
|
76
81
|
|
|
77
82
|
These are the public ways to run plays. They intentionally map to the external
|
package/dist/cli/index.js
CHANGED
|
@@ -266,7 +266,7 @@ function saveProjectDeeplineEnvValues(baseUrl, values, startDir = projectEnvStar
|
|
|
266
266
|
}
|
|
267
267
|
|
|
268
268
|
// src/version.ts
|
|
269
|
-
var SDK_VERSION = "0.1.
|
|
269
|
+
var SDK_VERSION = "0.1.28";
|
|
270
270
|
var SDK_API_CONTRACT = "2026-05-runs-v2";
|
|
271
271
|
|
|
272
272
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
@@ -548,7 +548,7 @@ function decodeSseFrame(frame) {
|
|
|
548
548
|
return parsed;
|
|
549
549
|
}
|
|
550
550
|
function sleep(ms) {
|
|
551
|
-
return new Promise((
|
|
551
|
+
return new Promise((resolve10) => setTimeout(resolve10, ms));
|
|
552
552
|
}
|
|
553
553
|
|
|
554
554
|
// src/client.ts
|
|
@@ -556,7 +556,7 @@ var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "ca
|
|
|
556
556
|
var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
|
|
557
557
|
var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
|
|
558
558
|
function sleep2(ms) {
|
|
559
|
-
return new Promise((
|
|
559
|
+
return new Promise((resolve10) => setTimeout(resolve10, ms));
|
|
560
560
|
}
|
|
561
561
|
function isTransientCompileManifestError(error) {
|
|
562
562
|
if (error instanceof DeeplineError && typeof error.statusCode === "number") {
|
|
@@ -714,7 +714,7 @@ var DeeplineClient = class {
|
|
|
714
714
|
play.outputSchema,
|
|
715
715
|
"rowOutputSchema"
|
|
716
716
|
);
|
|
717
|
-
const
|
|
717
|
+
const runCommand2 = this.playRunCommand(play, { csvInput });
|
|
718
718
|
return {
|
|
719
719
|
name: play.name,
|
|
720
720
|
...play.reference ? { reference: play.reference } : {},
|
|
@@ -728,8 +728,8 @@ var DeeplineClient = class {
|
|
|
728
728
|
outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
|
|
729
729
|
...csvInput ? { csvInput } : {},
|
|
730
730
|
...rowOutputSchema ? { rowOutputSchema } : {},
|
|
731
|
-
runCommand,
|
|
732
|
-
examples: [
|
|
731
|
+
runCommand: runCommand2,
|
|
732
|
+
examples: [runCommand2],
|
|
733
733
|
currentPublishedVersion: play.currentPublishedVersion ?? null,
|
|
734
734
|
isDraftDirty: play.isDraftDirty
|
|
735
735
|
};
|
|
@@ -2041,7 +2041,7 @@ function buildCandidateUrls2(url) {
|
|
|
2041
2041
|
}
|
|
2042
2042
|
}
|
|
2043
2043
|
function sleep3(ms) {
|
|
2044
|
-
return new Promise((
|
|
2044
|
+
return new Promise((resolve10) => setTimeout(resolve10, ms));
|
|
2045
2045
|
}
|
|
2046
2046
|
function printDeeplineLogo() {
|
|
2047
2047
|
if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
|
|
@@ -6477,7 +6477,7 @@ function writeStartedPlayRun(input) {
|
|
|
6477
6477
|
console.log(output);
|
|
6478
6478
|
}
|
|
6479
6479
|
function parsePlayRunOptions(args) {
|
|
6480
|
-
const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--live|--latest|--revision-id <id>] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--no-open] [--json] [--<input> value]\nRun `deepline plays run --help` for idempotency, tool call id, and ctx.map guidance.";
|
|
6480
|
+
const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--live|--latest|--revision-id <id>] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--no-open] [--json] [--<input> value]\n Unknown --<input> value flags, such as --csv leads.csv or --limit 5, are passed into play input.\nRun `deepline plays run --help` for idempotency, tool call id, and ctx.map guidance.";
|
|
6481
6481
|
let filePath = null;
|
|
6482
6482
|
let playName = null;
|
|
6483
6483
|
let input = null;
|
|
@@ -7689,7 +7689,9 @@ Examples:
|
|
|
7689
7689
|
Notes:
|
|
7690
7690
|
Local files are bundled, preflighted, then run in Deepline cloud.
|
|
7691
7691
|
Named plays run the live saved revision.
|
|
7692
|
-
Unknown --foo and --foo.bar flags are
|
|
7692
|
+
Unknown --foo value and --foo.bar value flags are passed into play input.
|
|
7693
|
+
Example: --csv leads.csv becomes input.csv = "leads.csv"; --limit 5 becomes
|
|
7694
|
+
input.limit = 5.
|
|
7693
7695
|
File args accept local paths; the CLI stages files before submit.
|
|
7694
7696
|
--watch prints logs, previews, stats, and next commands.
|
|
7695
7697
|
--wait is accepted as a compatibility alias for --watch.
|
|
@@ -7736,7 +7738,15 @@ Examples:
|
|
|
7736
7738
|
).option("--watch", "Stream logs until completion").option("--wait", "Alias for --watch; stream logs until completion").option(
|
|
7737
7739
|
"--logs",
|
|
7738
7740
|
"When output is non-interactive, stream play logs to stderr while waiting"
|
|
7739
|
-
).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Supersede any active runs for this play").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").
|
|
7741
|
+
).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Supersede any active runs for this play").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").addHelpText(
|
|
7742
|
+
"afterAll",
|
|
7743
|
+
`
|
|
7744
|
+
Pass-through input flags:
|
|
7745
|
+
Unknown flags are accepted intentionally and become play input fields. Use
|
|
7746
|
+
this for play-specific inputs like --csv leads.csv, --limit 5, or
|
|
7747
|
+
--filters.title "GTM Engineer".
|
|
7748
|
+
`
|
|
7749
|
+
).action(async (target, options, command) => {
|
|
7740
7750
|
const passthroughArgs = [...command.args];
|
|
7741
7751
|
const explicitTarget = options.file || options.name;
|
|
7742
7752
|
const targetIsInputFlag = typeof target === "string" && target.startsWith("--");
|
|
@@ -8199,7 +8209,7 @@ function toListedTool(tool) {
|
|
|
8199
8209
|
...tool,
|
|
8200
8210
|
id: tool.toolId,
|
|
8201
8211
|
type: "tool",
|
|
8202
|
-
|
|
8212
|
+
executeCommand: `deepline tools execute ${tool.toolId}`
|
|
8203
8213
|
};
|
|
8204
8214
|
}
|
|
8205
8215
|
async function listTools(args) {
|
|
@@ -8272,7 +8282,7 @@ Inspect its schema with: deepline plays describe ${playName} --json`
|
|
|
8272
8282
|
);
|
|
8273
8283
|
}
|
|
8274
8284
|
function registerToolsCommands(program) {
|
|
8275
|
-
const tools = program.command("tools").description("Search, describe, and
|
|
8285
|
+
const tools = program.command("tools").description("Search, describe, and execute atomic provider tools.").addHelpText(
|
|
8276
8286
|
"after",
|
|
8277
8287
|
`
|
|
8278
8288
|
Concepts:
|
|
@@ -8282,11 +8292,11 @@ Concepts:
|
|
|
8282
8292
|
Common commands:
|
|
8283
8293
|
deepline tools search email --json
|
|
8284
8294
|
deepline tools describe hunter_email_verifier --json
|
|
8285
|
-
deepline tools
|
|
8295
|
+
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
8286
8296
|
|
|
8287
8297
|
Output:
|
|
8288
|
-
|
|
8289
|
-
|
|
8298
|
+
Use describe for tool contracts. get is accepted as a compatibility alias.
|
|
8299
|
+
Use execute to run a tool. run is accepted as a compatibility alias.
|
|
8290
8300
|
`
|
|
8291
8301
|
);
|
|
8292
8302
|
tools.command("list").description("List available tools.").addHelpText(
|
|
@@ -8311,7 +8321,7 @@ Examples:
|
|
|
8311
8321
|
`
|
|
8312
8322
|
Notes:
|
|
8313
8323
|
Ranked discovery for atomic provider/API operations. Results include tool ids
|
|
8314
|
-
that can be passed to deepline tools describe or deepline tools
|
|
8324
|
+
that can be passed to deepline tools describe or deepline tools execute.
|
|
8315
8325
|
|
|
8316
8326
|
Examples:
|
|
8317
8327
|
deepline tools search email
|
|
@@ -8327,18 +8337,18 @@ Examples:
|
|
|
8327
8337
|
includeSearchDebug: Boolean(options.includeSearchDebug)
|
|
8328
8338
|
});
|
|
8329
8339
|
});
|
|
8330
|
-
const addToolMetadataCommand = (command
|
|
8340
|
+
const addToolMetadataCommand = (command) => command.description("Show metadata for a tool.").addHelpText(
|
|
8331
8341
|
"after",
|
|
8332
8342
|
`
|
|
8333
8343
|
Notes:
|
|
8334
8344
|
Shows the tool contract, input schema, output schema, Deepline cost, aliases,
|
|
8335
|
-
and metadata. describe is the preferred discovery verb
|
|
8336
|
-
compatibility
|
|
8345
|
+
and metadata. describe is the preferred discovery verb. get is kept as a
|
|
8346
|
+
compatibility alias for the same metadata surface.
|
|
8337
8347
|
|
|
8338
8348
|
Examples:
|
|
8339
|
-
deepline tools
|
|
8340
|
-
deepline tools
|
|
8341
|
-
deepline tools
|
|
8349
|
+
deepline tools describe hunter_email_verifier
|
|
8350
|
+
deepline tools describe hunter_email_verifier --json | jq '.inputSchema'
|
|
8351
|
+
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
8342
8352
|
`
|
|
8343
8353
|
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (toolId, options) => {
|
|
8344
8354
|
process.exitCode = await getTool([
|
|
@@ -8346,21 +8356,21 @@ Examples:
|
|
|
8346
8356
|
...options.json ? ["--json"] : []
|
|
8347
8357
|
]);
|
|
8348
8358
|
});
|
|
8349
|
-
addToolMetadataCommand(tools.command("describe <toolId>")
|
|
8350
|
-
|
|
8351
|
-
tools.command("call <toolId>").alias("execute").alias("run").description("Execute a tool by id.").addHelpText(
|
|
8359
|
+
addToolMetadataCommand(tools.command("describe <toolId>").alias("get"));
|
|
8360
|
+
tools.command("execute <toolId>").alias("run").description("Execute a tool by id.").addHelpText(
|
|
8352
8361
|
"after",
|
|
8353
8362
|
`
|
|
8354
8363
|
Notes:
|
|
8355
8364
|
Use tools for one atomic provider/API operation. Use plays for composed workflows,
|
|
8356
8365
|
waterfalls, row maps, checkpoints, and retries.
|
|
8366
|
+
execute is the canonical execution verb. run is a compatibility alias.
|
|
8357
8367
|
Calling a provider-backed tool can spend Deepline credits. Use --json for the
|
|
8358
8368
|
stable result payload and --full-output when debugging response metadata.
|
|
8359
8369
|
|
|
8360
8370
|
Examples:
|
|
8361
|
-
deepline tools
|
|
8362
|
-
deepline tools
|
|
8363
|
-
deepline tools
|
|
8371
|
+
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
8372
|
+
deepline tools execute hunter_email_verifier -p email=a@b.com
|
|
8373
|
+
deepline tools execute test_rate_limit --input '{"key":"smoke"}' --json | jq '.status'
|
|
8364
8374
|
`
|
|
8365
8375
|
).option("-p, --param <key=value>", "Pass one parameter. Repeat for multiple values.", (value, acc) => {
|
|
8366
8376
|
acc.push(value);
|
|
@@ -8649,7 +8659,7 @@ function normalizeOutputFormat(raw) {
|
|
|
8649
8659
|
function parseExecuteOptions(args) {
|
|
8650
8660
|
const toolId = args[0];
|
|
8651
8661
|
if (!toolId) {
|
|
8652
|
-
throw new Error(`Usage: deepline tools
|
|
8662
|
+
throw new Error(`Usage: deepline tools execute <toolId> [--param key=value ...] [--input '{"k":"v"}'] [--output-format auto|csv|csv_file|json|json_file] [--full-output] [--no-preview]`);
|
|
8653
8663
|
}
|
|
8654
8664
|
const params = {};
|
|
8655
8665
|
let outputFormat = "auto";
|
|
@@ -8843,11 +8853,123 @@ async function executeTool(args) {
|
|
|
8843
8853
|
return 0;
|
|
8844
8854
|
}
|
|
8845
8855
|
|
|
8846
|
-
// src/cli/
|
|
8856
|
+
// src/cli/commands/update.ts
|
|
8847
8857
|
var import_node_child_process2 = require("child_process");
|
|
8848
8858
|
var import_node_fs10 = require("fs");
|
|
8849
|
-
var import_node_os8 = require("os");
|
|
8850
8859
|
var import_node_path12 = require("path");
|
|
8860
|
+
function posixShellQuote(value) {
|
|
8861
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
8862
|
+
}
|
|
8863
|
+
function windowsCmdQuote(value) {
|
|
8864
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
8865
|
+
}
|
|
8866
|
+
function shellQuote2(value) {
|
|
8867
|
+
if (process.platform === "win32") {
|
|
8868
|
+
return /^[A-Za-z0-9_./:@%+=,-]+$/.test(value) ? value : windowsCmdQuote(value);
|
|
8869
|
+
}
|
|
8870
|
+
return posixShellQuote(value);
|
|
8871
|
+
}
|
|
8872
|
+
function buildSourceUpdateCommand(sourceRoot) {
|
|
8873
|
+
const quotedRoot = shellQuote2(sourceRoot);
|
|
8874
|
+
const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
|
|
8875
|
+
return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
|
|
8876
|
+
}
|
|
8877
|
+
function findRepoBackedSdkRoot(startPath) {
|
|
8878
|
+
let current = (0, import_node_path12.resolve)(startPath);
|
|
8879
|
+
while (true) {
|
|
8880
|
+
if ((0, import_node_fs10.existsSync)((0, import_node_path12.join)(current, "sdk", "package.json")) && (0, import_node_fs10.existsSync)((0, import_node_path12.join)(current, "sdk", "bin", "deepline-dev.ts"))) {
|
|
8881
|
+
return current;
|
|
8882
|
+
}
|
|
8883
|
+
const parent = (0, import_node_path12.dirname)(current);
|
|
8884
|
+
if (parent === current) return null;
|
|
8885
|
+
current = parent;
|
|
8886
|
+
}
|
|
8887
|
+
}
|
|
8888
|
+
function resolveUpdatePlan() {
|
|
8889
|
+
const entrypoint = process.argv[1] ? (0, import_node_path12.resolve)(process.argv[1]) : "";
|
|
8890
|
+
const sourceRoot = entrypoint ? findRepoBackedSdkRoot((0, import_node_path12.dirname)(entrypoint)) : null;
|
|
8891
|
+
if (sourceRoot) {
|
|
8892
|
+
return {
|
|
8893
|
+
kind: "source",
|
|
8894
|
+
repoRoot: sourceRoot,
|
|
8895
|
+
manualCommand: buildSourceUpdateCommand(sourceRoot)
|
|
8896
|
+
};
|
|
8897
|
+
}
|
|
8898
|
+
const command = "npm";
|
|
8899
|
+
const args = ["install", "-g", "deepline@latest"];
|
|
8900
|
+
return {
|
|
8901
|
+
kind: "npm-global",
|
|
8902
|
+
command,
|
|
8903
|
+
args,
|
|
8904
|
+
manualCommand: `${command} ${args.map(shellQuote2).join(" ")}`
|
|
8905
|
+
};
|
|
8906
|
+
}
|
|
8907
|
+
function runCommand(command, args) {
|
|
8908
|
+
return new Promise((resolveExitCode) => {
|
|
8909
|
+
const child = (0, import_node_child_process2.spawn)(command, args, {
|
|
8910
|
+
stdio: "inherit",
|
|
8911
|
+
shell: process.platform === "win32",
|
|
8912
|
+
env: process.env
|
|
8913
|
+
});
|
|
8914
|
+
child.on("error", (error) => {
|
|
8915
|
+
process.stderr.write(`Failed to start ${command}: ${error.message}
|
|
8916
|
+
`);
|
|
8917
|
+
resolveExitCode(1);
|
|
8918
|
+
});
|
|
8919
|
+
child.on("close", (code) => {
|
|
8920
|
+
resolveExitCode(code ?? 1);
|
|
8921
|
+
});
|
|
8922
|
+
});
|
|
8923
|
+
}
|
|
8924
|
+
async function handleUpdate(options) {
|
|
8925
|
+
const plan = resolveUpdatePlan();
|
|
8926
|
+
if (options.json) {
|
|
8927
|
+
process.stdout.write(`${JSON.stringify(plan)}
|
|
8928
|
+
`);
|
|
8929
|
+
return 0;
|
|
8930
|
+
}
|
|
8931
|
+
if (options.printCommand) {
|
|
8932
|
+
process.stdout.write(`${plan.manualCommand}
|
|
8933
|
+
`);
|
|
8934
|
+
return 0;
|
|
8935
|
+
}
|
|
8936
|
+
if (plan.kind === "source") {
|
|
8937
|
+
process.stdout.write(
|
|
8938
|
+
`This Deepline CLI is running from SDK source, so it cannot safely update itself like an npm global.
|
|
8939
|
+
Update the backing checkout with:
|
|
8940
|
+
${plan.manualCommand}
|
|
8941
|
+
`
|
|
8942
|
+
);
|
|
8943
|
+
return 0;
|
|
8944
|
+
}
|
|
8945
|
+
process.stderr.write(`Updating Deepline SDK/CLI with: ${plan.manualCommand}
|
|
8946
|
+
`);
|
|
8947
|
+
return runCommand(plan.command, plan.args);
|
|
8948
|
+
}
|
|
8949
|
+
function registerUpdateCommand(program) {
|
|
8950
|
+
program.command("update").alias("upgrade").description("Update the Deepline SDK/CLI.").addHelpText(
|
|
8951
|
+
"after",
|
|
8952
|
+
`
|
|
8953
|
+
Notes:
|
|
8954
|
+
For the published npm CLI, this runs npm install -g deepline@latest.
|
|
8955
|
+
For repo-backed SDK wrappers such as cli-env sdk-prod or sdk-worktree, this
|
|
8956
|
+
prints the exact git command to update the checkout that provides the CLI.
|
|
8957
|
+
|
|
8958
|
+
Examples:
|
|
8959
|
+
deepline update
|
|
8960
|
+
deepline update --print-command
|
|
8961
|
+
deepline update --json
|
|
8962
|
+
`
|
|
8963
|
+
).option("--print-command", "Print the update command without running it").option("--json", "Emit the resolved update plan as JSON").action(async (options) => {
|
|
8964
|
+
process.exitCode = await handleUpdate(options);
|
|
8965
|
+
});
|
|
8966
|
+
}
|
|
8967
|
+
|
|
8968
|
+
// src/cli/skills-sync.ts
|
|
8969
|
+
var import_node_child_process3 = require("child_process");
|
|
8970
|
+
var import_node_fs11 = require("fs");
|
|
8971
|
+
var import_node_os8 = require("os");
|
|
8972
|
+
var import_node_path13 = require("path");
|
|
8851
8973
|
var CHECK_TIMEOUT_MS2 = 3e3;
|
|
8852
8974
|
var SDK_SKILL_NAME = "deepline-sdk";
|
|
8853
8975
|
var SKILL_AGENTS = ["codex", "claude-code", "cursor"];
|
|
@@ -8858,21 +8980,21 @@ function shouldSkipSkillsSync() {
|
|
|
8858
8980
|
}
|
|
8859
8981
|
function sdkSkillsVersionPath(baseUrl) {
|
|
8860
8982
|
const home = process.env.HOME?.trim() || (0, import_node_os8.homedir)();
|
|
8861
|
-
return (0,
|
|
8983
|
+
return (0, import_node_path13.join)(home, ".local", "deepline", baseUrlSlug(baseUrl), "sdk-skills", ".version");
|
|
8862
8984
|
}
|
|
8863
8985
|
function readLocalSkillsVersion(baseUrl) {
|
|
8864
8986
|
const path = sdkSkillsVersionPath(baseUrl);
|
|
8865
|
-
if (!(0,
|
|
8987
|
+
if (!(0, import_node_fs11.existsSync)(path)) return "";
|
|
8866
8988
|
try {
|
|
8867
|
-
return (0,
|
|
8989
|
+
return (0, import_node_fs11.readFileSync)(path, "utf-8").trim();
|
|
8868
8990
|
} catch {
|
|
8869
8991
|
return "";
|
|
8870
8992
|
}
|
|
8871
8993
|
}
|
|
8872
8994
|
function writeLocalSkillsVersion(baseUrl, version) {
|
|
8873
8995
|
const path = sdkSkillsVersionPath(baseUrl);
|
|
8874
|
-
(0,
|
|
8875
|
-
(0,
|
|
8996
|
+
(0, import_node_fs11.mkdirSync)((0, import_node_path13.dirname)(path), { recursive: true });
|
|
8997
|
+
(0, import_node_fs11.writeFileSync)(path, `${version}
|
|
8876
8998
|
`, "utf-8");
|
|
8877
8999
|
}
|
|
8878
9000
|
async function fetchSkillsUpdate(baseUrl, localVersion) {
|
|
@@ -8936,13 +9058,13 @@ function buildBunxSkillsInstallArgs(baseUrl) {
|
|
|
8936
9058
|
];
|
|
8937
9059
|
}
|
|
8938
9060
|
function hasCommand(command) {
|
|
8939
|
-
const result = (0,
|
|
9061
|
+
const result = (0, import_node_child_process3.spawnSync)(command, ["--version"], {
|
|
8940
9062
|
stdio: "ignore",
|
|
8941
9063
|
shell: process.platform === "win32"
|
|
8942
9064
|
});
|
|
8943
9065
|
return result.status === 0;
|
|
8944
9066
|
}
|
|
8945
|
-
function
|
|
9067
|
+
function shellQuote3(arg) {
|
|
8946
9068
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
8947
9069
|
}
|
|
8948
9070
|
function resolveSkillsInstallCommands(baseUrl) {
|
|
@@ -8950,7 +9072,7 @@ function resolveSkillsInstallCommands(baseUrl) {
|
|
|
8950
9072
|
const npxInstall = {
|
|
8951
9073
|
command: "npx",
|
|
8952
9074
|
args: npxArgs,
|
|
8953
|
-
manualCommand: `npx ${npxArgs.map(
|
|
9075
|
+
manualCommand: `npx ${npxArgs.map(shellQuote3).join(" ")}`
|
|
8954
9076
|
};
|
|
8955
9077
|
if (hasCommand("bunx")) {
|
|
8956
9078
|
const bunxArgs = buildBunxSkillsInstallArgs(baseUrl);
|
|
@@ -8958,7 +9080,7 @@ function resolveSkillsInstallCommands(baseUrl) {
|
|
|
8958
9080
|
{
|
|
8959
9081
|
command: "bunx",
|
|
8960
9082
|
args: bunxArgs,
|
|
8961
|
-
manualCommand: `bunx ${bunxArgs.map(
|
|
9083
|
+
manualCommand: `bunx ${bunxArgs.map(shellQuote3).join(" ")}`
|
|
8962
9084
|
},
|
|
8963
9085
|
npxInstall
|
|
8964
9086
|
];
|
|
@@ -8966,8 +9088,8 @@ function resolveSkillsInstallCommands(baseUrl) {
|
|
|
8966
9088
|
return [npxInstall];
|
|
8967
9089
|
}
|
|
8968
9090
|
function runOneSkillsInstall(install) {
|
|
8969
|
-
return new Promise((
|
|
8970
|
-
const child = (0,
|
|
9091
|
+
return new Promise((resolve10) => {
|
|
9092
|
+
const child = (0, import_node_child_process3.spawn)(install.command, install.args, {
|
|
8971
9093
|
stdio: ["ignore", "ignore", "pipe"],
|
|
8972
9094
|
env: process.env
|
|
8973
9095
|
});
|
|
@@ -8976,7 +9098,7 @@ function runOneSkillsInstall(install) {
|
|
|
8976
9098
|
stderr += chunk.toString("utf-8");
|
|
8977
9099
|
});
|
|
8978
9100
|
child.on("error", (error) => {
|
|
8979
|
-
|
|
9101
|
+
resolve10({
|
|
8980
9102
|
ok: false,
|
|
8981
9103
|
detail: `failed to start ${install.command}: ${error.message}`,
|
|
8982
9104
|
manualCommand: install.manualCommand
|
|
@@ -8984,11 +9106,11 @@ function runOneSkillsInstall(install) {
|
|
|
8984
9106
|
});
|
|
8985
9107
|
child.on("close", (code) => {
|
|
8986
9108
|
if (code === 0) {
|
|
8987
|
-
|
|
9109
|
+
resolve10({ ok: true, detail: "", manualCommand: install.manualCommand });
|
|
8988
9110
|
return;
|
|
8989
9111
|
}
|
|
8990
9112
|
const detail = stderr.trim();
|
|
8991
|
-
|
|
9113
|
+
resolve10({
|
|
8992
9114
|
ok: false,
|
|
8993
9115
|
detail: detail ? `${install.command}: ${detail}` : `${install.command} exited ${code}`,
|
|
8994
9116
|
manualCommand: install.manualCommand
|
|
@@ -9075,7 +9197,8 @@ Common commands:
|
|
|
9075
9197
|
deepline plays search email --json
|
|
9076
9198
|
deepline plays describe person-linkedin-to-email --json
|
|
9077
9199
|
deepline plays run my.play.ts --input '{"domain":"stripe.com"}' --watch
|
|
9078
|
-
deepline tools
|
|
9200
|
+
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
9201
|
+
deepline update
|
|
9079
9202
|
|
|
9080
9203
|
Product model:
|
|
9081
9204
|
Tools are atomic provider/API operations that may spend credits.
|
|
@@ -9097,7 +9220,7 @@ Exit codes:
|
|
|
9097
9220
|
`
|
|
9098
9221
|
);
|
|
9099
9222
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
9100
|
-
if (actionCommand.name() === "version") {
|
|
9223
|
+
if (actionCommand.name() === "version" || actionCommand.name() === "update") {
|
|
9101
9224
|
return;
|
|
9102
9225
|
}
|
|
9103
9226
|
if (printStartupPhase) {
|
|
@@ -9128,6 +9251,7 @@ Exit codes:
|
|
|
9128
9251
|
registerCsvCommands(program);
|
|
9129
9252
|
registerDbCommands(program);
|
|
9130
9253
|
registerFeedbackCommands(program);
|
|
9254
|
+
registerUpdateCommand(program);
|
|
9131
9255
|
program.command("health").description("Check server health.").addHelpText(
|
|
9132
9256
|
"after",
|
|
9133
9257
|
`
|
package/dist/cli/index.mjs
CHANGED
|
@@ -243,7 +243,7 @@ function saveProjectDeeplineEnvValues(baseUrl, values, startDir = projectEnvStar
|
|
|
243
243
|
}
|
|
244
244
|
|
|
245
245
|
// src/version.ts
|
|
246
|
-
var SDK_VERSION = "0.1.
|
|
246
|
+
var SDK_VERSION = "0.1.28";
|
|
247
247
|
var SDK_API_CONTRACT = "2026-05-runs-v2";
|
|
248
248
|
|
|
249
249
|
// ../shared_libs/play-runtime/coordinator-headers.ts
|
|
@@ -525,7 +525,7 @@ function decodeSseFrame(frame) {
|
|
|
525
525
|
return parsed;
|
|
526
526
|
}
|
|
527
527
|
function sleep(ms) {
|
|
528
|
-
return new Promise((
|
|
528
|
+
return new Promise((resolve10) => setTimeout(resolve10, ms));
|
|
529
529
|
}
|
|
530
530
|
|
|
531
531
|
// src/client.ts
|
|
@@ -533,7 +533,7 @@ var TERMINAL_PLAY_STATUSES = /* @__PURE__ */ new Set(["completed", "failed", "ca
|
|
|
533
533
|
var INCLUDE_TOOL_METADATA_HEADER = "x-deepline-include-tool-metadata";
|
|
534
534
|
var COMPILE_MANIFEST_RETRY_DELAYS_MS = [250, 1e3];
|
|
535
535
|
function sleep2(ms) {
|
|
536
|
-
return new Promise((
|
|
536
|
+
return new Promise((resolve10) => setTimeout(resolve10, ms));
|
|
537
537
|
}
|
|
538
538
|
function isTransientCompileManifestError(error) {
|
|
539
539
|
if (error instanceof DeeplineError && typeof error.statusCode === "number") {
|
|
@@ -691,7 +691,7 @@ var DeeplineClient = class {
|
|
|
691
691
|
play.outputSchema,
|
|
692
692
|
"rowOutputSchema"
|
|
693
693
|
);
|
|
694
|
-
const
|
|
694
|
+
const runCommand2 = this.playRunCommand(play, { csvInput });
|
|
695
695
|
return {
|
|
696
696
|
name: play.name,
|
|
697
697
|
...play.reference ? { reference: play.reference } : {},
|
|
@@ -705,8 +705,8 @@ var DeeplineClient = class {
|
|
|
705
705
|
outputSchema: options?.compact ? this.compactSchema(play.outputSchema) : play.outputSchema ?? null,
|
|
706
706
|
...csvInput ? { csvInput } : {},
|
|
707
707
|
...rowOutputSchema ? { rowOutputSchema } : {},
|
|
708
|
-
runCommand,
|
|
709
|
-
examples: [
|
|
708
|
+
runCommand: runCommand2,
|
|
709
|
+
examples: [runCommand2],
|
|
710
710
|
currentPublishedVersion: play.currentPublishedVersion ?? null,
|
|
711
711
|
isDraftDirty: play.isDraftDirty
|
|
712
712
|
};
|
|
@@ -2023,7 +2023,7 @@ function buildCandidateUrls2(url) {
|
|
|
2023
2023
|
}
|
|
2024
2024
|
}
|
|
2025
2025
|
function sleep3(ms) {
|
|
2026
|
-
return new Promise((
|
|
2026
|
+
return new Promise((resolve10) => setTimeout(resolve10, ms));
|
|
2027
2027
|
}
|
|
2028
2028
|
function printDeeplineLogo() {
|
|
2029
2029
|
if (process.stdout.isTTY && (process.stdout.columns ?? 80) >= 70) {
|
|
@@ -6464,7 +6464,7 @@ function writeStartedPlayRun(input) {
|
|
|
6464
6464
|
console.log(output);
|
|
6465
6465
|
}
|
|
6466
6466
|
function parsePlayRunOptions(args) {
|
|
6467
|
-
const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--live|--latest|--revision-id <id>] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--no-open] [--json] [--<input> value]\nRun `deepline plays run --help` for idempotency, tool call id, and ctx.map guidance.";
|
|
6467
|
+
const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--live|--latest|--revision-id <id>] [--watch] [--out output.csv] [--tail-timeout-ms 30000] [--force] [--no-open] [--json] [--<input> value]\n Unknown --<input> value flags, such as --csv leads.csv or --limit 5, are passed into play input.\nRun `deepline plays run --help` for idempotency, tool call id, and ctx.map guidance.";
|
|
6468
6468
|
let filePath = null;
|
|
6469
6469
|
let playName = null;
|
|
6470
6470
|
let input = null;
|
|
@@ -7676,7 +7676,9 @@ Examples:
|
|
|
7676
7676
|
Notes:
|
|
7677
7677
|
Local files are bundled, preflighted, then run in Deepline cloud.
|
|
7678
7678
|
Named plays run the live saved revision.
|
|
7679
|
-
Unknown --foo and --foo.bar flags are
|
|
7679
|
+
Unknown --foo value and --foo.bar value flags are passed into play input.
|
|
7680
|
+
Example: --csv leads.csv becomes input.csv = "leads.csv"; --limit 5 becomes
|
|
7681
|
+
input.limit = 5.
|
|
7680
7682
|
File args accept local paths; the CLI stages files before submit.
|
|
7681
7683
|
--watch prints logs, previews, stats, and next commands.
|
|
7682
7684
|
--wait is accepted as a compatibility alias for --watch.
|
|
@@ -7723,7 +7725,15 @@ Examples:
|
|
|
7723
7725
|
).option("--watch", "Stream logs until completion").option("--wait", "Alias for --watch; stream logs until completion").option(
|
|
7724
7726
|
"--logs",
|
|
7725
7727
|
"When output is non-interactive, stream play logs to stderr while waiting"
|
|
7726
|
-
).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Supersede any active runs for this play").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").
|
|
7728
|
+
).option("--tail-timeout-ms <ms>", "Timeout while watching the run stream").option("--force", "Supersede any active runs for this play").option("--no-open", "Print the play page URL without opening a browser").option("--json", "Emit JSON output").addHelpText(
|
|
7729
|
+
"afterAll",
|
|
7730
|
+
`
|
|
7731
|
+
Pass-through input flags:
|
|
7732
|
+
Unknown flags are accepted intentionally and become play input fields. Use
|
|
7733
|
+
this for play-specific inputs like --csv leads.csv, --limit 5, or
|
|
7734
|
+
--filters.title "GTM Engineer".
|
|
7735
|
+
`
|
|
7736
|
+
).action(async (target, options, command) => {
|
|
7727
7737
|
const passthroughArgs = [...command.args];
|
|
7728
7738
|
const explicitTarget = options.file || options.name;
|
|
7729
7739
|
const targetIsInputFlag = typeof target === "string" && target.startsWith("--");
|
|
@@ -8186,7 +8196,7 @@ function toListedTool(tool) {
|
|
|
8186
8196
|
...tool,
|
|
8187
8197
|
id: tool.toolId,
|
|
8188
8198
|
type: "tool",
|
|
8189
|
-
|
|
8199
|
+
executeCommand: `deepline tools execute ${tool.toolId}`
|
|
8190
8200
|
};
|
|
8191
8201
|
}
|
|
8192
8202
|
async function listTools(args) {
|
|
@@ -8259,7 +8269,7 @@ Inspect its schema with: deepline plays describe ${playName} --json`
|
|
|
8259
8269
|
);
|
|
8260
8270
|
}
|
|
8261
8271
|
function registerToolsCommands(program) {
|
|
8262
|
-
const tools = program.command("tools").description("Search, describe, and
|
|
8272
|
+
const tools = program.command("tools").description("Search, describe, and execute atomic provider tools.").addHelpText(
|
|
8263
8273
|
"after",
|
|
8264
8274
|
`
|
|
8265
8275
|
Concepts:
|
|
@@ -8269,11 +8279,11 @@ Concepts:
|
|
|
8269
8279
|
Common commands:
|
|
8270
8280
|
deepline tools search email --json
|
|
8271
8281
|
deepline tools describe hunter_email_verifier --json
|
|
8272
|
-
deepline tools
|
|
8282
|
+
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
8273
8283
|
|
|
8274
8284
|
Output:
|
|
8275
|
-
|
|
8276
|
-
|
|
8285
|
+
Use describe for tool contracts. get is accepted as a compatibility alias.
|
|
8286
|
+
Use execute to run a tool. run is accepted as a compatibility alias.
|
|
8277
8287
|
`
|
|
8278
8288
|
);
|
|
8279
8289
|
tools.command("list").description("List available tools.").addHelpText(
|
|
@@ -8298,7 +8308,7 @@ Examples:
|
|
|
8298
8308
|
`
|
|
8299
8309
|
Notes:
|
|
8300
8310
|
Ranked discovery for atomic provider/API operations. Results include tool ids
|
|
8301
|
-
that can be passed to deepline tools describe or deepline tools
|
|
8311
|
+
that can be passed to deepline tools describe or deepline tools execute.
|
|
8302
8312
|
|
|
8303
8313
|
Examples:
|
|
8304
8314
|
deepline tools search email
|
|
@@ -8314,18 +8324,18 @@ Examples:
|
|
|
8314
8324
|
includeSearchDebug: Boolean(options.includeSearchDebug)
|
|
8315
8325
|
});
|
|
8316
8326
|
});
|
|
8317
|
-
const addToolMetadataCommand = (command
|
|
8327
|
+
const addToolMetadataCommand = (command) => command.description("Show metadata for a tool.").addHelpText(
|
|
8318
8328
|
"after",
|
|
8319
8329
|
`
|
|
8320
8330
|
Notes:
|
|
8321
8331
|
Shows the tool contract, input schema, output schema, Deepline cost, aliases,
|
|
8322
|
-
and metadata. describe is the preferred discovery verb
|
|
8323
|
-
compatibility
|
|
8332
|
+
and metadata. describe is the preferred discovery verb. get is kept as a
|
|
8333
|
+
compatibility alias for the same metadata surface.
|
|
8324
8334
|
|
|
8325
8335
|
Examples:
|
|
8326
|
-
deepline tools
|
|
8327
|
-
deepline tools
|
|
8328
|
-
deepline tools
|
|
8336
|
+
deepline tools describe hunter_email_verifier
|
|
8337
|
+
deepline tools describe hunter_email_verifier --json | jq '.inputSchema'
|
|
8338
|
+
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
8329
8339
|
`
|
|
8330
8340
|
).option("--json", "Emit JSON output. Also automatic when stdout is piped").action(async (toolId, options) => {
|
|
8331
8341
|
process.exitCode = await getTool([
|
|
@@ -8333,21 +8343,21 @@ Examples:
|
|
|
8333
8343
|
...options.json ? ["--json"] : []
|
|
8334
8344
|
]);
|
|
8335
8345
|
});
|
|
8336
|
-
addToolMetadataCommand(tools.command("describe <toolId>")
|
|
8337
|
-
|
|
8338
|
-
tools.command("call <toolId>").alias("execute").alias("run").description("Execute a tool by id.").addHelpText(
|
|
8346
|
+
addToolMetadataCommand(tools.command("describe <toolId>").alias("get"));
|
|
8347
|
+
tools.command("execute <toolId>").alias("run").description("Execute a tool by id.").addHelpText(
|
|
8339
8348
|
"after",
|
|
8340
8349
|
`
|
|
8341
8350
|
Notes:
|
|
8342
8351
|
Use tools for one atomic provider/API operation. Use plays for composed workflows,
|
|
8343
8352
|
waterfalls, row maps, checkpoints, and retries.
|
|
8353
|
+
execute is the canonical execution verb. run is a compatibility alias.
|
|
8344
8354
|
Calling a provider-backed tool can spend Deepline credits. Use --json for the
|
|
8345
8355
|
stable result payload and --full-output when debugging response metadata.
|
|
8346
8356
|
|
|
8347
8357
|
Examples:
|
|
8348
|
-
deepline tools
|
|
8349
|
-
deepline tools
|
|
8350
|
-
deepline tools
|
|
8358
|
+
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
8359
|
+
deepline tools execute hunter_email_verifier -p email=a@b.com
|
|
8360
|
+
deepline tools execute test_rate_limit --input '{"key":"smoke"}' --json | jq '.status'
|
|
8351
8361
|
`
|
|
8352
8362
|
).option("-p, --param <key=value>", "Pass one parameter. Repeat for multiple values.", (value, acc) => {
|
|
8353
8363
|
acc.push(value);
|
|
@@ -8636,7 +8646,7 @@ function normalizeOutputFormat(raw) {
|
|
|
8636
8646
|
function parseExecuteOptions(args) {
|
|
8637
8647
|
const toolId = args[0];
|
|
8638
8648
|
if (!toolId) {
|
|
8639
|
-
throw new Error(`Usage: deepline tools
|
|
8649
|
+
throw new Error(`Usage: deepline tools execute <toolId> [--param key=value ...] [--input '{"k":"v"}'] [--output-format auto|csv|csv_file|json|json_file] [--full-output] [--no-preview]`);
|
|
8640
8650
|
}
|
|
8641
8651
|
const params = {};
|
|
8642
8652
|
let outputFormat = "auto";
|
|
@@ -8830,11 +8840,123 @@ async function executeTool(args) {
|
|
|
8830
8840
|
return 0;
|
|
8831
8841
|
}
|
|
8832
8842
|
|
|
8843
|
+
// src/cli/commands/update.ts
|
|
8844
|
+
import { spawn } from "child_process";
|
|
8845
|
+
import { existsSync as existsSync7 } from "fs";
|
|
8846
|
+
import { dirname as dirname9, join as join9, resolve as resolve9 } from "path";
|
|
8847
|
+
function posixShellQuote(value) {
|
|
8848
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
8849
|
+
}
|
|
8850
|
+
function windowsCmdQuote(value) {
|
|
8851
|
+
return `"${value.replace(/"/g, '""')}"`;
|
|
8852
|
+
}
|
|
8853
|
+
function shellQuote2(value) {
|
|
8854
|
+
if (process.platform === "win32") {
|
|
8855
|
+
return /^[A-Za-z0-9_./:@%+=,-]+$/.test(value) ? value : windowsCmdQuote(value);
|
|
8856
|
+
}
|
|
8857
|
+
return posixShellQuote(value);
|
|
8858
|
+
}
|
|
8859
|
+
function buildSourceUpdateCommand(sourceRoot) {
|
|
8860
|
+
const quotedRoot = shellQuote2(sourceRoot);
|
|
8861
|
+
const cdCommand = process.platform === "win32" ? `cd /d ${quotedRoot}` : `cd ${quotedRoot}`;
|
|
8862
|
+
return `${cdCommand} && git fetch origin main --tags && git merge --ff-only origin/main`;
|
|
8863
|
+
}
|
|
8864
|
+
function findRepoBackedSdkRoot(startPath) {
|
|
8865
|
+
let current = resolve9(startPath);
|
|
8866
|
+
while (true) {
|
|
8867
|
+
if (existsSync7(join9(current, "sdk", "package.json")) && existsSync7(join9(current, "sdk", "bin", "deepline-dev.ts"))) {
|
|
8868
|
+
return current;
|
|
8869
|
+
}
|
|
8870
|
+
const parent = dirname9(current);
|
|
8871
|
+
if (parent === current) return null;
|
|
8872
|
+
current = parent;
|
|
8873
|
+
}
|
|
8874
|
+
}
|
|
8875
|
+
function resolveUpdatePlan() {
|
|
8876
|
+
const entrypoint = process.argv[1] ? resolve9(process.argv[1]) : "";
|
|
8877
|
+
const sourceRoot = entrypoint ? findRepoBackedSdkRoot(dirname9(entrypoint)) : null;
|
|
8878
|
+
if (sourceRoot) {
|
|
8879
|
+
return {
|
|
8880
|
+
kind: "source",
|
|
8881
|
+
repoRoot: sourceRoot,
|
|
8882
|
+
manualCommand: buildSourceUpdateCommand(sourceRoot)
|
|
8883
|
+
};
|
|
8884
|
+
}
|
|
8885
|
+
const command = "npm";
|
|
8886
|
+
const args = ["install", "-g", "deepline@latest"];
|
|
8887
|
+
return {
|
|
8888
|
+
kind: "npm-global",
|
|
8889
|
+
command,
|
|
8890
|
+
args,
|
|
8891
|
+
manualCommand: `${command} ${args.map(shellQuote2).join(" ")}`
|
|
8892
|
+
};
|
|
8893
|
+
}
|
|
8894
|
+
function runCommand(command, args) {
|
|
8895
|
+
return new Promise((resolveExitCode) => {
|
|
8896
|
+
const child = spawn(command, args, {
|
|
8897
|
+
stdio: "inherit",
|
|
8898
|
+
shell: process.platform === "win32",
|
|
8899
|
+
env: process.env
|
|
8900
|
+
});
|
|
8901
|
+
child.on("error", (error) => {
|
|
8902
|
+
process.stderr.write(`Failed to start ${command}: ${error.message}
|
|
8903
|
+
`);
|
|
8904
|
+
resolveExitCode(1);
|
|
8905
|
+
});
|
|
8906
|
+
child.on("close", (code) => {
|
|
8907
|
+
resolveExitCode(code ?? 1);
|
|
8908
|
+
});
|
|
8909
|
+
});
|
|
8910
|
+
}
|
|
8911
|
+
async function handleUpdate(options) {
|
|
8912
|
+
const plan = resolveUpdatePlan();
|
|
8913
|
+
if (options.json) {
|
|
8914
|
+
process.stdout.write(`${JSON.stringify(plan)}
|
|
8915
|
+
`);
|
|
8916
|
+
return 0;
|
|
8917
|
+
}
|
|
8918
|
+
if (options.printCommand) {
|
|
8919
|
+
process.stdout.write(`${plan.manualCommand}
|
|
8920
|
+
`);
|
|
8921
|
+
return 0;
|
|
8922
|
+
}
|
|
8923
|
+
if (plan.kind === "source") {
|
|
8924
|
+
process.stdout.write(
|
|
8925
|
+
`This Deepline CLI is running from SDK source, so it cannot safely update itself like an npm global.
|
|
8926
|
+
Update the backing checkout with:
|
|
8927
|
+
${plan.manualCommand}
|
|
8928
|
+
`
|
|
8929
|
+
);
|
|
8930
|
+
return 0;
|
|
8931
|
+
}
|
|
8932
|
+
process.stderr.write(`Updating Deepline SDK/CLI with: ${plan.manualCommand}
|
|
8933
|
+
`);
|
|
8934
|
+
return runCommand(plan.command, plan.args);
|
|
8935
|
+
}
|
|
8936
|
+
function registerUpdateCommand(program) {
|
|
8937
|
+
program.command("update").alias("upgrade").description("Update the Deepline SDK/CLI.").addHelpText(
|
|
8938
|
+
"after",
|
|
8939
|
+
`
|
|
8940
|
+
Notes:
|
|
8941
|
+
For the published npm CLI, this runs npm install -g deepline@latest.
|
|
8942
|
+
For repo-backed SDK wrappers such as cli-env sdk-prod or sdk-worktree, this
|
|
8943
|
+
prints the exact git command to update the checkout that provides the CLI.
|
|
8944
|
+
|
|
8945
|
+
Examples:
|
|
8946
|
+
deepline update
|
|
8947
|
+
deepline update --print-command
|
|
8948
|
+
deepline update --json
|
|
8949
|
+
`
|
|
8950
|
+
).option("--print-command", "Print the update command without running it").option("--json", "Emit the resolved update plan as JSON").action(async (options) => {
|
|
8951
|
+
process.exitCode = await handleUpdate(options);
|
|
8952
|
+
});
|
|
8953
|
+
}
|
|
8954
|
+
|
|
8833
8955
|
// src/cli/skills-sync.ts
|
|
8834
|
-
import { spawn, spawnSync as spawnSync2 } from "child_process";
|
|
8835
|
-
import { existsSync as
|
|
8956
|
+
import { spawn as spawn2, spawnSync as spawnSync2 } from "child_process";
|
|
8957
|
+
import { existsSync as existsSync8, mkdirSync as mkdirSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync8 } from "fs";
|
|
8836
8958
|
import { homedir as homedir4 } from "os";
|
|
8837
|
-
import { dirname as
|
|
8959
|
+
import { dirname as dirname10, join as join10 } from "path";
|
|
8838
8960
|
var CHECK_TIMEOUT_MS2 = 3e3;
|
|
8839
8961
|
var SDK_SKILL_NAME = "deepline-sdk";
|
|
8840
8962
|
var SKILL_AGENTS = ["codex", "claude-code", "cursor"];
|
|
@@ -8845,11 +8967,11 @@ function shouldSkipSkillsSync() {
|
|
|
8845
8967
|
}
|
|
8846
8968
|
function sdkSkillsVersionPath(baseUrl) {
|
|
8847
8969
|
const home = process.env.HOME?.trim() || homedir4();
|
|
8848
|
-
return
|
|
8970
|
+
return join10(home, ".local", "deepline", baseUrlSlug(baseUrl), "sdk-skills", ".version");
|
|
8849
8971
|
}
|
|
8850
8972
|
function readLocalSkillsVersion(baseUrl) {
|
|
8851
8973
|
const path = sdkSkillsVersionPath(baseUrl);
|
|
8852
|
-
if (!
|
|
8974
|
+
if (!existsSync8(path)) return "";
|
|
8853
8975
|
try {
|
|
8854
8976
|
return readFileSync5(path, "utf-8").trim();
|
|
8855
8977
|
} catch {
|
|
@@ -8858,7 +8980,7 @@ function readLocalSkillsVersion(baseUrl) {
|
|
|
8858
8980
|
}
|
|
8859
8981
|
function writeLocalSkillsVersion(baseUrl, version) {
|
|
8860
8982
|
const path = sdkSkillsVersionPath(baseUrl);
|
|
8861
|
-
mkdirSync5(
|
|
8983
|
+
mkdirSync5(dirname10(path), { recursive: true });
|
|
8862
8984
|
writeFileSync8(path, `${version}
|
|
8863
8985
|
`, "utf-8");
|
|
8864
8986
|
}
|
|
@@ -8929,7 +9051,7 @@ function hasCommand(command) {
|
|
|
8929
9051
|
});
|
|
8930
9052
|
return result.status === 0;
|
|
8931
9053
|
}
|
|
8932
|
-
function
|
|
9054
|
+
function shellQuote3(arg) {
|
|
8933
9055
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
8934
9056
|
}
|
|
8935
9057
|
function resolveSkillsInstallCommands(baseUrl) {
|
|
@@ -8937,7 +9059,7 @@ function resolveSkillsInstallCommands(baseUrl) {
|
|
|
8937
9059
|
const npxInstall = {
|
|
8938
9060
|
command: "npx",
|
|
8939
9061
|
args: npxArgs,
|
|
8940
|
-
manualCommand: `npx ${npxArgs.map(
|
|
9062
|
+
manualCommand: `npx ${npxArgs.map(shellQuote3).join(" ")}`
|
|
8941
9063
|
};
|
|
8942
9064
|
if (hasCommand("bunx")) {
|
|
8943
9065
|
const bunxArgs = buildBunxSkillsInstallArgs(baseUrl);
|
|
@@ -8945,7 +9067,7 @@ function resolveSkillsInstallCommands(baseUrl) {
|
|
|
8945
9067
|
{
|
|
8946
9068
|
command: "bunx",
|
|
8947
9069
|
args: bunxArgs,
|
|
8948
|
-
manualCommand: `bunx ${bunxArgs.map(
|
|
9070
|
+
manualCommand: `bunx ${bunxArgs.map(shellQuote3).join(" ")}`
|
|
8949
9071
|
},
|
|
8950
9072
|
npxInstall
|
|
8951
9073
|
];
|
|
@@ -8953,8 +9075,8 @@ function resolveSkillsInstallCommands(baseUrl) {
|
|
|
8953
9075
|
return [npxInstall];
|
|
8954
9076
|
}
|
|
8955
9077
|
function runOneSkillsInstall(install) {
|
|
8956
|
-
return new Promise((
|
|
8957
|
-
const child =
|
|
9078
|
+
return new Promise((resolve10) => {
|
|
9079
|
+
const child = spawn2(install.command, install.args, {
|
|
8958
9080
|
stdio: ["ignore", "ignore", "pipe"],
|
|
8959
9081
|
env: process.env
|
|
8960
9082
|
});
|
|
@@ -8963,7 +9085,7 @@ function runOneSkillsInstall(install) {
|
|
|
8963
9085
|
stderr += chunk.toString("utf-8");
|
|
8964
9086
|
});
|
|
8965
9087
|
child.on("error", (error) => {
|
|
8966
|
-
|
|
9088
|
+
resolve10({
|
|
8967
9089
|
ok: false,
|
|
8968
9090
|
detail: `failed to start ${install.command}: ${error.message}`,
|
|
8969
9091
|
manualCommand: install.manualCommand
|
|
@@ -8971,11 +9093,11 @@ function runOneSkillsInstall(install) {
|
|
|
8971
9093
|
});
|
|
8972
9094
|
child.on("close", (code) => {
|
|
8973
9095
|
if (code === 0) {
|
|
8974
|
-
|
|
9096
|
+
resolve10({ ok: true, detail: "", manualCommand: install.manualCommand });
|
|
8975
9097
|
return;
|
|
8976
9098
|
}
|
|
8977
9099
|
const detail = stderr.trim();
|
|
8978
|
-
|
|
9100
|
+
resolve10({
|
|
8979
9101
|
ok: false,
|
|
8980
9102
|
detail: detail ? `${install.command}: ${detail}` : `${install.command} exited ${code}`,
|
|
8981
9103
|
manualCommand: install.manualCommand
|
|
@@ -9062,7 +9184,8 @@ Common commands:
|
|
|
9062
9184
|
deepline plays search email --json
|
|
9063
9185
|
deepline plays describe person-linkedin-to-email --json
|
|
9064
9186
|
deepline plays run my.play.ts --input '{"domain":"stripe.com"}' --watch
|
|
9065
|
-
deepline tools
|
|
9187
|
+
deepline tools execute hunter_email_verifier --input '{"email":"a@b.com"}'
|
|
9188
|
+
deepline update
|
|
9066
9189
|
|
|
9067
9190
|
Product model:
|
|
9068
9191
|
Tools are atomic provider/API operations that may spend credits.
|
|
@@ -9084,7 +9207,7 @@ Exit codes:
|
|
|
9084
9207
|
`
|
|
9085
9208
|
);
|
|
9086
9209
|
program.hook("preAction", async (_thisCommand, actionCommand) => {
|
|
9087
|
-
if (actionCommand.name() === "version") {
|
|
9210
|
+
if (actionCommand.name() === "version" || actionCommand.name() === "update") {
|
|
9088
9211
|
return;
|
|
9089
9212
|
}
|
|
9090
9213
|
if (printStartupPhase) {
|
|
@@ -9115,6 +9238,7 @@ Exit codes:
|
|
|
9115
9238
|
registerCsvCommands(program);
|
|
9116
9239
|
registerDbCommands(program);
|
|
9117
9240
|
registerFeedbackCommands(program);
|
|
9241
|
+
registerUpdateCommand(program);
|
|
9118
9242
|
program.command("health").description("Check server health.").addHelpText(
|
|
9119
9243
|
"after",
|
|
9120
9244
|
`
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const SDK_VERSION = "0.1.
|
|
1
|
+
export const SDK_VERSION = "0.1.28";
|
|
2
2
|
export const SDK_API_CONTRACT = "2026-05-runs-v2";
|