@peasant-labs/schema 0.32.0 → 0.33.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.
@@ -2223,32 +2223,6 @@ export const zAnnotationsPayload = z.object({
2223
2223
  axis: zAnnotationAxis,
2224
2224
  id: z.string()
2225
2225
  });
2226
- export const zPullAnnotation = z.object({
2227
- annotatorKind: zAnnotatorKind.optional(),
2228
- annotatorName: z.string().optional(),
2229
- authorUserId: z.string(),
2230
- authorUsername: z.string(),
2231
- confidence: z.number().nullish(),
2232
- contentHash: z.string().nullish(),
2233
- createdAt: 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' }).optional(),
2234
- id: z.string().optional(),
2235
- isPrimary: z.boolean().optional(),
2236
- provenance: zProvenance.optional(),
2237
- reason: z.string().nullish(),
2238
- supersededBy: z.string().nullish(),
2239
- targetAnnotationId: z.string().nullish(),
2240
- targetAssociationId: zAssociationID.optional(),
2241
- targetContentHash: z.string().nullish(),
2242
- targetEntryEndIndex: z.int().nullish(),
2243
- targetEntryIndex: z.int().nullish(),
2244
- targetFilePath: z.string().nullish(),
2245
- targetKind: zTargetKind.optional(),
2246
- targetProjectHash: zProjectHash.optional(),
2247
- targetSessionId: z.string().nullish(),
2248
- typeId: z.string().optional(),
2249
- typeName: z.string().optional(),
2250
- value: z.string().optional()
2251
- });
2252
2226
  export const zQualitySession = z.object({
2253
2227
  date: z.string(),
2254
2228
  discoveryTurns: z.int(),
@@ -3022,6 +2996,10 @@ export const zVillageListTranscriptAttestation = z.object({
3022
2996
  org_login: z.string(),
3023
2997
  transcript_id: zTranscriptID
3024
2998
  });
2999
+ export const zVillageListUserOrganization = z.object({
3000
+ avatar_url: z.string().nullable(),
3001
+ org_login: z.string()
3002
+ });
3025
3003
  export const zVillageMetadataUserOrganization = z.object({
3026
3004
  avatar_url: z.string().nullable(),
3027
3005
  fetched_at: z.iso.datetime(),
@@ -3047,6 +3025,95 @@ export const zVillageProjectNameSource = z.enum([
3047
3025
  * Check-run conclusion policy for a collective's linked repositories when no prompts are attached
3048
3026
  */
3049
3027
  export const zVillagePromptsCheckMode = z.enum(['informational', 'required']);
3028
+ /**
3029
+ * Village Public Owner
3030
+ *
3031
+ * A person as another viewer sees them. The server resolves anonymity per viewer; consumers render what they receive and never re-derive the rule. profile carries id, username, display_name, and avatar_url; anonymous carries only its kind, with no id. Readers treat an unknown kind as anonymous.
3032
+ */
3033
+ export const zVillagePublicOwner = z.union([
3034
+ z.object({
3035
+ avatar_url: z.string().nullable(),
3036
+ display_name: z.string().nullable(),
3037
+ id: z.uuid().regex(/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/),
3038
+ kind: z.literal('profile'),
3039
+ username: z.string().min(1)
3040
+ }),
3041
+ z.object({
3042
+ kind: z.literal('anonymous')
3043
+ }),
3044
+ z.object({
3045
+ kind: z.string().min(1).refine((kind) => !["profile", "anonymous"].includes(kind))
3046
+ }).transform(() => ({ kind: 'anonymous' }))
3047
+ ]);
3048
+ export const zPullAnnotation = z.object({
3049
+ annotatorKind: zAnnotatorKind.optional(),
3050
+ annotatorName: z.string().optional(),
3051
+ author: zVillagePublicOwner,
3052
+ confidence: z.number().nullish(),
3053
+ contentHash: z.string().nullish(),
3054
+ createdAt: 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' }).optional(),
3055
+ id: z.string().optional(),
3056
+ isPrimary: z.boolean().optional(),
3057
+ provenance: zProvenance.optional(),
3058
+ reason: z.string().nullish(),
3059
+ supersededBy: z.string().nullish(),
3060
+ targetAnnotationId: z.string().nullish(),
3061
+ targetAssociationId: zAssociationID.optional(),
3062
+ targetContentHash: z.string().nullish(),
3063
+ targetEntryEndIndex: z.int().nullish(),
3064
+ targetEntryIndex: z.int().nullish(),
3065
+ targetFilePath: z.string().nullish(),
3066
+ targetKind: zTargetKind.optional(),
3067
+ targetProjectHash: zProjectHash.optional(),
3068
+ targetSessionId: z.string().nullish(),
3069
+ typeId: z.string().optional(),
3070
+ typeName: z.string().optional(),
3071
+ value: z.string().optional()
3072
+ });
3073
+ export const zVillageCollectiveContributor = z.object({
3074
+ contributor: zVillagePublicOwner,
3075
+ transcript_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 zVillageCollectiveMember = z.object({
3078
+ github_orgs: z.array(z.string()),
3079
+ joined_at: z.iso.datetime(),
3080
+ member: zVillagePublicOwner,
3081
+ role: zVillageCollectiveRole
3082
+ }).superRefine((value, context) => {
3083
+ const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zVillageCollectiveMember: " + reason });
3084
+ if (value.member.kind !== "profile" && value.github_orgs.length > 0)
3085
+ fail("github_orgs lists organizations beside an anonymous member; emit none for an anonymous member");
3086
+ });
3087
+ export const zVillagePendingShare = z.object({
3088
+ branch: z.string().nullable(),
3089
+ input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
3090
+ local_id: zSessionID,
3091
+ model_provider: z.string(),
3092
+ owner: zVillagePublicOwner,
3093
+ parent_session_id: zSessionID.nullable(),
3094
+ parent_transcript_id: zTranscriptID.nullable(),
3095
+ project_hash: zProjectHash.nullable(),
3096
+ project_name: z.string().nullable(),
3097
+ purpose: zSessionPurpose.optional(),
3098
+ relationships: z.array(zSessionRelationship).optional(),
3099
+ root_session_id: zSessionID.nullish(),
3100
+ shared_at: z.iso.datetime(),
3101
+ title: z.string().nullable(),
3102
+ transcript_id: zTranscriptID
3103
+ }).superRefine((value, context) => {
3104
+ const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zVillagePendingShare: " + reason });
3105
+ if (value.owner.kind !== "profile") {
3106
+ const present = ["project_hash", "project_name", "branch"].filter((field) => { const v = value[field]; return v !== null && v !== undefined; });
3107
+ if (present.length > 0)
3108
+ fail(present.join(", ") + " identify the repository of an anonymous owner; withhold every repository field (null, or omitted on the pull envelope) when the owner is anonymous");
3109
+ }
3110
+ });
3111
+ /**
3112
+ * Village Public Owner Kind
3113
+ *
3114
+ * How a person is shown to the viewer: their public profile, or anonymous. Readers treat a kind they do not know as anonymous.
3115
+ */
3116
+ export const zVillagePublicOwnerKind = z.enum(['profile', 'anonymous']);
3050
3117
  /**
3051
3118
  * Village Pull Request Attachment State
3052
3119
  *
@@ -3191,6 +3258,86 @@ export const zVillageTranscriptVisibility = z.enum([
3191
3258
  'shared',
3192
3259
  'public'
3193
3260
  ]);
3261
+ export const zVillageCollectiveTranscript = z.object({
3262
+ blob_size_bytes: z.int().nullable(),
3263
+ compute_version: z.int().nullable(),
3264
+ computed_at: z.iso.datetime().nullable(),
3265
+ content_hash: zTranscriptContentHash.nullable(),
3266
+ description: z.string().nullable(),
3267
+ diagnostics_partial: z.boolean().nullable(),
3268
+ diagnostics_warnings: z.array(zDiagnosticEntry).nullable(),
3269
+ discovery_turns: z.int().nullable(),
3270
+ duration_ms: z.int().nullable(),
3271
+ exploration_ratio: z.number().nullable(),
3272
+ files_touched: z.int().nullable(),
3273
+ git_branch: z.string().nullable(),
3274
+ git_remote: z.string().nullable(),
3275
+ harness_version: z.string().nullable(),
3276
+ id: zTranscriptID,
3277
+ ingested_at: z.iso.datetime().nullable(),
3278
+ input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
3279
+ license_id: zLicense.nullable(),
3280
+ lines_changed: z.int().nullable(),
3281
+ local_id: zSessionID,
3282
+ m2_token_outcome_ratio: z.number().nullable(),
3283
+ m3_unique_tool_count: z.int().nullable(),
3284
+ m4_consecutive_error_max: z.int().nullable(),
3285
+ m4_error_recovery_count: z.int().nullable(),
3286
+ m5_avg_message_tokens: z.int().nullable(),
3287
+ m5_context_utilization_pct: z.number().nullable(),
3288
+ m5_peak_context_tokens: z.int().nullable(),
3289
+ m6_lines_survived: z.int().nullable(),
3290
+ m6_lines_total: z.int().nullable(),
3291
+ m6_output_survival_pct: z.number().nullable(),
3292
+ m7_spec_has_constraints: z.boolean().nullable(),
3293
+ m7_spec_has_examples: z.boolean().nullable(),
3294
+ m7_spec_word_count: z.int().nullable(),
3295
+ model_name: z.string().nullable(),
3296
+ model_provider: z.string(),
3297
+ outcome: zSessionOutcome.nullable(),
3298
+ owner: zVillagePublicOwner,
3299
+ parent_session_id: zSessionID.nullable(),
3300
+ parent_transcript_id: zTranscriptID.nullable(),
3301
+ project_display_name: z.string().nullable(),
3302
+ project_hash: zProjectHash.nullable(),
3303
+ project_name: z.string().nullable(),
3304
+ project_name_source: zVillageProjectNameSource.nullable(),
3305
+ project_remote_label: z.string().nullable(),
3306
+ published_at: z.iso.datetime(),
3307
+ pull_requests: zVillagePullRequestsSummary,
3308
+ purpose: zSessionPurpose.optional(),
3309
+ relationships: z.array(zSessionRelationship).optional(),
3310
+ retry_loops: z.int().nullable(),
3311
+ retry_tokens_wasted: z.int().nullable(),
3312
+ root_session_id: zSessionID.nullish(),
3313
+ schema_version: z.string(),
3314
+ scope_breadth: z.int().nullable(),
3315
+ session_end: z.iso.datetime().nullable(),
3316
+ session_origin: zSessionOrigin,
3317
+ session_start: z.iso.datetime().nullable(),
3318
+ signal_density: z.number().nullable(),
3319
+ source_format: zSourceFormat.nullable(),
3320
+ spec_quality_score: z.number().nullable(),
3321
+ subagent_count: z.int().nullable(),
3322
+ subagents: z.array(z.record(z.string(), z.unknown())).nullable(),
3323
+ title: z.string().nullable(),
3324
+ title_generated: z.string().nullable(),
3325
+ token_count: z.int().nullable(),
3326
+ tokens_in: z.int().nullable(),
3327
+ tokens_out: z.int().nullable(),
3328
+ tool_call_count: z.int().nullable(),
3329
+ turn_count: z.int().nullable(),
3330
+ updated_at: z.iso.datetime(),
3331
+ visibility: zVillageTranscriptVisibility,
3332
+ within_session_reverts: z.int().nullable()
3333
+ }).superRefine((value, context) => {
3334
+ const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zVillageCollectiveTranscript: " + reason });
3335
+ if (value.owner.kind !== "profile") {
3336
+ const present = ["git_branch", "git_remote", "project_hash", "project_name", "project_display_name", "project_name_source", "project_remote_label"].filter((field) => { const v = value[field]; return v !== null && v !== undefined; });
3337
+ if (present.length > 0)
3338
+ fail(present.join(", ") + " identify the repository of an anonymous owner; withhold every repository field (null, or omitted on the pull envelope) when the owner is anonymous");
3339
+ }
3340
+ });
3194
3341
  export const zVillageContributableTranscript = z.object({
3195
3342
  already_shared: z.boolean(),
3196
3343
  git_branch: z.string().nullable(),
@@ -3217,6 +3364,77 @@ export const zVillagePullRequestAttachedTranscript = z.object({
3217
3364
  title: z.string().nullable(),
3218
3365
  transcript_id: zTranscriptID
3219
3366
  });
3367
+ export const zVillageTranscript = z.object({
3368
+ blob_size_bytes: z.int().nullable(),
3369
+ compute_version: z.int().nullable(),
3370
+ computed_at: z.iso.datetime().nullable(),
3371
+ content_hash: zTranscriptContentHash.nullable(),
3372
+ description: z.string().nullable(),
3373
+ diagnostics_partial: z.boolean().nullable(),
3374
+ diagnostics_warnings: z.array(zDiagnosticEntry).nullable(),
3375
+ discovery_turns: z.int().nullable(),
3376
+ duration_ms: z.int().nullable(),
3377
+ exploration_ratio: z.number().nullable(),
3378
+ files_touched: z.int().nullable(),
3379
+ git_branch: z.string().nullable(),
3380
+ git_remote: z.string().nullable(),
3381
+ harness_version: z.string().nullable(),
3382
+ id: zTranscriptID,
3383
+ ingested_at: z.iso.datetime().nullable(),
3384
+ input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
3385
+ license_id: zLicense.nullable(),
3386
+ lines_changed: z.int().nullable(),
3387
+ local_id: zSessionID,
3388
+ m2_token_outcome_ratio: z.number().nullable(),
3389
+ m3_unique_tool_count: z.int().nullable(),
3390
+ m4_consecutive_error_max: z.int().nullable(),
3391
+ m4_error_recovery_count: z.int().nullable(),
3392
+ m5_avg_message_tokens: z.int().nullable(),
3393
+ m5_context_utilization_pct: z.number().nullable(),
3394
+ m5_peak_context_tokens: z.int().nullable(),
3395
+ m6_lines_survived: z.int().nullable(),
3396
+ m6_lines_total: z.int().nullable(),
3397
+ m6_output_survival_pct: z.number().nullable(),
3398
+ m7_spec_has_constraints: z.boolean().nullable(),
3399
+ m7_spec_has_examples: z.boolean().nullable(),
3400
+ m7_spec_word_count: z.int().nullable(),
3401
+ model_name: z.string().nullable(),
3402
+ model_provider: z.string(),
3403
+ outcome: zSessionOutcome.nullable(),
3404
+ parent_session_id: zSessionID.nullable(),
3405
+ parent_transcript_id: zTranscriptID.nullable(),
3406
+ project_display_name: z.string().nullable(),
3407
+ project_hash: zProjectHash.nullable(),
3408
+ project_name: z.string().nullable(),
3409
+ project_name_source: zVillageProjectNameSource.nullable(),
3410
+ project_remote_label: z.string().nullable(),
3411
+ published_at: z.iso.datetime(),
3412
+ purpose: zSessionPurpose.optional(),
3413
+ relationships: z.array(zSessionRelationship).optional(),
3414
+ retry_loops: z.int().nullable(),
3415
+ retry_tokens_wasted: z.int().nullable(),
3416
+ root_session_id: zSessionID.nullish(),
3417
+ schema_version: z.string(),
3418
+ scope_breadth: z.int().nullable(),
3419
+ session_end: z.iso.datetime().nullable(),
3420
+ session_origin: zSessionOrigin,
3421
+ session_start: z.iso.datetime().nullable(),
3422
+ signal_density: z.number().nullable(),
3423
+ source_format: zSourceFormat.nullable(),
3424
+ spec_quality_score: z.number().nullable(),
3425
+ subagent_count: z.int().nullable(),
3426
+ subagents: z.array(z.record(z.string(), z.unknown())).nullable(),
3427
+ title: z.string().nullable(),
3428
+ title_generated: z.string().nullable(),
3429
+ token_count: z.int().nullable(),
3430
+ tokens_in: z.int().nullable(),
3431
+ tokens_out: z.int().nullable(),
3432
+ tool_call_count: z.int().nullable(),
3433
+ turn_count: z.int().nullable(),
3434
+ updated_at: z.iso.datetime(),
3435
+ visibility: zVillageTranscriptVisibility,
3436
+ within_session_reverts: z.int().nullable()
3437
+ });
3220
3438
  /**
3221
3439
  * Village UUID
3222
3440
  *
@@ -3421,7 +3639,7 @@ export const zSyncPushResponse = z.object({
3421
3639
  export const zVillageCollective = z.object({
3422
3640
  acceptance_mode: zVillageCollectiveAcceptanceMode,
3423
3641
  created_at: z.iso.datetime(),
3424
- created_by: zVillageUUID,
3642
+ creator: zVillagePublicOwner,
3425
3643
  data_access: zVillageCollectiveDataAccess,
3426
3644
  description: z.string().nullable(),
3427
3645
  display_members: z.boolean(),
@@ -3433,16 +3651,10 @@ export const zVillageCollective = z.object({
3433
3651
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3434
3652
  updated_at: z.iso.datetime()
3435
3653
  });
3436
- export const zVillageCollectiveContributor = z.object({
3437
- avatar_url: z.string().nullable(),
3438
- github_username: z.string(),
3439
- id: zVillageUUID,
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' })
3441
- });
3442
3654
  export const zVillageCollectiveDetailRecord = z.object({
3443
3655
  acceptance_mode: zVillageCollectiveAcceptanceMode,
3444
3656
  created_at: z.iso.datetime(),
3445
- created_by: zVillageUUID,
3657
+ creator: zVillagePublicOwner,
3446
3658
  data_access: zVillageCollectiveDataAccess,
3447
3659
  description: z.string().nullable(),
3448
3660
  display_members: z.boolean(),
@@ -3454,14 +3666,16 @@ export const zVillageCollectiveDetailRecord = z.object({
3454
3666
  transcript_deletion_policy: zVillageTranscriptDeletionPolicy,
3455
3667
  updated_at: z.iso.datetime()
3456
3668
  });
3457
- export const zVillageCollectiveMember = z.object({
3458
- avatar_url: z.string().nullable(),
3459
- display_name: z.string().nullable(),
3460
- github_orgs: z.array(z.string()),
3461
- github_username: z.string(),
3462
- id: zVillageUUID,
3463
- joined_at: z.iso.datetime(),
3464
- role: zVillageCollectiveRole
3669
+ export const zVillageCollectiveDetailResponse = z.object({
3670
+ can_read: z.boolean(),
3671
+ contributors: z.array(zVillageCollectiveContributor),
3672
+ group: zVillageCollectiveDetailRecord,
3673
+ members: z.array(zVillageCollectiveMember),
3674
+ models: z.array(zVillageCollectiveModelBreakdown),
3675
+ pending_members: z.array(zVillageCollectiveMember).optional(),
3676
+ stats: zVillageCollectiveTranscriptStats,
3677
+ transcripts: z.array(zVillageCollectiveTranscript),
3678
+ your_role: zVillageCollectiveViewerRole
3465
3679
  });
3466
3680
  export const zVillageCollectiveSearchResult = z.object({
3467
3681
  description: z.string().nullable(),
@@ -3482,92 +3696,6 @@ export const zVillageCollectiveSubmission = z.object({
3482
3696
  title: z.string().nullable(),
3483
3697
  transcript_id: zTranscriptID
3484
3698
  });
3485
- export const zVillageCollectiveTranscript = z.object({
3486
- blob_size_bytes: z.int().nullable(),
3487
- compute_version: z.int().nullable(),
3488
- computed_at: z.iso.datetime().nullable(),
3489
- content_hash: zTranscriptContentHash.nullable(),
3490
- description: z.string().nullable(),
3491
- diagnostics_partial: z.boolean().nullable(),
3492
- diagnostics_warnings: z.array(zDiagnosticEntry).nullable(),
3493
- discovery_turns: z.int().nullable(),
3494
- duration_ms: z.int().nullable(),
3495
- exploration_ratio: z.number().nullable(),
3496
- files_touched: z.int().nullable(),
3497
- git_branch: z.string().nullable(),
3498
- git_remote: z.string().nullable(),
3499
- harness_version: z.string().nullable(),
3500
- id: zTranscriptID,
3501
- ingested_at: z.iso.datetime().nullable(),
3502
- input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
3503
- license_id: zLicense.nullable(),
3504
- lines_changed: z.int().nullable(),
3505
- local_id: zSessionID,
3506
- m2_token_outcome_ratio: z.number().nullable(),
3507
- m3_unique_tool_count: z.int().nullable(),
3508
- m4_consecutive_error_max: z.int().nullable(),
3509
- m4_error_recovery_count: z.int().nullable(),
3510
- m5_avg_message_tokens: z.int().nullable(),
3511
- m5_context_utilization_pct: z.number().nullable(),
3512
- m5_peak_context_tokens: z.int().nullable(),
3513
- m6_lines_survived: z.int().nullable(),
3514
- m6_lines_total: z.int().nullable(),
3515
- m6_output_survival_pct: z.number().nullable(),
3516
- m7_spec_has_constraints: z.boolean().nullable(),
3517
- m7_spec_has_examples: z.boolean().nullable(),
3518
- m7_spec_word_count: z.int().nullable(),
3519
- model_name: z.string().nullable(),
3520
- model_provider: z.string(),
3521
- outcome: zSessionOutcome.nullable(),
3522
- owner_avatar_url: z.string().nullable(),
3523
- owner_id: zVillageUUID,
3524
- owner_is_discoverable: z.boolean(),
3525
- owner_username: z.string(),
3526
- parent_session_id: zSessionID.nullable(),
3527
- project_display_name: z.string(),
3528
- project_hash: zProjectHash,
3529
- project_name: z.string().nullable(),
3530
- project_name_source: zVillageProjectNameSource,
3531
- project_remote_label: z.string(),
3532
- published_at: z.iso.datetime(),
3533
- pull_requests: zVillagePullRequestsSummary,
3534
- purpose: zSessionPurpose.optional(),
3535
- relationships: z.array(zSessionRelationship).optional(),
3536
- retry_loops: z.int().nullable(),
3537
- retry_tokens_wasted: z.int().nullable(),
3538
- root_session_id: zSessionID.nullish(),
3539
- schema_version: z.string(),
3540
- scope_breadth: z.int().nullable(),
3541
- session_end: z.iso.datetime().nullable(),
3542
- session_origin: zSessionOrigin,
3543
- session_start: z.iso.datetime().nullable(),
3544
- signal_density: z.number().nullable(),
3545
- source_format: zSourceFormat.nullable(),
3546
- spec_quality_score: z.number().nullable(),
3547
- subagent_count: z.int().nullable(),
3548
- subagents: z.array(z.record(z.string(), z.unknown())).nullable(),
3549
- title: z.string().nullable(),
3550
- title_generated: z.string().nullable(),
3551
- token_count: z.int().nullable(),
3552
- tokens_in: z.int().nullable(),
3553
- tokens_out: z.int().nullable(),
3554
- tool_call_count: z.int().nullable(),
3555
- turn_count: z.int().nullable(),
3556
- updated_at: z.iso.datetime(),
3557
- visibility: zVillageTranscriptVisibility,
3558
- within_session_reverts: z.int().nullable()
3559
- });
3560
- export const zVillageCollectiveDetailResponse = z.object({
3561
- can_read: z.boolean(),
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
3699
  export const zVillageContributableResponse = z.object({
3572
3700
  group_id: zVillageUUID,
3573
3701
  transcripts: z.array(zVillageContributableTranscript)
@@ -3601,18 +3729,13 @@ export const zVillageLinkedRepository = z.object({
3601
3729
  installation_id: 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' }),
3602
3730
  is_private: z.boolean(),
3603
3731
  last_synced_at: z.iso.datetime().nullable(),
3604
- linked_by: zVillageUUID,
3732
+ linked_by: zVillagePublicOwner,
3605
3733
  name: z.string(),
3606
3734
  owner: z.string()
3607
3735
  });
3608
3736
  export const zVillageLinkedRepositoriesResponse = z.object({
3609
3737
  repositories: z.array(zVillageLinkedRepository)
3610
3738
  });
3611
- export const zVillageListUserOrganization = z.object({
3612
- avatar_url: z.string().nullable(),
3613
- org_login: z.string(),
3614
- user_id: zVillageUUID
3615
- });
3616
3739
  export const zVillageOrganizationCollective = z.object({
3617
3740
  description: z.string().nullable(),
3618
3741
  id: zVillageUUID,
@@ -3624,24 +3747,6 @@ export const zVillageOrganizationCollectivesResponse = z.object({
3624
3747
  collectives: z.array(zVillageOrganizationCollective)
3625
3748
  }).superRefine((value, ctx) => { const issue = collectiveContractIssue("VillageOrganizationCollectivesResponse", value); if (issue !== undefined)
3626
3749
  ctx.addIssue({ code: "custom", message: "Collective contract validation: " + issue + "; retain prior evidence and fetch validated metadata before retrying" }); });
3627
- export const zVillagePendingShare = z.object({
3628
- branch: z.string().nullable(),
3629
- input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
3630
- local_id: zSessionID,
3631
- model_provider: z.string(),
3632
- owner_id: zVillageUUID,
3633
- owner_is_discoverable: z.boolean(),
3634
- owner_username: z.string(),
3635
- parent_session_id: zSessionID.nullable(),
3636
- project_hash: zProjectHash,
3637
- project_name: z.string().nullable(),
3638
- purpose: zSessionPurpose.optional(),
3639
- relationships: z.array(zSessionRelationship).optional(),
3640
- root_session_id: zSessionID.nullish(),
3641
- shared_at: z.iso.datetime(),
3642
- title: z.string().nullable(),
3643
- transcript_id: zTranscriptID
3644
- });
3645
3750
  export const zVillagePublicCollective = z.object({
3646
3751
  acceptance_mode: zVillageCollectiveAcceptanceMode,
3647
3752
  created_at: z.iso.datetime(),
@@ -3654,7 +3759,7 @@ export const zVillagePublicCollective = z.object({
3654
3759
  transcript_count: z.int().min(-2147483648, { error: 'Invalid value: Expected int32 to be >= -2147483648' }).max(2147483647, { error: 'Invalid value: Expected int32 to be <= 2147483647' })
3655
3760
  });
3656
3761
  export const zVillagePullRequestAttachment = z.object({
3657
- author_user_id: zVillageUUID.nullable(),
3762
+ author: zVillagePublicOwner,
3658
3763
  check_run_id: z.int().nullable(),
3659
3764
  comment_id: z.int().nullable(),
3660
3765
  confirmed_at: z.iso.datetime().nullable(),
@@ -3667,7 +3772,7 @@ export const zVillagePullRequestAttachment = z.object({
3667
3772
  name: z.string(),
3668
3773
  number: z.int(),
3669
3774
  owner: z.string(),
3670
- requested_by_github_id: z.int().nullable(),
3775
+ requested_by: zVillagePublicOwner.nullable(),
3671
3776
  state: zVillagePullRequestAttachmentState,
3672
3777
  title: z.string().nullable(),
3673
3778
  updated_at: z.iso.datetime()
@@ -3685,81 +3790,9 @@ export const zVillageTag = z.object({
3685
3790
  id: zVillageUUID,
3686
3791
  name: z.string()
3687
3792
  });
3688
- export const zVillageTranscript = z.object({
3689
- blob_size_bytes: z.int().nullable(),
3690
- compute_version: z.int().nullable(),
3691
- computed_at: z.iso.datetime().nullable(),
3692
- content_hash: zTranscriptContentHash.nullable(),
3693
- description: z.string().nullable(),
3694
- diagnostics_partial: z.boolean().nullable(),
3695
- diagnostics_warnings: z.array(zDiagnosticEntry).nullable(),
3696
- discovery_turns: z.int().nullable(),
3697
- duration_ms: z.int().nullable(),
3698
- exploration_ratio: z.number().nullable(),
3699
- files_touched: z.int().nullable(),
3700
- git_branch: z.string().nullable(),
3701
- git_remote: z.string().nullable(),
3702
- harness_version: z.string().nullable(),
3703
- id: zTranscriptID,
3704
- ingested_at: z.iso.datetime().nullable(),
3705
- input_submission_count: z.int().gte(0).lte(9007199254740991).optional(),
3706
- license_id: zLicense.nullable(),
3707
- lines_changed: z.int().nullable(),
3708
- local_id: zSessionID,
3709
- m2_token_outcome_ratio: z.number().nullable(),
3710
- m3_unique_tool_count: z.int().nullable(),
3711
- m4_consecutive_error_max: z.int().nullable(),
3712
- m4_error_recovery_count: z.int().nullable(),
3713
- m5_avg_message_tokens: z.int().nullable(),
3714
- m5_context_utilization_pct: z.number().nullable(),
3715
- m5_peak_context_tokens: z.int().nullable(),
3716
- m6_lines_survived: z.int().nullable(),
3717
- m6_lines_total: z.int().nullable(),
3718
- m6_output_survival_pct: z.number().nullable(),
3719
- m7_spec_has_constraints: z.boolean().nullable(),
3720
- m7_spec_has_examples: z.boolean().nullable(),
3721
- m7_spec_word_count: z.int().nullable(),
3722
- model_name: z.string().nullable(),
3723
- model_provider: z.string(),
3724
- outcome: zSessionOutcome.nullable(),
3725
- owner_id: zVillageUUID,
3726
- parent_session_id: zSessionID.nullable(),
3727
- project_display_name: z.string(),
3728
- project_hash: zProjectHash,
3729
- project_name: z.string().nullable(),
3730
- project_name_source: zVillageProjectNameSource,
3731
- project_remote_label: z.string(),
3732
- published_at: z.iso.datetime(),
3733
- purpose: zSessionPurpose.optional(),
3734
- relationships: z.array(zSessionRelationship).optional(),
3735
- retry_loops: z.int().nullable(),
3736
- retry_tokens_wasted: z.int().nullable(),
3737
- root_session_id: zSessionID.nullish(),
3738
- schema_version: z.string(),
3739
- scope_breadth: z.int().nullable(),
3740
- session_end: z.iso.datetime().nullable(),
3741
- session_origin: zSessionOrigin,
3742
- session_start: z.iso.datetime().nullable(),
3743
- signal_density: z.number().nullable(),
3744
- source_format: zSourceFormat.nullable(),
3745
- spec_quality_score: z.number().nullable(),
3746
- subagent_count: z.int().nullable(),
3747
- subagents: z.array(z.record(z.string(), z.unknown())).nullable(),
3748
- title: z.string().nullable(),
3749
- title_generated: z.string().nullable(),
3750
- token_count: z.int().nullable(),
3751
- tokens_in: z.int().nullable(),
3752
- tokens_out: z.int().nullable(),
3753
- tool_call_count: z.int().nullable(),
3754
- turn_count: z.int().nullable(),
3755
- updated_at: z.iso.datetime(),
3756
- visibility: zVillageTranscriptVisibility,
3757
- within_session_reverts: z.int().nullable()
3758
- });
3759
3793
  export const zVillageTranscriptAttestation = z.object({
3760
3794
  attestation_type: z.string(),
3761
- attester_avatar: z.string().nullable(),
3762
- attester_username: z.string(),
3795
+ attester: zVillagePublicOwner,
3763
3796
  created_at: z.iso.datetime(),
3764
3797
  id: zVillageUUID,
3765
3798
  note: z.string().nullable(),
@@ -3776,11 +3809,59 @@ export const zVillageTranscriptCollective = z.object({
3776
3809
  export const zVillageTranscriptCollectivesResponse = z.object({
3777
3810
  collectives: z.array(zVillageTranscriptCollective)
3778
3811
  });
3812
+ export const zVillageTranscriptListRow = z.object({
3813
+ attestations: z.array(zVillageListTranscriptAttestation).nullable(),
3814
+ owner: zVillagePublicOwner,
3815
+ owner_orgs: z.array(zVillageListUserOrganization).nullable(),
3816
+ pull_requests: zVillagePullRequestsSummary,
3817
+ shares: z.array(zVillageEnrichedTranscriptShare).nullable(),
3818
+ tags: z.array(zVillageTag),
3819
+ transcript: zVillageTranscript
3820
+ }).superRefine((value, context) => {
3821
+ const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zVillageTranscriptListRow: " + reason });
3822
+ if (value.owner.kind !== "profile" && (value.owner_orgs?.length ?? 0) > 0)
3823
+ fail("owner_orgs lists organizations beside an anonymous owner; emit none for an anonymous owner");
3824
+ }).superRefine((value, context) => {
3825
+ const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zVillageTranscriptListRow: " + reason });
3826
+ if (value.owner.kind !== "profile") {
3827
+ const present = ["git_branch", "git_remote", "project_hash", "project_name", "project_display_name", "project_name_source", "project_remote_label"].filter((field) => { const v = value.transcript[field]; return v !== null && v !== undefined; });
3828
+ if (present.length > 0)
3829
+ fail(present.join(", ") + " identify the repository of an anonymous owner; withhold every repository field (null, or omitted on the pull envelope) when the owner is anonymous");
3830
+ }
3831
+ });
3832
+ export const zVillageTranscriptListResponse = z.object({
3833
+ agent_total: z.int(),
3834
+ limit: z.int(),
3835
+ page: z.int(),
3836
+ total: z.int(),
3837
+ transcripts: z.array(zVillageTranscriptListRow)
3838
+ });
3779
3839
  export const zVillageTranscriptShare = z.object({
3780
3840
  group_id: zVillageUUID,
3781
3841
  group_name: z.string(),
3782
3842
  shared_at: z.iso.datetime()
3783
3843
  });
3844
+ export const zVillageTranscriptMetadataResponse = z.object({
3845
+ attestations: z.array(zVillageTranscriptAttestation),
3846
+ enriched_shares: z.array(zVillageEnrichedTranscriptShare),
3847
+ owner: zVillagePublicOwner,
3848
+ owner_orgs: z.array(zVillageMetadataUserOrganization),
3849
+ relationshipNavigation: z.array(zSessionRelationshipNavigation).optional(),
3850
+ shares: z.array(zVillageTranscriptShare),
3851
+ tags: z.array(zVillageTag),
3852
+ transcript: zVillageTranscript
3853
+ }).superRefine((value, context) => {
3854
+ const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zVillageTranscriptMetadataResponse: " + reason });
3855
+ if (value.owner.kind !== "profile" && value.owner_orgs.length > 0)
3856
+ fail("owner_orgs lists organizations beside an anonymous owner; emit none for an anonymous owner");
3857
+ }).superRefine((value, context) => {
3858
+ const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zVillageTranscriptMetadataResponse: " + reason });
3859
+ if (value.owner.kind !== "profile") {
3860
+ const present = ["git_branch", "git_remote", "project_hash", "project_name", "project_display_name", "project_name_source", "project_remote_label"].filter((field) => { const v = value.transcript[field]; return v !== null && v !== undefined; });
3861
+ if (present.length > 0)
3862
+ fail(present.join(", ") + " identify the repository of an anonymous owner; withhold every repository field (null, or omitted on the pull envelope) when the owner is anonymous");
3863
+ }
3864
+ });
3784
3865
  export const zVillageUpdateCollectiveRequest = z.object({
3785
3866
  acceptance_mode: zVillageCollectiveAcceptanceMode.optional(),
3786
3867
  data_access: zVillageCollectiveDataAccess.optional(),
@@ -3810,36 +3891,10 @@ export const zVillageUser = z.object({
3810
3891
  updated_at: z.iso.datetime(),
3811
3892
  username_chosen: z.boolean()
3812
3893
  });
3813
- export const zVillageTranscriptListRow = z.object({
3814
- attestations: z.array(zVillageListTranscriptAttestation).nullable(),
3815
- owner: zVillageUser,
3816
- owner_orgs: z.array(zVillageListUserOrganization).nullable(),
3817
- pull_requests: zVillagePullRequestsSummary,
3818
- shares: z.array(zVillageEnrichedTranscriptShare).nullable(),
3819
- tags: z.array(zVillageTag),
3820
- transcript: zVillageTranscript
3821
- });
3822
- export const zVillageTranscriptListResponse = z.object({
3823
- agent_total: z.int(),
3824
- limit: z.int(),
3825
- page: z.int(),
3826
- total: z.int(),
3827
- transcripts: z.array(zVillageTranscriptListRow)
3828
- });
3829
- export const zVillageTranscriptMetadataResponse = z.object({
3830
- attestations: z.array(zVillageTranscriptAttestation),
3831
- enriched_shares: z.array(zVillageEnrichedTranscriptShare),
3832
- owner: zVillageUser,
3833
- owner_orgs: z.array(zVillageMetadataUserOrganization),
3834
- relationshipNavigation: z.array(zSessionRelationshipNavigation).optional(),
3835
- shares: z.array(zVillageTranscriptShare),
3836
- tags: z.array(zVillageTag),
3837
- transcript: zVillageTranscript
3838
- });
3839
3894
  export const zVillageUserCollective = z.object({
3840
3895
  acceptance_mode: zVillageCollectiveAcceptanceMode,
3841
3896
  created_at: z.iso.datetime(),
3842
- created_by: zVillageUUID,
3897
+ creator: zVillagePublicOwner,
3843
3898
  data_access: zVillageCollectiveDataAccess,
3844
3899
  description: z.string().nullable(),
3845
3900
  display_members: z.boolean(),
@@ -3866,8 +3921,9 @@ export const zVillageUserCollectiveShare = z.object({
3866
3921
  local_id: zSessionID,
3867
3922
  model_name: z.string().nullable(),
3868
3923
  model_provider: z.string(),
3869
- owner_id: zVillageUUID,
3924
+ owner: zVillagePublicOwner,
3870
3925
  parent_session_id: zSessionID.nullable(),
3926
+ parent_transcript_id: zTranscriptID.nullable(),
3871
3927
  published_at: z.iso.datetime(),
3872
3928
  purpose: zSessionPurpose.optional(),
3873
3929
  relationships: z.array(zSessionRelationship).optional(),
@@ -3884,11 +3940,14 @@ export const zVillageSessionRow = z.object({
3884
3940
  collective: zVillageCollectiveTranscript.nullish(),
3885
3941
  contributable: zVillageContributableTranscript.nullish(),
3886
3942
  myShare: zVillageUserCollectiveShare.nullish(),
3943
+ owner: zVillagePublicOwner,
3887
3944
  pending: zVillagePendingShare.nullish(),
3888
3945
  session: zVillageTranscript
3889
3946
  }).superRefine((value, context) => {
3890
3947
  const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zVillageSessionRow during grouped read validation: " + reason });
3891
3948
  const s = value.session;
3949
+ if (s.parent_transcript_id != null && (s.parent_session_id == null || s.parent_transcript_id === s.id))
3950
+ fail("parent_transcript_id is set without a parent_session_id or names the row itself; resolve the parent within the same owner, or emit null");
3892
3951
  const arms = [value.collective, value.pending, value.myShare, value.contributable].filter(v => v != null);
3893
3952
  if (arms.length > 1)
3894
3953
  fail("multiple route arms supplied; retain the originating route only");
@@ -3908,11 +3967,21 @@ export const zVillageSessionRow = z.object({
3908
3967
  if (!equal(row[key], session[aliases[key] ?? key]))
3909
3968
  fail("route identity or metric mirrors disagree; derive both from the same row");
3910
3969
  };
3970
+ for (const arm of [value.collective, value.pending, value.myShare])
3971
+ if (arm != null && !equal(arm.owner, value.owner))
3972
+ fail("route owner differs from the row owner; resolve the owner once for this viewer and project it into both");
3911
3973
  const graph = ["parent_session_id", "root_session_id", "purpose", "relationships", "input_submission_count"];
3912
- check(value.collective, [...graph, "id", "owner_id", "local_id", "title", "description", "visibility", "model_provider", "model_name", "harness_version", "turn_count", "token_count", "tokens_in", "tokens_out", "duration_ms", "project_hash", "project_name", "project_display_name", "project_name_source", "project_remote_label", "git_branch", "session_origin"]);
3913
- check(value.pending, [...graph, "transcript_id", "owner_id", "local_id", "title", "model_provider", "project_hash", "project_name", "branch"], { transcript_id: "id", branch: "git_branch" });
3914
- check(value.myShare, [...graph, "id", "owner_id", "local_id", "title", "visibility", "published_at", "model_provider", "model_name", "turn_count", "tokens_in", "tokens_out"]);
3974
+ check(value.collective, [...graph, "parent_transcript_id", "id", "local_id", "title", "description", "visibility", "model_provider", "model_name", "harness_version", "turn_count", "token_count", "tokens_in", "tokens_out", "duration_ms", "project_hash", "project_name", "project_display_name", "project_name_source", "project_remote_label", "git_branch", "session_origin"]);
3975
+ check(value.pending, [...graph, "parent_transcript_id", "transcript_id", "local_id", "title", "model_provider", "project_hash", "project_name", "branch"], { transcript_id: "id", branch: "git_branch" });
3976
+ check(value.myShare, [...graph, "parent_transcript_id", "id", "local_id", "title", "visibility", "published_at", "model_provider", "model_name", "turn_count", "tokens_in", "tokens_out"]);
3915
3977
  check(value.contributable, [...graph, "id", "local_id", "title", "visibility", "model_provider", "project_hash", "project_display_name", "project_name_source", "git_branch", "published_at", "session_origin"]);
3978
+ }).superRefine((value, context) => {
3979
+ const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zVillageSessionRow: " + reason });
3980
+ if (value.owner.kind !== "profile") {
3981
+ const present = ["git_branch", "git_remote", "project_hash", "project_name", "project_display_name", "project_name_source", "project_remote_label"].filter((field) => { const v = value.session[field]; return v !== null && v !== undefined; });
3982
+ if (present.length > 0)
3983
+ fail(present.join(", ") + " identify the repository of an anonymous owner; withhold every repository field (null, or omitted on the pull envelope) when the owner is anonymous");
3984
+ }
3916
3985
  });
3917
3986
  export const zVillageSessionListItem = z.object({
3918
3987
  context: zHelperContextSummary.nullish(),
@@ -4007,7 +4076,7 @@ export const zVillageUserStats = z.object({
4007
4076
  export const zVillageVisibleCollective = z.object({
4008
4077
  acceptance_mode: zVillageCollectiveAcceptanceMode,
4009
4078
  created_at: z.iso.datetime(),
4010
- created_by: zVillageUUID,
4079
+ creator: zVillagePublicOwner,
4011
4080
  data_access: zVillageCollectiveDataAccess,
4012
4081
  description: z.string().nullable(),
4013
4082
  display_members: z.boolean(),
@@ -4081,14 +4150,20 @@ export const zPullTranscriptInfo = z.object({
4081
4150
  harness: zHarness.optional(),
4082
4151
  license: zLicense.optional(),
4083
4152
  localId: z.string().optional(),
4084
- ownerUserId: z.string(),
4085
- ownerUsername: z.string(),
4086
- projectName: z.string().optional(),
4153
+ owner: zVillagePublicOwner,
4154
+ projectName: z.string().nullish(),
4087
4155
  publishedAt: 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' }),
4088
4156
  title: z.string().optional(),
4089
4157
  transcriptId: zTranscriptID,
4090
4158
  updatedAt: 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' }),
4091
4159
  visibility: zVisibility
4160
+ }).superRefine((value, context) => {
4161
+ const fail = (reason) => context.addIssue({ code: "custom", message: "schema.zPullTranscriptInfo: " + reason });
4162
+ if (value.owner.kind !== "profile") {
4163
+ const present = ["projectName"].filter((field) => { const v = value[field]; return v !== null && v !== undefined; });
4164
+ if (present.length > 0)
4165
+ fail(present.join(", ") + " identify the repository of an anonymous owner; withhold every repository field (null, or omitted on the pull envelope) when the owner is anonymous");
4166
+ }
4092
4167
  });
4093
4168
  export const zPullListResponse = z.object({
4094
4169
  limit: z.int(),