Skip to content

feat: Add chaos-trip-planner kit - #308

Open
khushi05sharma wants to merge 12 commits into
Lamatic:mainfrom
khushi05sharma:main
Open

feat: Add chaos-trip-planner kit#308
khushi05sharma wants to merge 12 commits into
Lamatic:mainfrom
khushi05sharma:main

Conversation

@khushi05sharma

@khushi05sharma khushi05sharma commented Jul 29, 2026

Copy link
Copy Markdown

PR Checklist

1. Select Contribution Type

  • Kit (kits/<category>/<kit-name>/)
  • Bundle (bundles/<bundle-name>/)
  • Template (templates/<template-name>/)

2. General Requirements

  • PR is for one project only (no unrelated changes)
  • No secrets, API keys, or real credentials are committed
  • Folder name uses kebab-case and matches the flow ID
  • All changes are documented in README.md (purpose, setup, usage)

3. File Structure (Check what applies)

  • config.json present with valid metadata (name, description, tags, steps, author, env keys)
  • All flows in flows/<flow-name>/ (where applicable) include: config.json, inputs.json, meta.json, README.md
  • .env.example with placeholder values only (kits only)
  • No hand‑edited flow config.json node graphs (changes via Lamatic Studio export)

4. Validation

  • npm install && npm run dev works locally (kits: UI runs; bundles/templates: flows are valid)
  • PR title is clear (e.g., [kit] Add <name> for <use case>)
  • GitHub Actions workflows pass (all checks are green)
  • All CodeRabbit or other PR review comments are addressed and resolved
  • No unrelated files or projects are modified

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.md for full details on the approach, tradeoffs, and setup instructions.

  • Added the chaos-trip-planner AgentKit, including kit metadata, constitution, README documentation, environment-variable templates, and ignore rules.
  • Added a Next.js 16 frontend with TypeScript, Tailwind CSS, ESLint, PostCSS, global styling, fonts, metadata, and setup documentation.
  • Added an accessible trip-planning form with client/server validation for city, travel date, duration, and budget.
  • Added Lamatic GraphQL orchestration with synchronous execution support and polling for asynchronous workflow results.
  • Added results rendering with session-based trip data, weather-themed day cards, activities, budget information, and itinerary reasoning.
  • Added the plan-trip flow configuration:
    • Geocodes the requested city.
    • Computes trip start and end dates.
    • Retrieves weather data from Open-Meteo.
    • Retrieves broad nearby-place data from Geoapify without preference filtering.
    • Uses Gemini 2.5 Flash to match places to user preferences and generate a structured itinerary.
    • Shapes and returns the final response through the response node.
  • Added flow prompts and model configuration enforcing JSON output, budget awareness, exact day counts, real-place-only recommendations, and honest handling of missing weather or suitable places.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It 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 reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

Changes

The 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

Layer / File(s) Summary
Trip workflow definition
kits/chaos-trip-planner/flows/plan-trip.ts, prompts/*, model-configs/*, scripts/*, constitutions/*, README.md, agent.md, lamatic.config.ts, .env.example
Defines the geocoding, date preparation, weather, places, LLM, and response workflow with structured itinerary output and documented guardrails.
Next.js application foundation
kits/chaos-trip-planner/apps/package.json, apps/tsconfig.json, apps/eslint.config.mjs, apps/postcss.config.mjs, apps/next.config.mjs, apps/app/globals.css, apps/app/layout.tsx, apps/.env.example, apps/.gitignore, apps/AGENTS.md, apps/CLAUDE.md, apps/README.md, .gitignore
Adds application configuration, styling, fonts, metadata, environment templates, ignore rules, and project documentation.
Server-side trip execution
kits/chaos-trip-planner/apps/actions/orchestrate.ts
Validates trip inputs, calls Lamatic through GraphQL, handles immediate results, polls asynchronous requests, and returns or times out on itinerary output.
Trip planning interface
kits/chaos-trip-planner/apps/app/page.tsx, apps/components/TripForm.tsx, apps/app/results/page.tsx
Collects trip details, persists generated results in session storage, navigates to the results page, and renders weather, budget, activities, and planning reasons.

Suggested reviewers: amanintech, d-pamneja

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 12.50% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and clearly names the main change: adding the chaos-trip-planner kit.
Description check ✅ Passed The PR description follows the checklist template and includes the required sections, with only some non-critical items left unchecked.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.ts

File 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

:robot_face: AgentKit Structural Validation

New Contributions Detected

  • Kit: kits/chaos-trip-planner

Check Results

Check Status
No edits to existing kits ✅ Pass
Required root files present ✅ Pass
Flow .ts files present ✅ Pass
lamatic.config.ts valid ✅ Pass
No changes outside kits/ ✅ Pass

🎉 All checks passed! This contribution follows the AgentKit structure.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4d5d9e1 and dba61bf.

⛔ Files ignored due to path filters (7)
  • kits/chaos-trip-planner/apps/app/favicon.ico is excluded by !**/*.ico
  • kits/chaos-trip-planner/apps/package-lock.json is excluded by !**/package-lock.json
  • kits/chaos-trip-planner/apps/public/file.svg is excluded by !**/*.svg
  • kits/chaos-trip-planner/apps/public/globe.svg is excluded by !**/*.svg
  • kits/chaos-trip-planner/apps/public/next.svg is excluded by !**/*.svg
  • kits/chaos-trip-planner/apps/public/vercel.svg is excluded by !**/*.svg
  • kits/chaos-trip-planner/apps/public/window.svg is excluded by !**/*.svg
📒 Files selected for processing (25)
  • kits/chaos-trip-planner/.gitignore
  • kits/chaos-trip-planner/README.md
  • kits/chaos-trip-planner/agent.md
  • kits/chaos-trip-planner/apps/.env.example
  • kits/chaos-trip-planner/apps/.gitignore
  • kits/chaos-trip-planner/apps/AGENTS.md
  • kits/chaos-trip-planner/apps/CLAUDE.md
  • kits/chaos-trip-planner/apps/README.md
  • kits/chaos-trip-planner/apps/actions/orchestrate.ts
  • kits/chaos-trip-planner/apps/app/globals.css
  • kits/chaos-trip-planner/apps/app/layout.tsx
  • kits/chaos-trip-planner/apps/app/page.tsx
  • kits/chaos-trip-planner/apps/app/results/page.tsx
  • kits/chaos-trip-planner/apps/components/TripForm.tsx
  • kits/chaos-trip-planner/apps/eslint.config.mjs
  • kits/chaos-trip-planner/apps/next.config.ts
  • kits/chaos-trip-planner/apps/package.json
  • kits/chaos-trip-planner/apps/postcss.config.mjs
  • kits/chaos-trip-planner/apps/tsconfig.json
  • kits/chaos-trip-planner/constitutions/default.md
  • kits/chaos-trip-planner/flows/plan-trip.ts
  • kits/chaos-trip-planner/lamatic.config.ts
  • kits/chaos-trip-planner/model-configs/plan-trip_instructor-llmnode-988_generative-model-name.ts
  • kits/chaos-trip-planner/prompts/plan-trip_instructor-llmnode-988_system_0.md
  • kits/chaos-trip-planner/prompts/plan-trip_instructor-llmnode-988_user_1.md

Comment on lines +1 to +22
"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();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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:


🏁 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

Comment on lines +11 to +22
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();
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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.

Comment on lines +50 to +57
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,
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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.

Suggested change
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

Comment thread kits/chaos-trip-planner/apps/app/results/page.tsx
Comment thread kits/chaos-trip-planner/apps/components/TripForm.tsx Outdated
Comment thread kits/chaos-trip-planner/apps/package.json
Comment thread kits/chaos-trip-planner/apps/README.md Outdated
Comment thread kits/chaos-trip-planner/apps/README.md Outdated
Comment thread kits/chaos-trip-planner/apps/README.md Outdated
"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"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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 -200

Repository: 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.

@khushi05sharma

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai
coderabbitai Bot requested review from amanintech and d-pamneja July 30, 2026 07:47

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
kits/chaos-trip-planner/apps/actions/orchestrate.ts (1)

11-24: ⚠️ Potential issue | 🟠 Major

HTTP status is only one checkpoint.

response.ok catches non-2xx responses, but HTTP 200 GraphQL responses with an errors array still pass through and become the misleading “No result” error. The raw fetch also 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 lamatic package 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

📥 Commits

Reviewing files that changed from the base of the PR and between 05287f8 and 331b796.

📒 Files selected for processing (3)
  • kits/chaos-trip-planner/apps/actions/orchestrate.ts
  • kits/chaos-trip-planner/apps/app/results/page.tsx
  • kits/chaos-trip-planner/apps/components/TripForm.tsx

Comment thread kits/chaos-trip-planner/apps/app/results/page.tsx
Comment on lines +35 to +40
}
if (!travelDate) {
setError("Please select a travel date.");
return;
}
setLoading(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ 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 -S

Repository: 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)
PY

Repository: 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

@akshatvirmani

Copy link
Copy Markdown
Contributor

/validate

@github-actions

Copy link
Copy Markdown
Contributor

📡 Running Studio validation — results will appear here shortly.

@github-actions

Copy link
Copy Markdown
Contributor

Studio Runtime Validation (Phase 2)

Studio validation failed. The kit was rejected by Lamatic Studio.

Errors

chaos-trip-planner

  • Flow: plan-trip | Node: codeNode_804 — Unresolved AgentKit reference "@scripts/plan-trip_code-node-804_code.ts" at values.code (not included in PR payload)

Please fix the errors above and push a new commit to re-run validation.
Refer to CONTRIBUTING.md for guidance.

@akshatvirmani

Copy link
Copy Markdown
Contributor

@khushi05sharma phase 2 is failing can you check?

Also there are lots of comments left by coderabbit please solve those as well

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Reject fractional inputs before they hit the GraphQL Int payload.

Number.isFinite still accepts values like 1.5 and 100.5, but $days and $budget are declared as Int in both the query and the flow schema. Reject non-integers here with Number.isInteger(...), or change the contract consistently to Float.

🤖 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

📥 Commits

Reviewing files that changed from the base of the PR and between 331b796 and 1e67b18.

📒 Files selected for processing (5)
  • kits/chaos-trip-planner/apps/README.md
  • kits/chaos-trip-planner/apps/actions/orchestrate.ts
  • kits/chaos-trip-planner/apps/app/results/page.tsx
  • kits/chaos-trip-planner/apps/components/TripForm.tsx
  • kits/chaos-trip-planner/apps/next.config.mjs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1e67b18 and 9947eb7.

📒 Files selected for processing (2)
  • kits/chaos-trip-planner/.gitignore
  • kits/chaos-trip-planner/scripts/plan-trip_code-node-804_code.ts

Comment on lines +1 to +2
const travelDate = {{triggerNode_1.output.travelDate}};
const days = {{triggerNode_1.output.days}};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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/scripts

Repository: 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"
done

Repository: 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]}`);
}
JS

Repository: 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

@khushi05sharma

Copy link
Copy Markdown
Author

Pushed a fix for the missing script file — should be resolved now. Let me know if anything else needs attention!

@github-actions

Copy link
Copy Markdown
Contributor

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:

  1. Read through all CodeRabbit comments carefully
  2. Address each issue raised (or reply explaining why you disagree)
  3. Push your fixes as new commits
  4. Once all issues are resolved, comment here so we can re-review

This helps keep the review process efficient for everyone. Thank you! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants