Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
bbbea28
Implement nested steps feature in Duron
tinchoz49 Jan 17, 2026
6789dcf
Add time travel feature to Duron job steps
tinchoz49 Jan 17, 2026
817ce79
Refactor time travel logic to preserve nested branches and their chil…
tinchoz49 Jan 17, 2026
79f24cd
Implement time offset adjustment for preserved job steps
tinchoz49 Jan 17, 2026
97b0607
Refactor CSS variables and enhance badge status component
tinchoz49 Jan 17, 2026
4e06f36
Refactor DuronDashboard and enhance StepList functionality
tinchoz49 Jan 17, 2026
ffb995c
Enhance DataTable component and streamline JobsTable layout
tinchoz49 Jan 17, 2026
580ebee
Refactor DataTable and JobsTable components for improved layout
tinchoz49 Jan 17, 2026
02349c5
Refactor JobDetails and Dashboard components for improved layout and …
tinchoz49 Jan 17, 2026
fe3f2b5
Refactor job step handling to support parallel execution
tinchoz49 Jan 17, 2026
85f58c1
Add resizable panels to Dashboard layout and integrate new Resizable …
tinchoz49 Jan 18, 2026
3166ea8
Refactor DuronDashboard layout and introduce LayoutProvider for impro…
tinchoz49 Jan 18, 2026
7cea671
Refactor layout configuration loading and enhance Dashboard panel res…
tinchoz49 Jan 18, 2026
43553e9
Add react-resizable-panels dependency and update CLAUDE.md documentation
tinchoz49 Jan 18, 2026
adc2bfe
Update layout configuration and Dashboard component for improved pane…
tinchoz49 Jan 18, 2026
9fbfb22
Refactor AuthContext to improve authentication state management
tinchoz49 Jan 18, 2026
c85d00d
Enhance PostgresBaseAdapter with updated_at timestamps and improve Da…
tinchoz49 Jan 18, 2026
4c8ed95
Add duration display to StepList component
tinchoz49 Jan 18, 2026
ac7d8e5
added telemetry
tinchoz49 Jan 18, 2026
336a5b7
Enhance documentation and add telemetry features
tinchoz49 Jan 18, 2026
e2fa4ee
Update dependencies and refactor metrics handling
tinchoz49 Jan 19, 2026
498af6f
Refactor metrics handling in Adapter and LocalTelemetryAdapter
tinchoz49 Jan 19, 2026
3ca5176
Add jsonata and usehooks-ts dependencies; enhance LocalTelemetryAdapt…
tinchoz49 Jan 19, 2026
75d14e6
Refactor metrics panel to integrate JSONata for advanced filtering
tinchoz49 Jan 19, 2026
fb0ef81
Enhance index export in Duron package
tinchoz49 Jan 19, 2026
fac906e
Update Duron and Duron Dashboard to version 0.3.0-beta.0; enhance bui…
tinchoz49 Jan 19, 2026
b2a8638
relase beta1
tinchoz49 Jan 19, 2026
dee1a94
Enhance action and step handling in Duron
tinchoz49 Jan 19, 2026
fd8866b
Enhance step definition handling in Duron
tinchoz49 Jan 19, 2026
2b5ac27
Enhance step execution capabilities in Duron
tinchoz49 Jan 19, 2026
49c4eb5
Update Duron to version 0.3.0-beta.5 and remove obsolete migration files
tinchoz49 Jan 19, 2026
4a7356e
Enhance job handling and type safety in Duron client
tinchoz49 Jan 19, 2026
3a3a718
relase beta6
tinchoz49 Jan 19, 2026
21cfbb1
Update Duron and Duron Dashboard to version 0.3.0-beta.6; enhance JSO…
tinchoz49 Jan 19, 2026
ae05499
relase beta2 of duron-dashboard
tinchoz49 Jan 19, 2026
5181fb5
Enhance telemetry and tracing capabilities in Duron
tinchoz49 Jan 19, 2026
b11e94e
Refactor StepList component to improve nesting visualization
tinchoz49 Jan 19, 2026
521e6be
new release
tinchoz49 Jan 19, 2026
0b9d2cb
Update concurrency settings in ActionJob and Action schema; add warni…
tinchoz49 Jan 19, 2026
715d734
Update Duron to version 0.3.0-beta.8; enhance error handling and intr…
tinchoz49 Jan 19, 2026
9b42d88
fix test
tinchoz49 Jan 19, 2026
37f8d2e
Enhance error handling and metadata in Duron
tinchoz49 Jan 20, 2026
7f5562e
Improve error handling in StepManager and refactor shared actions
tinchoz49 Jan 20, 2026
59cd862
release
tinchoz49 Jan 20, 2026
940c269
Enhance theme management in DuronDashboard
tinchoz49 Jan 20, 2026
510f7c5
Enhance job duration tracking and formatting in Duron
tinchoz49 Jan 20, 2026
61b9a02
Update Duron and DuronDashboard to version 0.3.0-beta.11 and 0.3.0-be…
tinchoz49 Jan 20, 2026
22b58fe
Update Duron and DuronDashboard to version 0.3.0-beta.11 and 0.3.0-be…
tinchoz49 Jan 20, 2026
45d1ad3
Enhance tracing and job result structure in Duron
tinchoz49 Jan 20, 2026
4591d25
Refactor tracing implementation in Duron
tinchoz49 Jan 20, 2026
7b03ec6
...
tinchoz49 Jan 20, 2026
64d900b
Update Duron to version 0.3.0-beta.12 and enhance tracing functionality
tinchoz49 Jan 20, 2026
417dc6e
Update telemetry documentation to reflect OpenTelemetry integration
tinchoz49 Jan 20, 2026
47aa633
fix types
tinchoz49 Jan 20, 2026
1851562
release
tinchoz49 Jan 20, 2026
3034943
Refactor theme context management in Duron Dashboard
tinchoz49 Jan 20, 2026
81cd209
release
tinchoz49 Jan 20, 2026
006f82b
Refactor duration handling in Duron Dashboard
tinchoz49 Jan 20, 2026
f08e763
Enhance span querying in PostgresBaseAdapter
tinchoz49 Jan 21, 2026
767c0d2
release
tinchoz49 Jan 21, 2026
46a730d
Add concurrency step limit to job creation and schema
tinchoz49 Jan 21, 2026
7074f06
added types
tinchoz49 Jan 21, 2026
2e89baf
release
tinchoz49 Jan 21, 2026
80857d2
Enhance job description functionality and telemetry context
tinchoz49 Jan 21, 2026
68e5b1a
release
tinchoz49 Jan 21, 2026
6f702ec
Implement column resizing and visibility management in Jobs Table
tinchoz49 Jan 21, 2026
69fb27f
Refactor DataTable component for improved column pinning and styling
tinchoz49 Jan 21, 2026
a541aed
release
tinchoz49 Jan 21, 2026
d366b7e
release
tinchoz49 Jan 21, 2026
94f8dcd
added description filtering and better resizing
tinchoz49 Jan 22, 2026
c7ba6cc
release
tinchoz49 Jan 22, 2026
2751121
Update duron package version to 0.3.0-beta.17 and enhance step name g…
tinchoz49 Jan 23, 2026
7cc667b
fix metadata mock data
tinchoz49 Jan 27, 2026
c151351
release
tinchoz49 Jan 27, 2026
b892f43
fix docs: correct defaults, add missing APIs, fix naming inconsistencies
tinchoz49 Feb 5, 2026
bd071c8
improve docs and images
tinchoz49 Mar 3, 2026
d9682ba
fix typecheck
tinchoz49 Mar 3, 2026
1041c11
fix lint
tinchoz49 Mar 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json

