GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sdk-js/packages/epilot-sdk-v2/docs/entity-ui.md at main · epilot-dev/sdk-js

Expand file tree

/

entity-ui.md

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
501 lines (406 loc) · 9.19 KB
/

entity-ui.md

Copy path

File metadata and controls

501 lines (406 loc) · 9.19 KB
Raw
Copy raw file
Download raw file
Outline
Edit and raw actions

Entity UI API

  • Base URL: https://entity-ui.sls.epilot.io
  • Full API Docs: https://docs.epilot.io/api/entity-ui

Usage

import { epilot } from '@epilot/sdk'

epilot.authorize(() => '<token>')
const { data } = await epilot.entityUi.putWidgetDefinition(...)

Tree-shakeable import

import { getClient, authorize } from '@epilot/sdk/entity-ui'

const entityUiClient = getClient()
authorize(entityUiClient, () => '<token>')
const { data } = await entityUiClient.putWidgetDefinition(...)

Operations

Widget Definitions

  • putWidgetDefinition
  • getWidgetDefinition
  • batchGetWidgetDefinitions

Schemas

  • WidgetDefinitionRef
  • WidgetDefinitionRefResponse
  • WidgetDefinition
  • WidgetDefinitionV1
  • WidgetDefinitionV2
  • WidgetPrompt
  • WidgetHtml
  • WidgetManifest
  • WidgetManifestV2
  • WidgetLibs
  • WidgetIcons
  • WidgetRelations
  • WidgetRelationsV2
  • WidgetFields
  • WidgetStrings
  • WidgetStringTable
  • WidgetSuggestions
  • BatchGetWidgetDefinitionsRequest
  • BatchGetWidgetDefinitionsResponse
  • ErrorResponse

putWidgetDefinition

Stores a widget definition and returns its ref.

PUT /v1/entity-ui/widget-definitions

const { data } = await client.putWidgetDefinition(
  null,
  {
    version: 1,
    prompt: 'string',
    manifest: {
      relations: {},
      libs: ['echarts'],
      icons: ['string']
    },
    html: 'string',
    strings: {
      de: {},
      en: {}
    },
    suggestions: {
      de: ['string'],
      en: ['string']
    }
  },
)
Response
{
  "ref": "9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
}

getWidgetDefinition

Returns a stored widget definition in its canonical form.

GET /v1/entity-ui/widget-definitions/{ref}

const { data } = await client.getWidgetDefinition({
  ref: 'example',
  schema: 'example',
})
Response
{
  "version": 1,
  "prompt": "string",
  "manifest": {
    "relations": {},
    "libs": ["echarts"],
    "icons": ["string"]
  },
  "html": "string",
  "strings": {
    "de": {},
    "en": {}
  },
  "suggestions": {
    "de": ["string"],
    "en": ["string"]
  }
}

batchGetWidgetDefinitions

Returns up to 20 stored widget definitions by ref. Refs that are not stored in the organization are listed in missing.

POST /v1/entity-ui/widget-definitions/batch-get

const { data } = await client.batchGetWidgetDefinitions(
  {
    schema: 'example',
  },
  {
    refs: ['9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08']
  },
)
Response
{
  "definitions": {},
  "missing": ["9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"]
}

Schemas

WidgetDefinitionRef

Lowercase hex SHA-256 of the definition's RFC 8785 canonical JSON

type WidgetDefinitionRef = string

WidgetDefinitionRefResponse

type WidgetDefinitionRefResponse = {
  ref: string
}

WidgetDefinition

An AI widget definition, version 1 or version 2. Unknown keys are rejected at every level, because any extra key would produce a different ref for an otherwise identical definition.

type WidgetDefinition = {
  version: 1
  prompt: string
  manifest: {
    relations: {
      mode?: { ... }
    } | {
      mode?: { ... }
      schemas?: { ... }
    }
    libs: "echarts"[]
    icons?: string[]
  }
  html: string
  strings: {
    de: Record<string, string>
    en: Record<string, string>
  }
  suggestions?: {
    de: string[]
    en: string[]
  }
} | {
  version: 2
  prompt: string
  manifest: {
    relations: {
      mode: { ... }
      schemas: { ... }
      size: { ... }
    }
    libs: "echarts"[]
    icons?: string[]
    fields: Record<string, string[]>
  }
  html: string
  strings: {
    de: Record<string, string>
    en: Record<string, string>
  }
  suggestions?: {
    de: string[]
    en: string[]
  }
}

WidgetDefinitionV1

Version 1 of an AI widget definition. The widget receives every attribute of every record.

