- Control Plane API with Gemini integration - Executors: Deploy, Analytics, Marketing - MCP Adapter for Continue integration - VSCode/VSCodium extension - Tool registry and run tracking - In-memory storage for local dev - Terraform infrastructure setup
117 lines
3.4 KiB
TypeScript
117 lines
3.4 KiB
TypeScript
/**
|
|
* In-memory storage for local development without Firestore/GCS
|
|
*/
|
|
import type { RunRecord, ToolDef } from "../types.js";
|
|
|
|
// In-memory stores
|
|
const runs = new Map<string, RunRecord>();
|
|
const tools = new Map<string, ToolDef>();
|
|
const artifacts = new Map<string, string>();
|
|
|
|
// Run operations
|
|
export async function saveRun(run: RunRecord): Promise<void> {
|
|
runs.set(run.run_id, { ...run });
|
|
}
|
|
|
|
export async function getRun(runId: string): Promise<RunRecord | null> {
|
|
return runs.get(runId) ?? null;
|
|
}
|
|
|
|
// Tool operations
|
|
export async function saveTool(tool: ToolDef): Promise<void> {
|
|
tools.set(tool.name, { ...tool });
|
|
}
|
|
|
|
export async function listTools(): Promise<ToolDef[]> {
|
|
return Array.from(tools.values());
|
|
}
|
|
|
|
// Artifact operations
|
|
export async function writeArtifactText(prefix: string, filename: string, content: string) {
|
|
const path = `${prefix}/${filename}`;
|
|
artifacts.set(path, content);
|
|
return { bucket: "memory", path };
|
|
}
|
|
|
|
// Seed some example tools for testing
|
|
export function seedTools() {
|
|
const sampleTools: ToolDef[] = [
|
|
{
|
|
name: "cloudrun.deploy_service",
|
|
description: "Build and deploy a Cloud Run service",
|
|
risk: "medium",
|
|
executor: { kind: "http", url: "http://localhost:8090", path: "/execute/cloudrun/deploy" },
|
|
inputSchema: {
|
|
type: "object",
|
|
required: ["service_name", "repo", "ref", "env"],
|
|
properties: {
|
|
service_name: { type: "string" },
|
|
repo: { type: "string" },
|
|
ref: { type: "string" },
|
|
env: { type: "string", enum: ["dev", "staging", "prod"] }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: "cloudrun.get_service_status",
|
|
description: "Get Cloud Run service status",
|
|
risk: "low",
|
|
executor: { kind: "http", url: "http://localhost:8090", path: "/execute/cloudrun/status" },
|
|
inputSchema: {
|
|
type: "object",
|
|
required: ["service_name", "region"],
|
|
properties: {
|
|
service_name: { type: "string" },
|
|
region: { type: "string" }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: "analytics.funnel_summary",
|
|
description: "Get funnel metrics for a time window",
|
|
risk: "low",
|
|
executor: { kind: "http", url: "http://localhost:8091", path: "/execute/analytics/funnel" },
|
|
inputSchema: {
|
|
type: "object",
|
|
required: ["range_days"],
|
|
properties: {
|
|
range_days: { type: "integer", minimum: 1, maximum: 365 }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: "brand.get_profile",
|
|
description: "Get tenant brand profile",
|
|
risk: "low",
|
|
executor: { kind: "http", url: "http://localhost:8092", path: "/execute/brand/get" },
|
|
inputSchema: {
|
|
type: "object",
|
|
required: ["profile_id"],
|
|
properties: {
|
|
profile_id: { type: "string" }
|
|
}
|
|
}
|
|
},
|
|
{
|
|
name: "marketing.generate_channel_posts",
|
|
description: "Generate social posts from a brief",
|
|
risk: "low",
|
|
executor: { kind: "http", url: "http://localhost:8093", path: "/execute/marketing/generate" },
|
|
inputSchema: {
|
|
type: "object",
|
|
required: ["brief", "channels"],
|
|
properties: {
|
|
brief: { type: "object" },
|
|
channels: { type: "array", items: { type: "string" } }
|
|
}
|
|
}
|
|
}
|
|
];
|
|
|
|
for (const tool of sampleTools) {
|
|
tools.set(tool.name, tool);
|
|
}
|
|
|
|
console.log(`📦 Seeded ${sampleTools.length} tools in memory`);
|
|
}
|