@adecore/agent-contracts 0.21.0 → 0.21.2

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/chat.d.ts CHANGED
@@ -428,6 +428,7 @@ export declare const ChatUiQueryReadingSchema: z.ZodObject<{
428
428
  value: z.ZodOptional<z.ZodUnknown>;
429
429
  readId: z.ZodOptional<z.ZodString>;
430
430
  readAt: z.ZodNumber;
431
+ code: z.ZodOptional<z.ZodString>;
431
432
  reason: z.ZodOptional<z.ZodString>;
432
433
  }, z.core.$strip>;
433
434
  export type ChatUiQueryReading = z.infer<typeof ChatUiQueryReadingSchema>;
@@ -457,12 +458,12 @@ export declare const ChatUiLinkReadingSchema: z.ZodObject<{
457
458
  conflicted: z.ZodOptional<z.ZodBoolean>;
458
459
  relativePath: z.ZodOptional<z.ZodString>;
459
460
  label: z.ZodOptional<z.ZodString>;
461
+ code: z.ZodOptional<z.ZodString>;
460
462
  reason: z.ZodOptional<z.ZodString>;
461
463
  }, z.core.$strip>;
462
464
  export type ChatUiLinkReading = z.infer<typeof ChatUiLinkReadingSchema>;
463
465
  export declare const ChatUiQueryStateSchema: z.ZodObject<{
464
466
  authorChatId: z.ZodString;
465
- access: z.ZodUnknown;
466
467
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
467
468
  revision: z.ZodString;
468
469
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -474,6 +475,7 @@ export declare const ChatUiQueryStateSchema: z.ZodObject<{
474
475
  value: z.ZodOptional<z.ZodUnknown>;
475
476
  readId: z.ZodOptional<z.ZodString>;
476
477
  readAt: z.ZodNumber;
478
+ code: z.ZodOptional<z.ZodString>;
477
479
  reason: z.ZodOptional<z.ZodString>;
478
480
  }, z.core.$strip>>;
479
481
  fallback: z.ZodString;
@@ -503,6 +505,7 @@ export declare const ChatUiQueryStateSchema: z.ZodObject<{
503
505
  conflicted: z.ZodOptional<z.ZodBoolean>;
504
506
  relativePath: z.ZodOptional<z.ZodString>;
505
507
  label: z.ZodOptional<z.ZodString>;
508
+ code: z.ZodOptional<z.ZodString>;
506
509
  reason: z.ZodOptional<z.ZodString>;
507
510
  }, z.core.$strip>>>;
508
511
  }, z.core.$strip>>;
@@ -529,7 +532,6 @@ export declare const ChatAssistantItemSchema: z.ZodObject<{
529
532
  }, z.core.$strip>>>;
530
533
  uiQueries: z.ZodOptional<z.ZodObject<{
531
534
  authorChatId: z.ZodString;
532
- access: z.ZodUnknown;
533
535
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
534
536
  revision: z.ZodString;
535
537
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -541,6 +543,7 @@ export declare const ChatAssistantItemSchema: z.ZodObject<{
541
543
  value: z.ZodOptional<z.ZodUnknown>;
542
544
  readId: z.ZodOptional<z.ZodString>;
543
545
  readAt: z.ZodNumber;
546
+ code: z.ZodOptional<z.ZodString>;
544
547
  reason: z.ZodOptional<z.ZodString>;
545
548
  }, z.core.$strip>>;
546
549
  fallback: z.ZodString;
@@ -570,6 +573,7 @@ export declare const ChatAssistantItemSchema: z.ZodObject<{
570
573
  conflicted: z.ZodOptional<z.ZodBoolean>;
571
574
  relativePath: z.ZodOptional<z.ZodString>;
572
575
  label: z.ZodOptional<z.ZodString>;
576
+ code: z.ZodOptional<z.ZodString>;
573
577
  reason: z.ZodOptional<z.ZodString>;
574
578
  }, z.core.$strip>>>;
575
579
  }, z.core.$strip>>;
@@ -990,7 +994,6 @@ export declare const ChatItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
990
994
  }, z.core.$strip>>>;
991
995
  uiQueries: z.ZodOptional<z.ZodObject<{
992
996
  authorChatId: z.ZodString;
993
- access: z.ZodUnknown;
994
997
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
995
998
  revision: z.ZodString;
996
999
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -1002,6 +1005,7 @@ export declare const ChatItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1002
1005
  value: z.ZodOptional<z.ZodUnknown>;
1003
1006
  readId: z.ZodOptional<z.ZodString>;
1004
1007
  readAt: z.ZodNumber;
1008
+ code: z.ZodOptional<z.ZodString>;
1005
1009
  reason: z.ZodOptional<z.ZodString>;
1006
1010
  }, z.core.$strip>>;
1007
1011
  fallback: z.ZodString;
@@ -1031,6 +1035,7 @@ export declare const ChatItemSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1031
1035
  conflicted: z.ZodOptional<z.ZodBoolean>;
1032
1036
  relativePath: z.ZodOptional<z.ZodString>;
1033
1037
  label: z.ZodOptional<z.ZodString>;
1038
+ code: z.ZodOptional<z.ZodString>;
1034
1039
  reason: z.ZodOptional<z.ZodString>;
1035
1040
  }, z.core.$strip>>>;
1036
1041
  }, z.core.$strip>>;
@@ -1322,7 +1327,6 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1322
1327
  }, z.core.$strip>>>;
1323
1328
  uiQueries: z.ZodOptional<z.ZodObject<{
1324
1329
  authorChatId: z.ZodString;
1325
- access: z.ZodUnknown;
1326
1330
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
1327
1331
  revision: z.ZodString;
1328
1332
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -1334,6 +1338,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1334
1338
  value: z.ZodOptional<z.ZodUnknown>;
1335
1339
  readId: z.ZodOptional<z.ZodString>;
1336
1340
  readAt: z.ZodNumber;
1341
+ code: z.ZodOptional<z.ZodString>;
1337
1342
  reason: z.ZodOptional<z.ZodString>;
1338
1343
  }, z.core.$strip>>;
