gpt-maa-ts
Version:
A TypeScript client for submitting AgentDefinitions and user prompt to a gpt-multi-atomic-agents REST API, to generate supported mutations.
1,144 lines (1,114 loc) • 92.7 kB
text/typescript
import { Spinner } from 'yocto-spinner';
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/** Defines a contract for models that can hold additional data besides the described properties. */
interface AdditionalDataHolder {
/**
* Gets the additional data for this object that did not belong to the properties.
* @returns The additional data for this object.
*/
additionalData?: Record<string, unknown>;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* Defines a serializable model object.
*/
interface Parsable {
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
type Guid = string;
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* Represents a date only. ISO 8601.
*/
declare class DateOnly implements DateOnlyInterface {
/**
* Creates a new DateOnly from the given string.
* @param root0 The year, month, and day
* @param root0.year The year
* @param root0.month The month
* @param root0.day The day
* @returns The new DateOnly
* @throws An error if the year is invalid
* @throws An error if the month is invalid
* @throws An error if the day is invalid
*/
constructor({ year, month, day }: Partial<DateOnlyInterface>);
year: number;
month: number;
day: number;
/**
* Creates a new DateOnly from the given date.
* @param date The date
* @returns The new DateOnly
* @throws An error if the date is invalid
*/
static fromDate(date: Date): DateOnly;
/**
* Parses a string into a DateOnly. The string can be of the ISO 8601 time only format or a number representing the ticks of a Date.
* @param value The value to parse
* @returns The parsed DateOnly.
* @throws An error if the value is invalid
*/
static parse(value: string | undefined): DateOnly | undefined;
/**
* Returns a string representation of the date in the format YYYY-MM-DD
* @returns The date in the format YYYY-MM-DD ISO 8601
*/
toString(): string;
}
interface DateOnlyInterface {
/**
* The year
* @default 0
*/
year: number;
/**
* The month
* @default 1
*/
month: number;
/**
* The day
* @default 1
*/
day: number;
}
/**
* Represents a duration value. ISO 8601.
*/
declare class Duration implements DurationInterface {
/**
* Creates a new Duration value from the given parameters.
* @param root0 The years, months, weeks, days, hours, minutes, seconds, and negative flag
* @param root0.years The years
* @param root0.months The months
* @param root0.weeks The weeks
* @param root0.days The days
* @param root0.hours The hours
* @param root0.minutes The minutes
* @param root0.seconds The seconds
* @param root0.negative The negative flag
* @returns The new Duration
* @throws An error if years is invalid
* @throws An error if months is invalid
* @throws An error if weeks is invalid
* @throws An error if days is invalid
* @throws An error if hours is invalid
* @throws An error if minutes is invalid
* @throws An error if seconds is invalid
* @throws An error if weeks is used in combination with years or months
*/
constructor({ years, months, weeks, days, hours, minutes, seconds, negative }: Partial<DurationInterface>);
years: number;
months: number;
weeks: number;
days: number;
hours: number;
minutes: number;
seconds: number;
negative: boolean;
/**
* Parses a string into a Duration. The string can be of the ISO 8601 duration format.
* @param value The value to parse
* @returns The parsed Duration.
* @throws An error if the value is invalid
*/
static parse(value: string | undefined): Duration | undefined;
/**
* Serializes the duration to a string in the ISO 8601 duration format.
* @returns The serialized duration.
*/
toString(): string;
}
interface DurationInterface {
/**
* Years of the duration
* @default 0
*/
years: number;
/**
* Months of the duration
* @default 0
*/
months: number;
/**
* Weeks of the duration, can't be used together with years or months
* @default 0
*/
weeks: number;
/**
* Days of the duration
* @default 0
*/
days: number;
/**
* Hours of the duration
* @default 0
*/
hours: number;
/**
* Minutes of the duration
* @default 0
*/
minutes: number;
/**
* Seconds of the duration
* @default 0
*/
seconds: number;
/**
* Whether the duration is negative
* @default false
*/
negative: boolean;
}
declare class TimeOnly implements TimeOnlyInterface {
/**
* Creates a new TimeOnly from the given parameters.
* @param root0 The hours, minutes, seconds, and milliseconds
* @param root0.hours The hours
* @param root0.minutes The minutes
* @param root0.seconds The seconds
* @param root0.picoseconds The milliseconds
* @returns The new TimeOnly
* @throws An error if the milliseconds are invalid
* @throws An error if the seconds are invalid
* @throws An error if the minutes are invalid
* @throws An error if the hours are invalid
* @throws An error if the milliseconds are invalid
*/
constructor({ hours, minutes, seconds, picoseconds }: Partial<TimeOnlyInterface>);
hours: number;
minutes: number;
seconds: number;
picoseconds: number;
/**
* Creates a new TimeOnly from the given date.
* @param date The date
* @returns The new TimeOnly
* @throws An error if the date is invalid
*/
static fromDate(date: Date): TimeOnly;
/**
* Parses a string into a TimeOnly. The string can be of the ISO 8601 time only format or a number representing the ticks of a Date.
* @param value The value to parse
* @returns The parsed TimeOnly.
* @throws An error if the value is invalid
*/
static parse(value: string | undefined): TimeOnly | undefined;
/**
* Returns a string representation of the time in the format HH:MM:SS.SSSSSSS
* @returns The time in the format HH:MM:SS.SSSSSSS
* @throws An error if the time is invalid
*/
toString(): string;
}
interface TimeOnlyInterface {
/**
* The hours
* @default 0
*/
hours: number;
/**
* The minutes
* @default 0
*/
minutes: number;
/**
* The seconds
* @default 0
*/
seconds: number;
/**
* The milliseconds
* @default 0
*/
picoseconds: number;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* Interface for a deserialization node in a parse tree. This interface provides an abstraction layer over serialization formats, libraries and implementations.
*/
interface ParseNode {
/**
* Gets the string value of the node.
* @returns the string value of the node.
*/
getStringValue(): string | undefined;
/**
* Gets a new parse node for the given identifier.
* @param identifier the identifier of the current node property.
* @returns a new parse node for the given identifier.
*/
getChildNode(identifier: string): ParseNode | undefined;
/**
* Gets the boolean value of the node.
* @returns the boolean value of the node.
*/
getBooleanValue(): boolean | undefined;
/**
* Gets the Number value of the node.
* @returns the Number value of the node.
*/
getNumberValue(): number | undefined;
/**
* Gets the Guid value of the node.
* @returns the Guid value of the node.
*/
getGuidValue(): Guid | undefined;
/**
* Gets the Date value of the node.
* @returns the Date value of the node.
*/
getDateValue(): Date | undefined;
/**
* Gets the Duration value of the node.
* @returns the Duration value of the node.
*/
getDurationValue(): Duration | undefined;
/**
* Gets the DateOnly value of the node.
* @returns the DateOnly value of the node.
*/
getDateOnlyValue(): DateOnly | undefined;
/**
* Gets the TimeOnly value of the node.
* @returns the TimeOnly value of the node.
*/
getTimeOnlyValue(): TimeOnly | undefined;
/**
* Gets the collection of primitive values of the node.
* @returns the collection of primitive values of the node.
*/
getCollectionOfPrimitiveValues<T>(): T[] | undefined;
/**
* Gets the collection of object values of the node.
* @returns the collection of object values of the node.
*/
getCollectionOfObjectValues<T extends Parsable>(parsableFactory: ParsableFactory<T>): T[] | undefined;
/**
* Gets the model object value of the node.
* @returns the model object value of the node.
*/
getObjectValue<T extends Parsable>(parsableFactory: ParsableFactory<T>): T;
/**
* Gets the Enum values of the node.
* @returns the Enum values of the node.
*/
getCollectionOfEnumValues<T>(type: any): T[];
/**
* Gets the Enum value of the node.
* @returns the Enum value of the node.
*/
getEnumValue<T>(type: any): T | undefined;
/**
* Gets the callback called before the node is deserialized.
* @returns the callback called before the node is deserialized.
*/
onBeforeAssignFieldValues: ((value: Parsable) => void) | undefined;
/**
* Gets the callback called after the node is deserialized.
* @returns the callback called after the node is deserialized.
*/
onAfterAssignFieldValues: ((value: Parsable) => void) | undefined;
/**
* Gets the byte array value of the node.
* @returns the byte array value of the node.
*/
getByteArrayValue(): ArrayBuffer | undefined;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/** Defines an interface for serialization of objects to a stream. */
interface SerializationWriter {
/**
* Writes the specified byte array value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeByteArrayValue(key?: string, value?: ArrayBuffer): void;
/**
* Writes the specified string value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeStringValue(key?: string, value?: string | null): void;
/**
* Writes the specified boolean value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeBooleanValue(key?: string, value?: boolean | null): void;
/**
* Writes the specified number value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeNumberValue(key?: string, value?: number | null): void;
/**
* Writes the specified Guid value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeGuidValue(key?: string, value?: Guid | null): void;
/**
* Writes the specified Date value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeDateValue(key?: string, value?: Date | null): void;
/**
* Writes the specified Duration value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeDurationValue(key?: string, value?: Duration | null): void;
/**
* Writes the specified TimeOnly value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeTimeOnlyValue(key?: string, value?: TimeOnly | null): void;
/**
* Writes the specified DateOnly value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeDateOnlyValue(key?: string, value?: DateOnly | null): void;
/**
* Writes the specified collection of primitive values to the stream with an optional given key.
* @param key the key to write the value with.
* @param values the value to write to the stream.
*/
writeCollectionOfPrimitiveValues<T>(key?: string, values?: T[] | null): void;
/**
* Writes the specified collection of object values to the stream with an optional given key.
* @param key the key to write the value with.
* @param values the value to write to the stream.
*/
writeCollectionOfObjectValues<T extends Parsable>(key?: string, values?: T[] | null, serializerMethod?: ModelSerializerFunction<T>): void;
/**
* Writes the specified model object value to the stream with an optional given key.
* @param key the key to write the value with.
* @param value the value to write to the stream.
*/
writeObjectValue<T extends Parsable>(key?: string, value?: T | null, serializerMethod?: ModelSerializerFunction<T>): void;
/**
* Writes the specified enum value to the stream with an optional given key.
* @param key the key to write the value with.
* @param values the value to write to the stream.
*/
writeEnumValue<T>(key?: string, ...values: (T | null | undefined)[]): void;
/**
* Writes a null value for the specified key.
* @param key the key to write the value with.
*/
writeNullValue(key?: string): void;
/**
* Gets the value of the serialized content.
* @returns the value of the serialized content.
*/
getSerializedContent(): ArrayBuffer;
/**
* Writes the specified additional data values to the stream with an optional given key.
* @param value the values to write to the stream.
*/
writeAdditionalData(value: Record<string, unknown> | undefined): void;
/**
* Gets the callback called before the object gets serialized.
* @returns the callback called before the object gets serialized.
*/
onBeforeObjectSerialization: ((value: Parsable) => void) | undefined;
/**
* Gets the callback called after the object gets serialized.
* @returns the callback called after the object gets serialized.
*/
onAfterObjectSerialization: ((value: Parsable) => void) | undefined;
/**
* Gets the callback called right after the serialization process starts.
* @returns the callback called right after the serialization process starts.
*/
onStartObjectSerialization: ((value: Parsable, writer: SerializationWriter) => void) | undefined;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
type ModelSerializerFunction<T extends Parsable> = (writer: SerializationWriter, value?: Partial<T> | null) => void;
type DeserializeIntoModelFunction<T extends Parsable> = (value?: Partial<T>) => Record<string, (node: ParseNode) => void>;
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* Defines the factory to get the deserializers constructing the parsable models.
* @param parseNode The node to parse use to get the discriminator value from the payload.
* @returns The parsable object.
*/
type ParsableFactory<T extends Parsable> = (parseNode: ParseNode | undefined) => DeserializeIntoModelFunction<T>;
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/** Defines the contract for a factory that creates SerializationWriter instances. */
interface SerializationWriterFactory {
/**
* Gets the content type this factory creates serialization writers for.
* @returns the content type this factory creates serialization writers for.
*/
getValidContentType(): string;
/**
* Creates a new SerializationWriter instance for the given content type.
* @param contentType the content type to create a serialization writer for.
* @returns a new SerializationWriter instance for the given content type.
*/
getSerializationWriter(contentType: string): SerializationWriter;
}
/**
* A collection class for HTTP headers. The keys are case-insensitive.
* @example
* ```typescript
* const headers = new Headers();
* headers.add("header1", "value1");
* ```
*/
declare class Headers extends Map<string, Set<string>> {
private headers;
private readonly singleValueHeaders;
/**
* Creates a new Headers object.
* @param entries An iterable object that contains key-value pairs. Each key-value pair must be an array with two elements: the key of the header, and the value of the header.
* @example
* ```typescript
* const entries: [string, Set<string>][] = [
* ['header1', new Set(['value1'])],
* ['header2', new Set(['value2', 'value3'])]
* ];
* const headers = new Headers(entries);
* ```
*/
constructor(entries?: readonly (readonly [string, Set<string>])[] | null);
/**
* Sets a header with the specified name and value. If a header with the same name already exists, its value is appended with the specified value.
* @param headerName the name of the header to set
* @param headerValue the value of the header to set
* @returns Headers object
*/
set(headerName: string, headerValue: Set<string>): this;
/**
* Gets the values for the header with the specified name.
* @param headerName The name of the header to get the values for.
* @returns The values for the header with the specified name.
* @throws Error if headerName is null or empty
*/
get(headerName: string): Set<string> | undefined;
/**
* Checks if a header exists.
* @param key The name of the header to check for.
* @returns whether or not a header with the given name/key exists.
*/
has(key: string): boolean;
/**
* Delete the header with the specified name.
* @param headerName The name of the header to delete.
* @returns Whether or not the header existed and was deleted.
* @throws Error if headerName is null or empty
*/
delete(headerName: string): boolean;
/**
* clear the headers collection
*/
clear(): void;
/**
* execute a provided function once per each header
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each header in the dictionary.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
forEach(callbackfn: (value: Set<string>, key: string, map: Map<string, Set<string>>) => void, thisArg?: any): void;
/**
* Adds values to the header with the specified name.
* @param headerName The name of the header to add values to.
* @param headerValues The values to add to the header.
* @returns Whether or not the values were added to the header.
*/
add(headerName: string, ...headerValues: string[]): boolean;
/**
* Adds values to the header with the specified name if it's not already present
* @param headerName The name of the header to add values to.
* @param headerValue The values to add to the header.
* @returns If the headerValue have been added to the Dictionary.
*/
tryAdd(headerName: string, headerValue: string): boolean;
/**
* Removes the specified value from the header with the specified name.
* @param headerName The name of the header to remove the value from.
* @param headerValue The value to remove from the header.
* @returns Whether or not the header existed and was removed.
* @throws Error if headerName is null or empty
* @throws Error if headerValue is null
*/
remove(headerName: string, headerValue: string): boolean;
/**
* Adds all the headers values from the specified headers collection.
* @param headers The headers to update the current headers with.
* @throws Error if headers is null
*/
addAll(headers: Headers): void;
/**
* Adds all headers from the request configuration value to the current headers collection.
* Replaces any existing headers with the same key.
* @param headers The headers to update the current headers with.
* @throws Error if headers is null
*/
addAllRaw(headers: Record<string, string | string[]>): void;
/**
* Gets the values for the header with the specified name.
* @param key The name of the header to get the values for.
* @returns The values for the header with the specified name.
* @throws Error if key is null or empty
*/
tryGetValue(key: string): string[] | null;
/**
* Override toString method for the headers collection
* @returns a string representation of the headers collection
*/
toString(): string;
/**
* check if the headers collection is empty
* @returns a boolean indicating if the headers collection is empty
*/
isEmpty(): boolean;
/**
* get keys of the headers collection
* @returns an iterator of keys
*/
keys(): IterableIterator<string>;
/**
* get entries
* @returns an iterator of entries
*/
entries(): IterableIterator<[string, Set<string>]>;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* Represents the HTTP method used by a request.
*/
declare enum HttpMethod {
/** The HTTP GET method */
GET = "GET",
/** The HTTP POST method */
POST = "POST",
/** The HTTP PATCH method */
PATCH = "PATCH",
/** The HTTP DELETE method */
DELETE = "DELETE",
/** The HTTP OPTIONS method */
OPTIONS = "OPTIONS",
/** The HTTP CONNECT method */
CONNECT = "CONNECT",
/** The HTTP TRACE method */
TRACE = "TRACE",
/** The HTTP HEAD method */
HEAD = "HEAD",
/** The HTTP PUT method */
PUT = "PUT"
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/** Represents a request option. */
interface RequestOption {
/** Gets the option key for when adding it to a request. Must be unique. */
getKey(): string;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* Request configuration
* @template T Query parameters type
*/
interface RequestConfiguration<T extends object> {
/**
* Request headers
*/
headers?: Record<string, string | string[]>;
/**
* Request options
*/
options?: RequestOption[];
/**
* Request query parameters
*/
queryParameters?: T;
}
/** This class represents an abstract HTTP request. */
declare class RequestInformation implements RequestInformationSetContent {
/**
* Initializes a request information instance with the provided values.
* @param httpMethod The HTTP method for the request.
* @param urlTemplate The URL template for the request.
* @param pathParameters The path parameters for the request.
*/
constructor(httpMethod?: HttpMethod, urlTemplate?: string, pathParameters?: Record<string, unknown>);
/** The URI of the request. */
private uri?;
/** The path parameters for the request. */
pathParameters: Record<string, unknown>;
/** The URL template for the request */
urlTemplate?: string;
/**
* Gets the URL of the request
* @returns the url string
*/
get URL(): string;
/** Sets the URL of the request */
set URL(url: string);
static readonly raw_url_key = "request-raw-url";
/** The HTTP method for the request */
httpMethod?: HttpMethod;
/** The Request Body. */
content?: ArrayBuffer;
/** The Query Parameters of the request. */
queryParameters: Record<string, string | number | boolean | string[] | number[] | undefined>;
/** The Request Headers. */
headers: Headers;
private _requestOptions;
/**
* Gets the request options for the request.
* @returns the request options.
*/
getRequestOptions(): Record<string, RequestOption>;
/**
* Adds the headers for the request.
* @param source The source collection to add the headers to
*/
addRequestHeaders(source: Record<string, string | string[]> | undefined): void;
/**
* Adds the request options for the request.
* @param options the options to add.
*/
addRequestOptions(options: RequestOption[] | undefined): void;
/**
* Removes the request options for the request.
* @param options the options to remove.
*/
removeRequestOptions(...options: RequestOption[]): void;
private static readonly binaryContentType;
private static readonly contentTypeHeader;
private static readonly tracerKey;
private static readonly requestTypeKey;
/**
* Sets the request body from a model with the specified content type.
* @param requestAdapter The adapter service to get the serialization writer from.
* @param contentType the content type.
* @param value the models.
* @param modelSerializerFunction the serialization function for the model type.
*/
setContentFromParsable: <T extends Parsable>(requestAdapter?: RequestAdapter, contentType?: string, value?: T[] | T, modelSerializerFunction?: ModelSerializerFunction<T>) => void;
private readonly setContentAndContentType;
private readonly getSerializationWriter;
/**
* Sets the request body from a model with the specified content type.
* @param requestAdapter The adapter service to get the serialization writer from.
* @param contentType the content type.
* @param value the scalar values to serialize.
*/
setContentFromScalar: <T extends PrimitiveTypesForDeserializationType>(requestAdapter: RequestAdapter | undefined, contentType: string | undefined, value: T[] | T) => void;
/**
* Sets the request body to be a binary stream.
* @param value the binary stream
* @param contentType the content type.
*/
setStreamContent: (value: ArrayBuffer, contentType?: string) => void;
private normalizeValue;
/**
* Sets the query string parameters from a raw object.
* @param q parameters the parameters.
* @param p the mapping from code symbol to URI template parameter name.
*/
setQueryStringParametersFromRawObject<T extends object>(q?: T, p?: Record<string, string>): void;
/**
* Configure the current request with headers, query parameters and options.
* @param config the configuration object to use.
* @param queryParametersMapper mapping between code symbols and URI template parameter names.
*/
configure<T extends object>(config?: RequestConfiguration<T>, queryParametersMapper?: Record<string, string>): void;
}
/**
* Describes the contract of request adapter set content methods so it can be used in request metadata.
*/
interface RequestInformationSetContent {
setStreamContent(value: ArrayBuffer, contentType?: string): void;
setContentFromScalar<T extends PrimitiveTypesForDeserializationType>(requestAdapter: RequestAdapter | undefined, contentType: string | undefined, value: T[] | T): void;
setContentFromParsable<T extends Parsable>(requestAdapter?: RequestAdapter, contentType?: string, value?: T[] | T, modelSerializerFunction?: ModelSerializerFunction<T>): void;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/**
* Stores model information in a different location than the object properties. Implementations can provide dirty tracking capabilities, caching capabilities or integration with 3rd party stores.
*/
interface BackingStore {
/**
* Gets a value from the backing store based on its key. Returns null if the value hasn't changed and "ReturnOnlyChangedValues" is true.
* @returns The value from the backing store.
* @param key The key to lookup the backing store with.
*/
get<T>(key: string): T | undefined;
/**
* Sets or updates the stored value for the given key.
* Will trigger subscriptions callbacks.
* @param key The key to store and retrieve the information.
* @param value The value to be stored.
*/
set<T>(key: string, value: T): void;
/**
* Enumerates all the values stored in the backing store. Values will be filtered if "ReturnOnlyChangedValues" is true.
* @returns The values available in the backing store.
*/
enumerate(): {
key: string;
value: unknown;
}[];
/**
* Enumerates the keys for all values that changed to null.
* @returns The keys for the values that changed to null.
*/
enumerateKeysForValuesChangedToNull(): string[];
/**
* Creates a subscription to any data change happening.
* @param callback Callback to be invoked on data changes where the first parameter is the data key, the second the previous value and the third the new value.
* @param subscriptionId The subscription Id to use.
* @returns The subscription Id to use when removing the subscription
*/
subscribe(callback: () => {
key: string;
previousValue: unknown;
newValue: unknown;
}, subscriptionId?: string): string;
/**
* Removes a subscription from the store based on its subscription id.
* @param subscriptionId The Id of the subscription to remove.
*/
unsubscribe(subscriptionId: string): void;
/**
* Clears the data stored in the backing store. Doesn't trigger any subscription.
*/
clear(): void;
/**
* Whether the initialization of the object and/or the initial deserialization has been completed to track whether objects have changed.
*/
initializationCompleted: boolean;
/**
* Whether to return only values that have changed since the initialization of the object when calling the Get and Enumerate methods.
*/
returnOnlyChangedValues: boolean;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/** Defines the contract for a factory that creates backing stores. */
interface BackingStoreFactory {
/**
* Creates a new instance of the backing store.
* @returns a new instance of the backing store.
*/
createBackingStore(): BackingStore;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/** Service responsible for translating abstract Request Info into concrete native HTTP requests. */
interface RequestAdapter {
/**
* Gets the serialization writer factory currently in use for the HTTP core service.
* @returns the serialization writer factory currently in use for the HTTP core service.
*/
getSerializationWriterFactory(): SerializationWriterFactory;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model.
* @param requestInfo the request info to execute.
* @param type the class of the response model to deserialize the response into.
* @param errorMappings the error factories mapping to use in case of a failed request.
* @returns a {@link Promise} with the deserialized response model.
*/
send<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType | undefined>;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection.
* @param requestInfo the request info to execute.
* @param type the class of the response model to deserialize the response into.
* @param errorMappings the error factories mapping to use in case of a failed request.
* @returns a {@link Promise} with the deserialized response model collection.
*/
sendCollection<ModelType extends Parsable>(requestInfo: RequestInformation, type: ParsableFactory<ModelType>, errorMappings: ErrorMappings | undefined): Promise<ModelType[] | undefined>;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection.
* @param requestInfo the request info to execute.
* @param responseType the class of the response model to deserialize the response into.
* @param errorMappings the error factories mapping to use in case of a failed request.
* @returns a {@link Promise} with the deserialized response model collection.
*/
sendCollectionOfPrimitive<ResponseType extends Exclude<PrimitiveTypesForDeserializationType, ArrayBuffer>>(requestInfo: RequestInformation, responseType: Exclude<PrimitiveTypesForDeserialization, "ArrayBuffer">, errorMappings: ErrorMappings | undefined): Promise<ResponseType[] | undefined>;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model.
* @param requestInfo the request info to execute.
* @param responseType the class of the response model to deserialize the response into.
* @param errorMappings the error factories mapping to use in case of a failed request.
* @returns a {@link Promise} with the deserialized primitive response model.
*/
sendPrimitive<ResponseType extends PrimitiveTypesForDeserializationType>(requestInfo: RequestInformation, responseType: PrimitiveTypesForDeserialization, errorMappings: ErrorMappings | undefined): Promise<ResponseType | undefined>;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized primitive response model.
* @param requestInfo the request info to execute.
* @param errorMappings the error factories mapping to use in case of a failed request.
* @returns a {@link Promise} of void.
*/
sendNoResponseContent(requestInfo: RequestInformation, errorMappings: ErrorMappings | undefined): Promise<void>;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized enum response model.
* @template EnumObject - The type of the enum object. Must extend Record<string, unknown>.
* @param requestInfo - The request info to execute.
* @param enumObject - The Enum object expected in the response.
* @param errorMappings - the error factories mapping to use in case of a failed request.
* @returns A promise that resolves to the response of the request, or undefined if an error occurred.
*/
sendEnum<EnumObject extends Record<string, unknown>>(requestInfo: RequestInformation, enumObject: EnumObject, errorMappings: ErrorMappings | undefined): Promise<EnumObject[keyof EnumObject] | undefined>;
/**
* Executes the HTTP request specified by the given RequestInformation and returns the deserialized response model collection.
* @template EnumObject - The type of the enum objects. Must extend Record<string, unknown>.
* @param requestInfo - The request info to execute.
* @param enumObject - The Enum object expected in the response.
* @param errorMappings - the error factories mapping to use in case of a failed request.
* @returns a promise with the deserialized response model collection.
*/
sendCollectionOfEnum<EnumObject extends Record<string, unknown>>(requestInfo: RequestInformation, enumObject: EnumObject, errorMappings: ErrorMappings | undefined): Promise<EnumObject[keyof EnumObject][] | undefined>;
/**
* Enables the backing store proxies for the SerializationWriters and ParseNodes in use.
* @param backingStoreFactory the backing store factory to use.
*/
enableBackingStore(backingStoreFactory?: BackingStoreFactory): void;
/** The base url for every request. */
baseUrl: string;
/**
* Converts the given RequestInformation into a native HTTP request used by the implementing adapter.
* @param requestInfo the request info to convert.
* @returns a {@link Promise} with the native request.
*/
convertToNativeRequest<T>(requestInfo: RequestInformation): Promise<T>;
}
interface ErrorMappings {
_4XX?: ParsableFactory<Parsable>;
_5XX?: ParsableFactory<Parsable>;
XXX?: ParsableFactory<Parsable>;
[key: number]: ParsableFactory<Parsable>;
}
type PrimitiveTypesForDeserializationType = string | number | boolean | Date | DateOnly | TimeOnly | Duration | ArrayBuffer;
type PrimitiveTypesForDeserialization = "string" | "number" | "boolean" | "Date" | "DateOnly" | "TimeOnly" | "Duration" | "ArrayBuffer";
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
/** Parent interface for errors thrown by the client when receiving failed responses to its requests. */
interface ApiError extends Error {
/** The status code for the error. */
responseStatusCode: number | undefined;
/** The Response Headers. */
responseHeaders: Record<string, string[]> | undefined;
}
/**
* -------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License.
* See License in the project root for license information.
* -------------------------------------------------------------------------------------------
*/
interface BaseRequestBuilder<T> {
withUrl(rawUrl: string): T;
}
interface AgentDescription extends AdditionalDataHolder, Parsable {
/**
* Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
*/
additionalData?: Record<string, unknown>;
/**
* The name of the agent
*/
agentName?: string | null;
/**
* A list of agent parameters that you can extract from the user's prompt.
*/
agentParameterNames?: string[] | null;
/**
* The description of this agent, its purpose and capabilities.
*/
description?: string | null;
/**
* This agent ONLY generates if user mentioned one of these topics
*/
topics?: string[] | null;
}
/**
* This schema represents a generated plan to execute agents to fulfill the user's request. The chat message should be non-technical - do NOT mention agents.
*/
interface AgentExecutionPlanSchema extends AdditionalDataHolder, Parsable {
/**
* Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
*/
additionalData?: Record<string, unknown>;
/**
* The chat response to the user's message - a friendly non-technical message. Do NOT mention agents.
*/
chatMessage?: string | null;
/**
* The ordered list of agents that you recommend should be used to handle the user's prompt. Only the most relevant agents should be recommended.
*/
recommendedAgents?: RecommendedAgent[] | null;
}
type BlackboardFormat = (typeof BlackboardFormatObject)[keyof typeof BlackboardFormatObject];
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {AgentDescription}
*/
declare function createAgentDescriptionFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {AgentExecutionPlanSchema}
*/
declare function createAgentExecutionPlanSchemaFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {FunctionAgentDefinitionMinimal_agent_parameters}
*/
declare function createFunctionAgentDefinitionMinimal_agent_parametersFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {FunctionAgentDefinitionMinimal}
*/
declare function createFunctionAgentDefinitionMinimalFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {FunctionCallBlackboardInput}
*/
declare function createFunctionCallBlackboardInputFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {FunctionCallBlackboardOutput}
*/
declare function createFunctionCallBlackboardOutputFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {FunctionCallGenerateRequest}
*/
declare function createFunctionCallGenerateRequestFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {FunctionCallSchema_parameters}
*/
declare function createFunctionCallSchema_parametersFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {FunctionCallSchema}
*/
declare function createFunctionCallSchemaFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {FunctionSpecSchema}
*/
declare function createFunctionSpecSchemaFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {GeneratePlanRequest}
*/
declare function createGeneratePlanRequestFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {HTTPValidationError}
*/
declare function createHTTPValidationErrorFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {Message}
*/
declare function createMessageFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {ParameterSpec}
*/
declare function createParameterSpecFromDiscriminatorValue(parseNode: ParseNode | undefined): ((instance?: Parsable) => Record<string, (node: ParseNode) => void>);
/**
* Creates a new instance of the appropriate class based on discriminator value
* @param parseNode The parse node to use to read the discriminator value and create the object
* @returns {RecommendedAgent_agent_parameters}
*/
declare function createRecommendedAgent_agent_parametersFromDiscriminatorValue(parseNode: ParseNode