@ubiquity-os/plugin-sdk
Version:
SDK for plugin support.
76 lines (69 loc) • 3.72 kB
text/typescript
import { EmitterWebhookEventName } from '@octokit/webhooks';
import { C as Context } from './context-Dwl3aRX-.mjs';
export { a as CommentHandler } from './context-Dwl3aRX-.mjs';
import { TSchema, TAnySchema } from '@sinclair/typebox';
import { LogLevel } from '@ubiquity-os/ubiquity-os-logger';
export { LlmCallOptions, callLlm } from './llm.mjs';
import * as hono_types from 'hono/types';
import { Hono } from 'hono';
import { Manifest } from './manifest.mjs';
import '@octokit/plugin-rest-endpoint-methods';
import './octokit.mjs';
import '@octokit/core/types';
import '@octokit/plugin-paginate-graphql';
import '@octokit/plugin-paginate-rest';
import '@octokit/webhooks/node_modules/@octokit/request-error';
import '@octokit/core';
import 'openai/resources/chat/completions';
import './signature.mjs';
type Return = Record<string, unknown> | undefined | void;
type HandlerReturn = Promise<Return> | Return;
interface Options$1<TEnvSchema extends TSchema = TAnySchema, TSettingsSchema extends TSchema = TAnySchema, TCommandSchema extends TSchema = TAnySchema> {
kernelPublicKey?: string;
logLevel?: LogLevel;
postCommentOnError?: boolean;
settingsSchema?: TSettingsSchema;
envSchema?: TEnvSchema;
commandSchema?: TCommandSchema;
/**
* @deprecated This disables signature verification - only for local development
*/
bypassSignatureVerification?: boolean;
returnDataToKernel?: boolean;
}
/**
* Removes wrapper backticks or fenced blocks that LLMs often return around payloads.
*/
declare function sanitizeLlmResponse(input: string): string;
declare function createActionsPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, options?: Options$1): Promise<void>;
/**
* Options for cleanMarkdown.
*
* tags:
* A single list of HTML tag names (keyof HTMLElementTagNameMap) to remove.
* Behavior per tag:
* 1. If an HTML block token consists solely of a single root element whose tag matches, the entire block (its content) is removed.
* (e.g. <details> ... </details> when "details" is in tags).
* 2. Standalone inline occurrences of that tag treated as void/self-closing (e.g. <br>) are stripped.
*
* collapseEmptyLines:
* If true, collapses sequences of 3+ blank lines down to exactly 2, preserving paragraph spacing while shrinking payload size.
*/
type Options = {
tags?: string[];
shouldCollapseEmptyLines?: boolean;
};
/**
* Cleans a GitHub-flavored markdown string by:
* - Removing top‑level HTML comments (<!-- ... -->) (outside code / inline code / blockquote context)
* - Removing blocks for configured tags when the entire html token is a single element of that tag
* - Removing inline occurrences of configured tags treated as void (e.g. \<br\>) outside fenced / inline code
* - Preserving comments and tags inside:
* * fenced or indented code blocks
* * inline code spans
* * blockquotes (their contents unchanged)
* - Optionally collapsing excessive blank lines
*/
declare function cleanMarkdown(md: string, options?: Options): string;
declare function createPlugin<TConfig = unknown, TEnv = unknown, TCommand = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TCommand, TSupportedEvents>) => HandlerReturn, manifest: Manifest, options?: Options$1): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
export { Context, type Options$1 as Options, cleanMarkdown, createActionsPlugin, createPlugin, sanitizeLlmResponse };