deepline 0.3.409 → 0.3.411

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.
Files changed (215) hide show
  1. package/dist/bundling-sources/sdk/src/agent-runtime.ts +18 -1
  2. package/dist/bundling-sources/sdk/src/client.ts +206 -333
  3. package/dist/bundling-sources/sdk/src/compat.ts +45 -2
  4. package/dist/bundling-sources/sdk/src/db/query.ts +9 -10
  5. package/dist/bundling-sources/sdk/src/http.ts +38 -20
  6. package/dist/bundling-sources/sdk/src/index.ts +4 -5
  7. package/dist/bundling-sources/sdk/src/play.ts +10 -10
  8. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +6 -4
  9. package/dist/bundling-sources/sdk/src/plays/check-local-play-graph.ts +114 -0
  10. package/dist/bundling-sources/sdk/src/plays/client.ts +431 -0
  11. package/dist/bundling-sources/sdk/src/plays/local-play-execution.ts +2 -2
  12. package/dist/bundling-sources/sdk/src/plays/run-request.ts +106 -16
  13. package/dist/bundling-sources/sdk/src/release.ts +13 -7
  14. package/dist/bundling-sources/sdk/src/runs/read-errors.ts +8 -0
  15. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +124 -13
  16. package/dist/bundling-sources/sdk/src/tool-calls.ts +108 -19
  17. package/dist/bundling-sources/sdk/src/types.ts +18 -0
  18. package/dist/bundling-sources/shared_libs/integration-contracts/execute-retry-contract.ts +37 -0
  19. package/dist/bundling-sources/shared_libs/integration-contracts/package.json +3 -0
  20. package/dist/bundling-sources/shared_libs/monitors/package.json +1 -1
  21. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +3 -1
  22. package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +1 -1
  23. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +277 -76
  24. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/dataset-row-input.ts +124 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +6 -62
  27. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +1 -0
  28. package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +67 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +64 -6
  30. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +1 -5
  31. package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +1 -1
  32. package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +3 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +10 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +3 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/egress-probe.ts +3 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +26 -16
  37. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +36 -11
  38. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +35 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +21 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +21 -6
  41. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +11 -2
  42. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +85 -20
  43. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +71 -13
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-execution-queries.ts +100 -0
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +9 -5
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +337 -146
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +26 -12
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +3 -1
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +425 -102
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
  51. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +4 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +9 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +181 -124
  54. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +152 -0
  55. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +5 -3
  56. package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +31 -0
  57. package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +10 -0
  58. package/dist/bundling-sources/shared_libs/plays/ambiguous-write-error.ts +25 -0
  59. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
  60. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +63 -68
  61. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +129 -63
  62. package/dist/bundling-sources/shared_libs/plays/contracts.ts +14 -0
  63. package/dist/bundling-sources/shared_libs/plays/enrich-play-compiler.ts +58 -16
  64. package/dist/bundling-sources/shared_libs/plays/fetch-http-error.ts +50 -0
  65. package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +351 -0
  66. package/dist/bundling-sources/shared_libs/plays/tool-list-getter-mode.ts +9 -0
  67. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
  68. package/dist/cli/auth-M7TBLW55.js +40 -0
  69. package/dist/cli/{auth-5HIIACF7.mjs → auth-YD6ZTMB2.mjs} +6 -6
  70. package/dist/cli/{billing-4275N7FL.js → billing-2L3MOB42.js} +84 -84
  71. package/dist/cli/{billing-EVZ3ZWKC.mjs → billing-ZT46GV4C.mjs} +8 -8
  72. package/dist/cli/{chunk-ZAAKSJAS.js → chunk-27GJKC5Q.js} +17 -10
  73. package/dist/cli/{chunk-UHNDVD3P.js → chunk-2H4EY7KH.js} +100 -41
  74. package/dist/cli/{chunk-GAICVLKL.js → chunk-2NI6DHN7.js} +2 -2
  75. package/dist/cli/{chunk-JGHG4NBA.js → chunk-2WUY3VNK.js} +19 -4
  76. package/dist/cli/{chunk-FHPCKULR.mjs → chunk-4BA6ATHA.mjs} +2 -2
  77. package/dist/cli/{chunk-RTCDW2GU.js → chunk-4O4WNFFC.js} +170 -49
  78. package/dist/cli/{chunk-OSDXE27V.mjs → chunk-4PG4ARL2.mjs} +17 -10
  79. package/dist/cli/{chunk-AU4OFDFX.js → chunk-5IGDNBG7.js} +26 -26
  80. package/dist/cli/{chunk-WYQO2CBS.mjs → chunk-5LRWWMRV.mjs} +149 -28
  81. package/dist/cli/{chunk-PMVFAYL7.mjs → chunk-63ILLN5H.mjs} +2 -2
  82. package/dist/cli/chunk-6AUE6JXY.js +35 -0
  83. package/dist/cli/chunk-7DSMMCXP.js +501 -0
  84. package/dist/cli/{chunk-6BJK4EJ3.mjs → chunk-AARWVK4C.mjs} +2132 -65
  85. package/dist/cli/{chunk-FERRDNMO.js → chunk-AD47BXN2.js} +5 -5
  86. package/dist/cli/{chunk-J6DCKJNM.mjs → chunk-BJV3VSKE.mjs} +16 -1
  87. package/dist/cli/{chunk-S6R3OX7B.js → chunk-E4CABWXL.js} +25 -2
  88. package/dist/cli/{chunk-NXGCO4JB.mjs → chunk-E4IXDAZI.mjs} +5 -0
  89. package/dist/cli/{chunk-BEVLCKXG.mjs → chunk-E4KBNNNB.mjs} +1 -1
  90. package/dist/cli/{chunk-2PRO2JTX.mjs → chunk-E52TKKVI.mjs} +36 -284
  91. package/dist/cli/chunk-FR2ILQ4G.mjs +8 -0
  92. package/dist/cli/{chunk-2GI3QD3L.js → chunk-FRVPOXGB.js} +644 -330
  93. package/dist/cli/chunk-G43JLBDE.mjs +501 -0
  94. package/dist/cli/{chunk-BZAMOCPA.mjs → chunk-IMZ56EOH.mjs} +3 -3
  95. package/dist/cli/chunk-IPGV6VFA.mjs +6084 -0
  96. package/dist/cli/{chunk-IT3XBJQR.mjs → chunk-IR3AKJAY.mjs} +330 -625
  97. package/dist/cli/chunk-J33TSWO5.js +8 -0
  98. package/dist/cli/chunk-JQMZUWNM.mjs +35 -0
  99. package/dist/cli/chunk-JYHSEGRM.js +6084 -0
  100. package/dist/cli/{chunk-JI2B4RZP.mjs → chunk-KCC3FKIW.mjs} +71 -12
  101. package/dist/cli/{chunk-6IKARAYD.mjs → chunk-L2VKAASU.mjs} +23 -0
  102. package/dist/cli/{chunk-O3VSXP2F.js → chunk-LWBM5FFL.js} +50 -50
  103. package/dist/cli/{chunk-VWBTTJYQ.mjs → chunk-M6OASCVL.mjs} +6 -3
  104. package/dist/cli/{chunk-YHPYUZZX.mjs → chunk-MAMVGOSC.mjs} +1 -1
  105. package/dist/cli/{chunk-Q2E4E4FJ.js → chunk-NPBJI7RE.js} +8 -8
  106. package/dist/cli/chunk-NQWIZ5PZ.js +313 -0
  107. package/dist/cli/{chunk-HQXL5526.mjs → chunk-NUX2QHNC.mjs} +1 -1
  108. package/dist/cli/{chunk-TQNHMWUR.mjs → chunk-OGSXENOF.mjs} +5 -2
  109. package/dist/cli/{chunk-SEFMGO3Z.js → chunk-OQQOXSYA.js} +2184 -117
  110. package/dist/cli/{chunk-FJCIUF34.js → chunk-OZSC6CEW.js} +128 -376
  111. package/dist/cli/{chunk-NZSF57UO.mjs → chunk-PO2VU6WV.mjs} +2 -2
  112. package/dist/cli/{chunk-7P5AA3SN.js → chunk-PPDBRJRW.js} +6 -1
  113. package/dist/cli/{chunk-ILHRA7AD.js → chunk-QADCFSGH.js} +7 -7
  114. package/dist/cli/{chunk-N44JHMKY.mjs → chunk-RFES6Q2J.mjs} +452 -138
  115. package/dist/cli/{chunk-DEC3JECC.js → chunk-RMINBDYY.js} +5 -2
  116. package/dist/cli/{chunk-WLOCMJWV.js → chunk-TPFD4F5S.js} +426 -721
  117. package/dist/cli/{chunk-V76R6HMV.js → chunk-U5AQKE3T.js} +1029 -806
  118. package/dist/cli/{chunk-PBZYY7VZ.mjs → chunk-UAEVKAUR.mjs} +734 -511
  119. package/dist/cli/{chunk-WHG43Z67.js → chunk-VGHWJL4W.js} +11 -8
  120. package/dist/cli/chunk-VKKVSFRD.js +62 -0
  121. package/dist/cli/{chunk-GSK6NHVM.js → chunk-WU4U6VSB.js} +5 -5
  122. package/dist/cli/chunk-XAB47ZRV.mjs +313 -0
  123. package/dist/cli/{chunk-JRAVVJ3T.mjs → chunk-XJD6LZCO.mjs} +2 -2
  124. package/dist/cli/chunk-ZCALLYF6.mjs +62 -0
  125. package/dist/cli/{chunk-YD7B53RW.js → chunk-ZHWBU36H.js} +12 -12
  126. package/dist/cli/{csv-A2MP6EFV.mjs → csv-BKNRRW7D.mjs} +5 -5
  127. package/dist/cli/{csv-BBOTCGQY.js → csv-SVDP2EU7.js} +14 -14
  128. package/dist/cli/{db-3W5DMTUX.mjs → db-LU4KLRM6.mjs} +15 -20
  129. package/dist/cli/{db-G4CODDCA.js → db-OQ6S7TTZ.js} +42 -47
  130. package/dist/cli/{describe-PQTQ5B6F.js → describe-45TGETKR.js} +27 -22
  131. package/dist/cli/{describe-XYJ2ZT4M.mjs → describe-U4KOGDRA.mjs} +20 -15
  132. package/dist/cli/describe-core.d.mts +2 -2
  133. package/dist/cli/describe-core.d.ts +2 -2
  134. package/dist/cli/describe-core.js +6 -6
  135. package/dist/cli/describe-core.mjs +5 -5
  136. package/dist/cli/{executions-UR67CA5H.mjs → executions-2GAAUXLA.mjs} +8 -8
  137. package/dist/cli/{executions-TLANVR7Y.js → executions-VZN56VRC.js} +10 -10
  138. package/dist/cli/{feedback-6C2YTRJL.js → feedback-NS76B5GU.js} +13 -9
  139. package/dist/cli/{feedback-WHCMGEIL.mjs → feedback-XW5IWA5R.mjs} +11 -7
  140. package/dist/cli/{git-GWLB6VSA.mjs → git-CLI66XP6.mjs} +6 -6
  141. package/dist/cli/git-VGYRGFEN.js +24 -0
  142. package/dist/cli/index.js +236 -348
  143. package/dist/cli/index.mjs +162 -274
  144. package/dist/cli/{legacy-noops-ZUFA7RWI.js → legacy-noops-HCFB3ZOV.js} +9 -9
  145. package/dist/cli/{legacy-noops-KF4XIFEF.mjs → legacy-noops-ODDOMLBL.mjs} +6 -6
  146. package/dist/cli/{monitors-TB3K2IVE.js → monitors-7WXQ7JFT.js} +94 -94
  147. package/dist/cli/{monitors-6UOIDIMB.mjs → monitors-ZXX456TE.mjs} +8 -8
  148. package/dist/cli/{org-CKWMBPIR.js → org-YLX5PHBQ.js} +68 -68
  149. package/dist/cli/{org-WGHHMVDZ.mjs → org-YUN3TLNP.mjs} +8 -8
  150. package/dist/cli/{play-LYPAXCLD.mjs → play-LL73A7EP.mjs} +533 -98
  151. package/dist/cli/{play-N2B3KAVS.js → play-YGOXL52D.js} +1067 -632
  152. package/dist/cli/{providers-6DI5BVZJ.mjs → providers-35QSAUHL.mjs} +8 -8
  153. package/dist/cli/{providers-UR42MD6Z.js → providers-RHCIU2PX.js} +11 -11
  154. package/dist/cli/{quickstart-MNA2S6PO.mjs → quickstart-6BN3LCZH.mjs} +5 -5
  155. package/dist/cli/{quickstart-FCJG4XGB.js → quickstart-ORMM4NRK.js} +7 -7
  156. package/dist/cli/search-EWDMUPHR.js +30 -0
  157. package/dist/cli/{search-VPPYUJ2M.mjs → search-GAERWLSE.mjs} +9 -9
  158. package/dist/cli/{secrets-QOSMVO36.js → secrets-3AFCTGT7.js} +17 -17
  159. package/dist/cli/{secrets-DRI4W7Z5.mjs → secrets-FCL5PALY.mjs} +8 -8
  160. package/dist/cli/sessions-3OEHEQG7.js +16 -0
  161. package/dist/cli/{sessions-DQNUKP43.mjs → sessions-RSSL7I7O.mjs} +6 -6
  162. package/dist/cli/{settings-DWDK3Y2R.mjs → settings-GE4NRE7Y.mjs} +12 -12
  163. package/dist/cli/{settings-JUGGCOPS.js → settings-RX5K4I7H.js} +79 -79
  164. package/dist/cli/{setup-AWBHNYXK.js → setup-N3ZNAEL5.js} +45 -44
  165. package/dist/cli/{setup-D5DWVNY4.mjs → setup-X3RXGG4F.mjs} +11 -10
  166. package/dist/cli/{skills-YV2XR35J.mjs → skills-5JEAJBDE.mjs} +7 -7
  167. package/dist/cli/skills-VAAQVEQC.js +29 -0
  168. package/dist/cli/tools-BYYOT2DU.js +44 -0
  169. package/dist/cli/{tools-VFJYHNV2.mjs → tools-JOKUWEBZ.mjs} +19 -14
  170. package/dist/cli/update-36G4ZD7B.js +31 -0
  171. package/dist/cli/{update-IM6VOTGL.mjs → update-UBHEVFR3.mjs} +11 -9
  172. package/dist/cli/{workflow-26URBWPV.mjs → workflow-FR6EXAXF.mjs} +44 -20
  173. package/dist/cli/{workflow-3BS6U6SL.js → workflow-SZAVOHN6.js} +54 -30
  174. package/dist/{client-BfInrZPB.d.mts → client-74k4IPh6.d.mts} +135 -54
  175. package/dist/{client-BMjJFpan.d.ts → client-C1IK1f8c.d.ts} +135 -54
  176. package/dist/{compiler-manifest-Ycx-hoAr.d.mts → compiler-manifest-lzWpbV3w.d.mts} +83 -66
  177. package/dist/{compiler-manifest-Ycx-hoAr.d.ts → compiler-manifest-lzWpbV3w.d.ts} +83 -66
  178. package/dist/{index-CZXgiN3E.d.mts → index-C8Cy-YTm.d.ts} +5 -1
  179. package/dist/{index-NPG5pqxQ.d.ts → index-CtNK-0nI.d.mts} +5 -1
  180. package/dist/index.d.mts +47 -9
  181. package/dist/index.d.ts +47 -9
  182. package/dist/index.js +17 -14
  183. package/dist/index.mjs +13 -10
  184. package/dist/install-integrity.json +118 -102
  185. package/dist/plays/bundle-play-file.d.mts +3 -3
  186. package/dist/plays/bundle-play-file.d.ts +3 -3
  187. package/dist/plays/bundle-play-file.mjs +5 -4
  188. package/dist/plays/csv-data-input.js +3 -3
  189. package/dist/plays/csv-data-input.mjs +2 -2
  190. package/dist/plays/play-description.d.mts +2 -2
  191. package/dist/plays/play-description.d.ts +2 -2
  192. package/dist/plays/run-request.d.mts +2 -2
  193. package/dist/plays/run-request.d.ts +2 -2
  194. package/dist/plays/run-request.js +11 -3
  195. package/dist/plays/run-request.mjs +10 -2
  196. package/dist/release.d.mts +15 -6
  197. package/dist/release.d.ts +15 -6
  198. package/dist/release.js +2 -2
  199. package/dist/release.mjs +1 -1
  200. package/package.json +2 -2
  201. package/dist/cli/auth-F6BX32XZ.js +0 -40
  202. package/dist/cli/chunk-264PC2RN.mjs +0 -83
  203. package/dist/cli/chunk-44ZTYHMQ.mjs +0 -155
  204. package/dist/cli/chunk-53HN7WZN.js +0 -392
  205. package/dist/cli/chunk-7AALNGTA.mjs +0 -392
  206. package/dist/cli/chunk-ALD4COBH.js +0 -155
  207. package/dist/cli/chunk-CLJGSOVM.mjs +0 -1716
  208. package/dist/cli/chunk-WNUR6VP5.js +0 -83
  209. package/dist/cli/chunk-Z4VNJOF7.js +0 -1716
  210. package/dist/cli/git-VQFF6D7C.js +0 -24
  211. package/dist/cli/search-NCEEONMQ.js +0 -30
  212. package/dist/cli/sessions-3WYKQABW.js +0 -16
  213. package/dist/cli/skills-AKPAJVSO.js +0 -29
  214. package/dist/cli/tools-RBKEK6PM.js +0 -39
  215. package/dist/cli/update-VFNUBLDA.js +0 -29
