@namzu/sdk 68.0.0 → 69.0.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 (281) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/bridge/acp/server.d.ts +12 -0
  3. package/dist/bridge/acp/server.d.ts.map +1 -1
  4. package/dist/bridge/acp/server.js +20 -0
  5. package/dist/bridge/acp/server.js.map +1 -1
  6. package/dist/compaction/context-window.d.ts +8 -0
  7. package/dist/compaction/context-window.d.ts.map +1 -1
  8. package/dist/compaction/context-window.js +14 -0
  9. package/dist/compaction/context-window.js.map +1 -1
  10. package/dist/compaction/loaded-skills.d.ts +10 -0
  11. package/dist/compaction/loaded-skills.d.ts.map +1 -1
  12. package/dist/compaction/loaded-skills.js +45 -1
  13. package/dist/compaction/loaded-skills.js.map +1 -1
  14. package/dist/compaction/manager.d.ts +8 -0
  15. package/dist/compaction/manager.d.ts.map +1 -1
  16. package/dist/compaction/manager.js +31 -0
  17. package/dist/compaction/manager.js.map +1 -1
  18. package/dist/compaction/manual.d.ts.map +1 -1
  19. package/dist/compaction/manual.js +7 -1
  20. package/dist/compaction/manual.js.map +1 -1
  21. package/dist/compaction/model-summary.js +2 -2
  22. package/dist/compaction/model-summary.js.map +1 -1
  23. package/dist/compaction/restore.d.ts +8 -0
  24. package/dist/compaction/restore.d.ts.map +1 -1
  25. package/dist/compaction/restore.js +65 -0
  26. package/dist/compaction/restore.js.map +1 -1
  27. package/dist/compaction/salience/working-set.d.ts.map +1 -1
  28. package/dist/compaction/salience/working-set.js +2 -2
  29. package/dist/compaction/salience/working-set.js.map +1 -1
  30. package/dist/compaction/tool-result-editing.d.ts +6 -0
  31. package/dist/compaction/tool-result-editing.d.ts.map +1 -1
  32. package/dist/compaction/tool-result-editing.js +7 -1
  33. package/dist/compaction/tool-result-editing.js.map +1 -1
  34. package/dist/compaction/types.d.ts +2 -0
  35. package/dist/compaction/types.d.ts.map +1 -1
  36. package/dist/compaction/wire.d.ts.map +1 -1
  37. package/dist/compaction/wire.js +4 -0
  38. package/dist/compaction/wire.js.map +1 -1
  39. package/dist/manager/session/turn-recorder.d.ts.map +1 -1
  40. package/dist/manager/session/turn-recorder.js +23 -1
  41. package/dist/manager/session/turn-recorder.js.map +1 -1
  42. package/dist/network/join.d.ts +10 -0
  43. package/dist/network/join.d.ts.map +1 -1
  44. package/dist/network/join.js +15 -0
  45. package/dist/network/join.js.map +1 -1
  46. package/dist/network/service.d.ts.map +1 -1
  47. package/dist/network/service.js +166 -12
  48. package/dist/network/service.js.map +1 -1
  49. package/dist/network/store.d.ts +23 -1
  50. package/dist/network/store.d.ts.map +1 -1
  51. package/dist/network/store.js +23 -1
  52. package/dist/network/store.js.map +1 -1
  53. package/dist/network/transport.d.ts +1 -1
  54. package/dist/network/transport.js +1 -1
  55. package/dist/network/wire.d.ts +12 -0
  56. package/dist/network/wire.d.ts.map +1 -1
  57. package/dist/network/wire.js +12 -1
  58. package/dist/network/wire.js.map +1 -1
  59. package/dist/prompt/coding-agent-doctrine.d.ts +4 -4
  60. package/dist/prompt/coding-agent-doctrine.d.ts.map +1 -1
  61. package/dist/prompt/coding-agent-doctrine.js +7 -2
  62. package/dist/prompt/coding-agent-doctrine.js.map +1 -1
  63. package/dist/provider/fallback.d.ts.map +1 -1
  64. package/dist/provider/fallback.js +5 -0
  65. package/dist/provider/fallback.js.map +1 -1
  66. package/dist/provider/idle-timeout.d.ts.map +1 -1
  67. package/dist/provider/idle-timeout.js +5 -0
  68. package/dist/provider/idle-timeout.js.map +1 -1
  69. package/dist/provider/instrumentation.d.ts.map +1 -1
  70. package/dist/provider/instrumentation.js +10 -0
  71. package/dist/provider/instrumentation.js.map +1 -1
  72. package/dist/provider/model-window-suffix.d.ts.map +1 -1
  73. package/dist/provider/model-window-suffix.js +1 -0
  74. package/dist/provider/model-window-suffix.js.map +1 -1
  75. package/dist/provider/retry.d.ts.map +1 -1
  76. package/dist/provider/retry.js +5 -0
  77. package/dist/provider/retry.js.map +1 -1
  78. package/dist/public-runtime.d.ts +1 -1
  79. package/dist/public-runtime.d.ts.map +1 -1
  80. package/dist/public-runtime.js +1 -1
  81. package/dist/public-runtime.js.map +1 -1
  82. package/dist/public-tools.d.ts +2 -0
  83. package/dist/public-tools.d.ts.map +1 -1
  84. package/dist/public-tools.js +4 -0
  85. package/dist/public-tools.js.map +1 -1
  86. package/dist/public-types.d.ts +1 -0
  87. package/dist/public-types.d.ts.map +1 -1
  88. package/dist/registry/tool/presentation.d.ts +8 -1
  89. package/dist/registry/tool/presentation.d.ts.map +1 -1
  90. package/dist/registry/tool/presentation.js +14 -5
  91. package/dist/registry/tool/presentation.js.map +1 -1
  92. package/dist/runtime/jobs/registry.d.ts.map +1 -1
  93. package/dist/runtime/jobs/registry.js +2 -1
  94. package/dist/runtime/jobs/registry.js.map +1 -1
  95. package/dist/runtime/query/auto-review/classifier.d.ts.map +1 -1
  96. package/dist/runtime/query/auto-review/classifier.js +19 -3
  97. package/dist/runtime/query/auto-review/classifier.js.map +1 -1
  98. package/dist/runtime/query/auto-review/failure.d.ts +12 -0
  99. package/dist/runtime/query/auto-review/failure.d.ts.map +1 -0
  100. package/dist/runtime/query/auto-review/failure.js +46 -0
  101. package/dist/runtime/query/auto-review/failure.js.map +1 -0
  102. package/dist/runtime/query/auto-review/index.d.ts +1 -0
  103. package/dist/runtime/query/auto-review/index.d.ts.map +1 -1
  104. package/dist/runtime/query/auto-review/index.js +1 -0
  105. package/dist/runtime/query/auto-review/index.js.map +1 -1
  106. package/dist/runtime/query/file-evidence-replay.d.ts.map +1 -1
  107. package/dist/runtime/query/file-evidence-replay.js +6 -6
  108. package/dist/runtime/query/file-evidence-replay.js.map +1 -1
  109. package/dist/runtime/query/index.d.ts.map +1 -1
  110. package/dist/runtime/query/index.js +8 -1
  111. package/dist/runtime/query/index.js.map +1 -1
  112. package/dist/runtime/query/iteration/index.d.ts.map +1 -1
  113. package/dist/runtime/query/iteration/index.js +2 -0
  114. package/dist/runtime/query/iteration/index.js.map +1 -1
  115. package/dist/runtime/query/iteration/phases/compaction.d.ts.map +1 -1
  116. package/dist/runtime/query/iteration/phases/compaction.js +21 -3
  117. package/dist/runtime/query/iteration/phases/compaction.js.map +1 -1
  118. package/dist/runtime/query/iteration/phases/context.d.ts +4 -0
  119. package/dist/runtime/query/iteration/phases/context.d.ts.map +1 -1
  120. package/dist/runtime/query/iteration/phases/context.js.map +1 -1
  121. package/dist/runtime/query/iteration/phases/per-call-review.d.ts +6 -2
  122. package/dist/runtime/query/iteration/phases/per-call-review.d.ts.map +1 -1
  123. package/dist/runtime/query/iteration/phases/per-call-review.js +24 -9
  124. package/dist/runtime/query/iteration/phases/per-call-review.js.map +1 -1
  125. package/dist/runtime/query/iteration/step-shaping.d.ts.map +1 -1
  126. package/dist/runtime/query/iteration/step-shaping.js +4 -0
  127. package/dist/runtime/query/iteration/step-shaping.js.map +1 -1
  128. package/dist/runtime/query/prepare-turn.d.ts +5 -1
  129. package/dist/runtime/query/prepare-turn.d.ts.map +1 -1
  130. package/dist/runtime/query/prepare-turn.js +13 -3
  131. package/dist/runtime/query/prepare-turn.js.map +1 -1
  132. package/dist/runtime/query/review-policy.d.ts +13 -2
  133. package/dist/runtime/query/review-policy.d.ts.map +1 -1
  134. package/dist/runtime/query/review-policy.js +13 -2
  135. package/dist/runtime/query/review-policy.js.map +1 -1
  136. package/dist/runtime/query/turn/outcome-ledger.d.ts +4 -0
  137. package/dist/runtime/query/turn/outcome-ledger.d.ts.map +1 -1
  138. package/dist/runtime/query/turn/outcome-ledger.js +36 -1
  139. package/dist/runtime/query/turn/outcome-ledger.js.map +1 -1
  140. package/dist/sandbox/provider/local.d.ts.map +1 -1
  141. package/dist/sandbox/provider/local.js +3 -1
  142. package/dist/sandbox/provider/local.js.map +1 -1
  143. package/dist/tools/admit-facts.d.ts.map +1 -1
  144. package/dist/tools/admit-facts.js +20 -0
  145. package/dist/tools/admit-facts.js.map +1 -1
  146. package/dist/tools/builtins/bash.d.ts.map +1 -1
  147. package/dist/tools/builtins/bash.js +5 -2
  148. package/dist/tools/builtins/bash.js.map +1 -1
  149. package/dist/tools/builtins/browser.js +2 -2
  150. package/dist/tools/builtins/browser.js.map +1 -1
  151. package/dist/tools/builtins/computer-use.d.ts +4 -0
  152. package/dist/tools/builtins/computer-use.d.ts.map +1 -1
  153. package/dist/tools/builtins/computer-use.js +106 -5
  154. package/dist/tools/builtins/computer-use.js.map +1 -1
  155. package/dist/tools/builtins/content-fingerprint.d.ts.map +1 -1
  156. package/dist/tools/builtins/content-fingerprint.js +2 -1
  157. package/dist/tools/builtins/content-fingerprint.js.map +1 -1
  158. package/dist/tools/builtins/edit-apply.d.ts +1 -0
  159. package/dist/tools/builtins/edit-apply.d.ts.map +1 -1
  160. package/dist/tools/builtins/edit-apply.js +108 -21
  161. package/dist/tools/builtins/edit-apply.js.map +1 -1
  162. package/dist/tools/builtins/edit-match.d.ts +37 -0
  163. package/dist/tools/builtins/edit-match.d.ts.map +1 -1
  164. package/dist/tools/builtins/edit-match.js +193 -0
  165. package/dist/tools/builtins/edit-match.js.map +1 -1
  166. package/dist/tools/builtins/edit.d.ts.map +1 -1
  167. package/dist/tools/builtins/edit.js +14 -7
  168. package/dist/tools/builtins/edit.js.map +1 -1
  169. package/dist/tools/builtins/exit-semantics.d.ts +8 -0
  170. package/dist/tools/builtins/exit-semantics.d.ts.map +1 -1
  171. package/dist/tools/builtins/exit-semantics.js +19 -0
  172. package/dist/tools/builtins/exit-semantics.js.map +1 -1
  173. package/dist/tools/builtins/index.d.ts +2 -0
  174. package/dist/tools/builtins/index.d.ts.map +1 -1
  175. package/dist/tools/builtins/index.js +1 -0
  176. package/dist/tools/builtins/index.js.map +1 -1
  177. package/dist/tools/builtins/present-file.d.ts +24 -0
  178. package/dist/tools/builtins/present-file.d.ts.map +1 -0
  179. package/dist/tools/builtins/present-file.js +116 -0
  180. package/dist/tools/builtins/present-file.js.map +1 -0
  181. package/dist/tools/builtins/read-file.js +1 -1
  182. package/dist/tools/builtins/read-file.js.map +1 -1
  183. package/dist/tools/builtins/read-render.d.ts +12 -1
  184. package/dist/tools/builtins/read-render.d.ts.map +1 -1
  185. package/dist/tools/builtins/read-render.js +16 -3
  186. package/dist/tools/builtins/read-render.js.map +1 -1
  187. package/dist/tools/builtins/search-tools.d.ts +10 -0
  188. package/dist/tools/builtins/search-tools.d.ts.map +1 -1
  189. package/dist/tools/builtins/search-tools.js +36 -2
  190. package/dist/tools/builtins/search-tools.js.map +1 -1
  191. package/dist/tools/builtins/wait-for-job.d.ts.map +1 -1
  192. package/dist/tools/builtins/wait-for-job.js +5 -0
  193. package/dist/tools/builtins/wait-for-job.js.map +1 -1
  194. package/dist/tools/builtins/web.d.ts.map +1 -1
  195. package/dist/tools/builtins/web.js +13 -2
  196. package/dist/tools/builtins/web.js.map +1 -1
  197. package/dist/tools/task/create.js +2 -2
  198. package/dist/tools/task/create.js.map +1 -1
  199. package/dist/tools/task/update.js +1 -1
  200. package/dist/tools/task/update.js.map +1 -1
  201. package/dist/types/provider/chat.d.ts +8 -0
  202. package/dist/types/provider/chat.d.ts.map +1 -1
  203. package/dist/types/provider/interface.d.ts +10 -0
  204. package/dist/types/provider/interface.d.ts.map +1 -1
  205. package/dist/types/provider/model.d.ts +6 -0
  206. package/dist/types/provider/model.d.ts.map +1 -1
  207. package/dist/types/provider/stream.d.ts +2 -0
  208. package/dist/types/provider/stream.d.ts.map +1 -1
  209. package/dist/types/tool/presentation.d.ts +11 -0
  210. package/dist/types/tool/presentation.d.ts.map +1 -1
  211. package/dist/utils/node-on-path.d.ts +27 -0
  212. package/dist/utils/node-on-path.d.ts.map +1 -0
  213. package/dist/utils/node-on-path.js +70 -0
  214. package/dist/utils/node-on-path.js.map +1 -0
  215. package/package.json +1 -1
  216. package/src/bridge/acp/server.ts +25 -0
  217. package/src/compaction/context-window.ts +18 -0
  218. package/src/compaction/loaded-skills.ts +42 -1
  219. package/src/compaction/manager.ts +28 -0
  220. package/src/compaction/manual.ts +9 -1
  221. package/src/compaction/model-summary.ts +2 -2
  222. package/src/compaction/restore.ts +69 -0
  223. package/src/compaction/salience/working-set.ts +6 -2
  224. package/src/compaction/tool-result-editing.ts +8 -1
  225. package/src/compaction/types.ts +2 -0
  226. package/src/compaction/wire.ts +4 -0
  227. package/src/manager/session/turn-recorder.ts +24 -1
  228. package/src/network/join.ts +17 -0
  229. package/src/network/service.ts +185 -12
  230. package/src/network/store.ts +28 -1
  231. package/src/network/transport.ts +1 -1
  232. package/src/network/wire.ts +13 -1
  233. package/src/prompt/coding-agent-doctrine.ts +7 -2
  234. package/src/provider/fallback.ts +6 -0
  235. package/src/provider/idle-timeout.ts +6 -0
  236. package/src/provider/instrumentation.ts +12 -0
  237. package/src/provider/model-window-suffix.ts +1 -0
  238. package/src/provider/retry.ts +6 -0
  239. package/src/public-runtime.ts +1 -0
  240. package/src/public-tools.ts +9 -0
  241. package/src/public-types.ts +1 -0
  242. package/src/registry/tool/presentation.ts +14 -4
  243. package/src/runtime/jobs/registry.ts +2 -1
  244. package/src/runtime/query/auto-review/classifier.ts +19 -3
  245. package/src/runtime/query/auto-review/failure.ts +50 -0
  246. package/src/runtime/query/auto-review/index.ts +1 -0
  247. package/src/runtime/query/file-evidence-replay.ts +6 -5
  248. package/src/runtime/query/index.ts +19 -0
  249. package/src/runtime/query/iteration/index.ts +2 -0
  250. package/src/runtime/query/iteration/phases/compaction.ts +25 -2
  251. package/src/runtime/query/iteration/phases/context.ts +4 -0
  252. package/src/runtime/query/iteration/phases/per-call-review.ts +24 -7
  253. package/src/runtime/query/iteration/step-shaping.ts +4 -0
  254. package/src/runtime/query/prepare-turn.ts +20 -2
  255. package/src/runtime/query/review-policy.ts +24 -4
  256. package/src/runtime/query/turn/outcome-ledger.ts +45 -1
  257. package/src/sandbox/provider/local.ts +3 -1
  258. package/src/tools/admit-facts.ts +18 -0
  259. package/src/tools/builtins/bash.ts +5 -2
  260. package/src/tools/builtins/browser.ts +2 -2
  261. package/src/tools/builtins/computer-use.ts +123 -4
  262. package/src/tools/builtins/content-fingerprint.ts +2 -1
  263. package/src/tools/builtins/edit-apply.ts +124 -24
  264. package/src/tools/builtins/edit-match.ts +200 -0
  265. package/src/tools/builtins/edit.ts +16 -7
  266. package/src/tools/builtins/exit-semantics.ts +23 -0
  267. package/src/tools/builtins/index.ts +2 -0
  268. package/src/tools/builtins/present-file.ts +127 -0
  269. package/src/tools/builtins/read-file.ts +1 -1
  270. package/src/tools/builtins/read-render.ts +18 -3
  271. package/src/tools/builtins/search-tools.ts +36 -2
  272. package/src/tools/builtins/wait-for-job.ts +5 -0
  273. package/src/tools/builtins/web.ts +15 -2
  274. package/src/tools/task/create.ts +2 -2
  275. package/src/tools/task/update.ts +1 -1
  276. package/src/types/provider/chat.ts +9 -0
  277. package/src/types/provider/interface.ts +11 -0
  278. package/src/types/provider/model.ts +6 -0
  279. package/src/types/provider/stream.ts +2 -0
  280. package/src/types/tool/presentation.ts +12 -0
  281. package/src/utils/node-on-path.ts +81 -0
