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 README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

mosoo provides a Cloudflare-native control plane to stream tool activity, inspect Run history, and keep Threads and files across executions. It is self-hostable in your own account.

Your application remains yours. Its backend owns product behavior and end-user access. mosoo focuses on Agent execution and lifecycle; App Deployment is a separate Alpha surface, not the core product contract.
Your application remains yours. Its backend owns product behavior and end-user access. mosoo focuses on Agent execution and lifecycle.

## How It Works

Expand Down
2 changes: 0 additions & 2 deletions apps/api/.dev.vars.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@ GOOGLE_OAUTH_CLIENT_SECRET=
R2_ACCESS_KEY_ID=
R2_SECRET_ACCESS_KEY=
CLOUDFLARE_ACCOUNT_ID=
CLOUDFLARE_API_TOKEN=
CLOUDFLARE_ZONE_ID=
SKILLS_SH_API_TOKEN=
2 changes: 0 additions & 2 deletions apps/api/bin/init-dev-vars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ const devVarSpecs: readonly DevVarSpec[] = [
{ key: "R2_ACCESS_KEY_ID", required: false },
{ key: "R2_SECRET_ACCESS_KEY", required: false },
{ key: "CLOUDFLARE_ACCOUNT_ID", required: false },
{ key: "CLOUDFLARE_API_TOKEN", required: false },
{ key: "CLOUDFLARE_ZONE_ID", required: false },
{ key: "SKILLS_SH_API_TOKEN", required: false },
];

