Skip to content

The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.

769 B
Raw Blame
import type { PlatformPrincipal } from '../../src/cloud-app/engine/platform-principal'
import type { Ctx } from '../../src/cloud-app/engine/ctx'
import { createServer } from '../../src/cloud-app/engine/server'

export const principal: PlatformPrincipal = {
  organizationId: 'org',
  userId: 'user',
  actor: 'user:user',
  permissions: ['read:apps', 'write:apps', 'delete:apps'],
}

export function managementHttp(ctx: Ctx) {
  const app = createServer(ctx)
  return (path: string, init?: RequestInit, caller = principal) =>
    Promise.resolve(app.request(path, init, { platformPrincipal: caller }))
}

export function jsonPost(value: unknown): RequestInit {
  return { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify(value) }
}