Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/desktop/src/app/DesktopApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const MAX_TCP_PORT = 65_535;
const DESKTOP_BACKEND_PORT_PROBE_HOSTS = ["127.0.0.1", "0.0.0.0", "::"] as const;

const makeDesktopRunId = Crypto.Crypto.pipe(
Effect.flatMap((crypto) => crypto.randomUUIDv4),
Effect.flatMap((crypto) => crypto.randomUUIDv4()),
Effect.map((value) => value.replaceAll("-", "").slice(0, 12)),
);

Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/app/DesktopConnectionCatalogStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ export const make = Effect.gen(function* () {
),
),
);
const suffix = (yield* crypto.randomUUIDv4.pipe(
const suffix = (yield* crypto.randomUUIDv4().pipe(
Effect.mapError(
(cause) =>
new DesktopConnectionCatalogStoreWriteError({
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/preview/Manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2501,7 +2501,7 @@ const makeNativeOperations = Effect.fn("PreviewManager.makeOperations")(function
wc,
),
]);
const uuid = yield* crypto.randomUUIDv4.pipe(Effect.orDie);
const uuid = yield* crypto.randomUUIDv4().pipe(Effect.orDie);
const id = `browser-screenshot-${artifactSiteSlug(wc.getURL())}-${millis.toString(36)}-${uuid.slice(0, 8)}`;
const artifactPath = path.join(resolvedArtifactDirectory, `${id}.png`);
const data = image.toPNG();
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/settings/DesktopAppSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ export const make = Effect.gen(function* () {
return Effect.succeed([settingsChange(settings, false), settings] as const);
}

return crypto.randomUUIDv4.pipe(
return crypto.randomUUIDv4().pipe(
Effect.map((uuid) => uuid.replace(/-/g, "")),
Effect.mapError(
(cause) =>
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/settings/DesktopClientSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ export const make = Effect.gen(function* () {
Effect.withSpan("desktop.clientSettings.get"),
),
set: (settings) =>
crypto.randomUUIDv4.pipe(
crypto.randomUUIDv4().pipe(
Effect.map((uuid) => uuid.replace(/-/g, "")),
Effect.mapError(
(cause) =>
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/snapShot/DesktopSnapShot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ export const make = Effect.gen(function* () {
const prepareCapture = Effect.fn("desktop.snapShot.prepareCapture")(function* (
settings: ClientSettings,
) {
const id = yield* crypto.randomUUIDv4.pipe(Effect.mapError((cause) => captureFailure(cause)));
const id = yield* crypto.randomUUIDv4().pipe(Effect.mapError((cause) => captureFailure(cause)));
const mode = captureMode(environment.platform);
if (mode === "unavailable") {
return yield* new DesktopSnapShotError({ operation: "unsupported", captureId: id });
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/ssh/DesktopSshPasswordPrompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ export const make = Effect.fn("desktop.sshPasswordPrompts.make")(function* (
});
}

const requestId = yield* crypto.randomUUIDv4.pipe(
const requestId = yield* crypto.randomUUIDv4().pipe(
Effect.mapError(
(cause) =>
new DesktopSshPromptRequestIdGenerationError({
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/features/cloud/dpop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ export function createDpopProof(input: {
});
const nowMs = yield* Clock.currentTimeMillis;
const jti = yield* Crypto.Crypto.pipe(
Effect.flatMap((crypto) => crypto.randomUUIDv4),
Effect.flatMap((crypto) => crypto.randomUUIDv4()),
Effect.mapError(cloudDpopError("Could not generate DPoP proof identifier.")),
);
const htu = yield* normalizeHtu(input.url);
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/assets/AttachmentUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ export const storeAttachmentUpload = Effect.fn("AttachmentUpload.store")(functio
relativePath,
});
const crypto = yield* Crypto.Crypto;
const partId = yield* crypto.randomUUIDv4.pipe(Effect.orDie);
const partId = yield* crypto.randomUUIDv4().pipe(Effect.orDie);
const partPath = resolveAttachmentRelativePath({
attachmentsDir: config.attachmentsDir,
relativePath: `${relativePath}.${partId}.part`,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/assets/NativeAppIconResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ const resolveNativeAppIconUncached = Effect.fn("NativeAppIconResolver.resolveUnc
yield* fileSystem.makeDirectory(cacheDirectory, { recursive: true });
const temporaryPath = path.join(
cacheDirectory,
`.${cacheKey}-${process.pid}-${(yield* Clock.currentTimeMillis).toString(36)}-${yield* crypto.randomUUIDv4.pipe(Effect.orDie)}.png`,
`.${cacheKey}-${process.pid}-${(yield* Clock.currentTimeMillis).toString(36)}-${yield* crypto.randomUUIDv4().pipe(Effect.orDie)}.png`,
);
yield* commandOutput("/usr/bin/sips", [
"-z",
Expand Down
13 changes: 8 additions & 5 deletions apps/server/src/auth/PairingGrantStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,14 @@ export const make = Effect.gen(function* () {
const issueOneTimeToken: PairingGrantStore["Service"]["issueOneTimeToken"] = Effect.fn(
"PairingGrantStore.issueOneTimeToken",
)(function* (input) {
const id = yield* crypto.randomUUIDv4.pipe(
Effect.mapError(
(cause) => new PairingCredentialRandomGenerationError({ operation: "generate-id", cause }),
),
);
const id = yield* crypto
.randomUUIDv4()
.pipe(
Effect.mapError(
(cause) =>
new PairingCredentialRandomGenerationError({ operation: "generate-id", cause }),
),
);
const credential = yield* generatePairingToken;
const isDevStartupToken = config.devUrl !== undefined && input?.purpose === "startup";
const ttl =
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/auth/ServerSecretStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ export const make = Effect.gen(function* () {

const set: ServerSecretStore["Service"]["set"] = (name, value) => {
const secretPath = resolveSecretPath(name);
return crypto.randomUUIDv4.pipe(
return crypto.randomUUIDv4().pipe(
Effect.mapError(
(cause) =>
new SecretStoreTemporaryPathError({
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/auth/SessionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,9 @@ export const make = Effect.gen(function* () {
const issue: SessionStore["Service"]["issue"] = Effect.fn("SessionStore.issue")(
function* (input) {
const sessionId = AuthSessionId.make(
yield* crypto.randomUUIDv4.pipe(
Effect.mapError((cause) => new SessionCredentialIssueError({ cause })),
),
yield* crypto
.randomUUIDv4()
.pipe(Effect.mapError((cause) => new SessionCredentialIssueError({ cause }))),
);
const issuedAt = yield* DateTime.now;
const expiresAt = DateTime.add(issuedAt, {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/cli/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ const runAppCommand = Effect.fn("cli.app")(function* (flags: {
joinPath: path.join,
}).address;
const crypto = yield* Crypto.Crypto;
const requestId = yield* crypto.randomUUIDv4.pipe(Effect.orDie);
const requestId = yield* crypto.randomUUIDv4().pipe(Effect.orDie);
const request: DesktopAppActivationRequest = {
version: DESKTOP_APP_ACTIVATION_PROTOCOL_VERSION,
requestId,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/cli/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export function projectCommandErrorFromLiveServerRequest(cause: unknown): Projec
}

const projectCommandUuid = Crypto.Crypto.pipe(
Effect.flatMap((crypto) => crypto.randomUUIDv4),
Effect.flatMap((crypto) => crypto.randomUUIDv4()),
Effect.mapError(
(cause) =>
new ProjectCommandIdGenerationError({
Expand Down
8 changes: 4 additions & 4 deletions apps/server/src/cloud/CloudLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,7 +647,7 @@ const make = Effect.gen(function* () {
iss: `t3-env:${descriptor.environmentId}`,
aud: normalizeRelayIssuer(request.relayIssuer),
sub: descriptor.environmentId,
jti: yield* crypto.randomUUIDv4,
jti: yield* crypto.randomUUIDv4(),
iat: nowSeconds,
exp: Math.floor(expiresAt.epochMilliseconds / 1_000),
challenge: request.challenge,
Expand Down Expand Up @@ -984,7 +984,7 @@ const make = Effect.gen(function* () {
Option.isSome(configuredIssuer) ? bytesToString(configuredIssuer.value) : input.relayUrl,
),
sub: input.environmentId,
jti: yield* crypto.randomUUIDv4,
jti: yield* crypto.randomUUIDv4(),
iat: issuedAt,
exp: issuedAt + 60,
environmentId: input.environmentId,
Expand Down Expand Up @@ -1517,7 +1517,7 @@ const make = Effect.gen(function* () {
iss: `t3-env:${environmentId}`,
aud: normalizeRelayIssuer(relayIssuer),
sub: environmentId,
jti: yield* crypto.randomUUIDv4,
jti: yield* crypto.randomUUIDv4(),
iat: nowSeconds,
exp: Math.floor(responseExpiresAt.epochMilliseconds / 1_000),
environmentId,
Expand Down Expand Up @@ -1627,7 +1627,7 @@ const make = Effect.gen(function* () {
iss: `t3-env:${environmentId}`,
aud: normalizeRelayIssuer(relayIssuer),
sub: environmentId,
jti: yield* crypto.randomUUIDv4,
jti: yield* crypto.randomUUIDv4(),
iat: nowSeconds,
exp: Math.floor(issued.expiresAt.epochMilliseconds / 1_000),
environmentId,
Expand Down
12 changes: 7 additions & 5 deletions apps/server/src/desktopUpdate/DesktopAppUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,13 @@ export const make = Effect.fn("desktopUpdate.desktopAppUpdate.make")(function* (

return yield* Effect.scoped(
Effect.gen(function* () {
const requestId = yield* crypto.randomUUIDv4.pipe(
Effect.mapError((error) =>
failWith("Could not generate a desktop update request id.", error),
),
);
const requestId = yield* crypto
.randomUUIDv4()
.pipe(
Effect.mapError((error) =>
failWith("Could not generate a desktop update request id.", error),
),
);
// Subscribe before sending the request so a fast first report
// cannot be missed.
const { changes } = yield* receiver.desktopUpdates;
Expand Down
17 changes: 9 additions & 8 deletions apps/server/src/environment/ServerEnvironment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,14 +171,15 @@ it.layer(NodeServices.layer)("ServerEnvironmentLive", (it) => {
}),
Effect.provideService(Crypto.Crypto, {
...crypto,
randomUUIDv4: Effect.gen(function* () {
const id = yield* crypto.randomUUIDv4;
if (--remaining === 0) {
yield* Deferred.succeed(bothGenerated, undefined);
}
yield* Deferred.await(bothGenerated);
return id;
}),
randomUUIDv4: (() =>
Effect.gen(function* () {
const id = yield* crypto.randomUUIDv4();
if (--remaining === 0) {
yield* Deferred.succeed(bothGenerated, undefined);
}
yield* Deferred.await(bothGenerated);
return id;
})) as Crypto.Crypto["randomUUIDv4"],
}),
);

Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/environment/ServerEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const makeIdentity = Effect.gen(function* () {
return persisted;
}

const generated = yield* crypto.randomUUIDv4;
const generated = yield* crypto.randomUUIDv4();
yield* persistEnvironmentId(generated, "create");
let winner = yield* readPersistedEnvironmentId;
if (winner === null) {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/git/GitManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,7 @@ export const make = Effect.gen(function* () {
}
});
const randomUUIDv4 = (cwd: string) =>
crypto.randomUUIDv4.pipe(
crypto.randomUUIDv4().pipe(
Effect.mapError(
(cause) =>
new GitManagerError({
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/mcp/McpHttpServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ const saveScreenshot = Effect.fn("McpHttpServer.saveScreenshot")(function* (
const millis = yield* Clock.currentTimeMillis;
const crypto = yield* Crypto.Crypto;
// Two saves in the same millisecond must not overwrite each other.
const unique = (yield* crypto.randomUUIDv4.pipe(Effect.orDie)).slice(0, 8);
const unique = (yield* crypto.randomUUIDv4().pipe(Effect.orDie)).slice(0, 8);
const fileName = `browser-screenshot-${screenshotSiteSlug(pageUrl)}-${millis.toString(36)}-${unique}.png`;
const screenshotPath = path.join(config.browserArtifactsDir, fileName);
yield* fileSystem.makeDirectory(config.browserArtifactsDir, { recursive: true }).pipe(
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/mcp/McpSessionRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ const makeWithOptions = Effect.fn("McpSessionRegistry.make")(function* (
const issue: McpSessionRegistryShape["issue"] = Effect.fn("McpSessionRegistry.issue")(
function* (request) {
const issuedAt = yield* currentTimeMillis;
const providerSessionId = yield* crypto.randomUUIDv4.pipe(Effect.orDie);
const providerSessionId = yield* crypto.randomUUIDv4().pipe(Effect.orDie);
const rawToken = yield* crypto.randomBytes(32).pipe(Effect.map(tokenFromBytes), Effect.orDie);
const tokenHash = yield* hashToken(rawToken);
const browserToolsAvailable = request.browserToolsAvailable ?? true;
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/mcp/OrchestratorMcpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1322,7 +1322,7 @@ const make = Effect.gen(function* () {

const requestKey = (clientRequestId: string | undefined): Effect.Effect<string> =>
clientRequestId === undefined
? crypto.randomUUIDv4.pipe(Effect.orDie)
? crypto.randomUUIDv4().pipe(Effect.orDie)
: Effect.succeed(clientRequestId);

const readTask = (
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/mcp/PreviewAutomationBroker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ export const make = Effect.gen(function* PreviewAutomationBrokerMake() {
) {
const clientId = host.clientId;
const queue = yield* Queue.unbounded<PreviewAutomationStreamEvent, Cause.Done>();
const connectionId = yield* crypto.randomUUIDv4.pipe(Effect.orDie);
const connectionId = yield* crypto.randomUUIDv4().pipe(Effect.orDie);
yield* Queue.offer(queue, { type: "connected", connectionId });
const connection: ClientConnection = {
clientId,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/mcp/ThreadMetadataMcpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ const make = Effect.gen(function* () {
.pipe(Effect.mapError(threadLookupFailure));
const requestKey =
input.clientRequestId === undefined
? yield* crypto.randomUUIDv4.pipe(Effect.orDie)
? yield* crypto.randomUUIDv4().pipe(Effect.orDie)
: input.clientRequestId;
const updateCommandId = commandId({
scope,
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/mcp/WorktreeMcpService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ const make = Effect.gen(function* () {
);

const handoffIds = (scope: McpThreadInvocationScope) =>
crypto.randomUUIDv4.pipe(
crypto.randomUUIDv4().pipe(
Effect.map((uuid) => {
const part = (kind: string, operation: string) =>
[kind, "mcp", encodeURIComponent(scope.thread.providerSessionId), operation, uuid].join(
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/mcp/threadAccess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,5 @@ export const readThread = Effect.fn("mcp.readThread")(function* <

export const newCommandId = Effect.fn("mcp.newCommandId")(function* () {
const crypto = yield* Crypto.Crypto;
return CommandId.make(`mcp:${yield* crypto.randomUUIDv4.pipe(Effect.orDie)}`);
return CommandId.make(`mcp:${yield* crypto.randomUUIDv4().pipe(Effect.orDie)}`);
});
2 changes: 1 addition & 1 deletion apps/server/src/mcp/toolkits/pullRequests/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ const make = Effect.gen(function* () {
const crypto = yield* Crypto.Crypto;

const commandId = (tag: string, threadId: ThreadId) =>
crypto.randomUUIDv4.pipe(
crypto.randomUUIDv4().pipe(
Effect.orDie,
Effect.map((uuid) => CommandId.make(`server:${tag}:${threadId}:${uuid}`)),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1588,7 +1588,7 @@ async function recordClaudeStreamingQuery(input: {
text: prompt,
uuid: await Effect.runPromise(
Crypto.Crypto.pipe(
Effect.flatMap((crypto) => crypto.randomUUIDv4),
Effect.flatMap((crypto) => crypto.randomUUIDv4()),
Effect.filterOrFail(ClaudeAdapterV2.isClaudePromptUuid),
Effect.provide(NodeServices.layer),
),
Expand Down
8 changes: 4 additions & 4 deletions apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -663,9 +663,9 @@ export const layerQueryRunner: Layer.Layer<
const agentScope = yield* AgentScope;

return ClaudeAgentSdkQueryRunner.of({
allocateSessionId: crypto.randomUUIDv4.pipe(
Effect.mapError((cause) => queryRunnerError(cause, "allocateSessionId")),
),
allocateSessionId: crypto
.randomUUIDv4()
.pipe(Effect.mapError((cause) => queryRunnerError(cause, "allocateSessionId"))),
open: Effect.fn("ClaudeAgentSdkQueryRunner.open")(function* (
input: ClaudeAgentSdkQueryOpenInput,
) {
Expand Down Expand Up @@ -8499,7 +8499,7 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
// a uuid derived from run ids can repeat.
const promptUuid = isClaudeProviderContinuationTurn(turnInput)
? null
: yield* crypto.randomUUIDv4.pipe(
: yield* crypto.randomUUIDv4().pipe(
Effect.filterOrFail(isClaudePromptUuid),
Effect.mapError(
(cause) =>
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/orchestration-v2/PullRequestSyncReactor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export const make = Effect.gen(function* () {
}
const url = siblingPullRequestUrl(link.url, layer.number);
if (url === null) continue;
const uuid = yield* crypto.randomUUIDv4;
const uuid = yield* crypto.randomUUIDv4();
yield* engine.dispatch({
type: "thread.pull-request.link",
commandId: CommandId.make(`server:pr-stack-link:${thread.id}:${uuid}`),
Expand All @@ -259,7 +259,7 @@ export const make = Effect.gen(function* () {
linkedThisSweep.add(dedupeKey);
}
if (changed) {
const uuid = yield* crypto.randomUUIDv4;
const uuid = yield* crypto.randomUUIDv4();
yield* engine.dispatch({
type: "thread.pull-request-link.sync",
commandId: CommandId.make(`server:pr-sync:${thread.id}:${uuid}`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export const make = Effect.gen(function* () {
wake?: { readonly text: string; readonly notification: OrchestrationV2Notification },
) =>
Effect.gen(function* () {
const uuid = yield* crypto.randomUUIDv4;
const uuid = yield* crypto.randomUUIDv4();
yield* engine.dispatch({
type: "thread.pull-request-watch.sync",
commandId: CommandId.make(`server:pr-watch:${target.thread.id}:${uuid}`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export const make = Effect.gen(function* () {
if (!projectWorkspaceMatchesSnapshot(currentProject, project.workspaceRoot)) {
return failBackfill([thread]);
}
const uuid = yield* crypto.randomUUIDv4;
const uuid = yield* crypto.randomUUIDv4();
yield* orchestrator.dispatch({
type: "thread.pull-request.sync",
commandId: CommandId.make(`server:thread-pull-request:${thread.id}:${uuid}`),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ export const make = Effect.gen(function* () {
autoSettleOnMerge: currentSettings.sidebarAutoSettleOnMerge,
});
if (settledAt === null) return thread;
const uuid = yield* crypto.randomUUIDv4;
const uuid = yield* crypto.randomUUIDv4();
yield* orchestrator.dispatch({
type: "thread.auto-settle",
commandId: CommandId.make(`server:auto-settle:${thread.id}:${uuid}`),
Expand Down
Loading
Loading