Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
import * as Schema from "effect/Schema";
import { ServerSelfUpdateMethod } from "../environment.ts";
import { TrimmedNonEmptyString } from "../baseSchemas.ts";
import { ProviderDriverKind, ProviderInstanceId } from "../providerInstance.ts";
import { ServerProviders } from "./providers.ts";
export const ServerProviderUpdatedPayload = Schema.Struct({
providers: ServerProviders,
});
export type ServerProviderUpdatedPayload = typeof ServerProviderUpdatedPayload.Type;
export const ServerProviderUpdateInput = Schema.Struct({
provider: ProviderDriverKind,
instanceId: Schema.optionalKey(ProviderInstanceId),
});
export type ServerProviderUpdateInput = typeof ServerProviderUpdateInput.Type;
export class ServerProviderUpdateError extends Schema.TaggedErrorClass<ServerProviderUpdateError>()(
"ServerProviderUpdateError",
{
provider: ProviderDriverKind,
reason: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
return `Provider update failed for ${this.provider}: ${this.reason}`;
}
}
export const ServerSelfUpdateInput = Schema.Struct({
/** Exact npm version of the `t3` package to install (never a dist-tag, so
the server and the acknowledging client agree on what was requested). */
targetVersion: TrimmedNonEmptyString,
});
export type ServerSelfUpdateInput = typeof ServerSelfUpdateInput.Type;
/** Acknowledgement that the update artifact is installed and the server is
about to restart into it — the connection will drop moments later. */
export const ServerSelfUpdateResult = Schema.Struct({
targetVersion: TrimmedNonEmptyString,
method: ServerSelfUpdateMethod,
/** Launcher-generated correlation ID. Absent when talking to older servers. */
updateId: Schema.optionalKey(TrimmedNonEmptyString),
});
export type ServerSelfUpdateResult = typeof ServerSelfUpdateResult.Type;
export const ServerSelfUpdateProgressStage = Schema.Literals(["downloading", "installing"]);
export type ServerSelfUpdateProgressStage = typeof ServerSelfUpdateProgressStage.Type;
export const ServerSelfUpdateProgressEvent = Schema.Union([
Schema.Struct({
type: Schema.Literal("progress"),
stage: ServerSelfUpdateProgressStage,
}),
Schema.Struct({
type: Schema.Literal("complete"),
result: ServerSelfUpdateResult,
}),
]);
export type ServerSelfUpdateProgressEvent = typeof ServerSelfUpdateProgressEvent.Type;
export class ServerSelfUpdateError extends Schema.TaggedErrorClass<ServerSelfUpdateError>()(
"ServerSelfUpdateError",
{
reason: TrimmedNonEmptyString,
cause: Schema.optional(Schema.Defect()),
},
) {
override get message(): string {
return `Server update failed: ${this.reason}`;
}
}