@buildinternet/releases-api-types 0.1.0 → 0.3.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/api-types.ts +56 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildinternet/releases-api-types",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Wire protocol — request/response types for the Releases registry API. Shared by web, workers, and clients.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/api-types.ts CHANGED
@@ -412,6 +412,42 @@ export interface SearchChunkHit {
412
412
  score: number;
413
413
  }
414
414
 
415
+ // ── Lookup (on-demand GitHub index) ──
416
+
417
+ export type LookupStatus = "indexed" | "existing" | "empty" | "not_found" | "deferred";
418
+
419
+ /**
420
+ * Slim wire payload embedded in a search response when the query is a GitHub
421
+ * coordinate (org/repo) and no existing entity matched. The server performs an
422
+ * on-demand lookup and includes the result here so the client can surface a
423
+ * "just indexed" or "not found" rail without a second round trip.
424
+ */
425
+ export interface LookupResultPayload {
426
+ status: LookupStatus;
427
+ source?: {
428
+ id: string;
429
+ slug: string;
430
+ name: string;
431
+ url: string;
432
+ discovery: "curated" | "agent" | "on_demand";
433
+ };
434
+ releases?: Array<{
435
+ id: string;
436
+ version: string | null;
437
+ title: string;
438
+ publishedAt: string | null;
439
+ }>;
440
+ /**
441
+ * Unambiguous "did you mean" rail: the curated org that owns GitHub repos
442
+ * under the same org segment, plus its top sources. Null when the org
443
+ * segment matches multiple curated orgs or none.
444
+ */
445
+ relatedOrg: {
446
+ org: { id: string; slug: string; name: string };
447
+ sources: Array<{ id: string; slug: string; name: string; url: string }>;
448
+ } | null;
449
+ }
450
+
415
451
  export interface UnifiedSearchResponse {
416
452
  query: string;
417
453
  orgs: SearchOrgHit[];
@@ -429,6 +465,11 @@ export interface UnifiedSearchResponse {
429
465
  degraded?: boolean;
430
466
  /** Human-readable reason for degradation (e.g., missing Vectorize binding). */
431
467
  degradedReason?: string;
468
+ /**
469
+ * On-demand lookup result. Present when the query parsed as a GitHub
470
+ * `org/repo` coordinate and no existing entities matched. Null otherwise.
471
+ */
472
+ lookup?: LookupResultPayload | null;
432
473
  }
433
474
 
434
475
  // ── Overview Pages ──
@@ -663,6 +704,13 @@ export interface UsageStatsResponse {
663
704
 
664
705
  // ── Sessions ──
665
706
 
707
+ /**
708
+ * Where the session error originated.
709
+ * - `provider`: managed-agents service / Anthropic-side (e.g. unknown_error, model_overloaded, retries_exhausted)
710
+ * - `us`: this codebase / our agent setup (e.g. parser failure, no tools called, timeout)
711
+ */
712
+ export type SessionErrorSource = "provider" | "us";
713
+
666
714
  export interface Session {
667
715
  sessionId: string;
668
716
  company: string;
@@ -677,6 +725,14 @@ export interface Session {
677
725
  startedAt: number;
678
726
  lastUpdatedAt: number;
679
727
  error?: string;
728
+ /** Where the error originated. Absent on legacy sessions; treat as `"us"`. */
729
+ errorSource?: SessionErrorSource;
730
+ /** Provider error type (e.g. `unknown_error`, `model_overloaded_error`). */
731
+ errorType?: string;
732
+ /** Stop reason from the final `session.status_idle` event (e.g. `retries_exhausted`). */
733
+ stopReason?: string;
734
+ /** Number of provider `session.error` events observed before terminal. */
735
+ retryCount?: number;
680
736
  activeSources?: string[];
681
737
  cancelRequested?: boolean;
682
738
  }