eve 0.67.1 → 0.68.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 (653) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/src/channel/channel-address.d.ts +2 -2
  3. package/dist/src/channel/compiled-channel.d.ts +3 -2
  4. package/dist/src/channel/cross-channel-receive.d.ts +1 -18
  5. package/dist/src/channel/cross-channel-receive.js +1 -1
  6. package/dist/src/channel/forwarded-principal.d.ts +3 -2
  7. package/dist/src/channel/resolve-text.d.ts +2 -1
  8. package/dist/src/channel/schedule.d.ts +2 -2
  9. package/dist/src/channel/session-callback.d.ts +2 -1
  10. package/dist/src/channel/types.d.ts +3 -7
  11. package/dist/src/cli/acp/command.d.ts +2 -1
  12. package/dist/src/cli/agent-command.d.ts +2 -1
  13. package/dist/src/cli/agent-detection.d.ts +0 -1
  14. package/dist/src/cli/agent-detection.js +1 -1
  15. package/dist/src/cli/application-command.d.ts +2 -1
  16. package/dist/src/cli/application-root.d.ts +3 -6
  17. package/dist/src/cli/application-root.js +1 -1
  18. package/dist/src/cli/commands/init-target.d.ts +1 -1
  19. package/dist/src/cli/commands/init-telemetry.d.ts +2 -1
  20. package/dist/src/cli/commands/registry-declared-setups.d.ts +2 -1
  21. package/dist/src/cli/commands/registry-install-transaction.d.ts +0 -13
  22. package/dist/src/cli/commands/registry-install-transaction.js +1 -1
  23. package/dist/src/cli/commands/registry-pnpm-build-policy-flow.d.ts +1 -1
  24. package/dist/src/cli/commands/registry-presentation.d.ts +0 -1
  25. package/dist/src/cli/commands/registry-presentation.js +1 -1
  26. package/dist/src/cli/commands/registry-project.d.ts +2 -1
  27. package/dist/src/cli/commands/registry.d.ts +0 -4
  28. package/dist/src/cli/commands/registry.js +1 -1
  29. package/dist/src/cli/commands/setup-headless.d.ts +2 -1
  30. package/dist/src/cli/commands/vercel-non-interactive.d.ts +2 -1
  31. package/dist/src/cli/dev/command-options.d.ts +1 -0
  32. package/dist/src/cli/dev/command.js +1 -1
  33. package/dist/src/cli/dev/diagnostic-dump.d.ts +0 -2
  34. package/dist/src/cli/dev/diagnostic-dump.js +1 -1
  35. package/dist/src/cli/dev/diagnostic-sink.d.ts +3 -2
  36. package/dist/src/cli/dev/local-server-process.js +1 -1
  37. package/dist/src/cli/dev/tui/agent-header.d.ts +2 -1
  38. package/dist/src/cli/dev/tui/argument-typeahead.d.ts +2 -1
  39. package/dist/src/cli/dev/tui/dev-rebuild-status.d.ts +2 -1
  40. package/dist/src/cli/dev/tui/diagnostic-presentation.d.ts +2 -1
  41. package/dist/src/cli/dev/tui/errors.d.ts +2 -7
  42. package/dist/src/cli/dev/tui/errors.js +1 -1
  43. package/dist/src/cli/dev/tui/flow-drawer.d.ts +2 -1
  44. package/dist/src/cli/dev/tui/line-editor.d.ts +1 -1
  45. package/dist/src/cli/dev/tui/mcp-connection-status.d.ts +2 -1
  46. package/dist/src/cli/dev/tui/message-queue.d.ts +4 -3
  47. package/dist/src/cli/dev/tui/prompt-command-handler.d.ts +2 -1
  48. package/dist/src/cli/dev/tui/provider-picker.d.ts +3 -2
  49. package/dist/src/cli/dev/tui/question-panel.d.ts +2 -1
  50. package/dist/src/cli/dev/tui/registry-result-message.d.ts +3 -4
  51. package/dist/src/cli/dev/tui/registry-result-message.js +1 -1
  52. package/dist/src/cli/dev/tui/remote-connection-probe.d.ts +3 -2
  53. package/dist/src/cli/dev/tui/setup-panel.d.ts +2 -2
  54. package/dist/src/cli/dev/tui/setup-selection-input.d.ts +2 -2
  55. package/dist/src/cli/dev/tui/status-line.d.ts +2 -1
  56. package/dist/src/cli/dev/tui/stream-format.d.ts +3 -2
  57. package/dist/src/cli/dev/tui/terminal-renderer.d.ts +3 -2
  58. package/dist/src/cli/dev/tui/theme.d.ts +1 -1
  59. package/dist/src/cli/dev/tui/tool-block-groups.d.ts +3 -2
  60. package/dist/src/cli/dev/tui/tool-presentation.d.ts +2 -1
  61. package/dist/src/cli/dev/tui/traces/trace-content.d.ts +0 -9
  62. package/dist/src/cli/dev/tui/traces/trace-content.js +1 -1
  63. package/dist/src/cli/dev/tui/traces/trace-view.d.ts +3 -2
  64. package/dist/src/cli/dev/tui/traces/trace-viewer-session.d.ts +2 -1
  65. package/dist/src/cli/dev/tui/traces/trace-viewer-state.d.ts +2 -3
  66. package/dist/src/cli/dev/tui/traces/trace-viewer-state.js +1 -1
  67. package/dist/src/cli/dev/tui/tui.js +1 -1
  68. package/dist/src/cli/dev/ui-options.d.ts +3 -2
  69. package/dist/src/cli/dev/url-target.d.ts +2 -1
  70. package/dist/src/cli/invoke/command.d.ts +0 -11
  71. package/dist/src/cli/invoke/command.js +1 -1
  72. package/dist/src/cli/invoke/result.d.ts +1 -1
  73. package/dist/src/cli/telemetry/index.d.ts +0 -6
  74. package/dist/src/cli/telemetry/preference.d.ts +2 -1
  75. package/dist/src/cli/ui/alt-screen.d.ts +3 -2
  76. package/dist/src/cli/ui/live-region.d.ts +3 -2
  77. package/dist/src/cli/ui/output.d.ts +1 -1
  78. package/dist/src/client/eve-agent-store-helpers.d.ts +0 -1
  79. package/dist/src/client/eve-agent-store-helpers.js +1 -1
  80. package/dist/src/client/message-action-parts.d.ts +2 -1
  81. package/dist/src/client/session-utils.d.ts +3 -2
  82. package/dist/src/compiled/.vendor-stamp.json +6 -6
  83. package/dist/src/compiled/@photon-ai/chat-adapter-imessage/index.js +55 -55
  84. package/dist/src/compiled/@vercel/blob/index.js +1 -1
  85. package/dist/src/compiled/@vercel/oidc/index.js +1 -1
  86. package/dist/src/compiled/@workflow/core/index.js +2 -2
  87. package/dist/src/compiled/@workflow/core/private.js +1 -1
  88. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +4 -3
  89. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +23 -0
  90. package/dist/src/compiled/@workflow/core/runtime/helpers.js +1 -1
  91. package/dist/src/compiled/@workflow/core/runtime/hook-wake.d.ts +69 -36
  92. package/dist/src/compiled/@workflow/core/runtime/lifecycle-hooks.d.ts +25 -22
  93. package/dist/src/compiled/@workflow/core/runtime/run-spec-version.d.ts +16 -0
  94. package/dist/src/compiled/@workflow/core/runtime/start.d.ts +59 -1
  95. package/dist/src/compiled/@workflow/core/runtime/step-latency.d.ts +3 -2
  96. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +34 -12
  97. package/dist/src/compiled/@workflow/core/runtime.js +4 -4
  98. package/dist/src/compiled/@workflow/core/serialization.d.ts +7 -2
  99. package/dist/src/compiled/@workflow/core/serialization.js +1 -1
  100. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +29 -0
  101. package/dist/src/compiled/@workflow/core/types.d.ts +1 -0
  102. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  103. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  104. package/dist/src/compiled/@workflow/errors/index.d.ts +13 -0
  105. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  106. package/dist/src/compiled/@workflow/world/events.d.ts +14 -4
  107. package/dist/src/compiled/@workflow/world/index.d.ts +2 -2
  108. package/dist/src/compiled/@workflow/world/interfaces.d.ts +2 -1
  109. package/dist/src/compiled/@workflow/world/shared.d.ts +24 -0
  110. package/dist/src/compiled/@workflow/world/spec-version.d.ts +23 -0
  111. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  112. package/dist/src/compiled/@workflow/world-vercel/index.js +16 -16
  113. package/dist/src/compiled/_chunks/workflow/{attribute-changes-DzJovO_f.js → attribute-changes-D721NpZv.js} +3 -3
  114. package/dist/src/compiled/_chunks/workflow/{dist-BQSf8Hax.js → dist-BUFGAKRb.js} +1 -1
  115. package/dist/src/compiled/_chunks/workflow/dist-CaNNONeg.js +3 -0
  116. package/dist/src/compiled/_chunks/workflow/{frames-qKc30rjg.js → frames-Dr9fHWdo.js} +2 -2
  117. package/dist/src/compiled/_chunks/workflow/{global-BQnKzRXo.js → global-DKbOgrts.js} +1 -1
  118. package/dist/src/compiled/_chunks/workflow/helpers-DkKxg_yn.js +1 -0
  119. package/dist/src/compiled/_chunks/workflow/logger-D4GJNTk4.js +14 -0
  120. package/dist/src/compiled/_chunks/workflow/resume-hook-uTW-jBYz.js +1 -0
  121. package/dist/src/compiled/_chunks/workflow/run-5DmiMN9b.js +1 -0
  122. package/dist/src/compiled/_chunks/workflow/serialization-CNIYl1D3.js +3 -0
  123. package/dist/src/compiled/_chunks/workflow/sleep-DFKgN7UG.js +1 -0
  124. package/dist/src/compiled/_chunks/workflow/wait-until-3_1djUuL.js +1 -0
  125. package/dist/src/compiled/_chunks/workflow/{ws-transport-BrsMYqJg.js → ws-transport--rYOVIaf.js} +1 -1
  126. package/dist/src/compiler/artifacts.d.ts +4 -27
  127. package/dist/src/compiler/artifacts.js +1 -1
  128. package/dist/src/compiler/compile-agent.d.ts +2 -1
  129. package/dist/src/compiler/compile-agent.js +1 -1
  130. package/dist/src/compiler/diagnostics.d.ts +0 -11
  131. package/dist/src/compiler/diagnostics.js +1 -1
  132. package/dist/src/compiler/extension-compatibility.d.ts +6 -6
  133. package/dist/src/compiler/extension-compatibility.js +1 -1
  134. package/dist/src/compiler/manifest.d.ts +0 -4
  135. package/dist/src/compiler/module-map.d.ts +1 -5
  136. package/dist/src/compiler/module-map.js +1 -1
  137. package/dist/src/compiler/normalize-agent-config.js +1 -1
  138. package/dist/src/compiler/normalize-connection.d.ts +2 -1
  139. package/dist/src/compiler/normalize-instructions.d.ts +2 -6
  140. package/dist/src/compiler/normalize-instructions.js +1 -1
  141. package/dist/src/compiler/normalize-manifest-helpers.d.ts +0 -1
  142. package/dist/src/compiler/normalize-manifest-helpers.js +1 -1
  143. package/dist/src/compiler/normalize-manifest.js +1 -1
  144. package/dist/src/compiler/normalize-skill.d.ts +2 -1
  145. package/dist/src/compiler/project-sources.d.ts +0 -14
  146. package/dist/src/compiler/project-sources.js +1 -1
  147. package/dist/src/compiler/resolve-workspace-subagent.js +1 -1
  148. package/dist/src/compiler/source-graph.d.ts +1 -2
  149. package/dist/src/compiler/source-graph.js +1 -1
  150. package/dist/src/computer-use/extension/extension.d.ts +2 -0
  151. package/dist/src/computer-use/extension/extension.js +1 -0
  152. package/dist/src/computer-use/extension/lib/command-failure.d.ts +7 -0
  153. package/dist/src/computer-use/extension/lib/command-failure.js +2 -0
  154. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-driver-source.d.ts +0 -2
  155. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-driver-source.js +57 -57
  156. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-sandbox.js +1 -1
  157. package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use.d.ts +1 -1
  158. package/dist/src/computer-use/extension/lib/sandbox.d.ts +1 -0
  159. package/dist/src/computer-use/extension/lib/sandbox.js +1 -0
  160. package/dist/src/computer-use/extension/lib/shell.d.ts +1 -0
  161. package/dist/src/computer-use/extension/lib/shell.js +1 -0
  162. package/dist/src/computer-use/tools.d.ts +1 -0
  163. package/dist/src/computer-use/tools.js +1 -0
  164. package/dist/src/context/build-base-tool-context.d.ts +2 -1
  165. package/dist/src/context/dynamic-tool-lifecycle.d.ts +1 -5
  166. package/dist/src/context/dynamic-tool-lifecycle.js +1 -1
  167. package/dist/src/context/dynamic-tool-metadata.d.ts +0 -1
  168. package/dist/src/context/dynamic-tool-metadata.js +1 -1
  169. package/dist/src/context/hook-lifecycle.d.ts +4 -3
  170. package/dist/src/context/hook-lifecycle.js +1 -1
  171. package/dist/src/context/memory-lifecycle.d.ts +0 -8
  172. package/dist/src/context/memory-lifecycle.js +1 -1
  173. package/dist/src/discover/connections.d.ts +0 -15
  174. package/dist/src/discover/connections.js +1 -1
  175. package/dist/src/discover/diagnostics.d.ts +0 -8
  176. package/dist/src/discover/diagnostics.js +1 -1
  177. package/dist/src/discover/discover-agent.js +1 -1
  178. package/dist/src/discover/discover-subagent.d.ts +0 -1
  179. package/dist/src/discover/discover-subagent.js +1 -1
  180. package/dist/src/discover/extensions.d.ts +3 -10
  181. package/dist/src/discover/extensions.js +1 -1
  182. package/dist/src/discover/filesystem.d.ts +5 -9
  183. package/dist/src/discover/filesystem.js +1 -1
  184. package/dist/src/discover/grammar.d.ts +0 -46
  185. package/dist/src/discover/grammar.js +1 -1
  186. package/dist/src/discover/manifest.d.ts +5 -4
  187. package/dist/src/discover/memory.d.ts +0 -1
  188. package/dist/src/discover/memory.js +1 -1
  189. package/dist/src/discover/named-source-directory.js +1 -1
  190. package/dist/src/discover/project-source.d.ts +2 -1
  191. package/dist/src/discover/project.js +1 -1
  192. package/dist/src/discover/sandbox.js +1 -1
  193. package/dist/src/discover/skills.d.ts +0 -4
  194. package/dist/src/discover/skills.js +1 -1
  195. package/dist/src/evals/cli/eval-client.d.ts +2 -1
  196. package/dist/src/evals/judge.d.ts +2 -1
  197. package/dist/src/evals/runner/execute-task.d.ts +1 -1
  198. package/dist/src/evals/types.d.ts +1 -1
  199. package/dist/src/eve-channel/support.d.ts +1 -3
  200. package/dist/src/eve-channel/support.js +1 -1
  201. package/dist/src/execution/continuation-conflict-step.js +1 -1
  202. package/dist/src/execution/dynamic-workflow/schema.d.ts +2 -1
  203. package/dist/src/execution/dynamic-workflow/tool.js +1 -1
  204. package/dist/src/execution/effective-agent-config.d.ts +2 -1
  205. package/dist/src/execution/eve-workflow-attributes.d.ts +3 -5
  206. package/dist/src/execution/eve-workflow-attributes.js +1 -1
  207. package/dist/src/execution/history-view.d.ts +2 -1
  208. package/dist/src/execution/node-step.d.ts +3 -2
  209. package/dist/src/execution/proxied-deliver-step.js +1 -1
  210. package/dist/src/execution/publish-channel-event.js +1 -1
  211. package/dist/src/execution/sandbox/active-handles.d.ts +2 -4
  212. package/dist/src/execution/sandbox/active-handles.js +1 -1
  213. package/dist/src/execution/sandbox/bash.d.ts +2 -1
  214. package/dist/src/execution/sandbox/bindings/docker.js +1 -1
  215. package/dist/src/execution/sandbox/bindings/immutable-resources.d.ts +0 -6
  216. package/dist/src/execution/sandbox/bindings/immutable-resources.js +1 -1
  217. package/dist/src/execution/sandbox/bindings/local-provider-utils.d.ts +3 -2
  218. package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.d.ts +0 -1
  219. package/dist/src/execution/sandbox/bindings/microsandbox-lifecycle.js +1 -1
  220. package/dist/src/execution/sandbox/bindings/microsandbox-network.d.ts +1 -1
  221. package/dist/src/execution/sandbox/bindings/microsandbox-options.d.ts +0 -3
  222. package/dist/src/execution/sandbox/bindings/microsandbox-options.js +1 -1
  223. package/dist/src/execution/sandbox/bindings/microsandbox-templates.d.ts +0 -1
  224. package/dist/src/execution/sandbox/bindings/microsandbox-templates.js +1 -1
  225. package/dist/src/execution/sandbox/bindings/vercel.d.ts +1 -1
  226. package/dist/src/execution/sandbox/dockerfile.d.ts +0 -1
  227. package/dist/src/execution/sandbox/dockerfile.js +1 -1
  228. package/dist/src/execution/sandbox/ensure.d.ts +2 -1
  229. package/dist/src/execution/sandbox/ensure.js +1 -1
  230. package/dist/src/execution/sandbox/prewarm.d.ts +1 -18
  231. package/dist/src/execution/sandbox/prewarm.js +1 -1
  232. package/dist/src/execution/sandbox/require-sandbox.d.ts +0 -11
  233. package/dist/src/execution/sandbox/require-sandbox.js +1 -1
  234. package/dist/src/execution/sandbox/truncate-output.d.ts +2 -5
  235. package/dist/src/execution/sandbox/truncate-output.js +2 -2
  236. package/dist/src/execution/session/admission.d.ts +3 -2
  237. package/dist/src/execution/session/event-sink.d.ts +2 -1
  238. package/dist/src/execution/session/finalization.d.ts +2 -1
  239. package/dist/src/execution/session/handoff.d.ts +3 -2
  240. package/dist/src/execution/session/route-selected-delivery.d.ts +2 -1
  241. package/dist/src/execution/session/timeout-control.d.ts +2 -1
  242. package/dist/src/execution/session/timeout-steps.js +1 -1
  243. package/dist/src/execution/session/turn-event-handler.d.ts +27 -0
  244. package/dist/src/execution/session/turn-event-handler.js +1 -0
  245. package/dist/src/execution/session/turn-step.js +1 -1
  246. package/dist/src/execution/session-activity.d.ts +0 -3
  247. package/dist/src/execution/session-activity.js +1 -1
  248. package/dist/src/execution/session-inbox/protocol.d.ts +2 -1
  249. package/dist/src/execution/session.d.ts +3 -2
  250. package/dist/src/execution/stable-workflow-names.d.ts +0 -6
  251. package/dist/src/execution/stable-workflow-names.js +1 -1
  252. package/dist/src/execution/task-input-response-route.js +1 -1
  253. package/dist/src/execution/tasks/child/notify.js +1 -1
  254. package/dist/src/execution/tools/agent-router-workflow.js +1 -1
  255. package/dist/src/execution/tools/ask-question-workflow.js +1 -1
  256. package/dist/src/execution/tools/connection-search.js +2 -2
  257. package/dist/src/execution/tools/sleep-workflow.js +1 -1
  258. package/dist/src/execution/tools/subagent/emit-event-step.js +1 -1
  259. package/dist/src/execution/tools/subagent/invoke-preparation.d.ts +2 -1
  260. package/dist/src/execution/tools/subagent/task-agent-requests.d.ts +4 -3
  261. package/dist/src/execution/tools/workflow/answer.d.ts +4 -1
  262. package/dist/src/execution/tools/workflow/answer.js +1 -1
  263. package/dist/src/execution/tools/workflow/background.d.ts +2 -6
  264. package/dist/src/execution/tools/workflow/background.js +1 -1
  265. package/dist/src/execution/tools/workflow/owner-channels.d.ts +1 -1
  266. package/dist/src/execution/tools/workflow/workflow-owner-background.d.ts +2 -1
  267. package/dist/src/execution/web-fetch/execute.d.ts +2 -2
  268. package/dist/src/execution/web-fetch/request.d.ts +2 -1
  269. package/dist/src/execution/workflow-runtime.js +1 -1
  270. package/dist/src/extensions/code/extension/lib/generated-paths.d.ts +2 -1
  271. package/dist/src/extensions/code/extension/lib/grep-search.d.ts +5 -5
  272. package/dist/src/extensions/code/extension/lib/grep-search.js +2 -2
  273. package/dist/src/extensions/code/extension/lib/guidelines.d.ts +2 -1
  274. package/dist/src/extensions/code/extension/lib/patch.d.ts +3 -2
  275. package/dist/src/extensions/code/extension/lib/prwatch-github.d.ts +1 -2
  276. package/dist/src/extensions/code/extension/lib/prwatch-github.js +1 -1
  277. package/dist/src/extensions/code/extension/lib/prwatch-registry.d.ts +2 -1
  278. package/dist/src/extensions/code/extension/lib/sandbox.d.ts +3 -2
  279. package/dist/src/extensions/code/extension/lib/sandbox.js +1 -1
  280. package/dist/src/extensions/code/extension/lib/signed-commit.d.ts +1 -1
  281. package/dist/src/extensions/code/extension/lib/signed-commit.js +2 -2
  282. package/dist/src/extensions/code/tools.d.ts +2 -1
  283. package/dist/src/extensions/code/tools.js +1 -1
  284. package/dist/src/framework/host-inventory.d.ts +3 -2
  285. package/dist/src/harness/approval-candidates.d.ts +4 -3
  286. package/dist/src/harness/approval-delivery-coordinator.d.ts +2 -1
  287. package/dist/src/harness/compaction-prompt.d.ts +2 -1
  288. package/dist/src/harness/coordination.d.ts +0 -4
  289. package/dist/src/harness/coordination.js +1 -1
  290. package/dist/src/harness/input-requests.d.ts +1 -10
  291. package/dist/src/harness/input-requests.js +1 -1
  292. package/dist/src/harness/pending-input-batches.d.ts +0 -5
  293. package/dist/src/harness/pending-input-batches.js +1 -1
  294. package/dist/src/harness/provider-tools.d.ts +2 -1
  295. package/dist/src/harness/session-limit-continuation.d.ts +0 -4
  296. package/dist/src/harness/session-limit-continuation.js +1 -1
  297. package/dist/src/harness/session-usage-limits.d.ts +2 -1
  298. package/dist/src/harness/tool-loop.js +2 -2
  299. package/dist/src/harness/tool-model-output.d.ts +2 -1
  300. package/dist/src/harness/turn-client-context.d.ts +2 -1
  301. package/dist/src/instrumentation/ai-sdk-hook-bridge.js +1 -1
  302. package/dist/src/instrumentation/lifecycle.d.ts +2 -2
  303. package/dist/src/instrumentation/lifecycle.js +1 -1
  304. package/dist/src/instrumentation/state.d.ts +2 -2
  305. package/dist/src/internal/agent-name.d.ts +0 -2
  306. package/dist/src/internal/agent-name.js +1 -1
  307. package/dist/src/internal/application/build-profile.d.ts +2 -2
  308. package/dist/src/internal/application/dev-environment.d.ts +2 -8
  309. package/dist/src/internal/application/dev-environment.js +1 -1
  310. package/dist/src/internal/application/output-publication.d.ts +1 -1
  311. package/dist/src/internal/application/package.js +1 -1
  312. package/dist/src/internal/application/paths.d.ts +0 -5
  313. package/dist/src/internal/application/paths.js +1 -1
  314. package/dist/src/internal/application/tsconfig-dependencies.d.ts +0 -16
  315. package/dist/src/internal/application/tsconfig-dependencies.js +1 -1
  316. package/dist/src/internal/authored-definition/schema-backed.js +1 -1
  317. package/dist/src/internal/authored-definition/source-identity.d.ts +1 -1
  318. package/dist/src/internal/authored-module-map-loader.js +1 -1
  319. package/dist/src/internal/bundler/extension-scope-plugin.d.ts +2 -1
  320. package/dist/src/internal/bundler/nitro-rolldown.d.ts +0 -11
  321. package/dist/src/internal/bundler/nitro-rolldown.js +1 -1
  322. package/dist/src/internal/eve-project-root.d.ts +0 -3
  323. package/dist/src/internal/eve-project-root.js +1 -1
  324. package/dist/src/internal/external-resources-snapshot.d.ts +1 -1
  325. package/dist/src/internal/external-resources.d.ts +0 -1
  326. package/dist/src/internal/external-resources.js +1 -1
  327. package/dist/src/internal/helpers/markdown.js +1 -1
  328. package/dist/src/internal/invocation/metadata.d.ts +1 -1
  329. package/dist/src/internal/materialized-authored-modules.d.ts +2 -1
  330. package/dist/src/internal/mcp/protected-resource.d.ts +2 -1
  331. package/dist/src/internal/mcp/streamable-http-server.d.ts +4 -5
  332. package/dist/src/internal/mcp/streamable-http-server.js +1 -1
  333. package/dist/src/internal/model-catalog.d.ts +2 -1
  334. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.d.ts +2 -2
  335. package/dist/src/internal/nitro/dev-runtime-artifacts-retention.js +1 -1
  336. package/dist/src/internal/nitro/dev-runtime-artifacts.d.ts +2 -8
  337. package/dist/src/internal/nitro/dev-runtime-artifacts.js +1 -1
  338. package/dist/src/internal/nitro/dev-runtime-generation-metadata.d.ts +13 -0
  339. package/dist/src/internal/nitro/dev-runtime-generation-metadata.js +1 -0
  340. package/dist/src/internal/nitro/dev-runtime-source-snapshot.d.ts +0 -1
  341. package/dist/src/internal/nitro/dev-runtime-source-snapshot.js +1 -1
  342. package/dist/src/internal/nitro/development-generation.d.ts +2 -1
  343. package/dist/src/internal/nitro/development-generation.js +1 -1
  344. package/dist/src/internal/nitro/host/channel-routes.d.ts +1 -1
  345. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.d.ts +3 -1
  346. package/dist/src/internal/nitro/host/dev-authored-rebuild-coordinator.js +1 -1
  347. package/dist/src/internal/nitro/host/dev-host-candidate.d.ts +2 -1
  348. package/dist/src/internal/nitro/host/dev-workflow-world-setup.d.ts +1 -0
  349. package/dist/src/internal/nitro/host/dev-workflow-world-setup.js +1 -1
  350. package/dist/src/internal/nitro/host/drained-nitro-dev-server.d.ts +1 -1
  351. package/dist/src/internal/nitro/host/extension-capability-requirements.js +1 -1
  352. package/dist/src/internal/nitro/host/schedule-task-routes.d.ts +1 -1
  353. package/dist/src/internal/nitro/host/start-development-server.js +1 -1
  354. package/dist/src/internal/nitro/host/types.d.ts +2 -0
  355. package/dist/src/internal/nitro/host/workspace-extensions.js +1 -1
  356. package/dist/src/internal/nitro/routes/channel-request-instrumentation.d.ts +2 -1
  357. package/dist/src/internal/nitro/routes/channel-route-context.d.ts +1 -1
  358. package/dist/src/internal/nitro/routes/runtime-stack.d.ts +2 -1
  359. package/dist/src/internal/resolve-model-endpoint-status.d.ts +2 -1
  360. package/dist/src/internal/vercel/assemble-eve-services.d.ts +3 -2
  361. package/dist/src/internal/vercel/eve-service-contribution.d.ts +2 -3
  362. package/dist/src/internal/vercel/eve-service-contribution.js +1 -1
  363. package/dist/src/internal/vercel/project-link.d.ts +2 -1
  364. package/dist/src/internal/vercel/project-link.js +1 -1
  365. package/dist/src/internal/workflow/cancel-expired-development-run.d.ts +2 -0
  366. package/dist/src/internal/workflow/cancel-expired-development-run.js +1 -0
  367. package/dist/src/internal/workflow/development-runtime-compatibility.d.ts +12 -0
  368. package/dist/src/internal/workflow/development-runtime-compatibility.js +1 -0
  369. package/dist/src/internal/workflow/development-world-client.js +1 -1
  370. package/dist/src/internal/workflow/development-world-codec.d.ts +2 -1
  371. package/dist/src/internal/workflow/development-world-protocol.d.ts +9 -0
  372. package/dist/src/internal/workflow/development-world-server.d.ts +2 -0
  373. package/dist/src/internal/workflow/development-world-server.js +1 -1
  374. package/dist/src/internal/workflow/is-inactive-workflow-run-error.d.ts +2 -0
  375. package/dist/src/internal/workflow/is-inactive-workflow-run-error.js +1 -0
  376. package/dist/src/internal/workflow/world-compatibility.d.ts +2 -1
  377. package/dist/src/internal/workflow-bundle/builder-support.d.ts +0 -9
  378. package/dist/src/internal/workflow-bundle/builder-support.js +2 -3
  379. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.d.ts +0 -1
  380. package/dist/src/internal/workflow-bundle/dynamic-tool-transform.js +1 -1
  381. package/dist/src/protocol/activity.d.ts +3 -3
  382. package/dist/src/protocol/activity.js +1 -1
  383. package/dist/src/protocol/baggage.d.ts +2 -2
  384. package/dist/src/protocol/cancel-turn.d.ts +0 -2
  385. package/dist/src/protocol/event-dedupe.d.ts +2 -1
  386. package/dist/src/protocol/event-id.d.ts +0 -6
  387. package/dist/src/protocol/event-id.js +1 -1
  388. package/dist/src/protocol/traceparent.d.ts +2 -1
  389. package/dist/src/public/channels/chat-sdk/audience.d.ts +2 -4
  390. package/dist/src/public/channels/chat-sdk/audience.js +1 -1
  391. package/dist/src/public/channels/discord/discordChannel.d.ts +1 -1
  392. package/dist/src/public/channels/github/api.d.ts +2 -12
  393. package/dist/src/public/channels/github/api.js +1 -1
  394. package/dist/src/public/channels/github/auth.d.ts +0 -9
  395. package/dist/src/public/channels/github/auth.js +1 -1
  396. package/dist/src/public/channels/github/binding.d.ts +3 -2
  397. package/dist/src/public/channels/github/checkout.d.ts +3 -3
  398. package/dist/src/public/channels/github/defaults.d.ts +3 -2
  399. package/dist/src/public/channels/github/githubChannel.d.ts +1 -1
  400. package/dist/src/public/channels/github/limits.d.ts +0 -2
  401. package/dist/src/public/channels/github/limits.js +2 -2
  402. package/dist/src/public/channels/github/pr-context.d.ts +2 -3
  403. package/dist/src/public/channels/github/pr-context.js +1 -1
  404. package/dist/src/public/channels/github/state.d.ts +2 -1
  405. package/dist/src/public/channels/github/verify.d.ts +2 -1
  406. package/dist/src/public/channels/linear/defaults.d.ts +2 -1
  407. package/dist/src/public/channels/linear/inbound-images.d.ts +2 -1
  408. package/dist/src/public/channels/slack/app-manifest.d.ts +3 -4
  409. package/dist/src/public/channels/slack/app-manifest.js +1 -1
  410. package/dist/src/public/channels/slack/inbound.d.ts +2 -1
  411. package/dist/src/public/channels/slack/model-context.d.ts +0 -18
  412. package/dist/src/public/channels/slack/model-context.js +1 -1
  413. package/dist/src/public/channels/slack/privacy.d.ts +2 -1
  414. package/dist/src/public/channels/slack/verify.d.ts +1 -1
  415. package/dist/src/public/channels/teams/teamsChannel.d.ts +1 -1
  416. package/dist/src/public/channels/telegram/audience.d.ts +2 -3
  417. package/dist/src/public/channels/telegram/audience.js +1 -1
  418. package/dist/src/public/channels/telegram/telegramChannel.d.ts +1 -1
  419. package/dist/src/public/channels/twilio/defaults.d.ts +0 -7
  420. package/dist/src/public/channels/twilio/defaults.js +1 -1
  421. package/dist/src/public/channels/twilio/routing.d.ts +2 -1
  422. package/dist/src/public/channels/twilio/twilioChannel.d.ts +1 -1
  423. package/dist/src/public/definitions/channel.d.ts +1 -1
  424. package/dist/src/public/definitions/hook.d.ts +12 -0
  425. package/dist/src/public/index.js +1 -1
  426. package/dist/src/public/memory/file/provider.js +1 -1
  427. package/dist/src/public/models/openai/chatgpt/model.d.ts +2 -1
  428. package/dist/src/public/models/openai/chatgpt/token-broker.d.ts +1 -1
  429. package/dist/src/public/nuxt/dev-server.d.ts +3 -2
  430. package/dist/src/public/skills/index.js +1 -1
  431. package/dist/src/public/sveltekit/dev-server.d.ts +3 -2
  432. package/dist/src/public/tools/index.js +1 -1
  433. package/dist/src/runtime/compiled-artifacts-source.d.ts +0 -4
  434. package/dist/src/runtime/compiled-artifacts-source.js +1 -1
  435. package/dist/src/runtime/connections/instance-identity.d.ts +0 -3
  436. package/dist/src/runtime/connections/instance-identity.js +1 -1
  437. package/dist/src/runtime/connections/mcp-client.d.ts +7 -0
  438. package/dist/src/runtime/connections/mcp-client.js +1 -1
  439. package/dist/src/runtime/connections/mcp-tracing.d.ts +1 -6
  440. package/dist/src/runtime/connections/mcp-tracing.js +1 -1
  441. package/dist/src/runtime/connections/openapi-client.d.ts +1 -1
  442. package/dist/src/runtime/connections/scoped-authorization.d.ts +0 -9
  443. package/dist/src/runtime/connections/scoped-authorization.js +1 -1
  444. package/dist/src/runtime/hooks/registry.d.ts +0 -7
  445. package/dist/src/runtime/hooks/registry.js +1 -1
  446. package/dist/src/runtime/loaders/artifact-paths.d.ts +2 -1
  447. package/dist/src/runtime/loaders/bundled-artifacts.d.ts +0 -1
  448. package/dist/src/runtime/loaders/bundled-artifacts.js +1 -1
  449. package/dist/src/runtime/resolve-agent.d.ts +2 -2
  450. package/dist/src/runtime/resolve-agent.js +1 -1
  451. package/dist/src/runtime/resolve-dynamic-tool.d.ts +0 -16
  452. package/dist/src/runtime/resolve-dynamic-tool.js +1 -1
  453. package/dist/src/runtime/sandbox/prepared-artifacts.d.ts +1 -2
  454. package/dist/src/runtime/sandbox/prepared-artifacts.js +1 -1
  455. package/dist/src/runtime/schedules/register.d.ts +0 -4
  456. package/dist/src/runtime/schedules/register.js +1 -1
  457. package/dist/src/self-modification/credentials.d.ts +1 -4
  458. package/dist/src/self-modification/credentials.js +1 -1
  459. package/dist/src/self-modification/extension/subagents/agent/tools/search_traces.js +1 -1
  460. package/dist/src/self-modification/filesystem.d.ts +0 -1
  461. package/dist/src/self-modification/filesystem.js +1 -1
  462. package/dist/src/self-modification/git-workspace.d.ts +0 -3
  463. package/dist/src/self-modification/git-workspace.js +1 -1
  464. package/dist/src/self-modification/github-publisher.d.ts +2 -1
  465. package/dist/src/self-modification/migration.d.ts +0 -1
  466. package/dist/src/self-modification/migration.js +1 -1
  467. package/dist/src/self-modification/mode.d.ts +2 -1
  468. package/dist/src/self-modification/proposal.d.ts +0 -2
  469. package/dist/src/self-modification/proposal.js +2 -2
  470. package/dist/src/self-modification/setup.js +1 -1
  471. package/dist/src/services/dev-client/agent-info-probe.d.ts +2 -1
  472. package/dist/src/services/dev-client/request-headers.d.ts +1 -1
  473. package/dist/src/setup/ai-gateway-api-key.d.ts +2 -1
  474. package/dist/src/setup/append-env.d.ts +3 -2
  475. package/dist/src/setup/ask.d.ts +3 -3
  476. package/dist/src/setup/boxes/apply-ai-gateway-credential.d.ts +2 -1
  477. package/dist/src/setup/boxes/deploy-project.d.ts +4 -3
  478. package/dist/src/setup/boxes/link-project.d.ts +2 -1
  479. package/dist/src/setup/boxes/model-capabilities.d.ts +2 -2
  480. package/dist/src/setup/boxes/model-capabilities.js +1 -1
  481. package/dist/src/setup/boxes/resolve-provisioning.d.ts +2 -1
  482. package/dist/src/setup/boxes/select-model.d.ts +0 -1
  483. package/dist/src/setup/boxes/select-model.js +1 -1
  484. package/dist/src/setup/cli/option-row.d.ts +1 -1
  485. package/dist/src/setup/cli/prompt-ui.d.ts +0 -10
  486. package/dist/src/setup/cli/prompt-ui.js +1 -1
  487. package/dist/src/setup/cli/rail-log.d.ts +0 -2
  488. package/dist/src/setup/cli/rail-log.js +2 -2
  489. package/dist/src/setup/connect-provisioning.d.ts +2 -1
  490. package/dist/src/setup/connection-connector.d.ts +2 -1
  491. package/dist/src/setup/flows/link.d.ts +2 -1
  492. package/dist/src/setup/flows/model-login.d.ts +1 -1
  493. package/dist/src/setup/flows/model-source-change.js +1 -1
  494. package/dist/src/setup/flows/registry-session.d.ts +3 -2
  495. package/dist/src/setup/integrations/discord/api.d.ts +2 -1
  496. package/dist/src/setup/integrations/discord/connect.d.ts +3 -3
  497. package/dist/src/setup/integrations/discord/connect.js +1 -1
  498. package/dist/src/setup/integrations/discord/setup.d.ts +2 -1
  499. package/dist/src/setup/integrations/file-memory/vercel.d.ts +1 -1
  500. package/dist/src/setup/integrations/github/connect.d.ts +3 -3
  501. package/dist/src/setup/integrations/github/connect.js +1 -1
  502. package/dist/src/setup/integrations/github/setup.d.ts +1 -1
  503. package/dist/src/setup/integrations/linear/connect.d.ts +2 -2
  504. package/dist/src/setup/integrations/linear/connect.js +1 -1
  505. package/dist/src/setup/integrations/linear/setup.d.ts +1 -1
  506. package/dist/src/setup/integrations/linq/connect.d.ts +3 -4
  507. package/dist/src/setup/integrations/linq/connect.js +1 -1
  508. package/dist/src/setup/integrations/linq/management.d.ts +2 -1
  509. package/dist/src/setup/integrations/linq/setup.d.ts +1 -9
  510. package/dist/src/setup/integrations/linq/setup.js +1 -1
  511. package/dist/src/setup/integrations/photon/connect.d.ts +5 -7
  512. package/dist/src/setup/integrations/photon/connect.js +1 -1
  513. package/dist/src/setup/integrations/photon/management.d.ts +5 -4
  514. package/dist/src/setup/integrations/photon/setup-flow.d.ts +2 -1
  515. package/dist/src/setup/integrations/registry.d.ts +0 -2
  516. package/dist/src/setup/integrations/registry.js +1 -1
  517. package/dist/src/setup/integrations/runner.d.ts +3 -2
  518. package/dist/src/setup/integrations/shared/scaffold.d.ts +2 -1
  519. package/dist/src/setup/integrations/shared/vercel-project.d.ts +2 -1
  520. package/dist/src/setup/integrations/shopify/setup.d.ts +2 -1
  521. package/dist/src/setup/integrations/teams/connect.d.ts +3 -3
  522. package/dist/src/setup/integrations/teams/connect.js +1 -1
  523. package/dist/src/setup/integrations/teams/setup.d.ts +2 -1
  524. package/dist/src/setup/integrations/web/setup.d.ts +2 -3
  525. package/dist/src/setup/integrations/web/setup.js +3 -3
  526. package/dist/src/setup/primitives/pm/process-result.d.ts +2 -1
  527. package/dist/src/setup/primitives/pm/shared.d.ts +2 -1
  528. package/dist/src/setup/primitives/process-output.d.ts +2 -1
  529. package/dist/src/setup/quit-guard.d.ts +3 -2
  530. package/dist/src/setup/scaffold/create/add-to-project.d.ts +2 -1
  531. package/dist/src/setup/scaffold/create/project.js +1 -1
  532. package/dist/src/setup/scaffold/create/web-template.d.ts +1 -1
  533. package/dist/src/setup/scaffold/create/web-template.js +1 -1
  534. package/dist/src/setup/scaffold/files.d.ts +2 -1
  535. package/dist/src/setup/scaffold/update/channels.d.ts +0 -1
  536. package/dist/src/setup/scaffold/workspace-glob.d.ts +0 -1
  537. package/dist/src/setup/scaffold/workspace-glob.js +1 -1
  538. package/dist/src/setup/scaffold/workspace-root.d.ts +2 -1
  539. package/dist/src/setup/slack-connect-create.d.ts +1 -1
  540. package/dist/src/setup/slack-connect-lifecycle.d.ts +5 -5
  541. package/dist/src/setup/slack-connect.d.ts +0 -4
  542. package/dist/src/setup/slack-connect.js +1 -1
  543. package/dist/src/setup/slackbot.d.ts +3 -3
  544. package/dist/src/setup/slackbot.js +1 -1
  545. package/dist/src/setup/vercel-project-api.d.ts +1 -1
  546. package/dist/src/setup/vercel-project.d.ts +3 -18
  547. package/dist/src/setup/vercel-project.js +0 -0
  548. package/dist/src/shared/action-types.d.ts +1 -58
  549. package/dist/src/shared/action-types.js +1 -1
  550. package/dist/src/shared/agent-definition.d.ts +0 -3
  551. package/dist/src/shared/agent-turn-outcome.d.ts +1 -3
  552. package/dist/src/shared/agent-turn-outcome.js +1 -1
  553. package/dist/src/shared/chatgpt-model.d.ts +0 -1
  554. package/dist/src/shared/chatgpt-model.js +1 -1
  555. package/dist/src/shared/connection-types.d.ts +5 -0
  556. package/dist/src/shared/conversation-context.d.ts +2 -1
  557. package/dist/src/shared/extension-package-contract.d.ts +2 -1
  558. package/dist/src/shared/forwarded-trace-policy.d.ts +3 -2
  559. package/dist/src/shared/gateway-model-catalog.d.ts +25 -2
  560. package/dist/src/shared/gateway-model-catalog.js +1 -1
  561. package/dist/src/shared/gateway-service-tier.d.ts +2 -1
  562. package/dist/src/shared/memory-state.d.ts +0 -8
  563. package/dist/src/shared/memory-state.js +1 -1
  564. package/dist/src/shared/sandbox-environment.d.ts +0 -1
  565. package/dist/src/shared/sandbox-environment.js +1 -1
  566. package/dist/src/shared/skill-package.d.ts +0 -5
  567. package/dist/src/shared/skill-package.js +1 -1
  568. package/dist/src/shared/token-usage.d.ts +0 -7
  569. package/dist/src/shared/token-usage.js +1 -1
  570. package/dist/src/shared/ulid.d.ts +2 -8
  571. package/dist/src/shared/ulid.js +1 -1
  572. package/dist/src/shared/vercel-project.d.ts +2 -1
  573. package/dist/src/shared/vercel-services.d.ts +2 -2
  574. package/dist/src/shared/workflow-sandbox.d.ts +0 -7
  575. package/dist/src/source-change/agent-config-ast.d.ts +2 -1
  576. package/dist/src/source-change/agent-config-string-path.d.ts +2 -2
  577. package/dist/src/source-change/apply-agent-model-settings.d.ts +2 -1
  578. package/dist/src/source-change/apply-model-selection.d.ts +2 -1
  579. package/dist/src/source-change/static-source-change.d.ts +4 -3
  580. package/dist/src/subagents/invocation.d.ts +1 -1
  581. package/dist/src/subagents/parent-notification.js +1 -1
  582. package/dist/src/subagents/tool.d.ts +2 -1
  583. package/dist/src/tasks/types.d.ts +2 -0
  584. package/dist/src/tools/definition.d.ts +8 -3
  585. package/dist/src/tools/durable-callbacks.d.ts +1 -2
  586. package/dist/src/tools/durable-callbacks.js +1 -1
  587. package/dist/src/tools/framework/agent.js +1 -1
  588. package/dist/src/tools/framework/task-cancel.d.ts +1 -1
  589. package/dist/src/tools/native-definition.d.ts +2 -1
  590. package/dist/src/tracing/agent-action-instrumentation.d.ts +2 -1
  591. package/dist/src/tracing/agent-memory-instrumentation.d.ts +2 -1
  592. package/dist/src/tracing/agent-otel-provider.d.ts +2 -1
  593. package/dist/src/tracing/agent-span-id-generator.d.ts +0 -1
  594. package/dist/src/tracing/agent-span-id-generator.js +1 -1
  595. package/dist/src/tracing/agent-tool-instrumentation.d.ts +2 -1
  596. package/dist/src/tracing/agent-tool-span-context.d.ts +3 -2
  597. package/dist/src/tracing/agent-trace-state.d.ts +0 -24
  598. package/dist/src/tracing/agent-trace-state.js +1 -1
  599. package/dist/src/tracing/batch-span-processor.d.ts +2 -1
  600. package/dist/src/tracing/local-trace-analysis.d.ts +4 -3
  601. package/dist/src/tracing/local-trace-discovery-index.d.ts +0 -2
  602. package/dist/src/tracing/local-trace-discovery-index.js +1 -1
  603. package/dist/src/tracing/local-trace-query.d.ts +2 -1
  604. package/dist/src/tracing/local-trace-retention.d.ts +4 -4
  605. package/dist/src/tracing/telemetry-budget.d.ts +0 -1
  606. package/dist/src/tracing/telemetry-budget.js +1 -1
  607. package/docs/concepts/project-structure.mdx +1 -1
  608. package/docs/guides/auth-and-route-protection.md +1 -1
  609. package/docs/guides/deployment/vercel.mdx +1 -1
  610. package/docs/guides/dynamic-capabilities.md +10 -7
  611. package/docs/guides/hooks.md +34 -2
  612. package/docs/install-integrations.mdx +1 -1
  613. package/docs/reference/cli.md +36 -15
  614. package/docs/tools/human-in-the-loop.md +2 -0
  615. package/package.json +31 -10
  616. package/dist/src/cli/commands/channel-add-conflicts.d.ts +0 -21
  617. package/dist/src/cli/commands/channel-add-conflicts.js +0 -1
  618. package/dist/src/cli/commands/registry-search-presentation.d.ts +0 -16
  619. package/dist/src/cli/commands/registry-search-presentation.js +0 -6
  620. package/dist/src/compiled/_chunks/workflow/dist-BfMqXLK3.js +0 -3
  621. package/dist/src/compiled/_chunks/workflow/helpers-CNMO7zB1.js +0 -1
  622. package/dist/src/compiled/_chunks/workflow/logger-BCEj9caG.js +0 -14
  623. package/dist/src/compiled/_chunks/workflow/resume-hook-QS_cMwHn.js +0 -1
  624. package/dist/src/compiled/_chunks/workflow/run-CA5wWV2S.js +0 -1
  625. package/dist/src/compiled/_chunks/workflow/serialization-CJ265vSe.js +0 -3
  626. package/dist/src/compiled/_chunks/workflow/sleep-CBn94Ayv.js +0 -1
  627. package/dist/src/compiled/_chunks/workflow/wait-until-Bo2U6ON9.js +0 -1
  628. package/dist/src/compiler/compile-from-memory.d.ts +0 -44
  629. package/dist/src/compiler/compile-from-memory.js +0 -1
  630. package/dist/src/execution/connection-auth-tool-result.d.ts +0 -2
  631. package/dist/src/execution/connection-auth-tool-result.js +0 -1
  632. package/dist/src/internal/process/pnpm.d.ts +0 -28
  633. package/dist/src/internal/process/pnpm.js +0 -1
  634. package/dist/src/public/channels/slack/api-encoding.d.ts +0 -5
  635. package/dist/src/public/channels/slack/api-encoding.js +0 -1
  636. package/dist/src/public/definitions/instrumentation.d.ts +0 -1
  637. package/dist/src/public/definitions/instrumentation.js +0 -1
  638. package/dist/src/public/models/openai/chatgpt/unsigned-jwt.d.ts +0 -5
  639. package/dist/src/public/models/openai/chatgpt/unsigned-jwt.js +0 -1
  640. package/dist/src/sandbox/backends/probes.d.ts +0 -7
  641. package/dist/src/sandbox/backends/probes.js +0 -1
  642. package/dist/src/setup/channel-add-conflicts.d.ts +0 -28
  643. package/dist/src/setup/channel-add-conflicts.js +0 -1
  644. package/dist/src/setup/primitives/run-pnpm.d.ts +0 -1
  645. package/dist/src/setup/primitives/run-pnpm.js +0 -1
  646. package/dist/src/shared/boundary-hook-error.d.ts +0 -4
  647. package/dist/src/shared/boundary-hook-error.js +0 -1
  648. package/dist/src/shared/dispatch-action.d.ts +0 -30
  649. package/dist/src/shared/dispatch-action.js +0 -1
  650. /package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use-sandbox.d.ts +0 -0
  651. /package/dist/src/{extensions/code → computer-use}/extension/lib/computer-use.js +0 -0
  652. /package/dist/src/{extensions/code → computer-use}/extension/tools/computer_use.d.ts +0 -0
  653. /package/dist/src/{extensions/code → computer-use}/extension/tools/computer_use.js +0 -0