@@ -1,9 +1,6 @@
1
1
  import {
2
- getActiveCliProgress
3
- } from "./chunk-44ZTYHMQ.mjs";
4
- import {
5
- printCommandEnvelope
6
- } from "./chunk-JRAVVJ3T.mjs";
2
+ isJsonOutputMode
3
+ } from "./chunk-XJD6LZCO.mjs";
7
4
  import {
8
5
  DEFAULT_SKILL_AGENTS,
9
6
  KNOWN_SKILL_AGENTS,
@@ -13,162 +10,20 @@ import {
13
10
  autoDetectBaseUrl,
14
11
  deploymentProtectionHeaders,
15
12
  detectAgentRuntime,
16
- ensureProjectPrivatePathsIgnored,
17
13
  hasActivePluginSkills,
18
14
  readSdkSkillsLocalVersion,
19
15
  resolveApiKeyForBaseUrl,
20
16
  resolveAutoSyncSkillAgents,
21
- resolveProjectPinTarget,
22
17
  sdkCliStateDirPath,
23
18
  skillsAgentPathSegment,
24
19
  writeSdkSkillsLocalVersion
25
- } from "./chunk-2PRO2JTX.mjs";
20
+ } from "./chunk-E52TKKVI.mjs";
26
21
  import {
27
22
  DeeplineError
28
- } from "./chunk-NXGCO4JB.mjs";
23
+ } from "./chunk-E4IXDAZI.mjs";
29
24
  import {
30
25
  SDK_RELEASE
31
- } from "./chunk-TQNHMWUR.mjs";
32
-
33
- // src/cli/commands/skills.ts
34
- import { spawn as spawn2 } from "child_process";
35
- import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
36
- import { homedir as homedir3 } from "os";
37
- import { dirname as dirname3, join as join3 } from "path";
38
-
39
- // contracts/install-commands.json
40
- var install_commands_default = {
41
- skills: {
42
- index_path: "/.well-known/skills/index.json",
43
- default_agents: [
44
- "codex",
45
- "claude-code",
46
- "cursor",
47
- "gemini-cli",
48
- "antigravity"
49
- ],
50
- npx_binary: "npx",
51
- npx_add_args_template: [
52
- "--yes",
53
- "skills@1.5.15",
54
- "add",
55
- "{skills_source_url}",
56
- "--agent",
57
- "{agents}",
58
- "--global",
59
- "--yes",
60
- "--skill",
61
- "{skill_name}",
62
- "--full-depth"
63
- ]
64
- },
65
- cli: {
66
- sdk_npm_global: "npm install -g deepline@latest"
67
- }
68
- };
69
-
70
- // src/cli/install-commands.ts
71
- var INSTALL_COMMANDS = install_commands_default;
72
- var skillsNpxPackage = INSTALL_COMMANDS.skills.npx_add_args_template.find(
73
- (arg) => /^skills@\d+\.\d+\.\d+$/.test(arg)
74
- );
75
- if (!skillsNpxPackage) {
76
- throw new Error(
77
- "shared_libs/cli/install-commands.json must pin an exact skills package version."
78
- );
79
- }
80
- var SKILLS_NPX_PACKAGE = skillsNpxPackage;
81
- var DEFAULT_V1_SKILL_NAMES = [
82
- "deepline-org-chart",
83
- "build-tam",
84
- "clay-to-deepline",
85
- "deepline-analytics",
86
- "deepline-engine",
87
- // Retired: its guidance lives in `feedback send --help` and `sessions send
88
- // --help`. Kept as a stub because installed CLIs list it and refuse to
89
- // sync any skill when the published index lacks a listed name. Move to
90
- // LEGACY_SKILL_NAMES_TO_REMOVE once those CLIs are out of the field.
91
- "deepline-feedback",
92
- "deepline-gtm",
93
- "deepline-start",
94
- "deepline-plays",
95
- "deepline-quickstart",
96
- "deepline-research",
97
- "deepline-scoring",
98
- "find-qualified-titles",
99
- "linkedin-url-lookup",
100
- // Deprecated alias for `deepline-scoring`, kept installable so saved prompts
101
- // and scripts using `/niche-signal-discovery` keep routing to the renamed
102
- // skill. Move to LEGACY_SKILL_NAMES_TO_REMOVE once the window closes.
103
- "niche-signal-discovery",
104
- "portfolio-prospecting"
105
- ];
106
- var DEFAULT_SDK_SKILL_NAMES = [...DEFAULT_V1_SKILL_NAMES];
107
- var LEGACY_SKILL_NAMES_TO_REMOVE = [
108
- "deepline-plays-feedback",
109
- "deepline-plays-quickstart",
110
- "workflow-hello-world"
111
- ];
112
- function normalizeBaseUrl(baseUrl) {
113
- return baseUrl.replace(/\/$/, "");
114
- }
115
- function renderTemplate(template, values) {
116
- return template.replace(/\{([a-z_]+)\}/g, (match, key) => {
117
- return values[key] ?? match;
118
- });
119
- }
120
- function skillsIndexUrl(baseUrl) {
121
- return `${normalizeBaseUrl(baseUrl)}${INSTALL_COMMANDS.skills.index_path}`;
122
- }
123
- function skillsSourceUrl(baseUrl) {
124
- return normalizeBaseUrl(baseUrl);
125
- }
126
- function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
127
- const skillNames = Array.isArray(skillName) ? skillName : [skillName];
128
- const [firstSkillName, ...extraSkillNames] = skillNames;
129
- const agents = options.agents ?? DEFAULT_SKILL_AGENTS;
130
- const values = {
131
- skills_index_url: skillsIndexUrl(baseUrl),
132
- skills_source_url: skillsSourceUrl(baseUrl),
133
- agents: agents.join(" "),
134
- skill_name: firstSkillName ?? ""
135
- };
136
- const rendered = INSTALL_COMMANDS.skills.npx_add_args_template.flatMap(
137
- (arg, index) => {
138
- const next = index === 0 && options.firstArg ? options.firstArg : arg;
139
- const value = renderTemplate(next, values);
140
- if (arg === "{agents}") {
141
- return agents;
142
- }
143
- if (arg === "{skill_name}") {
144
- return [
145
- value,
146
- ...extraSkillNames.flatMap((name) => ["--skill", name])
147
- ];
148
- }
149
- return value;
150
- }
151
- );
152
- return rendered;
153
- }
154
-
155
- // src/cli/skills-sync.ts
156
- import { spawn, spawnSync } from "child_process";
157
- import { createHash, randomUUID as randomUUID2 } from "crypto";
158
- import { homedir as homedir2 } from "os";
159
- import { gunzipSync } from "zlib";
160
- import {
161
- appendFileSync,
162
- existsSync as existsSync2,
163
- mkdirSync as mkdirSync2,
164
- readdirSync,
165
- readFileSync as readFileSync2,
166
- renameSync as renameSync2,
167
- rmSync as rmSync2,
168
- unlinkSync,
169
- writeFileSync as writeFileSync2
170
- } from "fs";
171
- import { dirname as dirname2, join as join2 } from "path";
26
+ } from "./chunk-OGSXENOF.mjs";
172
27
 
