@peasant-labs/schema 0.30.0 → 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()
@@ -896,6 +1028,46 @@ export const zNativePiMessageRole = z.enum(['toolResult']);
896
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.
897
1029
  */
898
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
+ });
899
1071
  /**
900
1072
  * Omitted preserves, null requests clear, and a canonical license replaces
901
1073
  */
@@ -1078,6 +1250,23 @@ export const zPublishAssociationOperation = z.object({
1078
1250
  prior = key;
1079
1251
  }
1080
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" }); });
1081
1270
  /**
1082
1271
  * Read Attribution State
1083
1272
  *
@@ -2308,6 +2497,36 @@ export const zCanonicalPublishOperation = z.object({
2308
2497
  * Village-side transcript identifier (canonical lowercase-hex UUID)
2309
2498
  */
2310
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" }); });
2311
2530
  export const zPromptDigestItem = z.object({
2312
2531
  additions: z.int().nullish(),
2313
2532
  args: z.string().optional(),
@@ -2677,7 +2896,7 @@ export const zTaxonomyNode = z.object({
2677
2896
  *
2678
2897
  * Collective roles an owner may assign through the member role endpoint
2679
2898
  */
2680
- export const zVillageAssignableGroupRole = z.enum(['contributor', 'member']);
2899
+ export const zVillageAssignableCollectiveRole = z.enum(['contributor', 'member']);
2681
2900
  export const zVillageAvailableRepository = z.object({
2682
2901
  is_private: z.boolean(),
2683
2902
  name: z.string(),
@@ -2696,36 +2915,12 @@ export const zVillageBatchShareRequest = z.object({
2696
2915
  transcript_ids: z.array(zTranscriptID).optional(),
2697
2916
  visibility_confirmed: z.boolean()
2698
2917
  });
2699
- /**
2700
- * Village Contribution Status
2701
- *
2702
- * Status assigned when a new collective contribution is opened
2703
- */
2704
- export const zVillageContributionStatus = z.enum(['approved', 'pending']);
2705
- export const zVillageBatchShareEntry = z.object({
2706
- status: zVillageContributionStatus,
2707
- transcript_id: zTranscriptID
2708
- });
2709
- export const zVillageBatchShareResponse = z.object({
2710
- already_shared: z.array(zTranscriptID),
2711
- project_hash: zProjectHash,
2712
- shared: z.array(zVillageBatchShareEntry)
2713
- });
2714
- export const zVillageErrorResponse = z.object({
2715
- error: z.string()
2716
- });
2717
- /**
2718
- * GitHub Webhook Payload
2719
- *
2720
- * GitHub event payload forwarded verbatim; validated by the X-Hub-Signature-256 HMAC over the raw body, never by shape
2721
- */
2722
- export const zVillageGitHubWebhookPayload = z.record(z.string(), z.unknown());
2723
2918
  /**
2724
2919
  * Village Group Acceptance Mode
2725
2920
  *
2726
2921
  * How a collective accepts new members and contributions
2727
2922
  */
2728
- export const zVillageGroupAcceptanceMode = z.enum([
2923
+ export const zVillageCollectiveAcceptanceMode = z.enum([
2729
2924
  'open',
2730
2925
  'verified_only',
2731
2926
  'curated'
@@ -2735,25 +2930,18 @@ export const zVillageGroupAcceptanceMode = z.enum([
2735
2930
  *
2736
2931
  * Who may read a collective's pooled transcript data
2737
2932
  */
2738
- export const zVillageGroupDataAccess = z.enum([
2933
+ export const zVillageCollectiveDataAccess = z.enum([
2739
2934
  'members_only',
2740
2935
  'contributors',
2741
2936
  'public'
2742
2937
  ]);
2743
- export const zVillageCreateGroupRequest = z.object({
2744
- acceptance_mode: zVillageGroupAcceptanceMode.optional(),
2745
- data_access: zVillageGroupDataAccess.optional(),
2746
- description: z.string().optional(),
2747
- linked_github_org: z.string().nullish(),
2748
- name: z.string()
2749
- });
2750
- export const zVillageGroupMemberRoleRequest = z.object({
2751
- role: zVillageAssignableGroupRole
2938
+ export const zVillageCollectiveMemberRoleRequest = z.object({
2939
+ role: zVillageAssignableCollectiveRole
2752
2940
  });
2753
- export const zVillageGroupMemberUsernameRequest = z.object({
2941
+ export const zVillageCollectiveMemberUsernameRequest = z.object({
2754
2942
  username: z.string()
2755
2943
  });
2756
- export const zVillageGroupModelBreakdown = z.object({
2944
+ export const zVillageCollectiveModelBreakdown = z.object({
2757
2945
  model_provider: z.string(),
2758
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' })
2759
2947
  });
@@ -2762,17 +2950,17 @@ export const zVillageGroupModelBreakdown = z.object({
2762
2950
  *
2763
2951
  * A user's role in one collective
2764
2952
  */
2765
- export const zVillageGroupRole = z.enum([
2953
+ export const zVillageCollectiveRole = z.enum([
2766
2954
  'owner',
2767
2955
  'member',
2768
2956
  'contributor',
2769
2957
  'pending'
2770
2958
  ]);
2771
- export const zVillageGroupStatusRoleResponse = z.object({
2772
- role: zVillageGroupRole,
2959
+ export const zVillageCollectiveStatusRoleResponse = z.object({
2960
+ role: zVillageCollectiveRole,
2773
2961
  status: z.string()
2774
2962
  });
2775
- export const zVillageGroupTranscriptStats = z.object({
2963
+ export const zVillageCollectiveTranscriptStats = z.object({
2776
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' }),
2777
2965
  pull_request_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
2778
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' }),
@@ -2785,13 +2973,44 @@ export const zVillageGroupTranscriptStats = z.object({
2785
2973
  *
2786
2974
  * The caller's role in a collective, or an empty string when the caller has none
2787
2975
  */
2788
- export const zVillageGroupViewerRole = z.enum([
2976
+ export const zVillageCollectiveViewerRole = z.enum([
2789
2977
  '',
2790
2978
  'owner',
2791
2979
  'member',
2792
2980
  'contributor',
2793
2981
  'pending'
2794
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());
2795
3014
  export const zVillageLinkRepositoryRequest = z.object({
2796
3015
  installation_id: z.int().nullish(),
2797
3016
  name: z.string(),
@@ -2861,7 +3080,7 @@ export const zVillagePullRequestsSummary = z.object({
2861
3080
  count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
2862
3081
  recent: z.array(zVillagePullRequestRef)
2863
3082
  });
2864
- export const zVillageRemoveGroupMemberResponse = z.object({
3083
+ export const zVillageRemoveCollectiveMemberResponse = z.object({
2865
3084
  retracted: z.boolean(),
2866
3085
  status: z.string()
2867
3086
  });
@@ -2921,11 +3140,26 @@ export const zVillageShareStatus = z.enum([
2921
3140
  'revoked'
2922
3141
  ]);
2923
3142
  export const zVillageShareEvent = z.object({
2924
- 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(),
2925
3144
  decided_by_actor: zVillageShareEventActor,
2926
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' }),
2927
- 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$/),
2928
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");
2929
3163
  });
2930
3164
  export const zVillageStatusResponse = z.object({
2931
3165
  status: z.string()
@@ -3011,6 +3245,71 @@ export const zAutoPublishRuleRequest = z.object({
3011
3245
  context.addIssue({ code: "custom", message: "name exactly one session or explicit pattern target" });
3012
3246
  }
3013
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" }); });
3014
3313
  export const zLocalPublicationAudienceMember = z.object({
3015
3314
  collectiveId: zVillageUUID,
3016
3315
  name: z.string(),
@@ -3030,6 +3329,49 @@ export const zLocalPublication = z.object({
3030
3329
  export const zLocalPublicationsResponse = z.object({
3031
3330
  publications: z.array(zLocalPublication)
3032
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" }); });
3033
3375
  export const zLocalSettingsResponse = z.object({
3034
3376
  autoPublish: z.array(zAutoPublishRule),
3035
3377
  settings: z.array(zLocalSetting)
@@ -3076,55 +3418,11 @@ export const zSyncPushResponse = z.object({
3076
3418
  skipped: z.int().gte(0),
3077
3419
  updated: z.int().gte(0)
3078
3420
  });
3079
- export const zVillageCollectiveSearchResult = z.object({
3080
- description: z.string().nullable(),
3081
- id: zVillageUUID,
3082
- linked_github_org: z.string().nullable(),
3083
- member_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3084
- name: z.string(),
3085
- transcript_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
3086
- });
3087
- export const zVillageCollectiveSearchResponse = z.object({
3088
- collectives: z.array(zVillageCollectiveSearchResult)
3089
- });
3090
- export const zVillageCollectiveSubmission = z.object({
3091
- event_num: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3092
- group_id: zVillageUUID,
3093
- recorded_at: z.iso.datetime(),
3094
- status: zVillageShareStatus,
3095
- title: z.string().nullable(),
3096
- transcript_id: zTranscriptID
3097
- });
3098
- export const zVillageContributableResponse = z.object({
3099
- group_id: zVillageUUID,
3100
- transcripts: z.array(zVillageContributableTranscript)
3101
- });
3102
- export const zVillageContributedCollective = z.object({
3103
- approved_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3104
- description: z.string().nullable(),
3105
- id: zVillageUUID,
3106
- linked_github_org: z.string().nullable(),
3107
- name: z.string(),
3108
- pending_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3109
- 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' }),
3110
- 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' })
3111
- });
3112
- export const zVillageContributedCollectivesResponse = z.object({
3113
- collectives: z.array(zVillageContributedCollective)
3114
- });
3115
- export const zVillageEnrichedTranscriptShare = z.object({
3116
- acceptance_mode: zVillageGroupAcceptanceMode,
3117
- group_id: zVillageUUID,
3118
- group_name: z.string(),
3119
- shared_at: z.iso.datetime(),
3120
- status: zVillageShareStatus,
3121
- transcript_id: zTranscriptID
3122
- });
3123
- export const zVillageGroup = z.object({
3124
- acceptance_mode: zVillageGroupAcceptanceMode,
3421
+ export const zVillageCollective = z.object({
3422
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3125
3423
  created_at: z.iso.datetime(),
3126
3424
  created_by: zVillageUUID,
3127
- data_access: zVillageGroupDataAccess,
3425
+ data_access: zVillageCollectiveDataAccess,
3128
3426
  description: z.string().nullable(),
3129
3427
  display_members: z.boolean(),
3130
3428
  id: zVillageUUID,
@@ -3135,17 +3433,17 @@ export const zVillageGroup = z.object({
3135
3433
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3136
3434
  updated_at: z.iso.datetime()
3137
3435
  });
3138
- export const zVillageGroupContributor = z.object({
3436
+ export const zVillageCollectiveContributor = z.object({
3139
3437
  avatar_url: z.string().nullable(),
3140
3438
  github_username: z.string(),
3141
3439
  id: zVillageUUID,
3142
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' })
3143
3441
  });
3144
- export const zVillageGroupDetailRecord = z.object({
3145
- acceptance_mode: zVillageGroupAcceptanceMode,
3442
+ export const zVillageCollectiveDetailRecord = z.object({
3443
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3146
3444
  created_at: z.iso.datetime(),
3147
3445
  created_by: zVillageUUID,
3148
- data_access: zVillageGroupDataAccess,
3446
+ data_access: zVillageCollectiveDataAccess,
3149
3447
  description: z.string().nullable(),
3150
3448
  display_members: z.boolean(),
3151
3449
  id: zVillageUUID,
@@ -3156,16 +3454,35 @@ export const zVillageGroupDetailRecord = z.object({
3156
3454
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3157
3455
  updated_at: z.iso.datetime()
3158
3456
  });
3159
- export const zVillageGroupMember = z.object({
3457
+ export const zVillageCollectiveMember = z.object({
3160
3458
  avatar_url: z.string().nullable(),
3161
3459
  display_name: z.string().nullable(),
3162
3460
  github_orgs: z.array(z.string()),
3163
3461
  github_username: z.string(),
3164
3462
  id: zVillageUUID,
3165
3463
  joined_at: z.iso.datetime(),
3166
- 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' })
3167
3473
  });
3168
- export const zVillageGroupTranscript = z.object({
3474
+ export const zVillageCollectiveSearchResponse = z.object({
3475
+ collectives: z.array(zVillageCollectiveSearchResult)
3476
+ });
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({
3169
3486
  blob_size_bytes: z.int().nullable(),
3170
3487
  compute_version: z.int().nullable(),
3171
3488
  computed_at: z.iso.datetime().nullable(),
@@ -3240,16 +3557,42 @@ export const zVillageGroupTranscript = z.object({
3240
3557
  visibility: zVillageTranscriptVisibility,
3241
3558
  within_session_reverts: z.int().nullable()
3242
3559
  });
3243
- export const zVillageGroupDetailResponse = z.object({
3560
+ export const zVillageCollectiveDetailResponse = z.object({
3244
3561
  can_read: z.boolean(),
3245
- contributors: z.array(zVillageGroupContributor),
3246
- group: zVillageGroupDetailRecord,
3247
- members: z.array(zVillageGroupMember),
3248
- models: z.array(zVillageGroupModelBreakdown),
3249
- pending_members: z.array(zVillageGroupMember).optional(),
3250
- stats: zVillageGroupTranscriptStats,
3251
- transcripts: z.array(zVillageGroupTranscript),
3252
- 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
3253
3596
  });
3254
3597
  export const zVillageLinkedRepository = z.object({
3255
3598
  created_at: z.iso.datetime().nullable(),
@@ -3270,6 +3613,17 @@ export const zVillageListUserOrganization = z.object({
3270
3613
  org_login: z.string(),
3271
3614
  user_id: zVillageUUID
3272
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" }); });
3273
3627
  export const zVillagePendingShare = z.object({
3274
3628
  branch: z.string().nullable(),
3275
3629
  input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
@@ -3288,10 +3642,10 @@ export const zVillagePendingShare = z.object({
3288
3642
  title: z.string().nullable(),
3289
3643
  transcript_id: zTranscriptID
3290
3644
  });
3291
- export const zVillagePublicGroup = z.object({
3292
- acceptance_mode: zVillageGroupAcceptanceMode,
3645
+ export const zVillagePublicCollective = z.object({
3646
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3293
3647
  created_at: z.iso.datetime(),
3294
- data_access: zVillageGroupDataAccess,
3648
+ data_access: zVillageCollectiveDataAccess,
3295
3649
  description: z.string().nullable(),
3296
3650
  id: zVillageUUID,
3297
3651
  linked_github_org: z.string().nullable(),
@@ -3427,9 +3781,9 @@ export const zVillageTranscriptShare = z.object({
3427
3781
  group_name: z.string(),
3428
3782
  shared_at: z.iso.datetime()
3429
3783
  });
3430
- export const zVillageUpdateGroupRequest = z.object({
3431
- acceptance_mode: zVillageGroupAcceptanceMode.optional(),
3432
- data_access: zVillageGroupDataAccess.optional(),
3784
+ export const zVillageUpdateCollectiveRequest = z.object({
3785
+ acceptance_mode: zVillageCollectiveAcceptanceMode.optional(),
3786
+ data_access: zVillageCollectiveDataAccess.optional(),
3433
3787
  description: z.string().optional(),
3434
3788
  display_members: z.boolean().nullish(),
3435
3789
  linked_github_org: z.string().nullish(),
@@ -3482,11 +3836,11 @@ export const zVillageTranscriptMetadataResponse = z.object({
3482
3836
  tags: z.array(zVillageTag),
3483
3837
  transcript: zVillageTranscript
3484
3838
  });
3485
- export const zVillageUserGroup = z.object({
3486
- acceptance_mode: zVillageGroupAcceptanceMode,
3839
+ export const zVillageUserCollective = z.object({
3840
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3487
3841
  created_at: z.iso.datetime(),
3488
3842
  created_by: zVillageUUID,
3489
- data_access: zVillageGroupDataAccess,
3843
+ data_access: zVillageCollectiveDataAccess,
3490
3844
  description: z.string().nullable(),
3491
3845
  display_members: z.boolean(),
3492
3846
  id: zVillageUUID,
@@ -3494,19 +3848,19 @@ export const zVillageUserGroup = z.object({
3494
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' }),
3495
3849
  member_since: z.iso.datetime(),
3496
3850
  name: z.string(),
3497
- role: zVillageGroupRole,
3851
+ role: zVillageCollectiveRole,
3498
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' }),
3499
3853
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3500
3854
  updated_at: z.iso.datetime()
3501
3855
  });
3502
3856
  export const zLocalVillageCollective = z.object({
3503
- group: zVillageUserGroup,
3857
+ group: zVillageUserCollective,
3504
3858
  suggestion: zLocalCollectiveSuggestion.optional()
3505
3859
  });
3506
3860
  export const zLocalVillageCollectivesResponse = z.object({
3507
3861
  collectives: z.array(zLocalVillageCollective)
3508
3862
  });
3509
- export const zVillageUserGroupShare = z.object({
3863
+ export const zVillageUserCollectiveShare = z.object({
3510
3864
  id: zTranscriptID,
3511
3865
  input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
3512
3866
  local_id: zSessionID,
@@ -3527,9 +3881,9 @@ export const zVillageUserGroupShare = z.object({
3527
3881
  visibility: zVillageTranscriptVisibility
3528
3882
  });
3529
3883
  export const zVillageSessionRow = z.object({
3530
- collective: zVillageGroupTranscript.nullish(),
3884
+ collective: zVillageCollectiveTranscript.nullish(),
3531
3885
  contributable: zVillageContributableTranscript.nullish(),
3532
- myShare: zVillageUserGroupShare.nullish(),
3886
+ myShare: zVillageUserCollectiveShare.nullish(),
3533
3887
  pending: zVillagePendingShare.nullish(),
3534
3888
  session: zVillageTranscript
3535
3889
  }).superRefine((value, context) => {
@@ -3615,20 +3969,29 @@ export const zVillageSessionListPayload = z.object({
3615
3969
  page: z.int().gte(1).lte(9007199254740991),
3616
3970
  totalItems: z.int().gte(0).lte(9007199254740991)
3617
3971
  });
3618
- 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({
3619
3978
  groupId: zVillageUUID,
3620
3979
  transcriptList: zVillageSessionListPayload
3621
3980
  });
3622
- export const zVillageGroupedGroupDetailResponse = z.object({
3981
+ export const zVillageGroupedCollectiveDetailResponse = z.object({
3623
3982
  can_read: z.boolean(),
3624
- contributors: z.array(zVillageGroupContributor),
3625
- group: zVillageGroupDetailRecord,
3626
- members: z.array(zVillageGroupMember),
3627
- models: z.array(zVillageGroupModelBreakdown),
3628
- pending_members: z.array(zVillageGroupMember).optional(),
3629
- 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,
3630
3989
  transcriptList: zVillageSessionListPayload,
3631
- your_role: zVillageGroupViewerRole
3990
+ your_role: zVillageCollectiveViewerRole
3991
+ });
3992
+ export const zVillageGroupedContributableResponse = z.object({
3993
+ group_id: zVillageUUID,
3994
+ transcriptList: zVillageSessionListPayload
3632
3995
  });
3633
3996
  export const zVillageUserSettings = z.object({
3634
3997
  auto_attach_pull_requests: z.boolean(),
@@ -3641,11 +4004,11 @@ export const zVillageUserStats = z.object({
3641
4004
  total_transcripts: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3642
4005
  total_turns: z.coerce.bigint().gte(BigInt(0)).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' })
3643
4006
  });
3644
- export const zVillageVisibleGroup = z.object({
3645
- acceptance_mode: zVillageGroupAcceptanceMode,
4007
+ export const zVillageVisibleCollective = z.object({
4008
+ acceptance_mode: zVillageCollectiveAcceptanceMode,
3646
4009
  created_at: z.iso.datetime(),
3647
4010
  created_by: zVillageUUID,
3648
- data_access: zVillageGroupDataAccess,
4011
+ data_access: zVillageCollectiveDataAccess,
3649
4012
  description: z.string().nullable(),
3650
4013
  display_members: z.boolean(),
3651
4014
  id: zVillageUUID,
@@ -3653,7 +4016,7 @@ export const zVillageVisibleGroup = z.object({
3653
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' }),
3654
4017
  member_since: z.iso.datetime().nullable(),
3655
4018
  name: z.string(),
3656
- role: zVillageGroupRole.nullable(),
4019
+ role: zVillageCollectiveRole.nullable(),
3657
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' }),
3658
4021
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3659
4022
  updated_at: z.iso.datetime()