Integrate mobile chat workspace and OpenRouter agent flow

This commit is contained in:
sai karthik
2026-07-25 17:49:11 +05:30
parent a17aa5c283
commit 48200a11df
24 changed files with 1142 additions and 211 deletions

View File

@@ -1,4 +1,5 @@
import {
decodePublicGitImportResult,
preparePublicGitSource,
type ProjectImportOutcome,
type ProjectView,
@@ -8,15 +9,17 @@ import {
import { v } from "convex/values";
import { Effect } from "effect";
import { internal } from "./_generated/api";
import type { Id } from "./_generated/dataModel";
import { action, internalMutation, query } from "./_generated/server";
import { createInitialArtifacts } from "./artifactModel";
import { requireCurrentOrganization } from "./authz";
import { requireAuthUserId, requireCurrentOrganization } from "./authz";
import {
makeProjectMutationStore,
makeProjectQueryStore,
persistPublicGitImportTransaction,
} from "./projectStore";
import { inspectPublicGit } from "./publicGit";
// ---------------------------------------------------------------------------
// Internal: persist a public Git import in one transaction
@@ -182,18 +185,31 @@ export const get = query({
});
// ---------------------------------------------------------------------------
// Public action: import a public Git repository
// (daemon wiring added in the Daemon phase)
// Public action: import a supported public Git repository
// ---------------------------------------------------------------------------
export const importPublicGit = action({
args: { repositoryUrl: v.string() },
handler: async (_ctx, args): Promise<ProjectImportOutcome> => {
// Normalize through the domain layer to validate the URL before the
// daemon adapter is wired.
await Effect.runPromise(preparePublicGitSource(args.repositoryUrl));
// The daemon PublicGit adapter is wired in the Daemon phase.
throw new Error("PublicGit import is not yet wired to the daemon adapter");
handler: async (ctx, args): Promise<ProjectImportOutcome> => {
const userId = await requireAuthUserId(ctx);
const source = await Effect.runPromise(
preparePublicGitSource(args.repositoryUrl)
);
const remote = await inspectPublicGit(source);
const validatedRemote = await Effect.runPromise(
decodePublicGitImportResult(remote)
);
return await ctx.runMutation(internal.projects.persistPublicGitImport, {
remote: {
defaultBranch: validatedRemote.defaultBranch,
documents: validatedRemote.documents.map((document) => ({
...document,
})),
warnings: validatedRemote.warnings.map((warning) => ({ ...warning })),
},
source,
userId,
});
},
});