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