t3code-cli 0.13.0 → 0.14.0

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 (323) hide show
  1. package/README.md +87 -1
  2. package/dist/application.d.ts +2 -0
  3. package/dist/application.js +1 -1
  4. package/dist/auth.d.ts +50 -0
  5. package/dist/auth.js +1 -1
  6. package/dist/bin.d.ts +1 -0
  7. package/dist/bin.js +348 -603
  8. package/dist/cli.d.ts +66 -0
  9. package/dist/cli.js +1 -1
  10. package/dist/client-runtime/authorization.d.ts +2 -0
  11. package/dist/client-runtime/authorization.js +2 -0
  12. package/dist/client-runtime/connection.d.ts +2 -0
  13. package/dist/client-runtime/connection.js +2 -0
  14. package/dist/client-runtime/environment.d.ts +57 -0
  15. package/dist/client-runtime/environment.js +2 -0
  16. package/dist/client-runtime/errors.d.ts +28 -0
  17. package/dist/client-runtime/errors.js +35 -0
  18. package/dist/client-runtime/operations/projects.d.ts +2 -0
  19. package/dist/client-runtime/operations/projects.js +2 -0
  20. package/dist/client-runtime/operations.d.ts +2 -0
  21. package/dist/client-runtime/operations.js +2 -0
  22. package/dist/client-runtime/platform.d.ts +26 -0
  23. package/dist/client-runtime/platform.js +74 -0
  24. package/dist/client-runtime/relay.d.ts +121 -0
  25. package/dist/client-runtime/relay.js +245 -0
  26. package/dist/client-runtime/rpc.d.ts +2 -0
  27. package/dist/client-runtime/rpc.js +2 -0
  28. package/dist/client-runtime/state/assets.d.ts +40 -0
  29. package/dist/client-runtime/state/assets.js +53 -0
  30. package/dist/client-runtime/state/auth.d.ts +98 -0
  31. package/dist/client-runtime/state/auth.js +48 -0
  32. package/dist/client-runtime/state/connections.d.ts +2 -0
  33. package/dist/client-runtime/state/connections.js +52 -0
  34. package/dist/client-runtime/state/entities.d.ts +33 -0
  35. package/dist/client-runtime/state/entities.js +2 -0
  36. package/dist/client-runtime/state/filesystem.d.ts +42 -0
  37. package/dist/client-runtime/state/filesystem.js +48 -0
  38. package/dist/client-runtime/state/git.d.ts +43 -0
  39. package/dist/client-runtime/state/git.js +18 -0
  40. package/dist/client-runtime/state/models.d.ts +2 -0
  41. package/dist/client-runtime/state/models.js +2 -0
  42. package/dist/client-runtime/state/orchestration.d.ts +128 -0
  43. package/dist/client-runtime/state/orchestration.js +20 -0
  44. package/dist/client-runtime/state/presentation.d.ts +277 -0
  45. package/dist/client-runtime/state/presentation.js +34 -0
  46. package/dist/client-runtime/state/preview.d.ts +447 -0
  47. package/dist/client-runtime/state/preview.js +103 -0
  48. package/dist/client-runtime/state/project-grouping.d.ts +26 -0
  49. package/dist/client-runtime/state/project-grouping.js +73 -0
  50. package/dist/client-runtime/state/projects.d.ts +192 -0
  51. package/dist/client-runtime/state/projects.js +2 -0
  52. package/dist/client-runtime/state/relay.d.ts +10 -0
  53. package/dist/client-runtime/state/relay.js +19 -0
  54. package/dist/client-runtime/state/review.d.ts +28 -0
  55. package/dist/client-runtime/state/review.js +11 -0
  56. package/dist/client-runtime/state/runtime.d.ts +2 -0
  57. package/dist/client-runtime/state/runtime.js +2 -0
  58. package/dist/client-runtime/state/server.d.ts +1495 -0
  59. package/dist/client-runtime/state/server.js +207 -0
  60. package/dist/client-runtime/state/session.d.ts +532 -0
  61. package/dist/client-runtime/state/session.js +21 -0
  62. package/dist/client-runtime/state/shell.d.ts +529 -0
  63. package/dist/client-runtime/state/shell.js +2 -0
  64. package/dist/client-runtime/state/source-control.d.ts +92 -0
  65. package/dist/client-runtime/state/source-control.js +36 -0
  66. package/dist/client-runtime/state/terminal.d.ts +237 -0
  67. package/dist/client-runtime/state/terminal.js +173 -0
  68. package/dist/client-runtime/state/thread-settled.d.ts +104 -0
  69. package/dist/client-runtime/state/thread-settled.js +157 -0
  70. package/dist/client-runtime/state/thread-sort.d.ts +23 -0
  71. package/dist/client-runtime/state/thread-sort.js +47 -0
  72. package/dist/client-runtime/state/threads.d.ts +538 -0
  73. package/dist/client-runtime/state/threads.js +934 -0
  74. package/dist/client-runtime/state/vcs.d.ts +442 -0
  75. package/dist/client-runtime/state/vcs.js +756 -0
  76. package/dist/config.d.ts +84 -0
  77. package/dist/config.js +1 -1
  78. package/dist/connection.d.ts +7 -0
  79. package/dist/connection.js +1 -1
  80. package/dist/contracts.d.ts +2 -0
  81. package/dist/contracts.js +2 -1
  82. package/dist/index.d.ts +2 -0
  83. package/dist/index.js +1 -1
  84. package/dist/node.d.ts +6 -0
  85. package/dist/node.js +1 -1
  86. package/dist/orchestration.d.ts +1420 -0
  87. package/dist/orchestration.js +1 -1
  88. package/dist/preview.d.ts +2 -0
  89. package/dist/preview.js +2 -0
  90. package/dist/rpc.d.ts +6043 -0
  91. package/dist/rpc.js +1 -1
  92. package/dist/runtime.d.ts +2 -0
  93. package/dist/runtime.js +2 -2
  94. package/dist/shared/DrainableWorker.d.ts +28 -0
  95. package/dist/shared/DrainableWorker.js +24 -0
  96. package/dist/shared/KeyedCoalescingWorker.d.ts +13 -0
  97. package/dist/shared/KeyedCoalescingWorker.js +89 -0
  98. package/dist/shared/Net.d.ts +43 -0
  99. package/dist/shared/Net.js +126 -0
  100. package/dist/shared/String.d.ts +4 -0
  101. package/dist/shared/String.js +8 -0
  102. package/dist/shared/Struct.d.ts +5 -0
  103. package/dist/shared/Struct.js +2 -0
  104. package/dist/shared/advertisedEndpoint.d.ts +2 -0
  105. package/dist/shared/advertisedEndpoint.js +2 -0
  106. package/dist/shared/agentAwareness.d.ts +27 -0
  107. package/dist/shared/agentAwareness.js +54 -0
  108. package/dist/shared/backgroundActivitySettings.d.ts +23 -0
  109. package/dist/shared/backgroundActivitySettings.js +2 -0
  110. package/dist/shared/chatList.d.ts +12 -0
  111. package/dist/shared/chatList.js +14 -0
  112. package/dist/shared/cliArgs.d.ts +33 -0
  113. package/dist/shared/cliArgs.js +103 -0
  114. package/dist/shared/composerInlineTokens.d.ts +20 -0
  115. package/dist/shared/composerInlineTokens.js +72 -0
  116. package/dist/shared/composerTrigger.d.ts +26 -0
  117. package/dist/shared/composerTrigger.js +97 -0
  118. package/dist/shared/connectAuth.d.ts +58 -0
  119. package/dist/shared/connectAuth.js +89 -0
  120. package/dist/shared/devHome.d.ts +21 -0
  121. package/dist/shared/devHome.js +65 -0
  122. package/dist/shared/devProxy.d.ts +15 -0
  123. package/dist/shared/devProxy.js +22 -0
  124. package/dist/shared/dpop.d.ts +32 -0
  125. package/dist/shared/dpop.js +2724 -0
  126. package/dist/shared/dpopCommon.d.ts +2 -0
  127. package/dist/shared/dpopCommon.js +2 -0
  128. package/dist/shared/filePreview.d.ts +8 -0
  129. package/dist/shared/filePreview.js +31 -0
  130. package/dist/shared/git.d.ts +41 -0
  131. package/dist/shared/git.js +2 -0
  132. package/dist/shared/hostProcess.d.ts +13 -0
  133. package/dist/shared/hostProcess.js +2 -0
  134. package/dist/shared/httpObservability.d.ts +5 -0
  135. package/dist/shared/httpObservability.js +2 -0
  136. package/dist/shared/httpReadiness.d.ts +38 -0
  137. package/dist/shared/httpReadiness.js +110 -0
  138. package/dist/shared/keybindings.d.ts +35 -0
  139. package/dist/shared/keybindings.js +330 -0
  140. package/dist/shared/logging.d.ts +39 -0
  141. package/dist/shared/logging.js +2 -0
  142. package/dist/shared/model.d.ts +44 -0
  143. package/dist/shared/model.js +2 -0
  144. package/dist/shared/oauthScope.d.ts +23 -0
  145. package/dist/shared/oauthScope.js +2 -0
  146. package/dist/shared/observability.d.ts +105 -0
  147. package/dist/shared/observability.js +346 -0
  148. package/dist/shared/orchestrationTiming.d.ts +16 -0
  149. package/dist/shared/orchestrationTiming.js +32 -0
  150. package/dist/shared/path.d.ts +2 -0
  151. package/dist/shared/path.js +2 -0
  152. package/dist/shared/preview.d.ts +35 -0
  153. package/dist/shared/preview.js +103 -0
  154. package/dist/shared/previewViewport.d.ts +16 -0
  155. package/dist/shared/previewViewport.js +159 -0
  156. package/dist/shared/projectFavicon.d.ts +5 -0
  157. package/dist/shared/projectFavicon.js +13 -0
  158. package/dist/shared/projectScripts.d.ts +19 -0
  159. package/dist/shared/projectScripts.js +18 -0
  160. package/dist/shared/qrCode.d.ts +87 -0
  161. package/dist/shared/qrCode.js +870 -0
  162. package/dist/shared/relayAuth.d.ts +27 -0
  163. package/dist/shared/relayAuth.js +83 -0
  164. package/dist/shared/relayClient.d.ts +58 -0
  165. package/dist/shared/relayClient.js +245 -0
  166. package/dist/shared/relayJwt.d.ts +39 -0
  167. package/dist/shared/relayJwt.js +2 -0
  168. package/dist/shared/relaySigning.d.ts +4 -0
  169. package/dist/shared/relaySigning.js +2 -0
  170. package/dist/shared/relayTracing.d.ts +25 -0
  171. package/dist/shared/relayTracing.js +2 -0
  172. package/dist/shared/relayUrl.d.ts +5 -0
  173. package/dist/shared/relayUrl.js +2 -0
  174. package/dist/shared/remote.d.ts +57 -0
  175. package/dist/shared/remote.js +2 -0
  176. package/dist/shared/schemaJson.d.ts +35 -0
  177. package/dist/shared/schemaJson.js +2 -0
  178. package/dist/shared/schemaYaml.d.ts +86 -0
  179. package/dist/shared/schemaYaml.js +99 -0
  180. package/dist/shared/searchRanking.d.ts +30 -0
  181. package/dist/shared/searchRanking.js +99 -0
  182. package/dist/shared/semver.d.ts +23 -0
  183. package/dist/shared/semver.js +124 -0
  184. package/dist/shared/serverSettings.d.ts +19 -0
  185. package/dist/shared/serverSettings.js +103 -0
  186. package/dist/shared/shell.d.ts +51 -0
  187. package/dist/shared/shell.js +408 -0
  188. package/dist/shared/sourceControl.d.ts +26 -0
  189. package/dist/shared/sourceControl.js +2 -0
  190. package/dist/shared/t3ProjectFile.d.ts +27 -0
  191. package/dist/shared/t3ProjectFile.js +25 -0
  192. package/dist/shared/terminalLabels.d.ts +16 -0
  193. package/dist/shared/terminalLabels.js +28 -0
  194. package/dist/shared/toolActivity.d.ts +16 -0
  195. package/dist/shared/toolActivity.js +159 -0
  196. package/dist/shared.d.ts +43036 -0
  197. package/dist/shared.js +25428 -12277
  198. package/dist/t3tools.d.ts +2 -0
  199. package/dist/t3tools.js +1 -1
  200. package/package.json +39 -21
  201. package/src/auth/index.ts +2 -0
  202. package/src/auth/pairing.ts +8 -5
  203. package/src/auth/service.ts +2 -1
  204. package/src/auth/transport.ts +4 -0
  205. package/src/auth/type.ts +6 -0
  206. package/src/cli/auth.ts +7 -1
  207. package/src/contracts/index.ts +8 -0
  208. package/src/orchestration/layer.ts +36 -0
  209. package/src/orchestration/service.ts +5 -0
  210. package/src/preview/index.ts +11 -0
  211. package/src/preview/service.ts +52 -0
  212. package/src/rpc/error.ts +2 -0
  213. package/src/rpc/layer.ts +5 -4
  214. package/src/rpc/operation.ts +5 -4
  215. package/src/rpc/ws-group.ts +6 -0
  216. package/src/runtime/index.ts +1 -0
  217. package/src/runtime/layer.ts +5 -0
  218. package/src/sql/node-sqlite-client.ts +3 -0
  219. package/dist/src/application/actions.d.ts +0 -25
  220. package/dist/src/application/error.d.ts +0 -3
  221. package/dist/src/application/index.d.ts +0 -4
  222. package/dist/src/application/layer.d.ts +0 -117
  223. package/dist/src/application/model-selection.d.ts +0 -34
  224. package/dist/src/application/models.d.ts +0 -8
  225. package/dist/src/application/project-commands.d.ts +0 -44
  226. package/dist/src/application/projects.d.ts +0 -23
  227. package/dist/src/application/service.d.ts +0 -243
  228. package/dist/src/application/shell-sequence.d.ts +0 -96
  229. package/dist/src/application/terminals.d.ts +0 -66
  230. package/dist/src/application/thread-commands.d.ts +0 -157
  231. package/dist/src/application/thread-update.d.ts +0 -8
  232. package/dist/src/application/thread-wait.d.ts +0 -106
  233. package/dist/src/application/threads.d.ts +0 -660
  234. package/dist/src/auth/error.d.ts +0 -50
  235. package/dist/src/auth/index.d.ts +0 -10
  236. package/dist/src/auth/layer.d.ts +0 -53
  237. package/dist/src/auth/local-base-dir.d.ts +0 -8
  238. package/dist/src/auth/local-origin.d.ts +0 -18
  239. package/dist/src/auth/local-token.d.ts +0 -26
  240. package/dist/src/auth/local.d.ts +0 -24
  241. package/dist/src/auth/pairing.d.ts +0 -22
  242. package/dist/src/auth/remote-error.d.ts +0 -3
  243. package/dist/src/auth/schema.d.ts +0 -58
  244. package/dist/src/auth/service.d.ts +0 -27
  245. package/dist/src/auth/transport.d.ts +0 -22
  246. package/dist/src/auth/type.d.ts +0 -83
  247. package/dist/src/cli/env/flag.d.ts +0 -2
  248. package/dist/src/cli/env/index.d.ts +0 -2
  249. package/dist/src/cli/env/selection-layer.d.ts +0 -3
  250. package/dist/src/cli/flags.d.ts +0 -20
  251. package/dist/src/cli/format/index.d.ts +0 -1
  252. package/dist/src/cli/format/output.d.ts +0 -12
  253. package/dist/src/cli/index.d.ts +0 -5
  254. package/dist/src/cli/runtime/index.d.ts +0 -1
  255. package/dist/src/cli/runtime/service.d.ts +0 -16
  256. package/dist/src/cli/scope/index.d.ts +0 -1
  257. package/dist/src/cli/scope/resolve.d.ts +0 -20
  258. package/dist/src/cli-path/layer.d.ts +0 -3
  259. package/dist/src/cli-path/service.d.ts +0 -8
  260. package/dist/src/config/config.d.ts +0 -49
  261. package/dist/src/config/credential/cipher-node.d.ts +0 -3
  262. package/dist/src/config/credential/cipher-web.d.ts +0 -3
  263. package/dist/src/config/credential/cipher.d.ts +0 -29
  264. package/dist/src/config/credential/env.d.ts +0 -3
  265. package/dist/src/config/credential/error.d.ts +0 -8
  266. package/dist/src/config/credential/index.d.ts +0 -6
  267. package/dist/src/config/credential/service.d.ts +0 -34
  268. package/dist/src/config/env/env.d.ts +0 -55
  269. package/dist/src/config/env/index.d.ts +0 -2
  270. package/dist/src/config/env/layout.d.ts +0 -11
  271. package/dist/src/config/environment-name/index.d.ts +0 -1
  272. package/dist/src/config/environment-name/name.d.ts +0 -10
  273. package/dist/src/config/error.d.ts +0 -11
  274. package/dist/src/config/index.d.ts +0 -10
  275. package/dist/src/config/keystore/error.d.ts +0 -8
  276. package/dist/src/config/keystore/file.d.ts +0 -9
  277. package/dist/src/config/keystore/index.d.ts +0 -4
  278. package/dist/src/config/keystore/keyring-node.d.ts +0 -4
  279. package/dist/src/config/keystore/service.d.ts +0 -33
  280. package/dist/src/config/paths/index.d.ts +0 -1
  281. package/dist/src/config/paths/paths.d.ts +0 -6
  282. package/dist/src/config/persist/file-mode.d.ts +0 -4
  283. package/dist/src/config/persist/migration.d.ts +0 -68
  284. package/dist/src/config/persist/persist.d.ts +0 -40
  285. package/dist/src/config/persist/schema.d.ts +0 -68
  286. package/dist/src/config/resolve/resolve.d.ts +0 -40
  287. package/dist/src/config/selection/index.d.ts +0 -1
  288. package/dist/src/config/selection/resolve.d.ts +0 -4
  289. package/dist/src/config/selection/service.d.ts +0 -10
  290. package/dist/src/config/types.d.ts +0 -36
  291. package/dist/src/config/url/error.d.ts +0 -10
  292. package/dist/src/config/url/index.d.ts +0 -2
  293. package/dist/src/config/url/url.d.ts +0 -6
  294. package/dist/src/connection/error.d.ts +0 -10
  295. package/dist/src/connection/index.d.ts +0 -4
  296. package/dist/src/connection/layer.d.ts +0 -3
  297. package/dist/src/connection/prepared.d.ts +0 -14
  298. package/dist/src/connection/service.d.ts +0 -13
  299. package/dist/src/connection/type.d.ts +0 -10
  300. package/dist/src/contracts/index.d.ts +0 -1
  301. package/dist/src/domain/error.d.ts +0 -57
  302. package/dist/src/domain/helpers.d.ts +0 -179
  303. package/dist/src/domain/model-config.d.ts +0 -330
  304. package/dist/src/domain/thread-activities.d.ts +0 -14
  305. package/dist/src/domain/thread-lifecycle.d.ts +0 -120
  306. package/dist/src/index.d.ts +0 -3
  307. package/dist/src/node/connection.d.ts +0 -2
  308. package/dist/src/node/index.d.ts +0 -1
  309. package/dist/src/orchestration/index.d.ts +0 -2
  310. package/dist/src/orchestration/layer.d.ts +0 -1419
  311. package/dist/src/orchestration/service.d.ts +0 -28
  312. package/dist/src/rpc/error.d.ts +0 -16
  313. package/dist/src/rpc/index.d.ts +0 -6
  314. package/dist/src/rpc/layer.d.ts +0 -5862
  315. package/dist/src/rpc/operation.d.ts +0 -24
  316. package/dist/src/rpc/service.d.ts +0 -15
  317. package/dist/src/rpc/session.d.ts +0 -22
  318. package/dist/src/rpc/ws-group.d.ts +0 -1984
  319. package/dist/src/runtime/index.d.ts +0 -1
  320. package/dist/src/runtime/layer.d.ts +0 -15
  321. package/dist/src/sql/node-sqlite-client.d.ts +0 -10
  322. package/dist/src/sql/service.d.ts +0 -17
  323. package/dist/src/t3tools/index.d.ts +0 -1