1339
1344
  fallback: z.ZodString;
@@ -1363,6 +1368,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1363
1368
  conflicted: z.ZodOptional<z.ZodBoolean>;
1364
1369
  relativePath: z.ZodOptional<z.ZodString>;
1365
1370
  label: z.ZodOptional<z.ZodString>;
1371
+ code: z.ZodOptional<z.ZodString>;
1366
1372
  reason: z.ZodOptional<z.ZodString>;
1367
1373
  }, z.core.$strip>>>;
1368
1374
  }, z.core.$strip>>;
@@ -1599,7 +1605,6 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1599
1605
  ui: z.ZodOptional<z.ZodArray<z.ZodType<import("@adecore/intelligent-ui/compiler").UiBlock, unknown, z.core.$ZodTypeInternals<import("@adecore/intelligent-ui/compiler").UiBlock, unknown>>>>;
1600
1606
  uiQueries: z.ZodOptional<z.ZodObject<{
1601
1607
  authorChatId: z.ZodString;
1602
- access: z.ZodUnknown;
1603
1608
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
1604
1609
  revision: z.ZodString;
1605
1610
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -1611,6 +1616,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1611
1616
  value: z.ZodOptional<z.ZodUnknown>;
1612
1617
  readId: z.ZodOptional<z.ZodString>;
1613
1618
  readAt: z.ZodNumber;
1619
+ code: z.ZodOptional<z.ZodString>;
1614
1620
  reason: z.ZodOptional<z.ZodString>;
1615
1621
  }, z.core.$strip>>;
1616
1622
  fallback: z.ZodString;
@@ -1640,6 +1646,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1640
1646
  conflicted: z.ZodOptional<z.ZodBoolean>;
1641
1647
  relativePath: z.ZodOptional<z.ZodString>;
1642
1648
  label: z.ZodOptional<z.ZodString>;
1649
+ code: z.ZodOptional<z.ZodString>;
1643
1650
  reason: z.ZodOptional<z.ZodString>;
1644
1651
  }, z.core.$strip>>>;
1645
1652
  }, z.core.$strip>>;
@@ -1997,7 +2004,6 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
1997
2004
  }, z.core.$strip>>>;
1998
2005
  uiQueries: z.ZodOptional<z.ZodObject<{
1999
2006
  authorChatId: z.ZodString;
2000
- access: z.ZodUnknown;
2001
2007
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
2002
2008
  revision: z.ZodString;
2003
2009
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2009,6 +2015,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2009
2015
  value: z.ZodOptional<z.ZodUnknown>;
2010
2016
  readId: z.ZodOptional<z.ZodString>;
2011
2017
  readAt: z.ZodNumber;
2018
+ code: z.ZodOptional<z.ZodString>;
2012
2019
  reason: z.ZodOptional<z.ZodString>;
2013
2020
  }, z.core.$strip>>;
2014
2021
  fallback: z.ZodString;
@@ -2038,6 +2045,7 @@ export declare const ChatEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
2038
2045
  conflicted: z.ZodOptional<z.ZodBoolean>;
2039
2046
  relativePath: z.ZodOptional<z.ZodString>;
2040
2047
  label: z.ZodOptional<z.ZodString>;
2048
+ code: z.ZodOptional<z.ZodString>;
2041
2049
  reason: z.ZodOptional<z.ZodString>;
2042
2050
  }, z.core.$strip>>>;
2043
2051
  }, z.core.$strip>>;
@@ -2322,7 +2330,6 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
2322
2330
  }, z.core.$strip>>>;
2323
2331
  uiQueries: z.ZodOptional<z.ZodObject<{
2324
2332
  authorChatId: z.ZodString;
2325
- access: z.ZodUnknown;
2326
2333
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
2327
2334
  revision: z.ZodString;
2328
2335
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2334,6 +2341,7 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
2334
2341
  value: z.ZodOptional<z.ZodUnknown>;
2335
2342
  readId: z.ZodOptional<z.ZodString>;
2336
2343
  readAt: z.ZodNumber;
2344
+ code: z.ZodOptional<z.ZodString>;
2337
2345
  reason: z.ZodOptional<z.ZodString>;
2338
2346
  }, z.core.$strip>>;
2339
2347
  fallback: z.ZodString;
@@ -2363,6 +2371,7 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
2363
2371
  conflicted: z.ZodOptional<z.ZodBoolean>;
2364
2372
  relativePath: z.ZodOptional<z.ZodString>;
2365
2373
  label: z.ZodOptional<z.ZodString>;
2374
+ code: z.ZodOptional<z.ZodString>;
2366
2375
  reason: z.ZodOptional<z.ZodString>;
2367
2376
  }, z.core.$strip>>>;
2368
2377
  }, z.core.$strip>>;
@@ -2599,7 +2608,6 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
2599
2608
  ui: z.ZodOptional<z.ZodArray<z.ZodType<import("@adecore/intelligent-ui/compiler").UiBlock, unknown, z.core.$ZodTypeInternals<import("@adecore/intelligent-ui/compiler").UiBlock, unknown>>>>;
2600
2609
  uiQueries: z.ZodOptional<z.ZodObject<{
2601
2610
  authorChatId: z.ZodString;
2602
- access: z.ZodUnknown;
2603
2611
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
2604
2612
  revision: z.ZodString;
2605
2613
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2611,6 +2619,7 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
2611
2619
  value: z.ZodOptional<z.ZodUnknown>;
2612
2620
  readId: z.ZodOptional<z.ZodString>;
2613
2621
  readAt: z.ZodNumber;
2622
+ code: z.ZodOptional<z.ZodString>;
2614
2623
  reason: z.ZodOptional<z.ZodString>;
2615
2624
  }, z.core.$strip>>;
2616
2625
  fallback: z.ZodString;
@@ -2640,6 +2649,7 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
2640
2649
  conflicted: z.ZodOptional<z.ZodBoolean>;
2641
2650
  relativePath: z.ZodOptional<z.ZodString>;
2642
2651
  label: z.ZodOptional<z.ZodString>;
2652
+ code: z.ZodOptional<z.ZodString>;
2643
2653
  reason: z.ZodOptional<z.ZodString>;
2644
2654
  }, z.core.$strip>>>;
2645
2655
  }, z.core.$strip>>;
@@ -2997,7 +3007,6 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
2997
3007
  }, z.core.$strip>>>;
2998
3008
  uiQueries: z.ZodOptional<z.ZodObject<{
2999
3009
  authorChatId: z.ZodString;
3000
- access: z.ZodUnknown;
3001
3010
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
3002
3011
  revision: z.ZodString;
3003
3012
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -3009,6 +3018,7 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
3009
3018
  value: z.ZodOptional<z.ZodUnknown>;
3010
3019
  readId: z.ZodOptional<z.ZodString>;
3011
3020
  readAt: z.ZodNumber;
3021
+ code: z.ZodOptional<z.ZodString>;
3012
3022
  reason: z.ZodOptional<z.ZodString>;
3013
3023
  }, z.core.$strip>>;
3014
3024
  fallback: z.ZodString;
@@ -3038,6 +3048,7 @@ export declare const ChatEventEnvelopeSchema: z.ZodObject<{
3038
3048
  conflicted: z.ZodOptional<z.ZodBoolean>;
3039
3049
  relativePath: z.ZodOptional<z.ZodString>;
3040
3050
  label: z.ZodOptional<z.ZodString>;
3051
+ code: z.ZodOptional<z.ZodString>;
3041
3052
  reason: z.ZodOptional<z.ZodString>;
3042
3053
  }, z.core.$strip>>>;
3043
3054
  }, z.core.$strip>>;
@@ -3422,7 +3433,6 @@ export declare const ChatHistoryResultSchema: z.ZodObject<{
3422
3433
  }, z.core.$strip>>>;
3423
3434
  uiQueries: z.ZodOptional<z.ZodObject<{
3424
3435
  authorChatId: z.ZodString;
3425
- access: z.ZodUnknown;
3426
3436
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
3427
3437
  revision: z.ZodString;
3428
3438
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -3434,6 +3444,7 @@ export declare const ChatHistoryResultSchema: z.ZodObject<{
3434
3444
  value: z.ZodOptional<z.ZodUnknown>;
3435
3445
  readId: z.ZodOptional<z.ZodString>;
3436
3446
  readAt: z.ZodNumber;
3447
+ code: z.ZodOptional<z.ZodString>;
3437
3448
  reason: z.ZodOptional<z.ZodString>;
3438
3449
  }, z.core.$strip>>;
3439
3450
  fallback: z.ZodString;
@@ -3463,6 +3474,7 @@ export declare const ChatHistoryResultSchema: z.ZodObject<{
3463
3474
  conflicted: z.ZodOptional<z.ZodBoolean>;
3464
3475
  relativePath: z.ZodOptional<z.ZodString>;
3465
3476
  label: z.ZodOptional<z.ZodString>;
3477
+ code: z.ZodOptional<z.ZodString>;
3466
3478
  reason: z.ZodOptional<z.ZodString>;
3467
3479
  }, z.core.$strip>>>;
3468
3480
  }, z.core.$strip>>;
@@ -3775,7 +3787,6 @@ export declare const ChatSubagentResultSchema: z.ZodObject<{
3775
3787
  }, z.core.$strip>>>;
3776
3788
  uiQueries: z.ZodOptional<z.ZodObject<{
3777
3789
  authorChatId: z.ZodString;
3778
- access: z.ZodUnknown;
3779
3790
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
3780
3791
  revision: z.ZodString;
3781
3792
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -3787,6 +3798,7 @@ export declare const ChatSubagentResultSchema: z.ZodObject<{
3787
3798
  value: z.ZodOptional<z.ZodUnknown>;
3788
3799
  readId: z.ZodOptional<z.ZodString>;
3789
3800
  readAt: z.ZodNumber;
3801
+ code: z.ZodOptional<z.ZodString>;
3790
3802
  reason: z.ZodOptional<z.ZodString>;
3791
3803
  }, z.core.$strip>>;
3792
3804
  fallback: z.ZodString;
@@ -3816,6 +3828,7 @@ export declare const ChatSubagentResultSchema: z.ZodObject<{
3816
3828
  conflicted: z.ZodOptional<z.ZodBoolean>;
3817
3829
  relativePath: z.ZodOptional<z.ZodString>;
3818
3830
  label: z.ZodOptional<z.ZodString>;
3831
+ code: z.ZodOptional<z.ZodString>;
3819
3832
  reason: z.ZodOptional<z.ZodString>;
3820
3833
  }, z.core.$strip>>>;
3821
3834
  }, z.core.$strip>>;
@@ -4563,7 +4576,6 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
4563
4576
  }, z.core.$strip>>>;
4564
4577
  uiQueries: z.ZodOptional<z.ZodObject<{
4565
4578
  authorChatId: z.ZodString;
4566
- access: z.ZodUnknown;
4567
4579
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
4568
4580
  revision: z.ZodString;
4569
4581
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -4575,6 +4587,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
4575
4587
  value: z.ZodOptional<z.ZodUnknown>;
4576
4588
  readId: z.ZodOptional<z.ZodString>;
4577
4589
  readAt: z.ZodNumber;
4590
+ code: z.ZodOptional<z.ZodString>;
4578
4591
  reason: z.ZodOptional<z.ZodString>;
4579
4592
  }, z.core.$strip>>;
4580
4593
  fallback: z.ZodString;
@@ -4604,6 +4617,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
4604
4617
  conflicted: z.ZodOptional<z.ZodBoolean>;
4605
4618
  relativePath: z.ZodOptional<z.ZodString>;
4606
4619
  label: z.ZodOptional<z.ZodString>;
4620
+ code: z.ZodOptional<z.ZodString>;
4607
4621
  reason: z.ZodOptional<z.ZodString>;
4608
4622
  }, z.core.$strip>>>;
4609
4623
  }, z.core.$strip>>;
@@ -4886,7 +4900,6 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
4886
4900
  }, z.core.$strip>>>;
4887
4901
  uiQueries: z.ZodOptional<z.ZodObject<{
4888
4902
  authorChatId: z.ZodString;
4889
- access: z.ZodUnknown;
4890
4903
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
4891
4904
  revision: z.ZodString;
4892
4905
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -4898,6 +4911,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
4898
4911
  value: z.ZodOptional<z.ZodUnknown>;
4899
4912
  readId: z.ZodOptional<z.ZodString>;
4900
4913
  readAt: z.ZodNumber;
4914
+ code: z.ZodOptional<z.ZodString>;
4901
4915
  reason: z.ZodOptional<z.ZodString>;
4902
4916
  }, z.core.$strip>>;
4903
4917
  fallback: z.ZodString;
@@ -4927,6 +4941,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
4927
4941
  conflicted: z.ZodOptional<z.ZodBoolean>;
4928
4942
  relativePath: z.ZodOptional<z.ZodString>;
4929
4943
  label: z.ZodOptional<z.ZodString>;
4944
+ code: z.ZodOptional<z.ZodString>;
4930
4945
  reason: z.ZodOptional<z.ZodString>;
4931
4946
  }, z.core.$strip>>>;
4932
4947
  }, z.core.$strip>>;
@@ -5208,7 +5223,6 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5208
5223
  }, z.core.$strip>>>;
5209
5224
  uiQueries: z.ZodOptional<z.ZodObject<{
5210
5225
  authorChatId: z.ZodString;
5211
- access: z.ZodUnknown;
5212
5226
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
5213
5227
  revision: z.ZodString;
5214
5228
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -5220,6 +5234,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5220
5234
  value: z.ZodOptional<z.ZodUnknown>;
5221
5235
  readId: z.ZodOptional<z.ZodString>;
5222
5236
  readAt: z.ZodNumber;
5237
+ code: z.ZodOptional<z.ZodString>;
5223
5238
  reason: z.ZodOptional<z.ZodString>;
5224
5239
  }, z.core.$strip>>;
5225
5240
  fallback: z.ZodString;
@@ -5249,6 +5264,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5249
5264
  conflicted: z.ZodOptional<z.ZodBoolean>;
5250
5265
  relativePath: z.ZodOptional<z.ZodString>;
5251
5266
  label: z.ZodOptional<z.ZodString>;
5267
+ code: z.ZodOptional<z.ZodString>;
5252
5268
  reason: z.ZodOptional<z.ZodString>;
5253
5269
  }, z.core.$strip>>>;
5254
5270
  }, z.core.$strip>>;
@@ -5485,7 +5501,6 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5485
5501
  ui: z.ZodOptional<z.ZodArray<z.ZodType<import("@adecore/intelligent-ui/compiler").UiBlock, unknown, z.core.$ZodTypeInternals<import("@adecore/intelligent-ui/compiler").UiBlock, unknown>>>>;
5486
5502
  uiQueries: z.ZodOptional<z.ZodObject<{
5487
5503
  authorChatId: z.ZodString;
5488
- access: z.ZodUnknown;
5489
5504
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
5490
5505
  revision: z.ZodString;
5491
5506
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -5497,6 +5512,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5497
5512
  value: z.ZodOptional<z.ZodUnknown>;
5498
5513
  readId: z.ZodOptional<z.ZodString>;
5499
5514
  readAt: z.ZodNumber;
5515
+ code: z.ZodOptional<z.ZodString>;
5500
5516
  reason: z.ZodOptional<z.ZodString>;
5501
5517
  }, z.core.$strip>>;
5502
5518
  fallback: z.ZodString;
@@ -5526,6 +5542,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5526
5542
  conflicted: z.ZodOptional<z.ZodBoolean>;
5527
5543
  relativePath: z.ZodOptional<z.ZodString>;
5528
5544
  label: z.ZodOptional<z.ZodString>;
5545
+ code: z.ZodOptional<z.ZodString>;
5529
5546
  reason: z.ZodOptional<z.ZodString>;
5530
5547
  }, z.core.$strip>>>;
5531
5548
  }, z.core.$strip>>;
@@ -5883,7 +5900,6 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5883
5900
  }, z.core.$strip>>>;
5884
5901
  uiQueries: z.ZodOptional<z.ZodObject<{
5885
5902
  authorChatId: z.ZodString;
5886
- access: z.ZodUnknown;
5887
5903
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
5888
5904
  revision: z.ZodString;
5889
5905
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -5895,6 +5911,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5895
5911
  value: z.ZodOptional<z.ZodUnknown>;
5896
5912
  readId: z.ZodOptional<z.ZodString>;
5897
5913
  readAt: z.ZodNumber;
5914
+ code: z.ZodOptional<z.ZodString>;
5898
5915
  reason: z.ZodOptional<z.ZodString>;
5899
5916
  }, z.core.$strip>>;
5900
5917
  fallback: z.ZodString;
@@ -5924,6 +5941,7 @@ export declare const ChatAttachResultSchema: z.ZodObject<{
5924
5941
  conflicted: z.ZodOptional<z.ZodBoolean>;
5925
5942
  relativePath: z.ZodOptional<z.ZodString>;
5926
5943
  label: z.ZodOptional<z.ZodString>;
5944
+ code: z.ZodOptional<z.ZodString>;
5927
5945
  reason: z.ZodOptional<z.ZodString>;
5928
5946
  }, z.core.$strip>>>;
5929
5947
  }, z.core.$strip>>;
package/dist/chat.js CHANGED
@@ -29,12 +29,14 @@ export const CHAT_ATTACHMENTS_MAX_BYTES = 10 * 1024 * 1024;
29
29
  export const CHAT_ATTACHMENT_MAX_BYTES = CHAT_ATTACHMENTS_MAX_BYTES;
30
30
  export const CHAT_ATTACHMENTS_MAX_COUNT = 8;
31
31
  const MAX_BASE64_LENGTH = Math.ceil(CHAT_ATTACHMENT_MAX_BYTES / 3) * 4;
32
+ function paddingOf(data) {
33
+ return data.endsWith('==') ? 2 : data.endsWith('=') ? 1 : 0;
34
+ }
32
35
  export function attachmentBytes(data) {
33
- return Math.floor((data.length * 3) / 4) - (data.endsWith('==') ? 2 : data.endsWith('=') ? 1 : 0);
36
+ return Math.floor((data.length * 3) / 4) - paddingOf(data);
34
37
  }
35
38
  function isBase64(data) {
36
- const padding = data.endsWith('==') ? 2 : data.endsWith('=') ? 1 : 0;
37
- return data.length % 4 === 0 && !/[^A-Za-z0-9+/]/.test(data.slice(0, data.length - padding));
39
+ return data.length % 4 === 0 && !/[^A-Za-z0-9+/]/.test(data.slice(0, data.length - paddingOf(data)));
38
40
  }
39
41
  const IMAGE_MIME_BY_EXTENSION = new Map([
40
42
  ['png', 'image/png'],
@@ -259,17 +261,20 @@ export const ChatUserItemSchema = z.object({
259
261
  attachments: z.array(ChatAttachmentSchema).optional(),
260
262
  uiChoice: ChatUiChoiceOriginSchema.optional()
261
263
  });
264
+ // `state` is a frozen set: native clients validate these payloads whole, so a new state would fail them.
262
265
  export const ChatUiQueryReadingSchema = z.object({
263
266
  state: z.enum(['fresh', 'failed', 'refused']),
264
267
  value: z.unknown().optional(),
265
268
  readId: z.string().optional(),
266
269
  readAt: z.number().nonnegative(),
270
+ // A code that names the reason across versions, for a client that says it in its own words; open, so a new one fails nobody.
271
+ code: z.string().optional(),
267
272
  reason: z.string().optional()
268
273
  });
269
274
  export const ChatUiLinkReadingSchema = UiLinkResolutionSchema;
275
+ // The writer's captured access stays on the daemon; a record from before that still parses and drops it.
270
276
  export const ChatUiQueryStateSchema = z.object({
271
277
  authorChatId: z.string(),
272
- access: z.unknown(),
273
278
  blocks: z.record(z.string(), z.object({
274
279
  revision: z.string(),
275
280
  readings: z.record(z.string(), ChatUiQueryReadingSchema),
@@ -405,6 +410,7 @@ export const ChatSubagentItemSchema = z.object({
405
410
  // Where the CLI keeps this subagent's own conversation; set once the daemon found it.
406
411
  native: z.object({ agentId: z.string().optional(), threadId: z.string().optional() }).optional(),
407
412
  // Who opened it: the CLI with its own tool, or a verb with `--task` that made a node; absent is `native`.
413
+ // The second value keeps its legacy spelling, since stored threads carry it.
408
414
  origin: z.enum(['native', 'ruimte']).optional(),
409
415
  // The node a `--task` opened, whose own conversation this row stands for.
410
416
  childId: z.string().optional(),
@@ -511,7 +517,7 @@ export const ChatCompactionItemSchema = z.object({
511
517
  });
512
518
  /*
513
519
  * Never a new member here, and never a new value in an enum a chat or a push already carries: the
514
- * iPhone app validates `chat.attach` and `chat.history` whole, so one item it does not know rejects
520
+ * native client validates `chat.attach` and `chat.history` whole, so one item it does not know rejects
515
521
  * the entire conversation. Add optional fields instead.
516
522
  */
517
523
  export const ChatItemSchema = z.discriminatedUnion('kind', [
@@ -232,7 +232,6 @@ export declare const AGENT_REQUEST_SCHEMAS: {
232
232
  }, z.core.$strip>>>;
233
233
  uiQueries: z.ZodOptional<z.ZodObject<{
234
234
  authorChatId: z.ZodString;
235
- access: z.ZodUnknown;
236
235
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
237
236
  revision: z.ZodString;
238
237
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -244,6 +243,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
244
243
  value: z.ZodOptional<z.ZodUnknown>;
245
244
  readId: z.ZodOptional<z.ZodString>;
246
245
  readAt: z.ZodNumber;
246
+ code: z.ZodOptional<z.ZodString>;
247
247
  reason: z.ZodOptional<z.ZodString>;
248
248
  }, z.core.$strip>>;
249
249
  fallback: z.ZodString;
@@ -273,6 +273,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
273
273
  conflicted: z.ZodOptional<z.ZodBoolean>;
274
274
  relativePath: z.ZodOptional<z.ZodString>;
275
275
  label: z.ZodOptional<z.ZodString>;
276
+ code: z.ZodOptional<z.ZodString>;
276
277
  reason: z.ZodOptional<z.ZodString>;
277
278
  }, z.core.$strip>>>;
278
279
  }, z.core.$strip>>;
@@ -713,7 +714,6 @@ export declare const AGENT_REQUEST_SCHEMAS: {
713
714
  }, z.core.$strip>>>;
714
715
  uiQueries: z.ZodOptional<z.ZodObject<{
715
716
  authorChatId: z.ZodString;
716
- access: z.ZodUnknown;
717
717
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
718
718
  revision: z.ZodString;
719
719
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -725,6 +725,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
725
725
  value: z.ZodOptional<z.ZodUnknown>;
726
726
  readId: z.ZodOptional<z.ZodString>;
727
727
  readAt: z.ZodNumber;
728
+ code: z.ZodOptional<z.ZodString>;
728
729
  reason: z.ZodOptional<z.ZodString>;
729
730
  }, z.core.$strip>>;
730
731
  fallback: z.ZodString;
@@ -754,6 +755,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
754
755
  conflicted: z.ZodOptional<z.ZodBoolean>;
755
756
  relativePath: z.ZodOptional<z.ZodString>;
756
757
  label: z.ZodOptional<z.ZodString>;
758
+ code: z.ZodOptional<z.ZodString>;
757
759
  reason: z.ZodOptional<z.ZodString>;
758
760
  }, z.core.$strip>>>;
759
761
  }, z.core.$strip>>;
@@ -1036,7 +1038,6 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1036
1038
  }, z.core.$strip>>>;
1037
1039
  uiQueries: z.ZodOptional<z.ZodObject<{
1038
1040
  authorChatId: z.ZodString;
1039
- access: z.ZodUnknown;
1040
1041
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
1041
1042
  revision: z.ZodString;
1042
1043
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -1048,6 +1049,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1048
1049
  value: z.ZodOptional<z.ZodUnknown>;
1049
1050
  readId: z.ZodOptional<z.ZodString>;
1050
1051
  readAt: z.ZodNumber;
1052
+ code: z.ZodOptional<z.ZodString>;
1051
1053
  reason: z.ZodOptional<z.ZodString>;
1052
1054
  }, z.core.$strip>>;
1053
1055
  fallback: z.ZodString;
@@ -1077,6 +1079,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1077
1079
  conflicted: z.ZodOptional<z.ZodBoolean>;
1078
1080
  relativePath: z.ZodOptional<z.ZodString>;
1079
1081
  label: z.ZodOptional<z.ZodString>;
1082
+ code: z.ZodOptional<z.ZodString>;
1080
1083
  reason: z.ZodOptional<z.ZodString>;
1081
1084
  }, z.core.$strip>>>;
1082
1085
  }, z.core.$strip>>;
@@ -1358,7 +1361,6 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1358
1361
  }, z.core.$strip>>>;
1359
1362
  uiQueries: z.ZodOptional<z.ZodObject<{
1360
1363
  authorChatId: z.ZodString;
1361
- access: z.ZodUnknown;
1362
1364
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
1363
1365
  revision: z.ZodString;
1364
1366
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -1370,6 +1372,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1370
1372
  value: z.ZodOptional<z.ZodUnknown>;
1371
1373
  readId: z.ZodOptional<z.ZodString>;
1372
1374
  readAt: z.ZodNumber;
1375
+ code: z.ZodOptional<z.ZodString>;
1373
1376
  reason: z.ZodOptional<z.ZodString>;
1374
1377
  }, z.core.$strip>>;
1375
1378
  fallback: z.ZodString;
@@ -1399,6 +1402,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1399
1402
  conflicted: z.ZodOptional<z.ZodBoolean>;
1400
1403
  relativePath: z.ZodOptional<z.ZodString>;
1401
1404
  label: z.ZodOptional<z.ZodString>;
1405
+ code: z.ZodOptional<z.ZodString>;
1402
1406
  reason: z.ZodOptional<z.ZodString>;
1403
1407
  }, z.core.$strip>>>;
1404
1408
  }, z.core.$strip>>;
@@ -1635,7 +1639,6 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1635
1639
  ui: z.ZodOptional<z.ZodArray<z.ZodType<import("@adecore/intelligent-ui/compiler").UiBlock, unknown, z.core.$ZodTypeInternals<import("@adecore/intelligent-ui/compiler").UiBlock, unknown>>>>;
1636
1640
  uiQueries: z.ZodOptional<z.ZodObject<{
1637
1641
  authorChatId: z.ZodString;
1638
- access: z.ZodUnknown;
1639
1642
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
1640
1643
  revision: z.ZodString;
1641
1644
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -1647,6 +1650,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1647
1650
  value: z.ZodOptional<z.ZodUnknown>;
1648
1651
  readId: z.ZodOptional<z.ZodString>;
1649
1652
  readAt: z.ZodNumber;
1653
+ code: z.ZodOptional<z.ZodString>;
1650
1654
  reason: z.ZodOptional<z.ZodString>;
1651
1655
  }, z.core.$strip>>;
1652
1656
  fallback: z.ZodString;
@@ -1676,6 +1680,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
1676
1680
  conflicted: z.ZodOptional<z.ZodBoolean>;
1677
1681
  relativePath: z.ZodOptional<z.ZodString>;
1678
1682
  label: z.ZodOptional<z.ZodString>;
1683
+ code: z.ZodOptional<z.ZodString>;
1679
1684
  reason: z.ZodOptional<z.ZodString>;
1680
1685
  }, z.core.$strip>>>;
1681
1686
  }, z.core.$strip>>;
@@ -2033,7 +2038,6 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2033
2038
  }, z.core.$strip>>>;
2034
2039
  uiQueries: z.ZodOptional<z.ZodObject<{
2035
2040
  authorChatId: z.ZodString;
2036
- access: z.ZodUnknown;
2037
2041
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
2038
2042
  revision: z.ZodString;
2039
2043
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -2045,6 +2049,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2045
2049
  value: z.ZodOptional<z.ZodUnknown>;
2046
2050
  readId: z.ZodOptional<z.ZodString>;
2047
2051
  readAt: z.ZodNumber;
2052
+ code: z.ZodOptional<z.ZodString>;
2048
2053
  reason: z.ZodOptional<z.ZodString>;
2049
2054
  }, z.core.$strip>>;
2050
2055
  fallback: z.ZodString;
@@ -2074,6 +2079,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2074
2079
  conflicted: z.ZodOptional<z.ZodBoolean>;
2075
2080
  relativePath: z.ZodOptional<z.ZodString>;
2076
2081
  label: z.ZodOptional<z.ZodString>;
2082
+ code: z.ZodOptional<z.ZodString>;
2077
2083
  reason: z.ZodOptional<z.ZodString>;
2078
2084
  }, z.core.$strip>>>;
2079
2085
  }, z.core.$strip>>;
@@ -2403,6 +2409,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2403
2409
  conflicted: z.ZodOptional<z.ZodBoolean>;
2404
2410
  relativePath: z.ZodOptional<z.ZodString>;
2405
2411
  label: z.ZodOptional<z.ZodString>;
2412
+ code: z.ZodOptional<z.ZodString>;
2406
2413
  reason: z.ZodOptional<z.ZodString>;
2407
2414
  }, z.core.$strip>;
2408
2415
  };
@@ -2424,6 +2431,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
2424
2431
  value: z.ZodOptional<z.ZodUnknown>;
2425
2432
  readId: z.ZodOptional<z.ZodString>;
2426
2433
  readAt: z.ZodNumber;
2434
+ code: z.ZodOptional<z.ZodString>;
2427
2435
  reason: z.ZodOptional<z.ZodString>;
2428
2436
  }, z.core.$strip>;
2429
2437
  };
@@ -3207,7 +3215,6 @@ export declare const AGENT_REQUEST_SCHEMAS: {
3207
3215
  }, z.core.$strip>>>;
3208
3216
  uiQueries: z.ZodOptional<z.ZodObject<{
3209
3217
  authorChatId: z.ZodString;
3210
- access: z.ZodUnknown;
3211
3218
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
3212
3219
  revision: z.ZodString;
3213
3220
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -3219,6 +3226,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
3219
3226
  value: z.ZodOptional<z.ZodUnknown>;
3220
3227
  readId: z.ZodOptional<z.ZodString>;
3221
3228
  readAt: z.ZodNumber;
3229
+ code: z.ZodOptional<z.ZodString>;
3222
3230
  reason: z.ZodOptional<z.ZodString>;
3223
3231
  }, z.core.$strip>>;
3224
3232
  fallback: z.ZodString;
@@ -3248,6 +3256,7 @@ export declare const AGENT_REQUEST_SCHEMAS: {
3248
3256
  conflicted: z.ZodOptional<z.ZodBoolean>;
3249
3257
  relativePath: z.ZodOptional<z.ZodString>;
3250
3258
  label: z.ZodOptional<z.ZodString>;
3259
+ code: z.ZodOptional<z.ZodString>;
3251
3260
  reason: z.ZodOptional<z.ZodString>;
3252
3261
  }, z.core.$strip>>>;
3253
3262
  }, z.core.$strip>>;
@@ -4383,7 +4392,6 @@ export declare const AGENT_EVENT_SCHEMAS: {
4383
4392
  }, z.core.$strip>>>;
4384
4393
  uiQueries: z.ZodOptional<z.ZodObject<{
4385
4394
  authorChatId: z.ZodString;
4386
- access: z.ZodUnknown;
4387
4395
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
4388
4396
  revision: z.ZodString;
4389
4397
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -4395,6 +4403,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
4395
4403
  value: z.ZodOptional<z.ZodUnknown>;
4396
4404
  readId: z.ZodOptional<z.ZodString>;
4397
4405
  readAt: z.ZodNumber;
4406
+ code: z.ZodOptional<z.ZodString>;
4398
4407
  reason: z.ZodOptional<z.ZodString>;
4399
4408
  }, z.core.$strip>>;
4400
4409
  fallback: z.ZodString;
@@ -4424,6 +4433,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
4424
4433
  conflicted: z.ZodOptional<z.ZodBoolean>;
4425
4434
  relativePath: z.ZodOptional<z.ZodString>;
4426
4435
  label: z.ZodOptional<z.ZodString>;
4436
+ code: z.ZodOptional<z.ZodString>;
4427
4437
  reason: z.ZodOptional<z.ZodString>;
4428
4438
  }, z.core.$strip>>>;
4429
4439
  }, z.core.$strip>>;
@@ -4660,7 +4670,6 @@ export declare const AGENT_EVENT_SCHEMAS: {
4660
4670
  ui: z.ZodOptional<z.ZodArray<z.ZodType<import("@adecore/intelligent-ui/compiler").UiBlock, unknown, z.core.$ZodTypeInternals<import("@adecore/intelligent-ui/compiler").UiBlock, unknown>>>>;
4661
4671
  uiQueries: z.ZodOptional<z.ZodObject<{
4662
4672
  authorChatId: z.ZodString;
4663
- access: z.ZodUnknown;
4664
4673
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
4665
4674
  revision: z.ZodString;
4666
4675
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -4672,6 +4681,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
4672
4681
  value: z.ZodOptional<z.ZodUnknown>;
4673
4682
  readId: z.ZodOptional<z.ZodString>;
4674
4683
  readAt: z.ZodNumber;
4684
+ code: z.ZodOptional<z.ZodString>;
4675
4685
  reason: z.ZodOptional<z.ZodString>;
4676
4686
  }, z.core.$strip>>;
4677
4687
  fallback: z.ZodString;
@@ -4701,6 +4711,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
4701
4711
  conflicted: z.ZodOptional<z.ZodBoolean>;
4702
4712
  relativePath: z.ZodOptional<z.ZodString>;
4703
4713
  label: z.ZodOptional<z.ZodString>;
4714
+ code: z.ZodOptional<z.ZodString>;
4704
4715
  reason: z.ZodOptional<z.ZodString>;
4705
4716
  }, z.core.$strip>>>;
4706
4717
  }, z.core.$strip>>;
@@ -5058,7 +5069,6 @@ export declare const AGENT_EVENT_SCHEMAS: {
5058
5069
  }, z.core.$strip>>>;
5059
5070
  uiQueries: z.ZodOptional<z.ZodObject<{
5060
5071
  authorChatId: z.ZodString;
5061
- access: z.ZodUnknown;
5062
5072
  blocks: z.ZodRecord<z.ZodString, z.ZodObject<{
5063
5073
  revision: z.ZodString;
5064
5074
  readings: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -5070,6 +5080,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
5070
5080
  value: z.ZodOptional<z.ZodUnknown>;
5071
5081
  readId: z.ZodOptional<z.ZodString>;
5072
5082
  readAt: z.ZodNumber;
5083
+ code: z.ZodOptional<z.ZodString>;
5073
5084
  reason: z.ZodOptional<z.ZodString>;
5074
5085
  }, z.core.$strip>>;
5075
5086
  fallback: z.ZodString;
@@ -5099,6 +5110,7 @@ export declare const AGENT_EVENT_SCHEMAS: {
5099
5110
  conflicted: z.ZodOptional<z.ZodBoolean>;
5100
5111
  relativePath: z.ZodOptional<z.ZodString>;
5101
5112
  label: z.ZodOptional<z.ZodString>;
5113
+ code: z.ZodOptional<z.ZodString>;
5102
5114
  reason: z.ZodOptional<z.ZodString>;
5103
5115
  }, z.core.$strip>>>;
5104
5116
  }, z.core.$strip>>;