@@ -74,6 +74,15 @@ export interface ChatCompletionParams {
74
74
 
75
75
  cacheControl?: CacheControl
76
76
 
77
+ /**
78
+ * A stable name for the conversation this request belongs to. A driver
79
+ * whose wire has a cache-routing field (a prompt cache key, a session
80
+ * header) sends it so every request of one conversation lands on the same
81
+ * cache; a driver without one ignores it. Never a secret and never
82
+ * derived from the content of the request.
83
+ */
84
+ cacheKey?: string
85
+
77
86
  topP?: number
78
87
  topK?: number
79
88
  frequencyPenalty?: number
@@ -280,6 +280,17 @@ export interface LLMProvider {
280
280
  */
281
281
  resolveContextWindow?(model: string, signal?: AbortSignal): Promise<number | undefined>
282
282
 
283
+ /**
284
+ * The token count at which the provider's own service says a conversation on `model`
285
+ * should be compacted, when it states one (the same listing that states the window).
286
+ *
287
+ * The compaction trigger uses it as `min(limit, 90% of the window)` when the host set no
288
+ * threshold of its own; without it Namzu's derived trigger applies. Same contract as
289
+ * `resolveContextWindow`: asked once per turn, bounded, and a rejection or `undefined`
290
+ * means "no answer", never a failed turn.
291
+ */
292
+ resolveAutoCompactLimit?(model: string, signal?: AbortSignal): Promise<number | undefined>
293
+
283
294
  /**
284
295
  * The model to re-run a refused request on, when this provider has one.
285
296
  *
@@ -37,6 +37,12 @@ export interface ModelInfo {
37
37
  * back to its own table instead of trusting a zero.
38
38
  */
39
39
  contextWindow?: number
40
+ /**
41
+ * Tokens at which the provider's service says a conversation should be compacted, already
42
+ * held to 90% of `contextWindow` when both are known. Absent means the service stated none
43
+ * and Namzu's own trigger rule applies.
44
+ */
45
+ autoCompactTokenLimit?: number
40
46
  /** Same, and absent for the same reason. */
41
47
  maxOutputTokens?: number
42
48
  /**
@@ -26,6 +26,8 @@ export interface StreamChunk {
26
26
  url?: string
27
27
  /** How many sources the provider reported for this call. Absent means unknown, not zero. */
28
28
  results?: number
29
+ /** How many queries one hosted call ran, when it ran several. Absent means one or unknown. */
30
+ searches?: number
29
31
  }
30
32
 
31
33
  content?: string
@@ -219,6 +219,18 @@ export type ToolFacts =
219
219
  readonly hunks?: readonly ToolDiffHunk[]
220
220
  readonly hunksTruncated?: true
221
221
  }
