mirror of
https://github.com/andrewyng/openworker.git
synced 2026-11-20 20:37:44 +00:00
Allow developers to easily build AI apps without worrying about the harness part. Bundles the Rust agent runtime as a SDK (Rust and TypeScript) for building desktop and web applications. Applications can manage a local harness or connect to an authenticated harness service on k8s with separately scaled workers and sandbox execution. The implementation is primarily contained in harness/, with deployment tooling in deploy/, Markdown guides in docs/harness/guides/, and the static documentation site in docs-site/. It does not replace the existing Python harness or migrate OpenWorker Desktop. Co-authored-by: Devika Verma <devikaverma11@gmail.com>
167 lines
4.1 KiB
TypeScript
167 lines
4.1 KiB
TypeScript
export type Api = "responses" | "chat-completions" | "anthropic";
|
|
export interface ProviderSettings {
|
|
name: string;
|
|
preset: string;
|
|
api: Api;
|
|
baseUrl: string;
|
|
model: string;
|
|
}
|
|
export interface Settings {
|
|
version: 1;
|
|
gamesRoot: string;
|
|
provider: ProviderSettings | null;
|
|
}
|
|
export interface Brief {
|
|
engine?: "canvas" | "three";
|
|
idea: string;
|
|
kind: string;
|
|
vibe: string;
|
|
difficulty: string;
|
|
}
|
|
export type GameStatus =
|
|
| "draft"
|
|
| "building"
|
|
| "waiting"
|
|
| "ready"
|
|
| "failed"
|
|
| "cancelled"
|
|
| "interrupted";
|
|
export interface Game {
|
|
coverUrl?: string;
|
|
id: string;
|
|
title: string;
|
|
directory: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
brief: Brief;
|
|
session: { session_id: string; agent: string } | null;
|
|
model: { provider: string; name: string } | null;
|
|
revisionId: string | null;
|
|
status: GameStatus;
|
|
error: string | null;
|
|
thumbnail: boolean;
|
|
submissionId: string | null;
|
|
}
|
|
export interface Revision {
|
|
id: string;
|
|
gameId: string;
|
|
createdAt: string;
|
|
hash: string;
|
|
source: "agent" | "duplicate" | "template";
|
|
}
|
|
export interface Message {
|
|
id: string;
|
|
role: "user" | "assistant";
|
|
text: string;
|
|
}
|
|
export interface Activity {
|
|
id: string;
|
|
text: string;
|
|
kind: "status" | "tool" | "error";
|
|
time: string;
|
|
}
|
|
export interface Pending {
|
|
id: string;
|
|
session_id: string;
|
|
kind: "approval" | "question" | "safety";
|
|
code?: string;
|
|
tool?: string;
|
|
question?: string;
|
|
options?: string[];
|
|
}
|
|
export interface ProjectView {
|
|
testing?: TestingSummary;
|
|
reviewAvailable?: boolean;
|
|
files?: { path: string; bytes: number }[];
|
|
game: Game;
|
|
messages: Message[];
|
|
partial: string;
|
|
activity: Activity[];
|
|
pending: Pending[];
|
|
active: boolean;
|
|
stage: string;
|
|
revisions: Revision[];
|
|
previewUrl: string | null;
|
|
}
|
|
export interface ReviewView {
|
|
digest: string;
|
|
baseRevision: string | null;
|
|
draftUrl: string;
|
|
currentUrl: string | null;
|
|
changes: { path: string; kind: string }[];
|
|
}
|
|
export type TestCheck = "start" | "movement" | "pause" | "compact" | "level";
|
|
export interface TestingSummary {
|
|
digest: string;
|
|
current: boolean;
|
|
updatedAt: string;
|
|
screenshots: number;
|
|
keys: number;
|
|
pointer: number;
|
|
viewports: string[];
|
|
hostErrors: number;
|
|
error?: string;
|
|
checks: Record<
|
|
TestCheck,
|
|
{ status: "passed" | "failed" | "not_tested"; note: string }
|
|
>;
|
|
}
|
|
export interface AppSnapshot {
|
|
starters: StarterGame[];
|
|
settings: Settings;
|
|
games: Game[];
|
|
activeGameId: string | null;
|
|
runtime: "idle" | "ready" | "recovering" | "unavailable";
|
|
}
|
|
export interface StarterGame {
|
|
id: string;
|
|
version: string;
|
|
title: string;
|
|
description: string;
|
|
engine: "canvas" | "three";
|
|
tags: string[];
|
|
license: string;
|
|
coverUrl: string;
|
|
heroUrl: string;
|
|
previewUrl: string;
|
|
}
|
|
export type AppEvent =
|
|
| { type: "changed" }
|
|
| { type: "project"; view: ProjectView }
|
|
| { type: "runtime"; state: string };
|
|
export type Action =
|
|
| { type: "snapshot" }
|
|
| { type: "settings.save"; provider: ProviderSettings; apiKey?: string }
|
|
| { type: "settings.directory" }
|
|
| { type: "provider.test" }
|
|
| { type: "game.create"; title?: string; brief: Brief }
|
|
| { type: "game.open"; id: string }
|
|
| { type: "game.review"; id: string; interactionId: string }
|
|
| { type: "game.play"; id: string }
|
|
| { type: "game.template" }
|
|
| { type: "starter.remix"; id: string }
|
|
| { type: "game.file"; id: string; path: string }
|
|
| { type: "game.import-assets"; id: string }
|
|
| { type: "window.fullscreen" }
|
|
| { type: "game.duplicate"; id: string }
|
|
| { type: "game.send"; id: string; text: string }
|
|
| {
|
|
type: "game.respond";
|
|
id: string;
|
|
interactionId: string;
|
|
decision?: "once" | "session" | "deny";
|
|
answer?: string;
|
|
}
|
|
| { type: "game.cancel"; id: string }
|
|
| { type: "game.restore"; id: string; revisionId: string }
|
|
| { type: "game.export"; id: string }
|
|
| { type: "game.thumbnail"; id: string; revisionId: string };
|
|
export interface DesktopBridge {
|
|
gameProgress: (
|
|
url: string,
|
|
request: import("./game-progress.js").ProgressRequest,
|
|
) => Promise<unknown>;
|
|
action<T = unknown>(input: Action): Promise<T>;
|
|
onEvent(listener: (event: AppEvent) => void): () => void;
|
|
}
|