# Finder (MacOS) folder config
.DS_Store
.claude/settings.local.json
132 changes: 131 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ Duron is a modern, type-safe background job processing system built with TypeScr

- **Type-Safe Actions** - Define actions with Zod schemas for input/output validation
- **Step-Based Execution** - Break down complex workflows into manageable, retryable steps
- **Nested Steps** - Steps can create child steps with proper parent-child tracking and abort signal propagation
- **Intelligent Retry Logic** - Configurable exponential backoff with per-action and per-step options
- **Flexible Sync Patterns** - Pull, push, hybrid, or manual job fetching
- **Advanced Concurrency Control** - Per-action, per-group, and dynamic concurrency limits
- **Multi-Process Support** - Run multiple worker processes sharing the same database
- **Database Adapters** - PostgreSQL (production) and PGLite (development/testing)
- **REST API Server** - Built-in Elysia-based API with advanced filtering and pagination
- **Dashboard UI** - Beautiful React dashboard for real-time job monitoring
- **Telemetry & Observability** - Built-in support for metrics, tracing, and custom observability with pluggable adapters

## Runtime Environment

Expand Down Expand Up @@ -85,6 +87,10 @@ The main library providing:
- **Adapters**:
- `duron/adapters/postgres` - PostgreSQL adapter for production
- `duron/adapters/pglite` - PGLite adapter for development/testing
- **Telemetry** - Configured via `telemetry` option on client:
- `telemetry: { local: true }` - Store spans in the database
- `telemetry: { traceExporter }` - Export to OpenTelemetry backends
- No config = telemetry disabled (default)

**Key Dependencies:**
- `zod` - Schema validation
Expand All @@ -93,6 +99,7 @@ The main library providing:
- `pino` - Logging
- `fastq` - Queue implementation
- `jose` - JWT handling
- `@opentelemetry/api` - OpenTelemetry integration (optional)

### `duron-dashboard` (React Dashboard)