@@ -1 +1 @@
1
- import{join}from"node:path";import{normalizeLogicalPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{createConnectionSourceRef}from"#discover/manifest.js";import{DISCOVER_MODULE_SLOT_COLLISION,createConnectionNameDiagnostic,createModuleSlotCollisionDiagnostic,readSortedDirectoryEntries}from"#discover/grammar.js";import{collectNamedSlotCandidates}from"#discover/slots.js";const DISCOVER_CONNECTIONS_DIRECTORY_INVALID=`discover/connections-directory-invalid`,DISCOVER_CONNECTION_FILE_FOLDER_COLLISION=`discover/connection-file-folder-collision`,DISCOVER_CONNECTION_FOLDER_EMPTY=`discover/connection-folder-empty`;async function discoverConnectionSources(e){let t=`connections`,n=join(e.rootPath,t),r=e.rootEntries.find(e=>e.name===t);if(r===void 0)return{connections:[],diagnostics:[]};if(!r.isDirectory())return{connections:[],diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_CONNECTIONS_DIRECTORY_INVALID,message:`Expected "${n}" to be a directory of authored connections.`,sourcePath:n})]};let i=await readSortedDirectoryEntries(e.source,n),a=[],o=[],s=new Set;for(let e of collectNamedSlotCandidates(i,{allowMarkdown:!1,allowModules:!0})){let r=normalizeLogicalPath(join(t,e.slotName));if(e.moduleFileNames.length>1){s.add(e.slotName),o.push(createModuleSlotCollisionDiagnostic(n,r,e.moduleFileNames));continue}let[i]=e.moduleFileNames;if(i===void 0)continue;s.add(e.slotName);let c=createConnectionNameDiagnostic(e.slotName,join(n,i));if(c!==null){o.push(c);continue}a.push(createConnectionSourceRef({connectionName:e.slotName,logicalPath:join(t,i)}))}for(let r of i){if(!r.isDirectory())continue;let i=r.name,c=join(n,i);if(s.has(i)){o.push(createDiscoverErrorDiagnostic({code:DISCOVER_CONNECTION_FILE_FOLDER_COLLISION,message:`Connection "${i}" is defined twice. Found both file-form "connections/${i}.ts" and folder-form "connections/${i}/". Use one form, not both.`,sourcePath:c}));let e=a.findIndex(e=>e.connectionName===i);e!==-1&&a.splice(e,1);continue}let l=createConnectionNameDiagnostic(i,c);if(l!==null){o.push(l);continue}let u=collectFolderConnectionModuleCandidates(await readSortedDirectoryEntries(e.source,c));if(u.length>1){o.push(createDiscoverErrorDiagnostic({code:DISCOVER_MODULE_SLOT_COLLISION,message:`Found multiple connection definition modules inside "${normalizeLogicalPath(join(t,i))}": `+u.map(e=>`"${e}"`).join(`, `),sourcePath:c}));continue}let[d]=u;if(d===void 0){o.push(createDiscoverErrorDiagnostic({code:DISCOVER_CONNECTION_FOLDER_EMPTY,message:`Connection folder "connections/${i}/" contains no "connection.ts" definition. Add "connections/${i}/connection.ts" or use the file form "connections/${i}.ts".`,sourcePath:c}));continue}a.push(createConnectionSourceRef({connectionName:i,logicalPath:join(t,i,d)}))}return{connections:a,diagnostics:o}}function collectFolderConnectionModuleCandidates(e){let t=e.filter(e=>e.isFile()),n=[];for(let e of collectNamedSlotCandidates(t,{allowMarkdown:!1,allowModules:!0}))e.slotName===`connection`&&n.push(...e.moduleFileNames);return n}export{DISCOVER_CONNECTIONS_DIRECTORY_INVALID,DISCOVER_CONNECTION_FILE_FOLDER_COLLISION,DISCOVER_CONNECTION_FOLDER_EMPTY,discoverConnectionSources};
1
+ import{join}from"node:path";import{normalizeLogicalPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{DISCOVER_MODULE_SLOT_COLLISION,createConnectionNameDiagnostic,createModuleSlotCollisionDiagnostic,readSortedDirectoryEntries}from"#discover/grammar.js";import{createConnectionSourceRef}from"#discover/manifest.js";import{collectNamedSlotCandidates}from"#discover/slots.js";async function discoverConnectionSources(e){let t=`connections`,n=join(e.rootPath,t),r=e.rootEntries.find(e=>e.name===t);if(r===void 0)return{connections:[],diagnostics:[]};if(!r.isDirectory())return{connections:[],diagnostics:[createDiscoverErrorDiagnostic({code:`discover/connections-directory-invalid`,message:`Expected "${n}" to be a directory of authored connections.`,sourcePath:n})]};let i=await readSortedDirectoryEntries(e.source,n),a=[],o=[],s=new Set;for(let e of collectNamedSlotCandidates(i,{allowMarkdown:!1,allowModules:!0})){let r=normalizeLogicalPath(join(t,e.slotName));if(e.moduleFileNames.length>1){s.add(e.slotName),o.push(createModuleSlotCollisionDiagnostic(n,r,e.moduleFileNames));continue}let[i]=e.moduleFileNames;if(i===void 0)continue;s.add(e.slotName);let c=createConnectionNameDiagnostic(e.slotName,join(n,i));if(c!==null){o.push(c);continue}a.push(createConnectionSourceRef({connectionName:e.slotName,logicalPath:join(t,i)}))}for(let r of i){if(!r.isDirectory())continue;let i=r.name,c=join(n,i);if(s.has(i)){o.push(createDiscoverErrorDiagnostic({code:`discover/connection-file-folder-collision`,message:`Connection "${i}" is defined twice. Found both file-form "connections/${i}.ts" and folder-form "connections/${i}/". Use one form, not both.`,sourcePath:c}));let e=a.findIndex(e=>e.connectionName===i);e!==-1&&a.splice(e,1);continue}let l=createConnectionNameDiagnostic(i,c);if(l!==null){o.push(l);continue}let u=collectFolderConnectionModuleCandidates(await readSortedDirectoryEntries(e.source,c));if(u.length>1){o.push(createDiscoverErrorDiagnostic({code:DISCOVER_MODULE_SLOT_COLLISION,message:`Found multiple connection definition modules inside "${normalizeLogicalPath(join(t,i))}": `+u.map(e=>`"${e}"`).join(`, `),sourcePath:c}));continue}let[d]=u;if(d===void 0){o.push(createDiscoverErrorDiagnostic({code:`discover/connection-folder-empty`,message:`Connection folder "connections/${i}/" contains no "connection.ts" definition. Add "connections/${i}/connection.ts" or use the file form "connections/${i}.ts".`,sourcePath:c}));continue}a.push(createConnectionSourceRef({connectionName:i,logicalPath:join(t,i,d)}))}return{connections:a,diagnostics:o}}function collectFolderConnectionModuleCandidates(e){let t=e.filter(e=>e.isFile()),n=[];for(let e of collectNamedSlotCandidates(t,{allowMarkdown:!1,allowModules:!0}))e.slotName===`connection`&&n.push(...e.moduleFileNames);return n}export{discoverConnectionSources};
@@ -1,12 +1,4 @@
1
1
  import { z } from "#compiled/zod/index.js";
2
- /**
3
- * Structured discovery diagnostic severity.
4
- */
5
- export type DiscoverDiagnosticSeverity = z.infer<typeof discoverDiagnosticSeveritySchema>;
6
- /**
7
- * Zod schema for structured discovery diagnostic severities.
8
- */
9
- export declare const discoverDiagnosticSeveritySchema: z.ZodUnion<readonly [z.ZodLiteral<"error">, z.ZodLiteral<"warning">]>;
10
2
  /**
11
3
  * Structured discovery diagnostic emitted while classifying authored sources.
12
4
  */
@@ -1 +1 @@
1
- import{z}from"#compiled/zod/index.js";const discoverDiagnosticSeveritySchema=z.union([z.literal(`error`),z.literal(`warning`)]),discoverDiagnosticSchema=z.object({code:z.string(),message:z.string(),severity:discoverDiagnosticSeveritySchema,sourcePath:z.string()}).strict(),discoverDiagnosticsSummarySchema=z.object({errors:z.number().finite(),warnings:z.number().finite()}).strict(),DISCOVER_PROJECT_NOT_FOUND=`discover/project-not-found`;function createDiscoverErrorDiagnostic(e){return{...e,severity:`error`}}function createDiscoverWarningDiagnostic(e){return{...e,severity:`warning`}}function summarizeDiscoverDiagnostics(e){return e.reduce((e,t)=>(t.severity===`error`?e.errors+=1:e.warnings+=1,e),{errors:0,warnings:0})}export{DISCOVER_PROJECT_NOT_FOUND,createDiscoverErrorDiagnostic,createDiscoverWarningDiagnostic,discoverDiagnosticSchema,discoverDiagnosticSeveritySchema,discoverDiagnosticsSummarySchema,summarizeDiscoverDiagnostics};
1
+ import{z}from"#compiled/zod/index.js";const discoverDiagnosticSeveritySchema=z.union([z.literal(`error`),z.literal(`warning`)]),discoverDiagnosticSchema=z.object({code:z.string(),message:z.string(),severity:discoverDiagnosticSeveritySchema,sourcePath:z.string()}).strict(),discoverDiagnosticsSummarySchema=z.object({errors:z.number().finite(),warnings:z.number().finite()}).strict(),DISCOVER_PROJECT_NOT_FOUND=`discover/project-not-found`;function createDiscoverErrorDiagnostic(e){return{...e,severity:`error`}}function createDiscoverWarningDiagnostic(e){return{...e,severity:`warning`}}function summarizeDiscoverDiagnostics(e){return e.reduce((e,t)=>(t.severity===`error`?e.errors+=1:e.warnings+=1,e),{errors:0,warnings:0})}export{DISCOVER_PROJECT_NOT_FOUND,createDiscoverErrorDiagnostic,createDiscoverWarningDiagnostic,discoverDiagnosticSchema,discoverDiagnosticsSummarySchema,summarizeDiscoverDiagnostics};
@@ -1 +1 @@
1
- import{join,resolve}from"node:path";import{classifyAgentRootEntry,normalizeLogicalPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{DISCOVER_EXTENSION_AGENT_CONFIG_UNSUPPORTED,DISCOVER_EXTENSION_INSTRUMENTATION_UNSUPPORTED,DISCOVER_EXTENSION_MEMORY_UNSUPPORTED,DISCOVER_EXTENSION_MOUNT_AMBIGUOUS,DISCOVER_EXTENSION_MOUNT_MISSING_DECLARATION,DISCOVER_EXTENSION_NESTED_MOUNT_UNSUPPORTED,DISCOVER_EXTENSION_SANDBOX_UNSUPPORTED,locateExtensionMount,mountNamespace}from"#discover/extensions.js";import{createDiskProjectSource}from"#discover/project-source.js";import{createAgentSourceManifest,createModuleSourceRef}from"#discover/manifest.js";import{DISCOVER_CHANNELS_DIRECTORY_INVALID,DISCOVER_EXTENSIONS_DIRECTORY_INVALID,DISCOVER_HOOKS_DIRECTORY_INVALID,DISCOVER_TOOLS_DIRECTORY_INVALID,createChannelNameDiagnostic,createExtensionNameDiagnostic,createHookNameDiagnostic,createToolNameDiagnostic,createUnsupportedRootDirectoryDiagnostics,discoverFlatModuleSource,discoverInstructionsSource,discoverNamedSourceDirectory,readSortedDirectoryEntries}from"#discover/grammar.js";import{discoverConnectionSources}from"#discover/connections.js";import{discoverSubagents}from"#discover/discover-subagent.js";import{discoverLibSources}from"#discover/lib.js";import{discoverMemorySources}from"#discover/memory.js";import{discoverSandboxSource}from"#discover/sandbox.js";import{discoverScheduleSources}from"#discover/schedules.js";import{discoverSkills}from"#discover/skills.js";import{stripNpmPackageScope}from"#shared/package-name.js";async function discoverAgent(e){let t=e.source??createDiskProjectSource(),n=resolve(e.appRoot),r=resolve(e.agentRoot),i=e.role??`agent`,a=[],o=await tryReadPackageJsonName(t,n),s=await readSortedDirectoryEntries(t,r);a.push(...createUnsupportedRootDirectoryDiagnostics({classifyEntry:classifyAgentRootEntry,createUnsupportedDirectoryMessage(e){return`Ignoring unsupported directory "${e}/" in the agent root.`},rootEntries:s,rootPath:r}));let c=await discoverInstructionsSource({rootEntries:s,rootPath:r,source:t,required:i!==`extension`});a.push(...c.diagnostics);let l=discoverFlatModuleSource({rootEntries:s,rootPath:r,slotName:`agent`});a.push(...l.diagnostics);let u=await discoverNamedSourceDirectory({directoryName:`channels`,invalidDirectoryCode:DISCOVER_CHANNELS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(r,`channels`)}" to be a directory of authored channels.`,recursive:!0,rootEntries:s,rootPath:r,source:t,validateSegment:createChannelNameDiagnostic});a.push(...u.diagnostics);let d=await discoverLibSources({agentRoot:r,rootEntries:s,source:t});a.push(...d.diagnostics);let f=await discoverScheduleSources({agentRoot:r,rootEntries:s,source:t});a.push(...f.diagnostics);let p=await discoverConnectionSources({rootEntries:s,rootPath:r,source:t});a.push(...p.diagnostics);let m=await discoverMemorySources({rootEntries:s,rootPath:r,source:t});a.push(...m.diagnostics);let h=await discoverSandboxSource({rootEntries:s,rootPath:r,source:t});if(a.push(...h.diagnostics),i===`extension`){l.module!==void 0&&a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_AGENT_CONFIG_UNSUPPORTED,message:`An extension may not declare agent config (agent.ts) — model, limits, and sandbox are the consuming agent's to own.`,sourcePath:join(r,l.module.logicalPath)}));let e=s.find(e=>e.name===`instrumentation`&&e.isDirectory());e!==void 0&&a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_INSTRUMENTATION_UNSUPPORTED,message:`An extension may not declare instrumentation providers — process-wide observability belongs to the consuming agent.`,sourcePath:join(r,e.name)}));let[t]=m.memories;t!==void 0&&a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MEMORY_UNSUPPORTED,message:`An extension may not declare memory — scope and lifecycle state belong to the consuming application.`,sourcePath:join(r,t.logicalPath)})),h.sandbox!==null&&a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_SANDBOX_UNSUPPORTED,message:`An extension may not declare a sandbox — it is the consuming agent's to own.`,sourcePath:join(r,h.sandbox.logicalPath)}))}let g=await discoverNamedSourceDirectory({directoryName:`tools`,invalidDirectoryCode:DISCOVER_TOOLS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(r,`tools`)}" to be a directory of authored tools.`,recursive:!0,rootEntries:s,rootPath:r,source:t,validateSegment:createToolNameDiagnostic});a.push(...g.diagnostics);let _=await discoverNamedSourceDirectory({directoryName:`hooks`,invalidDirectoryCode:DISCOVER_HOOKS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(r,`hooks`)}" to be a directory of authored hooks.`,recursive:!0,rootEntries:s,rootPath:r,source:t,validateSegment:createHookNameDiagnostic});a.push(..._.diagnostics);let v=await discoverNamedSourceDirectory({directoryName:`extensions`,invalidDirectoryCode:DISCOVER_EXTENSIONS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(r,`extensions`)}" to be a directory of extension mounts.`,recursive:!1,rootEntries:s,rootPath:r,source:t,validateSegment:createExtensionNameDiagnostic});a.push(...v.diagnostics);let y=await discoverSkills({agentRoot:r,source:t});a.push(...y.diagnostics);let b=await discoverSubagents({agentRoot:r,appRoot:n,source:t});a.push(...b.diagnostics);let x=await collectExtensionMounts({agentRoot:r,fileMounts:v.sources,rootEntries:s,source:t});a.push(...x.diagnostics);let S=[];if(i!==`agent`)for(let e of x.mounts)a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_NESTED_MOUNT_UNSUPPORTED,message:`"${e.mountRef.logicalPath}" mounts an extension from inside an extension, which is not supported yet. Extensions cannot mount other extensions; remove the "extensions/" slot.`,sourcePath:join(r,e.mountRef.logicalPath)}));else{let e=await resolveExtensionMounts({agentRoot:r,appRoot:n,mounts:x.mounts,source:t});a.push(...e.diagnostics),S=e.mounts}let C={agentRoot:r,appRoot:n,channels:u.sources,connections:p.connections,packageName:o,diagnostics:a,extensions:i===`extension`?[]:x.mounts.map(e=>e.mountRef),resolvedExtensions:S,hooks:_.sources,memories:i===`extension`?[]:m.memories,lib:d.lib,instructions:c.instructions,sandbox:i===`extension`?null:h.sandbox,sandboxWorkspaces:i===`extension`||h.sandboxWorkspace===null?[]:[h.sandboxWorkspace],schedules:f.schedules,skills:y.skills,tools:g.sources,subagents:b.subagents};return i!==`extension`&&l.module!==void 0&&(C.configModule=l.module),{diagnostics:a,manifest:createAgentSourceManifest(C)}}async function resolveExtensionMounts(e){let t=[],n=[];for(let r of e.mounts){let i=await locateExtensionMount({source:e.source,agentRoot:e.agentRoot,appRoot:e.appRoot,mount:r.mountRef,namespace:r.namespace});if(t.push(...i.diagnostics),i.location===void 0)continue;let a=await discoverAgent({agentRoot:i.location.sourceRoot,appRoot:i.location.packageRoot,source:e.source,role:`extension`});t.push(...a.diagnostics);let o;if(r.overridesRoot!==void 0){let n=await discoverAgent({agentRoot:r.overridesRoot,appRoot:e.appRoot,source:e.source,role:`extension`});t.push(...n.diagnostics),o=n.manifest}n.push({namespace:i.location.namespace,specifier:i.location.specifier,packageName:i.location.packageName,packageRoot:i.location.packageRoot,sourceRoot:i.location.sourceRoot,manifest:a.manifest,externalDependencies:i.location.externalDependencies,overrides:o})}return{diagnostics:t,mounts:n}}async function discoverExtensionMountDeclarations(e){let t=e.source??createDiskProjectSource(),n=resolve(e.agentRoot),r=await readSortedDirectoryEntries(t,n),i=await discoverNamedSourceDirectory({directoryName:`extensions`,invalidDirectoryCode:DISCOVER_EXTENSIONS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(n,`extensions`)}" to be a directory of extension mounts.`,recursive:!1,rootEntries:r,rootPath:n,source:t,validateSegment:createExtensionNameDiagnostic}),a=await collectExtensionMounts({agentRoot:n,fileMounts:i.sources,rootEntries:r,source:t});return{diagnostics:[...i.diagnostics,...a.diagnostics],mounts:a.mounts}}async function collectExtensionMounts(e){let t=[],n=join(e.agentRoot,`extensions`),r=e.fileMounts.map(e=>({namespace:mountNamespace(e.logicalPath),mountRef:e})),i=new Set(r.map(e=>e.namespace)),a=e.rootEntries.find(e=>e.name===`extensions`),o=[],s=new Set;if(a?.isDirectory()===!0){let r=await readSortedDirectoryEntries(e.source,n);for(let a of r){if(!a.isDirectory())continue;let r=a.name,c=join(n,r),l=createExtensionNameDiagnostic(r,c);if(l!==null){t.push(l);continue}let u=discoverFlatModuleSource({rootEntries:await readSortedDirectoryEntries(e.source,c),rootPath:c,slotName:`extension`});if(t.push(...u.diagnostics),u.module===void 0){t.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_MISSING_DECLARATION,message:`Extension mount directory "extensions/${r}/" must declare its mount in "extension.ts" (or another supported module extension).`,sourcePath:c}));continue}i.has(r)&&s.add(r),o.push({namespace:r,mountRef:createModuleSourceRef({logicalPath:normalizeLogicalPath(join(`extensions`,r,u.module.logicalPath))}),overridesRoot:c})}}for(let e of s)t.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_AMBIGUOUS,message:`Extension namespace "${e}" is claimed by both a file mount ("extensions/${e}.ts") and a directory mount ("extensions/${e}/"). Keep only one.`,sourcePath:n}));return{diagnostics:t,mounts:[...r,...o].filter(e=>!s.has(e.namespace))}}async function tryReadPackageJsonName(e,t){try{let n=join(t,`package.json`),r=JSON.parse(await e.readTextFile(n)).name;return typeof r!=`string`||r.length===0?void 0:stripNpmPackageScope(r)}catch{return}}export{discoverAgent,discoverExtensionMountDeclarations,resolveExtensionMounts};
1
+ import{join,resolve}from"node:path";import{classifyAgentRootEntry,normalizeLogicalPath}from"#discover/filesystem.js";import{DISCOVER_EXTENSION_AGENT_CONFIG_UNSUPPORTED,DISCOVER_EXTENSION_INSTRUMENTATION_UNSUPPORTED,DISCOVER_EXTENSION_MEMORY_UNSUPPORTED,DISCOVER_EXTENSION_MOUNT_AMBIGUOUS,DISCOVER_EXTENSION_MOUNT_MISSING_DECLARATION,DISCOVER_EXTENSION_NESTED_MOUNT_UNSUPPORTED,DISCOVER_EXTENSION_SANDBOX_UNSUPPORTED,locateExtensionMount,mountNamespace}from"#discover/extensions.js";import{createDiskProjectSource}from"#discover/project-source.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{DISCOVER_CHANNELS_DIRECTORY_INVALID,DISCOVER_EXTENSIONS_DIRECTORY_INVALID,DISCOVER_HOOKS_DIRECTORY_INVALID,DISCOVER_TOOLS_DIRECTORY_INVALID,createChannelNameDiagnostic,createExtensionNameDiagnostic,createHookNameDiagnostic,createToolNameDiagnostic,createUnsupportedRootDirectoryDiagnostics,discoverFlatModuleSource,discoverInstructionsSource,discoverNamedSourceDirectory,readSortedDirectoryEntries}from"#discover/grammar.js";import{createAgentSourceManifest,createModuleSourceRef}from"#discover/manifest.js";import{discoverConnectionSources}from"#discover/connections.js";import{discoverSubagents}from"#discover/discover-subagent.js";import{discoverLibSources}from"#discover/lib.js";import{discoverMemorySources}from"#discover/memory.js";import{discoverSandboxSource}from"#discover/sandbox.js";import{discoverScheduleSources}from"#discover/schedules.js";import{discoverSkills}from"#discover/skills.js";import{stripNpmPackageScope}from"#shared/package-name.js";async function discoverAgent(e){let t=e.source??createDiskProjectSource(),n=resolve(e.appRoot),r=resolve(e.agentRoot),i=e.role??`agent`,a=[],o=await tryReadPackageJsonName(t,n),s=await readSortedDirectoryEntries(t,r);a.push(...createUnsupportedRootDirectoryDiagnostics({classifyEntry:classifyAgentRootEntry,createUnsupportedDirectoryMessage(e){return`Ignoring unsupported directory "${e}/" in the agent root.`},rootEntries:s,rootPath:r}));let c=await discoverInstructionsSource({rootEntries:s,rootPath:r,source:t,required:i!==`extension`});a.push(...c.diagnostics);let l=discoverFlatModuleSource({rootEntries:s,rootPath:r,slotName:`agent`});a.push(...l.diagnostics);let u=await discoverNamedSourceDirectory({directoryName:`channels`,invalidDirectoryCode:DISCOVER_CHANNELS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(r,`channels`)}" to be a directory of authored channels.`,recursive:!0,rootEntries:s,rootPath:r,source:t,validateSegment:createChannelNameDiagnostic});a.push(...u.diagnostics);let d=await discoverLibSources({agentRoot:r,rootEntries:s,source:t});a.push(...d.diagnostics);let f=await discoverScheduleSources({agentRoot:r,rootEntries:s,source:t});a.push(...f.diagnostics);let p=await discoverConnectionSources({rootEntries:s,rootPath:r,source:t});a.push(...p.diagnostics);let m=await discoverMemorySources({rootEntries:s,rootPath:r,source:t});a.push(...m.diagnostics);let h=await discoverSandboxSource({rootEntries:s,rootPath:r,source:t});if(a.push(...h.diagnostics),i===`extension`){l.module!==void 0&&a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_AGENT_CONFIG_UNSUPPORTED,message:`An extension may not declare agent config (agent.ts) — model, limits, and sandbox are the consuming agent's to own.`,sourcePath:join(r,l.module.logicalPath)}));let e=s.find(e=>e.name===`instrumentation`&&e.isDirectory());e!==void 0&&a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_INSTRUMENTATION_UNSUPPORTED,message:`An extension may not declare instrumentation providers — process-wide observability belongs to the consuming agent.`,sourcePath:join(r,e.name)}));let[t]=m.memories;t!==void 0&&a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MEMORY_UNSUPPORTED,message:`An extension may not declare memory — scope and lifecycle state belong to the consuming application.`,sourcePath:join(r,t.logicalPath)})),h.sandbox!==null&&a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_SANDBOX_UNSUPPORTED,message:`An extension may not declare a sandbox — it is the consuming agent's to own.`,sourcePath:join(r,h.sandbox.logicalPath)}))}let g=await discoverNamedSourceDirectory({directoryName:`tools`,invalidDirectoryCode:DISCOVER_TOOLS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(r,`tools`)}" to be a directory of authored tools.`,recursive:!0,rootEntries:s,rootPath:r,source:t,validateSegment:createToolNameDiagnostic});a.push(...g.diagnostics);let _=await discoverNamedSourceDirectory({directoryName:`hooks`,invalidDirectoryCode:DISCOVER_HOOKS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(r,`hooks`)}" to be a directory of authored hooks.`,recursive:!0,rootEntries:s,rootPath:r,source:t,validateSegment:createHookNameDiagnostic});a.push(..._.diagnostics);let v=await discoverNamedSourceDirectory({directoryName:`extensions`,invalidDirectoryCode:DISCOVER_EXTENSIONS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(r,`extensions`)}" to be a directory of extension mounts.`,recursive:!1,rootEntries:s,rootPath:r,source:t,validateSegment:createExtensionNameDiagnostic});a.push(...v.diagnostics);let y=await discoverSkills({agentRoot:r,source:t});a.push(...y.diagnostics);let b=await discoverSubagents({agentRoot:r,appRoot:n,source:t});a.push(...b.diagnostics);let x=await collectExtensionMounts({agentRoot:r,fileMounts:v.sources,rootEntries:s,source:t});a.push(...x.diagnostics);let S=[];if(i!==`agent`)for(let e of x.mounts)a.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_NESTED_MOUNT_UNSUPPORTED,message:`"${e.mountRef.logicalPath}" mounts an extension from inside an extension, which is not supported yet. Extensions cannot mount other extensions; remove the "extensions/" slot.`,sourcePath:join(r,e.mountRef.logicalPath)}));else{let e=await resolveExtensionMounts({agentRoot:r,appRoot:n,mounts:x.mounts,source:t});a.push(...e.diagnostics),S=e.mounts}let C={agentRoot:r,appRoot:n,channels:u.sources,connections:p.connections,packageName:o,diagnostics:a,extensions:i===`extension`?[]:x.mounts.map(e=>e.mountRef),resolvedExtensions:S,hooks:_.sources,memories:i===`extension`?[]:m.memories,lib:d.lib,instructions:c.instructions,sandbox:i===`extension`?null:h.sandbox,sandboxWorkspaces:i===`extension`||h.sandboxWorkspace===null?[]:[h.sandboxWorkspace],schedules:f.schedules,skills:y.skills,tools:g.sources,subagents:b.subagents};return i!==`extension`&&l.module!==void 0&&(C.configModule=l.module),{diagnostics:a,manifest:createAgentSourceManifest(C)}}async function resolveExtensionMounts(e){let t=[],n=[];for(let r of e.mounts){let i=await locateExtensionMount({source:e.source,agentRoot:e.agentRoot,appRoot:e.appRoot,mount:r.mountRef,namespace:r.namespace});if(t.push(...i.diagnostics),i.location===void 0)continue;let a=await discoverAgent({agentRoot:i.location.sourceRoot,appRoot:i.location.packageRoot,source:e.source,role:`extension`});t.push(...a.diagnostics);let o;if(r.overridesRoot!==void 0){let n=await discoverAgent({agentRoot:r.overridesRoot,appRoot:e.appRoot,source:e.source,role:`extension`});t.push(...n.diagnostics),o=n.manifest}n.push({namespace:i.location.namespace,specifier:i.location.specifier,packageName:i.location.packageName,packageRoot:i.location.packageRoot,sourceRoot:i.location.sourceRoot,manifest:a.manifest,externalDependencies:i.location.externalDependencies,overrides:o})}return{diagnostics:t,mounts:n}}async function discoverExtensionMountDeclarations(e){let t=e.source??createDiskProjectSource(),n=resolve(e.agentRoot),r=await readSortedDirectoryEntries(t,n),i=await discoverNamedSourceDirectory({directoryName:`extensions`,invalidDirectoryCode:DISCOVER_EXTENSIONS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(n,`extensions`)}" to be a directory of extension mounts.`,recursive:!1,rootEntries:r,rootPath:n,source:t,validateSegment:createExtensionNameDiagnostic}),a=await collectExtensionMounts({agentRoot:n,fileMounts:i.sources,rootEntries:r,source:t});return{diagnostics:[...i.diagnostics,...a.diagnostics],mounts:a.mounts}}async function collectExtensionMounts(e){let t=[],n=join(e.agentRoot,`extensions`),r=e.fileMounts.map(e=>({namespace:mountNamespace(e.logicalPath),mountRef:e})),i=new Set(r.map(e=>e.namespace)),a=e.rootEntries.find(e=>e.name===`extensions`),o=[],s=new Set;if(a?.isDirectory()===!0){let r=await readSortedDirectoryEntries(e.source,n);for(let a of r){if(!a.isDirectory())continue;let r=a.name,c=join(n,r),l=createExtensionNameDiagnostic(r,c);if(l!==null){t.push(l);continue}let u=discoverFlatModuleSource({rootEntries:await readSortedDirectoryEntries(e.source,c),rootPath:c,slotName:`extension`});if(t.push(...u.diagnostics),u.module===void 0){t.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_MISSING_DECLARATION,message:`Extension mount directory "extensions/${r}/" must declare its mount in "extension.ts" (or another supported module extension).`,sourcePath:c}));continue}i.has(r)&&s.add(r),o.push({namespace:r,mountRef:createModuleSourceRef({logicalPath:normalizeLogicalPath(join(`extensions`,r,u.module.logicalPath))}),overridesRoot:c})}}for(let e of s)t.push(createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_AMBIGUOUS,message:`Extension namespace "${e}" is claimed by both a file mount ("extensions/${e}.ts") and a directory mount ("extensions/${e}/"). Keep only one.`,sourcePath:n}));return{diagnostics:t,mounts:[...r,...o].filter(e=>!s.has(e.namespace))}}async function tryReadPackageJsonName(e,t){try{let n=join(t,`package.json`),r=JSON.parse(await e.readTextFile(n)).name;return typeof r!=`string`||r.length===0?void 0:stripNpmPackageScope(r)}catch{return}}export{discoverAgent,discoverExtensionMountDeclarations,resolveExtensionMounts};
@@ -6,7 +6,6 @@ import { type ProjectSource } from "#discover/project-source.js";
6
6
  */
7
7
  export declare const DISCOVER_LOCAL_SUBAGENT_SCHEDULES_INVALID = "discover/local-subagent-schedules-invalid";
8
8
  export declare const DISCOVER_REQUIRED_SUBAGENT_CONFIG_MODULE_MISSING = "discover/required-subagent-config-module-missing";
9
- export declare const DISCOVER_SUBAGENTS_DIRECTORY_INVALID = "discover/subagents-directory-invalid";
10
9
  /**
11
10
  * Input for discovering subagent entries beneath one authored source root.
12
11
  */
@@ -1 +1 @@
1
- import{join,relative,resolve}from"node:path";import{discoverExtensionMountDeclarations,resolveExtensionMounts}from"#discover/discover-agent.js";import{classifyLocalSubagentEntry,getDirectoryEntryType,getSupportedModuleBaseName,normalizeLogicalPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{createDiskProjectSource}from"#discover/project-source.js";import{createAgentSourceManifest,createLocalSubagentSourceRef,createModuleSourceRef}from"#discover/manifest.js";import{DISCOVER_HOOKS_DIRECTORY_INVALID,DISCOVER_TOOLS_DIRECTORY_INVALID,createHookNameDiagnostic,createToolNameDiagnostic,createUnsupportedRootDirectoryDiagnostics,discoverFlatModuleSource,discoverInstructionsSource,discoverNamedSourceDirectory,readSortedDirectoryEntries}from"#discover/grammar.js";import{discoverConnectionSources}from"#discover/connections.js";import{discoverLibSources}from"#discover/lib.js";import{discoverMemorySources}from"#discover/memory.js";import{discoverSandboxSource}from"#discover/sandbox.js";import{discoverSkills}from"#discover/skills.js";const DISCOVER_LOCAL_SUBAGENT_SCHEDULES_INVALID=`discover/local-subagent-schedules-invalid`,DISCOVER_REQUIRED_SUBAGENT_CONFIG_MODULE_MISSING=`discover/required-subagent-config-module-missing`,DISCOVER_SUBAGENTS_DIRECTORY_INVALID=`discover/subagents-directory-invalid`;async function discoverSubagents(e){let t=e.source??createDiskProjectSource(),n=resolve(e.agentRoot),r=resolve(e.subagentsDirectoryPath??join(n,`subagents`)),i=normalizeLogicalPath(e.subagentsLogicalPath??relative(n,r)),a=await t.stat(r);if(a===`missing`)return{diagnostics:[],subagents:[]};if(a!==`directory`)return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SUBAGENTS_DIRECTORY_INVALID,message:`Expected "${r}" to be a directory of authored subagents.`,sourcePath:r})],subagents:[]};let o=await readSortedDirectoryEntries(t,r),s=[],c=[];for(let a of o){if(a.isFile()){let t=getSupportedModuleBaseName(a.name);if(t===null)continue;c.push(discoverSingleFileSubagent({agentRoot:n,appRoot:e.appRoot,subagentId:t,subagentLogicalPath:join(i,a.name),subagentPath:join(r,a.name)}));continue}if(!a.isDirectory())continue;let o=await discoverLocalSubagentPackage({appRoot:e.appRoot,source:t,subagentId:a.name,subagentLogicalPath:join(i,a.name),subagentRoot:join(r,a.name)});s.push(...o.diagnostics),c.push(o.subagent)}return{diagnostics:s,subagents:c}}function discoverSingleFileSubagent(e){let t=createModuleSourceRef({logicalPath:e.subagentLogicalPath}),n=createAgentSourceManifest({agentId:e.subagentId,agentRoot:e.agentRoot,appRoot:e.appRoot,configModule:t});return createLocalSubagentSourceRef({entryPath:e.subagentPath,logicalPath:e.subagentLogicalPath,manifest:n,rootPath:e.agentRoot,subagentId:e.subagentId})}async function discoverLocalSubagentPackage(e){let t=[],n=await readSortedDirectoryEntries(e.source,e.subagentRoot);t.push(...createUnsupportedRootDirectoryDiagnostics({classifyEntry:classifyLocalSubagentEntry,createUnsupportedDirectoryMessage(e){return`Ignoring unsupported directory "${e}/" in the local subagent root.`},rootEntries:n,rootPath:e.subagentRoot}));let r=await discoverInstructionsSource({required:!1,rootEntries:n,rootPath:e.subagentRoot,source:e.source});t.push(...r.diagnostics);let i=discoverFlatModuleSource({missingDiagnostic:{code:DISCOVER_REQUIRED_SUBAGENT_CONFIG_MODULE_MISSING,message:`Expected one authored subagent config module at "agent.ts", "agent.cts", "agent.mts", "agent.js", "agent.cjs", or "agent.mjs".`},rootEntries:n,rootPath:e.subagentRoot,slotName:`agent`});t.push(...i.diagnostics);let a=await discoverConnectionSources({rootEntries:n,rootPath:e.subagentRoot,source:e.source});t.push(...a.diagnostics);let o=await discoverMemorySources({rootEntries:n,rootPath:e.subagentRoot,source:e.source});t.push(...o.diagnostics);let s=await discoverSandboxSource({rootEntries:n,rootPath:e.subagentRoot,source:e.source});t.push(...s.diagnostics);let c=await discoverNamedSourceDirectory({directoryName:`tools`,invalidDirectoryCode:DISCOVER_TOOLS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(e.subagentRoot,`tools`)}" to be a directory of authored tools.`,recursive:!0,rootEntries:n,rootPath:e.subagentRoot,source:e.source,validateSegment:createToolNameDiagnostic});t.push(...c.diagnostics);let l=await discoverNamedSourceDirectory({directoryName:`hooks`,invalidDirectoryCode:DISCOVER_HOOKS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(e.subagentRoot,`hooks`)}" to be a directory of authored hooks.`,recursive:!0,rootEntries:n,rootPath:e.subagentRoot,source:e.source,validateSegment:createHookNameDiagnostic});t.push(...l.diagnostics);let u=await discoverLibSources({agentRoot:e.subagentRoot,rootEntries:n,source:e.source});t.push(...u.diagnostics),t.push(...createLocalSubagentScheduleDiagnostics(e.subagentRoot,n));let d=await discoverSkills({agentRoot:e.subagentRoot,source:e.source});t.push(...d.diagnostics);let f=await discoverSubagents({agentRoot:e.subagentRoot,appRoot:e.appRoot,source:e.source});t.push(...f.diagnostics);let p=await discoverExtensionMountDeclarations({agentRoot:e.subagentRoot,source:e.source});t.push(...p.diagnostics);let m=await resolveExtensionMounts({agentRoot:e.subagentRoot,appRoot:e.appRoot,mounts:p.mounts,source:e.source});t.push(...m.diagnostics);let h={agentRoot:e.subagentRoot,appRoot:e.appRoot,connections:a.connections,diagnostics:t,extensions:p.mounts.map(e=>e.mountRef),resolvedExtensions:m.mounts,hooks:l.sources,memories:o.memories,lib:u.lib,instructions:r.instructions,sandbox:s.sandbox,sandboxWorkspaces:s.sandboxWorkspace===null?[]:[s.sandboxWorkspace],skills:d.skills,tools:c.sources,subagents:f.subagents};i.module!==void 0&&(h.configModule=i.module);let g=createAgentSourceManifest(h);return{diagnostics:t,subagent:createLocalSubagentSourceRef({entryPath:e.subagentRoot,logicalPath:e.subagentLogicalPath,manifest:g,rootPath:e.subagentRoot,subagentId:e.subagentId})}}function createLocalSubagentScheduleDiagnostics(e,t){return t.flatMap(t=>classifyLocalSubagentEntry(t.name,getDirectoryEntryType(t))===`invalid-schedules-directory`?[createDiscoverErrorDiagnostic({code:DISCOVER_LOCAL_SUBAGENT_SCHEDULES_INVALID,message:`Local subagent packages cannot define schedules at "${join(e,t.name)}".`,sourcePath:join(e,t.name)})]:[])}export{DISCOVER_LOCAL_SUBAGENT_SCHEDULES_INVALID,DISCOVER_REQUIRED_SUBAGENT_CONFIG_MODULE_MISSING,DISCOVER_SUBAGENTS_DIRECTORY_INVALID,discoverSubagents};
1
+ import{join,relative,resolve}from"node:path";import{classifyLocalSubagentEntry,getDirectoryEntryType,getSupportedModuleBaseName,normalizeLogicalPath}from"#discover/filesystem.js";import{discoverExtensionMountDeclarations,resolveExtensionMounts}from"#discover/discover-agent.js";import{createDiskProjectSource}from"#discover/project-source.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{DISCOVER_HOOKS_DIRECTORY_INVALID,DISCOVER_TOOLS_DIRECTORY_INVALID,createHookNameDiagnostic,createToolNameDiagnostic,createUnsupportedRootDirectoryDiagnostics,discoverFlatModuleSource,discoverInstructionsSource,discoverNamedSourceDirectory,readSortedDirectoryEntries}from"#discover/grammar.js";import{createAgentSourceManifest,createLocalSubagentSourceRef,createModuleSourceRef}from"#discover/manifest.js";import{discoverConnectionSources}from"#discover/connections.js";import{discoverLibSources}from"#discover/lib.js";import{discoverMemorySources}from"#discover/memory.js";import{discoverSandboxSource}from"#discover/sandbox.js";import{discoverSkills}from"#discover/skills.js";const DISCOVER_LOCAL_SUBAGENT_SCHEDULES_INVALID=`discover/local-subagent-schedules-invalid`,DISCOVER_REQUIRED_SUBAGENT_CONFIG_MODULE_MISSING=`discover/required-subagent-config-module-missing`;async function discoverSubagents(e){let t=e.source??createDiskProjectSource(),n=resolve(e.agentRoot),r=resolve(e.subagentsDirectoryPath??join(n,`subagents`)),i=normalizeLogicalPath(e.subagentsLogicalPath??relative(n,r)),a=await t.stat(r);if(a===`missing`)return{diagnostics:[],subagents:[]};if(a!==`directory`)return{diagnostics:[createDiscoverErrorDiagnostic({code:`discover/subagents-directory-invalid`,message:`Expected "${r}" to be a directory of authored subagents.`,sourcePath:r})],subagents:[]};let o=await readSortedDirectoryEntries(t,r),s=[],c=[];for(let a of o){if(a.isFile()){let t=getSupportedModuleBaseName(a.name);if(t===null)continue;c.push(discoverSingleFileSubagent({agentRoot:n,appRoot:e.appRoot,subagentId:t,subagentLogicalPath:join(i,a.name),subagentPath:join(r,a.name)}));continue}if(!a.isDirectory())continue;let o=await discoverLocalSubagentPackage({appRoot:e.appRoot,source:t,subagentId:a.name,subagentLogicalPath:join(i,a.name),subagentRoot:join(r,a.name)});s.push(...o.diagnostics),c.push(o.subagent)}return{diagnostics:s,subagents:c}}function discoverSingleFileSubagent(e){let t=createModuleSourceRef({logicalPath:e.subagentLogicalPath}),n=createAgentSourceManifest({agentId:e.subagentId,agentRoot:e.agentRoot,appRoot:e.appRoot,configModule:t});return createLocalSubagentSourceRef({entryPath:e.subagentPath,logicalPath:e.subagentLogicalPath,manifest:n,rootPath:e.agentRoot,subagentId:e.subagentId})}async function discoverLocalSubagentPackage(e){let t=[],n=await readSortedDirectoryEntries(e.source,e.subagentRoot);t.push(...createUnsupportedRootDirectoryDiagnostics({classifyEntry:classifyLocalSubagentEntry,createUnsupportedDirectoryMessage(e){return`Ignoring unsupported directory "${e}/" in the local subagent root.`},rootEntries:n,rootPath:e.subagentRoot}));let r=await discoverInstructionsSource({required:!1,rootEntries:n,rootPath:e.subagentRoot,source:e.source});t.push(...r.diagnostics);let i=discoverFlatModuleSource({missingDiagnostic:{code:DISCOVER_REQUIRED_SUBAGENT_CONFIG_MODULE_MISSING,message:`Expected one authored subagent config module at "agent.ts", "agent.cts", "agent.mts", "agent.js", "agent.cjs", or "agent.mjs".`},rootEntries:n,rootPath:e.subagentRoot,slotName:`agent`});t.push(...i.diagnostics);let a=await discoverConnectionSources({rootEntries:n,rootPath:e.subagentRoot,source:e.source});t.push(...a.diagnostics);let o=await discoverMemorySources({rootEntries:n,rootPath:e.subagentRoot,source:e.source});t.push(...o.diagnostics);let s=await discoverSandboxSource({rootEntries:n,rootPath:e.subagentRoot,source:e.source});t.push(...s.diagnostics);let c=await discoverNamedSourceDirectory({directoryName:`tools`,invalidDirectoryCode:DISCOVER_TOOLS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(e.subagentRoot,`tools`)}" to be a directory of authored tools.`,recursive:!0,rootEntries:n,rootPath:e.subagentRoot,source:e.source,validateSegment:createToolNameDiagnostic});t.push(...c.diagnostics);let l=await discoverNamedSourceDirectory({directoryName:`hooks`,invalidDirectoryCode:DISCOVER_HOOKS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(e.subagentRoot,`hooks`)}" to be a directory of authored hooks.`,recursive:!0,rootEntries:n,rootPath:e.subagentRoot,source:e.source,validateSegment:createHookNameDiagnostic});t.push(...l.diagnostics);let u=await discoverLibSources({agentRoot:e.subagentRoot,rootEntries:n,source:e.source});t.push(...u.diagnostics),t.push(...createLocalSubagentScheduleDiagnostics(e.subagentRoot,n));let d=await discoverSkills({agentRoot:e.subagentRoot,source:e.source});t.push(...d.diagnostics);let f=await discoverSubagents({agentRoot:e.subagentRoot,appRoot:e.appRoot,source:e.source});t.push(...f.diagnostics);let p=await discoverExtensionMountDeclarations({agentRoot:e.subagentRoot,source:e.source});t.push(...p.diagnostics);let m=await resolveExtensionMounts({agentRoot:e.subagentRoot,appRoot:e.appRoot,mounts:p.mounts,source:e.source});t.push(...m.diagnostics);let h={agentRoot:e.subagentRoot,appRoot:e.appRoot,connections:a.connections,diagnostics:t,extensions:p.mounts.map(e=>e.mountRef),resolvedExtensions:m.mounts,hooks:l.sources,memories:o.memories,lib:u.lib,instructions:r.instructions,sandbox:s.sandbox,sandboxWorkspaces:s.sandboxWorkspace===null?[]:[s.sandboxWorkspace],skills:d.skills,tools:c.sources,subagents:f.subagents};i.module!==void 0&&(h.configModule=i.module);let g=createAgentSourceManifest(h);return{diagnostics:t,subagent:createLocalSubagentSourceRef({entryPath:e.subagentRoot,logicalPath:e.subagentLogicalPath,manifest:g,rootPath:e.subagentRoot,subagentId:e.subagentId})}}function createLocalSubagentScheduleDiagnostics(e,t){return t.flatMap(t=>classifyLocalSubagentEntry(t.name,getDirectoryEntryType(t))===`invalid-schedules-directory`?[createDiscoverErrorDiagnostic({code:DISCOVER_LOCAL_SUBAGENT_SCHEDULES_INVALID,message:`Local subagent packages cannot define schedules at "${join(e,t.name)}".`,sourcePath:join(e,t.name)})]:[])}export{DISCOVER_LOCAL_SUBAGENT_SCHEDULES_INVALID,DISCOVER_REQUIRED_SUBAGENT_CONFIG_MODULE_MISSING,discoverSubagents};
@@ -1,10 +1,6 @@
1
1
  import { type DiscoverDiagnostic } from "#discover/diagnostics.js";
2
2
  import type { ExtensionSourceRef } from "#discover/manifest.js";
3
3
  import type { ProjectSource } from "#discover/project-source.js";
4
- /**
5
- * Emitted when a mount file cannot be resolved to an extension package.
6
- */
7
- export declare const DISCOVER_EXTENSION_MOUNT_UNRESOLVED = "discover/extension-mount-unresolved";
8
4
  /**
9
5
  * Emitted when one namespace is claimed by both a file mount
10
6
  * (`extensions/<ns>.ts`) and a directory mount (`extensions/<ns>/`).
@@ -21,10 +17,6 @@ export declare const DISCOVER_EXTENSION_MOUNT_MISSING_DECLARATION = "discover/ex
21
17
  * later is additive rather than a surprise.
22
18
  */
23
19
  export declare const DISCOVER_EXTENSION_NESTED_MOUNT_UNSUPPORTED = "discover/extension-nested-mount-unsupported";
24
- /**
25
- * Emitted when a resolved package is not a valid eve extension.
26
- */
27
- export declare const DISCOVER_EXTENSION_PACKAGE_INVALID = "discover/extension-package-invalid";
28
20
  /**
29
21
  * Emitted when an extension distribution's compatibility manifest is missing
30
22
  * or malformed.
@@ -54,7 +46,7 @@ export declare const DISCOVER_EXTENSION_INSTRUMENTATION_UNSUPPORTED = "discover/
54
46
  /**
55
47
  * Resolved on-disk location of one mounted extension package.
56
48
  */
57
- export interface ExtensionMountLocation {
49
+ interface ExtensionMountLocation {
58
50
  /** Mount namespace derived from the mount filename (e.g. `crm`). */
59
51
  readonly namespace: string;
60
52
  /** Package specifier the mount imports (e.g. `@acme/crm`). */
@@ -73,7 +65,7 @@ export interface ExtensionMountLocation {
73
65
  * inspected. Development uses this to build a mounted workspace extension
74
66
  * before the consumer requires its dist tree to exist.
75
67
  */
76
- export interface ExtensionMountPackageLocation {
68
+ interface ExtensionMountPackageLocation {
77
69
  /** Mount namespace derived from the mount filename. */
78
70
  readonly namespace: string;
79
71
  /** Package specifier read from the mount declaration. */
@@ -140,3 +132,4 @@ export declare function locateExtensionMountPackage(input: {
140
132
  location?: ExtensionMountPackageLocation;
141
133
  diagnostics: DiscoverDiagnostic[];
142
134
  }>;
135
+ export {};
@@ -1 +1 @@
1
- import{dirname,isAbsolute,join,resolve}from"node:path";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,findUnsupportedExtensionCapabilities,parseExtensionCompatibilityManifest}from"#compiler/extension-compatibility.js";import{parseExtensionMountSpecifier}from"#discover/extension-specifier.js";import{parseBuiltInExtensionPackageRoots,parseExtensionPackageRoots}from"#shared/extension-package-contract.js";const DISCOVER_EXTENSION_MOUNT_UNRESOLVED=`discover/extension-mount-unresolved`,DISCOVER_EXTENSION_MOUNT_AMBIGUOUS=`discover/extension-mount-ambiguous`,DISCOVER_EXTENSION_MOUNT_MISSING_DECLARATION=`discover/extension-mount-missing-declaration`,DISCOVER_EXTENSION_NESTED_MOUNT_UNSUPPORTED=`discover/extension-nested-mount-unsupported`,DISCOVER_EXTENSION_PACKAGE_INVALID=`discover/extension-package-invalid`,DISCOVER_EXTENSION_COMPATIBILITY_INVALID=`discover/extension-compatibility-invalid`,DISCOVER_EXTENSION_CAPABILITY_INCOMPATIBLE=`discover/extension-capability-incompatible`,DISCOVER_EXTENSION_AGENT_CONFIG_UNSUPPORTED=`discover/extension-agent-config-unsupported`,DISCOVER_EXTENSION_SANDBOX_UNSUPPORTED=`discover/extension-sandbox-unsupported`,DISCOVER_EXTENSION_MEMORY_UNSUPPORTED=`discover/extension-memory-unsupported`,DISCOVER_EXTENSION_INSTRUMENTATION_UNSUPPORTED=`discover/extension-instrumentation-unsupported`;function mountNamespace(e){let t=e.slice(e.lastIndexOf(`/`)+1);for(let e of SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS)if(t.toLowerCase().endsWith(e))return t.slice(0,t.length-e.length);return t}function mountRefNamespace(e){let t=e.replace(/^extensions\//,``),n=t.indexOf(`/`);return n===-1?mountNamespace(e):t.slice(0,n)}function packageStateNamespace(e){return e.replace(/^@/,``).replace(/[^a-zA-Z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``)||`extension`}async function locateExtensionMount(e){let t=await locateExtensionMountPackage(e);if(t.location===void 0)return{diagnostics:t.diagnostics};let{location:n}=t;if(n.builtIn)return{location:{namespace:n.namespace,specifier:n.specifier,packageName:n.packageName,packageRoot:n.packageRoot,sourceRoot:n.distRoot,externalDependencies:[]},diagnostics:[]};let r=join(n.distRoot,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),i;try{i=parseExtensionCompatibilityManifest(await e.source.readTextFile(r),r)}catch(e){return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_COMPATIBILITY_INVALID,message:`Extension "${n.packageName}" has no valid compatibility manifest at "${r}". Rebuild or reinstall the extension. ${e instanceof Error?e.message:String(e)}`,sourcePath:r})]}}let a=findUnsupportedExtensionCapabilities(i);return a.length>0?{diagnostics:a.map(e=>createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_CAPABILITY_INCOMPATIBLE,message:`Extension "${n.packageName}" requires ${e.capability} contract v${e.requiredVersion}, but this eve supports ${e.capability} contract ${formatSupportedVersions(e.supportedVersions)}. Upgrade eve or install an extension release that requires a supported ${e.capability} contract.`,sourcePath:r}))}:{location:{namespace:n.namespace,specifier:n.specifier,packageName:n.packageName,packageRoot:n.packageRoot,sourceRoot:n.distRoot,externalDependencies:i.build?.externalDependencies??[]},diagnostics:[]}}async function locateExtensionMountPackage(e){let t=join(e.agentRoot,e.mount.logicalPath),{namespace:n}=e,r;try{r=await e.source.readTextFile(t)}catch{return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_UNRESOLVED,message:`Could not read extension mount "${e.mount.logicalPath}".`,sourcePath:t})]}}let i=parseExtensionMountSpecifier(r);if(i===null)return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_UNRESOLVED,message:`Extension mount "${e.mount.logicalPath}" must default-export a mounted extension, e.g. \`export default crm({ ... })\` or \`export { default } from "@acme/crm"\`.`,sourcePath:t})]};let a=await resolvePackageRoot({source:e.source,appRoot:e.appRoot,mountDirectory:dirname(t),specifier:i});if(a===null)return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_UNRESOLVED,message:`Could not resolve extension package "${i}" mounted by "${e.mount.logicalPath}".`,sourcePath:t})]};let o=join(a,`package.json`),s;try{s=JSON.parse(await e.source.readTextFile(o))}catch{return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_PACKAGE_INVALID,message:`Extension package "${i}" has no readable package.json at "${o}".`,sourcePath:o})]}}let c=parseBuiltInExtensionPackageRoots(s.eve?.builtInExtensions,packageSpecifierSubpath(i)),l=c??parseExtensionPackageRoots(s.eve?.extension);return l===null?{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_PACKAGE_INVALID,message:`Package "${i}" is not an eve extension: its package.json must declare \`eve.extension.dist\`.`,sourcePath:o})]}:{location:{namespace:n,specifier:i,packageName:typeof s.name==`string`&&s.name.length>0?s.name:i,packageRoot:a,...l.source===void 0?{}:{authoredSourceRoot:resolve(a,l.source)},builtIn:c!==null,distRoot:resolve(a,l.dist)},diagnostics:[]}}function formatSupportedVersions(e){return e.length===0?`versions: none`:`versions: ${e.map(e=>`v${e}`).join(`, `)}`}async function resolvePackageRoot(e){if(e.specifier.startsWith(`.`)){let t=resolve(e.mountDirectory,e.specifier);return await hasPackageJson(e.source,t)?t:null}if(isAbsolute(e.specifier))return await hasPackageJson(e.source,e.specifier)?e.specifier:null;let t=bareSpecifierPackagePath(e.specifier),n=resolve(e.appRoot);for(;;){let r=join(n,`node_modules`,t);if(await hasPackageJson(e.source,r))return r;let i=dirname(n);if(i===n)return null;n=i}}function packageSpecifierSubpath(e){let t=e.slice(bareSpecifierPackagePath(e).length);return t.length===0?`.`:`.${t}`}function bareSpecifierPackagePath(e){let t=e.split(`/`);return e.startsWith(`@`)?t.slice(0,2).join(`/`):t[0]??e}async function hasPackageJson(e,t){return await e.stat(join(t,`package.json`))===`file`}export{DISCOVER_EXTENSION_AGENT_CONFIG_UNSUPPORTED,DISCOVER_EXTENSION_CAPABILITY_INCOMPATIBLE,DISCOVER_EXTENSION_COMPATIBILITY_INVALID,DISCOVER_EXTENSION_INSTRUMENTATION_UNSUPPORTED,DISCOVER_EXTENSION_MEMORY_UNSUPPORTED,DISCOVER_EXTENSION_MOUNT_AMBIGUOUS,DISCOVER_EXTENSION_MOUNT_MISSING_DECLARATION,DISCOVER_EXTENSION_MOUNT_UNRESOLVED,DISCOVER_EXTENSION_NESTED_MOUNT_UNSUPPORTED,DISCOVER_EXTENSION_PACKAGE_INVALID,DISCOVER_EXTENSION_SANDBOX_UNSUPPORTED,locateExtensionMount,locateExtensionMountPackage,mountNamespace,mountRefNamespace,packageStateNamespace};
1
+ import{dirname,isAbsolute,join,resolve}from"node:path";import{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{EXTENSION_COMPATIBILITY_MANIFEST_FILENAME,findUnsupportedExtensionCapabilities,parseExtensionCompatibilityManifest}from"#compiler/extension-compatibility.js";import{parseExtensionMountSpecifier}from"#discover/extension-specifier.js";import{parseBuiltInExtensionPackageRoots,parseExtensionPackageRoots}from"#shared/extension-package-contract.js";const DISCOVER_EXTENSION_MOUNT_UNRESOLVED=`discover/extension-mount-unresolved`,DISCOVER_EXTENSION_MOUNT_AMBIGUOUS=`discover/extension-mount-ambiguous`,DISCOVER_EXTENSION_MOUNT_MISSING_DECLARATION=`discover/extension-mount-missing-declaration`,DISCOVER_EXTENSION_NESTED_MOUNT_UNSUPPORTED=`discover/extension-nested-mount-unsupported`,DISCOVER_EXTENSION_PACKAGE_INVALID=`discover/extension-package-invalid`,DISCOVER_EXTENSION_COMPATIBILITY_INVALID=`discover/extension-compatibility-invalid`,DISCOVER_EXTENSION_CAPABILITY_INCOMPATIBLE=`discover/extension-capability-incompatible`,DISCOVER_EXTENSION_AGENT_CONFIG_UNSUPPORTED=`discover/extension-agent-config-unsupported`,DISCOVER_EXTENSION_SANDBOX_UNSUPPORTED=`discover/extension-sandbox-unsupported`,DISCOVER_EXTENSION_MEMORY_UNSUPPORTED=`discover/extension-memory-unsupported`,DISCOVER_EXTENSION_INSTRUMENTATION_UNSUPPORTED=`discover/extension-instrumentation-unsupported`;function mountNamespace(e){let t=e.slice(e.lastIndexOf(`/`)+1);for(let e of SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS)if(t.toLowerCase().endsWith(e))return t.slice(0,t.length-e.length);return t}function mountRefNamespace(e){let t=e.replace(/^extensions\//,``),n=t.indexOf(`/`);return n===-1?mountNamespace(e):t.slice(0,n)}function packageStateNamespace(e){return e.replace(/^@/,``).replace(/[^a-zA-Z0-9._-]+/g,`-`).replace(/^-+|-+$/g,``)||`extension`}async function locateExtensionMount(e){let t=await locateExtensionMountPackage(e);if(t.location===void 0)return{diagnostics:t.diagnostics};let{location:n}=t;if(n.builtIn)return{location:{namespace:n.namespace,specifier:n.specifier,packageName:n.packageName,packageRoot:n.packageRoot,sourceRoot:n.distRoot,externalDependencies:[]},diagnostics:[]};let r=join(n.distRoot,EXTENSION_COMPATIBILITY_MANIFEST_FILENAME),i;try{i=parseExtensionCompatibilityManifest(await e.source.readTextFile(r),r)}catch(e){return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_COMPATIBILITY_INVALID,message:`Extension "${n.packageName}" has no valid compatibility manifest at "${r}". Rebuild or reinstall the extension. ${e instanceof Error?e.message:String(e)}`,sourcePath:r})]}}let a=findUnsupportedExtensionCapabilities(i);return a.length>0?{diagnostics:a.map(e=>createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_CAPABILITY_INCOMPATIBLE,message:`Extension "${n.packageName}" requires ${e.capability} contract v${e.requiredVersion}, but this eve supports ${e.capability} contract ${formatSupportedVersions(e.supportedVersions)}. Upgrade eve or install an extension release that requires a supported ${e.capability} contract.`,sourcePath:r}))}:{location:{namespace:n.namespace,specifier:n.specifier,packageName:n.packageName,packageRoot:n.packageRoot,sourceRoot:n.distRoot,externalDependencies:i.build?.externalDependencies??[]},diagnostics:[]}}async function locateExtensionMountPackage(e){let t=join(e.agentRoot,e.mount.logicalPath),{namespace:n}=e,r;try{r=await e.source.readTextFile(t)}catch{return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_UNRESOLVED,message:`Could not read extension mount "${e.mount.logicalPath}".`,sourcePath:t})]}}let i=parseExtensionMountSpecifier(r);if(i===null)return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_UNRESOLVED,message:`Extension mount "${e.mount.logicalPath}" must default-export a mounted extension, e.g. \`export default crm({ ... })\` or \`export { default } from "@acme/crm"\`.`,sourcePath:t})]};let a=await resolvePackageRoot({source:e.source,appRoot:e.appRoot,mountDirectory:dirname(t),specifier:i});if(a===null)return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_MOUNT_UNRESOLVED,message:`Could not resolve extension package "${i}" mounted by "${e.mount.logicalPath}".`,sourcePath:t})]};let o=join(a,`package.json`),s;try{s=JSON.parse(await e.source.readTextFile(o))}catch{return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_PACKAGE_INVALID,message:`Extension package "${i}" has no readable package.json at "${o}".`,sourcePath:o})]}}let c=parseBuiltInExtensionPackageRoots(s.eve?.builtInExtensions,packageSpecifierSubpath(i)),l=c??parseExtensionPackageRoots(s.eve?.extension);return l===null?{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_PACKAGE_INVALID,message:`Package "${i}" is not an eve extension: its package.json must declare \`eve.extension.dist\`.`,sourcePath:o})]}:{location:{namespace:n,specifier:i,packageName:typeof s.name==`string`&&s.name.length>0?s.name:i,packageRoot:a,...l.source===void 0?{}:{authoredSourceRoot:resolve(a,l.source)},builtIn:c!==null,distRoot:resolve(a,l.dist)},diagnostics:[]}}function formatSupportedVersions(e){return e.length===0?`versions: none`:`versions: ${e.map(e=>`v${e}`).join(`, `)}`}async function resolvePackageRoot(e){if(e.specifier.startsWith(`.`)){let t=resolve(e.mountDirectory,e.specifier);return await hasPackageJson(e.source,t)?t:null}if(isAbsolute(e.specifier))return await hasPackageJson(e.source,e.specifier)?e.specifier:null;let t=bareSpecifierPackagePath(e.specifier),n=resolve(e.appRoot);for(;;){let r=join(n,`node_modules`,t);if(await hasPackageJson(e.source,r))return r;let i=dirname(n);if(i===n)return null;n=i}}function packageSpecifierSubpath(e){let t=e.slice(bareSpecifierPackagePath(e).length);return t.length===0?`.`:`.${t}`}function bareSpecifierPackagePath(e){let t=e.split(`/`);return e.startsWith(`@`)?t.slice(0,2).join(`/`):t[0]??e}async function hasPackageJson(e,t){return await e.stat(join(t,`package.json`))===`file`}export{DISCOVER_EXTENSION_AGENT_CONFIG_UNSUPPORTED,DISCOVER_EXTENSION_CAPABILITY_INCOMPATIBLE,DISCOVER_EXTENSION_COMPATIBILITY_INVALID,DISCOVER_EXTENSION_INSTRUMENTATION_UNSUPPORTED,DISCOVER_EXTENSION_MEMORY_UNSUPPORTED,DISCOVER_EXTENSION_MOUNT_AMBIGUOUS,DISCOVER_EXTENSION_MOUNT_MISSING_DECLARATION,DISCOVER_EXTENSION_NESTED_MOUNT_UNSUPPORTED,DISCOVER_EXTENSION_SANDBOX_UNSUPPORTED,locateExtensionMount,locateExtensionMountPackage,mountNamespace,mountRefNamespace,packageStateNamespace};
@@ -3,11 +3,6 @@ import type { Dirent } from "node:fs";
3
3
  * Supported authored JavaScript and TypeScript module file extensions.
4
4
  */
5
5
  export declare const SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS: readonly [".cts", ".mts", ".cjs", ".mjs", ".ts", ".js"];
6
- /**
7
- * Files that mark a surrounding directory as an application root when paired
8
- * with a top-level `agent/` directory.
9
- */
10
- export declare const PROJECT_MARKER_FILE_NAMES: readonly ["package.json", "vercel.json"];
11
6
  /**
12
7
  * Filesystem entry type used by discovery classifiers.
13
8
  */
@@ -15,19 +10,19 @@ export type DirectoryEntryType = "directory" | "file" | "other";
15
10
  /**
16
11
  * Classified root-level agent entry.
17
12
  */
18
- export type AgentRootEntryKind = "agent-config-module" | "channels-directory" | "connections-directory" | "extensions-directory" | "hooks-directory" | "ignored-directory" | "instrumentation-directory" | "instructions-directory" | "instructions-markdown" | "instructions-module" | "lib-directory" | "memory-directory" | "memory-module" | "sandbox-directory" | "schedules-directory" | "skills-directory" | "system-markdown" | "system-module" | "tools-directory" | "unknown" | "subagents-directory";
13
+ type AgentRootEntryKind = "agent-config-module" | "channels-directory" | "connections-directory" | "extensions-directory" | "hooks-directory" | "ignored-directory" | "instrumentation-directory" | "instructions-directory" | "instructions-markdown" | "instructions-module" | "lib-directory" | "memory-directory" | "memory-module" | "sandbox-directory" | "schedules-directory" | "skills-directory" | "system-markdown" | "system-module" | "tools-directory" | "unknown" | "subagents-directory";
19
14
  /**
20
15
  * Classified local-subagent root entry.
21
16
  */
22
- export type LocalSubagentEntryKind = "agent-config-module" | "connections-directory" | "extensions-directory" | "hooks-directory" | "ignored-directory" | "instructions-directory" | "instructions-markdown" | "instructions-module" | "invalid-schedules-directory" | "lib-directory" | "memory-directory" | "memory-module" | "sandbox-directory" | "skills-directory" | "system-markdown" | "system-module" | "tools-directory" | "unknown" | "subagents-directory";
17
+ type LocalSubagentEntryKind = "agent-config-module" | "connections-directory" | "extensions-directory" | "hooks-directory" | "ignored-directory" | "instructions-directory" | "instructions-markdown" | "instructions-module" | "invalid-schedules-directory" | "lib-directory" | "memory-directory" | "memory-module" | "sandbox-directory" | "skills-directory" | "system-markdown" | "system-module" | "tools-directory" | "unknown" | "subagents-directory";
23
18
  /**
24
19
  * Classified Agent Skills package entry.
25
20
  */
26
- export type SkillPackageEntryKind = "skill-assets-directory" | "skill-markdown" | "skill-references-directory" | "skill-resource" | "skill-scripts-directory";
21
+ type SkillPackageEntryKind = "skill-assets-directory" | "skill-markdown" | "skill-references-directory" | "skill-resource" | "skill-scripts-directory";
27
22
  /**
28
23
  * Classified top-level entry inside `skills/`.
29
24
  */
30
- export type SkillsDirectoryEntryKind = "flat-skill-markdown" | "flat-skill-module" | "ignored-declaration" | "ignored-source-map" | "skill-package-directory" | "unknown";
25
+ type SkillsDirectoryEntryKind = "flat-skill-markdown" | "flat-skill-module" | "ignored-declaration" | "ignored-source-map" | "skill-package-directory" | "unknown";
31
26
  /**
32
27
  * Returns the normalized entry type for a Node filesystem dirent.
33
28
  */
@@ -76,3 +71,4 @@ export declare function matchesSupportedModuleBaseName(name: string, baseName: s
76
71
  * Removes a final file extension from a logical path when present.
77
72
  */
78
73
  export declare function stripLogicalPathExtension(input: string): string;
74
+ export {};
@@ -1 +1 @@
1
- import{sep}from"node:path";const SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS=[`.cts`,`.mts`,`.cjs`,`.mjs`,`.ts`,`.js`],PROJECT_MARKER_FILE_NAMES=[`package.json`,`vercel.json`],PROJECT_MARKER_FILE_NAME_SET=new Set(PROJECT_MARKER_FILE_NAMES),GENERATED_AGENT_DIRECTORY_NAMES=new Set([`.devtools`,`.eve`,`.next`,`.output`,`.vercel`,`node_modules`]);function getDirectoryEntryType(e){return e.isDirectory()?`directory`:e.isFile()?`file`:`other`}function isProjectMarkerEntry(e,t){return t===`file`&&PROJECT_MARKER_FILE_NAME_SET.has(e)}function isDiscoverableAgentRootEntry(e,t){let n=classifyAgentRootEntry(e,t);return n!==`unknown`&&n!==`ignored-directory`&&n!==`lib-directory`&&n!==`memory-directory`}function classifyAgentRootEntry(e,t){if(t===`file`)return matchesSupportedModuleBaseName(e,`agent`)?`agent-config-module`:e.toLowerCase()===`instructions.md`?`instructions-markdown`:matchesSupportedModuleBaseName(e,`instructions`)?`instructions-module`:matchesSupportedModuleBaseName(e,`memory`)?`memory-module`:e.toLowerCase()===`system.md`?`system-markdown`:matchesSupportedModuleBaseName(e,`system`)?`system-module`:`unknown`;if(t===`directory`){if(GENERATED_AGENT_DIRECTORY_NAMES.has(e))return`ignored-directory`;if(e===`channels`)return`channels-directory`;if(e===`connections`)return`connections-directory`;if(e===`extensions`)return`extensions-directory`;if(e===`hooks`)return`hooks-directory`;if(e===`instructions`)return`instructions-directory`;if(e===`instrumentation`)return`instrumentation-directory`;if(e===`lib`)return`lib-directory`;if(e===`memory`)return`memory-directory`;if(e===`skills`)return`skills-directory`;if(e===`sandbox`)return`sandbox-directory`;if(e===`tools`)return`tools-directory`;if(e===`schedules`)return`schedules-directory`;if(e===`subagents`)return`subagents-directory`}return`unknown`}function classifyLocalSubagentEntry(e,t){if(t===`file`)return matchesSupportedModuleBaseName(e,`agent`)?`agent-config-module`:e.toLowerCase()===`instructions.md`?`instructions-markdown`:matchesSupportedModuleBaseName(e,`instructions`)?`instructions-module`:matchesSupportedModuleBaseName(e,`memory`)?`memory-module`:e.toLowerCase()===`system.md`?`system-markdown`:matchesSupportedModuleBaseName(e,`system`)?`system-module`:`unknown`;if(t===`directory`){if(GENERATED_AGENT_DIRECTORY_NAMES.has(e))return`ignored-directory`;if(e===`connections`)return`connections-directory`;if(e===`extensions`)return`extensions-directory`;if(e===`hooks`)return`hooks-directory`;if(e===`instructions`)return`instructions-directory`;if(e===`lib`)return`lib-directory`;if(e===`memory`)return`memory-directory`;if(e===`sandbox`)return`sandbox-directory`;if(e===`skills`)return`skills-directory`;if(e===`tools`)return`tools-directory`;if(e===`subagents`)return`subagents-directory`;if(e===`schedules`)return`invalid-schedules-directory`}return`unknown`}function classifySkillPackageEntry(e,t){if(t===`file`)return e.toLowerCase()===`skill.md`?`skill-markdown`:`skill-resource`;if(t===`directory`){if(e===`scripts`)return`skill-scripts-directory`;if(e===`references`)return`skill-references-directory`;if(e===`assets`)return`skill-assets-directory`}return`skill-resource`}function classifySkillsDirectoryEntry(e,t){if(t===`directory`)return`skill-package-directory`;if(t===`file`){if(isTypeScriptDeclarationFileName(e))return`ignored-declaration`;if(isGeneratedSourceMapFileName(e))return`ignored-source-map`;if(e.toLowerCase().endsWith(`.md`))return`flat-skill-markdown`;if(getSupportedModuleBaseName(e)!==null)return`flat-skill-module`}return`unknown`}function normalizeLogicalPath(e){return e.replaceAll(sep,`/`).replace(/^\.\//,``).replace(/^\/+/,``)}function getSupportedModuleBaseName(e){if(isTypeScriptDeclarationFileName(e))return null;for(let t of SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS)if(e.endsWith(t)&&e.length>t.length)return e.slice(0,-t.length);return null}function isTypeScriptDeclarationFileName(e){return/\.d\.(?:cts|mts|ts)$/.test(e)}function isAuthoredTestPath(e){return/(?:^|[/\\])__tests__(?:[/\\]|$)/.test(e)||/\.(?:test|spec)\.[cm]?[jt]s$/.test(e)}function isGeneratedSourceMapFileName(e){if(!e.endsWith(`.map`))return!1;let t=e.slice(0,-4);return isTypeScriptDeclarationFileName(t)||getSupportedModuleBaseName(t)!==null}function matchesSupportedModuleBaseName(e,t){return getSupportedModuleBaseName(e)===t}function stripLogicalPathExtension(e){let t=normalizeLogicalPath(e),n=t.lastIndexOf(`/`),r=t.lastIndexOf(`.`);return r===-1||r<n?t:t.slice(0,r)}export{PROJECT_MARKER_FILE_NAMES,SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS,classifyAgentRootEntry,classifyLocalSubagentEntry,classifySkillPackageEntry,classifySkillsDirectoryEntry,getDirectoryEntryType,getSupportedModuleBaseName,isAuthoredTestPath,isDiscoverableAgentRootEntry,isGeneratedSourceMapFileName,isProjectMarkerEntry,isTypeScriptDeclarationFileName,matchesSupportedModuleBaseName,normalizeLogicalPath,stripLogicalPathExtension};
1
+ import{sep}from"node:path";const SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS=[`.cts`,`.mts`,`.cjs`,`.mjs`,`.ts`,`.js`],PROJECT_MARKER_FILE_NAME_SET=new Set([`package.json`,`vercel.json`]),GENERATED_AGENT_DIRECTORY_NAMES=new Set([`.devtools`,`.eve`,`.next`,`.output`,`.vercel`,`node_modules`]);function getDirectoryEntryType(e){return e.isDirectory()?`directory`:e.isFile()?`file`:`other`}function isProjectMarkerEntry(e,t){return t===`file`&&PROJECT_MARKER_FILE_NAME_SET.has(e)}function isDiscoverableAgentRootEntry(e,t){let n=classifyAgentRootEntry(e,t);return n!==`unknown`&&n!==`ignored-directory`&&n!==`lib-directory`&&n!==`memory-directory`}function classifyAgentRootEntry(e,t){if(t===`file`)return matchesSupportedModuleBaseName(e,`agent`)?`agent-config-module`:e.toLowerCase()===`instructions.md`?`instructions-markdown`:matchesSupportedModuleBaseName(e,`instructions`)?`instructions-module`:matchesSupportedModuleBaseName(e,`memory`)?`memory-module`:e.toLowerCase()===`system.md`?`system-markdown`:matchesSupportedModuleBaseName(e,`system`)?`system-module`:`unknown`;if(t===`directory`){if(GENERATED_AGENT_DIRECTORY_NAMES.has(e))return`ignored-directory`;if(e===`channels`)return`channels-directory`;if(e===`connections`)return`connections-directory`;if(e===`extensions`)return`extensions-directory`;if(e===`hooks`)return`hooks-directory`;if(e===`instructions`)return`instructions-directory`;if(e===`instrumentation`)return`instrumentation-directory`;if(e===`lib`)return`lib-directory`;if(e===`memory`)return`memory-directory`;if(e===`skills`)return`skills-directory`;if(e===`sandbox`)return`sandbox-directory`;if(e===`tools`)return`tools-directory`;if(e===`schedules`)return`schedules-directory`;if(e===`subagents`)return`subagents-directory`}return`unknown`}function classifyLocalSubagentEntry(e,t){if(t===`file`)return matchesSupportedModuleBaseName(e,`agent`)?`agent-config-module`:e.toLowerCase()===`instructions.md`?`instructions-markdown`:matchesSupportedModuleBaseName(e,`instructions`)?`instructions-module`:matchesSupportedModuleBaseName(e,`memory`)?`memory-module`:e.toLowerCase()===`system.md`?`system-markdown`:matchesSupportedModuleBaseName(e,`system`)?`system-module`:`unknown`;if(t===`directory`){if(GENERATED_AGENT_DIRECTORY_NAMES.has(e))return`ignored-directory`;if(e===`connections`)return`connections-directory`;if(e===`extensions`)return`extensions-directory`;if(e===`hooks`)return`hooks-directory`;if(e===`instructions`)return`instructions-directory`;if(e===`lib`)return`lib-directory`;if(e===`memory`)return`memory-directory`;if(e===`sandbox`)return`sandbox-directory`;if(e===`skills`)return`skills-directory`;if(e===`tools`)return`tools-directory`;if(e===`subagents`)return`subagents-directory`;if(e===`schedules`)return`invalid-schedules-directory`}return`unknown`}function classifySkillPackageEntry(e,t){if(t===`file`)return e.toLowerCase()===`skill.md`?`skill-markdown`:`skill-resource`;if(t===`directory`){if(e===`scripts`)return`skill-scripts-directory`;if(e===`references`)return`skill-references-directory`;if(e===`assets`)return`skill-assets-directory`}return`skill-resource`}function classifySkillsDirectoryEntry(e,t){if(t===`directory`)return`skill-package-directory`;if(t===`file`){if(isTypeScriptDeclarationFileName(e))return`ignored-declaration`;if(isGeneratedSourceMapFileName(e))return`ignored-source-map`;if(e.toLowerCase().endsWith(`.md`))return`flat-skill-markdown`;if(getSupportedModuleBaseName(e)!==null)return`flat-skill-module`}return`unknown`}function normalizeLogicalPath(e){return e.replaceAll(sep,`/`).replace(/^\.\//,``).replace(/^\/+/,``)}function getSupportedModuleBaseName(e){if(isTypeScriptDeclarationFileName(e))return null;for(let t of SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS)if(e.endsWith(t)&&e.length>t.length)return e.slice(0,-t.length);return null}function isTypeScriptDeclarationFileName(e){return/\.d\.(?:cts|mts|ts)$/.test(e)}function isAuthoredTestPath(e){return/(?:^|[/\\])__tests__(?:[/\\]|$)/.test(e)||/\.(?:test|spec)\.[cm]?[jt]s$/.test(e)}function isGeneratedSourceMapFileName(e){if(!e.endsWith(`.map`))return!1;let t=e.slice(0,-4);return isTypeScriptDeclarationFileName(t)||getSupportedModuleBaseName(t)!==null}function matchesSupportedModuleBaseName(e,t){return getSupportedModuleBaseName(e)===t}function stripLogicalPathExtension(e){let t=normalizeLogicalPath(e),n=t.lastIndexOf(`/`),r=t.lastIndexOf(`.`);return r===-1||r<n?t:t.slice(0,r)}export{SUPPORTED_AUTHORED_MODULE_FILE_EXTENSIONS,classifyAgentRootEntry,classifyLocalSubagentEntry,classifySkillPackageEntry,classifySkillsDirectoryEntry,getDirectoryEntryType,getSupportedModuleBaseName,isAuthoredTestPath,isDiscoverableAgentRootEntry,isGeneratedSourceMapFileName,isProjectMarkerEntry,isTypeScriptDeclarationFileName,matchesSupportedModuleBaseName,normalizeLogicalPath,stripLogicalPathExtension};
@@ -1,4 +1,3 @@
1
- import type { Dirent } from "node:fs";
2
1
  import type { ModuleSourceRef } from "#shared/source-ref.js";
3
2
  import { type DiscoverDiagnostic } from "#discover/diagnostics.js";
4
3
  import { type DirectoryEntryType } from "#discover/filesystem.js";
@@ -49,27 +48,12 @@ export declare const DISCOVER_EXTENSIONS_DIRECTORY_INVALID = "discover/extension
49
48
  * not satisfy the model tool-name charset rule.
50
49
  */
51
50
  export declare const DISCOVER_TOOL_NAME_INVALID = "discover/tool-name-invalid";
52
- /**
53
- * Shared diagnostic emitted when an authored `connections/*.{ts,…}` filename
54
- * does not satisfy the connection slug charset rule.
55
- */
56
- export declare const DISCOVER_CONNECTION_NAME_INVALID = "discover/connection-name-invalid";
57
51
  /**
58
52
  * Shared diagnostic emitted when the authored `sandbox/` root is not a
59
53
  * directory. The diagnostic code string retains its plural suffix for
60
54
  * stability across manifest versions.
61
55
  */
62
56
  export declare const DISCOVER_SANDBOX_DIRECTORY_INVALID = "discover/sandbox-directory-invalid";
63
- /**
64
- * Shared diagnostic emitted when the authored `instructions/` root is not a
65
- * directory.
66
- */
67
- export declare const DISCOVER_INSTRUCTIONS_DIRECTORY_INVALID = "discover/instructions-directory-invalid";
68
- /**
69
- * Shared diagnostic emitted when an authored `channels/**` filename or
70
- * directory segment does not satisfy the channel slug charset rule.
71
- */
72
- export declare const DISCOVER_CHANNEL_NAME_INVALID = "discover/channel-name-invalid";
73
57
  /**
74
58
  * Shared diagnostic emitted when an authored `hooks/**` filename or
75
59
  * directory segment does not satisfy the hook slug charset rule.
@@ -96,40 +80,10 @@ export declare const TOOL_SLUG_PATTERN: RegExp;
96
80
  * model APIs as identifiers.
97
81
  */
98
82
  export declare const CONNECTION_SLUG_PATTERN: RegExp;
99
- /**
100
- * Channel filename / directory segment charset.
101
- */
102
- export declare const CHANNEL_SLUG_PATTERN: RegExp;
103
- /**
104
- * Hook filename / directory segment charset. Each segment of the
105
- * path-relative slug uses the same restrictive charset as tool slugs:
106
- * ASCII letters, digits, underscores, and dashes, starting with a
107
- * letter, up to 64 characters per segment. Bracketed parameter forms
108
- * are not allowed — hooks have no URL semantics.
109
- */
110
- export declare const HOOK_SLUG_PATTERN: RegExp;
111
- /**
112
- * Extension mount filename charset. The basename becomes the namespace the
113
- * consumer's build prefixes onto every contribution (`crm` → `crm__search`),
114
- * so it uses the same restrictive charset as tool slugs: ASCII letters,
115
- * digits, underscores, and dashes, starting with a letter, up to 64
116
- * characters.
117
- */
118
- export declare const EXTENSION_SLUG_PATTERN: RegExp;
119
83
  /**
120
84
  * Shared diagnostic emitted when discovery ignores one unsupported directory.
121
85
  */
122
86
  export declare const DISCOVER_UNSUPPORTED_DIRECTORY = "discover/unsupported-directory";
123
- /**
124
- * Structural `Dirent`-like entry used throughout discovery.
125
- *
126
- * Legacy alias preserved for backwards compatibility inside `src/discover/`.
127
- * Every discover function now consumes {@link ProjectSourceEntry}, which
128
- * has the same three properties (`name`, `isDirectory()`, `isFile()`). Real
129
- * `Dirent<string>` values from `node:fs` satisfy this shape, so
130
- * {@link createDiskProjectSource} returns them directly.
131
- */
132
- export type StringDirent = Dirent<string>;
133
87
  /**
134
88
  * Reads sorted agent source entries, excluding colocated tests unless reading resources.
135
89
  */
@@ -1 +1 @@
1
- import{join}from"node:path";import{getDirectoryEntryType,isAuthoredTestPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic,createDiscoverWarningDiagnostic}from"#discover/diagnostics.js";import{createModuleSourceRef}from"#discover/manifest.js";import{collectFlatSlotCandidates}from"#discover/slots.js";import{lowerInstructionsMarkdown}from"#internal/helpers/markdown.js";import{discoverMarkdownSource}from"#discover/markdown.js";import{discoverNamedSourceDirectory,discoverNamedSourceDirectory as discoverNamedSourceDirectory$1}from"#discover/named-source-directory.js";const DISCOVER_MODULE_SLOT_COLLISION=`discover/module-slot-collision`,DISCOVER_REQUIRED_INSTRUCTIONS_MISSING=`discover/required-instructions-missing`,DISCOVER_DEPRECATED_SYSTEM_SLOT=`discover/deprecated-system-slot`,DISCOVER_SLOT_COLLISION=`discover/slot-collision`,DISCOVER_TOOLS_DIRECTORY_INVALID=`discover/tools-directory-invalid`,DISCOVER_HOOKS_DIRECTORY_INVALID=`discover/hooks-directory-invalid`,DISCOVER_CHANNELS_DIRECTORY_INVALID=`discover/channels-directory-invalid`,DISCOVER_EXTENSIONS_DIRECTORY_INVALID=`discover/extensions-directory-invalid`,DISCOVER_TOOL_NAME_INVALID=`discover/tool-name-invalid`,DISCOVER_CONNECTION_NAME_INVALID=`discover/connection-name-invalid`,DISCOVER_SANDBOX_DIRECTORY_INVALID=`discover/sandbox-directory-invalid`,DISCOVER_INSTRUCTIONS_DIRECTORY_INVALID=`discover/instructions-directory-invalid`,DISCOVER_CHANNEL_NAME_INVALID=`discover/channel-name-invalid`,DISCOVER_HOOK_NAME_INVALID=`discover/hook-name-invalid`,DISCOVER_EXTENSION_NAME_INVALID=`discover/extension-name-invalid`,TOOL_SLUG_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/,CONNECTION_SLUG_PATTERN=/^[a-z][a-z0-9-]{0,63}$/,CHANNEL_SLUG_PATTERN=/^(\.?[a-z][a-z0-9-]{0,63}|\[[a-zA-Z][a-zA-Z0-9_]{0,63}\])$/,HOOK_SLUG_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/,EXTENSION_SLUG_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/,DISCOVER_UNSUPPORTED_DIRECTORY=`discover/unsupported-directory`;async function readSortedDirectoryEntries(e,t,n={}){let r=(await e.readDirectory(t)).filter(e=>n.includeTests||!isAuthoredTestPath(e.name));return r.sort((e,t)=>e.name.localeCompare(t.name)),r}async function discoverInstructionsSource(e){let t=e.rootEntries.some(e=>e.name===`instructions`&&e.isDirectory()),n=await discoverSlotSource({markdownFileName:`instructions.md`,moduleBaseName:`instructions`,rootEntries:e.rootEntries,rootPath:e.rootPath,slotLabel:`instructions`,source:e.source});if(t){let t=await discoverNamedSourceDirectory$1({allowMarkdown:!0,directoryName:`instructions`,invalidDirectoryCode:DISCOVER_INSTRUCTIONS_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(e.rootPath,`instructions`)}" to be a directory of authored instructions.`,markdownLowerer:e=>lowerInstructionsMarkdown(e),recursive:!1,rootEntries:e.rootEntries,rootPath:e.rootPath,source:e.source}),r=[...t.sources];return n.source!==void 0&&r.unshift(n.source),{diagnostics:[...n.diagnostics,...t.diagnostics],instructions:r}}if(n.diagnostics.length>0||n.source!==void 0)return{diagnostics:n.diagnostics,instructions:n.source===void 0?[]:[n.source]};let r=await discoverSlotSource({markdownFileName:`system.md`,moduleBaseName:`system`,rootEntries:e.rootEntries,rootPath:e.rootPath,slotLabel:`system`,source:e.source});if(r.source!==void 0){let t=r.source.sourceKind===`markdown`?`system.md`:r.source.logicalPath;return{diagnostics:[createDiscoverWarningDiagnostic({code:DISCOVER_DEPRECATED_SYSTEM_SLOT,message:`The "${t}" slot is deprecated. Rename it to "${t.replace(/^system/,`instructions`)}" — the runtime still loads the legacy slot for now, but support will be removed in a future release.`,sourcePath:join(e.rootPath,t)}),...r.diagnostics],instructions:[r.source]}}return r.diagnostics.length>0?{diagnostics:r.diagnostics,instructions:[]}:e.required===!1?{diagnostics:[],instructions:[]}:{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_REQUIRED_INSTRUCTIONS_MISSING,message:`Expected authored instructions at "instructions.md", "instructions.ts", "instructions.cts", "instructions.mts", "instructions.js", "instructions.cjs", "instructions.mjs", or "instructions/" directory.`,sourcePath:e.rootPath})],instructions:[]}}async function discoverSlotSource(e){let t=collectFlatSlotCandidates(e.rootEntries,{markdownFileName:e.markdownFileName,moduleBaseName:e.moduleBaseName});if(t.markdownFileName!==void 0&&t.moduleFileNames.length>0)return{diagnostics:[createSlotCollisionDiagnostic(e.rootPath,e.slotLabel,[t.markdownFileName,...t.moduleFileNames])]};if(t.moduleFileNames.length>1)return{diagnostics:[createModuleSlotCollisionDiagnostic(e.rootPath,e.slotLabel,t.moduleFileNames)]};if(t.markdownFileName!==void 0)return{diagnostics:[],source:await discoverMarkdownSource({logicalPath:e.markdownFileName,lower:lowerInstructionsMarkdown,source:e.source,sourcePath:join(e.rootPath,t.markdownFileName)})};let[n]=t.moduleFileNames;return n===void 0?{diagnostics:[]}:{diagnostics:[],source:createModuleSourceRef({logicalPath:n})}}function discoverFlatModuleSource(e){let t=collectFlatSlotCandidates(e.rootEntries,{moduleBaseName:e.slotName});if(t.moduleFileNames.length>1)return{diagnostics:[createModuleSlotCollisionDiagnostic(e.rootPath,e.slotName,t.moduleFileNames)]};let[n]=t.moduleFileNames;return n===void 0?e.missingDiagnostic===void 0?{diagnostics:[]}:{diagnostics:[createDiscoverErrorDiagnostic({code:e.missingDiagnostic.code,message:e.missingDiagnostic.message,sourcePath:e.rootPath})]}:{diagnostics:[],module:createModuleSourceRef({logicalPath:n})}}function createToolNameDiagnostic(e,t){return TOOL_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_TOOL_NAME_INVALID,message:`Tool filename "${e}" is not a legal tool name. Expected ASCII letters, digits, underscores, and dashes only, starting with a letter, up to 64 characters.`,sourcePath:t})}function createConnectionNameDiagnostic(e,t){return CONNECTION_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_CONNECTION_NAME_INVALID,message:`Connection filename "${e}" is not a legal connection name. Expected lowercase ASCII letters, digits, and dashes only, starting with a letter, up to 64 characters.`,sourcePath:t})}function createChannelNameDiagnostic(e,t){return CHANNEL_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_CHANNEL_NAME_INVALID,message:`Channel path segment "${e}" is not a legal channel name. Expected lowercase kebab-case (\`my-channel\`), optionally with a leading dot (\`.well-known\`), or a path parameter form (\`[sessionId]\`).`,sourcePath:t})}function createHookNameDiagnostic(e,t){return HOOK_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_HOOK_NAME_INVALID,message:`Hook path segment "${e}" is not a legal hook name. Expected ASCII letters, digits, underscores, and dashes only, starting with a letter, up to 64 characters.`,sourcePath:t})}function createExtensionNameDiagnostic(e,t){return EXTENSION_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_NAME_INVALID,message:`Extension mount filename "${e}" is not a legal extension namespace. Expected ASCII letters, digits, underscores, and dashes only, starting with a letter, up to 64 characters.`,sourcePath:t})}function createUnsupportedRootDirectoryDiagnostics(e){return e.rootEntries.flatMap(t=>!t.isDirectory()||e.classifyEntry(t.name,getDirectoryEntryType(t))!==`unknown`?[]:[createDiscoverWarningDiagnostic({code:DISCOVER_UNSUPPORTED_DIRECTORY,message:e.createUnsupportedDirectoryMessage(t.name),sourcePath:join(e.rootPath,t.name)})])}function createSlotCollisionDiagnostic(e,t,n){return createDiscoverErrorDiagnostic({code:DISCOVER_SLOT_COLLISION,message:`Found conflicting authored sources for "${t}": ${formatQuotedFileList(n)}.`,sourcePath:e})}function createModuleSlotCollisionDiagnostic(e,t,n){return createDiscoverErrorDiagnostic({code:DISCOVER_MODULE_SLOT_COLLISION,message:`Found multiple authored module sources for "${t}": ${formatQuotedFileList(n)}.`,sourcePath:e})}function formatQuotedFileList(e){return e.map(e=>`"${e}"`).join(`, `)}export{CHANNEL_SLUG_PATTERN,CONNECTION_SLUG_PATTERN,DISCOVER_CHANNELS_DIRECTORY_INVALID,DISCOVER_CHANNEL_NAME_INVALID,DISCOVER_CONNECTION_NAME_INVALID,DISCOVER_DEPRECATED_SYSTEM_SLOT,DISCOVER_EXTENSIONS_DIRECTORY_INVALID,DISCOVER_EXTENSION_NAME_INVALID,DISCOVER_HOOKS_DIRECTORY_INVALID,DISCOVER_HOOK_NAME_INVALID,DISCOVER_INSTRUCTIONS_DIRECTORY_INVALID,DISCOVER_MODULE_SLOT_COLLISION,DISCOVER_REQUIRED_INSTRUCTIONS_MISSING,DISCOVER_SANDBOX_DIRECTORY_INVALID,DISCOVER_SLOT_COLLISION,DISCOVER_TOOLS_DIRECTORY_INVALID,DISCOVER_TOOL_NAME_INVALID,DISCOVER_UNSUPPORTED_DIRECTORY,EXTENSION_SLUG_PATTERN,HOOK_SLUG_PATTERN,TOOL_SLUG_PATTERN,createChannelNameDiagnostic,createConnectionNameDiagnostic,createExtensionNameDiagnostic,createHookNameDiagnostic,createModuleSlotCollisionDiagnostic,createSlotCollisionDiagnostic,createToolNameDiagnostic,createUnsupportedRootDirectoryDiagnostics,discoverFlatModuleSource,discoverInstructionsSource,discoverNamedSourceDirectory,readSortedDirectoryEntries};
1
+ import{join}from"node:path";import{getDirectoryEntryType,isAuthoredTestPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic,createDiscoverWarningDiagnostic}from"#discover/diagnostics.js";import{createModuleSourceRef}from"#discover/manifest.js";import{collectFlatSlotCandidates}from"#discover/slots.js";import{lowerInstructionsMarkdown}from"#internal/helpers/markdown.js";import{discoverMarkdownSource}from"#discover/markdown.js";import{discoverNamedSourceDirectory,discoverNamedSourceDirectory as discoverNamedSourceDirectory$1}from"#discover/named-source-directory.js";const DISCOVER_MODULE_SLOT_COLLISION=`discover/module-slot-collision`,DISCOVER_REQUIRED_INSTRUCTIONS_MISSING=`discover/required-instructions-missing`,DISCOVER_DEPRECATED_SYSTEM_SLOT=`discover/deprecated-system-slot`,DISCOVER_SLOT_COLLISION=`discover/slot-collision`,DISCOVER_TOOLS_DIRECTORY_INVALID=`discover/tools-directory-invalid`,DISCOVER_HOOKS_DIRECTORY_INVALID=`discover/hooks-directory-invalid`,DISCOVER_CHANNELS_DIRECTORY_INVALID=`discover/channels-directory-invalid`,DISCOVER_EXTENSIONS_DIRECTORY_INVALID=`discover/extensions-directory-invalid`,DISCOVER_TOOL_NAME_INVALID=`discover/tool-name-invalid`,DISCOVER_SANDBOX_DIRECTORY_INVALID=`discover/sandbox-directory-invalid`,DISCOVER_HOOK_NAME_INVALID=`discover/hook-name-invalid`,DISCOVER_EXTENSION_NAME_INVALID=`discover/extension-name-invalid`,TOOL_SLUG_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/,CONNECTION_SLUG_PATTERN=/^[a-z][a-z0-9-]{0,63}$/,CHANNEL_SLUG_PATTERN=/^(\.?[a-z][a-z0-9-]{0,63}|\[[a-zA-Z][a-zA-Z0-9_]{0,63}\])$/,HOOK_SLUG_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/,EXTENSION_SLUG_PATTERN=/^[a-zA-Z][a-zA-Z0-9_-]{0,63}$/,DISCOVER_UNSUPPORTED_DIRECTORY=`discover/unsupported-directory`;async function readSortedDirectoryEntries(e,t,n={}){let r=(await e.readDirectory(t)).filter(e=>n.includeTests||!isAuthoredTestPath(e.name));return r.sort((e,t)=>e.name.localeCompare(t.name)),r}async function discoverInstructionsSource(e){let t=e.rootEntries.some(e=>e.name===`instructions`&&e.isDirectory()),n=await discoverSlotSource({markdownFileName:`instructions.md`,moduleBaseName:`instructions`,rootEntries:e.rootEntries,rootPath:e.rootPath,slotLabel:`instructions`,source:e.source});if(t){let t=await discoverNamedSourceDirectory$1({allowMarkdown:!0,directoryName:`instructions`,invalidDirectoryCode:`discover/instructions-directory-invalid`,invalidDirectoryMessage:`Expected "${join(e.rootPath,`instructions`)}" to be a directory of authored instructions.`,markdownLowerer:e=>lowerInstructionsMarkdown(e),recursive:!1,rootEntries:e.rootEntries,rootPath:e.rootPath,source:e.source}),r=[...t.sources];return n.source!==void 0&&r.unshift(n.source),{diagnostics:[...n.diagnostics,...t.diagnostics],instructions:r}}if(n.diagnostics.length>0||n.source!==void 0)return{diagnostics:n.diagnostics,instructions:n.source===void 0?[]:[n.source]};let r=await discoverSlotSource({markdownFileName:`system.md`,moduleBaseName:`system`,rootEntries:e.rootEntries,rootPath:e.rootPath,slotLabel:`system`,source:e.source});if(r.source!==void 0){let t=r.source.sourceKind===`markdown`?`system.md`:r.source.logicalPath;return{diagnostics:[createDiscoverWarningDiagnostic({code:DISCOVER_DEPRECATED_SYSTEM_SLOT,message:`The "${t}" slot is deprecated. Rename it to "${t.replace(/^system/,`instructions`)}" — the runtime still loads the legacy slot for now, but support will be removed in a future release.`,sourcePath:join(e.rootPath,t)}),...r.diagnostics],instructions:[r.source]}}return r.diagnostics.length>0?{diagnostics:r.diagnostics,instructions:[]}:e.required===!1?{diagnostics:[],instructions:[]}:{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_REQUIRED_INSTRUCTIONS_MISSING,message:`Expected authored instructions at "instructions.md", "instructions.ts", "instructions.cts", "instructions.mts", "instructions.js", "instructions.cjs", "instructions.mjs", or "instructions/" directory.`,sourcePath:e.rootPath})],instructions:[]}}async function discoverSlotSource(e){let t=collectFlatSlotCandidates(e.rootEntries,{markdownFileName:e.markdownFileName,moduleBaseName:e.moduleBaseName});if(t.markdownFileName!==void 0&&t.moduleFileNames.length>0)return{diagnostics:[createSlotCollisionDiagnostic(e.rootPath,e.slotLabel,[t.markdownFileName,...t.moduleFileNames])]};if(t.moduleFileNames.length>1)return{diagnostics:[createModuleSlotCollisionDiagnostic(e.rootPath,e.slotLabel,t.moduleFileNames)]};if(t.markdownFileName!==void 0)return{diagnostics:[],source:await discoverMarkdownSource({logicalPath:e.markdownFileName,lower:lowerInstructionsMarkdown,source:e.source,sourcePath:join(e.rootPath,t.markdownFileName)})};let[n]=t.moduleFileNames;return n===void 0?{diagnostics:[]}:{diagnostics:[],source:createModuleSourceRef({logicalPath:n})}}function discoverFlatModuleSource(e){let t=collectFlatSlotCandidates(e.rootEntries,{moduleBaseName:e.slotName});if(t.moduleFileNames.length>1)return{diagnostics:[createModuleSlotCollisionDiagnostic(e.rootPath,e.slotName,t.moduleFileNames)]};let[n]=t.moduleFileNames;return n===void 0?e.missingDiagnostic===void 0?{diagnostics:[]}:{diagnostics:[createDiscoverErrorDiagnostic({code:e.missingDiagnostic.code,message:e.missingDiagnostic.message,sourcePath:e.rootPath})]}:{diagnostics:[],module:createModuleSourceRef({logicalPath:n})}}function createToolNameDiagnostic(e,t){return TOOL_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_TOOL_NAME_INVALID,message:`Tool filename "${e}" is not a legal tool name. Expected ASCII letters, digits, underscores, and dashes only, starting with a letter, up to 64 characters.`,sourcePath:t})}function createConnectionNameDiagnostic(e,t){return CONNECTION_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:`discover/connection-name-invalid`,message:`Connection filename "${e}" is not a legal connection name. Expected lowercase ASCII letters, digits, and dashes only, starting with a letter, up to 64 characters.`,sourcePath:t})}function createChannelNameDiagnostic(e,t){return CHANNEL_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:`discover/channel-name-invalid`,message:`Channel path segment "${e}" is not a legal channel name. Expected lowercase kebab-case (\`my-channel\`), optionally with a leading dot (\`.well-known\`), or a path parameter form (\`[sessionId]\`).`,sourcePath:t})}function createHookNameDiagnostic(e,t){return HOOK_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_HOOK_NAME_INVALID,message:`Hook path segment "${e}" is not a legal hook name. Expected ASCII letters, digits, underscores, and dashes only, starting with a letter, up to 64 characters.`,sourcePath:t})}function createExtensionNameDiagnostic(e,t){return EXTENSION_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_EXTENSION_NAME_INVALID,message:`Extension mount filename "${e}" is not a legal extension namespace. Expected ASCII letters, digits, underscores, and dashes only, starting with a letter, up to 64 characters.`,sourcePath:t})}function createUnsupportedRootDirectoryDiagnostics(e){return e.rootEntries.flatMap(t=>!t.isDirectory()||e.classifyEntry(t.name,getDirectoryEntryType(t))!==`unknown`?[]:[createDiscoverWarningDiagnostic({code:DISCOVER_UNSUPPORTED_DIRECTORY,message:e.createUnsupportedDirectoryMessage(t.name),sourcePath:join(e.rootPath,t.name)})])}function createSlotCollisionDiagnostic(e,t,n){return createDiscoverErrorDiagnostic({code:DISCOVER_SLOT_COLLISION,message:`Found conflicting authored sources for "${t}": ${formatQuotedFileList(n)}.`,sourcePath:e})}function createModuleSlotCollisionDiagnostic(e,t,n){return createDiscoverErrorDiagnostic({code:DISCOVER_MODULE_SLOT_COLLISION,message:`Found multiple authored module sources for "${t}": ${formatQuotedFileList(n)}.`,sourcePath:e})}function formatQuotedFileList(e){return e.map(e=>`"${e}"`).join(`, `)}export{CONNECTION_SLUG_PATTERN,DISCOVER_CHANNELS_DIRECTORY_INVALID,DISCOVER_DEPRECATED_SYSTEM_SLOT,DISCOVER_EXTENSIONS_DIRECTORY_INVALID,DISCOVER_EXTENSION_NAME_INVALID,DISCOVER_HOOKS_DIRECTORY_INVALID,DISCOVER_HOOK_NAME_INVALID,DISCOVER_MODULE_SLOT_COLLISION,DISCOVER_REQUIRED_INSTRUCTIONS_MISSING,DISCOVER_SANDBOX_DIRECTORY_INVALID,DISCOVER_SLOT_COLLISION,DISCOVER_TOOLS_DIRECTORY_INVALID,DISCOVER_TOOL_NAME_INVALID,DISCOVER_UNSUPPORTED_DIRECTORY,TOOL_SLUG_PATTERN,createChannelNameDiagnostic,createConnectionNameDiagnostic,createExtensionNameDiagnostic,createHookNameDiagnostic,createModuleSlotCollisionDiagnostic,createSlotCollisionDiagnostic,createToolNameDiagnostic,createUnsupportedRootDirectoryDiagnostics,discoverFlatModuleSource,discoverInstructionsSource,discoverNamedSourceDirectory,readSortedDirectoryEntries};
@@ -155,7 +155,7 @@ export type SubagentSourceRef = LocalSubagentSourceRef;
155
155
  /**
156
156
  * Input used to build a manifest-ready connection source ref.
157
157
  */
158
- export interface CreateConnectionSourceRefInput extends CreateModuleSourceRefInput {
158
+ interface CreateConnectionSourceRefInput extends CreateModuleSourceRefInput {
159
159
  connectionName: string;
160
160
  }
161
161
  /**
@@ -248,7 +248,7 @@ export interface CreateAgentSourceManifestInput {
248
248
  /**
249
249
  * Input used to build a manifest-ready skill package source ref.
250
250
  */
251
- export interface CreateSkillPackageSourceRefInput {
251
+ interface CreateSkillPackageSourceRefInput {
252
252
  assetsPath?: string;
253
253
  description: string;
254
254
  license?: string;
@@ -266,7 +266,7 @@ export interface CreateSkillPackageSourceRefInput {
266
266
  /**
267
267
  * Input used to build a manifest-ready module source ref.
268
268
  */
269
- export interface CreateModuleSourceRefInput {
269
+ interface CreateModuleSourceRefInput {
270
270
  exportName?: string;
271
271
  logicalPath: string;
272
272
  sourceId?: string;
@@ -274,7 +274,7 @@ export interface CreateModuleSourceRefInput {
274
274
  /**
275
275
  * Input used to build a manifest-ready local subagent source ref.
276
276
  */
277
- export interface CreateLocalSubagentSourceRefInput {
277
+ interface CreateLocalSubagentSourceRefInput {
278
278
  entryPath: string;
279
279
  logicalPath: string;
280
280
  manifest: AgentSourceManifest;
@@ -314,3 +314,4 @@ export declare function createLocalSubagentSourceRef(input: CreateLocalSubagentS
314
314
  * Creates a skill package source ref while omitting optional undefined fields.
315
315
  */
316
316
  export declare function createSkillPackageSourceRef(input: CreateSkillPackageSourceRefInput): NamedSkillDefinition & SkillPackageSourceRef;
317
+ export {};
@@ -1,7 +1,6 @@
1
1
  import { type DiscoverDiagnostic } from "#discover/diagnostics.js";
2
2
  import type { MemorySourceRef } from "#discover/manifest.js";
3
3
  import type { ProjectSource, ProjectSourceEntry } from "#discover/project-source.js";
4
- export declare const DISCOVER_MEMORY_DIRECTORY_INVALID = "discover/memory-directory-invalid";
5
4
  export declare const DISCOVER_MEMORY_SLOT_AMBIGUOUS = "discover/memory-slot-ambiguous";
6
5
  export declare const DISCOVER_MEMORY_NAME_INVALID = "discover/memory-name-invalid";
7
6
  export declare function discoverMemorySources(input: {
@@ -1 +1 @@
1
- import{join}from"node:path";import{matchesSupportedModuleBaseName,stripLogicalPathExtension}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{TOOL_SLUG_PATTERN,discoverFlatModuleSource}from"#discover/grammar.js";import{discoverNamedSourceDirectory as discoverNamedSourceDirectory$1}from"#discover/named-source-directory.js";const DISCOVER_MEMORY_DIRECTORY_INVALID=`discover/memory-directory-invalid`,DISCOVER_MEMORY_SLOT_AMBIGUOUS=`discover/memory-slot-ambiguous`,DISCOVER_MEMORY_NAME_INVALID=`discover/memory-name-invalid`;async function discoverMemorySources(e){let t=discoverFlatModuleSource({rootEntries:e.rootEntries,rootPath:e.rootPath,slotName:`memory`}),n=e.rootEntries.some(e=>e.isFile()&&matchesSupportedModuleBaseName(e.name,`memory`)),r=e.rootEntries.some(e=>e.name===`memory`&&e.isDirectory()),i=await discoverNamedSourceDirectory$1({directoryName:`memory`,invalidDirectoryCode:DISCOVER_MEMORY_DIRECTORY_INVALID,invalidDirectoryMessage:`Expected "${join(e.rootPath,`memory`)}" to be a directory of authored memory slots.`,recursive:!1,rootEntries:e.rootEntries,rootPath:e.rootPath,source:e.source,validateSegment:createMemoryNameDiagnostic});return n&&r?{diagnostics:[...t.diagnostics,...i.diagnostics,createDiscoverErrorDiagnostic({code:DISCOVER_MEMORY_SLOT_AMBIGUOUS,message:`Memory must use either the flat "memory.ts" form or the named "memory/" directory form, not both.`,sourcePath:e.rootPath})],memories:[]}:t.module===void 0?{diagnostics:[...t.diagnostics,...i.diagnostics],memories:i.sources.map(e=>({...e,slot:stripLogicalPathExtension(e.logicalPath).slice(7)}))}:{diagnostics:[...t.diagnostics,...i.diagnostics],memories:[{...t.module,slot:`memory`}]}}function createMemoryNameDiagnostic(e,t){return TOOL_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_MEMORY_NAME_INVALID,message:`Memory slot "${e}" must start with an ASCII letter and contain only letters, digits, underscores, or dashes (64 characters maximum).`,sourcePath:t})}export{DISCOVER_MEMORY_DIRECTORY_INVALID,DISCOVER_MEMORY_NAME_INVALID,DISCOVER_MEMORY_SLOT_AMBIGUOUS,discoverMemorySources};
1
+ import{join}from"node:path";import{matchesSupportedModuleBaseName,stripLogicalPathExtension}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{TOOL_SLUG_PATTERN,discoverFlatModuleSource}from"#discover/grammar.js";import{discoverNamedSourceDirectory as discoverNamedSourceDirectory$1}from"#discover/named-source-directory.js";const DISCOVER_MEMORY_SLOT_AMBIGUOUS=`discover/memory-slot-ambiguous`,DISCOVER_MEMORY_NAME_INVALID=`discover/memory-name-invalid`;async function discoverMemorySources(e){let t=discoverFlatModuleSource({rootEntries:e.rootEntries,rootPath:e.rootPath,slotName:`memory`}),n=e.rootEntries.some(e=>e.isFile()&&matchesSupportedModuleBaseName(e.name,`memory`)),r=e.rootEntries.some(e=>e.name===`memory`&&e.isDirectory()),i=await discoverNamedSourceDirectory$1({directoryName:`memory`,invalidDirectoryCode:`discover/memory-directory-invalid`,invalidDirectoryMessage:`Expected "${join(e.rootPath,`memory`)}" to be a directory of authored memory slots.`,recursive:!1,rootEntries:e.rootEntries,rootPath:e.rootPath,source:e.source,validateSegment:createMemoryNameDiagnostic});return n&&r?{diagnostics:[...t.diagnostics,...i.diagnostics,createDiscoverErrorDiagnostic({code:DISCOVER_MEMORY_SLOT_AMBIGUOUS,message:`Memory must use either the flat "memory.ts" form or the named "memory/" directory form, not both.`,sourcePath:e.rootPath})],memories:[]}:t.module===void 0?{diagnostics:[...t.diagnostics,...i.diagnostics],memories:i.sources.map(e=>({...e,slot:stripLogicalPathExtension(e.logicalPath).slice(7)}))}:{diagnostics:[...t.diagnostics,...i.diagnostics],memories:[{...t.module,slot:`memory`}]}}function createMemoryNameDiagnostic(e,t){return TOOL_SLUG_PATTERN.test(e)?null:createDiscoverErrorDiagnostic({code:DISCOVER_MEMORY_NAME_INVALID,message:`Memory slot "${e}" must start with an ASCII letter and contain only letters, digits, underscores, or dashes (64 characters maximum).`,sourcePath:t})}export{DISCOVER_MEMORY_NAME_INVALID,DISCOVER_MEMORY_SLOT_AMBIGUOUS,discoverMemorySources};
@@ -1 +1 @@
1
- import{join}from"node:path";import{getDirectoryEntryType,getSupportedModuleBaseName,isTypeScriptDeclarationFileName,normalizeLogicalPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{createModuleSourceRef}from"#discover/manifest.js";import{createModuleSlotCollisionDiagnostic,createSlotCollisionDiagnostic,readSortedDirectoryEntries}from"#discover/grammar.js";import{collectNamedSlotCandidates}from"#discover/slots.js";import{discoverMarkdownSource}from"#discover/markdown.js";async function discoverNamedSourceDirectory(e){let t=join(e.rootPath,e.directoryName),n=e.rootEntries.find(t=>t.name===e.directoryName);if(n===void 0)return{diagnostics:[],sources:[]};if(!n.isDirectory())return{diagnostics:[createDiscoverErrorDiagnostic({code:e.invalidDirectoryCode,message:e.invalidDirectoryMessage,sourcePath:t})],sources:[]};let r=[],i=[];return await walkNamedSourceDirectory({allowMarkdown:e.allowMarkdown===!0,diagnostics:r,markdownLowerer:e.allowMarkdown===!0?e.markdownLowerer:void 0,projectSource:e.source,recursive:e.recursive,relativeDirectory:e.directoryName,rootDirectoryPath:t,sources:i,subdirectoryRelative:``,unsupportedEntryCode:e.unsupportedEntryCode,unsupportedEntryMessage:e.unsupportedEntryMessage,unsupportedFileCode:e.unsupportedFileCode,unsupportedFileMessage:e.unsupportedFileMessage,validateSegment:e.validateSegment}),{diagnostics:r,sources:i}}async function walkNamedSourceDirectory(e){let t=e.subdirectoryRelative===``?e.rootDirectoryPath:join(e.rootDirectoryPath,e.subdirectoryRelative),n=await readSortedDirectoryEntries(e.projectSource,t);e.recursive&&await walkSubdirectories(e,n,t),(e.unsupportedFileCode!==void 0||e.unsupportedEntryCode!==void 0)&&emitUnsupportedLeafDiagnostics(e,n,t),await collectLeafSources(e,n,t)}async function walkSubdirectories(e,t,n){for(let r of t){if(!r.isDirectory())continue;let t=join(n,r.name);if(e.validateSegment!==void 0){let n=e.validateSegment(r.name,t);if(n!==null){e.diagnostics.push(n);continue}}await walkNamedSourceDirectory({allowMarkdown:e.allowMarkdown,diagnostics:e.diagnostics,markdownLowerer:e.markdownLowerer,projectSource:e.projectSource,recursive:e.recursive,relativeDirectory:e.relativeDirectory,rootDirectoryPath:e.rootDirectoryPath,sources:e.sources,subdirectoryRelative:e.subdirectoryRelative===``?r.name:join(e.subdirectoryRelative,r.name),unsupportedEntryCode:e.unsupportedEntryCode,unsupportedEntryMessage:e.unsupportedEntryMessage,unsupportedFileCode:e.unsupportedFileCode,unsupportedFileMessage:e.unsupportedFileMessage,validateSegment:e.validateSegment})}}function emitUnsupportedLeafDiagnostics(e,t,n){for(let r of t){let t=getDirectoryEntryType(r),i=join(n,r.name);if(t===`directory`)continue;if(t===`other`){e.unsupportedEntryCode!==void 0&&e.diagnostics.push(createDiscoverErrorDiagnostic({code:e.unsupportedEntryCode,message:e.unsupportedEntryMessage?.(i,e.relativeDirectory)??`Expected "${i}" to be a regular file or directory within "${e.relativeDirectory}/".`,sourcePath:i}));continue}if(e.unsupportedFileCode===void 0||isTypeScriptDeclarationFileName(r.name))continue;let a=getSupportedModuleBaseName(r.name)!==null,o=e.allowMarkdown&&r.name.endsWith(`.md`);a||o||e.diagnostics.push(createDiscoverErrorDiagnostic({code:e.unsupportedFileCode,message:e.unsupportedFileMessage?.(i,e.relativeDirectory)??`Expected "${i}" to be a supported authored source within "${e.relativeDirectory}/".`,sourcePath:i}))}}async function collectLeafSources(e,t,n){for(let r of collectNamedSlotCandidates(t,{allowMarkdown:e.allowMarkdown,allowModules:!0})){let t=e.subdirectoryRelative===``?r.slotName:join(e.subdirectoryRelative,r.slotName),i=normalizeLogicalPath(join(e.relativeDirectory,t));if(e.validateSegment!==void 0){let t=r.markdownFileName??r.moduleFileNames[0]??r.slotName,i=e.validateSegment(r.slotName,join(n,t));if(i!==null){e.diagnostics.push(i);continue}}if(r.markdownFileName!==void 0&&r.moduleFileNames.length>0){e.diagnostics.push(createSlotCollisionDiagnostic(n,i,[r.markdownFileName,...r.moduleFileNames]));continue}if(r.moduleFileNames.length>1){e.diagnostics.push(createModuleSlotCollisionDiagnostic(n,i,r.moduleFileNames));continue}if(r.markdownFileName!==void 0){let t=e.subdirectoryRelative===``?r.markdownFileName:join(e.subdirectoryRelative,r.markdownFileName),n=normalizeLogicalPath(join(e.relativeDirectory,t));if(e.markdownLowerer===void 0)continue;let i=await discoverMarkdownSource({logicalPath:n,lower:e.markdownLowerer,source:e.projectSource,sourcePath:join(e.rootDirectoryPath,t)});e.sources.push(i);continue}let[a]=r.moduleFileNames;if(a===void 0)continue;let o=e.subdirectoryRelative===``?a:join(e.subdirectoryRelative,a);e.sources.push(createModuleSourceRef({logicalPath:normalizeLogicalPath(join(e.relativeDirectory,o))}))}}export{discoverNamedSourceDirectory};
1
+ import{join}from"node:path";import{getDirectoryEntryType,getSupportedModuleBaseName,isTypeScriptDeclarationFileName,normalizeLogicalPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{createModuleSlotCollisionDiagnostic,createSlotCollisionDiagnostic,readSortedDirectoryEntries}from"#discover/grammar.js";import{createModuleSourceRef}from"#discover/manifest.js";import{collectNamedSlotCandidates}from"#discover/slots.js";import{discoverMarkdownSource}from"#discover/markdown.js";async function discoverNamedSourceDirectory(e){let t=join(e.rootPath,e.directoryName),n=e.rootEntries.find(t=>t.name===e.directoryName);if(n===void 0)return{diagnostics:[],sources:[]};if(!n.isDirectory())return{diagnostics:[createDiscoverErrorDiagnostic({code:e.invalidDirectoryCode,message:e.invalidDirectoryMessage,sourcePath:t})],sources:[]};let r=[],i=[];return await walkNamedSourceDirectory({allowMarkdown:e.allowMarkdown===!0,diagnostics:r,markdownLowerer:e.allowMarkdown===!0?e.markdownLowerer:void 0,projectSource:e.source,recursive:e.recursive,relativeDirectory:e.directoryName,rootDirectoryPath:t,sources:i,subdirectoryRelative:``,unsupportedEntryCode:e.unsupportedEntryCode,unsupportedEntryMessage:e.unsupportedEntryMessage,unsupportedFileCode:e.unsupportedFileCode,unsupportedFileMessage:e.unsupportedFileMessage,validateSegment:e.validateSegment}),{diagnostics:r,sources:i}}async function walkNamedSourceDirectory(e){let t=e.subdirectoryRelative===``?e.rootDirectoryPath:join(e.rootDirectoryPath,e.subdirectoryRelative),n=await readSortedDirectoryEntries(e.projectSource,t);e.recursive&&await walkSubdirectories(e,n,t),(e.unsupportedFileCode!==void 0||e.unsupportedEntryCode!==void 0)&&emitUnsupportedLeafDiagnostics(e,n,t),await collectLeafSources(e,n,t)}async function walkSubdirectories(e,t,n){for(let r of t){if(!r.isDirectory())continue;let t=join(n,r.name);if(e.validateSegment!==void 0){let n=e.validateSegment(r.name,t);if(n!==null){e.diagnostics.push(n);continue}}await walkNamedSourceDirectory({allowMarkdown:e.allowMarkdown,diagnostics:e.diagnostics,markdownLowerer:e.markdownLowerer,projectSource:e.projectSource,recursive:e.recursive,relativeDirectory:e.relativeDirectory,rootDirectoryPath:e.rootDirectoryPath,sources:e.sources,subdirectoryRelative:e.subdirectoryRelative===``?r.name:join(e.subdirectoryRelative,r.name),unsupportedEntryCode:e.unsupportedEntryCode,unsupportedEntryMessage:e.unsupportedEntryMessage,unsupportedFileCode:e.unsupportedFileCode,unsupportedFileMessage:e.unsupportedFileMessage,validateSegment:e.validateSegment})}}function emitUnsupportedLeafDiagnostics(e,t,n){for(let r of t){let t=getDirectoryEntryType(r),i=join(n,r.name);if(t===`directory`)continue;if(t===`other`){e.unsupportedEntryCode!==void 0&&e.diagnostics.push(createDiscoverErrorDiagnostic({code:e.unsupportedEntryCode,message:e.unsupportedEntryMessage?.(i,e.relativeDirectory)??`Expected "${i}" to be a regular file or directory within "${e.relativeDirectory}/".`,sourcePath:i}));continue}if(e.unsupportedFileCode===void 0||isTypeScriptDeclarationFileName(r.name))continue;let a=getSupportedModuleBaseName(r.name)!==null,o=e.allowMarkdown&&r.name.endsWith(`.md`);a||o||e.diagnostics.push(createDiscoverErrorDiagnostic({code:e.unsupportedFileCode,message:e.unsupportedFileMessage?.(i,e.relativeDirectory)??`Expected "${i}" to be a supported authored source within "${e.relativeDirectory}/".`,sourcePath:i}))}}async function collectLeafSources(e,t,n){for(let r of collectNamedSlotCandidates(t,{allowMarkdown:e.allowMarkdown,allowModules:!0})){let t=e.subdirectoryRelative===``?r.slotName:join(e.subdirectoryRelative,r.slotName),i=normalizeLogicalPath(join(e.relativeDirectory,t));if(e.validateSegment!==void 0){let t=r.markdownFileName??r.moduleFileNames[0]??r.slotName,i=e.validateSegment(r.slotName,join(n,t));if(i!==null){e.diagnostics.push(i);continue}}if(r.markdownFileName!==void 0&&r.moduleFileNames.length>0){e.diagnostics.push(createSlotCollisionDiagnostic(n,i,[r.markdownFileName,...r.moduleFileNames]));continue}if(r.moduleFileNames.length>1){e.diagnostics.push(createModuleSlotCollisionDiagnostic(n,i,r.moduleFileNames));continue}if(r.markdownFileName!==void 0){let t=e.subdirectoryRelative===``?r.markdownFileName:join(e.subdirectoryRelative,r.markdownFileName),n=normalizeLogicalPath(join(e.relativeDirectory,t));if(e.markdownLowerer===void 0)continue;let i=await discoverMarkdownSource({logicalPath:n,lower:e.markdownLowerer,source:e.projectSource,sourcePath:join(e.rootDirectoryPath,t)});e.sources.push(i);continue}let[a]=r.moduleFileNames;if(a===void 0)continue;let o=e.subdirectoryRelative===``?a:join(e.subdirectoryRelative,a);e.sources.push(createModuleSourceRef({logicalPath:normalizeLogicalPath(join(e.relativeDirectory,o))}))}}export{discoverNamedSourceDirectory};
@@ -70,7 +70,7 @@ export declare function createDiskProjectSource(): ProjectSource;
70
70
  *
71
71
  * Keys are paths; values are UTF-8 text or `{ content }` records.
72
72
  */
73
- export interface MemoryProjectSourceInput {
73
+ interface MemoryProjectSourceInput {
74
74
  /**
75
75
  * Optional root hint used only for diagnostics. The source itself accepts
76
76
  * reads against any path — unrelated absolute paths simply resolve as
@@ -105,3 +105,4 @@ export interface MemoryProjectSourceInput {
105
105
  * enough for all discovery code paths.
106
106
  */
107
107
  export declare function createMemoryProjectSource(input: MemoryProjectSourceInput): ProjectSource;
108
+ export {};
@@ -1 +1 @@
1
- import{basename,dirname,join,resolve}from"node:path";import{findEveProjectContext}from"#internal/project-context.js";import{getDirectoryEntryType,isDiscoverableAgentRootEntry,isProjectMarkerEntry}from"#discover/filesystem.js";import{DISCOVER_PROJECT_NOT_FOUND,createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{createDiskProjectSource}from"#discover/project-source.js";var DiscoveryProjectResolutionError=class extends Error{diagnostic;constructor(e){super(e.message),this.name=`DiscoveryProjectResolutionError`,this.diagnostic=e}};async function resolveDiscoveryProject(e=process.cwd(),t={}){let n=t.source??createDiskProjectSource(),r=await resolveSearchDirectory(n,e),i=r;for(;;){let e=await tryResolveNestedProjectFromAgentDirectory(n,i);if(e!==null)return e;let t=await tryResolveNestedProjectFromAppRoot(n,i);if(t!==null)return t;if(await isFlatAgentRoot(n,i))return{agentRoot:i,appRoot:i,layout:`flat`};let r=dirname(i);if(r===i)break;i=r}throw new DiscoveryProjectResolutionError(createDiscoverErrorDiagnostic({code:DISCOVER_PROJECT_NOT_FOUND,message:`Could not resolve an eve agent root from "${r}".`,sourcePath:r}))}async function resolveSearchDirectory(e,t){let n=resolve(t);return await e.stat(n)===`directory`?n:dirname(n)}async function tryResolveNestedProjectFromAgentDirectory(e,t){if(basename(t)!==`agent`||await hasProjectMarkers(e,t))return null;let n=dirname(t);return await isNestedProjectRoot(e,n)?{agentRoot:t,appRoot:n,layout:`nested`}:null}async function tryResolveNestedProjectFromAppRoot(e,t){if(!await isNestedProjectRoot(e,t))return null;let n=join(t,`agent`);return await directoryExists(e,n)?{agentRoot:n,appRoot:t,layout:`nested`}:null}async function isNestedProjectRoot(e,t){if(await hasProjectMarkers(e,t))return!0;let n=await findEveProjectContext(t,{source:e});return n?.kind===`workspace-member`&&n.member.appRoot===t}async function isFlatAgentRoot(e,t){let n=await readDirectoryEntryTypes(e,t);return Array.from(n.entries()).some(([e,t])=>isDiscoverableAgentRootEntry(e,t))}async function hasProjectMarkers(e,t){let n=await readDirectoryEntryTypes(e,t);return Array.from(n.entries()).some(([e,t])=>isProjectMarkerEntry(e,t))}async function readDirectoryEntryTypes(e,t){if(await e.stat(t)!==`directory`)return new Map;let n=await e.readDirectory(t);return new Map(n.map(e=>[e.name,getDirectoryEntryType(e)]))}async function directoryExists(e,t){return await e.stat(t)===`directory`}export{DiscoveryProjectResolutionError,resolveDiscoveryProject};
1
+ import{basename,dirname,join,resolve}from"node:path";import{findEveProjectContext}from"#internal/project-context.js";import{getDirectoryEntryType,isDiscoverableAgentRootEntry,isProjectMarkerEntry}from"#discover/filesystem.js";import{createDiskProjectSource}from"#discover/project-source.js";import{DISCOVER_PROJECT_NOT_FOUND,createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";var DiscoveryProjectResolutionError=class extends Error{diagnostic;constructor(e){super(e.message),this.name=`DiscoveryProjectResolutionError`,this.diagnostic=e}};async function resolveDiscoveryProject(e=process.cwd(),t={}){let n=t.source??createDiskProjectSource(),r=await resolveSearchDirectory(n,e),i=r;for(;;){let e=await tryResolveNestedProjectFromAgentDirectory(n,i);if(e!==null)return e;let t=await tryResolveNestedProjectFromAppRoot(n,i);if(t!==null)return t;if(await isFlatAgentRoot(n,i))return{agentRoot:i,appRoot:i,layout:`flat`};let r=dirname(i);if(r===i)break;i=r}throw new DiscoveryProjectResolutionError(createDiscoverErrorDiagnostic({code:DISCOVER_PROJECT_NOT_FOUND,message:`Could not resolve an eve agent root from "${r}".`,sourcePath:r}))}async function resolveSearchDirectory(e,t){let n=resolve(t);return await e.stat(n)===`directory`?n:dirname(n)}async function tryResolveNestedProjectFromAgentDirectory(e,t){if(basename(t)!==`agent`||await hasProjectMarkers(e,t))return null;let n=dirname(t);return await isNestedProjectRoot(e,n)?{agentRoot:t,appRoot:n,layout:`nested`}:null}async function tryResolveNestedProjectFromAppRoot(e,t){if(!await isNestedProjectRoot(e,t))return null;let n=join(t,`agent`);return await directoryExists(e,n)?{agentRoot:n,appRoot:t,layout:`nested`}:null}async function isNestedProjectRoot(e,t){if(await hasProjectMarkers(e,t))return!0;let n=await findEveProjectContext(t,{source:e});return n?.kind===`workspace-member`&&n.member.appRoot===t}async function isFlatAgentRoot(e,t){let n=await readDirectoryEntryTypes(e,t);return Array.from(n.entries()).some(([e,t])=>isDiscoverableAgentRootEntry(e,t))}async function hasProjectMarkers(e,t){let n=await readDirectoryEntryTypes(e,t);return Array.from(n.entries()).some(([e,t])=>isProjectMarkerEntry(e,t))}async function readDirectoryEntryTypes(e,t){if(await e.stat(t)!==`directory`)return new Map;let n=await e.readDirectory(t);return new Map(n.map(e=>[e.name,getDirectoryEntryType(e)]))}async function directoryExists(e,t){return await e.stat(t)===`directory`}export{DiscoveryProjectResolutionError,resolveDiscoveryProject};
@@ -1 +1 @@
1
- import{join}from"node:path";import{normalizeLogicalPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{createModuleSourceRef,createPathDerivedSourceId}from"#discover/manifest.js";import{DISCOVER_MODULE_SLOT_COLLISION,DISCOVER_SANDBOX_DIRECTORY_INVALID,readSortedDirectoryEntries}from"#discover/grammar.js";import{collectFlatSlotCandidates,collectNamedSlotCandidates}from"#discover/slots.js";const SANDBOX_DIRECTORY_NAME=`sandbox`,SANDBOX_WORKSPACE_DIRECTORY_NAME=`workspace`,SANDBOX_DEFINITION_BASE_NAME=`sandbox`,DISCOVER_SANDBOX_FOLDER_EMPTY=`discover/sandbox-folder-empty`;async function discoverSandboxSource(e){let t=[],n=e.rootEntries.find(e=>e.name===SANDBOX_DIRECTORY_NAME);if(n===void 0)return discoverRootSandboxModule({diagnostics:t,rootEntries:e.rootEntries,rootPath:e.rootPath});let r=join(e.rootPath,SANDBOX_DIRECTORY_NAME);if(!n.isDirectory())return t.push(createDiscoverErrorDiagnostic({code:DISCOVER_SANDBOX_DIRECTORY_INVALID,message:`Expected "${r}" to be the sandbox folder.`,sourcePath:r})),{diagnostics:t,sandbox:null,sandboxWorkspace:null};let i=await readSortedDirectoryEntries(e.source,r),a=collectFolderSandboxModuleCandidates(i),o=i.find(e=>e.name===SANDBOX_WORKSPACE_DIRECTORY_NAME&&e.isDirectory()),s=i.some(e=>e.name===`Dockerfile`&&e.isFile());if(a.length>1)return t.push(createDiscoverErrorDiagnostic({code:DISCOVER_MODULE_SLOT_COLLISION,message:`Found multiple sandbox definition modules inside "${normalizeLogicalPath(SANDBOX_DIRECTORY_NAME)}": `+a.map(e=>`"${e}"`).join(`, `),sourcePath:r})),{diagnostics:t,sandbox:null,sandboxWorkspace:null};let[c]=a,l=c!==void 0,u=o!==void 0;if(!l&&!u&&!s)return t.push(createDiscoverErrorDiagnostic({code:DISCOVER_SANDBOX_FOLDER_EMPTY,message:`Sandbox folder "sandbox/" contains no "Dockerfile", "sandbox.<ext>" definition, or "workspace/" subdirectory. Add one or remove the folder.`,sourcePath:r})),{diagnostics:t,sandbox:null,sandboxWorkspace:null};let d=null;l&&(d=createModuleSourceRef({logicalPath:join(SANDBOX_DIRECTORY_NAME,c)}));let f=null;if(u){let t=join(r,SANDBOX_WORKSPACE_DIRECTORY_NAME),n=normalizeLogicalPath(join(SANDBOX_DIRECTORY_NAME,SANDBOX_WORKSPACE_DIRECTORY_NAME));f={logicalPath:n,rootEntries:await collectWorkspaceRootEntries(e.source,t),sourceId:createPathDerivedSourceId(n),sourcePath:t}}return{diagnostics:t,sandbox:d,sandboxWorkspace:f}}function discoverRootSandboxModule(e){let t=collectFlatSlotCandidates(e.rootEntries,{moduleBaseName:SANDBOX_DEFINITION_BASE_NAME});if(t.moduleFileNames.length>1)return e.diagnostics.push(createDiscoverErrorDiagnostic({code:DISCOVER_MODULE_SLOT_COLLISION,message:`Found multiple top-level sandbox definition modules: `+t.moduleFileNames.map(e=>`"${e}"`).join(`, `),sourcePath:e.rootPath})),{diagnostics:e.diagnostics,sandbox:null,sandboxWorkspace:null};let[n]=t.moduleFileNames;return n===void 0?{diagnostics:e.diagnostics,sandbox:null,sandboxWorkspace:null}:{diagnostics:e.diagnostics,sandbox:createModuleSourceRef({logicalPath:n}),sandboxWorkspace:null}}function collectFolderSandboxModuleCandidates(e){let t=e.filter(e=>e.isFile()),n=[];for(let e of collectNamedSlotCandidates(t,{allowMarkdown:!1,allowModules:!0}))e.slotName===SANDBOX_DEFINITION_BASE_NAME&&n.push(...e.moduleFileNames);return n}async function collectWorkspaceRootEntries(e,t){let n=await readSortedDirectoryEntries(e,t,{includeTests:!0}),r=[];for(let e of n){if(e.isDirectory()){r.push(`${e.name}/`);continue}e.isFile()&&r.push(e.name)}return r}export{DISCOVER_SANDBOX_FOLDER_EMPTY,discoverSandboxSource};
1
+ import{join}from"node:path";import{normalizeLogicalPath}from"#discover/filesystem.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{DISCOVER_MODULE_SLOT_COLLISION,DISCOVER_SANDBOX_DIRECTORY_INVALID,readSortedDirectoryEntries}from"#discover/grammar.js";import{createModuleSourceRef,createPathDerivedSourceId}from"#discover/manifest.js";import{collectFlatSlotCandidates,collectNamedSlotCandidates}from"#discover/slots.js";const SANDBOX_DIRECTORY_NAME=`sandbox`,SANDBOX_WORKSPACE_DIRECTORY_NAME=`workspace`,SANDBOX_DEFINITION_BASE_NAME=`sandbox`,DISCOVER_SANDBOX_FOLDER_EMPTY=`discover/sandbox-folder-empty`;async function discoverSandboxSource(e){let t=[],n=e.rootEntries.find(e=>e.name===SANDBOX_DIRECTORY_NAME);if(n===void 0)return discoverRootSandboxModule({diagnostics:t,rootEntries:e.rootEntries,rootPath:e.rootPath});let r=join(e.rootPath,SANDBOX_DIRECTORY_NAME);if(!n.isDirectory())return t.push(createDiscoverErrorDiagnostic({code:DISCOVER_SANDBOX_DIRECTORY_INVALID,message:`Expected "${r}" to be the sandbox folder.`,sourcePath:r})),{diagnostics:t,sandbox:null,sandboxWorkspace:null};let i=await readSortedDirectoryEntries(e.source,r),a=collectFolderSandboxModuleCandidates(i),o=i.find(e=>e.name===SANDBOX_WORKSPACE_DIRECTORY_NAME&&e.isDirectory()),s=i.some(e=>e.name===`Dockerfile`&&e.isFile());if(a.length>1)return t.push(createDiscoverErrorDiagnostic({code:DISCOVER_MODULE_SLOT_COLLISION,message:`Found multiple sandbox definition modules inside "${normalizeLogicalPath(SANDBOX_DIRECTORY_NAME)}": `+a.map(e=>`"${e}"`).join(`, `),sourcePath:r})),{diagnostics:t,sandbox:null,sandboxWorkspace:null};let[c]=a,l=c!==void 0,u=o!==void 0;if(!l&&!u&&!s)return t.push(createDiscoverErrorDiagnostic({code:DISCOVER_SANDBOX_FOLDER_EMPTY,message:`Sandbox folder "sandbox/" contains no "Dockerfile", "sandbox.<ext>" definition, or "workspace/" subdirectory. Add one or remove the folder.`,sourcePath:r})),{diagnostics:t,sandbox:null,sandboxWorkspace:null};let d=null;l&&(d=createModuleSourceRef({logicalPath:join(SANDBOX_DIRECTORY_NAME,c)}));let f=null;if(u){let t=join(r,SANDBOX_WORKSPACE_DIRECTORY_NAME),n=normalizeLogicalPath(join(SANDBOX_DIRECTORY_NAME,SANDBOX_WORKSPACE_DIRECTORY_NAME));f={logicalPath:n,rootEntries:await collectWorkspaceRootEntries(e.source,t),sourceId:createPathDerivedSourceId(n),sourcePath:t}}return{diagnostics:t,sandbox:d,sandboxWorkspace:f}}function discoverRootSandboxModule(e){let t=collectFlatSlotCandidates(e.rootEntries,{moduleBaseName:SANDBOX_DEFINITION_BASE_NAME});if(t.moduleFileNames.length>1)return e.diagnostics.push(createDiscoverErrorDiagnostic({code:DISCOVER_MODULE_SLOT_COLLISION,message:`Found multiple top-level sandbox definition modules: `+t.moduleFileNames.map(e=>`"${e}"`).join(`, `),sourcePath:e.rootPath})),{diagnostics:e.diagnostics,sandbox:null,sandboxWorkspace:null};let[n]=t.moduleFileNames;return n===void 0?{diagnostics:e.diagnostics,sandbox:null,sandboxWorkspace:null}:{diagnostics:e.diagnostics,sandbox:createModuleSourceRef({logicalPath:n}),sandboxWorkspace:null}}function collectFolderSandboxModuleCandidates(e){let t=e.filter(e=>e.isFile()),n=[];for(let e of collectNamedSlotCandidates(t,{allowMarkdown:!1,allowModules:!0}))e.slotName===SANDBOX_DEFINITION_BASE_NAME&&n.push(...e.moduleFileNames);return n}async function collectWorkspaceRootEntries(e,t){let n=await readSortedDirectoryEntries(e,t,{includeTests:!0}),r=[];for(let e of n){if(e.isDirectory()){r.push(`${e.name}/`);continue}e.isFile()&&r.push(e.name)}return r}export{DISCOVER_SANDBOX_FOLDER_EMPTY,discoverSandboxSource};
@@ -1,10 +1,6 @@
1
1
  import { type DiscoverDiagnostic } from "#discover/diagnostics.js";
2
2
  import { type SkillSourceRef } from "#discover/manifest.js";
3
3
  import { type ProjectSource } from "#discover/project-source.js";
4
- /**
5
- * Diagnostics emitted by skill discovery.
6
- */
7
- export declare const DISCOVER_SKILLS_DIRECTORY_INVALID = "discover/skills-directory-invalid";
8
4
  export declare const DISCOVER_SKILL_COLLISION = "discover/skill-collision";
9
5
  export declare const DISCOVER_SKILL_ENTRY_NOT_DIRECTORY = "discover/skill-entry-not-directory";
10
6
  export declare const DISCOVER_SKILL_FRONTMATTER_INVALID = "discover/skill-frontmatter-invalid";
@@ -1 +1 @@
1
- import{join,relative,resolve}from"node:path";import{classifySkillPackageEntry,classifySkillsDirectoryEntry,getDirectoryEntryType,getSupportedModuleBaseName,normalizeLogicalPath}from"#discover/filesystem.js";import{toErrorMessage}from"#shared/errors.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{createDiskProjectSource}from"#discover/project-source.js";import{createModuleSourceRef,createPathDerivedSourceId,createSkillPackageSourceRef}from"#discover/manifest.js";import{readSortedDirectoryEntries}from"#discover/grammar.js";import{lowerSkillMarkdown}from"#internal/helpers/markdown.js";const DISCOVER_SKILLS_DIRECTORY_INVALID=`discover/skills-directory-invalid`,DISCOVER_SKILL_COLLISION=`discover/skill-collision`,DISCOVER_SKILL_ENTRY_NOT_DIRECTORY=`discover/skill-entry-not-directory`,DISCOVER_SKILL_FRONTMATTER_INVALID=`discover/skill-frontmatter-invalid`,DISCOVER_SKILL_MARKDOWN_MISSING=`discover/skill-markdown-missing`;async function discoverSkills(e){let t=e.source??createDiskProjectSource(),n=resolve(e.agentRoot),r=resolve(e.skillsDirectoryPath??join(n,`skills`)),i=normalizeLogicalPath(e.skillsLogicalPath??relative(n,r)),a=await t.stat(r);if(a===`missing`)return{diagnostics:[],skills:[]};if(a!==`directory`)return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SKILLS_DIRECTORY_INVALID,message:`Expected "${r}" to be a directory of authored skills.`,sourcePath:r})],skills:[]};let o=[],s=new Set,c=new Map,l=await readSortedDirectoryEntries(t,r);for(let e of l){let n=await discoverOneSkill({entryName:e.name,entryType:getDirectoryEntryType(e),skillsDirectoryPath:r,skillsLogicalPath:i,source:t});if(o.push(...n.diagnostics),n.skill===null||n.skillId===null||s.has(n.skillId))continue;let a=c.get(n.skillId);if(a!==void 0){o.push(createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_COLLISION,message:`Found conflicting authored skill sources for "${n.skillId}": "${a.logicalPath}" and "${n.logicalPath}".`,sourcePath:join(r,n.skillId)})),s.add(n.skillId),c.delete(n.skillId);continue}c.set(n.skillId,{logicalPath:n.logicalPath,skill:n.skill})}return{diagnostics:o,skills:[...c.values()].map(e=>e.skill)}}async function discoverOneSkill(e){let t=join(e.skillsDirectoryPath,e.entryName);switch(classifySkillsDirectoryEntry(e.entryName,e.entryType)){case`skill-package-directory`:return discoverPackagedSkill({logicalSkillsPath:e.skillsLogicalPath,skillId:e.entryName,skillRootPath:t,source:e.source});case`flat-skill-markdown`:return discoverFlatMarkdownSkill({logicalSkillsPath:e.skillsLogicalPath,skillFileName:e.entryName,skillFilePath:t,source:e.source});case`flat-skill-module`:return discoverFlatModuleSkill({logicalSkillsPath:e.skillsLogicalPath,skillFileName:e.entryName});case`ignored-declaration`:case`ignored-source-map`:return{diagnostics:[],logicalPath:normalizeLogicalPath(join(e.skillsLogicalPath,e.entryName)),skill:null,skillId:null};default:return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_ENTRY_NOT_DIRECTORY,message:`Expected "${t}" to be a skill directory containing SKILL.md or a flat ".md", ".ts", ".cts", ".mts", ".js", ".cjs", or ".mjs" skill file.`,sourcePath:t})],logicalPath:normalizeLogicalPath(join(e.skillsLogicalPath,e.entryName)),skill:null,skillId:null}}}async function discoverPackagedSkill(e){let t=(await readSortedDirectoryEntries(e.source,e.skillRootPath)).find(e=>e.isFile()&&e.name.toLowerCase()===`skill.md`)?.name,n=join(e.skillRootPath,t??`SKILL.md`),r=normalizeLogicalPath(join(e.logicalSkillsPath,e.skillId,t??`SKILL.md`));if(t===void 0)return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_MARKDOWN_MISSING,message:`Expected "${n}" to exist for the "${e.skillId}" skill.`,sourcePath:e.skillRootPath})],logicalPath:r,skill:null,skillId:null};let i;try{i=lowerSkillMarkdown(await e.source.readTextFile(n))}catch(e){return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_FRONTMATTER_INVALID,message:formatSkillDiscoveryError(n,e),sourcePath:n})],logicalPath:r,skill:null,skillId:null}}let a=await discoverSkillPackagePaths(e.source,e.skillRootPath),o={description:i.description,logicalPath:r,markdown:i.markdown,name:e.skillId,rootPath:e.skillRootPath,skillFilePath:n,skillId:e.skillId,sourceId:createPathDerivedSourceId(r)};return a.assetsPath!==void 0&&(o.assetsPath=a.assetsPath),i.license!==void 0&&(o.license=i.license),i.metadata!==void 0&&(o.metadata=i.metadata),a.referencesPath!==void 0&&(o.referencesPath=a.referencesPath),a.scriptsPath!==void 0&&(o.scriptsPath=a.scriptsPath),{diagnostics:[],logicalPath:r,skill:createSkillPackageSourceRef(o),skillId:e.skillId}}async function discoverFlatMarkdownSkill(e){let t=stripMarkdownExtension(e.skillFileName),n=normalizeLogicalPath(join(e.logicalSkillsPath,e.skillFileName)),r;try{r=lowerSkillMarkdown(await e.source.readTextFile(e.skillFilePath),{slug:t})}catch(t){return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_FRONTMATTER_INVALID,message:formatSkillDiscoveryError(e.skillFilePath,t),sourcePath:e.skillFilePath})],logicalPath:n,skill:null,skillId:null}}return{diagnostics:[],logicalPath:n,skill:{definition:r,sourceKind:`markdown`,logicalPath:n,sourceId:createPathDerivedSourceId(n)},skillId:t}}async function discoverFlatModuleSkill(e){let t=getSupportedModuleBaseName(e.skillFileName),n=normalizeLogicalPath(join(e.logicalSkillsPath,e.skillFileName));return t===null?{diagnostics:[],logicalPath:n,skill:null,skillId:null}:{diagnostics:[],logicalPath:n,skill:createModuleSourceRef({logicalPath:n}),skillId:t}}async function discoverSkillPackagePaths(e,t){let n=await e.readDirectory(t),r={};for(let e of n)if(e.isDirectory())switch(classifySkillPackageEntry(e.name,getDirectoryEntryType(e))){case`skill-assets-directory`:r.assetsPath=join(t,e.name);break;case`skill-references-directory`:r.referencesPath=join(t,e.name);break;case`skill-scripts-directory`:r.scriptsPath=join(t,e.name)}return r}function formatSkillDiscoveryError(e,t){return`Invalid authored skill frontmatter in "${e}": ${toErrorMessage(t)}`}function stripMarkdownExtension(e){return e.toLowerCase().endsWith(`.md`)?e.slice(0,-3):e}export{DISCOVER_SKILLS_DIRECTORY_INVALID,DISCOVER_SKILL_COLLISION,DISCOVER_SKILL_ENTRY_NOT_DIRECTORY,DISCOVER_SKILL_FRONTMATTER_INVALID,DISCOVER_SKILL_MARKDOWN_MISSING,discoverSkills};
1
+ import{join,relative,resolve}from"node:path";import{classifySkillPackageEntry,classifySkillsDirectoryEntry,getDirectoryEntryType,getSupportedModuleBaseName,normalizeLogicalPath}from"#discover/filesystem.js";import{toErrorMessage}from"#shared/errors.js";import{createDiskProjectSource}from"#discover/project-source.js";import{createDiscoverErrorDiagnostic}from"#discover/diagnostics.js";import{readSortedDirectoryEntries}from"#discover/grammar.js";import{createModuleSourceRef,createPathDerivedSourceId,createSkillPackageSourceRef}from"#discover/manifest.js";import{lowerSkillMarkdown}from"#internal/helpers/markdown.js";const DISCOVER_SKILL_COLLISION=`discover/skill-collision`,DISCOVER_SKILL_ENTRY_NOT_DIRECTORY=`discover/skill-entry-not-directory`,DISCOVER_SKILL_FRONTMATTER_INVALID=`discover/skill-frontmatter-invalid`,DISCOVER_SKILL_MARKDOWN_MISSING=`discover/skill-markdown-missing`;async function discoverSkills(e){let t=e.source??createDiskProjectSource(),n=resolve(e.agentRoot),r=resolve(e.skillsDirectoryPath??join(n,`skills`)),i=normalizeLogicalPath(e.skillsLogicalPath??relative(n,r)),a=await t.stat(r);if(a===`missing`)return{diagnostics:[],skills:[]};if(a!==`directory`)return{diagnostics:[createDiscoverErrorDiagnostic({code:`discover/skills-directory-invalid`,message:`Expected "${r}" to be a directory of authored skills.`,sourcePath:r})],skills:[]};let o=[],s=new Set,c=new Map,l=await readSortedDirectoryEntries(t,r);for(let e of l){let n=await discoverOneSkill({entryName:e.name,entryType:getDirectoryEntryType(e),skillsDirectoryPath:r,skillsLogicalPath:i,source:t});if(o.push(...n.diagnostics),n.skill===null||n.skillId===null||s.has(n.skillId))continue;let a=c.get(n.skillId);if(a!==void 0){o.push(createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_COLLISION,message:`Found conflicting authored skill sources for "${n.skillId}": "${a.logicalPath}" and "${n.logicalPath}".`,sourcePath:join(r,n.skillId)})),s.add(n.skillId),c.delete(n.skillId);continue}c.set(n.skillId,{logicalPath:n.logicalPath,skill:n.skill})}return{diagnostics:o,skills:[...c.values()].map(e=>e.skill)}}async function discoverOneSkill(e){let t=join(e.skillsDirectoryPath,e.entryName);switch(classifySkillsDirectoryEntry(e.entryName,e.entryType)){case`skill-package-directory`:return discoverPackagedSkill({logicalSkillsPath:e.skillsLogicalPath,skillId:e.entryName,skillRootPath:t,source:e.source});case`flat-skill-markdown`:return discoverFlatMarkdownSkill({logicalSkillsPath:e.skillsLogicalPath,skillFileName:e.entryName,skillFilePath:t,source:e.source});case`flat-skill-module`:return discoverFlatModuleSkill({logicalSkillsPath:e.skillsLogicalPath,skillFileName:e.entryName});case`ignored-declaration`:case`ignored-source-map`:return{diagnostics:[],logicalPath:normalizeLogicalPath(join(e.skillsLogicalPath,e.entryName)),skill:null,skillId:null};default:return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_ENTRY_NOT_DIRECTORY,message:`Expected "${t}" to be a skill directory containing SKILL.md or a flat ".md", ".ts", ".cts", ".mts", ".js", ".cjs", or ".mjs" skill file.`,sourcePath:t})],logicalPath:normalizeLogicalPath(join(e.skillsLogicalPath,e.entryName)),skill:null,skillId:null}}}async function discoverPackagedSkill(e){let t=(await readSortedDirectoryEntries(e.source,e.skillRootPath)).find(e=>e.isFile()&&e.name.toLowerCase()===`skill.md`)?.name,n=join(e.skillRootPath,t??`SKILL.md`),r=normalizeLogicalPath(join(e.logicalSkillsPath,e.skillId,t??`SKILL.md`));if(t===void 0)return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_MARKDOWN_MISSING,message:`Expected "${n}" to exist for the "${e.skillId}" skill.`,sourcePath:e.skillRootPath})],logicalPath:r,skill:null,skillId:null};let i;try{i=lowerSkillMarkdown(await e.source.readTextFile(n))}catch(e){return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_FRONTMATTER_INVALID,message:formatSkillDiscoveryError(n,e),sourcePath:n})],logicalPath:r,skill:null,skillId:null}}let a=await discoverSkillPackagePaths(e.source,e.skillRootPath),o={description:i.description,logicalPath:r,markdown:i.markdown,name:e.skillId,rootPath:e.skillRootPath,skillFilePath:n,skillId:e.skillId,sourceId:createPathDerivedSourceId(r)};return a.assetsPath!==void 0&&(o.assetsPath=a.assetsPath),i.license!==void 0&&(o.license=i.license),i.metadata!==void 0&&(o.metadata=i.metadata),a.referencesPath!==void 0&&(o.referencesPath=a.referencesPath),a.scriptsPath!==void 0&&(o.scriptsPath=a.scriptsPath),{diagnostics:[],logicalPath:r,skill:createSkillPackageSourceRef(o),skillId:e.skillId}}async function discoverFlatMarkdownSkill(e){let t=stripMarkdownExtension(e.skillFileName),n=normalizeLogicalPath(join(e.logicalSkillsPath,e.skillFileName)),r;try{r=lowerSkillMarkdown(await e.source.readTextFile(e.skillFilePath),{slug:t})}catch(t){return{diagnostics:[createDiscoverErrorDiagnostic({code:DISCOVER_SKILL_FRONTMATTER_INVALID,message:formatSkillDiscoveryError(e.skillFilePath,t),sourcePath:e.skillFilePath})],logicalPath:n,skill:null,skillId:null}}return{diagnostics:[],logicalPath:n,skill:{definition:r,sourceKind:`markdown`,logicalPath:n,sourceId:createPathDerivedSourceId(n)},skillId:t}}async function discoverFlatModuleSkill(e){let t=getSupportedModuleBaseName(e.skillFileName),n=normalizeLogicalPath(join(e.logicalSkillsPath,e.skillFileName));return t===null?{diagnostics:[],logicalPath:n,skill:null,skillId:null}:{diagnostics:[],logicalPath:n,skill:createModuleSourceRef({logicalPath:n}),skillId:t}}async function discoverSkillPackagePaths(e,t){let n=await e.readDirectory(t),r={};for(let e of n)if(e.isDirectory())switch(classifySkillPackageEntry(e.name,getDirectoryEntryType(e))){case`skill-assets-directory`:r.assetsPath=join(t,e.name);break;case`skill-references-directory`:r.referencesPath=join(t,e.name);break;case`skill-scripts-directory`:r.scriptsPath=join(t,e.name)}return r}function formatSkillDiscoveryError(e,t){return`Invalid authored skill frontmatter in "${e}": ${toErrorMessage(t)}`}function stripMarkdownExtension(e){return e.toLowerCase().endsWith(`.md`)?e.slice(0,-3):e}export{DISCOVER_SKILL_COLLISION,DISCOVER_SKILL_ENTRY_NOT_DIRECTORY,DISCOVER_SKILL_FRONTMATTER_INVALID,DISCOVER_SKILL_MARKDOWN_MISSING,discoverSkills};
@@ -8,7 +8,7 @@ import type { EveEvalTargetHandle } from "#evals/types.js";
8
8
  * Ambient Vercel credentials need the async {@link createEvalClient}.
9
9
  */
10
10
  export declare function resolveEvalClientOptions(target: Pick<EveEvalTargetHandle, "kind" | "url">): ClientOptions;
11
- export interface CreateEvalClientOptions {
11
+ interface CreateEvalClientOptions {
12
12
  /** Working directory for Vercel lookup and the fallback on-disk project link. */
13
13
  readonly workspaceRoot?: string;
14
14
  /** Test seams for the two authority-resolution boundaries. */
@@ -16,3 +16,4 @@ export interface CreateEvalClientOptions {
16
16
  }
17
17
  /** Creates one eval client, authorizing ambient Vercel credentials only after origin proof. */
18
18
  export declare function createEvalClient(target: Pick<EveEvalTargetHandle, "kind" | "url">, options?: CreateEvalClientOptions): Promise<Client>;
19
+ export {};