chore: upgrade vite-plus to 0.3.0 (#9327)
Co-authored-by: Julius Marminge <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
This commit is contained in:
31 files changed
+1134
-971
No files matched your search
@@ -663,15 +663,13 @@ export const makeBackendInstance = Effect.fn("makeBackendInstance")(function* (
|
||||
Ref.update(state, withActiveRun(runId, f));
|
||||
|
||||
const snapshot = Ref.get(state).pipe(
|
||||
Effect.map(
|
||||
(current): DesktopBackendSnapshot => ({
|
||||
desiredRunning: current.desiredRunning,
|
||||
ready: current.ready,
|
||||
activePid: activePid(current.active),
|
||||
restartAttempt: current.restartAttempt,
|
||||
restartScheduled: Option.isSome(current.restartFiber),
|
||||
}),
|
||||
),
|
||||
Effect.map((current): DesktopBackendSnapshot => ({
|
||||
desiredRunning: current.desiredRunning,
|
||||
ready: current.ready,
|
||||
activePid: activePid(current.active),
|
||||
restartAttempt: current.restartAttempt,
|
||||
restartScheduled: Option.isSome(current.restartFiber),
|
||||
})),
|
||||
);
|
||||
const currentConfig = Ref.get(state).pipe(Effect.map((current) => current.config));
|
||||
|
||||
|
||||
@@ -122,16 +122,14 @@ export function buildShortcutActions(recents: ReadonlyArray<RecentThreadShortcut
|
||||
icon: SHORTCUT_ICON,
|
||||
params: { href: NEW_TASK_SHORTCUT_HREF },
|
||||
},
|
||||
...recents.slice(0, MAX_RECENT_THREAD_SHORTCUTS).map(
|
||||
(thread): Action => ({
|
||||
// The encoded href doubles as the launcher id: URI-encoding makes the
|
||||
// env/thread join unambiguous (a plain `-` join lets different pairs
|
||||
// collide and overwrite each other's launcher slots).
|
||||
id: `thread:${threadShortcutHref(thread)}`,
|
||||
title: threadShortcutLabel(thread),
|
||||
icon: SHORTCUT_ICON,
|
||||
params: { href: threadShortcutHref(thread) },
|
||||
}),
|
||||
),
|
||||
...recents.slice(0, MAX_RECENT_THREAD_SHORTCUTS).map((thread): Action => ({
|
||||
// The encoded href doubles as the launcher id: URI-encoding makes the
|
||||
// env/thread join unambiguous (a plain `-` join lets different pairs
|
||||
// collide and overwrite each other's launcher slots).
|
||||
id: `thread:${threadShortcutHref(thread)}`,
|
||||
title: threadShortcutLabel(thread),
|
||||
icon: SHORTCUT_ICON,
|
||||
params: { href: threadShortcutHref(thread) },
|
||||
})),
|
||||
];
|
||||
}
|
||||
@@ -948,16 +948,14 @@ export function ThreadTerminalRouteScreen(props: ThreadTerminalRouteScreenProps)
|
||||
},
|
||||
],
|
||||
},
|
||||
...terminalMenuSessions.map(
|
||||
(session): MenuAction => ({
|
||||
id: `terminal-session:${session.terminalId}`,
|
||||
title: session.displayLabel,
|
||||
subtitle: [getTerminalStatusLabel({ status: session.status }), basename(session.cwd)]
|
||||
.filter(Boolean)
|
||||
.join(" · "),
|
||||
state: session.terminalId === terminalId ? ("on" as const) : undefined,
|
||||
}),
|
||||
),
|
||||
...terminalMenuSessions.map((session): MenuAction => ({
|
||||
id: `terminal-session:${session.terminalId}`,
|
||||
title: session.displayLabel,
|
||||
subtitle: [getTerminalStatusLabel({ status: session.status }), basename(session.cwd)]
|
||||
.filter(Boolean)
|
||||
.join(" · "),
|
||||
state: session.terminalId === terminalId ? ("on" as const) : undefined,
|
||||
})),
|
||||
{
|
||||
id: "terminal-new",
|
||||
title: "Open new terminal",
|
||||
|
||||
@@ -255,25 +255,21 @@ export function buildThreadListV2ListItems(input: {
|
||||
readonly settledShelfHeaderIndex?: number | null;
|
||||
readonly snoozeLabelNow?: string;
|
||||
}): ThreadListV2ListItem[] {
|
||||
const threadItems = input.items.map(
|
||||
(item): ThreadListV2ListItem => ({
|
||||
type: "v2-thread",
|
||||
key: `v2-thread:${item.thread.environmentId}:${item.thread.id}`,
|
||||
item,
|
||||
snoozeWakeLabelText:
|
||||
item.snoozed && item.thread.snoozedUntil != null && input.snoozeLabelNow !== undefined
|
||||
? snoozeWakeLabel(item.thread.snoozedUntil, { now: input.snoozeLabelNow })
|
||||
: undefined,
|
||||
}),
|
||||
);
|
||||
const pendingItems = input.pendingTasks.map(
|
||||
(pendingTask, index): ThreadListV2ListItem => ({
|
||||
type: "v2-pending",
|
||||
key: `v2-pending:${pendingTask.message.messageId}`,
|
||||
pendingTask,
|
||||
showPendingDivider: index === 0,
|
||||
}),
|
||||
);
|
||||
const threadItems = input.items.map((item): ThreadListV2ListItem => ({
|
||||
type: "v2-thread",
|
||||
key: `v2-thread:${item.thread.environmentId}:${item.thread.id}`,
|
||||
item,
|
||||
snoozeWakeLabelText:
|
||||
item.snoozed && item.thread.snoozedUntil != null && input.snoozeLabelNow !== undefined
|
||||
? snoozeWakeLabel(item.thread.snoozedUntil, { now: input.snoozeLabelNow })
|
||||
: undefined,
|
||||
}));
|
||||
const pendingItems = input.pendingTasks.map((pendingTask, index): ThreadListV2ListItem => ({
|
||||
type: "v2-pending",
|
||||
key: `v2-pending:${pendingTask.message.messageId}`,
|
||||
pendingTask,
|
||||
showPendingDivider: index === 0,
|
||||
}));
|
||||
const snoozedCount = input.snoozedCount ?? 0;
|
||||
const snoozedShelfHeaderIndex = input.snoozedShelfHeaderIndex ?? null;
|
||||
const settledCount = input.settledCount ?? 0;
|
||||
|
||||
@@ -365,14 +365,13 @@ const makeAvailable = Effect.gen(function* () {
|
||||
}).pipe(
|
||||
Effect.flatMap(Schema.decodeUnknownEffect(ClientCacheSummaryRows)),
|
||||
Effect.mapError(databaseError("inspect-caches")),
|
||||
Effect.map(
|
||||
(rows): ReadonlyArray<ClientCacheSummaryRow> =>
|
||||
rows.map((row) => ({
|
||||
environmentId: row.environmentId as EnvironmentId,
|
||||
kind: row.kind,
|
||||
recordCount: row.recordCount,
|
||||
payloadBytes: row.payloadBytes,
|
||||
})),
|
||||
Effect.map((rows): ReadonlyArray<ClientCacheSummaryRow> =>
|
||||
rows.map((row) => ({
|
||||
environmentId: row.environmentId as EnvironmentId,
|
||||
kind: row.kind,
|
||||
recordCount: row.recordCount,
|
||||
payloadBytes: row.payloadBytes,
|
||||
})),
|
||||
),
|
||||
),
|
||||
loadPreferencesJson: Effect.tryPromise({
|
||||
|
||||
@@ -923,12 +923,10 @@ export const make = Effect.gen(function* () {
|
||||
const listClientSessions: EnvironmentAuth["Service"]["listClientSessions"] = (currentSessionId) =>
|
||||
listSessions().pipe(
|
||||
Effect.map((clientSessions) =>
|
||||
clientSessions.map(
|
||||
(clientSession): AuthClientSession => ({
|
||||
...clientSession,
|
||||
current: clientSession.sessionId === currentSessionId,
|
||||
}),
|
||||
),
|
||||
clientSessions.map((clientSession): AuthClientSession => ({
|
||||
...clientSession,
|
||||
current: clientSession.sessionId === currentSessionId,
|
||||
})),
|
||||
),
|
||||
Effect.withSpan("EnvironmentAuth.listClientSessions"),
|
||||
);
|
||||
|
||||
@@ -89,9 +89,10 @@ export const waitForLoopbackAuthorization = Effect.fn(
|
||||
while (true) {
|
||||
const result = yield* Effect.raceFirst(
|
||||
input.callback.pipe(
|
||||
Effect.map(
|
||||
(code): LoopbackAuthorizationResult => ({ _tag: "AuthorizationCode", code }),
|
||||
),
|
||||
Effect.map((code): LoopbackAuthorizationResult => ({
|
||||
_tag: "AuthorizationCode",
|
||||
code,
|
||||
})),
|
||||
),
|
||||
readLoopbackAuthorizationAction(terminalInput),
|
||||
);
|
||||
|
||||
@@ -61,21 +61,19 @@ export const make = Effect.fn("makeProcessDiagnostics")(function* () {
|
||||
Effect.map((snapshot) => {
|
||||
const processes = snapshot.processes
|
||||
.filter((entry) => canSignalCategory(entry.category))
|
||||
.map(
|
||||
(entry): ServerProcessDiagnosticsEntry => ({
|
||||
pid: entry.identity.pid,
|
||||
startTimeMs: entry.identity.startTimeMs,
|
||||
ppid: entry.ppid,
|
||||
pgid: Option.none(),
|
||||
status: entry.status || "Unknown",
|
||||
cpuPercent: entry.cpuPercent,
|
||||
rssBytes: entry.residentBytes,
|
||||
elapsed: formatElapsed(entry.runTimeMs),
|
||||
command: entry.command || entry.name || "unknown",
|
||||
depth: Math.max(0, entry.depth - 1),
|
||||
childPids: entry.childPids,
|
||||
}),
|
||||
);
|
||||
.map((entry): ServerProcessDiagnosticsEntry => ({
|
||||
pid: entry.identity.pid,
|
||||
startTimeMs: entry.identity.startTimeMs,
|
||||
ppid: entry.ppid,
|
||||
pgid: Option.none(),
|
||||
status: entry.status || "Unknown",
|
||||
cpuPercent: entry.cpuPercent,
|
||||
rssBytes: entry.residentBytes,
|
||||
elapsed: formatElapsed(entry.runTimeMs),
|
||||
command: entry.command || entry.name || "unknown",
|
||||
depth: Math.max(0, entry.depth - 1),
|
||||
childPids: entry.childPids,
|
||||
}));
|
||||
return {
|
||||
serverPid: process.pid,
|
||||
readAt: snapshot.readAt,
|
||||
|
||||
@@ -64,30 +64,29 @@ export const normalizeMcpHttpResponse = (
|
||||
};
|
||||
|
||||
const makeMcpAuthMiddleware = McpSessionRegistry.McpSessionRegistry.pipe(
|
||||
Effect.map(
|
||||
(registry): McpAuthMiddleware =>
|
||||
Effect.fn("McpHttpServer.authenticateRequest")(function* (httpEffect) {
|
||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
const authorization = request.headers.authorization;
|
||||
const token =
|
||||
authorization?.startsWith("Bearer ") === true
|
||||
? authorization.slice("Bearer ".length).trim()
|
||||
: "";
|
||||
const invocation = yield* registry.resolve(token);
|
||||
if (!invocation) {
|
||||
// Without this the only symptom of a dead credential is the agent
|
||||
// quietly losing the whole `t3-code` toolkit for the rest of its
|
||||
// session, with nothing on the server to explain why.
|
||||
yield* Effect.logWarning("rejected MCP request with an unusable credential", {
|
||||
reason: token.length === 0 ? "missing_bearer_token" : "unknown_or_expired_token",
|
||||
});
|
||||
return unauthorized;
|
||||
}
|
||||
return yield* httpEffect.pipe(
|
||||
Effect.provideService(McpInvocationContext.McpInvocationContext, invocation),
|
||||
Effect.map(normalizeMcpHttpResponse),
|
||||
);
|
||||
}),
|
||||
Effect.map((registry): McpAuthMiddleware =>
|
||||
Effect.fn("McpHttpServer.authenticateRequest")(function* (httpEffect) {
|
||||
const request = yield* HttpServerRequest.HttpServerRequest;
|
||||
const authorization = request.headers.authorization;
|
||||
const token =
|
||||
authorization?.startsWith("Bearer ") === true
|
||||
? authorization.slice("Bearer ".length).trim()
|
||||
: "";
|
||||
const invocation = yield* registry.resolve(token);
|
||||
if (!invocation) {
|
||||
// Without this the only symptom of a dead credential is the agent
|
||||
// quietly losing the whole `t3-code` toolkit for the rest of its
|
||||
// session, with nothing on the server to explain why.
|
||||
yield* Effect.logWarning("rejected MCP request with an unusable credential", {
|
||||
reason: token.length === 0 ? "missing_bearer_token" : "unknown_or_expired_token",
|
||||
});
|
||||
return unauthorized;
|
||||
}
|
||||
return yield* httpEffect.pipe(
|
||||
Effect.provideService(McpInvocationContext.McpInvocationContext, invocation),
|
||||
Effect.map(normalizeMcpHttpResponse),
|
||||
);
|
||||
}),
|
||||
),
|
||||
Effect.withSpan("McpHttpServer.makeAuthMiddleware"),
|
||||
);
|
||||
|
||||
@@ -2391,42 +2391,40 @@ pending_approval_requests AS (
|
||||
)
|
||||
: Result.failVoid,
|
||||
),
|
||||
threads: threadRows.map(
|
||||
(row): OrchestrationThreadShell => ({
|
||||
id: row.threadId,
|
||||
projectId: row.projectId,
|
||||
title: row.title,
|
||||
modelSelection: row.modelSelection,
|
||||
runtimeMode: row.runtimeMode,
|
||||
interactionMode: row.interactionMode,
|
||||
branch: row.branch,
|
||||
worktreePath: row.worktreePath,
|
||||
...(row.linkedPullRequest === null
|
||||
? {}
|
||||
: { linkedPullRequest: row.linkedPullRequest }),
|
||||
latestTurn: latestTurnByThread.get(row.threadId) ?? null,
|
||||
createdAt: row.createdAt,
|
||||
updatedAt: row.updatedAt,
|
||||
archivedAt: row.archivedAt,
|
||||
settledOverride: row.settledOverride,
|
||||
settledAt: row.settledAt,
|
||||
unsettledAt: row.unsettledAt,
|
||||
snoozedUntil: row.snoozedUntil,
|
||||
snoozedAt: row.snoozedAt,
|
||||
pinnedAt: row.pinnedAt,
|
||||
pinOrderKey: row.pinOrderKey ?? null,
|
||||
titleRegeneration: mapTitleRegeneration(row),
|
||||
session: sessionByThread.get(row.threadId) ?? null,
|
||||
latestUserMessageAt: row.latestUserMessageAt,
|
||||
hasPendingApprovals: row.pendingApprovalCount > 0,
|
||||
hasPendingUserInput: row.pendingUserInputCount > 0,
|
||||
hasActionableProposedPlan: row.hasActionableProposedPlan > 0,
|
||||
backgroundLiveness: threadBackgroundLiveness.getThreadBackgroundLiveness(
|
||||
row.threadId,
|
||||
),
|
||||
planProgress: threadPlanProgress.getThreadPlanProgress(row.threadId),
|
||||
}),
|
||||
),
|
||||
threads: threadRows.map((row): OrchestrationThreadShell => ({
|
||||
id: row.threadId,
|
||||
projectId: row.projectId,
|
||||
title: row.title,
|
||||
modelSelection: row.modelSelection,
|
||||
runtimeMode: row.runtimeMode,
|
||||
interactionMode: row.interactionMode,
|
||||
branch: row.branch,
|
||||
worktreePath: row.worktreePath,
|
||||
...(row.linkedPullRequest === null
|
||||
? {}
|
||||
: { linkedPullRequest: row.linkedPullRequest }),
|
||||
latestTurn: latestTurnByThread.get(row.threadId) ?? null,
|
||||
createdAt: row.createdAt,
|
||||
updatedAt: row.updatedAt,
|
||||
archivedAt: row.archivedAt,
|
||||
settledOverride: row.settledOverride,
|
||||
settledAt: row.settledAt,
|
||||
unsettledAt: row.unsettledAt,
|
||||
snoozedUntil: row.snoozedUntil,
|
||||
snoozedAt: row.snoozedAt,
|
||||
pinnedAt: row.pinnedAt,
|
||||
pinOrderKey: row.pinOrderKey ?? null,
|
||||
titleRegeneration: mapTitleRegeneration(row),
|
||||
session: sessionByThread.get(row.threadId) ?? null,
|
||||
latestUserMessageAt: row.latestUserMessageAt,
|
||||
hasPendingApprovals: row.pendingApprovalCount > 0,
|
||||
hasPendingUserInput: row.pendingUserInputCount > 0,
|
||||
hasActionableProposedPlan: row.hasActionableProposedPlan > 0,
|
||||
backgroundLiveness: threadBackgroundLiveness.getThreadBackgroundLiveness(
|
||||
row.threadId,
|
||||
),
|
||||
planProgress: threadPlanProgress.getThreadPlanProgress(row.threadId),
|
||||
})),
|
||||
updatedAt: updatedAt ?? "1970-01-01T00:00:00.000Z",
|
||||
};
|
||||
|
||||
@@ -2470,12 +2468,10 @@ pending_approval_requests AS (
|
||||
"ProjectionSnapshotQuery.getCounts:decodeRow",
|
||||
),
|
||||
),
|
||||
Effect.map(
|
||||
(row): ProjectionSnapshotCounts => ({
|
||||
projectCount: row.projectCount,
|
||||
threadCount: row.threadCount,
|
||||
}),
|
||||
),
|
||||
Effect.map((row): ProjectionSnapshotCounts => ({
|
||||
projectCount: row.projectCount,
|
||||
threadCount: row.threadCount,
|
||||
})),
|
||||
);
|
||||
|
||||
const getEventReplayStats: ProjectionSnapshotQueryShape["getEventReplayStats"] = (input) =>
|
||||
@@ -2486,12 +2482,10 @@ pending_approval_requests AS (
|
||||
"ProjectionSnapshotQuery.getEventReplayStats:decodeRow",
|
||||
),
|
||||
),
|
||||
Effect.map(
|
||||
(row): ProjectionEventReplayStats => ({
|
||||
eventCount: row.eventCount,
|
||||
payloadBytes: row.payloadBytes,
|
||||
}),
|
||||
),
|
||||
Effect.map((row): ProjectionEventReplayStats => ({
|
||||
eventCount: row.eventCount,
|
||||
payloadBytes: row.payloadBytes,
|
||||
})),
|
||||
);
|
||||
|
||||
const searchThreads: ProjectionSnapshotQueryShape["searchThreads"] = Effect.fn(
|
||||
@@ -2616,17 +2610,15 @@ pending_approval_requests AS (
|
||||
projectId: threadRow.value.projectId,
|
||||
workspaceRoot: threadRow.value.workspaceRoot,
|
||||
worktreePath: threadRow.value.worktreePath,
|
||||
checkpoints: checkpointRows.map(
|
||||
(row): OrchestrationCheckpointSummary => ({
|
||||
turnId: row.turnId,
|
||||
checkpointTurnCount: row.checkpointTurnCount,
|
||||
checkpointRef: row.checkpointRef,
|
||||
status: row.status,
|
||||
files: row.files,
|
||||
assistantMessageId: row.assistantMessageId,
|
||||
completedAt: row.completedAt,
|
||||
}),
|
||||
),
|
||||
checkpoints: checkpointRows.map((row): OrchestrationCheckpointSummary => ({
|
||||
turnId: row.turnId,
|
||||
checkpointTurnCount: row.checkpointTurnCount,
|
||||
checkpointRef: row.checkpointRef,
|
||||
status: row.status,
|
||||
files: row.files,
|
||||
assistantMessageId: row.assistantMessageId,
|
||||
completedAt: row.completedAt,
|
||||
})),
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -433,15 +433,13 @@ export const make = Effect.gen(function* PreviewManagerMake() {
|
||||
const list: PreviewManager["Service"]["list"] = Effect.fn("PreviewManager.list")(
|
||||
function* (input) {
|
||||
return yield* SynchronizedRef.get(stateRef).pipe(
|
||||
Effect.map(
|
||||
(state): PreviewListResult => ({
|
||||
sessions: sessionsForThread(state, input.threadId)
|
||||
.map((s) => s.snapshot)
|
||||
.toSorted((a, b) => a.updatedAt.localeCompare(b.updatedAt)),
|
||||
serverEpoch,
|
||||
revision: state.revision,
|
||||
}),
|
||||
),
|
||||
Effect.map((state): PreviewListResult => ({
|
||||
sessions: sessionsForThread(state, input.threadId)
|
||||
.map((s) => s.snapshot)
|
||||
.toSorted((a, b) => a.updatedAt.localeCompare(b.updatedAt)),
|
||||
serverEpoch,
|
||||
revision: state.revision,
|
||||
})),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -239,13 +239,11 @@ const collectText = Effect.fn("processRunner.collectText")(function* (input: {
|
||||
});
|
||||
},
|
||||
),
|
||||
Effect.map(
|
||||
(state): CollectedUint8StreamText => ({
|
||||
...decodeUtf8(Buffer.concat(state.chunks, state.bytes)),
|
||||
bytes: state.bytes,
|
||||
truncated: false,
|
||||
}),
|
||||
),
|
||||
Effect.map((state): CollectedUint8StreamText => ({
|
||||
...decodeUtf8(Buffer.concat(state.chunks, state.bytes)),
|
||||
bytes: state.bytes,
|
||||
truncated: false,
|
||||
})),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -186,9 +186,10 @@ function toSessionPermissionUpdates(
|
||||
toolName: string,
|
||||
suggestions: ReadonlyArray<PermissionUpdate> | undefined,
|
||||
): Array<PermissionUpdate> {
|
||||
const sessionScoped = (suggestions ?? []).map(
|
||||
(suggestion): PermissionUpdate => ({ ...suggestion, destination: "session" }),
|
||||
);
|
||||
const sessionScoped = (suggestions ?? []).map((suggestion): PermissionUpdate => ({
|
||||
...suggestion,
|
||||
destination: "session",
|
||||
}));
|
||||
if (sessionScoped.length > 0) {
|
||||
return sessionScoped;
|
||||
}
|
||||
|
||||
@@ -84,24 +84,22 @@ class FakeCodexRuntime implements CodexSessionRuntimeShape {
|
||||
}),
|
||||
);
|
||||
|
||||
public readonly interruptTurnImpl = vi.fn(
|
||||
(_turnId?: TurnId): Promise<void> => Promise.resolve(undefined),
|
||||
public readonly interruptTurnImpl = vi.fn((_turnId?: TurnId): Promise<void> =>
|
||||
Promise.resolve(undefined),
|
||||
);
|
||||
|
||||
public readonly readThreadImpl = vi.fn(
|
||||
(): Promise<CodexThreadSnapshot> =>
|
||||
Promise.resolve({
|
||||
threadId: "provider-thread-1",
|
||||
turns: [],
|
||||
}),
|
||||
public readonly readThreadImpl = vi.fn((): Promise<CodexThreadSnapshot> =>
|
||||
Promise.resolve({
|
||||
threadId: "provider-thread-1",
|
||||
turns: [],
|
||||
}),
|
||||
);
|
||||
|
||||
public readonly rollbackThreadImpl = vi.fn(
|
||||
(_numTurns: number): Promise<CodexThreadSnapshot> =>
|
||||
Promise.resolve({
|
||||
threadId: "provider-thread-1",
|
||||
turns: [],
|
||||
}),
|
||||
public readonly rollbackThreadImpl = vi.fn((_numTurns: number): Promise<CodexThreadSnapshot> =>
|
||||
Promise.resolve({
|
||||
threadId: "provider-thread-1",
|
||||
turns: [],
|
||||
}),
|
||||
);
|
||||
|
||||
public readonly uploadFeedbackImpl = vi.fn((_reason?: string) =>
|
||||
|
||||
@@ -188,20 +188,18 @@ function makeFakeCodexAdapter(provider: ProviderDriverKind = CODEX_DRIVER) {
|
||||
): Effect.Effect<void, ProviderAdapterError> => Effect.void,
|
||||
);
|
||||
|
||||
const stopSession = vi.fn(
|
||||
(threadId: ThreadId): Effect.Effect<void, ProviderAdapterError> =>
|
||||
Effect.sync(() => {
|
||||
sessions.delete(threadId);
|
||||
}),
|
||||
const stopSession = vi.fn((threadId: ThreadId): Effect.Effect<void, ProviderAdapterError> =>
|
||||
Effect.sync(() => {
|
||||
sessions.delete(threadId);
|
||||
}),
|
||||
);
|
||||
|
||||
const listSessions = vi.fn(
|
||||
(): Effect.Effect<ReadonlyArray<ProviderSession>> =>
|
||||
Effect.sync(() => Array.from(sessions.values())),
|
||||
const listSessions = vi.fn((): Effect.Effect<ReadonlyArray<ProviderSession>> =>
|
||||
Effect.sync(() => Array.from(sessions.values())),
|
||||
);
|
||||
|
||||
const hasSession = vi.fn(
|
||||
(threadId: ThreadId): Effect.Effect<boolean> => Effect.succeed(sessions.has(threadId)),
|
||||
const hasSession = vi.fn((threadId: ThreadId): Effect.Effect<boolean> =>
|
||||
Effect.succeed(sessions.has(threadId)),
|
||||
);
|
||||
|
||||
const readThread = vi.fn(
|
||||
@@ -235,11 +233,10 @@ function makeFakeCodexAdapter(provider: ProviderDriverKind = CODEX_DRIVER) {
|
||||
Effect.succeed({ feedbackId: `feedback-${input.threadId}` }),
|
||||
);
|
||||
|
||||
const stopAll = vi.fn(
|
||||
(): Effect.Effect<void, ProviderAdapterError> =>
|
||||
Effect.sync(() => {
|
||||
sessions.clear();
|
||||
}),
|
||||
const stopAll = vi.fn((): Effect.Effect<void, ProviderAdapterError> =>
|
||||
Effect.sync(() => {
|
||||
sessions.clear();
|
||||
}),
|
||||
);
|
||||
|
||||
const adapter: ProviderAdapterShape<ProviderAdapterError> = {
|
||||
|
||||
@@ -263,12 +263,10 @@ export const make = Effect.fn("ProviderMaintenanceRunner.make")(function* () {
|
||||
concurrency: "unbounded",
|
||||
},
|
||||
).pipe(
|
||||
Effect.map(
|
||||
(verifiedProviders): VerifiedProviderRefresh => ({
|
||||
providers,
|
||||
verifiedProviders,
|
||||
}),
|
||||
),
|
||||
Effect.map((verifiedProviders): VerifiedProviderRefresh => ({
|
||||
providers,
|
||||
verifiedProviders,
|
||||
})),
|
||||
Effect.catchCause((cause) =>
|
||||
Effect.logWarning("Provider post-update version verification failed", {
|
||||
provider,
|
||||
|
||||
@@ -157,23 +157,21 @@ export const make = Effect.gen(function* () {
|
||||
getChangeRequest: (input) =>
|
||||
cli.getPullRequest({ cwd: input.cwd, number: input.number }).pipe(
|
||||
Effect.mapError(fail("getChangeRequest")),
|
||||
Effect.map(
|
||||
(pullRequest): ProviderChangeRequestDetail => ({
|
||||
...toChangeRequest(pullRequest),
|
||||
body: pullRequest.body,
|
||||
changedFiles: 0,
|
||||
mergedAt: pullRequest.state === "merged" ? pullRequest.closedAt : null,
|
||||
closedAt: pullRequest.state === "closed" ? pullRequest.closedAt : null,
|
||||
reviewers: pullRequest.reviewers,
|
||||
checks: [],
|
||||
mergeCapabilities: { merge: true, squash: true, rebase: false },
|
||||
viewerPermissions: AZURE_DEVOPS_VIEWER_PERMISSIONS,
|
||||
autoMergeEnabled: pullRequest.autoMergeEnabled,
|
||||
...(pullRequest.autoMergeMethod === undefined
|
||||
? {}
|
||||
: { autoMergeMethod: pullRequest.autoMergeMethod }),
|
||||
}),
|
||||
),
|
||||
Effect.map((pullRequest): ProviderChangeRequestDetail => ({
|
||||
...toChangeRequest(pullRequest),
|
||||
body: pullRequest.body,
|
||||
changedFiles: 0,
|
||||
mergedAt: pullRequest.state === "merged" ? pullRequest.closedAt : null,
|
||||
closedAt: pullRequest.state === "closed" ? pullRequest.closedAt : null,
|
||||
reviewers: pullRequest.reviewers,
|
||||
checks: [],
|
||||
mergeCapabilities: { merge: true, squash: true, rebase: false },
|
||||
viewerPermissions: AZURE_DEVOPS_VIEWER_PERMISSIONS,
|
||||
autoMergeEnabled: pullRequest.autoMergeEnabled,
|
||||
...(pullRequest.autoMergeMethod === undefined
|
||||
? {}
|
||||
: { autoMergeMethod: pullRequest.autoMergeMethod }),
|
||||
})),
|
||||
),
|
||||
|
||||
getChangeRequestActivity: (input) =>
|
||||
@@ -187,15 +185,13 @@ export const make = Effect.gen(function* () {
|
||||
Effect.orElseSucceed(() => ({ comments: [], truncated: true })),
|
||||
)
|
||||
).pipe(
|
||||
Effect.map(
|
||||
(conversation): ProviderChangeRequestActivity => ({
|
||||
comments: conversation.comments,
|
||||
commentCount: conversation.comments.length,
|
||||
commentsTruncated: conversation.truncated,
|
||||
reviewThreads: [],
|
||||
commits: [],
|
||||
}),
|
||||
),
|
||||
Effect.map((conversation): ProviderChangeRequestActivity => ({
|
||||
comments: conversation.comments,
|
||||
commentCount: conversation.comments.length,
|
||||
commentsTruncated: conversation.truncated,
|
||||
reviewThreads: [],
|
||||
commits: [],
|
||||
})),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -203,17 +203,15 @@ export const make = Effect.gen(function* () {
|
||||
{ concurrency: 3 },
|
||||
).pipe(
|
||||
Effect.mapError(fail("getChangeRequestActivity")),
|
||||
Effect.map(
|
||||
([pullRequest, comments, commits]): ProviderChangeRequestActivity => ({
|
||||
comments: [...comments.comments, ...pullRequest.reviews].toSorted((left, right) =>
|
||||
left.createdAt.localeCompare(right.createdAt),
|
||||
),
|
||||
commentCount: comments.comments.length + pullRequest.reviews.length,
|
||||
commentsTruncated: comments.truncated,
|
||||
reviewThreads: comments.threads,
|
||||
commits,
|
||||
}),
|
||||
),
|
||||
Effect.map(([pullRequest, comments, commits]): ProviderChangeRequestActivity => ({
|
||||
comments: [...comments.comments, ...pullRequest.reviews].toSorted((left, right) =>
|
||||
left.createdAt.localeCompare(right.createdAt),
|
||||
),
|
||||
commentCount: comments.comments.length + pullRequest.reviews.length,
|
||||
commentsTruncated: comments.truncated,
|
||||
reviewThreads: comments.threads,
|
||||
commits,
|
||||
})),
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@@ -144,14 +144,12 @@ function withWorkflowApprovals(
|
||||
}
|
||||
const approvalChecks = runs
|
||||
.filter((run) => !representedRunIds.has(run.id))
|
||||
.map(
|
||||
(run): PullRequestCheck => ({
|
||||
name: run.name,
|
||||
status: "action-required",
|
||||
description: "A maintainer must approve this workflow before it can run.",
|
||||
url: run.url,
|
||||
}),
|
||||
);
|
||||
.map((run): PullRequestCheck => ({
|
||||
name: run.name,
|
||||
status: "action-required",
|
||||
description: "A maintainer must approve this workflow before it can run.",
|
||||
url: run.url,
|
||||
}));
|
||||
return [
|
||||
...checks,
|
||||
...approvalChecks,
|
||||
@@ -363,38 +361,34 @@ export const make = Effect.gen(function* () {
|
||||
{ concurrency: 3 },
|
||||
).pipe(
|
||||
Effect.mapError(fail("getChangeRequest")),
|
||||
Effect.map(
|
||||
([detail, repository, viewerAccess]): ProviderChangeRequestDetail => ({
|
||||
...detail.pullRequest,
|
||||
checks: withWorkflowApprovals(
|
||||
detail.pullRequest.checks,
|
||||
detail.workflowApprovals.runs,
|
||||
detail.workflowApprovals.unavailable,
|
||||
),
|
||||
...(detail.workflowApprovals.unavailable
|
||||
? {}
|
||||
: { workflowApprovalsRequired: detail.workflowApprovals.runs.length }),
|
||||
reviewers: detail.pullRequest.reviewRequestLogins.map((login) => ({
|
||||
login,
|
||||
name: null,
|
||||
avatarUrl: null,
|
||||
})),
|
||||
mergeCapabilities: repository.mergeCapabilities,
|
||||
viewerPermissions: gitHubViewerPermissions({
|
||||
...viewerAccess,
|
||||
canUpdateBranch: detail.comparison?.viewerCanUpdate === true,
|
||||
}),
|
||||
baseComparison:
|
||||
detail.comparison === null || detail.comparison.behindBy === null
|
||||
? "unknown"
|
||||
: detail.comparison.behindBy > 0
|
||||
? "behind"
|
||||
: "up-to-date",
|
||||
...(detail.comparison?.behindBy == null
|
||||
? {}
|
||||
: { behindBy: detail.comparison.behindBy }),
|
||||
Effect.map(([detail, repository, viewerAccess]): ProviderChangeRequestDetail => ({
|
||||
...detail.pullRequest,
|
||||
checks: withWorkflowApprovals(
|
||||
detail.pullRequest.checks,
|
||||
detail.workflowApprovals.runs,
|
||||
detail.workflowApprovals.unavailable,
|
||||
),
|
||||
...(detail.workflowApprovals.unavailable
|
||||
? {}
|
||||
: { workflowApprovalsRequired: detail.workflowApprovals.runs.length }),
|
||||
reviewers: detail.pullRequest.reviewRequestLogins.map((login) => ({
|
||||
login,
|
||||
name: null,
|
||||
avatarUrl: null,
|
||||
})),
|
||||
mergeCapabilities: repository.mergeCapabilities,
|
||||
viewerPermissions: gitHubViewerPermissions({
|
||||
...viewerAccess,
|
||||
canUpdateBranch: detail.comparison?.viewerCanUpdate === true,
|
||||
}),
|
||||
),
|
||||
baseComparison:
|
||||
detail.comparison === null || detail.comparison.behindBy === null
|
||||
? "unknown"
|
||||
: detail.comparison.behindBy > 0
|
||||
? "behind"
|
||||
: "up-to-date",
|
||||
...(detail.comparison?.behindBy == null ? {} : { behindBy: detail.comparison.behindBy }),
|
||||
})),
|
||||
),
|
||||
|
||||
getChangeRequestActivity: (input) =>
|
||||
@@ -426,53 +420,51 @@ export const make = Effect.gen(function* () {
|
||||
{ concurrency: 2 },
|
||||
).pipe(
|
||||
Effect.mapError(fail("getChangeRequestActivity")),
|
||||
Effect.map(
|
||||
([pullRequest, reviewThreads]): ProviderChangeRequestActivity => ({
|
||||
author: withAvatar(pullRequest.author, reviewThreads.avatarsByLogin, input.host),
|
||||
reviewers: reviewThreads.reviewers,
|
||||
reactions: reviewThreads.reactions,
|
||||
commits: (reviewThreads.commits.length > 0
|
||||
? reviewThreads.commits
|
||||
: pullRequest.commits
|
||||
).map((commit) => ({
|
||||
...commit,
|
||||
...reviewThreads.commitStats.get(commit.oid),
|
||||
authors: commit.authors?.map(
|
||||
(author) => withAvatar(author, reviewThreads.avatarsByLogin, input.host) ?? author,
|
||||
),
|
||||
Effect.map(([pullRequest, reviewThreads]): ProviderChangeRequestActivity => ({
|
||||
author: withAvatar(pullRequest.author, reviewThreads.avatarsByLogin, input.host),
|
||||
reviewers: reviewThreads.reviewers,
|
||||
reactions: reviewThreads.reactions,
|
||||
commits: (reviewThreads.commits.length > 0
|
||||
? reviewThreads.commits
|
||||
: pullRequest.commits
|
||||
).map((commit) => ({
|
||||
...commit,
|
||||
...reviewThreads.commitStats.get(commit.oid),
|
||||
authors: commit.authors?.map(
|
||||
(author) => withAvatar(author, reviewThreads.avatarsByLogin, input.host) ?? author,
|
||||
),
|
||||
})),
|
||||
comments: [...pullRequest.comments, ...reviewThreads.comments]
|
||||
.map((comment) => ({
|
||||
...comment,
|
||||
// GitHub keeps the dismissal reason on the timeline event, not on the review,
|
||||
// so a dismissed review with nothing visible of its own reads its words from
|
||||
// there. "Visible" and not "empty": bot reviews often carry only an HTML
|
||||
// marker comment, which markdown renders as nothing.
|
||||
body:
|
||||
comment.kind === "review" &&
|
||||
comment.reviewState?.toUpperCase() === "DISMISSED" &&
|
||||
rendersEmpty(comment.body)
|
||||
? (reviewThreads.dismissalsByReviewId.get(comment.id) ?? comment.body)
|
||||
: comment.body,
|
||||
author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
|
||||
// A comment out of `gh pr view --json` carries none of its own: that read
|
||||
// reports no reaction at all, so they arrive from the GraphQL page by node id.
|
||||
reactions: comment.reactions ?? reviewThreads.reactionsById.get(comment.id) ?? [],
|
||||
}))
|
||||
.toSorted((left, right) => left.createdAt.localeCompare(right.createdAt)),
|
||||
// `gh pr view --json comments,reviews` follows GitHub's cursors itself, so those two
|
||||
// are always whole and only the thread walk can stop short of the host.
|
||||
commentCount: pullRequest.comments.length + reviewThreads.commentCount,
|
||||
commentsTruncated: reviewThreads.truncated,
|
||||
reviewThreads: reviewThreads.reviewThreads.map((thread) => ({
|
||||
...thread,
|
||||
comments: thread.comments.map((comment) => ({
|
||||
...comment,
|
||||
author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
|
||||
})),
|
||||
comments: [...pullRequest.comments, ...reviewThreads.comments]
|
||||
.map((comment) => ({
|
||||
...comment,
|
||||
// GitHub keeps the dismissal reason on the timeline event, not on the review,
|
||||
// so a dismissed review with nothing visible of its own reads its words from
|
||||
// there. "Visible" and not "empty": bot reviews often carry only an HTML
|
||||
// marker comment, which markdown renders as nothing.
|
||||
body:
|
||||
comment.kind === "review" &&
|
||||
comment.reviewState?.toUpperCase() === "DISMISSED" &&
|
||||
rendersEmpty(comment.body)
|
||||
? (reviewThreads.dismissalsByReviewId.get(comment.id) ?? comment.body)
|
||||
: comment.body,
|
||||
author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
|
||||
// A comment out of `gh pr view --json` carries none of its own: that read
|
||||
// reports no reaction at all, so they arrive from the GraphQL page by node id.
|
||||
reactions: comment.reactions ?? reviewThreads.reactionsById.get(comment.id) ?? [],
|
||||
}))
|
||||
.toSorted((left, right) => left.createdAt.localeCompare(right.createdAt)),
|
||||
// `gh pr view --json comments,reviews` follows GitHub's cursors itself, so those two
|
||||
// are always whole and only the thread walk can stop short of the host.
|
||||
commentCount: pullRequest.comments.length + reviewThreads.commentCount,
|
||||
commentsTruncated: reviewThreads.truncated,
|
||||
reviewThreads: reviewThreads.reviewThreads.map((thread) => ({
|
||||
...thread,
|
||||
comments: thread.comments.map((comment) => ({
|
||||
...comment,
|
||||
author: withAvatar(comment.author, reviewThreads.avatarsByLogin, input.host),
|
||||
})),
|
||||
})),
|
||||
}),
|
||||
),
|
||||
})),
|
||||
})),
|
||||
),
|
||||
|
||||
getReviewThreadComments: (input) =>
|
||||
|
||||
@@ -147,24 +147,22 @@ export const make = Effect.gen(function* () {
|
||||
{ concurrency: 2 },
|
||||
).pipe(
|
||||
Effect.mapError(fail("getChangeRequest")),
|
||||
Effect.map(
|
||||
([mergeRequest, mergeCapabilities]): ProviderChangeRequestDetail => ({
|
||||
...mergeRequest,
|
||||
mergeCapabilities,
|
||||
viewerPermissions: gitLabViewerPermissions(mergeRequest),
|
||||
// A GitLab too old to count the divergence says nothing here rather than "up to
|
||||
// date": the banner is worth missing, and a wrong all-clear is not worth showing.
|
||||
baseComparison:
|
||||
mergeRequest.divergedCommits === undefined
|
||||
? "unknown"
|
||||
: mergeRequest.divergedCommits > 0
|
||||
? "behind"
|
||||
: "up-to-date",
|
||||
...(mergeRequest.divergedCommits === undefined
|
||||
? {}
|
||||
: { behindBy: mergeRequest.divergedCommits }),
|
||||
}),
|
||||
),
|
||||
Effect.map(([mergeRequest, mergeCapabilities]): ProviderChangeRequestDetail => ({
|
||||
...mergeRequest,
|
||||
mergeCapabilities,
|
||||
viewerPermissions: gitLabViewerPermissions(mergeRequest),
|
||||
// A GitLab too old to count the divergence says nothing here rather than "up to
|
||||
// date": the banner is worth missing, and a wrong all-clear is not worth showing.
|
||||
baseComparison:
|
||||
mergeRequest.divergedCommits === undefined
|
||||
? "unknown"
|
||||
: mergeRequest.divergedCommits > 0
|
||||
? "behind"
|
||||
: "up-to-date",
|
||||
...(mergeRequest.divergedCommits === undefined
|
||||
? {}
|
||||
: { behindBy: mergeRequest.divergedCommits }),
|
||||
})),
|
||||
),
|
||||
|
||||
getChangeRequestActivity: (input) =>
|
||||
@@ -189,28 +187,26 @@ export const make = Effect.gen(function* () {
|
||||
{ concurrency: 4 },
|
||||
).pipe(
|
||||
Effect.mapError(fail("getChangeRequestActivity")),
|
||||
Effect.map(
|
||||
([notes, commits, discussions, awards]): ProviderChangeRequestActivity => ({
|
||||
reactions: awards.reactions,
|
||||
comments: notes.comments.map((comment) => ({
|
||||
Effect.map(([notes, commits, discussions, awards]): ProviderChangeRequestActivity => ({
|
||||
reactions: awards.reactions,
|
||||
comments: notes.comments.map((comment) => ({
|
||||
...comment,
|
||||
reactions: awards.reactionsByNoteId.get(comment.id) ?? [],
|
||||
})),
|
||||
// GitLab reports no count of its own, so the walk's own total is the host's: the
|
||||
// notes endpoint carries every comment on the merge request, including the ones
|
||||
// written under a discussion, and it is read until GitLab runs out.
|
||||
commentCount: notes.comments.length,
|
||||
commentsTruncated: notes.truncated || discussions.truncated,
|
||||
reviewThreads: discussions.threads.map((thread) => ({
|
||||
...thread,
|
||||
comments: thread.comments.map((comment) => ({
|
||||
...comment,
|
||||
reactions: awards.reactionsByNoteId.get(comment.id) ?? [],
|
||||
})),
|
||||
// GitLab reports no count of its own, so the walk's own total is the host's: the
|
||||
// notes endpoint carries every comment on the merge request, including the ones
|
||||
// written under a discussion, and it is read until GitLab runs out.
|
||||
commentCount: notes.comments.length,
|
||||
commentsTruncated: notes.truncated || discussions.truncated,
|
||||
reviewThreads: discussions.threads.map((thread) => ({
|
||||
...thread,
|
||||
comments: thread.comments.map((comment) => ({
|
||||
...comment,
|
||||
reactions: awards.reactionsByNoteId.get(comment.id) ?? [],
|
||||
})),
|
||||
})),
|
||||
commits,
|
||||
}),
|
||||
),
|
||||
})),
|
||||
commits,
|
||||
})),
|
||||
),
|
||||
|
||||
// The same read the detail takes it from, on its own: `user.can_merge` lives on the merge
|
||||
|
||||
@@ -1035,21 +1035,19 @@ export const make = Effect.gen(function* () {
|
||||
}),
|
||||
// One unreachable repository must not blank the page. A host-level failure is
|
||||
// already reported through `providers`, so it degrades the same way here.
|
||||
Effect.orElseSucceed(
|
||||
(): RepositoryBatch => ({
|
||||
key,
|
||||
entries: [],
|
||||
errors: [
|
||||
{
|
||||
projectId: project.project.id,
|
||||
projectTitle: project.project.title,
|
||||
message: `${project.repository} could not be read.`,
|
||||
},
|
||||
],
|
||||
truncated: false,
|
||||
nextCursor: null,
|
||||
}),
|
||||
),
|
||||
Effect.orElseSucceed((): RepositoryBatch => ({
|
||||
key,
|
||||
entries: [],
|
||||
errors: [
|
||||
{
|
||||
projectId: project.project.id,
|
||||
projectTitle: project.project.title,
|
||||
message: `${project.repository} could not be read.`,
|
||||
},
|
||||
],
|
||||
truncated: false,
|
||||
nextCursor: null,
|
||||
})),
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -1230,20 +1228,18 @@ export const make = Effect.gen(function* () {
|
||||
: project.api.getChangeRequestSummary(providerInput);
|
||||
return read.pipe(
|
||||
Effect.mapError(toPullRequestError("summary")),
|
||||
Effect.map(
|
||||
(changeRequest): PullRequestSummary => ({
|
||||
provider: project.api.kind,
|
||||
projectId: project.project.id,
|
||||
repository: project.repository,
|
||||
number: changeRequest.number,
|
||||
title: changeRequest.title,
|
||||
url: changeRequest.url,
|
||||
state: changeRequest.state,
|
||||
headBranch: changeRequest.headBranch,
|
||||
baseBranch: changeRequest.baseBranch,
|
||||
updatedAt: changeRequest.updatedAt,
|
||||
}),
|
||||
),
|
||||
Effect.map((changeRequest): PullRequestSummary => ({
|
||||
provider: project.api.kind,
|
||||
projectId: project.project.id,
|
||||
repository: project.repository,
|
||||
number: changeRequest.number,
|
||||
title: changeRequest.title,
|
||||
url: changeRequest.url,
|
||||
state: changeRequest.state,
|
||||
headBranch: changeRequest.headBranch,
|
||||
baseBranch: changeRequest.baseBranch,
|
||||
updatedAt: changeRequest.updatedAt,
|
||||
})),
|
||||
);
|
||||
}),
|
||||
);
|
||||
@@ -1265,55 +1261,53 @@ export const make = Effect.gen(function* () {
|
||||
],
|
||||
{ concurrency: 2 },
|
||||
).pipe(
|
||||
Effect.map(
|
||||
([changeRequest, viewer]): PullRequestDetail => ({
|
||||
provider: project.api.kind,
|
||||
capabilities: project.api.capabilities,
|
||||
projectId: project.project.id,
|
||||
projectTitle: project.project.title,
|
||||
workspaceRoot: project.project.workspaceRoot,
|
||||
repository: project.repository,
|
||||
number: changeRequest.number,
|
||||
title: changeRequest.title,
|
||||
body: changeRequest.body,
|
||||
url: changeRequest.url,
|
||||
author: changeRequest.author,
|
||||
state: changeRequest.state,
|
||||
isDraft: changeRequest.isDraft,
|
||||
mergeability: changeRequest.mergeability,
|
||||
additions: changeRequest.additions,
|
||||
deletions: changeRequest.deletions,
|
||||
changedFiles: changeRequest.changedFiles,
|
||||
headBranch: changeRequest.headBranch,
|
||||
...(changeRequest.headRepositoryNameWithOwner === undefined
|
||||
? {}
|
||||
: { headRepositoryNameWithOwner: changeRequest.headRepositoryNameWithOwner }),
|
||||
baseBranch: changeRequest.baseBranch,
|
||||
createdAt: changeRequest.createdAt,
|
||||
updatedAt: changeRequest.updatedAt,
|
||||
mergedAt: changeRequest.mergedAt,
|
||||
closedAt: changeRequest.closedAt,
|
||||
reviewers: changeRequest.reviewers,
|
||||
labels: changeRequest.labels,
|
||||
checks: changeRequest.checks,
|
||||
mergeCapabilities: changeRequest.mergeCapabilities,
|
||||
viewerPermissions: changeRequest.viewerPermissions,
|
||||
...(viewer === null || viewer.trim().length === 0 ? {} : { viewer }),
|
||||
...(changeRequest.baseComparison === undefined
|
||||
? {}
|
||||
: { baseComparison: changeRequest.baseComparison }),
|
||||
...(changeRequest.behindBy === undefined ? {} : { behindBy: changeRequest.behindBy }),
|
||||
...(changeRequest.autoMergeEnabled === undefined
|
||||
? {}
|
||||
: { autoMergeEnabled: changeRequest.autoMergeEnabled }),
|
||||
...(changeRequest.autoMergeMethod === undefined
|
||||
? {}
|
||||
: { autoMergeMethod: changeRequest.autoMergeMethod }),
|
||||
...(changeRequest.workflowApprovalsRequired === undefined
|
||||
? {}
|
||||
: { workflowApprovalsRequired: changeRequest.workflowApprovalsRequired }),
|
||||
}),
|
||||
),
|
||||
Effect.map(([changeRequest, viewer]): PullRequestDetail => ({
|
||||
provider: project.api.kind,
|
||||
capabilities: project.api.capabilities,
|
||||
projectId: project.project.id,
|
||||
projectTitle: project.project.title,
|
||||
workspaceRoot: project.project.workspaceRoot,
|
||||
repository: project.repository,
|
||||
number: changeRequest.number,
|
||||
title: changeRequest.title,
|
||||
body: changeRequest.body,
|
||||
url: changeRequest.url,
|
||||
author: changeRequest.author,
|
||||
state: changeRequest.state,
|
||||
isDraft: changeRequest.isDraft,
|
||||
mergeability: changeRequest.mergeability,
|
||||
additions: changeRequest.additions,
|
||||
deletions: changeRequest.deletions,
|
||||
changedFiles: changeRequest.changedFiles,
|
||||
headBranch: changeRequest.headBranch,
|
||||
...(changeRequest.headRepositoryNameWithOwner === undefined
|
||||
? {}
|
||||
: { headRepositoryNameWithOwner: changeRequest.headRepositoryNameWithOwner }),
|
||||
baseBranch: changeRequest.baseBranch,
|
||||
createdAt: changeRequest.createdAt,
|
||||
updatedAt: changeRequest.updatedAt,
|
||||
mergedAt: changeRequest.mergedAt,
|
||||
closedAt: changeRequest.closedAt,
|
||||
reviewers: changeRequest.reviewers,
|
||||
labels: changeRequest.labels,
|
||||
checks: changeRequest.checks,
|
||||
mergeCapabilities: changeRequest.mergeCapabilities,
|
||||
viewerPermissions: changeRequest.viewerPermissions,
|
||||
...(viewer === null || viewer.trim().length === 0 ? {} : { viewer }),
|
||||
...(changeRequest.baseComparison === undefined
|
||||
? {}
|
||||
: { baseComparison: changeRequest.baseComparison }),
|
||||
...(changeRequest.behindBy === undefined ? {} : { behindBy: changeRequest.behindBy }),
|
||||
...(changeRequest.autoMergeEnabled === undefined
|
||||
? {}
|
||||
: { autoMergeEnabled: changeRequest.autoMergeEnabled }),
|
||||
...(changeRequest.autoMergeMethod === undefined
|
||||
? {}
|
||||
: { autoMergeMethod: changeRequest.autoMergeMethod }),
|
||||
...(changeRequest.workflowApprovalsRequired === undefined
|
||||
? {}
|
||||
: { workflowApprovalsRequired: changeRequest.workflowApprovalsRequired }),
|
||||
})),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1330,18 +1324,16 @@ export const make = Effect.gen(function* () {
|
||||
})
|
||||
.pipe(
|
||||
Effect.mapError(toPullRequestError("activity")),
|
||||
Effect.map(
|
||||
(activity): PullRequestActivity => ({
|
||||
...(activity.author === undefined ? {} : { author: activity.author }),
|
||||
...(activity.reviewers === undefined ? {} : { reviewers: activity.reviewers }),
|
||||
comments: activity.comments,
|
||||
commentCount: activity.commentCount,
|
||||
commentsTruncated: activity.commentsTruncated,
|
||||
reviewThreads: activity.reviewThreads,
|
||||
commits: activity.commits,
|
||||
...(activity.reactions === undefined ? {} : { reactions: activity.reactions }),
|
||||
}),
|
||||
),
|
||||
Effect.map((activity): PullRequestActivity => ({
|
||||
...(activity.author === undefined ? {} : { author: activity.author }),
|
||||
...(activity.reviewers === undefined ? {} : { reviewers: activity.reviewers }),
|
||||
comments: activity.comments,
|
||||
commentCount: activity.commentCount,
|
||||
commentsTruncated: activity.commentsTruncated,
|
||||
reviewThreads: activity.reviewThreads,
|
||||
commits: activity.commits,
|
||||
...(activity.reactions === undefined ? {} : { reactions: activity.reactions }),
|
||||
})),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -1906,23 +1898,22 @@ export const make = Effect.gen(function* () {
|
||||
);
|
||||
}
|
||||
return viewerPermissionsOf(project, input, "setLabels").pipe(
|
||||
Effect.flatMap(
|
||||
(viewer): Effect.Effect<void, PullRequestError> =>
|
||||
viewer.labels === false
|
||||
? Effect.fail(
|
||||
new PullRequestOperationError({
|
||||
operation: "setLabels",
|
||||
detail: LABEL_CHANGE_REFUSAL,
|
||||
}),
|
||||
)
|
||||
: change({
|
||||
cwd: project.project.workspaceRoot,
|
||||
repository: project.repository,
|
||||
host: project.host,
|
||||
number: input.number,
|
||||
labels: input.labels,
|
||||
applied: input.applied,
|
||||
}).pipe(Effect.mapError(toPullRequestError("setLabels"))),
|
||||
Effect.flatMap((viewer): Effect.Effect<void, PullRequestError> =>
|
||||
viewer.labels === false
|
||||
? Effect.fail(
|
||||
new PullRequestOperationError({
|
||||
operation: "setLabels",
|
||||
detail: LABEL_CHANGE_REFUSAL,
|
||||
}),
|
||||
)
|
||||
: change({
|
||||
cwd: project.project.workspaceRoot,
|
||||
repository: project.repository,
|
||||
host: project.host,
|
||||
number: input.number,
|
||||
labels: input.labels,
|
||||
applied: input.applied,
|
||||
}).pipe(Effect.mapError(toPullRequestError("setLabels"))),
|
||||
),
|
||||
);
|
||||
}),
|
||||
|
||||
@@ -1339,18 +1339,16 @@ function toComments(raw: {
|
||||
readonly comments?: ReadonlyArray<Schema.Schema.Type<typeof RawCommentSchema>> | undefined;
|
||||
readonly reviews?: ReadonlyArray<Schema.Schema.Type<typeof RawReviewSchema>> | undefined;
|
||||
}): ReadonlyArray<PullRequestComment> {
|
||||
const issueComments = (raw.comments ?? []).map(
|
||||
(comment): PullRequestComment => ({
|
||||
id: comment.id,
|
||||
kind: "issue-comment",
|
||||
author: toActor(comment.author),
|
||||
body: comment.body ?? "",
|
||||
createdAt: comment.createdAt,
|
||||
url: trimmed(comment.url),
|
||||
path: null,
|
||||
reviewState: null,
|
||||
}),
|
||||
);
|
||||
const issueComments = (raw.comments ?? []).map((comment): PullRequestComment => ({
|
||||
id: comment.id,
|
||||
kind: "issue-comment",
|
||||
author: toActor(comment.author),
|
||||
body: comment.body ?? "",
|
||||
createdAt: comment.createdAt,
|
||||
url: trimmed(comment.url),
|
||||
path: null,
|
||||
reviewState: null,
|
||||
}));
|
||||
// A review with no body is kept only when its state is the event itself — an approval, a
|
||||
// request for changes, a dismissal. GitHub also opens a bodiless `COMMENTED` review as the
|
||||
// container for line comments, and those comments are read from the review threads, so
|
||||
@@ -1743,19 +1741,17 @@ export function reviewThreadConversation(
|
||||
threads: ReadonlyArray<PullRequestReviewThread>,
|
||||
): ReadonlyArray<PullRequestComment> {
|
||||
return threads.flatMap((thread) =>
|
||||
thread.comments.map(
|
||||
(comment): PullRequestComment => ({
|
||||
id: comment.id,
|
||||
kind: "review-comment",
|
||||
author: comment.author,
|
||||
body: comment.body,
|
||||
createdAt: comment.createdAt,
|
||||
url: comment.url,
|
||||
path: thread.path,
|
||||
reviewState: null,
|
||||
reactions: comment.reactions ?? [],
|
||||
}),
|
||||
),
|
||||
thread.comments.map((comment): PullRequestComment => ({
|
||||
id: comment.id,
|
||||
kind: "review-comment",
|
||||
author: comment.author,
|
||||
body: comment.body,
|
||||
createdAt: comment.createdAt,
|
||||
url: comment.url,
|
||||
path: thread.path,
|
||||
reviewState: null,
|
||||
reactions: comment.reactions ?? [],
|
||||
})),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -518,13 +518,11 @@ export const make = Effect.fn("resourceTelemetry.desktopTelemetryReceiver.make")
|
||||
if (message.type === "desktopTelemetryHello") {
|
||||
return recordContact.pipe(
|
||||
Effect.andThen(
|
||||
updateHealth(
|
||||
(current): DesktopTelemetryReceiverHealth => ({
|
||||
...current,
|
||||
status: "healthy",
|
||||
lastError: Option.none(),
|
||||
}),
|
||||
),
|
||||
updateHealth((current): DesktopTelemetryReceiverHealth => ({
|
||||
...current,
|
||||
status: "healthy",
|
||||
lastError: Option.none(),
|
||||
})),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -549,22 +547,18 @@ export const make = Effect.fn("resourceTelemetry.desktopTelemetryReceiver.make")
|
||||
);
|
||||
}),
|
||||
Effect.andThen(
|
||||
updateHealth(
|
||||
(current): DesktopTelemetryReceiverHealth => ({
|
||||
...current,
|
||||
status: "stopped",
|
||||
lastError: Option.some(new DesktopTelemetryStreamClosed({ fd }).message),
|
||||
}),
|
||||
),
|
||||
updateHealth((current): DesktopTelemetryReceiverHealth => ({
|
||||
...current,
|
||||
status: "stopped",
|
||||
lastError: Option.some(new DesktopTelemetryStreamClosed({ fd }).message),
|
||||
})),
|
||||
),
|
||||
Effect.catch((error) =>
|
||||
updateHealth(
|
||||
(current): DesktopTelemetryReceiverHealth => ({
|
||||
...current,
|
||||
status: "degraded",
|
||||
lastError: Option.some(error.message),
|
||||
}),
|
||||
),
|
||||
updateHealth((current): DesktopTelemetryReceiverHealth => ({
|
||||
...current,
|
||||
status: "degraded",
|
||||
lastError: Option.some(error.message),
|
||||
})),
|
||||
),
|
||||
Effect.forkScoped,
|
||||
);
|
||||
|
||||
@@ -491,12 +491,10 @@ export const make = Effect.fn("resourceTelemetry.resourceTelemetry.make")(functi
|
||||
validateProcessIdentity,
|
||||
retry: nativeClient.retry.pipe(
|
||||
Effect.zip(Ref.get(state)),
|
||||
Effect.map(
|
||||
([accepted, current]): ResourceTelemetryRetryResult => ({
|
||||
accepted,
|
||||
snapshot: current.latest,
|
||||
}),
|
||||
),
|
||||
Effect.map(([accepted, current]): ResourceTelemetryRetryResult => ({
|
||||
accepted,
|
||||
snapshot: current.latest,
|
||||
})),
|
||||
),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -333,7 +333,7 @@ async function runUpload(job: UploadJob): Promise<void> {
|
||||
}
|
||||
|
||||
function pumpUploads(): void {
|
||||
for (let index = 0; index < queue.length; ) {
|
||||
for (let index = 0; index < queue.length;) {
|
||||
const job = queue[index]!;
|
||||
const active = activeUploadsByEnvironment.get(job.environmentId) ?? 0;
|
||||
if (active >= MAX_UPLOADS_PER_ENVIRONMENT) {
|
||||
|
||||
@@ -317,12 +317,10 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* (
|
||||
}),
|
||||
});
|
||||
const lease = yield* effect.pipe(
|
||||
Effect.mapError(
|
||||
(error): TracedAttemptFailure => ({
|
||||
error,
|
||||
attemptSpan: Option.some(attemptSpan),
|
||||
}),
|
||||
),
|
||||
Effect.mapError((error): TracedAttemptFailure => ({
|
||||
error,
|
||||
attemptSpan: Option.some(attemptSpan),
|
||||
})),
|
||||
);
|
||||
return { attemptSpan: Option.some(attemptSpan), lease };
|
||||
}).pipe(Effect.withSpan("relay.connection.attempt", { root: true }));
|
||||
@@ -358,12 +356,10 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* (
|
||||
attemptSpan: Option.none<Tracer.Span>(),
|
||||
lease,
|
||||
})),
|
||||
Effect.mapError(
|
||||
(error): TracedAttemptFailure => ({
|
||||
error,
|
||||
attemptSpan: Option.none(),
|
||||
}),
|
||||
),
|
||||
Effect.mapError((error): TracedAttemptFailure => ({
|
||||
error,
|
||||
attemptSpan: Option.none(),
|
||||
})),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -514,20 +510,16 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* (
|
||||
exitUnlessInterrupted(
|
||||
establishTracedConnection(attempt, generation, lastFailure, pendingRetry),
|
||||
).pipe(
|
||||
Effect.map(
|
||||
(exit): EstablishmentEvent => ({
|
||||
_tag: "Completed",
|
||||
exit,
|
||||
}),
|
||||
),
|
||||
Effect.map((exit): EstablishmentEvent => ({
|
||||
_tag: "Completed",
|
||||
exit,
|
||||
})),
|
||||
),
|
||||
waitForEstablishmentInterrupt().pipe(
|
||||
Effect.map(
|
||||
(resetRetry): EstablishmentEvent => ({
|
||||
_tag: "Interrupted",
|
||||
resetRetry,
|
||||
}),
|
||||
),
|
||||
Effect.map((resetRetry): EstablishmentEvent => ({
|
||||
_tag: "Interrupted",
|
||||
resetRetry,
|
||||
})),
|
||||
),
|
||||
Effect.sleep(CONNECTION_ESTABLISHMENT_TIMEOUT).pipe(
|
||||
Effect.as<EstablishmentEvent>({ _tag: "TimedOut" }),
|
||||
@@ -602,20 +594,16 @@ export const make = Effect.fn("EnvironmentSupervisor.make")(function* (
|
||||
|
||||
const connectedExit = yield* Effect.raceAllFirst([
|
||||
active.lease.session.closed.pipe(
|
||||
Effect.mapError(
|
||||
(error): TracedAttemptFailure => ({
|
||||
error,
|
||||
attemptSpan: active.attemptSpan,
|
||||
}),
|
||||
),
|
||||
Effect.mapError((error): TracedAttemptFailure => ({
|
||||
error,
|
||||
attemptSpan: active.attemptSpan,
|
||||
})),
|
||||
),
|
||||
monitorConnectedLease(active.lease).pipe(
|
||||
Effect.mapError(
|
||||
(error): TracedAttemptFailure => ({
|
||||
error,
|
||||
attemptSpan: active.attemptSpan,
|
||||
}),
|
||||
),
|
||||
Effect.mapError((error): TracedAttemptFailure => ({
|
||||
error,
|
||||
attemptSpan: active.attemptSpan,
|
||||
})),
|
||||
),
|
||||
waitForAuthorizationRefresh(active.lease.prepared),
|
||||
]).pipe(exitUnlessInterrupted);
|
||||
|
||||
@@ -607,14 +607,11 @@ describe("RpcSessionFactory", () => {
|
||||
payload: { themes: [] },
|
||||
},
|
||||
];
|
||||
const settingsEvents = Array.from(
|
||||
{ length: 65 },
|
||||
(): ServerConfigStreamEventType => ({
|
||||
version: 1,
|
||||
type: "settingsUpdated",
|
||||
payload: { settings: DEFAULT_SERVER_SETTINGS },
|
||||
}),
|
||||
);
|
||||
const settingsEvents = Array.from({ length: 65 }, (): ServerConfigStreamEventType => ({
|
||||
version: 1,
|
||||
type: "settingsUpdated",
|
||||
payload: { settings: DEFAULT_SERVER_SETTINGS },
|
||||
}));
|
||||
const allEvents = [...themeEvents, ...settingsEvents];
|
||||
const observedByFastSubscriber = yield* Queue.unbounded<ServerConfigStreamEventType>();
|
||||
yield* session.subscribeServerConfig({ environmentThemes: true }).pipe(
|
||||
|
||||
@@ -3831,7 +3831,10 @@ export type V2ConfigWriteResponse__WriteStatus = "ok" | "okOverridden";
|
||||
export const V2ConfigWriteResponse__WriteStatus = Schema.Literals(["ok", "okOverridden"]);
|
||||
|
||||
export type V2ConsumeAccountRateLimitResetCreditResponse__ConsumeAccountRateLimitResetCreditOutcome =
|
||||
"reset" | "nothingToReset" | "noCredit" | "alreadyRedeemed";
|
||||
| "reset"
|
||||
| "nothingToReset"
|
||||
| "noCredit"
|
||||
| "alreadyRedeemed";
|
||||
export const V2ConsumeAccountRateLimitResetCreditResponse__ConsumeAccountRateLimitResetCreditOutcome =
|
||||
Schema.Literals(["reset", "nothingToReset", "noCredit", "alreadyRedeemed"]);
|
||||
|
||||
@@ -3960,16 +3963,16 @@ export const V2ExternalAgentConfigDetectResponse__SubagentMigration = Schema.Str
|
||||
});
|
||||
|
||||
export type V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType =
|
||||
| "AGENTS_MD"
|
||||
| "CONFIG"
|
||||
| "SKILLS"
|
||||
| "PLUGINS"
|
||||
| "MCP_SERVER_CONFIG"
|
||||
| "SUBAGENTS"
|
||||
| "HOOKS"
|
||||
| "COMMANDS"
|
||||
| "MEMORY"
|
||||
| "SESSIONS";
|
||||
| "AGENTS_MD"
|
||||
| "CONFIG"
|
||||
| "SKILLS"
|
||||
| "PLUGINS"
|
||||
| "MCP_SERVER_CONFIG"
|
||||
| "SUBAGENTS"
|
||||
| "HOOKS"
|
||||
| "COMMANDS"
|
||||
| "MEMORY"
|
||||
| "SESSIONS";
|
||||
export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConfigMigrationItemType =
|
||||
Schema.Literals([
|
||||
"AGENTS_MD",
|
||||
@@ -3985,16 +3988,16 @@ export const V2ExternalAgentConfigImportCompletedNotification__ExternalAgentConf
|
||||
]);
|
||||
|
||||
export type V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType =
|
||||
| "AGENTS_MD"
|
||||
| "CONFIG"
|
||||
| "SKILLS"
|
||||
| "PLUGINS"
|
||||
| "MCP_SERVER_CONFIG"
|
||||
| "SUBAGENTS"
|
||||
| "HOOKS"
|
||||
| "COMMANDS"
|
||||
| "MEMORY"
|
||||
| "SESSIONS";
|
||||
| "AGENTS_MD"
|
||||
| "CONFIG"
|
||||
| "SKILLS"
|
||||
| "PLUGINS"
|
||||
| "MCP_SERVER_CONFIG"
|
||||
| "SUBAGENTS"
|
||||
| "HOOKS"
|
||||
| "COMMANDS"
|
||||
| "MEMORY"
|
||||
| "SESSIONS";
|
||||
export const V2ExternalAgentConfigImportHistoriesReadResponse__ExternalAgentConfigMigrationItemType =
|
||||
Schema.Literals([
|
||||
"AGENTS_MD",
|
||||
|
||||
@@ -778,7 +778,7 @@ export class QrSegment {
|
||||
if (!QrSegment.isNumeric(digits))
|
||||
throw new RangeError("String contains non-numeric characters");
|
||||
let bb: Array<bit> = [];
|
||||
for (let i = 0; i < digits.length; ) {
|
||||
for (let i = 0; i < digits.length;) {
|
||||
// Consume up to 3 digits per iteration
|
||||
const n: int = Math.min(digits.length - i, 3);
|
||||
appendBits(parseInt(digits.substring(i, i + n), 10), n * 3 + 1, bb);
|
||||
|
||||
Generated
+613
-366
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -53,8 +53,8 @@ catalog:
|
||||
lightningcss: 1.33.0
|
||||
tailwindcss: 4.3.3
|
||||
typescript: ~6.0.3
|
||||
vite: npm:@voidzero-dev/vite-plus-core@0.2.2
|
||||
vite-plus: 0.2.2
|
||||
vite: npm:@voidzero-dev/vite-plus-core@0.3.0
|
||||
vite-plus: 0.3.0
|
||||
yaml: ^2.9.0
|
||||
|
||||
minimumReleaseAgeExclude:
|
||||
|
||||
Reference in new issue
Block a user