@swiss-ai-hub/web 0.319.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.
@@ -2792,10 +2792,7 @@ export type ChatCompletionRequest = {
2792
2792
  * Function Call
2793
2793
  */
2794
2794
  function_call?:
2795
- | "none"
2796
- | "auto"
2797
- | ChatCompletionFunctionCallOptionParam
2798
- | null;
2795
+ "none" | "auto" | ChatCompletionFunctionCallOptionParam | null;
2799
2796
  /**
2800
2797
  * Functions
2801
2798
  */
@@ -2840,13 +2837,7 @@ export type ChatCompletionRequest = {
2840
2837
  * Reasoning Effort
2841
2838
  */
2842
2839
  reasoning_effort?:
2843
- | "none"
2844
- | "minimal"
2845
- | "low"
2846
- | "medium"
2847
- | "high"
2848
- | "xhigh"
2849
- | null;
2840
+ "none" | "minimal" | "low" | "medium" | "high" | "xhigh" | null;
2850
2841
  /**
2851
2842
  * Response Format
2852
2843
  */
@@ -3311,11 +3302,7 @@ export type Choice = {
3311
3302
  * Finish Reason
3312
3303
  */
3313
3304
  finish_reason:
3314
- | "stop"
3315
- | "length"
3316
- | "tool_calls"
3317
- | "content_filter"
3318
- | "function_call";
3305
+ "stop" | "length" | "tool_calls" | "content_filter" | "function_call";
3319
3306
  /**
3320
3307
  * Index
3321
3308
  */
@@ -3858,7 +3845,7 @@ export type ContextualizedAgentEvent = {
3858
3845
  | ToolEvent
3859
3846
  | UserMessageEvent
3860
3847
  | RagStartEvent
3861
- | ScheduledStartEvent
3848
+ | CronStartEvent
3862
3849
  | ExceptionEvent
3863
3850
  | RagSuccessStopEvent
3864
3851
  | RagFailureStopEvent
@@ -3882,7 +3869,8 @@ export type ContextualizedAgentEvent = {
3882
3869
  | UnreadMailListedEvent
3883
3870
  | MailFetchedEvent
3884
3871
  | MailMovedEvent
3885
- | MailBatchDraftedEvent;
3872
+ | MailBatchDraftedEvent
3873
+ | MailBatchClassifiedEvent;
3886
3874
  };
3887
3875
 
3888
3876
  /**
@@ -4156,7 +4144,7 @@ export type CreateTokenResponse = {
4156
4144
  * A FormKit element for editing the cron schedule of a schedulable agent profile.
4157
4145
  *
4158
4146
  * The element renders the five cron positions plus a timezone selector, and the submitted value
4159
- * matches the fields of `AgentSchedule`:
4147
+ * matches the fields of `CronSchedule`:
4160
4148
  * {
4161
4149
  * "minute": str,
4162
4150
  * "hour": str,
@@ -4172,19 +4160,19 @@ export type CreateTokenResponse = {
4172
4160
  * ### Form Duality
4173
4161
  * ```python
4174
4162
  * from swiss_ai_hub.core.form.elements.cron_input import CronInput
4175
- * from swiss_ai_hub.core.scheduling.agent_schedule import AgentSchedule
4163
+ * from swiss_ai_hub.core.scheduling.cron_schedule import CronSchedule
4176
4164
  *
4177
4165
  * class MyAgentConfig(AgentConfig):
4178
4166
  * schedule: Annotated[
4179
- * AgentSchedule | CronInput | None,
4167
+ * CronSchedule | CronInput | None,
4180
4168
  * Field(description="When this profile runs automatically"),
4181
4169
  * ] = None
4182
4170
  *
4183
4171
  * # Form mode - for rendering:
4184
4172
  * config = MyAgentConfig(schedule=CronInput(label=LocaleString(en="Schedule")))
4185
4173
  *
4186
- * # Data mode - from submission (Pydantic validates into AgentSchedule):
4187
- * config = MyAgentConfig(schedule=AgentSchedule(hour="12", timezone="Europe/Zurich"))
4174
+ * # Data mode - from submission (Pydantic validates into CronSchedule):
4175
+ * config = MyAgentConfig(schedule=CronSchedule(hour="12", timezone="Europe/Zurich"))
4188
4176
  * ```
4189
4177
  */
4190
4178
  export type CronInput = {
@@ -4288,6 +4276,70 @@ export type CronInput = {
4288
4276
  [key: string]: unknown;
4289
4277
  };
4290
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
+
4291
4343
  /**
4292
4344
  * Custom
4293
4345
  *
@@ -5169,9 +5221,15 @@ export type DraftedReplyRef = {
5169
5221
  /**
5170
5222
  * Source Uid
5171
5223
  *
5172
- * 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.
5173
5225
  */
5174
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;
5175
5233
  /**
5176
5234
  * Drafts Folder
5177
5235
  *
@@ -8708,6 +8766,18 @@ export type LlmCostEvent = {
8708
8766
  * The name of the LLM service (e.g., 'openai/gpt-4') this event pertains to.
8709
8767
  */
8710
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;
8711
8781
  /**
8712
8782
  * Event Name
8713
8783
  *
@@ -8846,6 +8916,59 @@ export type LlmEvent = {
8846
8916
  [key: string]: unknown;
8847
8917
  };
8848
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
+
8849
8972
  /**
8850
8973
  * LLMStopEvent
8851
8974
  */
@@ -9451,6 +9574,88 @@ export type MailAttachmentRef = {
9451
9574
  size_bytes: number;
9452
9575
  };
9453
9576
 
9577
+ /**
9578
+ * MailBatchClassifiedEvent
9579
+ *
9580
+ * Summarises one classification run: how many messages were classified and where each was filed.
9581
+ *
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.
9585
+ */
9586
+ export type MailBatchClassifiedEvent = {
9587
+ /**
9588
+ * Event Id
9589
+ */
9590
+ event_id?: string;
9591
+ /**
9592
+ * Created At
9593
+ *
9594
+ * The time (in ns since epoch) the event was stored in the event store
9595
+ */
9596
+ created_at?: number;
9597
+ /**
9598
+ * Display name for the event
9599
+ */
9600
+ display_name?: LocaleString | null;
9601
+ /**
9602
+ * Display description for the event
9603
+ */
9604
+ display_description?: LocaleString | null;
9605
+ /**
9606
+ * Source Folder
9607
+ *
9608
+ * Folder the classified messages were read from.
9609
+ */
9610
+ source_folder: string;
9611
+ /**
9612
+ * Count
9613
+ *
9614
+ * Number of messages classified and filed in this run.
9615
+ */
9616
+ count: number;
9617
+ /**
9618
+ * Per Category
9619
+ *
9620
+ * How many messages were filed under each configured category.
9621
+ */
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>;
9643
+ /**
9644
+ * Event Name
9645
+ *
9646
+ * The event type name, usually the class name. If unknown, uses _unknown_event_name.
9647
+ * Used during deserialization to decide which subclass to instantiate.
9648
+ */
9649
+ readonly _event_name: string;
9650
+ /**
9651
+ * Parent Event Names
9652
+ *
9653
+ * Contains the names of all parent classes up until BaseEvent, ordered from deepest to least deep inheritance.
9654
+ */
9655
+ readonly _parent_event_names: Array<string>;
9656
+ [key: string]: unknown;
9657
+ };
9658
+
9454
9659
  /**
9455
9660
  * MailBatchDraftedEvent
9456
9661
  *
@@ -9490,6 +9695,20 @@ export type MailBatchDraftedEvent = {
9490
9695
  * Number of reply drafts created in this run.
9491
9696
  */
9492
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;
9493
9712
  /**
9494
9713
  * Drafted
9495
9714
  *
@@ -9512,6 +9731,66 @@ export type MailBatchDraftedEvent = {
9512
9731
  [key: string]: unknown;
9513
9732
  };
9514
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
+
9515
9794
  /**
9516
9795
  * MailFetchedEvent
9517
9796
  *
@@ -9689,6 +9968,12 @@ export type MailMovedEvent = {
9689
9968
  * Folder the message was moved into.
9690
9969
  */
9691
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;
9692
9977
  /**
9693
9978
  * Event Name
9694
9979
  *
@@ -13286,93 +13571,29 @@ export type RunStatistics = {
13286
13571
  *
13287
13572
  * Start time (ISO format string)
13288
13573
  */
13289
- started_at?: string | null;
13290
- /**
13291
- * Ended At
13292
- *
13293
- * End time (ISO format string)
13294
- */
13295
- ended_at?: string | null;
13296
- /**
13297
- * Duration
13298
- *
13299
- * Duration in seconds
13300
- */
13301
- duration?: number | null;
13302
- /**
13303
- * Run Id
13304
- *
13305
- * The run ID
13306
- */
13307
- run_id: string;
13308
- /**
13309
- * The agent that ran the run
13310
- */
13311
- agent: MinimalAgentInstanceDto;
13312
- };
13313
-
13314
- /**
13315
- * ScheduledStartEvent
13316
- *
13317
- * Start event fired by the cron scheduler — handling it is what makes an agent schedulable.
13318
- *
13319
- * Mirrors how accepting a `UserMessageEvent` makes an agent conversational: `AgentRunner` derives
13320
- * `is_schedulable` from the start events an agent declares, so a blueprint opts in by adding a step
13321
- * that consumes this event, with no separate registration.
13322
- *
13323
- * Scheduled runs are system runs, so `user` is always None and the agent must not depend on an
13324
- * initiating identity. Whatever tenant context the agent needs comes from its own profile
13325
- * configuration (as `OrgMemoryWriteConfig.tenant_id` already does), never from the run.
13326
- */
13327
- export type ScheduledStartEvent = {
13328
- /**
13329
- * Event Id
13330
- */
13331
- event_id?: string;
13332
- /**
13333
- * Created At
13334
- *
13335
- * The time (in ns since epoch) the event was stored in the event store
13336
- */
13337
- created_at?: number;
13338
- /**
13339
- * Display name for the event
13340
- */
13341
- display_name?: LocaleString | null;
13342
- /**
13343
- * Display description for the event
13344
- */
13345
- display_description?: LocaleString | null;
13346
- /**
13347
- * Locale
13348
- *
13349
- * The locale the scheduled run reports its display output in.
13350
- */
13351
- locale?: string;
13574
+ started_at?: string | null;
13352
13575
  /**
13353
- * Always None — scheduled runs are system-initiated and carry no execution identity.
13576
+ * Ended At
13577
+ *
13578
+ * End time (ISO format string)
13354
13579
  */
13355
- user?: UserIdentity | null;
13580
+ ended_at?: string | null;
13356
13581
  /**
13357
- * Scheduled For
13582
+ * Duration
13358
13583
  *
13359
- * 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.
13584
+ * Duration in seconds
13360
13585
  */
13361
- scheduled_for: Date;
13586
+ duration?: number | null;
13362
13587
  /**
13363
- * Event Name
13588
+ * Run Id
13364
13589
  *
13365
- * The event type name, usually the class name. If unknown, uses _unknown_event_name.
13366
- * Used during deserialization to decide which subclass to instantiate.
13590
+ * The run ID
13367
13591
  */
13368
- readonly _event_name: string;
13592
+ run_id: string;
13369
13593
  /**
13370
- * Parent Event Names
13371
- *
13372
- * Contains the names of all parent classes up until BaseEvent, ordered from deepest to least deep inheritance.
13594
+ * The agent that ran the run
13373
13595
  */
13374
- readonly _parent_event_names: Array<string>;
13375
- [key: string]: unknown;
13596
+ agent: MinimalAgentInstanceDto;
13376
13597
  };
13377
13598
 
13378
13599
  /**
@@ -18539,7 +18760,7 @@ export type ContextualizedAgentEventWritable = {
18539
18760
  | ToolEventWritable
18540
18761
  | UserMessageEventWritable
18541
18762
  | RagStartEventWritable
18542
- | ScheduledStartEventWritable
18763
+ | CronStartEventWritable
18543
18764
  | ExceptionEventWritable
18544
18765
  | RagSuccessStopEventWritable
18545
18766
  | RagFailureStopEventWritable
@@ -18563,7 +18784,8 @@ export type ContextualizedAgentEventWritable = {
18563
18784
  | UnreadMailListedEventWritable
18564
18785
  | MailFetchedEventWritable
18565
18786
  | MailMovedEventWritable
18566
- | MailBatchDraftedEventWritable;
18787
+ | MailBatchDraftedEventWritable
18788
+ | MailBatchClassifiedEventWritable;
18567
18789
  };
18568
18790
 
18569
18791
  /**
@@ -18639,7 +18861,7 @@ export type ConversationTitleEventWritable = {
18639
18861
  * A FormKit element for editing the cron schedule of a schedulable agent profile.
18640
18862
  *
18641
18863
  * The element renders the five cron positions plus a timezone selector, and the submitted value
18642
- * matches the fields of `AgentSchedule`:
18864
+ * matches the fields of `CronSchedule`:
18643
18865
  * {
18644
18866
  * "minute": str,
18645
18867
  * "hour": str,
@@ -18655,19 +18877,19 @@ export type ConversationTitleEventWritable = {
18655
18877
  * ### Form Duality
18656
18878
  * ```python
18657
18879
  * from swiss_ai_hub.core.form.elements.cron_input import CronInput
18658
- * from swiss_ai_hub.core.scheduling.agent_schedule import AgentSchedule
18880
+ * from swiss_ai_hub.core.scheduling.cron_schedule import CronSchedule
18659
18881
  *
18660
18882
  * class MyAgentConfig(AgentConfig):
18661
18883
  * schedule: Annotated[
18662
- * AgentSchedule | CronInput | None,
18884
+ * CronSchedule | CronInput | None,
18663
18885
  * Field(description="When this profile runs automatically"),
18664
18886
  * ] = None
18665
18887
  *
18666
18888
  * # Form mode - for rendering:
18667
18889
  * config = MyAgentConfig(schedule=CronInput(label=LocaleString(en="Schedule")))
18668
18890
  *
18669
- * # Data mode - from submission (Pydantic validates into AgentSchedule):
18670
- * config = MyAgentConfig(schedule=AgentSchedule(hour="12", timezone="Europe/Zurich"))
18891
+ * # Data mode - from submission (Pydantic validates into CronSchedule):
18892
+ * config = MyAgentConfig(schedule=CronSchedule(hour="12", timezone="Europe/Zurich"))
18671
18893
  * ```
18672
18894
  */
18673
18895
  export type CronInputWritable = {
@@ -18767,6 +18989,57 @@ export type CronInputWritable = {
18767
18989
  [key: string]: unknown;
18768
18990
  };
18769
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
+
18770
19043
  /**
18771
19044
  * DatePicker
18772
19045
  *
@@ -21253,6 +21526,18 @@ export type LlmCostEventWritable = {
21253
21526
  * The name of the LLM service (e.g., 'openai/gpt-4') this event pertains to.
21254
21527
  */
21255
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;
21256
21541
  [key: string]: unknown;
21257
21542
  };
21258
21543
 
@@ -21787,6 +22072,75 @@ export type LocaleInputWritable = {
21787
22072
  [key: string]: unknown;
21788
22073
  };
21789
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
+
21790
22144
  /**
21791
22145
  * MailBatchDraftedEvent
21792
22146
  *
@@ -21826,6 +22180,20 @@ export type MailBatchDraftedEventWritable = {
21826
22180
  * Number of reply drafts created in this run.
21827
22181
  */
21828
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;
21829
22197
  /**
21830
22198
  * Drafted
21831
22199
  *
@@ -21962,6 +22330,12 @@ export type MailMovedEventWritable = {
21962
22330
  * Folder the message was moved into.
21963
22331
  */
21964
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;
21965
22339
  [key: string]: unknown;
21966
22340
  };
21967
22341
 
@@ -23772,57 +24146,6 @@ export type RunStatisticsWritable = {
23772
24146
  agent: MinimalAgentInstanceDtoWritable;
23773
24147
  };
23774
24148
 
23775
- /**
23776
- * ScheduledStartEvent
23777
- *
23778
- * Start event fired by the cron scheduler — handling it is what makes an agent schedulable.
23779
- *
23780
- * Mirrors how accepting a `UserMessageEvent` makes an agent conversational: `AgentRunner` derives
23781
- * `is_schedulable` from the start events an agent declares, so a blueprint opts in by adding a step
23782
- * that consumes this event, with no separate registration.
23783
- *
23784
- * Scheduled runs are system runs, so `user` is always None and the agent must not depend on an
23785
- * initiating identity. Whatever tenant context the agent needs comes from its own profile
23786
- * configuration (as `OrgMemoryWriteConfig.tenant_id` already does), never from the run.
23787
- */
23788
- export type ScheduledStartEventWritable = {
23789
- /**
23790
- * Event Id
23791
- */
23792
- event_id?: string;
23793
- /**
23794
- * Created At
23795
- *
23796
- * The time (in ns since epoch) the event was stored in the event store
23797
- */
23798
- created_at?: number;
23799
- /**
23800
- * Display name for the event
23801
- */
23802
- display_name?: LocaleString | null;
23803
- /**
23804
- * Display description for the event
23805
- */
23806
- display_description?: LocaleString | null;
23807
- /**
23808
- * Locale
23809
- *
23810
- * The locale the scheduled run reports its display output in.
23811
- */
23812
- locale?: string;
23813
- /**
23814
- * Always None — scheduled runs are system-initiated and carry no execution identity.
23815
- */
23816
- user?: UserIdentity | null;
23817
- /**
23818
- * Scheduled For
23819
- *
23820
- * 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.
23821
- */
23822
- scheduled_for: Date;
23823
- [key: string]: unknown;
23824
- };
23825
-
23826
24149
  /**
23827
24150
  * Select
23828
24151
  *
@@ -26222,6 +26545,92 @@ export type GetAgentEventTimeseriesResponses = {
26222
26545
  export type GetAgentEventTimeseriesResponse =
26223
26546
  GetAgentEventTimeseriesResponses[keyof GetAgentEventTimeseriesResponses];
26224
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
+
26225
26634
  export type GetLitellmModelsData = {
26226
26635
  body?: never;
26227
26636
  path: {