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