Skip to main content

harn_stdlib/
lib.rs

1//! Canonical embedded Harn standard library source catalog.
2//!
3//! This crate intentionally contains only static source strings so runtime and
4//! static tooling crates can share the same stdlib modules without depending on
5//! each other.
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub struct StdlibSource {
9    pub module: &'static str,
10    pub source: &'static str,
11}
12
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub struct StdlibPromptAsset {
15    pub path: &'static str,
16    pub source: &'static str,
17}
18
19#[derive(Debug, Clone, PartialEq, Eq)]
20pub struct StdlibPublicFunction {
21    pub name: String,
22    pub signature: String,
23    pub required_params: usize,
24    pub total_params: usize,
25    pub variadic: bool,
26    pub doc: Option<String>,
27}
28
29#[derive(Debug, Clone, PartialEq, Eq)]
30pub struct StdlibEntrypointModule {
31    pub import_path: String,
32    pub category: String,
33}
34
35pub const STDLIB_SOURCES: &[StdlibSource] = &[
36    StdlibSource {
37        module: "text",
38        source: include_str!("stdlib/stdlib_text.harn"),
39    },
40    StdlibSource {
41        module: "ansi",
42        source: include_str!("stdlib/stdlib_ansi.harn"),
43    },
44    StdlibSource {
45        module: "table",
46        source: include_str!("stdlib/stdlib_table.harn"),
47    },
48    StdlibSource {
49        module: "diff",
50        source: include_str!("stdlib/stdlib_diff.harn"),
51    },
52    StdlibSource {
53        module: "edit",
54        source: include_str!("stdlib/stdlib_edit.harn"),
55    },
56    StdlibSource {
57        module: "artifact/web",
58        source: include_str!("stdlib/artifact/web.harn"),
59    },
60    StdlibSource {
61        module: "collections",
62        source: include_str!("stdlib/stdlib_collections.harn"),
63    },
64    StdlibSource {
65        module: "math",
66        source: include_str!("stdlib/stdlib_math.harn"),
67    },
68    StdlibSource {
69        module: "path",
70        source: include_str!("stdlib/stdlib_path.harn"),
71    },
72    StdlibSource {
73        module: "fs",
74        source: include_str!("stdlib/stdlib_fs.harn"),
75    },
76    StdlibSource {
77        module: "run_artifacts",
78        source: include_str!("stdlib/stdlib_run_artifacts.harn"),
79    },
80    StdlibSource {
81        module: "os",
82        source: include_str!("stdlib/stdlib_os.harn"),
83    },
84    StdlibSource {
85        module: "json",
86        source: include_str!("stdlib/stdlib_json.harn"),
87    },
88    StdlibSource {
89        module: "json/stream",
90        source: include_str!("stdlib/stdlib_json_stream.harn"),
91    },
92    StdlibSource {
93        module: "cache",
94        source: include_str!("stdlib/stdlib_cache.harn"),
95    },
96    StdlibSource {
97        module: "observability",
98        source: include_str!("stdlib/stdlib_observability.harn"),
99    },
100    StdlibSource {
101        module: "timing",
102        source: include_str!("stdlib/stdlib_timing.harn"),
103    },
104    StdlibSource {
105        module: "tools",
106        source: include_str!("stdlib/stdlib_tools.harn"),
107    },
108    StdlibSource {
109        module: "composition",
110        source: include_str!("stdlib/stdlib_composition.harn"),
111    },
112    StdlibSource {
113        module: "web",
114        source: include_str!("stdlib/stdlib_web.harn"),
115    },
116    StdlibSource {
117        module: "graphql",
118        source: include_str!("stdlib/stdlib_graphql.harn"),
119    },
120    StdlibSource {
121        module: "schema",
122        source: include_str!("stdlib/stdlib_schema.harn"),
123    },
124    StdlibSource {
125        module: "testing",
126        source: include_str!("stdlib/stdlib_testing.harn"),
127    },
128    StdlibSource {
129        module: "files",
130        source: include_str!("stdlib/stdlib_files.harn"),
131    },
132    StdlibSource {
133        module: "mcp",
134        source: include_str!("stdlib/stdlib_mcp.harn"),
135    },
136    StdlibSource {
137        module: "vision",
138        source: include_str!("stdlib/stdlib_vision.harn"),
139    },
140    StdlibSource {
141        module: "context",
142        source: include_str!("stdlib/stdlib_context.harn"),
143    },
144    StdlibSource {
145        module: "context/maintenance",
146        source: include_str!("stdlib/context/maintenance.harn"),
147    },
148    StdlibSource {
149        module: "context/eval",
150        source: include_str!("stdlib/context/eval.harn"),
151    },
152    StdlibSource {
153        module: "runtime",
154        source: include_str!("stdlib/stdlib_runtime.harn"),
155    },
156    StdlibSource {
157        module: "io",
158        source: include_str!("stdlib/stdlib_io.harn"),
159    },
160    StdlibSource {
161        module: "command",
162        source: include_str!("stdlib/stdlib_command.harn"),
163    },
164    StdlibSource {
165        module: "signal",
166        source: include_str!("stdlib/stdlib_signal.harn"),
167    },
168    StdlibSource {
169        module: "net_policy",
170        source: include_str!("stdlib/stdlib_net_policy.harn"),
171    },
172    StdlibSource {
173        module: "review",
174        source: include_str!("stdlib/stdlib_review.harn"),
175    },
176    StdlibSource {
177        module: "experiments",
178        source: include_str!("stdlib/stdlib_experiments.harn"),
179    },
180    StdlibSource {
181        module: "project",
182        source: include_str!("stdlib/stdlib_project.harn"),
183    },
184    StdlibSource {
185        module: "prompt_library",
186        source: include_str!("stdlib/stdlib_prompt_library.harn"),
187    },
188    StdlibSource {
189        module: "async",
190        source: include_str!("stdlib/stdlib_async.harn"),
191    },
192    StdlibSource {
193        module: "poll",
194        source: include_str!("stdlib/stdlib_poll.harn"),
195    },
196    StdlibSource {
197        module: "coerce",
198        source: include_str!("stdlib/stdlib_coerce.harn"),
199    },
200    StdlibSource {
201        module: "settled",
202        source: include_str!("stdlib/stdlib_settled.harn"),
203    },
204    StdlibSource {
205        module: "cli",
206        source: include_str!("stdlib/stdlib_cli.harn"),
207    },
208    StdlibSource {
209        module: "cli/argparse",
210        source: include_str!("stdlib/cli/argparse.harn"),
211    },
212    StdlibSource {
213        module: "cli/render",
214        source: include_str!("stdlib/cli/render.harn"),
215    },
216    StdlibSource {
217        module: "cli/paths",
218        source: include_str!("stdlib/cli/paths.harn"),
219    },
220    StdlibSource {
221        module: "gha",
222        source: include_str!("stdlib/stdlib_gha.harn"),
223    },
224    StdlibSource {
225        module: "tui",
226        source: include_str!("stdlib/stdlib_tui.harn"),
227    },
228    StdlibSource {
229        module: "jsonl",
230        source: include_str!("stdlib/stdlib_jsonl.harn"),
231    },
232    StdlibSource {
233        module: "config",
234        source: include_str!("stdlib/stdlib_config.harn"),
235    },
236    StdlibSource {
237        module: "calendar",
238        source: include_str!("stdlib/stdlib_calendar.harn"),
239    },
240    StdlibSource {
241        module: "agents",
242        source: include_str!("stdlib/stdlib_agents.harn"),
243    },
244    StdlibSource {
245        module: "lifecycle/pool",
246        source: include_str!("stdlib/lifecycle/pool.harn"),
247    },
248    StdlibSource {
249        module: "lifecycle/combinators",
250        source: include_str!("stdlib/lifecycle/combinators.harn"),
251    },
252    StdlibSource {
253        module: "lifecycle/on_budget",
254        source: include_str!("stdlib/lifecycle/on_budget.harn"),
255    },
256    StdlibSource {
257        module: "agent/prompts",
258        source: include_str!("stdlib/agent/prompts.harn"),
259    },
260    StdlibSource {
261        module: "llm/media",
262        source: include_str!("stdlib/llm/media.harn"),
263    },
264    StdlibSource {
265        module: "llm/options",
266        source: include_str!("stdlib/llm/options.harn"),
267    },
268    StdlibSource {
269        module: "llm/catalog",
270        source: include_str!("stdlib/llm/catalog.harn"),
271    },
272    StdlibSource {
273        module: "llm/safe",
274        source: include_str!("stdlib/llm/safe.harn"),
275    },
276    StdlibSource {
277        module: "llm/budget",
278        source: include_str!("stdlib/llm/budget.harn"),
279    },
280    StdlibSource {
281        module: "llm/economics",
282        source: include_str!("stdlib/llm/economics.harn"),
283    },
284    StdlibSource {
285        module: "llm/prompts",
286        source: include_str!("stdlib/llm/prompts.harn"),
287    },
288    StdlibSource {
289        module: "llm/defaults",
290        source: include_str!("stdlib/llm/defaults.harn"),
291    },
292    StdlibSource {
293        module: "llm/handlers",
294        source: include_str!("stdlib/llm/handlers.harn"),
295    },
296    StdlibSource {
297        module: "llm/tool_telemetry",
298        source: include_str!("stdlib/llm/tool_telemetry.harn"),
299    },
300    StdlibSource {
301        module: "llm/tool_middleware",
302        source: include_str!("stdlib/llm/tool_middleware.harn"),
303    },
304    StdlibSource {
305        module: "llm/tool_binder",
306        source: include_str!("stdlib/llm/tool_binder.harn"),
307    },
308    StdlibSource {
309        module: "llm/structural_validator",
310        source: include_str!("stdlib/llm/structural_validator.harn"),
311    },
312    StdlibSource {
313        module: "llm/refine",
314        source: include_str!("stdlib/llm/refine.harn"),
315    },
316    StdlibSource {
317        module: "llm/ensemble",
318        source: include_str!("stdlib/llm/ensemble.harn"),
319    },
320    StdlibSource {
321        module: "llm/rerank",
322        source: include_str!("stdlib/llm/rerank.harn"),
323    },
324    StdlibSource {
325        module: "agent/reasoning",
326        source: include_str!("stdlib/agent/reasoning.harn"),
327    },
328    StdlibSource {
329        module: "agent/options",
330        source: include_str!("stdlib/agent/options.harn"),
331    },
332    StdlibSource {
333        module: "llm/judge",
334        source: include_str!("stdlib/llm/judge.harn"),
335    },
336    StdlibSource {
337        module: "llm/optimize",
338        source: include_str!("stdlib/llm/optimize.harn"),
339    },
340    StdlibSource {
341        module: "agent/events",
342        source: include_str!("stdlib/agent/events.harn"),
343    },
344    StdlibSource {
345        module: "agent/primitives",
346        source: include_str!("stdlib/agent/primitives.harn"),
347    },
348    StdlibSource {
349        module: "agent/progress",
350        source: include_str!("stdlib/agent/progress.harn"),
351    },
352    StdlibSource {
353        module: "agent/required_tools",
354        source: include_str!("stdlib/agent/required_tools.harn"),
355    },
356    StdlibSource {
357        module: "agent/stall",
358        source: include_str!("stdlib/agent/stall.harn"),
359    },
360    StdlibSource {
361        module: "agent/control",
362        source: include_str!("stdlib/agent/control.harn"),
363    },
364    StdlibSource {
365        module: "agent/loop",
366        source: include_str!("stdlib/agent/loop.harn"),
367    },
368    StdlibSource {
369        module: "agent/chat",
370        source: include_str!("stdlib/agent/chat.harn"),
371    },
372    StdlibSource {
373        module: "agent/user",
374        source: include_str!("stdlib/agent/user.harn"),
375    },
376    StdlibSource {
377        module: "agent/tool_search",
378        source: include_str!("stdlib/agent/tool_search.harn"),
379    },
380    StdlibSource {
381        module: "agent/turn",
382        source: include_str!("stdlib/agent/turn.harn"),
383    },
384    StdlibSource {
385        module: "agent/workers",
386        source: include_str!("stdlib/agent/workers.harn"),
387    },
388    StdlibSource {
389        module: "agent/introspection",
390        source: include_str!("stdlib/agent/introspection.harn"),
391    },
392    StdlibSource {
393        module: "agent/resume_by",
394        source: include_str!("stdlib/agent/resume_by.harn"),
395    },
396    StdlibSource {
397        module: "agent/state",
398        source: include_str!("stdlib/agent/state.harn"),
399    },
400    StdlibSource {
401        module: "agent/skills",
402        source: include_str!("stdlib/agent/skills.harn"),
403    },
404    StdlibSource {
405        module: "agent/autocompact",
406        source: include_str!("stdlib/agent/autocompact.harn"),
407    },
408    StdlibSource {
409        module: "agent/mcp",
410        source: include_str!("stdlib/agent/mcp.harn"),
411    },
412    StdlibSource {
413        module: "agent/host_tools",
414        source: include_str!("stdlib/agent/host_tools.harn"),
415    },
416    StdlibSource {
417        module: "agent/budget",
418        source: include_str!("stdlib/agent/budget.harn"),
419    },
420    StdlibSource {
421        module: "agent/daemon",
422        source: include_str!("stdlib/agent/daemon.harn"),
423    },
424    StdlibSource {
425        module: "agent/preflight",
426        source: include_str!("stdlib/agent/preflight.harn"),
427    },
428    StdlibSource {
429        module: "agent/postturn",
430        source: include_str!("stdlib/agent/postturn.harn"),
431    },
432    StdlibSource {
433        module: "agent/judge",
434        source: include_str!("stdlib/agent/judge.harn"),
435    },
436    StdlibSource {
437        module: "agent/step_judge",
438        source: include_str!("stdlib/agent/step_judge.harn"),
439    },
440    StdlibSource {
441        module: "agent/fact",
442        source: include_str!("stdlib/agent/fact.harn"),
443    },
444    StdlibSource {
445        module: "agent/probe",
446        source: include_str!("stdlib/agent/probe.harn"),
447    },
448    StdlibSource {
449        module: "agent/presets",
450        source: include_str!("stdlib/agent/presets.harn"),
451    },
452    StdlibSource {
453        module: "agent/task_plan",
454        source: include_str!("stdlib/agent/task_plan.harn"),
455    },
456    StdlibSource {
457        module: "agent_state",
458        source: include_str!("stdlib/stdlib_agent_state.harn"),
459    },
460    StdlibSource {
461        module: "memory",
462        source: include_str!("stdlib/stdlib_memory.harn"),
463    },
464    StdlibSource {
465        module: "postgres",
466        source: include_str!("stdlib/stdlib_postgres.harn"),
467    },
468    StdlibSource {
469        module: "checkpoint",
470        source: include_str!("stdlib/stdlib_checkpoint.harn"),
471    },
472    StdlibSource {
473        module: "host",
474        source: include_str!("stdlib/stdlib_host.harn"),
475    },
476    StdlibSource {
477        module: "git",
478        source: include_str!("stdlib/stdlib_git.harn"),
479    },
480    StdlibSource {
481        module: "hitl",
482        source: include_str!("stdlib/stdlib_hitl.harn"),
483    },
484    StdlibSource {
485        module: "trust",
486        source: include_str!("stdlib/stdlib_trust.harn"),
487    },
488    StdlibSource {
489        module: "corrections",
490        source: include_str!("stdlib/stdlib_corrections.harn"),
491    },
492    StdlibSource {
493        module: "plan",
494        source: include_str!("stdlib/stdlib_plan.harn"),
495    },
496    StdlibSource {
497        module: "waitpoints",
498        source: include_str!("stdlib/stdlib_waitpoints.harn"),
499    },
500    StdlibSource {
501        module: "waitpoint",
502        source: include_str!("stdlib/stdlib_waitpoint.harn"),
503    },
504    StdlibSource {
505        module: "monitors",
506        source: include_str!("stdlib/stdlib_monitors.harn"),
507    },
508    StdlibSource {
509        module: "worktree",
510        source: include_str!("stdlib/stdlib_worktree.harn"),
511    },
512    StdlibSource {
513        module: "acp",
514        source: include_str!("stdlib/stdlib_acp.harn"),
515    },
516    StdlibSource {
517        module: "triggers",
518        source: include_str!("stdlib/stdlib_triggers.harn"),
519    },
520    StdlibSource {
521        module: "triage",
522        source: include_str!("stdlib/stdlib_triage.harn"),
523    },
524    StdlibSource {
525        module: "dashboard/jobs",
526        source: include_str!("stdlib/dashboard/jobs.harn"),
527    },
528    StdlibSource {
529        module: "ui_resource",
530        source: include_str!("stdlib/stdlib_ui_resource.harn"),
531    },
532    StdlibSource {
533        module: "handoffs",
534        source: include_str!("stdlib/stdlib_handoffs.harn"),
535    },
536    StdlibSource {
537        module: "lifecycle",
538        source: include_str!("stdlib/stdlib_lifecycle.harn"),
539    },
540    StdlibSource {
541        module: "tool_hooks_catalogues",
542        source: include_str!("stdlib/stdlib_tool_hooks_catalogues.harn"),
543    },
544    StdlibSource {
545        module: "tool_hooks",
546        source: include_str!("stdlib/stdlib_tool_hooks.harn"),
547    },
548    StdlibSource {
549        module: "channel_guardrails",
550        source: include_str!("stdlib/stdlib_channel_guardrails.harn"),
551    },
552    StdlibSource {
553        module: "personas/prelude",
554        source: include_str!("stdlib/stdlib_personas_prelude.harn"),
555    },
556    StdlibSource {
557        module: "personas/bulletins",
558        source: include_str!("stdlib/stdlib_personas_bulletins.harn"),
559    },
560    StdlibSource {
561        module: "connectors/shared",
562        source: include_str!("stdlib/stdlib_connectors_shared.harn"),
563    },
564    StdlibSource {
565        module: "oauth/providers",
566        source: include_str!("stdlib/oauth/providers.harn"),
567    },
568    StdlibSource {
569        module: "oauth/storage",
570        source: include_str!("stdlib/oauth/storage.harn"),
571    },
572    StdlibSource {
573        module: "oauth/client",
574        source: include_str!("stdlib/oauth/client.harn"),
575    },
576    StdlibSource {
577        module: "oauth/device_flow",
578        source: include_str!("stdlib/oauth/device_flow.harn"),
579    },
580    StdlibSource {
581        module: "oauth/redaction",
582        source: include_str!("stdlib/oauth/redaction.harn"),
583    },
584    StdlibSource {
585        module: "oauth/dynamic_registration",
586        source: include_str!("stdlib/oauth/dynamic_registration.harn"),
587    },
588    StdlibSource {
589        module: "connectors/github",
590        source: include_str!("stdlib/stdlib_connectors_github.harn"),
591    },
592    StdlibSource {
593        module: "connectors/linear",
594        source: include_str!("stdlib/stdlib_connectors_linear.harn"),
595    },
596    StdlibSource {
597        module: "connectors/notion",
598        source: include_str!("stdlib/stdlib_connectors_notion.harn"),
599    },
600    StdlibSource {
601        module: "connectors/slack",
602        source: include_str!("stdlib/stdlib_connectors_slack.harn"),
603    },
604    StdlibSource {
605        module: "workflow/prompts",
606        source: include_str!("stdlib/workflow/prompts.harn"),
607    },
608    StdlibSource {
609        module: "workflow/context",
610        source: include_str!("stdlib/workflow/context.harn"),
611    },
612    StdlibSource {
613        module: "workflow/options",
614        source: include_str!("stdlib/workflow/options.harn"),
615    },
616    StdlibSource {
617        module: "workflow/checkpoints",
618        source: include_str!("stdlib/workflow/checkpoints.harn"),
619    },
620    StdlibSource {
621        module: "workflow/stage",
622        source: include_str!("stdlib/workflow/stage.harn"),
623    },
624    StdlibSource {
625        module: "workflow/map",
626        source: include_str!("stdlib/workflow/map.harn"),
627    },
628    StdlibSource {
629        module: "workflow/schedule",
630        source: include_str!("stdlib/workflow/schedule.harn"),
631    },
632    StdlibSource {
633        module: "workflow/execute",
634        source: include_str!("stdlib/workflow/execute.harn"),
635    },
636];
637
638pub const STDLIB_PROMPT_ASSETS: &[StdlibPromptAsset] = &[
639    StdlibPromptAsset {
640        path: "agent/prompts/tool_contract_text.harn.prompt",
641        source: include_str!("stdlib/agent/prompts/tool_contract_text.harn.prompt"),
642    },
643    StdlibPromptAsset {
644        path: "agent/prompts/tool_contract_native.harn.prompt",
645        source: include_str!("stdlib/agent/prompts/tool_contract_native.harn.prompt"),
646    },
647    StdlibPromptAsset {
648        path: "agent/prompts/tool_contract_text_response_protocol.harn.prompt",
649        source: include_str!(
650            "stdlib/agent/prompts/tool_contract_text_response_protocol.harn.prompt"
651        ),
652    },
653    StdlibPromptAsset {
654        path: "agent/prompts/tool_contract_action_native.harn.prompt",
655        source: include_str!("stdlib/agent/prompts/tool_contract_action_native.harn.prompt"),
656    },
657    StdlibPromptAsset {
658        path: "agent/prompts/tool_contract_action_text.harn.prompt",
659        source: include_str!("stdlib/agent/prompts/tool_contract_action_text.harn.prompt"),
660    },
661    StdlibPromptAsset {
662        path: "agent/prompts/tool_contract_task_ledger.harn.prompt",
663        source: include_str!("stdlib/agent/prompts/tool_contract_task_ledger.harn.prompt"),
664    },
665    StdlibPromptAsset {
666        path: "agent/prompts/tool_contract_deferred_tools.harn.prompt",
667        source: include_str!("stdlib/agent/prompts/tool_contract_deferred_tools.harn.prompt"),
668    },
669    StdlibPromptAsset {
670        path: "agent/prompts/deferred_tool_listing.harn.prompt",
671        source: include_str!("stdlib/agent/prompts/deferred_tool_listing.harn.prompt"),
672    },
673    StdlibPromptAsset {
674        path: "agent/prompts/action_turn_nudge.harn.prompt",
675        source: include_str!("stdlib/agent/prompts/action_turn_nudge.harn.prompt"),
676    },
677    StdlibPromptAsset {
678        path: "agent/prompts/agent_turn_preamble.harn.prompt",
679        source: include_str!("stdlib/agent/prompts/agent_turn_preamble.harn.prompt"),
680    },
681    StdlibPromptAsset {
682        path: "agent/prompts/default_nudge.harn.prompt",
683        source: include_str!("stdlib/agent/prompts/default_nudge.harn.prompt"),
684    },
685    StdlibPromptAsset {
686        path: "agent/prompts/agentic_user_system.harn.prompt",
687        source: include_str!("stdlib/agent/prompts/agentic_user_system.harn.prompt"),
688    },
689    StdlibPromptAsset {
690        path: "agent/prompts/agentic_user_user.harn.prompt",
691        source: include_str!("stdlib/agent/prompts/agentic_user_user.harn.prompt"),
692    },
693    StdlibPromptAsset {
694        path: "agent/prompts/loop_until_done_system.harn.prompt",
695        source: include_str!("stdlib/agent/prompts/loop_until_done_system.harn.prompt"),
696    },
697    StdlibPromptAsset {
698        path: "agent/prompts/completion_judge_default.harn.prompt",
699        source: include_str!("stdlib/agent/prompts/completion_judge_default.harn.prompt"),
700    },
701    StdlibPromptAsset {
702        path: "agent/prompts/completion_judge_feedback_fallback.harn.prompt",
703        source: include_str!("stdlib/agent/prompts/completion_judge_feedback_fallback.harn.prompt"),
704    },
705    StdlibPromptAsset {
706        path: "agent/prompts/completion_judge_user.harn.prompt",
707        source: include_str!("stdlib/agent/prompts/completion_judge_user.harn.prompt"),
708    },
709    StdlibPromptAsset {
710        path: "agent/prompts/step_judge_system_default.harn.prompt",
711        source: include_str!("stdlib/agent/prompts/step_judge_system_default.harn.prompt"),
712    },
713    StdlibPromptAsset {
714        path: "agent/prompts/step_judge_system_adversarial.harn.prompt",
715        source: include_str!("stdlib/agent/prompts/step_judge_system_adversarial.harn.prompt"),
716    },
717    StdlibPromptAsset {
718        path: "agent/prompts/step_judge_user.harn.prompt",
719        source: include_str!("stdlib/agent/prompts/step_judge_user.harn.prompt"),
720    },
721    StdlibPromptAsset {
722        path: "agent/prompts/parse_guidance.harn.prompt",
723        source: include_str!("stdlib/agent/prompts/parse_guidance.harn.prompt"),
724    },
725    StdlibPromptAsset {
726        path: "agent/prompts/protocol_violation_feedback.harn.prompt",
727        source: include_str!("stdlib/agent/prompts/protocol_violation_feedback.harn.prompt"),
728    },
729    StdlibPromptAsset {
730        path: "agent/prompts/native_tool_contract_feedback.harn.prompt",
731        source: include_str!("stdlib/agent/prompts/native_tool_contract_feedback.harn.prompt"),
732    },
733    StdlibPromptAsset {
734        path: "agent/prompts/verification_gate_feedback.harn.prompt",
735        source: include_str!("stdlib/agent/prompts/verification_gate_feedback.harn.prompt"),
736    },
737    StdlibPromptAsset {
738        path: "agent/prompts/action_required_feedback.harn.prompt",
739        source: include_str!("stdlib/agent/prompts/action_required_feedback.harn.prompt"),
740    },
741    StdlibPromptAsset {
742        path: "agent/prompts/daemon_watch_feedback.harn.prompt",
743        source: include_str!("stdlib/agent/prompts/daemon_watch_feedback.harn.prompt"),
744    },
745    StdlibPromptAsset {
746        path: "agent/prompts/daemon_timer_feedback.harn.prompt",
747        source: include_str!("stdlib/agent/prompts/daemon_timer_feedback.harn.prompt"),
748    },
749    StdlibPromptAsset {
750        path: "llm/prompts/completion_fallback_system.harn.prompt",
751        source: include_str!("stdlib/llm/prompts/completion_fallback_system.harn.prompt"),
752    },
753    StdlibPromptAsset {
754        path: "llm/prompts/completion_fallback_user.harn.prompt",
755        source: include_str!("stdlib/llm/prompts/completion_fallback_user.harn.prompt"),
756    },
757    StdlibPromptAsset {
758        path: "llm/prompts/transcript_summarize_user.harn.prompt",
759        source: include_str!("stdlib/llm/prompts/transcript_summarize_user.harn.prompt"),
760    },
761    StdlibPromptAsset {
762        path: "llm/prompts/structural_chain_of_draft.harn.prompt",
763        source: include_str!("stdlib/llm/prompts/structural_chain_of_draft.harn.prompt"),
764    },
765    StdlibPromptAsset {
766        path: "llm/prompts/schema_recover_repair.harn.prompt",
767        source: include_str!("stdlib/llm/prompts/schema_recover_repair.harn.prompt"),
768    },
769    StdlibPromptAsset {
770        path: "llm/prompts/structured_envelope_schema_contract.harn.prompt",
771        source: include_str!("stdlib/llm/prompts/structured_envelope_schema_contract.harn.prompt"),
772    },
773    StdlibPromptAsset {
774        path: "llm/prompts/structured_envelope_repair.harn.prompt",
775        source: include_str!("stdlib/llm/prompts/structured_envelope_repair.harn.prompt"),
776    },
777    StdlibPromptAsset {
778        path: "llm/prompts/pairwise_rerank_user.harn.prompt",
779        source: include_str!("stdlib/llm/prompts/pairwise_rerank_user.harn.prompt"),
780    },
781    StdlibPromptAsset {
782        path: "llm/prompts/tool_binder_user.harn.prompt",
783        source: include_str!("stdlib/llm/prompts/tool_binder_user.harn.prompt"),
784    },
785    StdlibPromptAsset {
786        path: "workflow/prompts/stage.harn.prompt",
787        source: include_str!("stdlib/workflow/prompts/stage.harn.prompt"),
788    },
789    StdlibPromptAsset {
790        path: "workflow/prompts/verification_context_intro.harn.prompt",
791        source: include_str!("stdlib/workflow/prompts/verification_context_intro.harn.prompt"),
792    },
793    StdlibPromptAsset {
794        path: "orchestration/prompts/compaction_summary.harn.prompt",
795        source: include_str!("stdlib/orchestration/prompts/compaction_summary.harn.prompt"),
796    },
797    StdlibPromptAsset {
798        path: "orchestration/prompts/compaction_policy_replacement.harn.prompt",
799        source: include_str!(
800            "stdlib/orchestration/prompts/compaction_policy_replacement.harn.prompt"
801        ),
802    },
803];
804
805/// Embedded `.harn` script that backs a CLI subcommand. Looked up by
806/// the `harn-cli` dispatch wedge (see harn#2293 epic and harn#2294 G1)
807/// so subcommands can ship in Harn instead of Rust.
808#[derive(Debug, Clone, Copy, PartialEq, Eq)]
809pub struct StdlibCliScript {
810    /// Lookup name. For nested scripts this is the path under
811    /// `stdlib/cli/` without the `.harn` extension (e.g. `"eval/prompt"`
812    /// for `stdlib/cli/eval/prompt.harn`).
813    pub name: &'static str,
814    /// Embedded source. Run via the existing `harn run` codepath by the
815    /// dispatch wedge.
816    pub source: &'static str,
817}
818
819pub const STDLIB_CLI_SCRIPTS: &[StdlibCliScript] = &[
820    StdlibCliScript {
821        name: "doctor",
822        source: include_str!("stdlib/cli/doctor.harn"),
823    },
824    StdlibCliScript {
825        name: "echo",
826        source: include_str!("stdlib/cli/echo.harn"),
827    },
828    // Helper module for the embedded `eval/*` scripts. Has a stub `main`
829    // that exits non-zero — sibling scripts inline its helpers until the
830    // dispatch wedge gains a cross-script import surface (#2300 / G7).
831    StdlibCliScript {
832        name: "eval/_runner",
833        source: include_str!("stdlib/cli/eval/_runner.harn"),
834    },
835    StdlibCliScript {
836        name: "eval/context",
837        source: include_str!("stdlib/cli/eval/context.harn"),
838    },
839    StdlibCliScript {
840        name: "eval/model_selector",
841        source: include_str!("stdlib/cli/eval/model_selector.harn"),
842    },
843    StdlibCliScript {
844        name: "eval/tool_calls",
845        source: include_str!("stdlib/cli/eval/tool_calls.harn"),
846    },
847    StdlibCliScript {
848        name: "eval/coding_agent",
849        source: include_str!("stdlib/cli/eval/coding_agent.harn"),
850    },
851    StdlibCliScript {
852        name: "eval/prompt",
853        source: include_str!("stdlib/cli/eval/prompt.harn"),
854    },
855    StdlibCliScript {
856        name: "explain",
857        source: include_str!("stdlib/cli/explain.harn"),
858    },
859    StdlibCliScript {
860        name: "graph",
861        source: include_str!("stdlib/cli/graph.harn"),
862    },
863    StdlibCliScript {
864        name: "models/list",
865        source: include_str!("stdlib/cli/models/list.harn"),
866    },
867    StdlibCliScript {
868        name: "models/recommend",
869        source: include_str!("stdlib/cli/models/recommend.harn"),
870    },
871    StdlibCliScript {
872        name: "models/test",
873        source: include_str!("stdlib/cli/models/test.harn"),
874    },
875    StdlibCliScript {
876        name: "precompile",
877        source: include_str!("stdlib/cli/precompile.harn"),
878    },
879    StdlibCliScript {
880        name: "providers/catalog",
881        source: include_str!("stdlib/cli/providers/catalog.harn"),
882    },
883    StdlibCliScript {
884        name: "providers/probe",
885        source: include_str!("stdlib/cli/providers/probe.harn"),
886    },
887    StdlibCliScript {
888        name: "providers/recommend",
889        source: include_str!("stdlib/cli/providers/recommend.harn"),
890    },
891    StdlibCliScript {
892        name: "providers/tool_probe",
893        source: include_str!("stdlib/cli/providers/tool_probe.harn"),
894    },
895    StdlibCliScript {
896        name: "routes",
897        source: include_str!("stdlib/cli/routes.harn"),
898    },
899    StdlibCliScript {
900        name: "scaffold/init",
901        source: include_str!("stdlib/cli/scaffold/init.harn"),
902    },
903    StdlibCliScript {
904        name: "scaffold/tool_new",
905        source: include_str!("stdlib/cli/scaffold/tool_new.harn"),
906    },
907    StdlibCliScript {
908        name: "trace_import",
909        source: include_str!("stdlib/cli/trace_import.harn"),
910    },
911    StdlibCliScript {
912        name: "try",
913        source: include_str!("stdlib/cli/try.harn"),
914    },
915    StdlibCliScript {
916        name: "version",
917        source: include_str!("stdlib/cli/version.harn"),
918    },
919];
920
921pub fn get_stdlib_source(module: &str) -> Option<&'static str> {
922    STDLIB_SOURCES
923        .iter()
924        .find_map(|entry| (entry.module == module).then_some(entry.source))
925}
926
927/// Find an embedded CLI subcommand script by name. Returns the embedded
928/// source string when present, or `None` if no script with that name is
929/// registered in [`STDLIB_CLI_SCRIPTS`].
930pub fn find_cli_script(name: &str) -> Option<&'static str> {
931    STDLIB_CLI_SCRIPTS
932        .iter()
933        .find_map(|entry| (entry.name == name).then_some(entry.source))
934}
935
936pub fn get_stdlib_prompt_asset(path: &str) -> Option<&'static str> {
937    let path = path.strip_prefix("std/").unwrap_or(path);
938    STDLIB_PROMPT_ASSETS
939        .iter()
940        .find_map(|entry| (entry.path == path).then_some(entry.source))
941}
942
943pub fn public_functions_for_module(module: &str) -> Vec<StdlibPublicFunction> {
944    let Some(source) = get_stdlib_source(module) else {
945        return Vec::new();
946    };
947    public_functions_from_source(source)
948}
949
950pub fn entrypoint_modules() -> Vec<StdlibEntrypointModule> {
951    STDLIB_SOURCES
952        .iter()
953        .filter_map(|entry| {
954            entrypoint_category_from_source(entry.source).map(|category| StdlibEntrypointModule {
955                import_path: format!("std/{}", entry.module),
956                category,
957            })
958        })
959        .collect()
960}
961
962fn entrypoint_category_from_source(source: &str) -> Option<String> {
963    for line in source.lines() {
964        let line = line.trim();
965        if line.is_empty() {
966            continue;
967        }
968        if let Some(category) = line.strip_prefix("// @harn-entrypoint-category ") {
969            let category = category.trim();
970            return (!category.is_empty()).then(|| category.to_string());
971        }
972        if !line.starts_with("//") {
973            return None;
974        }
975    }
976    None
977}
978
979fn public_functions_from_source(source: &str) -> Vec<StdlibPublicFunction> {
980    let mut out = Vec::new();
981    let mut doc: Option<String> = None;
982    let lines = source.lines().collect::<Vec<_>>();
983    let mut index = 0usize;
984    while index < lines.len() {
985        let line = lines[index].trim();
986        if line.starts_with("/**") {
987            let (parsed, next) = parse_harndoc(&lines, index);
988            doc = parsed;
989            index = next;
990            continue;
991        }
992        if line.starts_with("pub fn ") {
993            let (signature_line, next) = collect_public_function_signature(&lines, index);
994            if let Some(function) = parse_public_function_line(&signature_line, doc.take()) {
995                out.push(function);
996                index = next;
997                continue;
998            }
999        }
1000        if let Some(function) = parse_public_function_line(line, doc.take()) {
1001            out.push(function);
1002        } else if !line.is_empty() && !line.starts_with("//") {
1003            doc = None;
1004        }
1005        index += 1;
1006    }
1007    out
1008}
1009
1010fn collect_public_function_signature(lines: &[&str], start: usize) -> (String, usize) {
1011    let mut parts = Vec::new();
1012    let mut index = start;
1013    while index < lines.len() {
1014        parts.push(lines[index].trim().to_string());
1015        let candidate = parts.join(" ");
1016        if public_function_signature_complete(&candidate) {
1017            return (candidate, index + 1);
1018        }
1019        index += 1;
1020    }
1021    (parts.join(" "), index)
1022}
1023
1024fn public_function_signature_complete(line: &str) -> bool {
1025    let Some(rest) = line.strip_prefix("pub fn ") else {
1026        return false;
1027    };
1028    let Some(name_end) = rest.find('(') else {
1029        return false;
1030    };
1031    matching_paren_len(&rest[name_end + 1..]).is_some()
1032}
1033
1034fn parse_harndoc(lines: &[&str], start: usize) -> (Option<String>, usize) {
1035    let mut parts = Vec::new();
1036    let mut index = start;
1037    while index < lines.len() {
1038        let mut line = lines[index].trim();
1039        if index == start {
1040            line = line.trim_start_matches("/**").trim();
1041        }
1042        let done = line.ends_with("*/");
1043        line = line.trim_end_matches("*/").trim();
1044        line = line.trim_start_matches('*').trim();
1045        if !line.is_empty() {
1046            parts.push(line.to_string());
1047        }
1048        index += 1;
1049        if done {
1050            break;
1051        }
1052    }
1053    let text = parts.join("\n").trim().to_string();
1054    ((!text.is_empty()).then_some(text), index)
1055}
1056
1057fn parse_public_function_line(line: &str, doc: Option<String>) -> Option<StdlibPublicFunction> {
1058    let rest = line.strip_prefix("pub fn ")?.trim();
1059    let name_end = rest.find('(')?;
1060    let name = rest[..name_end].trim();
1061    if name.is_empty() {
1062        return None;
1063    }
1064    let params_start = name_end + 1;
1065    let params_len = matching_paren_len(&rest[params_start..])?;
1066    let params = &rest[params_start..params_start + params_len];
1067    let after = rest[params_start + params_len + 1..].trim();
1068    let return_type = after
1069        .strip_prefix("->")
1070        .and_then(|tail| tail.split('{').next())
1071        .map(str::trim)
1072        .filter(|value| !value.is_empty());
1073    let signature = match return_type {
1074        Some(ret) => format!("{name}({params}) -> {ret}"),
1075        None => format!("{name}({params})"),
1076    };
1077    let param_parts = split_top_level_params(params);
1078    let total_params = param_parts
1079        .iter()
1080        .filter(|param| !param.trim().is_empty())
1081        .count();
1082    let variadic = param_parts
1083        .iter()
1084        .any(|param| param.trim_start().starts_with("..."));
1085    let required_params = param_parts
1086        .iter()
1087        .filter(|param| {
1088            let param = param.trim();
1089            !param.is_empty() && !param.contains('=') && !param.starts_with("...")
1090        })
1091        .count();
1092    Some(StdlibPublicFunction {
1093        name: name.to_string(),
1094        signature,
1095        required_params,
1096        total_params,
1097        variadic,
1098        doc,
1099    })
1100}
1101
1102fn matching_paren_len(input: &str) -> Option<usize> {
1103    let mut depth = 1usize;
1104    for (offset, ch) in input.char_indices() {
1105        match ch {
1106            '(' | '[' | '{' => depth += 1,
1107            ')' => {
1108                depth = depth.saturating_sub(1);
1109                if depth == 0 {
1110                    return Some(offset);
1111                }
1112            }
1113            ']' | '}' => depth = depth.saturating_sub(1),
1114            _ => {}
1115        }
1116    }
1117    None
1118}
1119
1120fn split_top_level_params(params: &str) -> Vec<&str> {
1121    let mut out = Vec::new();
1122    let mut depth = 0isize;
1123    let mut start = 0usize;
1124    for (offset, ch) in params.char_indices() {
1125        match ch {
1126            '(' | '[' | '{' => depth += 1,
1127            ')' | ']' | '}' => depth -= 1,
1128            ',' if depth == 0 => {
1129                out.push(&params[start..offset]);
1130                start = offset + 1;
1131            }
1132            _ => {}
1133        }
1134    }
1135    out.push(&params[start..]);
1136    out
1137}
1138
1139#[cfg(test)]
1140mod tests {
1141    use std::collections::BTreeSet;
1142
1143    use super::{
1144        entrypoint_modules, find_cli_script, get_stdlib_prompt_asset, get_stdlib_source,
1145        public_functions_for_module, STDLIB_CLI_SCRIPTS, STDLIB_PROMPT_ASSETS, STDLIB_SOURCES,
1146    };
1147
1148    #[test]
1149    fn stdlib_sources_are_non_empty() {
1150        for entry in STDLIB_SOURCES {
1151            assert!(
1152                !entry.source.trim().is_empty(),
1153                "{} should have non-empty source",
1154                entry.module
1155            );
1156        }
1157    }
1158
1159    #[test]
1160    fn cli_scripts_are_non_empty_and_uniquely_named() {
1161        let mut seen = BTreeSet::new();
1162        for entry in STDLIB_CLI_SCRIPTS {
1163            assert!(
1164                !entry.source.trim().is_empty(),
1165                "cli/{} should have non-empty source",
1166                entry.name
1167            );
1168            assert!(
1169                seen.insert(entry.name),
1170                "cli/{} is registered more than once in STDLIB_CLI_SCRIPTS",
1171                entry.name
1172            );
1173        }
1174    }
1175
1176    #[test]
1177    fn find_cli_script_round_trips() {
1178        for entry in STDLIB_CLI_SCRIPTS {
1179            assert_eq!(find_cli_script(entry.name), Some(entry.source));
1180        }
1181        assert!(find_cli_script("not-a-real-script").is_none());
1182    }
1183
1184    #[test]
1185    fn stdlib_source_names_are_unique() {
1186        let mut names = BTreeSet::new();
1187        for entry in STDLIB_SOURCES {
1188            assert!(names.insert(entry.module), "duplicate {}", entry.module);
1189        }
1190    }
1191
1192    #[test]
1193    fn stdlib_prompt_assets_are_non_empty() {
1194        for entry in STDLIB_PROMPT_ASSETS {
1195            assert!(
1196                !entry.source.trim().is_empty(),
1197                "{} should have non-empty prompt asset source",
1198                entry.path
1199            );
1200        }
1201    }
1202
1203    #[test]
1204    fn stdlib_prompt_asset_paths_are_unique() {
1205        let mut paths = BTreeSet::new();
1206        for entry in STDLIB_PROMPT_ASSETS {
1207            assert!(paths.insert(entry.path), "duplicate {}", entry.path);
1208        }
1209    }
1210
1211    #[test]
1212    fn key_stdlib_modules_resolve() {
1213        for module in [
1214            "context",
1215            "context/maintenance",
1216            "context/eval",
1217            "edit",
1218            "artifact/web",
1219            "command",
1220            "waitpoint",
1221            "llm/handlers",
1222            "llm/tool_middleware",
1223            "llm/tool_binder",
1224            "llm/ensemble",
1225            "llm/rerank",
1226            "personas/prelude",
1227            "personas/bulletins",
1228            "agent/host_tools",
1229            "agent/user",
1230            "llm/optimize",
1231            "llm/judge",
1232            "llm/refine",
1233            "connectors/shared",
1234            "connectors/github",
1235            "connectors/linear",
1236            "connectors/notion",
1237            "connectors/slack",
1238            "triage",
1239            "dashboard/jobs",
1240            "ui_resource",
1241        ] {
1242            assert!(
1243                get_stdlib_source(module).is_some(),
1244                "std/{module} should resolve"
1245            );
1246        }
1247    }
1248
1249    #[test]
1250    fn key_stdlib_prompt_assets_resolve() {
1251        for path in [
1252            "std/agent/prompts/tool_contract_text.harn.prompt",
1253            "std/agent/prompts/action_turn_nudge.harn.prompt",
1254            "std/agent/prompts/completion_judge_default.harn.prompt",
1255            "std/workflow/prompts/stage.harn.prompt",
1256            "std/orchestration/prompts/compaction_summary.harn.prompt",
1257            "std/orchestration/prompts/compaction_policy_replacement.harn.prompt",
1258        ] {
1259            assert!(
1260                get_stdlib_prompt_asset(path).is_some(),
1261                "{path} should resolve"
1262            );
1263        }
1264    }
1265
1266    #[test]
1267    fn public_function_catalog_derives_signatures_from_harn_source() {
1268        let exports = public_functions_for_module("workflow/execute");
1269        assert_eq!(exports.len(), 1);
1270        assert_eq!(exports[0].name, "workflow_execute");
1271        assert_eq!(
1272            exports[0].signature,
1273            "workflow_execute(task, graph, artifacts = nil, options = nil)"
1274        );
1275        assert_eq!(exports[0].required_params, 2);
1276        assert_eq!(exports[0].total_params, 4);
1277    }
1278
1279    #[test]
1280    fn command_stdlib_module_exports_step_helpers() {
1281        let exports = public_functions_for_module("command")
1282            .into_iter()
1283            .map(|function| function.name)
1284            .collect::<BTreeSet<_>>();
1285        for name in [
1286            "command_run",
1287            "command_output_tail",
1288            "command_json",
1289            "command_json_step",
1290            "command_try",
1291            "command_step",
1292            "command_steps_append",
1293            "command_last_failed_step",
1294            "command_step_ref",
1295        ] {
1296            assert!(exports.contains(name), "std/command should export {name}");
1297        }
1298    }
1299
1300    #[test]
1301    fn async_stdlib_exports_predicate_backoff_name_only() {
1302        let exports = public_functions_for_module("async")
1303            .into_iter()
1304            .map(|function| function.name)
1305            .collect::<BTreeSet<_>>();
1306        assert!(
1307            exports.contains("retry_predicate_with_backoff"),
1308            "std/async should export retry_predicate_with_backoff"
1309        );
1310        assert!(
1311            !exports.contains("retry_with_backoff"),
1312            "std/async should not retain the old retry_with_backoff export"
1313        );
1314    }
1315
1316    #[test]
1317    fn signal_stdlib_module_exports_interrupt_helpers() {
1318        let exports = public_functions_for_module("signal")
1319            .into_iter()
1320            .map(|function| function.name)
1321            .collect::<BTreeSet<_>>();
1322        for name in [
1323            "on_interrupt",
1324            "off_interrupt",
1325            "interrupted",
1326            "with_interrupt",
1327        ] {
1328            assert!(exports.contains(name), "std/signal should export {name}");
1329        }
1330    }
1331
1332    #[test]
1333    fn git_stdlib_module_exports_local_wrappers() {
1334        let exports = public_functions_for_module("git")
1335            .into_iter()
1336            .map(|function| function.name)
1337            .collect::<BTreeSet<_>>();
1338        for name in [
1339            "git_run",
1340            "git_status",
1341            "git_current_branch",
1342            "git_log",
1343            "git_switch",
1344            "git_pull_ff_only",
1345            "git_find_tool",
1346            "git_run_tool",
1347            "git_tools",
1348            "git_toolbox_tools",
1349        ] {
1350            assert!(exports.contains(name), "std/git should export {name}");
1351        }
1352    }
1353
1354    #[test]
1355    fn agent_workers_exports_suspend_resume_wrappers() {
1356        let exports = public_functions_for_module("agent/workers");
1357        let suspend = exports
1358            .iter()
1359            .find(|function| function.name == "suspend_agent")
1360            .expect("std/agent/workers should export suspend_agent");
1361        assert_eq!(
1362            suspend.signature,
1363            "suspend_agent(worker, reason = \"\", options = nil)"
1364        );
1365        assert_eq!(suspend.required_params, 1);
1366        assert_eq!(suspend.total_params, 3);
1367
1368        let resume = exports
1369            .iter()
1370            .find(|function| function.name == "resume_agent")
1371            .expect("std/agent/workers should export resume_agent");
1372        assert_eq!(
1373            resume.signature,
1374            "resume_agent(worker_or_snapshot, resume_input = nil, continue_transcript = true)"
1375        );
1376        assert_eq!(resume.required_params, 1);
1377        assert_eq!(resume.total_params, 3);
1378
1379        let parse_resume = exports
1380            .iter()
1381            .find(|function| function.name == "parse_resume_conditions")
1382            .expect("std/agent/workers should export parse_resume_conditions");
1383        assert_eq!(
1384            parse_resume.signature,
1385            "parse_resume_conditions(conditions = nil) -> ResumeConditions?"
1386        );
1387        assert_eq!(parse_resume.required_params, 0);
1388        assert_eq!(parse_resume.total_params, 1);
1389
1390        let lifecycle = exports
1391            .iter()
1392            .find(|function| function.name == "agent_lifecycle_tools")
1393            .expect("std/agent/workers should export agent_lifecycle_tools");
1394        assert_eq!(
1395            lifecycle.signature,
1396            "agent_lifecycle_tools(registry = nil, options = nil)"
1397        );
1398        assert_eq!(lifecycle.required_params, 0);
1399        assert_eq!(lifecycle.total_params, 2);
1400    }
1401
1402    #[test]
1403    fn tui_stdlib_module_exports_terminal_helpers() {
1404        let exports = public_functions_for_module("tui")
1405            .into_iter()
1406            .map(|function| function.name)
1407            .collect::<BTreeSet<_>>();
1408        for name in ["page", "terminal_width", "rule", "clear", "select_from"] {
1409            assert!(exports.contains(name), "std/tui should export {name}");
1410        }
1411    }
1412
1413    #[test]
1414    fn harn_entrypoint_catalog_is_declared_by_stdlib_sources() {
1415        let modules = entrypoint_modules();
1416        let entries = modules
1417            .iter()
1418            .map(|module| (module.import_path.as_str(), module.category.as_str()))
1419            .collect::<BTreeSet<_>>();
1420        for entry in [
1421            ("std/agent/loop", "agent.stdlib"),
1422            ("std/agent/turn", "agent.stdlib"),
1423            ("std/agent/primitives", "agent.stdlib"),
1424            ("std/workflow/execute", "workflow.stdlib"),
1425        ] {
1426            assert!(entries.contains(&entry), "{entry:?} should be declared");
1427        }
1428    }
1429}