@peasant-labs/schema 0.23.0 → 0.25.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.
@@ -233,6 +233,50 @@ export const zAuthoritativeTimestampInfo = z.object({
233
233
  ingested: z.int().nullish(),
234
234
  start: 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' })
235
235
  }).strict();
236
+ /**
237
+ * Auto Publish Event
238
+ *
239
+ * Git hook that publishes an auto-publish rule's sessions
240
+ */
241
+ export const zAutoPublishEvent = z.enum(['pre-push', 'post-commit']);
242
+ export const zAutoPublishHookRemedy = z.object({
243
+ message: z.string().min(1),
244
+ snippet: z.string().optional()
245
+ });
246
+ /**
247
+ * Auto Publish Hook Status
248
+ *
249
+ * State of one repository's auto-publish hook for one event
250
+ */
251
+ export const zAutoPublishHookStatus = z.enum([
252
+ 'absent',
253
+ 'installed',
254
+ 'blocked',
255
+ 'failed'
256
+ ]);
257
+ export const zAutoPublishHook = z.object({
258
+ event: zAutoPublishEvent,
259
+ remedy: zAutoPublishHookRemedy.optional(),
260
+ status: zAutoPublishHookStatus
261
+ });
262
+ export const zAutoPublishInstallRequest = z.object({
263
+ path: z.string().min(1)
264
+ }).strict();
265
+ export const zAutoPublishRepository = z.object({
266
+ hooks: z.array(zAutoPublishHook),
267
+ label: z.string().optional(),
268
+ path: z.string().min(1)
269
+ });
270
+ export const zAutoPublishRemovalResponse = z.object({
271
+ id: z.string().min(1),
272
+ repositories: z.array(zAutoPublishRepository)
273
+ });
274
+ /**
275
+ * Auto Publish Rule Kind
276
+ *
277
+ * What an auto-publish rule's match pattern names
278
+ */
279
+ export const zAutoPublishRuleKind = z.enum(['folder', 'remote']);
236
280
  export const zBatchCreateAnnotationsErrorResponse = z.object({
237
281
  error: z.string(),
238
282
  failingIndex: z.int()
@@ -664,6 +708,9 @@ export const zInteractionType = z.enum([
664
708
  'discussed',
665
709
  'questioned'
666
710
  ]);
711
+ export const zInterpretationDiagnostics = z.object({
712
+ partial: z.boolean()
713
+ });
667
714
  /**
668
715
  * License
669
716
  *
@@ -674,6 +721,69 @@ export const zLicense = z.enum([
674
721
  'CC-BY-4.0',
675
722
  'CC-BY-SA-4.0'
676
723
  ]);
724
+ /**
725
+ * Local Collective Suggestion Reason
726
+ *
727
+ * Why the local server suggests a collective for a session
728
+ */
729
+ export const zLocalCollectiveSuggestionReason = z.enum(['linked_repository', 'linked_github_org']);
730
+ export const zLocalCollectiveSuggestion = z.object({
731
+ match: z.string(),
732
+ reason: zLocalCollectiveSuggestionReason
733
+ });
734
+ export const zLocalPublicationAttemptFailure = z.object({
735
+ attemptedAt: z.iso.datetime(),
736
+ message: z.string()
737
+ });
738
+ /**
739
+ * Local Publication State
740
+ *
741
+ * Whether a local session has a publication on Village
742
+ */
743
+ export const zLocalPublicationState = z.enum(['unpublished', 'published']);
744
+ /**
745
+ * Local Setting Kind
746
+ *
747
+ * JSON type of one local setting's value
748
+ */
749
+ export const zLocalSettingKind = z.enum([
750
+ 'boolean',
751
+ 'integer',
752
+ 'string',
753
+ 'string_list',
754
+ 'choice',
755
+ 'structured'
756
+ ]);
757
+ export const zLocalSettingRefusal = z.object({
758
+ error: z.string().min(1),
759
+ key: z.string().min(1)
760
+ });
761
+ /**
762
+ * Local Setting Value
763
+ *
764
+ * One setting's value, of the JSON type its kind names; null means the key is unset and the server's default applies
765
+ */
766
+ export const zLocalSettingValue = z.union([
767
+ z.boolean(),
768
+ z.int(),
769
+ z.string(),
770
+ z.array(z.unknown()),
771
+ z.record(z.string(), z.unknown())
772
+ ]).nullable();
773
+ export const zLocalSetting = z.object({
774
+ description: z.string().optional(),
775
+ editable: z.boolean(),
776
+ effective: zLocalSettingValue,
777
+ inPeasantConfig: z.boolean(),
778
+ key: z.string().min(1),
779
+ kind: zLocalSettingKind,
780
+ options: z.array(z.string()).optional(),
781
+ value: zLocalSettingValue
782
+ });
783
+ export const zLocalSettingUpdateRequest = z.object({
784
+ key: z.string().min(1),
785
+ value: zLocalSettingValue
786
+ }).strict();
677
787
  export const zMapEdge = z.object({
678
788
  count: z.int(),
679
789
  from: z.string(),
@@ -794,23 +904,6 @@ export const zAuthoritativeProjectContext = z.object({
794
904
  hash: zProjectHash,
795
905
  name: z.string()
796
906
  }).strict();
797
- export const zLocalSyncSummary = z.object({
798
- durationMs: 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' }),
799
- harness: zHarness,
800
- hostSlug: z.string(),
801
- id: z.string(),
802
- inputSubmissionCount: z.int().gte(0).lte(9007199254740991).optional(),
803
- model: z.string(),
804
- projectHash: zProjectHash,
805
- projectName: z.string(),
806
- startTime: z.string(),
807
- syncStatus: z.string(),
808
- totalTokens: z.int(),
809
- turnCount: z.int()
810
- });
811
- export const zLocalSyncSessionsPayload = z.object({
812
- sessions: z.array(zLocalSyncSummary)
813
- });
814
907
  export const zProjectContext = z.object({
815
908
  filePath: z.string().optional(),
816
909
  hash: zProjectHash,
@@ -1070,6 +1163,15 @@ export const zRelationshipTargetState = z.enum([
1070
1163
  'unknown',
1071
1164
  'conflicting_current_native_evidence'
1072
1165
  ]);
1166
+ export const zRetainedUnknownRecord = z.object({
1167
+ kind: z.string().min(1),
1168
+ namespace: z.string().min(1),
1169
+ payload: z.string().min(1),
1170
+ pointer: z.string().regex(/^(?:\/(?:[^~]|~[01])*)*$/),
1171
+ position: z.number().int().min(0).max(9007199254740991),
1172
+ recordIndex: z.number().int().min(0).max(9007199254740991),
1173
+ sourceRef: z.string().min(1)
1174
+ });
1073
1175
  export const zReviewSuggestion = z.object({
1074
1176
  daysSince: z.int(),
1075
1177
  lastEngaged: z.string(),
@@ -1478,6 +1580,171 @@ export const zSessionSummary = z.object({
1478
1580
  totalTokens: z.int(),
1479
1581
  turnCount: z.int()
1480
1582
  });
1583
+ export const zSessionsPayload = z.object({
1584
+ sessions: z.array(zSessionSummary).nullable()
1585
+ });
1586
+ /**
1587
+ * Source Format
1588
+ *
1589
+ * Transcript file format
1590
+ */
1591
+ export const zSourceFormat = z.enum(['jsonl', 'json']);
1592
+ export const zAuthoritativeSourceInfo = z.object({
1593
+ filePath: z.string().optional(),
1594
+ format: zSourceFormat
1595
+ }).strict();
1596
+ export const zSourceInfo = z.object({
1597
+ filePath: z.string().optional(),
1598
+ format: zSourceFormat
1599
+ });
1600
+ /**
1601
+ * Stop Reason
1602
+ *
1603
+ * Reason why a session or turn ended (ACP-aligned)
1604
+ */
1605
+ export const zStopReason = z.enum([
1606
+ 'end_turn',
1607
+ 'cancelled',
1608
+ 'max_tokens',
1609
+ 'max_turn_requests',
1610
+ 'refusal'
1611
+ ]);
1612
+ export const zSubagentRef = z.object({
1613
+ parentUuid: zSessionID,
1614
+ sessionId: zSessionID
1615
+ });
1616
+ /**
1617
+ * Submission Reference
1618
+ */
1619
+ export const zSubmissionRef = z.string().min(1).max(96).refine((value) => !/[\uD800-\uDFFF]/u.test(value) && new TextEncoder().encode(value).length <= 96, { error: "SubmissionRef is invalid UTF-8 or exceeds 96 bytes" });
1620
+ export const zContentProvenance = z.object({
1621
+ actor: zActorOrigin,
1622
+ delivery: zDeliveryOrigin,
1623
+ evidence: zEvidenceKind,
1624
+ inputModality: zInputModality,
1625
+ origin: zContentOrigin,
1626
+ ownership: zContentOwnership,
1627
+ submissionRef: zSubmissionRef.optional()
1628
+ }).strict();
1629
+ export const zSyncAuthResponse = z.object({
1630
+ authenticated: z.boolean(),
1631
+ username: z.string().optional(),
1632
+ villageConfigured: z.boolean().optional(),
1633
+ villageUrl: z.string().optional()
1634
+ });
1635
+ /**
1636
+ * Sync Hold Reason
1637
+ *
1638
+ * Why a held local session cannot be published yet
1639
+ */
1640
+ export const zSyncHoldReason = z.enum(['metrics_missing', 'metadata_missing']);
1641
+ /**
1642
+ * Sync Login Status
1643
+ *
1644
+ * Result of starting the Village sign-in from the local server
1645
+ */
1646
+ export const zSyncLoginStatus = z.enum(['pending', 'already_authenticated']);
1647
+ export const zSyncLoginResponse = z.object({
1648
+ status: zSyncLoginStatus
1649
+ });
1650
+ /**
1651
+ * Sync Logout Status
1652
+ *
1653
+ * Result of ending this computer's Village sign-in
1654
+ */
1655
+ export const zSyncLogoutStatus = z.enum(['logged_out', 'already_logged_out']);
1656
+ export const zSyncLogoutResponse = z.object({
1657
+ status: zSyncLogoutStatus
1658
+ });
1659
+ /**
1660
+ * Sync Push Session Status
1661
+ *
1662
+ * Outcome of one session in a push
1663
+ */
1664
+ export const zSyncPushSessionStatus = z.enum([
1665
+ 'new',
1666
+ 'updated',
1667
+ 'skipped',
1668
+ 'error',
1669
+ 'held'
1670
+ ]);
1671
+ /**
1672
+ * Sync Push Step
1673
+ *
1674
+ * One step a push runs for a session
1675
+ */
1676
+ export const zSyncPushStep = z.enum([
1677
+ 'content',
1678
+ 'add_collective',
1679
+ 'remove_collective'
1680
+ ]);
1681
+ /**
1682
+ * Sync Push Step Outcome
1683
+ *
1684
+ * Result of one push step
1685
+ */
1686
+ export const zSyncPushStepOutcome = z.enum([
1687
+ 'succeeded',
1688
+ 'pending_approval',
1689
+ 'skipped',
1690
+ 'failed',
1691
+ 'not_attempted'
1692
+ ]);
1693
+ export const zSyncRedactionItem = z.object({
1694
+ category: z.string(),
1695
+ contextAfter: z.array(z.string()),
1696
+ contextBefore: z.array(z.string()),
1697
+ description: z.string(),
1698
+ entryIndex: z.int().gte(0).optional(),
1699
+ lineNumber: z.int().gte(0),
1700
+ originalText: z.string(),
1701
+ redactedReplacement: z.string(),
1702
+ ruleDisplayName: z.string(),
1703
+ ruleId: z.string(),
1704
+ toolCallId: z.string().optional()
1705
+ });
1706
+ export const zSyncRedactionRuleGroup = z.object({
1707
+ count: z.int().gte(0),
1708
+ displayName: z.string(),
1709
+ items: z.array(zSyncRedactionItem),
1710
+ ruleId: z.string()
1711
+ });
1712
+ export const zSyncRedactionCategoryGroup = z.object({
1713
+ category: z.string(),
1714
+ rules: z.array(zSyncRedactionRuleGroup),
1715
+ totalCount: z.int().gte(0)
1716
+ });
1717
+ export const zSyncRedactionsResponse = z.object({
1718
+ categories: z.array(zSyncRedactionCategoryGroup),
1719
+ total: z.int().gte(0)
1720
+ });
1721
+ /**
1722
+ * Sync Status
1723
+ *
1724
+ * Publication status of one listed local session; held rows always carry a hold reason
1725
+ */
1726
+ export const zSyncStatus = z.enum([
1727
+ 'new',
1728
+ 'updated',
1729
+ 'synced',
1730
+ 'held'
1731
+ ]);
1732
+ export const zLocalSyncSummary = z.object({
1733
+ durationMs: 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' }),
1734
+ harness: zHarness,
1735
+ holdReason: zSyncHoldReason.optional(),
1736
+ hostSlug: z.string(),
1737
+ id: z.string(),
1738
+ inputSubmissionCount: z.int().gte(0).lte(9007199254740991).optional(),
1739
+ model: z.string(),
1740
+ previouslyPushed: z.boolean(),
1741
+ projectHash: zProjectHash,
1742
+ projectName: z.string(),
1743
+ startTime: z.string(),
1744
+ syncStatus: zSyncStatus,
1745
+ totalTokens: z.int(),
1746
+ turnCount: z.int()
1747
+ });
1481
1748
  export const zLocalSessionRow = z.object({
1482
1749
  matches: z.array(zSearchResult).optional(),
1483
1750
  session: zSessionSummary,
@@ -1551,52 +1818,9 @@ export const zLocalSessionListPayload = z.object({
1551
1818
  page: z.int().gte(1).lte(9007199254740991),
1552
1819
  totalItems: z.int().gte(0).lte(9007199254740991)
1553
1820
  });
1554
- export const zSessionsPayload = z.object({
1555
- sessions: z.array(zSessionSummary).nullable()
1556
- });
1557
- /**
1558
- * Source Format
1559
- *
1560
- * Transcript file format
1561
- */
1562
- export const zSourceFormat = z.enum(['jsonl', 'json']);
1563
- export const zAuthoritativeSourceInfo = z.object({
1564
- filePath: z.string().optional(),
1565
- format: zSourceFormat
1566
- }).strict();
1567
- export const zSourceInfo = z.object({
1568
- filePath: z.string().optional(),
1569
- format: zSourceFormat
1570
- });
1571
- /**
1572
- * Stop Reason
1573
- *
1574
- * Reason why a session or turn ended (ACP-aligned)
1575
- */
1576
- export const zStopReason = z.enum([
1577
- 'end_turn',
1578
- 'cancelled',
1579
- 'max_tokens',
1580
- 'max_turn_requests',
1581
- 'refusal'
1582
- ]);
1583
- export const zSubagentRef = z.object({
1584
- parentUuid: zSessionID,
1585
- sessionId: zSessionID
1821
+ export const zLocalSyncSessionsPayload = z.object({
1822
+ sessions: z.array(zLocalSyncSummary)
1586
1823
  });
1587
- /**
1588
- * Submission Reference
1589
- */
1590
- export const zSubmissionRef = z.string().min(1).max(96).refine((value) => !/[\uD800-\uDFFF]/u.test(value) && new TextEncoder().encode(value).length <= 96, { error: "SubmissionRef is invalid UTF-8 or exceeds 96 bytes" });
1591
- export const zContentProvenance = z.object({
1592
- actor: zActorOrigin,
1593
- delivery: zDeliveryOrigin,
1594
- evidence: zEvidenceKind,
1595
- inputModality: zInputModality,
1596
- origin: zContentOrigin,
1597
- ownership: zContentOwnership,
1598
- submissionRef: zSubmissionRef.optional()
1599
- }).strict();
1600
1824
  /**
1601
1825
  * Target Kind
1602
1826
  *
@@ -2276,6 +2500,7 @@ export const zEarlierHistorySection = z.object({
2276
2500
  }).strict();
2277
2501
  export const zSessionDetailPayload = z.object({
2278
2502
  childSessions: z.array(zChildSessionRef).optional(),
2503
+ diagnostics: zInterpretationDiagnostics.optional(),
2279
2504
  durationMins: z.number(),
2280
2505
  earlierHistory: z.array(zEarlierHistorySection).optional(),
2281
2506
  endTime: z.iso.datetime(),
@@ -2291,6 +2516,7 @@ export const zSessionDetailPayload = z.object({
2291
2516
  project: z.string().optional(),
2292
2517
  purpose: zSessionPurpose.optional(),
2293
2518
  relationships: z.array(zSessionRelationship).optional(),
2519
+ retainedUnknown: z.array(zRetainedUnknownRecord).optional(),
2294
2520
  rootSessionId: zSessionID.nullish(),
2295
2521
  schemaVersion: z.string().optional(),
2296
2522
  scorecard: zSessionScorecard.nullish(),
@@ -2308,6 +2534,7 @@ export const zSessionDetailPayload = z.object({
2308
2534
  });
2309
2535
  export const zSessionDetailReadPayload = z.object({
2310
2536
  childSessions: z.array(zChildSessionRef).optional(),
2537
+ diagnostics: zInterpretationDiagnostics.optional(),
2311
2538
  durationMins: z.number().optional(),
2312
2539
  earlierHistory: z.array(zEarlierHistorySection).optional(),
2313
2540
  endTime: z.iso.datetime().optional(),
@@ -2324,6 +2551,7 @@ export const zSessionDetailReadPayload = z.object({
2324
2551
  purpose: zSessionPurpose.optional(),
2325
2552
  relationshipNavigation: z.array(zSessionRelationshipNavigation).optional(),
2326
2553
  relationships: z.array(zSessionRelationship).optional(),
2554
+ retainedUnknown: z.array(zRetainedUnknownRecord).optional(),
2327
2555
  rootSessionId: zSessionID.optional(),
2328
2556
  schemaVersion: z.string().optional(),
2329
2557
  scorecard: zSessionScorecard.optional(),
@@ -2389,7 +2617,8 @@ export const zVillageAssignableGroupRole = z.enum(['contributor', 'member']);
2389
2617
  export const zVillageAvailableRepository = z.object({
2390
2618
  is_private: z.boolean(),
2391
2619
  name: z.string(),
2392
- owner: z.string()
2620
+ owner: z.string(),
2621
+ publisher_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
2393
2622
  });
2394
2623
  export const zVillageAvailableRepositoriesResponse = z.object({
2395
2624
  repositories: z.array(zVillageAvailableRepository)
@@ -2451,7 +2680,7 @@ export const zVillageCreateGroupRequest = z.object({
2451
2680
  acceptance_mode: zVillageGroupAcceptanceMode.optional(),
2452
2681
  data_access: zVillageGroupDataAccess.optional(),
2453
2682
  description: z.string().optional(),
2454
- linked_github_org: z.string().optional(),
2683
+ linked_github_org: z.string().nullish(),
2455
2684
  name: z.string()
2456
2685
  });
2457
2686
  export const zVillageGroupMemberRoleRequest = z.object({
@@ -2481,6 +2710,7 @@ export const zVillageGroupStatusRoleResponse = z.object({
2481
2710
  });
2482
2711
  export const zVillageGroupTranscriptStats = z.object({
2483
2712
  contributor_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
2713
+ pull_request_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
2484
2714
  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' }),
2485
2715
  total_tokens: 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' }),
2486
2716
  total_transcripts: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
@@ -2558,6 +2788,15 @@ export const zVillagePromptRequest = z.object({
2558
2788
  export const zVillagePromptRequestsResponse = z.object({
2559
2789
  requests: z.array(zVillagePromptRequest)
2560
2790
  });
2791
+ export const zVillagePullRequestRef = z.object({
2792
+ name: z.string().min(1),
2793
+ number: z.int().gte(1),
2794
+ owner: z.string().min(1)
2795
+ });
2796
+ export const zVillagePullRequestsSummary = z.object({
2797
+ count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
2798
+ recent: z.array(zVillagePullRequestRef)
2799
+ });
2561
2800
  export const zVillageRemoveGroupMemberResponse = z.object({
2562
2801
  retracted: z.boolean(),
2563
2802
  status: z.string()
@@ -2633,6 +2872,17 @@ export const zVillageStatusResponse = z.object({
2633
2872
  * Whether leaving a collective retracts contributed transcripts by default
2634
2873
  */
2635
2874
  export const zVillageTranscriptDeletionPolicy = z.enum(['user_choice', 'mandatory']);
2875
+ export const zVillageTranscriptPullRequest = z.object({
2876
+ head_ref: z.string().nullable(),
2877
+ name: z.string().min(1),
2878
+ number: z.int().gte(1),
2879
+ owner: z.string().min(1),
2880
+ state: zVillagePullRequestAttachmentState,
2881
+ title: z.string().nullable()
2882
+ });
2883
+ export const zVillageTranscriptPullRequestsResponse = z.object({
2884
+ pull_requests: z.array(zVillageTranscriptPullRequest)
2885
+ });
2636
2886
  /**
2637
2887
  * Village Transcript Visibility
2638
2888
  *
@@ -2675,6 +2925,74 @@ export const zVillagePullRequestAttachedTranscript = z.object({
2675
2925
  * Village-side canonical lowercase UUID identifier
2676
2926
  */
2677
2927
  export const zVillageUUID = z.uuid().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/);
2928
+ export const zAutoPublishRule = z.object({
2929
+ collectives: z.array(zVillageUUID),
2930
+ events: z.array(zAutoPublishEvent),
2931
+ id: z.string().min(1),
2932
+ kind: zAutoPublishRuleKind,
2933
+ match: z.string().min(1),
2934
+ repositories: z.array(zAutoPublishRepository)
2935
+ });
2936
+ export const zAutoPublishRuleRequest = z.object({
2937
+ collectives: z.array(zVillageUUID),
2938
+ events: z.array(zAutoPublishEvent),
2939
+ kind: zAutoPublishRuleKind,
2940
+ match: z.string().min(1)
2941
+ }).strict();
2942
+ export const zLocalPublicationAudienceMember = z.object({
2943
+ collectiveId: zVillageUUID,
2944
+ name: z.string(),
2945
+ status: zVillageShareStatus
2946
+ });
2947
+ export const zLocalPublication = z.object({
2948
+ audience: z.array(zLocalPublicationAudienceMember).optional(),
2949
+ autoPublish: z.boolean(),
2950
+ lastAttempt: zLocalPublicationAttemptFailure.optional(),
2951
+ outsideSelection: z.boolean(),
2952
+ publishedAt: z.iso.datetime().optional(),
2953
+ sessionId: z.string(),
2954
+ state: zLocalPublicationState,
2955
+ transcriptId: zTranscriptID.optional(),
2956
+ transcriptUrl: z.string().optional()
2957
+ });
2958
+ export const zLocalPublicationsResponse = z.object({
2959
+ publications: z.array(zLocalPublication)
2960
+ });
2961
+ export const zLocalSettingsResponse = z.object({
2962
+ autoPublish: z.array(zAutoPublishRule),
2963
+ settings: z.array(zLocalSetting)
2964
+ });
2965
+ export const zSyncPushCollectives = z.object({
2966
+ add: z.array(zVillageUUID).optional(),
2967
+ remove: z.array(zVillageUUID).optional()
2968
+ }).strict();
2969
+ export const zSyncPushRequest = z.object({
2970
+ collectives: zSyncPushCollectives.optional(),
2971
+ redactionLevel: z.string().optional(),
2972
+ sessionIds: z.array(z.string()).min(1)
2973
+ }).strict();
2974
+ export const zSyncPushStepResult = z.object({
2975
+ collectiveId: zVillageUUID.optional(),
2976
+ outcome: zSyncPushStepOutcome,
2977
+ reason: z.string().optional(),
2978
+ step: zSyncPushStep
2979
+ });
2980
+ export const zSyncPushSessionResult = z.object({
2981
+ error: z.string().optional(),
2982
+ sessionId: z.string(),
2983
+ status: zSyncPushSessionStatus,
2984
+ steps: z.array(zSyncPushStepResult).optional(),
2985
+ title: z.string().optional(),
2986
+ transcriptUrl: z.string().optional(),
2987
+ waitingPullRequests: z.array(zVillagePromptRequest).optional()
2988
+ });
2989
+ export const zSyncPushResponse = z.object({
2990
+ errors: z.int().gte(0),
2991
+ new: z.int().gte(0),
2992
+ sessions: z.array(zSyncPushSessionResult),
2993
+ skipped: z.int().gte(0),
2994
+ updated: z.int().gte(0)
2995
+ });
2678
2996
  export const zVillageCollectiveSearchResult = z.object({
2679
2997
  description: z.string().nullable(),
2680
2998
  id: zVillageUUID,
@@ -2812,6 +3130,7 @@ export const zVillageGroupTranscript = z.object({
2812
3130
  project_name_source: zVillageProjectNameSource,
2813
3131
  project_remote_label: z.string(),
2814
3132
  published_at: z.iso.datetime(),
3133
+ pull_requests: zVillagePullRequestsSummary,
2815
3134
  purpose: zSessionPurpose.optional(),
2816
3135
  relationships: z.array(zSessionRelationship).optional(),
2817
3136
  retry_loops: z.int().nullable(),
@@ -2904,6 +3223,7 @@ export const zVillagePullRequestAttachment = z.object({
2904
3223
  confirmed_at: z.iso.datetime().nullable(),
2905
3224
  created_at: z.iso.datetime(),
2906
3225
  detached_at: z.iso.datetime().nullable(),
3226
+ head_ref: z.string().nullable(),
2907
3227
  head_sha: z.string(),
2908
3228
  id: zVillageUUID,
2909
3229
  is_private_repository: z.boolean(),
@@ -2912,6 +3232,7 @@ export const zVillagePullRequestAttachment = z.object({
2912
3232
  owner: z.string(),
2913
3233
  requested_by_github_id: z.int().nullable(),
2914
3234
  state: zVillagePullRequestAttachmentState,
3235
+ title: z.string().nullable(),
2915
3236
  updated_at: z.iso.datetime()
2916
3237
  });
2917
3238
  export const zVillagePullRequestAttachmentResponse = z.object({
@@ -3035,6 +3356,7 @@ export const zVillageUpdateGroupRequest = z.object({
3035
3356
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy.optional()
3036
3357
  });
3037
3358
  export const zVillageUpdateUserSettingsRequest = z.object({
3359
+ auto_attach_pull_requests: z.boolean().nullish(),
3038
3360
  preview_before_attach: z.boolean().nullish()
3039
3361
  });
3040
3362
  export const zVillageUser = z.object({
@@ -3055,6 +3377,7 @@ export const zVillageTranscriptListRow = z.object({
3055
3377
  attestations: z.array(zVillageListTranscriptAttestation).nullable(),
3056
3378
  owner: zVillageUser,
3057
3379
  owner_orgs: z.array(zVillageListUserOrganization).nullable(),
3380
+ pull_requests: zVillagePullRequestsSummary,
3058
3381
  shares: z.array(zVillageEnrichedTranscriptShare).nullable(),
3059
3382
  tags: z.array(zVillageTag),
3060
3383
  transcript: zVillageTranscript
@@ -3093,6 +3416,13 @@ export const zVillageUserGroup = z.object({
3093
3416
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3094
3417
  updated_at: z.iso.datetime()
3095
3418
  });
3419
+ export const zLocalVillageCollective = z.object({
3420
+ group: zVillageUserGroup,
3421
+ suggestion: zLocalCollectiveSuggestion.optional()
3422
+ });
3423
+ export const zLocalVillageCollectivesResponse = z.object({
3424
+ collectives: z.array(zLocalVillageCollective)
3425
+ });
3096
3426
  export const zVillageUserGroupShare = z.object({
3097
3427
  id: zTranscriptID,
3098
3428
  input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
@@ -3218,8 +3548,16 @@ export const zVillageGroupedGroupDetailResponse = z.object({
3218
3548
  your_role: zVillageGroupViewerRole
3219
3549
  });
3220
3550
  export const zVillageUserSettings = z.object({
3551
+ auto_attach_pull_requests: z.boolean(),
3221
3552
  preview_before_attach: z.boolean()
3222
3553
  });
3554
+ export const zVillageUserStats = z.object({
3555
+ pull_request_count: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3556
+ total_duration_ms: z.coerce.bigint().gte(BigInt(0)).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
3557
+ total_tokens: z.coerce.bigint().gte(BigInt(0)).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' }),
3558
+ total_transcripts: z.int().gte(0).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' }),
3559
+ total_turns: z.coerce.bigint().gte(BigInt(0)).max(BigInt('9223372036854775807'), { error: 'Invalid value: Expected int64 to be <= 9223372036854775807' })
3560
+ });
3223
3561
  export const zVillageVisibleGroup = z.object({
3224
3562
  acceptance_mode: zVillageGroupAcceptanceMode,
3225
3563
  created_at: z.iso.datetime(),