173
28
  // src/compat.ts
174
29
  import { randomUUID } from "crypto";
@@ -183,6 +38,7 @@ import {
183
38
  import { homedir } from "os";
184
39
  import { dirname, join } from "path";
185
40
  var CHECK_TIMEOUT_MS = 2e3;
41
+ var SDK_CLI_AUTO_UPDATE_CAPABILITY = "safe-continuation-v1";
186
42
  var SDK_COMPATIBILITY_TRUST_MS = 10 * 60 * 1e3;
187
43
  var SDK_COMPATIBILITY_CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
188
44
  var SDK_COMPATIBILITY_FAST_DEADLINE_MS = 400;
@@ -201,10 +57,10 @@ function shouldSkipCompatibilityCheck() {
201
57
  const value = process.env.DEEPLINE_SKIP_SDK_COMPAT_CHECK?.trim().toLowerCase();
202
58
  return value === "1" || value === "true" || value === "yes";
203
59
  }
204
- function sdkCompatibilityCachePath(baseUrl, homeDir = homedir()) {
60
+ function sdkCompatibilityCachePath(baseUrl, homeDir = process.env.HOME?.trim() || homedir()) {
205
61
  return join(sdkCliStateDirPath(baseUrl, homeDir), "compat-cache.json");
206
62
  }
207
- function legacySdkCompatibilityCachePath(homeDir = homedir()) {
63
+ function legacySdkCompatibilityCachePath(homeDir = process.env.HOME?.trim() || homedir()) {
208
64
  return join(homeDir, ".cache", "deepline", "sdk-compat-cache.json");
209
65
  }
210
66
  function compatibilityCacheKey(baseUrl, command, skillsVersion) {
@@ -244,6 +100,22 @@ function isSavedWithin(savedAt, windowMs, now) {
244
100
  const age = now - savedAt;
245
101
  return Number.isFinite(age) && age >= 0 && age <= windowMs;
246
102
  }
103
+ var UPDATE_ADVISORY_INTERVAL_MS = 24 * 60 * 60 * 1e3;
104
+ function claimUpdateAdvisory(baseUrl, now = Date.now()) {
105
+ const path = join(sdkCliStateDirPath(baseUrl), "update-advisory.json");
106
+ try {
107
+ const { shownAt } = JSON.parse(readFileSync(path, "utf8"));
108
+ if (isSavedWithin(shownAt, UPDATE_ADVISORY_INTERVAL_MS, now)) return false;
109
+ } catch {
110
+ }
111
+ try {
112
+ mkdirSync(dirname(path), { recursive: true });
113
+ writeFileSync(path, `${JSON.stringify({ shownAt: now })}
114
+ `);
115
+ } catch {
116
+ }
117
+ return true;
118
+ }
247
119
  function readCachedCompatibility(baseUrl, command, skillsVersion) {
248
120
  return readCachedCompatibilityEntry(baseUrl, command, skillsVersion)?.response ?? null;
249
121
  }
@@ -327,6 +199,9 @@ async function checkSdkCompatibility(baseUrl, options = {}) {
327
199
  }
328
200
  if (options.catalog) {
329
201
  url.searchParams.set("catalog_tool_id", options.catalog.toolId);
202
+ if (options.catalog.purpose) {
203
+ url.searchParams.set("catalog_purpose", options.catalog.purpose);
204
+ }
330
205
  }
331
206
  const response = await fetch(url, {
332
207
  method: "GET",
@@ -337,7 +212,9 @@ async function checkSdkCompatibility(baseUrl, options = {}) {
337
212
  "X-Deepline-API-Major": String(SDK_API_MAJOR),
338
213
  "X-Deepline-API-Contract": SDK_API_CONTRACT,
339
214
  "X-Deepline-CLI-Update-Preferences": "1",
340
- ...options.catalog ? { Authorization: `Bearer ${resolveApiKeyForBaseUrl(baseUrl)}` } : {}
215
+ "X-Deepline-CLI-Auto-Update-Capability": SDK_CLI_AUTO_UPDATE_CAPABILITY,
216
+ ...options.catalog ? { Authorization: `Bearer ${resolveApiKeyForBaseUrl(baseUrl)}` } : {},
217
+ ...options.catalog?.cliInvocationId ? { "X-Deepline-CLI-Invocation-ID": options.catalog.cliInvocationId } : {}
341
218
  },
342
219
  signal: controller.signal
343
220
  });
@@ -356,7 +233,7 @@ async function checkSdkCompatibility(baseUrl, options = {}) {
356
233
  data
357
234
  );
358
235
  }
359
- if (options.catalog && catalogMetadata && typeof catalogMetadata === "object" && "toolId" in catalogMetadata && catalogMetadata.toolId === options.catalog.toolId) {
236
+ if (data.ok && options.catalog && catalogMetadata && typeof catalogMetadata === "object" && "toolId" in catalogMetadata && catalogMetadata.toolId === options.catalog.toolId) {
360
237
  options.catalog.acceptMetadata(catalogMetadata);
361
238
  }
362
239
  return { response: data, error: null };
@@ -403,6 +280,269 @@ function enforceSdkCompatibilityResponse(response, options = {}) {
403
280
  }
404
281
  }
405
282
 
283
+ // contracts/install-commands.json
284
+ var install_commands_default = {
285
+ skills: {
286
+ index_path: "/.well-known/skills/index.json",
287
+ default_agents: [
288
+ "codex",
289
+ "claude-code",
290
+ "cursor",
291
+ "gemini-cli",
292
+ "antigravity"
293
+ ],
294
+ npx_binary: "npx",
295
+ npx_add_args_template: [
296
+ "--yes",
297
+ "skills@1.5.15",
298
+ "add",
299
+ "{skills_source_url}",
300
+ "--agent",
301
+ "{agents}",
302
+ "--global",
303
+ "--yes",
304
+ "--skill",
305
+ "{skill_name}",
306
+ "--full-depth"
307
+ ]
308
+ },
309
+ cli: {
310
+ sdk_npm_global: "npm install -g deepline@latest"
311
+ }
312
+ };
313
+
314
+ // src/cli/install-commands.ts
315
+ var INSTALL_COMMANDS = install_commands_default;
316
+ var skillsNpxPackage = INSTALL_COMMANDS.skills.npx_add_args_template.find(
317
+ (arg) => /^skills@\d+\.\d+\.\d+$/.test(arg)
318
+ );
319
+ if (!skillsNpxPackage) {
320
+ throw new Error(
321
+ "shared_libs/cli/install-commands.json must pin an exact skills package version."
322
+ );
323
+ }
324
+ var SKILLS_NPX_PACKAGE = skillsNpxPackage;
325
+ var DEFAULT_V1_SKILL_NAMES = [
326
+ "deepline-org-chart",
327
+ "build-tam",
328
+ "clay-to-deepline",
329
+ "deepline-analytics",
330
+ "deepline-engine",
331
+ // Retired: its guidance lives in `feedback send --help` and `sessions send
332
+ // --help`. Kept as a stub because installed CLIs list it and refuse to
333
+ // sync any skill when the published index lacks a listed name. Move to
334
+ // LEGACY_SKILL_NAMES_TO_REMOVE once those CLIs are out of the field.
335
+ "deepline-feedback",
336
+ "deepline-gtm",
337
+ "deepline-start",
338
+ "deepline-plays",
339
+ "deepline-quickstart",
340
+ "deepline-research",
341
+ "deepline-scoring",
342
+ "find-qualified-titles",
343
+ "linkedin-url-lookup",
344
+ // Deprecated alias for `deepline-scoring`, kept installable so saved prompts
345
+ // and scripts using `/niche-signal-discovery` keep routing to the renamed
346
+ // skill. Move to LEGACY_SKILL_NAMES_TO_REMOVE once the window closes.
347
+ "niche-signal-discovery",
348
+ "portfolio-prospecting"
349
+ ];
350
+ var DEFAULT_SDK_SKILL_NAMES = [...DEFAULT_V1_SKILL_NAMES];
351
+ var LEGACY_SKILL_NAMES_TO_REMOVE = [
352
+ "deepline-plays-feedback",
353
+ "deepline-plays-quickstart",
354
+ "workflow-hello-world"
355
+ ];
356
+ function normalizeBaseUrl(baseUrl) {
357
+ return baseUrl.replace(/\/$/, "");
358
+ }
359
+ function renderTemplate(template, values) {
360
+ return template.replace(/\{([a-z_]+)\}/g, (match, key) => {
361
+ return values[key] ?? match;
362
+ });
363
+ }
364
+ function skillsIndexUrl(baseUrl) {
365
+ return `${normalizeBaseUrl(baseUrl)}${INSTALL_COMMANDS.skills.index_path}`;
366
+ }
367
+ function skillsSourceUrl(baseUrl) {
368
+ return normalizeBaseUrl(baseUrl);
369
+ }
370
+ function buildSkillsAddArgs(baseUrl, skillName, options = {}) {
371
+ const skillNames = Array.isArray(skillName) ? skillName : [skillName];
372
+ const [firstSkillName, ...extraSkillNames] = skillNames;
373
+ const agents = options.agents ?? DEFAULT_SKILL_AGENTS;
374
+ const values = {
375
+ skills_index_url: skillsIndexUrl(baseUrl),
376
+ skills_source_url: skillsSourceUrl(baseUrl),
377
+ agents: agents.join(" "),
378
+ skill_name: firstSkillName ?? ""
379
+ };
380
+ const rendered = INSTALL_COMMANDS.skills.npx_add_args_template.flatMap(
381
+ (arg, index) => {
382
+ const next = index === 0 && options.firstArg ? options.firstArg : arg;
383
+ const value = renderTemplate(next, values);
384
+ if (arg === "{agents}") {
385
+ return agents;
386
+ }
387
+ if (arg === "{skill_name}") {
388
+ return [
389
+ value,
390
+ ...extraSkillNames.flatMap((name) => ["--skill", name])
391
+ ];
392
+ }
393
+ return value;
394
+ }
395
+ );
396
+ return rendered;
397
+ }
398
+
399
+ // src/cli/progress.ts
400
+ import { Worker } from "worker_threads";
401
+ var CliProgress = class {
402
+ lastMessage = null;
403
+ interactive = Boolean(process.stderr.isTTY);
404
+ grey = "\x1B[90m";
405
+ cyan = "\x1B[36m";
406
+ dim = "\x1B[2m";
407
+ reset = "\x1B[0m";
408
+ worker = null;
409
+ enabled;
410
+ // --json output is one JSON document: progress never renders under it.
411
+ constructor(enabled) {
412
+ this.enabled = enabled && !isJsonOutputMode();
413
+ }
414
+ phase(message) {
415
+ if (!this.enabled || this.lastMessage === message) {
416
+ return;
417
+ }
418
+ if (this.interactive && this.lastMessage) {
419
+ this.settle("\u2713");
420
+ }
421
+ this.lastMessage = message;
422
+ if (!this.interactive) {
423
+ process.stderr.write(`${message}
424
+ `);
425
+ return;
426
+ }
427
+ this.ensureWorker();
428
+ this.worker?.postMessage({ type: "phase", message });
429
+ }
430
+ complete() {
431
+ this.settle("\u2713");
432
+ }
433
+ fail() {
434
+ this.settle("\u2717");
435
+ }
436
+ writeLogLine(line) {
437
+ if (isJsonOutputMode()) return;
438
+ if (!this.enabled) {
439
+ process.stderr.write(`${line}
440
+ `);
441
+ return;
442
+ }
443
+ const message = this.interactive ? `${this.cyan}[logs]${this.reset} ${this.dim}${line}${this.reset}` : `[logs] ${line}`;
444
+ if (!this.interactive) {
445
+ process.stderr.write(`${message}
446
+ `);
447
+ return;
448
+ }
449
+ const activeMessage = this.lastMessage;
450
+ this.worker?.terminate().catch(() => void 0);
451
+ this.worker = null;
452
+ process.stderr.write(`\r\x1B[2K${message}
453
+ `);
454
+ if (activeMessage) {
455
+ this.startWorker().postMessage({ type: "phase", message: activeMessage });
456
+ }
457
+ }
458
+ writeLine(line, stream = process.stderr) {
459
+ if (!this.enabled || !this.interactive) {
460
+ stream.write(`${line}
461
+ `);
462
+ return;
463
+ }
464
+ const activeMessage = this.lastMessage;
465
+ this.worker?.terminate().catch(() => void 0);
466
+ this.worker = null;
467
+ stream.write(`\r\x1B[2K${line}
468
+ `);
469
+ if (activeMessage) {
470
+ this.startWorker().postMessage({ type: "phase", message: activeMessage });
471
+ }
472
+ }
473
+ settle(mark) {
474
+ if (!this.enabled || !this.lastMessage) {
475
+ return;
476
+ }
477
+ if (this.interactive) {
478
+ this.worker?.terminate().catch(() => void 0);
479
+ this.worker = null;
480
+ process.stderr.write(
481
+ `\r\x1B[2K${this.grey}${mark} ${this.lastMessage}${this.reset}
482
+ `
483
+ );
484
+ }
485
+ this.lastMessage = null;
486
+ }
487
+ ensureWorker() {
488
+ this.startWorker();
489
+ }
490
+ startWorker() {
491
+ if (this.worker) {
492
+ return this.worker;
493
+ }
494
+ this.worker = new Worker(
495
+ `
496
+ const { parentPort } = require('node:worker_threads');
497
+ const { writeSync } = require('node:fs');
498
+ const frames = ['\u2014', '\\\\', '|', '/'];
499
+ const grey = '\\x1b[90m';
500
+ const reset = '\\x1b[0m';
501
+ let message = '';
502
+ let frameIndex = 0;
503
+ let timer = null;
504
+ function render() {
505
+ if (!message) return;
506
+ const frame = frames[frameIndex % frames.length] || '\u2014';
507
+ frameIndex += 1;
508
+ writeSync(2, '\\r\\x1b[2K' + grey + frame + ' ' + message + reset);
509
+ }
510
+ parentPort.on('message', (event) => {
511
+ if (event.type === 'phase') {
512
+ message = String(event.message || '');
513
+ frameIndex = 0;
514
+ render();
515
+ if (!timer) {
516
+ timer = setInterval(render, 120);
517
+ timer.unref && timer.unref();
518
+ }
519
+ }
520
+ if (event.type === 'stop') {
521
+ if (timer) clearInterval(timer);
522
+ timer = null;
523
+ writeSync(2, '\\r\\x1b[2K');
524
+ }
525
+ });
526
+ `,
527
+ { eval: true }
528
+ );
529
+ this.worker.unref();
530
+ return this.worker;
531
+ }
532
+ };
533
+ var activeProgress = null;
534
+ function setActiveCliProgress(progress) {
535
+ activeProgress = progress;
536
+ }
537
+ function getActiveCliProgress() {
538
+ return activeProgress;
539
+ }
540
+ function createCliProgress(enabled) {
541
+ const progress = new CliProgress(enabled);
542
+ setActiveCliProgress(progress);
543
+ return progress;
544
+ }
545
+
406
546
  // src/cli/windows-arg-escape.ts
407
547
  import { statSync } from "fs";
408
548
  import { win32 } from "path";
@@ -547,7 +687,13 @@ function classifyNetworkFailure(error) {
547
687
  if (combined.includes("remotedisconnected") || combined.includes("remote end closed connection") || combined.includes("other side closed") || combined.includes("socket hang up")) {
548
688
  return "network_remote_disconnected";
549
689
  }
550
- if (combined.includes("ssl") || combined.includes("tls") || combined.includes("unexpected_eof_while_reading")) {
690
+ if (
691
+ // Local filenames and retry commands may contain "ssl" or "tls".
692
+ // Require a transport identifier or protocol failure text instead.
693
+ code.includes("ssl") || code.includes("tls") || name.includes("ssl") || name.includes("tls") || /(?:^|[\s[(:])(?:ssl|tls)[\s:_-]+(?:error|handshake|certificate|routines|connection|failed|failure)(?:$|[\s:_-])/.test(
694
+ text
695
+ ) || combined.includes("unexpected_eof_while_reading")
696
+ ) {
551
697
  return "network_ssl_error";
552
698
  }
553
699
  current = record.cause ?? record.context;
@@ -833,6 +979,22 @@ async function maybeReportSdkCliFailure(input) {
833
979
  }
834
980
 
835
981
  // src/cli/skills-sync.ts
982
+ import { spawn, spawnSync } from "child_process";
983
+ import { createHash, randomUUID as randomUUID2 } from "crypto";
984
+ import { homedir as homedir2 } from "os";
985
+ import { gunzipSync } from "zlib";
986
+ import {
987
+ appendFileSync,
988
+ existsSync as existsSync2,
989
+ mkdirSync as mkdirSync2,
990
+ readdirSync,
991
+ readFileSync as readFileSync2,
992
+ renameSync as renameSync2,
993
+ rmSync as rmSync2,
994
+ unlinkSync,
995
+ writeFileSync as writeFileSync2
996
+ } from "fs";
997
+ import { dirname as dirname2, join as join2 } from "path";
836
998
  var CHECK_TIMEOUT_MS2 = 3e3;
837
999
  var INSTALLER_PROBE_TIMEOUT_MS = 1e3;
838
1000
  var PUBLISHED_VERIFICATION_RETRY_MS = 5 * 6e4;
@@ -1907,474 +2069,20 @@ async function runInlineSkillsSync(baseUrl, remoteVersion, agents, notices) {
1907
2069
  notice("Deepline agent skills are up to date.");
1908
2070
  }
1909
2071
 
1910
- // src/cli/commands/skills.ts
1911
- var SKILLS_INSTALL_LEASE_WAIT_MS = 9e4;
1912
- var SKILLS_PROCESS_TIMEOUT_MS = 45e3;
1913
- var RUNTIME_TO_SKILLS_AGENT = {
1914
- antigravity: "antigravity",
1915
- claude_code: "claude-code",
1916
- claude_cowork: "claude-code",
1917
- cline: "cline",
1918
- codex: "codex",
1919
- cursor: "cursor",
1920
- gemini: "gemini-cli",
1921
- windsurf: "windsurf"
1922
- };
1923
- var AGENT_MARKERS = [
1924
- { agent: "codex", paths: [".codex"] },
1925
- { agent: "claude-code", paths: [".claude"] },
1926
- { agent: "cursor", paths: [".cursor"] },
1927
- { agent: "gemini-cli", paths: [".gemini", ".gemini-cli"] },
1928
- { agent: "antigravity", paths: [".antigravity"] }
1929
- ];
1930
- var WORKSPACE_SKILL_ROOTS_BY_AGENT = {
1931
- antigravity: [".agents"],
1932
- "claude-code": [".claude"],
1933
- cline: [".agents"],
1934
- codex: [".agents"],
1935
- cursor: [".agents"],
1936
- "gemini-cli": [".agents"],
1937
- windsurf: [".windsurf"],
1938
- "*": [".agents", ".claude", ".windsurf"]
1939
- };
1940
- function workspaceSkillRootsForAgents(agents) {
1941
- return [
1942
- ...new Set(
1943
- agents.flatMap((agent) => WORKSPACE_SKILL_ROOTS_BY_AGENT[agent] ?? [])
1944
- )
1945
- ].sort((a, b) => a.localeCompare(b));
1946
- }
1947
- function normalizeScope(value) {
1948
- if (value === "global") return "global";
1949
- if (value === "local") return "local";
1950
- if (!value) return inferActiveSkillsScope();
1951
- throw new Error("--scope must be one of: global, local");
1952
- }
1953
- function inferActiveSkillsScope(entrypoint = process.argv[1] ?? "") {
1954
- return /[\\/]\.deepline[\\/]runtime[\\/]/.test(entrypoint) ? "local" : "global";
1955
- }
1956
- function resolveLocalRoot() {
1957
- const target = resolveProjectPinTarget();
1958
- if (!target.ok) {
1959
- throw new Error(
1960
- `Cowork project folder is ambiguous. Candidate folders: ${target.candidates.join(
1961
- ", "
1962
- )}. Set CLAUDE_PROJECT_DIR or cd into the intended project folder.`
1963
- );
1964
- }
1965
- return target.dir;
1966
- }
1967
- function detectSkillsAgents(input) {
1968
- const runtime = input.runtime ?? detectAgentRuntime();
1969
- const knownAgent = RUNTIME_TO_SKILLS_AGENT[runtime];
1970
- if (knownAgent) return [knownAgent];
1971
- const roots = [
1972
- ...input.scope === "local" && input.root ? [input.root] : [],
1973
- input.homeDir ?? homedir3()
1974
- ];
1975
- const detected = AGENT_MARKERS.filter(
1976
- (marker) => roots.some(
1977
- (root) => marker.paths.some((path) => existsSync3(join3(root, path)))
1978
- )
1979
- ).map((marker) => marker.agent);
1980
- return detected.length > 0 ? detected : ["*"];
1981
- }
1982
- function skillsStatePathForScope(baseUrl, scope, root) {
1983
- return scope === "local" && root ? join3(root, ".deepline", "setup", "skills.json") : join3(sdkCliStateDirPath(baseUrl), "skills-install.json");
1984
- }
1985
- function buildSkillsPlan(input) {
1986
- const scopeArgs = input.scope === "global" ? ["--global"] : [];
1987
- const legacyNames = [...LEGACY_SKILL_NAMES_TO_REMOVE].sort(
1988
- (a, b) => a.localeCompare(b)
1989
- );
1990
- return {
1991
- scope: input.scope,
1992
- root: input.root,
1993
- agents: input.agents,
1994
- skillNames: input.skillNames,
1995
- version: input.version,
1996
- remove: {
1997
- command: "npm",
1998
- args: [
1999
- "exec",
2000
- "--yes",
2001
- `--package=${SKILLS_NPX_PACKAGE}`,
2002
- "--",
2003
- "skills",
2004
- "remove",
2005
- ...scopeArgs,
2006
- "--agent",
2007
- ...input.agents,
2008
- "-y",
2009
- ...legacyNames
2010
- ]
2011
- },
2012
- install: {
2013
- command: "npm",
2014
- args: [
2015
- "exec",
2016
- "--yes",
2017
- `--package=${SKILLS_NPX_PACKAGE}`,
2018
- "--",
2019
- "skills",
2020
- "add",
2021
- skillsSourceUrl(input.baseUrl),
2022
- "--agent",
2023
- ...input.agents,
2024
- ...scopeArgs,
2025
- "--yes",
2026
- ...input.skillNames.flatMap((name) => ["--skill", name]),
2027
- "--full-depth"
2028
- ]
2029
- },
2030
- statePath: skillsStatePathForScope(input.baseUrl, input.scope, input.root)
2031
- };
2032
- }
2033
- function sortedStrings(value) {
2034
- if (!Array.isArray(value) || value.some((entry) => typeof entry !== "string")) {
2035
- return null;
2036
- }
2037
- return [...value].sort((a, b) => a.localeCompare(b));
2038
- }
2039
- function isSkillsPlanCurrent(plan, state) {
2040
- if (!state || state.scope !== plan.scope || state.skillsVersion !== plan.version) {
2041
- return false;
2042
- }
2043
- const installedAgents = sortedStrings(state.agents);
2044
- const installedSkillNames = sortedStrings(state.skillNames);
2045
- if (!installedAgents || !installedSkillNames) return false;
2046
- return installedAgents.join("\0") === [...plan.agents].sort((a, b) => a.localeCompare(b)).join("\0") && installedSkillNames.join("\0") === [...plan.skillNames].sort((a, b) => a.localeCompare(b)).join("\0");
2047
- }
2048
- function readSkillsInstallState(path) {
2049
- try {
2050
- const parsed = JSON.parse(readFileSync3(path, "utf8"));
2051
- return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
2052
- } catch {
2053
- return null;
2054
- }
2055
- }
2056
- function runProcess(command, args, cwd) {
2057
- return new Promise((resolve, reject) => {
2058
- const plan = resolveShellSpawn(
2059
- command,
2060
- args,
2061
- process.platform,
2062
- process.env,
2063
- cwd
2064
- );
2065
- const child = spawn2(plan.command, plan.args, {
2066
- cwd,
2067
- env: process.env,
2068
- stdio: ["ignore", "ignore", "pipe"],
2069
- shell: plan.shell
2070
- });
2071
- let stderr = "";
2072
- child.stderr.on("data", (chunk) => {
2073
- stderr += chunk.toString("utf8");
2074
- process.stderr.write(chunk);
2075
- });
2076
- const timeout = setTimeout(() => {
2077
- child.kill("SIGTERM");
2078
- reject(
2079
- new Error(
2080
- `${SKILLS_NPX_PACKAGE} timed out after ${SKILLS_PROCESS_TIMEOUT_MS}ms.`
2081
- )
2082
- );
2083
- }, SKILLS_PROCESS_TIMEOUT_MS);
2084
- child.once("error", (error) => {
2085
- clearTimeout(timeout);
2086
- reject(error);
2087
- });
2088
- child.once("close", (code) => {
2089
- clearTimeout(timeout);
2090
- if (code && stderr.trim()) {
2091
- process.stderr.write(`${SKILLS_NPX_PACKAGE} exited ${code}.
2092
- `);
2093
- }
2094
- resolve(code ?? 1);
2095
- });
2096
- });
2097
- }
2098
- async function runSkillsCommand(options, dependencies = {}) {
2099
- let scope;
2100
- let root;
2101
- try {
2102
- scope = normalizeScope(options.scope);
2103
- root = scope === "local" ? resolveLocalRoot() : null;
2104
- } catch (error) {
2105
- printCommandEnvelope(
2106
- {
2107
- ok: false,
2108
- status: "failed",
2109
- code: "INVALID_SKILLS_SCOPE",
2110
- exitCode: 2,
2111
- message: error instanceof Error ? error.message : String(error)
2112
- },
2113
- { json: options.json }
2114
- );
2115
- return 2;
2116
- }
2117
- const baseUrl = autoDetectBaseUrl().replace(/\/$/, "");
2118
- const catalog = {
2119
- skillNames: [...DEFAULT_SDK_SKILL_NAMES],
2120
- version: SDK_VERSION
2121
- };
2122
- const agents = options.agent ? [options.agent] : detectSkillsAgents({ scope, root });
2123
- const plan = buildSkillsPlan({ baseUrl, scope, root, agents, ...catalog });
2124
- if (options.dryRun) {
2125
- printCommandEnvelope(
2126
- { ok: true, status: "planned", dryRun: true, ...plan },
2127
- { json: options.json }
2128
- );
2129
- return 0;
2130
- }
2131
- if (isSkillsPlanCurrent(plan, readSkillsInstallState(plan.statePath)) && !hasFailedAutomaticSkillsSync(baseUrl, agents)) {
2132
- printCommandEnvelope(
2133
- {
2134
- ok: true,
2135
- status: "current",
2136
- complete: true,
2137
- changed: false,
2138
- skipped: true,
2139
- skipReason: "skills_version_current",
2140
- scope,
2141
- agents,
2142
- skillsVersion: plan.version,
2143
- skillCount: plan.skillNames.length,
2144
- statePath: plan.statePath,
2145
- render: {
2146
- sections: [
2147
- {
2148
- title: "skills",
2149
- lines: [
2150
- `Scope: ${scope}`,
2151
- `Agents: ${agents.join(", ")}`,
2152
- `Current: ${plan.skillNames.length}`
2153
- ]
2154
- }
2155
- ]
2156
- }
2157
- },
2158
- { json: options.json }
2159
- );
2160
- return 0;
2161
- }
2162
- if (scope === "local" && root) {
2163
- const managedNames = [
2164
- .../* @__PURE__ */ new Set([...plan.skillNames, ...LEGACY_SKILL_NAMES_TO_REMOVE])
2165
- ];
2166
- const agentRoots = workspaceSkillRootsForAgents(plan.agents);
2167
- ensureProjectPrivatePathsIgnored(root, [
2168
- ".deepline/",
2169
- ...agentRoots.flatMap(
2170
- (agentRoot) => managedNames.map((name) => `${agentRoot}/skills/${name}/`)
2171
- )
2172
- ]);
2173
- }
2174
- let lease;
2175
- try {
2176
- lease = scope === "global" ? await acquireSkillsInstallLease(baseUrl, agents, plan.version, {
2177
- waitMs: dependencies.installLeaseWaitMs ?? SKILLS_INSTALL_LEASE_WAIT_MS,
2178
- onWait: () => process.stderr.write(
2179
- "Waiting for a background Deepline skills refresh to finish...\n"
2180
- )
2181
- }) : { release: () => {
2182
- } };
2183
- } catch (error) {
2184
- if (!(error instanceof SkillsStateUnavailableError)) throw error;
2185
- printCommandEnvelope(
2186
- {
2187
- ok: false,
2188
- status: "failed",
2189
- code: "SKILLS_STATE_UNAVAILABLE",
2190
- exitCode: 5,
2191
- scope,
2192
- agents,
2193
- message: error.message,
2194
- next: `Resolve this filesystem error, then run: deepline skills --scope ${scope}`
2195
- },
2196
- { json: options.json }
2197
- );
2198
- return 5;
2199
- }
2200
- if (!lease) {
2201
- printCommandEnvelope(
2202
- {
2203
- ok: false,
2204
- status: "failed",
2205
- code: "SKILLS_SYNC_IN_PROGRESS",
2206
- exitCode: 7,
2207
- scope,
2208
- agents,
2209
- message: "A background Deepline skills refresh is still running for these agents.",
2210
- next: `Retry in a moment: deepline skills --scope ${scope}. If no refresh is running, remove ${skillsInstallLeasePath(baseUrl, agents)}`
2211
- },
2212
- { json: options.json }
2213
- );
2214
- return 7;
2215
- }
2216
- try {
2217
- return await runSkillsInstallWithLease({
2218
- options,
2219
- dependencies,
2220
- baseUrl,
2221
- scope,
2222
- root,
2223
- agents,
2224
- plan
2225
- });
2226
- } finally {
2227
- lease.release();
2228
- }
2229
- }
2230
- async function runSkillsInstallWithLease(input) {
2231
- const { options, dependencies, baseUrl, scope, root, agents, plan } = input;
2232
- process.stderr.write(
2233
- `Replacing Deepline skills for ${agents.join(", ")} (${scope})...
2234
- `
2235
- );
2236
- const execute = dependencies.runProcess ?? runProcess;
2237
- try {
2238
- const installCode = await execute(
2239
- plan.install.command,
2240
- plan.install.args,
2241
- root ?? void 0
2242
- );
2243
- if (installCode !== 0) {
2244
- throw new Error("Could not install the current Deepline skills.");
2245
- }
2246
- } catch (error) {
2247
- printCommandEnvelope(
2248
- {
2249
- ok: false,
2250
- status: "failed",
2251
- code: "SKILLS_INSTALL_FAILED",
2252
- exitCode: 5,
2253
- scope,
2254
- agents,
2255
- message: error instanceof Error ? error.message : String(error),
2256
- next: `deepline skills --scope ${scope}`
2257
- },
2258
- { json: options.json }
2259
- );
2260
- return 5;
2261
- }
2262
- try {
2263
- const removeCode = await execute(
2264
- plan.remove.command,
2265
- plan.remove.args,
2266
- root ?? void 0
2267
- );
2268
- if (removeCode !== 0) {
2269
- process.stderr.write(
2270
- "Current Deepline skills installed, but legacy skill cleanup failed. The installed skills remain usable.\n"
2271
- );
2272
- }
2273
- } catch (error) {
2274
- process.stderr.write(
2275
- `Current Deepline skills installed, but legacy skill cleanup failed: ${error instanceof Error ? error.message : String(error)}. The installed skills remain usable.
2276
- `
2277
- );
2278
- }
2279
- mkdirSync3(dirname3(plan.statePath), { recursive: true });
2280
- writeFileSync3(
2281
- plan.statePath,
2282
- `${JSON.stringify(
2283
- {
2284
- schemaVersion: 1,
2285
- installedAt: (/* @__PURE__ */ new Date()).toISOString(),
2286
- cliVersion: SDK_VERSION,
2287
- scope,
2288
- agents,
2289
- skillsVersion: plan.version,
2290
- skillNames: plan.skillNames
2291
- },
2292
- null,
2293
- 2
2294
- )}
2295
- `,
2296
- "utf8"
2297
- );
2298
- if (scope === "global") {
2299
- clearFailedAutomaticSkillsSync(baseUrl, agents);
2300
- }
2301
- printCommandEnvelope(
2302
- {
2303
- ok: true,
2304
- status: "complete",
2305
- scope,
2306
- agents,
2307
- skillsVersion: plan.version,
2308
- skillCount: plan.skillNames.length,
2309
- statePath: plan.statePath,
2310
- render: {
2311
- sections: [
2312
- {
2313
- title: "skills",
2314
- lines: [
2315
- `Scope: ${scope}`,
2316
- `Agents: ${agents.join(", ")}`,
2317
- `Installed: ${plan.skillNames.length}`
2318
- ]
2319
- }
2320
- ]
2321
- }
2322
- },
2323
- { json: options.json }
2324
- );
2325
- return 0;
2326
- }
2327
- function registerSkillsCommand(program) {
2328
- program.command("skills").description("Replace Deepline agent skills with the current release.").option("--scope <scope>", "Install scope: global or local").option("--agent <agent>", "Override the detected agent target").option("--dry-run", "Print the install plan without changing files").option("--json", "Emit one JSON result envelope").addHelpText(
2329
- "after",
2330
- `
2331
- Notes:
2332
- This command reinstalls current Deepline-managed skills using ${SKILLS_NPX_PACKAGE},
2333
- then removes legacy Deepline skill names. Local scope writes into the resolved
2334
- persistent project.
2335
-
2336
- Examples:
2337
- deepline skills
2338
- deepline skills --scope local
2339
- deepline skills --agent codex --dry-run
2340
- `
2341
- ).action(async (options) => {
2342
- process.exitCode = await runSkillsCommand(options);
2343
- });
2344
- program.command(SKILLS_AUTO_SYNC_COMMAND, { hidden: true }).description("Refresh Deepline agent skills in the background.").option(
2345
- "--claim <token>",
2346
- "Owner token of the leases this child was started for."
2347
- ).action(async (options) => {
2348
- const claim = options.claim?.trim();
2349
- if (!claim) {
2350
- printCommandEnvelope(
2351
- {
2352
- ok: false,
2353
- status: "failed",
2354
- code: "SKILLS_AUTO_SYNC_CLAIM_REQUIRED",
2355
- exitCode: 2,
2356
- message: "skills-auto-sync is started by ordinary deepline commands and requires the lease token they pass; run `deepline skills` to install skills yourself."
2357
- },
2358
- { json: true }
2359
- );
2360
- process.exitCode = 2;
2361
- return;
2362
- }
2363
- await syncSdkSkillsIfNeeded(autoDetectBaseUrl().replace(/\/$/, ""), {
2364
- mode: "inline",
2365
- notices: "defer",
2366
- claim
2367
- });
2368
- });
2369
- }
2370
-
2371
2072
  export {
2372
2073
  SDK_COMPATIBILITY_FAST_DEADLINE_MS,
2373
2074
  readFreshCleanCompatibility,
2374
2075
  readTrustedCleanCompatibility,
2076
+ claimUpdateAdvisory,
2375
2077
  checkSdkCompatibility,
2376
2078
  isCiEnvironment,
2377
2079
  enforceSdkCompatibilityResponse,
2080
+ SKILLS_NPX_PACKAGE,
2081
+ DEFAULT_SDK_SKILL_NAMES,
2082
+ LEGACY_SKILL_NAMES_TO_REMOVE,
2083
+ skillsSourceUrl,
2084
+ getActiveCliProgress,
2085
+ createCliProgress,
2378
2086
  resolveShellSpawn,
2379
2087
  isFailureReportingDisabled,
2380
2088
  redactFailureText,
@@ -2382,15 +2090,12 @@ export {
2382
2090
  failureReportHeaders,
2383
2091
  resolveSdkCliFailureExitCode,
2384
2092
  maybeReportSdkCliFailure,
2093
+ SkillsStateUnavailableError,
2094
+ acquireSkillsInstallLease,
2095
+ skillsInstallLeasePath,
2385
2096
  flushDeferredSkillsSyncNotices,
2386
2097
  SKILLS_AUTO_SYNC_COMMAND,
2387
- syncSdkSkillsIfNeeded,
2388
- workspaceSkillRootsForAgents,
2389
- inferActiveSkillsScope,
2390
- detectSkillsAgents,
2391
- skillsStatePathForScope,
2392
- buildSkillsPlan,
2393
- isSkillsPlanCurrent,
2394
- runSkillsCommand,
2395
- registerSkillsCommand
2098
+ hasFailedAutomaticSkillsSync,
2099
+ clearFailedAutomaticSkillsSync,
2100
+ syncSdkSkillsIfNeeded
2396
2101
  };