@buildinternet/releases-api-types 0.8.0 → 0.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buildinternet/releases-api-types",
3
- "version": "0.8.0",
3
+ "version": "0.9.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",
@@ -17,7 +17,7 @@
17
17
  "README.md"
18
18
  ],
19
19
  "dependencies": {
20
- "@buildinternet/releases-core": "workspace:*",
20
+ "@buildinternet/releases-core": "^0.18.0",
21
21
  "zod": "^4.3.6"
22
22
  },
23
23
  "publishConfig": {
package/src/api-types.ts CHANGED
@@ -620,6 +620,13 @@ export interface OrgReleasesResponse {
620
620
  pagination: { nextCursor: string | null; limit: number };
621
621
  }
622
622
 
623
+ // Source-scoped release feed — the source identity is encoded in the URL, so
624
+ // items omit the redundant `source` block carried by the org feed.
625
+ export interface SourceReleasesResponse {
626
+ releases: ReleaseItem[];
627
+ pagination: { nextCursor: string | null; limit: number };
628
+ }
629
+
623
630
  // ── Products ──
624
631
 
625
632
  // `Category` lives in @buildinternet/releases-core/categories — import it from
@@ -667,6 +674,76 @@ export interface TagDetail {
667
674
  products: TaxonomyProduct[];
668
675
  }
669
676
 
677
+ // ── Collections ──
678
+ //
679
+ // Curated, named groups of orgs that drive a public "playlist" page (e.g.
680
+ // /collections/frontier-ai-labs). Independent of the fixed `category` taxonomy.
681
+
682
+ export interface CollectionMemberOrg {
683
+ slug: string;
684
+ name: string;
685
+ domain: string | null;
686
+ avatarUrl: string | null;
687
+ description: string | null;
688
+ }
689
+
690
+ /** Item shape on GET /v1/collections (list). */
691
+ export interface CollectionListItem {
692
+ slug: string;
693
+ name: string;
694
+ description: string | null;
695
+ memberCount: number;
696
+ }
697
+
698
+ /** Detail shape on GET /v1/collections/:slug. */
699
+ export interface CollectionDetail {
700
+ slug: string;
701
+ name: string;
702
+ description: string | null;
703
+ orgs: CollectionMemberOrg[];
704
+ }
705
+
706
+ /** Body for POST /v1/collections. `slug` derives from `name` via toSlug() if omitted. */
707
+ export interface CreateCollectionRequest {
708
+ slug?: string;
709
+ name: string;
710
+ description?: string | null;
711
+ }
712
+
713
+ /** Body for PATCH /v1/collections/:slug. All fields optional; slug rename is allowed. */
714
+ export interface UpdateCollectionRequest {
715
+ slug?: string;
716
+ name?: string;
717
+ description?: string | null;
718
+ }
719
+
720
+ /** A single member entry accepted by the member-write endpoints. */
721
+ export interface CollectionMemberInput {
722
+ /** Either `orgId` (org_…) or `orgSlug` is required; if both are given, `orgId` wins. */
723
+ orgId?: string;
724
+ orgSlug?: string;
725
+ /** Authoring position (default 0). For PUT, omit to use array index. */
726
+ position?: number;
727
+ }
728
+
729
+ /** Body for POST /v1/collections/:slug/members. */
730
+ export type AddCollectionMemberRequest = CollectionMemberInput;
731
+
732
+ /** Body for PUT /v1/collections/:slug/members. Replaces the full membership atomically. */
733
+ export interface ReplaceCollectionMembersRequest {
734
+ orgs: CollectionMemberInput[];
735
+ }
736
+
737
+ /** Bare row returned by POST/PATCH on /v1/collections. */
738
+ export interface CollectionRow {
739
+ id: string;
740
+ slug: string;
741
+ name: string;
742
+ description: string | null;
743
+ createdAt: string;
744
+ updatedAt: string;
745
+ }
746
+
670
747
  // ── Releases (enriched) ──
671
748
 
672
749
  /** Flat release shape returned by GET /v1/releases/:id with source metadata. */
@@ -780,8 +857,28 @@ export interface Session {
780
857
  sessionId: string;
781
858
  company: string;
782
859
  type: "onboard" | "update";
860
+ /**
861
+ * Sub-agent **role** label that ran this session — `"coordinator"` is the
862
+ * parent orchestrator (typically Sonnet) when a multi-agent session
863
+ * delegates, `"sonnet"` / `"haiku"` are direct single-agent runs.
864
+ * Surfaces on the detail GET.
865
+ *
866
+ * This is a logical role label, not the runtime model identifier. The
867
+ * resolved Anthropic model string (e.g. `claude-sonnet-4-6`,
868
+ * `claude-haiku-4-5`) lives on `usage.model` when the session reported
869
+ * one — consult that field for the concrete model.
870
+ */
871
+ agent?: "sonnet" | "haiku" | "coordinator";
872
+ /** Identifies the client that started this session (e.g. hostname). */
873
+ runner?: string;
874
+ /** Correlation ID for end-to-end tracing across CLI → API → managed agent. */
875
+ correlationId?: string;
876
+ /** Anthropic session ID for linking to console logs. */
877
+ anthropicSessionId?: string;
783
878
  status: "running" | "complete" | "error" | "cancelled";
784
879
  step?: string;
880
+ sourcesFound?: number;
881
+ sourcesValidated?: number;
785
882
  totalSources?: number;
786
883
  sourcesFetched?: number;
787
884
  releasesFound?: number;
@@ -798,6 +895,40 @@ export interface Session {
798
895
  stopReason?: string;
799
896
  /** Number of provider `session.error` events observed before terminal. */
800
897
  retryCount?: number;
898
+ /** Non-fatal warnings collected during the session. */
899
+ warnings?: string[];
900
+ /**
901
+ * Token usage + estimated cost from the managed-agents session. `estimatedUsd`
902
+ * is a snapshot of Anthropic list prices at session-completion time.
903
+ */
904
+ usage?: {
905
+ inputTokens?: number;
906
+ outputTokens?: number;
907
+ cacheWriteTokens?: number;
908
+ cacheReadTokens?: number;
909
+ model?: string;
910
+ estimatedUsd?: number;
911
+ };
912
+ /**
913
+ * Final agent-reported state for terminal `onboard` sessions — the JSON
914
+ * blob the agent passed to its `releases_report_state` tool, plus an
915
+ * `agentSessionId` field stitched in server-side. Empty on `update`
916
+ * sessions and pre-report errors. Typed as `Record<string, unknown>`
917
+ * because the shape is owned by the discovery system prompt and may
918
+ * grow new fields without a wire bump; the keys produced today are:
919
+ *
920
+ * - `product` (`string`) — company name
921
+ * - `domain` (`string | null`) — discovered domain
922
+ * - `githubOrg` (`string | null`) — discovered GitHub org
923
+ * - `startedAt`, `updatedAt` (ISO strings)
924
+ * - `status` (e.g. `"awaiting_review"`)
925
+ * - `sources` (`Array<{ url, type, slug, label, confidence,
926
+ * validated, validationError?, releaseCount, releasesFetched,
927
+ * fetched, contentDepth }>`)
928
+ * - `agentSessionId` (`string`) — Anthropic session ID, useful for
929
+ * cross-referencing console logs
930
+ */
931
+ result?: Record<string, unknown>;
801
932
  activeSources?: string[];
802
933
  cancelRequested?: boolean;
803
934
  }
@@ -88,18 +88,31 @@ export const UpdateProductBodySchema = z.object({
88
88
  aliases: z.array(z.string()).optional(),
89
89
  });
90
90
 
91
- /** Body accepted by `POST /v1/products/adopt`. */
91
+ /**
92
+ * Body accepted by `POST /v1/products/adopt`.
93
+ *
94
+ * `mergeInto` (slug or `prod_…` ID) folds the source org into an existing
95
+ * product under `targetOrgSlug` instead of creating a new one. When set,
96
+ * `slug` and `url` must be omitted (the existing product's values stand).
97
+ */
92
98
  export const AdoptProductBodySchema = z.object({
93
99
  sourceOrgSlug: z.string().min(1),
94
100
  targetOrgSlug: z.string().min(1),
95
101
  slug: z.string().optional(),
96
102
  url: z.string().optional(),
103
+ mergeInto: z.string().optional(),
97
104
  dryRun: z.boolean().optional(),
98
105
  });
99
106
 
100
- /** Live (non-dryRun) result from `POST /v1/products/adopt`. */
107
+ /**
108
+ * Live (non-dryRun) result from `POST /v1/products/adopt`.
109
+ *
110
+ * `mergedInto` is set when the request used `mergeInto` — its value is the
111
+ * existing product's slug, signalling that no new product was created.
112
+ */
101
113
  export const ProductAdoptResultSchema = z.object({
102
114
  product: ProductRowSchema,
115
+ mergedInto: z.string().optional(),
103
116
  sourcesMoved: z.number().int().min(0),
104
117
  accountsMoved: z.number().int().min(0),
105
118
  sourceOrgDeleted: z.string(),
@@ -108,6 +121,7 @@ export const ProductAdoptResultSchema = z.object({
108
121
  /** Dry-run preview from `POST /v1/products/adopt` with `dryRun: true`. */
109
122
  export const ProductAdoptDryRunSchema = z.object({
110
123
  dryRun: z.literal(true),
124
+ mergeInto: z.string().optional(),
111
125
  product: z.object({
112
126
  name: z.string(),
113
127
  slug: z.string(),