feat: Add chaos-trip-planner kit - #308
Conversation
…nfigs, constitutions)
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughChangesThe mission delivers a Lamatic trip-planning workflow, supporting prompts and configuration, a Next.js application, authenticated workflow execution with polling, validated trip input, and itinerary result rendering. Chaos Trip Planner
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Biome (2.5.5)kits/chaos-trip-planner/scripts/plan-trip_code-node-804_code.tsFile contains syntax errors that prevent linting: Line 1: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{triggerNode_1.output.trav; Line 1: Expected a statement but instead found '}'.; Line 2: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{triggerNode_1.output.days; Line 2: Expected a statement but instead found '}'. 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. |
There was a problem hiding this comment.
Actionable comments posted: 12
🤖 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/chaos-trip-planner/apps/actions/orchestrate.ts`:
- Around line 11-22: Update callLamatic to enforce a request timeout using an
abort signal, check response.ok before parsing the body, and inspect the parsed
GraphQL response for errors. Throw or otherwise propagate descriptive failures
for timeout, non-2xx responses, and GraphQL errors so callers do not treat
invalid responses as successful data.
- Around line 1-22: The workflow integration in orchestrate.ts must use the
lamatic SDK instead of raw GraphQL requests. Replace callLamatic and the inline
ExecuteWorkflow/CheckStatus queries with the package’s executeFlow and
checkStatus functions, and pass the SDK configuration and workflow identifiers
through the existing orchestration flow rather than calling fetch or reading
LAMATIC_FLOW_ID directly.
- Around line 50-57: Update the orchestration flow around callLamatic in
orchestrate.ts to import and use the parent kit’s ../../lamatic.config step
definition for the workflow identifier, specifically the configured “plan-trip”
step, instead of sourcing workflowId only from process.env.LAMATIC_FLOW_ID. Keep
the existing query inputs unchanged and ensure the app remains synchronized with
configuration changes.
In `@kits/chaos-trip-planner/apps/app/results/page.tsx`:
- Around line 40-45: Update the tripResult loading logic in the useEffect to
wrap JSON.parse(stored) in try/catch. If parsing fails, clear or leave trip
unset so the component falls through to the existing “No trip data found” state,
while preserving normal parsing behavior for valid stored data.
In `@kits/chaos-trip-planner/apps/components/TripForm.tsx`:
- Around line 64-115: Add matching id attributes to each input and textarea in
the TripForm fields and set each label’s htmlFor to the corresponding unique id,
covering city, travelDate, days, budget, and preferences. Preserve the existing
values, handlers, and styling.
- Around line 22-35: Update the validation flow in TripForm’s submit handler
after the existing city, days, and budget checks to reject an empty or invalid
travelDate before setLoading(true) and planTrip. Set a clear validation error
and return early, ensuring PrepDates receives a valid date.
In `@kits/chaos-trip-planner/apps/next.config.ts`:
- Around line 1-7: Preserve the kit app configuration contract by renaming the
config represented by nextConfig from next.config.ts to next.config.mjs, or
explicitly update the applicable contract if TypeScript configuration is
intentional. Keep the existing NextConfig settings and default export unchanged.
In `@kits/chaos-trip-planner/apps/package.json`:
- Around line 11-24: Restore the mandated dependency stack in the apps package
manifest by adding lamatic, react-hook-form, zod, and lucide-react with
compatible versions. Update the orchestration flow in orchestrate.ts to use the
Lamatic SDK rather than raw fetch, preserving the existing behavior; only revise
the kit contract instead if the SDK requirement is intentionally being removed.
In `@kits/chaos-trip-planner/apps/README.md`:
- Around line 21-41: Add language tags to both fenced code blocks in the README:
mark the flow diagram block as text and the environment-variable block as dotenv
or bash. Keep the existing block contents unchanged.
- Line 101: Update the itinerary-generation wait-time guidance in the README to
match the 3-second polling interval and 20-attempt limit implemented by
orchestrate.ts, documenting an upper bound of approximately 60 seconds rather
than 20–30 seconds.
- Line 71: Update the Node.js prerequisite in the README to Node.js 20.9.0+ so
it matches the required runtime for next@16.2.11. Keep the existing Next.js
dependency unchanged.
In `@kits/chaos-trip-planner/flows/plan-trip.ts`:
- Line 42: The plan-trip flow contains a dangling `plan_trip_code_node_804_code`
script reference. Add the matching `plan-trip_code-node-804_code.ts` script
under the pack’s scripts directory, implementing the values required by
`codeNode_804` (“PrepDates”) for Weather `start_date`/`end_date` and the
`Forecast Available` variable, or update/remove the reference so no missing
`@scripts` target remains.
🪄 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 Plus
Run ID: d776e59f-ac49-4e78-8632-7a862e364078
⛔ Files ignored due to path filters (7)
kits/chaos-trip-planner/apps/app/favicon.icois excluded by!**/*.icokits/chaos-trip-planner/apps/package-lock.jsonis excluded by!**/package-lock.jsonkits/chaos-trip-planner/apps/public/file.svgis excluded by!**/*.svgkits/chaos-trip-planner/apps/public/globe.svgis excluded by!**/*.svgkits/chaos-trip-planner/apps/public/next.svgis excluded by!**/*.svgkits/chaos-trip-planner/apps/public/vercel.svgis excluded by!**/*.svgkits/chaos-trip-planner/apps/public/window.svgis excluded by!**/*.svg
📒 Files selected for processing (25)
kits/chaos-trip-planner/.gitignorekits/chaos-trip-planner/README.mdkits/chaos-trip-planner/agent.mdkits/chaos-trip-planner/apps/.env.examplekits/chaos-trip-planner/apps/.gitignorekits/chaos-trip-planner/apps/AGENTS.mdkits/chaos-trip-planner/apps/CLAUDE.mdkits/chaos-trip-planner/apps/README.mdkits/chaos-trip-planner/apps/actions/orchestrate.tskits/chaos-trip-planner/apps/app/globals.csskits/chaos-trip-planner/apps/app/layout.tsxkits/chaos-trip-planner/apps/app/page.tsxkits/chaos-trip-planner/apps/app/results/page.tsxkits/chaos-trip-planner/apps/components/TripForm.tsxkits/chaos-trip-planner/apps/eslint.config.mjskits/chaos-trip-planner/apps/next.config.tskits/chaos-trip-planner/apps/package.jsonkits/chaos-trip-planner/apps/postcss.config.mjskits/chaos-trip-planner/apps/tsconfig.jsonkits/chaos-trip-planner/constitutions/default.mdkits/chaos-trip-planner/flows/plan-trip.tskits/chaos-trip-planner/lamatic.config.tskits/chaos-trip-planner/model-configs/plan-trip_instructor-llmnode-988_generative-model-name.tskits/chaos-trip-planner/prompts/plan-trip_instructor-llmnode-988_system_0.mdkits/chaos-trip-planner/prompts/plan-trip_instructor-llmnode-988_user_1.md
| "use server"; | ||
|
|
||
| export type TripInput = { | ||
| city: string; | ||
| travelDate: string; | ||
| days: number; | ||
| budget: number; | ||
| preferences: string; | ||
| }; | ||
|
|
||
| async function callLamatic(query: string, variables: Record<string, any>) { | ||
| const response = await fetch(process.env.LAMATIC_ENDPOINT!, { | ||
| method: "POST", | ||
| headers: { | ||
| Authorization: `Bearer ${process.env.LAMATIC_API_KEY}`, | ||
| "Content-Type": "application/json", | ||
| "x-project-id": process.env.LAMATIC_PROJECT_ID!, | ||
| }, | ||
| body: JSON.stringify({ query, variables }), | ||
| }); | ||
| return response.json(); | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🌐 Web query:
What is the current API for the lamatic npm package's executeFlow/checkStatus methods for calling Lamatic workflows from a Next.js server action?
💡 Result:
To call Lamatic workflows from a Next.js server action using the lamatic npm package, you can utilize the executeFlow method from the Lamatic SDK [1][2]. The current API for these methods is as follows: 1. Initialization First, initialize the client using your project credentials [2][3]: import { Lamatic } from 'lamatic'; const lamaticClient = new Lamatic({ projectId: process.env.LAMATIC_PROJECT_ID, apiKey: process.env.LAMATIC_API_KEY, }); 2. Calling executeFlow The executeFlow method is used to trigger a workflow. It takes the flow ID and a payload object as arguments and returns a promise [1][4]. In a Next.js Server Action, you would use it as follows [2]: // app/actions.ts (or within a Server Component) 'use server' import { lamaticClient } from './utils'; // Import your initialized client export async function runWorkflow(data: any) { try { const response = await lamaticClient.executeFlow(process.env.LAMATIC_FLOW_ID, {...data, }); return response; } catch (error) { console.error('Error executing flow:', error); throw error; } } 3. Calling checkStatus The checkStatus method is designed for long-running workflows or agents that execute asynchronously [1]. It allows you to poll for the status of a request using its request ID [1]. Method signature [1]: checkStatus(requestId: string, pollInterval?: number, pollTimeout?: number): Promise Example usage: const statusResponse = await lamaticClient.checkStatus(requestId); The response structure for both methods is a LamaticResponse object containing [1][4]: - status: "success" | "error" - result: object | null (the data returned from the workflow) - message?: string (error message if status is "error") - statusCode?: number Note: Unlike executeFlow, checkStatus returns error responses instead of throwing exceptions, allowing for manual handling of the response status [1].
Citations:
- 1: https://lamatic.ai/docs/api-integration/sdk
- 2: https://lamatic.ai/docs/api-integration/sdk/next
- 3: https://github.com/lamatic/docs/blob/main/pages/docs/api-integration/sdk/next.mdx
- 4: https://github.com/Lamatic/lamatic-sdk
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== target files =="
fd -a 'orchestrate\.ts$|lamatic\.config\.)$|package\.json$' . | sed 's#^\./##' | head -200
echo
echo "== target file excerpt =="
if [ -f kits/chaos-trip-planner/apps/actions/orchestrate.ts ]; then
cat -n kits/chaos-trip-planner/apps/actions/orchestrate.ts | sed -n '1,120p'
fi
echo
echo "== references/imports =="
rg -n "lamatic|lamatic\.config|require\(.*lamatic|from ['\"].*lamatic|executeFlow|checkStatus|process\.env\.(LAMATIC_ENDPOINT|LAMATIC_API_KEY|LAMATIC_PROJECT_ID|LAMATIC_FLOW_ID)" kits/chaos-trip-planner -S || true
echo
echo "== package context =="
fd 'package\.json$' kits/chaos-trip-planner -x sh -c 'echo "--- {}"; sed -n "1,220p" "{}"'Repository: Lamatic/AgentKit
Length of output: 514
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== target files =="
{ fd -a 'orchestrate\.ts$' . || true; fd -a 'lamatic\.config\.)$' . || true; fd -a 'package\.json$' . || true; } | sed 's#^\./##' | head -200
echo
echo "== target file excerpt =="
if [ -f kits/chaos-trip-planner/apps/actions/orchestrate.ts ]; then
cat -n kits/chaos-trip-planner/apps/actions/orchestrate.ts | sed -n '1,140p'
else
echo "kits/chaos-trip-planner/apps/actions/orchestrate.ts not found"
fi
echo
echo "== references/imports =="
rg -n "lamatic|lamatic\.config|require\(.*lamatic|from ['\"].*lamatic|executeFlow|checkStatus|process\.env\.(LAMATIC_ENDPOINT|LAMATIC_API_KEY|LAMATIC_PROJECT_ID|LAMATIC_FLOW_ID)" kits/chaos-trip-planner -S || true
echo
echo "== package context =="
fd 'package\.json$' kits/chaos-trip-planner -x sh -c 'echo "--- $1"; sed -n "1,220p" "$1"' sh "{}"Repository: Lamatic/AgentKit
Length of output: 11127
Mission: use lamatic instead of raw GraphQL.
orchestrate.ts imports only the app dependencies and still builds the workflow call with raw fetch, inline ExecuteWorkflow/CheckStatus queries, and process.env.LAMATIC_FLOW_ID. Since kit Next.js apps must integrate via the lamatic npm package, replace this with executeFlow/checkStatus from the SDK.
🤖 Prompt for 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.
In `@kits/chaos-trip-planner/apps/actions/orchestrate.ts` around lines 1 - 22, The
workflow integration in orchestrate.ts must use the lamatic SDK instead of raw
GraphQL requests. Replace callLamatic and the inline ExecuteWorkflow/CheckStatus
queries with the package’s executeFlow and checkStatus functions, and pass the
SDK configuration and workflow identifiers through the existing orchestration
flow rather than calling fetch or reading LAMATIC_FLOW_ID directly.
Source: Path instructions
| async function callLamatic(query: string, variables: Record<string, any>) { | ||
| const response = await fetch(process.env.LAMATIC_ENDPOINT!, { | ||
| method: "POST", | ||
| headers: { | ||
| Authorization: `Bearer ${process.env.LAMATIC_API_KEY}`, | ||
| "Content-Type": "application/json", | ||
| "x-project-id": process.env.LAMATIC_PROJECT_ID!, | ||
| }, | ||
| body: JSON.stringify({ query, variables }), | ||
| }); | ||
| return response.json(); | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
This message will self-destruct... eventually. Give the fetch a fuse.
callLamatic has no timeout and never checks response.ok/GraphQL errors before response.json(). A hung Lamatic endpoint blocks the server action indefinitely, and a non-2xx or error body gets parsed as if it were valid data — masking the real failure behind the generic "No result or requestId returned" error.
⏱️ Proposed fix
async function callLamatic(query: string, variables: Record<string, any>) {
const response = await fetch(process.env.LAMATIC_ENDPOINT!, {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.LAMATIC_API_KEY}`,
"Content-Type": "application/json",
"x-project-id": process.env.LAMATIC_PROJECT_ID!,
},
body: JSON.stringify({ query, variables }),
+ signal: AbortSignal.timeout(15000),
});
- return response.json();
+ const json = await response.json();
+ if (!response.ok || json.errors) {
+ throw new Error(json.errors?.[0]?.message ?? `Lamatic request failed (${response.status})`);
+ }
+ return json;
}Also applies to: 83-88
🤖 Prompt for 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.
In `@kits/chaos-trip-planner/apps/actions/orchestrate.ts` around lines 11 - 22,
Update callLamatic to enforce a request timeout using an abort signal, check
response.ok before parsing the body, and inspect the parsed GraphQL response for
errors. Throw or otherwise propagate descriptive failures for timeout, non-2xx
responses, and GraphQL errors so callers do not treat invalid responses as
successful data.
| const initial = await callLamatic(executeQuery, { | ||
| workflowId: process.env.LAMATIC_FLOW_ID, | ||
| city: input.city, | ||
| days: input.days, | ||
| budget: input.budget, | ||
| preferences: input.preferences, | ||
| travelDate: input.travelDate, | ||
| }); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Missing dead-drop: ../../lamatic.config never gets read.
workflowId is sourced purely from process.env.LAMATIC_FLOW_ID instead of the kit's own lamatic.config.ts step definition (steps: [{ id: "plan-trip", type: "mandatory" }]). If the kit's step id ever changes, this app silently drifts out of sync with its own config.
As per path instructions, kits/*/apps/actions/orchestrate.ts: "Kit Next.js apps must import and use ../../lamatic.config to read step definitions from the parent kit."
🕵️ Proposed fix
+import kitConfig from "../../lamatic.config";
+
export async function planTrip(input: TripInput) {
...
const initial = await callLamatic(executeQuery, {
- workflowId: process.env.LAMATIC_FLOW_ID,
+ workflowId: kitConfig.steps[0].id,📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const initial = await callLamatic(executeQuery, { | |
| workflowId: process.env.LAMATIC_FLOW_ID, | |
| city: input.city, | |
| days: input.days, | |
| budget: input.budget, | |
| preferences: input.preferences, | |
| travelDate: input.travelDate, | |
| }); | |
| import kitConfig from "../../lamatic.config"; | |
| export async function planTrip(input: TripInput) { | |
| ... | |
| const initial = await callLamatic(executeQuery, { | |
| workflowId: kitConfig.steps[0].id, | |
| city: input.city, | |
| days: input.days, | |
| budget: input.budget, | |
| preferences: input.preferences, | |
| travelDate: input.travelDate, | |
| }); |
🤖 Prompt for 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.
In `@kits/chaos-trip-planner/apps/actions/orchestrate.ts` around lines 50 - 57,
Update the orchestration flow around callLamatic in orchestrate.ts to import and
use the parent kit’s ../../lamatic.config step definition for the workflow
identifier, specifically the configured “plan-trip” step, instead of sourcing
workflowId only from process.env.LAMATIC_FLOW_ID. Keep the existing query inputs
unchanged and ensure the app remains synchronized with configuration changes.
Source: Path instructions
| "plan_trip_instructor_llmnode_988_generative_model_name": "@model-configs/plan-trip_instructor-llmnode-988_generative-model-name.ts" | ||
| }, | ||
| "scripts": { | ||
| "plan_trip_code_node_804_code": "@scripts/plan-trip_code-node-804_code.ts" |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
fd . kits/chaos-trip-planner -t f | rg -i 'script'Repository: Lamatic/AgentKit
Length of output: 154
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== repo files matching scripts =="
fd . -t f -H . | rg '(^|/)scripts/' || true
echo
echo "== file under review summary =="
if [ -f kits/chaos-trip-planner/flows/plan-trip.ts ]; then
wc -l kits/chaos-trip-planner/flows/plan-trip.ts
sed -n '1,140p' kits/chaos-trip-planner/flows/plan-trip.ts
fi
echo
echo "== references to plan-trip_code-node-804_code scripts =="
rg -n "plan-trip_code-node-804_code|PrepDates|codeNode_804|`@scripts`" . || true
echo
echo "== files under chaos-trip-planner =="
fd . kits/chaos-trip-planner -t f | sed -u 's#^`#-` #' | head -200Repository: Lamatic/AgentKit
Length of output: 50373
Mission: deliver the missing chaos-trip-planner code-node dossier.
codeNode_804 (“PrepDates,” lines 89-102) references @scripts/plan-trip_code-node-804_code.ts, but this pack has no matching scripts/……_code.ts file. If the script is absent, the Weather node’s start_date/end_date and the Forecast Available variable consumed by prompts won’t resolve at runtime. Add the script under kits/chaos-trip-planner/scripts/ or remove/update the dangling @scripts reference.
🤖 Prompt for 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.
In `@kits/chaos-trip-planner/flows/plan-trip.ts` at line 42, The plan-trip flow
contains a dangling `plan_trip_code_node_804_code` script reference. Add the
matching `plan-trip_code-node-804_code.ts` script under the pack’s scripts
directory, implementing the values required by `codeNode_804` (“PrepDates”) for
Weather `start_date`/`end_date` and the `Forecast Available` variable, or
update/remove the reference so no missing `@scripts` target remains.
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (1)
kits/chaos-trip-planner/apps/actions/orchestrate.ts (1)
11-24:⚠️ Potential issue | 🟠 MajorHTTP status is only one checkpoint.
response.okcatches non-2xx responses, but HTTP 200 GraphQL responses with anerrorsarray still pass through and become the misleading “No result” error. The rawfetchalso has no timeout, so a hung Lamatic request can hold the server action indefinitely. Parse and reject GraphQL errors, add a deadline, or use the required Lamatic SDK. This repeats the earlier transport finding.As per coding guidelines, kit apps must use the
lamaticpackage for SDK integration.🤖 Prompt for 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. In `@kits/chaos-trip-planner/apps/actions/orchestrate.ts` around lines 11 - 24, Update callLamatic to use the lamatic package SDK instead of raw fetch, preserving the existing query and variables behavior. Ensure the SDK integration enforces a request deadline and propagates GraphQL errors rather than returning responses containing an errors array as successful results.Source: Coding guidelines
🤖 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/chaos-trip-planner/apps/app/results/page.tsx`:
- Around line 40-48: Validate the parsed value in the trip-loading useEffect
before calling setTrip: require the expected Trip shape, including usable
summary, days, and reasons fields, rather than accepting arbitrary objects or
arrays. When validation fails, remove the invalid "tripResult" sessionStorage
entry and leave trip unset so the existing fallback renders; preserve valid
payload loading and existing city handling.
In `@kits/chaos-trip-planner/apps/components/TripForm.tsx`:
- Around line 35-40: Move authoritative input validation into planTrip by
defining or reusing a shared Zod schema and parsing the action input before
forwarding travelDate, city, days, or budget to Lamatic. Update TripForm to use
that same schema through react-hook-form, replacing its ad-hoc useState and
manual checks while preserving the existing loading and submission behavior.
---
Duplicate comments:
In `@kits/chaos-trip-planner/apps/actions/orchestrate.ts`:
- Around line 11-24: Update callLamatic to use the lamatic package SDK instead
of raw fetch, preserving the existing query and variables behavior. Ensure the
SDK integration enforces a request deadline and propagates GraphQL errors rather
than returning responses containing an errors array as successful results.
🪄 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 Plus
Run ID: 0c2fe38f-c6dd-4098-8bd3-a5977e8062df
📒 Files selected for processing (3)
kits/chaos-trip-planner/apps/actions/orchestrate.tskits/chaos-trip-planner/apps/app/results/page.tsxkits/chaos-trip-planner/apps/components/TripForm.tsx
| } | ||
| if (!travelDate) { | ||
| setError("Please select a travel date."); | ||
| return; | ||
| } | ||
| setLoading(true); |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== locate files =="
fd -a 'TripForm\.tsx$|planTrip|TripInput|schema|lamatic' kits/chaos-trip-planner 2>/dev/null | sed 's#^\./##' | head -200
echo
echo "== tree candidate =="
fd -t f . kits/chaos-trip-planner/apps 2>/dev/null | sed 's#^\./##' | head -200
echo
echo "== inspect TripForm outline and relevant snippets =="
ast-grep outline kits/chaos-trip-planner/apps/components/TripForm.tsx --view expanded || true
echo "--- TripForm relevant lines ---"
cat -n kits/chaos-trip-planner/apps/components/TripForm.tsx | sed -n '1,220p'
echo
echo "== search planTrip definitions/usages and TripInput =="
rg -n "planTrip|TripInput|zod|react-hook-form|travelDate|setError" kits/chaos-trip-planner -SRepository: Lamatic/AgentKit
Length of output: 9438
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== orchestrate action =="
cat -n kits/chaos-trip-planner/apps/actions/orchestrate.ts | sed -n '1,140p'
echo
echo "== package scripts/dependencies =="
cat -n kits/chaos-trip-planner/apps/package.json | sed -n '1,180p'
echo
echo "== behavioral probe for current server-side validation gaps =="
python3 - <<'PY'
from pathlib import Path
text = Path("kits/chaos-trip-planner/apps/actions/orchestrate.ts").read_text()
checks = {
"TripInput_string_fields": "city?: string" in text and "travelDate: string" in text and "preferences: string" in text,
"planTrip_uses_input_values": "input.city" in text and "input.travelDate" in text and "input.preferences" in text,
"has_thrown_on_empty": "throw" in text,
"has_zod": "import" in text and ("zod" in text.lower() or "zod" in text),
"has_server_type_assertion": "as unknown as TripInput" in text or "input as TripInput" in text,
}
for k, v in checks.items():
print(f"{k}={v}")
# Read-only semantic probe: show which validation guard statements exist around TripInput assignment/use.
import re
statements = []
for stmt in re.findall(r"if\s*\([^;]+;\s*(?:throw|return|setError)[^;]*;", text):
statements.append(stmt.replace("\n", " "))
print("validation_guard_statements:")
for s in statements:
print(" -", s)
PYRepository: Lamatic/AgentKit
Length of output: 4126
Move the real validation checkpoint to planTrip.
TripForm rejects missing dates on the client, but planTrip only has a TypeScript-only shape and forwards input.travelDate, input.city, input.days, and input.budget directly to Lamatic. Validate a shared Zod schema on the server action before executing the workflow, and reuse the same schema with react-hook-form here instead of ad-hoc useState/hand validation.
🤖 Prompt for 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.
In `@kits/chaos-trip-planner/apps/components/TripForm.tsx` around lines 35 - 40,
Move authoritative input validation into planTrip by defining or reusing a
shared Zod schema and parsing the action input before forwarding travelDate,
city, days, or budget to Lamatic. Update TripForm to use that same schema
through react-hook-form, replacing its ad-hoc useState and manual checks while
preserving the existing loading and submission behavior.
Source: Coding guidelines
|
/validate |
|
📡 Running Studio validation — results will appear here shortly. |
Studio Runtime Validation (Phase 2)❌ Studio validation failed. The kit was rejected by Lamatic Studio. Errorschaos-trip-planner
Please fix the errors above and push a new commit to re-run validation. |
|
@khushi05sharma phase 2 is failing can you check? Also there are lots of comments left by coderabbit please solve those as well |
…e validation, README fixes
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
kits/chaos-trip-planner/apps/actions/orchestrate.ts (1)
35-48: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick winReject fractional inputs before they hit the GraphQL
Intpayload.
Number.isFinitestill accepts values like1.5and100.5, but$daysand$budgetare declared asIntin both the query and the flow schema. Reject non-integers here withNumber.isInteger(...), or change the contract consistently toFloat.🤖 Prompt for 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. In `@kits/chaos-trip-planner/apps/actions/orchestrate.ts` around lines 35 - 48, Update the input validation before ExecuteWorkflow in the orchestration handler to require Number.isInteger for both input.days and input.budget, while preserving the existing range checks and error behavior; keep the GraphQL Int declarations unchanged.
🤖 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.
Outside diff comments:
In `@kits/chaos-trip-planner/apps/actions/orchestrate.ts`:
- Around line 35-48: Update the input validation before ExecuteWorkflow in the
orchestration handler to require Number.isInteger for both input.days and
input.budget, while preserving the existing range checks and error behavior;
keep the GraphQL Int declarations unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI (base), Organization UI (inherited)
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: fd912799-4477-44ba-b3ca-05216aa1dd7d
📒 Files selected for processing (5)
kits/chaos-trip-planner/apps/README.mdkits/chaos-trip-planner/apps/actions/orchestrate.tskits/chaos-trip-planner/apps/app/results/page.tsxkits/chaos-trip-planner/apps/components/TripForm.tsxkits/chaos-trip-planner/apps/next.config.mjs
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/chaos-trip-planner/scripts/plan-trip_code-node-804_code.ts`:
- Around line 1-2: Replace the direct mustache expressions in the script’s
travelDate and days initialization with values read from the Lamatic Code node
runtime object, using the established runtime input contract. Ensure both inputs
are resolved as valid TypeScript values before execution and preserve their
existing names for downstream 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 Plus
Run ID: 8fb8d416-db7b-44d7-9bd7-68a18ca0dc92
📒 Files selected for processing (2)
kits/chaos-trip-planner/.gitignorekits/chaos-trip-planner/scripts/plan-trip_code-node-804_code.ts
| const travelDate = {{triggerNode_1.output.travelDate}}; | ||
| const days = {{triggerNode_1.output.days}}; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
rg -n '\{\{.*\}\}' kits/chaos-trip-planner/scripts
rg -n 'workflow\.[A-Za-z0-9_]+\.output' kits/chaos-trip-planner/scriptsRepository: Lamatic/AgentKit
Length of output: 386
🏁 Script executed:
#!/bin/bash
set -eu
printf 'Files under kits/*/scripts:\n'
git ls-files 'kits/*/scripts/*.ts' | sed -n '1,120p'
printf '\nTarget file contents:\n'
cat -n kits/chaos-trip-planner/scripts/plan-trip_code-node-804_code.ts
printf '\nReferences to Lamatic/codeNode/runtime object patterns:\n'
rg -n 'codeNode|workflow\.|template|{{|execute|output\.' . --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' | sed -n '1,220p'
printf '\nPackage/tooling hints:\n'
for f in package.json kits/*/package.json; do
[ -f "$f" ] && echo "--- $f" && sed -n '1,120p' "$f"
doneRepository: Lamatic/AgentKit
Length of output: 8644
🏁 Script executed:
#!/bin/bash
set -eu
echo 'All scripts with template-like code:'
for f in $(git ls-files 'kits/*/scripts/*.ts'); do
if grep -nEE='\{\{[^{}]+\}\}' "$f" >/tmp/templated_scripts.tmp 2>/tmp/templated_scripts.err || true; then
echo "--- $f"
sed -n '1,80p' "$f"
fi
done < /tmp/templated_scripts.tmp 2>/dev/null | sed -n '1,220p'
echo 'Search for workflow/codeNode/template references outside lockfiles and node_modules:'
rg -n 'codeNode|workflow\.|template|{{|execute|output\.' . --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' --glob '!**/package-lock.json' | sed -n '1,260p'
echo 'Files likely containing docs/tests/examples:'
git ls-files | grep -Ei '(readme|doc|example|template|codegen|workflow|lamatic|agent|script|kit)' | sed -n '1,260p'Repository: Lamatic/AgentKit
Length of output: 14086
🏁 Script executed:
#!/bin/bash
set -eu -o pipefail
echo 'Targeted searches for Lamatic runtime/input patterns (python rg equivalent):'
python3 - <<'PY'
import os, re, subprocess, sys
repo_files = subprocess.check_output(['git','ls-files'], text=True).splitlines()
patterns = [re.compile(r'codeNode|workflow\.', re.I), re.compile(r'\{\{[^{}]+\}\}')]
for f in repo_files:
if any(part in ('node_modules','dist','build','.lock') for part in f.split('/')) or f.endswith(('.json','yaml','yml','.md')):
continue
try:
data = subprocess.check_output(['cat', f], text=True, errors='replace')
except Exception:
continue
for i,line in enumerate(data.splitlines(),1):
for p in patterns:
if p.search(line):
print(f'{f}:{i}:{line}')
break
PY
echo 'README/docs around Lamatic code examples:'
for f in README.md kits/*/README.md; do
[ -f "$f" ] || continue
echo "--- $f"
rg -n -i -C 3 'Lamatic|code node|Code|{{|workflow|scripts|execute|output' "$f" | sed -n '1,200p' || true
done
echo 'Lamatic config references to scripts/code nodes:'
rg -n -i -C 3 'scripts|codeNode|type[:=].*code|execute' kits --glob '*.ts' --glob '*.md' | sed -n '1,280p'
echo 'Parse-safety probe for current first lines:'
node - <<'JS'
const fs = require('fs');
const path = 'kits/chaos-trip-planner/scripts/plan-trip_code-node-804_code.ts';
const contents = fs.readFileSync(path, 'utf8');
try {
new Function(contents);
console.log('TS/JS parse: OK');
} catch (err) {
console.log(`TS/JS parse: ${err.type || 'Error'}: ${err.message.split('\\n')[0]}`);
}
JSRepository: Lamatic/AgentKit
Length of output: 50373
Mission compromised: remove the mustache expressions before this script executes.
Lines 1 and 2 embed {{triggerNode_1.output...}} directly in TypeScript, so the Code node receives invalid script text when execution starts. Read these inputs through the Lamatic Code node runtime object, or confirm the exact runtime contract before merging.
🧰 Tools
🪛 Biome (2.5.5)
[error] 1-1: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{triggerNode_1.output.travelDate'.
(parse)
[error] 1-1: Expected a statement but instead found '}'.
(parse)
[error] 2-2: Expected a property, a shorthand property, a getter, a setter, or a method but instead found '{triggerNode_1.output.days'.
(parse)
[error] 2-2: Expected a statement but instead found '}'.
(parse)
🤖 Prompt for 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.
In `@kits/chaos-trip-planner/scripts/plan-trip_code-node-804_code.ts` around lines
1 - 2, Replace the direct mustache expressions in the script’s travelDate and
days initialization with values read from the Lamatic Code node runtime object,
using the established runtime input contract. Ensure both inputs are resolved as
valid TypeScript values before execution and preserve their existing names for
downstream logic.
Sources: Learnings, Linters/SAST tools
|
Pushed a fix for the missing script file — should be resolved now. Let me know if anything else needs attention! |
|
Hi @khushi05sharma! 👋 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! 🙏 |
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,inputs.json,meta.json,README.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>)About this PR
Chaos Trip Planner — an AI trip planner built on Lamatic AgentKit that generates a day-by-day itinerary using real weather data (Open-Meteo) and real nearby places (Geoapify), reasoned over by an LLM (Gemini 2.5 Flash). The Places API is deliberately unfiltered by user preference — all personalization happens in the LLM step. Frontend built with Next.js, TypeScript, and Tailwind CSS.
See
README.mdfor full details on the approach, tradeoffs, and setup instructions.chaos-trip-plannerAgentKit, including kit metadata, constitution, README documentation, environment-variable templates, and ignore rules.plan-tripflow configuration: