Files
Pranay Prakash 3aee6d7efb Port Peter's Workbench UI to nextjs-turbopack (#458)
* Port Peter's Workspace UI

* Add symlinks for webpack workbench to share UI with turbopack

- Add symlinks for components, hooks, lib directories
- Add symlinks for app/workflows and app/api/workflows
- Install UI dependencies in webpack workbench package.json
- Both webpack and turbopack workbenches now share the same UI code

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Use allWorkflows from @/_workflows instead of custom examples.ts

- Update workflow definitions to include workflowFile field
- Change start route to use allWorkflows like trigger route
- Remove unused examples.ts file
- This allows accessing workflows from any workflow file, not just 99_e2e

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Dynamically generate workflow definitions from allWorkflows

- Remove manual workflow definitions, now auto-generated from _workflows.ts
- Add workflowFile path display in UI (tooltip and fallback description)
- Sort workflows by file name first, then by workflow name
- Fix duplicate key issue by using workflowFile:name as key
- Make description optional since it's inferred from file path

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add default arguments map for workflows that require parameters

- Create DEFAULT_ARGS_MAP to provide sensible defaults for workflows with parameters
- Includes defaults for: addTenWorkflow, hookWorkflow, webhookWorkflow, hookCleanupTestWorkflow, closureVariableWorkflow
- Workflows without entries in the map get empty args array

This allows all workflows to be started from the UI without needing manual argument input for now.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Fix terminal log colors for better visibility on black background

- Change info logs from text-primary (black in light mode) to text-cyan-400
- Change error logs from text-destructive to text-red-400
- Update stream logs to text-blue-400
- Update result logs to text-green-400
- Change prefix color from text-gray-500 to text-gray-400

All colors now work properly with the terminal's black background regardless of light/dark mode.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Remove toTitleCase transformation, use raw workflow names

- Display workflow names exactly as they are in code (e.g., "addTenWorkflow")
- Remove the toTitleCase helper function
- Simpler and more direct mapping from code to UI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Use monospace font for workflow names

- Apply font-mono to workflow displayName in both card and tooltip
- Makes workflow names more readable and consistent with code style

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Filter out step functions using workflowId property

- Check for 'workflowId' property added by compiler to identify workflow functions
- More reliable than checking function name endings
- Only functions with "use workflow" directive have workflowId property
- Prevents step functions from appearing in the UI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add symlinks for remaining workflow files and dependencies

- Add symlinks for 2_control_flow.ts, 4_ai.ts, 5_hooks.ts to both workbenches
- Install openai and mixpart dependencies needed by these workflows
- Update DEFAULT_ARGS_MAP with arguments for new workflows:
  - ai: sample weather prompt
  - agent: sample weather prompt for Muscat
  - handleUserSignup: example email address
- All 9 workflow files now available in both workbenches

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Group workflows by file with section headers in UI

- Group workflows by workflowFile and render each group separately
- Add section headers showing the file path for each group
- Use monospace font for file path headers
- Increase spacing between sections (space-y-4)
- Improves visual organization when browsing workflows

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Show default arguments instead of file path in workflow cards

- Display default arguments in the card description line (if present)
- Remove redundant file path since it's now shown in section headers
- Use monospace font for argument display
- Workflows without arguments show no description line

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Display default arguments with multi-line formatting

- Use JSON.stringify with indentation (null, 2) for better readability
- Change from <p> to <pre> with whitespace-pre-wrap
- Arguments now display across multiple lines when needed
- Easier to read complex arguments like webhook tokens

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Add workflow runtime duration display with millisecond precision

- Add formatDuration helper to calculate and format runtime
- Show duration in ms, seconds, or minutes based on length
- Formats: "123ms", "5.234s", "2m 15.678s"
- Display duration in monospace font below end time
- Only shown when invocation has completed (endTime exists)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

* Update default arguments to match e2e test values

- Use arguments from packages/core/e2e/e2e.test.ts for accuracy
- addTenWorkflow: 123 (instead of 5) to match test expectations
- closureVariableWorkflow: 7 (instead of 42) to match test expectations
- Use Math.random().toString(36) for hook/webhook tokens (matches test pattern)
- Add comment referencing e2e test source

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-11-28 21:43:27 -08:00

84 lines
1.8 KiB
TypeScript

import * as React from 'react';
import { cn } from '@/lib/utils';
const Card = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn(
'rounded-xl border bg-card text-card-foreground shadow',
className
)}
{...props}
/>
));
Card.displayName = 'Card';
const CardHeader = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn('flex flex-col space-y-1.5 p-6', className)}
{...props}
/>
));
CardHeader.displayName = 'CardHeader';
const CardTitle = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn('font-semibold leading-none tracking-tight', className)}
{...props}
/>
));
CardTitle.displayName = 'CardTitle';
const CardDescription = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn('text-sm text-muted-foreground', className)}
{...props}
/>
));
CardDescription.displayName = 'CardDescription';
const CardContent = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div ref={ref} className={cn('p-6 pt-0', className)} {...props} />
));
CardContent.displayName = 'CardContent';
const CardFooter = React.forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLDivElement>
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn('flex items-center p-6 pt-0', className)}
{...props}
/>
));
CardFooter.displayName = 'CardFooter';
export {
Card,
CardHeader,
CardFooter,
CardTitle,
CardDescription,
CardContent,
};