@vercel/factory 0.0.20 → 0.0.22
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 +16 -0
- package/dist/build-factory.d.mts +1 -1
- package/dist/build-factory.mjs +2 -1
- package/dist/build-factory.mjs.map +1 -1
- package/dist/client.d.mts +4 -4
- package/dist/client.mjs +1 -0
- package/dist/client.mjs.map +1 -1
- package/dist/eve/task-execution.d.mts +16 -16
- package/dist/github.d.mts +21 -1
- package/dist/github.mjs +25 -1
- package/dist/github.mjs.map +1 -1
- package/dist/intake-contracts.d.mts +2 -2
- package/dist/integrations/github.d.mts +2 -2
- package/dist/integrations/github.mjs +2 -2
- package/dist/repository-scripts.d.mts +221 -0
- package/dist/repository-scripts.mjs +330 -0
- package/dist/repository-scripts.mjs.map +1 -0
- package/dist/schema/task-graph.d.mts +96 -96
- package/dist/schema/transcript.d.mts +4 -4
- package/dist/vercel-github-api.mjs +11 -10
- package/dist/vercel-github-api.mjs.map +1 -1
- package/docs/recipes/repository-scripts.md +64 -0
- package/package.json +8 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @vercel/factory
|
|
2
2
|
|
|
3
|
+
## 0.0.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 2b90bb3: Validate sandbox harness integration against the harness releases matching AI SDK 7.0.105 to avoid incompatible provider types in fresh installs.
|
|
8
|
+
- f8d68e2: Add `factory create --empty` for deploying an inert Factory host, including support for generating it inside an existing Git worktree.
|
|
9
|
+
- 59e4b10: Add exact-version repository event scripts with durable Task execution, scoped classification,
|
|
10
|
+
and idempotent GitHub issue comment and label actions.
|
|
11
|
+
- f69894b: Preserve delegated work during session refreshes and scaffold streaming worker command output.
|
|
12
|
+
|
|
13
|
+
## 0.0.21
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- e65f13d: Discover managed pull requests before publishing so branch reuse and ambiguous creation can be reconciled safely.
|
|
18
|
+
|
|
3
19
|
## 0.0.20
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
package/dist/build-factory.d.mts
CHANGED
|
@@ -8,7 +8,7 @@ interface BuildFactoryOptions<TConfig extends EveNextConfig = EveNextConfig> {
|
|
|
8
8
|
nextConfig: EveNextConfigInput<TConfig>;
|
|
9
9
|
root?: string;
|
|
10
10
|
}
|
|
11
|
-
/** Create
|
|
11
|
+
/** Create a Next.js configuration that mounts the Eve agents beneath a Factory project root. */
|
|
12
12
|
declare function buildFactory<TConfig extends EveNextConfig>({ factoryConfig, nextConfig, root }: BuildFactoryOptions<TConfig>): EveNextConfigFunction<TConfig>;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { BuildFactoryOptions, buildFactory };
|
package/dist/build-factory.mjs
CHANGED
|
@@ -2,11 +2,12 @@ import { defineFactory } from "./schema/factory-config.mjs";
|
|
|
2
2
|
import { readdirSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
//#region src/build-factory.ts
|
|
5
|
-
/** Create
|
|
5
|
+
/** Create a Next.js configuration that mounts the Eve agents beneath a Factory project root. */
|
|
6
6
|
function buildFactory({ factoryConfig, nextConfig, root = process.cwd() }) {
|
|
7
7
|
defineFactory(factoryConfig);
|
|
8
8
|
const agentDefinitions = Object.fromEntries(readdirSync(path.join(root, "agents"), { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => [entry.name, path.join(root, "agents", entry.name)]));
|
|
9
9
|
return async (phase, context) => {
|
|
10
|
+
if (Object.keys(agentDefinitions).length === 0) return typeof nextConfig === "function" ? nextConfig(phase, context) : nextConfig;
|
|
10
11
|
const { withEve } = await import("eve/next");
|
|
11
12
|
return withEve(nextConfig, { agents: agentDefinitions })(phase, context);
|
|
12
13
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-factory.mjs","names":[],"sources":["../src/build-factory.ts"],"sourcesContent":["import { readdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport {\n type EveNextConfig,\n type EveNextConfigFunction,\n type EveNextConfigInput,\n type WithEveAgentsConfig,\n} from \"eve/next\";\nimport { defineFactory, type FactoryConfigInput } from \"./schema/factory-config\";\n\n/** Inputs for validating a Factory configuration and discovering its Eve agents at build time. */\nexport interface BuildFactoryOptions<TConfig extends EveNextConfig = EveNextConfig> {\n factoryConfig: FactoryConfigInput;\n nextConfig: EveNextConfigInput<TConfig>;\n root?: string;\n}\n\n/** Create
|
|
1
|
+
{"version":3,"file":"build-factory.mjs","names":[],"sources":["../src/build-factory.ts"],"sourcesContent":["import { readdirSync } from \"node:fs\";\nimport path from \"node:path\";\nimport {\n type EveNextConfig,\n type EveNextConfigFunction,\n type EveNextConfigInput,\n type WithEveAgentsConfig,\n} from \"eve/next\";\nimport { defineFactory, type FactoryConfigInput } from \"./schema/factory-config\";\n\n/** Inputs for validating a Factory configuration and discovering its Eve agents at build time. */\nexport interface BuildFactoryOptions<TConfig extends EveNextConfig = EveNextConfig> {\n factoryConfig: FactoryConfigInput;\n nextConfig: EveNextConfigInput<TConfig>;\n root?: string;\n}\n\n/** Create a Next.js configuration that mounts the Eve agents beneath a Factory project root. */\nexport function buildFactory<TConfig extends EveNextConfig>({\n factoryConfig,\n nextConfig,\n root = process.cwd(),\n}: BuildFactoryOptions<TConfig>): EveNextConfigFunction<TConfig> {\n defineFactory(factoryConfig);\n const agentDefinitions: WithEveAgentsConfig = Object.fromEntries(\n readdirSync(path.join(root, \"agents\"), { withFileTypes: true })\n .filter((entry) => entry.isDirectory())\n .map((entry) => [entry.name, path.join(root, \"agents\", entry.name)]),\n );\n return async (phase, context) => {\n if (Object.keys(agentDefinitions).length === 0) {\n return typeof nextConfig === \"function\" ? nextConfig(phase, context) : nextConfig;\n }\n const { withEve } = await import(\"eve/next\");\n return withEve(nextConfig, { agents: agentDefinitions })(phase, context);\n };\n}\n"],"mappings":";;;;;AAkBA,SAAgB,aAA4C,EAC1D,eACA,YACA,OAAO,QAAQ,IAAI,KAC4C;CAC/D,cAAc,aAAa;CAC3B,MAAM,mBAAwC,OAAO,YACnD,YAAY,KAAK,KAAK,MAAM,QAAQ,GAAG,EAAE,eAAe,KAAK,CAAC,CAAC,CAC5D,QAAQ,UAAU,MAAM,YAAY,CAAC,CAAC,CACtC,KAAK,UAAU,CAAC,MAAM,MAAM,KAAK,KAAK,MAAM,UAAU,MAAM,IAAI,CAAC,CAAC,CACvE;CACA,OAAO,OAAO,OAAO,YAAY;EAC/B,IAAI,OAAO,KAAK,gBAAgB,CAAC,CAAC,WAAW,GAC3C,OAAO,OAAO,eAAe,aAAa,WAAW,OAAO,OAAO,IAAI;EAEzE,MAAM,EAAE,YAAY,MAAM,OAAO;EACjC,OAAO,QAAQ,YAAY,EAAE,QAAQ,iBAAiB,CAAC,CAAC,CAAC,OAAO,OAAO;CACzE;AACF"}
|
package/dist/client.d.mts
CHANGED
|
@@ -153,11 +153,11 @@ declare class FactoryClient {
|
|
|
153
153
|
limit?: number;
|
|
154
154
|
}): Promise<{
|
|
155
155
|
items: {
|
|
156
|
+
deliveryId: string;
|
|
156
157
|
id: `sig_${string}`;
|
|
157
158
|
schemaVersion: 1;
|
|
158
159
|
repositoryId: `repo_${string}`;
|
|
159
160
|
source: SignalSource;
|
|
160
|
-
deliveryId: string;
|
|
161
161
|
replyTo: {
|
|
162
162
|
channel: string;
|
|
163
163
|
address: string;
|
|
@@ -166,6 +166,7 @@ declare class FactoryClient {
|
|
|
166
166
|
outcome: "pending" | "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
|
|
167
167
|
repository: string;
|
|
168
168
|
taskIds: `task_${string}`[];
|
|
169
|
+
reason?: string | undefined;
|
|
169
170
|
triage?: {
|
|
170
171
|
attempt: number;
|
|
171
172
|
state: "running" | "blocked" | "uncertain";
|
|
@@ -176,7 +177,6 @@ declare class FactoryClient {
|
|
|
176
177
|
failure?: "cancelled" | "billing_verification_required" | "provider_failed" | "no_decision" | "launch_unconfirmed" | undefined;
|
|
177
178
|
} | undefined;
|
|
178
179
|
detail?: string | undefined;
|
|
179
|
-
reason?: string | undefined;
|
|
180
180
|
decidedAt?: string | undefined;
|
|
181
181
|
tasksNextCursor?: string | null | undefined;
|
|
182
182
|
}[];
|
|
@@ -184,11 +184,11 @@ declare class FactoryClient {
|
|
|
184
184
|
}>;
|
|
185
185
|
/** Retry only the observed stopped attempt; concurrent or stale retries conflict. */
|
|
186
186
|
retryIntake(id: string, expectedAttempt: number): Promise<{
|
|
187
|
+
deliveryId: string;
|
|
187
188
|
id: `sig_${string}`;
|
|
188
189
|
schemaVersion: 1;
|
|
189
190
|
repositoryId: `repo_${string}`;
|
|
190
191
|
source: SignalSource;
|
|
191
|
-
deliveryId: string;
|
|
192
192
|
replyTo: {
|
|
193
193
|
channel: string;
|
|
194
194
|
address: string;
|
|
@@ -197,6 +197,7 @@ declare class FactoryClient {
|
|
|
197
197
|
outcome: "pending" | "accepted" | "duplicate" | "unactionable" | "low_confidence" | "ignored";
|
|
198
198
|
repository: string;
|
|
199
199
|
taskIds: `task_${string}`[];
|
|
200
|
+
reason?: string | undefined;
|
|
200
201
|
triage?: {
|
|
201
202
|
attempt: number;
|
|
202
203
|
state: "running" | "blocked" | "uncertain";
|
|
@@ -207,7 +208,6 @@ declare class FactoryClient {
|
|
|
207
208
|
failure?: "cancelled" | "billing_verification_required" | "provider_failed" | "no_decision" | "launch_unconfirmed" | undefined;
|
|
208
209
|
} | undefined;
|
|
209
210
|
detail?: string | undefined;
|
|
210
|
-
reason?: string | undefined;
|
|
211
211
|
decidedAt?: string | undefined;
|
|
212
212
|
tasksNextCursor?: string | null | undefined;
|
|
213
213
|
}>;
|
package/dist/client.mjs
CHANGED
package/dist/client.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import { sessionSummarySchema, type SessionSummary } from \"./api-contracts\";\nexport { sessionSummarySchema } from \"./api-contracts\";\nexport { sessionTaskSummarySchema } from \"./schema/session-summary\";\nexport type { SessionSummary } from \"./api-contracts\";\nexport type { SessionTaskSummary } from \"./schema/session-summary\";\nimport { inboxActivitySchema, type InboxActivity } from \"./inbox-activity\";\nimport {\n modelSettingsSchema,\n updateModelDefaultsSchema,\n type ModelSettings,\n type UpdateModelDefaults,\n} from \"./model-settings\";\nexport {\n agentModelConfigSchema,\n modelSettingsSchema,\n updateModelDefaultsSchema,\n} from \"./model-settings\";\nexport type { AgentModelConfig, ModelSettings, UpdateModelDefaults } from \"./model-settings\";\nexport { inboxActivitySchema, inboxActivityItemSchema } from \"./inbox-activity\";\nexport type { InboxActivity, InboxActivityItem } from \"./inbox-activity\";\nimport { sessionPreviewsSchema, type SessionPreviews } from \"./session-previews\";\nexport { sessionPreviewsSchema, sessionPreviewSchema } from \"./session-previews\";\nexport type { SessionPreviews, SessionPreview } from \"./session-previews\";\nimport { sessionReviewSchema, type SessionReview } from \"./session-review\";\nexport {\n sessionReviewSchema,\n sessionReviewCheckSchema,\n sessionReviewScreenshotSchema,\n sessionReviewIssueSchema,\n} from \"./session-review\";\nexport type {\n SessionReview,\n SessionReviewCheck,\n SessionReviewScreenshot,\n SessionReviewIssue,\n} from \"./session-review\";\nimport {\n workspaceFilesRequestSchema,\n workspaceFilesSchema,\n type WorkspaceFiles,\n type WorkspaceFilesRequest,\n} from \"./workspace-files\";\nexport {\n workspacePathSchema,\n workspaceFilesRequestSchema,\n workspaceFileEntrySchema,\n workspaceFileContentSchema,\n workspaceFilesSchema,\n} from \"./workspace-files\";\nexport type { WorkspaceFilesRequest, WorkspaceFileEntry, WorkspaceFiles } from \"./workspace-files\";\nimport { intakePageSchema, intakeViewSchema, retryIntakeSchema } from \"./intake-contracts\";\nexport { describeIntake } from \"./intake-contracts\";\nexport type { IntakeView } from \"./intake-contracts\";\nimport {\n approvalPageSchema,\n approvalRequestSchema,\n approvalViewSchema,\n type ApprovalListOptions,\n type ApprovalPage,\n type ApprovalView,\n} from \"./approval-contracts\";\nexport type { ApprovalListOptions, ApprovalPage, ApprovalView } from \"./approval-contracts\";\nimport { z } from \"zod\";\nimport {\n imageAttachmentSchema,\n type ImageAttachment,\n type ImageId,\n type ImageUploadInput,\n} from \"./image-input\";\nexport {\n MAX_IMAGE_BYTES,\n MAX_IMAGES,\n imageAttachmentSchema,\n imageAttachmentsSchema,\n imageIdSchema,\n} from \"./image-input\";\nexport type { ImageAttachment, ImageId, ImageUploadInput } from \"./image-input\";\nimport {\n answerSessionQuestionRequestSchema,\n apiAgentSchema,\n controlSessionRequestSchema,\n createSessionRequestSchema,\n repositoryDetailsSchema,\n sendSessionMessageRequestSchema,\n sessionPageSchema,\n sessionViewSchema,\n submitSessionInputRequestSchema,\n type AnswerSessionQuestionRequest,\n type ApiAgent,\n type ControlSessionRequest,\n type CreateSessionRequest,\n type RepositoryDetails,\n type SendSessionMessageRequest,\n type SessionPage,\n type SessionView,\n type SubmitSessionInputRequest,\n} from \"./api-contracts\";\nimport { changeSchema } from \"./schema/change\";\nimport type { MaybePromise } from \"./schema/common\";\nimport { taskIdSchema, type RepositoryId, type TaskId } from \"./schema/id\";\nimport { repositorySlugSchema, type RepositorySlug } from \"./schema/repository\";\nimport type { AgentSessionId } from \"./schema/session\";\nimport { workspaceDiffSchema, type WorkspaceDiff } from \"./workspace-diff\";\nimport { taskSchema, taskStateSchema, type Task } from \"./schema/task\";\nimport { taskGraphViewSchema, type TaskGraphView } from \"./task-graph-view\";\nimport {\n transcriptBlockSchema,\n transcriptPageSchema,\n type TranscriptBlock,\n type TranscriptPage,\n type TranscriptSnapshot,\n} from \"./schema/transcript\";\nexport type { TaskGraphView } from \"./task-graph-view\";\n\n/** All durable Task states in their schema-defined order. */\nexport const taskStates = Object.freeze([...taskStateSchema.options]);\n\n/** Filters and pagination accepted by the session-list API. */\nexport interface SessionListOptions {\n readonly scope?: \"all\" | \"interactive\";\n readonly detail?: \"full\" | \"summary\";\n readonly limit?: number;\n readonly cursor?: string;\n readonly query?: string;\n readonly repository?: RepositorySlug;\n readonly agent?: string;\n readonly source?: \"automatic\";\n readonly state?: Task[\"state\"] | \"conversation\";\n readonly attention?: boolean;\n readonly topLevel?: boolean;\n readonly includeTotal?: boolean;\n}\n\nexport type { WorkspaceDiff, WorkspaceDiffFile } from \"./workspace-diff\";\nexport { workspaceDiffFileSchema, workspaceDiffSchema } from \"./workspace-diff\";\nexport { agentSessionIdSchema, agentSessionSchema } from \"./schema/session\";\nexport type {\n AgentSession,\n AgentSessionId,\n DirectAgentSession,\n ExternalAgentSession,\n TaskAgentSession,\n} from \"./schema/session\";\n\nexport {\n answerSessionQuestionRequestSchema,\n pendingFollowUpSchema,\n apiAgentSchema,\n controlSessionRequestSchema,\n createSessionRequestSchema,\n repositoryDetailsSchema,\n repositorySummarySchema,\n sendSessionMessageRequestSchema,\n sessionInputResponseSchema,\n sessionPageSchema,\n sessionPullRequestSchema,\n sessionPullRequestStateSchema,\n sessionWorkGroupSchema,\n sessionWorkResultSchema,\n sessionWorkTaskSchema,\n sessionViewSchema,\n submitSessionInputRequestSchema,\n} from \"./api-contracts\";\nexport type {\n AnswerSessionQuestionRequest,\n PendingFollowUp,\n ApiAgent,\n ControlSessionRequest,\n CreateSessionRequest,\n RepositoryDetails,\n RepositorySummary,\n SendSessionMessageRequest,\n SessionInputResponse,\n SessionPage,\n SessionPullRequest,\n SessionWorkGroup,\n SessionWorkResult,\n SessionWorkTask,\n SessionView,\n SubmitSessionInputRequest,\n} from \"./api-contracts\";\nexport { readEvents, streamEventSchema, type StreamEvent } from \"./client-events\";\nexport {\n Transcript,\n type InputRequest,\n type TranscriptBlock,\n type ToolCall,\n type TranscriptSnapshot,\n type TranscriptHistoryPage,\n} from \"./client-transcript\";\nexport {\n inputRequestSchema,\n toolCallSchema,\n transcriptBlockSchema,\n transcriptSnapshotSchema,\n transcriptPageSchema,\n} from \"./schema/transcript\";\nexport type { TranscriptPage, TranscriptPageQuery } from \"./schema/transcript\";\nexport {\n followSessionStream,\n loadPreviousTranscriptPage,\n expandTranscriptBlock,\n type FollowSessionStreamOptions,\n type SessionStreamClient,\n} from \"./client-stream\";\n\n/** An unsuccessful Factory API response surfaced by the browser-safe client. */\nexport class ApiError extends Error {\n constructor(\n readonly status: number,\n message: string,\n readonly actor?: string,\n ) {\n super(message);\n }\n}\n\n/** Connection and request customization for {@link FactoryClient}. */\nexport interface FactoryClientOptions {\n /**\n * Canonical Factory origin. It must be HTTPS, except for HTTP loopback development, and cannot\n * contain credentials, a path, query parameters, or a fragment.\n */\n readonly url: string;\n /**\n * Headers resolved immediately before every request, allowing short-lived authentication to be\n * refreshed. Factory always sets `content-type` to `application/json` afterward.\n */\n readonly headers?: () => MaybePromise<HeadersInit>;\n /** Fetch implementation used for every request; defaults to `globalThis.fetch`. */\n readonly fetch?: typeof globalThis.fetch;\n}\n\n/** Identifies an uploaded image and optionally controls cancellation of its download. */\nexport interface GetImageOptions {\n readonly id: ImageId;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies an operator session and the amount of detail to return. */\nexport interface GetSessionOptions {\n readonly id: AgentSessionId;\n readonly detail?: \"full\" | \"summary\";\n}\n\n/** Selects the observed execution whose review evidence should be read. */\nexport interface SessionReviewOptions {\n readonly sessionId: AgentSessionId;\n readonly executionId: string | null;\n readonly signal?: AbortSignal;\n}\n\n/** Selects the observed execution whose preview links and instructions should be read. */\nexport interface SessionPreviewsOptions {\n readonly sessionId: AgentSessionId;\n readonly executionId: string | null;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies the operator session whose canonical task graph should be read. */\nexport interface GetSessionGraphOptions {\n readonly id: AgentSessionId;\n /** Selects a Task in the bound graph or work addressed to this conversation. */\n readonly taskId?: TaskId;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies an exact task execution transcript within an operator session. */\nexport interface GraphTranscriptOptions {\n readonly sessionId: AgentSessionId;\n readonly taskId: TaskId;\n readonly executionId: string;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies a file or directory at an observed execution and optional immutable revision. */\nexport interface WorkspaceFilesOptions extends WorkspaceFilesRequest {\n readonly sessionId: AgentSessionId;\n readonly executionId: string | null;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies the execution whose committed workspace should be compared. */\nexport interface WorkspaceDiffOptions {\n readonly sessionId: AgentSessionId;\n readonly executionId: string | null;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies a materialized transcript response used by the stream follower. */\nexport interface SessionTranscriptRequest {\n readonly sessionId: AgentSessionId;\n readonly executionId: string;\n readonly taskId?: TaskId;\n readonly history?: boolean;\n readonly limit?: number;\n readonly cursor?: string;\n readonly blockId?: string;\n readonly signal: AbortSignal;\n}\n\n/** Identifies a cursor-addressed event stream used by the stream follower. */\nexport interface SessionEventStreamRequest {\n readonly sessionId: AgentSessionId;\n readonly executionId: string;\n readonly cursor: number;\n readonly taskId?: TaskId;\n readonly signal: AbortSignal;\n}\n\n/**\n * Browser-safe typed client for the public Factory HTTP API.\n *\n * @remarks\n * Requests use same-origin credentials, bypass HTTP caches, and refuse redirects so authentication\n * redirects cannot be mistaken for API responses. When no caller signal is available, requests\n * time out after 30 seconds. Non-success responses throw {@link ApiError}; successful JSON bodies\n * are still validated against their public schemas before being returned.\n */\nexport class FactoryClient {\n private readonly origin: string;\n /**\n * Creates a client for one canonical Factory origin without performing a request.\n *\n * @param options - Factory origin plus optional per-request headers and fetch implementation.\n * @throws When `options.url` is not an HTTPS origin or an HTTP loopback origin.\n */\n constructor(private readonly options: FactoryClientOptions) {\n const url = new URL(options.url);\n if (\n url.username ||\n url.password ||\n url.pathname !== \"/\" ||\n url.search ||\n url.hash ||\n (url.protocol !== \"https:\" &&\n !(url.protocol === \"http:\" && [\"localhost\", \"127.0.0.1\", \"[::1]\"].includes(url.hostname)))\n ) {\n throw new Error(\"Factory URL must be an HTTPS origin, or HTTP on loopback\");\n }\n this.origin = url.origin;\n }\n\n private async response(path: string, body?: unknown, signal?: AbortSignal): Promise<Response> {\n const url = new URL(`/api/v1/${path}`, this.origin);\n if (url.origin !== this.origin || !url.pathname.startsWith(\"/api/v1/\"))\n throw new Error(\"Invalid Factory API path\");\n const headers = new Headers(await this.options.headers?.());\n headers.set(\"content-type\", \"application/json\");\n const response = await (this.options.fetch ?? globalThis.fetch)(url.href, {\n method: body === undefined ? \"GET\" : \"POST\",\n headers,\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n credentials: \"same-origin\",\n cache: \"no-store\",\n redirect: \"manual\",\n signal: signal ?? AbortSignal.timeout(30_000),\n });\n if (response.type === \"opaqueredirect\" || [301, 302, 303, 307, 308].includes(response.status)) {\n await response.body?.cancel();\n throw new ApiError(\n response.status,\n `Factory at ${this.origin} returned a redirect. Reload to sign in, or set factory.url to the factory's canonical origin. Redirects are not followed.`,\n );\n }\n if (!response.ok) {\n const value: unknown = await response.json().catch(() => null);\n const detail =\n value !== null &&\n typeof value === \"object\" &&\n \"error\" in value &&\n typeof value.error === \"string\"\n ? value.error\n : `HTTP ${response.status}`;\n const actor =\n value !== null &&\n typeof value === \"object\" &&\n \"actor\" in value &&\n typeof value.actor === \"string\"\n ? value.actor\n : undefined;\n throw new ApiError(\n response.status,\n response.status === 401\n ? \"Authentication rejected. Reload to sign in, or run vercel login for the terminal client.\"\n : detail,\n actor,\n );\n }\n return response;\n }\n\n /** Read authorized intake and pre-task triage failures. */\n async intake(options: { repository?: string; cursor?: string; limit?: number } = {}) {\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(options))\n if (value !== undefined) query.set(key, String(value));\n return intakePageSchema.parse(await (await this.response(`intake?${query}`)).json());\n }\n\n /** Retry only the observed stopped attempt; concurrent or stale retries conflict. */\n async retryIntake(id: string, expectedAttempt: number) {\n return intakeViewSchema.parse(\n await (\n await this.response(\n `intake/${encodeURIComponent(id)}/retry`,\n retryIntakeSchema.parse({ expectedAttempt }),\n )\n ).json(),\n );\n }\n\n /** Lists approval proposals visible to the authenticated operator. */\n async listApprovals(options: ApprovalListOptions = {}): Promise<ApprovalPage> {\n const query = new URLSearchParams(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n );\n return approvalPageSchema.parse(await (await this.response(`approvals?${query}`)).json());\n }\n /** Reads one approval proposal by Task ID. */\n async getApproval(id: TaskId): Promise<ApprovalView> {\n return approvalViewSchema.parse(\n await (await this.response(`tasks/${encodeURIComponent(id)}/approval`)).json(),\n );\n }\n /** Approves one proposal, optionally recording an operator reason. */\n async approveTask(id: TaskId, reason?: string): Promise<ApprovalView> {\n return approvalViewSchema.parse(\n await (\n await this.response(\n `tasks/${encodeURIComponent(id)}/approve`,\n approvalRequestSchema.parse({ reason }),\n )\n ).json(),\n );\n }\n\n /** Rejects one proposal with the required operator reason. */\n async rejectTask(id: TaskId, reason: string): Promise<ApprovalView> {\n return approvalViewSchema.parse(\n await (\n await this.response(\n `tasks/${encodeURIComponent(id)}/reject`,\n approvalRequestSchema.parse({ reason }),\n )\n ).json(),\n );\n }\n\n /** Uploads one bounded image for use in a later message. */\n async uploadImage(input: ImageUploadInput): Promise<ImageAttachment> {\n return imageAttachmentSchema.parse(await (await this.response(\"images\", input)).json());\n }\n /** Downloads a previously uploaded image. */\n async getImage(options: GetImageOptions): Promise<Blob> {\n return (\n await this.response(`images/${encodeURIComponent(options.id)}`, undefined, options.signal)\n ).blob();\n }\n\n /** Lists agents exposed for operator session creation. */\n async listAgents(): Promise<readonly ApiAgent[]> {\n return z\n .object({ agents: z.array(apiAgentSchema).readonly() })\n .parse(await (await this.response(\"agents\")).json()).agents;\n }\n /** Reports whether the configured origin is the isolated local fixture runtime. */\n async isLocalTestRuntime(): Promise<boolean> {\n const response = await this.response(\"agents\");\n const local = response.headers.get(\"x-factory-local-test\") === \"1\";\n await response.body?.cancel();\n return local;\n }\n /** Lists configured repository slugs. */\n async listRepositories(): Promise<readonly RepositorySlug[]> {\n return z\n .object({ repositories: z.array(repositorySlugSchema).readonly() })\n .parse(await (await this.response(\"repositories\")).json()).repositories;\n }\n /** Reads repository slugs together with their stable configured identifiers. */\n async getRepositoryDetails(): Promise<RepositoryDetails> {\n return repositoryDetailsSchema.parse(await (await this.response(\"repositories\")).json());\n }\n /** Reads one bounded page of open Changes, optionally scoped to a repository. */\n async getChangePage(\n options: { repository?: RepositorySlug; limit?: number; cursor?: string } = {},\n ) {\n const query = new URLSearchParams(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n );\n return z\n .object({ changes: z.array(changeSchema).readonly(), nextCursor: z.string().nullable() })\n .parse(await (await this.response(`changes?${query}`)).json());\n }\n /** Reads one bounded page of canonical Tasks authorized for the caller. */\n async getTaskPage(options: { limit?: number; cursor?: string } = {}) {\n const query = new URLSearchParams(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n );\n return z\n .object({ tasks: z.array(taskSchema).readonly(), nextCursor: z.string().nullable() })\n .parse(await (await this.response(`tasks?${query}`)).json());\n }\n /**\n * Lists sessions matching the requested operator scope without pagination metadata.\n *\n * @param options - Optional scope and detail projection; both use their server defaults when omitted.\n * @returns The first matching page's sessions. Use {@link getSessionPage} to follow cursors.\n */\n async listSessions(\n options: Pick<SessionListOptions, \"scope\" | \"detail\"> = {},\n ): Promise<readonly SessionSummary[]> {\n return (await this.getSessionPage(options)).sessions;\n }\n /**\n * Reads a filtered, cursor-paginated page of sessions.\n *\n * @param options - Filters, cursor, projection detail, and page limit sent to the API.\n * @returns The validated page, including its continuation cursor and optional total count.\n */\n async getSessionPage(options: SessionListOptions = {}): Promise<SessionPage> {\n const query = new URLSearchParams(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n ).toString();\n return sessionPageSchema.parse(\n await (await this.response(`sessions${query ? `?${query}` : \"\"}`)).json(),\n );\n }\n /** Reads application-owned external work requiring operator attention. */\n async getInboxActivity(): Promise<InboxActivity> {\n return inboxActivitySchema.parse(await (await this.response(\"inbox-activity\")).json());\n }\n /** Reads application model choices and optional repository defaults. */\n async getModelSettings(repository?: RepositorySlug): Promise<ModelSettings> {\n const query = repository ? `?${new URLSearchParams({ repository })}` : \"\";\n return modelSettingsSchema.parse(await (await this.response(`models${query}`)).json());\n }\n /** Saves repository defaults only when their observed revision still matches. */\n async updateModelDefaults(input: UpdateModelDefaults): Promise<ModelSettings> {\n return modelSettingsSchema.parse(\n await (await this.response(\"models\", updateModelDefaultsSchema.parse(input))).json(),\n );\n }\n /** Counts sessions that currently require operator attention. */\n async getInboxCount(): Promise<number> {\n const result = z\n .object({ totalCount: z.number().int().nonnegative().optional() })\n .parse(\n await (\n await this.response(\n \"sessions?scope=all&detail=summary&attention=true&includeTotal=true&limit=1\",\n )\n ).json(),\n );\n if (result.totalCount === undefined)\n throw new Error(\"This factory's access policy does not provide an exact attention count\");\n return result.totalCount;\n }\n /** Reads a summary batch for the provided session IDs. */\n async getSessionBatch(ids: readonly AgentSessionId[]): Promise<readonly SessionSummary[]> {\n if (ids.length === 0) return [];\n const query = new URLSearchParams({ ids: ids.join(\",\"), detail: \"summary\" });\n return z\n .object({ sessions: z.array(sessionSummarySchema).readonly() })\n .parse(await (await this.response(`sessions?${query}`)).json()).sessions;\n }\n /** Reads one earlier page of authorized provider executions. */\n async getSessionHistory(\n id: AgentSessionId,\n options: { cursor?: string; signal?: AbortSignal } = {},\n ) {\n const query = new URLSearchParams({\n limit: \"20\",\n ...(options.cursor ? { cursor: options.cursor } : {}),\n });\n return z\n .object({\n items: sessionViewSchema.shape.history.unwrap(),\n nextCursor: z.string().nullable(),\n })\n .parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(id)}/history?${query}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads one earlier page of delivered conversation notifications. */\n async getSessionNotifications(\n id: AgentSessionId,\n options: { cursor?: string; signal?: AbortSignal } = {},\n ) {\n const query = new URLSearchParams({\n limit: \"30\",\n ...(options.cursor ? { cursor: options.cursor } : {}),\n });\n return z\n .object({ items: sessionViewSchema.shape.notifications, nextCursor: z.string().nullable() })\n .parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(id)}/notifications?${query}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads one bounded page of related Tasks authorized for this conversation. */\n async getSessionRelatedTasks(\n id: AgentSessionId,\n options: { cursor?: string; signal?: AbortSignal } = {},\n ) {\n const query = new URLSearchParams({\n limit: \"30\",\n ...(options.cursor ? { cursor: options.cursor } : {}),\n });\n return z\n .object({\n items: sessionViewSchema.shape.relatedTasks.unwrap(),\n nextCursor: z.string().nullable(),\n })\n .parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(id)}/related-tasks?${query}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /**\n * Reads one operator session.\n *\n * @param options - Stable session ID and optional summary or full projection.\n * @returns The current validated session view; it is a snapshot and does not follow live events.\n */\n async getSession(options: GetSessionOptions): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.id)}${options.detail ? `?detail=${options.detail}` : \"\"}`,\n )\n ).json(),\n );\n }\n /** Reads the canonical task graph projected for one session. */\n async getSessionGraph(options: GetSessionGraphOptions): Promise<TaskGraphView> {\n return taskGraphViewSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.id)}/graph${options.taskId ? `?${new URLSearchParams({ taskId: options.taskId })}` : \"\"}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads the materialized transcript for one exact graph task execution. */\n async getGraphTranscript(options: GraphTranscriptOptions): Promise<TranscriptSnapshot> {\n const query = new URLSearchParams({\n taskId: options.taskId,\n executionId: options.executionId,\n });\n return transcriptPageSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/graph-transcript?${query}`,\n undefined,\n options.signal,\n )\n ).json(),\n ).snapshot;\n }\n /** Refreshes a session summary and reloads its history when the active execution changes. */\n async refreshSession(previous: SessionView): Promise<SessionView> {\n const current = await this.getSession({ id: previous.session.id, detail: \"summary\" });\n if (\n current.task?.id !== previous.task?.id ||\n current.execution?.sessionId !== previous.execution?.sessionId ||\n current.execution?.provider !== previous.execution?.provider\n )\n return this.getSession({ id: previous.session.id });\n if (\n current.session.latestNotificationId !== previous.session.latestNotificationId ||\n current.task?.updatedAt !== previous.task?.updatedAt ||\n current.statusRevision !== previous.statusRevision\n ) {\n const fresh = await this.getSession({ id: previous.session.id });\n if (\n fresh.task?.id !== previous.task?.id ||\n fresh.execution?.sessionId !== previous.execution?.sessionId ||\n fresh.execution?.provider !== previous.execution?.provider\n )\n return fresh;\n return {\n ...fresh,\n history: [\n ...new Map(\n [...(previous.history ?? []), ...(fresh.history ?? [])].map((entry) => [\n JSON.stringify(entry.execution),\n entry,\n ]),\n ).values(),\n ],\n historyNextCursor:\n (previous.history?.length ?? 0) > (fresh.history?.length ?? 0)\n ? previous.historyNextCursor\n : fresh.historyNextCursor,\n notifications: [\n ...new Map(\n [...previous.notifications, ...fresh.notifications].map((entry) => [\n entry.eventId,\n entry,\n ]),\n ).values(),\n ],\n notificationsNextCursor:\n previous.notifications.length > fresh.notifications.length\n ? previous.notificationsNextCursor\n : fresh.notificationsNextCursor,\n relatedTasks: [\n ...new Map(\n [\n ...(fresh.relatedTasks ?? []),\n ...(previous.relatedTasks ?? []).filter(\n (entry) => !fresh.relatedTasks?.some((current) => current.id === entry.id),\n ),\n ].map((entry) => [entry.id, entry]),\n ).values(),\n ],\n relatedTasksNextCursor:\n (previous.relatedTasks?.length ?? 0) > (fresh.relatedTasks?.length ?? 0)\n ? previous.relatedTasksNextCursor\n : fresh.relatedTasksNextCursor,\n };\n }\n return {\n ...current,\n history: previous.history,\n historyNextCursor: previous.historyNextCursor,\n notifications: previous.notifications,\n notificationsNextCursor: previous.notificationsNextCursor,\n relatedTasks: previous.relatedTasks,\n relatedTasksNextCursor: previous.relatedTasksNextCursor,\n };\n }\n /** Reads application-owned previews without starting an agent, deployment, or server. */\n async getSessionPreviews(options: SessionPreviewsOptions): Promise<SessionPreviews> {\n return sessionPreviewsSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/previews?${new URLSearchParams({ executionId: options.executionId ?? \"\" })}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads recorded checks, screenshots, and issues through the application's review reader. */\n async getSessionReview(options: SessionReviewOptions): Promise<SessionReview> {\n return sessionReviewSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/review?${new URLSearchParams({ executionId: options.executionId ?? \"\" })}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads a directory or complete file through the factory's configured workspace adapter. */\n async getWorkspaceFiles(options: WorkspaceFilesOptions): Promise<WorkspaceFiles> {\n const query = workspaceFilesRequestSchema.parse({\n path: options.path,\n revision: options.revision,\n });\n const params = new URLSearchParams({\n executionId: options.executionId ?? \"\",\n path: query.path,\n });\n if (query.revision !== undefined) params.set(\"revision\", query.revision);\n return workspaceFilesSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/files?${params}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads the committed workspace comparison for one observed execution. */\n async getWorkspaceDiff(options: WorkspaceDiffOptions): Promise<WorkspaceDiff> {\n return workspaceDiffSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/diff?${new URLSearchParams({ executionId: options.executionId ?? \"\" })}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /**\n * Creates or recovers an idempotent conversational session.\n *\n * @remarks\n * Retain `input.operationId` unchanged across ambiguous failures. Reusing it with identical input\n * returns the original session; reusing it with different input is a conflict. The returned view\n * means admission and any initial dispatch attempt finished, not that the agent's work completed.\n *\n * @param input - Agent, initial content, optional repository/change, and client idempotency key.\n * @returns The admitted or recovered session snapshot.\n */\n async createSession(input: CreateSessionRequest): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (await this.response(\"sessions\", createSessionRequestSchema.parse(input))).json(),\n );\n }\n\n /** Creates or recovers idempotent workflow work through a specialist signal. */\n async createSignal(input: CreateSessionRequest): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (await this.response(\"signals\", createSessionRequestSchema.parse(input))).json(),\n );\n }\n\n /** Starts a deepsec security scan of a repository, or returns its already-active scan. */\n async runSecurityScan(repositoryId: RepositoryId): Promise<{ taskId: TaskId; reused: boolean }> {\n return z\n .strictObject({ taskId: taskIdSchema, reused: z.boolean() })\n .parse(await (await this.response(`repositories/${repositoryId}/security-scan`, {})).json());\n }\n\n /**\n * Sends a message to an existing session using optimistic execution matching.\n *\n * @remarks\n * `input.executionId` must be the execution the caller observed, or `null` when none was active.\n * A completed Task follow-up also requires an `operationId`, which must be retained for retries.\n * Resolving means the API accepted the message; provider or follow-up work may still be running.\n *\n * @param id - Stable Factory session receiving the message.\n * @param input - Message, observed execution, steering policy, attachments, and optional retry key.\n * @returns Nothing after the API accepts the request.\n */\n async sendSessionMessage(id: AgentSessionId, input: SendSessionMessageRequest): Promise<void> {\n const response = await this.response(\n `sessions/${encodeURIComponent(id)}/messages`,\n sendSessionMessageRequestSchema.parse(input),\n );\n await response.body?.cancel();\n }\n\n /**\n * Submits responses to pending provider input requests.\n *\n * @param id - Stable Factory session whose provider requested input.\n * @param input - Observed execution ID and one or more request-correlated responses.\n * @returns Nothing after the API accepts the responses; stale execution IDs are rejected.\n */\n async submitSessionInput(id: AgentSessionId, input: SubmitSessionInputRequest): Promise<void> {\n const response = await this.response(\n `sessions/${encodeURIComponent(id)}/input`,\n submitSessionInputRequestSchema.parse(input),\n );\n await response.body?.cancel();\n }\n\n /**\n * Attempts to dispatch queued workflow work associated with a session.\n *\n * @param id - Stable Factory session whose current work should be dispatched.\n * @returns The refreshed session after the bounded dispatch attempt, which may still be queued.\n */\n async dispatchSession(id: AgentSessionId): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (await this.response(`sessions/${encodeURIComponent(id)}/dispatch`, {})).json(),\n );\n }\n\n /** Answers a workflow question associated with a session. */\n async answerSessionQuestion(\n id: AgentSessionId,\n input: AnswerSessionQuestionRequest,\n ): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(id)}/answer`,\n answerSessionQuestionRequestSchema.parse(input),\n )\n ).json(),\n );\n }\n\n /** Cooperatively interrupts the currently observed turn. */\n async interruptSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"interrupt\", input);\n }\n\n /** Cancels active workflow and provider work in a session. */\n async cancelSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"cancel\", input);\n }\n\n /** Compacts the provider context for a session. */\n async compactSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"compact\", input);\n }\n\n /** Clears the provider context for a session. */\n async clearSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"clear\", input);\n }\n\n /** Resets a session after cancelling its active work. */\n async resetSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"reset\", input);\n }\n\n /** Reads a materialized transcript as a raw HTTP response for incremental following. */\n async getSessionTranscriptResponse(input: SessionTranscriptRequest): Promise<Response> {\n const query = new URLSearchParams({ executionId: input.executionId });\n if (input.history === true) query.set(\"history\", \"1\");\n if (input.taskId !== undefined) query.set(\"taskId\", input.taskId);\n if (input.limit !== undefined) query.set(\"limit\", String(input.limit));\n if (input.cursor !== undefined) query.set(\"cursor\", input.cursor);\n if (input.blockId !== undefined) query.set(\"blockId\", input.blockId);\n return this.response(\n `sessions/${encodeURIComponent(input.sessionId)}/${input.taskId ? \"graph-transcript\" : \"transcript\"}?${query}`,\n undefined,\n input.signal,\n );\n }\n\n /** Reads one bounded page of saved transcript history from Factory storage. */\n async getTranscriptPage(\n input: Omit<SessionTranscriptRequest, \"blockId\">,\n ): Promise<TranscriptPage> {\n return transcriptPageSchema.parse(\n await (await this.getSessionTranscriptResponse(input)).json(),\n );\n }\n\n /** Expands one large transcript block after authorizing its session and execution. */\n async getTranscriptBlock(\n input: Omit<SessionTranscriptRequest, \"limit\" | \"cursor\"> & { readonly blockId: string },\n ): Promise<TranscriptBlock> {\n return transcriptBlockSchema.parse(\n await (await this.getSessionTranscriptResponse(input)).json(),\n );\n }\n\n /** Opens a cursor-addressed session event stream as a raw HTTP response. */\n async getSessionEventStreamResponse(input: SessionEventStreamRequest): Promise<Response> {\n const query = new URLSearchParams({\n executionId: input.executionId,\n startIndex: String(input.cursor),\n });\n if (input.taskId !== undefined) query.set(\"taskId\", input.taskId);\n return this.response(\n `sessions/${encodeURIComponent(input.sessionId)}/${input.taskId ? \"graph-stream\" : \"stream\"}?${query}`,\n undefined,\n input.signal,\n );\n }\n\n private async controlSession(\n id: AgentSessionId,\n action: \"interrupt\" | \"cancel\" | \"compact\" | \"clear\" | \"reset\",\n input: ControlSessionRequest,\n ): Promise<void> {\n const response = await this.response(\n `sessions/${encodeURIComponent(id)}/${action}`,\n controlSessionRequestSchema.parse(input),\n );\n await response.body?.cancel();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAa,aAAa,OAAO,OAAO,CAAC,GAAG,gBAAgB,OAAO,CAAC;;AA4FpE,IAAa,WAAb,cAA8B,MAAM;CAEvB;CAEA;CAHX,YACE,QACA,SACA,OACA;EACA,MAAM,OAAO;EAJJ,KAAA,SAAA;EAEA,KAAA,QAAA;CAGX;AACF;;;;;;;;;;AAwGA,IAAa,gBAAb,MAA2B;CAQI;CAP7B;;;;;;;CAOA,YAAY,SAAgD;EAA/B,KAAA,UAAA;EAC3B,MAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;EAC/B,IACE,IAAI,YACJ,IAAI,YACJ,IAAI,aAAa,OACjB,IAAI,UACJ,IAAI,QACH,IAAI,aAAa,YAChB,EAAE,IAAI,aAAa,WAAW;GAA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AM,IAAI,WAAW,GAAG;EACpD,IAAI,MAAM,WAAW,KAAA,GAAW,MAAM,IAAI,UAAU,MAAM,MAAM;EAChE,IAAI,MAAM,UAAU,KAAA,GAAW,MAAM,IAAI,SAAS,OAAO,MAAM,KAAK,CAAC;EACrE,IAAI,MAAM,WAAW,KAAA,GAAW,MAAM,IAAI,UAAU,MAAM,MAAM;EAChE,IAAI,MAAM,YAAY,KAAA,GAAW,MAAM,IAAI,WAAW,MAAM,OAAO;EACnE,OAAO,KAAK,SACV,YAAY,mBAAmB,MAAM,SAAS,EAAE,GAAG,MAAM,SAAS,qBAAqB,aAAa,GAAG,SACvG,KAAA,GACA,MAAM,MACR;CACF;;CAGA,MAAM,kBACJ,OACyB;EACzB,OAAO,qBAAqB,MAC1B,OAAO,MAAM,KAAK,6BAA6B,KAAK,EAAA,CAAG,KAAK,CAC9D;CACF;;CAGA,MAAM,mBACJ,OAC0B;EAC1B,OAAO,sBAAsB,MAC3B,OAAO,MAAM,KAAK,6BAA6B,KAAK,EAAA,CAAG,KAAK,CAC9D;CACF;;CAGA,MAAM,8BAA8B,OAAqD;EACvF,MAAM,QAAQ,IAAI,gBAAgB;GAChC,aAAa,MAAM;GACnB,YAAY,OAAO,MAAM,MAAM;EACjC,CAAC;EACD,IAAI,MAAM,WAAW,KAAA,GAAW,MAAM,IAAI,UAAU,MAAM,MAAM;EAChE,OAAO,KAAK,SACV,YAAY,mBAAmB,MAAM,SAAS,EAAE,GAAG,MAAM,SAAS,iBAAiB,SAAS,GAAG,SAC/F,KAAA,GACA,MAAM,MACR;CACF;CAEA,MAAc,eACZ,IACA,QACA,OACe;EAKf,OAAM,MAJiB,KAAK,SAC1B,YAAY,mBAAmB,EAAE,EAAE,GAAG,UACtC,4BAA4B,MAAM,KAAK,CACzC,EAAA,CACe,MAAM,OAAO;CAC9B;AACF"}
|
|
1
|
+
{"version":3,"file":"client.mjs","names":[],"sources":["../src/client.ts"],"sourcesContent":["import { sessionSummarySchema, type SessionSummary } from \"./api-contracts\";\nexport { sessionSummarySchema } from \"./api-contracts\";\nexport { sessionTaskSummarySchema } from \"./schema/session-summary\";\nexport type { SessionSummary } from \"./api-contracts\";\nexport type { SessionTaskSummary } from \"./schema/session-summary\";\nimport { inboxActivitySchema, type InboxActivity } from \"./inbox-activity\";\nimport {\n modelSettingsSchema,\n updateModelDefaultsSchema,\n type ModelSettings,\n type UpdateModelDefaults,\n} from \"./model-settings\";\nexport {\n agentModelConfigSchema,\n modelSettingsSchema,\n updateModelDefaultsSchema,\n} from \"./model-settings\";\nexport type { AgentModelConfig, ModelSettings, UpdateModelDefaults } from \"./model-settings\";\nexport { inboxActivitySchema, inboxActivityItemSchema } from \"./inbox-activity\";\nexport type { InboxActivity, InboxActivityItem } from \"./inbox-activity\";\nimport { sessionPreviewsSchema, type SessionPreviews } from \"./session-previews\";\nexport { sessionPreviewsSchema, sessionPreviewSchema } from \"./session-previews\";\nexport type { SessionPreviews, SessionPreview } from \"./session-previews\";\nimport { sessionReviewSchema, type SessionReview } from \"./session-review\";\nexport {\n sessionReviewSchema,\n sessionReviewCheckSchema,\n sessionReviewScreenshotSchema,\n sessionReviewIssueSchema,\n} from \"./session-review\";\nexport type {\n SessionReview,\n SessionReviewCheck,\n SessionReviewScreenshot,\n SessionReviewIssue,\n} from \"./session-review\";\nimport {\n workspaceFilesRequestSchema,\n workspaceFilesSchema,\n type WorkspaceFiles,\n type WorkspaceFilesRequest,\n} from \"./workspace-files\";\nexport {\n workspacePathSchema,\n workspaceFilesRequestSchema,\n workspaceFileEntrySchema,\n workspaceFileContentSchema,\n workspaceFilesSchema,\n} from \"./workspace-files\";\nexport type { WorkspaceFilesRequest, WorkspaceFileEntry, WorkspaceFiles } from \"./workspace-files\";\nimport { intakePageSchema, intakeViewSchema, retryIntakeSchema } from \"./intake-contracts\";\nexport { describeIntake } from \"./intake-contracts\";\nexport type { IntakeView } from \"./intake-contracts\";\nimport {\n approvalPageSchema,\n approvalRequestSchema,\n approvalViewSchema,\n type ApprovalListOptions,\n type ApprovalPage,\n type ApprovalView,\n} from \"./approval-contracts\";\nexport type { ApprovalListOptions, ApprovalPage, ApprovalView } from \"./approval-contracts\";\nimport { z } from \"zod\";\nimport {\n imageAttachmentSchema,\n type ImageAttachment,\n type ImageId,\n type ImageUploadInput,\n} from \"./image-input\";\nexport {\n MAX_IMAGE_BYTES,\n MAX_IMAGES,\n imageAttachmentSchema,\n imageAttachmentsSchema,\n imageIdSchema,\n} from \"./image-input\";\nexport type { ImageAttachment, ImageId, ImageUploadInput } from \"./image-input\";\nimport {\n answerSessionQuestionRequestSchema,\n apiAgentSchema,\n controlSessionRequestSchema,\n createSessionRequestSchema,\n repositoryDetailsSchema,\n sendSessionMessageRequestSchema,\n sessionPageSchema,\n sessionViewSchema,\n submitSessionInputRequestSchema,\n type AnswerSessionQuestionRequest,\n type ApiAgent,\n type ControlSessionRequest,\n type CreateSessionRequest,\n type RepositoryDetails,\n type SendSessionMessageRequest,\n type SessionPage,\n type SessionView,\n type SubmitSessionInputRequest,\n} from \"./api-contracts\";\nimport { changeSchema } from \"./schema/change\";\nimport type { MaybePromise } from \"./schema/common\";\nimport { taskIdSchema, type RepositoryId, type TaskId } from \"./schema/id\";\nimport { repositorySlugSchema, type RepositorySlug } from \"./schema/repository\";\nimport type { AgentSessionId } from \"./schema/session\";\nimport { workspaceDiffSchema, type WorkspaceDiff } from \"./workspace-diff\";\nimport { taskSchema, taskStateSchema, type Task } from \"./schema/task\";\nimport { taskGraphViewSchema, type TaskGraphView } from \"./task-graph-view\";\nimport {\n transcriptBlockSchema,\n transcriptPageSchema,\n type TranscriptBlock,\n type TranscriptPage,\n type TranscriptSnapshot,\n} from \"./schema/transcript\";\nexport type { TaskGraphView } from \"./task-graph-view\";\n\n/** All durable Task states in their schema-defined order. */\nexport const taskStates = Object.freeze([...taskStateSchema.options]);\n\n/** Filters and pagination accepted by the session-list API. */\nexport interface SessionListOptions {\n readonly scope?: \"all\" | \"interactive\";\n readonly detail?: \"full\" | \"summary\";\n readonly limit?: number;\n readonly cursor?: string;\n readonly query?: string;\n readonly repository?: RepositorySlug;\n readonly agent?: string;\n readonly source?: \"automatic\";\n readonly state?: Task[\"state\"] | \"conversation\";\n readonly attention?: boolean;\n readonly topLevel?: boolean;\n readonly includeTotal?: boolean;\n}\n\nexport type { WorkspaceDiff, WorkspaceDiffFile } from \"./workspace-diff\";\nexport { workspaceDiffFileSchema, workspaceDiffSchema } from \"./workspace-diff\";\nexport { agentSessionIdSchema, agentSessionSchema } from \"./schema/session\";\nexport type {\n AgentSession,\n AgentSessionId,\n DirectAgentSession,\n ExternalAgentSession,\n TaskAgentSession,\n} from \"./schema/session\";\n\nexport {\n answerSessionQuestionRequestSchema,\n pendingFollowUpSchema,\n apiAgentSchema,\n controlSessionRequestSchema,\n createSessionRequestSchema,\n repositoryDetailsSchema,\n repositorySummarySchema,\n sendSessionMessageRequestSchema,\n sessionInputResponseSchema,\n sessionPageSchema,\n sessionPullRequestSchema,\n sessionPullRequestStateSchema,\n sessionWorkGroupSchema,\n sessionWorkResultSchema,\n sessionWorkTaskSchema,\n sessionViewSchema,\n submitSessionInputRequestSchema,\n} from \"./api-contracts\";\nexport type {\n AnswerSessionQuestionRequest,\n PendingFollowUp,\n ApiAgent,\n ControlSessionRequest,\n CreateSessionRequest,\n RepositoryDetails,\n RepositorySummary,\n SendSessionMessageRequest,\n SessionInputResponse,\n SessionPage,\n SessionPullRequest,\n SessionWorkGroup,\n SessionWorkResult,\n SessionWorkTask,\n SessionView,\n SubmitSessionInputRequest,\n} from \"./api-contracts\";\nexport { readEvents, streamEventSchema, type StreamEvent } from \"./client-events\";\nexport {\n Transcript,\n type InputRequest,\n type TranscriptBlock,\n type ToolCall,\n type TranscriptSnapshot,\n type TranscriptHistoryPage,\n} from \"./client-transcript\";\nexport {\n inputRequestSchema,\n toolCallSchema,\n transcriptBlockSchema,\n transcriptSnapshotSchema,\n transcriptPageSchema,\n} from \"./schema/transcript\";\nexport type { TranscriptPage, TranscriptPageQuery } from \"./schema/transcript\";\nexport {\n followSessionStream,\n loadPreviousTranscriptPage,\n expandTranscriptBlock,\n type FollowSessionStreamOptions,\n type SessionStreamClient,\n} from \"./client-stream\";\n\n/** An unsuccessful Factory API response surfaced by the browser-safe client. */\nexport class ApiError extends Error {\n constructor(\n readonly status: number,\n message: string,\n readonly actor?: string,\n ) {\n super(message);\n }\n}\n\n/** Connection and request customization for {@link FactoryClient}. */\nexport interface FactoryClientOptions {\n /**\n * Canonical Factory origin. It must be HTTPS, except for HTTP loopback development, and cannot\n * contain credentials, a path, query parameters, or a fragment.\n */\n readonly url: string;\n /**\n * Headers resolved immediately before every request, allowing short-lived authentication to be\n * refreshed. Factory always sets `content-type` to `application/json` afterward.\n */\n readonly headers?: () => MaybePromise<HeadersInit>;\n /** Fetch implementation used for every request; defaults to `globalThis.fetch`. */\n readonly fetch?: typeof globalThis.fetch;\n}\n\n/** Identifies an uploaded image and optionally controls cancellation of its download. */\nexport interface GetImageOptions {\n readonly id: ImageId;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies an operator session and the amount of detail to return. */\nexport interface GetSessionOptions {\n readonly id: AgentSessionId;\n readonly detail?: \"full\" | \"summary\";\n}\n\n/** Selects the observed execution whose review evidence should be read. */\nexport interface SessionReviewOptions {\n readonly sessionId: AgentSessionId;\n readonly executionId: string | null;\n readonly signal?: AbortSignal;\n}\n\n/** Selects the observed execution whose preview links and instructions should be read. */\nexport interface SessionPreviewsOptions {\n readonly sessionId: AgentSessionId;\n readonly executionId: string | null;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies the operator session whose canonical task graph should be read. */\nexport interface GetSessionGraphOptions {\n readonly id: AgentSessionId;\n /** Selects a Task in the bound graph or work addressed to this conversation. */\n readonly taskId?: TaskId;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies an exact task execution transcript within an operator session. */\nexport interface GraphTranscriptOptions {\n readonly sessionId: AgentSessionId;\n readonly taskId: TaskId;\n readonly executionId: string;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies a file or directory at an observed execution and optional immutable revision. */\nexport interface WorkspaceFilesOptions extends WorkspaceFilesRequest {\n readonly sessionId: AgentSessionId;\n readonly executionId: string | null;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies the execution whose committed workspace should be compared. */\nexport interface WorkspaceDiffOptions {\n readonly sessionId: AgentSessionId;\n readonly executionId: string | null;\n readonly signal?: AbortSignal;\n}\n\n/** Identifies a materialized transcript response used by the stream follower. */\nexport interface SessionTranscriptRequest {\n readonly sessionId: AgentSessionId;\n readonly executionId: string;\n readonly taskId?: TaskId;\n readonly history?: boolean;\n readonly limit?: number;\n readonly cursor?: string;\n readonly blockId?: string;\n readonly signal: AbortSignal;\n}\n\n/** Identifies a cursor-addressed event stream used by the stream follower. */\nexport interface SessionEventStreamRequest {\n readonly sessionId: AgentSessionId;\n readonly executionId: string;\n readonly cursor: number;\n readonly taskId?: TaskId;\n readonly signal: AbortSignal;\n}\n\n/**\n * Browser-safe typed client for the public Factory HTTP API.\n *\n * @remarks\n * Requests use same-origin credentials, bypass HTTP caches, and refuse redirects so authentication\n * redirects cannot be mistaken for API responses. When no caller signal is available, requests\n * time out after 30 seconds. Non-success responses throw {@link ApiError}; successful JSON bodies\n * are still validated against their public schemas before being returned.\n */\nexport class FactoryClient {\n private readonly origin: string;\n /**\n * Creates a client for one canonical Factory origin without performing a request.\n *\n * @param options - Factory origin plus optional per-request headers and fetch implementation.\n * @throws When `options.url` is not an HTTPS origin or an HTTP loopback origin.\n */\n constructor(private readonly options: FactoryClientOptions) {\n const url = new URL(options.url);\n if (\n url.username ||\n url.password ||\n url.pathname !== \"/\" ||\n url.search ||\n url.hash ||\n (url.protocol !== \"https:\" &&\n !(url.protocol === \"http:\" && [\"localhost\", \"127.0.0.1\", \"[::1]\"].includes(url.hostname)))\n ) {\n throw new Error(\"Factory URL must be an HTTPS origin, or HTTP on loopback\");\n }\n this.origin = url.origin;\n }\n\n private async response(path: string, body?: unknown, signal?: AbortSignal): Promise<Response> {\n const url = new URL(`/api/v1/${path}`, this.origin);\n if (url.origin !== this.origin || !url.pathname.startsWith(\"/api/v1/\"))\n throw new Error(\"Invalid Factory API path\");\n const headers = new Headers(await this.options.headers?.());\n headers.set(\"content-type\", \"application/json\");\n const response = await (this.options.fetch ?? globalThis.fetch)(url.href, {\n method: body === undefined ? \"GET\" : \"POST\",\n headers,\n ...(body === undefined ? {} : { body: JSON.stringify(body) }),\n credentials: \"same-origin\",\n cache: \"no-store\",\n redirect: \"manual\",\n signal: signal ?? AbortSignal.timeout(30_000),\n });\n if (response.type === \"opaqueredirect\" || [301, 302, 303, 307, 308].includes(response.status)) {\n await response.body?.cancel();\n throw new ApiError(\n response.status,\n `Factory at ${this.origin} returned a redirect. Reload to sign in, or set factory.url to the factory's canonical origin. Redirects are not followed.`,\n );\n }\n if (!response.ok) {\n const value: unknown = await response.json().catch(() => null);\n const detail =\n value !== null &&\n typeof value === \"object\" &&\n \"error\" in value &&\n typeof value.error === \"string\"\n ? value.error\n : `HTTP ${response.status}`;\n const actor =\n value !== null &&\n typeof value === \"object\" &&\n \"actor\" in value &&\n typeof value.actor === \"string\"\n ? value.actor\n : undefined;\n throw new ApiError(\n response.status,\n response.status === 401\n ? \"Authentication rejected. Reload to sign in, or run vercel login for the terminal client.\"\n : detail,\n actor,\n );\n }\n return response;\n }\n\n /** Read authorized intake and pre-task triage failures. */\n async intake(options: { repository?: string; cursor?: string; limit?: number } = {}) {\n const query = new URLSearchParams();\n for (const [key, value] of Object.entries(options))\n if (value !== undefined) query.set(key, String(value));\n return intakePageSchema.parse(await (await this.response(`intake?${query}`)).json());\n }\n\n /** Retry only the observed stopped attempt; concurrent or stale retries conflict. */\n async retryIntake(id: string, expectedAttempt: number) {\n return intakeViewSchema.parse(\n await (\n await this.response(\n `intake/${encodeURIComponent(id)}/retry`,\n retryIntakeSchema.parse({ expectedAttempt }),\n )\n ).json(),\n );\n }\n\n /** Lists approval proposals visible to the authenticated operator. */\n async listApprovals(options: ApprovalListOptions = {}): Promise<ApprovalPage> {\n const query = new URLSearchParams(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n );\n return approvalPageSchema.parse(await (await this.response(`approvals?${query}`)).json());\n }\n /** Reads one approval proposal by Task ID. */\n async getApproval(id: TaskId): Promise<ApprovalView> {\n return approvalViewSchema.parse(\n await (await this.response(`tasks/${encodeURIComponent(id)}/approval`)).json(),\n );\n }\n /** Approves one proposal, optionally recording an operator reason. */\n async approveTask(id: TaskId, reason?: string): Promise<ApprovalView> {\n return approvalViewSchema.parse(\n await (\n await this.response(\n `tasks/${encodeURIComponent(id)}/approve`,\n approvalRequestSchema.parse({ reason }),\n )\n ).json(),\n );\n }\n\n /** Rejects one proposal with the required operator reason. */\n async rejectTask(id: TaskId, reason: string): Promise<ApprovalView> {\n return approvalViewSchema.parse(\n await (\n await this.response(\n `tasks/${encodeURIComponent(id)}/reject`,\n approvalRequestSchema.parse({ reason }),\n )\n ).json(),\n );\n }\n\n /** Uploads one bounded image for use in a later message. */\n async uploadImage(input: ImageUploadInput): Promise<ImageAttachment> {\n return imageAttachmentSchema.parse(await (await this.response(\"images\", input)).json());\n }\n /** Downloads a previously uploaded image. */\n async getImage(options: GetImageOptions): Promise<Blob> {\n return (\n await this.response(`images/${encodeURIComponent(options.id)}`, undefined, options.signal)\n ).blob();\n }\n\n /** Lists agents exposed for operator session creation. */\n async listAgents(): Promise<readonly ApiAgent[]> {\n return z\n .object({ agents: z.array(apiAgentSchema).readonly() })\n .parse(await (await this.response(\"agents\")).json()).agents;\n }\n /** Reports whether the configured origin is the isolated local fixture runtime. */\n async isLocalTestRuntime(): Promise<boolean> {\n const response = await this.response(\"agents\");\n const local = response.headers.get(\"x-factory-local-test\") === \"1\";\n await response.body?.cancel();\n return local;\n }\n /** Lists configured repository slugs. */\n async listRepositories(): Promise<readonly RepositorySlug[]> {\n return z\n .object({ repositories: z.array(repositorySlugSchema).readonly() })\n .parse(await (await this.response(\"repositories\")).json()).repositories;\n }\n /** Reads repository slugs together with their stable configured identifiers. */\n async getRepositoryDetails(): Promise<RepositoryDetails> {\n return repositoryDetailsSchema.parse(await (await this.response(\"repositories\")).json());\n }\n /** Reads one bounded page of open Changes, optionally scoped to a repository. */\n async getChangePage(\n options: { repository?: RepositorySlug; limit?: number; cursor?: string } = {},\n ) {\n const query = new URLSearchParams(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n );\n return z\n .object({ changes: z.array(changeSchema).readonly(), nextCursor: z.string().nullable() })\n .parse(await (await this.response(`changes?${query}`)).json());\n }\n /** Reads one bounded page of canonical Tasks authorized for the caller. */\n async getTaskPage(options: { limit?: number; cursor?: string } = {}) {\n const query = new URLSearchParams(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n );\n return z\n .object({ tasks: z.array(taskSchema).readonly(), nextCursor: z.string().nullable() })\n .parse(await (await this.response(`tasks?${query}`)).json());\n }\n /**\n * Lists sessions matching the requested operator scope without pagination metadata.\n *\n * @param options - Optional scope and detail projection; both use their server defaults when omitted.\n * @returns The first matching page's sessions. Use {@link getSessionPage} to follow cursors.\n */\n async listSessions(\n options: Pick<SessionListOptions, \"scope\" | \"detail\"> = {},\n ): Promise<readonly SessionSummary[]> {\n return (await this.getSessionPage(options)).sessions;\n }\n /**\n * Reads a filtered, cursor-paginated page of sessions.\n *\n * @param options - Filters, cursor, projection detail, and page limit sent to the API.\n * @returns The validated page, including its continuation cursor and optional total count.\n */\n async getSessionPage(options: SessionListOptions = {}): Promise<SessionPage> {\n const query = new URLSearchParams(\n Object.entries(options)\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)]),\n ).toString();\n return sessionPageSchema.parse(\n await (await this.response(`sessions${query ? `?${query}` : \"\"}`)).json(),\n );\n }\n /** Reads application-owned external work requiring operator attention. */\n async getInboxActivity(): Promise<InboxActivity> {\n return inboxActivitySchema.parse(await (await this.response(\"inbox-activity\")).json());\n }\n /** Reads application model choices and optional repository defaults. */\n async getModelSettings(repository?: RepositorySlug): Promise<ModelSettings> {\n const query = repository ? `?${new URLSearchParams({ repository })}` : \"\";\n return modelSettingsSchema.parse(await (await this.response(`models${query}`)).json());\n }\n /** Saves repository defaults only when their observed revision still matches. */\n async updateModelDefaults(input: UpdateModelDefaults): Promise<ModelSettings> {\n return modelSettingsSchema.parse(\n await (await this.response(\"models\", updateModelDefaultsSchema.parse(input))).json(),\n );\n }\n /** Counts sessions that currently require operator attention. */\n async getInboxCount(): Promise<number> {\n const result = z\n .object({ totalCount: z.number().int().nonnegative().optional() })\n .parse(\n await (\n await this.response(\n \"sessions?scope=all&detail=summary&attention=true&includeTotal=true&limit=1\",\n )\n ).json(),\n );\n if (result.totalCount === undefined)\n throw new Error(\"This factory's access policy does not provide an exact attention count\");\n return result.totalCount;\n }\n /** Reads a summary batch for the provided session IDs. */\n async getSessionBatch(ids: readonly AgentSessionId[]): Promise<readonly SessionSummary[]> {\n if (ids.length === 0) return [];\n const query = new URLSearchParams({ ids: ids.join(\",\"), detail: \"summary\" });\n return z\n .object({ sessions: z.array(sessionSummarySchema).readonly() })\n .parse(await (await this.response(`sessions?${query}`)).json()).sessions;\n }\n /** Reads one earlier page of authorized provider executions. */\n async getSessionHistory(\n id: AgentSessionId,\n options: { cursor?: string; signal?: AbortSignal } = {},\n ) {\n const query = new URLSearchParams({\n limit: \"20\",\n ...(options.cursor ? { cursor: options.cursor } : {}),\n });\n return z\n .object({\n items: sessionViewSchema.shape.history.unwrap(),\n nextCursor: z.string().nullable(),\n })\n .parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(id)}/history?${query}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads one earlier page of delivered conversation notifications. */\n async getSessionNotifications(\n id: AgentSessionId,\n options: { cursor?: string; signal?: AbortSignal } = {},\n ) {\n const query = new URLSearchParams({\n limit: \"30\",\n ...(options.cursor ? { cursor: options.cursor } : {}),\n });\n return z\n .object({ items: sessionViewSchema.shape.notifications, nextCursor: z.string().nullable() })\n .parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(id)}/notifications?${query}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads one bounded page of related Tasks authorized for this conversation. */\n async getSessionRelatedTasks(\n id: AgentSessionId,\n options: { cursor?: string; signal?: AbortSignal } = {},\n ) {\n const query = new URLSearchParams({\n limit: \"30\",\n ...(options.cursor ? { cursor: options.cursor } : {}),\n });\n return z\n .object({\n items: sessionViewSchema.shape.relatedTasks.unwrap(),\n nextCursor: z.string().nullable(),\n })\n .parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(id)}/related-tasks?${query}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /**\n * Reads one operator session.\n *\n * @param options - Stable session ID and optional summary or full projection.\n * @returns The current validated session view; it is a snapshot and does not follow live events.\n */\n async getSession(options: GetSessionOptions): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.id)}${options.detail ? `?detail=${options.detail}` : \"\"}`,\n )\n ).json(),\n );\n }\n /** Reads the canonical task graph projected for one session. */\n async getSessionGraph(options: GetSessionGraphOptions): Promise<TaskGraphView> {\n return taskGraphViewSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.id)}/graph${options.taskId ? `?${new URLSearchParams({ taskId: options.taskId })}` : \"\"}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads the materialized transcript for one exact graph task execution. */\n async getGraphTranscript(options: GraphTranscriptOptions): Promise<TranscriptSnapshot> {\n const query = new URLSearchParams({\n taskId: options.taskId,\n executionId: options.executionId,\n });\n return transcriptPageSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/graph-transcript?${query}`,\n undefined,\n options.signal,\n )\n ).json(),\n ).snapshot;\n }\n /** Refreshes a session summary and reloads its history when the active execution changes. */\n async refreshSession(previous: SessionView): Promise<SessionView> {\n const current = await this.getSession({ id: previous.session.id, detail: \"summary\" });\n if (\n current.task?.id !== previous.task?.id ||\n current.execution?.sessionId !== previous.execution?.sessionId ||\n current.execution?.provider !== previous.execution?.provider\n )\n return this.getSession({ id: previous.session.id });\n if (\n current.session.latestNotificationId !== previous.session.latestNotificationId ||\n current.task?.updatedAt !== previous.task?.updatedAt ||\n current.statusRevision !== previous.statusRevision\n ) {\n const fresh = await this.getSession({ id: previous.session.id });\n if (\n fresh.task?.id !== previous.task?.id ||\n fresh.execution?.sessionId !== previous.execution?.sessionId ||\n fresh.execution?.provider !== previous.execution?.provider\n )\n return fresh;\n return {\n ...fresh,\n history: [\n ...new Map(\n [...(previous.history ?? []), ...(fresh.history ?? [])].map((entry) => [\n JSON.stringify(entry.execution),\n entry,\n ]),\n ).values(),\n ],\n historyNextCursor:\n (previous.history?.length ?? 0) > (fresh.history?.length ?? 0)\n ? previous.historyNextCursor\n : fresh.historyNextCursor,\n notifications: [\n ...new Map(\n [...previous.notifications, ...fresh.notifications].map((entry) => [\n entry.eventId,\n entry,\n ]),\n ).values(),\n ],\n notificationsNextCursor:\n previous.notifications.length > fresh.notifications.length\n ? previous.notificationsNextCursor\n : fresh.notificationsNextCursor,\n relatedTasks: [\n ...new Map(\n [\n ...(fresh.relatedTasks ?? []),\n ...(previous.relatedTasks ?? []).filter(\n (entry) => !fresh.relatedTasks?.some((current) => current.id === entry.id),\n ),\n ].map((entry) => [entry.id, entry]),\n ).values(),\n ],\n relatedTasksNextCursor:\n (previous.relatedTasks?.length ?? 0) > (fresh.relatedTasks?.length ?? 0)\n ? previous.relatedTasksNextCursor\n : fresh.relatedTasksNextCursor,\n };\n }\n return {\n ...current,\n workGroups: previous.workGroups,\n history: previous.history,\n historyNextCursor: previous.historyNextCursor,\n notifications: previous.notifications,\n notificationsNextCursor: previous.notificationsNextCursor,\n relatedTasks: previous.relatedTasks,\n relatedTasksNextCursor: previous.relatedTasksNextCursor,\n };\n }\n /** Reads application-owned previews without starting an agent, deployment, or server. */\n async getSessionPreviews(options: SessionPreviewsOptions): Promise<SessionPreviews> {\n return sessionPreviewsSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/previews?${new URLSearchParams({ executionId: options.executionId ?? \"\" })}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads recorded checks, screenshots, and issues through the application's review reader. */\n async getSessionReview(options: SessionReviewOptions): Promise<SessionReview> {\n return sessionReviewSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/review?${new URLSearchParams({ executionId: options.executionId ?? \"\" })}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads a directory or complete file through the factory's configured workspace adapter. */\n async getWorkspaceFiles(options: WorkspaceFilesOptions): Promise<WorkspaceFiles> {\n const query = workspaceFilesRequestSchema.parse({\n path: options.path,\n revision: options.revision,\n });\n const params = new URLSearchParams({\n executionId: options.executionId ?? \"\",\n path: query.path,\n });\n if (query.revision !== undefined) params.set(\"revision\", query.revision);\n return workspaceFilesSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/files?${params}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /** Reads the committed workspace comparison for one observed execution. */\n async getWorkspaceDiff(options: WorkspaceDiffOptions): Promise<WorkspaceDiff> {\n return workspaceDiffSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(options.sessionId)}/diff?${new URLSearchParams({ executionId: options.executionId ?? \"\" })}`,\n undefined,\n options.signal,\n )\n ).json(),\n );\n }\n /**\n * Creates or recovers an idempotent conversational session.\n *\n * @remarks\n * Retain `input.operationId` unchanged across ambiguous failures. Reusing it with identical input\n * returns the original session; reusing it with different input is a conflict. The returned view\n * means admission and any initial dispatch attempt finished, not that the agent's work completed.\n *\n * @param input - Agent, initial content, optional repository/change, and client idempotency key.\n * @returns The admitted or recovered session snapshot.\n */\n async createSession(input: CreateSessionRequest): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (await this.response(\"sessions\", createSessionRequestSchema.parse(input))).json(),\n );\n }\n\n /** Creates or recovers idempotent workflow work through a specialist signal. */\n async createSignal(input: CreateSessionRequest): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (await this.response(\"signals\", createSessionRequestSchema.parse(input))).json(),\n );\n }\n\n /** Starts a deepsec security scan of a repository, or returns its already-active scan. */\n async runSecurityScan(repositoryId: RepositoryId): Promise<{ taskId: TaskId; reused: boolean }> {\n return z\n .strictObject({ taskId: taskIdSchema, reused: z.boolean() })\n .parse(await (await this.response(`repositories/${repositoryId}/security-scan`, {})).json());\n }\n\n /**\n * Sends a message to an existing session using optimistic execution matching.\n *\n * @remarks\n * `input.executionId` must be the execution the caller observed, or `null` when none was active.\n * A completed Task follow-up also requires an `operationId`, which must be retained for retries.\n * Resolving means the API accepted the message; provider or follow-up work may still be running.\n *\n * @param id - Stable Factory session receiving the message.\n * @param input - Message, observed execution, steering policy, attachments, and optional retry key.\n * @returns Nothing after the API accepts the request.\n */\n async sendSessionMessage(id: AgentSessionId, input: SendSessionMessageRequest): Promise<void> {\n const response = await this.response(\n `sessions/${encodeURIComponent(id)}/messages`,\n sendSessionMessageRequestSchema.parse(input),\n );\n await response.body?.cancel();\n }\n\n /**\n * Submits responses to pending provider input requests.\n *\n * @param id - Stable Factory session whose provider requested input.\n * @param input - Observed execution ID and one or more request-correlated responses.\n * @returns Nothing after the API accepts the responses; stale execution IDs are rejected.\n */\n async submitSessionInput(id: AgentSessionId, input: SubmitSessionInputRequest): Promise<void> {\n const response = await this.response(\n `sessions/${encodeURIComponent(id)}/input`,\n submitSessionInputRequestSchema.parse(input),\n );\n await response.body?.cancel();\n }\n\n /**\n * Attempts to dispatch queued workflow work associated with a session.\n *\n * @param id - Stable Factory session whose current work should be dispatched.\n * @returns The refreshed session after the bounded dispatch attempt, which may still be queued.\n */\n async dispatchSession(id: AgentSessionId): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (await this.response(`sessions/${encodeURIComponent(id)}/dispatch`, {})).json(),\n );\n }\n\n /** Answers a workflow question associated with a session. */\n async answerSessionQuestion(\n id: AgentSessionId,\n input: AnswerSessionQuestionRequest,\n ): Promise<SessionView> {\n return sessionViewSchema.parse(\n await (\n await this.response(\n `sessions/${encodeURIComponent(id)}/answer`,\n answerSessionQuestionRequestSchema.parse(input),\n )\n ).json(),\n );\n }\n\n /** Cooperatively interrupts the currently observed turn. */\n async interruptSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"interrupt\", input);\n }\n\n /** Cancels active workflow and provider work in a session. */\n async cancelSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"cancel\", input);\n }\n\n /** Compacts the provider context for a session. */\n async compactSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"compact\", input);\n }\n\n /** Clears the provider context for a session. */\n async clearSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"clear\", input);\n }\n\n /** Resets a session after cancelling its active work. */\n async resetSession(id: AgentSessionId, input: ControlSessionRequest = {}): Promise<void> {\n return this.controlSession(id, \"reset\", input);\n }\n\n /** Reads a materialized transcript as a raw HTTP response for incremental following. */\n async getSessionTranscriptResponse(input: SessionTranscriptRequest): Promise<Response> {\n const query = new URLSearchParams({ executionId: input.executionId });\n if (input.history === true) query.set(\"history\", \"1\");\n if (input.taskId !== undefined) query.set(\"taskId\", input.taskId);\n if (input.limit !== undefined) query.set(\"limit\", String(input.limit));\n if (input.cursor !== undefined) query.set(\"cursor\", input.cursor);\n if (input.blockId !== undefined) query.set(\"blockId\", input.blockId);\n return this.response(\n `sessions/${encodeURIComponent(input.sessionId)}/${input.taskId ? \"graph-transcript\" : \"transcript\"}?${query}`,\n undefined,\n input.signal,\n );\n }\n\n /** Reads one bounded page of saved transcript history from Factory storage. */\n async getTranscriptPage(\n input: Omit<SessionTranscriptRequest, \"blockId\">,\n ): Promise<TranscriptPage> {\n return transcriptPageSchema.parse(\n await (await this.getSessionTranscriptResponse(input)).json(),\n );\n }\n\n /** Expands one large transcript block after authorizing its session and execution. */\n async getTranscriptBlock(\n input: Omit<SessionTranscriptRequest, \"limit\" | \"cursor\"> & { readonly blockId: string },\n ): Promise<TranscriptBlock> {\n return transcriptBlockSchema.parse(\n await (await this.getSessionTranscriptResponse(input)).json(),\n );\n }\n\n /** Opens a cursor-addressed session event stream as a raw HTTP response. */\n async getSessionEventStreamResponse(input: SessionEventStreamRequest): Promise<Response> {\n const query = new URLSearchParams({\n executionId: input.executionId,\n startIndex: String(input.cursor),\n });\n if (input.taskId !== undefined) query.set(\"taskId\", input.taskId);\n return this.response(\n `sessions/${encodeURIComponent(input.sessionId)}/${input.taskId ? \"graph-stream\" : \"stream\"}?${query}`,\n undefined,\n input.signal,\n );\n }\n\n private async controlSession(\n id: AgentSessionId,\n action: \"interrupt\" | \"cancel\" | \"compact\" | \"clear\" | \"reset\",\n input: ControlSessionRequest,\n ): Promise<void> {\n const response = await this.response(\n `sessions/${encodeURIComponent(id)}/${action}`,\n controlSessionRequestSchema.parse(input),\n );\n await response.body?.cancel();\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmHA,MAAa,aAAa,OAAO,OAAO,CAAC,GAAG,gBAAgB,OAAO,CAAC;;AA4FpE,IAAa,WAAb,cAA8B,MAAM;CAEvB;CAEA;CAHX,YACE,QACA,SACA,OACA;EACA,MAAM,OAAO;EAJJ,KAAA,SAAA;EAEA,KAAA,QAAA;CAGX;AACF;;;;;;;;;;AAwGA,IAAa,gBAAb,MAA2B;CAQI;CAP7B;;;;;;;CAOA,YAAY,SAAgD;EAA/B,KAAA,UAAA;EAC3B,MAAM,MAAM,IAAI,IAAI,QAAQ,GAAG;EAC/B,IACE,IAAI,YACJ,IAAI,YACJ,IAAI,aAAa,OACjB,IAAI,UACJ,IAAI,QACH,IAAI,a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skExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
60
60
|
session: Pick<SessionContext["session"], "id" | "auth">;
|
|
61
61
|
}, requestedTaskId: TaskId): Promise<({
|
|
62
62
|
id: `task_${string}`;
|
|
63
|
+
origin: {
|
|
64
|
+
signalId?: `sig_${string}` | undefined;
|
|
65
|
+
operator?: string | undefined;
|
|
66
|
+
};
|
|
63
67
|
schemaVersion: 1;
|
|
64
68
|
replyTo: {
|
|
65
69
|
channel: string;
|
|
@@ -73,10 +77,6 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
73
77
|
model?: string | undefined;
|
|
74
78
|
area?: string | undefined;
|
|
75
79
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
76
|
-
origin: {
|
|
77
|
-
signalId?: `sig_${string}` | undefined;
|
|
78
|
-
operator?: string | undefined;
|
|
79
|
-
};
|
|
80
80
|
work: {
|
|
81
81
|
title: string;
|
|
82
82
|
input: JsonValue;
|
|
@@ -136,6 +136,10 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
136
136
|
parentTaskId?: `task_${string}`;
|
|
137
137
|
}) | ({
|
|
138
138
|
id: `task_${string}`;
|
|
139
|
+
origin: {
|
|
140
|
+
signalId?: `sig_${string}` | undefined;
|
|
141
|
+
operator?: string | undefined;
|
|
142
|
+
};
|
|
139
143
|
schemaVersion: 1;
|
|
140
144
|
replyTo: {
|
|
141
145
|
channel: string;
|
|
@@ -149,10 +153,6 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
149
153
|
model?: string | undefined;
|
|
150
154
|
area?: string | undefined;
|
|
151
155
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
152
|
-
origin: {
|
|
153
|
-
signalId?: `sig_${string}` | undefined;
|
|
154
|
-
operator?: string | undefined;
|
|
155
|
-
};
|
|
156
156
|
work: {
|
|
157
157
|
title: string;
|
|
158
158
|
input: JsonValue;
|
|
@@ -218,6 +218,10 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
218
218
|
parentTaskId?: `task_${string}`;
|
|
219
219
|
}) | ({
|
|
220
220
|
id: `task_${string}`;
|
|
221
|
+
origin: {
|
|
222
|
+
signalId?: `sig_${string}` | undefined;
|
|
223
|
+
operator?: string | undefined;
|
|
224
|
+
};
|
|
221
225
|
schemaVersion: 1;
|
|
222
226
|
replyTo: {
|
|
223
227
|
channel: string;
|
|
@@ -231,10 +235,6 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
231
235
|
model?: string | undefined;
|
|
232
236
|
area?: string | undefined;
|
|
233
237
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
234
|
-
origin: {
|
|
235
|
-
signalId?: `sig_${string}` | undefined;
|
|
236
|
-
operator?: string | undefined;
|
|
237
|
-
};
|
|
238
238
|
work: {
|
|
239
239
|
title: string;
|
|
240
240
|
input: JsonValue;
|
|
@@ -300,6 +300,10 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
300
300
|
parentTaskId: `task_${string}`;
|
|
301
301
|
}) | ({
|
|
302
302
|
id: `task_${string}`;
|
|
303
|
+
origin: {
|
|
304
|
+
signalId?: `sig_${string}` | undefined;
|
|
305
|
+
operator?: string | undefined;
|
|
306
|
+
};
|
|
303
307
|
schemaVersion: 1;
|
|
304
308
|
replyTo: {
|
|
305
309
|
channel: string;
|
|
@@ -313,10 +317,6 @@ declare function requireTaskExecution(stores: Pick<FactoryStores, "tasks">, ctx:
|
|
|
313
317
|
model?: string | undefined;
|
|
314
318
|
area?: string | undefined;
|
|
315
319
|
approval?: "required" | "granted" | "denied" | undefined;
|
|
316
|
-
origin: {
|
|
317
|
-
signalId?: `sig_${string}` | undefined;
|
|
318
|
-
operator?: string | undefined;
|
|
319
|
-
};
|
|
320
320
|
work: {
|
|
321
321
|
title: string;
|
|
322
322
|
input: JsonValue;
|
package/dist/github.d.mts
CHANGED
|
@@ -65,6 +65,10 @@ interface GitHubRepositoryRequest {
|
|
|
65
65
|
interface GitHubPullRequestTarget extends GitHubRepositoryRequest {
|
|
66
66
|
pullRequestNumber: number;
|
|
67
67
|
}
|
|
68
|
+
/** Repository-scoped identity of one GitHub issue. */
|
|
69
|
+
interface GitHubIssueTarget extends GitHubRepositoryRequest {
|
|
70
|
+
issueNumber: number;
|
|
71
|
+
}
|
|
68
72
|
/** Provider-owned number and URL that identify one GitHub pull request. */
|
|
69
73
|
interface GitHubPullRequestReference {
|
|
70
74
|
pullRequestNumber: number;
|
|
@@ -190,6 +194,12 @@ type ListPullRequestCommentsInput = GitHubPullRequestTarget;
|
|
|
190
194
|
interface CreatePullRequestCommentInput extends ListPullRequestCommentsInput {
|
|
191
195
|
body: string;
|
|
192
196
|
}
|
|
197
|
+
/** Repository issue whose comments should be listed. */
|
|
198
|
+
type ListIssueCommentsInput = GitHubIssueTarget;
|
|
199
|
+
/** Repository issue and body for a new comment. */
|
|
200
|
+
interface CreateIssueCommentInput extends GitHubIssueTarget {
|
|
201
|
+
body: string;
|
|
202
|
+
}
|
|
193
203
|
/** Existing issue-style comment and replacement body to persist. */
|
|
194
204
|
interface UpdatePullRequestCommentInput extends GitHubRepositoryRequest {
|
|
195
205
|
commentId: number;
|
|
@@ -199,6 +209,10 @@ interface UpdatePullRequestCommentInput extends GitHubRepositoryRequest {
|
|
|
199
209
|
interface PullRequestLabelInput extends GitHubPullRequestTarget {
|
|
200
210
|
label: string;
|
|
201
211
|
}
|
|
212
|
+
/** Repository issue and label targeted by a metadata-only label operation. */
|
|
213
|
+
interface IssueLabelInput extends GitHubIssueTarget {
|
|
214
|
+
label: string;
|
|
215
|
+
}
|
|
202
216
|
/** Repository label to create when absent, retaining any existing color and description. */
|
|
203
217
|
interface EnsureGitHubLabelInput extends GitHubRepositoryRequest {
|
|
204
218
|
name: string;
|
|
@@ -320,10 +334,14 @@ declare function updateCheckRun(input: UpdateCheckRunInput): Promise<GitHubCheck
|
|
|
320
334
|
declare function listCheckRunsForRef(input: ListCheckRunsForRefInput): Promise<readonly GitHubCheckRun[]>;
|
|
321
335
|
/** List every issue-style comment in a pull request conversation. */
|
|
322
336
|
declare function listPullRequestComments(input: ListPullRequestCommentsInput): Promise<readonly GitHubIssueComment[]>;
|
|
337
|
+
/** List issue comments with a ten-page bound so reconciliation never scans without limit. */
|
|
338
|
+
declare function listIssueComments(input: ListIssueCommentsInput): Promise<readonly GitHubIssueComment[]>;
|
|
323
339
|
/** Read a page of all PR discussion types without treating any author's text as authorization. */
|
|
324
340
|
declare function listPullRequestDiscussion(input: ListPullRequestDiscussionInput): Promise<GitHubPullRequestDiscussionPage>;
|
|
325
341
|
/** Add one issue-style comment to a pull request conversation. */
|
|
326
342
|
declare function createPullRequestComment(input: CreatePullRequestCommentInput): Promise<GitHubIssueComment>;
|
|
343
|
+
/** Add one issue comment and return GitHub's persisted identity. */
|
|
344
|
+
declare function createIssueComment(input: CreateIssueCommentInput): Promise<GitHubIssueComment>;
|
|
327
345
|
/** Edit one issue-style pull request comment. */
|
|
328
346
|
declare function updatePullRequestComment(input: UpdatePullRequestCommentInput): Promise<GitHubIssueComment>;
|
|
329
347
|
/** One issue comment as GitHub reports it, with the issue it belongs to. */
|
|
@@ -358,6 +376,8 @@ declare function listOpenPullRequests(input: ListOpenPullRequestsInput): Promise
|
|
|
358
376
|
declare function ensureGitHubLabel(input: EnsureGitHubLabelInput): Promise<void>;
|
|
359
377
|
/** Add one label to a pull request. */
|
|
360
378
|
declare function addLabel(input: PullRequestLabelInput): Promise<readonly string[]>;
|
|
379
|
+
/** Add one existing repository label to an issue. */
|
|
380
|
+
declare function addIssueLabel(input: IssueLabelInput): Promise<readonly string[]>;
|
|
361
381
|
/** Remove one label from a pull request. */
|
|
362
382
|
declare function removeLabel(input: PullRequestLabelInput): Promise<readonly string[]>;
|
|
363
383
|
/** Raw payload, shared secret, and provider signature used for webhook verification. */
|
|
@@ -450,5 +470,5 @@ declare function normalizeGitHubPullRequestClosed(options: WebhookEvent): GitHub
|
|
|
450
470
|
/** Normalize a completed, unsuccessful GitHub Actions run into a CI failure signal. */
|
|
451
471
|
declare function normalizeGitHubWorkflowRunFailure(options: WebhookEvent): GitHubCiFailureSignal | null;
|
|
452
472
|
//#endregion
|
|
453
|
-
export { AnswerReviewCommentInput, CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunFields, CheckRunOutput, CheckRunProgressStatus, type CheckoutGitHubRepositoryInput, type CommittedGitChange, CompletedCheckRunFields, ConfiguredEventRepositoryInput, ConflictedGitHubPullRequest, CreateCheckRunInput, type CreateGitHubBranchInput, type CreateGitHubCommitInput, type CreateGitHubPublicationPullRequestInput, type CreateGitHubTreeInput, CreatePullRequestCommentInput, CreatePullRequestInput, type CreatedGitHubPublicationPullRequest, CreatedGitHubPullRequest, EnsureGitHubLabelInput, FactoryMentionOptions, FactoryQuestionReply, FactoryReviewComment, type FetchGitHubBundleInput, type FetchGitHubRefsInput, type GitHubAppFactoryInput, type GitHubAppInstallationToken, type GitHubAppLike, type GitHubAppPermissions, GitHubCheckRun, GitHubCheckoutConflictError, GitHubCiFailureSignal, type GitHubCommit, GitHubDefaultBranchPush, type GitHubGitTransport, GitHubIssueComment, GitHubIssueCommentRecord, GitHubIssueSignal, GitHubPublicationApiError, type GitHubPublicationClient, type GitHubPublicationClientOptions, type GitHubPublicationLimits, type GitHubPublicationPullRequest, GitHubPullRequest, GitHubPullRequestClosed, GitHubPullRequestDiscussionComment, GitHubPullRequestDiscussionPage, GitHubPullRequestDiscussionReview, GitHubPullRequestHead, GitHubPullRequestReference, GitHubPullRequestSignal, GitHubPullRequestTarget, type GitHubRefMapping, GitHubRepositoryAuthorRequest, type GitHubRepositoryBundle, GitHubRepositoryRequest, GitHubReviewComment, GitHubReviewCommentAuthorError, type GitHubTreeDeletion, type GitHubTreeEntry, type GitHubTreeUpsert, type GitTransferSandbox, IncompleteCheckRunFields, ListCheckRunsForRefInput, ListConflictedPullRequestsInput, type ListGitHubPublicationPullRequestsInput, ListOpenPullRequestsInput, ListPullRequestCommentsInput, ListPullRequestDiscussionInput, type MarkGitHubPullRequestReadyInput, type MintGitHubAppInstallationTokenInput, NormalizeFactoryCommentInput, NormalizeFactoryReviewCommentInput, ObservedCheckRunStatus, PullRequestLabelInput, PullRequestReviewComment, PullRequestReviewEvent, type PushGitHubBundleInput, type PushGitHubHeadInput, type ReadCommittedGitChangeInput, type ReadGitHubBranchHeadInput, type ReadGitHubCommitInput, type ReadGitHubPullRequestInput, type ReadGitTransferFileInput, ReadReviewCommentInput, ReviewCommentAuthorPolicy, type RunSandboxGitInput, type SandboxGit, type SandboxGitCommandInput, type SandboxGitCommandResult, StalePullRequestHeadError, SubmitPullRequestReviewInput, SubmittedPullRequestReview, UpdateCheckRunInput, type UpdateGitHubBranchInput, UpdatePullRequestCommentInput, VerifyGitHubSignatureInput, type WithSandboxGitBundleInput, type WriteGitTransferFileInput, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
473
|
+
export { AnswerReviewCommentInput, CheckRunAnnotation, CheckRunAnnotationLevel, CheckRunConclusion, CheckRunFields, CheckRunOutput, CheckRunProgressStatus, type CheckoutGitHubRepositoryInput, type CommittedGitChange, CompletedCheckRunFields, ConfiguredEventRepositoryInput, ConflictedGitHubPullRequest, CreateCheckRunInput, type CreateGitHubBranchInput, type CreateGitHubCommitInput, type CreateGitHubPublicationPullRequestInput, type CreateGitHubTreeInput, CreateIssueCommentInput, CreatePullRequestCommentInput, CreatePullRequestInput, type CreatedGitHubPublicationPullRequest, CreatedGitHubPullRequest, EnsureGitHubLabelInput, FactoryMentionOptions, FactoryQuestionReply, FactoryReviewComment, type FetchGitHubBundleInput, type FetchGitHubRefsInput, type GitHubAppFactoryInput, type GitHubAppInstallationToken, type GitHubAppLike, type GitHubAppPermissions, GitHubCheckRun, GitHubCheckoutConflictError, GitHubCiFailureSignal, type GitHubCommit, GitHubDefaultBranchPush, type GitHubGitTransport, GitHubIssueComment, GitHubIssueCommentRecord, GitHubIssueSignal, GitHubIssueTarget, GitHubPublicationApiError, type GitHubPublicationClient, type GitHubPublicationClientOptions, type GitHubPublicationLimits, type GitHubPublicationPullRequest, GitHubPullRequest, GitHubPullRequestClosed, GitHubPullRequestDiscussionComment, GitHubPullRequestDiscussionPage, GitHubPullRequestDiscussionReview, GitHubPullRequestHead, GitHubPullRequestReference, GitHubPullRequestSignal, GitHubPullRequestTarget, type GitHubRefMapping, GitHubRepositoryAuthorRequest, type GitHubRepositoryBundle, GitHubRepositoryRequest, GitHubReviewComment, GitHubReviewCommentAuthorError, type GitHubTreeDeletion, type GitHubTreeEntry, type GitHubTreeUpsert, type GitTransferSandbox, IncompleteCheckRunFields, IssueLabelInput, ListCheckRunsForRefInput, ListConflictedPullRequestsInput, type ListGitHubPublicationPullRequestsInput, ListIssueCommentsInput, ListOpenPullRequestsInput, ListPullRequestCommentsInput, ListPullRequestDiscussionInput, type MarkGitHubPullRequestReadyInput, type MintGitHubAppInstallationTokenInput, NormalizeFactoryCommentInput, NormalizeFactoryReviewCommentInput, ObservedCheckRunStatus, PullRequestLabelInput, PullRequestReviewComment, PullRequestReviewEvent, type PushGitHubBundleInput, type PushGitHubHeadInput, type ReadCommittedGitChangeInput, type ReadGitHubBranchHeadInput, type ReadGitHubCommitInput, type ReadGitHubPullRequestInput, type ReadGitTransferFileInput, ReadReviewCommentInput, ReviewCommentAuthorPolicy, type RunSandboxGitInput, type SandboxGit, type SandboxGitCommandInput, type SandboxGitCommandResult, StalePullRequestHeadError, SubmitPullRequestReviewInput, SubmittedPullRequestReview, UpdateCheckRunInput, type UpdateGitHubBranchInput, UpdatePullRequestCommentInput, VerifyGitHubSignatureInput, type WithSandboxGitBundleInput, type WriteGitTransferFileInput, addIssueLabel, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createIssueComment, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listIssueComments, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
454
474
|
//# sourceMappingURL=github.d.mts.map
|
package/dist/github.mjs
CHANGED
|
@@ -311,6 +311,16 @@ async function listPullRequestComments(input) {
|
|
|
311
311
|
if (response.length < 100) return comments;
|
|
312
312
|
}
|
|
313
313
|
}
|
|
314
|
+
/** List issue comments with a ten-page bound so reconciliation never scans without limit. */
|
|
315
|
+
async function listIssueComments(input) {
|
|
316
|
+
const comments = [];
|
|
317
|
+
for (let page = 1; page <= 10; page += 1) {
|
|
318
|
+
const response = z.array(issueCommentSchema).max(100).parse(await gitHubRequest(input, `/issues/${positiveInteger(input.issueNumber, "issueNumber")}/comments?per_page=100&page=${page}`));
|
|
319
|
+
comments.push(...response.map(parseIssueComment));
|
|
320
|
+
if (response.length < 100) return comments;
|
|
321
|
+
}
|
|
322
|
+
throw new Error("Issue comment lookup is incomplete after ten pages");
|
|
323
|
+
}
|
|
314
324
|
/** Read a page of all PR discussion types without treating any author's text as authorization. */
|
|
315
325
|
async function listPullRequestDiscussion(input) {
|
|
316
326
|
const page = z.number().int().positive().parse(input.page ?? 1);
|
|
@@ -363,6 +373,13 @@ async function createPullRequestComment(input) {
|
|
|
363
373
|
body: JSON.stringify({ body: input.body })
|
|
364
374
|
}));
|
|
365
375
|
}
|
|
376
|
+
/** Add one issue comment and return GitHub's persisted identity. */
|
|
377
|
+
async function createIssueComment(input) {
|
|
378
|
+
return parseIssueComment(await gitHubRequest(input, `/issues/${positiveInteger(input.issueNumber, "issueNumber")}/comments`, {
|
|
379
|
+
method: "POST",
|
|
380
|
+
body: JSON.stringify({ body: input.body })
|
|
381
|
+
}));
|
|
382
|
+
}
|
|
366
383
|
/** Edit one issue-style pull request comment. */
|
|
367
384
|
async function updatePullRequestComment(input) {
|
|
368
385
|
return parseIssueComment(await gitHubRequest(input, `/issues/comments/${positiveInteger(input.commentId, "commentId")}`, {
|
|
@@ -557,6 +574,13 @@ async function addLabel(input) {
|
|
|
557
574
|
body: JSON.stringify({ labels: [input.label] })
|
|
558
575
|
}));
|
|
559
576
|
}
|
|
577
|
+
/** Add one existing repository label to an issue. */
|
|
578
|
+
async function addIssueLabel(input) {
|
|
579
|
+
return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.issueNumber, "issueNumber")}/labels`, {
|
|
580
|
+
method: "POST",
|
|
581
|
+
body: JSON.stringify({ labels: [input.label] })
|
|
582
|
+
}));
|
|
583
|
+
}
|
|
560
584
|
/** Remove one label from a pull request. */
|
|
561
585
|
async function removeLabel(input) {
|
|
562
586
|
return parseLabels(await gitHubRequest(input, `/issues/${positiveInteger(input.pullRequestNumber, "pullRequestNumber")}/labels/${encodeURIComponent(input.label)}`, { method: "DELETE" }));
|
|
@@ -902,6 +926,6 @@ function normalizeGitHubWorkflowRunFailure(options) {
|
|
|
902
926
|
};
|
|
903
927
|
}
|
|
904
928
|
//#endregion
|
|
905
|
-
export { GitHubCheckoutConflictError, GitHubPublicationApiError, GitHubReviewCommentAuthorError, StalePullRequestHeadError, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
929
|
+
export { GitHubCheckoutConflictError, GitHubPublicationApiError, GitHubReviewCommentAuthorError, StalePullRequestHeadError, addIssueLabel, addLabel, answerReviewComment, checkoutGitHubRepository, closePullRequest, configuredEventRepositorySlug, createCheckRun, createGitHubPublicationClient, createIssueComment, createPullRequest, createPullRequestComment, ensureGitHubLabel, factorySessionBranch, factoryTaskBranch, hasGitHubRepositoryWriteAccess, isSafeGitRef, listCheckRunsForRef, listConflictedPullRequests, listIssueComments, listOpenPullRequests, listPullRequestComments, listPullRequestDiscussion, mintGitHubAppInstallationToken, normalizeFactoryQuestionReply, normalizeFactoryReviewComment, normalizeGitHubDefaultBranchPush, normalizeGitHubIssueOpened, normalizeGitHubPullRequest, normalizeGitHubPullRequestClosed, normalizeGitHubWorkflowRunFailure, readCommittedGitChange, readIssueComment, readPullRequest, readPullRequestHead, readReviewComment, removeLabel, runSandboxGit, stripFactoryQuestionMention, submitPullRequestReview, updateCheckRun, updatePullRequestComment, verifyGitHubSignature };
|
|
906
930
|
|
|
907
931
|
//# sourceMappingURL=github.mjs.map
|