Files
open-design/packages/contracts/src/api/chat.ts
marco 5dd70b5016
Some checks failed
ci / Validate workspace (push) Successful in 12m32s
landing-page-ci / Validate landing page (push) Successful in 9m41s
landing-page-deploy / Deploy landing page (push) Failing after 5m23s
github-metrics / Generate repository metrics SVG (push) Failing after 2m6s
refresh-contributors-wall / Refresh contributors wall cache bust (push) Failing after 12s
Initial import: open-design source for helix-mind.ai distribution
This repository contains the open-design daemon CLI source code, built
and packaged at https://helix-mind.ai/cli/open-design/latest.tgz for use
by the HelixMind /design slash command.

Licenses: Apache-2.0 (root) + MIT (skills/*)
2026-05-06 20:50:24 +02:00

128 lines
3.3 KiB
TypeScript

import type { ProjectFile } from './files';
import type {
PreviewCommentMember,
PreviewCommentPosition,
PreviewCommentSelectionKind,
} from './comments';
export type ChatRole = 'user' | 'assistant';
export interface ChatRequest {
agentId: string;
message: string;
systemPrompt?: string;
projectId?: string | null;
conversationId?: string | null;
assistantMessageId?: string | null;
clientRequestId?: string | null;
skillId?: string | null;
designSystemId?: string | null;
attachments?: string[];
commentAttachments?: ChatCommentAttachment[];
model?: string | null;
reasoning?: string | null;
}
export interface ChatRunCreateRequest extends ChatRequest {
projectId: string;
conversationId: string;
assistantMessageId: string;
clientRequestId: string;
}
export type ChatRunStatus = 'queued' | 'running' | 'succeeded' | 'failed' | 'canceled';
export interface ChatRunCreateResponse {
runId: string;
}
export interface ChatRunStatusResponse {
id: string;
projectId: string | null;
conversationId: string | null;
assistantMessageId: string | null;
agentId: string | null;
status: ChatRunStatus;
createdAt: number;
updatedAt: number;
exitCode?: number | null;
signal?: string | null;
}
export interface ChatRunListResponse {
runs: ChatRunStatusResponse[];
}
export interface ChatRunCancelResponse {
ok: true;
}
export interface ChatAttachment {
path: string;
name: string;
kind: 'image' | 'file';
size?: number;
}
export interface ChatCommentAttachment {
id: string;
order: number;
filePath: string;
elementId: string;
selector: string;
label: string;
comment: string;
currentText: string;
pagePosition: PreviewCommentPosition;
htmlHint: string;
selectionKind?: PreviewCommentSelectionKind;
memberCount?: number;
podMembers?: PreviewCommentMember[];
source?: 'saved-comment' | 'board-batch';
}
export type PersistedAgentEvent =
| { kind: 'status'; label: string; detail?: string }
| { kind: 'text'; text: string }
| { kind: 'thinking'; text: string }
| {
kind: 'live_artifact';
action: 'created' | 'updated' | 'deleted';
projectId: string;
artifactId: string;
title: string;
refreshStatus?: string;
}
| {
kind: 'live_artifact_refresh';
phase: 'started' | 'succeeded' | 'failed';
projectId: string;
artifactId: string;
refreshId?: string;
title?: string;
refreshedSourceCount?: number;
error?: string;
}
| { kind: 'tool_use'; id: string; name: string; input: unknown }
| { kind: 'tool_result'; toolUseId: string; content: string; isError: boolean }
| { kind: 'usage'; inputTokens?: number; outputTokens?: number; costUsd?: number; durationMs?: number }
| { kind: 'raw'; line: string };
export interface ChatMessage {
id: string;
role: ChatRole;
content: string;
agentId?: string;
agentName?: string;
events?: PersistedAgentEvent[];
createdAt?: number;
runId?: string;
runStatus?: ChatRunStatus;
lastRunEventId?: string;
startedAt?: number;
endedAt?: number;
attachments?: ChatAttachment[];
commentAttachments?: ChatCommentAttachment[];
producedFiles?: ProjectFile[];
}