-
Notifications
You must be signed in to change notification settings - Fork 0
feat: wire the inventory domain through the stack #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,7 +108,8 @@ export const DEFAULT_PATHS = Object.freeze({ | |
|
|
||
| const STAGE_NAMES = ["decide", "act", "prove"]; | ||
| const DEMO_FLAG_OPTIONS = new Set(["--dispute", "--json"]); | ||
| const DEMO_VALUE_OPTIONS = new Set(["--response", "--fault", "--prove"]); | ||
| const DEMO_VALUE_OPTIONS = new Set(["--response", "--fault", "--prove", "--domain"]); | ||
| const DEMO_DOMAINS = new Set(["refund", "inventory"]); | ||
| const PROVE_MODES = new Set(["simulate", "rail"]); | ||
| const STDERR_LIMIT = 800; | ||
| /** Child stdout is capped so a runaway tool cannot inflate the run bundle. */ | ||
|
|
@@ -237,7 +238,7 @@ export function helpText() { | |
| return `Agent Action Stack | ||
|
|
||
| Usage: | ||
| aas demo [--response pass|fail] [--fault none|duplicate] [--dispute] [--prove simulate|rail] [--json] | ||
| aas demo [--response pass|fail] [--fault none|duplicate] [--dispute] [--prove simulate|rail] [--domain refund|inventory] [--json] | ||
| aas export <run-id> [--out <path>] | ||
| aas replay <bundle-file|-> [--json] | ||
| aas cases [--json] | ||
|
|
@@ -259,6 +260,7 @@ Options: | |
| --dispute Force MandateBound prove after a settled act | ||
| --prove simulate|rail Prove path: canned operator simulation (default) | ||
| or review of the same-case rail bundle | ||
| --domain refund|inventory Synthetic action domain (default: refund) | ||
| --json Print the run report as JSON | ||
| -h, --help Show this help | ||
|
|
||
|
|
@@ -573,9 +575,13 @@ export function runDecide( | |
| fixturesDir = DEFAULT_PATHS.fixtures, | ||
| runner = runCapture, | ||
| python = null, | ||
| domain = "refund", | ||
| } = {}, | ||
| ) { | ||
| const policyPath = join(fixturesDir, "policy.json"); | ||
| const policyPath = join( | ||
| fixturesDir, | ||
| domain === "inventory" ? "inventory.policy.json" : "policy.json", | ||
| ); | ||
| const pythonPath = join(depsDir, "constitutional-agent-testbench", "src"); | ||
| const decideCli = join(pythonPath, "constitutional_agent_testbench", "cli.py"); | ||
| if (runner === runCapture && !existsSync(decideCli)) { | ||
|
|
@@ -628,13 +634,18 @@ export function runDecide( | |
| */ | ||
| export function runAct( | ||
| fault, | ||
| { depsDir = DEFAULT_PATHS.deps, runner = runCapture, persistRailBundle = false } = {}, | ||
| { | ||
| depsDir = DEFAULT_PATHS.deps, | ||
| runner = runCapture, | ||
| persistRailBundle = false, | ||
| domain = "refund", | ||
| } = {}, | ||
| ) { | ||
| const crctl = join(depsDir, "consequence-rail", "cmd", "crctl.js"); | ||
| if (runner === runCapture && !existsSync(crctl)) { | ||
| throw missingChildTool("act CLI (deps/consequence-rail/cmd/crctl.js)"); | ||
| } | ||
| const args = ["demo", "refund", "--json"]; | ||
| const args = ["demo", domain, "--json"]; | ||
| if (fault && fault !== "none") args.push("--fault", fault); | ||
| const railDir = join(depsDir, "consequence-rail"); | ||
| let scratch = null; | ||
|
|
@@ -1456,7 +1467,15 @@ export async function runDemo(args = [], options = {}) { | |
| if (!PROVE_MODES.has(proveMode)) { | ||
| throw new UsageError("--prove must be simulate or rail"); | ||
| } | ||
| const responsePath = join(paths.fixtures, `response.${responseName}.json`); | ||
| const domain = option(args, "--domain", "refund"); | ||
| if (!DEMO_DOMAINS.has(domain)) { | ||
| throw new UsageError("--domain must be refund or inventory"); | ||
|
Comment on lines
+1470
to
+1472
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Inventory unavailable in guided GUI GUI requests never pass the new Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
| } | ||
| const responseFile = | ||
| domain === "inventory" | ||
| ? `inventory.response.${responseName}.json` | ||
| : `response.${responseName}.json`; | ||
| const responsePath = join(paths.fixtures, responseFile); | ||
| if (!existsSync(responsePath) && !options.runDecideFn) throw new Error(`Missing fixture: ${responsePath}`); | ||
| const runId = options.runId ?? createRunId(options.now ? new Date(options.now) : new Date()); | ||
| const componentProvenance = options.componentResolver | ||
|
|
@@ -1500,6 +1519,7 @@ export async function runDemo(args = [], options = {}) { | |
| depsDir: paths.deps, | ||
| fixturesDir: paths.fixtures, | ||
| runner, | ||
| domain, | ||
| ...(options.python ? { python: options.python } : {}), | ||
| }); | ||
| const decideStderr = clipChildStderr(decide.stderr); | ||
|
|
@@ -1542,6 +1562,7 @@ export async function runDemo(args = [], options = {}) { | |
| const act = await (options.runActFn ?? runAct)(fault, { | ||
| depsDir: paths.deps, | ||
| runner, | ||
| domain, | ||
| persistRailBundle: proveMode === "rail" && options.runActFn === undefined, | ||
| }); | ||
| const outcome = act.raw?.outcome ?? null; | ||
|
|
||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| { | ||
| "policy_id": "aas-inventory-gate-v1", | ||
| "schema_version": "1.0", | ||
| "rules": [ | ||
| { | ||
| "kind": "required_field", | ||
| "path": "summary", | ||
| "rule_id": "summary-present" | ||
| }, | ||
| { | ||
| "kind": "equals", | ||
| "path": "decision", | ||
| "rule_id": "decision-accept", | ||
| "value": "accept" | ||
| }, | ||
| { | ||
| "kind": "one_of", | ||
| "path": "action_type", | ||
| "rule_id": "action-is-allocation", | ||
| "values": ["allocate_inventory"] | ||
| }, | ||
| { | ||
| "kind": "one_of", | ||
| "path": "risk_level", | ||
| "rule_id": "risk-allowed", | ||
| "values": ["low", "moderate"] | ||
| }, | ||
| { | ||
| "kind": "false", | ||
| "path": "blocked", | ||
| "rule_id": "blocked-is-false" | ||
| }, | ||
| { | ||
| "kind": "equals", | ||
| "path": "recourse_required", | ||
| "rule_id": "recourse-required", | ||
| "value": true | ||
| } | ||
| ] | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "summary": "Requested allocation exceeds the bound allowed without recourse.", | ||
| "decision": "deny", | ||
| "action_type": "allocate_inventory", | ||
| "risk_level": "high", | ||
| "blocked": true, | ||
| "recourse_required": false | ||
| } |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "summary": "Authorize a bounded synthetic inventory allocation with recourse reserved before execution.", | ||
| "decision": "accept", | ||
| "action_type": "allocate_inventory", | ||
| "risk_level": "moderate", | ||
| "blocked": false, | ||
| "recourse_required": true | ||
| } |
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
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Unknown domains select refund policy
Direct callers passing a misspelled
domaintorunDecidesilently receive the refund policy. Every value exceptinventoryfollows the refund branch, allowing the wrong policy decision.Was this helpful? React with 👍 or 👎 to provide feedback.