Skip to main content

harn_stdlib/
lib.rs

1//! Canonical embedded Harn standard library source catalog.
2//!
3//! This crate intentionally contains only static source strings so runtime and
4//! static tooling crates can share the same stdlib modules without depending on
5//! each other.
6
7#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub struct StdlibSource {
9    pub module: &'static str,
10    pub source: &'static str,
11}
12
13#[derive(Debug, Clone, Copy, PartialEq, Eq)]
14pub struct StdlibPromptAsset {
15    pub path: &'static str,
16    pub source: &'static str,
17}
18
19macro_rules! embedded_catalog {
20    ($entry:ident, $key:ident, [$($name:literal => $path:literal),* $(,)?]) => {
21        &[
22            $($entry {
23                $key: $name,
24                source: include_str!($path),
25            },)*
26        ]
27    };
28}
29
30#[derive(Debug, Clone, PartialEq, Eq)]
31pub struct StdlibPublicFunction {
32    pub name: String,
33    pub signature: String,
34    pub required_params: usize,
35    pub total_params: usize,
36    pub variadic: bool,
37    pub doc: Option<String>,
38}
39
40#[derive(Debug, Clone, PartialEq, Eq)]
41pub struct StdlibEntrypointModule {
42    pub import_path: String,
43    pub category: String,
44}
45
46pub const STDLIB_SOURCES: &[StdlibSource] = embedded_catalog!(StdlibSource, module, [
47    "text" => "stdlib/stdlib_text.harn",
48    "semver" => "stdlib/stdlib_semver.harn",
49    "changelog" => "stdlib/stdlib_changelog.harn",
50    "ansi" => "stdlib/stdlib_ansi.harn",
51    "table" => "stdlib/stdlib_table.harn",
52    "diff" => "stdlib/stdlib_diff.harn",
53    "edit" => "stdlib/stdlib_edit.harn",
54    "edit/capabilities" => "stdlib/edit/capabilities.harn",
55    "edit/internal" => "stdlib/edit/internal.harn",
56    "edit/patch" => "stdlib/edit/patch.harn",
57    "edit/safe_patch" => "stdlib/edit/safe_patch.harn",
58    "edit/fast_apply" => "stdlib/edit/fast_apply.harn",
59    "ast" => "stdlib/stdlib_ast.harn",
60    "rules" => "stdlib/stdlib_rules.harn",
61    "lint" => "stdlib/stdlib_lint.harn",
62    "artifact/web" => "stdlib/artifact/web.harn",
63    "collections" => "stdlib/stdlib_collections.harn",
64    "math" => "stdlib/stdlib_math.harn",
65    "slug" => "stdlib/stdlib_slug.harn",
66    "path" => "stdlib/stdlib_path.harn",
67    "fs" => "stdlib/stdlib_fs.harn",
68    "run_artifacts" => "stdlib/stdlib_run_artifacts.harn",
69    "os" => "stdlib/stdlib_os.harn",
70    "json" => "stdlib/stdlib_json.harn",
71    "json/stream" => "stdlib/stdlib_json_stream.harn",
72    "xml" => "stdlib/stdlib_xml.harn",
73    "cache" => "stdlib/stdlib_cache.harn",
74    "observability" => "stdlib/stdlib_observability.harn",
75    "timing" => "stdlib/stdlib_timing.harn",
76    "verification" => "stdlib/stdlib_verification.harn",
77    "tools" => "stdlib/stdlib_tools.harn",
78    "composition" => "stdlib/stdlib_composition.harn",
79    "web" => "stdlib/stdlib_web.harn",
80    "graphql" => "stdlib/stdlib_graphql.harn",
81    "code_librarian" => "stdlib/stdlib_code_librarian.harn",
82    "schema" => "stdlib/stdlib_schema.harn",
83    "identity" => "stdlib/stdlib_identity.harn",
84    "disclosure" => "stdlib/stdlib_disclosure.harn",
85    "testing" => "stdlib/stdlib_testing.harn",
86    "files" => "stdlib/stdlib_files.harn",
87    "document" => "stdlib/stdlib_document.harn",
88    "mcp" => "stdlib/stdlib_mcp.harn",
89    "vision" => "stdlib/stdlib_vision.harn",
90    "context" => "stdlib/stdlib_context.harn",
91    "context/maintenance" => "stdlib/context/maintenance.harn",
92    "context/eval" => "stdlib/context/eval.harn",
93    "eval/stats" => "stdlib/stdlib_eval_stats.harn",
94    "eval/agreement" => "stdlib/stdlib_eval_agreement.harn",
95    "runtime" => "stdlib/stdlib_runtime.harn",
96    "io" => "stdlib/stdlib_io.harn",
97    "net" => "stdlib/stdlib_net.harn",
98    "command" => "stdlib/stdlib_command.harn",
99    "signal" => "stdlib/stdlib_signal.harn",
100    "net_policy" => "stdlib/stdlib_net_policy.harn",
101    "review" => "stdlib/stdlib_review.harn",
102    "experiments" => "stdlib/stdlib_experiments.harn",
103    "project" => "stdlib/stdlib_project.harn",
104    "prompt_library" => "stdlib/stdlib_prompt_library.harn",
105    "async" => "stdlib/stdlib_async.harn",
106    "poll" => "stdlib/stdlib_poll.harn",
107    "coerce" => "stdlib/stdlib_coerce.harn",
108    "settled" => "stdlib/stdlib_settled.harn",
109    "cli" => "stdlib/stdlib_cli.harn",
110    "cli/argparse" => "stdlib/cli/argparse.harn",
111    "cli/render" => "stdlib/cli/render.harn",
112    "cli/models/batch_artifacts" => "stdlib/cli/models/batch_artifacts.harn",
113    "cli/models/batch_cancel" => "stdlib/cli/models/batch_cancel.harn",
114    "cli/models/batch_download" => "stdlib/cli/models/batch_download.harn",
115    "cli/models/batch_lifecycle" => "stdlib/cli/models/batch_lifecycle.harn",
116    "cli/models/batch_status" => "stdlib/cli/models/batch_status.harn",
117    "cli/models/batch_submit" => "stdlib/cli/models/batch_submit.harn",
118    "cli/models/batch_transport" => "stdlib/cli/models/batch_transport.harn",
119    "cli/models/lora_render" => "stdlib/cli/models/lora_render.harn",
120    "cli/paths" => "stdlib/cli/paths.harn",
121    "gha" => "stdlib/stdlib_gha.harn",
122    "tui" => "stdlib/stdlib_tui.harn",
123    "jsonl" => "stdlib/stdlib_jsonl.harn",
124    "config" => "stdlib/stdlib_config.harn",
125    "calendar" => "stdlib/stdlib_calendar.harn",
126    "agents" => "stdlib/stdlib_agents.harn",
127    "lifecycle/pool" => "stdlib/lifecycle/pool.harn",
128    "lifecycle/combinators" => "stdlib/lifecycle/combinators.harn",
129    "lifecycle/on_budget" => "stdlib/lifecycle/on_budget.harn",
130    "agent/prompts" => "stdlib/agent/prompts.harn",
131    "llm/media" => "stdlib/llm/media.harn",
132    "llm/options" => "stdlib/llm/options.harn",
133    "llm/catalog" => "stdlib/llm/catalog.harn",
134    "llm/safe" => "stdlib/llm/safe.harn",
135    "harness/policy" => "stdlib/harness/policy.harn",
136    "llm/budget" => "stdlib/llm/budget.harn",
137    "llm/economics" => "stdlib/llm/economics.harn",
138    "llm/prompts" => "stdlib/llm/prompts.harn",
139    "llm/defaults" => "stdlib/llm/defaults.harn",
140    "llm/handlers" => "stdlib/llm/handlers.harn",
141    "llm/tool_telemetry" => "stdlib/llm/tool_telemetry.harn",
142    "llm/tool_middleware" => "stdlib/llm/tool_middleware.harn",
143    "llm/tool_binder" => "stdlib/llm/tool_binder.harn",
144    "llm/structural_validator" => "stdlib/llm/structural_validator.harn",
145    "llm/missing_tool_call" => "stdlib/llm/missing_tool_call.harn",
146    "llm/scope_classifier" => "stdlib/llm/scope_classifier.harn",
147    "llm/refine" => "stdlib/llm/refine.harn",
148    "llm/ensemble" => "stdlib/llm/ensemble.harn",
149    "llm/rerank" => "stdlib/llm/rerank.harn",
150    "agent/reasoning" => "stdlib/agent/reasoning.harn",
151    "agent/caller_transport" => "stdlib/agent/caller_transport.harn",
152    "agent/options" => "stdlib/agent/options.harn",
153    "agent/llm_dispatch" => "stdlib/agent/llm_dispatch.harn",
154    "agent/prefill" => "stdlib/agent/prefill.harn",
155    "agent/retry" => "stdlib/agent/retry.harn",
156    "llm/judge" => "stdlib/llm/judge.harn",
157    "llm/faithfulness" => "stdlib/llm/faithfulness.harn",
158    "llm/optimize" => "stdlib/llm/optimize.harn",
159    "agent/events" => "stdlib/agent/events.harn",
160    "agent/completions" => "stdlib/agent/completions.harn",
161    "agent/transcript" => "stdlib/agent/transcript.harn",
162    "agent/primitives" => "stdlib/agent/primitives.harn",
163    "agent/progress" => "stdlib/agent/progress.harn",
164    "agent/required_tools" => "stdlib/agent/required_tools.harn",
165    "agent/monologue_actuation" => "stdlib/agent/monologue_actuation.harn",
166    "agent/monologue_actuation_types" => "stdlib/agent/monologue_actuation_types.harn",
167    "agent/stall_types" => "stdlib/agent/stall_types.harn",
168    "agent/stall" => "stdlib/agent/stall.harn",
169    "agent/governors" => "stdlib/agent/governors.harn",
170    "agent/control" => "stdlib/agent/control.harn",
171    "agent/action_graph" => "stdlib/agent/action_graph.harn",
172    "agent/result_text" => "stdlib/agent/result_text.harn",
173    "agent/best_of_n" => "stdlib/agent/best_of_n.harn",
174    "agent/loop" => "stdlib/agent/loop.harn",
175    "agent/chat" => "stdlib/agent/chat.harn",
176    "agent/user" => "stdlib/agent/user.harn",
177    "agent/tool_search" => "stdlib/agent/tool_search.harn",
178    "agent/tool_annotations" => "stdlib/agent/tool_annotations.harn",
179    "agent/tool_lifecycle" => "stdlib/agent/tool_lifecycle.harn",
180    "agent/turn" => "stdlib/agent/turn.harn",
181    "agent/workers" => "stdlib/agent/workers.harn",
182    "agent/introspection" => "stdlib/agent/introspection.harn",
183    "agent/resume_by" => "stdlib/agent/resume_by.harn",
184    "agent/state" => "stdlib/agent/state.harn",
185    "agent/canon" => "stdlib/agent/canon.harn",
186    "agent/skills" => "stdlib/agent/skills.harn",
187    "agent/autocompact" => "stdlib/agent/autocompact.harn",
188    "agent/mcp" => "stdlib/agent/mcp.harn",
189    "agent/command_capture" => "stdlib/agent/command_capture.harn",
190    "agent/host_tools" => "stdlib/agent/host_tools.harn",
191    "agent/host_injection" => "stdlib/agent/host_injection.harn",
192    "agent/budget" => "stdlib/agent/budget.harn",
193    "agent/daemon" => "stdlib/agent/daemon.harn",
194    "agent/preflight" => "stdlib/agent/preflight.harn",
195    "agent/postturn" => "stdlib/agent/postturn.harn",
196    "agent/stance" => "stdlib/agent/stance.harn",
197    "agent/lanes" => "stdlib/agent/lanes.harn",
198    "agent/overlays" => "stdlib/agent/overlays.harn",
199    "agent/sitrep" => "stdlib/agent/sitrep.harn",
200    "agent/verdict" => "stdlib/agent/verdict.harn",
201    "agent/judge_internals" => "stdlib/agent/judge_internals.harn",
202    "agent/judge" => "stdlib/agent/judge.harn",
203    "agent/guardrails" => "stdlib/agent/guardrails.harn",
204    "agent/step_judge" => "stdlib/agent/step_judge.harn",
205    "agent/scratchpad" => "stdlib/agent/scratchpad.harn",
206    "agent/fact" => "stdlib/agent/fact.harn",
207    "agent/hypothesis" => "stdlib/agent/hypothesis.harn",
208    "agent/pattern_knowledge" => "stdlib/agent/pattern_knowledge.harn",
209    "agent/probe" => "stdlib/agent/probe.harn",
210    "agent/stream" => "stdlib/agent/stream.harn",
211    "agent/presets" => "stdlib/agent/presets.harn",
212    "agent/pins" => "stdlib/agent/pins.harn",
213    "agent/goal" => "stdlib/agent/goal.harn",
214    "agent/task_plan" => "stdlib/agent/task_plan.harn",
215    "personas/compiler" => "stdlib/personas/compiler.harn",
216    "personas/prompt_compiler" => "stdlib/personas/prompt_compiler.harn",
217    "agent_state" => "stdlib/stdlib_agent_state.harn",
218    "memory" => "stdlib/stdlib_memory.harn",
219    "session-store" => "stdlib/stdlib_session_store.harn",
220    "coordination" => "stdlib/stdlib_coordination.harn",
221    "fleet/coordination" => "stdlib/fleet/coordination.harn",
222    "postgres" => "stdlib/stdlib_postgres.harn",
223    "postgres/query" => "stdlib/postgres/query.harn",
224    "sqlite" => "stdlib/stdlib_sqlite.harn",
225    "checkpoint" => "stdlib/stdlib_checkpoint.harn",
226    "host" => "stdlib/stdlib_host.harn",
227    "host_lease" => "stdlib/stdlib_host_lease.harn",
228    "git" => "stdlib/stdlib_git.harn",
229    "git/checkout" => "stdlib/git/checkout.harn",
230    "hitl" => "stdlib/stdlib_hitl.harn",
231    "trust" => "stdlib/stdlib_trust.harn",
232    "corrections" => "stdlib/stdlib_corrections.harn",
233    "plan" => "stdlib/stdlib_plan.harn",
234    "waitpoints" => "stdlib/stdlib_waitpoints.harn",
235    "waitpoint" => "stdlib/stdlib_waitpoint.harn",
236    "monitors" => "stdlib/stdlib_monitors.harn",
237    "worktree" => "stdlib/stdlib_worktree.harn",
238    "acp" => "stdlib/stdlib_acp.harn",
239    "external_agent" => "stdlib/stdlib_external_agent.harn",
240    "triggers" => "stdlib/stdlib_triggers.harn",
241    "triage" => "stdlib/stdlib_triage.harn",
242    "dashboard/jobs" => "stdlib/dashboard/jobs.harn",
243    "ui_resource" => "stdlib/stdlib_ui_resource.harn",
244    "handoffs" => "stdlib/stdlib_handoffs.harn",
245    "lifecycle" => "stdlib/stdlib_lifecycle.harn",
246    "tool_hooks_catalogues" => "stdlib/stdlib_tool_hooks_catalogues.harn",
247    "tool_hooks" => "stdlib/stdlib_tool_hooks.harn",
248    "channel_guardrails" => "stdlib/stdlib_channel_guardrails.harn",
249    "personas/prelude" => "stdlib/stdlib_personas_prelude.harn",
250    "personas/bulletins" => "stdlib/stdlib_personas_bulletins.harn",
251    "connectors/shared" => "stdlib/stdlib_connectors_shared.harn",
252    "oauth/providers" => "stdlib/oauth/providers.harn",
253    "oauth/token_exchange_catalog" => "stdlib/oauth/token_exchange_catalog.harn",
254    "oauth/token_exchange" => "stdlib/oauth/token_exchange.harn",
255    "oauth/storage" => "stdlib/oauth/storage.harn",
256    "oauth/client" => "stdlib/oauth/client.harn",
257    "oauth/device_flow" => "stdlib/oauth/device_flow.harn",
258    "oauth/redaction" => "stdlib/oauth/redaction.harn",
259    "oauth/dynamic_registration" => "stdlib/oauth/dynamic_registration.harn",
260    "connectors/github" => "stdlib/stdlib_connectors_github.harn",
261    "connectors/linear" => "stdlib/stdlib_connectors_linear.harn",
262    "connectors/notion" => "stdlib/stdlib_connectors_notion.harn",
263    "connectors/slack" => "stdlib/stdlib_connectors_slack.harn",
264    "workflow/prompts" => "stdlib/workflow/prompts.harn",
265    "workflow/context" => "stdlib/workflow/context.harn",
266    "workflow/options" => "stdlib/workflow/options.harn",
267    "workflow/checkpoints" => "stdlib/workflow/checkpoints.harn",
268    "workflow/patterns" => "stdlib/workflow/patterns.harn",
269    "workflow/stage" => "stdlib/workflow/stage.harn",
270    "workflow/map" => "stdlib/workflow/map.harn",
271    "workflow/schedule" => "stdlib/workflow/schedule.harn",
272    "workflow/execute" => "stdlib/workflow/execute.harn",
273    "workflow/repair" => "stdlib/workflow/repair.harn",
274    "security" => "stdlib/stdlib_security.harn",
275    "pii" => "stdlib/stdlib_pii.harn",
276]);
277
278/// Canonical normalized connector event schemas, authored as Harn `type`
279/// declarations. This is the SOURCE OF TRUTH for the Rust event-payload
280/// structs in `crates/harn-vm/src/triggers/event/schemas_generated.rs`, which
281/// are generated from these declarations by `harn connector-schema-codegen`.
282///
283/// It is intentionally NOT registered in [`STDLIB_SOURCES`]: it is a codegen
284/// input (like `spec/openapi.yaml`), not a module loaded into every program.
285/// Exposing it as an embedded string keeps the generator independent of the
286/// current working directory.
287pub const CONNECTOR_EVENT_SCHEMAS_SOURCE: &str = include_str!("stdlib/stdlib_event_schemas.harn");
288
289pub const STDLIB_PROMPT_ASSETS: &[StdlibPromptAsset] = embedded_catalog!(StdlibPromptAsset, path, [
290    "agent/prompts/tool_contract_text.harn.prompt" => "stdlib/agent/prompts/tool_contract_text.harn.prompt",
291    "agent/prompts/tool_contract_json.harn.prompt" => "stdlib/agent/prompts/tool_contract_json.harn.prompt",
292    "agent/prompts/tool_contract_native.harn.prompt" => "stdlib/agent/prompts/tool_contract_native.harn.prompt",
293    "agent/prompts/tool_contract_text_response_protocol.harn.prompt" => "stdlib/agent/prompts/tool_contract_text_response_protocol.harn.prompt",
294    "agent/prompts/tool_contract_action_native.harn.prompt" => "stdlib/agent/prompts/tool_contract_action_native.harn.prompt",
295    "agent/prompts/tool_contract_action_text.harn.prompt" => "stdlib/agent/prompts/tool_contract_action_text.harn.prompt",
296    "agent/prompts/tool_contract_task_ledger.harn.prompt" => "stdlib/agent/prompts/tool_contract_task_ledger.harn.prompt",
297    "agent/prompts/tool_contract_deferred_tools.harn.prompt" => "stdlib/agent/prompts/tool_contract_deferred_tools.harn.prompt",
298    "agent/prompts/deferred_tool_listing.harn.prompt" => "stdlib/agent/prompts/deferred_tool_listing.harn.prompt",
299    "agent/prompts/agent_turn_preamble.harn.prompt" => "stdlib/agent/prompts/agent_turn_preamble.harn.prompt",
300    "agent/prompts/default_nudge.harn.prompt" => "stdlib/agent/prompts/default_nudge.harn.prompt",
301    "agent/prompts/agentic_user_system.harn.prompt" => "stdlib/agent/prompts/agentic_user_system.harn.prompt",
302    "agent/prompts/agentic_user_user.harn.prompt" => "stdlib/agent/prompts/agentic_user_user.harn.prompt",
303    "agent/prompts/loop_until_done_system.harn.prompt" => "stdlib/agent/prompts/loop_until_done_system.harn.prompt",
304    "agent/prompts/completion_judge_default.harn.prompt" => "stdlib/agent/prompts/completion_judge_default.harn.prompt",
305    "agent/prompts/completion_judge_feedback_fallback.harn.prompt" => "stdlib/agent/prompts/completion_judge_feedback_fallback.harn.prompt",
306    "agent/prompts/completion_judge_user.harn.prompt" => "stdlib/agent/prompts/completion_judge_user.harn.prompt",
307    "agent/prompts/step_judge_system_default.harn.prompt" => "stdlib/agent/prompts/step_judge_system_default.harn.prompt",
308    "agent/prompts/step_judge_system_adversarial.harn.prompt" => "stdlib/agent/prompts/step_judge_system_adversarial.harn.prompt",
309    "agent/prompts/step_judge_user.harn.prompt" => "stdlib/agent/prompts/step_judge_user.harn.prompt",
310    "agent/prompts/parse_guidance.harn.prompt" => "stdlib/agent/prompts/parse_guidance.harn.prompt",
311    "agent/prompts/native_tool_contract_feedback.harn.prompt" => "stdlib/agent/prompts/native_tool_contract_feedback.harn.prompt",
312    "agent/prompts/verification_gate_feedback.harn.prompt" => "stdlib/agent/prompts/verification_gate_feedback.harn.prompt",
313    "agent/prompts/daemon_watch_feedback.harn.prompt" => "stdlib/agent/prompts/daemon_watch_feedback.harn.prompt",
314    "agent/prompts/daemon_timer_feedback.harn.prompt" => "stdlib/agent/prompts/daemon_timer_feedback.harn.prompt",
315    "llm/prompts/completion_fallback_system.harn.prompt" => "stdlib/llm/prompts/completion_fallback_system.harn.prompt",
316    "llm/prompts/completion_fallback_user.harn.prompt" => "stdlib/llm/prompts/completion_fallback_user.harn.prompt",
317    "llm/prompts/transcript_summarize_user.harn.prompt" => "stdlib/llm/prompts/transcript_summarize_user.harn.prompt",
318    "llm/prompts/sitrep_user.harn.prompt" => "stdlib/llm/prompts/sitrep_user.harn.prompt",
319    "llm/prompts/structural_chain_of_draft.harn.prompt" => "stdlib/llm/prompts/structural_chain_of_draft.harn.prompt",
320    "llm/prompts/schema_recover_repair.harn.prompt" => "stdlib/llm/prompts/schema_recover_repair.harn.prompt",
321    "llm/prompts/structured_envelope_schema_contract.harn.prompt" => "stdlib/llm/prompts/structured_envelope_schema_contract.harn.prompt",
322    "llm/prompts/structured_envelope_repair.harn.prompt" => "stdlib/llm/prompts/structured_envelope_repair.harn.prompt",
323    "llm/prompts/pairwise_rerank_user.harn.prompt" => "stdlib/llm/prompts/pairwise_rerank_user.harn.prompt",
324    "llm/prompts/tool_binder_user.harn.prompt" => "stdlib/llm/prompts/tool_binder_user.harn.prompt",
325    "workflow/prompts/stage.harn.prompt" => "stdlib/workflow/prompts/stage.harn.prompt",
326    "workflow/prompts/verification_context_intro.harn.prompt" => "stdlib/workflow/prompts/verification_context_intro.harn.prompt",
327    "orchestration/prompts/compaction_summary.harn.prompt" => "stdlib/orchestration/prompts/compaction_summary.harn.prompt",
328    "orchestration/prompts/compaction_policy_replacement.harn.prompt" => "stdlib/orchestration/prompts/compaction_policy_replacement.harn.prompt",
329]);
330
331/// Embedded `.harn` script that backs a CLI subcommand. Looked up by
332/// the `harn-cli` dispatch wedge (see harn#2293 epic and harn#2294 G1)
333/// so subcommands can ship in Harn instead of Rust.
334#[derive(Debug, Clone, Copy, PartialEq, Eq)]
335pub struct StdlibCliScript {
336    /// Lookup name. For nested scripts this is the path under
337    /// `stdlib/cli/` without the `.harn` extension (e.g. `"eval/prompt"`
338    /// for `stdlib/cli/eval/prompt.harn`).
339    pub name: &'static str,
340    /// Embedded source. Run via the existing `harn run` codepath by the
341    /// dispatch wedge.
342    pub source: &'static str,
343}
344
345pub const STDLIB_CLI_SCRIPTS: &[StdlibCliScript] = embedded_catalog!(StdlibCliScript, name, [
346    "codemod" => "stdlib/cli/codemod.harn",
347    "canon/check" => "stdlib/cli/canon/check.harn",
348    "doctor" => "stdlib/cli/doctor.harn",
349    "echo" => "stdlib/cli/echo.harn",
350    // Helper module for the embedded `eval/*` scripts. Has a stub `main`
351    // that exits non-zero — sibling scripts inline its helpers until the
352    // dispatch wedge gains a cross-script import surface (#2300 / G7).
353    "eval/_runner" => "stdlib/cli/eval/_runner.harn",
354    "eval/context" => "stdlib/cli/eval/context.harn",
355    "eval/model_selector" => "stdlib/cli/eval/model_selector.harn",
356    "eval/tool_calls" => "stdlib/cli/eval/tool_calls.harn",
357    "eval/coding_agent" => "stdlib/cli/eval/coding_agent.harn",
358    "eval/scope_triage" => "stdlib/cli/eval/scope_triage.harn",
359    "eval/prompt" => "stdlib/cli/eval/prompt.harn",
360    "explain" => "stdlib/cli/explain.harn",
361    "graph" => "stdlib/cli/graph.harn",
362    "personas/compile_prompt" => "stdlib/cli/personas/compile_prompt.harn",
363    "personas/materialize" => "stdlib/cli/personas/materialize.harn",
364    "models/batch_plan" => "stdlib/cli/models/batch_plan.harn",
365    "models/list" => "stdlib/cli/models/list.harn",
366    "models/lora_inspect" => "stdlib/cli/models/lora_inspect.harn",
367    "models/lora_export" => "stdlib/cli/models/lora_export.harn",
368    "models/lora_manifest" => "stdlib/cli/models/lora_manifest.harn",
369    "models/lora_preflight" => "stdlib/cli/models/lora_preflight.harn",
370    "models/lora_promote" => "stdlib/cli/models/lora_promote.harn",
371    "models/lora_plan" => "stdlib/cli/models/lora_plan.harn",
372    "models/lora_train" => "stdlib/cli/models/lora_train.harn",
373    "models/recommend" => "stdlib/cli/models/recommend.harn",
374    "models/test" => "stdlib/cli/models/test.harn",
375    "precompile" => "stdlib/cli/precompile.harn",
376    "providers/cache_probe" => "stdlib/cli/providers/cache_probe.harn",
377    "providers/catalog" => "stdlib/cli/providers/catalog.harn",
378    "providers/probe" => "stdlib/cli/providers/probe.harn",
379    "providers/recommend" => "stdlib/cli/providers/recommend.harn",
380    "providers/tool_probe" => "stdlib/cli/providers/tool_probe.harn",
381    "providers/tool_scorecard" => "stdlib/cli/providers/tool_scorecard.harn",
382    "routes" => "stdlib/cli/routes.harn",
383    "scan" => "stdlib/cli/scan.harn",
384    "scaffold/init" => "stdlib/cli/scaffold/init.harn",
385    "scaffold/tool_new" => "stdlib/cli/scaffold/tool_new.harn",
386    "trace_import" => "stdlib/cli/trace_import.harn",
387    "try" => "stdlib/cli/try.harn",
388    "version" => "stdlib/cli/version.harn",
389]);
390
391pub fn get_stdlib_source(module: &str) -> Option<&'static str> {
392    STDLIB_SOURCES
393        .iter()
394        .find_map(|entry| (entry.module == module).then_some(entry.source))
395}
396
397/// Builtins a stdlib module re-exports under its own name, so
398/// `import { assert_eq } from "std/testing"` resolves.
399///
400/// Some of the standard library is implemented in Rust rather than Harn — the
401/// value differ behind `assert_eq` needs to walk the runtime representation of
402/// a value, which Harn source cannot do. Those builtins are callable without an
403/// import, but a reader who has just typed `import { assert_throws } from
404/// "std/testing"` has every reason to expect its sibling `assert_eq` to come
405/// from the same place, and no reason to know which side of the Rust/Harn line
406/// a given assertion happens to fall on. This table erases that seam: the
407/// module's export surface is its `pub fn`s plus the names listed here.
408///
409/// The list is explicit rather than derived from the builtins' `category`
410/// metadata: a category is a free-form label for docs and observability, and an
411/// export surface is an API contract. Deriving one from the other would let an
412/// unrelated metadata edit silently add or remove a public export.
413///
414/// `harn_vm::stdlib::tests` pins every name here to a registered builtin, so an
415/// entry cannot rot into a name that no longer exists.
416pub fn builtin_reexports(module: &str) -> &'static [&'static str] {
417    match module {
418        "testing" => &[
419            "assert",
420            "assert_approx",
421            "assert_eq",
422            "assert_matches",
423            "assert_ne",
424            "value_diff",
425        ],
426        _ => &[],
427    }
428}
429
430/// Find an embedded CLI subcommand script by name. Returns the embedded
431/// source string when present, or `None` if no script with that name is
432/// registered in [`STDLIB_CLI_SCRIPTS`].
433pub fn find_cli_script(name: &str) -> Option<&'static str> {
434    STDLIB_CLI_SCRIPTS
435        .iter()
436        .find_map(|entry| (entry.name == name).then_some(entry.source))
437}
438
439pub fn get_stdlib_prompt_asset(path: &str) -> Option<&'static str> {
440    let path = path.strip_prefix("std/").unwrap_or(path);
441    STDLIB_PROMPT_ASSETS
442        .iter()
443        .find_map(|entry| (entry.path == path).then_some(entry.source))
444}
445
446pub fn public_functions_for_module(module: &str) -> Vec<StdlibPublicFunction> {
447    let Some(source) = get_stdlib_source(module) else {
448        return Vec::new();
449    };
450    public_functions_from_source(source)
451}
452
453pub fn entrypoint_modules() -> Vec<StdlibEntrypointModule> {
454    STDLIB_SOURCES
455        .iter()
456        .filter_map(|entry| {
457            entrypoint_category_from_source(entry.source).map(|category| StdlibEntrypointModule {
458                import_path: format!("std/{}", entry.module),
459                category,
460            })
461        })
462        .collect()
463}
464
465fn entrypoint_category_from_source(source: &str) -> Option<String> {
466    for line in source.lines() {
467        let line = line.trim();
468        if line.is_empty() {
469            continue;
470        }
471        if let Some(category) = line.strip_prefix("// @harn-entrypoint-category ") {
472            let category = category.trim();
473            return (!category.is_empty()).then(|| category.to_string());
474        }
475        if !line.starts_with("//") {
476            return None;
477        }
478    }
479    None
480}
481
482fn public_functions_from_source(source: &str) -> Vec<StdlibPublicFunction> {
483    let mut out = Vec::new();
484    let mut doc: Option<String> = None;
485    let lines = source.lines().collect::<Vec<_>>();
486    let mut index = 0usize;
487    while index < lines.len() {
488        let line = lines[index].trim();
489        if line.starts_with("/**") {
490            let (parsed, next) = parse_harndoc(&lines, index);
491            doc = parsed;
492            index = next;
493            continue;
494        }
495        if line.starts_with("pub fn ") {
496            let (signature_line, next) = collect_public_function_signature(&lines, index);
497            if let Some(function) = parse_public_function_line(&signature_line, doc.take()) {
498                out.push(function);
499                index = next;
500                continue;
501            }
502        }
503        if let Some(function) = parse_public_function_line(line, doc.take()) {
504            out.push(function);
505        } else if !line.is_empty() && !line.starts_with("//") {
506            doc = None;
507        }
508        index += 1;
509    }
510    out
511}
512
513fn collect_public_function_signature(lines: &[&str], start: usize) -> (String, usize) {
514    let mut parts = Vec::new();
515    let mut index = start;
516    while index < lines.len() {
517        parts.push(lines[index].trim().to_string());
518        let candidate = parts.join(" ");
519        if public_function_signature_complete(&candidate) {
520            return (candidate, index + 1);
521        }
522        index += 1;
523    }
524    (parts.join(" "), index)
525}
526
527fn public_function_signature_complete(line: &str) -> bool {
528    let Some(rest) = line.strip_prefix("pub fn ") else {
529        return false;
530    };
531    let Some(name_end) = rest.find('(') else {
532        return false;
533    };
534    matching_paren_len(&rest[name_end + 1..]).is_some()
535}
536
537fn parse_harndoc(lines: &[&str], start: usize) -> (Option<String>, usize) {
538    let mut parts = Vec::new();
539    let mut index = start;
540    while index < lines.len() {
541        let mut line = lines[index].trim();
542        if index == start {
543            line = line.trim_start_matches("/**").trim();
544        }
545        let done = line.ends_with("*/");
546        line = line.trim_end_matches("*/").trim();
547        line = line.trim_start_matches('*').trim();
548        if !line.is_empty() {
549            parts.push(line.to_string());
550        }
551        index += 1;
552        if done {
553            break;
554        }
555    }
556    let text = parts.join("\n").trim().to_string();
557    ((!text.is_empty()).then_some(text), index)
558}
559
560fn parse_public_function_line(line: &str, doc: Option<String>) -> Option<StdlibPublicFunction> {
561    let rest = line.strip_prefix("pub fn ")?.trim();
562    let name_end = rest.find('(')?;
563    let name = rest[..name_end].trim();
564    if name.is_empty() {
565        return None;
566    }
567    let params_start = name_end + 1;
568    let params_len = matching_paren_len(&rest[params_start..])?;
569    let params = &rest[params_start..params_start + params_len];
570    let after = rest[params_start + params_len + 1..].trim();
571    let return_type = after
572        .strip_prefix("->")
573        .and_then(|tail| tail.split('{').next())
574        .map(str::trim)
575        .filter(|value| !value.is_empty());
576    let signature = match return_type {
577        Some(ret) => format!("{name}({params}) -> {ret}"),
578        None => format!("{name}({params})"),
579    };
580    let param_parts = split_top_level_params(params);
581    let total_params = param_parts
582        .iter()
583        .filter(|param| !param.trim().is_empty())
584        .count();
585    let variadic = param_parts
586        .iter()
587        .any(|param| param.trim_start().starts_with("..."));
588    let required_params = param_parts
589        .iter()
590        .filter(|param| {
591            let param = param.trim();
592            !param.is_empty() && !param.contains('=') && !param.starts_with("...")
593        })
594        .count();
595    Some(StdlibPublicFunction {
596        name: name.to_string(),
597        signature,
598        required_params,
599        total_params,
600        variadic,
601        doc,
602    })
603}
604
605fn matching_paren_len(input: &str) -> Option<usize> {
606    let mut depth = 1usize;
607    for (offset, ch) in input.char_indices() {
608        match ch {
609            '(' | '[' | '{' => depth += 1,
610            ')' | ']' | '}' => {
611                depth = depth.saturating_sub(1);
612                if depth == 0 {
613                    return Some(offset);
614                }
615            }
616            _ => {}
617        }
618    }
619    None
620}
621
622fn split_top_level_params(params: &str) -> Vec<&str> {
623    let mut out = Vec::new();
624    let mut depth = 0isize;
625    let mut start = 0usize;
626    for (offset, ch) in params.char_indices() {
627        match ch {
628            '(' | '[' | '{' => depth += 1,
629            ')' | ']' | '}' => depth -= 1,
630            ',' if depth == 0 => {
631                out.push(&params[start..offset]);
632                start = offset + 1;
633            }
634            _ => {}
635        }
636    }
637    out.push(&params[start..]);
638    out
639}
640
641#[cfg(test)]
642mod tests {
643    use std::collections::BTreeSet;
644
645    use super::{
646        entrypoint_modules, find_cli_script, get_stdlib_prompt_asset, get_stdlib_source,
647        matching_paren_len, parse_public_function_line, public_functions_for_module,
648        STDLIB_CLI_SCRIPTS, STDLIB_PROMPT_ASSETS, STDLIB_SOURCES,
649    };
650
651    #[test]
652    fn stdlib_sources_are_non_empty() {
653        for entry in STDLIB_SOURCES {
654            assert!(
655                !entry.source.trim().is_empty(),
656                "{} should have non-empty source",
657                entry.module
658            );
659        }
660    }
661
662    #[test]
663    fn cli_scripts_are_non_empty_and_uniquely_named() {
664        let mut seen = BTreeSet::new();
665        for entry in STDLIB_CLI_SCRIPTS {
666            assert!(
667                !entry.source.trim().is_empty(),
668                "cli/{} should have non-empty source",
669                entry.name
670            );
671            assert!(
672                seen.insert(entry.name),
673                "cli/{} is registered more than once in STDLIB_CLI_SCRIPTS",
674                entry.name
675            );
676        }
677    }
678
679    #[test]
680    fn find_cli_script_round_trips() {
681        for entry in STDLIB_CLI_SCRIPTS {
682            assert_eq!(find_cli_script(entry.name), Some(entry.source));
683        }
684        assert!(find_cli_script("not-a-real-script").is_none());
685    }
686
687    #[test]
688    fn stdlib_source_names_are_unique() {
689        let mut names = BTreeSet::new();
690        for entry in STDLIB_SOURCES {
691            assert!(names.insert(entry.module), "duplicate {}", entry.module);
692        }
693    }
694
695    #[test]
696    fn stdlib_prompt_assets_are_non_empty() {
697        for entry in STDLIB_PROMPT_ASSETS {
698            assert!(
699                !entry.source.trim().is_empty(),
700                "{} should have non-empty prompt asset source",
701                entry.path
702            );
703        }
704    }
705
706    #[test]
707    fn stdlib_prompt_asset_paths_are_unique() {
708        let mut paths = BTreeSet::new();
709        for entry in STDLIB_PROMPT_ASSETS {
710            assert!(paths.insert(entry.path), "duplicate {}", entry.path);
711        }
712    }
713
714    #[test]
715    fn key_stdlib_modules_resolve() {
716        for module in [
717            "context",
718            "context/maintenance",
719            "context/eval",
720            "eval/stats",
721            "eval/agreement",
722            "edit",
723            "verification",
724            "disclosure",
725            "artifact/web",
726            "command",
727            "waitpoint",
728            "llm/handlers",
729            "llm/tool_middleware",
730            "llm/tool_binder",
731            "llm/missing_tool_call",
732            "llm/ensemble",
733            "llm/rerank",
734            "personas/prelude",
735            "personas/bulletins",
736            "agent/host_tools",
737            "agent/host_injection",
738            "agent/tool_lifecycle",
739            "agent/user",
740            "agent/governors",
741            "agent/guardrails",
742            "cli",
743            "cli/models/batch_artifacts",
744            "cli/models/batch_cancel",
745            "cli/models/batch_download",
746            "cli/models/batch_lifecycle",
747            "cli/models/batch_status",
748            "cli/models/batch_submit",
749            "cli/models/batch_transport",
750            "cli/models/lora_render",
751            "llm/optimize",
752            "llm/judge",
753            "llm/faithfulness",
754            "llm/refine",
755            "connectors/shared",
756            "connectors/github",
757            "connectors/linear",
758            "connectors/notion",
759            "connectors/slack",
760            "triage",
761            "dashboard/jobs",
762            "ui_resource",
763            "host_lease",
764        ] {
765            assert!(
766                get_stdlib_source(module).is_some(),
767                "std/{module} should resolve"
768            );
769        }
770    }
771
772    #[test]
773    fn key_stdlib_prompt_assets_resolve() {
774        for path in [
775            "std/agent/prompts/tool_contract_text.harn.prompt",
776            "std/agent/prompts/default_nudge.harn.prompt",
777            "std/agent/prompts/completion_judge_default.harn.prompt",
778            "std/workflow/prompts/stage.harn.prompt",
779            "std/orchestration/prompts/compaction_summary.harn.prompt",
780            "std/orchestration/prompts/compaction_policy_replacement.harn.prompt",
781        ] {
782            assert!(
783                get_stdlib_prompt_asset(path).is_some(),
784                "{path} should resolve"
785            );
786        }
787    }
788
789    #[test]
790    fn public_function_catalog_derives_signatures_from_harn_source() {
791        let exports = public_functions_for_module("workflow/execute");
792        assert_eq!(exports.len(), 1);
793        assert_eq!(exports[0].name, "workflow_execute");
794        assert_eq!(
795            exports[0].signature,
796            "workflow_execute(task, graph, artifacts = nil, options = nil)"
797        );
798        assert_eq!(exports[0].required_params, 2);
799        assert_eq!(exports[0].total_params, 4);
800    }
801
802    #[test]
803    fn command_stdlib_module_exports_step_helpers() {
804        let exports = public_functions_for_module("command")
805            .into_iter()
806            .map(|function| function.name)
807            .collect::<BTreeSet<_>>();
808        for name in [
809            "command_run",
810            "command_wait",
811            "command_cancel",
812            "command_run_streaming",
813            "command_output_tail",
814            "command_json",
815            "command_json_step",
816            "command_try",
817            "command_step",
818            "command_steps_append",
819            "command_last_failed_step",
820            "command_step_ref",
821        ] {
822            assert!(exports.contains(name), "std/command should export {name}");
823        }
824    }
825
826    #[test]
827    fn disclosure_stdlib_module_exports_render_helpers() {
828        let exports = public_functions_for_module("disclosure")
829            .into_iter()
830            .map(|function| function.name)
831            .collect::<BTreeSet<_>>();
832        assert!(
833            exports.contains("render"),
834            "std/disclosure should export render"
835        );
836        assert!(
837            exports.contains("git_trailers"),
838            "std/disclosure should export git_trailers"
839        );
840        assert!(
841            exports.contains("slack_message_disclosure"),
842            "std/disclosure should export slack_message_disclosure"
843        );
844        assert!(
845            exports.contains("append_git_trailers"),
846            "std/disclosure should export append_git_trailers"
847        );
848    }
849
850    #[test]
851    fn async_stdlib_exports_predicate_backoff_name_only() {
852        let exports = public_functions_for_module("async")
853            .into_iter()
854            .map(|function| function.name)
855            .collect::<BTreeSet<_>>();
856        assert!(
857            exports.contains("retry_predicate_with_backoff"),
858            "std/async should export retry_predicate_with_backoff"
859        );
860        assert!(
861            !exports.contains("retry_with_backoff"),
862            "std/async should not retain the old retry_with_backoff export"
863        );
864    }
865
866    #[test]
867    fn signal_stdlib_module_exports_interrupt_helpers() {
868        let exports = public_functions_for_module("signal")
869            .into_iter()
870            .map(|function| function.name)
871            .collect::<BTreeSet<_>>();
872        for name in [
873            "on_interrupt",
874            "off_interrupt",
875            "interrupted",
876            "with_interrupt",
877        ] {
878            assert!(exports.contains(name), "std/signal should export {name}");
879        }
880    }
881
882    #[test]
883    fn git_stdlib_module_exports_local_wrappers() {
884        let exports = public_functions_for_module("git")
885            .into_iter()
886            .map(|function| function.name)
887            .collect::<BTreeSet<_>>();
888        for name in [
889            "git_run",
890            "git_status",
891            "git_current_branch",
892            "git_log",
893            "git_switch",
894            "git_pull_ff_only",
895            "git_find_tool",
896            "git_run_tool",
897            "git_tools",
898            "git_toolbox_tools",
899        ] {
900            assert!(exports.contains(name), "std/git should export {name}");
901        }
902    }
903
904    #[test]
905    fn agent_workers_exports_suspend_resume_wrappers() {
906        let exports = public_functions_for_module("agent/workers");
907        let suspend = exports
908            .iter()
909            .find(|function| function.name == "suspend_agent")
910            .expect("std/agent/workers should export suspend_agent");
911        assert_eq!(
912            suspend.signature,
913            "suspend_agent(worker, reason = \"\", options = nil)"
914        );
915        assert_eq!(suspend.required_params, 1);
916        assert_eq!(suspend.total_params, 3);
917
918        let resume = exports
919            .iter()
920            .find(|function| function.name == "resume_agent")
921            .expect("std/agent/workers should export resume_agent");
922        assert_eq!(
923            resume.signature,
924            "resume_agent(worker_or_snapshot, resume_input = nil, continue_transcript = true)"
925        );
926        assert_eq!(resume.required_params, 1);
927        assert_eq!(resume.total_params, 3);
928
929        let stop = exports
930            .iter()
931            .find(|function| function.name == "agent_stop")
932            .expect("std/agent/workers should export agent_stop");
933        assert_eq!(
934            stop.signature,
935            "agent_stop(worker, options: AgentStopOptions = nil)"
936        );
937        assert_eq!(stop.required_params, 1);
938        assert_eq!(stop.total_params, 2);
939
940        let parse_resume = exports
941            .iter()
942            .find(|function| function.name == "parse_resume_conditions")
943            .expect("std/agent/workers should export parse_resume_conditions");
944        assert_eq!(
945            parse_resume.signature,
946            "parse_resume_conditions(conditions = nil) -> ResumeConditions?"
947        );
948        assert_eq!(parse_resume.required_params, 0);
949        assert_eq!(parse_resume.total_params, 1);
950
951        let lifecycle = exports
952            .iter()
953            .find(|function| function.name == "agent_lifecycle_tools")
954            .expect("std/agent/workers should export agent_lifecycle_tools");
955        assert_eq!(
956            lifecycle.signature,
957            "agent_lifecycle_tools(registry = nil, options = nil)"
958        );
959        assert_eq!(lifecycle.required_params, 0);
960        assert_eq!(lifecycle.total_params, 2);
961    }
962
963    #[test]
964    fn tui_stdlib_module_exports_terminal_helpers() {
965        let exports = public_functions_for_module("tui")
966            .into_iter()
967            .map(|function| function.name)
968            .collect::<BTreeSet<_>>();
969        for name in ["page", "terminal_width", "rule", "clear", "select_from"] {
970            assert!(exports.contains(name), "std/tui should export {name}");
971        }
972    }
973
974    #[test]
975    fn semver_stdlib_module_exports_release_helpers() {
976        let exports = public_functions_for_module("semver")
977            .into_iter()
978            .map(|function| function.name)
979            .collect::<BTreeSet<_>>();
980        for name in [
981            "strip_v",
982            "add_v",
983            "is_v_semver",
984            "parse",
985            "max_canonical_tag",
986            "next",
987            "bump_type",
988            "version_from_release_branch",
989            "version_from_tag",
990        ] {
991            assert!(exports.contains(name), "std/semver should export {name}");
992        }
993    }
994
995    #[test]
996    fn changelog_stdlib_module_exports_typed_primitives() {
997        let exports = public_functions_for_module("changelog")
998            .into_iter()
999            .map(|function| function.name)
1000            .collect::<BTreeSet<_>>();
1001        for name in [
1002            "changelog_validate_categories",
1003            "changelog_parse_fragment",
1004            "changelog_order_fragments",
1005            "changelog_normalize_fragment_body",
1006            "changelog_assemble_fragments",
1007            "changelog_parse_sections",
1008            "changelog_find_section",
1009            "changelog_merge_unreleased",
1010        ] {
1011            assert!(exports.contains(name), "std/changelog should export {name}");
1012        }
1013    }
1014
1015    #[test]
1016    fn text_stdlib_module_exports_regex_and_pad_helpers() {
1017        let exports = public_functions_for_module("text")
1018            .into_iter()
1019            .map(|function| function.name)
1020            .collect::<BTreeSet<_>>();
1021        for name in [
1022            "pad_left",
1023            "pad_right",
1024            "repeat_string",
1025            "regex_first_capture",
1026            "regex_capture_groups",
1027            "regex_all_first_captures",
1028        ] {
1029            assert!(exports.contains(name), "std/text should export {name}");
1030        }
1031    }
1032
1033    #[test]
1034    fn harn_entrypoint_catalog_is_declared_by_stdlib_sources() {
1035        let modules = entrypoint_modules();
1036        let entries = modules
1037            .iter()
1038            .map(|module| (module.import_path.as_str(), module.category.as_str()))
1039            .collect::<BTreeSet<_>>();
1040        for entry in [
1041            ("std/agent/loop", "agent.stdlib"),
1042            ("std/agent/turn", "agent.stdlib"),
1043            ("std/agent/primitives", "agent.stdlib"),
1044            ("std/workflow/execute", "workflow.stdlib"),
1045        ] {
1046            assert!(entries.contains(&entry), "{entry:?} should be declared");
1047        }
1048    }
1049
1050    #[test]
1051    fn matching_paren_len_closes_on_every_bracket_kind() {
1052        // Each closer kind must terminate the scan once depth returns to zero,
1053        // mirroring the symmetric opener arm and `split_top_level_params`.
1054        assert_eq!(matching_paren_len("a, b)"), Some(4));
1055        assert_eq!(matching_paren_len("x: [int])"), Some(8));
1056        assert_eq!(matching_paren_len("x: {a: int})"), Some(11));
1057        // A top-level `]`/`}` is the matching close for the consumed opener and
1058        // must return rather than scanning to the end and yielding `None`.
1059        assert_eq!(matching_paren_len("x]"), Some(1));
1060        assert_eq!(matching_paren_len("x}"), Some(1));
1061        assert_eq!(matching_paren_len("unterminated"), None);
1062    }
1063
1064    #[test]
1065    fn parse_public_function_line_handles_record_typed_params() {
1066        let parsed =
1067            parse_public_function_line("pub fn configure(opts: {retries: int}) -> bool", None)
1068                .expect("signature with a record-typed parameter should parse");
1069        assert_eq!(parsed.name, "configure");
1070        assert_eq!(parsed.signature, "configure(opts: {retries: int}) -> bool");
1071        assert_eq!(parsed.total_params, 1);
1072        assert_eq!(parsed.required_params, 1);
1073    }
1074}