type WidgetDefinitionV1 = {
  version: 1
  prompt: string
  manifest: {
    relations: {
      mode?: { ... }
    } | {
      mode?: { ... }
      schemas?: { ... }
    }
    libs: "echarts"[]
    icons?: string[]
  }
  html: string
  strings: {
    de: Record<string, string>
    en: Record<string, string>
  }
  suggestions?: {
    de: string[]
    en: string[]
  }
}

WidgetDefinitionV2

Version 2 of an AI widget definition. The widget receives only the attributes its manifest.fields declares, plus _id, _schema and _title.

Across both string tables, the UTF-8 bytes of every key plus every value may total at most 65536 bytes. The server enforces this and answers 400; JSON

type WidgetDefinitionV2 = {
  version: 2
  prompt: string
  manifest: {
    relations: {
      mode: { ... }
      schemas: { ... }
      size: { ... }
    }
    libs: "echarts"[]
    icons?: string[]
    fields: Record<string, string[]>
  }
  html: string
  strings: {
    de: Record<string, string>
    en: Record<string, string>
  }
  suggestions?: {
    de: string[]
    en: string[]
  }
}

WidgetPrompt

The admin's own words, at most 4000 UTF-16 code units. The server counts code units and answers 400, because maxLength counts code points, so a prompt of astral characters passes it at up to 8000 code units.

type WidgetPrompt = string

WidgetHtml

Body fragment rendered inside the sandboxed frame, at most 65536 UTF-8 bytes. The server counts bytes and answers 400, because maxLength counts characters.

type WidgetHtml = string

WidgetManifest

type WidgetManifest = {
  relations: {
    mode?: "direct" | "reverse" | "both"
  } | {
    mode?: "none"
    schemas?: unknown
  }
  libs: "echarts"[]
  icons?: string[]
}

WidgetManifestV2

type WidgetManifestV2 = {
  relations: {
    mode: "none" | "direct" | "reverse" | "both"
    schemas: string[]
    size: number
  }
  libs: "echarts"[]
  icons?: string[]
  fields: Record<string, string[]>
}

WidgetLibs

Host-injected libraries, [] for none

type WidgetLibs = "echarts"[]

WidgetIcons

Icon names the widget renders

type WidgetIcons = string[]

WidgetRelations

type WidgetRelations = {
  mode?: "direct" | "reverse" | "both"
} | {
  mode?: "none"
  schemas?: unknown
}

WidgetRelationsV2

Relations of a version 2 definition: schemas names every related schema to load, so it must be non-empty unless mode is none, and empty when mode is none.

type WidgetRelationsV2 = {
  mode: "none" | "direct" | "reverse" | "both"
  schemas: string[]
  size: number
}

WidgetFields

Maps an entity schema slug to the top-level attributes the widget reads from records of that schema. A record whose schema has no key receives _id, _schema and _title only.

Every key must be 1 to 128 UTF-16 code units and may not be __proto__, and every attribute name at most 128 UTF-16 cod

type WidgetFields = Record<string, string[]>

WidgetStrings

Localized string tables; both include title

type WidgetStrings = {
  de: Record<string, string>
  en: Record<string, string>
}

WidgetStringTable

String table of one locale. Keys are what the widget passes to t(); both tables include title.

Every key must match ^[a-z0-9_]{1,64}$ (snake_case, at most 64 characters) and may not be __proto__. The server enforces this and answers 400 naming the offending key; OpenAPI 3.0 has no keyword

type WidgetStringTable = Record<string, string>

WidgetSuggestions

type WidgetSuggestions = {
  de: string[]
  en: string[]
}

BatchGetWidgetDefinitionsRequest

type BatchGetWidgetDefinitionsRequest = {
  refs: string[]
}

BatchGetWidgetDefinitionsResponse

type BatchGetWidgetDefinitionsResponse = {
  definitions: Record<string, {
    version: 1
    prompt: string
    manifest: {
      relations: { ... }
      libs: { ... }
      icons?: { ... }
    }
    html: string
    strings: {
      de: { ... }
      en: { ... }
    }
    suggestions?: {
      de: { ... }
      en: { ... }
    }
  } | {
    version: 2
    prompt: string
    manifest: {
      relations: { ... }
      libs: { ... }
      icons?: { ... }
      fields: { ... }
    }
    html: string
    strings: {
      de: { ... }
      en: { ... }
    }
    suggestions?: {
      de: { ... }
      en: { ... }
    }
  }>
  missing: string[]
}

ErrorResponse

Standard error response format for all API errors

type ErrorResponse = {
  error: string | object[]
  status: number
}
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.