Repository navigation
Add script_create: create jobs from scripts with a stable contract - #5
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
script_create, a new intent kind that gives scripts, CI and other agents a supported way to create jobs. Until now the only route wascarly_create, Carly's internal message. Using it marked jobsby Carly, announced them as "Carly scheduled …", and relied on fields that were never meant to be stable.Credit to @roverdude24: their #4 documented how to create jobs by writing
carly_createintents. That showed scripts need a supported way to do this. This PR builds it as a separate public kind, socarly_createstays internal and script-made jobs aren't labelled as Carly's.Contract (README → "From a script")
<data folder>/intents/<digits>-<alnum>-<digits>.json. Write it under a temporary name and rename it into place. Agent Scheduler answers inreplies/<reply>.json, usually within 2–3 s.format: 1,kind: "script_create",reply(12 ×a-z0-9),prompt,when,folder.name,role,quiet_ok,only_when(same flat keys as Carly),source(1–24 ×[A-Za-z0-9_-]) andexpires(unix seconds).approvalorcwdis refused withUnknown field "…"., and a wrong type gets a specific message. A typo can't quietly produce a Hands-off job.by <source>, orby scriptwhen there is nosource; narrow layouts show⚙. The toast and desktop notification read "created_sourceand kept through edits and reloads; an invalid hand-edited value is cleared on load.job_id,name,when,next,next_at(new; unix seconds),folder,role,approval,only_when,quiet_ok,source. Failure reply:{ok:false, error}, using the same wording the form shows.Implementation
carly_create's body is now a sharedcreate_job(reply, fields, origin, h).carly_createandscript_createare thin wrappers around it. Carly keeps her lenient truncation and prompt cap. Her notification text and storedcreated_byare unchanged.jobs.createtakes an optionalsource.created_bycan now beuser,carlyorscript.mgr_common.creator_markreplaces the two copies of the Carly check in the list and live views.AGENTS.mdgains a "Public contracts" note: fields may only be added as optional, andformatchanges only for a breaking change.Testing
bun run test: all files pass. New cases cover:sourceexpiresUnknown field "approval".reply.The version bump and CHANGELOG entry are left for release time.