Expand Down
2 changes: 0 additions & 2 deletions apps/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@
"graphql": "^17.0.2",
"graphql-yoga": "^5.21.3",
"hono": "^4.12.32",
"jsonc-parser": "3.3.1",
"smol-toml": "1.8.0",
"xstate": "^5.32.0"
},
"devDependencies": {
Expand Down
5 changes: 0 additions & 5 deletions apps/api/src/adapters/graphql/graphql-module-specs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,9 @@ export const onboardingGraphQLSpec = {
export const appGraphQLSpec = {
mutationFields: [
"createApp(input: CreateAppInput!): App!",
"deleteAppDeployment(input: DeleteAppDeploymentInput!): OperationResult!",
"deployApp(input: DeployAppInput!): AppDeploymentRun!",
"renameApp(input: RenameAppInput!): App!",
],
queryFields: [
"appDeploymentRunList(appId: ULID!, limit: Int): [AppDeploymentRun!]!",
"appDeploymentStatus(appId: ULID!): AppDeploymentRun",
"appList(organizationId: ULID!): [App!]!",
"appOverview(appId: ULID!, agentLimit: Int, credentialLimit: Int): AppOverview!",
"controlPlaneOverview(appLimit: Int, agentLimit: Int, credentialLimit: Int): ControlPlaneOverview!",
Expand All @@ -127,7 +123,6 @@ export const sessionGraphQLSpec = {
],
queryFields: [
"agentSessionDiagnostics(appId: ULID!, sessionId: ULID!): AgentSessionDiagnostics!",
"boundCapabilityRunProvenance(appId: ULID!, runId: ULID!): BoundCapabilityRunProvenance",
"agentSessionRetrieve(appId: ULID!, sessionId: ULID!): AgentSessionRetrieve!",
"session(appId: ULID!, sessionId: ULID!): Session!",
"sessionMessages(appId: ULID!, sessionId: ULID!): [SessionMessage!]!",
Expand Down
84 changes: 0 additions & 84 deletions apps/api/src/adapters/graphql/schema.generated.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -454,52 +454,6 @@ type AppCostCard {
totals: CostTotals!
}

type AppDeployment {
appId: ULID!
createdAt: String!
defaultBranch: String!
id: ULID!
latestRun: AppDeploymentRun
liveUrl: String
plannedUrl: String!
repoName: String!
repoOwner: String!
repoUrl: String!
updatedAt: String!
}

type AppDeploymentRun {
appId: ULID!
createdAt: String!
deploymentId: ULID!
errorCode: String
errorMessage: String
id: ULID!
liveUrl: String
plannedUrl: String!
sourceBranch: String!
sourceCommitSha: String!
status: AppDeploymentRunStatus!
targetKind: AppDeploymentTargetKind
updatedAt: String!
}

enum AppDeploymentRunStatus {
activating
building
failed
preparing
queued
submitted
submitting
success
}

enum AppDeploymentTargetKind {
cloudflare_pages
cloudflare_worker
}

type AppInfo {
api: String!
name: String!
Expand All @@ -509,8 +463,6 @@ type AppInfo {
type AppOverview {
agents: AppOverviewAgentList!
app: App!
boundAgents: [AppOverviewBoundAgent!]!
deployment: AppDeployment
providerCredentials: AppOverviewProviderCredentialList!
}

Expand All @@ -533,17 +485,6 @@ type AppOverviewAgentList {
limit: Int!
}

type AppOverviewBoundAgent {
agentId: ULID!
envVar: String!
expose: AppOverviewBoundAgentExposure!
name: String!
}

enum AppOverviewBoundAgentExposure {
public_thread
}

type AppOverviewProviderCredential {
appId: ULID!
hasCustomApiBase: Boolean!
Expand Down Expand Up @@ -588,16 +529,6 @@ input BootstrapOnboardingInput {
name: String
}

type BoundCapabilityRunProvenance {
agentId: ULID!
appId: ULID!
bindingEnv: String!
bindingName: String!
deploymentId: ULID!
deploymentRunId: ULID!
runId: ULID!
}

input ConnectMcpBearerInput {
appId: ULID!
serverId: ULID!
Expand Down Expand Up @@ -807,10 +738,6 @@ input DeleteAgentInput {
appId: ULID!
}

input DeleteAppDeploymentInput {
appId: ULID!
}

input DeleteEnvironmentInput {
appId: ULID!
environmentId: ULID!
Expand All @@ -821,12 +748,6 @@ input DeleteVendorCredentialInput {
id: ULID!
}

input DeployAppInput {
appId: ULID!
configPath: String
repoUrl: String!
}

type EnvironmentDetail {
allowMcpServers: Boolean!
allowPackageManagers: Boolean!
Expand Down Expand Up @@ -1157,12 +1078,10 @@ type Mutation {
createVendorCredential(input: CreateVendorCredentialInput!): VendorCredential!
deleteAgent(input: DeleteAgentInput!): OperationResult!
deleteAgentSession(appId: ULID!, sessionId: ULID!): OperationResult!
deleteAppDeployment(input: DeleteAppDeploymentInput!): OperationResult!
deleteEnvironment(input: DeleteEnvironmentInput!): OperationResult!
deleteMcpServer(appId: ULID!, serverId: ULID!): OperationResult!
deleteOwnedSkill(appId: ULID!, skillId: ULID!): OperationResult!
deleteVendorCredential(input: DeleteVendorCredentialInput!): OperationResult!
deployApp(input: DeployAppInput!): AppDeploymentRun!
importAgentPackage(input: ImportAgentPackageInput!): AgentPackageImportResult!
onboardingBootstrap(input: BootstrapOnboardingInput!): OnboardingStatus!
prewarmAgentSession(appId: ULID!, sessionId: ULID!): SessionRuntimePrewarmAck!
Expand Down Expand Up @@ -1233,15 +1152,12 @@ type Query {
agentSessionList(agentId: ULID!, appId: ULID!, archived: Boolean, beforeCursor: String, limit: Int, participantOnly: Boolean, type: SessionType): SessionConnection!
agentSessionRetrieve(appId: ULID!, sessionId: ULID!): AgentSessionRetrieve!
appCostCard(appId: ULID!, range: CostRange!, runPurposes: [CostRunPurpose!]): AppCostCard!
appDeploymentRunList(appId: ULID!, limit: Int): [AppDeploymentRun!]!
appDeploymentStatus(appId: ULID!): AppDeploymentRun
appEnvironmentList(appId: ULID!): [EnvironmentSummary!]!
appInfo: AppInfo!
appList(organizationId: ULID!): [App!]!
appOverview(agentLimit: Int, appId: ULID!, credentialLimit: Int): AppOverview!
appSkillList(appId: ULID!): [SkillSummary!]!
availableAgentModels(appId: ULID!, currentModelId: String, currentVendorId: String, runtimeId: String!): [ResolvedModelEntry!]!
boundCapabilityRunProvenance(appId: ULID!, runId: ULID!): BoundCapabilityRunProvenance
controlPlaneOverview(agentLimit: Int, appLimit: Int, credentialLimit: Int): ControlPlaneOverview!
environment(appId: ULID!, environmentId: ULID!): EnvironmentDetail!
exportAgentPackage(agentId: ULID!, appId: ULID!): AgentPackageExport!
Expand Down
69 changes: 0 additions & 69 deletions apps/api/src/adapters/graphql/schema/app-schema.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,8 @@
export const appSchema = /* GraphQL */ `
enum AppOverviewBoundAgentExposure {
public_thread
}

enum AppOverviewProviderCredentialStatus {
configured
}

enum AppDeploymentRunStatus {
activating
building
failed
preparing
queued
submitted
submitting
success
}

enum AppDeploymentTargetKind {
cloudflare_pages
cloudflare_worker
}

type App {
createdAt: String!
defaultEnvironmentId: ULID
Expand All @@ -31,36 +11,6 @@ export const appSchema = /* GraphQL */ `
ownerAccountId: ULID!
}

type AppDeploymentRun {
appId: ULID!
createdAt: String!
deploymentId: ULID!
errorCode: String
errorMessage: String
id: ULID!
liveUrl: String
plannedUrl: String!
sourceBranch: String!
sourceCommitSha: String!
status: AppDeploymentRunStatus!
targetKind: AppDeploymentTargetKind
updatedAt: String!
}

type AppDeployment {
appId: ULID!
createdAt: String!
defaultBranch: String!
id: ULID!
latestRun: AppDeploymentRun
liveUrl: String
plannedUrl: String!
repoName: String!
repoOwner: String!
repoUrl: String!
updatedAt: String!
}

type AppOverviewAgent {
appId: ULID!
description: String
Expand All @@ -80,13 +30,6 @@ export const appSchema = /* GraphQL */ `
limit: Int!
}

type AppOverviewBoundAgent {
agentId: ULID!
envVar: String!
expose: AppOverviewBoundAgentExposure!
name: String!
}

type AppOverviewProviderCredential {
appId: ULID!
hasCustomApiBase: Boolean!
Expand Down Expand Up @@ -115,8 +58,6 @@ export const appSchema = /* GraphQL */ `
type AppOverview {
agents: AppOverviewAgentList!
app: App!
boundAgents: [AppOverviewBoundAgent!]!
deployment: AppDeployment
providerCredentials: AppOverviewProviderCredentialList!
}

Expand All @@ -136,16 +77,6 @@ export const appSchema = /* GraphQL */ `
organizationId: ULID!
}

input DeployAppInput {
appId: ULID!
configPath: String
repoUrl: String!
}

input DeleteAppDeploymentInput {
appId: ULID!
}

input RenameAppInput {
appId: ULID!
name: String!
Expand Down
10 changes: 0 additions & 10 deletions apps/api/src/adapters/graphql/schema/session-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,6 @@ export const sessionSchema = /* GraphQL */ `
updatedAt: String!
}

type BoundCapabilityRunProvenance {
agentId: ULID!
appId: ULID!
bindingEnv: String!
bindingName: String!
deploymentId: ULID!
deploymentRunId: ULID!
runId: ULID!
}

enum AgentSessionEventType {
${graphQLEnumValues(AGENT_SESSION_EVENT_TYPES)}
}
Expand Down
31 changes: 3 additions & 28 deletions apps/api/src/adapters/http/request-logging.middleware.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { MiddlewareHandler } from "hono";

import { APP_AGENT_BOUND_PATH_PREFIX } from "../../modules/public-api/app-agent-capability";
import {
createApiWideEvent,
createRequestLogContext,
Expand All @@ -9,54 +8,30 @@ import {
} from "../../platform/cloudflare/logger";
import type { ApiGatewayEnvironment } from "../../platform/cloudflare/worker-types";

/**
* A bound capability URL is a bearer secret carried in the path. Request logs
* keep the route shape (`/api/v1/bound/:token/...`) and never the token.
*/
export function redactRequestLogPath(pathname: string): string {
const prefix = `${APP_AGENT_BOUND_PATH_PREFIX}/`;

if (!pathname.startsWith(prefix)) {
return pathname;
}

const remainder = pathname.slice(prefix.length);
const nextSlash = remainder.indexOf("/");

return `${APP_AGENT_BOUND_PATH_PREFIX}/:token${nextSlash === -1 ? "" : remainder.slice(nextSlash)}`;
}

function createRedactedRequestLogContext(request: Request) {
return {
...createRequestLogContext(request),
path: redactRequestLogPath(new URL(request.url).pathname),
};
}

export function requestLoggingMiddleware(): MiddlewareHandler<ApiGatewayEnvironment> {
return async (c, next) =>
runWithRequestLogContext(c.req.raw, async () => {
const startedAt = Date.now();
let requestError: unknown = null;
const requestEvent = createApiWideEvent("http.request", {
fields: {
http: createRedactedRequestLogContext(c.req.raw),
http: createRequestLogContext(c.req.raw),
},
});

try {
await next();
} catch (error) {
requestError = error;
requestEvent.setError(error, createRedactedRequestLogContext(c.req.raw));
requestEvent.setError(error, createRequestLogContext(c.req.raw));
throw error;
} finally {
const url = new URL(c.req.url);
const statusCode = requestError ? 500 : c.res.status;

requestEvent.merge("http", {
duration_ms: Date.now() - startedAt,
path: redactRequestLogPath(url.pathname),
path: url.pathname,
status_code: statusCode,
});

Expand Down
Loading
Loading