package/dist/text.js CHANGED
@@ -2,7 +2,7 @@ const graphemes = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
2
2
  /*
3
3
  * The longest start of `text` that fits in `max` UTF-16 units, the measure a schema's `max` counts in,
4
4
  * cut only between characters as a person sees them. A cut between the halves of a surrogate pair
5
- * leaves a lone half, which JSON writes as an escape the iPhone app refuses along with its whole frame.
5
+ * leaves a lone half, which JSON writes as an escape a native client refuses along with its whole frame.
6
6
  */
7
7
  export function clipText(text, max) {
8
8
  if (text.length <= max) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adecore/agent-contracts",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "description": "Schemas and port contracts for agent chats, provider accounts, models and usage.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -81,7 +81,7 @@
81
81
  "test": "bun --conditions=source test"
82
82
  },
83
83
  "dependencies": {
84
- "@adecore/intelligent-ui": "0.21.0",
84
+ "@adecore/intelligent-ui": "0.21.2",
85
85
  "zod": "^4.6.5"
86
86
  },
87
87
  "devDependencies": {
package/src/chat.ts CHANGED
@@ -37,13 +37,16 @@ export const CHAT_ATTACHMENT_MAX_BYTES = CHAT_ATTACHMENTS_MAX_BYTES;
37
37
  export const CHAT_ATTACHMENTS_MAX_COUNT = 8;
38
38
  const MAX_BASE64_LENGTH = Math.ceil(CHAT_ATTACHMENT_MAX_BYTES / 3) * 4;
39
39
 
40
+ function paddingOf(data: string): number {
41
+ return data.endsWith('==') ? 2 : data.endsWith('=') ? 1 : 0;
42
+ }
43
+
40
44
  export function attachmentBytes(data: string): number {
41
- return Math.floor((data.length * 3) / 4) - (data.endsWith('==') ? 2 : data.endsWith('=') ? 1 : 0);
45
+ return Math.floor((data.length * 3) / 4) - paddingOf(data);
42
46
  }
43
47
 
44
48
  function isBase64(data: string): boolean {
45
- const padding = data.endsWith('==') ? 2 : data.endsWith('=') ? 1 : 0;
46
- return data.length % 4 === 0 && !/[^A-Za-z0-9+/]/.test(data.slice(0, data.length - padding));
49
+ return data.length % 4 === 0 && !/[^A-Za-z0-9+/]/.test(data.slice(0, data.length - paddingOf(data)));
47
50
  }
48
51
 
49
52
  const IMAGE_MIME_BY_EXTENSION = new Map([
@@ -307,11 +310,14 @@ export const ChatUserItemSchema = z.object({
307
310
  uiChoice: ChatUiChoiceOriginSchema.optional()
308
311
  });
309
312
 
313
+ // `state` is a frozen set: native clients validate these payloads whole, so a new state would fail them.
310
314
  export const ChatUiQueryReadingSchema = z.object({
311
315
  state: z.enum(['fresh', 'failed', 'refused']),
312
316
  value: z.unknown().optional(),
313
317
  readId: z.string().optional(),
314
318
  readAt: z.number().nonnegative(),
319
+ // A code that names the reason across versions, for a client that says it in its own words; open, so a new one fails nobody.
320
+ code: z.string().optional(),
315
321
  reason: z.string().optional()
316
322
  });
317
323
  export type ChatUiQueryReading = z.infer<typeof ChatUiQueryReadingSchema>;
@@ -319,9 +325,9 @@ export type ChatUiQueryReading = z.infer<typeof ChatUiQueryReadingSchema>;
319
325
  export const ChatUiLinkReadingSchema = UiLinkResolutionSchema;
320
326
  export type ChatUiLinkReading = z.infer<typeof ChatUiLinkReadingSchema>;
321
327
 
328
+ // The writer's captured access stays on the daemon; a record from before that still parses and drops it.
322
329
  export const ChatUiQueryStateSchema = z.object({
323
330
  authorChatId: z.string(),
324
- access: z.unknown(),
325
331
  blocks: z.record(
326
332
  z.string(),
327
333
  z.object({
@@ -484,6 +490,7 @@ export const ChatSubagentItemSchema = z.object({
484
490
  // Where the CLI keeps this subagent's own conversation; set once the daemon found it.
485
491
  native: z.object({ agentId: z.string().optional(), threadId: z.string().optional() }).optional(),
486
492
  // Who opened it: the CLI with its own tool, or a verb with `--task` that made a node; absent is `native`.
493
+ // The second value keeps its legacy spelling, since stored threads carry it.
487
494
  origin: z.enum(['native', 'ruimte']).optional(),
488
495
  // The node a `--task` opened, whose own conversation this row stands for.
489
496
  childId: z.string().optional(),
@@ -610,7 +617,7 @@ export const ChatCompactionItemSchema = z.object({
610
617
 
611
618
  /*
612
619
  * Never a new member here, and never a new value in an enum a chat or a push already carries: the
613
- * iPhone app validates `chat.attach` and `chat.history` whole, so one item it does not know rejects
620
+ * native client validates `chat.attach` and `chat.history` whole, so one item it does not know rejects
614
621
  * the entire conversation. Add optional fields instead.
615
622
  */
616
623
  export const ChatItemSchema = z.discriminatedUnion('kind', [
package/src/text.ts CHANGED
@@ -3,7 +3,7 @@ const graphemes = new Intl.Segmenter(undefined, { granularity: 'grapheme' });
3
3
  /*
4
4
  * The longest start of `text` that fits in `max` UTF-16 units, the measure a schema's `max` counts in,
5
5
  * cut only between characters as a person sees them. A cut between the halves of a surrogate pair
6
- * leaves a lone half, which JSON writes as an escape the iPhone app refuses along with its whole frame.
6
+ * leaves a lone half, which JSON writes as an escape a native client refuses along with its whole frame.
7
7
  */
8
8
  export function clipText(text: string, max: number): string {
9
9
  if (text.length <= max) {