Expand Down Expand Up @@ -198,6 +205,49 @@ const sendEmail = defineAction<typeof variables>()({
})
```

### Nested Steps

Steps can create child steps using the `step()` method available in the step handler context. Child steps share abort signals with their parent and are tracked with `parentStepId` in the database.

```typescript
const processOrder = defineAction<typeof variables>()({
name: 'process-order',
input: z.object({ orderId: z.string() }),
output: z.object({ success: z.boolean() }),
handler: async (ctx) => {
const result = await ctx.step('process', async ({ step, signal, stepId }) => {
// stepId is available for the current step
console.log('Processing step:', stepId)

// Create child steps - they inherit the parent's abort signal
const validation = await step('validate', async ({ parentStepId }) => {
// parentStepId links back to the 'process' step
return { valid: true }
})

// Child steps can also be nested further
const payment = await step('charge', async ({ step: nestedStep }) => {
const auth = await nestedStep('authorize', async () => {
return { authCode: '123' }
})
return { charged: true, authCode: auth.authCode }
})

return { success: validation.valid && payment.charged }
})

return result
},
})
```

**Important:** All child steps MUST be awaited before the parent step returns. If a parent step completes with unawaited children, Duron will:
1. Abort all pending child steps
2. Wait for them to settle
3. Throw an `UnhandledChildStepsError`

This prevents orphaned processes and ensures proper async patterns.

### Creating a Client

```typescript
Expand Down Expand Up @@ -228,6 +278,75 @@ const jobId = await client.runAction('send-email', {
const job = await client.waitForJob(jobId)
```

### Telemetry & Observability

Duron provides built-in OpenTelemetry support for tracing:

```typescript
import { duron } from 'duron'
import { postgresAdapter } from 'duron/adapters/postgres'

const client = duron({
database: postgresAdapter({
connection: process.env.DATABASE_URL,
}),
// Enable local telemetry - stores spans in the database
telemetry: { local: true },
actions: { sendEmail },
})
```

**Telemetry Configuration Options:**

- `local: true | { flushDelayMs?: number }` - Store spans in the Duron database
- `traceExporter: SpanExporter` - Export to OpenTelemetry-compatible backends (Jaeger, OTLP, etc.)
- `spanProcessors: SpanProcessor[]` - Add custom span processors
- `serviceName: string` - Service name for OpenTelemetry resource (default: `'duron'`)

**Recording Custom Metrics:**

The `telemetry` context is available in action and step handlers for recording custom metrics:

```typescript
const processAI = defineAction()({
name: 'process-ai',
handler: async (ctx) => {
const startTime = Date.now()

// Record job-level metrics
ctx.telemetry.recordMetric('ai.request.start', 1)
const span = ctx.telemetry.getActiveSpan()
span?.setAttribute('model', 'gpt-4')
span?.addEvent('processing.started')

const result = await ctx.step('call-api', async ({ telemetry }) => {
const response = await callAI(ctx.input)

// Record step-level metrics
telemetry.recordMetric('ai.tokens.input', response.inputTokens)
telemetry.recordMetric('ai.tokens.output', response.outputTokens)
telemetry.recordMetric('ai.latency.ms', Date.now() - startTime)
telemetry.getActiveSpan()?.addEvent('api.call.complete', { status: 'success' })

return response
})

return result
},
})
```

**Accessing Metrics via API:**

When using `telemetry: { local: true }`, spans are stored in the database and accessible via the REST API:

```
GET /api/jobs/:id/spans
GET /api/steps/:id/spans
```

The dashboard also shows metrics when local telemetry is enabled.

### Creating a Server with Dashboard

```typescript
Expand Down Expand Up @@ -340,6 +459,8 @@ Uses Bun's bundler mode with:
| `packages/duron/src/server.ts` | REST API server |
| `packages/duron/src/adapters/adapter.ts` | Base adapter class |
| `packages/duron/src/adapters/postgres/` | PostgreSQL adapter |
| `packages/duron/src/step-manager.ts` | Step execution and nested step handling |
| `packages/duron/src/telemetry/` | Telemetry adapters (local, opentelemetry, noop) |
| `packages/duron-dashboard/src/DuronDashboard.tsx` | Dashboard root |
| `packages/duron-dashboard/src/views/` | Dashboard pages |
| `packages/examples/basic/start.ts` | Basic example |
Expand Down Expand Up @@ -368,15 +489,22 @@ Uses Bun's bundler mode with:
## Error Handling

- Use `NonRetriableError` for errors that should not be retried
- Use `UnhandledChildStepsError` is thrown when parent steps complete with unawaited children
- Steps have built-in retry logic with exponential backoff
- Jobs have timeout/expiration settings

```typescript
import { NonRetriableError } from 'duron'
import { NonRetriableError, UnhandledChildStepsError } from 'duron'

// For errors that should not be retried
if (!apiKey) {
throw new NonRetriableError('API key is required')
}

// UnhandledChildStepsError is thrown automatically when:
// - A parent step returns before all child steps are awaited
// - The parent step's callback completes but children are still pending
// This error is non-retriable and will fail the entire job
```

## Environment Variables
Expand All @@ -395,3 +523,5 @@ if (!apiKey) {
4. Follow existing code patterns
5. Use TypeScript strict mode
6. Document public APIs with JSDoc

Always use Context7 MCP when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.
Loading