@swiss-ai-hub/web 0.318.0 → 0.320.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.
@@ -355,6 +355,7 @@ export type AgentClassDto = {
355
355
  | Checkbox
356
356
  | ChipsInput
357
357
  | ColorPicker
358
+ | CronInput
358
359
  | DatePicker
359
360
  | Group
360
361
  | IconSelector
@@ -419,6 +420,12 @@ export type AgentClassDto = {
419
420
  * Whether the agent class can participate in a chat-based conversation
420
421
  */
421
422
  is_conversational: boolean;
423
+ /**
424
+ * Is Schedulable
425
+ *
426
+ * Whether the agent class can be run automatically on a cron schedule
427
+ */
428
+ is_schedulable?: boolean;
422
429
  /**
423
430
  * Is Online
424
431
  *
@@ -482,6 +489,7 @@ export type AgentConfigDto = {
482
489
  | Checkbox
483
490
  | ChipsInput
484
491
  | ColorPicker
492
+ | CronInput
485
493
  | DatePicker
486
494
  | Group
487
495
  | IconSelector
@@ -2784,10 +2792,7 @@ export type ChatCompletionRequest = {
2784
2792
  * Function Call
2785
2793
  */
2786
2794
  function_call?:
2787
- | "none"
2788
- | "auto"
2789
- | ChatCompletionFunctionCallOptionParam
2790
- | null;
2795
+ "none" | "auto" | ChatCompletionFunctionCallOptionParam | null;
2791
2796
  /**
2792
2797
  * Functions
2793
2798
  */
@@ -2832,13 +2837,7 @@ export type ChatCompletionRequest = {
2832
2837
  * Reasoning Effort
2833
2838
  */
2834
2839
  reasoning_effort?:
2835
- | "none"
2836
- | "minimal"
2837
- | "low"
2838
- | "medium"
2839
- | "high"
2840
- | "xhigh"
2841
- | null;
2840
+ "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null;
2842
2841
  /**
2843
2842
  * Response Format
2844
2843
  */
@@ -3303,11 +3302,7 @@ export type Choice = {
3303
3302
  * Finish Reason
3304
3303
  */
3305
3304
  finish_reason:
3306
- | "stop"
3307
- | "length"
3308
- | "tool_calls"
3309
- | "content_filter"
3310
- | "function_call";
3305
+ "stop" | "length" | "tool_calls" | "content_filter" | "function_call";
3311
3306
  /**
3312
3307
  * Index
3313
3308
  */
@@ -3850,6 +3845,7 @@ export type ContextualizedAgentEvent = {
3850
3845
  | ToolEvent
3851
3846
  | UserMessageEvent
3852
3847
  | RagStartEvent
3848
+ | CronStartEvent
3853
3849
  | ExceptionEvent
3854
3850
  | RagSuccessStopEvent
3855
3851
  | RagFailureStopEvent
@@ -3873,7 +3869,8 @@ export type ContextualizedAgentEvent = {
3873
3869
  | UnreadMailListedEvent
3874
3870
  | MailFetchedEvent
3875
3871
  | MailMovedEvent
3876
- | MailBatchDraftedEvent;
3872
+ | MailBatchDraftedEvent
3873
+ | MailBatchClassifiedEvent;
3877
3874
  };
3878
3875
 
3879
3876
  /**
@@ -4141,6 +4138,208 @@ export type CreateTokenResponse = {
4141
4138
  token: string;
4142
4139
  };
4143
4140
 
4141
+ /**
4142
+ * CronInput
4143
+ *
4144
+ * A FormKit element for editing the cron schedule of a schedulable agent profile.
4145
+ *
4146
+ * The element renders the five cron positions plus a timezone selector, and the submitted value
4147
+ * matches the fields of `CronSchedule`:
4148
+ * {
4149
+ * "minute": str,
4150
+ * "hour": str,
4151
+ * "day_of_month": str,
4152
+ * "month": str,
4153
+ * "day_of_week": str,
4154
+ * "timezone": str,
4155
+ * }
4156
+ *
4157
+ * Presets and the plain-language summary of the current schedule are delivered by the Admin UI
4158
+ * (see the cron schedule configuration UI issue); this element only declares the contract.
4159
+ *
4160
+ * ### Form Duality
4161
+ * ```python
4162
+ * from swiss_ai_hub.core.form.elements.cron_input import CronInput
4163
+ * from swiss_ai_hub.core.scheduling.cron_schedule import CronSchedule
4164
+ *
4165
+ * class MyAgentConfig(AgentConfig):
4166
+ * schedule: Annotated[
4167
+ * CronSchedule | CronInput | None,
4168
+ * Field(description="When this profile runs automatically"),
4169
+ * ] = None
4170
+ *
4171
+ * # Form mode - for rendering:
4172
+ * config = MyAgentConfig(schedule=CronInput(label=LocaleString(en="Schedule")))
4173
+ *
4174
+ * # Data mode - from submission (Pydantic validates into CronSchedule):
4175
+ * config = MyAgentConfig(schedule=CronSchedule(hour="12", timezone="Europe/Zurich"))
4176
+ * ```
4177
+ */
4178
+ export type CronInput = {
4179
+ /**
4180
+ * Is Formkit Element
4181
+ *
4182
+ * Indicates that this element is a FormKit element
4183
+ */
4184
+ is_formkit_element?: true;
4185
+ /**
4186
+ * If
4187
+ *
4188
+ * Conditional expression to show this element
4189
+ */
4190
+ if?: string | null;
4191
+ /**
4192
+ * Id
4193
+ *
4194
+ * Unique identifier for this element
4195
+ */
4196
+ id?: string | null;
4197
+ /**
4198
+ * Nullable
4199
+ *
4200
+ * Render with a sibling toggle that sets this field to null when off
4201
+ */
4202
+ nullable?: boolean;
4203
+ /**
4204
+ * Defaultenabled
4205
+ *
4206
+ * For a nullable element, whether its toggle should start enabled on a fresh form (i.e. the field's data default is non-null). Ignored for non-nullable elements.
4207
+ */
4208
+ defaultEnabled?: boolean | null;
4209
+ /**
4210
+ * Formkit
4211
+ *
4212
+ * Cron schedule input element.
4213
+ */
4214
+ formkit?: "cronInput";
4215
+ /**
4216
+ * Name
4217
+ *
4218
+ * Name of this field
4219
+ */
4220
+ name?: string | null;
4221
+ /**
4222
+ * Label
4223
+ *
4224
+ * Label of this field
4225
+ */
4226
+ label: LocaleString | string;
4227
+ /**
4228
+ * Help
4229
+ *
4230
+ * Help text of this field
4231
+ */
4232
+ help?: LocaleString | string | null;
4233
+ /**
4234
+ * Value
4235
+ *
4236
+ * Default value for this field
4237
+ */
4238
+ value?:
4239
+ | string
4240
+ | number
4241
+ | number
4242
+ | boolean
4243
+ | Array<string>
4244
+ | {
4245
+ [key: string]: string;
4246
+ }
4247
+ | null;
4248
+ /**
4249
+ * Required
4250
+ *
4251
+ * Whether this field is required
4252
+ */
4253
+ required?: boolean;
4254
+ /**
4255
+ * Additional Validation Rules
4256
+ *
4257
+ * Validation expression
4258
+ */
4259
+ additional_validation_rules?: string | null;
4260
+ /**
4261
+ * Timezoneplaceholder
4262
+ *
4263
+ * Placeholder for the timezone select
4264
+ */
4265
+ timezonePlaceholder?: LocaleString | string | null;
4266
+ /**
4267
+ * Filter
4268
+ *
4269
+ * Whether to enable filtering/search on the timezone select
4270
+ */
4271
+ filter?: boolean;
4272
+ /**
4273
+ * Validation
4274
+ */
4275
+ readonly validation: string;
4276
+ [key: string]: unknown;
4277
+ };
4278
+
4279
+ /**
4280
+ * CronStartEvent
4281
+ *
4282
+ * Start event fired by the cron scheduler — handling it is what makes an agent schedulable.
4283
+ *
4284
+ * Mirrors how accepting a `UserMessageEvent` makes an agent conversational: `AgentRunner` derives
4285
+ * `is_schedulable` from the start events an agent declares, so a blueprint opts in by adding a step
4286
+ * that consumes this event, with no separate registration.
4287
+ *
4288
+ * Scheduled runs are system runs, so `user` is always None and the agent must not depend on an
4289
+ * initiating identity. Whatever tenant context the agent needs comes from its own profile
4290
+ * configuration (as `OrgMemoryWriteConfig.tenant_id` already does), never from the run.
4291
+ */
4292
+ export type CronStartEvent = {
4293
+ /**
4294
+ * Event Id
4295
+ */
4296
+ event_id?: string;
4297
+ /**
4298
+ * Created At
4299
+ *
4300
+ * The time (in ns since epoch) the event was stored in the event store
4301
+ */
4302
+ created_at?: number;
4303
+ /**
4304
+ * Display name for the event
4305
+ */
4306
+ display_name?: LocaleString | null;
4307
+ /**
4308
+ * Display description for the event
4309
+ */
4310
+ display_description?: LocaleString | null;
4311
+ /**
4312
+ * Locale
4313
+ *
4314
+ * The locale the scheduled run reports its display output in.
4315
+ */
4316
+ locale?: string;
4317
+ /**
4318
+ * Always None — scheduled runs are system-initiated and carry no execution identity.
4319
+ */
4320
+ user?: UserIdentity | null;
4321
+ /**
4322
+ * Scheduled For
4323
+ *
4324
+ * The cron occurrence this run fires for, in UTC. Distinct from `created_at`, which records when the scheduler published the event — the two differ by the scheduler's tick latency.
4325
+ */
4326
+ scheduled_for: Date;
4327
+ /**
4328
+ * Event Name
4329
+ *
4330
+ * The event type name, usually the class name. If unknown, uses _unknown_event_name.
4331
+ * Used during deserialization to decide which subclass to instantiate.
4332
+ */
4333
+ readonly _event_name: string;
4334
+ /**
4335
+ * Parent Event Names
4336
+ *
4337
+ * Contains the names of all parent classes up until BaseEvent, ordered from deepest to least deep inheritance.
4338
+ */
4339
+ readonly _parent_event_names: Array<string>;
4340
+ [key: string]: unknown;
4341
+ };
4342
+
4144
4343
  /**
4145
4344
  * Custom
4146
4345
  *
@@ -5022,9 +5221,15 @@ export type DraftedReplyRef = {
5022
5221
  /**
5023
5222
  * Source Uid
5024
5223
  *
5025
- * IMAP UID of the source message within the source folder.
5224
+ * IMAP UID the source message had in the folder it was read from. A blueprint that files the message before drafting (EmailClassificationAgent) reports the pre-move UID, which no longer resolves on the server — it identifies the message within the run, not for a later fetch.
5026
5225
  */
5027
5226
  source_uid: string;
5227
+ /**
5228
+ * Category
5229
+ *
5230
+ * Category the source message was classified under, when drafting followed a classification run. Null when the drafting blueprint does not classify.
5231
+ */
5232
+ category?: string | null;
5028
5233
  /**
5029
5234
  * Drafts Folder
5030
5235
  *
@@ -5638,6 +5843,12 @@ export type FullAgentInstanceDto = {
5638
5843
  * Whether the agent can participate in a chat-based conversation
5639
5844
  */
5640
5845
  is_conversational: boolean;
5846
+ /**
5847
+ * Is Schedulable
5848
+ *
5849
+ * Whether the agent can be run automatically on a cron schedule
5850
+ */
5851
+ is_schedulable?: boolean;
5641
5852
  /**
5642
5853
  * Start Events
5643
5854
  *
@@ -5749,6 +5960,7 @@ export type FullProcessInstanceDto = {
5749
5960
  | Checkbox
5750
5961
  | ChipsInput
5751
5962
  | ColorPicker
5963
+ | CronInput
5752
5964
  | DatePicker
5753
5965
  | Group
5754
5966
  | IconSelector
@@ -5935,6 +6147,7 @@ export type Group = {
5935
6147
  | Checkbox
5936
6148
  | ChipsInput
5937
6149
  | ColorPicker
6150
+ | CronInput
5938
6151
  | DatePicker
5939
6152
  | Group
5940
6153
  | IconSelector
@@ -6290,6 +6503,7 @@ export type HumanInDto = {
6290
6503
  | Checkbox
6291
6504
  | ChipsInput
6292
6505
  | ColorPicker
6506
+ | CronInput
6293
6507
  | DatePicker
6294
6508
  | Group
6295
6509
  | IconSelector
@@ -6370,6 +6584,7 @@ export type HumanInSpecs = {
6370
6584
  | Checkbox
6371
6585
  | ChipsInput
6372
6586
  | ColorPicker
6587
+ | CronInput
6373
6588
  | DatePicker
6374
6589
  | Group
6375
6590
  | IconSelector
@@ -8551,6 +8766,18 @@ export type LlmCostEvent = {
8551
8766
  * The name of the LLM service (e.g., 'openai/gpt-4') this event pertains to.
8552
8767
  */
8553
8768
  llm_name: string;
8769
+ /**
8770
+ * User Id
8771
+ *
8772
+ * Invoking user, so spend is queryable per user. None for runs with no user context.
8773
+ */
8774
+ user_id?: string | null;
8775
+ /**
8776
+ * Tenant Id
8777
+ *
8778
+ * Acting tenant, so spend is queryable per tenant. None for sysadmins and system runs.
8779
+ */
8780
+ tenant_id?: string | null;
8554
8781
  /**
8555
8782
  * Event Name
8556
8783
  *
@@ -8689,6 +8916,59 @@ export type LlmEvent = {
8689
8916
  [key: string]: unknown;
8690
8917
  };
8691
8918
 
8919
+ /**
8920
+ * LLMSpend
8921
+ *
8922
+ * LLM spend aggregated over one attribution key (a user or a tenant).
8923
+ *
8924
+ * Costs come from the platform's own `LLMCostEvent` records rather than from LiteLLM's spend log:
8925
+ * the gateway can only attribute the user, so the tenant dimension exists here alone (see #1451).
8926
+ */
8927
+ export type LlmSpend = {
8928
+ /**
8929
+ * User Id
8930
+ *
8931
+ * Invoking user, None when grouping by tenant.
8932
+ */
8933
+ user_id?: string | null;
8934
+ /**
8935
+ * Tenant Id
8936
+ *
8937
+ * Acting tenant, None for runs outside a tenant.
8938
+ */
8939
+ tenant_id?: string | null;
8940
+ /**
8941
+ * Calls
8942
+ *
8943
+ * Number of LLM calls attributed to this key.
8944
+ */
8945
+ calls?: number;
8946
+ /**
8947
+ * Prompt Tokens Costs
8948
+ *
8949
+ * Cost of prompt tokens.
8950
+ */
8951
+ prompt_tokens_costs?: number;
8952
+ /**
8953
+ * Completion Tokens Costs
8954
+ *
8955
+ * Cost of completion tokens.
8956
+ */
8957
+ completion_tokens_costs?: number;
8958
+ /**
8959
+ * Embedding Tokens Costs
8960
+ *
8961
+ * Cost of embedding tokens.
8962
+ */
8963
+ embedding_tokens_costs?: number;
8964
+ /**
8965
+ * Total Costs
8966
+ *
8967
+ * Sum of prompt, completion and embedding costs.
8968
+ */
8969
+ total_costs?: number;
8970
+ };
8971
+
8692
8972
  /**
8693
8973
  * LLMStopEvent
8694
8974
  */
@@ -9140,6 +9420,13 @@ export type LocaleInput = {
9140
9420
  placeholder?: LocaleString | string | null;
9141
9421
  /**
9142
9422
  * Validation
9423
+ *
9424
+ * Emits `localeRequired` where other elements emit FormKit's `required`.
9425
+ *
9426
+ * FormKit's `required` rule only asks whether a value is present, and this element's
9427
+ * value is always a `{de, en, fr, it}` object — non-empty, therefore passing, even when
9428
+ * every locale inside it is blank. `localeRequired` (registered in the frontend FormKit
9429
+ * config) looks at the locale values themselves.
9143
9430
  */
9144
9431
  readonly validation: string;
9145
9432
  [key: string]: unknown;
@@ -9288,14 +9575,15 @@ export type MailAttachmentRef = {
9288
9575
  };
9289
9576
 
9290
9577
  /**
9291
- * MailBatchDraftedEvent
9578
+ * MailBatchClassifiedEvent
9292
9579
  *
9293
- * Records that a batch of reply drafts was appended to the Drafts folder for a human to review and send.
9580
+ * Summarises one classification run: how many messages were classified and where each was filed.
9294
9581
  *
9295
- * The agent never sends — the drafts sitting in Drafts are the human handoff. Each source message is left unread and
9296
- * marked as drafted so it is not drafted again on the next run.
9582
+ * One event per run rather than one per message, matching `MailBatchDraftedEvent` — the per-message detail rides in
9583
+ * `classified`. Filing is what prevents reprocessing: every message leaves the source folder, so the next unread
9584
+ * listing cannot see it again.
9297
9585
  */
9298
- export type MailBatchDraftedEvent = {
9586
+ export type MailBatchClassifiedEvent = {
9299
9587
  /**
9300
9588
  * Event Id
9301
9589
  */
@@ -9317,21 +9605,41 @@ export type MailBatchDraftedEvent = {
9317
9605
  /**
9318
9606
  * Source Folder
9319
9607
  *
9320
- * Folder the drafted messages were read from.
9608
+ * Folder the classified messages were read from.
9321
9609
  */
9322
9610
  source_folder: string;
9323
9611
  /**
9324
9612
  * Count
9325
9613
  *
9326
- * Number of reply drafts created in this run.
9614
+ * Number of messages classified and filed in this run.
9327
9615
  */
9328
9616
  count: number;
9329
9617
  /**
9330
- * Drafted
9618
+ * Per Category
9331
9619
  *
9332
- * Per-message references to the created reply drafts.
9620
+ * How many messages were filed under each configured category.
9333
9621
  */
9334
- drafted?: Array<DraftedReplyRef>;
9622
+ per_category?: {
9623
+ [key: string]: number;
9624
+ };
9625
+ /**
9626
+ * Fallback Count
9627
+ *
9628
+ * How many messages went to the fallback folder instead of a category.
9629
+ */
9630
+ fallback_count?: number;
9631
+ /**
9632
+ * Failed Count
9633
+ *
9634
+ * How many messages the classifier could not reach a verdict on at all. They are filed into the failure folder rather than left in the inbox, where they would be re-selected on every run forever.
9635
+ */
9636
+ failed_count?: number;
9637
+ /**
9638
+ * Classified
9639
+ *
9640
+ * Per-message classification verdicts and filing destinations.
9641
+ */
9642
+ classified?: Array<MailClassificationRef>;
9335
9643
  /**
9336
9644
  * Event Name
9337
9645
  *
@@ -9349,11 +9657,14 @@ export type MailBatchDraftedEvent = {
9349
9657
  };
9350
9658
 
9351
9659
  /**
9352
- * MailFetchedEvent
9660
+ * MailBatchDraftedEvent
9353
9661
  *
9354
- * Carries a single fetched message — headers, body, and references to its stored attachments.
9662
+ * Records that a batch of reply drafts was appended to the Drafts folder for a human to review and send.
9663
+ *
9664
+ * The agent never sends — the drafts sitting in Drafts are the human handoff. Each source message is left unread and
9665
+ * marked as drafted so it is not drafted again on the next run.
9355
9666
  */
9356
- export type MailFetchedEvent = {
9667
+ export type MailBatchDraftedEvent = {
9357
9668
  /**
9358
9669
  * Event Id
9359
9670
  */
@@ -9373,11 +9684,143 @@ export type MailFetchedEvent = {
9373
9684
  */
9374
9685
  display_description?: LocaleString | null;
9375
9686
  /**
9376
- * Message Id
9687
+ * Source Folder
9377
9688
  *
9378
- * IMAP UID of the fetched message within the inbox folder.
9689
+ * Folder the drafted messages were read from.
9379
9690
  */
9380
- message_id: string;
9691
+ source_folder: string;
9692
+ /**
9693
+ * Count
9694
+ *
9695
+ * Number of reply drafts created in this run.
9696
+ */
9697
+ count: number;
9698
+ /**
9699
+ * Per Category
9700
+ *
9701
+ * How many drafts were created for each category, when drafting followed a classification run. Empty when the drafting blueprint does not classify.
9702
+ */
9703
+ per_category?: {
9704
+ [key: string]: number;
9705
+ };
9706
+ /**
9707
+ * Skipped Count
9708
+ *
9709
+ * Messages in the batch that got no draft: usually because their category was not opted in, or no category fitted them at all.
9710
+ */
9711
+ skipped_count?: number;
9712
+ /**
9713
+ * Drafted
9714
+ *
9715
+ * Per-message references to the created reply drafts.
9716
+ */
9717
+ drafted?: Array<DraftedReplyRef>;
9718
+ /**
9719
+ * Event Name
9720
+ *
9721
+ * The event type name, usually the class name. If unknown, uses _unknown_event_name.
9722
+ * Used during deserialization to decide which subclass to instantiate.
9723
+ */
9724
+ readonly _event_name: string;
9725
+ /**
9726
+ * Parent Event Names
9727
+ *
9728
+ * Contains the names of all parent classes up until BaseEvent, ordered from deepest to least deep inheritance.
9729
+ */
9730
+ readonly _parent_event_names: Array<string>;
9731
+ [key: string]: unknown;
9732
+ };
9733
+
9734
+ /**
9735
+ * MailClassificationRef
9736
+ *
9737
+ * One classified message and where it was filed — the per-message detail behind a run summary.
9738
+ */
9739
+ export type MailClassificationRef = {
9740
+ /**
9741
+ * Message Id
9742
+ *
9743
+ * IMAP UID of the message within the source folder.
9744
+ */
9745
+ message_id: string;
9746
+ /**
9747
+ * Sender
9748
+ *
9749
+ * Raw From header of the message.
9750
+ */
9751
+ sender: string;
9752
+ /**
9753
+ * Subject
9754
+ *
9755
+ * Subject header of the message.
9756
+ */
9757
+ subject: string;
9758
+ /**
9759
+ * Category
9760
+ *
9761
+ * Configured category the message was filed under, or null when it went to the fallback folder because no category clearly fitted.
9762
+ */
9763
+ category?: string | null;
9764
+ /**
9765
+ * Target Folder
9766
+ *
9767
+ * Folder the message was filed into.
9768
+ */
9769
+ target_folder: string;
9770
+ /**
9771
+ * Reason
9772
+ *
9773
+ * Model's stated reason for the choice — the audit trail for a misfile.
9774
+ */
9775
+ reason: string;
9776
+ /**
9777
+ * Folder Created
9778
+ *
9779
+ * Whether this message's target folder was created during the run. Folders are created once up front for the whole batch, so every message routed to a newly created folder carries this, not only the first one.
9780
+ */
9781
+ folder_created?: boolean;
9782
+ /**
9783
+ * Attachments
9784
+ *
9785
+ * References to the message's attachments stored in S3.
9786
+ */
9787
+ attachments?: Array<MailAttachmentRef>;
9788
+ /**
9789
+ * Reference to the original RFC822 message stored in S3.
9790
+ */
9791
+ original_message?: MailMessageRef | null;
9792
+ };
9793
+
9794
+ /**
9795
+ * MailFetchedEvent
9796
+ *
9797
+ * Carries a single fetched message — headers, body, and references to its stored attachments.
9798
+ */
9799
+ export type MailFetchedEvent = {
9800
+ /**
9801
+ * Event Id
9802
+ */
9803
+ event_id?: string;
9804
+ /**
9805
+ * Created At
9806
+ *
9807
+ * The time (in ns since epoch) the event was stored in the event store
9808
+ */
9809
+ created_at?: number;
9810
+ /**
9811
+ * Display name for the event
9812
+ */
9813
+ display_name?: LocaleString | null;
9814
+ /**
9815
+ * Display description for the event
9816
+ */
9817
+ display_description?: LocaleString | null;
9818
+ /**
9819
+ * Message Id
9820
+ *
9821
+ * IMAP UID of the fetched message within the inbox folder.
9822
+ */
9823
+ message_id: string;
9381
9824
  /**
9382
9825
  * Sender
9383
9826
  *
@@ -9426,6 +9869,10 @@ export type MailFetchedEvent = {
9426
9869
  * References to the message's attachments stored in S3.
9427
9870
  */
9428
9871
  attachments?: Array<MailAttachmentRef>;
9872
+ /**
9873
+ * Reference to the original RFC822 message stored in S3, or null when it was not stored.
9874
+ */
9875
+ original_message?: MailMessageRef | null;
9429
9876
  /**
9430
9877
  * Event Name
9431
9878
  *
@@ -9442,6 +9889,43 @@ export type MailFetchedEvent = {
9442
9889
  [key: string]: unknown;
9443
9890
  };
9444
9891
 
9892
+ /**
9893
+ * MailMessageRef
9894
+ *
9895
+ * Reference to a fetched message's original RFC822 bytes, stored in S3 rather than carried in the event.
9896
+ *
9897
+ * Mirrors ``MailAttachmentRef``: the message is referenced by ``file_id`` so the raw mail — which may be
9898
+ * orders of magnitude larger than the summary the event carries — never enters the audit trail or the
9899
+ * WebSocket stream. The stored object is the message **verbatim**, so it also preserves what the event
9900
+ * deliberately omits: the recipients and the untrusted HTML body.
9901
+ */
9902
+ export type MailMessageRef = {
9903
+ /**
9904
+ * Filename
9905
+ *
9906
+ * Filename the message is stored under, e.g. '1234.eml'. Must not contain path separators.
9907
+ */
9908
+ filename: string;
9909
+ /**
9910
+ * Content Type
9911
+ *
9912
+ * MIME type of the stored message.
9913
+ */
9914
+ content_type?: string;
9915
+ /**
9916
+ * File Id
9917
+ *
9918
+ * UUID4 file identifier; the S3 object key is derived from the agent identity at runtime.
9919
+ */
9920
+ file_id: string;
9921
+ /**
9922
+ * Size Bytes
9923
+ *
9924
+ * Size of the stored message in bytes.
9925
+ */
9926
+ size_bytes: number;
9927
+ };
9928
+
9445
9929
  /**
9446
9930
  * MailMovedEvent
9447
9931
  *
@@ -9484,6 +9968,12 @@ export type MailMovedEvent = {
9484
9968
  * Folder the message was moved into.
9485
9969
  */
9486
9970
  target_folder: string;
9971
+ /**
9972
+ * Folder Created
9973
+ *
9974
+ * Whether the target folder did not exist and was created by this move — an agent adding a folder to someone's mailbox is a visible side effect and belongs in the audit trail.
9975
+ */
9976
+ folder_created?: boolean;
9487
9977
  /**
9488
9978
  * Event Name
9489
9979
  *
@@ -10006,6 +10496,12 @@ export type MinimalAgentInstanceDto = {
10006
10496
  * Whether the agent can participate in a chat-based conversation
10007
10497
  */
10008
10498
  is_conversational: boolean;
10499
+ /**
10500
+ * Is Schedulable
10501
+ *
10502
+ * Whether the agent can be run automatically on a cron schedule
10503
+ */
10504
+ is_schedulable?: boolean;
10009
10505
  };
10010
10506
 
10011
10507
  /**
@@ -11482,6 +11978,7 @@ export type ProcessClassDto = {
11482
11978
  | Checkbox
11483
11979
  | ChipsInput
11484
11980
  | ColorPicker
11981
+ | CronInput
11485
11982
  | DatePicker
11486
11983
  | Group
11487
11984
  | IconSelector
@@ -12516,6 +13013,7 @@ export type Repeater = {
12516
13013
  | Checkbox
12517
13014
  | ChipsInput
12518
13015
  | ColorPicker
13016
+ | CronInput
12519
13017
  | DatePicker
12520
13018
  | Group
12521
13019
  | IconSelector
@@ -16611,6 +17109,7 @@ export type AgentClassDtoWritable = {
16611
17109
  | CheckboxWritable
16612
17110
  | ChipsInputWritable
16613
17111
  | ColorPickerWritable
17112
+ | CronInputWritable
16614
17113
  | DatePickerWritable
16615
17114
  | GroupWritable
16616
17115
  | IconSelectorWritable
@@ -16675,6 +17174,12 @@ export type AgentClassDtoWritable = {
16675
17174
  * Whether the agent class can participate in a chat-based conversation
16676
17175
  */
16677
17176
  is_conversational: boolean;
17177
+ /**
17178
+ * Is Schedulable
17179
+ *
17180
+ * Whether the agent class can be run automatically on a cron schedule
17181
+ */
17182
+ is_schedulable?: boolean;
16678
17183
  /**
16679
17184
  * Is Online
16680
17185
  *
@@ -16738,6 +17243,7 @@ export type AgentConfigDtoWritable = {
16738
17243
  | CheckboxWritable
16739
17244
  | ChipsInputWritable
16740
17245
  | ColorPickerWritable
17246
+ | CronInputWritable
16741
17247
  | DatePickerWritable
16742
17248
  | GroupWritable
16743
17249
  | IconSelectorWritable
@@ -18254,6 +18760,7 @@ export type ContextualizedAgentEventWritable = {
18254
18760
  | ToolEventWritable
18255
18761
  | UserMessageEventWritable
18256
18762
  | RagStartEventWritable
18763
+ | CronStartEventWritable
18257
18764
  | ExceptionEventWritable
18258
18765
  | RagSuccessStopEventWritable
18259
18766
  | RagFailureStopEventWritable
@@ -18277,7 +18784,8 @@ export type ContextualizedAgentEventWritable = {
18277
18784
  | UnreadMailListedEventWritable
18278
18785
  | MailFetchedEventWritable
18279
18786
  | MailMovedEventWritable
18280
- | MailBatchDraftedEventWritable;
18787
+ | MailBatchDraftedEventWritable
18788
+ | MailBatchClassifiedEventWritable;
18281
18789
  };
18282
18790
 
18283
18791
  /**
@@ -18347,6 +18855,191 @@ export type ConversationTitleEventWritable = {
18347
18855
  [key: string]: unknown;
18348
18856
  };
18349
18857
 
18858
+ /**
18859
+ * CronInput
18860
+ *
18861
+ * A FormKit element for editing the cron schedule of a schedulable agent profile.
18862
+ *
18863
+ * The element renders the five cron positions plus a timezone selector, and the submitted value
18864
+ * matches the fields of `CronSchedule`:
18865
+ * {
18866
+ * "minute": str,
18867
+ * "hour": str,
18868
+ * "day_of_month": str,
18869
+ * "month": str,
18870
+ * "day_of_week": str,
18871
+ * "timezone": str,
18872
+ * }
18873
+ *
18874
+ * Presets and the plain-language summary of the current schedule are delivered by the Admin UI
18875
+ * (see the cron schedule configuration UI issue); this element only declares the contract.
18876
+ *
18877
+ * ### Form Duality
18878
+ * ```python
18879
+ * from swiss_ai_hub.core.form.elements.cron_input import CronInput
18880
+ * from swiss_ai_hub.core.scheduling.cron_schedule import CronSchedule
18881
+ *
18882
+ * class MyAgentConfig(AgentConfig):
18883
+ * schedule: Annotated[
18884
+ * CronSchedule | CronInput | None,
18885
+ * Field(description="When this profile runs automatically"),
18886
+ * ] = None
18887
+ *
18888
+ * # Form mode - for rendering:
18889
+ * config = MyAgentConfig(schedule=CronInput(label=LocaleString(en="Schedule")))
18890
+ *
18891
+ * # Data mode - from submission (Pydantic validates into CronSchedule):
18892
+ * config = MyAgentConfig(schedule=CronSchedule(hour="12", timezone="Europe/Zurich"))
18893
+ * ```
18894
+ */
18895
+ export type CronInputWritable = {
18896
+ /**
18897
+ * Is Formkit Element
18898
+ *
18899
+ * Indicates that this element is a FormKit element
18900
+ */
18901
+ is_formkit_element?: true;
18902
+ /**
18903
+ * If
18904
+ *
18905
+ * Conditional expression to show this element
18906
+ */
18907
+ if?: string | null;
18908
+ /**
18909
+ * Id
18910
+ *
18911
+ * Unique identifier for this element
18912
+ */
18913
+ id?: string | null;
18914
+ /**
18915
+ * Nullable
18916
+ *
18917
+ * Render with a sibling toggle that sets this field to null when off
18918
+ */
18919
+ nullable?: boolean;
18920
+ /**
18921
+ * Defaultenabled
18922
+ *
18923
+ * For a nullable element, whether its toggle should start enabled on a fresh form (i.e. the field's data default is non-null). Ignored for non-nullable elements.
18924
+ */
18925
+ defaultEnabled?: boolean | null;
18926
+ /**
18927
+ * Formkit
18928
+ *
18929
+ * Cron schedule input element.
18930
+ */
18931
+ formkit?: "cronInput";
18932
+ /**
18933
+ * Name
18934
+ *
18935
+ * Name of this field
18936
+ */
18937
+ name?: string | null;
18938
+ /**
18939
+ * Label
18940
+ *
18941
+ * Label of this field
18942
+ */
18943
+ label: LocaleString | string;
18944
+ /**
18945
+ * Help
18946
+ *
18947
+ * Help text of this field
18948
+ */
18949
+ help?: LocaleString | string | null;
18950
+ /**
18951
+ * Value
18952
+ *
18953
+ * Default value for this field
18954
+ */
18955
+ value?:
18956
+ | string
18957
+ | number
18958
+ | number
18959
+ | boolean
18960
+ | Array<string>
18961
+ | {
18962
+ [key: string]: string;
18963
+ }
18964
+ | null;
18965
+ /**
18966
+ * Required
18967
+ *
18968
+ * Whether this field is required
18969
+ */
18970
+ required?: boolean;
18971
+ /**
18972
+ * Additional Validation Rules
18973
+ *
18974
+ * Validation expression
18975
+ */
18976
+ additional_validation_rules?: string | null;
18977
+ /**
18978
+ * Timezoneplaceholder
18979
+ *
18980
+ * Placeholder for the timezone select
18981
+ */
18982
+ timezonePlaceholder?: LocaleString | string | null;
18983
+ /**
18984
+ * Filter
18985
+ *
18986
+ * Whether to enable filtering/search on the timezone select
18987
+ */
18988
+ filter?: boolean;
18989
+ [key: string]: unknown;
18990
+ };
18991
+
18992
+ /**
18993
+ * CronStartEvent
18994
+ *
18995
+ * Start event fired by the cron scheduler — handling it is what makes an agent schedulable.
18996
+ *
18997
+ * Mirrors how accepting a `UserMessageEvent` makes an agent conversational: `AgentRunner` derives
18998
+ * `is_schedulable` from the start events an agent declares, so a blueprint opts in by adding a step
18999
+ * that consumes this event, with no separate registration.
19000
+ *
19001
+ * Scheduled runs are system runs, so `user` is always None and the agent must not depend on an
19002
+ * initiating identity. Whatever tenant context the agent needs comes from its own profile
19003
+ * configuration (as `OrgMemoryWriteConfig.tenant_id` already does), never from the run.
19004
+ */
19005
+ export type CronStartEventWritable = {
19006
+ /**
19007
+ * Event Id
19008
+ */
19009
+ event_id?: string;
19010
+ /**
19011
+ * Created At
19012
+ *
19013
+ * The time (in ns since epoch) the event was stored in the event store
19014
+ */
19015
+ created_at?: number;
19016
+ /**
19017
+ * Display name for the event
19018
+ */
19019
+ display_name?: LocaleString | null;
19020
+ /**
19021
+ * Display description for the event
19022
+ */
19023
+ display_description?: LocaleString | null;
19024
+ /**
19025
+ * Locale
19026
+ *
19027
+ * The locale the scheduled run reports its display output in.
19028
+ */
19029
+ locale?: string;
19030
+ /**
19031
+ * Always None — scheduled runs are system-initiated and carry no execution identity.
19032
+ */
19033
+ user?: UserIdentity | null;
19034
+ /**
19035
+ * Scheduled For
19036
+ *
19037
+ * The cron occurrence this run fires for, in UTC. Distinct from `created_at`, which records when the scheduler published the event — the two differ by the scheduler's tick latency.
19038
+ */
19039
+ scheduled_for: Date;
19040
+ [key: string]: unknown;
19041
+ };
19042
+
18350
19043
  /**
18351
19044
  * DatePicker
18352
19045
  *
@@ -18857,6 +19550,12 @@ export type FullAgentInstanceDtoWritable = {
18857
19550
  * Whether the agent can participate in a chat-based conversation
18858
19551
  */
18859
19552
  is_conversational: boolean;
19553
+ /**
19554
+ * Is Schedulable
19555
+ *
19556
+ * Whether the agent can be run automatically on a cron schedule
19557
+ */
19558
+ is_schedulable?: boolean;
18860
19559
  /**
18861
19560
  * Start Events
18862
19561
  *
@@ -18968,6 +19667,7 @@ export type FullProcessInstanceDtoWritable = {
18968
19667
  | CheckboxWritable
18969
19668
  | ChipsInputWritable
18970
19669
  | ColorPickerWritable
19670
+ | CronInputWritable
18971
19671
  | DatePickerWritable
18972
19672
  | GroupWritable
18973
19673
  | IconSelectorWritable
@@ -19093,6 +19793,7 @@ export type GroupWritable = {
19093
19793
  | CheckboxWritable
19094
19794
  | ChipsInputWritable
19095
19795
  | ColorPickerWritable
19796
+ | CronInputWritable
19096
19797
  | DatePickerWritable
19097
19798
  | GroupWritable
19098
19799
  | IconSelectorWritable
@@ -19296,6 +19997,7 @@ export type HumanInDtoWritable = {
19296
19997
  | CheckboxWritable
19297
19998
  | ChipsInputWritable
19298
19999
  | ColorPickerWritable
20000
+ | CronInputWritable
19299
20001
  | DatePickerWritable
19300
20002
  | GroupWritable
19301
20003
  | IconSelectorWritable
@@ -19376,6 +20078,7 @@ export type HumanInSpecsWritable = {
19376
20078
  | CheckboxWritable
19377
20079
  | ChipsInputWritable
19378
20080
  | ColorPickerWritable
20081
+ | CronInputWritable
19379
20082
  | DatePickerWritable
19380
20083
  | GroupWritable
19381
20084
  | IconSelectorWritable
@@ -20823,6 +21526,18 @@ export type LlmCostEventWritable = {
20823
21526
  * The name of the LLM service (e.g., 'openai/gpt-4') this event pertains to.
20824
21527
  */
20825
21528
  llm_name: string;
21529
+ /**
21530
+ * User Id
21531
+ *
21532
+ * Invoking user, so spend is queryable per user. None for runs with no user context.
21533
+ */
21534
+ user_id?: string | null;
21535
+ /**
21536
+ * Tenant Id
21537
+ *
21538
+ * Acting tenant, so spend is queryable per tenant. None for sysadmins and system runs.
21539
+ */
21540
+ tenant_id?: string | null;
20826
21541
  [key: string]: unknown;
20827
21542
  };
20828
21543
 
@@ -21357,6 +22072,75 @@ export type LocaleInputWritable = {
21357
22072
  [key: string]: unknown;
21358
22073
  };
21359
22074
 
22075
+ /**
22076
+ * MailBatchClassifiedEvent
22077
+ *
22078
+ * Summarises one classification run: how many messages were classified and where each was filed.
22079
+ *
22080
+ * One event per run rather than one per message, matching `MailBatchDraftedEvent` — the per-message detail rides in
22081
+ * `classified`. Filing is what prevents reprocessing: every message leaves the source folder, so the next unread
22082
+ * listing cannot see it again.
22083
+ */
22084
+ export type MailBatchClassifiedEventWritable = {
22085
+ /**
22086
+ * Event Id
22087
+ */
22088
+ event_id?: string;
22089
+ /**
22090
+ * Created At
22091
+ *
22092
+ * The time (in ns since epoch) the event was stored in the event store
22093
+ */
22094
+ created_at?: number;
22095
+ /**
22096
+ * Display name for the event
22097
+ */
22098
+ display_name?: LocaleString | null;
22099
+ /**
22100
+ * Display description for the event
22101
+ */
22102
+ display_description?: LocaleString | null;
22103
+ /**
22104
+ * Source Folder
22105
+ *
22106
+ * Folder the classified messages were read from.
22107
+ */
22108
+ source_folder: string;
22109
+ /**
22110
+ * Count
22111
+ *
22112
+ * Number of messages classified and filed in this run.
22113
+ */
22114
+ count: number;
22115
+ /**
22116
+ * Per Category
22117
+ *
22118
+ * How many messages were filed under each configured category.
22119
+ */
22120
+ per_category?: {
22121
+ [key: string]: number;
22122
+ };
22123
+ /**
22124
+ * Fallback Count
22125
+ *
22126
+ * How many messages went to the fallback folder instead of a category.
22127
+ */
22128
+ fallback_count?: number;
22129
+ /**
22130
+ * Failed Count
22131
+ *
22132
+ * How many messages the classifier could not reach a verdict on at all. They are filed into the failure folder rather than left in the inbox, where they would be re-selected on every run forever.
22133
+ */
22134
+ failed_count?: number;
22135
+ /**
22136
+ * Classified
22137
+ *
22138
+ * Per-message classification verdicts and filing destinations.
22139
+ */
22140
+ classified?: Array<MailClassificationRef>;
22141
+ [key: string]: unknown;
22142
+ };
22143
+
21360
22144
  /**
21361
22145
  * MailBatchDraftedEvent
21362
22146
  *
@@ -21396,6 +22180,20 @@ export type MailBatchDraftedEventWritable = {
21396
22180
  * Number of reply drafts created in this run.
21397
22181
  */
21398
22182
  count: number;
22183
+ /**
22184
+ * Per Category
22185
+ *
22186
+ * How many drafts were created for each category, when drafting followed a classification run. Empty when the drafting blueprint does not classify.
22187
+ */
22188
+ per_category?: {
22189
+ [key: string]: number;
22190
+ };
22191
+ /**
22192
+ * Skipped Count
22193
+ *
22194
+ * Messages in the batch that got no draft: usually because their category was not opted in, or no category fitted them at all.
22195
+ */
22196
+ skipped_count?: number;
21399
22197
  /**
21400
22198
  * Drafted
21401
22199
  *
@@ -21483,6 +22281,10 @@ export type MailFetchedEventWritable = {
21483
22281
  * References to the message's attachments stored in S3.
21484
22282
  */
21485
22283
  attachments?: Array<MailAttachmentRef>;
22284
+ /**
22285
+ * Reference to the original RFC822 message stored in S3, or null when it was not stored.
22286
+ */
22287
+ original_message?: MailMessageRef | null;
21486
22288
  [key: string]: unknown;
21487
22289
  };
21488
22290
 
@@ -21528,6 +22330,12 @@ export type MailMovedEventWritable = {
21528
22330
  * Folder the message was moved into.
21529
22331
  */
21530
22332
  target_folder: string;
22333
+ /**
22334
+ * Folder Created
22335
+ *
22336
+ * Whether the target folder did not exist and was created by this move — an agent adding a folder to someone's mailbox is a visible side effect and belongs in the audit trail.
22337
+ */
22338
+ folder_created?: boolean;
21531
22339
  [key: string]: unknown;
21532
22340
  };
21533
22341
 
@@ -21661,6 +22469,12 @@ export type MinimalAgentInstanceDtoWritable = {
21661
22469
  * Whether the agent can participate in a chat-based conversation
21662
22470
  */
21663
22471
  is_conversational: boolean;
22472
+ /**
22473
+ * Is Schedulable
22474
+ *
22475
+ * Whether the agent can be run automatically on a cron schedule
22476
+ */
22477
+ is_schedulable?: boolean;
21664
22478
  };
21665
22479
 
21666
22480
  /**
@@ -22274,6 +23088,7 @@ export type ProcessClassDtoWritable = {
22274
23088
  | CheckboxWritable
22275
23089
  | ChipsInputWritable
22276
23090
  | ColorPickerWritable
23091
+ | CronInputWritable
22277
23092
  | DatePickerWritable
22278
23093
  | GroupWritable
22279
23094
  | IconSelectorWritable
@@ -22945,6 +23760,7 @@ export type RepeaterWritable = {
22945
23760
  | CheckboxWritable
22946
23761
  | ChipsInputWritable
22947
23762
  | ColorPickerWritable
23763
+ | CronInputWritable
22948
23764
  | DatePickerWritable
22949
23765
  | GroupWritable
22950
23766
  | IconSelectorWritable
@@ -25729,6 +26545,92 @@ export type GetAgentEventTimeseriesResponses = {
25729
26545
  export type GetAgentEventTimeseriesResponse =
25730
26546
  GetAgentEventTimeseriesResponses[keyof GetAgentEventTimeseriesResponses];
25731
26547
 
26548
+ export type GetLlmSpendByUserData = {
26549
+ body?: never;
26550
+ path: {
26551
+ /**
26552
+ * Tenant Id
26553
+ *
26554
+ * Tenant identifier: a name, ObjectId, or 'active'
26555
+ */
26556
+ tenant_id: string;
26557
+ };
26558
+ query?: {
26559
+ /**
26560
+ * Since
26561
+ *
26562
+ * Only count calls at or after this time. Defaults to the last 30 days.
26563
+ */
26564
+ since?: Date | null;
26565
+ };
26566
+ url: "/{tenant_id}/events/spend/users";
26567
+ };
26568
+
26569
+ export type GetLlmSpendByUserErrors = {
26570
+ /**
26571
+ * Validation Error
26572
+ */
26573
+ 422: HttpValidationError;
26574
+ };
26575
+
26576
+ export type GetLlmSpendByUserError =
26577
+ GetLlmSpendByUserErrors[keyof GetLlmSpendByUserErrors];
26578
+
26579
+ export type GetLlmSpendByUserResponses = {
26580
+ /**
26581
+ * Response Get Llm Spend By User Tenant Id Events Spend Users Get
26582
+ *
26583
+ * Successful Response
26584
+ */
26585
+ 200: Array<LlmSpend>;
26586
+ };
26587
+
26588
+ export type GetLlmSpendByUserResponse =
26589
+ GetLlmSpendByUserResponses[keyof GetLlmSpendByUserResponses];
26590
+
26591
+ export type GetLlmSpendByTenantData = {
26592
+ body?: never;
26593
+ path: {
26594
+ /**
26595
+ * Tenant Id
26596
+ *
26597
+ * Tenant identifier: a name, ObjectId, or 'active'
26598
+ */
26599
+ tenant_id: string;
26600
+ };
26601
+ query?: {
26602
+ /**
26603
+ * Since
26604
+ *
26605
+ * Only count calls at or after this time. Defaults to the last 30 days.
26606
+ */
26607
+ since?: Date | null;
26608
+ };
26609
+ url: "/{tenant_id}/events/spend/tenants";
26610
+ };
26611
+
26612
+ export type GetLlmSpendByTenantErrors = {
26613
+ /**
26614
+ * Validation Error
26615
+ */
26616
+ 422: HttpValidationError;
26617
+ };
26618
+
26619
+ export type GetLlmSpendByTenantError =
26620
+ GetLlmSpendByTenantErrors[keyof GetLlmSpendByTenantErrors];
26621
+
26622
+ export type GetLlmSpendByTenantResponses = {
26623
+ /**
26624
+ * Response Get Llm Spend By Tenant Tenant Id Events Spend Tenants Get
26625
+ *
26626
+ * Successful Response
26627
+ */
26628
+ 200: Array<LlmSpend>;
26629
+ };
26630
+
26631
+ export type GetLlmSpendByTenantResponse =
26632
+ GetLlmSpendByTenantResponses[keyof GetLlmSpendByTenantResponses];
26633
+
25732
26634
  export type GetLitellmModelsData = {
25733
26635
  body?: never;
25734
26636
  path: {