222
+ | {
223
+ readonly kind: 'shared'
224
+ /** Files handed to the person, as absolute paths. */
225
+ readonly files: readonly {
226
+ readonly path: string
227
+ /** Where the path led when the call checked it, links followed; a host compares it again at use. */
228
+ readonly real?: string
229
+ readonly bytes?: number
230
+ }[]
231
+ /** One line saying what they are. */
232
+ readonly caption?: string
233
+ }
222
234
  | {
223
235
  readonly kind: 'failure'
224
236
  readonly reason: ToolFailureReason
@@ -0,0 +1,81 @@
1
+ import { constants, accessSync, realpathSync, statSync } from 'node:fs'
2
+ import { posix, win32 } from 'node:path'
3
+ import { readEnvironmentEntry, setEnvironmentEntry } from './process-environment.js'
4
+
5
+ export interface NodeOnPathOptions {
6
+ /** The running binary. Defaults to `process.execPath`. */
7
+ readonly execPath?: string
8
+ readonly platform?: NodeJS.Platform
9
+ /** Whether a file is an executable `node`. Defaults to a filesystem check. */
10
+ readonly isExecutable?: (file: string) => boolean
11
+ /** Resolve links. Defaults to `fs.realpathSync`. */
12
+ readonly realpath?: (file: string) => string
13
+ }
14
+
15
+ function defaultIsExecutable(file: string, platform: NodeJS.Platform): boolean {
16
+ try {
17
+ if (!statSync(file).isFile()) return false
18
+ if (platform !== 'win32') accessSync(file, constants.X_OK)
19
+ return true
20
+ } catch {
21
+ return false
22
+ }
23
+ }
24
+
25
+ /**
26
+ * The directory that would be appended to PATH so `node` resolves, or
27
+ * undefined when `node` already resolves (or cannot be offered).
28
+ */
29
+ export function nodeDirectoryToAppend(
30
+ pathValue: string,
31
+ options: NodeOnPathOptions = {},
32
+ ): string | undefined {
33
+ const platform = options.platform ?? process.platform
34
+ const path = platform === 'win32' ? win32 : posix
35
+ const execPath = options.execPath ?? process.execPath
36
+ const binary = path.basename(execPath).toLowerCase()
37
+ const wanted = platform === 'win32' ? ['node.exe', 'node.cmd'] : ['node']
38
+ if (!wanted.includes(binary)) return undefined
39
+
40
+ const entries = pathValue.split(path.delimiter)
41
+ const isExecutable =
42
+ options.isExecutable ?? ((file: string) => defaultIsExecutable(file, platform))
43
+ for (const dir of entries) {
44
+ if (dir === '') continue
45
+ for (const file of wanted) if (isExecutable(path.join(dir, file))) return undefined
46
+ }
47
+
48
+ let target: string
49
+ try {
50
+ target = path.dirname((options.realpath ?? realpathSync)(execPath))
51
+ } catch {
52
+ target = path.dirname(execPath)
53
+ }
54
+ return entries.includes(target) ? undefined : target
55
+ }
56
+
57
+ /**
58
+ * Make `node` resolvable in a shell command's environment.
59
+ *
60
+ * The runtime is often started by an absolute path whose directory is not on
61
+ * the user's PATH, so a command like `node --test` then fails with exit 127
62
+ * while the runtime itself is running on that very binary. When no `node`
63
+ * resolves on PATH, the directory of the running binary is appended to the END
64
+ * of PATH: a `node` the user has installed always wins. The environment is
65
+ * returned unchanged when `node` already resolves, when PATH is absent, or when
66
+ * the running binary is not a plain node binary (an embedded runtime).
67
+ */
68
+ export function withNodeOnPath(
69
+ env: Record<string, string>,
70
+ options: NodeOnPathOptions = {},
71
+ ): Record<string, string> {
72
+ const platform = options.platform ?? process.platform
73
+ const entry = readEnvironmentEntry(env, 'PATH', platform)
74
+ if (!entry) return env
75
+ const [name, value] = entry
76
+ const target = nodeDirectoryToAppend(value, options)
77
+ if (target === undefined) return env
78
+ const separator = platform === 'win32' ? ';' : ':'
79
+ setEnvironmentEntry(env, name, value === '' ? target : `${value}${separator}${target}`, platform)
80
+ return env
81
+ }