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