feat: Add supply-chain-risk-oracle kit#277
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughChangesThe pull request adds a complete Supply Chain Risk Oracle kit with Lamatic scan and email workflows, prompts and processing scripts, server actions, configuration, and a Next.js dashboard for supplier risk analysis and outreach drafting. ChangesSupply Chain Risk Oracle
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
:robot_face: AgentKit Structural ValidationNew Contributions Detected
Check Results
🎉 All checks passed! This contribution follows the AgentKit structure. |
|
Failure recorded at 2026-07-20T13:13:39Z UTC. If this PR is not fixed within 4 weeks it will be automatically closed. |
There was a problem hiding this comment.
Actionable comments posted: 8
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/supply-chain-risk-oracle/apps/actions/orchestrate.ts`:
- Around line 40-48: Harden runSupplyChainScan output by normalizing every
risk_matrix entry with defaults for missing SupplierRisk fields, including
risk_factors as an empty array and risk_score plus other promised fields as
appropriate. Also update both kits/supply-chain-risk-oracle/apps/app/page.tsx
sites at lines 102 and 188-189 to use optional risk_factors mapping with an
empty-array fallback in EmailModal and SupplierAccordion.
- Around line 76-77: Update the cleaning logic immediately before JSON.parse in
the draft parsing flow to trim raw before removing the opening and closing code
fences, then retain the final trim. Ensure fenced JSON with leading blank lines
or trailing newlines is normalized so JSON.parse receives only the payload.
- Around line 28-33: Remove news_api_key and weather_api_key from the
executeFlow input object in the orchestration flow. Configure the flow to obtain
these credentials through its supported secret or environment-variable
mechanism, while preserving the suppliers and scan_focus inputs and the existing
NEWS_API_KEY and WEATHER_API_KEY configuration names.
- Around line 3-4: Validate each risk_matrix entry in the action before
returning flow output, ensuring every supplier has risk_factors and all required
SupplierRisk fields expected by apps/app/page.tsx; reject or handle malformed
entries instead of returning them. Apply the root fix in
kits/supply-chain-risk-oracle/apps/actions/orchestrate.ts (lines 3-4);
kits/supply-chain-risk-oracle/apps/lib/config.ts (lines 7-16) requires no direct
change.
In `@kits/supply-chain-risk-oracle/apps/app/page.tsx`:
- Around line 161-176: Make the supplier accordion control in the
supplier-row-head element keyboard accessible by adding an appropriate
button-like role, tabIndex, and keyboard handler that toggles open for Enter and
Space while preserving the existing click behavior. Ensure assistive
technologies can identify its expanded state so keyboard and screen-reader users
can reach the row’s inquiry content.
- Around line 71-149: Update the EmailModal root dialog to support keyboard
dismissal and accessible dialog semantics: add role="dialog", aria-modal="true",
and an onKeyDown handler that calls onClose when Escape is pressed. Ensure
keyboard focus is contained within the modal while it is open, using the
component’s existing modal structure and controls.
In `@kits/supply-chain-risk-oracle/apps/package.json`:
- Line 24: Update the tailwindcss dependency in the package manifest from the
current 3.x range to a Tailwind CSS v4 or newer release, preserving the existing
dependency configuration.
In `@kits/supply-chain-risk-oracle/prompts/scan-system.md`:
- Around line 1-3: Remove the cosmetic heading and following blank line from
kits/supply-chain-risk-oracle/prompts/scan-system.md at lines 1-3, leaving the
prompt content as the file’s first text. In
kits/supply-chain-risk-oracle/prompts/email-system.md at lines 1-36, remove the
“Email Drafting System Prompt” heading and all two-space indentation throughout
the file.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 0c667b5f-7773-4425-8351-41c4653d3a24
⛔ Files ignored due to path filters (1)
kits/supply-chain-risk-oracle/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (33)
kits/supply-chain-risk-oracle/.env.examplekits/supply-chain-risk-oracle/.gitignorekits/supply-chain-risk-oracle/README.mdkits/supply-chain-risk-oracle/agent.mdkits/supply-chain-risk-oracle/apps/.env.examplekits/supply-chain-risk-oracle/apps/.gitignorekits/supply-chain-risk-oracle/apps/actions/orchestrate.tskits/supply-chain-risk-oracle/apps/app/globals.csskits/supply-chain-risk-oracle/apps/app/layout.tsxkits/supply-chain-risk-oracle/apps/app/page.tsxkits/supply-chain-risk-oracle/apps/lib/config.tskits/supply-chain-risk-oracle/apps/lib/lamatic-client.tskits/supply-chain-risk-oracle/apps/lib/types.tskits/supply-chain-risk-oracle/apps/next-env.d.tskits/supply-chain-risk-oracle/apps/next.config.mjskits/supply-chain-risk-oracle/apps/package.jsonkits/supply-chain-risk-oracle/apps/postcss.config.mjskits/supply-chain-risk-oracle/apps/tailwind.config.tskits/supply-chain-risk-oracle/apps/tsconfig.jsonkits/supply-chain-risk-oracle/constitutions/default.mdkits/supply-chain-risk-oracle/flows/supply-chain-email-draft.tskits/supply-chain-risk-oracle/flows/supply-chain-scan.tskits/supply-chain-risk-oracle/lamatic.config.tskits/supply-chain-risk-oracle/model-configs/supply-chain-email-draft_draft.tskits/supply-chain-risk-oracle/model-configs/supply-chain-scan_parse.tskits/supply-chain-risk-oracle/model-configs/supply-chain-scan_score.tskits/supply-chain-risk-oracle/model-configs/supply-chain-scan_search.tskits/supply-chain-risk-oracle/prompts/email-system.mdkits/supply-chain-risk-oracle/prompts/scan-system.mdkits/supply-chain-risk-oracle/prompts/supply-chain-email-draft_draft_user.mdkits/supply-chain-risk-oracle/prompts/supply-chain-scan_parse_user.mdkits/supply-chain-risk-oracle/prompts/supply-chain-scan_score_user.mdkits/supply-chain-risk-oracle/prompts/supply-chain-scan_search_user.md
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/supply-chain-risk-oracle/scripts/supply-chain-scan_build-output.ts`:
- Around line 3-25: Replace the top-level return in the parsed-response handler
with standard if/else control flow: track parse failure, treat null or otherwise
absent parsed values as errors, and assign the existing fallback output without
returning. Only access parsed.risk_matrix and parsed.summary in the successful
branch, preserving the existing output structure and safely filtering supplier
entries.
In `@kits/supply-chain-risk-oracle/scripts/supply-chain-scan_build-query.ts`:
- Around line 3-14: Harden the supplier extraction and query construction around
the suppliers and locationTerms logic: wrap JSON parsing and payload extraction
in try/catch, normalize non-array results to an empty array, and safely ignore
suppliers without a usable location. Filter empty location terms and append the
location clause only when terms exist, so newsQuery never ends with an empty
pair of parentheses.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: 8f63076b-8133-483a-86ac-ba9fc82b3909
📒 Files selected for processing (3)
kits/supply-chain-risk-oracle/scripts/supply-chain-scan_build-output.tskits/supply-chain-risk-oracle/scripts/supply-chain-scan_build-query.tskits/supply-chain-risk-oracle/scripts/supply-chain-scan_format-api-data.ts
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@kits/supply-chain-risk-oracle/apps/.gitignore`:
- Line 5: Update the .gitignore rules around the existing .vercel entry to
ignore all .env.* environment-file variants while explicitly allowing the
intended environment template file. Preserve the existing ignore behavior and
ensure production and development environment files cannot be committed.
In `@kits/supply-chain-risk-oracle/apps/app/page.tsx`:
- Around line 169-176: Update the supplier-row keyboard handler on the accordion
element to call e.preventDefault() when the Space key is pressed before toggling
open state, while preserving Enter behavior and the existing setOpen logic.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro
Run ID: e7ef7b3a-b7ed-497b-9a1e-0db9904d2bfe
⛔ Files ignored due to path filters (1)
kits/supply-chain-risk-oracle/apps/package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (15)
kits/supply-chain-risk-oracle/.env.examplekits/supply-chain-risk-oracle/README.mdkits/supply-chain-risk-oracle/apps/.env.examplekits/supply-chain-risk-oracle/apps/.gitignorekits/supply-chain-risk-oracle/apps/actions/orchestrate.tskits/supply-chain-risk-oracle/apps/app/globals.csskits/supply-chain-risk-oracle/apps/app/page.tsxkits/supply-chain-risk-oracle/apps/package.jsonkits/supply-chain-risk-oracle/apps/postcss.config.mjskits/supply-chain-risk-oracle/lamatic.config.tskits/supply-chain-risk-oracle/prompts/email-system.mdkits/supply-chain-risk-oracle/prompts/scan-system.mdkits/supply-chain-risk-oracle/scripts/supply-chain-scan_build-output.tskits/supply-chain-risk-oracle/scripts/supply-chain-scan_build-query.tskits/supply-chain-risk-oracle/scripts/supply-chain-scan_format-api-data.ts
💤 Files with no reviewable changes (1)
- kits/supply-chain-risk-oracle/.env.example
|
Hi @KURO-1125! 👋 Before this PR can be reviewed by maintainers, please resolve all comments and requested changes from the CodeRabbit automated review. Steps to follow:
This helps keep the review process efficient for everyone. Thank you! 🙏 |
All the coderabbit reviews has been resolved and coderabbit has approved the changes as well. |
Supply Chain Risk Oracle
Adds a full-stack Kit that autonomously scans global disruption signals for a user-supplied list of suppliers, scores each node 0–100, and drafts professional mitigation emails for high-risk suppliers.
Problem
Procurement and logistics teams learn about supply chain disruptions after they have already caused delays. There is no existing kit in AgentKit that addresses proactive supplier risk monitoring.
What this kit does
Live Demo
https://supply-chain-risk-oracle.vercel.app
Load the sample data and click Run risk scan to see it in action.
Flows
supply-chain-scansupply-chain-email-draftTech stack
PR Checklist
1. Select Contribution Type
kits/<category>/<kit-name>/)bundles/<bundle-name>/)templates/<template-name>/)2. General Requirements
kebab-caseand matches the flow IDREADME.md(purpose, setup, usage)3. File Structure (Check what applies)
config.jsonpresent with valid metadata (name, description, tags, steps, author, env keys)flows/<flow-name>/(where applicable) include:config.json(Lamatic flow export)inputs.jsonmeta.jsonREADME.md.env.examplewith placeholder values only (kits only)config.jsonnode graphs (changes via Lamatic Studio export)4. Validation
npm install && npm run devworks locally (kits: UI runs; bundles/templates: flows are valid)[kit] Add <name> for <use case>)kits/supply-chain-risk-oracleKit scaffolding and documentation:.env.example,README.md,agent.md,constitutions/default.md,lamatic.config.ts.gitignoreflows/supply-chain-scan.ts: node graphtriggerNode→dynamicNode(LLM parse) →dynamicNode(code: build API queries) →dynamicNode(apiNode: NewsAPI + OpenWeatherMap) →dynamicNode(code: format API data) →dynamicNode(LLM search) →dynamicNode(LLM score/synthesize) →dynamicNode(code: build output) →graphqlResponseNoderesponse (defaultEdge+ finalresponseEdge). Producesrisk_matrix,high_risk_suppliers,scan_timestamp,summary.flows/supply-chain-email-draft.ts: node graphtriggerNode→dynamicNode(LLM draft) →graphqlResponseNoderesponse. Producesemail_subject,email_body,urgency_levelfor high-risk suppliers.prompts/scan-system.md,supply-chain-scan_parse_user.md,supply-chain-scan_search_user.md,supply-chain-scan_score_user.md,email-system.md,supply-chain-email-draft_draft_user.mdmodel-configs/supply-chain-scan_*andmodel-configs/supply-chain-email-draft_draft.ts(empty memories/messages/attachments arrays)scripts/supply-chain-scan_build-query.tsscripts/supply-chain-scan_format-api-data.tsscripts/supply-chain-scan_build-output.ts(JSON parsing incl. markdown code-fence stripping + fallback error output)kits/supply-chain-risk-oracle/apps:apps/.env.example,apps/.gitignore,package.json,next.config.mjs,tsconfig.json,next-env.d.ts,postcss.config.mjsapp/layout.tsx,app/page.tsx,app/globals.css(risk dashboard, expandable supplier rows, email-draft modal)apps/lib/config.ts(env/flow IDs + Lamatic credentials)apps/lib/lamatic-client.ts(validates required config)apps/lib/types.ts(typed risk/scan/email contracts +ActionResult)apps/actions/orchestrate.ts(server actionsrunSupplyChainScan+draftSupplierEmail, including normalization/clamping and flexible JSON parsing for email generation)