@elevasis/ui 2.15.0 → 2.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/index.js +3 -2
- package/dist/app/index.js +9 -7
- package/dist/auth/index.js +4 -3
- package/dist/charts/index.js +11 -10
- package/dist/{chunk-C7BX547M.js → chunk-2TDZBYXI.js} +9 -3
- package/dist/{chunk-5IBTTMWX.js → chunk-34NQLV2W.js} +2 -2
- package/dist/{chunk-FL67C3WY.js → chunk-6IA2OMAE.js} +1 -1
- package/dist/{chunk-L4XXM55J.js → chunk-7YQKVWSD.js} +1 -1
- package/dist/{chunk-XJ7KC54A.js → chunk-ABUDMATM.js} +7 -8
- package/dist/{chunk-TUXTSEAF.js → chunk-DK2HVHCY.js} +1 -1
- package/dist/{chunk-GHIPBT5V.js → chunk-E4WQGJNS.js} +1 -1
- package/dist/{chunk-5SXYCICG.js → chunk-FNWWVX5N.js} +8 -6
- package/dist/{chunk-IOKL7BKE.js → chunk-GCBWGGI6.js} +133 -1
- package/dist/chunk-GRGRBWIO.js +383 -0
- package/dist/{chunk-SLVC5OJ2.js → chunk-HQ7M6PBW.js} +1 -1
- package/dist/chunk-IRW7JMQ4.js +28 -0
- package/dist/{chunk-YNPVQDNB.js → chunk-JU6UB4YA.js} +4 -4
- package/dist/{chunk-SFW573HS.js → chunk-MDO4UCEJ.js} +4 -4
- package/dist/{chunk-STZJ7SY5.js → chunk-MJ6YV2B5.js} +3 -2
- package/dist/{chunk-D7HBX5US.js → chunk-MUZIYL5Q.js} +5 -4
- package/dist/{chunk-DKQQK3WX.js → chunk-OCCZRPER.js} +1 -1
- package/dist/{chunk-FFXHKADZ.js → chunk-OXWQQCDR.js} +13 -32
- package/dist/{chunk-ZB5GAV7J.js → chunk-P3TFNFZS.js} +6 -5
- package/dist/{chunk-QEPXAWE2.js → chunk-QHSW4WHM.js} +3 -26
- package/dist/{chunk-LXHZYSMQ.js → chunk-QSTH6T77.js} +2 -52
- package/dist/{chunk-U2RXVZGY.js → chunk-R7GKX4HW.js} +66 -461
- package/dist/{chunk-X75JEGHS.js → chunk-S6CYH4RI.js} +7 -6
- package/dist/{chunk-MTJ43R2E.js → chunk-SLH2QLKV.js} +1 -1
- package/dist/{chunk-32NXXCQU.js → chunk-TP5NMF6K.js} +6 -7
- package/dist/{chunk-SQQGLGHW.js → chunk-TTP62HWW.js} +3 -3
- package/dist/{chunk-NVOCKXUQ.js → chunk-VDM6DQES.js} +1 -1
- package/dist/chunk-ZTWA5H77.js +94 -0
- package/dist/components/index.d.ts +2640 -2640
- package/dist/components/index.js +38 -35
- package/dist/execution/index.js +2 -2
- package/dist/features/auth/index.js +5 -4
- package/dist/features/crm/index.d.ts +51 -51
- package/dist/features/crm/index.js +21 -19
- package/dist/features/dashboard/index.js +23 -21
- package/dist/features/delivery/index.d.ts +2604 -2604
- package/dist/features/delivery/index.js +21 -19
- package/dist/features/lead-gen/index.js +29 -26
- package/dist/features/monitoring/index.js +26 -24
- package/dist/features/monitoring/requests/index.d.ts +26 -26
- package/dist/features/monitoring/requests/index.js +21 -19
- package/dist/features/operations/index.d.ts +10 -10
- package/dist/features/operations/index.js +28 -25
- package/dist/features/seo/index.js +1 -1
- package/dist/features/settings/index.d.ts +34 -34
- package/dist/features/settings/index.js +22 -20
- package/dist/hooks/delivery/index.css +589 -0
- package/dist/hooks/delivery/index.d.ts +3044 -0
- package/dist/hooks/delivery/index.js +4 -0
- package/dist/hooks/index.d.ts +3103 -3120
- package/dist/hooks/index.js +20 -18
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +506 -0
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.js +1 -0
- package/dist/hooks/published.d.ts +3103 -3120
- package/dist/hooks/published.js +20 -18
- package/dist/index.d.ts +3409 -3361
- package/dist/index.js +21 -19
- package/dist/initialization/index.js +4 -3
- package/dist/layout/index.js +3 -3
- package/dist/organization/index.js +4 -3
- package/dist/profile/index.js +2 -1
- package/dist/provider/ElevasisServiceContext.d.ts +54 -0
- package/dist/provider/ElevasisServiceContext.js +1 -0
- package/dist/provider/index.d.ts +244 -240
- package/dist/provider/index.js +17 -16
- package/dist/provider/published.d.ts +244 -240
- package/dist/provider/published.js +15 -14
- package/dist/types/index.d.ts +2349 -2332
- package/dist/utils/index.d.ts +73 -1
- package/dist/utils/index.js +2 -1
- package/dist/zustand/index.d.ts +7 -7
- package/package.json +3 -3
- package/dist/{chunk-4BF74JVD.js → chunk-6GUW5GGF.js} +1 -1
- package/dist/{chunk-ELJIFLCB.js → chunk-KRWALB24.js} +6 -6
package/dist/types/index.d.ts
CHANGED
|
@@ -3517,6 +3517,23 @@ interface APIExecutionListResponse {
|
|
|
3517
3517
|
executions: APIExecutionSummary$1[];
|
|
3518
3518
|
}
|
|
3519
3519
|
|
|
3520
|
+
/**
|
|
3521
|
+
* Execution Runner Types
|
|
3522
|
+
*
|
|
3523
|
+
* Shared types for the Execution Runner UI feature.
|
|
3524
|
+
* Used by both API (apps/api) and frontend (apps/command-center).
|
|
3525
|
+
*/
|
|
3526
|
+
|
|
3527
|
+
interface ExecutionRunnerCatalogItem {
|
|
3528
|
+
resourceId: string;
|
|
3529
|
+
resourceName: string;
|
|
3530
|
+
resourceType: 'workflow' | 'agent';
|
|
3531
|
+
description?: string;
|
|
3532
|
+
status: 'dev' | 'prod';
|
|
3533
|
+
version: string;
|
|
3534
|
+
interface: SerializedExecutionInterface$1;
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3520
3537
|
/**
|
|
3521
3538
|
* Deployment types — browser-safe
|
|
3522
3539
|
*
|
|
@@ -3538,2350 +3555,2350 @@ interface Deployment {
|
|
|
3538
3555
|
updatedAt: string;
|
|
3539
3556
|
}
|
|
3540
3557
|
|
|
3541
|
-
/**
|
|
3542
|
-
* Workflow-specific logging types and utilities
|
|
3543
|
-
*/
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
// Workflow start/end log context
|
|
3548
|
-
interface WorkflowExecutionContext {
|
|
3549
|
-
type: 'workflow'
|
|
3550
|
-
contextType: 'workflow-execution'
|
|
3551
|
-
executionId: string
|
|
3552
|
-
workflowId: string
|
|
3553
|
-
workflowName?: string
|
|
3554
|
-
organizationId: string
|
|
3555
|
-
executionPath?: string[]
|
|
3556
|
-
}
|
|
3557
|
-
|
|
3558
|
-
// Workflow failure log context
|
|
3559
|
-
interface WorkflowFailureContext {
|
|
3560
|
-
type: 'workflow'
|
|
3561
|
-
contextType: 'workflow-failure'
|
|
3562
|
-
executionId: string
|
|
3563
|
-
workflowId: string
|
|
3564
|
-
error: string
|
|
3565
|
-
}
|
|
3566
|
-
|
|
3567
|
-
// Step started log context
|
|
3568
|
-
interface StepStartedContext {
|
|
3569
|
-
type: 'workflow'
|
|
3570
|
-
contextType: 'step-started'
|
|
3571
|
-
stepId: string
|
|
3572
|
-
stepStatus: 'started'
|
|
3573
|
-
input: unknown
|
|
3574
|
-
startTime: number // Explicit start timestamp for timeline
|
|
3575
|
-
}
|
|
3576
|
-
|
|
3577
|
-
// Step completed log context
|
|
3578
|
-
interface StepCompletedContext {
|
|
3579
|
-
type: 'workflow'
|
|
3580
|
-
contextType: 'step-completed'
|
|
3581
|
-
stepId: string
|
|
3582
|
-
stepStatus: 'completed'
|
|
3583
|
-
output: unknown
|
|
3584
|
-
duration: number
|
|
3585
|
-
isTerminal: boolean
|
|
3586
|
-
startTime: number // Explicit start timestamp for timeline
|
|
3587
|
-
endTime: number // Explicit end timestamp for timeline
|
|
3588
|
-
}
|
|
3589
|
-
|
|
3590
|
-
// Step failed log context
|
|
3591
|
-
interface StepFailedContext {
|
|
3592
|
-
type: 'workflow'
|
|
3593
|
-
contextType: 'step-failed'
|
|
3594
|
-
stepId: string
|
|
3595
|
-
stepStatus: 'failed'
|
|
3596
|
-
error: string
|
|
3597
|
-
duration: number
|
|
3598
|
-
startTime: number // Explicit start timestamp for timeline
|
|
3599
|
-
endTime: number // Explicit end timestamp for timeline
|
|
3600
|
-
}
|
|
3601
|
-
|
|
3602
|
-
// Conditional routing log context
|
|
3603
|
-
interface ConditionalRouteContext {
|
|
3604
|
-
type: 'workflow'
|
|
3605
|
-
contextType: 'conditional-route'
|
|
3606
|
-
stepId: string
|
|
3607
|
-
target: string
|
|
3608
|
-
error?: string
|
|
3609
|
-
}
|
|
3610
|
-
|
|
3611
|
-
// Execution path log context
|
|
3612
|
-
interface ExecutionPathContext {
|
|
3613
|
-
type: 'workflow'
|
|
3614
|
-
contextType: 'execution-path'
|
|
3615
|
-
executionPath: string[]
|
|
3616
|
-
}
|
|
3617
|
-
|
|
3618
|
-
// Union of all workflow log contexts
|
|
3619
|
-
type WorkflowLogContext =
|
|
3620
|
-
| WorkflowExecutionContext
|
|
3621
|
-
| WorkflowFailureContext
|
|
3622
|
-
| StepStartedContext
|
|
3623
|
-
| StepCompletedContext
|
|
3624
|
-
| StepFailedContext
|
|
3625
|
-
| ConditionalRouteContext
|
|
3558
|
+
/**
|
|
3559
|
+
* Workflow-specific logging types and utilities
|
|
3560
|
+
*/
|
|
3561
|
+
|
|
3562
|
+
|
|
3563
|
+
|
|
3564
|
+
// Workflow start/end log context
|
|
3565
|
+
interface WorkflowExecutionContext {
|
|
3566
|
+
type: 'workflow'
|
|
3567
|
+
contextType: 'workflow-execution'
|
|
3568
|
+
executionId: string
|
|
3569
|
+
workflowId: string
|
|
3570
|
+
workflowName?: string
|
|
3571
|
+
organizationId: string
|
|
3572
|
+
executionPath?: string[]
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3575
|
+
// Workflow failure log context
|
|
3576
|
+
interface WorkflowFailureContext {
|
|
3577
|
+
type: 'workflow'
|
|
3578
|
+
contextType: 'workflow-failure'
|
|
3579
|
+
executionId: string
|
|
3580
|
+
workflowId: string
|
|
3581
|
+
error: string
|
|
3582
|
+
}
|
|
3583
|
+
|
|
3584
|
+
// Step started log context
|
|
3585
|
+
interface StepStartedContext {
|
|
3586
|
+
type: 'workflow'
|
|
3587
|
+
contextType: 'step-started'
|
|
3588
|
+
stepId: string
|
|
3589
|
+
stepStatus: 'started'
|
|
3590
|
+
input: unknown
|
|
3591
|
+
startTime: number // Explicit start timestamp for timeline
|
|
3592
|
+
}
|
|
3593
|
+
|
|
3594
|
+
// Step completed log context
|
|
3595
|
+
interface StepCompletedContext {
|
|
3596
|
+
type: 'workflow'
|
|
3597
|
+
contextType: 'step-completed'
|
|
3598
|
+
stepId: string
|
|
3599
|
+
stepStatus: 'completed'
|
|
3600
|
+
output: unknown
|
|
3601
|
+
duration: number
|
|
3602
|
+
isTerminal: boolean
|
|
3603
|
+
startTime: number // Explicit start timestamp for timeline
|
|
3604
|
+
endTime: number // Explicit end timestamp for timeline
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
// Step failed log context
|
|
3608
|
+
interface StepFailedContext {
|
|
3609
|
+
type: 'workflow'
|
|
3610
|
+
contextType: 'step-failed'
|
|
3611
|
+
stepId: string
|
|
3612
|
+
stepStatus: 'failed'
|
|
3613
|
+
error: string
|
|
3614
|
+
duration: number
|
|
3615
|
+
startTime: number // Explicit start timestamp for timeline
|
|
3616
|
+
endTime: number // Explicit end timestamp for timeline
|
|
3617
|
+
}
|
|
3618
|
+
|
|
3619
|
+
// Conditional routing log context
|
|
3620
|
+
interface ConditionalRouteContext {
|
|
3621
|
+
type: 'workflow'
|
|
3622
|
+
contextType: 'conditional-route'
|
|
3623
|
+
stepId: string
|
|
3624
|
+
target: string
|
|
3625
|
+
error?: string
|
|
3626
|
+
}
|
|
3627
|
+
|
|
3628
|
+
// Execution path log context
|
|
3629
|
+
interface ExecutionPathContext {
|
|
3630
|
+
type: 'workflow'
|
|
3631
|
+
contextType: 'execution-path'
|
|
3632
|
+
executionPath: string[]
|
|
3633
|
+
}
|
|
3634
|
+
|
|
3635
|
+
// Union of all workflow log contexts
|
|
3636
|
+
type WorkflowLogContext =
|
|
3637
|
+
| WorkflowExecutionContext
|
|
3638
|
+
| WorkflowFailureContext
|
|
3639
|
+
| StepStartedContext
|
|
3640
|
+
| StepCompletedContext
|
|
3641
|
+
| StepFailedContext
|
|
3642
|
+
| ConditionalRouteContext
|
|
3626
3643
|
| ExecutionPathContext
|
|
3627
3644
|
|
|
3628
|
-
/**
|
|
3629
|
-
* Agent-specific logging types
|
|
3630
|
-
* Simplified 2-event model: lifecycle, iteration
|
|
3631
|
-
*
|
|
3632
|
-
* Design Philosophy:
|
|
3633
|
-
* - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
|
|
3634
|
-
* - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
|
|
3635
|
-
*/
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
|
|
3639
|
-
// ============================================================================
|
|
3640
|
-
// FORMAL TYPES
|
|
3641
|
-
// ============================================================================
|
|
3642
|
-
|
|
3643
|
-
/**
|
|
3644
|
-
* Agent lifecycle stages
|
|
3645
|
-
* Universal checkpoints that apply to all agent executions
|
|
3646
|
-
*/
|
|
3647
|
-
type AgentLifecycle = 'initialization' | 'iteration' | 'completion'
|
|
3648
|
-
|
|
3649
|
-
/**
|
|
3650
|
-
* Iteration event types
|
|
3651
|
-
* Activities that occur during agent iterations
|
|
3652
|
-
*/
|
|
3653
|
-
type IterationEventType = 'reasoning' | 'action' | 'tool-call'
|
|
3654
|
-
|
|
3655
|
-
// ============================================================================
|
|
3656
|
-
// LIFECYCLE EVENTS (Structural Checkpoints)
|
|
3657
|
-
// ============================================================================
|
|
3658
|
-
|
|
3659
|
-
/**
|
|
3660
|
-
* Base fields shared by all lifecycle events
|
|
3661
|
-
*/
|
|
3662
|
-
interface AgentLifecycleEventBase {
|
|
3663
|
-
type: 'agent'
|
|
3664
|
-
agentId: string
|
|
3665
|
-
lifecycle: AgentLifecycle
|
|
3666
|
-
sessionId?: string // Optional: only present when agent runs in session context
|
|
3667
|
-
}
|
|
3668
|
-
|
|
3669
|
-
/**
|
|
3670
|
-
* Lifecycle started event - emitted when a phase begins
|
|
3671
|
-
* REQUIRED: startTime (phase has started, no end yet)
|
|
3672
|
-
*/
|
|
3673
|
-
interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
|
|
3674
|
-
stage: 'started'
|
|
3675
|
-
startTime: number // REQUIRED: Phase start timestamp
|
|
3676
|
-
iteration?: number // Only for 'iteration' lifecycle
|
|
3677
|
-
}
|
|
3678
|
-
|
|
3679
|
-
/**
|
|
3680
|
-
* Lifecycle completed event - emitted when a phase succeeds
|
|
3681
|
-
* REQUIRED: startTime, endTime, duration (phase has finished successfully)
|
|
3682
|
-
*/
|
|
3683
|
-
interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
|
|
3684
|
-
stage: 'completed'
|
|
3685
|
-
startTime: number // REQUIRED: Phase start timestamp
|
|
3686
|
-
endTime: number // REQUIRED: Phase end timestamp
|
|
3687
|
-
duration: number // REQUIRED: Calculated duration (endTime - startTime)
|
|
3688
|
-
iteration?: number // Only for 'iteration' lifecycle
|
|
3689
|
-
|
|
3690
|
-
// Optional fields specific to certain lifecycles
|
|
3691
|
-
attempts?: number // Only for 'completion' lifecycle (tracks output generation attempts: 1 or 2)
|
|
3692
|
-
memorySize?: {
|
|
3693
|
-
sessionMemoryKeys: number
|
|
3694
|
-
historyEntries: number
|
|
3695
|
-
} // Only for 'completion' lifecycle (memory snapshot metadata)
|
|
3696
|
-
}
|
|
3697
|
-
|
|
3698
|
-
/**
|
|
3699
|
-
* Lifecycle failed event - emitted when a phase fails
|
|
3700
|
-
* REQUIRED: startTime, endTime, duration, error (phase has finished with error)
|
|
3701
|
-
*/
|
|
3702
|
-
interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
|
|
3703
|
-
stage: 'failed'
|
|
3704
|
-
startTime: number // REQUIRED: Phase start timestamp
|
|
3705
|
-
endTime: number // REQUIRED: Phase end timestamp
|
|
3706
|
-
duration: number // REQUIRED: Calculated duration (endTime - startTime)
|
|
3707
|
-
error: string // REQUIRED: Error message
|
|
3708
|
-
iteration?: number // Only for 'iteration' lifecycle
|
|
3709
|
-
}
|
|
3710
|
-
|
|
3711
|
-
/**
|
|
3712
|
-
* Union type for all lifecycle events
|
|
3713
|
-
* Discriminated by 'stage' field for type narrowing
|
|
3714
|
-
*/
|
|
3715
|
-
type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent
|
|
3716
|
-
|
|
3717
|
-
// ============================================================================
|
|
3718
|
-
// ITERATION EVENTS (Execution Activities)
|
|
3719
|
-
// ============================================================================
|
|
3720
|
-
|
|
3721
|
-
/**
|
|
3722
|
-
* Placeholder data for MVP
|
|
3723
|
-
* Will be typed per actionType in future
|
|
3724
|
-
*/
|
|
3725
|
-
interface ActionPlaceholderData {
|
|
3726
|
-
message: string
|
|
3727
|
-
}
|
|
3728
|
-
|
|
3729
|
-
/**
|
|
3730
|
-
* Iteration event - captures activities during agent iterations
|
|
3731
|
-
* Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
|
|
3732
|
-
*/
|
|
3733
|
-
interface AgentIterationEvent {
|
|
3734
|
-
type: 'agent'
|
|
3735
|
-
agentId: string
|
|
3736
|
-
lifecycle: 'iteration' // Always iteration
|
|
3737
|
-
eventType: IterationEventType
|
|
3738
|
-
iteration: number
|
|
3739
|
-
sessionId?: string // Optional: only present when agent runs in session context
|
|
3740
|
-
|
|
3741
|
-
// Timeline timing fields (v2 - Clean Break)
|
|
3742
|
-
startTime: number // Activity start timestamp
|
|
3743
|
-
endTime: number // Activity end timestamp
|
|
3744
|
-
duration: number // Calculated duration (endTime - startTime)
|
|
3745
|
-
|
|
3746
|
-
// Conditional fields based on eventType
|
|
3747
|
-
output?: string // For reasoning events
|
|
3748
|
-
actionType?: string // For action events (tool-use, delegate, memory-write, etc.)
|
|
3749
|
-
data?: ActionPlaceholderData // For action events
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
|
-
/**
|
|
3753
|
-
* Tool call event - captures individual tool executions during iterations
|
|
3754
|
-
* Provides granular timing for each tool invocation
|
|
3755
|
-
*/
|
|
3756
|
-
interface AgentToolCallEvent {
|
|
3757
|
-
type: 'agent'
|
|
3758
|
-
agentId: string
|
|
3759
|
-
lifecycle: 'iteration' // Always iteration
|
|
3760
|
-
eventType: 'tool-call' // Specific event type for tool calls
|
|
3761
|
-
iteration: number
|
|
3762
|
-
sessionId?: string // Optional: only present when agent runs in session context
|
|
3763
|
-
|
|
3764
|
-
// Tool identification and timing
|
|
3765
|
-
toolName: string // Tool identifier
|
|
3766
|
-
startTime: number // Tool call start timestamp
|
|
3767
|
-
endTime: number // Tool call end timestamp
|
|
3768
|
-
duration: number // Calculated duration
|
|
3769
|
-
|
|
3770
|
-
// Execution results
|
|
3771
|
-
success: boolean // Whether tool execution succeeded
|
|
3772
|
-
error?: string // Error message if failed
|
|
3773
|
-
input?: Record<string, unknown> // Tool input parameters
|
|
3774
|
-
output?: unknown // Tool output result
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
|
-
// ============================================================================
|
|
3778
|
-
// UNION TYPES
|
|
3779
|
-
// ============================================================================
|
|
3780
|
-
|
|
3781
|
-
/**
|
|
3782
|
-
* Union type for all agent log contexts
|
|
3783
|
-
* 3 event types total (lifecycle, iteration, tool-call)
|
|
3784
|
-
*/
|
|
3645
|
+
/**
|
|
3646
|
+
* Agent-specific logging types
|
|
3647
|
+
* Simplified 2-event model: lifecycle, iteration
|
|
3648
|
+
*
|
|
3649
|
+
* Design Philosophy:
|
|
3650
|
+
* - LIFECYCLE EVENTS: Structural checkpoints (initialization, iteration, completion)
|
|
3651
|
+
* - ITERATION EVENTS: Execution activities (reasoning, actions during iterations)
|
|
3652
|
+
*/
|
|
3653
|
+
|
|
3654
|
+
|
|
3655
|
+
|
|
3656
|
+
// ============================================================================
|
|
3657
|
+
// FORMAL TYPES
|
|
3658
|
+
// ============================================================================
|
|
3659
|
+
|
|
3660
|
+
/**
|
|
3661
|
+
* Agent lifecycle stages
|
|
3662
|
+
* Universal checkpoints that apply to all agent executions
|
|
3663
|
+
*/
|
|
3664
|
+
type AgentLifecycle = 'initialization' | 'iteration' | 'completion'
|
|
3665
|
+
|
|
3666
|
+
/**
|
|
3667
|
+
* Iteration event types
|
|
3668
|
+
* Activities that occur during agent iterations
|
|
3669
|
+
*/
|
|
3670
|
+
type IterationEventType = 'reasoning' | 'action' | 'tool-call'
|
|
3671
|
+
|
|
3672
|
+
// ============================================================================
|
|
3673
|
+
// LIFECYCLE EVENTS (Structural Checkpoints)
|
|
3674
|
+
// ============================================================================
|
|
3675
|
+
|
|
3676
|
+
/**
|
|
3677
|
+
* Base fields shared by all lifecycle events
|
|
3678
|
+
*/
|
|
3679
|
+
interface AgentLifecycleEventBase {
|
|
3680
|
+
type: 'agent'
|
|
3681
|
+
agentId: string
|
|
3682
|
+
lifecycle: AgentLifecycle
|
|
3683
|
+
sessionId?: string // Optional: only present when agent runs in session context
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
/**
|
|
3687
|
+
* Lifecycle started event - emitted when a phase begins
|
|
3688
|
+
* REQUIRED: startTime (phase has started, no end yet)
|
|
3689
|
+
*/
|
|
3690
|
+
interface AgentLifecycleStartedEvent extends AgentLifecycleEventBase {
|
|
3691
|
+
stage: 'started'
|
|
3692
|
+
startTime: number // REQUIRED: Phase start timestamp
|
|
3693
|
+
iteration?: number // Only for 'iteration' lifecycle
|
|
3694
|
+
}
|
|
3695
|
+
|
|
3696
|
+
/**
|
|
3697
|
+
* Lifecycle completed event - emitted when a phase succeeds
|
|
3698
|
+
* REQUIRED: startTime, endTime, duration (phase has finished successfully)
|
|
3699
|
+
*/
|
|
3700
|
+
interface AgentLifecycleCompletedEvent extends AgentLifecycleEventBase {
|
|
3701
|
+
stage: 'completed'
|
|
3702
|
+
startTime: number // REQUIRED: Phase start timestamp
|
|
3703
|
+
endTime: number // REQUIRED: Phase end timestamp
|
|
3704
|
+
duration: number // REQUIRED: Calculated duration (endTime - startTime)
|
|
3705
|
+
iteration?: number // Only for 'iteration' lifecycle
|
|
3706
|
+
|
|
3707
|
+
// Optional fields specific to certain lifecycles
|
|
3708
|
+
attempts?: number // Only for 'completion' lifecycle (tracks output generation attempts: 1 or 2)
|
|
3709
|
+
memorySize?: {
|
|
3710
|
+
sessionMemoryKeys: number
|
|
3711
|
+
historyEntries: number
|
|
3712
|
+
} // Only for 'completion' lifecycle (memory snapshot metadata)
|
|
3713
|
+
}
|
|
3714
|
+
|
|
3715
|
+
/**
|
|
3716
|
+
* Lifecycle failed event - emitted when a phase fails
|
|
3717
|
+
* REQUIRED: startTime, endTime, duration, error (phase has finished with error)
|
|
3718
|
+
*/
|
|
3719
|
+
interface AgentLifecycleFailedEvent extends AgentLifecycleEventBase {
|
|
3720
|
+
stage: 'failed'
|
|
3721
|
+
startTime: number // REQUIRED: Phase start timestamp
|
|
3722
|
+
endTime: number // REQUIRED: Phase end timestamp
|
|
3723
|
+
duration: number // REQUIRED: Calculated duration (endTime - startTime)
|
|
3724
|
+
error: string // REQUIRED: Error message
|
|
3725
|
+
iteration?: number // Only for 'iteration' lifecycle
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3728
|
+
/**
|
|
3729
|
+
* Union type for all lifecycle events
|
|
3730
|
+
* Discriminated by 'stage' field for type narrowing
|
|
3731
|
+
*/
|
|
3732
|
+
type AgentLifecycleEvent = AgentLifecycleStartedEvent | AgentLifecycleCompletedEvent | AgentLifecycleFailedEvent
|
|
3733
|
+
|
|
3734
|
+
// ============================================================================
|
|
3735
|
+
// ITERATION EVENTS (Execution Activities)
|
|
3736
|
+
// ============================================================================
|
|
3737
|
+
|
|
3738
|
+
/**
|
|
3739
|
+
* Placeholder data for MVP
|
|
3740
|
+
* Will be typed per actionType in future
|
|
3741
|
+
*/
|
|
3742
|
+
interface ActionPlaceholderData {
|
|
3743
|
+
message: string
|
|
3744
|
+
}
|
|
3745
|
+
|
|
3746
|
+
/**
|
|
3747
|
+
* Iteration event - captures activities during agent iterations
|
|
3748
|
+
* Consolidates reasoning (LLM thought process) and actions (tool use, memory ops, etc.)
|
|
3749
|
+
*/
|
|
3750
|
+
interface AgentIterationEvent {
|
|
3751
|
+
type: 'agent'
|
|
3752
|
+
agentId: string
|
|
3753
|
+
lifecycle: 'iteration' // Always iteration
|
|
3754
|
+
eventType: IterationEventType
|
|
3755
|
+
iteration: number
|
|
3756
|
+
sessionId?: string // Optional: only present when agent runs in session context
|
|
3757
|
+
|
|
3758
|
+
// Timeline timing fields (v2 - Clean Break)
|
|
3759
|
+
startTime: number // Activity start timestamp
|
|
3760
|
+
endTime: number // Activity end timestamp
|
|
3761
|
+
duration: number // Calculated duration (endTime - startTime)
|
|
3762
|
+
|
|
3763
|
+
// Conditional fields based on eventType
|
|
3764
|
+
output?: string // For reasoning events
|
|
3765
|
+
actionType?: string // For action events (tool-use, delegate, memory-write, etc.)
|
|
3766
|
+
data?: ActionPlaceholderData // For action events
|
|
3767
|
+
}
|
|
3768
|
+
|
|
3769
|
+
/**
|
|
3770
|
+
* Tool call event - captures individual tool executions during iterations
|
|
3771
|
+
* Provides granular timing for each tool invocation
|
|
3772
|
+
*/
|
|
3773
|
+
interface AgentToolCallEvent {
|
|
3774
|
+
type: 'agent'
|
|
3775
|
+
agentId: string
|
|
3776
|
+
lifecycle: 'iteration' // Always iteration
|
|
3777
|
+
eventType: 'tool-call' // Specific event type for tool calls
|
|
3778
|
+
iteration: number
|
|
3779
|
+
sessionId?: string // Optional: only present when agent runs in session context
|
|
3780
|
+
|
|
3781
|
+
// Tool identification and timing
|
|
3782
|
+
toolName: string // Tool identifier
|
|
3783
|
+
startTime: number // Tool call start timestamp
|
|
3784
|
+
endTime: number // Tool call end timestamp
|
|
3785
|
+
duration: number // Calculated duration
|
|
3786
|
+
|
|
3787
|
+
// Execution results
|
|
3788
|
+
success: boolean // Whether tool execution succeeded
|
|
3789
|
+
error?: string // Error message if failed
|
|
3790
|
+
input?: Record<string, unknown> // Tool input parameters
|
|
3791
|
+
output?: unknown // Tool output result
|
|
3792
|
+
}
|
|
3793
|
+
|
|
3794
|
+
// ============================================================================
|
|
3795
|
+
// UNION TYPES
|
|
3796
|
+
// ============================================================================
|
|
3797
|
+
|
|
3798
|
+
/**
|
|
3799
|
+
* Union type for all agent log contexts
|
|
3800
|
+
* 3 event types total (lifecycle, iteration, tool-call)
|
|
3801
|
+
*/
|
|
3785
3802
|
type AgentLogContext = AgentLifecycleEvent | AgentIterationEvent | AgentToolCallEvent
|
|
3786
3803
|
|
|
3787
|
-
/**
|
|
3788
|
-
* Base execution logger for Execution Engine
|
|
3789
|
-
*/
|
|
3790
|
-
type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error'
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
// Union type for all contexts
|
|
3794
|
-
type LogContext = WorkflowLogContext | AgentLogContext
|
|
3795
|
-
|
|
3796
|
-
// Updated interface with consolidated context
|
|
3797
|
-
interface ExecutionLogMessage {
|
|
3798
|
-
level: ExecutionLogLevel
|
|
3799
|
-
message: string
|
|
3800
|
-
timestamp: number
|
|
3801
|
-
context?: LogContext
|
|
3802
|
-
}
|
|
3803
|
-
|
|
3804
|
-
/**
|
|
3805
|
-
* Shared form field types for dynamic form generation
|
|
3806
|
-
* Used by: Command Queue, Execution Runner UI, future form-based features
|
|
3807
|
-
*/
|
|
3808
|
-
|
|
3809
|
-
/**
|
|
3810
|
-
* Supported form field types for action payloads
|
|
3811
|
-
* Maps to Mantine form components
|
|
3812
|
-
*/
|
|
3813
|
-
type FormFieldType =
|
|
3814
|
-
| 'text' // TextInput
|
|
3815
|
-
| 'textarea' // Textarea
|
|
3816
|
-
| 'number' // NumberInput
|
|
3817
|
-
| 'select' // Select dropdown
|
|
3818
|
-
| 'checkbox' // Checkbox
|
|
3819
|
-
| 'radio' // Radio group
|
|
3820
|
-
| 'richtext' // Rich text editor (TipTap)
|
|
3821
|
-
|
|
3822
|
-
/**
|
|
3823
|
-
* Form field definition
|
|
3824
|
-
*/
|
|
3825
|
-
interface FormField {
|
|
3826
|
-
/** Field key in payload object */
|
|
3827
|
-
name: string
|
|
3828
|
-
|
|
3829
|
-
/** Field label for UI */
|
|
3830
|
-
label: string
|
|
3831
|
-
|
|
3832
|
-
/** Field type (determines UI component) */
|
|
3833
|
-
type: FormFieldType
|
|
3834
|
-
|
|
3835
|
-
/** Default value */
|
|
3836
|
-
defaultValue?: unknown
|
|
3837
|
-
|
|
3838
|
-
/** Required field */
|
|
3839
|
-
required?: boolean
|
|
3840
|
-
|
|
3841
|
-
/** Placeholder text */
|
|
3842
|
-
placeholder?: string
|
|
3843
|
-
|
|
3844
|
-
/** Help text */
|
|
3845
|
-
description?: string
|
|
3846
|
-
|
|
3847
|
-
/** Options for select/radio */
|
|
3848
|
-
options?: Array<{
|
|
3849
|
-
label: string
|
|
3850
|
-
value: string | number
|
|
3851
|
-
}>
|
|
3852
|
-
|
|
3853
|
-
/** Min/max for number */
|
|
3854
|
-
min?: number
|
|
3855
|
-
max?: number
|
|
3856
|
-
|
|
3857
|
-
/** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
|
|
3858
|
-
defaultValueFromContext?: string
|
|
3859
|
-
}
|
|
3860
|
-
|
|
3861
|
-
/**
|
|
3862
|
-
* Form schema for action payload collection
|
|
3863
|
-
*/
|
|
3864
|
-
interface FormSchema {
|
|
3865
|
-
/** Form title */
|
|
3866
|
-
title?: string
|
|
3867
|
-
|
|
3868
|
-
/** Form description */
|
|
3869
|
-
description?: string
|
|
3870
|
-
|
|
3871
|
-
/** Form fields */
|
|
3872
|
-
fields: FormField[]
|
|
3873
|
-
}
|
|
3874
|
-
|
|
3875
|
-
/**
|
|
3876
|
-
* Error categories for observability grouping and classification.
|
|
3877
|
-
* Used to categorize errors in the execution_errors table metadata.
|
|
3878
|
-
*/
|
|
3804
|
+
/**
|
|
3805
|
+
* Base execution logger for Execution Engine
|
|
3806
|
+
*/
|
|
3807
|
+
type ExecutionLogLevel = 'debug' | 'info' | 'warn' | 'error'
|
|
3808
|
+
|
|
3809
|
+
|
|
3810
|
+
// Union type for all contexts
|
|
3811
|
+
type LogContext = WorkflowLogContext | AgentLogContext
|
|
3812
|
+
|
|
3813
|
+
// Updated interface with consolidated context
|
|
3814
|
+
interface ExecutionLogMessage {
|
|
3815
|
+
level: ExecutionLogLevel
|
|
3816
|
+
message: string
|
|
3817
|
+
timestamp: number
|
|
3818
|
+
context?: LogContext
|
|
3819
|
+
}
|
|
3820
|
+
|
|
3821
|
+
/**
|
|
3822
|
+
* Shared form field types for dynamic form generation
|
|
3823
|
+
* Used by: Command Queue, Execution Runner UI, future form-based features
|
|
3824
|
+
*/
|
|
3825
|
+
|
|
3826
|
+
/**
|
|
3827
|
+
* Supported form field types for action payloads
|
|
3828
|
+
* Maps to Mantine form components
|
|
3829
|
+
*/
|
|
3830
|
+
type FormFieldType =
|
|
3831
|
+
| 'text' // TextInput
|
|
3832
|
+
| 'textarea' // Textarea
|
|
3833
|
+
| 'number' // NumberInput
|
|
3834
|
+
| 'select' // Select dropdown
|
|
3835
|
+
| 'checkbox' // Checkbox
|
|
3836
|
+
| 'radio' // Radio group
|
|
3837
|
+
| 'richtext' // Rich text editor (TipTap)
|
|
3838
|
+
|
|
3839
|
+
/**
|
|
3840
|
+
* Form field definition
|
|
3841
|
+
*/
|
|
3842
|
+
interface FormField {
|
|
3843
|
+
/** Field key in payload object */
|
|
3844
|
+
name: string
|
|
3845
|
+
|
|
3846
|
+
/** Field label for UI */
|
|
3847
|
+
label: string
|
|
3848
|
+
|
|
3849
|
+
/** Field type (determines UI component) */
|
|
3850
|
+
type: FormFieldType
|
|
3851
|
+
|
|
3852
|
+
/** Default value */
|
|
3853
|
+
defaultValue?: unknown
|
|
3854
|
+
|
|
3855
|
+
/** Required field */
|
|
3856
|
+
required?: boolean
|
|
3857
|
+
|
|
3858
|
+
/** Placeholder text */
|
|
3859
|
+
placeholder?: string
|
|
3860
|
+
|
|
3861
|
+
/** Help text */
|
|
3862
|
+
description?: string
|
|
3863
|
+
|
|
3864
|
+
/** Options for select/radio */
|
|
3865
|
+
options?: Array<{
|
|
3866
|
+
label: string
|
|
3867
|
+
value: string | number
|
|
3868
|
+
}>
|
|
3869
|
+
|
|
3870
|
+
/** Min/max for number */
|
|
3871
|
+
min?: number
|
|
3872
|
+
max?: number
|
|
3873
|
+
|
|
3874
|
+
/** Path to context value for pre-filling (dot notation, e.g., 'proposal.summary') */
|
|
3875
|
+
defaultValueFromContext?: string
|
|
3876
|
+
}
|
|
3877
|
+
|
|
3878
|
+
/**
|
|
3879
|
+
* Form schema for action payload collection
|
|
3880
|
+
*/
|
|
3881
|
+
interface FormSchema {
|
|
3882
|
+
/** Form title */
|
|
3883
|
+
title?: string
|
|
3884
|
+
|
|
3885
|
+
/** Form description */
|
|
3886
|
+
description?: string
|
|
3887
|
+
|
|
3888
|
+
/** Form fields */
|
|
3889
|
+
fields: FormField[]
|
|
3890
|
+
}
|
|
3891
|
+
|
|
3892
|
+
/**
|
|
3893
|
+
* Error categories for observability grouping and classification.
|
|
3894
|
+
* Used to categorize errors in the execution_errors table metadata.
|
|
3895
|
+
*/
|
|
3879
3896
|
type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system'
|
|
3880
3897
|
|
|
3881
|
-
/**
|
|
3882
|
-
* Memory type definitions
|
|
3883
|
-
* Types for agent memory management with semantic entry types
|
|
3884
|
-
*/
|
|
3885
|
-
|
|
3886
|
-
/**
|
|
3887
|
-
* Semantic memory entry types
|
|
3888
|
-
* Use-case agnostic types that describe the purpose of each entry
|
|
3889
|
-
* Memory types mirror action types for clarity and filtering
|
|
3890
|
-
*/
|
|
3891
|
-
type MemoryEntryType =
|
|
3892
|
-
| 'context' // Pre-loaded context entry (before execution)
|
|
3893
|
-
| 'input' // User request or event payload
|
|
3894
|
-
| 'reasoning' // LLM thought process
|
|
3895
|
-
| 'tool-result' // Result from tool execution
|
|
3896
|
-
| 'delegation-result' // Result from sub-agent delegation (future)
|
|
3897
|
-
| 'error' // Error from failed action (tool error, validation error, etc.)
|
|
3898
|
-
|
|
3899
|
-
/**
|
|
3900
|
-
* Memory entry - represents a single entry in agent memory
|
|
3901
|
-
* Stored in agent memory, translated by adapters to vendor-specific formats
|
|
3902
|
-
*/
|
|
3903
|
-
interface MemoryEntry {
|
|
3904
|
-
type: MemoryEntryType
|
|
3905
|
-
content: string
|
|
3906
|
-
timestamp: number
|
|
3907
|
-
turnNumber: number | null // Which turn/execution created this entry (1, 2, 3... for session turns, null for session memory or one-off executions)
|
|
3908
|
-
iterationNumber: number | null // Which iteration created this entry (0 = pre-iteration input, null = session memory/non-iteration-specific)
|
|
3909
|
-
}
|
|
3910
|
-
|
|
3911
|
-
/**
|
|
3912
|
-
* Agent memory - Self-orchestrated memory with session + working storage
|
|
3913
|
-
* Agent has full control over what persists, framework handles auto-compaction
|
|
3914
|
-
*/
|
|
3915
|
-
interface AgentMemory {
|
|
3916
|
-
/**
|
|
3917
|
-
* Session memory - Persists for session/conversation duration
|
|
3918
|
-
* Never auto-trimmed by framework
|
|
3919
|
-
* Agent-managed key-value store for critical information
|
|
3920
|
-
* Agent provides strings, framework wraps in MemoryEntry
|
|
3921
|
-
*/
|
|
3922
|
-
sessionMemory: Record<string, MemoryEntry>
|
|
3923
|
-
|
|
3924
|
-
/**
|
|
3925
|
-
* Working memory - Execution history
|
|
3926
|
-
* Automatically compacted by framework when needed
|
|
3927
|
-
* Agent doesn't control compaction
|
|
3928
|
-
*/
|
|
3929
|
-
history: MemoryEntry[]
|
|
3930
|
-
}
|
|
3931
|
-
|
|
3932
|
-
/**
|
|
3933
|
-
* Model Configuration
|
|
3934
|
-
* Centralized model information, configuration, options, constraints, and validation
|
|
3935
|
-
* Single source of truth for all model-related definitions
|
|
3936
|
-
* Update manually when pricing changes or new models are added
|
|
3937
|
-
*/
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
// ============================================================================
|
|
3942
|
-
// Model Types
|
|
3943
|
-
// ============================================================================
|
|
3944
|
-
|
|
3945
|
-
/**
|
|
3946
|
-
* Supported Open AI models (direct SDK access)
|
|
3947
|
-
*/
|
|
3948
|
-
type OpenAIModel = 'gpt-5' | 'gpt-5.4-mini' | 'gpt-5.4-nano'
|
|
3949
|
-
|
|
3950
|
-
/**
|
|
3951
|
-
* Supported OpenRouter models (explicit union for type safety)
|
|
3952
|
-
*/
|
|
3953
|
-
type OpenRouterModel = 'openrouter/z-ai/glm-5'
|
|
3954
|
-
|
|
3955
|
-
/**
|
|
3956
|
-
* Supported Google models (direct SDK access)
|
|
3957
|
-
*/
|
|
3958
|
-
type GoogleModel = 'gemini-3-flash-preview' | 'gemini-3.1-flash-lite-preview'
|
|
3959
|
-
|
|
3960
|
-
/**
|
|
3961
|
-
* Supported Anthropic models (direct SDK access via @anthropic-ai/sdk)
|
|
3962
|
-
*/
|
|
3963
|
-
type AnthropicModel = 'claude-sonnet-4-5'
|
|
3964
|
-
|
|
3965
|
-
/** Supported LLM models */
|
|
3966
|
-
type LLMModel = OpenAIModel | OpenRouterModel | GoogleModel | AnthropicModel | 'mock'
|
|
3967
|
-
|
|
3968
|
-
// ============================================================================
|
|
3969
|
-
// Model Configuration Schemas (Schema-First - Single Source of Truth)
|
|
3970
|
-
// ============================================================================
|
|
3971
|
-
|
|
3972
|
-
/**
|
|
3973
|
-
* GPT-5 model options schema
|
|
3974
|
-
*/
|
|
3975
|
-
declare const GPT5OptionsSchema = z.object({
|
|
3976
|
-
reasoning_effort: z.enum(['minimal', 'low', 'medium', 'high']).optional(),
|
|
3977
|
-
verbosity: z.enum(['low', 'medium', 'high']).optional()
|
|
3978
|
-
})
|
|
3979
|
-
|
|
3980
|
-
/**
|
|
3981
|
-
* OpenRouter model options schema
|
|
3982
|
-
* OpenRouter-specific options for routing and transforms
|
|
3983
|
-
*/
|
|
3984
|
-
declare const OpenRouterOptionsSchema = z.object({
|
|
3985
|
-
/** Optional transforms to apply (e.g., 'middle-out' for long context) */
|
|
3986
|
-
transforms: z.array(z.string()).optional(),
|
|
3987
|
-
/** Routing strategy (e.g., 'fallback' for automatic provider failover) */
|
|
3988
|
-
route: z.enum(['fallback']).optional()
|
|
3989
|
-
})
|
|
3990
|
-
|
|
3991
|
-
/**
|
|
3992
|
-
* Google model options schema
|
|
3993
|
-
* Gemini 3 specific options for thinking depth control
|
|
3994
|
-
*/
|
|
3995
|
-
declare const GoogleOptionsSchema = z.object({
|
|
3996
|
-
/** Thinking level for Gemini 3 models (controls reasoning depth) */
|
|
3997
|
-
thinkingLevel: z.enum(['minimal', 'low', 'medium', 'high']).optional()
|
|
3998
|
-
})
|
|
3999
|
-
|
|
4000
|
-
/**
|
|
4001
|
-
* Anthropic model options schema
|
|
4002
|
-
* Currently empty - future options: budget_tokens for extended thinking
|
|
4003
|
-
*/
|
|
4004
|
-
declare const AnthropicOptionsSchema = z.object({})
|
|
4005
|
-
|
|
4006
|
-
/**
|
|
4007
|
-
* Infer TypeScript types from schemas
|
|
4008
|
-
*/
|
|
4009
|
-
type GPT5Options = z.infer<typeof GPT5OptionsSchema>
|
|
4010
|
-
type MockOptions = Record<string, never>
|
|
4011
|
-
type OpenRouterOptions = z.infer<typeof OpenRouterOptionsSchema>
|
|
4012
|
-
type GoogleOptions = z.infer<typeof GoogleOptionsSchema>
|
|
4013
|
-
type AnthropicOptions = z.infer<typeof AnthropicOptionsSchema>
|
|
4014
|
-
type ModelSpecificOptions = GPT5Options | MockOptions | OpenRouterOptions | GoogleOptions | AnthropicOptions
|
|
4015
|
-
|
|
4016
|
-
// ============================================================================
|
|
4017
|
-
// Model Configuration
|
|
4018
|
-
// ============================================================================
|
|
4019
|
-
|
|
4020
|
-
/**
|
|
4021
|
-
* Model configuration for LLM execution
|
|
4022
|
-
* Belongs in resource definition (AgentDefinition, WorkflowDefinition, etc.)
|
|
4023
|
-
*/
|
|
4024
|
-
interface ModelConfig {
|
|
4025
|
-
model: LLMModel
|
|
4026
|
-
provider: 'openai' | 'anthropic' | 'openrouter' | 'google' | 'mock'
|
|
4027
|
-
apiKey: string
|
|
4028
|
-
temperature?: number
|
|
4029
|
-
/** Maximum output tokens per LLM call. NOT the model's context window — see ModelInfo.maxTokens for that. */
|
|
4030
|
-
maxOutputTokens?: number
|
|
4031
|
-
topP?: number
|
|
4032
|
-
|
|
4033
|
-
/**
|
|
4034
|
-
* Model-specific options (flat structure)
|
|
4035
|
-
* Options are model-specific, not vendor-specific
|
|
4036
|
-
* Available options defined in MODEL_INFO per model
|
|
4037
|
-
* Validated at build time via validateModelOptions()
|
|
4038
|
-
*/
|
|
4039
|
-
modelOptions?: ModelSpecificOptions
|
|
4040
|
-
}
|
|
4041
|
-
|
|
4042
|
-
// ============================================================================
|
|
4043
|
-
// AI Call Tracking Types (SSOT)
|
|
4044
|
-
// ============================================================================
|
|
4045
|
-
|
|
4046
|
-
interface BaseAICall {
|
|
4047
|
-
callSequence: number // 1, 2, 3... (execution-wide universal counter)
|
|
4048
|
-
callType: 'agent-reasoning' | 'agent-completion' | 'workflow-step' | 'tool' | 'other'
|
|
4049
|
-
model: LLMModel
|
|
4050
|
-
inputTokens: number
|
|
4051
|
-
outputTokens: number
|
|
4052
|
-
costUsd: number // Cost in USD with full decimal precision
|
|
4053
|
-
latencyMs: number
|
|
4054
|
-
context?: AICallContext
|
|
4055
|
-
}
|
|
4056
|
-
|
|
4057
|
-
type AICallContext =
|
|
4058
|
-
| AgentReasoningContext
|
|
4059
|
-
| AgentCompletionContext
|
|
4060
|
-
| WorkflowStepContext
|
|
4061
|
-
| ToolCallContext
|
|
4062
|
-
| OtherCallContext
|
|
4063
|
-
|
|
4064
|
-
interface AgentReasoningContext {
|
|
4065
|
-
type: 'agent-reasoning'
|
|
4066
|
-
iteration: number
|
|
4067
|
-
actionsPlanned?: string[]
|
|
4068
|
-
sessionId?: string
|
|
4069
|
-
turnNumber?: number
|
|
4070
|
-
}
|
|
4071
|
-
|
|
4072
|
-
interface AgentCompletionContext {
|
|
4073
|
-
type: 'agent-completion'
|
|
4074
|
-
attempt: 1 | 2
|
|
4075
|
-
validationFailed?: boolean
|
|
4076
|
-
sessionId?: string
|
|
4077
|
-
turnNumber?: number
|
|
4078
|
-
}
|
|
4079
|
-
|
|
4080
|
-
interface WorkflowStepContext {
|
|
4081
|
-
type: 'workflow-step'
|
|
4082
|
-
stepId: string
|
|
4083
|
-
stepName?: string
|
|
4084
|
-
stepSequence?: number
|
|
4085
|
-
}
|
|
4086
|
-
|
|
4087
|
-
interface ToolCallContext {
|
|
4088
|
-
type: 'tool'
|
|
4089
|
-
toolName: string
|
|
4090
|
-
parentIteration?: number
|
|
4091
|
-
parentStepId?: string
|
|
4092
|
-
}
|
|
4093
|
-
|
|
4094
|
-
interface OtherCallContext {
|
|
4095
|
-
type: 'other'
|
|
4096
|
-
description?: string
|
|
4097
|
-
metadata?: Record<string, unknown>
|
|
4098
|
-
}
|
|
4099
|
-
|
|
4100
|
-
type AICallRecord = BaseAICall
|
|
4101
|
-
|
|
4102
|
-
// ============================================================================
|
|
4103
|
-
// API Request/Response Types (Dashboard Observability)
|
|
4104
|
-
// ============================================================================
|
|
3898
|
+
/**
|
|
3899
|
+
* Memory type definitions
|
|
3900
|
+
* Types for agent memory management with semantic entry types
|
|
3901
|
+
*/
|
|
3902
|
+
|
|
3903
|
+
/**
|
|
3904
|
+
* Semantic memory entry types
|
|
3905
|
+
* Use-case agnostic types that describe the purpose of each entry
|
|
3906
|
+
* Memory types mirror action types for clarity and filtering
|
|
3907
|
+
*/
|
|
3908
|
+
type MemoryEntryType =
|
|
3909
|
+
| 'context' // Pre-loaded context entry (before execution)
|
|
3910
|
+
| 'input' // User request or event payload
|
|
3911
|
+
| 'reasoning' // LLM thought process
|
|
3912
|
+
| 'tool-result' // Result from tool execution
|
|
3913
|
+
| 'delegation-result' // Result from sub-agent delegation (future)
|
|
3914
|
+
| 'error' // Error from failed action (tool error, validation error, etc.)
|
|
3915
|
+
|
|
3916
|
+
/**
|
|
3917
|
+
* Memory entry - represents a single entry in agent memory
|
|
3918
|
+
* Stored in agent memory, translated by adapters to vendor-specific formats
|
|
3919
|
+
*/
|
|
3920
|
+
interface MemoryEntry {
|
|
3921
|
+
type: MemoryEntryType
|
|
3922
|
+
content: string
|
|
3923
|
+
timestamp: number
|
|
3924
|
+
turnNumber: number | null // Which turn/execution created this entry (1, 2, 3... for session turns, null for session memory or one-off executions)
|
|
3925
|
+
iterationNumber: number | null // Which iteration created this entry (0 = pre-iteration input, null = session memory/non-iteration-specific)
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3928
|
+
/**
|
|
3929
|
+
* Agent memory - Self-orchestrated memory with session + working storage
|
|
3930
|
+
* Agent has full control over what persists, framework handles auto-compaction
|
|
3931
|
+
*/
|
|
3932
|
+
interface AgentMemory {
|
|
3933
|
+
/**
|
|
3934
|
+
* Session memory - Persists for session/conversation duration
|
|
3935
|
+
* Never auto-trimmed by framework
|
|
3936
|
+
* Agent-managed key-value store for critical information
|
|
3937
|
+
* Agent provides strings, framework wraps in MemoryEntry
|
|
3938
|
+
*/
|
|
3939
|
+
sessionMemory: Record<string, MemoryEntry>
|
|
3940
|
+
|
|
3941
|
+
/**
|
|
3942
|
+
* Working memory - Execution history
|
|
3943
|
+
* Automatically compacted by framework when needed
|
|
3944
|
+
* Agent doesn't control compaction
|
|
3945
|
+
*/
|
|
3946
|
+
history: MemoryEntry[]
|
|
3947
|
+
}
|
|
3948
|
+
|
|
3949
|
+
/**
|
|
3950
|
+
* Model Configuration
|
|
3951
|
+
* Centralized model information, configuration, options, constraints, and validation
|
|
3952
|
+
* Single source of truth for all model-related definitions
|
|
3953
|
+
* Update manually when pricing changes or new models are added
|
|
3954
|
+
*/
|
|
3955
|
+
|
|
3956
|
+
|
|
3957
|
+
|
|
3958
|
+
// ============================================================================
|
|
3959
|
+
// Model Types
|
|
3960
|
+
// ============================================================================
|
|
3961
|
+
|
|
3962
|
+
/**
|
|
3963
|
+
* Supported Open AI models (direct SDK access)
|
|
3964
|
+
*/
|
|
3965
|
+
type OpenAIModel = 'gpt-5' | 'gpt-5.4-mini' | 'gpt-5.4-nano'
|
|
3966
|
+
|
|
3967
|
+
/**
|
|
3968
|
+
* Supported OpenRouter models (explicit union for type safety)
|
|
3969
|
+
*/
|
|
3970
|
+
type OpenRouterModel = 'openrouter/z-ai/glm-5'
|
|
3971
|
+
|
|
3972
|
+
/**
|
|
3973
|
+
* Supported Google models (direct SDK access)
|
|
3974
|
+
*/
|
|
3975
|
+
type GoogleModel = 'gemini-3-flash-preview' | 'gemini-3.1-flash-lite-preview'
|
|
3976
|
+
|
|
3977
|
+
/**
|
|
3978
|
+
* Supported Anthropic models (direct SDK access via @anthropic-ai/sdk)
|
|
3979
|
+
*/
|
|
3980
|
+
type AnthropicModel = 'claude-sonnet-4-5'
|
|
3981
|
+
|
|
3982
|
+
/** Supported LLM models */
|
|
3983
|
+
type LLMModel = OpenAIModel | OpenRouterModel | GoogleModel | AnthropicModel | 'mock'
|
|
3984
|
+
|
|
3985
|
+
// ============================================================================
|
|
3986
|
+
// Model Configuration Schemas (Schema-First - Single Source of Truth)
|
|
3987
|
+
// ============================================================================
|
|
3988
|
+
|
|
3989
|
+
/**
|
|
3990
|
+
* GPT-5 model options schema
|
|
3991
|
+
*/
|
|
3992
|
+
declare const GPT5OptionsSchema = z.object({
|
|
3993
|
+
reasoning_effort: z.enum(['minimal', 'low', 'medium', 'high']).optional(),
|
|
3994
|
+
verbosity: z.enum(['low', 'medium', 'high']).optional()
|
|
3995
|
+
})
|
|
3996
|
+
|
|
3997
|
+
/**
|
|
3998
|
+
* OpenRouter model options schema
|
|
3999
|
+
* OpenRouter-specific options for routing and transforms
|
|
4000
|
+
*/
|
|
4001
|
+
declare const OpenRouterOptionsSchema = z.object({
|
|
4002
|
+
/** Optional transforms to apply (e.g., 'middle-out' for long context) */
|
|
4003
|
+
transforms: z.array(z.string()).optional(),
|
|
4004
|
+
/** Routing strategy (e.g., 'fallback' for automatic provider failover) */
|
|
4005
|
+
route: z.enum(['fallback']).optional()
|
|
4006
|
+
})
|
|
4007
|
+
|
|
4008
|
+
/**
|
|
4009
|
+
* Google model options schema
|
|
4010
|
+
* Gemini 3 specific options for thinking depth control
|
|
4011
|
+
*/
|
|
4012
|
+
declare const GoogleOptionsSchema = z.object({
|
|
4013
|
+
/** Thinking level for Gemini 3 models (controls reasoning depth) */
|
|
4014
|
+
thinkingLevel: z.enum(['minimal', 'low', 'medium', 'high']).optional()
|
|
4015
|
+
})
|
|
4016
|
+
|
|
4017
|
+
/**
|
|
4018
|
+
* Anthropic model options schema
|
|
4019
|
+
* Currently empty - future options: budget_tokens for extended thinking
|
|
4020
|
+
*/
|
|
4021
|
+
declare const AnthropicOptionsSchema = z.object({})
|
|
4022
|
+
|
|
4023
|
+
/**
|
|
4024
|
+
* Infer TypeScript types from schemas
|
|
4025
|
+
*/
|
|
4026
|
+
type GPT5Options = z.infer<typeof GPT5OptionsSchema>
|
|
4027
|
+
type MockOptions = Record<string, never>
|
|
4028
|
+
type OpenRouterOptions = z.infer<typeof OpenRouterOptionsSchema>
|
|
4029
|
+
type GoogleOptions = z.infer<typeof GoogleOptionsSchema>
|
|
4030
|
+
type AnthropicOptions = z.infer<typeof AnthropicOptionsSchema>
|
|
4031
|
+
type ModelSpecificOptions = GPT5Options | MockOptions | OpenRouterOptions | GoogleOptions | AnthropicOptions
|
|
4032
|
+
|
|
4033
|
+
// ============================================================================
|
|
4034
|
+
// Model Configuration
|
|
4035
|
+
// ============================================================================
|
|
4036
|
+
|
|
4037
|
+
/**
|
|
4038
|
+
* Model configuration for LLM execution
|
|
4039
|
+
* Belongs in resource definition (AgentDefinition, WorkflowDefinition, etc.)
|
|
4040
|
+
*/
|
|
4041
|
+
interface ModelConfig {
|
|
4042
|
+
model: LLMModel
|
|
4043
|
+
provider: 'openai' | 'anthropic' | 'openrouter' | 'google' | 'mock'
|
|
4044
|
+
apiKey: string
|
|
4045
|
+
temperature?: number
|
|
4046
|
+
/** Maximum output tokens per LLM call. NOT the model's context window — see ModelInfo.maxTokens for that. */
|
|
4047
|
+
maxOutputTokens?: number
|
|
4048
|
+
topP?: number
|
|
4049
|
+
|
|
4050
|
+
/**
|
|
4051
|
+
* Model-specific options (flat structure)
|
|
4052
|
+
* Options are model-specific, not vendor-specific
|
|
4053
|
+
* Available options defined in MODEL_INFO per model
|
|
4054
|
+
* Validated at build time via validateModelOptions()
|
|
4055
|
+
*/
|
|
4056
|
+
modelOptions?: ModelSpecificOptions
|
|
4057
|
+
}
|
|
4058
|
+
|
|
4059
|
+
// ============================================================================
|
|
4060
|
+
// AI Call Tracking Types (SSOT)
|
|
4061
|
+
// ============================================================================
|
|
4062
|
+
|
|
4063
|
+
interface BaseAICall {
|
|
4064
|
+
callSequence: number // 1, 2, 3... (execution-wide universal counter)
|
|
4065
|
+
callType: 'agent-reasoning' | 'agent-completion' | 'workflow-step' | 'tool' | 'other'
|
|
4066
|
+
model: LLMModel
|
|
4067
|
+
inputTokens: number
|
|
4068
|
+
outputTokens: number
|
|
4069
|
+
costUsd: number // Cost in USD with full decimal precision
|
|
4070
|
+
latencyMs: number
|
|
4071
|
+
context?: AICallContext
|
|
4072
|
+
}
|
|
4073
|
+
|
|
4074
|
+
type AICallContext =
|
|
4075
|
+
| AgentReasoningContext
|
|
4076
|
+
| AgentCompletionContext
|
|
4077
|
+
| WorkflowStepContext
|
|
4078
|
+
| ToolCallContext
|
|
4079
|
+
| OtherCallContext
|
|
4080
|
+
|
|
4081
|
+
interface AgentReasoningContext {
|
|
4082
|
+
type: 'agent-reasoning'
|
|
4083
|
+
iteration: number
|
|
4084
|
+
actionsPlanned?: string[]
|
|
4085
|
+
sessionId?: string
|
|
4086
|
+
turnNumber?: number
|
|
4087
|
+
}
|
|
4088
|
+
|
|
4089
|
+
interface AgentCompletionContext {
|
|
4090
|
+
type: 'agent-completion'
|
|
4091
|
+
attempt: 1 | 2
|
|
4092
|
+
validationFailed?: boolean
|
|
4093
|
+
sessionId?: string
|
|
4094
|
+
turnNumber?: number
|
|
4095
|
+
}
|
|
4096
|
+
|
|
4097
|
+
interface WorkflowStepContext {
|
|
4098
|
+
type: 'workflow-step'
|
|
4099
|
+
stepId: string
|
|
4100
|
+
stepName?: string
|
|
4101
|
+
stepSequence?: number
|
|
4102
|
+
}
|
|
4103
|
+
|
|
4104
|
+
interface ToolCallContext {
|
|
4105
|
+
type: 'tool'
|
|
4106
|
+
toolName: string
|
|
4107
|
+
parentIteration?: number
|
|
4108
|
+
parentStepId?: string
|
|
4109
|
+
}
|
|
4110
|
+
|
|
4111
|
+
interface OtherCallContext {
|
|
4112
|
+
type: 'other'
|
|
4113
|
+
description?: string
|
|
4114
|
+
metadata?: Record<string, unknown>
|
|
4115
|
+
}
|
|
4116
|
+
|
|
4117
|
+
type AICallRecord = BaseAICall
|
|
4118
|
+
|
|
4119
|
+
// ============================================================================
|
|
4120
|
+
// API Request/Response Types (Dashboard Observability)
|
|
4121
|
+
// ============================================================================
|
|
4122
|
+
|
|
4123
|
+
/**
|
|
4124
|
+
* Time range selector for dashboard metrics
|
|
4125
|
+
*/
|
|
4126
|
+
type TimeRange = '1h' | '24h' | '7d' | '30d'
|
|
4127
|
+
|
|
4128
|
+
/**
|
|
4129
|
+
* Execution health metrics response
|
|
4130
|
+
* Success rate, P95 duration, execution counts, and trend data
|
|
4131
|
+
* trendData includes executionCount for throughput visualization (eliminates separate API call)
|
|
4132
|
+
*/
|
|
4133
|
+
interface ExecutionHealthMetrics {
|
|
4134
|
+
successRate: number
|
|
4135
|
+
p95Duration: number
|
|
4136
|
+
totalExecutions: number
|
|
4137
|
+
trendData: Array<{
|
|
4138
|
+
time: string
|
|
4139
|
+
rate: number
|
|
4140
|
+
successCount: number
|
|
4141
|
+
errorCount: number
|
|
4142
|
+
warningCount: number
|
|
4143
|
+
executionCount: number
|
|
4144
|
+
}>
|
|
4145
|
+
statusCounts: { success: number; failed: number; pending: number; warning: number }
|
|
4146
|
+
peakPeriod: string
|
|
4147
|
+
granularity: 'hour' | 'day'
|
|
4148
|
+
}
|
|
4149
|
+
|
|
4150
|
+
/**
|
|
4151
|
+
* Error analysis metrics response
|
|
4152
|
+
* Error categories and top failing resources
|
|
4153
|
+
*/
|
|
4154
|
+
interface ErrorAnalysisMetrics {
|
|
4155
|
+
totalErrors: number
|
|
4156
|
+
errorsByCategory: Array<{
|
|
4157
|
+
category: string
|
|
4158
|
+
count: number
|
|
4159
|
+
percentage: number
|
|
4160
|
+
}>
|
|
4161
|
+
topFailingResources: Array<{
|
|
4162
|
+
resourceId: string
|
|
4163
|
+
name: string
|
|
4164
|
+
errorCount: number
|
|
4165
|
+
failureRate: number
|
|
4166
|
+
}>
|
|
4167
|
+
}
|
|
4168
|
+
|
|
4169
|
+
/**
|
|
4170
|
+
* Business impact metrics response
|
|
4171
|
+
* ROI, labor savings, and cost analysis
|
|
4172
|
+
*/
|
|
4173
|
+
interface BusinessImpactMetrics {
|
|
4174
|
+
totalSavingsUsd: number
|
|
4175
|
+
totalCostUsd: number
|
|
4176
|
+
netSavingsUsd: number
|
|
4177
|
+
roi: number
|
|
4178
|
+
}
|
|
4179
|
+
|
|
4180
|
+
/**
|
|
4181
|
+
* Cost breakdown metrics response
|
|
4182
|
+
* Per-resource cost analysis
|
|
4183
|
+
*/
|
|
4184
|
+
interface CostBreakdownMetrics {
|
|
4185
|
+
resources: Array<{
|
|
4186
|
+
resourceId: string
|
|
4187
|
+
totalCostUsd: number
|
|
4188
|
+
executionCount: number
|
|
4189
|
+
avgCostUsd: number
|
|
4190
|
+
}>
|
|
4191
|
+
}
|
|
4192
|
+
|
|
4193
|
+
/**
|
|
4194
|
+
* Detailed execution metrics response
|
|
4195
|
+
* Full execution metrics with AI call breakdown
|
|
4196
|
+
*/
|
|
4197
|
+
interface ExecutionMetricsDetail {
|
|
4198
|
+
executionId: string
|
|
4199
|
+
organizationId: string
|
|
4200
|
+
resourceId: string
|
|
4201
|
+
totalInputTokens: number
|
|
4202
|
+
totalOutputTokens: number
|
|
4203
|
+
totalCostUsd: number
|
|
4204
|
+
aiCallCount: number
|
|
4205
|
+
aiCalls: AICallRecord[]
|
|
4206
|
+
durationMs?: number
|
|
4207
|
+
automationSavingsUsd?: number
|
|
4208
|
+
createdAt: string
|
|
4209
|
+
}
|
|
4210
|
+
|
|
4211
|
+
/**
|
|
4212
|
+
* Dashboard metrics response
|
|
4213
|
+
* Aggregates core observability metrics in a single response
|
|
4214
|
+
* Note: Throughput data is now included in executionHealth.trendData.executionCount
|
|
4215
|
+
*/
|
|
4216
|
+
interface DashboardMetrics {
|
|
4217
|
+
executionHealth: ExecutionHealthMetrics
|
|
4218
|
+
costBreakdown: CostBreakdownMetrics
|
|
4219
|
+
businessImpact: BusinessImpactMetrics
|
|
4220
|
+
/** ISO timestamp of the currently active deployment, or null if none */
|
|
4221
|
+
activeDeploymentDate: string | null
|
|
4222
|
+
/** Deployment version of the active deployment, or null if none */
|
|
4223
|
+
activeDeploymentVersion: string | null
|
|
4224
|
+
}
|
|
4225
|
+
|
|
4226
|
+
// ============================================================================
|
|
4227
|
+
// Error Tracking Types
|
|
4228
|
+
// ============================================================================
|
|
4229
|
+
|
|
4230
|
+
/**
|
|
4231
|
+
* Error record for list view (ErrorBreakdownTable)
|
|
4232
|
+
*/
|
|
4233
|
+
interface ErrorRecord {
|
|
4234
|
+
id: string // execution_errors.id
|
|
4235
|
+
timestamp: string // occurred_at
|
|
4236
|
+
errorType: string // error_type
|
|
4237
|
+
message: string // error_message
|
|
4238
|
+
executionId: string // execution_id
|
|
4239
|
+
resourceId: string // execution_logs.resource_id (via JOIN)
|
|
4240
|
+
resourceName: string // execution_logs.resource_id (TODO: resolve via registry)
|
|
4241
|
+
severity: 'critical' | 'warning' | 'info'
|
|
4242
|
+
category: ExecutionErrorCategory // error_category (moved from metadata to dedicated column)
|
|
4243
|
+
resolved: boolean // resolved flag (human acknowledgment, does not affect execution status)
|
|
4244
|
+
resolvedAt: string | null // timestamp when resolved
|
|
4245
|
+
resolvedBy: string | null // user ID who resolved
|
|
4246
|
+
}
|
|
4247
|
+
|
|
4248
|
+
/**
|
|
4249
|
+
* Full error detail for modal view (ErrorDetailsModal)
|
|
4250
|
+
*/
|
|
4251
|
+
interface ErrorDetailFull extends ErrorRecord {
|
|
4252
|
+
stackTrace?: string // error_stack_trace
|
|
4253
|
+
retryAttempt?: number // metadata.retryAttempt
|
|
4254
|
+
stepName?: string // metadata.stepName
|
|
4255
|
+
stepSequence?: number // metadata.stepSequence
|
|
4256
|
+
errorContext?: Record<string, unknown> // metadata.errorContext
|
|
4257
|
+
executionContext?: Record<string, unknown> // metadata.executionContext
|
|
4258
|
+
}
|
|
4259
|
+
|
|
4260
|
+
/**
|
|
4261
|
+
* Error details API response (paginated)
|
|
4262
|
+
*/
|
|
4263
|
+
interface ErrorDetailResponse {
|
|
4264
|
+
errors: ErrorRecord[]
|
|
4265
|
+
total: number
|
|
4266
|
+
page: number
|
|
4267
|
+
limit: number
|
|
4268
|
+
}
|
|
4269
|
+
|
|
4270
|
+
/**
|
|
4271
|
+
* Error trend data for time-series charts
|
|
4272
|
+
*/
|
|
4273
|
+
interface ErrorTrend {
|
|
4274
|
+
time: string // Time bucket (ISO timestamp)
|
|
4275
|
+
errorCount: number // Total errors in bucket
|
|
4276
|
+
criticalCount: number // Critical errors in bucket
|
|
4277
|
+
warningCount: number // Warning errors in bucket
|
|
4278
|
+
infoCount: number // Info errors in bucket
|
|
4279
|
+
}
|
|
4280
|
+
|
|
4281
|
+
/**
|
|
4282
|
+
* Failing resource data for health monitoring
|
|
4283
|
+
*/
|
|
4284
|
+
interface FailingResource {
|
|
4285
|
+
resourceId: string
|
|
4286
|
+
resourceName: string // TODO: Resolve via registry
|
|
4287
|
+
errorCount: number
|
|
4288
|
+
criticalCount: number
|
|
4289
|
+
warningCount: number
|
|
4290
|
+
mostCommonError: string
|
|
4291
|
+
}
|
|
4292
|
+
|
|
4293
|
+
// ============================================================================
|
|
4294
|
+
// Recent Executions by Resource Types (Dashboard)
|
|
4295
|
+
// ============================================================================
|
|
4296
|
+
|
|
4297
|
+
/**
|
|
4298
|
+
* Summary of executions for a single resource
|
|
4299
|
+
* Used by RecentExecutionsByResource dashboard component
|
|
4300
|
+
*/
|
|
4301
|
+
interface ResourceExecutionSummary {
|
|
4302
|
+
resourceId: string // resource_id from execution_logs
|
|
4303
|
+
resourceType: string // Inferred from resource definitions (resolved by frontend)
|
|
4304
|
+
resourceName: string | null // From resource registry lookup (resolved by frontend)
|
|
4305
|
+
lastExecution: string // ISO timestamp (MAX started_at)
|
|
4306
|
+
totalExecutions: number // COUNT(*)
|
|
4307
|
+
successCount: number // COUNT WHERE status='completed' OR status='warning'
|
|
4308
|
+
failureCount: number // COUNT WHERE status='failed'
|
|
4309
|
+
warningCount: number // COUNT WHERE status='warning' (subset of success)
|
|
4310
|
+
successRate: number // (successCount / totalExecutions) * 100
|
|
4311
|
+
}
|
|
4312
|
+
|
|
4313
|
+
/**
|
|
4314
|
+
* Response from getRecentExecutionsByResource endpoint
|
|
4315
|
+
*/
|
|
4316
|
+
interface RecentExecutionsByResourceResponse {
|
|
4317
|
+
resources: ResourceExecutionSummary[]
|
|
4318
|
+
}
|
|
4319
|
+
|
|
4320
|
+
// ============================================================================
|
|
4321
|
+
// Per-Resource Health Types (Dashboard Recent Activity)
|
|
4322
|
+
// ============================================================================
|
|
4323
|
+
|
|
4324
|
+
/** Resource identifier for health queries */
|
|
4325
|
+
interface ResourceIdentifier {
|
|
4326
|
+
entityType: string // 'workflow' | 'agent'
|
|
4327
|
+
entityId: string // Resource ID
|
|
4328
|
+
}
|
|
4329
|
+
|
|
4330
|
+
/** Time-bucketed health data point */
|
|
4331
|
+
interface ResourceHealthDataPoint {
|
|
4332
|
+
time: string // ISO timestamp (bucket start)
|
|
4333
|
+
success: number // Success count in bucket (completed + warning)
|
|
4334
|
+
failure: number // Failure count in bucket
|
|
4335
|
+
warning: number // Warning count in bucket (subset of success)
|
|
4336
|
+
rate: number // Success rate (0-100)
|
|
4337
|
+
}
|
|
4338
|
+
|
|
4339
|
+
/** Health data for a single resource */
|
|
4340
|
+
interface ResourceHealth {
|
|
4341
|
+
entityType: string
|
|
4342
|
+
entityId: string
|
|
4343
|
+
entityName: string | null
|
|
4344
|
+
trendData: ResourceHealthDataPoint[]
|
|
4345
|
+
summary: {
|
|
4346
|
+
total: number
|
|
4347
|
+
successRate: number
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
|
|
4351
|
+
/** Batch response with all requested resources */
|
|
4352
|
+
interface ResourcesHealthResponse {
|
|
4353
|
+
resources: ResourceHealth[]
|
|
4354
|
+
}
|
|
4355
|
+
|
|
4356
|
+
// ============================================================================
|
|
4357
|
+
// Cost Analytics Types (Time-Series)
|
|
4358
|
+
// ============================================================================
|
|
4359
|
+
|
|
4360
|
+
/**
|
|
4361
|
+
* Cost trend data point for time-series charts
|
|
4362
|
+
* Represents a single time bucket (hour or day)
|
|
4363
|
+
*/
|
|
4364
|
+
interface CostTrendDataPoint {
|
|
4365
|
+
time: string // ISO timestamp (bucket start)
|
|
4366
|
+
totalCostUsd: number
|
|
4367
|
+
executionCount: number
|
|
4368
|
+
avgCostPerExecution: number
|
|
4369
|
+
}
|
|
4370
|
+
|
|
4371
|
+
/**
|
|
4372
|
+
* Cost trends response (time-series data)
|
|
4373
|
+
*/
|
|
4374
|
+
interface CostTrendsResponse {
|
|
4375
|
+
trendData: CostTrendDataPoint[]
|
|
4376
|
+
granularity: 'hour' | 'day'
|
|
4377
|
+
totalCostUsd: number
|
|
4378
|
+
totalExecutions: number
|
|
4379
|
+
}
|
|
4380
|
+
|
|
4381
|
+
/**
|
|
4382
|
+
* Cost summary response with MTD and projections
|
|
4383
|
+
*/
|
|
4384
|
+
interface CostSummaryResponse {
|
|
4385
|
+
current: {
|
|
4386
|
+
totalCostUsd: number
|
|
4387
|
+
executionCount: number
|
|
4388
|
+
}
|
|
4389
|
+
previous: {
|
|
4390
|
+
totalCostUsd: number
|
|
4391
|
+
executionCount: number
|
|
4392
|
+
}
|
|
4393
|
+
mtd: {
|
|
4394
|
+
totalCostUsd: number
|
|
4395
|
+
daysElapsed: number
|
|
4396
|
+
}
|
|
4397
|
+
projection: {
|
|
4398
|
+
monthlyCostUsd: number
|
|
4399
|
+
confidence: 'low' | 'medium' | 'high'
|
|
4400
|
+
}
|
|
4401
|
+
trend: {
|
|
4402
|
+
changePercent: number
|
|
4403
|
+
direction: 'up' | 'down' | 'flat'
|
|
4404
|
+
}
|
|
4405
|
+
}
|
|
4406
|
+
|
|
4407
|
+
/**
|
|
4408
|
+
* Cost by model data for model-level breakdown
|
|
4409
|
+
*/
|
|
4410
|
+
interface CostByModelData {
|
|
4411
|
+
model: string
|
|
4412
|
+
totalCostUsd: number
|
|
4413
|
+
callCount: number
|
|
4414
|
+
totalInputTokens: number
|
|
4415
|
+
totalOutputTokens: number
|
|
4416
|
+
avgCostPerCall: number
|
|
4417
|
+
}
|
|
4418
|
+
|
|
4419
|
+
/**
|
|
4420
|
+
* Cost by model response
|
|
4421
|
+
*/
|
|
4422
|
+
interface CostByModelResponse {
|
|
4423
|
+
models: CostByModelData[]
|
|
4424
|
+
totalCostUsd: number
|
|
4425
|
+
totalCallCount: number
|
|
4426
|
+
}
|
|
4427
|
+
|
|
4428
|
+
/**
|
|
4429
|
+
* Action configuration for HITL tasks
|
|
4430
|
+
* Defines available user actions and their behavior
|
|
4431
|
+
*/
|
|
4432
|
+
interface ActionConfig {
|
|
4433
|
+
/** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
|
|
4434
|
+
id: string
|
|
4435
|
+
|
|
4436
|
+
/** Display label for UI button */
|
|
4437
|
+
label: string
|
|
4438
|
+
|
|
4439
|
+
/** Button variant/style */
|
|
4440
|
+
type: 'primary' | 'secondary' | 'danger' | 'outline'
|
|
4441
|
+
|
|
4442
|
+
/** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
|
|
4443
|
+
icon?: string
|
|
4444
|
+
|
|
4445
|
+
/** Button color (Mantine theme colors) */
|
|
4446
|
+
color?: string
|
|
4447
|
+
|
|
4448
|
+
/** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
|
|
4449
|
+
variant?: string
|
|
4450
|
+
|
|
4451
|
+
/** Execution target (agent/workflow to invoke) */
|
|
4452
|
+
target?: {
|
|
4453
|
+
resourceType: 'agent' | 'workflow'
|
|
4454
|
+
resourceId: string
|
|
4455
|
+
/**
|
|
4456
|
+
* Optional session ID for agent continuation.
|
|
4457
|
+
* If provided, invokes a new turn on the existing session instead of standalone execution.
|
|
4458
|
+
* Only valid when resourceType is 'agent'.
|
|
4459
|
+
*/
|
|
4460
|
+
sessionId?: string
|
|
4461
|
+
}
|
|
4462
|
+
|
|
4463
|
+
/** Form schema for collecting action-specific data */
|
|
4464
|
+
form?: FormSchema
|
|
4465
|
+
|
|
4466
|
+
/** Payload template for pre-filling forms */
|
|
4467
|
+
payloadTemplate?: unknown
|
|
4468
|
+
|
|
4469
|
+
/** Requires confirmation dialog */
|
|
4470
|
+
requiresConfirmation?: boolean
|
|
4471
|
+
|
|
4472
|
+
/** Confirmation message */
|
|
4473
|
+
confirmationMessage?: string
|
|
4474
|
+
|
|
4475
|
+
/** Help text / tooltip */
|
|
4476
|
+
description?: string
|
|
4477
|
+
}
|
|
4478
|
+
|
|
4479
|
+
/**
|
|
4480
|
+
* Origin resource type - where an execution/task originated from.
|
|
4481
|
+
* Used for audit trails and tracking execution lineage.
|
|
4482
|
+
*/
|
|
4483
|
+
type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api'
|
|
4484
|
+
|
|
4485
|
+
/**
|
|
4486
|
+
* Origin tracking metadata - who/what created this execution/task.
|
|
4487
|
+
* Used by both TaskScheduler and CommandQueue for complete audit trails.
|
|
4488
|
+
*/
|
|
4489
|
+
interface OriginTracking {
|
|
4490
|
+
originExecutionId: string
|
|
4491
|
+
originResourceType: OriginResourceType
|
|
4492
|
+
originResourceId: string
|
|
4493
|
+
}
|
|
4494
|
+
|
|
4495
|
+
/**
|
|
4496
|
+
* Command queue task with flexible action system
|
|
4497
|
+
*/
|
|
4498
|
+
interface Task extends OriginTracking {
|
|
4499
|
+
id: string
|
|
4500
|
+
organizationId: string
|
|
4501
|
+
|
|
4502
|
+
// NEW: Flexible action system
|
|
4503
|
+
actions: ActionConfig[]
|
|
4504
|
+
context: unknown
|
|
4505
|
+
selectedAction?: string
|
|
4506
|
+
actionPayload?: unknown
|
|
4507
|
+
|
|
4508
|
+
// Task metadata
|
|
4509
|
+
description?: string
|
|
4510
|
+
priority: number
|
|
4511
|
+
|
|
4512
|
+
/** Optional checkpoint identifier for grouping related human approval tasks */
|
|
4513
|
+
humanCheckpoint?: string
|
|
4514
|
+
|
|
4515
|
+
// Status (updated to include 'completed')
|
|
4516
|
+
status: QueueTaskStatus
|
|
4517
|
+
|
|
4518
|
+
/**
|
|
4519
|
+
* Target resource tracking — mirrors origin columns.
|
|
4520
|
+
* Set when task is created; patchable to redirect execution to a different resource.
|
|
4521
|
+
*/
|
|
4522
|
+
targetResourceId?: string
|
|
4523
|
+
targetResourceType?: 'agent' | 'workflow'
|
|
4524
|
+
|
|
4525
|
+
/**
|
|
4526
|
+
* Execution ID for the action that runs AFTER user approval.
|
|
4527
|
+
* NULL until execution starts.
|
|
4528
|
+
*
|
|
4529
|
+
* Naming distinction:
|
|
4530
|
+
* - originExecutionId = Parent execution that CREATED the HITL task
|
|
4531
|
+
* - targetExecutionId = Child execution that RUNS AFTER user approval
|
|
4532
|
+
*/
|
|
4533
|
+
targetExecutionId?: string
|
|
4534
|
+
|
|
4535
|
+
createdAt: Date
|
|
4536
|
+
completedAt?: Date
|
|
4537
|
+
completedBy?: string
|
|
4538
|
+
expiresAt?: Date
|
|
4539
|
+
idempotencyKey?: string | null
|
|
4540
|
+
}
|
|
4541
|
+
|
|
4542
|
+
/**
|
|
4543
|
+
* Task status values
|
|
4544
|
+
* - pending: awaiting action
|
|
4545
|
+
* - processing: execution in progress after user approval
|
|
4546
|
+
* - completed: action was taken and execution succeeded
|
|
4547
|
+
* - failed: execution failed, task can be retried
|
|
4548
|
+
* - expired: timed out before action
|
|
4549
|
+
*/
|
|
4550
|
+
type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired'
|
|
4551
|
+
|
|
4552
|
+
/**
|
|
4553
|
+
* Parameters for patching mutable metadata on a task
|
|
4554
|
+
*/
|
|
4555
|
+
interface PatchTaskParams {
|
|
4556
|
+
humanCheckpoint?: string | null
|
|
4557
|
+
description?: string
|
|
4558
|
+
priority?: number
|
|
4559
|
+
context?: Record<string, unknown>
|
|
4560
|
+
actions?: unknown[]
|
|
4561
|
+
targetResourceId?: string | null
|
|
4562
|
+
targetResourceType?: 'agent' | 'workflow' | null
|
|
4563
|
+
targetExecutionId?: string
|
|
4564
|
+
status?: 'pending' | 'failed' | 'completed'
|
|
4565
|
+
}
|
|
4566
|
+
|
|
4567
|
+
/**
|
|
4568
|
+
* Checkpoint list item for sidebar grouping
|
|
4569
|
+
* The id field contains the resourceId of the human checkpoint
|
|
4570
|
+
*/
|
|
4571
|
+
interface CheckpointListItem {
|
|
4572
|
+
/** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
|
|
4573
|
+
id: string
|
|
4574
|
+
/** Display name (same as id, or "Ungrouped" for null) */
|
|
4575
|
+
name: string
|
|
4576
|
+
/** Task count for this checkpoint */
|
|
4577
|
+
count: number
|
|
4578
|
+
}
|
|
4579
|
+
|
|
4580
|
+
/**
|
|
4581
|
+
* Status counts for pie chart display
|
|
4582
|
+
*/
|
|
4583
|
+
interface StatusCounts {
|
|
4584
|
+
pending: number
|
|
4585
|
+
completed: number
|
|
4586
|
+
expired: number
|
|
4587
|
+
}
|
|
4588
|
+
|
|
4589
|
+
/**
|
|
4590
|
+
* Priority counts for donut chart display
|
|
4591
|
+
*/
|
|
4592
|
+
interface PriorityCounts {
|
|
4593
|
+
critical: number
|
|
4594
|
+
high: number
|
|
4595
|
+
medium: number
|
|
4596
|
+
low: number
|
|
4597
|
+
}
|
|
4598
|
+
|
|
4599
|
+
/**
|
|
4600
|
+
* Response from GET /command-queue/checkpoints endpoint
|
|
4601
|
+
*/
|
|
4602
|
+
interface CheckpointListResponse {
|
|
4603
|
+
checkpoints: CheckpointListItem[]
|
|
4604
|
+
/** Total tasks across all checkpoints */
|
|
4605
|
+
total: number
|
|
4606
|
+
/** Breakdown by status for donut chart */
|
|
4607
|
+
statusCounts: StatusCounts
|
|
4608
|
+
/** Breakdown by priority for donut chart */
|
|
4609
|
+
priorityCounts: PriorityCounts
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4612
|
+
interface RecurringScheduleConfig {
|
|
4613
|
+
type: 'recurring'
|
|
4614
|
+
cron?: string
|
|
4615
|
+
interval?: 'daily' | 'weekly' | 'monthly'
|
|
4616
|
+
time?: string
|
|
4617
|
+
timezone: string
|
|
4618
|
+
payload: Record<string, unknown>
|
|
4619
|
+
endAt?: string | null
|
|
4620
|
+
overduePolicy?: 'skip' | 'execute' // Default: 'skip'
|
|
4621
|
+
}
|
|
4622
|
+
|
|
4623
|
+
interface RelativeScheduleConfig {
|
|
4624
|
+
type: 'relative'
|
|
4625
|
+
anchorAt: string
|
|
4626
|
+
anchorLabel?: string
|
|
4627
|
+
items: RelativeScheduleItem[]
|
|
4628
|
+
overduePolicy?: 'skip' | 'execute' // Default: 'skip'
|
|
4629
|
+
}
|
|
4630
|
+
|
|
4631
|
+
interface RelativeScheduleItem {
|
|
4632
|
+
offset: string // '-7d', '+3d', '-2h', '+1h'
|
|
4633
|
+
payload: Record<string, unknown>
|
|
4634
|
+
label?: string
|
|
4635
|
+
}
|
|
4636
|
+
|
|
4637
|
+
interface AbsoluteScheduleConfig {
|
|
4638
|
+
type: 'absolute'
|
|
4639
|
+
items: AbsoluteScheduleItem[]
|
|
4640
|
+
overduePolicy?: 'skip' | 'execute' // Default: 'skip'
|
|
4641
|
+
}
|
|
4642
|
+
|
|
4643
|
+
interface AbsoluteScheduleItem {
|
|
4644
|
+
runAt: string
|
|
4645
|
+
payload: Record<string, unknown>
|
|
4646
|
+
label?: string
|
|
4647
|
+
}
|
|
4648
|
+
|
|
4649
|
+
/**
|
|
4650
|
+
* Wire-format DTO for notification API responses.
|
|
4651
|
+
* Dates are ISO 8601 strings (not Date objects like the domain Notification type).
|
|
4652
|
+
* Used by frontend hooks that consume /api/notifications.
|
|
4653
|
+
*/
|
|
4654
|
+
interface NotificationDTO {
|
|
4655
|
+
id: string
|
|
4656
|
+
userId: string
|
|
4657
|
+
organizationId: string
|
|
4658
|
+
category: string
|
|
4659
|
+
title: string
|
|
4660
|
+
message: string
|
|
4661
|
+
actionUrl: string | null
|
|
4662
|
+
read: boolean
|
|
4663
|
+
readAt: string | null
|
|
4664
|
+
createdAt: string
|
|
4665
|
+
}
|
|
4666
|
+
|
|
4667
|
+
/**
|
|
4668
|
+
* Supported integration types
|
|
4669
|
+
*
|
|
4670
|
+
* These represent the available integration adapters that can be used with tools.
|
|
4671
|
+
* Each integration type corresponds to an adapter implementation.
|
|
4672
|
+
*
|
|
4673
|
+
* Note: Concrete adapter implementations are deferred until needed.
|
|
4674
|
+
* This type provides compile-time safety and auto-completion for tool definitions.
|
|
4675
|
+
*/
|
|
4676
|
+
type IntegrationType =
|
|
4677
|
+
| 'gmail' // Google Gmail API
|
|
4678
|
+
| 'google-sheets' // Google Sheets API
|
|
4679
|
+
| 'slack' // Slack API
|
|
4680
|
+
| 'github' // GitHub API
|
|
4681
|
+
| 'linear' // Linear API
|
|
4682
|
+
| 'attio' // Attio CRM API
|
|
4683
|
+
| 'airtable' // Airtable API
|
|
4684
|
+
| 'salesforce' // Salesforce API
|
|
4685
|
+
| 'hubspot' // HubSpot API
|
|
4686
|
+
| 'stripe' // Stripe API
|
|
4687
|
+
| 'twilio' // Twilio API
|
|
4688
|
+
| 'sendgrid' // SendGrid API
|
|
4689
|
+
| 'mailgun' // Mailgun API
|
|
4690
|
+
| 'zapier' // Zapier Webhooks
|
|
4691
|
+
| 'webhook' // Generic webhook
|
|
4692
|
+
| 'apify' // Apify actor automation
|
|
4693
|
+
| 'instantly' // Instantly.ai email automation
|
|
4694
|
+
| 'resend' // Resend transactional email API
|
|
4695
|
+
| 'signature-api' // SignatureAPI eSignature service
|
|
4696
|
+
| 'dropbox' // Dropbox file storage API
|
|
4697
|
+
| 'anymailfinder' // Anymailfinder email finder API
|
|
4698
|
+
| 'tomba' // Tomba email discovery API
|
|
4699
|
+
| 'millionverifier'
|
|
4105
4700
|
|
|
4106
|
-
/**
|
|
4107
|
-
*
|
|
4108
|
-
|
|
4109
|
-
|
|
4701
|
+
/**
|
|
4702
|
+
* Standard Domain Definitions
|
|
4703
|
+
* Centralized domain constants and definitions for all organization resources.
|
|
4704
|
+
*/
|
|
4705
|
+
|
|
4706
|
+
|
|
4707
|
+
|
|
4708
|
+
// ============================================================================
|
|
4709
|
+
// Standard Domain IDs
|
|
4710
|
+
// ============================================================================
|
|
4711
|
+
|
|
4712
|
+
declare const DOMAINS = {
|
|
4713
|
+
// Business domains
|
|
4714
|
+
INBOUND_PIPELINE: 'inbound-pipeline',
|
|
4715
|
+
LEAD_GEN_PIPELINE: 'lead-gen-pipeline',
|
|
4716
|
+
SUPPORT: 'support',
|
|
4717
|
+
CLIENT_SUPPORT: 'client-support',
|
|
4718
|
+
DELIVERY: 'delivery',
|
|
4719
|
+
OPERATIONS: 'operations',
|
|
4720
|
+
FINANCE: 'finance',
|
|
4721
|
+
EXECUTIVE: 'executive',
|
|
4722
|
+
INSTANTLY: 'instantly',
|
|
4723
|
+
|
|
4724
|
+
// Technical domains
|
|
4725
|
+
TESTING: 'testing',
|
|
4726
|
+
INTERNAL: 'internal',
|
|
4727
|
+
INTEGRATION: 'integration',
|
|
4728
|
+
UTILITY: 'utility',
|
|
4729
|
+
DIAGNOSTIC: 'diagnostic'
|
|
4730
|
+
} as const
|
|
4731
|
+
|
|
4732
|
+
/**
|
|
4733
|
+
* ResourceDomain - Strongly typed domain identifier
|
|
4734
|
+
* Use this type for all domain references to ensure compile-time validation.
|
|
4735
|
+
*/
|
|
4736
|
+
type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS]
|
|
4110
4737
|
|
|
4111
|
-
/**
|
|
4112
|
-
*
|
|
4113
|
-
|
|
4114
|
-
|
|
4115
|
-
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4119
|
-
|
|
4120
|
-
|
|
4121
|
-
|
|
4122
|
-
|
|
4123
|
-
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4738
|
+
/**
|
|
4739
|
+
* Resource Registry type definitions
|
|
4740
|
+
*/
|
|
4741
|
+
|
|
4742
|
+
|
|
4743
|
+
|
|
4744
|
+
// ============================================================================
|
|
4745
|
+
// Core Resource Type Definitions
|
|
4746
|
+
// ============================================================================
|
|
4747
|
+
|
|
4748
|
+
/**
|
|
4749
|
+
* Environment/deployment status for resources
|
|
4750
|
+
*/
|
|
4751
|
+
type ResourceStatus = 'dev' | 'prod'
|
|
4752
|
+
|
|
4753
|
+
/**
|
|
4754
|
+
* All resource types in the platform
|
|
4755
|
+
* Used as the discriminator field in ResourceDefinition
|
|
4756
|
+
*/
|
|
4757
|
+
type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
|
|
4758
|
+
|
|
4759
|
+
// ============================================================================
|
|
4760
|
+
// Base Resource Interface
|
|
4761
|
+
// ============================================================================
|
|
4762
|
+
|
|
4763
|
+
/**
|
|
4764
|
+
* Base interface for ALL platform resources
|
|
4765
|
+
* Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
|
|
4766
|
+
*/
|
|
4767
|
+
interface ResourceDefinition {
|
|
4768
|
+
/** Unique resource identifier */
|
|
4769
|
+
resourceId: string
|
|
4770
|
+
|
|
4771
|
+
/** Display name */
|
|
4772
|
+
name: string
|
|
4773
|
+
|
|
4774
|
+
/** Purpose and functionality description */
|
|
4775
|
+
description: string
|
|
4776
|
+
|
|
4777
|
+
/** Version for change tracking and evolution */
|
|
4778
|
+
version: string
|
|
4779
|
+
|
|
4780
|
+
/** Resource type discriminator */
|
|
4781
|
+
type: ResourceType
|
|
4782
|
+
|
|
4783
|
+
/** Environment/deployment status */
|
|
4784
|
+
status: ResourceStatus
|
|
4785
|
+
|
|
4786
|
+
/** Domain tags for filtering and organization */
|
|
4787
|
+
domains?: ResourceDomain[]
|
|
4788
|
+
|
|
4789
|
+
/** Whether the agent supports multi-turn sessions (agents only) */
|
|
4790
|
+
sessionCapable?: boolean
|
|
4791
|
+
|
|
4792
|
+
/** Whether the resource is local (monorepo) or remote (externally deployed) */
|
|
4793
|
+
origin?: 'local' | 'remote'
|
|
4794
|
+
|
|
4795
|
+
/** Whether this resource is archived and should be excluded from registration and deployment */
|
|
4796
|
+
archived?: boolean
|
|
4797
|
+
}
|
|
4798
|
+
|
|
4799
|
+
// ============================================================================
|
|
4800
|
+
// Domain Definition Types
|
|
4801
|
+
// ============================================================================
|
|
4802
|
+
|
|
4803
|
+
/**
|
|
4804
|
+
* Domain definition for Command View filtering
|
|
4805
|
+
*
|
|
4806
|
+
* Domains are organizational metadata for UI filtering/grouping.
|
|
4807
|
+
* No execution impact - purely for visualization.
|
|
4808
|
+
*
|
|
4809
|
+
* @example
|
|
4810
|
+
* {
|
|
4811
|
+
* id: 'support',
|
|
4812
|
+
* name: 'Customer Support',
|
|
4813
|
+
* description: 'Ticket triage, knowledge base, escalations',
|
|
4814
|
+
* color: 'green',
|
|
4815
|
+
* icon: 'IconHeadset'
|
|
4816
|
+
* }
|
|
4817
|
+
*/
|
|
4818
|
+
interface DomainDefinition {
|
|
4819
|
+
/** Unique identifier (e.g., 'support') */
|
|
4820
|
+
id: string
|
|
4821
|
+
/** Display name (e.g., 'Customer Support') */
|
|
4822
|
+
name: string
|
|
4823
|
+
/** Purpose description */
|
|
4824
|
+
description: string
|
|
4825
|
+
/** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
|
|
4826
|
+
color?: string
|
|
4827
|
+
/** Optional Tabler icon name (e.g., 'IconHeadset') */
|
|
4828
|
+
icon?: string
|
|
4829
|
+
}
|
|
4830
|
+
|
|
4831
|
+
// ============================================================================
|
|
4832
|
+
// Resource Manifest Types
|
|
4833
|
+
// ============================================================================
|
|
4834
|
+
|
|
4835
|
+
// ============================================================================
|
|
4836
|
+
// Trigger Configuration Types
|
|
4837
|
+
// ============================================================================
|
|
4838
|
+
|
|
4839
|
+
/** Webhook provider identifiers */
|
|
4840
|
+
type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
|
|
4841
|
+
|
|
4842
|
+
/** Webhook trigger configuration */
|
|
4843
|
+
interface WebhookTriggerConfig {
|
|
4844
|
+
/** Provider identifier */
|
|
4845
|
+
provider: WebhookProviderType
|
|
4846
|
+
/** Event type for documentation (not used for matching - workflow handles routing) */
|
|
4847
|
+
event?: string
|
|
4848
|
+
/** Optional filtering (e.g., specific form ID for Fillout) */
|
|
4849
|
+
filter?: Record<string, string>
|
|
4850
|
+
/** References credential in credentials table for per-org webhook secrets */
|
|
4851
|
+
credentialName?: string
|
|
4852
|
+
}
|
|
4853
|
+
|
|
4854
|
+
/** Schedule trigger configuration */
|
|
4855
|
+
interface ScheduleTriggerConfig {
|
|
4856
|
+
/** Cron expression (e.g., '0 6 * * *') */
|
|
4857
|
+
cron: string
|
|
4858
|
+
/** Optional timezone (default: UTC) */
|
|
4859
|
+
timezone?: string
|
|
4860
|
+
}
|
|
4861
|
+
|
|
4862
|
+
/** Event trigger configuration */
|
|
4863
|
+
interface EventTriggerConfig {
|
|
4864
|
+
/** Internal event type */
|
|
4865
|
+
eventType: string
|
|
4866
|
+
/** Event source */
|
|
4867
|
+
source?: string
|
|
4868
|
+
}
|
|
4869
|
+
|
|
4870
|
+
/** Union of all trigger configs */
|
|
4871
|
+
type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig
|
|
4872
|
+
|
|
4873
|
+
// ============================================================================
|
|
4874
|
+
// Trigger Definition
|
|
4875
|
+
// ============================================================================
|
|
4876
|
+
|
|
4877
|
+
/**
|
|
4878
|
+
* Trigger metadata - entry points that initiate resource execution
|
|
4879
|
+
*
|
|
4880
|
+
* Triggers represent how executions start: webhooks from external services,
|
|
4881
|
+
* scheduled cron jobs, platform events, or manual user actions.
|
|
4882
|
+
*
|
|
4883
|
+
* BREAKING CHANGES (2025-11-30):
|
|
4884
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
|
|
4885
|
+
* - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
|
|
4886
|
+
* - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
|
|
4887
|
+
* - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
|
|
4888
|
+
* - triggers object now includes `externalResources` option
|
|
4889
|
+
*
|
|
4890
|
+
* @example
|
|
4891
|
+
* // TriggerDefinition - metadata only
|
|
4892
|
+
* {
|
|
4893
|
+
* resourceId: 'trigger-new-order',
|
|
4894
|
+
* type: 'trigger',
|
|
4895
|
+
* triggerType: 'webhook',
|
|
4896
|
+
* name: 'New Order',
|
|
4897
|
+
* description: 'Webhook from Shopify on new orders',
|
|
4898
|
+
* version: '1.0.0',
|
|
4899
|
+
* status: 'prod',
|
|
4900
|
+
* webhookPath: '/webhooks/shopify/orders'
|
|
4901
|
+
* }
|
|
4902
|
+
*
|
|
4903
|
+
* // Relationships declared in ResourceRelationships (not on TriggerDefinition):
|
|
4904
|
+
* // relationships: {
|
|
4905
|
+
* // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
|
|
4906
|
+
* // }
|
|
4907
|
+
*/
|
|
4908
|
+
interface TriggerDefinition extends ResourceDefinition {
|
|
4909
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
4910
|
+
type: 'trigger'
|
|
4911
|
+
|
|
4912
|
+
/** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
|
|
4913
|
+
triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
|
|
4914
|
+
|
|
4915
|
+
/** Type-specific configuration */
|
|
4916
|
+
config?: TriggerConfig
|
|
4917
|
+
|
|
4918
|
+
// Legacy fields (deprecated, use config instead)
|
|
4919
|
+
/** For webhook triggers: path like '/webhooks/shopify/orders' */
|
|
4920
|
+
webhookPath?: string
|
|
4921
|
+
/** For schedule triggers: cron expression like '0 6 * * *' */
|
|
4922
|
+
schedule?: string
|
|
4923
|
+
/** For event triggers: event type like 'low-stock-alert' */
|
|
4924
|
+
eventType?: string
|
|
4925
|
+
|
|
4926
|
+
// NOTE: What this trigger starts is declared in ResourceRelationships, not here
|
|
4927
|
+
// This prevents duplication - triggers are forward-declared in relationships
|
|
4928
|
+
}
|
|
4929
|
+
|
|
4930
|
+
/**
|
|
4931
|
+
* Integration metadata - external service connections
|
|
4932
|
+
*
|
|
4933
|
+
* References credentials table for actual connection. No connection status
|
|
4934
|
+
* stored here (queried at runtime from credentials table).
|
|
4935
|
+
*
|
|
4936
|
+
* BREAKING CHANGES (2025-11-30):
|
|
4937
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
|
|
4938
|
+
* - Field renames: `id` -> `resourceId` (inherited)
|
|
4939
|
+
* - New required field: `status` (inherited) - organizations must add status to all integrations
|
|
4940
|
+
* - New required field: `version` (inherited) - organizations must add version to all integrations
|
|
4941
|
+
* - New required field: `type: 'integration'` (inherited) - resource type discriminator
|
|
4942
|
+
*
|
|
4943
|
+
* @example
|
|
4944
|
+
* {
|
|
4945
|
+
* resourceId: 'integration-shopify-prod',
|
|
4946
|
+
* type: 'integration',
|
|
4947
|
+
* provider: 'shopify',
|
|
4948
|
+
* credentialName: 'shopify-prod',
|
|
4949
|
+
* name: 'Shopify Production',
|
|
4950
|
+
* description: 'E-commerce platform',
|
|
4951
|
+
* version: '1.0.0',
|
|
4952
|
+
* status: 'prod'
|
|
4953
|
+
* }
|
|
4954
|
+
*/
|
|
4955
|
+
interface IntegrationDefinition extends ResourceDefinition {
|
|
4956
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
4957
|
+
type: 'integration'
|
|
4958
|
+
|
|
4959
|
+
/** Integration provider type */
|
|
4960
|
+
provider: IntegrationType
|
|
4961
|
+
/** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
|
|
4962
|
+
credentialName: string
|
|
4963
|
+
}
|
|
4964
|
+
|
|
4965
|
+
// ============================================================================
|
|
4966
|
+
// External Resource Types
|
|
4967
|
+
// ============================================================================
|
|
4968
|
+
|
|
4969
|
+
/**
|
|
4970
|
+
* External platform type
|
|
4971
|
+
* Supported third-party automation platforms
|
|
4972
|
+
*/
|
|
4973
|
+
type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other'
|
|
4974
|
+
|
|
4975
|
+
/**
|
|
4976
|
+
* External automation resource metadata
|
|
4977
|
+
*
|
|
4978
|
+
* Represents workflows/automations running on third-party platforms
|
|
4979
|
+
* (n8n, Make, Zapier, etc.) for visualization in Command View.
|
|
4980
|
+
*
|
|
4981
|
+
* NOTE: This is metadata ONLY for visualization. No execution logic,
|
|
4982
|
+
* no API integration with external platforms, no status syncing.
|
|
4983
|
+
*
|
|
4984
|
+
* BREAKING CHANGES (2025-11-30):
|
|
4985
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
|
|
4986
|
+
* - Field renames: `id` -> `resourceId` (inherited)
|
|
4987
|
+
* - New required field: `version` (inherited) - organizations must add version to all external resources
|
|
4988
|
+
* - New required field: `type: 'external'` (inherited) - resource type discriminator
|
|
4989
|
+
* - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
|
|
4990
|
+
*
|
|
4991
|
+
* @example
|
|
4992
|
+
* {
|
|
4993
|
+
* resourceId: 'external-n8n-order-sync',
|
|
4994
|
+
* type: 'external',
|
|
4995
|
+
* version: '1.0.0',
|
|
4996
|
+
* platform: 'n8n',
|
|
4997
|
+
* name: 'Shopify Order Sync',
|
|
4998
|
+
* description: 'Legacy n8n workflow for syncing Shopify orders',
|
|
4999
|
+
* status: 'prod',
|
|
5000
|
+
* platformUrl: 'https://n8n.client.com/workflow/123',
|
|
5001
|
+
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
5002
|
+
* uses: { integrations: ['integration-shopify-prod'] }
|
|
5003
|
+
* }
|
|
5004
|
+
*/
|
|
5005
|
+
interface ExternalResourceDefinition extends ResourceDefinition {
|
|
5006
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
5007
|
+
type: 'external'
|
|
5008
|
+
|
|
5009
|
+
/** Platform type */
|
|
5010
|
+
platform: ExternalPlatform
|
|
5011
|
+
|
|
5012
|
+
// Optional platform-specific metadata
|
|
5013
|
+
/** Link to external platform (e.g., n8n workflow editor URL) */
|
|
5014
|
+
platformUrl?: string
|
|
5015
|
+
/** Platform's internal ID/reference */
|
|
5016
|
+
externalId?: string
|
|
5017
|
+
|
|
5018
|
+
/** What this external resource triggers (external -> internal) */
|
|
5019
|
+
triggers?: {
|
|
5020
|
+
/** Elevasis workflow resourceIds this external automation triggers */
|
|
5021
|
+
workflows?: string[]
|
|
5022
|
+
/** Elevasis agent resourceIds this external automation triggers */
|
|
5023
|
+
agents?: string[]
|
|
5024
|
+
}
|
|
5025
|
+
|
|
5026
|
+
/** Integrations this external resource uses (shared credentials) */
|
|
5027
|
+
uses?: {
|
|
5028
|
+
/** Integration IDs this external automation uses */
|
|
5029
|
+
integrations?: string[]
|
|
5030
|
+
}
|
|
5031
|
+
|
|
5032
|
+
// NOTE: triggeredBy field removed - per relationship-consolidation design,
|
|
5033
|
+
// all relationships are forward-only declarations. Graph edges are built
|
|
5034
|
+
// from forward declarations only.
|
|
5035
|
+
}
|
|
5036
|
+
|
|
5037
|
+
/**
|
|
5038
|
+
* Human Checkpoint definition - human decision points in automation
|
|
5039
|
+
*
|
|
5040
|
+
* Represents where human judgment is deployed in the automation landscape.
|
|
5041
|
+
* Tasks with matching command_queue_group are routed to this checkpoint.
|
|
5042
|
+
*
|
|
5043
|
+
* BREAKING CHANGES (2025-11-30):
|
|
5044
|
+
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
|
|
5045
|
+
* - Field renames: `id` -> `resourceId` (inherited)
|
|
5046
|
+
* - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
|
|
5047
|
+
* - New required field: `version` (inherited) - organizations must add version to all human checkpoints
|
|
5048
|
+
* - New required field: `type: 'human'` (inherited) - resource type discriminator
|
|
5049
|
+
*
|
|
5050
|
+
* @example
|
|
5051
|
+
* {
|
|
5052
|
+
* resourceId: 'sales-approval',
|
|
5053
|
+
* type: 'human',
|
|
5054
|
+
* name: 'Sales Approval Queue',
|
|
5055
|
+
* description: 'High-value order approvals for sales team',
|
|
5056
|
+
* version: '1.0.0',
|
|
5057
|
+
* status: 'prod',
|
|
5058
|
+
* requestedBy: { agents: ['order-processor-agent'] },
|
|
5059
|
+
* routesTo: { agents: ['order-fulfillment-agent'] }
|
|
5060
|
+
* }
|
|
5061
|
+
*/
|
|
5062
|
+
interface HumanCheckpointDefinition extends ResourceDefinition {
|
|
5063
|
+
/** Resource type discriminator (narrowed from base union) */
|
|
5064
|
+
type: 'human'
|
|
5065
|
+
|
|
5066
|
+
/** Resources that create tasks for this checkpoint */
|
|
5067
|
+
requestedBy?: {
|
|
5068
|
+
/** Agent resourceIds that request approval here */
|
|
5069
|
+
agents?: string[]
|
|
5070
|
+
/** Workflow resourceIds that request approval here */
|
|
5071
|
+
workflows?: string[]
|
|
5072
|
+
}
|
|
5073
|
+
|
|
5074
|
+
/** Resources that receive approved decisions */
|
|
5075
|
+
routesTo?: {
|
|
5076
|
+
/** Agent resourceIds that handle approved tasks */
|
|
5077
|
+
agents?: string[]
|
|
5078
|
+
/** Workflow resourceIds that handle approved tasks */
|
|
5079
|
+
workflows?: string[]
|
|
5080
|
+
}
|
|
5081
|
+
}
|
|
5082
|
+
|
|
5083
|
+
/**
|
|
5084
|
+
* Command View Types
|
|
5085
|
+
*
|
|
5086
|
+
* Unified type definitions for the Command View graph visualization.
|
|
5087
|
+
* These types are used by both backend serialization and frontend rendering.
|
|
5088
|
+
*
|
|
5089
|
+
* Command View shows the resource graph: agents, workflows, triggers, integrations,
|
|
5090
|
+
* external resources, and human checkpoints with their relationships.
|
|
5091
|
+
*/
|
|
5092
|
+
|
|
5093
|
+
|
|
5094
|
+
|
|
5095
|
+
// ============================================================================
|
|
5096
|
+
// Node Types - Resources that appear in the graph
|
|
5097
|
+
// ============================================================================
|
|
5098
|
+
|
|
5099
|
+
/**
|
|
5100
|
+
* Extended agent metadata for Command View
|
|
5101
|
+
* Includes model and capability information for graph display
|
|
5102
|
+
*/
|
|
5103
|
+
interface CommandViewAgent extends ResourceDefinition {
|
|
5104
|
+
type: 'agent'
|
|
5105
|
+
modelProvider: string // e.g., 'anthropic', 'openai'
|
|
5106
|
+
modelId: string // e.g., 'claude-sonnet-4-20250514'
|
|
5107
|
+
toolCount: number
|
|
5108
|
+
hasKnowledgeMap: boolean
|
|
5109
|
+
hasMemory: boolean
|
|
5110
|
+
sessionCapable: boolean // Explicit session capability declaration
|
|
5111
|
+
}
|
|
5112
|
+
|
|
5113
|
+
/**
|
|
5114
|
+
* Extended workflow metadata for Command View
|
|
5115
|
+
* Includes step information for graph display
|
|
5116
|
+
*/
|
|
5117
|
+
interface CommandViewWorkflow extends ResourceDefinition {
|
|
5118
|
+
type: 'workflow'
|
|
5119
|
+
stepCount: number
|
|
5120
|
+
entryPoint: string
|
|
5121
|
+
}
|
|
5122
|
+
|
|
5123
|
+
/**
|
|
5124
|
+
* Node type categories for Command View
|
|
5125
|
+
* Simplified categorization for UI rendering and layout
|
|
5126
|
+
*/
|
|
5127
|
+
type CommandViewNodeType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
|
|
5128
|
+
|
|
5129
|
+
/**
|
|
5130
|
+
* Union type for all node types in Command View
|
|
5131
|
+
* Frontend can use this for type-safe node handling
|
|
5132
|
+
*/
|
|
5133
|
+
type CommandViewNode =
|
|
5134
|
+
| CommandViewAgent
|
|
5135
|
+
| CommandViewWorkflow
|
|
5136
|
+
| TriggerDefinition
|
|
5137
|
+
| IntegrationDefinition
|
|
5138
|
+
| ExternalResourceDefinition
|
|
5139
|
+
| HumanCheckpointDefinition
|
|
5140
|
+
|
|
5141
|
+
// ============================================================================
|
|
5142
|
+
// Edge Types - Relationships between resources
|
|
5143
|
+
// ============================================================================
|
|
5144
|
+
|
|
5145
|
+
/**
|
|
5146
|
+
* Relationship types between resources
|
|
5147
|
+
*
|
|
5148
|
+
* - triggers: Resource initiates/starts another resource (orange)
|
|
5149
|
+
* - uses: Resource uses an integration (teal)
|
|
5150
|
+
* - approval: Resource requires human approval (yellow)
|
|
5151
|
+
*/
|
|
5152
|
+
type RelationshipType = 'triggers' | 'uses' | 'approval'
|
|
5153
|
+
|
|
5154
|
+
/**
|
|
5155
|
+
* Command View edge (relationship between resources)
|
|
5156
|
+
*/
|
|
5157
|
+
interface CommandViewEdge {
|
|
5158
|
+
id: string
|
|
5159
|
+
source: string // Source node ID
|
|
5160
|
+
target: string // Target node ID
|
|
5161
|
+
relationship: RelationshipType
|
|
5162
|
+
label?: string // Optional label for the edge
|
|
5163
|
+
}
|
|
5164
|
+
|
|
5165
|
+
// ============================================================================
|
|
5166
|
+
// Graph Data Structure
|
|
5167
|
+
// ============================================================================
|
|
5168
|
+
|
|
5169
|
+
/**
|
|
5170
|
+
* Command View data structure
|
|
5171
|
+
* Complete graph data for visualization
|
|
5172
|
+
*
|
|
5173
|
+
* Backend serializes this once at startup and serves it via /command-view endpoint.
|
|
5174
|
+
* Frontend consumes this directly for graph rendering.
|
|
5175
|
+
*/
|
|
5176
|
+
interface CommandViewData {
|
|
5177
|
+
workflows: CommandViewWorkflow[]
|
|
5178
|
+
agents: CommandViewAgent[]
|
|
5179
|
+
triggers: TriggerDefinition[]
|
|
5180
|
+
integrations: IntegrationDefinition[]
|
|
5181
|
+
externalResources: ExternalResourceDefinition[]
|
|
5182
|
+
humanCheckpoints: HumanCheckpointDefinition[]
|
|
5183
|
+
edges: CommandViewEdge[]
|
|
5184
|
+
domainDefinitions?: DomainDefinition[]
|
|
5185
|
+
}
|
|
5186
|
+
|
|
5187
|
+
/**
|
|
5188
|
+
* Serialized Registry Types
|
|
5189
|
+
*
|
|
5190
|
+
* Pre-computed JSON-safe types for API responses and Command View.
|
|
5191
|
+
* Serialization happens once at API startup, enabling instant response times.
|
|
5192
|
+
*/
|
|
5193
|
+
|
|
5194
|
+
|
|
5195
|
+
|
|
5196
|
+
// ============================================================================
|
|
5197
|
+
// Serialized Interface Types (for Execution Runner UI)
|
|
5198
|
+
// ============================================================================
|
|
5199
|
+
|
|
5200
|
+
/**
|
|
5201
|
+
* Serialized form field for API responses
|
|
5202
|
+
*/
|
|
5203
|
+
interface SerializedFormField {
|
|
5204
|
+
name: string
|
|
5205
|
+
label: string
|
|
5206
|
+
type: FormFieldType
|
|
5207
|
+
defaultValue?: unknown
|
|
5208
|
+
required?: boolean
|
|
5209
|
+
placeholder?: string
|
|
5210
|
+
description?: string
|
|
5211
|
+
options?: Array<{ label: string; value: string | number }>
|
|
5212
|
+
min?: number
|
|
5213
|
+
max?: number
|
|
5214
|
+
}
|
|
5215
|
+
|
|
5216
|
+
/**
|
|
5217
|
+
* Serialized form schema for API responses
|
|
5218
|
+
*/
|
|
5219
|
+
interface SerializedFormSchema {
|
|
5220
|
+
title?: string
|
|
5221
|
+
description?: string
|
|
5222
|
+
fields: SerializedFormField[]
|
|
5223
|
+
layout?: 'vertical' | 'horizontal' | 'grid'
|
|
5224
|
+
}
|
|
5225
|
+
|
|
5226
|
+
/**
|
|
5227
|
+
* Serialized execution form schema for API responses
|
|
5228
|
+
*/
|
|
5229
|
+
interface SerializedExecutionFormSchema extends SerializedFormSchema {
|
|
5230
|
+
fieldMappings?: Record<string, string>
|
|
5231
|
+
submitButton?: {
|
|
5232
|
+
label?: string
|
|
5233
|
+
loadingLabel?: string
|
|
5234
|
+
confirmMessage?: string
|
|
5235
|
+
}
|
|
5236
|
+
}
|
|
5237
|
+
|
|
5238
|
+
/**
|
|
5239
|
+
* Serialized schedule config for API responses
|
|
5240
|
+
*/
|
|
5241
|
+
interface SerializedScheduleConfig {
|
|
5242
|
+
enabled: boolean
|
|
5243
|
+
defaultSchedule?: string
|
|
5244
|
+
allowedPatterns?: string[]
|
|
5245
|
+
}
|
|
5246
|
+
|
|
5247
|
+
/**
|
|
5248
|
+
* Serialized webhook config for API responses
|
|
5249
|
+
*/
|
|
5250
|
+
interface SerializedWebhookConfig {
|
|
5251
|
+
enabled: boolean
|
|
5252
|
+
payloadSchema?: unknown
|
|
5253
|
+
}
|
|
5254
|
+
|
|
5255
|
+
/**
|
|
5256
|
+
* Serialized execution interface for API responses
|
|
5257
|
+
*/
|
|
5258
|
+
interface SerializedExecutionInterface {
|
|
5259
|
+
form: SerializedExecutionFormSchema
|
|
5260
|
+
schedule?: SerializedScheduleConfig
|
|
5261
|
+
webhook?: SerializedWebhookConfig
|
|
5262
|
+
}
|
|
5263
|
+
|
|
5264
|
+
// ============================================================================
|
|
5265
|
+
// Serialized Definition Types
|
|
5266
|
+
// ============================================================================
|
|
5267
|
+
|
|
5268
|
+
/**
|
|
5269
|
+
* Serialized agent definition (JSON-safe)
|
|
5270
|
+
* Result of serializeDefinition(AgentDefinition)
|
|
5271
|
+
*/
|
|
5272
|
+
interface SerializedAgentDefinition {
|
|
5273
|
+
config: {
|
|
5274
|
+
resourceId: string
|
|
5275
|
+
name: string
|
|
5276
|
+
description: string
|
|
5277
|
+
version: string
|
|
5278
|
+
type: 'agent'
|
|
5279
|
+
status: 'dev' | 'prod'
|
|
5280
|
+
/** Whether this resource is archived and should be excluded from registration and deployment */
|
|
5281
|
+
archived?: boolean
|
|
5282
|
+
systemPrompt: string
|
|
5283
|
+
constraints?: {
|
|
5284
|
+
maxIterations?: number
|
|
5285
|
+
timeout?: number
|
|
5286
|
+
maxSessionMemoryKeys?: number
|
|
5287
|
+
maxMemoryTokens?: number
|
|
5288
|
+
}
|
|
5289
|
+
sessionCapable?: boolean
|
|
5290
|
+
memoryPreferences?: string
|
|
5291
|
+
}
|
|
5292
|
+
modelConfig: {
|
|
5293
|
+
provider: string
|
|
5294
|
+
model: string
|
|
5295
|
+
apiKey: string // Redacted: "sk-proj..."
|
|
5296
|
+
temperature: number
|
|
5297
|
+
maxOutputTokens: number
|
|
5298
|
+
topP?: number
|
|
5299
|
+
modelOptions?: Record<string, unknown>
|
|
5300
|
+
}
|
|
5301
|
+
contract: {
|
|
5302
|
+
inputSchema: object // JSON Schema
|
|
5303
|
+
outputSchema?: object // JSON Schema
|
|
5304
|
+
}
|
|
5305
|
+
tools: Array<{
|
|
5306
|
+
name: string
|
|
5307
|
+
description: string
|
|
5308
|
+
inputSchema?: object // JSON Schema
|
|
5309
|
+
outputSchema?: object // JSON Schema
|
|
5310
|
+
}>
|
|
5311
|
+
knowledgeMap?: {
|
|
5312
|
+
nodeCount: number
|
|
5313
|
+
nodes: Array<{
|
|
5314
|
+
id: string
|
|
5315
|
+
description: string
|
|
5316
|
+
loaded: boolean
|
|
5317
|
+
hasPrompt: boolean
|
|
5318
|
+
}>
|
|
5319
|
+
}
|
|
5320
|
+
metricsConfig?: object
|
|
5321
|
+
interface?: SerializedExecutionInterface
|
|
5322
|
+
}
|
|
5323
|
+
|
|
5324
|
+
/**
|
|
5325
|
+
* Serialized workflow definition (JSON-safe)
|
|
5326
|
+
* Result of serializeDefinition(WorkflowDefinition)
|
|
5327
|
+
*/
|
|
5328
|
+
interface SerializedWorkflowDefinition {
|
|
5329
|
+
config: {
|
|
5330
|
+
resourceId: string
|
|
5331
|
+
name: string
|
|
5332
|
+
description: string
|
|
5333
|
+
version: string
|
|
5334
|
+
type: 'workflow'
|
|
5335
|
+
status: 'dev' | 'prod'
|
|
5336
|
+
/** Whether this resource is archived and should be excluded from registration and deployment */
|
|
5337
|
+
archived?: boolean
|
|
5338
|
+
}
|
|
5339
|
+
entryPoint: string
|
|
5340
|
+
steps: Array<{
|
|
5341
|
+
id: string
|
|
5342
|
+
name: string
|
|
5343
|
+
description: string
|
|
5344
|
+
inputSchema?: object // JSON Schema
|
|
5345
|
+
outputSchema?: object // JSON Schema
|
|
5346
|
+
next: {
|
|
5347
|
+
type: 'linear' | 'conditional'
|
|
5348
|
+
target?: string
|
|
5349
|
+
routes?: Array<{ target: string }>
|
|
5350
|
+
default?: string
|
|
5351
|
+
} | null
|
|
5352
|
+
}>
|
|
5353
|
+
contract: {
|
|
5354
|
+
inputSchema: object // JSON Schema
|
|
5355
|
+
outputSchema?: object // JSON Schema
|
|
5356
|
+
}
|
|
5357
|
+
metricsConfig?: object
|
|
5358
|
+
interface?: SerializedExecutionInterface
|
|
5359
|
+
}
|
|
5360
|
+
|
|
5361
|
+
/**
|
|
5362
|
+
* Agent timeline and observability types
|
|
5363
|
+
* Used for UI timeline visualization and backend processing
|
|
5364
|
+
*/
|
|
5365
|
+
|
|
5366
|
+
|
|
5367
|
+
|
|
5368
|
+
/**
|
|
5369
|
+
* Sub-activity within an iteration
|
|
5370
|
+
* Represents reasoning, actions, or tool calls with timing
|
|
5371
|
+
*/
|
|
5372
|
+
interface SubActivity {
|
|
5373
|
+
type: 'reasoning' | 'action' | 'tool-call'
|
|
5374
|
+
startTime: number
|
|
5375
|
+
endTime: number
|
|
5376
|
+
duration: number
|
|
5377
|
+
details: AgentIterationEvent | AgentToolCallEvent
|
|
5378
|
+
}
|
|
5379
|
+
|
|
5380
|
+
/**
|
|
5381
|
+
* Agent iteration state
|
|
5382
|
+
* Aggregates lifecycle events and sub-activities for a single iteration
|
|
5383
|
+
*/
|
|
5384
|
+
interface AgentIteration {
|
|
5385
|
+
iterationNumber: number
|
|
5386
|
+
status: 'running' | 'completed' | 'failed' | 'pending'
|
|
5387
|
+
iterationEvents: AgentIterationEvent[]
|
|
5388
|
+
duration?: number
|
|
5389
|
+
timestamp: number
|
|
5390
|
+
subActivities: SubActivity[]
|
|
5391
|
+
|
|
5392
|
+
// Timeline visualization timing (Phase 2 - optional for backward compatibility)
|
|
5393
|
+
startTime?: number // From lifecycle 'started' event
|
|
5394
|
+
endTime?: number // From lifecycle 'completed'/'failed' event
|
|
5395
|
+
}
|
|
5396
|
+
|
|
5397
|
+
/**
|
|
5398
|
+
* Agent lifecycle node state
|
|
5399
|
+
* Represents initialization or completion phase
|
|
5400
|
+
*/
|
|
5401
|
+
interface AgentLifecycleNode {
|
|
5402
|
+
type: 'initialization' | 'completion'
|
|
5403
|
+
status: 'running' | 'completed' | 'failed' | 'pending'
|
|
5404
|
+
duration?: number
|
|
5405
|
+
timestamp?: number
|
|
5406
|
+
|
|
5407
|
+
// Timeline visualization timing (Phase 2 - optional for backward compatibility)
|
|
5408
|
+
startTime?: number // From lifecycle 'started' event
|
|
5409
|
+
endTime?: number // From lifecycle 'completed'/'failed' event
|
|
5410
|
+
}
|
|
5411
|
+
|
|
5412
|
+
/**
|
|
5413
|
+
* Complete agent execution data for timeline visualization
|
|
5414
|
+
* Parsed from execution logs
|
|
5415
|
+
*/
|
|
5416
|
+
interface AgentIterationData {
|
|
5417
|
+
initialization: AgentLifecycleNode
|
|
5418
|
+
iterations: AgentIteration[]
|
|
5419
|
+
completion: AgentLifecycleNode
|
|
5420
|
+
currentIteration: number | null
|
|
5421
|
+
totalIterations: number
|
|
5422
|
+
totalDuration?: number
|
|
5423
|
+
status: 'running' | 'completed' | 'failed' | 'warning'
|
|
5424
|
+
}
|
|
5425
|
+
|
|
5426
|
+
// Execution status type shared between API and UI
|
|
5427
|
+
type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning'
|
|
5428
|
+
|
|
5429
|
+
/**
|
|
5430
|
+
* Event sent when new execution starts
|
|
5431
|
+
*/
|
|
5432
|
+
interface ExecutionStartedEvent {
|
|
5433
|
+
type: 'new-execution'
|
|
5434
|
+
resourceId: string
|
|
5435
|
+
executionId: string
|
|
5436
|
+
timestamp: number
|
|
5437
|
+
data?: undefined
|
|
5438
|
+
}
|
|
5439
|
+
|
|
5440
|
+
/**
|
|
5441
|
+
* Event sent when execution log message is emitted
|
|
5442
|
+
*/
|
|
5443
|
+
interface ExecutionLogEvent {
|
|
5444
|
+
type: 'log'
|
|
5445
|
+
resourceId: string
|
|
5446
|
+
executionId: string
|
|
5447
|
+
timestamp: number
|
|
5448
|
+
data: {
|
|
5449
|
+
log: ExecutionLogMessage
|
|
5450
|
+
}
|
|
5451
|
+
}
|
|
5452
|
+
|
|
5453
|
+
/**
|
|
5454
|
+
* Event sent when execution completes (success or failure)
|
|
5455
|
+
*/
|
|
5456
|
+
interface ExecutionCompleteEvent {
|
|
5457
|
+
type: 'execution-complete'
|
|
5458
|
+
resourceId: string
|
|
5459
|
+
executionId: string
|
|
5460
|
+
timestamp: number
|
|
5461
|
+
data: {
|
|
5462
|
+
success: boolean
|
|
5463
|
+
status?: ExecutionStatus
|
|
5464
|
+
result?: unknown
|
|
5465
|
+
error?: string
|
|
5466
|
+
}
|
|
5467
|
+
}
|
|
5468
|
+
|
|
5469
|
+
/**
|
|
5470
|
+
* Connection confirmation event
|
|
5471
|
+
*/
|
|
5472
|
+
interface ExecutionConnectedEvent {
|
|
5473
|
+
type: 'connected'
|
|
5474
|
+
resourceId: string
|
|
5475
|
+
executionId?: undefined
|
|
5476
|
+
timestamp: number
|
|
5477
|
+
data?: undefined
|
|
5478
|
+
}
|
|
5479
|
+
|
|
5480
|
+
/**
|
|
5481
|
+
* Union of all execution SSE events
|
|
5482
|
+
*/
|
|
5483
|
+
type ExecutionSSEEvent =
|
|
5484
|
+
| ExecutionStartedEvent
|
|
5485
|
+
| ExecutionLogEvent
|
|
5486
|
+
| ExecutionCompleteEvent
|
|
5487
|
+
| ExecutionConnectedEvent
|
|
5488
|
+
|
|
5489
|
+
// API execution types
|
|
5490
|
+
interface APIExecutionSummary {
|
|
5491
|
+
id: string
|
|
5492
|
+
status: ExecutionStatus
|
|
5493
|
+
startTime: number
|
|
5494
|
+
endTime?: number
|
|
5495
|
+
resourceStatus?: ResourceStatus // 'dev' | 'prod' - optional for backward compatibility
|
|
5496
|
+
}
|
|
5497
|
+
|
|
5498
|
+
/**
|
|
5499
|
+
* Execution Runner Types
|
|
5500
|
+
*
|
|
5501
|
+
* Shared types for the Execution Runner UI feature.
|
|
5502
|
+
* Used by both API (apps/api) and frontend (apps/command-center).
|
|
5503
|
+
*/
|
|
5504
|
+
|
|
5505
|
+
|
|
5506
|
+
|
|
5507
|
+
// ============================================================================
|
|
5508
|
+
// EXECUTION METRICS
|
|
5509
|
+
// ============================================================================
|
|
5510
|
+
|
|
5511
|
+
interface ExecutionMetrics {
|
|
5512
|
+
tokenCount?: number
|
|
5513
|
+
stepCount?: number
|
|
5514
|
+
toolCallCount?: number
|
|
5515
|
+
}
|
|
5516
|
+
|
|
5517
|
+
// ============================================================================
|
|
5518
|
+
// EXECUTION HISTORY TYPES
|
|
5519
|
+
// ============================================================================
|
|
5520
|
+
|
|
5521
|
+
interface ExecutionSummary {
|
|
5522
|
+
id: string
|
|
5523
|
+
resourceId: string
|
|
5524
|
+
resourceName: string
|
|
5525
|
+
status: ExecutionStatus
|
|
5526
|
+
startedAt: string
|
|
5527
|
+
completedAt?: string
|
|
5528
|
+
durationMs?: number
|
|
5529
|
+
metrics?: ExecutionMetrics
|
|
5530
|
+
input?: unknown
|
|
5531
|
+
output?: unknown
|
|
5532
|
+
error?: { message: string }
|
|
5533
|
+
}
|
|
5534
|
+
|
|
5535
|
+
/**
|
|
5536
|
+
* Execution history item.
|
|
5537
|
+
* Represents a single execution triggered by a schedule.
|
|
5538
|
+
*/
|
|
5539
|
+
declare const ExecutionHistoryItemSchema = z.object({
|
|
5540
|
+
id: z.string().uuid(),
|
|
5541
|
+
createdAt: z.string().datetime(),
|
|
5542
|
+
status: z.enum(['running', 'completed', 'failed', 'cancelled']),
|
|
5543
|
+
step: z.number().int().nullable(),
|
|
5544
|
+
itemLabel: z.string().nullable(),
|
|
5545
|
+
duration: z.number().nullable(), // milliseconds
|
|
5546
|
+
error: z.string().nullable()
|
|
5547
|
+
})
|
|
5548
|
+
|
|
5549
|
+
/**
|
|
5550
|
+
* Execution history response.
|
|
5551
|
+
* Returned by GET /schedules/:id/executions with pagination.
|
|
5552
|
+
*/
|
|
5553
|
+
declare const ExecutionHistoryResponseSchema = z.object({
|
|
5554
|
+
executions: z.array(ExecutionHistoryItemSchema),
|
|
5555
|
+
total: z.number().int(),
|
|
5556
|
+
limit: z.number().int(),
|
|
5557
|
+
offset: z.number().int()
|
|
5558
|
+
})
|
|
5559
|
+
type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>
|
|
5560
|
+
type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>
|
|
4132
5561
|
|
|
4133
|
-
/**
|
|
4134
|
-
*
|
|
4135
|
-
*
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
}
|
|
4150
|
-
}
|
|
5562
|
+
/**
|
|
5563
|
+
* Command Queue SSE Event Types
|
|
5564
|
+
*
|
|
5565
|
+
* Type-safe definitions for command queue related SSE events
|
|
5566
|
+
*/
|
|
5567
|
+
|
|
5568
|
+
|
|
5569
|
+
|
|
5570
|
+
/**
|
|
5571
|
+
* Event sent when command queue task is updated
|
|
5572
|
+
*/
|
|
5573
|
+
interface CommandQueueTaskUpdatedEvent {
|
|
5574
|
+
type: 'task_updated'
|
|
5575
|
+
timestamp: number
|
|
5576
|
+
data: {
|
|
5577
|
+
task: Task
|
|
5578
|
+
}
|
|
5579
|
+
}
|
|
5580
|
+
|
|
5581
|
+
/**
|
|
5582
|
+
* Connection confirmation event
|
|
5583
|
+
*/
|
|
5584
|
+
interface CommandQueueConnectedEvent {
|
|
5585
|
+
type: 'connected'
|
|
5586
|
+
timestamp: number
|
|
5587
|
+
data?: undefined
|
|
5588
|
+
}
|
|
5589
|
+
|
|
5590
|
+
/**
|
|
5591
|
+
* Event sent when action execution completes successfully
|
|
5592
|
+
*/
|
|
5593
|
+
interface CommandQueueExecutionCompletedEvent {
|
|
5594
|
+
type: 'execution_completed'
|
|
5595
|
+
timestamp: number
|
|
5596
|
+
data: {
|
|
5597
|
+
taskId: string
|
|
5598
|
+
targetExecutionId: string
|
|
5599
|
+
}
|
|
5600
|
+
}
|
|
5601
|
+
|
|
5602
|
+
/**
|
|
5603
|
+
* Event sent when action execution fails
|
|
5604
|
+
*/
|
|
5605
|
+
interface CommandQueueExecutionFailedEvent {
|
|
5606
|
+
type: 'execution_failed'
|
|
5607
|
+
timestamp: number
|
|
5608
|
+
data: {
|
|
5609
|
+
taskId: string
|
|
5610
|
+
targetExecutionId?: string
|
|
5611
|
+
error: string
|
|
5612
|
+
}
|
|
5613
|
+
}
|
|
5614
|
+
|
|
5615
|
+
/**
|
|
5616
|
+
* Union of all command queue SSE events
|
|
5617
|
+
*/
|
|
5618
|
+
type CommandQueueSSEEvent =
|
|
5619
|
+
| CommandQueueTaskUpdatedEvent
|
|
5620
|
+
| CommandQueueConnectedEvent
|
|
5621
|
+
| CommandQueueExecutionCompletedEvent
|
|
5622
|
+
| CommandQueueExecutionFailedEvent
|
|
4151
5623
|
|
|
4152
|
-
/**
|
|
4153
|
-
*
|
|
4154
|
-
*
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
5624
|
+
/**
|
|
5625
|
+
* Notification SSE Event Types
|
|
5626
|
+
*
|
|
5627
|
+
* Type-safe definitions for notification-related SSE events
|
|
5628
|
+
*/
|
|
5629
|
+
|
|
5630
|
+
/**
|
|
5631
|
+
* Event sent when notification unread count changes
|
|
5632
|
+
*/
|
|
5633
|
+
interface NotificationCountUpdatedEvent {
|
|
5634
|
+
type: 'unread_count_updated'
|
|
5635
|
+
timestamp: number
|
|
5636
|
+
data: {
|
|
5637
|
+
count: number
|
|
5638
|
+
}
|
|
5639
|
+
}
|
|
5640
|
+
|
|
5641
|
+
/**
|
|
5642
|
+
* Union of all notification SSE events
|
|
5643
|
+
*/
|
|
5644
|
+
type NotificationSSEEvent = NotificationCountUpdatedEvent
|
|
4162
5645
|
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
5646
|
+
type ActivityType =
|
|
5647
|
+
| 'workflow_execution'
|
|
5648
|
+
| 'agent_run'
|
|
5649
|
+
| 'hitl_action'
|
|
5650
|
+
| 'webhook_received'
|
|
5651
|
+
| 'webhook_executed'
|
|
5652
|
+
| 'webhook_failed'
|
|
5653
|
+
| 'credential_change'
|
|
5654
|
+
| 'api_key_change'
|
|
5655
|
+
| 'deployment_change'
|
|
5656
|
+
| 'membership_change'
|
|
5657
|
+
|
|
5658
|
+
type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed'
|
|
5659
|
+
|
|
5660
|
+
interface Activity {
|
|
5661
|
+
id: string
|
|
5662
|
+
organizationId: string
|
|
5663
|
+
activityType: ActivityType
|
|
5664
|
+
status: ActivityStatus
|
|
5665
|
+
title: string
|
|
5666
|
+
description: string | null
|
|
5667
|
+
entityType: string
|
|
5668
|
+
entityId: string
|
|
5669
|
+
entityName: string | null
|
|
5670
|
+
metadata: Record<string, unknown> | null
|
|
5671
|
+
actorId: string | null
|
|
5672
|
+
actorType: string | null
|
|
5673
|
+
occurredAt: Date
|
|
5674
|
+
createdAt: Date
|
|
5675
|
+
}
|
|
5676
|
+
|
|
5677
|
+
/**
|
|
5678
|
+
* Activity SSE Event Types
|
|
5679
|
+
*
|
|
5680
|
+
* Type-safe definitions for activity-related SSE events
|
|
5681
|
+
*/
|
|
5682
|
+
|
|
5683
|
+
|
|
5684
|
+
|
|
5685
|
+
/**
|
|
5686
|
+
* Event sent when new activity is created
|
|
5687
|
+
*/
|
|
5688
|
+
interface ActivityCreatedEvent {
|
|
5689
|
+
type: 'activity'
|
|
5690
|
+
timestamp: number
|
|
5691
|
+
data: Activity
|
|
5692
|
+
}
|
|
5693
|
+
|
|
5694
|
+
/**
|
|
5695
|
+
* Connection confirmation event
|
|
5696
|
+
*/
|
|
5697
|
+
interface ActivityConnectedEvent {
|
|
5698
|
+
type: 'connected'
|
|
5699
|
+
timestamp: number
|
|
5700
|
+
data?: undefined
|
|
5701
|
+
}
|
|
5702
|
+
|
|
5703
|
+
/**
|
|
5704
|
+
* Union of all activity SSE events
|
|
5705
|
+
*/
|
|
5706
|
+
type ActivitySSEEvent = ActivityCreatedEvent | ActivityConnectedEvent
|
|
4175
5707
|
|
|
4176
|
-
/**
|
|
4177
|
-
*
|
|
4178
|
-
*
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
5708
|
+
/**
|
|
5709
|
+
* Webhook Endpoint Domain Types
|
|
5710
|
+
*
|
|
5711
|
+
* Browser-safe domain types for generic inbound webhook endpoints.
|
|
5712
|
+
* These are camelCase representations of the `webhook_endpoints` DB table.
|
|
5713
|
+
*
|
|
5714
|
+
* Transform from snake_case DB rows happens in the API service layer,
|
|
5715
|
+
* not here (per core-package.md conventions).
|
|
5716
|
+
*/
|
|
5717
|
+
|
|
5718
|
+
/**
|
|
5719
|
+
* Lifecycle status of a webhook endpoint.
|
|
5720
|
+
* - `active`: Endpoint accepts inbound requests and triggers the target workflow
|
|
5721
|
+
* - `paused`: Endpoint exists but rejects inbound requests with 404
|
|
5722
|
+
*/
|
|
5723
|
+
type WebhookEndpointStatus = 'active' | 'paused'
|
|
5724
|
+
|
|
5725
|
+
/**
|
|
5726
|
+
* Generic inbound webhook endpoint domain type.
|
|
5727
|
+
*
|
|
5728
|
+
* Each endpoint gets a unique opaque URL (`/api/webhooks/inbound/:key`)
|
|
5729
|
+
* that maps to a target workflow resource within an organization.
|
|
5730
|
+
*/
|
|
5731
|
+
interface WebhookEndpoint {
|
|
5732
|
+
/** UUID primary key */
|
|
5733
|
+
id: string
|
|
5734
|
+
/** Organization this endpoint belongs to */
|
|
5735
|
+
organizationId: string
|
|
5736
|
+
/**
|
|
5737
|
+
* Unique opaque key used in the inbound URL.
|
|
5738
|
+
* Format: `wh_` + 32 crypto-random hex chars (128 bits of entropy).
|
|
5739
|
+
* This key IS the credential — it must be kept secret.
|
|
5740
|
+
*/
|
|
5741
|
+
key: string
|
|
5742
|
+
/** User-facing label (e.g., "Zapier → Lead Intake") */
|
|
5743
|
+
name: string
|
|
5744
|
+
/** Optional description for the endpoint */
|
|
5745
|
+
description: string | null
|
|
5746
|
+
/** Target workflow resourceId to invoke on inbound request, or null if not yet assigned */
|
|
5747
|
+
resourceId: string | null
|
|
5748
|
+
/** Whether the endpoint is accepting requests */
|
|
5749
|
+
status: WebhookEndpointStatus
|
|
5750
|
+
/** Timestamp of the most recent successful inbound request, or null */
|
|
5751
|
+
lastTriggeredAt: string | null
|
|
5752
|
+
/** Running total of inbound requests received */
|
|
5753
|
+
requestCount: number
|
|
5754
|
+
/** ISO 8601 creation timestamp */
|
|
5755
|
+
createdAt: string
|
|
5756
|
+
/** ISO 8601 last-updated timestamp */
|
|
5757
|
+
updatedAt: string
|
|
5758
|
+
}
|
|
5759
|
+
|
|
5760
|
+
/**
|
|
5761
|
+
* POST /api/webhook-endpoints - Create a new webhook endpoint
|
|
5762
|
+
*
|
|
5763
|
+
* The `key` and `id` are generated server-side and not accepted in the request.
|
|
5764
|
+
*/
|
|
5765
|
+
declare const CreateWebhookEndpointRequestSchema = z
|
|
5766
|
+
.object({
|
|
5767
|
+
/** User-facing label for the endpoint */
|
|
5768
|
+
name: NonEmptyStringSchema,
|
|
5769
|
+
/** Target workflow resourceId to invoke on inbound requests (can be set later) */
|
|
5770
|
+
resourceId: NonEmptyStringSchema.optional(),
|
|
5771
|
+
/** Optional description */
|
|
5772
|
+
description: z.string().optional()
|
|
5773
|
+
})
|
|
5774
|
+
.strict()
|
|
5775
|
+
|
|
5776
|
+
type CreateWebhookEndpointRequest = z.infer<typeof CreateWebhookEndpointRequestSchema>
|
|
5777
|
+
|
|
5778
|
+
/**
|
|
5779
|
+
* PATCH /api/webhook-endpoints/:id - Update an existing webhook endpoint
|
|
5780
|
+
*
|
|
5781
|
+
* At least one field must be provided.
|
|
5782
|
+
*/
|
|
5783
|
+
declare const UpdateWebhookEndpointRequestSchema = z
|
|
5784
|
+
.object({
|
|
5785
|
+
name: NonEmptyStringSchema.optional(),
|
|
5786
|
+
description: z.string().optional(),
|
|
5787
|
+
resourceId: NonEmptyStringSchema.optional(),
|
|
5788
|
+
status: WebhookEndpointStatusSchema.optional()
|
|
5789
|
+
})
|
|
5790
|
+
.strict()
|
|
5791
|
+
.refine(
|
|
5792
|
+
(data) =>
|
|
5793
|
+
data.name !== undefined ||
|
|
5794
|
+
data.description !== undefined ||
|
|
5795
|
+
data.resourceId !== undefined ||
|
|
5796
|
+
data.status !== undefined,
|
|
5797
|
+
{ message: 'At least one field (name, description, resourceId, or status) must be provided' }
|
|
5798
|
+
)
|
|
5799
|
+
|
|
5800
|
+
type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestSchema>
|
|
5801
|
+
|
|
5802
|
+
/**
|
|
5803
|
+
* Response shape for a single webhook endpoint.
|
|
5804
|
+
* NOT strict — response schemas allow extra fields for forward compatibility.
|
|
5805
|
+
*/
|
|
5806
|
+
declare const WebhookEndpointResponseSchema = z.object({
|
|
5807
|
+
id: UuidSchema,
|
|
5808
|
+
organizationId: UuidSchema,
|
|
5809
|
+
key: z.string(),
|
|
5810
|
+
name: z.string(),
|
|
5811
|
+
description: z.string().nullable(),
|
|
5812
|
+
resourceId: z.string().nullable(),
|
|
5813
|
+
status: WebhookEndpointStatusSchema,
|
|
5814
|
+
lastTriggeredAt: z.string().datetime().nullable(),
|
|
5815
|
+
requestCount: z.number().int().min(0),
|
|
5816
|
+
createdAt: z.string().datetime(),
|
|
5817
|
+
updatedAt: z.string().datetime()
|
|
5818
|
+
})
|
|
5819
|
+
|
|
5820
|
+
type WebhookEndpointResponse = z.infer<typeof WebhookEndpointResponseSchema>
|
|
4193
5821
|
|
|
4194
|
-
/**
|
|
4195
|
-
*
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
}
|
|
4208
|
-
|
|
4209
|
-
|
|
4210
|
-
// Error Tracking Types
|
|
4211
|
-
// ============================================================================
|
|
4212
|
-
|
|
4213
|
-
/**
|
|
4214
|
-
* Error record for list view (ErrorBreakdownTable)
|
|
4215
|
-
*/
|
|
4216
|
-
interface ErrorRecord {
|
|
4217
|
-
id: string // execution_errors.id
|
|
4218
|
-
timestamp: string // occurred_at
|
|
4219
|
-
errorType: string // error_type
|
|
4220
|
-
message: string // error_message
|
|
4221
|
-
executionId: string // execution_id
|
|
4222
|
-
resourceId: string // execution_logs.resource_id (via JOIN)
|
|
4223
|
-
resourceName: string // execution_logs.resource_id (TODO: resolve via registry)
|
|
4224
|
-
severity: 'critical' | 'warning' | 'info'
|
|
4225
|
-
category: ExecutionErrorCategory // error_category (moved from metadata to dedicated column)
|
|
4226
|
-
resolved: boolean // resolved flag (human acknowledgment, does not affect execution status)
|
|
4227
|
-
resolvedAt: string | null // timestamp when resolved
|
|
4228
|
-
resolvedBy: string | null // user ID who resolved
|
|
4229
|
-
}
|
|
4230
|
-
|
|
4231
|
-
/**
|
|
4232
|
-
* Full error detail for modal view (ErrorDetailsModal)
|
|
4233
|
-
*/
|
|
4234
|
-
interface ErrorDetailFull extends ErrorRecord {
|
|
4235
|
-
stackTrace?: string // error_stack_trace
|
|
4236
|
-
retryAttempt?: number // metadata.retryAttempt
|
|
4237
|
-
stepName?: string // metadata.stepName
|
|
4238
|
-
stepSequence?: number // metadata.stepSequence
|
|
4239
|
-
errorContext?: Record<string, unknown> // metadata.errorContext
|
|
4240
|
-
executionContext?: Record<string, unknown> // metadata.executionContext
|
|
4241
|
-
}
|
|
4242
|
-
|
|
4243
|
-
/**
|
|
4244
|
-
* Error details API response (paginated)
|
|
4245
|
-
*/
|
|
4246
|
-
interface ErrorDetailResponse {
|
|
4247
|
-
errors: ErrorRecord[]
|
|
4248
|
-
total: number
|
|
4249
|
-
page: number
|
|
4250
|
-
limit: number
|
|
4251
|
-
}
|
|
4252
|
-
|
|
4253
|
-
/**
|
|
4254
|
-
* Error trend data for time-series charts
|
|
4255
|
-
*/
|
|
4256
|
-
interface ErrorTrend {
|
|
4257
|
-
time: string // Time bucket (ISO timestamp)
|
|
4258
|
-
errorCount: number // Total errors in bucket
|
|
4259
|
-
criticalCount: number // Critical errors in bucket
|
|
4260
|
-
warningCount: number // Warning errors in bucket
|
|
4261
|
-
infoCount: number // Info errors in bucket
|
|
4262
|
-
}
|
|
4263
|
-
|
|
4264
|
-
/**
|
|
4265
|
-
* Failing resource data for health monitoring
|
|
4266
|
-
*/
|
|
4267
|
-
interface FailingResource {
|
|
4268
|
-
resourceId: string
|
|
4269
|
-
resourceName: string // TODO: Resolve via registry
|
|
4270
|
-
errorCount: number
|
|
4271
|
-
criticalCount: number
|
|
4272
|
-
warningCount: number
|
|
4273
|
-
mostCommonError: string
|
|
4274
|
-
}
|
|
4275
|
-
|
|
4276
|
-
// ============================================================================
|
|
4277
|
-
// Recent Executions by Resource Types (Dashboard)
|
|
4278
|
-
// ============================================================================
|
|
4279
|
-
|
|
4280
|
-
/**
|
|
4281
|
-
* Summary of executions for a single resource
|
|
4282
|
-
* Used by RecentExecutionsByResource dashboard component
|
|
4283
|
-
*/
|
|
4284
|
-
interface ResourceExecutionSummary {
|
|
4285
|
-
resourceId: string // resource_id from execution_logs
|
|
4286
|
-
resourceType: string // Inferred from resource definitions (resolved by frontend)
|
|
4287
|
-
resourceName: string | null // From resource registry lookup (resolved by frontend)
|
|
4288
|
-
lastExecution: string // ISO timestamp (MAX started_at)
|
|
4289
|
-
totalExecutions: number // COUNT(*)
|
|
4290
|
-
successCount: number // COUNT WHERE status='completed' OR status='warning'
|
|
4291
|
-
failureCount: number // COUNT WHERE status='failed'
|
|
4292
|
-
warningCount: number // COUNT WHERE status='warning' (subset of success)
|
|
4293
|
-
successRate: number // (successCount / totalExecutions) * 100
|
|
4294
|
-
}
|
|
4295
|
-
|
|
4296
|
-
/**
|
|
4297
|
-
* Response from getRecentExecutionsByResource endpoint
|
|
4298
|
-
*/
|
|
4299
|
-
interface RecentExecutionsByResourceResponse {
|
|
4300
|
-
resources: ResourceExecutionSummary[]
|
|
4301
|
-
}
|
|
4302
|
-
|
|
4303
|
-
// ============================================================================
|
|
4304
|
-
// Per-Resource Health Types (Dashboard Recent Activity)
|
|
4305
|
-
// ============================================================================
|
|
4306
|
-
|
|
4307
|
-
/** Resource identifier for health queries */
|
|
4308
|
-
interface ResourceIdentifier {
|
|
4309
|
-
entityType: string // 'workflow' | 'agent'
|
|
4310
|
-
entityId: string // Resource ID
|
|
4311
|
-
}
|
|
4312
|
-
|
|
4313
|
-
/** Time-bucketed health data point */
|
|
4314
|
-
interface ResourceHealthDataPoint {
|
|
4315
|
-
time: string // ISO timestamp (bucket start)
|
|
4316
|
-
success: number // Success count in bucket (completed + warning)
|
|
4317
|
-
failure: number // Failure count in bucket
|
|
4318
|
-
warning: number // Warning count in bucket (subset of success)
|
|
4319
|
-
rate: number // Success rate (0-100)
|
|
4320
|
-
}
|
|
4321
|
-
|
|
4322
|
-
/** Health data for a single resource */
|
|
4323
|
-
interface ResourceHealth {
|
|
4324
|
-
entityType: string
|
|
4325
|
-
entityId: string
|
|
4326
|
-
entityName: string | null
|
|
4327
|
-
trendData: ResourceHealthDataPoint[]
|
|
4328
|
-
summary: {
|
|
4329
|
-
total: number
|
|
4330
|
-
successRate: number
|
|
4331
|
-
}
|
|
4332
|
-
}
|
|
4333
|
-
|
|
4334
|
-
/** Batch response with all requested resources */
|
|
4335
|
-
interface ResourcesHealthResponse {
|
|
4336
|
-
resources: ResourceHealth[]
|
|
4337
|
-
}
|
|
4338
|
-
|
|
4339
|
-
// ============================================================================
|
|
4340
|
-
// Cost Analytics Types (Time-Series)
|
|
4341
|
-
// ============================================================================
|
|
4342
|
-
|
|
4343
|
-
/**
|
|
4344
|
-
* Cost trend data point for time-series charts
|
|
4345
|
-
* Represents a single time bucket (hour or day)
|
|
4346
|
-
*/
|
|
4347
|
-
interface CostTrendDataPoint {
|
|
4348
|
-
time: string // ISO timestamp (bucket start)
|
|
4349
|
-
totalCostUsd: number
|
|
4350
|
-
executionCount: number
|
|
4351
|
-
avgCostPerExecution: number
|
|
4352
|
-
}
|
|
4353
|
-
|
|
4354
|
-
/**
|
|
4355
|
-
* Cost trends response (time-series data)
|
|
4356
|
-
*/
|
|
4357
|
-
interface CostTrendsResponse {
|
|
4358
|
-
trendData: CostTrendDataPoint[]
|
|
4359
|
-
granularity: 'hour' | 'day'
|
|
4360
|
-
totalCostUsd: number
|
|
4361
|
-
totalExecutions: number
|
|
4362
|
-
}
|
|
4363
|
-
|
|
4364
|
-
/**
|
|
4365
|
-
* Cost summary response with MTD and projections
|
|
4366
|
-
*/
|
|
4367
|
-
interface CostSummaryResponse {
|
|
4368
|
-
current: {
|
|
4369
|
-
totalCostUsd: number
|
|
4370
|
-
executionCount: number
|
|
4371
|
-
}
|
|
4372
|
-
previous: {
|
|
4373
|
-
totalCostUsd: number
|
|
4374
|
-
executionCount: number
|
|
4375
|
-
}
|
|
4376
|
-
mtd: {
|
|
4377
|
-
totalCostUsd: number
|
|
4378
|
-
daysElapsed: number
|
|
4379
|
-
}
|
|
4380
|
-
projection: {
|
|
4381
|
-
monthlyCostUsd: number
|
|
4382
|
-
confidence: 'low' | 'medium' | 'high'
|
|
4383
|
-
}
|
|
4384
|
-
trend: {
|
|
4385
|
-
changePercent: number
|
|
4386
|
-
direction: 'up' | 'down' | 'flat'
|
|
4387
|
-
}
|
|
4388
|
-
}
|
|
4389
|
-
|
|
4390
|
-
/**
|
|
4391
|
-
* Cost by model data for model-level breakdown
|
|
4392
|
-
*/
|
|
4393
|
-
interface CostByModelData {
|
|
4394
|
-
model: string
|
|
4395
|
-
totalCostUsd: number
|
|
4396
|
-
callCount: number
|
|
4397
|
-
totalInputTokens: number
|
|
4398
|
-
totalOutputTokens: number
|
|
4399
|
-
avgCostPerCall: number
|
|
4400
|
-
}
|
|
4401
|
-
|
|
4402
|
-
/**
|
|
4403
|
-
* Cost by model response
|
|
4404
|
-
*/
|
|
4405
|
-
interface CostByModelResponse {
|
|
4406
|
-
models: CostByModelData[]
|
|
4407
|
-
totalCostUsd: number
|
|
4408
|
-
totalCallCount: number
|
|
4409
|
-
}
|
|
4410
|
-
|
|
4411
|
-
/**
|
|
4412
|
-
* Action configuration for HITL tasks
|
|
4413
|
-
* Defines available user actions and their behavior
|
|
4414
|
-
*/
|
|
4415
|
-
interface ActionConfig {
|
|
4416
|
-
/** Unique action identifier (e.g., 'approve', 'retry', 'escalate') */
|
|
4417
|
-
id: string
|
|
4418
|
-
|
|
4419
|
-
/** Display label for UI button */
|
|
4420
|
-
label: string
|
|
4421
|
-
|
|
4422
|
-
/** Button variant/style */
|
|
4423
|
-
type: 'primary' | 'secondary' | 'danger' | 'outline'
|
|
4424
|
-
|
|
4425
|
-
/** Tabler icon name (e.g., 'IconCheck', 'IconRefresh') */
|
|
4426
|
-
icon?: string
|
|
4427
|
-
|
|
4428
|
-
/** Button color (Mantine theme colors) */
|
|
4429
|
-
color?: string
|
|
4430
|
-
|
|
4431
|
-
/** Button variant (Mantine button variant, e.g., 'light', 'filled', 'outline') */
|
|
4432
|
-
variant?: string
|
|
4433
|
-
|
|
4434
|
-
/** Execution target (agent/workflow to invoke) */
|
|
4435
|
-
target?: {
|
|
4436
|
-
resourceType: 'agent' | 'workflow'
|
|
4437
|
-
resourceId: string
|
|
4438
|
-
/**
|
|
4439
|
-
* Optional session ID for agent continuation.
|
|
4440
|
-
* If provided, invokes a new turn on the existing session instead of standalone execution.
|
|
4441
|
-
* Only valid when resourceType is 'agent'.
|
|
4442
|
-
*/
|
|
4443
|
-
sessionId?: string
|
|
4444
|
-
}
|
|
4445
|
-
|
|
4446
|
-
/** Form schema for collecting action-specific data */
|
|
4447
|
-
form?: FormSchema
|
|
4448
|
-
|
|
4449
|
-
/** Payload template for pre-filling forms */
|
|
4450
|
-
payloadTemplate?: unknown
|
|
4451
|
-
|
|
4452
|
-
/** Requires confirmation dialog */
|
|
4453
|
-
requiresConfirmation?: boolean
|
|
4454
|
-
|
|
4455
|
-
/** Confirmation message */
|
|
4456
|
-
confirmationMessage?: string
|
|
4457
|
-
|
|
4458
|
-
/** Help text / tooltip */
|
|
4459
|
-
description?: string
|
|
4460
|
-
}
|
|
4461
|
-
|
|
4462
|
-
/**
|
|
4463
|
-
* Origin resource type - where an execution/task originated from.
|
|
4464
|
-
* Used for audit trails and tracking execution lineage.
|
|
4465
|
-
*/
|
|
4466
|
-
type OriginResourceType = 'agent' | 'workflow' | 'scheduler' | 'api'
|
|
4467
|
-
|
|
4468
|
-
/**
|
|
4469
|
-
* Origin tracking metadata - who/what created this execution/task.
|
|
4470
|
-
* Used by both TaskScheduler and CommandQueue for complete audit trails.
|
|
4471
|
-
*/
|
|
4472
|
-
interface OriginTracking {
|
|
4473
|
-
originExecutionId: string
|
|
4474
|
-
originResourceType: OriginResourceType
|
|
4475
|
-
originResourceId: string
|
|
4476
|
-
}
|
|
4477
|
-
|
|
4478
|
-
/**
|
|
4479
|
-
* Command queue task with flexible action system
|
|
4480
|
-
*/
|
|
4481
|
-
interface Task extends OriginTracking {
|
|
4482
|
-
id: string
|
|
4483
|
-
organizationId: string
|
|
4484
|
-
|
|
4485
|
-
// NEW: Flexible action system
|
|
4486
|
-
actions: ActionConfig[]
|
|
4487
|
-
context: unknown
|
|
4488
|
-
selectedAction?: string
|
|
4489
|
-
actionPayload?: unknown
|
|
4490
|
-
|
|
4491
|
-
// Task metadata
|
|
4492
|
-
description?: string
|
|
4493
|
-
priority: number
|
|
4494
|
-
|
|
4495
|
-
/** Optional checkpoint identifier for grouping related human approval tasks */
|
|
4496
|
-
humanCheckpoint?: string
|
|
4497
|
-
|
|
4498
|
-
// Status (updated to include 'completed')
|
|
4499
|
-
status: QueueTaskStatus
|
|
4500
|
-
|
|
4501
|
-
/**
|
|
4502
|
-
* Target resource tracking — mirrors origin columns.
|
|
4503
|
-
* Set when task is created; patchable to redirect execution to a different resource.
|
|
4504
|
-
*/
|
|
4505
|
-
targetResourceId?: string
|
|
4506
|
-
targetResourceType?: 'agent' | 'workflow'
|
|
4507
|
-
|
|
4508
|
-
/**
|
|
4509
|
-
* Execution ID for the action that runs AFTER user approval.
|
|
4510
|
-
* NULL until execution starts.
|
|
4511
|
-
*
|
|
4512
|
-
* Naming distinction:
|
|
4513
|
-
* - originExecutionId = Parent execution that CREATED the HITL task
|
|
4514
|
-
* - targetExecutionId = Child execution that RUNS AFTER user approval
|
|
4515
|
-
*/
|
|
4516
|
-
targetExecutionId?: string
|
|
4517
|
-
|
|
4518
|
-
createdAt: Date
|
|
4519
|
-
completedAt?: Date
|
|
4520
|
-
completedBy?: string
|
|
4521
|
-
expiresAt?: Date
|
|
4522
|
-
idempotencyKey?: string | null
|
|
4523
|
-
}
|
|
4524
|
-
|
|
4525
|
-
/**
|
|
4526
|
-
* Task status values
|
|
4527
|
-
* - pending: awaiting action
|
|
4528
|
-
* - processing: execution in progress after user approval
|
|
4529
|
-
* - completed: action was taken and execution succeeded
|
|
4530
|
-
* - failed: execution failed, task can be retried
|
|
4531
|
-
* - expired: timed out before action
|
|
4532
|
-
*/
|
|
4533
|
-
type QueueTaskStatus = 'pending' | 'processing' | 'completed' | 'failed' | 'expired'
|
|
4534
|
-
|
|
4535
|
-
/**
|
|
4536
|
-
* Parameters for patching mutable metadata on a task
|
|
4537
|
-
*/
|
|
4538
|
-
interface PatchTaskParams {
|
|
4539
|
-
humanCheckpoint?: string | null
|
|
4540
|
-
description?: string
|
|
4541
|
-
priority?: number
|
|
4542
|
-
context?: Record<string, unknown>
|
|
4543
|
-
actions?: unknown[]
|
|
4544
|
-
targetResourceId?: string | null
|
|
4545
|
-
targetResourceType?: 'agent' | 'workflow' | null
|
|
4546
|
-
targetExecutionId?: string
|
|
4547
|
-
status?: 'pending' | 'failed' | 'completed'
|
|
4548
|
-
}
|
|
4549
|
-
|
|
4550
|
-
/**
|
|
4551
|
-
* Checkpoint list item for sidebar grouping
|
|
4552
|
-
* The id field contains the resourceId of the human checkpoint
|
|
4553
|
-
*/
|
|
4554
|
-
interface CheckpointListItem {
|
|
4555
|
-
/** Human checkpoint resourceId (or 'ungrouped' for tasks without checkpoint) */
|
|
4556
|
-
id: string
|
|
4557
|
-
/** Display name (same as id, or "Ungrouped" for null) */
|
|
4558
|
-
name: string
|
|
4559
|
-
/** Task count for this checkpoint */
|
|
4560
|
-
count: number
|
|
4561
|
-
}
|
|
4562
|
-
|
|
4563
|
-
/**
|
|
4564
|
-
* Status counts for pie chart display
|
|
4565
|
-
*/
|
|
4566
|
-
interface StatusCounts {
|
|
4567
|
-
pending: number
|
|
4568
|
-
completed: number
|
|
4569
|
-
expired: number
|
|
4570
|
-
}
|
|
4571
|
-
|
|
4572
|
-
/**
|
|
4573
|
-
* Priority counts for donut chart display
|
|
4574
|
-
*/
|
|
4575
|
-
interface PriorityCounts {
|
|
4576
|
-
critical: number
|
|
4577
|
-
high: number
|
|
4578
|
-
medium: number
|
|
4579
|
-
low: number
|
|
4580
|
-
}
|
|
4581
|
-
|
|
4582
|
-
/**
|
|
4583
|
-
* Response from GET /command-queue/checkpoints endpoint
|
|
4584
|
-
*/
|
|
4585
|
-
interface CheckpointListResponse {
|
|
4586
|
-
checkpoints: CheckpointListItem[]
|
|
4587
|
-
/** Total tasks across all checkpoints */
|
|
4588
|
-
total: number
|
|
4589
|
-
/** Breakdown by status for donut chart */
|
|
4590
|
-
statusCounts: StatusCounts
|
|
4591
|
-
/** Breakdown by priority for donut chart */
|
|
4592
|
-
priorityCounts: PriorityCounts
|
|
4593
|
-
}
|
|
4594
|
-
|
|
4595
|
-
interface RecurringScheduleConfig {
|
|
4596
|
-
type: 'recurring'
|
|
4597
|
-
cron?: string
|
|
4598
|
-
interval?: 'daily' | 'weekly' | 'monthly'
|
|
4599
|
-
time?: string
|
|
4600
|
-
timezone: string
|
|
4601
|
-
payload: Record<string, unknown>
|
|
4602
|
-
endAt?: string | null
|
|
4603
|
-
overduePolicy?: 'skip' | 'execute' // Default: 'skip'
|
|
4604
|
-
}
|
|
4605
|
-
|
|
4606
|
-
interface RelativeScheduleConfig {
|
|
4607
|
-
type: 'relative'
|
|
4608
|
-
anchorAt: string
|
|
4609
|
-
anchorLabel?: string
|
|
4610
|
-
items: RelativeScheduleItem[]
|
|
4611
|
-
overduePolicy?: 'skip' | 'execute' // Default: 'skip'
|
|
4612
|
-
}
|
|
4613
|
-
|
|
4614
|
-
interface RelativeScheduleItem {
|
|
4615
|
-
offset: string // '-7d', '+3d', '-2h', '+1h'
|
|
4616
|
-
payload: Record<string, unknown>
|
|
4617
|
-
label?: string
|
|
4618
|
-
}
|
|
4619
|
-
|
|
4620
|
-
interface AbsoluteScheduleConfig {
|
|
4621
|
-
type: 'absolute'
|
|
4622
|
-
items: AbsoluteScheduleItem[]
|
|
4623
|
-
overduePolicy?: 'skip' | 'execute' // Default: 'skip'
|
|
4624
|
-
}
|
|
4625
|
-
|
|
4626
|
-
interface AbsoluteScheduleItem {
|
|
4627
|
-
runAt: string
|
|
4628
|
-
payload: Record<string, unknown>
|
|
4629
|
-
label?: string
|
|
4630
|
-
}
|
|
4631
|
-
|
|
4632
|
-
/**
|
|
4633
|
-
* Wire-format DTO for notification API responses.
|
|
4634
|
-
* Dates are ISO 8601 strings (not Date objects like the domain Notification type).
|
|
4635
|
-
* Used by frontend hooks that consume /api/notifications.
|
|
4636
|
-
*/
|
|
4637
|
-
interface NotificationDTO {
|
|
4638
|
-
id: string
|
|
4639
|
-
userId: string
|
|
4640
|
-
organizationId: string
|
|
4641
|
-
category: string
|
|
4642
|
-
title: string
|
|
4643
|
-
message: string
|
|
4644
|
-
actionUrl: string | null
|
|
4645
|
-
read: boolean
|
|
4646
|
-
readAt: string | null
|
|
4647
|
-
createdAt: string
|
|
4648
|
-
}
|
|
4649
|
-
|
|
4650
|
-
/**
|
|
4651
|
-
* Supported integration types
|
|
4652
|
-
*
|
|
4653
|
-
* These represent the available integration adapters that can be used with tools.
|
|
4654
|
-
* Each integration type corresponds to an adapter implementation.
|
|
4655
|
-
*
|
|
4656
|
-
* Note: Concrete adapter implementations are deferred until needed.
|
|
4657
|
-
* This type provides compile-time safety and auto-completion for tool definitions.
|
|
4658
|
-
*/
|
|
4659
|
-
type IntegrationType =
|
|
4660
|
-
| 'gmail' // Google Gmail API
|
|
4661
|
-
| 'google-sheets' // Google Sheets API
|
|
4662
|
-
| 'slack' // Slack API
|
|
4663
|
-
| 'github' // GitHub API
|
|
4664
|
-
| 'linear' // Linear API
|
|
4665
|
-
| 'attio' // Attio CRM API
|
|
4666
|
-
| 'airtable' // Airtable API
|
|
4667
|
-
| 'salesforce' // Salesforce API
|
|
4668
|
-
| 'hubspot' // HubSpot API
|
|
4669
|
-
| 'stripe' // Stripe API
|
|
4670
|
-
| 'twilio' // Twilio API
|
|
4671
|
-
| 'sendgrid' // SendGrid API
|
|
4672
|
-
| 'mailgun' // Mailgun API
|
|
4673
|
-
| 'zapier' // Zapier Webhooks
|
|
4674
|
-
| 'webhook' // Generic webhook
|
|
4675
|
-
| 'apify' // Apify actor automation
|
|
4676
|
-
| 'instantly' // Instantly.ai email automation
|
|
4677
|
-
| 'resend' // Resend transactional email API
|
|
4678
|
-
| 'signature-api' // SignatureAPI eSignature service
|
|
4679
|
-
| 'dropbox' // Dropbox file storage API
|
|
4680
|
-
| 'anymailfinder' // Anymailfinder email finder API
|
|
4681
|
-
| 'tomba' // Tomba email discovery API
|
|
4682
|
-
| 'millionverifier'
|
|
4683
|
-
|
|
4684
|
-
/**
|
|
4685
|
-
* Standard Domain Definitions
|
|
4686
|
-
* Centralized domain constants and definitions for all organization resources.
|
|
4687
|
-
*/
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
// ============================================================================
|
|
4692
|
-
// Standard Domain IDs
|
|
4693
|
-
// ============================================================================
|
|
4694
|
-
|
|
4695
|
-
declare const DOMAINS = {
|
|
4696
|
-
// Business domains
|
|
4697
|
-
INBOUND_PIPELINE: 'inbound-pipeline',
|
|
4698
|
-
LEAD_GEN_PIPELINE: 'lead-gen-pipeline',
|
|
4699
|
-
SUPPORT: 'support',
|
|
4700
|
-
CLIENT_SUPPORT: 'client-support',
|
|
4701
|
-
DELIVERY: 'delivery',
|
|
4702
|
-
OPERATIONS: 'operations',
|
|
4703
|
-
FINANCE: 'finance',
|
|
4704
|
-
EXECUTIVE: 'executive',
|
|
4705
|
-
INSTANTLY: 'instantly',
|
|
4706
|
-
|
|
4707
|
-
// Technical domains
|
|
4708
|
-
TESTING: 'testing',
|
|
4709
|
-
INTERNAL: 'internal',
|
|
4710
|
-
INTEGRATION: 'integration',
|
|
4711
|
-
UTILITY: 'utility',
|
|
4712
|
-
DIAGNOSTIC: 'diagnostic'
|
|
4713
|
-
} as const
|
|
4714
|
-
|
|
4715
|
-
/**
|
|
4716
|
-
* ResourceDomain - Strongly typed domain identifier
|
|
4717
|
-
* Use this type for all domain references to ensure compile-time validation.
|
|
4718
|
-
*/
|
|
4719
|
-
type ResourceDomain = (typeof DOMAINS)[keyof typeof DOMAINS]
|
|
4720
|
-
|
|
4721
|
-
/**
|
|
4722
|
-
* Resource Registry type definitions
|
|
4723
|
-
*/
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
// ============================================================================
|
|
4728
|
-
// Core Resource Type Definitions
|
|
4729
|
-
// ============================================================================
|
|
4730
|
-
|
|
4731
|
-
/**
|
|
4732
|
-
* Environment/deployment status for resources
|
|
4733
|
-
*/
|
|
4734
|
-
type ResourceStatus = 'dev' | 'prod'
|
|
4735
|
-
|
|
4736
|
-
/**
|
|
4737
|
-
* All resource types in the platform
|
|
4738
|
-
* Used as the discriminator field in ResourceDefinition
|
|
4739
|
-
*/
|
|
4740
|
-
type ResourceType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
|
|
4741
|
-
|
|
4742
|
-
// ============================================================================
|
|
4743
|
-
// Base Resource Interface
|
|
4744
|
-
// ============================================================================
|
|
4745
|
-
|
|
4746
|
-
/**
|
|
4747
|
-
* Base interface for ALL platform resources
|
|
4748
|
-
* Shared by both executable (agents, workflows) and non-executable (triggers, integrations, etc.) resources
|
|
4749
|
-
*/
|
|
4750
|
-
interface ResourceDefinition {
|
|
4751
|
-
/** Unique resource identifier */
|
|
4752
|
-
resourceId: string
|
|
4753
|
-
|
|
4754
|
-
/** Display name */
|
|
4755
|
-
name: string
|
|
4756
|
-
|
|
4757
|
-
/** Purpose and functionality description */
|
|
4758
|
-
description: string
|
|
4759
|
-
|
|
4760
|
-
/** Version for change tracking and evolution */
|
|
4761
|
-
version: string
|
|
4762
|
-
|
|
4763
|
-
/** Resource type discriminator */
|
|
4764
|
-
type: ResourceType
|
|
4765
|
-
|
|
4766
|
-
/** Environment/deployment status */
|
|
4767
|
-
status: ResourceStatus
|
|
4768
|
-
|
|
4769
|
-
/** Domain tags for filtering and organization */
|
|
4770
|
-
domains?: ResourceDomain[]
|
|
4771
|
-
|
|
4772
|
-
/** Whether the agent supports multi-turn sessions (agents only) */
|
|
4773
|
-
sessionCapable?: boolean
|
|
4774
|
-
|
|
4775
|
-
/** Whether the resource is local (monorepo) or remote (externally deployed) */
|
|
4776
|
-
origin?: 'local' | 'remote'
|
|
4777
|
-
|
|
4778
|
-
/** Whether this resource is archived and should be excluded from registration and deployment */
|
|
4779
|
-
archived?: boolean
|
|
4780
|
-
}
|
|
4781
|
-
|
|
4782
|
-
// ============================================================================
|
|
4783
|
-
// Domain Definition Types
|
|
4784
|
-
// ============================================================================
|
|
4785
|
-
|
|
4786
|
-
/**
|
|
4787
|
-
* Domain definition for Command View filtering
|
|
4788
|
-
*
|
|
4789
|
-
* Domains are organizational metadata for UI filtering/grouping.
|
|
4790
|
-
* No execution impact - purely for visualization.
|
|
4791
|
-
*
|
|
4792
|
-
* @example
|
|
4793
|
-
* {
|
|
4794
|
-
* id: 'support',
|
|
4795
|
-
* name: 'Customer Support',
|
|
4796
|
-
* description: 'Ticket triage, knowledge base, escalations',
|
|
4797
|
-
* color: 'green',
|
|
4798
|
-
* icon: 'IconHeadset'
|
|
4799
|
-
* }
|
|
4800
|
-
*/
|
|
4801
|
-
interface DomainDefinition {
|
|
4802
|
-
/** Unique identifier (e.g., 'support') */
|
|
4803
|
-
id: string
|
|
4804
|
-
/** Display name (e.g., 'Customer Support') */
|
|
4805
|
-
name: string
|
|
4806
|
-
/** Purpose description */
|
|
4807
|
-
description: string
|
|
4808
|
-
/** Optional Mantine color for UI (e.g., 'blue', 'green', 'orange') */
|
|
4809
|
-
color?: string
|
|
4810
|
-
/** Optional Tabler icon name (e.g., 'IconHeadset') */
|
|
4811
|
-
icon?: string
|
|
4812
|
-
}
|
|
4813
|
-
|
|
4814
|
-
// ============================================================================
|
|
4815
|
-
// Resource Manifest Types
|
|
4816
|
-
// ============================================================================
|
|
4817
|
-
|
|
4818
|
-
// ============================================================================
|
|
4819
|
-
// Trigger Configuration Types
|
|
4820
|
-
// ============================================================================
|
|
4821
|
-
|
|
4822
|
-
/** Webhook provider identifiers */
|
|
4823
|
-
type WebhookProviderType = 'cal-com' | 'stripe' | 'signature-api' | 'instantly' | 'apify' | 'test'
|
|
4824
|
-
|
|
4825
|
-
/** Webhook trigger configuration */
|
|
4826
|
-
interface WebhookTriggerConfig {
|
|
4827
|
-
/** Provider identifier */
|
|
4828
|
-
provider: WebhookProviderType
|
|
4829
|
-
/** Event type for documentation (not used for matching - workflow handles routing) */
|
|
4830
|
-
event?: string
|
|
4831
|
-
/** Optional filtering (e.g., specific form ID for Fillout) */
|
|
4832
|
-
filter?: Record<string, string>
|
|
4833
|
-
/** References credential in credentials table for per-org webhook secrets */
|
|
4834
|
-
credentialName?: string
|
|
4835
|
-
}
|
|
4836
|
-
|
|
4837
|
-
/** Schedule trigger configuration */
|
|
4838
|
-
interface ScheduleTriggerConfig {
|
|
4839
|
-
/** Cron expression (e.g., '0 6 * * *') */
|
|
4840
|
-
cron: string
|
|
4841
|
-
/** Optional timezone (default: UTC) */
|
|
4842
|
-
timezone?: string
|
|
4843
|
-
}
|
|
4844
|
-
|
|
4845
|
-
/** Event trigger configuration */
|
|
4846
|
-
interface EventTriggerConfig {
|
|
4847
|
-
/** Internal event type */
|
|
4848
|
-
eventType: string
|
|
4849
|
-
/** Event source */
|
|
4850
|
-
source?: string
|
|
4851
|
-
}
|
|
4852
|
-
|
|
4853
|
-
/** Union of all trigger configs */
|
|
4854
|
-
type TriggerConfig = WebhookTriggerConfig | ScheduleTriggerConfig | EventTriggerConfig
|
|
4855
|
-
|
|
4856
|
-
// ============================================================================
|
|
4857
|
-
// Trigger Definition
|
|
4858
|
-
// ============================================================================
|
|
4859
|
-
|
|
4860
|
-
/**
|
|
4861
|
-
* Trigger metadata - entry points that initiate resource execution
|
|
4862
|
-
*
|
|
4863
|
-
* Triggers represent how executions start: webhooks from external services,
|
|
4864
|
-
* scheduled cron jobs, platform events, or manual user actions.
|
|
4865
|
-
*
|
|
4866
|
-
* BREAKING CHANGES (2025-11-30):
|
|
4867
|
-
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
|
|
4868
|
-
* - Field renames: `id` -> `resourceId` (inherited), `type` -> `triggerType`
|
|
4869
|
-
* - Relationship rename: `invokes` -> `triggers` (unified vocabulary)
|
|
4870
|
-
* - New required fields: `version` (inherited), `type: 'trigger'` (inherited)
|
|
4871
|
-
* - triggers object now includes `externalResources` option
|
|
4872
|
-
*
|
|
4873
|
-
* @example
|
|
4874
|
-
* // TriggerDefinition - metadata only
|
|
4875
|
-
* {
|
|
4876
|
-
* resourceId: 'trigger-new-order',
|
|
4877
|
-
* type: 'trigger',
|
|
4878
|
-
* triggerType: 'webhook',
|
|
4879
|
-
* name: 'New Order',
|
|
4880
|
-
* description: 'Webhook from Shopify on new orders',
|
|
4881
|
-
* version: '1.0.0',
|
|
4882
|
-
* status: 'prod',
|
|
4883
|
-
* webhookPath: '/webhooks/shopify/orders'
|
|
4884
|
-
* }
|
|
4885
|
-
*
|
|
4886
|
-
* // Relationships declared in ResourceRelationships (not on TriggerDefinition):
|
|
4887
|
-
* // relationships: {
|
|
4888
|
-
* // 'trigger-new-order': { triggers: { workflows: ['order-fulfillment-workflow'] } }
|
|
4889
|
-
* // }
|
|
4890
|
-
*/
|
|
4891
|
-
interface TriggerDefinition extends ResourceDefinition {
|
|
4892
|
-
/** Resource type discriminator (narrowed from base union) */
|
|
4893
|
-
type: 'trigger'
|
|
4894
|
-
|
|
4895
|
-
/** Trigger mechanism type (renamed from 'type' to avoid collision with base type discriminator) */
|
|
4896
|
-
triggerType: 'webhook' | 'schedule' | 'manual' | 'event'
|
|
4897
|
-
|
|
4898
|
-
/** Type-specific configuration */
|
|
4899
|
-
config?: TriggerConfig
|
|
4900
|
-
|
|
4901
|
-
// Legacy fields (deprecated, use config instead)
|
|
4902
|
-
/** For webhook triggers: path like '/webhooks/shopify/orders' */
|
|
4903
|
-
webhookPath?: string
|
|
4904
|
-
/** For schedule triggers: cron expression like '0 6 * * *' */
|
|
4905
|
-
schedule?: string
|
|
4906
|
-
/** For event triggers: event type like 'low-stock-alert' */
|
|
4907
|
-
eventType?: string
|
|
4908
|
-
|
|
4909
|
-
// NOTE: What this trigger starts is declared in ResourceRelationships, not here
|
|
4910
|
-
// This prevents duplication - triggers are forward-declared in relationships
|
|
4911
|
-
}
|
|
4912
|
-
|
|
4913
|
-
/**
|
|
4914
|
-
* Integration metadata - external service connections
|
|
4915
|
-
*
|
|
4916
|
-
* References credentials table for actual connection. No connection status
|
|
4917
|
-
* stored here (queried at runtime from credentials table).
|
|
4918
|
-
*
|
|
4919
|
-
* BREAKING CHANGES (2025-11-30):
|
|
4920
|
-
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
|
|
4921
|
-
* - Field renames: `id` -> `resourceId` (inherited)
|
|
4922
|
-
* - New required field: `status` (inherited) - organizations must add status to all integrations
|
|
4923
|
-
* - New required field: `version` (inherited) - organizations must add version to all integrations
|
|
4924
|
-
* - New required field: `type: 'integration'` (inherited) - resource type discriminator
|
|
4925
|
-
*
|
|
4926
|
-
* @example
|
|
4927
|
-
* {
|
|
4928
|
-
* resourceId: 'integration-shopify-prod',
|
|
4929
|
-
* type: 'integration',
|
|
4930
|
-
* provider: 'shopify',
|
|
4931
|
-
* credentialName: 'shopify-prod',
|
|
4932
|
-
* name: 'Shopify Production',
|
|
4933
|
-
* description: 'E-commerce platform',
|
|
4934
|
-
* version: '1.0.0',
|
|
4935
|
-
* status: 'prod'
|
|
4936
|
-
* }
|
|
4937
|
-
*/
|
|
4938
|
-
interface IntegrationDefinition extends ResourceDefinition {
|
|
4939
|
-
/** Resource type discriminator (narrowed from base union) */
|
|
4940
|
-
type: 'integration'
|
|
4941
|
-
|
|
4942
|
-
/** Integration provider type */
|
|
4943
|
-
provider: IntegrationType
|
|
4944
|
-
/** References credentials table (e.g., 'shopify-prod', 'zendesk-api') */
|
|
4945
|
-
credentialName: string
|
|
4946
|
-
}
|
|
4947
|
-
|
|
4948
|
-
// ============================================================================
|
|
4949
|
-
// External Resource Types
|
|
4950
|
-
// ============================================================================
|
|
4951
|
-
|
|
4952
|
-
/**
|
|
4953
|
-
* External platform type
|
|
4954
|
-
* Supported third-party automation platforms
|
|
4955
|
-
*/
|
|
4956
|
-
type ExternalPlatform = 'n8n' | 'make' | 'zapier' | 'other'
|
|
4957
|
-
|
|
4958
|
-
/**
|
|
4959
|
-
* External automation resource metadata
|
|
4960
|
-
*
|
|
4961
|
-
* Represents workflows/automations running on third-party platforms
|
|
4962
|
-
* (n8n, Make, Zapier, etc.) for visualization in Command View.
|
|
4963
|
-
*
|
|
4964
|
-
* NOTE: This is metadata ONLY for visualization. No execution logic,
|
|
4965
|
-
* no API integration with external platforms, no status syncing.
|
|
4966
|
-
*
|
|
4967
|
-
* BREAKING CHANGES (2025-11-30):
|
|
4968
|
-
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
|
|
4969
|
-
* - Field renames: `id` -> `resourceId` (inherited)
|
|
4970
|
-
* - New required field: `version` (inherited) - organizations must add version to all external resources
|
|
4971
|
-
* - New required field: `type: 'external'` (inherited) - resource type discriminator
|
|
4972
|
-
* - REMOVED FIELD: `triggeredBy` - per relationship-consolidation design, all relationships are forward-only declarations
|
|
4973
|
-
*
|
|
4974
|
-
* @example
|
|
4975
|
-
* {
|
|
4976
|
-
* resourceId: 'external-n8n-order-sync',
|
|
4977
|
-
* type: 'external',
|
|
4978
|
-
* version: '1.0.0',
|
|
4979
|
-
* platform: 'n8n',
|
|
4980
|
-
* name: 'Shopify Order Sync',
|
|
4981
|
-
* description: 'Legacy n8n workflow for syncing Shopify orders',
|
|
4982
|
-
* status: 'prod',
|
|
4983
|
-
* platformUrl: 'https://n8n.client.com/workflow/123',
|
|
4984
|
-
* triggers: { workflows: ['order-fulfillment-workflow'] },
|
|
4985
|
-
* uses: { integrations: ['integration-shopify-prod'] }
|
|
4986
|
-
* }
|
|
4987
|
-
*/
|
|
4988
|
-
interface ExternalResourceDefinition extends ResourceDefinition {
|
|
4989
|
-
/** Resource type discriminator (narrowed from base union) */
|
|
4990
|
-
type: 'external'
|
|
4991
|
-
|
|
4992
|
-
/** Platform type */
|
|
4993
|
-
platform: ExternalPlatform
|
|
4994
|
-
|
|
4995
|
-
// Optional platform-specific metadata
|
|
4996
|
-
/** Link to external platform (e.g., n8n workflow editor URL) */
|
|
4997
|
-
platformUrl?: string
|
|
4998
|
-
/** Platform's internal ID/reference */
|
|
4999
|
-
externalId?: string
|
|
5000
|
-
|
|
5001
|
-
/** What this external resource triggers (external -> internal) */
|
|
5002
|
-
triggers?: {
|
|
5003
|
-
/** Elevasis workflow resourceIds this external automation triggers */
|
|
5004
|
-
workflows?: string[]
|
|
5005
|
-
/** Elevasis agent resourceIds this external automation triggers */
|
|
5006
|
-
agents?: string[]
|
|
5007
|
-
}
|
|
5008
|
-
|
|
5009
|
-
/** Integrations this external resource uses (shared credentials) */
|
|
5010
|
-
uses?: {
|
|
5011
|
-
/** Integration IDs this external automation uses */
|
|
5012
|
-
integrations?: string[]
|
|
5013
|
-
}
|
|
5014
|
-
|
|
5015
|
-
// NOTE: triggeredBy field removed - per relationship-consolidation design,
|
|
5016
|
-
// all relationships are forward-only declarations. Graph edges are built
|
|
5017
|
-
// from forward declarations only.
|
|
5018
|
-
}
|
|
5019
|
-
|
|
5020
|
-
/**
|
|
5021
|
-
* Human Checkpoint definition - human decision points in automation
|
|
5022
|
-
*
|
|
5023
|
-
* Represents where human judgment is deployed in the automation landscape.
|
|
5024
|
-
* Tasks with matching command_queue_group are routed to this checkpoint.
|
|
5025
|
-
*
|
|
5026
|
-
* BREAKING CHANGES (2025-11-30):
|
|
5027
|
-
* - Now extends ResourceDefinition (inherits: resourceId, name, description, version, type, status, domains)
|
|
5028
|
-
* - Field renames: `id` -> `resourceId` (inherited)
|
|
5029
|
-
* - description is now REQUIRED (was optional) - organizations must add description to all human checkpoints
|
|
5030
|
-
* - New required field: `version` (inherited) - organizations must add version to all human checkpoints
|
|
5031
|
-
* - New required field: `type: 'human'` (inherited) - resource type discriminator
|
|
5032
|
-
*
|
|
5033
|
-
* @example
|
|
5034
|
-
* {
|
|
5035
|
-
* resourceId: 'sales-approval',
|
|
5036
|
-
* type: 'human',
|
|
5037
|
-
* name: 'Sales Approval Queue',
|
|
5038
|
-
* description: 'High-value order approvals for sales team',
|
|
5039
|
-
* version: '1.0.0',
|
|
5040
|
-
* status: 'prod',
|
|
5041
|
-
* requestedBy: { agents: ['order-processor-agent'] },
|
|
5042
|
-
* routesTo: { agents: ['order-fulfillment-agent'] }
|
|
5043
|
-
* }
|
|
5044
|
-
*/
|
|
5045
|
-
interface HumanCheckpointDefinition extends ResourceDefinition {
|
|
5046
|
-
/** Resource type discriminator (narrowed from base union) */
|
|
5047
|
-
type: 'human'
|
|
5048
|
-
|
|
5049
|
-
/** Resources that create tasks for this checkpoint */
|
|
5050
|
-
requestedBy?: {
|
|
5051
|
-
/** Agent resourceIds that request approval here */
|
|
5052
|
-
agents?: string[]
|
|
5053
|
-
/** Workflow resourceIds that request approval here */
|
|
5054
|
-
workflows?: string[]
|
|
5055
|
-
}
|
|
5056
|
-
|
|
5057
|
-
/** Resources that receive approved decisions */
|
|
5058
|
-
routesTo?: {
|
|
5059
|
-
/** Agent resourceIds that handle approved tasks */
|
|
5060
|
-
agents?: string[]
|
|
5061
|
-
/** Workflow resourceIds that handle approved tasks */
|
|
5062
|
-
workflows?: string[]
|
|
5063
|
-
}
|
|
5064
|
-
}
|
|
5065
|
-
|
|
5066
|
-
/**
|
|
5067
|
-
* Command View Types
|
|
5068
|
-
*
|
|
5069
|
-
* Unified type definitions for the Command View graph visualization.
|
|
5070
|
-
* These types are used by both backend serialization and frontend rendering.
|
|
5071
|
-
*
|
|
5072
|
-
* Command View shows the resource graph: agents, workflows, triggers, integrations,
|
|
5073
|
-
* external resources, and human checkpoints with their relationships.
|
|
5074
|
-
*/
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
// ============================================================================
|
|
5079
|
-
// Node Types - Resources that appear in the graph
|
|
5080
|
-
// ============================================================================
|
|
5081
|
-
|
|
5082
|
-
/**
|
|
5083
|
-
* Extended agent metadata for Command View
|
|
5084
|
-
* Includes model and capability information for graph display
|
|
5085
|
-
*/
|
|
5086
|
-
interface CommandViewAgent extends ResourceDefinition {
|
|
5087
|
-
type: 'agent'
|
|
5088
|
-
modelProvider: string // e.g., 'anthropic', 'openai'
|
|
5089
|
-
modelId: string // e.g., 'claude-sonnet-4-20250514'
|
|
5090
|
-
toolCount: number
|
|
5091
|
-
hasKnowledgeMap: boolean
|
|
5092
|
-
hasMemory: boolean
|
|
5093
|
-
sessionCapable: boolean // Explicit session capability declaration
|
|
5094
|
-
}
|
|
5095
|
-
|
|
5096
|
-
/**
|
|
5097
|
-
* Extended workflow metadata for Command View
|
|
5098
|
-
* Includes step information for graph display
|
|
5099
|
-
*/
|
|
5100
|
-
interface CommandViewWorkflow extends ResourceDefinition {
|
|
5101
|
-
type: 'workflow'
|
|
5102
|
-
stepCount: number
|
|
5103
|
-
entryPoint: string
|
|
5104
|
-
}
|
|
5105
|
-
|
|
5106
|
-
/**
|
|
5107
|
-
* Node type categories for Command View
|
|
5108
|
-
* Simplified categorization for UI rendering and layout
|
|
5109
|
-
*/
|
|
5110
|
-
type CommandViewNodeType = 'agent' | 'workflow' | 'trigger' | 'integration' | 'external' | 'human'
|
|
5111
|
-
|
|
5112
|
-
/**
|
|
5113
|
-
* Union type for all node types in Command View
|
|
5114
|
-
* Frontend can use this for type-safe node handling
|
|
5115
|
-
*/
|
|
5116
|
-
type CommandViewNode =
|
|
5117
|
-
| CommandViewAgent
|
|
5118
|
-
| CommandViewWorkflow
|
|
5119
|
-
| TriggerDefinition
|
|
5120
|
-
| IntegrationDefinition
|
|
5121
|
-
| ExternalResourceDefinition
|
|
5122
|
-
| HumanCheckpointDefinition
|
|
5123
|
-
|
|
5124
|
-
// ============================================================================
|
|
5125
|
-
// Edge Types - Relationships between resources
|
|
5126
|
-
// ============================================================================
|
|
5127
|
-
|
|
5128
|
-
/**
|
|
5129
|
-
* Relationship types between resources
|
|
5130
|
-
*
|
|
5131
|
-
* - triggers: Resource initiates/starts another resource (orange)
|
|
5132
|
-
* - uses: Resource uses an integration (teal)
|
|
5133
|
-
* - approval: Resource requires human approval (yellow)
|
|
5134
|
-
*/
|
|
5135
|
-
type RelationshipType = 'triggers' | 'uses' | 'approval'
|
|
5136
|
-
|
|
5137
|
-
/**
|
|
5138
|
-
* Command View edge (relationship between resources)
|
|
5139
|
-
*/
|
|
5140
|
-
interface CommandViewEdge {
|
|
5141
|
-
id: string
|
|
5142
|
-
source: string // Source node ID
|
|
5143
|
-
target: string // Target node ID
|
|
5144
|
-
relationship: RelationshipType
|
|
5145
|
-
label?: string // Optional label for the edge
|
|
5146
|
-
}
|
|
5147
|
-
|
|
5148
|
-
// ============================================================================
|
|
5149
|
-
// Graph Data Structure
|
|
5150
|
-
// ============================================================================
|
|
5151
|
-
|
|
5152
|
-
/**
|
|
5153
|
-
* Command View data structure
|
|
5154
|
-
* Complete graph data for visualization
|
|
5155
|
-
*
|
|
5156
|
-
* Backend serializes this once at startup and serves it via /command-view endpoint.
|
|
5157
|
-
* Frontend consumes this directly for graph rendering.
|
|
5158
|
-
*/
|
|
5159
|
-
interface CommandViewData {
|
|
5160
|
-
workflows: CommandViewWorkflow[]
|
|
5161
|
-
agents: CommandViewAgent[]
|
|
5162
|
-
triggers: TriggerDefinition[]
|
|
5163
|
-
integrations: IntegrationDefinition[]
|
|
5164
|
-
externalResources: ExternalResourceDefinition[]
|
|
5165
|
-
humanCheckpoints: HumanCheckpointDefinition[]
|
|
5166
|
-
edges: CommandViewEdge[]
|
|
5167
|
-
domainDefinitions?: DomainDefinition[]
|
|
5168
|
-
}
|
|
5169
|
-
|
|
5170
|
-
/**
|
|
5171
|
-
* Serialized Registry Types
|
|
5172
|
-
*
|
|
5173
|
-
* Pre-computed JSON-safe types for API responses and Command View.
|
|
5174
|
-
* Serialization happens once at API startup, enabling instant response times.
|
|
5175
|
-
*/
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
// ============================================================================
|
|
5180
|
-
// Serialized Interface Types (for Execution Runner UI)
|
|
5181
|
-
// ============================================================================
|
|
5182
|
-
|
|
5183
|
-
/**
|
|
5184
|
-
* Serialized form field for API responses
|
|
5185
|
-
*/
|
|
5186
|
-
interface SerializedFormField {
|
|
5187
|
-
name: string
|
|
5188
|
-
label: string
|
|
5189
|
-
type: FormFieldType
|
|
5190
|
-
defaultValue?: unknown
|
|
5191
|
-
required?: boolean
|
|
5192
|
-
placeholder?: string
|
|
5193
|
-
description?: string
|
|
5194
|
-
options?: Array<{ label: string; value: string | number }>
|
|
5195
|
-
min?: number
|
|
5196
|
-
max?: number
|
|
5197
|
-
}
|
|
5198
|
-
|
|
5199
|
-
/**
|
|
5200
|
-
* Serialized form schema for API responses
|
|
5201
|
-
*/
|
|
5202
|
-
interface SerializedFormSchema {
|
|
5203
|
-
title?: string
|
|
5204
|
-
description?: string
|
|
5205
|
-
fields: SerializedFormField[]
|
|
5206
|
-
layout?: 'vertical' | 'horizontal' | 'grid'
|
|
5207
|
-
}
|
|
5208
|
-
|
|
5209
|
-
/**
|
|
5210
|
-
* Serialized execution form schema for API responses
|
|
5211
|
-
*/
|
|
5212
|
-
interface SerializedExecutionFormSchema extends SerializedFormSchema {
|
|
5213
|
-
fieldMappings?: Record<string, string>
|
|
5214
|
-
submitButton?: {
|
|
5215
|
-
label?: string
|
|
5216
|
-
loadingLabel?: string
|
|
5217
|
-
confirmMessage?: string
|
|
5218
|
-
}
|
|
5219
|
-
}
|
|
5220
|
-
|
|
5221
|
-
/**
|
|
5222
|
-
* Serialized schedule config for API responses
|
|
5223
|
-
*/
|
|
5224
|
-
interface SerializedScheduleConfig {
|
|
5225
|
-
enabled: boolean
|
|
5226
|
-
defaultSchedule?: string
|
|
5227
|
-
allowedPatterns?: string[]
|
|
5228
|
-
}
|
|
5229
|
-
|
|
5230
|
-
/**
|
|
5231
|
-
* Serialized webhook config for API responses
|
|
5232
|
-
*/
|
|
5233
|
-
interface SerializedWebhookConfig {
|
|
5234
|
-
enabled: boolean
|
|
5235
|
-
payloadSchema?: unknown
|
|
5236
|
-
}
|
|
5237
|
-
|
|
5238
|
-
/**
|
|
5239
|
-
* Serialized execution interface for API responses
|
|
5240
|
-
*/
|
|
5241
|
-
interface SerializedExecutionInterface {
|
|
5242
|
-
form: SerializedExecutionFormSchema
|
|
5243
|
-
schedule?: SerializedScheduleConfig
|
|
5244
|
-
webhook?: SerializedWebhookConfig
|
|
5245
|
-
}
|
|
5246
|
-
|
|
5247
|
-
// ============================================================================
|
|
5248
|
-
// Serialized Definition Types
|
|
5249
|
-
// ============================================================================
|
|
5250
|
-
|
|
5251
|
-
/**
|
|
5252
|
-
* Serialized agent definition (JSON-safe)
|
|
5253
|
-
* Result of serializeDefinition(AgentDefinition)
|
|
5254
|
-
*/
|
|
5255
|
-
interface SerializedAgentDefinition {
|
|
5256
|
-
config: {
|
|
5257
|
-
resourceId: string
|
|
5258
|
-
name: string
|
|
5259
|
-
description: string
|
|
5260
|
-
version: string
|
|
5261
|
-
type: 'agent'
|
|
5262
|
-
status: 'dev' | 'prod'
|
|
5263
|
-
/** Whether this resource is archived and should be excluded from registration and deployment */
|
|
5264
|
-
archived?: boolean
|
|
5265
|
-
systemPrompt: string
|
|
5266
|
-
constraints?: {
|
|
5267
|
-
maxIterations?: number
|
|
5268
|
-
timeout?: number
|
|
5269
|
-
maxSessionMemoryKeys?: number
|
|
5270
|
-
maxMemoryTokens?: number
|
|
5271
|
-
}
|
|
5272
|
-
sessionCapable?: boolean
|
|
5273
|
-
memoryPreferences?: string
|
|
5274
|
-
}
|
|
5275
|
-
modelConfig: {
|
|
5276
|
-
provider: string
|
|
5277
|
-
model: string
|
|
5278
|
-
apiKey: string // Redacted: "sk-proj..."
|
|
5279
|
-
temperature: number
|
|
5280
|
-
maxOutputTokens: number
|
|
5281
|
-
topP?: number
|
|
5282
|
-
modelOptions?: Record<string, unknown>
|
|
5283
|
-
}
|
|
5284
|
-
contract: {
|
|
5285
|
-
inputSchema: object // JSON Schema
|
|
5286
|
-
outputSchema?: object // JSON Schema
|
|
5287
|
-
}
|
|
5288
|
-
tools: Array<{
|
|
5289
|
-
name: string
|
|
5290
|
-
description: string
|
|
5291
|
-
inputSchema?: object // JSON Schema
|
|
5292
|
-
outputSchema?: object // JSON Schema
|
|
5293
|
-
}>
|
|
5294
|
-
knowledgeMap?: {
|
|
5295
|
-
nodeCount: number
|
|
5296
|
-
nodes: Array<{
|
|
5297
|
-
id: string
|
|
5298
|
-
description: string
|
|
5299
|
-
loaded: boolean
|
|
5300
|
-
hasPrompt: boolean
|
|
5301
|
-
}>
|
|
5302
|
-
}
|
|
5303
|
-
metricsConfig?: object
|
|
5304
|
-
interface?: SerializedExecutionInterface
|
|
5305
|
-
}
|
|
5306
|
-
|
|
5307
|
-
/**
|
|
5308
|
-
* Serialized workflow definition (JSON-safe)
|
|
5309
|
-
* Result of serializeDefinition(WorkflowDefinition)
|
|
5310
|
-
*/
|
|
5311
|
-
interface SerializedWorkflowDefinition {
|
|
5312
|
-
config: {
|
|
5313
|
-
resourceId: string
|
|
5314
|
-
name: string
|
|
5315
|
-
description: string
|
|
5316
|
-
version: string
|
|
5317
|
-
type: 'workflow'
|
|
5318
|
-
status: 'dev' | 'prod'
|
|
5319
|
-
/** Whether this resource is archived and should be excluded from registration and deployment */
|
|
5320
|
-
archived?: boolean
|
|
5321
|
-
}
|
|
5322
|
-
entryPoint: string
|
|
5323
|
-
steps: Array<{
|
|
5324
|
-
id: string
|
|
5325
|
-
name: string
|
|
5326
|
-
description: string
|
|
5327
|
-
inputSchema?: object // JSON Schema
|
|
5328
|
-
outputSchema?: object // JSON Schema
|
|
5329
|
-
next: {
|
|
5330
|
-
type: 'linear' | 'conditional'
|
|
5331
|
-
target?: string
|
|
5332
|
-
routes?: Array<{ target: string }>
|
|
5333
|
-
default?: string
|
|
5334
|
-
} | null
|
|
5335
|
-
}>
|
|
5336
|
-
contract: {
|
|
5337
|
-
inputSchema: object // JSON Schema
|
|
5338
|
-
outputSchema?: object // JSON Schema
|
|
5339
|
-
}
|
|
5340
|
-
metricsConfig?: object
|
|
5341
|
-
interface?: SerializedExecutionInterface
|
|
5342
|
-
}
|
|
5343
|
-
|
|
5344
|
-
/**
|
|
5345
|
-
* Agent timeline and observability types
|
|
5346
|
-
* Used for UI timeline visualization and backend processing
|
|
5347
|
-
*/
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
/**
|
|
5352
|
-
* Sub-activity within an iteration
|
|
5353
|
-
* Represents reasoning, actions, or tool calls with timing
|
|
5354
|
-
*/
|
|
5355
|
-
interface SubActivity {
|
|
5356
|
-
type: 'reasoning' | 'action' | 'tool-call'
|
|
5357
|
-
startTime: number
|
|
5358
|
-
endTime: number
|
|
5359
|
-
duration: number
|
|
5360
|
-
details: AgentIterationEvent | AgentToolCallEvent
|
|
5361
|
-
}
|
|
5362
|
-
|
|
5363
|
-
/**
|
|
5364
|
-
* Agent iteration state
|
|
5365
|
-
* Aggregates lifecycle events and sub-activities for a single iteration
|
|
5366
|
-
*/
|
|
5367
|
-
interface AgentIteration {
|
|
5368
|
-
iterationNumber: number
|
|
5369
|
-
status: 'running' | 'completed' | 'failed' | 'pending'
|
|
5370
|
-
iterationEvents: AgentIterationEvent[]
|
|
5371
|
-
duration?: number
|
|
5372
|
-
timestamp: number
|
|
5373
|
-
subActivities: SubActivity[]
|
|
5374
|
-
|
|
5375
|
-
// Timeline visualization timing (Phase 2 - optional for backward compatibility)
|
|
5376
|
-
startTime?: number // From lifecycle 'started' event
|
|
5377
|
-
endTime?: number // From lifecycle 'completed'/'failed' event
|
|
5378
|
-
}
|
|
5379
|
-
|
|
5380
|
-
/**
|
|
5381
|
-
* Agent lifecycle node state
|
|
5382
|
-
* Represents initialization or completion phase
|
|
5383
|
-
*/
|
|
5384
|
-
interface AgentLifecycleNode {
|
|
5385
|
-
type: 'initialization' | 'completion'
|
|
5386
|
-
status: 'running' | 'completed' | 'failed' | 'pending'
|
|
5387
|
-
duration?: number
|
|
5388
|
-
timestamp?: number
|
|
5389
|
-
|
|
5390
|
-
// Timeline visualization timing (Phase 2 - optional for backward compatibility)
|
|
5391
|
-
startTime?: number // From lifecycle 'started' event
|
|
5392
|
-
endTime?: number // From lifecycle 'completed'/'failed' event
|
|
5393
|
-
}
|
|
5394
|
-
|
|
5395
|
-
/**
|
|
5396
|
-
* Complete agent execution data for timeline visualization
|
|
5397
|
-
* Parsed from execution logs
|
|
5398
|
-
*/
|
|
5399
|
-
interface AgentIterationData {
|
|
5400
|
-
initialization: AgentLifecycleNode
|
|
5401
|
-
iterations: AgentIteration[]
|
|
5402
|
-
completion: AgentLifecycleNode
|
|
5403
|
-
currentIteration: number | null
|
|
5404
|
-
totalIterations: number
|
|
5405
|
-
totalDuration?: number
|
|
5406
|
-
status: 'running' | 'completed' | 'failed' | 'warning'
|
|
5407
|
-
}
|
|
5408
|
-
|
|
5409
|
-
// Execution status type shared between API and UI
|
|
5410
|
-
type ExecutionStatus = 'pending' | 'running' | 'completed' | 'failed' | 'warning'
|
|
5411
|
-
|
|
5412
|
-
/**
|
|
5413
|
-
* Event sent when new execution starts
|
|
5414
|
-
*/
|
|
5415
|
-
interface ExecutionStartedEvent {
|
|
5416
|
-
type: 'new-execution'
|
|
5417
|
-
resourceId: string
|
|
5418
|
-
executionId: string
|
|
5419
|
-
timestamp: number
|
|
5420
|
-
data?: undefined
|
|
5421
|
-
}
|
|
5422
|
-
|
|
5423
|
-
/**
|
|
5424
|
-
* Event sent when execution log message is emitted
|
|
5425
|
-
*/
|
|
5426
|
-
interface ExecutionLogEvent {
|
|
5427
|
-
type: 'log'
|
|
5428
|
-
resourceId: string
|
|
5429
|
-
executionId: string
|
|
5430
|
-
timestamp: number
|
|
5431
|
-
data: {
|
|
5432
|
-
log: ExecutionLogMessage
|
|
5433
|
-
}
|
|
5434
|
-
}
|
|
5435
|
-
|
|
5436
|
-
/**
|
|
5437
|
-
* Event sent when execution completes (success or failure)
|
|
5438
|
-
*/
|
|
5439
|
-
interface ExecutionCompleteEvent {
|
|
5440
|
-
type: 'execution-complete'
|
|
5441
|
-
resourceId: string
|
|
5442
|
-
executionId: string
|
|
5443
|
-
timestamp: number
|
|
5444
|
-
data: {
|
|
5445
|
-
success: boolean
|
|
5446
|
-
status?: ExecutionStatus
|
|
5447
|
-
result?: unknown
|
|
5448
|
-
error?: string
|
|
5449
|
-
}
|
|
5450
|
-
}
|
|
5451
|
-
|
|
5452
|
-
/**
|
|
5453
|
-
* Connection confirmation event
|
|
5454
|
-
*/
|
|
5455
|
-
interface ExecutionConnectedEvent {
|
|
5456
|
-
type: 'connected'
|
|
5457
|
-
resourceId: string
|
|
5458
|
-
executionId?: undefined
|
|
5459
|
-
timestamp: number
|
|
5460
|
-
data?: undefined
|
|
5461
|
-
}
|
|
5462
|
-
|
|
5463
|
-
/**
|
|
5464
|
-
* Union of all execution SSE events
|
|
5465
|
-
*/
|
|
5466
|
-
type ExecutionSSEEvent =
|
|
5467
|
-
| ExecutionStartedEvent
|
|
5468
|
-
| ExecutionLogEvent
|
|
5469
|
-
| ExecutionCompleteEvent
|
|
5470
|
-
| ExecutionConnectedEvent
|
|
5471
|
-
|
|
5472
|
-
// API execution types
|
|
5473
|
-
interface APIExecutionSummary {
|
|
5474
|
-
id: string
|
|
5475
|
-
status: ExecutionStatus
|
|
5476
|
-
startTime: number
|
|
5477
|
-
endTime?: number
|
|
5478
|
-
resourceStatus?: ResourceStatus // 'dev' | 'prod' - optional for backward compatibility
|
|
5479
|
-
}
|
|
5480
|
-
|
|
5481
|
-
/**
|
|
5482
|
-
* Execution Runner Types
|
|
5483
|
-
*
|
|
5484
|
-
* Shared types for the Execution Runner UI feature.
|
|
5485
|
-
* Used by both API (apps/api) and frontend (apps/command-center).
|
|
5486
|
-
*/
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5490
|
-
// ============================================================================
|
|
5491
|
-
// EXECUTION METRICS
|
|
5492
|
-
// ============================================================================
|
|
5493
|
-
|
|
5494
|
-
interface ExecutionMetrics {
|
|
5495
|
-
tokenCount?: number
|
|
5496
|
-
stepCount?: number
|
|
5497
|
-
toolCallCount?: number
|
|
5498
|
-
}
|
|
5499
|
-
|
|
5500
|
-
// ============================================================================
|
|
5501
|
-
// EXECUTION HISTORY TYPES
|
|
5502
|
-
// ============================================================================
|
|
5503
|
-
|
|
5504
|
-
interface ExecutionSummary {
|
|
5505
|
-
id: string
|
|
5506
|
-
resourceId: string
|
|
5507
|
-
resourceName: string
|
|
5508
|
-
status: ExecutionStatus
|
|
5509
|
-
startedAt: string
|
|
5510
|
-
completedAt?: string
|
|
5511
|
-
durationMs?: number
|
|
5512
|
-
metrics?: ExecutionMetrics
|
|
5513
|
-
input?: unknown
|
|
5514
|
-
output?: unknown
|
|
5515
|
-
error?: { message: string }
|
|
5516
|
-
}
|
|
5517
|
-
|
|
5518
|
-
/**
|
|
5519
|
-
* Execution history item.
|
|
5520
|
-
* Represents a single execution triggered by a schedule.
|
|
5521
|
-
*/
|
|
5522
|
-
declare const ExecutionHistoryItemSchema = z.object({
|
|
5523
|
-
id: z.string().uuid(),
|
|
5524
|
-
createdAt: z.string().datetime(),
|
|
5525
|
-
status: z.enum(['running', 'completed', 'failed', 'cancelled']),
|
|
5526
|
-
step: z.number().int().nullable(),
|
|
5527
|
-
itemLabel: z.string().nullable(),
|
|
5528
|
-
duration: z.number().nullable(), // milliseconds
|
|
5529
|
-
error: z.string().nullable()
|
|
5530
|
-
})
|
|
5531
|
-
|
|
5532
|
-
/**
|
|
5533
|
-
* Execution history response.
|
|
5534
|
-
* Returned by GET /schedules/:id/executions with pagination.
|
|
5535
|
-
*/
|
|
5536
|
-
declare const ExecutionHistoryResponseSchema = z.object({
|
|
5537
|
-
executions: z.array(ExecutionHistoryItemSchema),
|
|
5538
|
-
total: z.number().int(),
|
|
5539
|
-
limit: z.number().int(),
|
|
5540
|
-
offset: z.number().int()
|
|
5541
|
-
})
|
|
5542
|
-
type ExecutionHistoryItem = z.infer<typeof ExecutionHistoryItemSchema>
|
|
5543
|
-
type ExecutionHistoryResponse = z.infer<typeof ExecutionHistoryResponseSchema>
|
|
5544
|
-
|
|
5545
|
-
/**
|
|
5546
|
-
* Command Queue SSE Event Types
|
|
5547
|
-
*
|
|
5548
|
-
* Type-safe definitions for command queue related SSE events
|
|
5549
|
-
*/
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
/**
|
|
5554
|
-
* Event sent when command queue task is updated
|
|
5555
|
-
*/
|
|
5556
|
-
interface CommandQueueTaskUpdatedEvent {
|
|
5557
|
-
type: 'task_updated'
|
|
5558
|
-
timestamp: number
|
|
5559
|
-
data: {
|
|
5560
|
-
task: Task
|
|
5561
|
-
}
|
|
5562
|
-
}
|
|
5563
|
-
|
|
5564
|
-
/**
|
|
5565
|
-
* Connection confirmation event
|
|
5566
|
-
*/
|
|
5567
|
-
interface CommandQueueConnectedEvent {
|
|
5568
|
-
type: 'connected'
|
|
5569
|
-
timestamp: number
|
|
5570
|
-
data?: undefined
|
|
5571
|
-
}
|
|
5572
|
-
|
|
5573
|
-
/**
|
|
5574
|
-
* Event sent when action execution completes successfully
|
|
5575
|
-
*/
|
|
5576
|
-
interface CommandQueueExecutionCompletedEvent {
|
|
5577
|
-
type: 'execution_completed'
|
|
5578
|
-
timestamp: number
|
|
5579
|
-
data: {
|
|
5580
|
-
taskId: string
|
|
5581
|
-
targetExecutionId: string
|
|
5582
|
-
}
|
|
5583
|
-
}
|
|
5584
|
-
|
|
5585
|
-
/**
|
|
5586
|
-
* Event sent when action execution fails
|
|
5587
|
-
*/
|
|
5588
|
-
interface CommandQueueExecutionFailedEvent {
|
|
5589
|
-
type: 'execution_failed'
|
|
5590
|
-
timestamp: number
|
|
5591
|
-
data: {
|
|
5592
|
-
taskId: string
|
|
5593
|
-
targetExecutionId?: string
|
|
5594
|
-
error: string
|
|
5595
|
-
}
|
|
5596
|
-
}
|
|
5597
|
-
|
|
5598
|
-
/**
|
|
5599
|
-
* Union of all command queue SSE events
|
|
5600
|
-
*/
|
|
5601
|
-
type CommandQueueSSEEvent =
|
|
5602
|
-
| CommandQueueTaskUpdatedEvent
|
|
5603
|
-
| CommandQueueConnectedEvent
|
|
5604
|
-
| CommandQueueExecutionCompletedEvent
|
|
5605
|
-
| CommandQueueExecutionFailedEvent
|
|
5606
|
-
|
|
5607
|
-
/**
|
|
5608
|
-
* Notification SSE Event Types
|
|
5609
|
-
*
|
|
5610
|
-
* Type-safe definitions for notification-related SSE events
|
|
5611
|
-
*/
|
|
5612
|
-
|
|
5613
|
-
/**
|
|
5614
|
-
* Event sent when notification unread count changes
|
|
5615
|
-
*/
|
|
5616
|
-
interface NotificationCountUpdatedEvent {
|
|
5617
|
-
type: 'unread_count_updated'
|
|
5618
|
-
timestamp: number
|
|
5619
|
-
data: {
|
|
5620
|
-
count: number
|
|
5621
|
-
}
|
|
5622
|
-
}
|
|
5623
|
-
|
|
5624
|
-
/**
|
|
5625
|
-
* Union of all notification SSE events
|
|
5626
|
-
*/
|
|
5627
|
-
type NotificationSSEEvent = NotificationCountUpdatedEvent
|
|
5628
|
-
|
|
5629
|
-
type ActivityType =
|
|
5630
|
-
| 'workflow_execution'
|
|
5631
|
-
| 'agent_run'
|
|
5632
|
-
| 'hitl_action'
|
|
5633
|
-
| 'webhook_received'
|
|
5634
|
-
| 'webhook_executed'
|
|
5635
|
-
| 'webhook_failed'
|
|
5636
|
-
| 'credential_change'
|
|
5637
|
-
| 'api_key_change'
|
|
5638
|
-
| 'deployment_change'
|
|
5639
|
-
| 'membership_change'
|
|
5640
|
-
|
|
5641
|
-
type ActivityStatus = 'success' | 'failure' | 'pending' | 'approved' | 'rejected' | 'completed'
|
|
5642
|
-
|
|
5643
|
-
interface Activity {
|
|
5644
|
-
id: string
|
|
5645
|
-
organizationId: string
|
|
5646
|
-
activityType: ActivityType
|
|
5647
|
-
status: ActivityStatus
|
|
5648
|
-
title: string
|
|
5649
|
-
description: string | null
|
|
5650
|
-
entityType: string
|
|
5651
|
-
entityId: string
|
|
5652
|
-
entityName: string | null
|
|
5653
|
-
metadata: Record<string, unknown> | null
|
|
5654
|
-
actorId: string | null
|
|
5655
|
-
actorType: string | null
|
|
5656
|
-
occurredAt: Date
|
|
5657
|
-
createdAt: Date
|
|
5658
|
-
}
|
|
5659
|
-
|
|
5660
|
-
/**
|
|
5661
|
-
* Activity SSE Event Types
|
|
5662
|
-
*
|
|
5663
|
-
* Type-safe definitions for activity-related SSE events
|
|
5664
|
-
*/
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
/**
|
|
5669
|
-
* Event sent when new activity is created
|
|
5670
|
-
*/
|
|
5671
|
-
interface ActivityCreatedEvent {
|
|
5672
|
-
type: 'activity'
|
|
5673
|
-
timestamp: number
|
|
5674
|
-
data: Activity
|
|
5675
|
-
}
|
|
5676
|
-
|
|
5677
|
-
/**
|
|
5678
|
-
* Connection confirmation event
|
|
5679
|
-
*/
|
|
5680
|
-
interface ActivityConnectedEvent {
|
|
5681
|
-
type: 'connected'
|
|
5682
|
-
timestamp: number
|
|
5683
|
-
data?: undefined
|
|
5684
|
-
}
|
|
5685
|
-
|
|
5686
|
-
/**
|
|
5687
|
-
* Union of all activity SSE events
|
|
5688
|
-
*/
|
|
5689
|
-
type ActivitySSEEvent = ActivityCreatedEvent | ActivityConnectedEvent
|
|
5690
|
-
|
|
5691
|
-
/**
|
|
5692
|
-
* Webhook Endpoint Domain Types
|
|
5693
|
-
*
|
|
5694
|
-
* Browser-safe domain types for generic inbound webhook endpoints.
|
|
5695
|
-
* These are camelCase representations of the `webhook_endpoints` DB table.
|
|
5696
|
-
*
|
|
5697
|
-
* Transform from snake_case DB rows happens in the API service layer,
|
|
5698
|
-
* not here (per core-package.md conventions).
|
|
5699
|
-
*/
|
|
5700
|
-
|
|
5701
|
-
/**
|
|
5702
|
-
* Lifecycle status of a webhook endpoint.
|
|
5703
|
-
* - `active`: Endpoint accepts inbound requests and triggers the target workflow
|
|
5704
|
-
* - `paused`: Endpoint exists but rejects inbound requests with 404
|
|
5705
|
-
*/
|
|
5706
|
-
type WebhookEndpointStatus = 'active' | 'paused'
|
|
5707
|
-
|
|
5708
|
-
/**
|
|
5709
|
-
* Generic inbound webhook endpoint domain type.
|
|
5710
|
-
*
|
|
5711
|
-
* Each endpoint gets a unique opaque URL (`/api/webhooks/inbound/:key`)
|
|
5712
|
-
* that maps to a target workflow resource within an organization.
|
|
5713
|
-
*/
|
|
5714
|
-
interface WebhookEndpoint {
|
|
5715
|
-
/** UUID primary key */
|
|
5716
|
-
id: string
|
|
5717
|
-
/** Organization this endpoint belongs to */
|
|
5718
|
-
organizationId: string
|
|
5719
|
-
/**
|
|
5720
|
-
* Unique opaque key used in the inbound URL.
|
|
5721
|
-
* Format: `wh_` + 32 crypto-random hex chars (128 bits of entropy).
|
|
5722
|
-
* This key IS the credential — it must be kept secret.
|
|
5723
|
-
*/
|
|
5724
|
-
key: string
|
|
5725
|
-
/** User-facing label (e.g., "Zapier → Lead Intake") */
|
|
5726
|
-
name: string
|
|
5727
|
-
/** Optional description for the endpoint */
|
|
5728
|
-
description: string | null
|
|
5729
|
-
/** Target workflow resourceId to invoke on inbound request, or null if not yet assigned */
|
|
5730
|
-
resourceId: string | null
|
|
5731
|
-
/** Whether the endpoint is accepting requests */
|
|
5732
|
-
status: WebhookEndpointStatus
|
|
5733
|
-
/** Timestamp of the most recent successful inbound request, or null */
|
|
5734
|
-
lastTriggeredAt: string | null
|
|
5735
|
-
/** Running total of inbound requests received */
|
|
5736
|
-
requestCount: number
|
|
5737
|
-
/** ISO 8601 creation timestamp */
|
|
5738
|
-
createdAt: string
|
|
5739
|
-
/** ISO 8601 last-updated timestamp */
|
|
5740
|
-
updatedAt: string
|
|
5741
|
-
}
|
|
5742
|
-
|
|
5743
|
-
/**
|
|
5744
|
-
* POST /api/webhook-endpoints - Create a new webhook endpoint
|
|
5745
|
-
*
|
|
5746
|
-
* The `key` and `id` are generated server-side and not accepted in the request.
|
|
5747
|
-
*/
|
|
5748
|
-
declare const CreateWebhookEndpointRequestSchema = z
|
|
5749
|
-
.object({
|
|
5750
|
-
/** User-facing label for the endpoint */
|
|
5751
|
-
name: NonEmptyStringSchema,
|
|
5752
|
-
/** Target workflow resourceId to invoke on inbound requests (can be set later) */
|
|
5753
|
-
resourceId: NonEmptyStringSchema.optional(),
|
|
5754
|
-
/** Optional description */
|
|
5755
|
-
description: z.string().optional()
|
|
5756
|
-
})
|
|
5757
|
-
.strict()
|
|
5758
|
-
|
|
5759
|
-
type CreateWebhookEndpointRequest = z.infer<typeof CreateWebhookEndpointRequestSchema>
|
|
5760
|
-
|
|
5761
|
-
/**
|
|
5762
|
-
* PATCH /api/webhook-endpoints/:id - Update an existing webhook endpoint
|
|
5763
|
-
*
|
|
5764
|
-
* At least one field must be provided.
|
|
5765
|
-
*/
|
|
5766
|
-
declare const UpdateWebhookEndpointRequestSchema = z
|
|
5767
|
-
.object({
|
|
5768
|
-
name: NonEmptyStringSchema.optional(),
|
|
5769
|
-
description: z.string().optional(),
|
|
5770
|
-
resourceId: NonEmptyStringSchema.optional(),
|
|
5771
|
-
status: WebhookEndpointStatusSchema.optional()
|
|
5772
|
-
})
|
|
5773
|
-
.strict()
|
|
5774
|
-
.refine(
|
|
5775
|
-
(data) =>
|
|
5776
|
-
data.name !== undefined ||
|
|
5777
|
-
data.description !== undefined ||
|
|
5778
|
-
data.resourceId !== undefined ||
|
|
5779
|
-
data.status !== undefined,
|
|
5780
|
-
{ message: 'At least one field (name, description, resourceId, or status) must be provided' }
|
|
5781
|
-
)
|
|
5782
|
-
|
|
5783
|
-
type UpdateWebhookEndpointRequest = z.infer<typeof UpdateWebhookEndpointRequestSchema>
|
|
5784
|
-
|
|
5785
|
-
/**
|
|
5786
|
-
* Response shape for a single webhook endpoint.
|
|
5787
|
-
* NOT strict — response schemas allow extra fields for forward compatibility.
|
|
5788
|
-
*/
|
|
5789
|
-
declare const WebhookEndpointResponseSchema = z.object({
|
|
5790
|
-
id: UuidSchema,
|
|
5791
|
-
organizationId: UuidSchema,
|
|
5792
|
-
key: z.string(),
|
|
5793
|
-
name: z.string(),
|
|
5794
|
-
description: z.string().nullable(),
|
|
5795
|
-
resourceId: z.string().nullable(),
|
|
5796
|
-
status: WebhookEndpointStatusSchema,
|
|
5797
|
-
lastTriggeredAt: z.string().datetime().nullable(),
|
|
5798
|
-
requestCount: z.number().int().min(0),
|
|
5799
|
-
createdAt: z.string().datetime(),
|
|
5800
|
-
updatedAt: z.string().datetime()
|
|
5801
|
-
})
|
|
5802
|
-
|
|
5803
|
-
type WebhookEndpointResponse = z.infer<typeof WebhookEndpointResponseSchema>
|
|
5804
|
-
|
|
5805
|
-
/**
|
|
5806
|
-
* GET /api/credentials - List credentials
|
|
5807
|
-
*/
|
|
5808
|
-
declare const ListCredentialsResponseSchema = z.object({
|
|
5809
|
-
credentials: z.array(
|
|
5810
|
-
z.object({
|
|
5811
|
-
id: UuidSchema,
|
|
5812
|
-
name: z.string(),
|
|
5813
|
-
type: z.string(),
|
|
5814
|
-
provider: z.string().nullable(), // OAuth provider or null for non-OAuth
|
|
5815
|
-
createdAt: z.string().datetime()
|
|
5816
|
-
})
|
|
5817
|
-
)
|
|
5818
|
-
})
|
|
5819
|
-
|
|
5820
|
-
/** API response type for a single credential list item */
|
|
5822
|
+
/**
|
|
5823
|
+
* GET /api/credentials - List credentials
|
|
5824
|
+
*/
|
|
5825
|
+
declare const ListCredentialsResponseSchema = z.object({
|
|
5826
|
+
credentials: z.array(
|
|
5827
|
+
z.object({
|
|
5828
|
+
id: UuidSchema,
|
|
5829
|
+
name: z.string(),
|
|
5830
|
+
type: z.string(),
|
|
5831
|
+
provider: z.string().nullable(), // OAuth provider or null for non-OAuth
|
|
5832
|
+
createdAt: z.string().datetime()
|
|
5833
|
+
})
|
|
5834
|
+
)
|
|
5835
|
+
})
|
|
5836
|
+
|
|
5837
|
+
/** API response type for a single credential list item */
|
|
5821
5838
|
type CredentialListItem = z.infer<typeof ListCredentialsResponseSchema>['credentials'][number]
|
|
5822
5839
|
|
|
5823
|
-
/**
|
|
5824
|
-
* @deprecated Use TimeRange from '@repo/core' directly. Kept as alias for backward compatibility.
|
|
5825
|
-
*/
|
|
5826
|
-
type StatsTimeRange = TimeRange
|
|
5827
|
-
|
|
5828
|
-
/** Stats returned by /command-view/stats (counts only, no error details) */
|
|
5829
|
-
interface ResourceStats {
|
|
5830
|
-
resourceId: string
|
|
5831
|
-
totalRuns: number
|
|
5832
|
-
successCount: number
|
|
5833
|
-
failureCount: number // Used for badge: "X failed"
|
|
5834
|
-
warningCount: number // Completed with warnings (counts toward success)
|
|
5835
|
-
lastRunAt: string | null
|
|
5836
|
-
// NO recentErrors or totalErrors - fetched on-demand via /resource-errors
|
|
5837
|
-
}
|
|
5838
|
-
|
|
5839
|
-
/** Response from /command-view/resource-errors (on-demand) */
|
|
5840
|
-
interface ResourceErrorsResponse {
|
|
5841
|
-
resourceId: string
|
|
5842
|
-
errors: ErrorSummary[]
|
|
5843
|
-
totalErrors: number // Total count for "showing 10 of X" display
|
|
5844
|
-
timeRange: StatsTimeRange
|
|
5845
|
-
}
|
|
5846
|
-
|
|
5847
|
-
interface ErrorSummary {
|
|
5848
|
-
executionId: string
|
|
5849
|
-
errorType: string
|
|
5850
|
-
errorMessage: string
|
|
5851
|
-
occurredAt: string
|
|
5852
|
-
}
|
|
5853
|
-
|
|
5854
|
-
/** Single execution summary for Recent Executions list in command view */
|
|
5855
|
-
interface CommandViewExecution {
|
|
5856
|
-
executionId: string
|
|
5857
|
-
status: ExecutionStatus
|
|
5858
|
-
startedAt: string
|
|
5859
|
-
completedAt: string | null
|
|
5860
|
-
errorMessage: string | null // Only present if failed
|
|
5861
|
-
}
|
|
5862
|
-
|
|
5863
|
-
/** Response from /command-view/resource-executions (on-demand) */
|
|
5864
|
-
interface ResourceExecutionsResponse {
|
|
5865
|
-
resourceId: string
|
|
5866
|
-
executions: CommandViewExecution[]
|
|
5867
|
-
totalExecutions: number // Total count for "showing 10 of X" display
|
|
5868
|
-
timeRange: StatsTimeRange
|
|
5869
|
-
}
|
|
5870
|
-
|
|
5871
|
-
interface HumanCheckpointStats {
|
|
5872
|
-
checkpointId: string
|
|
5873
|
-
pendingCount: number
|
|
5874
|
-
completedCount: number
|
|
5875
|
-
expiredCount: number
|
|
5876
|
-
lastDecisionAt: string | null
|
|
5877
|
-
}
|
|
5878
|
-
|
|
5879
|
-
/** Response from /command-view/stats */
|
|
5880
|
-
interface CommandViewStatsResponse {
|
|
5881
|
-
resources: Record<string, ResourceStats>
|
|
5882
|
-
humanCheckpoints: Record<string, HumanCheckpointStats>
|
|
5883
|
-
timeRange: StatsTimeRange
|
|
5884
|
-
generatedAt: string
|
|
5885
|
-
}
|
|
5886
|
-
|
|
5887
|
-
export type { AIResourceDefinition, APIExecutionDetail, APIExecutionListResponse, APIExecutionSummary, AbsoluteScheduleConfig, AbsoluteScheduleItem, ActionConfig, Activity, ActivitySSEEvent, ActivityStatus, ActivityType, AgentIterationData, AgentMemory, ApiKeyListItem, BusinessImpactMetrics, ChatMessage, CheckpointListResponse, CommandQueueSSEEvent, CommandViewAgent, CommandViewData, CommandViewNode, CommandViewNodeType, CommandViewStatsResponse, CommandViewWorkflow, CostBreakdownMetrics, CostByModelResponse, CostSummaryResponse, CostTrendsResponse, CreateWebhookEndpointRequest, CredentialListItem, DashboardMetrics, DealListItem, DealStage, Deployment, DeploymentStatus, DomainDefinition, ErrorAnalysisMetrics, ErrorDetailFull, ErrorDetailResponse, ErrorTrend, ExecutionHealthMetrics, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogMessage, ExecutionMetricsDetail, ExecutionSSEEvent, ExecutionStatus$1 as ExecutionStatus, ExecutionSummary, FailingResource, HumanCheckpointDefinition, HumanCheckpointStats, KanbanBoardConfig, ListMembershipsParams, MembershipFeatureConfig, MembershipStatus, MembershipWithDetails, MessageEvent, MessageType, ModelConfig, NotificationDTO, NotificationSSEEvent, PatchTaskParams, QueueTaskStatus, RecentExecutionsByResourceResponse, RecurringScheduleConfig, RelativeScheduleConfig, RelativeScheduleItem, ResourceDefinition$1 as ResourceDefinition, ResourceDomain, ResourceErrorsResponse, ResourceExecutionSummary, ResourceExecutionsResponse, ResourceHealth, ResourceIdentifier, ResourceStats, ResourceStatus$1 as ResourceStatus, ResourceType$1 as ResourceType, ResourcesHealthResponse, SerializedAgentDefinition, SerializedExecutionInterface, SerializedWorkflowDefinition, SessionDTO, SessionTokenUsage, StatsTimeRange, SupabaseUserProfile, Task, TaskSchedule, TaskScheduleConfig, TimeRange, WorkflowNodeVisualizerData as TimelineData, UpdateWebhookEndpointRequest, UserConfig, WebhookEndpoint, WebhookEndpointResponse };
|
|
5840
|
+
/**
|
|
5841
|
+
* @deprecated Use TimeRange from '@repo/core' directly. Kept as alias for backward compatibility.
|
|
5842
|
+
*/
|
|
5843
|
+
type StatsTimeRange = TimeRange
|
|
5844
|
+
|
|
5845
|
+
/** Stats returned by /command-view/stats (counts only, no error details) */
|
|
5846
|
+
interface ResourceStats {
|
|
5847
|
+
resourceId: string
|
|
5848
|
+
totalRuns: number
|
|
5849
|
+
successCount: number
|
|
5850
|
+
failureCount: number // Used for badge: "X failed"
|
|
5851
|
+
warningCount: number // Completed with warnings (counts toward success)
|
|
5852
|
+
lastRunAt: string | null
|
|
5853
|
+
// NO recentErrors or totalErrors - fetched on-demand via /resource-errors
|
|
5854
|
+
}
|
|
5855
|
+
|
|
5856
|
+
/** Response from /command-view/resource-errors (on-demand) */
|
|
5857
|
+
interface ResourceErrorsResponse {
|
|
5858
|
+
resourceId: string
|
|
5859
|
+
errors: ErrorSummary[]
|
|
5860
|
+
totalErrors: number // Total count for "showing 10 of X" display
|
|
5861
|
+
timeRange: StatsTimeRange
|
|
5862
|
+
}
|
|
5863
|
+
|
|
5864
|
+
interface ErrorSummary {
|
|
5865
|
+
executionId: string
|
|
5866
|
+
errorType: string
|
|
5867
|
+
errorMessage: string
|
|
5868
|
+
occurredAt: string
|
|
5869
|
+
}
|
|
5870
|
+
|
|
5871
|
+
/** Single execution summary for Recent Executions list in command view */
|
|
5872
|
+
interface CommandViewExecution {
|
|
5873
|
+
executionId: string
|
|
5874
|
+
status: ExecutionStatus
|
|
5875
|
+
startedAt: string
|
|
5876
|
+
completedAt: string | null
|
|
5877
|
+
errorMessage: string | null // Only present if failed
|
|
5878
|
+
}
|
|
5879
|
+
|
|
5880
|
+
/** Response from /command-view/resource-executions (on-demand) */
|
|
5881
|
+
interface ResourceExecutionsResponse {
|
|
5882
|
+
resourceId: string
|
|
5883
|
+
executions: CommandViewExecution[]
|
|
5884
|
+
totalExecutions: number // Total count for "showing 10 of X" display
|
|
5885
|
+
timeRange: StatsTimeRange
|
|
5886
|
+
}
|
|
5887
|
+
|
|
5888
|
+
interface HumanCheckpointStats {
|
|
5889
|
+
checkpointId: string
|
|
5890
|
+
pendingCount: number
|
|
5891
|
+
completedCount: number
|
|
5892
|
+
expiredCount: number
|
|
5893
|
+
lastDecisionAt: string | null
|
|
5894
|
+
}
|
|
5895
|
+
|
|
5896
|
+
/** Response from /command-view/stats */
|
|
5897
|
+
interface CommandViewStatsResponse {
|
|
5898
|
+
resources: Record<string, ResourceStats>
|
|
5899
|
+
humanCheckpoints: Record<string, HumanCheckpointStats>
|
|
5900
|
+
timeRange: StatsTimeRange
|
|
5901
|
+
generatedAt: string
|
|
5902
|
+
}
|
|
5903
|
+
|
|
5904
|
+
export type { AIResourceDefinition, APIExecutionDetail, APIExecutionListResponse, APIExecutionSummary, AbsoluteScheduleConfig, AbsoluteScheduleItem, ActionConfig, Activity, ActivitySSEEvent, ActivityStatus, ActivityType, AgentIterationData, AgentMemory, ApiKeyListItem, BusinessImpactMetrics, ChatMessage, CheckpointListResponse, CommandQueueSSEEvent, CommandViewAgent, CommandViewData, CommandViewNode, CommandViewNodeType, CommandViewStatsResponse, CommandViewWorkflow, CostBreakdownMetrics, CostByModelResponse, CostSummaryResponse, CostTrendsResponse, CreateWebhookEndpointRequest, CredentialListItem, DashboardMetrics, DealListItem, DealStage, Deployment, DeploymentStatus, DomainDefinition, ErrorAnalysisMetrics, ErrorDetailFull, ErrorDetailResponse, ErrorTrend, ExecutionHealthMetrics, ExecutionHistoryItem, ExecutionHistoryResponse, ExecutionLogMessage, ExecutionMetricsDetail, ExecutionRunnerCatalogItem, ExecutionSSEEvent, ExecutionStatus$1 as ExecutionStatus, ExecutionSummary, FailingResource, HumanCheckpointDefinition, HumanCheckpointStats, KanbanBoardConfig, ListMembershipsParams, MembershipFeatureConfig, MembershipStatus, MembershipWithDetails, MessageEvent, MessageType, ModelConfig, NotificationDTO, NotificationSSEEvent, PatchTaskParams, QueueTaskStatus, RecentExecutionsByResourceResponse, RecurringScheduleConfig, RelativeScheduleConfig, RelativeScheduleItem, ResourceDefinition$1 as ResourceDefinition, ResourceDomain, ResourceErrorsResponse, ResourceExecutionSummary, ResourceExecutionsResponse, ResourceHealth, ResourceIdentifier, ResourceStats, ResourceStatus$1 as ResourceStatus, ResourceType$1 as ResourceType, ResourcesHealthResponse, SerializedAgentDefinition, SerializedExecutionInterface, SerializedWorkflowDefinition, SessionDTO, SessionTokenUsage, StatsTimeRange, SupabaseUserProfile, Task, TaskSchedule, TaskScheduleConfig, TimeRange, WorkflowNodeVisualizerData as TimelineData, UpdateWebhookEndpointRequest, UserConfig, WebhookEndpoint, WebhookEndpointResponse };
|