import { C as createApi, F as ActionError, I as Failure, L as Component, M as Settings, N as Package, O as recordingPlatform, R as component, S as Resource, _ as Plan, a as AgentOptions, b as Narrative, c as Route, d as Context, f as Trace, g as Step, h as noopTracing, i as definePlugin, j as stderrLogger, k as Logger, l as execute, n as Plugin, o as Manifest, r as PluginDefinition, s as Middleware, t as Answer, u as Payload, w as Credentials, x as Api, z as ref } from "./plugin-DYhXH7JX.mjs"; import { n as Ports, t as OwnPortsArgument } from "./ports-5rVV3z3m.mjs"; /** * A match that accepts a payload whose every dotted path's value equals its * field's, `null` matching null or absent. The fields are copied, however * deep: changing them after changes nothing it matches. A value JSON cannot * carry (a Date, a Map, undefined, …) is refused, naming each path. */ declare function where(fields: Record): (payload: Payload) => boolean; /** What the worker prints, and whether it succeeded: exit 0 when it did, 1 when not. */ interface Handled { output: string; success: boolean; } /** * Answers one document, as text: what the entry point prints and exits with. * Once answered, it stops the tracer it built, so nothing of tracing holds the * worker's exit. The ports beyond the core's are the plugin's own * (`context.ports`), required when the plugin needs them. */ declare function handle(plugin: Plugin, text: string, ...[ports]: OwnPortsArgument): Promise; /** The ports main runs a plugin with: the core's but the signal, which is main's (SIGTERM and SIGINT), and the plugin's own. */ type MainPorts = Omit & Own; /** * Runs `plugin` with `ports` (none: the real ones its settings describe, the * settings those the agent sets; the plugin's own required when it needs * them) as the command line and the agent ask, then lets the process end: it * sets the exit code and never exits itself, so stdout is never cut short. A * failure is told on stderr, exit code 1. */ declare function main(plugin: Plugin, ...[ports]: OwnPortsArgument>): Promise; /** * Serves `plugin` until `ports.signal` aborts: its own serve, when it has one; * else the agent's gRPC protocol, where the run's settings say. Once the serve * has ended, however it ends, the tracer this serve built is stopped. The * ports beyond the core's are the plugin's own (`context.ports`, its serve's * `context.ports`), required when the plugin needs them. A second serve in the * same process swaps the plugin the gRPC server serves and returns the same * promise. */ declare function serve(plugin: Plugin, ...[ports]: OwnPortsArgument): Promise; /** What an event's handler gets as its input: the event. */ interface EventInput { event: { /** The event's name, as the route declares it. */ name: string; /** The notification's source, as the payload sends it, trimmed. */ source: string; /** What the event is about, as the notification carries it; empty when it carries none. */ context: Record; }; } /** The route that answers the event `name` with `handler`: a payload with a source, whose event is `name`. */ declare function event(name: string, handler: (input: EventInput, context: Context) => unknown): Route; /** * The schemas a plugin declares in a specification's body (its attributes, an * action's parameters and results): JSON Schema, with the keywords the * platform reads in it beside the standard ones. `JSONSchema` is a type to * write one with, never a check: a body is published as written. What a * schema marks secret is what a trace never carries in clear (`redacted`). * * const schema = { type: "object", properties: { password: { type: "string", secret: true } } } satisfies JSONSchema; */ /** The forms of the console a property is shown or edited on. */ type FormRole = "create" | "read" | "update" | "delete" | "list"; /** A JSON Schema type's name. */ type SchemaType = "string" | "number" | "integer" | "boolean" | "object" | "array" | "null"; /** The keywords the platform reads in a JSON Schema, beside the standard ones. */ interface SchemaKeywords { /** Where the property goes among its siblings on a form. */ order?: number; /** The forms it is shown on. */ visibleOn?: readonly FormRole[]; /** The forms it is edited on. */ editableOn?: readonly FormRole[]; /** Its value is a secret: stored as one, never shown, never traced in clear. */ secret?: boolean; /** Two entities are compared by it. */ comparable?: boolean; /** It identifies its entity. */ identifier?: boolean; /** A value it may take, shown as a hint. */ example?: unknown; /** Whether its value is exported to what runs the entity, or how: an environment variable (a secret one with `secret`), a file, a symbolic link. */ export?: boolean | { type: "environment_variable" | "file" | "symbolic_link"; target?: string; secret?: boolean; }; /** Its value is never written by a form. */ readOnly?: boolean; } /** JSON Schema as a plugin writes one: the standard keywords, loosely typed, the platform's, and any other the author needs. */ interface JSONSchema extends SchemaKeywords { $schema?: string; $id?: string; $ref?: string; title?: string; description?: string; type?: SchemaType | readonly SchemaType[]; $defs?: Record; definitions?: Record; properties?: Record; patternProperties?: Record; required?: readonly string[]; additionalProperties?: boolean | JSONSchema; dependentSchemas?: Record; prefixItems?: readonly JSONSchema[]; items?: JSONSchema | readonly JSONSchema[]; enum?: readonly unknown[]; const?: unknown; default?: unknown; format?: string; pattern?: string; minimum?: number; maximum?: number; minLength?: number; maxLength?: number; minItems?: number; maxItems?: number; uniqueItems?: boolean; oneOf?: readonly JSONSchema[]; anyOf?: readonly JSONSchema[]; allOf?: readonly JSONSchema[]; not?: JSONSchema; if?: JSONSchema; then?: JSONSchema; else?: JSONSchema; [keyword: string]: unknown; } export { ActionError, type AgentOptions, type Answer, type Api, type Component, type Context, type Credentials, type Failure, type JSONSchema, type Logger, type Manifest, type Middleware, type Narrative, type Package, type Payload, type Plan, type Plugin, type PluginDefinition, type Ports, type Resource, type Route, type Settings, type Step, type Trace, component, createApi, definePlugin, event, execute, handle, main, noopTracing, recordingPlatform, ref, serve, stderrLogger, where }; //# sourceMappingURL=index.d.mts.map