@peasant-labs/schema 0.29.1 → 0.31.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.
@@ -1,4 +1,5 @@
1
1
  // publication-contract-semantic-refinement
2
+ import { collectiveContractIssue } from "../../../collective-validation.js";
2
3
  // This file is auto-generated by @hey-api/openapi-ts
3
4
  import * as z from 'zod';
4
5
  export const zActivityEdge = z.object({
@@ -376,6 +377,110 @@ export const zChildSessionRef = z.object({
376
377
  project: z.string().optional(),
377
378
  startTime: z.iso.datetime()
378
379
  });
380
+ /**
381
+ * Collective Evidence Coverage
382
+ *
383
+ * Available saved evidence or explicitly unknown source ranges
384
+ */
385
+ export const zCollectiveEvidenceCoverage = z.enum(['available', 'unknown']);
386
+ /**
387
+ * Collective Fetch Commit
388
+ *
389
+ * Committed effect, including earlier commits before cancellation
390
+ */
391
+ export const zCollectiveFetchCommit = z.enum([
392
+ 'updated',
393
+ 'unchanged',
394
+ 'retained'
395
+ ]);
396
+ /**
397
+ * Collective Fetch Domain
398
+ *
399
+ * Independently installed complete metadata dataset
400
+ */
401
+ export const zCollectiveFetchDomain = z.enum([
402
+ 'catalog',
403
+ 'history',
404
+ 'associations'
405
+ ]);
406
+ /**
407
+ * Collective Fetch Outcome
408
+ *
409
+ * Complete only when every requested required scope completed
410
+ */
411
+ export const zCollectiveFetchOutcome = z.enum([
412
+ 'complete',
413
+ 'partial',
414
+ 'failed'
415
+ ]);
416
+ /**
417
+ * Collective Fetch State
418
+ *
419
+ * One invocation result; a failed domain retains prior completed dates
420
+ */
421
+ export const zCollectiveFetchState = z.enum([
422
+ 'complete',
423
+ 'failed',
424
+ 'cancelled',
425
+ 'superseded',
426
+ 'not_requested'
427
+ ]);
428
+ /**
429
+ * Collective Observation Reason
430
+ *
431
+ * Independent dated relevance reason, not authority
432
+ */
433
+ export const zCollectiveObservationReason = z.enum([
434
+ 'membership',
435
+ 'contribution',
436
+ 'organization',
437
+ 'explicit'
438
+ ]);
439
+ /**
440
+ * Collective Observation Source
441
+ *
442
+ * Narrow metadata source, no world directory or transcript content
443
+ */
444
+ export const zCollectiveObservationSource = z.enum([
445
+ 'membership',
446
+ 'contribution-discovery',
447
+ 'organization',
448
+ 'explicit',
449
+ 'submissions',
450
+ 'attempts',
451
+ 'associations'
452
+ ]);
453
+ /**
454
+ * Collective Observation State
455
+ *
456
+ * Dated disclosure state, never current authorization
457
+ */
458
+ export const zCollectiveObservationState = z.enum([
459
+ 'observed',
460
+ 'unavailable',
461
+ 'invalidated'
462
+ ]);
463
+ /**
464
+ * Collective Operation
465
+ *
466
+ * Operation whose actual outcome is recorded
467
+ */
468
+ export const zCollectiveOperation = z.enum([
469
+ 'publish',
470
+ 'share',
471
+ 'fetch',
472
+ 'pull'
473
+ ]);
474
+ /**
475
+ * Collective Source Outcome
476
+ *
477
+ * Privacy-safe source outcome without hidden reasons
478
+ */
479
+ export const zCollectiveSourceOutcome = z.enum([
480
+ 'disclosed',
481
+ 'not_disclosed',
482
+ 'failed'
483
+ ]);
379
484
  export const zCommandInvocation = z.object({
380
485
  args: z.string().optional(),
381
486
  name: z.string()
@@ -436,6 +541,11 @@ export const zContentOwnership = z.enum([
436
541
  'uncertain'
437
542
  ]);
438
543
  export const zContractVersion = z.string().nullable();
544
+ /**
545
+ * Opaque versioned selected-category traversal token; not cacheRevision or authority
546
+ */
547
+ export const zContributionTraversalRevision = z.string().max(4096).superRefine((value, ctx) => { const issue = collectiveContractIssue("ContributionTraversalRevision", value); if (issue !== undefined)
548
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
439
549
  export const zCreateAnnotationRequest = z.object({
440
550
  annotatorName: z.string().optional(),
441
551
  confidence: z.number().nullish(),
@@ -731,6 +841,28 @@ export const zLocalCollectiveSuggestion = z.object({
731
841
  match: z.string(),
732
842
  reason: zLocalCollectiveSuggestionReason
733
843
  });
844
+ /**
845
+ * Confirmed Contribution Outcome
846
+ *
847
+ * Actual request effect, never collective approval
848
+ */
849
+ export const zLocalConfirmedContributionOutcome = z.enum(['published', 'submitted']);
850
+ /**
851
+ * Local Contribution Evidence Kind
852
+ *
853
+ * One independently bounded evidence category
854
+ */
855
+ export const zLocalContributionEvidenceKind = z.enum([
856
+ 'remote-attempts',
857
+ 'receipts',
858
+ 'operation-diagnostics'
859
+ ]);
860
+ /**
861
+ * Local Operation Diagnostic Outcome
862
+ *
863
+ * Failure or uncertain remote effect, never successful contribution
864
+ */
865
+ export const zLocalOperationDiagnosticOutcome = z.enum(['failed', 'uncertain']);
734
866
  export const zLocalPublicationAttemptFailure = z.object({
735
867
  attemptedAt: z.iso.datetime(),
736
868
  message: z.string()
@@ -784,6 +916,17 @@ export const zLocalSettingUpdateRequest = z.object({
784
916
  key: z.string().min(1),
785
917
  value: zLocalSettingValue
786
918
  }).strict();
919
+ /**
920
+ * Local Sync Publication Filter
921
+ *
922
+ * Root publication filter; auto uses the canonical live hook decision
923
+ */
924
+ export const zLocalSyncPublicationFilter = z.enum([
925
+ 'all',
926
+ 'not-published',
927
+ 'published',
928
+ 'auto'
929
+ ]);
787
930
  export const zMapEdge = z.object({
788
931
  count: z.int(),
789
932
  from: z.string(),
@@ -885,6 +1028,46 @@ export const zNativePiMessageRole = z.enum(['toolResult']);
885
1028
  * Exact UTF-8 model identifier observed on an assistant-generated turn; producer-enforced as assistant or subagent evidence. Values are non-empty and may not have a Unicode White_Space code point at either edge; all accepted bytes, including Unicode, mixed case, slashes, and internal spaces, are preserved.
886
1029
  */
887
1030
  export const zObservedModelID = z.string().min(1).regex(/^(?:|[^\s])(?:[\s\S]*(?:|[^\s]))?$/).refine((value) => { const edge = (text) => text === "\uFEFF" || (!/\s/u.test(text) && text !== "\u0085"); return edge(value.charAt(0)) && edge(value.charAt(value.length - 1)); }, { error: "ObservedModelID must match pattern without edge whitespace" });
1031
+ /**
1032
+ * Operation Issue Code
1033
+ *
1034
+ * Bounded failure category; retry is corrective text only
1035
+ */
1036
+ export const zOperationIssueCode = z.enum([
1037
+ 'auth',
1038
+ 'remote',
1039
+ 'contract',
1040
+ 'deadline',
1041
+ 'persistence',
1042
+ 'superseded'
1043
+ ]);
1044
+ export const zOperationIssue = z.object({
1045
+ code: zOperationIssueCode,
1046
+ message: z.string().min(1).max(2048),
1047
+ operation: zCollectiveOperation,
1048
+ retry: z.string().min(1).max(2048)
1049
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("OperationIssue", value); if (issue !== undefined)
1050
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
1051
+ export const zCollectiveFetchDomainSummary = z.object({
1052
+ coverage: zCollectiveEvidenceCoverage,
1053
+ issue: zOperationIssue.nullish(),
1054
+ lastAttemptAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
1055
+ lastCompletedAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
1056
+ lastInstalledRevision: z.string().nullish(),
1057
+ state: zCollectiveFetchState
1058
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("CollectiveFetchDomainSummary", value); if (issue !== undefined)
1059
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
1060
+ export const zCollectiveFetchSourceResult = z.object({
1061
+ complete: z.boolean(),
1062
+ issue: zOperationIssue.nullish(),
1063
+ observedAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
1064
+ outcome: zCollectiveSourceOutcome,
1065
+ source: zCollectiveObservationSource
1066
+ });
1067
+ export const zLocalContributionTraversalConflict = z.object({
1068
+ currentTraversalRevision: zContributionTraversalRevision,
1069
+ issue: zOperationIssue
1070
+ });
888
1071
  /**
889
1072
  * Omitted preserves, null requests clear, and a canonical license replaces
890
1073
  */
@@ -893,6 +1076,12 @@ export const zOwnerUpdateLicenseIntent = z.enum([
893
1076
  'CC-BY-4.0',
894
1077
  'CC-BY-SA-4.0'
895
1078
  ]).nullable();
1079
+ /**
1080
+ * Page Token
1081
+ *
1082
+ * Opaque continuation; empty starts traversal or marks its end. Not a credential or snapshot token.
1083
+ */
1084
+ export const zPageToken = z.string();
896
1085
  /**
897
1086
  * Project Hash
898
1087
  *
@@ -904,6 +1093,13 @@ export const zAuthoritativeProjectContext = z.object({
904
1093
  hash: zProjectHash,
905
1094
  name: z.string()
906
1095
  }).strict();
1096
+ export const zLocalSyncProjectOption = z.object({
1097
+ projectHash: zProjectHash,
1098
+ projectName: z.string()
1099
+ });
1100
+ export const zLocalSyncProjectOptions = z.object({
1101
+ projects: z.array(zLocalSyncProjectOption)
1102
+ });
907
1103
  export const zProjectContext = z.object({
908
1104
  filePath: z.string().optional(),
909
1105
  hash: zProjectHash,
@@ -1054,6 +1250,23 @@ export const zPublishAssociationOperation = z.object({
1054
1250
  prior = key;
1055
1251
  }
1056
1252
  });
1253
+ /**
1254
+ * Pull Association Metadata State
1255
+ *
1256
+ * Optional metadata result, independent of required content success
1257
+ */
1258
+ export const zPullAssociationMetadataState = z.enum([
1259
+ 'observed',
1260
+ 'stale',
1261
+ 'unknown',
1262
+ 'invalidated'
1263
+ ]);
1264
+ export const zPullAssociationMetadataResult = z.object({
1265
+ observedAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
1266
+ state: zPullAssociationMetadataState,
1267
+ warning: zOperationIssue.nullish()
1268
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("PullAssociationMetadataResult", value); if (issue !== undefined)
1269
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
1057
1270
  /**
1058
1271
  * Read Attribution State
1059
1272
  *
@@ -2284,6 +2497,36 @@ export const zCanonicalPublishOperation = z.object({
2284
2497
  * Village-side transcript identifier (canonical lowercase-hex UUID)
2285
2498
  */
2286
2499
  export const zTranscriptID = z.uuid().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
2500
+ export const zCollectiveFetchAssociationScopeResult = z.object({
2501
+ commit: zCollectiveFetchCommit,
2502
+ completedAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
2503
+ issue: zOperationIssue.nullish(),
2504
+ observedAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
2505
+ state: zCollectiveFetchState,
2506
+ transcriptId: zTranscriptID
2507
+ });
2508
+ export const zCollectiveFetchAssociationResults = z.object({
2509
+ completed: z.int().gte(0).lte(10000),
2510
+ failed: z.int().gte(0).lte(10000),
2511
+ requested: z.int().gte(0).lte(10000),
2512
+ scopes: z.array(zCollectiveFetchAssociationScopeResult).max(10000)
2513
+ });
2514
+ export const zCollectiveFetchDomainResult = z.object({
2515
+ associations: zCollectiveFetchAssociationResults.nullish(),
2516
+ commit: zCollectiveFetchCommit,
2517
+ completedAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
2518
+ coverage: zCollectiveEvidenceCoverage,
2519
+ domain: zCollectiveFetchDomain,
2520
+ issue: zOperationIssue.nullish(),
2521
+ lastAttemptAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
2522
+ lastCompletedAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
2523
+ lastInstalledRevision: z.string().nullish(),
2524
+ requested: z.boolean(),
2525
+ sourceOutcomes: z.array(zCollectiveFetchSourceResult).max(10000),
2526
+ startedAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
2527
+ state: zCollectiveFetchState
2528
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("CollectiveFetchDomainResult", value); if (issue !== undefined)
2529
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
2287
2530
  export const zPromptDigestItem = z.object({
2288
2531
  additions: z.int().nullish(),
2289
2532
  args: z.string().optional(),
@@ -2653,7 +2896,7 @@ export const zTaxonomyNode = z.object({
2653
2896
  *
2654
2897
  * Collective roles an owner may assign through the member role endpoint
2655
2898
  */
2656
- export const zVillageAssignableGroupRole = z.enum(['contributor', 'member']);
2899
+ export const zVillageAssignableCollectiveRole = z.enum(['contributor', 'member']);
2657
2900
  export const zVillageAvailableRepository = z.object({
2658
2901
  is_private: z.boolean(),
2659
2902
  name: z.string(),
@@ -2672,36 +2915,12 @@ export const zVillageBatchShareRequest = z.object({
2672
2915
  transcript_ids: z.array(zTranscriptID).optional(),
2673
2916
  visibility_confirmed: z.boolean()
2674
2917
  });
2675
- /**
2676
- * Village Contribution Status
2677
- *
2678
- * Status assigned when a new collective contribution is opened
2679
- */
2680
- export const zVillageContributionStatus = z.enum(['approved', 'pending']);
2681
- export const zVillageBatchShareEntry = z.object({
2682
- status: zVillageContributionStatus,
2683
- transcript_id: zTranscriptID
2684
- });
2685
- export const zVillageBatchShareResponse = z.object({
2686
- already_shared: z.array(zTranscriptID),
2687
- project_hash: zProjectHash,
2688
- shared: z.array(zVillageBatchShareEntry)
2689
- });
2690
- export const zVillageErrorResponse = z.object({
2691
- error: z.string()
2692
- });
2693
- /**
2694
- * GitHub Webhook Payload
2695
- *
2696
- * GitHub event payload forwarded verbatim; validated by the X-Hub-Signature-256 HMAC over the raw body, never by shape
2697
- */
2698
- export const zVillageGitHubWebhookPayload = z.record(z.string(), z.unknown());
2699
2918
  /**
2700
2919
  * Village Group Acceptance Mode
2701
2920
  *
2702
2921
  * How a collective accepts new members and contributions
2703
2922
  */
2704
- export const zVillageGroupAcceptanceMode = z.enum([
2923
+ export const zVillageCollectiveAcceptanceMode = z.enum([
2705
2924
  'open',
2706
2925
  'verified_only',
2707
2926
  'curated'
@@ -2711,25 +2930,18 @@ export const zVillageGroupAcceptanceMode = z.enum([
2711
2930
  *
2712
2931
  * Who may read a collective's pooled transcript data
2713
2932
  */
2714
- export const zVillageGroupDataAccess = z.enum([
2933
+ export const zVillageCollectiveDataAccess = z.enum([
2715
2934
  'members_only',
2716
2935
  'contributors',
2717
2936
  'public'
2718
2937
  ]);
2719
- export const zVillageCreateGroupRequest = z.object({
2720
- acceptance_mode: zVillageGroupAcceptanceMode.optional(),
2721
- data_access: zVillageGroupDataAccess.optional(),
2722
- description: z.string().optional(),
2723
- linked_github_org: z.string().nullish(),
2724
- name: z.string()
2725
- });
2726
- export const zVillageGroupMemberRoleRequest = z.object({
2727
- role: zVillageAssignableGroupRole
2938
+ export const zVillageCollectiveMemberRoleRequest = z.object({
2939
+ role: zVillageAssignableCollectiveRole
2728
2940
  });
2729
- export const zVillageGroupMemberUsernameRequest = z.object({
2941
+ export const zVillageCollectiveMemberUsernameRequest = z.object({
2730
2942
  username: z.string()
2731
2943
  });
2732
- export const zVillageGroupModelBreakdown = z.object({
2944
+ export const zVillageCollectiveModelBreakdown = z.object({
2733
2945
  model_provider: z.string(),
2734
2946
  transcript_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
2735
2947
  });
@@ -2738,17 +2950,17 @@ export const zVillageGroupModelBreakdown = z.object({
2738
2950
  *
2739
2951
  * A user's role in one collective
2740
2952
  */
2741
- export const zVillageGroupRole = z.enum([
2953
+ export const zVillageCollectiveRole = z.enum([
2742
2954
  'owner',
2743
2955
  'member',
2744
2956
  'contributor',
2745
2957
  'pending'
2746
2958
  ]);
2747
- export const zVillageGroupStatusRoleResponse = z.object({
2748
- role: zVillageGroupRole,
2959
+ export const zVillageCollectiveStatusRoleResponse = z.object({
2960
+ role: zVillageCollectiveRole,
2749
2961
  status: z.string()
2750
2962
  });
2751
- export const zVillageGroupTranscriptStats = z.object({
2963
+ export const zVillageCollectiveTranscriptStats = z.object({
2752
2964
  contributor_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
2753
2965
  pull_request_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
2754
2966
  total_duration_ms: z.coerce.bigint().min(BigInt('-9223372036854775808'), { error: 'Invalid value: Expected int64 to be >= -9223372036854775808' }).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
@@ -2761,13 +2973,44 @@ export const zVillageGroupTranscriptStats = z.object({
2761
2973
  *
2762
2974
  * The caller's role in a collective, or an empty string when the caller has none
2763
2975
  */
2764
- export const zVillageGroupViewerRole = z.enum([
2976
+ export const zVillageCollectiveViewerRole = z.enum([
2765
2977
  '',
2766
2978
  'owner',
2767
2979
  'member',
2768
2980
  'contributor',
2769
2981
  'pending'
2770
2982
  ]);
2983
+ /**
2984
+ * Village Contribution Status
2985
+ *
2986
+ * Status assigned when a new collective contribution is opened
2987
+ */
2988
+ export const zVillageContributionStatus = z.enum(['approved', 'pending']);
2989
+ export const zVillageBatchShareEntry = z.object({
2990
+ status: zVillageContributionStatus,
2991
+ transcript_id: zTranscriptID
2992
+ });
2993
+ export const zVillageBatchShareResponse = z.object({
2994
+ already_shared: z.array(zTranscriptID),
2995
+ project_hash: zProjectHash,
2996
+ shared: z.array(zVillageBatchShareEntry)
2997
+ });
2998
+ export const zVillageCreateCollectiveRequest = z.object({
2999
+ acceptance_mode: zVillageCollectiveAcceptanceMode.optional(),
3000
+ data_access: zVillageCollectiveDataAccess.optional(),
3001
+ description: z.string().optional(),
3002
+ linked_github_org: z.string().nullish(),
3003
+ name: z.string()
3004
+ });
3005
+ export const zVillageErrorResponse = z.object({
3006
+ error: z.string()
3007
+ });
3008
+ /**
3009
+ * GitHub Webhook Payload
3010
+ *
3011
+ * GitHub event payload forwarded verbatim; validated by the X-Hub-Signature-256 HMAC over the raw body, never by shape
3012
+ */
3013
+ export const zVillageGitHubWebhookPayload = z.record(z.string(), z.unknown());
2771
3014
  export const zVillageLinkRepositoryRequest = z.object({
2772
3015
  installation_id: z.int().nullish(),
2773
3016
  name: z.string(),
@@ -2837,7 +3080,7 @@ export const zVillagePullRequestsSummary = z.object({
2837
3080
  count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
2838
3081
  recent: z.array(zVillagePullRequestRef)
2839
3082
  });
2840
- export const zVillageRemoveGroupMemberResponse = z.object({
3083
+ export const zVillageRemoveCollectiveMemberResponse = z.object({
2841
3084
  retracted: z.boolean(),
2842
3085
  status: z.string()
2843
3086
  });
@@ -2897,11 +3140,26 @@ export const zVillageShareStatus = z.enum([
2897
3140
  'revoked'
2898
3141
  ]);
2899
3142
  export const zVillageShareEvent = z.object({
2900
- decided_at: z.iso.datetime().nullable(),
3143
+ decided_at: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullable(),
2901
3144
  decided_by_actor: zVillageShareEventActor,
2902
3145
  event_num: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
2903
- recorded_at: z.iso.datetime(),
3146
+ recorded_at: z.iso.datetime().refine((value) => new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$").test(value) && !new RegExp("^0001-01-01T00:00:00(\\.0+)?Z$").test(value), { message: "Collective timestamp requires nonzero UTC RFC3339 with explicit seconds and at most nine fractional digits; unsupported precision loses evidence, so correct the source timestamp ending in Z before retrying" }).regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/),
2904
3147
  status: zVillageShareStatus
3148
+ }).superRefine((value, ctx) => {
3149
+ const fail = (message) => ctx.addIssue({ code: "custom", message: "Collective contribution attempt validation failed: " + message + "; retain prior evidence and fetch validated owner history before retrying" });
3150
+ const actors = { pending: "", approved: "moderator", rejected: "moderator", retracted: "owner", revoked: "collective" };
3151
+ if (value.event_num < 1)
3152
+ fail("event_num must be a positive int32 ordinal");
3153
+ if (value.recorded_at === "0001-01-01T00:00:00Z" || /^0001-01-01T00:00:00\.0+Z$/.test(value.recorded_at))
3154
+ fail("recorded_at must be a nonzero UTC timestamp");
3155
+ if (value.decided_by_actor !== actors[value.status])
3156
+ fail("decided_by_actor does not match the status's actor capacity");
3157
+ if (value.status === "pending" && value.decided_at !== null)
3158
+ fail("pending attempts must have null decided_at");
3159
+ if (value.status !== "pending" && value.status !== "approved" && value.decided_at === null)
3160
+ fail("this terminal status requires decided_at");
3161
+ if (value.decided_at !== null && (value.decided_at === "0001-01-01T00:00:00Z" || /^0001-01-01T00:00:00\.0+Z$/.test(value.decided_at)))
3162
+ fail("decided_at must be a nonzero UTC timestamp when present");
2905
3163
  });
2906
3164
  export const zVillageStatusResponse = z.object({
2907
3165
  status: z.string()
@@ -2987,6 +3245,71 @@ export const zAutoPublishRuleRequest = z.object({
2987
3245
  context.addIssue({ code: "custom", message: "name exactly one session or explicit pattern target" });
2988
3246
  }
2989
3247
  });
3248
+ export const zCollectiveObservation = z.object({
3249
+ acceptanceMode: zVillageCollectiveAcceptanceMode.nullish(),
3250
+ dataAccess: zVillageCollectiveDataAccess.nullish(),
3251
+ description: z.string().nullish(),
3252
+ id: zVillageUUID,
3253
+ name: z.string(),
3254
+ observedAt: z.iso.datetime().refine((value) => new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$").test(value) && !new RegExp("^0001-01-01T00:00:00(\\.0+)?Z$").test(value), { message: "Collective timestamp requires nonzero UTC RFC3339 with explicit seconds and at most nine fractional digits; unsupported precision loses evidence, so correct the source timestamp ending in Z before retrying" }).regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/),
3255
+ reasons: z.array(zCollectiveObservationReason).max(4),
3256
+ state: zCollectiveObservationState
3257
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("CollectiveObservation", value); if (issue !== undefined)
3258
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3259
+ export const zCollectiveObservationScope = z.object({
3260
+ userId: zVillageUUID,
3261
+ villageUrl: z.string().max(1024)
3262
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("CollectiveObservationScope", value); if (issue !== undefined)
3263
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3264
+ export const zCollectiveFetchReport = z.object({
3265
+ cacheRevision: z.string().regex(/^(0|[1-9][0-9]{0,19})$/),
3266
+ domains: z.tuple([
3267
+ zCollectiveFetchDomainResult,
3268
+ zCollectiveFetchDomainResult,
3269
+ zCollectiveFetchDomainResult
3270
+ ]),
3271
+ invocationId: zVillageUUID,
3272
+ issues: z.array(zOperationIssue).max(10000),
3273
+ outcome: zCollectiveFetchOutcome,
3274
+ scope: zCollectiveObservationScope
3275
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("CollectiveFetchReport", value); if (issue !== undefined)
3276
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3277
+ export const zCollectiveFetchSummary = z.object({
3278
+ associations: zCollectiveFetchDomainSummary,
3279
+ catalog: zCollectiveFetchDomainSummary,
3280
+ history: zCollectiveFetchDomainSummary,
3281
+ lastAttemptAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
3282
+ lastCompletedFetchAt: z.iso.datetime().regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/).nullish(),
3283
+ latestReport: zCollectiveFetchReport.nullish()
3284
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("CollectiveFetchSummary", value); if (issue !== undefined)
3285
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3286
+ export const zCollectiveObservationResponse = z.object({
3287
+ cacheRevision: z.string().regex(/^(0|[1-9][0-9]{0,19})$/),
3288
+ collectives: z.array(zCollectiveObservation).max(10000),
3289
+ fetch: zCollectiveFetchSummary,
3290
+ scope: zCollectiveObservationScope
3291
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("CollectiveObservationResponse", value); if (issue !== undefined)
3292
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3293
+ export const zLocalConfirmedContributionReceipt = z.object({
3294
+ collectiveId: zVillageUUID.nullish(),
3295
+ confirmedAt: z.iso.datetime().refine((value) => new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$").test(value) && !new RegExp("^0001-01-01T00:00:00(\\.0+)?Z$").test(value), { message: "Collective timestamp requires nonzero UTC RFC3339 with explicit seconds and at most nine fractional digits; unsupported precision loses evidence, so correct the source timestamp ending in Z before retrying" }).regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/),
3296
+ operation: zCollectiveOperation,
3297
+ outcome: zLocalConfirmedContributionOutcome,
3298
+ receiptId: z.string().min(1).max(256),
3299
+ sourceReceiptId: z.string().max(256).nullish(),
3300
+ transcriptId: zTranscriptID
3301
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("LocalConfirmedContributionReceipt", value); if (issue !== undefined)
3302
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3303
+ export const zLocalOperationDiagnostic = z.object({
3304
+ attemptedAt: z.iso.datetime().refine((value) => new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$").test(value) && !new RegExp("^0001-01-01T00:00:00(\\.0+)?Z$").test(value), { message: "Collective timestamp requires nonzero UTC RFC3339 with explicit seconds and at most nine fractional digits; unsupported precision loses evidence, so correct the source timestamp ending in Z before retrying" }).regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/),
3305
+ collectiveId: zVillageUUID.nullish(),
3306
+ issue: zOperationIssue,
3307
+ operation: zCollectiveOperation,
3308
+ operationId: zVillageUUID,
3309
+ outcome: zLocalOperationDiagnosticOutcome,
3310
+ transcriptId: zTranscriptID.nullish()
3311
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("LocalOperationDiagnostic", value); if (issue !== undefined)
3312
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
2990
3313
  export const zLocalPublicationAudienceMember = z.object({
2991
3314
  collectiveId: zVillageUUID,
2992
3315
  name: z.string(),
@@ -3006,10 +3329,64 @@ export const zLocalPublication = z.object({
3006
3329
  export const zLocalPublicationsResponse = z.object({
3007
3330
  publications: z.array(zLocalPublication)
3008
3331
  });
3332
+ export const zLocalRemoteContributionAttempt = z.object({
3333
+ attempt: zVillageShareEvent,
3334
+ collectiveId: zVillageUUID,
3335
+ firstSeenAt: z.iso.datetime().refine((value) => new RegExp("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]{1,9})?Z$").test(value) && !new RegExp("^0001-01-01T00:00:00(\\.0+)?Z$").test(value), { message: "Collective timestamp requires nonzero UTC RFC3339 with explicit seconds and at most nine fractional digits; unsupported precision loses evidence, so correct the source timestamp ending in Z before retrying" }).regex(/^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\.[0-9]{1,9})?Z$/),
3336
+ transcriptId: zTranscriptID
3337
+ }).superRefine((value, ctx) => {
3338
+ const fail = (message) => ctx.addIssue({ code: "custom", message: "Collective contribution attempt validation failed: " + message + "; retain prior evidence and fetch validated owner history before retrying" });
3339
+ if (value.firstSeenAt === "0001-01-01T00:00:00Z" || /^0001-01-01T00:00:00\.0+Z$/.test(value.firstSeenAt))
3340
+ fail("firstSeenAt must be a nonzero UTC timestamp");
3341
+ });
3342
+ export const zLocalContributionHistoryResponse = z.union([
3343
+ z.strictObject({
3344
+ coverage: zCollectiveEvidenceCoverage,
3345
+ kind: z.literal('remote-attempts'),
3346
+ limit: z.int().gte(1).lte(200),
3347
+ page: z.int().gte(1).lte(9007199254740991),
3348
+ remoteAttempts: z.array(zLocalRemoteContributionAttempt).max(200),
3349
+ scope: zCollectiveObservationScope,
3350
+ total: z.int().gte(0).lte(9007199254740991),
3351
+ traversalRevision: zContributionTraversalRevision
3352
+ }),
3353
+ z.strictObject({
3354
+ coverage: zCollectiveEvidenceCoverage,
3355
+ kind: z.literal('receipts'),
3356
+ limit: z.int().gte(1).lte(200),
3357
+ page: z.int().gte(1).lte(9007199254740991),
3358
+ receipts: z.array(zLocalConfirmedContributionReceipt).max(200),
3359
+ scope: zCollectiveObservationScope,
3360
+ total: z.int().gte(0).lte(9007199254740991),
3361
+ traversalRevision: zContributionTraversalRevision
3362
+ }),
3363
+ z.strictObject({
3364
+ coverage: zCollectiveEvidenceCoverage,
3365
+ kind: z.literal('operation-diagnostics'),
3366
+ limit: z.int().gte(1).lte(200),
3367
+ operationDiagnostics: z.array(zLocalOperationDiagnostic).max(200),
3368
+ page: z.int().gte(1).lte(9007199254740991),
3369
+ scope: zCollectiveObservationScope,
3370
+ total: z.int().gte(0).lte(9007199254740991),
3371
+ traversalRevision: zContributionTraversalRevision
3372
+ })
3373
+ ]).superRefine((value, ctx) => { const issue = collectiveContractIssue("LocalContributionHistoryResponse", value); if (issue !== undefined)
3374
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3009
3375
  export const zLocalSettingsResponse = z.object({
3010
3376
  autoPublish: z.array(zAutoPublishRule),
3011
3377
  settings: z.array(zLocalSetting)
3012
3378
  });
3379
+ export const zLocalSyncSessionRow = z.object({
3380
+ childCount: z.int().gte(0),
3381
+ preview: z.string(),
3382
+ publication: zLocalPublication,
3383
+ sync: zLocalSyncSummary,
3384
+ title: z.string()
3385
+ });
3386
+ export const zLocalSyncSessionPage = z.object({
3387
+ items: z.array(zLocalSyncSessionRow),
3388
+ next: z.string()
3389
+ });
3013
3390
  export const zSyncPushCollectives = z.object({
3014
3391
  add: z.array(zVillageUUID).optional(),
3015
3392
  remove: z.array(zVillageUUID).optional()
@@ -3041,55 +3418,11 @@ export const zSyncPushResponse = z.object({
3041
3418
  skipped: z.int().gte(0),
3042
3419
  updated: z.int().gte(0)
3043
3420
  });
3044
- export const zVillageCollectiveSearchResult = z.object({
3045
- description: z.string().nullable(),
3046
- id: zVillageUUID,
3047
- linked_github_org: z.string().nullable(),
3048
- member_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3049
- name: z.string(),
3050
- transcript_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
3051
- });
3052
- export const zVillageCollectiveSearchResponse = z.object({
3053
- collectives: z.array(zVillageCollectiveSearchResult)
3054
- });
3055
- export const zVillageCollectiveSubmission = z.object({
3056
- event_num: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3057
- group_id: zVillageUUID,
3058
- recorded_at: z.iso.datetime(),
3059
- status: zVillageShareStatus,
3060
- title: z.string().nullable(),
3061
- transcript_id: zTranscriptID
3062
- });
3063
- export const zVillageContributableResponse = z.object({
3064
- group_id: zVillageUUID,
3065
- transcripts: z.array(zVillageContributableTranscript)
3066
- });
3067
- export const zVillageContributedCollective = z.object({
3068
- approved_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3069
- description: z.string().nullable(),
3070
- id: zVillageUUID,
3071
- linked_github_org: z.string().nullable(),
3072
- name: z.string(),
3073
- pending_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3074
- rejected_attempt_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3075
- withdrawn_attempt_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
3076
- });
3077
- export const zVillageContributedCollectivesResponse = z.object({
3078
- collectives: z.array(zVillageContributedCollective)
3079
- });
3080
- export const zVillageEnrichedTranscriptShare = z.object({
3081
- acceptance_mode: zVillageGroupAcceptanceMode,
3082
- group_id: zVillageUUID,
3083
- group_name: z.string(),
3084
- shared_at: z.iso.datetime(),
3085
- status: zVillageShareStatus,
3086
- transcript_id: zTranscriptID
3087
- });
3088
- export const zVillageGroup = z.object({
3089
- acceptance_mode: zVillageGroupAcceptanceMode,
3421
+ export const zVillageCollective = z.object({
3422
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3090
3423
  created_at: z.iso.datetime(),
3091
3424
  created_by: zVillageUUID,
3092
- data_access: zVillageGroupDataAccess,
3425
+ data_access: zVillageCollectiveDataAccess,
3093
3426
  description: z.string().nullable(),
3094
3427
  display_members: z.boolean(),
3095
3428
  id: zVillageUUID,
@@ -3100,17 +3433,17 @@ export const zVillageGroup = z.object({
3100
3433
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3101
3434
  updated_at: z.iso.datetime()
3102
3435
  });
3103
- export const zVillageGroupContributor = z.object({
3436
+ export const zVillageCollectiveContributor = z.object({
3104
3437
  avatar_url: z.string().nullable(),
3105
3438
  github_username: z.string(),
3106
3439
  id: zVillageUUID,
3107
3440
  transcript_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
3108
3441
  });
3109
- export const zVillageGroupDetailRecord = z.object({
3110
- acceptance_mode: zVillageGroupAcceptanceMode,
3442
+ export const zVillageCollectiveDetailRecord = z.object({
3443
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3111
3444
  created_at: z.iso.datetime(),
3112
3445
  created_by: zVillageUUID,
3113
- data_access: zVillageGroupDataAccess,
3446
+ data_access: zVillageCollectiveDataAccess,
3114
3447
  description: z.string().nullable(),
3115
3448
  display_members: z.boolean(),
3116
3449
  id: zVillageUUID,
@@ -3121,16 +3454,35 @@ export const zVillageGroupDetailRecord = z.object({
3121
3454
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3122
3455
  updated_at: z.iso.datetime()
3123
3456
  });
3124
- export const zVillageGroupMember = z.object({
3457
+ export const zVillageCollectiveMember = z.object({
3125
3458
  avatar_url: z.string().nullable(),
3126
3459
  display_name: z.string().nullable(),
3127
3460
  github_orgs: z.array(z.string()),
3128
3461
  github_username: z.string(),
3129
3462
  id: zVillageUUID,
3130
3463
  joined_at: z.iso.datetime(),
3131
- role: zVillageGroupRole
3464
+ role: zVillageCollectiveRole
3465
+ });
3466
+ export const zVillageCollectiveSearchResult = z.object({
3467
+ description: z.string().nullable(),
3468
+ id: zVillageUUID,
3469
+ linked_github_org: z.string().nullable(),
3470
+ member_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3471
+ name: z.string(),
3472
+ transcript_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
3473
+ });
3474
+ export const zVillageCollectiveSearchResponse = z.object({
3475
+ collectives: z.array(zVillageCollectiveSearchResult)
3132
3476
  });
3133
- export const zVillageGroupTranscript = z.object({
3477
+ export const zVillageCollectiveSubmission = z.object({
3478
+ event_num: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3479
+ group_id: zVillageUUID,
3480
+ recorded_at: z.iso.datetime(),
3481
+ status: zVillageShareStatus,
3482
+ title: z.string().nullable(),
3483
+ transcript_id: zTranscriptID
3484
+ });
3485
+ export const zVillageCollectiveTranscript = z.object({
3134
3486
  blob_size_bytes: z.int().nullable(),
3135
3487
  compute_version: z.int().nullable(),
3136
3488
  computed_at: z.iso.datetime().nullable(),
@@ -3205,16 +3557,42 @@ export const zVillageGroupTranscript = z.object({
3205
3557
  visibility: zVillageTranscriptVisibility,
3206
3558
  within_session_reverts: z.int().nullable()
3207
3559
  });
3208
- export const zVillageGroupDetailResponse = z.object({
3560
+ export const zVillageCollectiveDetailResponse = z.object({
3209
3561
  can_read: z.boolean(),
3210
- contributors: z.array(zVillageGroupContributor),
3211
- group: zVillageGroupDetailRecord,
3212
- members: z.array(zVillageGroupMember),
3213
- models: z.array(zVillageGroupModelBreakdown),
3214
- pending_members: z.array(zVillageGroupMember).optional(),
3215
- stats: zVillageGroupTranscriptStats,
3216
- transcripts: z.array(zVillageGroupTranscript),
3217
- your_role: zVillageGroupViewerRole
3562
+ contributors: z.array(zVillageCollectiveContributor),
3563
+ group: zVillageCollectiveDetailRecord,
3564
+ members: z.array(zVillageCollectiveMember),
3565
+ models: z.array(zVillageCollectiveModelBreakdown),
3566
+ pending_members: z.array(zVillageCollectiveMember).optional(),
3567
+ stats: zVillageCollectiveTranscriptStats,
3568
+ transcripts: z.array(zVillageCollectiveTranscript),
3569
+ your_role: zVillageCollectiveViewerRole
3570
+ });
3571
+ export const zVillageContributableResponse = z.object({
3572
+ group_id: zVillageUUID,
3573
+ transcripts: z.array(zVillageContributableTranscript)
3574
+ });
3575
+ export const zVillageContributedCollective = z.object({
3576
+ approved_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3577
+ description: z.string().nullable(),
3578
+ id: zVillageUUID,
3579
+ linked_github_org: z.string().nullable(),
3580
+ name: z.string(),
3581
+ pending_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3582
+ rejected_attempt_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3583
+ withdrawn_attempt_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
3584
+ });
3585
+ export const zVillageContributedCollectivesResponse = z.object({
3586
+ collectives: z.array(zVillageContributedCollective)
3587
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("VillageContributedCollectivesResponse", value); if (issue !== undefined)
3588
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3589
+ export const zVillageEnrichedTranscriptShare = z.object({
3590
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3591
+ group_id: zVillageUUID,
3592
+ group_name: z.string(),
3593
+ shared_at: z.iso.datetime(),
3594
+ status: zVillageShareStatus,
3595
+ transcript_id: zTranscriptID
3218
3596
  });
3219
3597
  export const zVillageLinkedRepository = z.object({
3220
3598
  created_at: z.iso.datetime().nullable(),
@@ -3235,6 +3613,17 @@ export const zVillageListUserOrganization = z.object({
3235
3613
  org_login: z.string(),
3236
3614
  user_id: zVillageUUID
3237
3615
  });
3616
+ export const zVillageOrganizationCollective = z.object({
3617
+ description: z.string().nullable(),
3618
+ id: zVillageUUID,
3619
+ member_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3620
+ name: z.string(),
3621
+ transcript_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
3622
+ });
3623
+ export const zVillageOrganizationCollectivesResponse = z.object({
3624
+ collectives: z.array(zVillageOrganizationCollective)
3625
+ }).superRefine((value, ctx) => { const issue = collectiveContractIssue("VillageOrganizationCollectivesResponse", value); if (issue !== undefined)
3626
+ ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3238
3627
  export const zVillagePendingShare = z.object({
3239
3628
  branch: z.string().nullable(),
3240
3629
  input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
@@ -3253,10 +3642,10 @@ export const zVillagePendingShare = z.object({
3253
3642
  title: z.string().nullable(),
3254
3643
  transcript_id: zTranscriptID
3255
3644
  });
3256
- export const zVillagePublicGroup = z.object({
3257
- acceptance_mode: zVillageGroupAcceptanceMode,
3645
+ export const zVillagePublicCollective = z.object({
3646
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3258
3647
  created_at: z.iso.datetime(),
3259
- data_access: zVillageGroupDataAccess,
3648
+ data_access: zVillageCollectiveDataAccess,
3260
3649
  description: z.string().nullable(),
3261
3650
  id: zVillageUUID,
3262
3651
  linked_github_org: z.string().nullable(),
@@ -3392,9 +3781,9 @@ export const zVillageTranscriptShare = z.object({
3392
3781
  group_name: z.string(),
3393
3782
  shared_at: z.iso.datetime()
3394
3783
  });
3395
- export const zVillageUpdateGroupRequest = z.object({
3396
- acceptance_mode: zVillageGroupAcceptanceMode.optional(),
3397
- data_access: zVillageGroupDataAccess.optional(),
3784
+ export const zVillageUpdateCollectiveRequest = z.object({
3785
+ acceptance_mode: zVillageCollectiveAcceptanceMode.optional(),
3786
+ data_access: zVillageCollectiveDataAccess.optional(),
3398
3787
  description: z.string().optional(),
3399
3788
  display_members: z.boolean().nullish(),
3400
3789
  linked_github_org: z.string().nullish(),
@@ -3447,11 +3836,11 @@ export const zVillageTranscriptMetadataResponse = z.object({
3447
3836
  tags: z.array(zVillageTag),
3448
3837
  transcript: zVillageTranscript
3449
3838
  });
3450
- export const zVillageUserGroup = z.object({
3451
- acceptance_mode: zVillageGroupAcceptanceMode,
3839
+ export const zVillageUserCollective = z.object({
3840
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3452
3841
  created_at: z.iso.datetime(),
3453
3842
  created_by: zVillageUUID,
3454
- data_access: zVillageGroupDataAccess,
3843
+ data_access: zVillageCollectiveDataAccess,
3455
3844
  description: z.string().nullable(),
3456
3845
  display_members: z.boolean(),
3457
3846
  id: zVillageUUID,
@@ -3459,19 +3848,19 @@ export const zVillageUserGroup = z.object({
3459
3848
  member_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3460
3849
  member_since: z.iso.datetime(),
3461
3850
  name: z.string(),
3462
- role: zVillageGroupRole,
3851
+ role: zVillageCollectiveRole,
3463
3852
  transcript_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3464
3853
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3465
3854
  updated_at: z.iso.datetime()
3466
3855
  });
3467
3856
  export const zLocalVillageCollective = z.object({
3468
- group: zVillageUserGroup,
3857
+ group: zVillageUserCollective,
3469
3858
  suggestion: zLocalCollectiveSuggestion.optional()
3470
3859
  });
3471
3860
  export const zLocalVillageCollectivesResponse = z.object({
3472
3861
  collectives: z.array(zLocalVillageCollective)
3473
3862
  });
3474
- export const zVillageUserGroupShare = z.object({
3863
+ export const zVillageUserCollectiveShare = z.object({
3475
3864
  id: zTranscriptID,
3476
3865
  input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
3477
3866
  local_id: zSessionID,
@@ -3492,9 +3881,9 @@ export const zVillageUserGroupShare = z.object({
3492
3881
  visibility: zVillageTranscriptVisibility
3493
3882
  });
3494
3883
  export const zVillageSessionRow = z.object({
3495
- collective: zVillageGroupTranscript.nullish(),
3884
+ collective: zVillageCollectiveTranscript.nullish(),
3496
3885
  contributable: zVillageContributableTranscript.nullish(),
3497
- myShare: zVillageUserGroupShare.nullish(),
3886
+ myShare: zVillageUserCollectiveShare.nullish(),
3498
3887
  pending: zVillagePendingShare.nullish(),
3499
3888
  session: zVillageTranscript
3500
3889
  }).superRefine((value, context) => {
@@ -3580,20 +3969,29 @@ export const zVillageSessionListPayload = z.object({
3580
3969
  page: z.int().gte(1).lte(9007199254740991),
3581
3970
  totalItems: z.int().gte(0).lte(9007199254740991)
3582
3971
  });
3583
- export const zVillageGroupedContributableResponse = z.object({
3972
+ /**
3973
+ * Released groupId envelope for GET /api/v1/groups/{id}/contributable during the alias window. Use VillageGroupedContributableResponse on /api/v1/collectives/{id}/contributable.
3974
+ *
3975
+ * @deprecated
3976
+ */
3977
+ export const zVillageDeprecatedGroupedContributableResponse = z.object({
3584
3978
  groupId: zVillageUUID,
3585
3979
  transcriptList: zVillageSessionListPayload
3586
3980
  });
3587
- export const zVillageGroupedGroupDetailResponse = z.object({
3981
+ export const zVillageGroupedCollectiveDetailResponse = z.object({
3588
3982
  can_read: z.boolean(),
3589
- contributors: z.array(zVillageGroupContributor),
3590
- group: zVillageGroupDetailRecord,
3591
- members: z.array(zVillageGroupMember),
3592
- models: z.array(zVillageGroupModelBreakdown),
3593
- pending_members: z.array(zVillageGroupMember).optional(),
3594
- stats: zVillageGroupTranscriptStats,
3983
+ contributors: z.array(zVillageCollectiveContributor),
3984
+ group: zVillageCollectiveDetailRecord,
3985
+ members: z.array(zVillageCollectiveMember),
3986
+ models: z.array(zVillageCollectiveModelBreakdown),
3987
+ pending_members: z.array(zVillageCollectiveMember).optional(),
3988
+ stats: zVillageCollectiveTranscriptStats,
3595
3989
  transcriptList: zVillageSessionListPayload,
3596
- your_role: zVillageGroupViewerRole
3990
+ your_role: zVillageCollectiveViewerRole
3991
+ });
3992
+ export const zVillageGroupedContributableResponse = z.object({
3993
+ group_id: zVillageUUID,
3994
+ transcriptList: zVillageSessionListPayload
3597
3995
  });
3598
3996
  export const zVillageUserSettings = z.object({
3599
3997
  auto_attach_pull_requests: z.boolean(),
@@ -3606,11 +4004,11 @@ export const zVillageUserStats = z.object({
3606
4004
  total_transcripts: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3607
4005
  total_turns: z.coerce.bigint().gte(BigInt(0)).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' })
3608
4006
  });
3609
- export const zVillageVisibleGroup = z.object({
3610
- acceptance_mode: zVillageGroupAcceptanceMode,
4007
+ export const zVillageVisibleCollective = z.object({
4008
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3611
4009
  created_at: z.iso.datetime(),
3612
4010
  created_by: zVillageUUID,
3613
- data_access: zVillageGroupDataAccess,
4011
+ data_access: zVillageCollectiveDataAccess,
3614
4012
  description: z.string().nullable(),
3615
4013
  display_members: z.boolean(),
3616
4014
  id: zVillageUUID,
@@ -3618,7 +4016,7 @@ export const zVillageVisibleGroup = z.object({
3618
4016
  member_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3619
4017
  member_since: z.iso.datetime().nullable(),
3620
4018
  name: z.string(),
3621
- role: zVillageGroupRole.nullable(),
4019
+ role: zVillageCollectiveRole.nullable(),
3622
4020
  transcript_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3623
4021
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3624
4022
  updated_at: z.iso.datetime()