inputs feature needs to be restored hero_proc #137
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_proc#137
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
⏺ inputs, input_schema, JobCreateInput, and HERO_INPUT_* are completely absent from the SDK. The entire §1.5 "typed inputs" section
documents a feature that no longer exists. Now I have everything I need. Let me make all the corrections:
dont forget to use the oschema
inputs feature needs to be restoredto inputs feature needs to be restored hero_procImplementation Spec for #137 — Restore typed inputs end-to-end
Root cause
The typed-inputs feature is half-present. The server runtime still works through the legacy db-RPC
job.createpath:crates/hero_proc_server/src/rpc/job.rshandle_createreads an optionalinputsobject and callsapply_inputs()(job.rs:132), which renders{{var}}/{{nested.path}}intospec.script, everyspec.envvalue, andspec.ai_config.{system_prompt,model}(ai only), and injectsHERO_INPUT_<UPPERCASE_KEY>for non-ai interpreters. The{{var}}engine lives incrates/hero_proc_server/src/actions/template.rsandAction.input_schemastill persists and is exposed (oschemajobs/10_action.oschema:94; mapped atjobs_impl.rs:271/303/995).What broke is the SDK surface. The multi-domain SDK creates jobs only through
run_quick_submit(RunSpec)(jobs_impl.rs:2608).RunSpec(oschema/jobs/40_run.oschema:37) has noinputsfield, andrun_quick_submitbuilds each job fromaction_from_api(action)and persists it (jobs_impl.rs:2647-2669) without ever callingapply_inputs. The old flatjob_create(JobCreateInput{spec,context,inputs})was dropped in the domain merge (MIGRATION_REMAP.md:34), soinputs/JobCreateInput/HERO_INPUT_*now exist only in the docs (docs/api.md§1.5 and friends). The docs describe a feature the SDK can no longer reach.Design (oschema-first, fully generated types)
Two complementary, oschema-driven changes — no hand-written wire types:
RunSpec.inputs— add one fieldinputs: {str: any}toRunSpec.{str: any}generatesHashMap<String, serde_json::Value>in both the server model and the SDK type.run_quick_submitconverts it to a JSON object once and calls the existingapply_inputsfor every action before the job is built. This fixes the actual bug and makes the quick-submit/run path honor inputs.job_createmethod — addjob_create(spec: Action, context: str, inputs: {str: any}) -> strto the Jobs service in90_rpc.oschema. The codegen packs multi-param methods into a per-method input struct (verified inherolib_macros), so this generates exactly:restoring the documented
JobCreateInput{spec, context, inputs}as a generated type andjobs().job_create(...)as a generated SDK call. The server handler mirrors the existingjob.rs handle_create(one-shot job, reuseapply_inputs) and returns the new job sid.input_schemastays declarative (persisted + exposed, not enforced) — matching the current docs. The no-inputs path is unchanged:apply_inputsshort-circuits on an empty map (job.rs:138), and emptyinputs/contextare valid defaults.Files to modify
crates/hero_proc_server/oschema/jobs/40_run.oschema— addinputs: {str: any}toRunSpec.crates/hero_proc_server/oschema/jobs/90_rpc.oschema— add thejob_create(...)method toservice Jobs.crates/hero_proc_server/src/rpc/impls/jobs_impl.rs— threadspec.inputsintoapply_inputsinsiderun_quick_submit; implement the newjob_createtrait method (reusingcrate::rpc::job::apply_inputs).crates/hero_proc_sdk/src/{factory.rs,builders.rs}— setinputs: Default::default()on the existingRunSpec { .. }literals so no-inputs callers still compile; add a small.inputs(..)builder convenience and surfacejob_create.crates/hero_proc_admin/docs/{api.md,overview.md,service_specs.md,cli_reference.md}— reconcile §1.5 with the restored surface (and fix the stalehero_proc_lib/src/template.rspath; the engine is inhero_proc_server/src/actions/template.rs).Implementation plan
40_run.oschemaand90_rpc.oschemaas above. Regenerate by buildinghero_proc_sdk; confirm the generated SDK types and OpenRPC json now containRunSpec.inputs,JobCreateInput, and thejob_createmethod. (Generated files are never hand-edited.) Dependencies: none.run_quick_submit, build aserde_json::Value::Objectfromspec.inputsonce, thenapply_inputs(&mut action_spec, &inputs_value)for each action before constructing theJob. Dependencies: step 1.job_createtrait method:action_from_api(&spec),apply_inputs, build the one-shotJob, persist, return the sid. Dependencies: step 1.inputs: Default::default()to theRunSpecliterals, an.inputs(..)setter on the run/job builders, and confirmjobs().job_create(..)is reachable. Dependencies: step 1.HERO_INPUT_*; thehero_proc_testharness.Acceptance criteria
inputsare passable through the multi-domain SDK (viaRunSpec.inputsandJobCreateInput).{{var}}/{{nested.path}}render inspec.script, everyspec.envvalue, andai_config.{system_prompt,model}(ai only); unresolved placeholders stay literal.HERO_INPUT_<UPPERCASE_KEY>(strings verbatim, non-strings JSON-serialized).input_schemapersists and is exposed.JobCreateInput/inputs/input_schema/HERO_INPUT_*exist in the SDK and §1.5 is accurate (the greet example actually works).Notes
run_quick_submitnever callingapply_inputs; addingRunSpec.inputswithout that call would silently drop inputs.RunSpec.inputsapplies one input set to every action in the run, which matches the single-action §1.5 use case; per-action inputs would be a futureActionfield, out of scope here.--db-path), not the shared daemon.Implemented — PR #140
Typed inputs are restored end-to-end on the multi-domain jobs surface, oschema-first.
Files changed
jobs/40_run.oschema(RunSpec.inputs),jobs/30_job.oschema(JobCreate struct),jobs/90_rpc.oschema(job_create method);openrpc/openrpc_jobs.jsonregenerated.rpc/impls/jobs_impl.rs— thread RunSpec.inputs throughapply_inputsinrun_quick_submit; implementjob_createreusingapply_inputs.factory.rs+builders.rs— generatedJobCreate/JobCreateInputsurfaced;.input()/.inputs()on job/run builders;.input_schema()onActionBuilder; job builder creates viajob_create.docs/api.mdtyped-inputs section + banner reconciled; stale template path fixed.tests/basic/jobs_quick.rsnewtyped_inputs_render_and_envcase.How inputs flow now
SDK
JobCreateInput { req: JobCreate { spec, context, inputs } }(orRunSpec.inputs) → wirejob_create/run_quick_submit→ server renders{{var}}/{{nested.path}}intospec.script, everyspec.envvalue, and (ai)ai_config, and injectsHERO_INPUT_<UPPER>for non-ai interpreters → job persisted and dispatched. Empty inputs are a no-op, so the no-inputs path is unchanged.input_schemastays declarative (persisted + exposed).Verification
cargo build --workspaceclean;cargo clippy --workspacezero errors (feature crates clean under-D warnings).hi alice (count=3)/hi bob (count=7),HERO_INPUT_NAMEis set in the job env, andinput_schemaround-trips. New test passes.developmentwithout theStateOutput.valuefix included here) and are unrelated to typed inputs; the inputs-adjacentuc40_job_inputs_mappasses when run alone.PR: #140 (development_restore_typed_inputs -> development)