Agent Script codegen backend: flat n-ary guard ladder for the requirement-dag Space - #29
Closed
jdonaldson wants to merge 3 commits into
Closed
Agent Script codegen backend: flat n-ary guard ladder for the requirement-dag Space#29jdonaldson wants to merge 3 commits into
jdonaldson wants to merge 3 commits into
Conversation
Second emit target next to burr_source(): the recognized decision table compiles to a Salesforce Agent Script .agent file. Key finding baked into the emitter: Agent Script has no elif AND its shipped linter rejects nested if (contradicting SPEC.md §5.8's own advice), so n-ary choice must compile to a FLAT ladder of mutually-exclusive guards carrying full path conjunctions — the decision-table normal form the probe already recognizes. emit_ladder() is n-ary (k-check chains plug in when the recognizer grows); today's single-check tables are the two-row special case. All 5 non-abstain demo examples validate 0-diagnostic against @sf-agentscript/agentforce (language 2.18.0 override needed — published pin is internally broken); elif and nested-if controls are rejected by the same toolchain.
The real stakeholder requirement that motivated the n-ary work: two out-of-library checks (VIP, repeat-customer) + an unenrolled action (free gift) + a chain structure past the single-check recognizer. Routes to the abstain path; intro explains why and what's open.
…eam derived Enroll CheckVIP / CheckRepeatCustomer / SendFreeGift as mock actions (no probe heads — the recognizer cannot demand them) and, for the ONE bundled VIP example, follow the honest abstain banner with a clearly-labeled MOCK preview: a hand-supplied 3-row decision table from which the n-ary DAG, Burr program (elif via ordered when() transitions), and Agent Script flat guard ladder are all derived symbolically. render_svg generalized to take n-ary guard edges/lanes (legacy single-check path untouched). Mock Agent Script validates 0-diagnostic with @sf-agentscript/agentforce; examples 0-5 regression-checked.
Owner
Author
|
Closing unmerged by design: this branch is the HF Space / Agentforce demo source, kept separate from main. The Space at hf.co/spaces/jdonaldson/requirement-dag deploys directly from this branch's experiments/agentforce_space/ via hf upload; future Space work continues here. |
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.
What
Adds a second codegen target to the requirement-dag HF Space: the recognized decision table now compiles to a Salesforce Agent Script
.agentfile alongside the Burr state machine.The finding that shaped the emitter
Agent Script has no
elif, and its shipped linter also rejects nestedif("Combine conditions with 'and'/'or'") — contradicting the repo's own SPEC.md §5.8, which recommends nesting. So an n-ary conditional must be emitted as a flat ladder of mutually-exclusive guards, row i carrying its full path conjunction (if not f1 and f2:). That is the decision-table normal form — exactly the object the probe recognizes, so the recognized table maps 1:1 onto Agentforce's reviewable artifact.Validation
@sf-agentscript/agentforce2.5.34 withlanguageoverridden to 2.18.0 — the published pin is internally inconsistent and won't import otherwise; packages live under the@sf-agentscript/*npm scope, not@agentscript/*as their README says).elif→ syntax error; minimal nested-if→ the no-nesting lint. The validator has teeth.not is_lateworld.emit_ladder()is n-ary — k-check elif chains plug in unchanged when the recognizer grows past one check (the Stefan requirement thread); today's single-check tables are the two-row special case.🤖 Generated with Claude Code