/** * Web implementation of ArtifactsService (minimal stub) * * This is a minimal implementation for browser mode. * Most functionality requires Tauri backend. */ import type { Artifact, ArtifactIndex, ArtifactCreate, DiffPreview, ImportResult, } from '@janhq/core' import type { ArtifactsService } from './types' export class WebArtifactsService implements ArtifactsService { private notImplemented(method: string): never { throw new Error(`${method} is not implemented in web mode. Use Tauri app for full artifacts support.`) } async listArtifacts(_threadId: string): Promise { return { schema_version: 1, artifacts: [], active_artifact_id: null, history_keep: { max_entries: 50, max_days: 30, }, } } async createArtifact(_threadId: string, _data: ArtifactCreate): Promise { return this.notImplemented('createArtifact') } async getArtifactContent(_threadId: string, _artifactId: string): Promise { return this.notImplemented('getArtifactContent') } async updateArtifact( _threadId: string, _artifactId: string, _content: string, _version: number, _hash: string ): Promise { return this.notImplemented('updateArtifact') } async deleteArtifact(_threadId: string, _artifactId: string): Promise { return this.notImplemented('deleteArtifact') } async renameArtifact(_threadId: string, _artifactId: string, _newName: string): Promise { return this.notImplemented('renameArtifact') } async setActiveArtifact(_threadId: string, _artifactId: string | null): Promise { // No-op in web mode return Promise.resolve() } async proposeUpdate(_threadId: string, _artifactId: string, _content: string): Promise { return { proposal_id: 'stub', artifact_id: _artifactId, current_version: 1, current_hash: '', proposed_hash: '', hunks: [], full_diff: '', } } async applyProposal( _threadId: string, _artifactId: string, _proposalId: string, _selectedHunks?: number[] ): Promise { return this.notImplemented('applyProposal') } async discardProposal(_threadId: string, _artifactId: string, _proposalId: string): Promise { return Promise.resolve() } async exportArtifacts(_threadId: string, _outputPath: string): Promise { return Promise.resolve() } async importArtifacts(_threadId: string, _archivePath: string): Promise { return this.notImplemented('importArtifacts') } }