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 e2e/playwright-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
seedUserInE2eDatabase,
} from './d1-utils.ts'
import { ensurePrimaryUserExists, primaryTestUser } from './auth-test-user.ts'
import { usernameFromEmail } from '../packages/worker/src/app/username.ts'
import { usernameFromEmail } from '../packages/worker/src/identity/username.ts'

export * from '@playwright/test'

Expand Down
2 changes: 1 addition & 1 deletion packages/worker/client/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
primaryLinkCss,
} from './styles/style-primitives.ts'
import { type AppLoaderData } from '#app/loader-data.ts'
import { userHasRole } from '#app/permissions.ts'
import { userHasRole } from '#worker/identity/permissions.ts'
import { buildAuthLink } from './auth-links.ts'
import { colors, mq, spacing, typography } from './styles/tokens.ts'
import { WaitlistBanner } from './waitlist-banner.tsx'
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/client/routes/admin-users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import {
formatMonthKeyLabel,
usageMetricSeries,
} from '#client/charts/usage-metric-series.ts'
import { type RoleName } from '#app/permissions.ts'
import { type RoleName } from '#worker/identity/permissions.ts'
import {
type AdminPlanName,
type AdminUserListItem,
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/client/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
roleNames,
type PermissionString,
type RoleName,
} from '#app/permissions.ts'
} from '#worker/identity/permissions.ts'
import {
featureFlagKeys,
type FeatureFlagKey,
Expand Down
6 changes: 0 additions & 6 deletions packages/worker/src/app/account-deletion-state.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { type AccountPackageInvocationTokensLoaderData } from '#app/loader-data.ts'
import { type readAuthenticatedAppUser } from '#app/authenticated-user.ts'
import {
Expand Down
6 changes: 0 additions & 6 deletions packages/worker/src/app/app-base-url.ts

This file was deleted.

7 changes: 0 additions & 7 deletions packages/worker/src/app/audit-log.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/account-jobs.node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ vi.mock('#app/ssr-render.tsx', () => ({
renderAppPage: async () => new Response('ok'),
}))

vi.mock('#app/app-base-url.ts', () => ({
vi.mock('#worker/app-base-url.ts', () => ({
getAppBaseUrl: (...args: Array<unknown>) => mockModule.getAppBaseUrl(...args),
}))

Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/account-jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
loadAccountJobsData,
type AccountJobsLoaderData,
} from '#app/account-jobs-data.ts'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { readAuthenticatedAppUser } from '#app/authenticated-user.ts'
import { type AccountJobsLoaderData as AppAccountJobsLoaderData } from '#app/loader-data.ts'
import { requireAuthenticatedPageUser } from '#app/page-auth.ts'
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/account-mcp-servers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { requireAuthenticatedPageUser } from '#app/page-auth.ts'
import { readTrimmedStringOrEmpty } from '#app/request-body.ts'
import { renderAppPage } from '#app/ssr-render.tsx'
import { type routes } from '#app/routes.ts'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { createMcpClientHubClient } from '#worker/mcp-client/hub-client.ts'
import {
addMcpServer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ vi.mock('#app/ssr-render.tsx', () => ({
renderAppPage: async () => new Response('ok'),
}))

vi.mock('#app/app-base-url.ts', () => ({
vi.mock('#worker/app-base-url.ts', () => ({
getAppBaseUrl: (...args: Array<unknown>) => mockModule.getAppBaseUrl(...args),
}))

Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/account-profile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { jsonResponse } from '#worker/json-response.ts'
import { type Action } from 'remix/router'
import { getRequestIp, logAuditEvent } from '#worker/audit-log.ts'
import { loadAccountProfileData } from '#app/account-profile-data.ts'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { readAuthenticatedAppUser } from '#app/authenticated-user.ts'
import { getUniqueConstraintField } from '#worker/database-errors.ts'
import { type ProfileVisibility } from '#app/loader-data.ts'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@
renderAppPage: async () => new Response('ok'),
}))

vi.mock('#app/app-base-url.ts', () => ({
vi.mock('#worker/app-base-url.ts', () => ({
getAppBaseUrl: (...args: Array<unknown>) => mockModule.getAppBaseUrl(...args),
}))

vi.mock('#mcp/secrets/allowed-hosts.ts', async (importOriginal) => {
const actual =
await importOriginal<typeof import('#mcp/secrets/allowed-hosts.ts')>()

Check warning on line 114 in packages/worker/src/app/handlers/account-secrets.node.test.ts

View workflow job for this annotation

GitHub Actions / 🧹 Static

typescript-eslint(consistent-type-imports)

`import()` type annotations are forbidden.
return {
normalizeAllowedHosts: actual.normalizeAllowedHosts,
normalizeHost: actual.normalizeHost,
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/account-secrets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
resolveApprovalRequest,
toPackageOptions,
} from '#app/account-secrets-data.ts'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { readAuthenticatedAppUser } from '#app/authenticated-user.ts'
import { loadConnectOauthNextSteps } from '#app/connect-oauth-next-steps.ts'
import { renderAppPage } from '#app/ssr-render.tsx'
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/blog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Action } from 'remix/router'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { type routes } from '#app/routes.ts'
import { renderAppPage } from '#app/ssr-render.tsx'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/community-install.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from 'zod'
import { type Action } from 'remix/router'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { readAuthenticatedAppUser } from '#app/authenticated-user.ts'
import {
buildInstallAdaptPrompt,
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/og-page-image.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { type Action } from 'remix/router'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { type routes } from '#app/routes.ts'
import { getPublicOgPage } from '#worker/og/pages.ts'

Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/package-app.node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ vi.mock('#app/auth-redirect.ts', () => ({
mockModule.redirectToLogin(...args),
}))

vi.mock('#app/app-base-url.ts', () => ({
vi.mock('#worker/app-base-url.ts', () => ({
getAppBaseUrl: (...args: Array<unknown>) => mockModule.getAppBaseUrl(...args),
}))

Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/handlers/package-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { html } from 'remix/html-template'
import { createHtmlResponse } from 'remix/response/html'
import { readAuthenticatedAppUser } from '#app/authenticated-user.ts'
import { redirectToLoginWhenUnauthenticated } from '#app/auth-redirect.ts'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { type PackageAppOwner } from '#app/package-app-owner.ts'
import { getUsernameFormatValidationError } from '#worker/identity/username.ts'
import { getSavedPackageByKodyId } from '#worker/package-registry/repo.ts'
Expand Down
5 changes: 4 additions & 1 deletion packages/worker/src/app/loader-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import {
type PublicCommunityStargazer,
type PublicProfilePackageItem,
} from '#app/community-public-types.ts'
import { type PermissionString, type RoleName } from '#app/permissions.ts'
import {
type PermissionString,
type RoleName,
} from '#worker/identity/permissions.ts'
import { type AdminFeatureFlag } from '#worker/feature-flags/types.ts'

export type { ProfileVisibility }
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/onboarding-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { type OnboardingFeaturedListing } from '#app/community-public-types.ts'
import { type OnboardingLoaderData } from '#app/loader-data.ts'

Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/app/package-app-origin.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { html } from 'remix/html-template'
import { createHtmlResponse } from 'remix/response/html'
import { getAppBaseUrl, getPackageAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl, getPackageAppBaseUrl } from '#worker/app-base-url.ts'
import { redirectToLoginWhenUnauthenticated } from '#app/auth-redirect.ts'
import { readAuthenticatedAppUser } from '#app/authenticated-user.ts'
import { isSecureRequest } from '#app/auth-session.ts'
Expand Down
7 changes: 0 additions & 7 deletions packages/worker/src/app/permissions.ts

This file was deleted.

2 changes: 1 addition & 1 deletion packages/worker/src/app/ssr-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
buildStylesheetHref,
getClientBuildId,
} from '#app/client-build-id.ts'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { setAuthSessionSecret } from '#app/auth-session.ts'
import {
absolutizeDocumentHead,
Expand Down
6 changes: 0 additions & 6 deletions packages/worker/src/app/user-lookup.ts

This file was deleted.

6 changes: 0 additions & 6 deletions packages/worker/src/app/username.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { dispatchAdminPackageSubscriptionEvent } from '#worker/package-invocations/admin-package-subscriptions.ts'
import {
buildCommunityActivityRecordedEvent,
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/email/package-subscriptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import {
dispatchAdminPackageSubscriptionEvent,
readPreExecutionPackageInvocationInfrastructureCode,
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/execute-maintenance.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { exports as workerExports } from 'cloudflare:workers'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { createExecuteExecutor } from '#mcp/executor.ts'
import { handleSecretMaintenanceRequest } from './maintenance-handler.ts'
import { getErrorMessage } from '@kody-internal/shared/error-message.ts'
Expand Down
4 changes: 2 additions & 2 deletions packages/worker/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import {
import { withCors } from './utils.ts'
import { normalizeRedirectTo } from '#app/auth-redirect.ts'
import { checkRateLimit, authRateLimitConfig } from '#app/rate-limit.ts'
import { getRequestIp } from '#app/audit-log.ts'
import { getRequestIp } from '#worker/audit-log.ts'
import { handleCapabilityReindexRequest } from './capability-maintenance.ts'
import { handleExecuteSmokeRequest } from './execute-maintenance.ts'
import { handleJobReindexRequest } from './job-maintenance.ts'
Expand Down Expand Up @@ -68,7 +68,7 @@ import { sweepStaleInboundDeliveries } from '#worker/email/reconcile-inbound-del
import { pruneSystemEmailRetention } from '#worker/email/system-email.ts'
import { refreshStaleStripePlans } from '#worker/billing/subscription-sync.ts'
import { handleQueueBatch } from '#worker/queue-handler.ts'
import { findPublicUserIdentityByUsername } from '#app/user-lookup.ts'
import { findPublicUserIdentityByUsername } from '#worker/identity/user-lookup.ts'
import { pruneRetention, shouldRunRetentionCron } from '#app/retention.ts'
import { pruneJobRetention } from '#worker/jobs/job-retention-cleanup.ts'
import {
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/jobs/service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type McpCallerContext } from '@kody-internal/shared/chat.ts'
import { type ExecuteResult } from '@cloudflare/codemode'
import { withAccountWriteLease } from '#app/account-deletion-state.ts'
import { withAccountWriteLease } from '#worker/account/deletion-state.ts'
import { McpCallerError } from '#mcp/caller-error.ts'
import { createMcpCallerContext, parseMcpCallerContext } from '#mcp/context.ts'
import { buildJobEmbedText } from '#mcp/jobs-embed.ts'
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/mcp-auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
type TokenSummary,
} from '@cloudflare/workers-oauth-provider'
import { isAccountSuspended } from '#app/account-suspension.ts'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { getRequestIp } from '#worker/audit-log.ts'
import { isAccountEmailVerified } from '#worker/identity/email-verification-state.ts'
import { buildMcpUserContextFromGrantProps } from './mcp-auth-user-context.ts'
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/oauth-handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { invalidClientIdMismatchMessage } from '@kody-internal/shared/oauth-mess
import { getUsernameFormatValidationError } from '#worker/identity/username.ts'
import { getPkceValidationError } from '#worker/oauth-pkce.ts'
import { oauthPaths } from '#app/oauth-paths.ts'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { mcpResourcePath } from './mcp-auth.ts'

export { oauthPaths }
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/package-invocations/http.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { jsonResponse } from '#worker/json-response.ts'
import { getRequestIp, logAuditEvent } from '#worker/audit-log.ts'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { findPublicUserIdentityByUsername } from '#worker/identity/user-lookup.ts'
import {
AccountDeletionInProgressError,
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/package-runtime/package-workflows.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
type WorkflowEvent,
type WorkflowStep,
} from 'cloudflare:workers'
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { createMcpCallerContext } from '#mcp/context.ts'
import {
readPreExecutionPackageInvocationInfrastructureCode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { dispatchAdminPackageSubscriptionEvent } from '#worker/package-invocations/admin-package-subscriptions.ts'
import {
buildPlatformFeedbackSubmittedEvent,
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/run-records/package-subscriptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { readPreExecutionPackageInvocationInfrastructureCode } from '#worker/package-invocations/admin-package-subscriptions.ts'
import { invokePackageSubscription } from '#worker/package-invocations/service.ts'
import { listPackageSubscriptions } from '#worker/package-registry/manifest.ts'
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/webhooks/http.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import {
AccountDeletionInProgressError,
assertAccountWritable,
Expand Down
2 changes: 1 addition & 1 deletion packages/worker/src/webhooks/service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getAppBaseUrl } from '#app/app-base-url.ts'
import { getAppBaseUrl } from '#worker/app-base-url.ts'
import { resolvePublicUsername } from '#worker/identity/user-lookup.ts'
import {
listPackageWebhooks,
Expand Down
1 change: 0 additions & 1 deletion packages/worker/tsconfig-client.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"./client/**/*.tsx",
"./client/**/*.d.ts",
"./src/app/oauth-login-errors.ts",
"./src/app/permissions.ts",
"./src/app/routes.ts",
"./src/app/route-pattern.ts",
"./src/app/oauth-paths.ts",
Expand Down
6 changes: 3 additions & 3 deletions tsconfig-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"./packages/worker/src/test-support/cloudflare-mock-server.ts",
"./tools/**/*.ts",
"./packages/shared/src/**/*.ts",
// Worker app modules imported by the seeding tools.
"./packages/worker/src/app/username.ts",
"./packages/worker/src/app/reserved-usernames.ts"
// Worker identity modules imported by the seeding tools.
"./packages/worker/src/identity/username.ts",
"./packages/worker/src/identity/reserved-usernames.ts"
]
}
Loading