UNPKG

@mochabug/adaptkit

Version:

A cmd to create, emulate and publish Mochabug Adapt plugins

430 lines 17.3 kB
import type { GenEnum, GenFile, GenMessage } from "@bufbuild/protobuf/codegenv2"; import type { SignalData, SignalDataJson } from "./signal_data_pb"; import type { SignalFormat, SignalFormatJson } from "./signal_format_pb"; import type { Message } from "@bufbuild/protobuf"; /** * Describes the file mochabugapis/adapt/graph/signal_binding.proto. */ export declare const file_mochabugapis_adapt_graph_signal_binding: GenFile; /** * SignalBinding represents an input point for a vertex in the computation graph. * Unlike SignalDescriptor which describes what a signal IS (producing one specific format), * a binding describes what formats an input ACCEPTS (potentially accepting multiple formats). * * Bindings enable flexible graph construction by allowing vertices to accept data in * various compatible formats. For example, a text display component might accept strings, * numbers, dates, and booleans, while an image viewer might accept image/* MIME types. * * The binding can be connected to a signal reference or assigned a constant value. * Runtime validation ensures the bound signal's format matches one of the accepted formats. * * @generated from message mochabugapis.adapt.graph.SignalBinding */ export type SignalBinding = Message<"mochabugapis.adapt.graph.SignalBinding"> & { /** * Identifier for this binding point, following ECMAScript identifier conventions. * Must be unique within the vertex's binding collection. * * Pattern: Must start with letter, $, or _, followed by letters, digits, $, or _ * Length: 1-50 characters * * Examples: "inputText", "image_data", "$config", "_internalParam" * * @generated from field: string name = 1; */ name: string; /** * Human-readable label for the binding, suitable for display in user interfaces. * Describes what this input represents in the context of the vertex. * * Length: Up to 250 characters * * Examples: "Text to Display", "Source Image", "Configuration Object" * * @generated from field: optional string label = 2; */ label?: string; /** * Detailed description of the binding's purpose and accepted data. * Should document what the vertex does with this input and any constraints. * * Length: Up to 1000 characters * * May include: * - What the binding represents in the vertex's operation * - How the data is used or transformed * - Constraints on values or formats * - Examples of valid inputs * * @generated from field: optional string description = 3; */ description?: string; /** * Indicates whether this binding must be connected. * * When false or unset: Binding is required and must be connected * When true: Binding is optional and may be left unbound * * Optional bindings provide flexibility, allowing vertices to function * with or without certain inputs (e.g., optional configuration parameters). * * @generated from field: optional bool optional = 4; */ optional?: boolean; /** * List of formats this binding accepts. The binding will accept any signal whose * format matches at least one entry in this list. * * Format matching rules: * - JTD schemas: Structural compatibility according to JTD specification * - MIME types (exact): Exact string match (case-insensitive) * - MIME types (wildcard): Pattern matching with * wildcards * - "image/*" matches "image/png", "image/jpeg", "image/webp", etc. * - "text/*" matches "text/plain", "text/html", "text/csv", etc. * - "application/*" matches any application type * * Common patterns: * * Example 1: Text display (accepts primitive types for display as text) * accepts = [ * { jtd_schema: { type: "string" } }, * { jtd_schema: { type: "float32" } }, * { jtd_schema: { type: "float64" } }, * { jtd_schema: { type: "int32" } }, * { jtd_schema: { type: "boolean" } }, * { jtd_schema: { type: "timestamp" } } * ] * * Example 2: Image viewer (accepts displayable image formats) * accepts = [ * { mime_type: "image/*" } // Accepts any image type * ] * * Example 3: Document viewer (accepts specific document types) * accepts = [ * { mime_type: "application/pdf" }, * { mime_type: "text/html" }, * { mime_type: "text/plain" } * ] * * Example 4: Data processor (accepts structured data) * accepts = [ * { jtd_schema: { elements: { type: "string" } } }, // Array of strings * { jtd_schema: { properties: { id: { type: "string" } } } } // Object with id * ] * * Validation: At least one format must be specified. Maximum 50 formats to prevent * overly permissive bindings and ensure reasonable validation performance. * * @generated from field: repeated mochabugapis.adapt.graph.SignalFormat accepts = 5; */ accepts: SignalFormat[]; /** * The actual binding - either a reference to another signal or a constant value. * Not required if the binding is marked as optional. * * When required (optional = false): * - Exactly one of 'reference' or 'constant' must be set * - If neither is set, ERROR_UNBOUND will be raised * * When optional (optional = true): * - May be unset (neither reference nor constant) * - Vertex must handle the unbound case gracefully * * @generated from oneof mochabugapis.adapt.graph.SignalBinding.binding */ binding: { /** * Reference to another signal in the graph. * * Format: <vertex_id>/<transmitter_name>/<signal_name> * - vertex_id: 4-character alphanumeric identifier (lowercase) * - transmitter_name: ECMAScript identifier for the output transmitter * - signal_name: ECMAScript identifier for the specific signal * * Examples: * - "a1b2/output/temperature" * - "xyz9/results/processedData" * - "0123/$internal/_debug" * * The referenced signal's format must match one of the accepted formats. * Validation occurs at graph construction time. * * @generated from field: string reference = 6; */ value: string; case: "reference"; } | { /** * Constant value to bind to this input. * The constant must be serialized in a format matching one of the accepted formats. * * For JTD schemas: * - Value must be JSON-serialized and encoded as bytes * - Must validate against at least one accepted JTD schema * * For MIME types: * - Value must be in the binary format specified by the MIME type * - Must match at least one accepted MIME type (considering wildcards) * * Validation occurs at graph construction time. * * @generated from field: mochabugapis.adapt.graph.SignalData constant = 7; */ value: SignalData; case: "constant"; } | { case: undefined; value?: undefined; }; /** * Error state of this binding, if any. * Set by the graph validation system when issues are detected. * Should not be set to ERROR_UNSPECIFIED (value 0). * * When unset: Binding is valid * When set: Binding has the specified error and requires correction * * Applications should check this field and provide appropriate user feedback * for bindings in error states. * * @generated from field: optional mochabugapis.adapt.graph.SignalBinding.Error error = 8; */ error?: SignalBinding_Error; }; /** * SignalBinding represents an input point for a vertex in the computation graph. * Unlike SignalDescriptor which describes what a signal IS (producing one specific format), * a binding describes what formats an input ACCEPTS (potentially accepting multiple formats). * * Bindings enable flexible graph construction by allowing vertices to accept data in * various compatible formats. For example, a text display component might accept strings, * numbers, dates, and booleans, while an image viewer might accept image/* MIME types. * * The binding can be connected to a signal reference or assigned a constant value. * Runtime validation ensures the bound signal's format matches one of the accepted formats. * * @generated from message mochabugapis.adapt.graph.SignalBinding */ export type SignalBindingJson = { /** * Identifier for this binding point, following ECMAScript identifier conventions. * Must be unique within the vertex's binding collection. * * Pattern: Must start with letter, $, or _, followed by letters, digits, $, or _ * Length: 1-50 characters * * Examples: "inputText", "image_data", "$config", "_internalParam" * * @generated from field: string name = 1; */ name?: string; /** * Human-readable label for the binding, suitable for display in user interfaces. * Describes what this input represents in the context of the vertex. * * Length: Up to 250 characters * * Examples: "Text to Display", "Source Image", "Configuration Object" * * @generated from field: optional string label = 2; */ label?: string; /** * Detailed description of the binding's purpose and accepted data. * Should document what the vertex does with this input and any constraints. * * Length: Up to 1000 characters * * May include: * - What the binding represents in the vertex's operation * - How the data is used or transformed * - Constraints on values or formats * - Examples of valid inputs * * @generated from field: optional string description = 3; */ description?: string; /** * Indicates whether this binding must be connected. * * When false or unset: Binding is required and must be connected * When true: Binding is optional and may be left unbound * * Optional bindings provide flexibility, allowing vertices to function * with or without certain inputs (e.g., optional configuration parameters). * * @generated from field: optional bool optional = 4; */ optional?: boolean; /** * List of formats this binding accepts. The binding will accept any signal whose * format matches at least one entry in this list. * * Format matching rules: * - JTD schemas: Structural compatibility according to JTD specification * - MIME types (exact): Exact string match (case-insensitive) * - MIME types (wildcard): Pattern matching with * wildcards * - "image/*" matches "image/png", "image/jpeg", "image/webp", etc. * - "text/*" matches "text/plain", "text/html", "text/csv", etc. * - "application/*" matches any application type * * Common patterns: * * Example 1: Text display (accepts primitive types for display as text) * accepts = [ * { jtd_schema: { type: "string" } }, * { jtd_schema: { type: "float32" } }, * { jtd_schema: { type: "float64" } }, * { jtd_schema: { type: "int32" } }, * { jtd_schema: { type: "boolean" } }, * { jtd_schema: { type: "timestamp" } } * ] * * Example 2: Image viewer (accepts displayable image formats) * accepts = [ * { mime_type: "image/*" } // Accepts any image type * ] * * Example 3: Document viewer (accepts specific document types) * accepts = [ * { mime_type: "application/pdf" }, * { mime_type: "text/html" }, * { mime_type: "text/plain" } * ] * * Example 4: Data processor (accepts structured data) * accepts = [ * { jtd_schema: { elements: { type: "string" } } }, // Array of strings * { jtd_schema: { properties: { id: { type: "string" } } } } // Object with id * ] * * Validation: At least one format must be specified. Maximum 50 formats to prevent * overly permissive bindings and ensure reasonable validation performance. * * @generated from field: repeated mochabugapis.adapt.graph.SignalFormat accepts = 5; */ accepts?: SignalFormatJson[]; /** * Reference to another signal in the graph. * * Format: <vertex_id>/<transmitter_name>/<signal_name> * - vertex_id: 4-character alphanumeric identifier (lowercase) * - transmitter_name: ECMAScript identifier for the output transmitter * - signal_name: ECMAScript identifier for the specific signal * * Examples: * - "a1b2/output/temperature" * - "xyz9/results/processedData" * - "0123/$internal/_debug" * * The referenced signal's format must match one of the accepted formats. * Validation occurs at graph construction time. * * @generated from field: string reference = 6; */ reference?: string; /** * Constant value to bind to this input. * The constant must be serialized in a format matching one of the accepted formats. * * For JTD schemas: * - Value must be JSON-serialized and encoded as bytes * - Must validate against at least one accepted JTD schema * * For MIME types: * - Value must be in the binary format specified by the MIME type * - Must match at least one accepted MIME type (considering wildcards) * * Validation occurs at graph construction time. * * @generated from field: mochabugapis.adapt.graph.SignalData constant = 7; */ constant?: SignalDataJson; /** * Error state of this binding, if any. * Set by the graph validation system when issues are detected. * Should not be set to ERROR_UNSPECIFIED (value 0). * * When unset: Binding is valid * When set: Binding has the specified error and requires correction * * Applications should check this field and provide appropriate user feedback * for bindings in error states. * * @generated from field: optional mochabugapis.adapt.graph.SignalBinding.Error error = 8; */ error?: SignalBinding_ErrorJson; }; /** * Describes the message mochabugapis.adapt.graph.SignalBinding. * Use `create(SignalBindingSchema)` to create a new message. */ export declare const SignalBindingSchema: GenMessage<SignalBinding, { jsonType: SignalBindingJson; }>; /** * Error codes that can occur during binding validation or resolution. * These errors are typically set by the graph validation system. * * @generated from enum mochabugapis.adapt.graph.SignalBinding.Error */ export declare enum SignalBinding_Error { /** * No error specified. This value should never be explicitly set as it indicates * the absence of an error. The error field should be unset for valid bindings. * * @generated from enum value: ERROR_UNSPECIFIED = 0; */ UNSPECIFIED = 0, /** * The binding is unbound (no reference or constant provided) despite being required. * This occurs when: * - The binding is not marked as optional * - Neither 'reference' nor 'constant' is set in the binding oneof * * Resolution: Provide either a signal reference or a constant value. * * @generated from enum value: ERROR_UNBOUND = 1; */ UNBOUND = 1, /** * The referenced signal source does not exist in the graph. * This occurs when: * - The reference points to a non-existent vertex ID * - The transmitter name doesn't exist on the referenced vertex * - The signal name doesn't exist on the specified transmitter * * Resolution: Verify the signal reference path and ensure the source vertex, * transmitter, and signal all exist. * * @generated from enum value: ERROR_INVALID_SOURCE = 2; */ INVALID_SOURCE = 2, /** * The signal format doesn't match any of the accepted formats. * This occurs when: * - The source signal's format (from SignalDescriptor) doesn't match any * format in the 'accepts' list * - JTD schema validation fails * - MIME type mismatch (including wildcard matching failures) * * Resolution: Either change the binding to accept the source signal's format, * or use a different signal source with a compatible format. * * @generated from enum value: ERROR_SCHEMA_MISMATCH = 3; */ SCHEMA_MISMATCH = 3 } /** * Error codes that can occur during binding validation or resolution. * These errors are typically set by the graph validation system. * * @generated from enum mochabugapis.adapt.graph.SignalBinding.Error */ export type SignalBinding_ErrorJson = "ERROR_UNSPECIFIED" | "ERROR_UNBOUND" | "ERROR_INVALID_SOURCE" | "ERROR_SCHEMA_MISMATCH"; /** * Describes the enum mochabugapis.adapt.graph.SignalBinding.Error. */ export declare const SignalBinding_ErrorSchema: GenEnum<SignalBinding_Error, SignalBinding_ErrorJson>; //# sourceMappingURL=signal_binding_pb.d.ts.map