diff --git a/bun.lock b/bun.lock index 4c5c1fec2..00984d038 100644 --- a/bun.lock +++ b/bun.lock @@ -302,6 +302,7 @@ "@opentelemetry/api": "^1.9.0", "@opentelemetry/exporter-trace-otlp-http": "^0.213.0", "@opentelemetry/sdk-node": "^0.202.0", + "@pillar-ai/server": "^0.2.4", "@posthog/ai": "^7.4.2", "@puzzmo/revenue-cat-webhook-types": "^1.1.0", "@react-email/components": "^0.0.42", @@ -1410,6 +1411,8 @@ "@phosphor-icons/react": ["@phosphor-icons/react@2.1.10", "", { "peerDependencies": { "react": ">= 16.8", "react-dom": ">= 16.8" } }, "sha512-vt8Tvq8GLjheAZZYa+YG/pW7HDbov8El/MANW8pOAz4eGxrwhnbfrQZq0Cp4q8zBEu8NIhHdnr+r8thnfRSNYA=="], + "@pillar-ai/server": ["@pillar-ai/server@0.2.4", "", { "peerDependencies": { "express": ">=4.0.0", "fastify": ">=4.0.0", "hono": ">=4.0.0", "zod": ">=3.0.0", "zod-to-json-schema": ">=3.0.0" }, "optionalPeers": ["express", "fastify", "hono", "zod", "zod-to-json-schema"] }, "sha512-0KeUyzj4Rks0NffAQJTIfnudSkjmlMalB8GWYP/c4ObNS3OcoNCMm4TxvwTAGTI/HAxjfZHXYiKCkEklQ7JWUw=="], + "@pinojs/redact": ["@pinojs/redact@0.4.0", "", {}, "sha512-k2ENnmBugE/rzQfEcdWHcCY+/FM3VLzH9cYEsbdsoqrvzAKRhUZeRNhAZvB8OitQJ1TBed3yqWtdjzS6wJKBwg=="], "@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="], diff --git a/server/package.json b/server/package.json index 77a05ffe2..dc25dd8c0 100644 --- a/server/package.json +++ b/server/package.json @@ -67,6 +67,7 @@ "@opentelemetry/api": "^1.9.0", "@opentelemetry/exporter-trace-otlp-http": "^0.213.0", "@opentelemetry/sdk-node": "^0.202.0", + "@pillar-ai/server": "^0.2.4", "@posthog/ai": "^7.4.2", "@puzzmo/revenue-cat-webhook-types": "^1.1.0", "@react-email/components": "^0.0.42", diff --git a/server/src/init.ts b/server/src/init.ts index 47f090738..65bf099dd 100644 --- a/server/src/init.ts +++ b/server/src/init.ts @@ -14,6 +14,7 @@ import { logger } from "./external/logtail/logtailUtils.js"; import { warmupRegionalRedis } from "./external/redis/initRedis.js"; import { createHonoApp } from "./initHono.js"; import { otelSdk } from "./instrumentation.js"; +import { initPillar } from "./internal/misc/pillar/pillarInit.js"; import { checkEnvVars } from "./utils/initUtils.js"; import { startMemoryMonitor } from "./utils/memoryMonitor.js"; @@ -23,7 +24,7 @@ const init = async () => { const app = createHonoApp(); initPgHealthMonitor({ client: clientCritical }); - await Promise.all([warmupRegionalRedis()]); + await Promise.all([warmupRegionalRedis(), initPillar()]); const PORT = process.env.SERVER_PORT ? Number.parseInt(process.env.SERVER_PORT) diff --git a/server/src/internal/misc/pillar/pillarInit.ts b/server/src/internal/misc/pillar/pillarInit.ts new file mode 100644 index 000000000..6e3682002 --- /dev/null +++ b/server/src/internal/misc/pillar/pillarInit.ts @@ -0,0 +1,15 @@ +import { Pillar } from "@pillar-ai/server"; +import { pillarSkills } from "./pillarSkills.js"; + +const pillarSecret = process.env.PILLAR_SECRET; + +export const pillar = new Pillar({ + apiKey: pillarSecret!, + skills: pillarSkills, + autoRegister: false, +}); + +export const initPillar = async () => { + if (!pillarSecret) return; + await pillar.register(); +}; diff --git a/server/src/internal/misc/pillar/pillarSkills.ts b/server/src/internal/misc/pillar/pillarSkills.ts new file mode 100644 index 000000000..ac209da3e --- /dev/null +++ b/server/src/internal/misc/pillar/pillarSkills.ts @@ -0,0 +1,10 @@ +import { defineSkill } from "@pillar-ai/server"; +import { skills } from "../../../../../packages/atmn/src/prompts/skills/index.js"; + +export const pillarSkills = skills.map((skill) => + defineSkill({ + name: skill.id, + description: skill.description, + content: skill.content, + }), +);