@vercel/factory 0.0.18 → 0.0.19

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/factory
2
2
 
3
+ ## 0.0.19
4
+
5
+ ### Patch Changes
6
+
7
+ - 2f5561a: Expose confirmed GitHub source-publication metadata through readGitHubIssuePublication and migrate PR label readers in the reference factory and CLI scaffold.
8
+
3
9
  ## 0.0.18
4
10
 
5
11
  ### Patch Changes
@@ -37,17 +37,28 @@ declare function createGitHubIssuePublisher(options: GitHubIssuePublisherOptions
37
37
  /** Recovers an existing publication by source key, or returns null without reserving or posting. */
38
38
  reconcile(key: string): Promise<PublishGitHubIssueResult | null>;
39
39
  };
40
- /** Reads labels only from a confirmed Factory publication matching the source issue. */
41
- declare function readGitHubIssuePublicationLabels(options: {
40
+ /** Confirmed source-key publication and host-owned metadata for a GitHub issue. */
41
+ interface GitHubIssuePublication {
42
+ repository: RepositorySlug;
43
+ key: string;
44
+ createdAt: string;
45
+ labels: readonly {
46
+ name: string;
47
+ color: string;
48
+ description: string;
49
+ }[];
50
+ issue: {
51
+ number: number;
52
+ html_url: string;
53
+ };
54
+ }
55
+ /** Reads a confirmed Factory publication matching the repository, source marker, and issue. */
56
+ declare function readGitHubIssuePublication(options: {
42
57
  state: Pick<ConditionalStateStore, "read">;
43
58
  repository: RepositorySlug;
44
59
  number: number;
45
60
  body: string;
46
- }): Promise<readonly {
47
- name: string;
48
- color: string;
49
- description: string;
50
- }[]>;
61
+ }): Promise<GitHubIssuePublication | null>;
51
62
  //#endregion
52
- export { GitHubIssuePublisherOptions, PublishGitHubIssueOptions, PublishGitHubIssueResult, createGitHubIssuePublisher, readGitHubIssuePublicationLabels };
63
+ export { GitHubIssuePublication, GitHubIssuePublisherOptions, PublishGitHubIssueOptions, PublishGitHubIssueResult, createGitHubIssuePublisher, readGitHubIssuePublication };
53
64
  //# sourceMappingURL=github-issues.d.mts.map
@@ -155,16 +155,21 @@ function createGitHubIssuePublisher(options) {
155
155
  }
156
156
  };
157
157
  }
158
- /** Reads labels only from a confirmed Factory publication matching the source issue. */
159
- async function readGitHubIssuePublicationLabels(options) {
158
+ /** Reads a confirmed Factory publication matching the repository, source marker, and issue. */
159
+ async function readGitHubIssuePublication(options) {
160
160
  const digest = /<!-- factory-issue:([a-f0-9]{64}) -->/u.exec(options.body)?.[1];
161
- if (!digest) return [];
161
+ if (!digest) return null;
162
162
  const stored = await options.state.read({ pathname: pathnameFor(digest) });
163
- if (!stored) return [];
163
+ if (!stored) return null;
164
164
  const publication = publicationSchema.parse(JSON.parse(stored.body));
165
- return publication.repository === options.repository && publication.issue?.number === options.number ? publication.labels : [];
165
+ const { issue } = publication;
166
+ const expectedDigest = createHash("sha256").update(JSON.stringify([publication.repository, publication.key])).digest("hex");
167
+ return publication.repository === options.repository && issue?.number === options.number && digest === expectedDigest ? {
168
+ ...publication,
169
+ issue
170
+ } : null;
166
171
  }
167
172
  //#endregion
168
- export { createGitHubIssuePublisher, readGitHubIssuePublicationLabels };
173
+ export { createGitHubIssuePublisher, readGitHubIssuePublication };
169
174
 
170
175
  //# sourceMappingURL=github-issues.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"github-issues.mjs","names":[],"sources":["../../src/integrations/github-issues.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { z } from \"zod\";\nimport { repositorySlugSchema, type RepositorySlug } from \"../schema/repository\";\nimport type { ConditionalStateStore } from \"../store/state\";\nimport { ensureGitHubLabel } from \"../github\";\n\nconst issueSchema = z.object({ number: z.number().int().positive(), html_url: z.url() });\nconst labelSchema = z.object({\n name: z.string().min(1).max(50),\n color: z.string().regex(/^[\\da-f]{6}$/iu),\n description: z.string().max(100),\n});\nconst publicationSchema = z.strictObject({\n repository: repositorySlugSchema,\n key: z.string(),\n createdAt: z.iso.datetime(),\n labels: z.array(labelSchema),\n issue: issueSchema.optional(),\n});\ntype State = Pick<ConditionalStateStore, \"read\" | \"write\">;\nconst pathnameFor = (digest: string) => `github-issue-publications/${digest}.json`;\n\n/** Host-owned credentials, repository scope, labels, and durable state for issue publication. */\nexport interface GitHubIssuePublisherOptions {\n repository: RepositorySlug;\n state: State;\n labels: readonly { name: string; color: string; description: string }[];\n authorize(): Promise<void>;\n token(): Promise<string>;\n fetch?: typeof globalThis.fetch;\n}\n\n/** A stable source identity and the sanitized issue the caller wants to publish. */\nexport interface PublishGitHubIssueOptions {\n key: string;\n title: string;\n body: string;\n}\n\n/** A confirmed GitHub issue, or an ambiguous write that requires reconciliation. */\nexport type PublishGitHubIssueResult =\n | { status: \"published\"; number: number; url: string }\n | { status: \"pending\"; reason: string };\n\n/** Creates an authorized publisher and a recovery operation that never creates issues or reservations. */\nexport function createGitHubIssuePublisher(options: GitHubIssuePublisherOptions) {\n repositorySlugSchema.parse(options.repository);\n const labels = z.array(labelSchema).max(10).parse(options.labels);\n async function resolve(\n key: string,\n input?: PublishGitHubIssueOptions,\n ): Promise<PublishGitHubIssueResult | null> {\n z.string().min(1).max(500).parse(key);\n await options.authorize();\n const digest = createHash(\"sha256\")\n .update(JSON.stringify([options.repository, key]))\n .digest(\"hex\");\n const pathname = pathnameFor(digest);\n const marker = `<!-- factory-issue:${digest} -->`;\n const api = `https://api.github.com/repos/${options.repository}`;\n const request: typeof globalThis.fetch = async (url, init) => {\n await options.authorize();\n return (options.fetch ?? globalThis.fetch)(url, {\n ...init,\n redirect: \"error\",\n signal: AbortSignal.timeout(30000),\n headers: {\n Authorization: `Bearer ${await options.token()}`,\n Accept: \"application/vnd.github+json\",\n \"Content-Type\": \"application/json\",\n \"X-GitHub-Api-Version\": \"2022-11-28\",\n },\n });\n };\n const read = () => options.state.read({ pathname });\n let stored = await read();\n let claimed = false;\n if (!stored) {\n if (!input) return null;\n // Label setup has no non-idempotent issue side effect and can be retried before claiming.\n for (const label of labels)\n await ensureGitHubLabel({\n repository: options.repository,\n token: \"\",\n fetch: request,\n ...label,\n });\n try {\n await options.state.write({\n pathname,\n overwrite: false,\n body: JSON.stringify({\n repository: options.repository,\n key,\n createdAt: new Date().toISOString(),\n labels,\n }),\n });\n claimed = true;\n } catch (error) {\n if (!(await read())) throw error;\n }\n stored = await read();\n }\n if (!stored) throw new Error(\"Issue publication reservation is missing\");\n const publication = publicationSchema.parse(JSON.parse(stored.body));\n if (publication.repository !== options.repository || publication.key !== key)\n throw new Error(\"Issue publication identity mismatch\");\n const result = (issue: z.infer<typeof issueSchema>): PublishGitHubIssueResult => ({\n status: \"published\",\n number: issue.number,\n url: issue.html_url,\n });\n if (publication.issue) return result(publication.issue);\n const save = async (issue: z.infer<typeof issueSchema>) => {\n try {\n await options.state.write({\n pathname,\n overwrite: true,\n ifMatch: stored.etag,\n body: JSON.stringify({ ...publication, issue }),\n });\n } catch (error) {\n const winner = await read();\n if (\n !winner ||\n publicationSchema.parse(JSON.parse(winner.body)).issue?.number !== issue.number\n )\n throw error;\n }\n return result(issue);\n };\n if (claimed && input) {\n // GitHub has no issue-creation idempotency key. Any failure after this claim is ambiguous.\n const response = await request(`${api}/issues`, {\n method: \"POST\",\n body: JSON.stringify({\n title: input.title,\n body: `${input.body}\\n\\n${marker}`,\n labels: publication.labels.map(({ name }) => name),\n }),\n });\n if (!response.ok)\n throw new Error(\n `GitHub issue creation returned ${response.status}; retry this source key to reconcile`,\n );\n return save(issueSchema.parse(await response.json()));\n }\n const since = new Date(Date.parse(publication.createdAt) - 60000).toISOString();\n for (let page = 1; page <= 10; page++) {\n const query = new URLSearchParams({\n state: \"all\",\n since,\n sort: \"created\",\n direction: \"asc\",\n per_page: \"100\",\n page: String(page),\n });\n const response = await request(`${api}/issues?${query}`);\n if (!response.ok) throw new Error(`GitHub issue reconciliation returned ${response.status}`);\n const issues = z\n .array(\n issueSchema.extend({ body: z.string().nullable(), pull_request: z.unknown().optional() }),\n )\n .parse(await response.json());\n const matches = issues.filter((issue) => !issue.pull_request && issue.body?.includes(marker));\n if (matches.length > 1)\n throw new Error(\"Multiple GitHub issues have the publication marker; inspect manually\");\n if (matches[0]) return save(matches[0]);\n if (issues.length < 100) break;\n }\n return {\n status: \"pending\",\n reason:\n \"An earlier publication may still be in flight. No second issue was created. Inspect GitHub and the publication record before resetting this source key.\",\n };\n }\n return {\n /** Publishes once per source key, reconciling any existing reservation without another POST. */\n async publish(input: PublishGitHubIssueOptions): Promise<PublishGitHubIssueResult> {\n z.object({\n key: z.string().min(1).max(500),\n title: z.string().min(1).max(256),\n body: z.string().min(1).max(50000),\n }).parse(input);\n if (input.body.includes(\"<!-- factory-issue:\"))\n throw new Error(\"Issue body contains a reserved publication marker\");\n const result = await resolve(input.key, input);\n if (!result) throw new Error(\"Issue publication reservation is missing\");\n return result;\n },\n /** Recovers an existing publication by source key, or returns null without reserving or posting. */\n reconcile(key: string): Promise<PublishGitHubIssueResult | null> {\n return resolve(key);\n },\n };\n}\n\n/** Reads labels only from a confirmed Factory publication matching the source issue. */\nexport async function readGitHubIssuePublicationLabels(options: {\n state: Pick<ConditionalStateStore, \"read\">;\n repository: RepositorySlug;\n number: number;\n body: string;\n}): Promise<readonly { name: string; color: string; description: string }[]> {\n const digest = /<!-- factory-issue:([a-f0-9]{64}) -->/u.exec(options.body)?.[1];\n if (!digest) return [];\n const stored = await options.state.read({ pathname: pathnameFor(digest) });\n if (!stored) return [];\n const publication = publicationSchema.parse(JSON.parse(stored.body));\n return publication.repository === options.repository &&\n publication.issue?.number === options.number\n ? publication.labels\n : [];\n}\n"],"mappings":";;;;;AAMA,MAAM,cAAc,EAAE,OAAO;CAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS;CAAG,UAAU,EAAE,IAAI;AAAE,CAAC;AACvF,MAAM,cAAc,EAAE,OAAO;CAC3B,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE;CAC9B,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,gBAAgB;CACxC,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,GAAG;IAChC,MAAM,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,GAAK;GACnC,CAAC,CAAC,CAAC,MAAM,KAAK;GACd,IAAI,MAAM,KAAK,SAAS,qBAAqB,GAC3C,MAAM,IAAI,MAAM,mDAAmD;GACrE,MAAM,SAAS,MAAM,QAAQ,MAAM,KAAK,KAAK;GAC7C,IAAI,CAAC,QAAQ,MAAM,IAAI,MAAM,0CAA0C;GACvE,OAAO;EACT;;EAEA,UAAU,KAAuD;GAC/D,OAAO,QAAQ,GAAG;EACpB;CACF;AACF;;AAGA,eAAsB,iCAAiC,SAKsB;CAC3E,MAAM,SAAS,yCAAyC,KAAK,QAAQ,IAAI,CAAC,GAAG;CAC7E,IAAI,CAAC,QAAQ,OAAO,CAAC;CACrB,MAAM,SAAS,MAAM,QAAQ,MAAM,KAAK,EAAE,UAAU,YAAY,MAAM,EAAE,CAAC;CACzE,IAAI,CAAC,QAAQ,OAAO,CAAC;CACrB,MAAM,cAAc,kBAAkB,MAAM,KAAK,MAAM,OAAO,IAAI,CAAC;CACnE,OAAO,YAAY,eAAe,QAAQ,cACxC,YAAY,OAAO,WAAW,QAAQ,SACpC,YAAY,SACZ,CAAC;AACP"}
1
+ {"version":3,"file":"github-issues.mjs","names":[],"sources":["../../src/integrations/github-issues.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport { z } from \"zod\";\nimport { repositorySlugSchema, type RepositorySlug } from \"../schema/repository\";\nimport type { ConditionalStateStore } from \"../store/state\";\nimport { ensureGitHubLabel } from \"../github\";\n\nconst issueSchema = z.object({ number: z.number().int().positive(), html_url: z.url() });\nconst labelSchema = z.object({\n name: z.string().min(1).max(50),\n color: z.string().regex(/^[\\da-f]{6}$/iu),\n description: z.string().max(100),\n});\nconst publicationSchema = z.strictObject({\n repository: repositorySlugSchema,\n key: z.string(),\n createdAt: z.iso.datetime(),\n labels: z.array(labelSchema),\n issue: issueSchema.optional(),\n});\ntype State = Pick<ConditionalStateStore, \"read\" | \"write\">;\nconst pathnameFor = (digest: string) => `github-issue-publications/${digest}.json`;\n\n/** Host-owned credentials, repository scope, labels, and durable state for issue publication. */\nexport interface GitHubIssuePublisherOptions {\n repository: RepositorySlug;\n state: State;\n labels: readonly { name: string; color: string; description: string }[];\n authorize(): Promise<void>;\n token(): Promise<string>;\n fetch?: typeof globalThis.fetch;\n}\n\n/** A stable source identity and the sanitized issue the caller wants to publish. */\nexport interface PublishGitHubIssueOptions {\n key: string;\n title: string;\n body: string;\n}\n\n/** A confirmed GitHub issue, or an ambiguous write that requires reconciliation. */\nexport type PublishGitHubIssueResult =\n | { status: \"published\"; number: number; url: string }\n | { status: \"pending\"; reason: string };\n\n/** Creates an authorized publisher and a recovery operation that never creates issues or reservations. */\nexport function createGitHubIssuePublisher(options: GitHubIssuePublisherOptions) {\n repositorySlugSchema.parse(options.repository);\n const labels = z.array(labelSchema).max(10).parse(options.labels);\n async function resolve(\n key: string,\n input?: PublishGitHubIssueOptions,\n ): Promise<PublishGitHubIssueResult | null> {\n z.string().min(1).max(500).parse(key);\n await options.authorize();\n const digest = createHash(\"sha256\")\n .update(JSON.stringify([options.repository, key]))\n .digest(\"hex\");\n const pathname = pathnameFor(digest);\n const marker = `<!-- factory-issue:${digest} -->`;\n const api = `https://api.github.com/repos/${options.repository}`;\n const request: typeof globalThis.fetch = async (url, init) => {\n await options.authorize();\n return (options.fetch ?? globalThis.fetch)(url, {\n ...init,\n redirect: \"error\",\n signal: AbortSignal.timeout(30000),\n headers: {\n Authorization: `Bearer ${await options.token()}`,\n Accept: \"application/vnd.github+json\",\n \"Content-Type\": \"application/json\",\n \"X-GitHub-Api-Version\": \"2022-11-28\",\n },\n });\n };\n const read = () => options.state.read({ pathname });\n let stored = await read();\n let claimed = false;\n if (!stored) {\n if (!input) return null;\n // Label setup has no non-idempotent issue side effect and can be retried before claiming.\n for (const label of labels)\n await ensureGitHubLabel({\n repository: options.repository,\n token: \"\",\n fetch: request,\n ...label,\n });\n try {\n await options.state.write({\n pathname,\n overwrite: false,\n body: JSON.stringify({\n repository: options.repository,\n key,\n createdAt: new Date().toISOString(),\n labels,\n }),\n });\n claimed = true;\n } catch (error) {\n if (!(await read())) throw error;\n }\n stored = await read();\n }\n if (!stored) throw new Error(\"Issue publication reservation is missing\");\n const publication = publicationSchema.parse(JSON.parse(stored.body));\n if (publication.repository !== options.repository || publication.key !== key)\n throw new Error(\"Issue publication identity mismatch\");\n const result = (issue: z.infer<typeof issueSchema>): PublishGitHubIssueResult => ({\n status: \"published\",\n number: issue.number,\n url: issue.html_url,\n });\n if (publication.issue) return result(publication.issue);\n const save = async (issue: z.infer<typeof issueSchema>) => {\n try {\n await options.state.write({\n pathname,\n overwrite: true,\n ifMatch: stored.etag,\n body: JSON.stringify({ ...publication, issue }),\n });\n } catch (error) {\n const winner = await read();\n if (\n !winner ||\n publicationSchema.parse(JSON.parse(winner.body)).issue?.number !== issue.number\n )\n throw error;\n }\n return result(issue);\n };\n if (claimed && input) {\n // GitHub has no issue-creation idempotency key. Any failure after this claim is ambiguous.\n const response = await request(`${api}/issues`, {\n method: \"POST\",\n body: JSON.stringify({\n title: input.title,\n body: `${input.body}\\n\\n${marker}`,\n labels: publication.labels.map(({ name }) => name),\n }),\n });\n if (!response.ok)\n throw new Error(\n `GitHub issue creation returned ${response.status}; retry this source key to reconcile`,\n );\n return save(issueSchema.parse(await response.json()));\n }\n const since = new Date(Date.parse(publication.createdAt) - 60000).toISOString();\n for (let page = 1; page <= 10; page++) {\n const query = new URLSearchParams({\n state: \"all\",\n since,\n sort: \"created\",\n direction: \"asc\",\n per_page: \"100\",\n page: String(page),\n });\n const response = await request(`${api}/issues?${query}`);\n if (!response.ok) throw new Error(`GitHub issue reconciliation returned ${response.status}`);\n const issues = z\n .array(\n issueSchema.extend({ body: z.string().nullable(), pull_request: z.unknown().optional() }),\n )\n .parse(await response.json());\n const matches = issues.filter((issue) => !issue.pull_request && issue.body?.includes(marker));\n if (matches.length > 1)\n throw new Error(\"Multiple GitHub issues have the publication marker; inspect manually\");\n if (matches[0]) return save(matches[0]);\n if (issues.length < 100) break;\n }\n return {\n status: \"pending\",\n reason:\n \"An earlier publication may still be in flight. No second issue was created. Inspect GitHub and the publication record before resetting this source key.\",\n };\n }\n return {\n /** Publishes once per source key, reconciling any existing reservation without another POST. */\n async publish(input: PublishGitHubIssueOptions): Promise<PublishGitHubIssueResult> {\n z.object({\n key: z.string().min(1).max(500),\n title: z.string().min(1).max(256),\n body: z.string().min(1).max(50000),\n }).parse(input);\n if (input.body.includes(\"<!-- factory-issue:\"))\n throw new Error(\"Issue body contains a reserved publication marker\");\n const result = await resolve(input.key, input);\n if (!result) throw new Error(\"Issue publication reservation is missing\");\n return result;\n },\n /** Recovers an existing publication by source key, or returns null without reserving or posting. */\n reconcile(key: string): Promise<PublishGitHubIssueResult | null> {\n return resolve(key);\n },\n };\n}\n\n/** Confirmed source-key publication and host-owned metadata for a GitHub issue. */\nexport interface GitHubIssuePublication {\n repository: RepositorySlug;\n key: string;\n createdAt: string;\n labels: readonly { name: string; color: string; description: string }[];\n issue: { number: number; html_url: string };\n}\n\n/** Reads a confirmed Factory publication matching the repository, source marker, and issue. */\nexport async function readGitHubIssuePublication(options: {\n state: Pick<ConditionalStateStore, \"read\">;\n repository: RepositorySlug;\n number: number;\n body: string;\n}): Promise<GitHubIssuePublication | null> {\n const digest = /<!-- factory-issue:([a-f0-9]{64}) -->/u.exec(options.body)?.[1];\n if (!digest) return null;\n const stored = await options.state.read({ pathname: pathnameFor(digest) });\n if (!stored) return null;\n const publication = publicationSchema.parse(JSON.parse(stored.body));\n const { issue } = publication;\n const expectedDigest = createHash(\"sha256\")\n .update(JSON.stringify([publication.repository, publication.key]))\n .digest(\"hex\");\n return publication.repository === options.repository &&\n issue?.number === options.number &&\n digest === expectedDigest\n ? { ...publication, issue }\n : null;\n}\n"],"mappings":";;;;;AAMA,MAAM,cAAc,EAAE,OAAO;CAAE,QAAQ,EAAE,OAAO,CAA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itHubPullRequestPublicationGate, GitHubPullRequestPublicationGateOptions, GitHubPullRequestPublisher, GitHubPullRequestPublisherOptions, PublishGitHubPullRequestInput, PushGitHubCheckpointInput, RequireTaskPullRequestInput, createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher } from "../pull-requests/github-publisher.mjs";
9
9
  import { GitHubPullRequestLabelManager, GitHubPullRequestLabelManagerOptions, ManageGitHubPullRequestLabelInput, createGitHubPullRequestLabelManager } from "../pull-requests/github-label-manager.mjs";
10
10
  import { GitHubOpenPullRequestLister, GitHubOpenPullRequestListerOptions, createGitHubOpenPullRequestLister } from "../work-triage/github.mjs";
11
- import { GitHubIssuePublisherOptions, PublishGitHubIssueOptions, PublishGitHubIssueResult, createGitHubIssuePublisher, readGitHubIssuePublicationLabels } from "./github-issues.mjs";
12
- export { type AnswerReviewCommentInput, type CheckRunAnnotation, type CheckRunAnnotationLevel, type CheckRunConclusion, type CheckRunFields, type CheckRunOutput, type CheckRunProgressStatus, type CheckoutGitHubRepositoryInput, type CommittedGitChange, type CompletedCheckRunFields, type ConfiguredEventRepositoryInput, type ConflictedGitHubPullRequest, type CreateCheckRunInput, type CreateGitHubBranchInput, type CreateGitHubCommitInput, type CreateGitHubPublicationPullRequestInput, type CreateGitHubTreeInput, type CreatePullRequestCommentInput, type CreatePullRequestInput, type CreatedGitHubPublicationPullRequest, type CreatedGitHubPullRequest, type EnsureGitHubLabelInput, type FactoryMentionOptions, type FactoryQuestionReply, type FactoryReviewComment, type FetchGitHubBundleInput, type FetchGitHubRefsInput, type GitHubAppFactoryInput, type GitHubAppInstallationToken, type GitHubAppLike, type GitHubAppPermissions, type GitHubCheckRun, GitHubCheckoutConflictError, type GitHubCiFailureSignal, type GitHubCommit, type GitHubCommunicationAdapterOptions, type GitHubDefaultBranchPush, type GitHubGitTransport, type GitHubIssueComment, type GitHubIssueCommentRecord, type GitHubIssuePublisherOptions, type GitHubIssueSignal, type GitHubOpenPullRequestLister, type GitHubOpenPullRequestListerOptions, GitHubPublicationApiError, type GitHubPublicationClient, type GitHubPublicationClientOptions, type GitHubPublicationLimits, type GitHubPublicationPullRequest, type GitHubPullRequest, type GitHubPullRequestClosed, type GitHubPullRequestDiscussionComment, type GitHubPullRequestDiscussionPage, type GitHubPullRequestDiscussionReview, type GitHubPullRequestHead, type GitHubPullRequestLabelManager, type GitHubPullRequestLabelManagerOptions, type GitHubPullRequestPublicationGate, type GitHubPullRequestPublicationGateOptions, type GitHubPullRequestPublisher, type GitHubPullRequestPublisherOptions, type GitHubPullRequestReference, type GitHubPullRequestSignal, type GitHubPullRequestTarget, type GitHubRefMapping, type GitHubReplyTarget, type GitHubRepositoryAuthorRequest, type GitHubRepositoryBundle, type GitHubRepositoryRequest, type GitHubReviewComment, GitHubReviewCommentAuthorError, type GitHubReviewReporter, type GitHubReviewReporterOptions, type GitHubTreeDeletion, type GitHubTreeEntry, type GitHubTreeUpsert, type GitTransferSandbox, type IncompleteCheckRunFields, type ListCheckRunsForRefInput, type ListConflictedPullRequestsInput, type ListGitHubPublicationPullRequestsInput, type ListOpenPullRequestsInput, type ListPullRequestCommentsInput, type ListPullRequestDiscussionInput, type ManageGitHubPullRequestLabelInput, type MarkGitHubPullRequestReadyInput, type MintGitHubAppInstallationTokenInput, type NormalizeFactoryCommentInput, type NormalizeFactoryReviewCommentInput, type ObservedCheckRunStatus, type PublishGitHubIssueOptions, type PublishGitHubIssueResult, type PublishGitHubPullRequestInput, type PublishedGitHubReview, type PullRequestLabelInput, type PullRequestReviewComment, type PullRequestReviewEvent, type PushGitHubBundleInput, type PushGitHubCheckpointInput, type PushGitHubHeadInput, type ReadCommittedGitChangeInput, type ReadGitHubBranchHeadInput, type ReadGitHubCommitInput, type ReadGitHubPullRequestInput, type ReadGitTransferFileInput, type ReadReviewCommentInput, type ReconcileReviewChecksInput, type ReconcileReviewChecksOptions, type ReconcileReviewChecksResult, type RequireTaskPullRequestInput, type ReviewCommentAuthorPolicy, type RunSandboxGitInput, type SandboxGit, type SandboxGitCommandInput, type SandboxGitCommandResult, StalePullRequestHeadError, type SubmitPullRequestReviewInput, type SubmittedPullRequestReview, type UpdateCheckRunInput, type UpdateGitHubBranchInput, type UpdatePullRequestCommentInput, type VerifyGitHubSignatureInput, type WithSandboxGitBundleInput, type WriteGitTransferFileInput, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubCommunicationAdapter, createGitHubIssuePublisher, createGitHubOpenPullRequestLister, createGitHubPublicationClient, createGitHubPullRequestLabelManager, createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher, createGitHubReviewReporter, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, parseGitHubReplyAddress, readCommittedGitChange, readGitHubIssuePublicationLabels, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, renderGitHubCommunicationEvent, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
11
+ import { GitHubIssuePublication, GitHubIssuePublisherOptions, PublishGitHubIssueOptions, PublishGitHubIssueResult, createGitHubIssuePublisher, readGitHubIssuePublication } from "./github-issues.mjs";
12
+ export { type AnswerReviewCommentInput, type CheckRunAnnotation, type CheckRunAnnotationLevel, type CheckRunConclusion, type CheckRunFields, type CheckRunOutput, type CheckRunProgressStatus, type CheckoutGitHubRepositoryInput, type CommittedGitChange, type CompletedCheckRunFields, type ConfiguredEventRepositoryInput, type ConflictedGitHubPullRequest, type CreateCheckRunInput, type CreateGitHubBranchInput, type CreateGitHubCommitInput, type CreateGitHubPublicationPullRequestInput, type CreateGitHubTreeInput, type CreatePullRequestCommentInput, type CreatePullRequestInput, type CreatedGitHubPublicationPullRequest, type CreatedGitHubPullRequest, type EnsureGitHubLabelInput, type FactoryMentionOptions, type FactoryQuestionReply, type FactoryReviewComment, type FetchGitHubBundleInput, type FetchGitHubRefsInput, type GitHubAppFactoryInput, type GitHubAppInstallationToken, type GitHubAppLike, type GitHubAppPermissions, type GitHubCheckRun, GitHubCheckoutConflictError, type GitHubCiFailureSignal, type GitHubCommit, type GitHubCommunicationAdapterOptions, type GitHubDefaultBranchPush, type GitHubGitTransport, type GitHubIssueComment, type GitHubIssueCommentRecord, type GitHubIssuePublication, type GitHubIssuePublisherOptions, type GitHubIssueSignal, type GitHubOpenPullRequestLister, type GitHubOpenPullRequestListerOptions, GitHubPublicationApiError, type GitHubPublicationClient, type GitHubPublicationClientOptions, type GitHubPublicationLimits, type GitHubPublicationPullRequest, type GitHubPullRequest, type GitHubPullRequestClosed, type GitHubPullRequestDiscussionComment, type GitHubPullRequestDiscussionPage, type GitHubPullRequestDiscussionReview, type GitHubPullRequestHead, type GitHubPullRequestLabelManager, type GitHubPullRequestLabelManagerOptions, type GitHubPullRequestPublicationGate, type GitHubPullRequestPublicationGateOptions, type GitHubPullRequestPublisher, type GitHubPullRequestPublisherOptions, type GitHubPullRequestReference, type GitHubPullRequestSignal, type GitHubPullRequestTarget, type GitHubRefMapping, type GitHubReplyTarget, type GitHubRepositoryAuthorRequest, type GitHubRepositoryBundle, type GitHubRepositoryRequest, type GitHubReviewComment, GitHubReviewCommentAuthorError, type GitHubReviewReporter, type GitHubReviewReporterOptions, type GitHubTreeDeletion, type GitHubTreeEntry, type GitHubTreeUpsert, type GitTransferSandbox, type IncompleteCheckRunFields, type ListCheckRunsForRefInput, type ListConflictedPullRequestsInput, type ListGitHubPublicationPullRequestsInput, type ListOpenPullRequestsInput, type ListPullRequestCommentsInput, type ListPullRequestDiscussionInput, type ManageGitHubPullRequestLabelInput, type MarkGitHubPullRequestReadyInput, type MintGitHubAppInstallationTokenInput, type NormalizeFactoryCommentInput, type NormalizeFactoryReviewCommentInput, type ObservedCheckRunStatus, type PublishGitHubIssueOptions, type PublishGitHubIssueResult, type PublishGitHubPullRequestInput, type PublishedGitHubReview, type PullRequestLabelInput, type PullRequestReviewComment, type PullRequestReviewEvent, type PushGitHubBundleInput, type PushGitHubCheckpointInput, type PushGitHubHeadInput, type ReadCommittedGitChangeInput, type ReadGitHubBranchHeadInput, type ReadGitHubCommitInput, type ReadGitHubPullRequestInput, type ReadGitTransferFileInput, type ReadReviewCommentInput, type ReconcileReviewChecksInput, type ReconcileReviewChecksOptions, type ReconcileReviewChecksResult, type RequireTaskPullRequestInput, type ReviewCommentAuthorPolicy, type RunSandboxGitInput, type SandboxGit, type SandboxGitCommandInput, type SandboxGitCommandResult, StalePullRequestHeadError, type SubmitPullRequestReviewInput, type SubmittedPullRequestReview, type UpdateCheckRunInput, type UpdateGitHubBranchInput, type UpdatePullRequestCommentInput, type VerifyGitHubSignatureInput, type WithSandboxGitBundleInput, type WriteGitTransferFileInput, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubCommunicationAdapter, createGitHubIssuePublisher, createGitHubOpenPullRequestLister, createGitHubPublicationClient, createGitHubPullRequestLabelManager, createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher, createGitHubReviewReporter, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, parseGitHubReplyAddress, readCommittedGitChange, readGitHubIssuePublication, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, renderGitHubCommunicationEvent, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
@@ -6,5 +6,5 @@ import { createGitHubReviewReporter } from "../code-review/github-reporter.mjs";
6
6
  import { createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher } from "../pull-requests/github-publisher.mjs";
7
7
  import { createGitHubPullRequestLabelManager } from "../pull-requests/github-label-manager.mjs";
8
8
  import { createGitHubOpenPullRequestLister } from "../work-triage/github.mjs";
9
- import { createGitHubIssuePublisher, readGitHubIssuePublicationLabels } from "./github-issues.mjs";
10
- export { GitHubCheckoutConflictError, GitHubPublicationApiError, GitHubReviewCommentAuthorError, StalePullRequestHeadError, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubCommunicationAdapter, createGitHubIssuePublisher, createGitHubOpenPullRequestLister, createGitHubPublicationClient, createGitHubPullRequestLabelManager, createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher, createGitHubReviewReporter, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, parseGitHubReplyAddress, readCommittedGitChange, readGitHubIssuePublicationLabels, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, renderGitHubCommunicationEvent, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
9
+ import { createGitHubIssuePublisher, readGitHubIssuePublication } from "./github-issues.mjs";
10
+ export { GitHubCheckoutConflictError, GitHubPublicationApiError, GitHubReviewCommentAuthorError, StalePullRequestHeadError, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubCommunicationAdapter, createGitHubIssuePublisher, createGitHubOpenPullRequestLister, createGitHubPublicationClient, createGitHubPullRequestLabelManager, createGitHubPullRequestPublicationGate, createGitHubPullRequestPublisher, createGitHubReviewReporter, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, parseGitHubReplyAddress, readCommittedGitChange, readGitHubIssuePublication, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, renderGitHubCommunicationEvent, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/factory",
3
- "version": "0.0.18",
3
+ "version": "0.0.19",
4
4
  "description": "Schema, state machines, and kernel primitives for Agent Factory.",
5
5
  "homepage": "https://github.com/vercel-labs/agent-factory/tree/main/packages/factory",
6
6
  "bugs": "https://github.com/vercel-labs/agent-factory/issues",