@@ -0,0 +1,86 @@
1
+ import * as Schema from "effect/Schema";
2
+ import * as SchemaGetter from "effect/SchemaGetter";
3
+ import * as SchemaTransformation from "effect/SchemaTransformation";
4
+ import { CreateNodeOptions, DocumentOptions, ParseOptions, SchemaOptions, ToJSOptions, ToStringOptions } from "yaml";
5
+ //#region upstream-t3code/packages/shared/src/schemaYaml.d.ts
6
+ type YamlParseOptions = ParseOptions & DocumentOptions & SchemaOptions & ToJSOptions;
7
+ type YamlStringifyOptions = DocumentOptions & SchemaOptions & ParseOptions & CreateNodeOptions & ToStringOptions;
8
+ /**
9
+ * Parses a YAML string into a value.
10
+ *
11
+ * **When to use**
12
+ *
13
+ * Use when you need a schema getter to parse a present encoded YAML string
14
+ * during decoding.
15
+ *
16
+ * **Details**
17
+ *
18
+ * Parse failures become `SchemaIssue.InvalidValue` values.
19
+ *
20
+ * **Example** (Parse YAML)
21
+ *
22
+ * ```ts
23
+ * import { parseYaml } from "@t3tools/shared/schemaYaml"
24
+ *
25
+ * const parse = parseYaml<string>()
26
+ * // Getter<unknown, string>
27
+ * ```
28
+ *
29
+ * @see {@link stringifyYaml} for the inverse operation
30
+ */
31
+ declare function parseYaml<E extends string>(options?: YamlParseOptions): SchemaGetter.Getter<unknown, E>;
32
+ /**
33
+ * Stringifies a present value as YAML.
34
+ *
35
+ * **When to use**
36
+ *
37
+ * Use when you need a schema getter to serialize a present decoded value to
38
+ * YAML text during encoding.
39
+ *
40
+ * **Details**
41
+ *
42
+ * Stringify failures become `SchemaIssue.InvalidValue` values.
43
+ *
44
+ * **Example** (Stringify YAML)
45
+ *
46
+ * ```ts
47
+ * import { stringifyYaml } from "@t3tools/shared/schemaYaml"
48
+ *
49
+ * const stringify = stringifyYaml()
50
+ * // Getter<string, unknown>
51
+ * ```
52
+ *
53
+ * @see {@link parseYaml} for the inverse operation
54
+ */
55
+ declare function stringifyYaml(options?: YamlStringifyOptions): SchemaGetter.Getter<string, unknown>;
56
+ /**
57
+ * Decodes a YAML string and encodes a value as YAML text.
58
+ *
59
+ * **When to use**
60
+ *
61
+ * Use when you need a schema transformation to decode YAML stored or
62
+ * transmitted as a string before validating the parsed structure.
63
+ *
64
+ * **Details**
65
+ *
66
+ * Decode and encode failures become `InvalidValue` schema issues.
67
+ *
68
+ * **Example** (Parsing YAML)
69
+ *
70
+ * ```ts
71
+ * import * as Schema from "effect/Schema"
72
+ * import { fromYamlString } from "@t3tools/shared/schemaYaml"
73
+ *
74
+ * const schema = Schema.String.pipe(Schema.decodeTo(Schema.Unknown, fromYamlString))
75
+ * ```
76
+ */
77
+ declare const fromYamlString: SchemaTransformation.Transformation<unknown, string, never, never>;
78
+ /**
79
+ * Build a schema that decodes a YAML string into `A`.
80
+ *
81
+ * Decode parses the input as YAML before validating the parsed value with the
82
+ * provided schema. Encode validates the value and serializes it as YAML text.
83
+ */
84
+ declare const fromYaml: <S extends Schema.Top>(schema: S) => Schema.decodeTo<S, Schema.String, never, never>;
85
+ //#endregion
86
+ export { YamlParseOptions, YamlStringifyOptions, fromYaml, fromYamlString, parseYaml, stringifyYaml };
@@ -0,0 +1,99 @@
1
+ import { a as __toESM } from "../rolldown-runtime.js";
2
+ import { DD as transformOrFail, ED as Transformation, PD as InvalidValue, PO as try_, QT as String, Uk as none, jT as require_dist, rE as decodeTo } from "../shared.js";
3
+ //#region upstream-t3code/packages/shared/src/schemaYaml.ts
4
+ var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
5
+ function formatYamlParseError(error) {
6
+ if (!(error instanceof import_dist.YAMLParseError)) return "Invalid YAML.";
7
+ const position = error.linePos?.[0];
8
+ const location = position === void 0 ? "" : `, line=${position.line}, column=${position.col}`;
9
+ return `Invalid YAML (code=${error.code}${location}).`;
10
+ }
11
+ /**
12
+ * Parses a YAML string into a value.
13
+ *
14
+ * **When to use**
15
+ *
16
+ * Use when you need a schema getter to parse a present encoded YAML string
17
+ * during decoding.
18
+ *
19
+ * **Details**
20
+ *
21
+ * Parse failures become `SchemaIssue.InvalidValue` values.
22
+ *
23
+ * **Example** (Parse YAML)
24
+ *
25
+ * ```ts
26
+ * import { parseYaml } from "@t3tools/shared/schemaYaml"
27
+ *
28
+ * const parse = parseYaml<string>()
29
+ * // Getter<unknown, string>
30
+ * ```
31
+ *
32
+ * @see {@link stringifyYaml} for the inverse operation
33
+ */
34
+ function parseYaml(options) {
35
+ return transformOrFail((input) => try_({
36
+ try: () => (0, import_dist.parse)(input, options),
37
+ catch: (error) => new InvalidValue(none(), { message: formatYamlParseError(error) })
38
+ }));
39
+ }
40
+ /**
41
+ * Stringifies a present value as YAML.
42
+ *
43
+ * **When to use**
44
+ *
45
+ * Use when you need a schema getter to serialize a present decoded value to
46
+ * YAML text during encoding.
47
+ *
48
+ * **Details**
49
+ *
50
+ * Stringify failures become `SchemaIssue.InvalidValue` values.
51
+ *
52
+ * **Example** (Stringify YAML)
53
+ *
54
+ * ```ts
55
+ * import { stringifyYaml } from "@t3tools/shared/schemaYaml"
56
+ *
57
+ * const stringify = stringifyYaml()
58
+ * // Getter<string, unknown>
59
+ * ```
60
+ *
61
+ * @see {@link parseYaml} for the inverse operation
62
+ */
63
+ function stringifyYaml(options) {
64
+ return transformOrFail((input) => try_({
65
+ try: () => (0, import_dist.stringify)(input, options),
66
+ catch: () => new InvalidValue(none(), { message: "Failed to stringify YAML." })
67
+ }));
68
+ }
69
+ /**
70
+ * Decodes a YAML string and encodes a value as YAML text.
71
+ *
72
+ * **When to use**
73
+ *
74
+ * Use when you need a schema transformation to decode YAML stored or
75
+ * transmitted as a string before validating the parsed structure.
76
+ *
77
+ * **Details**
78
+ *
79
+ * Decode and encode failures become `InvalidValue` schema issues.
80
+ *
81
+ * **Example** (Parsing YAML)
82
+ *
83
+ * ```ts
84
+ * import * as Schema from "effect/Schema"
85
+ * import { fromYamlString } from "@t3tools/shared/schemaYaml"
86
+ *
87
+ * const schema = Schema.String.pipe(Schema.decodeTo(Schema.Unknown, fromYamlString))
88
+ * ```
89
+ */
90
+ const fromYamlString = new Transformation(parseYaml(), stringifyYaml());
91
+ /**
92
+ * Build a schema that decodes a YAML string into `A`.
93
+ *
94
+ * Decode parses the input as YAML before validating the parsed value with the
95
+ * provided schema. Encode validates the value and serializes it as YAML text.
96
+ */
97
+ const fromYaml = (schema) => String.pipe(decodeTo(schema, fromYamlString));
98
+ //#endregion
99
+ export { fromYaml, fromYamlString, parseYaml, stringifyYaml };
@@ -0,0 +1,30 @@
1
+ //#region upstream-t3code/packages/shared/src/searchRanking.d.ts
2
+ type RankedSearchResult<T> = {
3
+ item: T;
4
+ score: number;
5
+ tieBreaker: string;
6
+ };
7
+ declare function normalizeSearchQuery(input: string, options?: {
8
+ trimLeadingPattern?: RegExp;
9
+ }): string;
10
+ declare function scoreSubsequenceMatch(value: string, query: string): number | null;
11
+ /**
12
+ * Scores how well `value` matches `query` using tiered match strategies.
13
+ *
14
+ * **Expects pre-normalized inputs**: both `value` and `query` must already be
15
+ * trimmed and lowercased (e.g. via {@link normalizeSearchQuery}).
16
+ */
17
+ declare function scoreQueryMatch(input: {
18
+ value: string;
19
+ query: string;
20
+ exactBase: number;
21
+ prefixBase?: number;
22
+ boundaryBase?: number;
23
+ includesBase?: number;
24
+ fuzzyBase?: number;
25
+ boundaryMarkers?: readonly string[];
26
+ }): number | null;
27
+ declare function compareRankedSearchResults<T>(left: RankedSearchResult<T>, right: RankedSearchResult<T>): number;
28
+ declare function insertRankedSearchResult<T>(rankedEntries: RankedSearchResult<T>[], candidate: RankedSearchResult<T>, limit: number): void;
29
+ //#endregion
30
+ export { RankedSearchResult, compareRankedSearchResults, insertRankedSearchResult, normalizeSearchQuery, scoreQueryMatch, scoreSubsequenceMatch };
@@ -0,0 +1,99 @@
1
+ //#region upstream-t3code/packages/shared/src/searchRanking.ts
2
+ function normalizeSearchQuery(input, options) {
3
+ const trimmed = input.trim();
4
+ if (!trimmed) return "";
5
+ return options?.trimLeadingPattern ? trimmed.replace(options.trimLeadingPattern, "").toLowerCase() : trimmed.toLowerCase();
6
+ }
7
+ function scoreSubsequenceMatch(value, query) {
8
+ if (!query) return 0;
9
+ let queryIndex = 0;
10
+ let firstMatchIndex = -1;
11
+ let previousMatchIndex = -1;
12
+ let gapPenalty = 0;
13
+ for (let valueIndex = 0; valueIndex < value.length; valueIndex += 1) {
14
+ if (value[valueIndex] !== query[queryIndex]) continue;
15
+ if (firstMatchIndex === -1) firstMatchIndex = valueIndex;
16
+ if (previousMatchIndex !== -1) gapPenalty += valueIndex - previousMatchIndex - 1;
17
+ previousMatchIndex = valueIndex;
18
+ queryIndex += 1;
19
+ if (queryIndex === query.length) {
20
+ const spanPenalty = valueIndex - firstMatchIndex + 1 - query.length;
21
+ const lengthPenalty = Math.min(64, value.length - query.length);
22
+ return firstMatchIndex * 2 + gapPenalty * 3 + spanPenalty + lengthPenalty;
23
+ }
24
+ }
25
+ return null;
26
+ }
27
+ function lengthPenalty(value, query) {
28
+ return Math.min(64, Math.max(0, value.length - query.length));
29
+ }
30
+ function findBoundaryMatchIndex(value, query, boundaryMarkers) {
31
+ let bestIndex = null;
32
+ for (const marker of boundaryMarkers) {
33
+ const index = value.indexOf(`${marker}${query}`);
34
+ if (index === -1) continue;
35
+ const matchIndex = index + marker.length;
36
+ if (bestIndex === null || matchIndex < bestIndex) bestIndex = matchIndex;
37
+ }
38
+ return bestIndex;
39
+ }
40
+ /**
41
+ * Scores how well `value` matches `query` using tiered match strategies.
42
+ *
43
+ * **Expects pre-normalized inputs**: both `value` and `query` must already be
44
+ * trimmed and lowercased (e.g. via {@link normalizeSearchQuery}).
45
+ */
46
+ function scoreQueryMatch(input) {
47
+ const { value, query } = input;
48
+ if (!value || !query) return null;
49
+ if (value === query) return input.exactBase;
50
+ if (input.prefixBase !== void 0 && value.startsWith(query)) return input.prefixBase + lengthPenalty(value, query);
51
+ if (input.boundaryBase !== void 0) {
52
+ const boundaryIndex = findBoundaryMatchIndex(value, query, input.boundaryMarkers ?? [
53
+ " ",
54
+ "-",
55
+ "_",
56
+ "/"
57
+ ]);
58
+ if (boundaryIndex !== null) return input.boundaryBase + boundaryIndex * 2 + lengthPenalty(value, query);
59
+ }
60
+ if (input.includesBase !== void 0) {
61
+ const includesIndex = value.indexOf(query);
62
+ if (includesIndex !== -1) return input.includesBase + includesIndex * 2 + lengthPenalty(value, query);
63
+ }
64
+ if (input.fuzzyBase !== void 0) {
65
+ const fuzzyScore = scoreSubsequenceMatch(value, query);
66
+ if (fuzzyScore !== null) return input.fuzzyBase + fuzzyScore;
67
+ }
68
+ return null;
69
+ }
70
+ function compareRankedSearchResults(left, right) {
71
+ const scoreDelta = left.score - right.score;
72
+ if (scoreDelta !== 0) return scoreDelta;
73
+ return left.tieBreaker.localeCompare(right.tieBreaker);
74
+ }
75
+ function findInsertionIndex(rankedEntries, candidate) {
76
+ let low = 0;
77
+ let high = rankedEntries.length;
78
+ while (low < high) {
79
+ const middle = low + Math.floor((high - low) / 2);
80
+ const current = rankedEntries[middle];
81
+ if (!current) break;
82
+ if (compareRankedSearchResults(candidate, current) < 0) high = middle;
83
+ else low = middle + 1;
84
+ }
85
+ return low;
86
+ }
87
+ function insertRankedSearchResult(rankedEntries, candidate, limit) {
88
+ if (limit <= 0) return;
89
+ const insertionIndex = findInsertionIndex(rankedEntries, candidate);
90
+ if (rankedEntries.length < limit) {
91
+ rankedEntries.splice(insertionIndex, 0, candidate);
92
+ return;
93
+ }
94
+ if (insertionIndex >= limit) return;
95
+ rankedEntries.splice(insertionIndex, 0, candidate);
96
+ rankedEntries.pop();
97
+ }
98
+ //#endregion
99
+ export { compareRankedSearchResults, insertRankedSearchResult, normalizeSearchQuery, scoreQueryMatch, scoreSubsequenceMatch };
@@ -0,0 +1,23 @@
1
+ //#region upstream-t3code/packages/shared/src/semver.d.ts
2
+ interface ParsedSemver {
3
+ readonly major: number;
4
+ readonly minor: number;
5
+ readonly patch: number;
6
+ readonly prerelease: ReadonlyArray<string>;
7
+ }
8
+ declare function normalizeSemverVersion(version: string): string;
9
+ declare function parseSemver(value: string): ParsedSemver | null;
10
+ declare function compareSemverVersions(left: string, right: string): number;
11
+ /**
12
+ * Small semver range checker for CLI/runtime gates.
13
+ *
14
+ * Keep the function body valid plain JavaScript: SSH startup stringifies this
15
+ * function and runs it on remote Node versions before TypeScript support is known.
16
+ *
17
+ * @param rawVersion Version string, with or without a leading `v`.
18
+ * @param range Space-separated comparators, with `||` range groups.
19
+ * @returns Whether `rawVersion` satisfies the supported range syntax.
20
+ */
21
+ declare const satisfiesSemverRange: (rawVersion: string, range: string) => boolean;
22
+ //#endregion
23
+ export { compareSemverVersions, normalizeSemverVersion, parseSemver, satisfiesSemverRange };
@@ -0,0 +1,124 @@
1
+ //#region upstream-t3code/packages/shared/src/semver.ts
2
+ const SEMVER_NUMBER_SEGMENT = /^\d+$/;
3
+ function normalizeSemverVersion(version) {
4
+ const [main, prerelease] = version.trim().split("-", 2);
5
+ const segments = [];
6
+ for (const segment of (main ?? "").split(".")) {
7
+ const trimmed = segment.trim();
8
+ if (trimmed.length > 0) segments.push(trimmed);
9
+ }
10
+ if (segments.length === 2) segments.push("0");
11
+ return prerelease ? `${segments.join(".")}-${prerelease}` : segments.join(".");
12
+ }
13
+ function parseSemver(value) {
14
+ const [main = "", prerelease] = normalizeSemverVersion(value).replace(/^v/, "").split("-", 2);
15
+ const segments = main.split(".");
16
+ if (segments.length !== 3) return null;
17
+ const [majorSegment, minorSegment, patchSegment] = segments;
18
+ if (majorSegment === void 0 || minorSegment === void 0 || patchSegment === void 0) return null;
19
+ if (!SEMVER_NUMBER_SEGMENT.test(majorSegment) || !SEMVER_NUMBER_SEGMENT.test(minorSegment) || !SEMVER_NUMBER_SEGMENT.test(patchSegment)) return null;
20
+ const major = Number.parseInt(majorSegment, 10);
21
+ const minor = Number.parseInt(minorSegment, 10);
22
+ const patch = Number.parseInt(patchSegment, 10);
23
+ if (![
24
+ major,
25
+ minor,
26
+ patch
27
+ ].every(Number.isInteger)) return null;
28
+ return {
29
+ major,
30
+ minor,
31
+ patch,
32
+ prerelease: parsePrereleaseSegments(prerelease)
33
+ };
34
+ }
35
+ function parsePrereleaseSegments(prerelease) {
36
+ if (prerelease === void 0) return [];
37
+ const segments = [];
38
+ for (const segment of prerelease.split(".")) {
39
+ const trimmed = segment.trim();
40
+ if (trimmed.length > 0) segments.push(trimmed);
41
+ }
42
+ return segments;
43
+ }
44
+ function comparePrereleaseIdentifier(left, right) {
45
+ const leftNumeric = SEMVER_NUMBER_SEGMENT.test(left);
46
+ const rightNumeric = SEMVER_NUMBER_SEGMENT.test(right);
47
+ if (leftNumeric && rightNumeric) return Number.parseInt(left, 10) - Number.parseInt(right, 10);
48
+ if (leftNumeric) return -1;
49
+ if (rightNumeric) return 1;
50
+ return left.localeCompare(right);
51
+ }
52
+ function compareSemverVersions(left, right) {
53
+ const parsedLeft = parseSemver(left);
54
+ const parsedRight = parseSemver(right);
55
+ if (!parsedLeft || !parsedRight) return left.localeCompare(right);
56
+ if (parsedLeft.major !== parsedRight.major) return parsedLeft.major - parsedRight.major;
57
+ if (parsedLeft.minor !== parsedRight.minor) return parsedLeft.minor - parsedRight.minor;
58
+ if (parsedLeft.patch !== parsedRight.patch) return parsedLeft.patch - parsedRight.patch;
59
+ if (parsedLeft.prerelease.length === 0 && parsedRight.prerelease.length === 0) return 0;
60
+ if (parsedLeft.prerelease.length === 0) return 1;
61
+ if (parsedRight.prerelease.length === 0) return -1;
62
+ const length = Math.max(parsedLeft.prerelease.length, parsedRight.prerelease.length);
63
+ for (let index = 0; index < length; index += 1) {
64
+ const leftIdentifier = parsedLeft.prerelease[index];
65
+ const rightIdentifier = parsedRight.prerelease[index];
66
+ if (leftIdentifier === void 0) return -1;
67
+ if (rightIdentifier === void 0) return 1;
68
+ const comparison = comparePrereleaseIdentifier(leftIdentifier, rightIdentifier);
69
+ if (comparison !== 0) return comparison;
70
+ }
71
+ return 0;
72
+ }
73
+ /**
74
+ * Small semver range checker for CLI/runtime gates.
75
+ *
76
+ * Keep the function body valid plain JavaScript: SSH startup stringifies this
77
+ * function and runs it on remote Node versions before TypeScript support is known.
78
+ *
79
+ * @param rawVersion Version string, with or without a leading `v`.
80
+ * @param range Space-separated comparators, with `||` range groups.
81
+ * @returns Whether `rawVersion` satisfies the supported range syntax.
82
+ */
83
+ const satisfiesSemverRange = function satisfiesSemverRange(rawVersion, range) {
84
+ const versionMatch = String(rawVersion).trim().replace(/^v/, "").match(/^(\d+)(?:\.(\d+))?(?:\.(\d+))?(?:-[0-9A-Za-z.-]+)?$/);
85
+ if (!versionMatch) return false;
86
+ const version = {
87
+ major: Number(versionMatch[1]),
88
+ minor: Number(versionMatch[2] || 0),
89
+ patch: Number(versionMatch[3] || 0)
90
+ };
91
+ return range.split("||").some((group) => {
92
+ const comparators = group.trim().split(/\s+/).filter(Boolean);
93
+ if (comparators.length === 0) return false;
94
+ return comparators.every((comparator) => {
95
+ const match = comparator.trim().match(/^(\^|>=|>|<=|<|=)?\s*v?(\d+(?:\.\d+){0,2})$/);
96
+ if (!match) return false;
97
+ const targetVersion = match[2];
98
+ if (targetVersion === void 0) return false;
99
+ const targetMatch = targetVersion.match(/^(\d+)(?:\.(\d+))?(?:\.(\d+))?$/);
100
+ if (!targetMatch) return false;
101
+ const target = {
102
+ major: Number(targetMatch[1]),
103
+ minor: Number(targetMatch[2] || 0),
104
+ patch: Number(targetMatch[3] || 0)
105
+ };
106
+ const compared = version.major !== target.major ? version.major > target.major ? 1 : -1 : version.minor !== target.minor ? version.minor > target.minor ? 1 : -1 : version.patch !== target.patch ? version.patch > target.patch ? 1 : -1 : 0;
107
+ switch (match[1] || "=") {
108
+ case "^":
109
+ if (compared < 0) return false;
110
+ if (target.major > 0) return version.major === target.major;
111
+ if (target.minor > 0) return version.major === 0 && version.minor === target.minor;
112
+ return version.major === 0 && version.minor === 0 && version.patch === target.patch;
113
+ case ">=": return compared >= 0;
114
+ case ">": return compared > 0;
115
+ case "<=": return compared <= 0;
116
+ case "<": return compared < 0;
117
+ case "=": return compared === 0;
118
+ default: return false;
119
+ }
120
+ });
121
+ });
122
+ };
123
+ //#endregion
124
+ export { compareSemverVersions, normalizeSemverVersion, parseSemver, satisfiesSemverRange };
@@ -0,0 +1,19 @@
1
+ import { A_ as ModelSelection, i_ as ServerSettings, ou as ServerProvider, s_ as ServerSettingsPatch } from "../shared.js";
2
+ //#region upstream-t3code/packages/shared/src/serverSettings.d.ts
3
+ declare function isModelSelectionProviderEnabled(settings: ServerSettings, selection: ModelSelection): boolean;
4
+ declare function resolveSourceControlWriterModelSelection(settings: ServerSettings, providers?: ReadonlyArray<ServerProvider>): ModelSelection;
5
+ interface PersistedServerObservabilitySettings {
6
+ readonly otlpTracesUrl: string | undefined;
7
+ readonly otlpMetricsUrl: string | undefined;
8
+ }
9
+ declare function normalizePersistedServerSettingString(value: string | null | undefined): string | undefined;
10
+ declare function extractPersistedServerObservabilitySettings(input: {
11
+ readonly observability?: {
12
+ readonly otlpTracesUrl?: string;
13
+ readonly otlpMetricsUrl?: string;
14
+ };
15
+ }): PersistedServerObservabilitySettings;
16
+ declare function parsePersistedServerObservabilitySettings(raw: string): PersistedServerObservabilitySettings;
17
+ declare function applyServerSettingsPatch(current: ServerSettings, patch: ServerSettingsPatch): ServerSettings;
18
+ //#endregion
19
+ export { PersistedServerObservabilitySettings, applyServerSettingsPatch, extractPersistedServerObservabilitySettings, isModelSelectionProviderEnabled, normalizePersistedServerSettingString, parsePersistedServerObservabilitySettings, resolveSourceControlWriterModelSelection };
@@ -0,0 +1,103 @@
1
+ import { Bk as isSome, N as createModelSelection, US as isProviderDriverKind, Yp as ServerSettings, aE as decodeUnknownOption, c as resolveBackgroundActivitySettings, g as fromLenientJson, i as getBackgroundActivityBaseProfile, mp as isProviderAvailable, o as normalizeBackgroundActivitySettings, s as normalizeServerBackgroundActivitySettings, u as deepMerge } from "../shared.js";
2
+ const decodeServerSettingsJson = decodeUnknownOption(fromLenientJson(ServerSettings));
3
+ const getLegacyProviderSettings = (settings, provider) => settings.providers[provider];
4
+ function isModelSelectionProviderEnabled(settings, selection) {
5
+ const instanceConfig = settings.providerInstances[selection.instanceId];
6
+ if (instanceConfig !== void 0) return instanceConfig.enabled ?? true;
7
+ return isProviderDriverKind(selection.instanceId) && getLegacyProviderSettings(settings, selection.instanceId)?.enabled === true;
8
+ }
9
+ function resolveSourceControlWriterModelSelection(settings, providers) {
10
+ const selection = settings.sourceControlWriterModelSelection;
11
+ if (!selection || !isModelSelectionProviderEnabled(settings, selection)) return settings.textGenerationModelSelection;
12
+ if (providers === void 0) return selection;
13
+ const provider = providers.find((candidate) => candidate.instanceId === selection.instanceId);
14
+ return provider?.enabled === true && isProviderAvailable(provider) ? selection : settings.textGenerationModelSelection;
15
+ }
16
+ function normalizePersistedServerSettingString(value) {
17
+ const trimmed = value?.trim();
18
+ return trimmed && trimmed.length > 0 ? trimmed : void 0;
19
+ }
20
+ function extractPersistedServerObservabilitySettings(input) {
21
+ return {
22
+ otlpTracesUrl: normalizePersistedServerSettingString(input.observability?.otlpTracesUrl),
23
+ otlpMetricsUrl: normalizePersistedServerSettingString(input.observability?.otlpMetricsUrl)
24
+ };
25
+ }
26
+ function parsePersistedServerObservabilitySettings(raw) {
27
+ const decoded = decodeServerSettingsJson(raw);
28
+ if (isSome(decoded)) return extractPersistedServerObservabilitySettings(decoded.value);
29
+ return {
30
+ otlpTracesUrl: void 0,
31
+ otlpMetricsUrl: void 0
32
+ };
33
+ }
34
+ function shouldReplaceTextGenerationModelSelection(patch) {
35
+ return Boolean(patch && (patch.instanceId !== void 0 || patch.model !== void 0));
36
+ }
37
+ function mergeModelSelectionOptionsById(input) {
38
+ if (input.patch === void 0) return input.current ? [...input.current] : void 0;
39
+ if (input.patch.length === 0) return;
40
+ const merged = new Map((input.current ?? []).map((selection) => [selection.id, selection.value]));
41
+ for (const selection of input.patch) merged.set(selection.id, selection.value);
42
+ return [...merged.entries()].map(([id, value]) => ({
43
+ id,
44
+ value
45
+ }));
46
+ }
47
+ function applyServerSettingsPatch(current, patch) {
48
+ const selectionPatch = patch.textGenerationModelSelection;
49
+ const { automaticGitFetchInterval, providerHealthRefreshInterval, backgroundActivityProfile, backgroundActivity, ...patchForMerge } = patch;
50
+ const currentBackgroundActivity = normalizeServerBackgroundActivitySettings(current);
51
+ const backgroundActivityPatch = backgroundActivityProfile !== void 0 ? {
52
+ schemaVersion: 1,
53
+ profile: automaticGitFetchInterval !== void 0 || providerHealthRefreshInterval !== void 0 ? "custom" : backgroundActivityProfile,
54
+ ...automaticGitFetchInterval !== void 0 || providerHealthRefreshInterval !== void 0 ? { baseProfile: backgroundActivityProfile } : {},
55
+ overrides: {
56
+ ...automaticGitFetchInterval !== void 0 ? { automaticGitFetchInterval } : {},
57
+ ...providerHealthRefreshInterval !== void 0 ? { providerHealthRefreshInterval } : {}
58
+ }
59
+ } : automaticGitFetchInterval !== void 0 || providerHealthRefreshInterval !== void 0 ? {
60
+ schemaVersion: 1,
61
+ profile: "custom",
62
+ baseProfile: getBackgroundActivityBaseProfile(currentBackgroundActivity),
63
+ overrides: {
64
+ ...currentBackgroundActivity.profile === "custom" ? currentBackgroundActivity.overrides : {},
65
+ ...automaticGitFetchInterval !== void 0 ? { automaticGitFetchInterval } : {},
66
+ ...providerHealthRefreshInterval !== void 0 ? { providerHealthRefreshInterval } : {}
67
+ }
68
+ } : void 0;
69
+ const nextWithReplacementsBase = {
70
+ ...deepMerge(current, patchForMerge),
71
+ ...backgroundActivity !== void 0 ? { backgroundActivity: {
72
+ ...deepMerge(currentBackgroundActivity, backgroundActivity),
73
+ ...backgroundActivity.overrides !== void 0 ? { overrides: backgroundActivity.overrides } : {}
74
+ } } : { backgroundActivity: currentBackgroundActivity },
75
+ ...backgroundActivity === void 0 && backgroundActivityPatch !== void 0 ? { backgroundActivity: backgroundActivityPatch } : {},
76
+ ...patch.providerInstances !== void 0 ? { providerInstances: patch.providerInstances } : {},
77
+ ...patch.sourceControlWriterModelSelection !== void 0 ? { sourceControlWriterModelSelection: patch.sourceControlWriterModelSelection } : {},
78
+ ...automaticGitFetchInterval !== void 0 ? { automaticGitFetchInterval } : {},
79
+ ...providerHealthRefreshInterval !== void 0 ? { providerHealthRefreshInterval } : {}
80
+ };
81
+ const normalizedBackgroundActivity = normalizeBackgroundActivitySettings(nextWithReplacementsBase.backgroundActivity);
82
+ const resolvedBackgroundActivity = resolveBackgroundActivitySettings(normalizedBackgroundActivity);
83
+ const nextWithReplacements = {
84
+ ...nextWithReplacementsBase,
85
+ backgroundActivity: normalizedBackgroundActivity,
86
+ automaticGitFetchInterval: resolvedBackgroundActivity.automaticGitFetchInterval,
87
+ providerHealthRefreshInterval: resolvedBackgroundActivity.providerHealthRefreshInterval,
88
+ backgroundActivityProfile: resolvedBackgroundActivity.profile
89
+ };
90
+ if (!selectionPatch) return nextWithReplacements;
91
+ const instanceId = selectionPatch.instanceId ?? current.textGenerationModelSelection.instanceId;
92
+ const model = selectionPatch.model ?? current.textGenerationModelSelection.model;
93
+ const options = shouldReplaceTextGenerationModelSelection(selectionPatch) ? selectionPatch.options : mergeModelSelectionOptionsById({
94
+ current: current.textGenerationModelSelection.options,
95
+ patch: selectionPatch.options
96
+ });
97
+ return {
98
+ ...nextWithReplacements,
99
+ textGenerationModelSelection: createModelSelection(instanceId, model, options)
100
+ };
101
+ }
102
+ //#endregion
103
+ export { applyServerSettingsPatch, extractPersistedServerObservabilitySettings, isModelSelectionProviderEnabled, normalizePersistedServerSettingString, parsePersistedServerObservabilitySettings, resolveSourceControlWriterModelSelection };
@@ -0,0 +1,51 @@
1
+ import * as Context from "effect/Context";
2
+ import * as Effect from "effect/Effect";
3
+ import * as Path from "effect/Path";
4
+ import * as FileSystem from "effect/FileSystem";
5
+ //#region upstream-t3code/packages/shared/src/shell.d.ts
6
+ type ExecFileSyncLike = (file: string, args: ReadonlyArray<string>, options: {
7
+ encoding: "utf8";
8
+ timeout: number;
9
+ }) => string;
10
+ interface CommandAvailabilityOptions {
11
+ readonly env?: NodeJS.ProcessEnv;
12
+ readonly extendEnv?: boolean;
13
+ }
14
+ type CommandAvailabilityChecker = (command: string, options?: CommandAvailabilityOptions) => Effect.Effect<boolean, never, FileSystem.FileSystem | Path.Path>;
15
+ declare const CommandResolutionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
16
+ readonly _tag: "CommandResolutionError";
17
+ } & Readonly<A>;
18
+ declare class CommandResolutionError extends CommandResolutionError_base<{
19
+ readonly command: string;
20
+ readonly reason: "not-found";
21
+ }> {}
22
+ interface ResolvedSpawnCommand {
23
+ readonly command: string;
24
+ readonly args: ReadonlyArray<string>;
25
+ readonly shell: boolean;
26
+ }
27
+ type SpawnExecutableResolver = (command: string, platform: NodeJS.Platform, env: NodeJS.ProcessEnv) => string | undefined;
28
+ declare const SpawnExecutableResolution: Context.Reference<SpawnExecutableResolver>;
29
+ interface WindowsEnvironmentProbeOptions {
30
+ readonly loadProfile?: boolean;
31
+ }
32
+ declare function listLoginShellCandidates(platform: NodeJS.Platform, shell: string | undefined, userShell?: string | undefined): ReadonlyArray<string>;
33
+ declare function extractPathFromShellOutput(output: string): string | null;
34
+ declare function readPathFromLoginShell(shell: string, execFile?: ExecFileSyncLike): string | undefined;
35
+ declare function readPathFromLaunchctl(execFile?: ExecFileSyncLike): string | undefined;
36
+ declare function mergePathEntries(preferredPath: string | undefined, inheritedPath: string | undefined, platform: NodeJS.Platform): string | undefined;
37
+ type ShellEnvironmentReader = (shell: string, names: ReadonlyArray<string>, execFile?: ExecFileSyncLike) => Partial<Record<string, string>>;
38
+ declare const readEnvironmentFromLoginShell: ShellEnvironmentReader;
39
+ type WindowsShellEnvironmentReader = (names: ReadonlyArray<string>, options?: WindowsEnvironmentProbeOptions) => Partial<Record<string, string>>;
40
+ declare const WindowsShellEnvironment: Context.Reference<WindowsShellEnvironmentReader>;
41
+ declare const CommandAvailability: Context.Reference<CommandAvailabilityChecker>;
42
+ declare function readEnvironmentFromWindowsShell(names: ReadonlyArray<string>, execFile?: ExecFileSyncLike): Partial<Record<string, string>>;
43
+ declare function readEnvironmentFromWindowsShell(names: ReadonlyArray<string>, options?: WindowsEnvironmentProbeOptions, execFile?: ExecFileSyncLike): Partial<Record<string, string>>;
44
+ declare function mergePathValues(preferredPath: string | undefined, inheritedPath: string | undefined, platform: NodeJS.Platform): string | undefined;
45
+ declare const resolveCommandPath: (command: string, options?: CommandAvailabilityOptions | undefined) => Effect.Effect<string, CommandResolutionError, FileSystem.FileSystem | Path.Path>;
46
+ declare const resolveSpawnCommand: (command: string, args: readonly string[], options?: CommandAvailabilityOptions | undefined) => Effect.Effect<ResolvedSpawnCommand, never, never>;
47
+ declare const isCommandAvailable: (command: string, options?: CommandAvailabilityOptions | undefined) => Effect.Effect<boolean, never, FileSystem.FileSystem | Path.Path>;
48
+ declare function resolveKnownWindowsCliDirs(env: NodeJS.ProcessEnv): ReadonlyArray<string>;
49
+ declare const resolveWindowsEnvironment: (env: NodeJS.ProcessEnv) => Effect.Effect<Partial<NodeJS.ProcessEnv>, never, FileSystem.FileSystem | Path.Path>;
50
+ //#endregion
51
+ export { CommandAvailability, CommandAvailabilityChecker, CommandAvailabilityOptions, CommandResolutionError, ResolvedSpawnCommand, ShellEnvironmentReader, SpawnExecutableResolution, SpawnExecutableResolver, WindowsEnvironmentProbeOptions, WindowsShellEnvironment, WindowsShellEnvironmentReader, extractPathFromShellOutput, isCommandAvailable, listLoginShellCandidates, mergePathEntries, mergePathValues, readEnvironmentFromLoginShell, readEnvironmentFromWindowsShell, readPathFromLaunchctl, readPathFromLoginShell, resolveCommandPath, resolveKnownWindowsCliDirs, resolveSpawnCommand, resolveWindowsEnvironment };