deepline 0.1.297 → 0.1.299
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 +10 -3
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +4 -45
- package/dist/bundling-sources/shared_libs/play-runtime/run-lifecycle-policy.ts +43 -3
- package/dist/cli/index.js +132 -32
- package/dist/cli/index.mjs +132 -32
- package/dist/index.js +29 -4
- package/dist/index.mjs +29 -4
- package/package.json +1 -1
|
@@ -93,6 +93,7 @@ import {
|
|
|
93
93
|
normalizePlayRuntimeSelection,
|
|
94
94
|
type PlayRuntimeSelection,
|
|
95
95
|
} from '../../shared_libs/play-runtime/runtime-environment.js';
|
|
96
|
+
import { decodePlayRunPublicStatus } from '../../shared_libs/play-runtime/run-lifecycle-policy.js';
|
|
96
97
|
|
|
97
98
|
const TERMINAL_PLAY_STATUSES = new Set(['completed', 'failed', 'cancelled']);
|
|
98
99
|
const INCLUDE_TOOL_METADATA_HEADER = 'x-deepline-include-tool-metadata';
|
|
@@ -991,12 +992,18 @@ function normalizePlayStatus(raw: Record<string, unknown>): PlayStatus {
|
|
|
991
992
|
? raw.package
|
|
992
993
|
: null;
|
|
993
994
|
const packageRun = runPackage?.run;
|
|
994
|
-
const
|
|
995
|
+
const rawStatus =
|
|
995
996
|
typeof raw.status === 'string'
|
|
996
997
|
? raw.status
|
|
997
998
|
: typeof packageRun?.status === 'string'
|
|
998
999
|
? packageRun.status
|
|
999
|
-
:
|
|
1000
|
+
: null;
|
|
1001
|
+
const status = decodePlayRunPublicStatus(rawStatus);
|
|
1002
|
+
if (!status) {
|
|
1003
|
+
throw new Error(
|
|
1004
|
+
`Invalid play run lifecycle status in API response: ${JSON.stringify(rawStatus)}.`,
|
|
1005
|
+
);
|
|
1006
|
+
}
|
|
1000
1007
|
const runId =
|
|
1001
1008
|
typeof raw.runId === 'string'
|
|
1002
1009
|
? raw.runId
|
|
@@ -1007,7 +1014,7 @@ function normalizePlayStatus(raw: Record<string, unknown>): PlayStatus {
|
|
|
1007
1014
|
...(raw as unknown as Omit<PlayStatus, 'runId' | 'status'>),
|
|
1008
1015
|
runId,
|
|
1009
1016
|
...(runPackage ? { package: runPackage, outputs: runPackage.outputs } : {}),
|
|
1010
|
-
status
|
|
1017
|
+
status,
|
|
1011
1018
|
};
|
|
1012
1019
|
}
|
|
1013
1020
|
|
|
@@ -155,7 +155,7 @@ export const SDK_RELEASE = {
|
|
|
155
155
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
156
156
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
157
157
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
158
|
-
version: '0.1.
|
|
158
|
+
version: '0.1.299',
|
|
159
159
|
contracts: {
|
|
160
160
|
api: {
|
|
161
161
|
name: 'sdk-http-api',
|
|
@@ -3,7 +3,6 @@ import {
|
|
|
3
3
|
PLATFORM_DEPLOY_INTERRUPTED_MESSAGE,
|
|
4
4
|
} from './run-failure';
|
|
5
5
|
import {
|
|
6
|
-
isAuthoritativePlayRunTerminalSource,
|
|
7
6
|
nextPlayRunLedgerTerminalSource,
|
|
8
7
|
normalizePlayRunLedgerTerminalSource,
|
|
9
8
|
} from './run-terminal-source';
|
|
@@ -643,16 +642,6 @@ function nextTerminalSource(
|
|
|
643
642
|
});
|
|
644
643
|
}
|
|
645
644
|
|
|
646
|
-
function shouldUpgradeFromCoordinatorTerminal(
|
|
647
|
-
base: PlayRunLedgerSnapshot,
|
|
648
|
-
eventSource: PlayRunLedgerEventSource,
|
|
649
|
-
): boolean {
|
|
650
|
-
return (
|
|
651
|
-
base.terminalSource === 'coordinator' &&
|
|
652
|
-
isAuthoritativePlayRunTerminalSource(eventSource)
|
|
653
|
-
);
|
|
654
|
-
}
|
|
655
|
-
|
|
656
645
|
function shouldIgnoreNonTerminalAfterStickyTerminal(
|
|
657
646
|
base: PlayRunLedgerSnapshot,
|
|
658
647
|
): boolean {
|
|
@@ -908,13 +897,10 @@ function appendLogLines(
|
|
|
908
897
|
}
|
|
909
898
|
|
|
910
899
|
/**
|
|
911
|
-
* Terminal-status precedence.
|
|
912
|
-
*
|
|
913
|
-
*
|
|
914
|
-
*
|
|
915
|
-
* an earlier partial terminal snapshot. Retryable platform-deploy failures are
|
|
916
|
-
* the narrow exception: they are never allowed to replace a real terminal
|
|
917
|
-
* result from the runtime.
|
|
900
|
+
* Terminal-status precedence. The first accepted run terminal is immutable:
|
|
901
|
+
* later events may enrich the same terminal payload, but may never change its
|
|
902
|
+
* outcome. Attempt retries are not authority to rewrite a terminal run, and
|
|
903
|
+
* producer timestamps are telemetry rather than an ordering mechanism.
|
|
918
904
|
*/
|
|
919
905
|
function conflictingTerminalSnapshot(
|
|
920
906
|
base: PlayRunLedgerSnapshot,
|
|
@@ -923,26 +909,12 @@ function conflictingTerminalSnapshot(
|
|
|
923
909
|
eventError?: string | null,
|
|
924
910
|
options?: {
|
|
925
911
|
allowStaleSameStatusPayloadMerge?: boolean;
|
|
926
|
-
allowCoordinatorTerminalUpgrade?: boolean;
|
|
927
912
|
},
|
|
928
913
|
): PlayRunLedgerSnapshot | null {
|
|
929
914
|
if (!isTerminalPlayRunLedgerStatus(base.status)) {
|
|
930
915
|
return null;
|
|
931
916
|
}
|
|
932
917
|
const terminalAt = base.finishedAt ?? base.updatedAt ?? 0;
|
|
933
|
-
if (base.status === 'cancelled' && eventType !== 'run.cancelled') {
|
|
934
|
-
if (occurredAt <= terminalAt) {
|
|
935
|
-
return withTiming(
|
|
936
|
-
appendLogLines(base, [
|
|
937
|
-
`[ledger] stale conflicting terminal event ${eventType} ignored; status already ${base.status}`,
|
|
938
|
-
]),
|
|
939
|
-
);
|
|
940
|
-
}
|
|
941
|
-
return withTiming(base);
|
|
942
|
-
}
|
|
943
|
-
if (options?.allowCoordinatorTerminalUpgrade === true) {
|
|
944
|
-
return null;
|
|
945
|
-
}
|
|
946
918
|
if (
|
|
947
919
|
base.status === 'completed' &&
|
|
948
920
|
eventType === 'run.failed' &&
|
|
@@ -970,12 +942,6 @@ function conflictingTerminalSnapshot(
|
|
|
970
942
|
}
|
|
971
943
|
return null;
|
|
972
944
|
}
|
|
973
|
-
if (occurredAt > terminalAt) {
|
|
974
|
-
// Newer terminal evidence reconciles the run. This covers replay/receipt
|
|
975
|
-
// races where an earlier attempt failed but a later attempt recovered and
|
|
976
|
-
// completed with the durable result.
|
|
977
|
-
return null;
|
|
978
|
-
}
|
|
979
945
|
return withTiming(
|
|
980
946
|
appendLogLines(base, [
|
|
981
947
|
`[ledger] stale conflicting terminal event ${eventType} ignored; status already ${base.status}`,
|
|
@@ -1205,12 +1171,7 @@ export function reducePlayRunLedgerEvent(
|
|
|
1205
1171
|
case 'run.completed':
|
|
1206
1172
|
return (
|
|
1207
1173
|
conflictingTerminalSnapshot(base, event.type, occurredAt, null, {
|
|
1208
|
-
allowCoordinatorTerminalUpgrade: shouldUpgradeFromCoordinatorTerminal(
|
|
1209
|
-
base,
|
|
1210
|
-
event.source,
|
|
1211
|
-
),
|
|
1212
1174
|
allowStaleSameStatusPayloadMerge:
|
|
1213
|
-
shouldUpgradeFromCoordinatorTerminal(base, event.source) ||
|
|
1214
1175
|
(base.result === undefined && event.result !== undefined) ||
|
|
1215
1176
|
(base.resultSummary === undefined &&
|
|
1216
1177
|
event.resultSummary !== undefined),
|
|
@@ -1234,7 +1195,6 @@ export function reducePlayRunLedgerEvent(
|
|
|
1234
1195
|
retryablePlatformDeployFailureSnapshot(base, event.error) ??
|
|
1235
1196
|
conflictingTerminalSnapshot(base, event.type, occurredAt, event.error, {
|
|
1236
1197
|
allowStaleSameStatusPayloadMerge:
|
|
1237
|
-
shouldUpgradeFromCoordinatorTerminal(base, event.source) ||
|
|
1238
1198
|
(base.error == null && event.error != null) ||
|
|
1239
1199
|
(base.result === undefined && event.result !== undefined),
|
|
1240
1200
|
}) ??
|
|
@@ -1258,7 +1218,6 @@ export function reducePlayRunLedgerEvent(
|
|
|
1258
1218
|
return (
|
|
1259
1219
|
conflictingTerminalSnapshot(base, event.type, occurredAt, event.error, {
|
|
1260
1220
|
allowStaleSameStatusPayloadMerge:
|
|
1261
|
-
shouldUpgradeFromCoordinatorTerminal(base, event.source) ||
|
|
1262
1221
|
(base.error == null && event.error != null) ||
|
|
1263
1222
|
(base.result === undefined && event.result !== undefined),
|
|
1264
1223
|
}) ??
|
|
@@ -9,6 +9,15 @@ export type PlayRunLifecycleStatus =
|
|
|
9
9
|
| 'timed_out'
|
|
10
10
|
| 'unknown';
|
|
11
11
|
|
|
12
|
+
/** The only lifecycle states exposed by the API, SDK, CLI, and UI. */
|
|
13
|
+
export type PlayRunPublicStatus =
|
|
14
|
+
| 'queued'
|
|
15
|
+
| 'running'
|
|
16
|
+
| 'waiting'
|
|
17
|
+
| 'completed'
|
|
18
|
+
| 'failed'
|
|
19
|
+
| 'cancelled';
|
|
20
|
+
|
|
12
21
|
const TERMINAL_PLAY_RUN_STATUSES = new Set<PlayRunLifecycleStatus>([
|
|
13
22
|
'completed',
|
|
14
23
|
'failed',
|
|
@@ -33,7 +42,7 @@ export function normalizePlayRunLifecycleStatus(
|
|
|
33
42
|
switch (normalized) {
|
|
34
43
|
case 'queued':
|
|
35
44
|
case 'pending':
|
|
36
|
-
return '
|
|
45
|
+
return 'queued';
|
|
37
46
|
case 'running':
|
|
38
47
|
case 'started':
|
|
39
48
|
return 'running';
|
|
@@ -60,12 +69,43 @@ export function normalizePlayRunLifecycleStatus(
|
|
|
60
69
|
}
|
|
61
70
|
|
|
62
71
|
export function isTerminalPlayRunLifecycleStatus(status: unknown): boolean {
|
|
63
|
-
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
72
|
+
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
73
|
+
normalizePlayRunLifecycleStatus(status),
|
|
74
|
+
);
|
|
64
75
|
}
|
|
65
76
|
|
|
66
77
|
export function isActivePlayRunLifecycleStatus(status: unknown): boolean {
|
|
67
78
|
const normalized = normalizePlayRunLifecycleStatus(status);
|
|
68
|
-
return
|
|
79
|
+
return (
|
|
80
|
+
normalized === 'queued' ||
|
|
81
|
+
normalized === 'running' ||
|
|
82
|
+
normalized === 'waiting'
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Decode a public lifecycle value without inventing progress. Internal
|
|
88
|
+
* termination reasons intentionally collapse to the one public cancellation
|
|
89
|
+
* outcome at this Adapter boundary. Unknown/missing values are invalid.
|
|
90
|
+
*/
|
|
91
|
+
export function decodePlayRunPublicStatus(
|
|
92
|
+
value: unknown,
|
|
93
|
+
): PlayRunPublicStatus | null {
|
|
94
|
+
const status = normalizePlayRunLifecycleStatus(value);
|
|
95
|
+
switch (status) {
|
|
96
|
+
case 'queued':
|
|
97
|
+
case 'running':
|
|
98
|
+
case 'waiting':
|
|
99
|
+
case 'completed':
|
|
100
|
+
case 'failed':
|
|
101
|
+
case 'cancelled':
|
|
102
|
+
return status;
|
|
103
|
+
case 'terminated':
|
|
104
|
+
case 'timed_out':
|
|
105
|
+
return 'cancelled';
|
|
106
|
+
case 'unknown':
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
69
109
|
}
|
|
70
110
|
|
|
71
111
|
export function isRecoverableDatasetRowStatus(status: unknown): boolean {
|
package/dist/cli/index.js
CHANGED
|
@@ -718,7 +718,7 @@ var SDK_RELEASE = {
|
|
|
718
718
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
719
719
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
720
720
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
721
|
-
version: "0.1.
|
|
721
|
+
version: "0.1.299",
|
|
722
722
|
contracts: {
|
|
723
723
|
api: {
|
|
724
724
|
name: "sdk-http-api",
|
|
@@ -2113,7 +2113,7 @@ function normalizePlayRunLifecycleStatus(value) {
|
|
|
2113
2113
|
switch (normalized) {
|
|
2114
2114
|
case "queued":
|
|
2115
2115
|
case "pending":
|
|
2116
|
-
return "
|
|
2116
|
+
return "queued";
|
|
2117
2117
|
case "running":
|
|
2118
2118
|
case "started":
|
|
2119
2119
|
return "running";
|
|
@@ -2139,7 +2139,26 @@ function normalizePlayRunLifecycleStatus(value) {
|
|
|
2139
2139
|
}
|
|
2140
2140
|
}
|
|
2141
2141
|
function isTerminalPlayRunLifecycleStatus(status) {
|
|
2142
|
-
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
2142
|
+
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
2143
|
+
normalizePlayRunLifecycleStatus(status)
|
|
2144
|
+
);
|
|
2145
|
+
}
|
|
2146
|
+
function decodePlayRunPublicStatus(value) {
|
|
2147
|
+
const status = normalizePlayRunLifecycleStatus(value);
|
|
2148
|
+
switch (status) {
|
|
2149
|
+
case "queued":
|
|
2150
|
+
case "running":
|
|
2151
|
+
case "waiting":
|
|
2152
|
+
case "completed":
|
|
2153
|
+
case "failed":
|
|
2154
|
+
case "cancelled":
|
|
2155
|
+
return status;
|
|
2156
|
+
case "terminated":
|
|
2157
|
+
case "timed_out":
|
|
2158
|
+
return "cancelled";
|
|
2159
|
+
case "unknown":
|
|
2160
|
+
return null;
|
|
2161
|
+
}
|
|
2143
2162
|
}
|
|
2144
2163
|
|
|
2145
2164
|
// ../shared_libs/play-runtime/run-snapshot-stream.ts
|
|
@@ -3080,7 +3099,13 @@ function isPlayRunPackage(value) {
|
|
|
3080
3099
|
function normalizePlayStatus(raw) {
|
|
3081
3100
|
const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
|
|
3082
3101
|
const packageRun = runPackage?.run;
|
|
3083
|
-
const
|
|
3102
|
+
const rawStatus = typeof raw.status === "string" ? raw.status : typeof packageRun?.status === "string" ? packageRun.status : null;
|
|
3103
|
+
const status = decodePlayRunPublicStatus(rawStatus);
|
|
3104
|
+
if (!status) {
|
|
3105
|
+
throw new Error(
|
|
3106
|
+
`Invalid play run lifecycle status in API response: ${JSON.stringify(rawStatus)}.`
|
|
3107
|
+
);
|
|
3108
|
+
}
|
|
3084
3109
|
const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : packageRun?.id ?? "";
|
|
3085
3110
|
return {
|
|
3086
3111
|
...raw,
|
|
@@ -29914,6 +29939,7 @@ var install_commands_default = {
|
|
|
29914
29939
|
|
|
29915
29940
|
// src/cli/install-commands.ts
|
|
29916
29941
|
var INSTALL_COMMANDS = install_commands_default;
|
|
29942
|
+
var DEFAULT_SKILL_AGENTS = INSTALL_COMMANDS.skills.default_agents;
|
|
29917
29943
|
var DEFAULT_V1_SKILL_NAMES = [
|
|
29918
29944
|
"build-tam",
|
|
29919
29945
|
"clay-to-deepline",
|
|
@@ -29950,9 +29976,10 @@ function skillsIndexUrl(baseUrl) {
|
|
|
29950
29976
|
function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
|
|
29951
29977
|
const skillNames = Array.isArray(skillName) ? skillName : [skillName];
|
|
29952
29978
|
const [firstSkillName, ...extraSkillNames] = skillNames;
|
|
29979
|
+
const agents = options.agents ?? INSTALL_COMMANDS.skills.default_agents;
|
|
29953
29980
|
const values = {
|
|
29954
29981
|
skills_index_url: skillsIndexUrl(baseUrl),
|
|
29955
|
-
agents:
|
|
29982
|
+
agents: agents.join(" "),
|
|
29956
29983
|
skill_name: firstSkillName ?? ""
|
|
29957
29984
|
};
|
|
29958
29985
|
const rendered = INSTALL_COMMANDS.skills.npx_add_args_template.flatMap(
|
|
@@ -29960,10 +29987,13 @@ function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
|
|
|
29960
29987
|
const next = index === 0 && options.firstArg ? options.firstArg : arg;
|
|
29961
29988
|
const value = renderTemplate(next, values);
|
|
29962
29989
|
if (arg === "{agents}") {
|
|
29963
|
-
return
|
|
29990
|
+
return agents;
|
|
29964
29991
|
}
|
|
29965
29992
|
if (arg === "{skill_name}") {
|
|
29966
|
-
return [
|
|
29993
|
+
return [
|
|
29994
|
+
value,
|
|
29995
|
+
...extraSkillNames.flatMap((name) => ["--skill", name])
|
|
29996
|
+
];
|
|
29967
29997
|
}
|
|
29968
29998
|
return value;
|
|
29969
29999
|
}
|
|
@@ -29984,6 +30014,29 @@ function sdkNpmGlobalInstallCommand() {
|
|
|
29984
30014
|
return INSTALL_COMMANDS.cli.sdk_npm_global;
|
|
29985
30015
|
}
|
|
29986
30016
|
|
|
30017
|
+
// src/cli/windows-arg-escape.ts
|
|
30018
|
+
var CMD_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
|
|
30019
|
+
function escapeCmdArgument(arg, forBatchFile = true) {
|
|
30020
|
+
let escaped = arg.replace(/(\\*)"/g, '$1$1\\"');
|
|
30021
|
+
escaped = escaped.replace(/(\\*)$/, "$1$1");
|
|
30022
|
+
escaped = `"${escaped}"`;
|
|
30023
|
+
escaped = escaped.replace(CMD_META_CHARS, "^$1");
|
|
30024
|
+
return forBatchFile ? escaped.replace(CMD_META_CHARS, "^$1") : escaped;
|
|
30025
|
+
}
|
|
30026
|
+
function escapeCmdCommand(command) {
|
|
30027
|
+
return command.replace(CMD_META_CHARS, "^$1");
|
|
30028
|
+
}
|
|
30029
|
+
function resolveShellSpawn(command, args, platform3 = process.platform) {
|
|
30030
|
+
if (platform3 !== "win32") {
|
|
30031
|
+
return { command, args: [...args], shell: false };
|
|
30032
|
+
}
|
|
30033
|
+
return {
|
|
30034
|
+
command: escapeCmdCommand(command),
|
|
30035
|
+
args: args.map((arg) => escapeCmdArgument(arg)),
|
|
30036
|
+
shell: true
|
|
30037
|
+
};
|
|
30038
|
+
}
|
|
30039
|
+
|
|
29987
30040
|
// src/cli/commands/skills.ts
|
|
29988
30041
|
var RUNTIME_TO_SKILLS_AGENT = {
|
|
29989
30042
|
antigravity: "antigravity",
|
|
@@ -30149,11 +30202,12 @@ function readSkillsInstallState(path) {
|
|
|
30149
30202
|
}
|
|
30150
30203
|
function runProcess(command, args, cwd) {
|
|
30151
30204
|
return new Promise((resolve15, reject) => {
|
|
30152
|
-
const
|
|
30205
|
+
const plan = resolveShellSpawn(command, args);
|
|
30206
|
+
const child = (0, import_node_child_process2.spawn)(plan.command, plan.args, {
|
|
30153
30207
|
cwd,
|
|
30154
30208
|
env: process.env,
|
|
30155
30209
|
stdio: ["ignore", "ignore", "pipe"],
|
|
30156
|
-
shell:
|
|
30210
|
+
shell: plan.shell
|
|
30157
30211
|
});
|
|
30158
30212
|
let stderr = "";
|
|
30159
30213
|
child.stderr.on("data", (chunk) => {
|
|
@@ -30695,9 +30749,10 @@ function installedPackageVersion(versionDir) {
|
|
|
30695
30749
|
function runCommand(command, args, env = process.env) {
|
|
30696
30750
|
return new Promise((resolveResult) => {
|
|
30697
30751
|
let output2 = "";
|
|
30698
|
-
const
|
|
30752
|
+
const plan = resolveShellSpawn(command, args);
|
|
30753
|
+
const child = (0, import_node_child_process3.spawn)(plan.command, plan.args, {
|
|
30699
30754
|
stdio: ["inherit", "pipe", "pipe"],
|
|
30700
|
-
shell:
|
|
30755
|
+
shell: plan.shell,
|
|
30701
30756
|
env
|
|
30702
30757
|
});
|
|
30703
30758
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -31240,19 +31295,27 @@ function isHomebrewFormulaCommand(path) {
|
|
|
31240
31295
|
const cellarIndex = parts.lastIndexOf("Cellar");
|
|
31241
31296
|
return cellarIndex >= 0 && parts[cellarIndex + 1] === "deepline" && parts.slice(cellarIndex + 3).includes("libexec");
|
|
31242
31297
|
}
|
|
31243
|
-
function resolvePersistentGlobalCommand(
|
|
31298
|
+
function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
31299
|
+
const platform3 = dependencies.platform ?? process.platform;
|
|
31300
|
+
const run = dependencies.spawn ?? import_node_child_process4.spawnSync;
|
|
31301
|
+
const pathExists = dependencies.exists ?? import_node_fs18.existsSync;
|
|
31302
|
+
const pathClis = dependencies.pathClis ?? resolvePathCommands("deepline");
|
|
31244
31303
|
const homebrewCommand = pathClis.find(isHomebrewFormulaCommand);
|
|
31245
31304
|
if (homebrewCommand) return homebrewCommand;
|
|
31246
|
-
const
|
|
31305
|
+
const plan = resolveShellSpawn("npm", ["prefix", "-g"], platform3);
|
|
31306
|
+
const prefix = run(plan.command, plan.args, {
|
|
31307
|
+
encoding: "utf8",
|
|
31308
|
+
shell: plan.shell
|
|
31309
|
+
});
|
|
31247
31310
|
if (prefix.status !== 0) return null;
|
|
31248
31311
|
const root = String(prefix.stdout ?? "").trim();
|
|
31249
31312
|
if (!root) return null;
|
|
31250
|
-
const candidates =
|
|
31251
|
-
return candidates.find((candidate) => (
|
|
31313
|
+
const candidates = platform3 === "win32" ? [(0, import_node_path20.join)(root, "deepline.cmd"), (0, import_node_path20.join)(root, "deepline")] : [(0, import_node_path20.join)(root, "bin", "deepline")];
|
|
31314
|
+
return candidates.find((candidate) => pathExists(candidate)) ?? null;
|
|
31252
31315
|
}
|
|
31253
31316
|
function inspectGlobalCliAvailability(input2) {
|
|
31254
31317
|
const pathClis = input2?.pathClis ?? resolvePathCommands("deepline");
|
|
31255
|
-
const persistentPath = input2 && "persistentGlobalCli" in input2 ? input2.persistentGlobalCli ?? null : resolvePersistentGlobalCommand(pathClis);
|
|
31318
|
+
const persistentPath = input2 && "persistentGlobalCli" in input2 ? input2.persistentGlobalCli ?? null : resolvePersistentGlobalCommand({ pathClis });
|
|
31256
31319
|
const path = persistentPath ? pathClis.find(
|
|
31257
31320
|
(candidate) => pathsResolveToSameFile(candidate, persistentPath)
|
|
31258
31321
|
) ?? null : null;
|
|
@@ -32272,28 +32335,51 @@ async function fetchSkillsUpdate(baseUrl, localVersion) {
|
|
|
32272
32335
|
clearTimeout(timeout);
|
|
32273
32336
|
}
|
|
32274
32337
|
}
|
|
32275
|
-
function buildSkillsInstallArgs(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES) {
|
|
32276
|
-
return buildSkillsAddArgs(baseUrl, sortedUniqueSkillNames(skillNames)
|
|
32338
|
+
function buildSkillsInstallArgs(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES, agents) {
|
|
32339
|
+
return buildSkillsAddArgs(baseUrl, sortedUniqueSkillNames(skillNames), {
|
|
32340
|
+
agents
|
|
32341
|
+
});
|
|
32277
32342
|
}
|
|
32278
|
-
function buildBunxSkillsInstallArgs(baseUrl, skillNames) {
|
|
32343
|
+
function buildBunxSkillsInstallArgs(baseUrl, skillNames, agents) {
|
|
32279
32344
|
return buildSkillsAddArgs(baseUrl, sortedUniqueSkillNames(skillNames), {
|
|
32280
|
-
firstArg: "--bun"
|
|
32345
|
+
firstArg: "--bun",
|
|
32346
|
+
agents
|
|
32281
32347
|
});
|
|
32282
32348
|
}
|
|
32349
|
+
function resolveAutoSyncSkillAgents() {
|
|
32350
|
+
switch (detectAgentRuntime()) {
|
|
32351
|
+
case "codex":
|
|
32352
|
+
return ["codex"];
|
|
32353
|
+
case "claude_code":
|
|
32354
|
+
return ["claude-code"];
|
|
32355
|
+
case "cursor":
|
|
32356
|
+
return ["cursor"];
|
|
32357
|
+
case "gemini":
|
|
32358
|
+
return ["gemini-cli"];
|
|
32359
|
+
case "antigravity":
|
|
32360
|
+
return ["antigravity"];
|
|
32361
|
+
default:
|
|
32362
|
+
return [];
|
|
32363
|
+
}
|
|
32364
|
+
}
|
|
32283
32365
|
function hasCommand(command) {
|
|
32284
|
-
const
|
|
32366
|
+
const plan = resolveShellSpawn(command, ["--version"]);
|
|
32367
|
+
const result = (0, import_node_child_process6.spawnSync)(plan.command, plan.args, {
|
|
32285
32368
|
stdio: "ignore",
|
|
32286
|
-
shell:
|
|
32369
|
+
shell: plan.shell
|
|
32287
32370
|
});
|
|
32288
32371
|
return result.status === 0;
|
|
32289
32372
|
}
|
|
32290
32373
|
function shellQuote5(arg) {
|
|
32291
32374
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
32292
32375
|
}
|
|
32293
|
-
function
|
|
32376
|
+
function resolveSkillsInstallSpawn(install, platform3 = process.platform) {
|
|
32377
|
+
return resolveShellSpawn(install.command, install.args, platform3);
|
|
32378
|
+
}
|
|
32379
|
+
function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES, agents = DEFAULT_SKILL_AGENTS) {
|
|
32294
32380
|
const commands = [];
|
|
32295
32381
|
if (hasCommand("bunx")) {
|
|
32296
|
-
const bunxArgs = buildBunxSkillsInstallArgs(baseUrl, skillNames);
|
|
32382
|
+
const bunxArgs = buildBunxSkillsInstallArgs(baseUrl, skillNames, agents);
|
|
32297
32383
|
commands.push({
|
|
32298
32384
|
command: "bunx",
|
|
32299
32385
|
args: bunxArgs,
|
|
@@ -32301,7 +32387,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
32301
32387
|
});
|
|
32302
32388
|
}
|
|
32303
32389
|
if (hasCommand("npx")) {
|
|
32304
|
-
const npxArgs = buildSkillsInstallArgs(baseUrl, skillNames);
|
|
32390
|
+
const npxArgs = buildSkillsInstallArgs(baseUrl, skillNames, agents);
|
|
32305
32391
|
commands.push({
|
|
32306
32392
|
command: "npx",
|
|
32307
32393
|
args: npxArgs,
|
|
@@ -32312,9 +32398,11 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
32312
32398
|
}
|
|
32313
32399
|
function runOneSkillsInstall(install) {
|
|
32314
32400
|
return new Promise((resolve15) => {
|
|
32315
|
-
const
|
|
32401
|
+
const plan = resolveSkillsInstallSpawn(install);
|
|
32402
|
+
const child = (0, import_node_child_process6.spawn)(plan.command, plan.args, {
|
|
32316
32403
|
stdio: ["ignore", "ignore", "pipe"],
|
|
32317
|
-
env: process.env
|
|
32404
|
+
env: process.env,
|
|
32405
|
+
shell: plan.shell
|
|
32318
32406
|
});
|
|
32319
32407
|
let stderr = "";
|
|
32320
32408
|
child.stderr.on("data", (chunk) => {
|
|
@@ -32358,7 +32446,7 @@ ${details}` : ""}
|
|
|
32358
32446
|
);
|
|
32359
32447
|
return false;
|
|
32360
32448
|
}
|
|
32361
|
-
function runLegacySkillsCleanup() {
|
|
32449
|
+
function runLegacySkillsCleanup(agents) {
|
|
32362
32450
|
const candidates = hasCommand("bunx") ? [
|
|
32363
32451
|
{
|
|
32364
32452
|
command: "bunx",
|
|
@@ -32367,6 +32455,8 @@ function runLegacySkillsCleanup() {
|
|
|
32367
32455
|
"skills",
|
|
32368
32456
|
"remove",
|
|
32369
32457
|
"--global",
|
|
32458
|
+
"--agent",
|
|
32459
|
+
...agents,
|
|
32370
32460
|
"-y",
|
|
32371
32461
|
...LEGACY_SKILL_NAMES_TO_REMOVE
|
|
32372
32462
|
]
|
|
@@ -32378,6 +32468,8 @@ function runLegacySkillsCleanup() {
|
|
|
32378
32468
|
"skills",
|
|
32379
32469
|
"remove",
|
|
32380
32470
|
"--global",
|
|
32471
|
+
"--agent",
|
|
32472
|
+
...agents,
|
|
32381
32473
|
"-y",
|
|
32382
32474
|
...LEGACY_SKILL_NAMES_TO_REMOVE
|
|
32383
32475
|
]
|
|
@@ -32390,16 +32482,19 @@ function runLegacySkillsCleanup() {
|
|
|
32390
32482
|
"skills",
|
|
32391
32483
|
"remove",
|
|
32392
32484
|
"--global",
|
|
32485
|
+
"--agent",
|
|
32486
|
+
...agents,
|
|
32393
32487
|
"-y",
|
|
32394
32488
|
...LEGACY_SKILL_NAMES_TO_REMOVE
|
|
32395
32489
|
]
|
|
32396
32490
|
}
|
|
32397
32491
|
];
|
|
32398
32492
|
for (const candidate of candidates) {
|
|
32399
|
-
const
|
|
32493
|
+
const plan = resolveShellSpawn(candidate.command, candidate.args);
|
|
32494
|
+
const result = (0, import_node_child_process6.spawnSync)(plan.command, plan.args, {
|
|
32400
32495
|
stdio: "ignore",
|
|
32401
32496
|
env: process.env,
|
|
32402
|
-
shell:
|
|
32497
|
+
shell: plan.shell
|
|
32403
32498
|
});
|
|
32404
32499
|
if (result.status === 0) return;
|
|
32405
32500
|
}
|
|
@@ -32433,7 +32528,12 @@ async function syncSdkSkillsIfNeeded(baseUrl, options = {}) {
|
|
|
32433
32528
|
remoteSkillNames.length > 0 ? remoteSkillNames : DEFAULT_SDK_SKILL_NAMES
|
|
32434
32529
|
);
|
|
32435
32530
|
if (skillNames.length === 0) return;
|
|
32436
|
-
const
|
|
32531
|
+
const agents = resolveAutoSyncSkillAgents();
|
|
32532
|
+
if (agents.length === 0) {
|
|
32533
|
+
writeUnavailableSkillsNotice(baseUrl, update.remoteVersion, skillNames);
|
|
32534
|
+
return;
|
|
32535
|
+
}
|
|
32536
|
+
const installs = resolveSkillsInstallCommands(baseUrl, skillNames, agents);
|
|
32437
32537
|
if (installs.length === 0) {
|
|
32438
32538
|
writeUnavailableSkillsNotice(baseUrl, update.remoteVersion, skillNames);
|
|
32439
32539
|
return;
|
|
@@ -32441,7 +32541,7 @@ async function syncSdkSkillsIfNeeded(baseUrl, options = {}) {
|
|
|
32441
32541
|
writeSdkSkillsStatusLine("Deepline skills changed; syncing agent skills...");
|
|
32442
32542
|
const installed = await runSkillsInstall(installs);
|
|
32443
32543
|
if (!installed) return;
|
|
32444
|
-
runLegacySkillsCleanup();
|
|
32544
|
+
runLegacySkillsCleanup(agents);
|
|
32445
32545
|
writeLocalSkillsVersion(baseUrl, update.remoteVersion);
|
|
32446
32546
|
clearUnavailableSkillsNotice(baseUrl);
|
|
32447
32547
|
writeSdkSkillsStatusLine("Deepline agent skills are up to date.");
|
package/dist/cli/index.mjs
CHANGED
|
@@ -703,7 +703,7 @@ var SDK_RELEASE = {
|
|
|
703
703
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
704
704
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
705
705
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
706
|
-
version: "0.1.
|
|
706
|
+
version: "0.1.299",
|
|
707
707
|
contracts: {
|
|
708
708
|
api: {
|
|
709
709
|
name: "sdk-http-api",
|
|
@@ -2098,7 +2098,7 @@ function normalizePlayRunLifecycleStatus(value) {
|
|
|
2098
2098
|
switch (normalized) {
|
|
2099
2099
|
case "queued":
|
|
2100
2100
|
case "pending":
|
|
2101
|
-
return "
|
|
2101
|
+
return "queued";
|
|
2102
2102
|
case "running":
|
|
2103
2103
|
case "started":
|
|
2104
2104
|
return "running";
|
|
@@ -2124,7 +2124,26 @@ function normalizePlayRunLifecycleStatus(value) {
|
|
|
2124
2124
|
}
|
|
2125
2125
|
}
|
|
2126
2126
|
function isTerminalPlayRunLifecycleStatus(status) {
|
|
2127
|
-
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
2127
|
+
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
2128
|
+
normalizePlayRunLifecycleStatus(status)
|
|
2129
|
+
);
|
|
2130
|
+
}
|
|
2131
|
+
function decodePlayRunPublicStatus(value) {
|
|
2132
|
+
const status = normalizePlayRunLifecycleStatus(value);
|
|
2133
|
+
switch (status) {
|
|
2134
|
+
case "queued":
|
|
2135
|
+
case "running":
|
|
2136
|
+
case "waiting":
|
|
2137
|
+
case "completed":
|
|
2138
|
+
case "failed":
|
|
2139
|
+
case "cancelled":
|
|
2140
|
+
return status;
|
|
2141
|
+
case "terminated":
|
|
2142
|
+
case "timed_out":
|
|
2143
|
+
return "cancelled";
|
|
2144
|
+
case "unknown":
|
|
2145
|
+
return null;
|
|
2146
|
+
}
|
|
2128
2147
|
}
|
|
2129
2148
|
|
|
2130
2149
|
// ../shared_libs/play-runtime/run-snapshot-stream.ts
|
|
@@ -3065,7 +3084,13 @@ function isPlayRunPackage(value) {
|
|
|
3065
3084
|
function normalizePlayStatus(raw) {
|
|
3066
3085
|
const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
|
|
3067
3086
|
const packageRun = runPackage?.run;
|
|
3068
|
-
const
|
|
3087
|
+
const rawStatus = typeof raw.status === "string" ? raw.status : typeof packageRun?.status === "string" ? packageRun.status : null;
|
|
3088
|
+
const status = decodePlayRunPublicStatus(rawStatus);
|
|
3089
|
+
if (!status) {
|
|
3090
|
+
throw new Error(
|
|
3091
|
+
`Invalid play run lifecycle status in API response: ${JSON.stringify(rawStatus)}.`
|
|
3092
|
+
);
|
|
3093
|
+
}
|
|
3069
3094
|
const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : packageRun?.id ?? "";
|
|
3070
3095
|
return {
|
|
3071
3096
|
...raw,
|
|
@@ -29971,6 +29996,7 @@ var install_commands_default = {
|
|
|
29971
29996
|
|
|
29972
29997
|
// src/cli/install-commands.ts
|
|
29973
29998
|
var INSTALL_COMMANDS = install_commands_default;
|
|
29999
|
+
var DEFAULT_SKILL_AGENTS = INSTALL_COMMANDS.skills.default_agents;
|
|
29974
30000
|
var DEFAULT_V1_SKILL_NAMES = [
|
|
29975
30001
|
"build-tam",
|
|
29976
30002
|
"clay-to-deepline",
|
|
@@ -30007,9 +30033,10 @@ function skillsIndexUrl(baseUrl) {
|
|
|
30007
30033
|
function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
|
|
30008
30034
|
const skillNames = Array.isArray(skillName) ? skillName : [skillName];
|
|
30009
30035
|
const [firstSkillName, ...extraSkillNames] = skillNames;
|
|
30036
|
+
const agents = options.agents ?? INSTALL_COMMANDS.skills.default_agents;
|
|
30010
30037
|
const values = {
|
|
30011
30038
|
skills_index_url: skillsIndexUrl(baseUrl),
|
|
30012
|
-
agents:
|
|
30039
|
+
agents: agents.join(" "),
|
|
30013
30040
|
skill_name: firstSkillName ?? ""
|
|
30014
30041
|
};
|
|
30015
30042
|
const rendered = INSTALL_COMMANDS.skills.npx_add_args_template.flatMap(
|
|
@@ -30017,10 +30044,13 @@ function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
|
|
|
30017
30044
|
const next = index === 0 && options.firstArg ? options.firstArg : arg;
|
|
30018
30045
|
const value = renderTemplate(next, values);
|
|
30019
30046
|
if (arg === "{agents}") {
|
|
30020
|
-
return
|
|
30047
|
+
return agents;
|
|
30021
30048
|
}
|
|
30022
30049
|
if (arg === "{skill_name}") {
|
|
30023
|
-
return [
|
|
30050
|
+
return [
|
|
30051
|
+
value,
|
|
30052
|
+
...extraSkillNames.flatMap((name) => ["--skill", name])
|
|
30053
|
+
];
|
|
30024
30054
|
}
|
|
30025
30055
|
return value;
|
|
30026
30056
|
}
|
|
@@ -30041,6 +30071,29 @@ function sdkNpmGlobalInstallCommand() {
|
|
|
30041
30071
|
return INSTALL_COMMANDS.cli.sdk_npm_global;
|
|
30042
30072
|
}
|
|
30043
30073
|
|
|
30074
|
+
// src/cli/windows-arg-escape.ts
|
|
30075
|
+
var CMD_META_CHARS = /([()\][%!^"`<>&|;, *?])/g;
|
|
30076
|
+
function escapeCmdArgument(arg, forBatchFile = true) {
|
|
30077
|
+
let escaped = arg.replace(/(\\*)"/g, '$1$1\\"');
|
|
30078
|
+
escaped = escaped.replace(/(\\*)$/, "$1$1");
|
|
30079
|
+
escaped = `"${escaped}"`;
|
|
30080
|
+
escaped = escaped.replace(CMD_META_CHARS, "^$1");
|
|
30081
|
+
return forBatchFile ? escaped.replace(CMD_META_CHARS, "^$1") : escaped;
|
|
30082
|
+
}
|
|
30083
|
+
function escapeCmdCommand(command) {
|
|
30084
|
+
return command.replace(CMD_META_CHARS, "^$1");
|
|
30085
|
+
}
|
|
30086
|
+
function resolveShellSpawn(command, args, platform3 = process.platform) {
|
|
30087
|
+
if (platform3 !== "win32") {
|
|
30088
|
+
return { command, args: [...args], shell: false };
|
|
30089
|
+
}
|
|
30090
|
+
return {
|
|
30091
|
+
command: escapeCmdCommand(command),
|
|
30092
|
+
args: args.map((arg) => escapeCmdArgument(arg)),
|
|
30093
|
+
shell: true
|
|
30094
|
+
};
|
|
30095
|
+
}
|
|
30096
|
+
|
|
30044
30097
|
// src/cli/commands/skills.ts
|
|
30045
30098
|
var RUNTIME_TO_SKILLS_AGENT = {
|
|
30046
30099
|
antigravity: "antigravity",
|
|
@@ -30206,11 +30259,12 @@ function readSkillsInstallState(path) {
|
|
|
30206
30259
|
}
|
|
30207
30260
|
function runProcess(command, args, cwd) {
|
|
30208
30261
|
return new Promise((resolve15, reject) => {
|
|
30209
|
-
const
|
|
30262
|
+
const plan = resolveShellSpawn(command, args);
|
|
30263
|
+
const child = spawn2(plan.command, plan.args, {
|
|
30210
30264
|
cwd,
|
|
30211
30265
|
env: process.env,
|
|
30212
30266
|
stdio: ["ignore", "ignore", "pipe"],
|
|
30213
|
-
shell:
|
|
30267
|
+
shell: plan.shell
|
|
30214
30268
|
});
|
|
30215
30269
|
let stderr = "";
|
|
30216
30270
|
child.stderr.on("data", (chunk) => {
|
|
@@ -30752,9 +30806,10 @@ function installedPackageVersion(versionDir) {
|
|
|
30752
30806
|
function runCommand(command, args, env = process.env) {
|
|
30753
30807
|
return new Promise((resolveResult) => {
|
|
30754
30808
|
let output2 = "";
|
|
30755
|
-
const
|
|
30809
|
+
const plan = resolveShellSpawn(command, args);
|
|
30810
|
+
const child = spawn3(plan.command, plan.args, {
|
|
30756
30811
|
stdio: ["inherit", "pipe", "pipe"],
|
|
30757
|
-
shell:
|
|
30812
|
+
shell: plan.shell,
|
|
30758
30813
|
env
|
|
30759
30814
|
});
|
|
30760
30815
|
child.stdout?.on("data", (chunk) => {
|
|
@@ -31305,19 +31360,27 @@ function isHomebrewFormulaCommand(path) {
|
|
|
31305
31360
|
const cellarIndex = parts.lastIndexOf("Cellar");
|
|
31306
31361
|
return cellarIndex >= 0 && parts[cellarIndex + 1] === "deepline" && parts.slice(cellarIndex + 3).includes("libexec");
|
|
31307
31362
|
}
|
|
31308
|
-
function resolvePersistentGlobalCommand(
|
|
31363
|
+
function resolvePersistentGlobalCommand(dependencies = {}) {
|
|
31364
|
+
const platform3 = dependencies.platform ?? process.platform;
|
|
31365
|
+
const run = dependencies.spawn ?? spawnSync;
|
|
31366
|
+
const pathExists = dependencies.exists ?? existsSync13;
|
|
31367
|
+
const pathClis = dependencies.pathClis ?? resolvePathCommands("deepline");
|
|
31309
31368
|
const homebrewCommand = pathClis.find(isHomebrewFormulaCommand);
|
|
31310
31369
|
if (homebrewCommand) return homebrewCommand;
|
|
31311
|
-
const
|
|
31370
|
+
const plan = resolveShellSpawn("npm", ["prefix", "-g"], platform3);
|
|
31371
|
+
const prefix = run(plan.command, plan.args, {
|
|
31372
|
+
encoding: "utf8",
|
|
31373
|
+
shell: plan.shell
|
|
31374
|
+
});
|
|
31312
31375
|
if (prefix.status !== 0) return null;
|
|
31313
31376
|
const root = String(prefix.stdout ?? "").trim();
|
|
31314
31377
|
if (!root) return null;
|
|
31315
|
-
const candidates =
|
|
31316
|
-
return candidates.find((candidate) =>
|
|
31378
|
+
const candidates = platform3 === "win32" ? [join16(root, "deepline.cmd"), join16(root, "deepline")] : [join16(root, "bin", "deepline")];
|
|
31379
|
+
return candidates.find((candidate) => pathExists(candidate)) ?? null;
|
|
31317
31380
|
}
|
|
31318
31381
|
function inspectGlobalCliAvailability(input2) {
|
|
31319
31382
|
const pathClis = input2?.pathClis ?? resolvePathCommands("deepline");
|
|
31320
|
-
const persistentPath = input2 && "persistentGlobalCli" in input2 ? input2.persistentGlobalCli ?? null : resolvePersistentGlobalCommand(pathClis);
|
|
31383
|
+
const persistentPath = input2 && "persistentGlobalCli" in input2 ? input2.persistentGlobalCli ?? null : resolvePersistentGlobalCommand({ pathClis });
|
|
31321
31384
|
const path = persistentPath ? pathClis.find(
|
|
31322
31385
|
(candidate) => pathsResolveToSameFile(candidate, persistentPath)
|
|
31323
31386
|
) ?? null : null;
|
|
@@ -32343,28 +32406,51 @@ async function fetchSkillsUpdate(baseUrl, localVersion) {
|
|
|
32343
32406
|
clearTimeout(timeout);
|
|
32344
32407
|
}
|
|
32345
32408
|
}
|
|
32346
|
-
function buildSkillsInstallArgs(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES) {
|
|
32347
|
-
return buildSkillsAddArgs(baseUrl, sortedUniqueSkillNames(skillNames)
|
|
32409
|
+
function buildSkillsInstallArgs(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES, agents) {
|
|
32410
|
+
return buildSkillsAddArgs(baseUrl, sortedUniqueSkillNames(skillNames), {
|
|
32411
|
+
agents
|
|
32412
|
+
});
|
|
32348
32413
|
}
|
|
32349
|
-
function buildBunxSkillsInstallArgs(baseUrl, skillNames) {
|
|
32414
|
+
function buildBunxSkillsInstallArgs(baseUrl, skillNames, agents) {
|
|
32350
32415
|
return buildSkillsAddArgs(baseUrl, sortedUniqueSkillNames(skillNames), {
|
|
32351
|
-
firstArg: "--bun"
|
|
32416
|
+
firstArg: "--bun",
|
|
32417
|
+
agents
|
|
32352
32418
|
});
|
|
32353
32419
|
}
|
|
32420
|
+
function resolveAutoSyncSkillAgents() {
|
|
32421
|
+
switch (detectAgentRuntime()) {
|
|
32422
|
+
case "codex":
|
|
32423
|
+
return ["codex"];
|
|
32424
|
+
case "claude_code":
|
|
32425
|
+
return ["claude-code"];
|
|
32426
|
+
case "cursor":
|
|
32427
|
+
return ["cursor"];
|
|
32428
|
+
case "gemini":
|
|
32429
|
+
return ["gemini-cli"];
|
|
32430
|
+
case "antigravity":
|
|
32431
|
+
return ["antigravity"];
|
|
32432
|
+
default:
|
|
32433
|
+
return [];
|
|
32434
|
+
}
|
|
32435
|
+
}
|
|
32354
32436
|
function hasCommand(command) {
|
|
32355
|
-
const
|
|
32437
|
+
const plan = resolveShellSpawn(command, ["--version"]);
|
|
32438
|
+
const result = spawnSync2(plan.command, plan.args, {
|
|
32356
32439
|
stdio: "ignore",
|
|
32357
|
-
shell:
|
|
32440
|
+
shell: plan.shell
|
|
32358
32441
|
});
|
|
32359
32442
|
return result.status === 0;
|
|
32360
32443
|
}
|
|
32361
32444
|
function shellQuote5(arg) {
|
|
32362
32445
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
32363
32446
|
}
|
|
32364
|
-
function
|
|
32447
|
+
function resolveSkillsInstallSpawn(install, platform3 = process.platform) {
|
|
32448
|
+
return resolveShellSpawn(install.command, install.args, platform3);
|
|
32449
|
+
}
|
|
32450
|
+
function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NAMES, agents = DEFAULT_SKILL_AGENTS) {
|
|
32365
32451
|
const commands = [];
|
|
32366
32452
|
if (hasCommand("bunx")) {
|
|
32367
|
-
const bunxArgs = buildBunxSkillsInstallArgs(baseUrl, skillNames);
|
|
32453
|
+
const bunxArgs = buildBunxSkillsInstallArgs(baseUrl, skillNames, agents);
|
|
32368
32454
|
commands.push({
|
|
32369
32455
|
command: "bunx",
|
|
32370
32456
|
args: bunxArgs,
|
|
@@ -32372,7 +32458,7 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
32372
32458
|
});
|
|
32373
32459
|
}
|
|
32374
32460
|
if (hasCommand("npx")) {
|
|
32375
|
-
const npxArgs = buildSkillsInstallArgs(baseUrl, skillNames);
|
|
32461
|
+
const npxArgs = buildSkillsInstallArgs(baseUrl, skillNames, agents);
|
|
32376
32462
|
commands.push({
|
|
32377
32463
|
command: "npx",
|
|
32378
32464
|
args: npxArgs,
|
|
@@ -32383,9 +32469,11 @@ function resolveSkillsInstallCommands(baseUrl, skillNames = DEFAULT_SDK_SKILL_NA
|
|
|
32383
32469
|
}
|
|
32384
32470
|
function runOneSkillsInstall(install) {
|
|
32385
32471
|
return new Promise((resolve15) => {
|
|
32386
|
-
const
|
|
32472
|
+
const plan = resolveSkillsInstallSpawn(install);
|
|
32473
|
+
const child = spawn5(plan.command, plan.args, {
|
|
32387
32474
|
stdio: ["ignore", "ignore", "pipe"],
|
|
32388
|
-
env: process.env
|
|
32475
|
+
env: process.env,
|
|
32476
|
+
shell: plan.shell
|
|
32389
32477
|
});
|
|
32390
32478
|
let stderr = "";
|
|
32391
32479
|
child.stderr.on("data", (chunk) => {
|
|
@@ -32429,7 +32517,7 @@ ${details}` : ""}
|
|
|
32429
32517
|
);
|
|
32430
32518
|
return false;
|
|
32431
32519
|
}
|
|
32432
|
-
function runLegacySkillsCleanup() {
|
|
32520
|
+
function runLegacySkillsCleanup(agents) {
|
|
32433
32521
|
const candidates = hasCommand("bunx") ? [
|
|
32434
32522
|
{
|
|
32435
32523
|
command: "bunx",
|
|
@@ -32438,6 +32526,8 @@ function runLegacySkillsCleanup() {
|
|
|
32438
32526
|
"skills",
|
|
32439
32527
|
"remove",
|
|
32440
32528
|
"--global",
|
|
32529
|
+
"--agent",
|
|
32530
|
+
...agents,
|
|
32441
32531
|
"-y",
|
|
32442
32532
|
...LEGACY_SKILL_NAMES_TO_REMOVE
|
|
32443
32533
|
]
|
|
@@ -32449,6 +32539,8 @@ function runLegacySkillsCleanup() {
|
|
|
32449
32539
|
"skills",
|
|
32450
32540
|
"remove",
|
|
32451
32541
|
"--global",
|
|
32542
|
+
"--agent",
|
|
32543
|
+
...agents,
|
|
32452
32544
|
"-y",
|
|
32453
32545
|
...LEGACY_SKILL_NAMES_TO_REMOVE
|
|
32454
32546
|
]
|
|
@@ -32461,16 +32553,19 @@ function runLegacySkillsCleanup() {
|
|
|
32461
32553
|
"skills",
|
|
32462
32554
|
"remove",
|
|
32463
32555
|
"--global",
|
|
32556
|
+
"--agent",
|
|
32557
|
+
...agents,
|
|
32464
32558
|
"-y",
|
|
32465
32559
|
...LEGACY_SKILL_NAMES_TO_REMOVE
|
|
32466
32560
|
]
|
|
32467
32561
|
}
|
|
32468
32562
|
];
|
|
32469
32563
|
for (const candidate of candidates) {
|
|
32470
|
-
const
|
|
32564
|
+
const plan = resolveShellSpawn(candidate.command, candidate.args);
|
|
32565
|
+
const result = spawnSync2(plan.command, plan.args, {
|
|
32471
32566
|
stdio: "ignore",
|
|
32472
32567
|
env: process.env,
|
|
32473
|
-
shell:
|
|
32568
|
+
shell: plan.shell
|
|
32474
32569
|
});
|
|
32475
32570
|
if (result.status === 0) return;
|
|
32476
32571
|
}
|
|
@@ -32504,7 +32599,12 @@ async function syncSdkSkillsIfNeeded(baseUrl, options = {}) {
|
|
|
32504
32599
|
remoteSkillNames.length > 0 ? remoteSkillNames : DEFAULT_SDK_SKILL_NAMES
|
|
32505
32600
|
);
|
|
32506
32601
|
if (skillNames.length === 0) return;
|
|
32507
|
-
const
|
|
32602
|
+
const agents = resolveAutoSyncSkillAgents();
|
|
32603
|
+
if (agents.length === 0) {
|
|
32604
|
+
writeUnavailableSkillsNotice(baseUrl, update.remoteVersion, skillNames);
|
|
32605
|
+
return;
|
|
32606
|
+
}
|
|
32607
|
+
const installs = resolveSkillsInstallCommands(baseUrl, skillNames, agents);
|
|
32508
32608
|
if (installs.length === 0) {
|
|
32509
32609
|
writeUnavailableSkillsNotice(baseUrl, update.remoteVersion, skillNames);
|
|
32510
32610
|
return;
|
|
@@ -32512,7 +32612,7 @@ async function syncSdkSkillsIfNeeded(baseUrl, options = {}) {
|
|
|
32512
32612
|
writeSdkSkillsStatusLine("Deepline skills changed; syncing agent skills...");
|
|
32513
32613
|
const installed = await runSkillsInstall(installs);
|
|
32514
32614
|
if (!installed) return;
|
|
32515
|
-
runLegacySkillsCleanup();
|
|
32615
|
+
runLegacySkillsCleanup(agents);
|
|
32516
32616
|
writeLocalSkillsVersion(baseUrl, update.remoteVersion);
|
|
32517
32617
|
clearUnavailableSkillsNotice(baseUrl);
|
|
32518
32618
|
writeSdkSkillsStatusLine("Deepline agent skills are up to date.");
|
package/dist/index.js
CHANGED
|
@@ -438,7 +438,7 @@ var SDK_RELEASE = {
|
|
|
438
438
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
439
439
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
440
440
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
441
|
-
version: "0.1.
|
|
441
|
+
version: "0.1.299",
|
|
442
442
|
contracts: {
|
|
443
443
|
api: {
|
|
444
444
|
name: "sdk-http-api",
|
|
@@ -1833,7 +1833,7 @@ function normalizePlayRunLifecycleStatus(value) {
|
|
|
1833
1833
|
switch (normalized) {
|
|
1834
1834
|
case "queued":
|
|
1835
1835
|
case "pending":
|
|
1836
|
-
return "
|
|
1836
|
+
return "queued";
|
|
1837
1837
|
case "running":
|
|
1838
1838
|
case "started":
|
|
1839
1839
|
return "running";
|
|
@@ -1859,7 +1859,26 @@ function normalizePlayRunLifecycleStatus(value) {
|
|
|
1859
1859
|
}
|
|
1860
1860
|
}
|
|
1861
1861
|
function isTerminalPlayRunLifecycleStatus(status) {
|
|
1862
|
-
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
1862
|
+
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
1863
|
+
normalizePlayRunLifecycleStatus(status)
|
|
1864
|
+
);
|
|
1865
|
+
}
|
|
1866
|
+
function decodePlayRunPublicStatus(value) {
|
|
1867
|
+
const status = normalizePlayRunLifecycleStatus(value);
|
|
1868
|
+
switch (status) {
|
|
1869
|
+
case "queued":
|
|
1870
|
+
case "running":
|
|
1871
|
+
case "waiting":
|
|
1872
|
+
case "completed":
|
|
1873
|
+
case "failed":
|
|
1874
|
+
case "cancelled":
|
|
1875
|
+
return status;
|
|
1876
|
+
case "terminated":
|
|
1877
|
+
case "timed_out":
|
|
1878
|
+
return "cancelled";
|
|
1879
|
+
case "unknown":
|
|
1880
|
+
return null;
|
|
1881
|
+
}
|
|
1863
1882
|
}
|
|
1864
1883
|
|
|
1865
1884
|
// ../shared_libs/play-runtime/run-snapshot-stream.ts
|
|
@@ -2800,7 +2819,13 @@ function isPlayRunPackage(value) {
|
|
|
2800
2819
|
function normalizePlayStatus(raw) {
|
|
2801
2820
|
const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
|
|
2802
2821
|
const packageRun = runPackage?.run;
|
|
2803
|
-
const
|
|
2822
|
+
const rawStatus = typeof raw.status === "string" ? raw.status : typeof packageRun?.status === "string" ? packageRun.status : null;
|
|
2823
|
+
const status = decodePlayRunPublicStatus(rawStatus);
|
|
2824
|
+
if (!status) {
|
|
2825
|
+
throw new Error(
|
|
2826
|
+
`Invalid play run lifecycle status in API response: ${JSON.stringify(rawStatus)}.`
|
|
2827
|
+
);
|
|
2828
|
+
}
|
|
2804
2829
|
const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : packageRun?.id ?? "";
|
|
2805
2830
|
return {
|
|
2806
2831
|
...raw,
|
package/dist/index.mjs
CHANGED
|
@@ -367,7 +367,7 @@ var SDK_RELEASE = {
|
|
|
367
367
|
// 0.1.253 makes play-page browser opening opt-in and retires --no-open.
|
|
368
368
|
// 0.1.254 removes the internal operations tree from the published SDK CLI.
|
|
369
369
|
// Operators use the checkout-local deepline-admin binary instead.
|
|
370
|
-
version: "0.1.
|
|
370
|
+
version: "0.1.299",
|
|
371
371
|
contracts: {
|
|
372
372
|
api: {
|
|
373
373
|
name: "sdk-http-api",
|
|
@@ -1762,7 +1762,7 @@ function normalizePlayRunLifecycleStatus(value) {
|
|
|
1762
1762
|
switch (normalized) {
|
|
1763
1763
|
case "queued":
|
|
1764
1764
|
case "pending":
|
|
1765
|
-
return "
|
|
1765
|
+
return "queued";
|
|
1766
1766
|
case "running":
|
|
1767
1767
|
case "started":
|
|
1768
1768
|
return "running";
|
|
@@ -1788,7 +1788,26 @@ function normalizePlayRunLifecycleStatus(value) {
|
|
|
1788
1788
|
}
|
|
1789
1789
|
}
|
|
1790
1790
|
function isTerminalPlayRunLifecycleStatus(status) {
|
|
1791
|
-
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
1791
|
+
return TERMINAL_PLAY_RUN_STATUSES.has(
|
|
1792
|
+
normalizePlayRunLifecycleStatus(status)
|
|
1793
|
+
);
|
|
1794
|
+
}
|
|
1795
|
+
function decodePlayRunPublicStatus(value) {
|
|
1796
|
+
const status = normalizePlayRunLifecycleStatus(value);
|
|
1797
|
+
switch (status) {
|
|
1798
|
+
case "queued":
|
|
1799
|
+
case "running":
|
|
1800
|
+
case "waiting":
|
|
1801
|
+
case "completed":
|
|
1802
|
+
case "failed":
|
|
1803
|
+
case "cancelled":
|
|
1804
|
+
return status;
|
|
1805
|
+
case "terminated":
|
|
1806
|
+
case "timed_out":
|
|
1807
|
+
return "cancelled";
|
|
1808
|
+
case "unknown":
|
|
1809
|
+
return null;
|
|
1810
|
+
}
|
|
1792
1811
|
}
|
|
1793
1812
|
|
|
1794
1813
|
// ../shared_libs/play-runtime/run-snapshot-stream.ts
|
|
@@ -2729,7 +2748,13 @@ function isPlayRunPackage(value) {
|
|
|
2729
2748
|
function normalizePlayStatus(raw) {
|
|
2730
2749
|
const runPackage = isPlayRunPackage(raw) ? raw : isPlayRunPackage(raw.package) ? raw.package : null;
|
|
2731
2750
|
const packageRun = runPackage?.run;
|
|
2732
|
-
const
|
|
2751
|
+
const rawStatus = typeof raw.status === "string" ? raw.status : typeof packageRun?.status === "string" ? packageRun.status : null;
|
|
2752
|
+
const status = decodePlayRunPublicStatus(rawStatus);
|
|
2753
|
+
if (!status) {
|
|
2754
|
+
throw new Error(
|
|
2755
|
+
`Invalid play run lifecycle status in API response: ${JSON.stringify(rawStatus)}.`
|
|
2756
|
+
);
|
|
2757
|
+
}
|
|
2733
2758
|
const runId = typeof raw.runId === "string" ? raw.runId : typeof raw.workflowId === "string" ? raw.workflowId : packageRun?.id ?? "";
|
|
2734
2759
|
return {
|
|
2735
2760
|
...raw,
|