@aryacode/dsh-arya-image-gen 0.0.0-stage → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +24 -0
  3. package/README.md +292 -2
  4. package/cordis.patch.yml +5 -0
  5. package/docs/assets/readme/canvas-edit.webp +0 -0
  6. package/docs/assets/readme/canvas-generate.webp +0 -0
  7. package/docs/assets/readme/chat-example.webp +0 -0
  8. package/docs/assets/readme/chat-generate.webp +0 -0
  9. package/docs/assets/readme/comfyui-workflows.webp +0 -0
  10. package/docs/assets/readme/gallery-management.webp +0 -0
  11. package/docs/assets/readme/hero-arya-wide.webp +0 -0
  12. package/docs/assets/readme/hero-arya.webp +0 -0
  13. package/docs/assets/readme/inspiration-arya.webp +0 -0
  14. package/docs/assets/readme/inspiration-library.webp +0 -0
  15. package/docs/assets/readme/install-arya.webp +0 -0
  16. package/docs/assets/readme/multi-model-compare.webp +0 -0
  17. package/docs/assets/readme/other-features.webp +0 -0
  18. package/docs/assets/readme/plugin-detail.webp +0 -0
  19. package/docs/assets/readme/plugins-entry.webp +0 -0
  20. package/docs/assets/readme/regenerating.webp +0 -0
  21. package/docs/assets/readme/revision-switcher.webp +0 -0
  22. package/docs/assets/readme/studio-arya.webp +0 -0
  23. package/docs/assets/readme/studio-workbench.webp +0 -0
  24. package/docs/assets/readme/workflow-overview-en.webp +0 -0
  25. package/docs/assets/readme/workflow-overview.webp +0 -0
  26. package/docs/workflows/arya-qwen-image-pack.zip +0 -0
  27. package/docs/workflows/qwen-image-compose.json +1 -0
  28. package/docs/workflows/qwen-image-create.json +142 -0
  29. package/docs/workflows/qwen-image-cutout.json +142 -0
  30. package/docs/workflows/qwen-image-edit.json +1 -0
  31. package/docs/workflows/qwen-image-remove-bg.json +1 -0
  32. package/lib/agent-toolset.js +51 -0
  33. package/lib/client.js +127081 -0
  34. package/lib/index.js +28598 -0
  35. package/lib/types/agent-preset/billion-context.d.ts +150 -0
  36. package/lib/types/agent-preset/definition.d.ts +75 -0
  37. package/lib/types/agent-preset/persona.d.ts +10 -0
  38. package/lib/types/agent-preset/register.d.ts +40 -0
  39. package/lib/types/agent-preset/toolset.d.ts +36 -0
  40. package/lib/types/baoyu-compose.d.ts +59 -0
  41. package/lib/types/canvas-asset-route.d.ts +12 -0
  42. package/lib/types/canvas-state-route.d.ts +37 -0
  43. package/lib/types/canvas-state.d.ts +80 -0
  44. package/lib/types/canvas-tools.d.ts +44 -0
  45. package/lib/types/client/browser-image-utils.d.ts +23 -0
  46. package/lib/types/client/conversation-image-revisions.d.ts +24 -0
  47. package/lib/types/client/conversation-regenerate.d.ts +8 -0
  48. package/lib/types/client/gallery-store.d.ts +137 -0
  49. package/lib/types/client/gallery-view.d.ts +255 -0
  50. package/lib/types/client/generation-activity.d.ts +62 -0
  51. package/lib/types/client/image-cache.d.ts +26 -0
  52. package/lib/types/client/image-ref.d.ts +31 -0
  53. package/lib/types/client/image-result-node.d.ts +81 -0
  54. package/lib/types/client/index.d.ts +113 -0
  55. package/lib/types/client/inspiration-catalog-cache.d.ts +4 -0
  56. package/lib/types/client/inspiration-image-cache.d.ts +3 -0
  57. package/lib/types/client/inspiration-style.d.ts +1 -0
  58. package/lib/types/client/inspiration-view.d.ts +9 -0
  59. package/lib/types/client/multi-model-compare.d.ts +20 -0
  60. package/lib/types/client/settings-state.d.ts +12 -0
  61. package/lib/types/client/settings-write.d.ts +4 -0
  62. package/lib/types/client/studio-style.d.ts +1 -0
  63. package/lib/types/client/studio-view.d.ts +48 -0
  64. package/lib/types/client/tl/canvas-selection.d.ts +13 -0
  65. package/lib/types/client/tl/canvas-sync.d.ts +30 -0
  66. package/lib/types/client/tl/conversation-landings.d.ts +48 -0
  67. package/lib/types/client/tl/css-supports-shim.d.ts +21 -0
  68. package/lib/types/client/tl/gallery-canvas-button.d.ts +10 -0
  69. package/lib/types/client/tl/gallery-image-transfer.d.ts +12 -0
  70. package/lib/types/client/tl/studio-tl-canvas.d.ts +16 -0
  71. package/lib/types/client/tl/tl-brand-theme.d.ts +10 -0
  72. package/lib/types/client/tl/tl-brand-tokens.d.ts +24 -0
  73. package/lib/types/client/tl/tl-canvas-bridge.d.ts +39 -0
  74. package/lib/types/client/tl/tl-css.d.ts +2 -0
  75. package/lib/types/client/tl/tl-theme-css.d.ts +17 -0
  76. package/lib/types/comfyui-progress.d.ts +78 -0
  77. package/lib/types/comfyui-server-route.d.ts +10 -0
  78. package/lib/types/comfyui-server.d.ts +61 -0
  79. package/lib/types/comfyui-workflow.d.ts +80 -0
  80. package/lib/types/comfyui.d.ts +52 -0
  81. package/lib/types/config.d.ts +87 -0
  82. package/lib/types/fetch-diagnostics.d.ts +10 -0
  83. package/lib/types/generated/default-workflows.d.ts +16 -0
  84. package/lib/types/image-route.d.ts +35 -0
  85. package/lib/types/image-tool-context.d.ts +3 -0
  86. package/lib/types/import-route.d.ts +16 -0
  87. package/lib/types/index.d.ts +16 -0
  88. package/lib/types/inspiration-route.d.ts +6 -0
  89. package/lib/types/inspiration.d.ts +92 -0
  90. package/lib/types/progress-route.d.ts +10 -0
  91. package/lib/types/redact.d.ts +2 -0
  92. package/lib/types/reference-image.d.ts +56 -0
  93. package/lib/types/reference-import.d.ts +66 -0
  94. package/lib/types/save-generated.d.ts +83 -0
  95. package/lib/types/settings-health.d.ts +6 -0
  96. package/lib/types/shared.d.ts +519 -0
  97. package/lib/types/studio-route.d.ts +15 -0
  98. package/lib/types/studio.d.ts +14 -0
  99. package/lib/types/validate-workflows.d.ts +48 -0
  100. package/lib/types/workspace-save.d.ts +103 -0
  101. package/package.json +143 -5
  102. package/skills/arya-image-references/SKILL.md +74 -0
  103. package/skills/arya-image-workflows/SKILL.md +75 -0
  104. package/skills/install-arya-image-gen/SKILL.md +28 -0
@@ -0,0 +1,137 @@
1
+ /**
2
+ * Lightweight IndexedDB persistence layer for Image Generation Gallery.
3
+ * Stores lightweight metadata indexes; image binaries remain managed by DSH Attachment service.
4
+ * Supports tombstones to ensure deleted items are never resurrected when revisiting conversations.
5
+ */
6
+ import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
7
+ import type { ImageProvider, StudioWatermark } from '../shared.js';
8
+ export interface GalleryItem {
9
+ id: string;
10
+ attachment: ImageAttachmentRef;
11
+ prompt: string;
12
+ /** Generation provider, or 'import' for user-uploaded images. */
13
+ provider: ImageProvider | 'import';
14
+ channel?: string | undefined;
15
+ model: string;
16
+ createdAt: number;
17
+ aspectRatio?: string | undefined;
18
+ imageSize?: string | undefined;
19
+ resolution?: string | undefined;
20
+ generationQuality?: string | undefined;
21
+ watermark?: StudioWatermark | undefined;
22
+ output?: string | undefined;
23
+ /** Workflow seed reported by the ComfyUI provider. Optional so records written by older versions stay readable; the object store is schemaless, so no IndexedDB version bump is needed. */
24
+ seed?: number | undefined;
25
+ /** ComfyUI timing split, stored for the details panel. */
26
+ queueMs?: number | undefined;
27
+ execMs?: number | undefined;
28
+ totalMs?: number | undefined;
29
+ queueAhead?: number | undefined;
30
+ comfyVersion?: string | undefined;
31
+ /** Saved file path on workspace disk if savedTo was returned */
32
+ savedTo?: string | undefined;
33
+ /** Whether this item is marked as favorite */
34
+ isFavorite?: boolean | undefined;
35
+ /** Custom tags or collection markers */
36
+ tags?: string[] | undefined;
37
+ /** Workspace filesystem path where the image was generated/saved */
38
+ workspacePath?: string | undefined;
39
+ /** Workspace ID if known */
40
+ workspaceId?: string | undefined;
41
+ /** Conversation session ID where the image was generated */
42
+ sessionId?: string | undefined;
43
+ /** Attachment ids of the source images this image was edited from; used by the canvas to rebuild edit chains. Optional so records written by older versions stay readable. */
44
+ sourceAttachmentIds?: string[] | undefined;
45
+ }
46
+ /** A user-created folder grouping favorite prompts. */
47
+ export interface FavoriteFolder {
48
+ id: string;
49
+ kind: 'image' | 'prompt';
50
+ name: string;
51
+ addedAt: number;
52
+ }
53
+ /** A prompt kept in the workbench favorites rail. */
54
+ export interface FavoritePrompt {
55
+ /** Stable id derived from the trimmed text; identical prompts dedupe. */
56
+ id: string;
57
+ text: string;
58
+ addedAt: number;
59
+ /** Owning folder id; absent entries are unfiled and appear under "all". */
60
+ folderId?: string;
61
+ }
62
+ type GalleryListener = () => void;
63
+ /**
64
+ * Subscribe to gallery mutations (insert/delete/clear).
65
+ */
66
+ export declare function subscribeGallery(listener: GalleryListener): () => void;
67
+ /**
68
+ * Save or update a gallery record by attachmentId.
69
+ * Skipped if the item was previously deleted (tombstoned).
70
+ * Preserves existing isFavorite, tags, and original createdAt on re-renders.
71
+ * Returns false when the record was not persisted (e.g. IndexedDB unavailable)
72
+ * so callers can surface the failure and let the user retry.
73
+ */
74
+ export declare function saveGalleryItem(item: Omit<GalleryItem, 'createdAt'> & {
75
+ createdAt?: number;
76
+ }): Promise<boolean>;
77
+ /**
78
+ * Retrieve all gallery records sorted by createdAt descending.
79
+ */
80
+ export declare function getGalleryItems(): Promise<GalleryItem[]>;
81
+ /**
82
+ * Toggle favorite status of a gallery item.
83
+ * Returns the new favorite status (true if favorited, false if unfavorited).
84
+ */
85
+ export declare function toggleFavoriteGalleryItem(id: string): Promise<boolean>;
86
+ /**
87
+ * Delete a single gallery record by ID and record a tombstone.
88
+ */
89
+ export declare function deleteGalleryItem(id: string): Promise<void>;
90
+ /**
91
+ * Bulk delete multiple gallery records by IDs and record tombstones in a single transaction.
92
+ */
93
+ export declare function bulkDeleteGalleryItems(ids: string[]): Promise<void>;
94
+ /**
95
+ * Bulk update favorite status for multiple gallery records in a single transaction.
96
+ */
97
+ export declare function bulkSetFavoriteGalleryItems(ids: string[], isFavorite: boolean): Promise<void>;
98
+ /**
99
+ * Clear all gallery records and reset tombstones.
100
+ */
101
+ export declare function clearGallery(): Promise<void>;
102
+ /**
103
+ * Standardize path format across Windows and POSIX (lowercase, forward slashes, no trailing slash).
104
+ */
105
+ export declare function normalizeWorkspacePath(rawPath: string): string;
106
+ /**
107
+ * Determine if a gallery item belongs to the given workspace context.
108
+ * Compares workspaceId, sessionId membership, workspacePath, and savedTo file path prefix.
109
+ */
110
+ export declare function isItemInWorkspace(item: GalleryItem, workspace?: {
111
+ workspaceId?: string | undefined;
112
+ path?: string | undefined;
113
+ sessionIds?: readonly string[] | undefined;
114
+ } | null): boolean;
115
+ /** Subscribe to favorites mutations (insert/delete). */
116
+ export declare function subscribeFavorites(listener: () => void): () => void;
117
+ /**
118
+ * Keep one prompt in the favorites rail; identical trimmed text overwrites
119
+ * (one record per distinct prompt).
120
+ * @returns false when the write failed.
121
+ */
122
+ export declare function saveFavoritePrompt(text: string): Promise<boolean>;
123
+ /** Prompt favorites, newest first. */
124
+ export declare function getFavoritePrompts(): Promise<FavoritePrompt[]>;
125
+ /** Drop one prompt favorite. */
126
+ export declare function deleteFavoritePrompt(id: string): Promise<void>;
127
+ /** Create a favorites folder; returns null when the name is empty or already used for the kind. */
128
+ export declare function addFavoriteFolder(kind: 'image' | 'prompt', name: string): Promise<FavoriteFolder | null>;
129
+ /** List all favorite folders. */
130
+ export declare function getFavoriteFolders(): Promise<FavoriteFolder[]>;
131
+ /** Delete a folder; member favorites survive and become unfiled. */
132
+ export declare function deleteFavoriteFolder(id: string): Promise<void>;
133
+ /** File a favorite prompt into a folder (undefined unfiles it). */
134
+ export declare function moveFavoritePrompt(id: string, folderId: string | undefined): Promise<boolean>;
135
+ /** Rewrite a favorite prompt's text in place, keeping its id stable. */
136
+ export declare function updateFavoritePrompt(id: string, text: string): Promise<boolean>;
137
+ export {};
@@ -0,0 +1,255 @@
1
+ /**
2
+ * Native Workspace Gallery & Studio View Component for DSH `conversation.view` slot.
3
+ * Fully i18n-reactive (Chinese & English) with modular tabs, multi-dimensional filters,
4
+ * responsive image grid, and placeholder routes.
5
+ */
6
+ import { type FC } from 'react';
7
+ /** Host-provided locale service; `active` may be missing before the locale loads. */
8
+ export interface LocaleService {
9
+ getSnapshot(): {
10
+ active?: string;
11
+ };
12
+ subscribe(fn: () => void): () => void;
13
+ }
14
+ export type TabKey = 'gallery' | 'studio' | 'inspiration' | 'favorites';
15
+ export type SortKey = 'newest' | 'oldest';
16
+ declare const DICT: {
17
+ readonly zh: {
18
+ readonly tabGallery: "图库";
19
+ readonly tabStudio: "工作台";
20
+ readonly tabInspiration: "灵感";
21
+ readonly tabFavorites: "收藏";
22
+ readonly tabCompare: "对比";
23
+ readonly tabTasks: "任务";
24
+ readonly filterAllProviders: "全部提供商";
25
+ readonly filterGoogle: "Google Gemini";
26
+ readonly filterOpenAI: "OpenAI";
27
+ readonly filterOpenAICompat: "OpenAI 兼容";
28
+ readonly filterSeedream: "字节 Seedream";
29
+ readonly filterDashScope: "阿里 DashScope";
30
+ readonly filterXAI: "xAI Grok";
31
+ readonly filterZhipu: "智谱 GLM";
32
+ readonly filterComfyUI: "本地 ComfyUI";
33
+ readonly filterImport: "导入";
34
+ readonly importImages: "导入图片";
35
+ readonly importAdded: "已导入 {count} 张图片";
36
+ readonly importPartial: "导入 {count} 张,{fail} 张失败";
37
+ readonly importFailed: "导入失败";
38
+ readonly importPickHint: "选择要导入的图片(PNG/JPG/WebP/GIF)";
39
+ readonly filterAllModels: "全部模型";
40
+ readonly filterAllRatios: "全部比例";
41
+ readonly searchPlaceholder: "搜索 Prompt、标签…";
42
+ readonly filterCurrentWorkspace: "仅看此工作区";
43
+ readonly filterCurrentWorkspaceHint: "只展示属于当前工作区的生图记录与物理文件";
44
+ readonly sortNewest: "最新生成";
45
+ readonly sortOldest: "最早生成";
46
+ readonly totalCount: "共 {count} 张生成图片";
47
+ readonly emptyTitle: "暂无生图记录";
48
+ readonly emptyDesc: "在对话中让 Agent 生图后,生成的图片会自动收录到这里。";
49
+ readonly favEmptyTitle: "暂无收藏图片";
50
+ readonly favEmptyDesc: "在图库中点击卡片右下角的 ♡ 按钮,即可将喜爱的图片收录到这里。";
51
+ readonly noMatchTitle: "未找到匹配结果";
52
+ readonly noMatchDesc: "尝试更换搜索关键词或调整筛选条件。";
53
+ readonly copiedPrompt: "已复制 Prompt";
54
+ readonly copiedImage: "已复制图片";
55
+ readonly copyFailed: "复制失败";
56
+ readonly favoriteAdded: "已添加到收藏";
57
+ readonly favoriteRemoved: "已取消收藏";
58
+ readonly preview: "查看大图";
59
+ readonly download: "下载图片";
60
+ readonly copyImg: "复制图片";
61
+ readonly copyPpt: "复制 Prompt";
62
+ readonly regenerate: "重新生成";
63
+ readonly regenerateTitle: "重新生成图片";
64
+ readonly regenerateHint: "可按需修改 Prompt,基于当前模型和比例在画廊生成一张新图片。";
65
+ readonly confirmRegenerate: "开始生成";
66
+ readonly regenerating: "正在重新生成…";
67
+ readonly regenerateSuccess: "已生成新图片并收录到画廊";
68
+ readonly regenerateSaveFailed: "图片已生成,但保存到图库失败,请重试";
69
+ readonly regenerateFailed: "重新生成失败";
70
+ readonly delete: "从画廊删除";
71
+ readonly confirmDelete: "确定要从画廊中删除这张图片吗?(不会影响原聊天记录)";
72
+ readonly deleted: "已从画廊删除";
73
+ readonly model: "模型";
74
+ readonly prompt: "Prompt";
75
+ readonly close: "关闭 (Esc)";
76
+ readonly prevImage: "上一张 (←)";
77
+ readonly nextImage: "下一张 (→)";
78
+ readonly manage: "批量管理";
79
+ readonly exitManage: "退出选择";
80
+ readonly selectedCount: "已选 {n} 项";
81
+ readonly selectAll: "全选";
82
+ readonly invertSelect: "反选";
83
+ readonly clearSelect: "清空";
84
+ readonly batchFavorite: "批量收藏";
85
+ readonly batchUnfavorite: "批量取消收藏";
86
+ readonly batchFavoritedToast: "已将 {count} 张图片加入收藏";
87
+ readonly batchUnfavoritedToast: "已取消 {count} 张图片的收藏";
88
+ readonly batchFavoriteFailed: "收藏操作失败,请重试";
89
+ readonly batchDownload: "批量下载";
90
+ readonly batchDownloading: "打包中 ({current}/{total})…";
91
+ readonly batchDownloadSingleToast: "已下载 1 张图片";
92
+ readonly batchDownloadZipToast: "已打包下载 {count} 张图片";
93
+ readonly batchDownloadFailed: "批量下载失败,请重试";
94
+ readonly batchDelete: "批量删除";
95
+ readonly batchDeleteTitle: "确认批量删除选中的 {count} 张图片?";
96
+ readonly batchDeleteTitleSingle: "确认从画廊中删除这张图片?";
97
+ readonly batchDeleteDesc: "将从画廊历史记录中移除所选图片。";
98
+ readonly deleteWorkspaceFilesOpt: "同时清理工作区磁盘物理文件(不可恢复)";
99
+ readonly cancel: "取消";
100
+ readonly confirmBatchDelete: "确认删除 ({count})";
101
+ readonly confirmDeleteSingle: "确认删除";
102
+ readonly batchDeletedToast: "已删除 {count} 张图片";
103
+ readonly batchDeletedWithFilesToast: "已删除 {count} 张图片,并清理了 {files} 个工作区文件";
104
+ readonly deleteFailedFileLocked: "已删除 {count} 张图片,但有 {files} 个文件因被系统占用未能删除";
105
+ readonly deleteFailedDatabase: "删除失败:本地数据库操作异常";
106
+ readonly justNow: "刚刚";
107
+ readonly minutesAgo: "{n} 分钟前";
108
+ readonly hoursAgo: "{n} 小时前";
109
+ readonly daysAgo: "{n} 天前";
110
+ readonly studioTitle: "AI 图像工作台 (Studio)";
111
+ readonly studioDesc: "工作台模块正在紧锣密鼓开发中。在此你将体验大图精修、变体生成 (Variations)、参数重调并一键将生成结果无缝插回 DSH 正在进行的对话。";
112
+ readonly studioTip: "💡 提示:目前你可以在“图库”中点击任意图片,在弹窗中进行查看、复制与下载。";
113
+ readonly compareTitle: "多模型横向对比 (Compare)";
114
+ readonly compareDesc: "支持单个 Prompt 一键同时调度 Gemini、Seedream、DashScope 及本地 ComfyUI 模型并排生成,直观横评画质与细节。";
115
+ readonly tasksTitle: "异步任务队列 (Tasks)";
116
+ readonly tasksDesc: "集中管理后台批量生图、多模型并发生成与本地 ComfyUI 耗时任务。支持状态追踪、失败重试与执行耗时分析。";
117
+ readonly comingSoonBadge: "即将推出";
118
+ };
119
+ readonly en: {
120
+ readonly tabGallery: "Gallery";
121
+ readonly tabStudio: "Studio";
122
+ readonly tabInspiration: "Inspiration";
123
+ readonly tabFavorites: "Favorites";
124
+ readonly tabCompare: "Compare";
125
+ readonly tabTasks: "Tasks";
126
+ readonly filterAllProviders: "All Providers";
127
+ readonly filterGoogle: "Google Gemini";
128
+ readonly filterOpenAI: "OpenAI";
129
+ readonly filterOpenAICompat: "OpenAI-compatible";
130
+ readonly filterSeedream: "ByteDance Seedream";
131
+ readonly filterDashScope: "Aliyun DashScope";
132
+ readonly filterXAI: "xAI Grok";
133
+ readonly filterZhipu: "Zhipu GLM";
134
+ readonly filterComfyUI: "Local ComfyUI";
135
+ readonly filterImport: "Imported";
136
+ readonly importImages: "Import images";
137
+ readonly importAdded: "Imported {count} images";
138
+ readonly importPartial: "Imported {count}, {fail} failed";
139
+ readonly importFailed: "Import failed";
140
+ readonly importPickHint: "Choose images to import (PNG/JPG/WebP/GIF)";
141
+ readonly filterAllModels: "All Models";
142
+ readonly filterAllRatios: "All Ratios";
143
+ readonly searchPlaceholder: "Search prompt, tags…";
144
+ readonly filterCurrentWorkspace: "Current workspace only";
145
+ readonly filterCurrentWorkspaceHint: "Only show images belonging to the active workspace";
146
+ readonly sortNewest: "Newest first";
147
+ readonly sortOldest: "Oldest first";
148
+ readonly totalCount: "{count} images total";
149
+ readonly emptyTitle: "No images generated yet";
150
+ readonly emptyDesc: "Images generated during conversations will automatically appear here.";
151
+ readonly favEmptyTitle: "No favorite images yet";
152
+ readonly favEmptyDesc: "Click the ♡ button on any card in the gallery to collect your favorite images here.";
153
+ readonly noMatchTitle: "No matching images";
154
+ readonly noMatchDesc: "Try a different search keyword or adjust filter criteria.";
155
+ readonly copiedPrompt: "Prompt copied";
156
+ readonly copiedImage: "Image copied";
157
+ readonly copyFailed: "Copy failed";
158
+ readonly favoriteAdded: "Added to favorites";
159
+ readonly favoriteRemoved: "Removed from favorites";
160
+ readonly preview: "Full Preview";
161
+ readonly download: "Download";
162
+ readonly copyImg: "Copy Image";
163
+ readonly copyPpt: "Copy Prompt";
164
+ readonly regenerate: "Regenerate";
165
+ readonly regenerateTitle: "Regenerate Image";
166
+ readonly regenerateHint: "Edit prompt if needed. A new image will be generated and added to the gallery.";
167
+ readonly confirmRegenerate: "Generate";
168
+ readonly regenerating: "Regenerating…";
169
+ readonly regenerateSuccess: "New image generated and added to gallery";
170
+ readonly regenerateSaveFailed: "Image generated, but saving to the gallery failed. Please retry.";
171
+ readonly regenerateFailed: "Regeneration failed";
172
+ readonly delete: "Delete from gallery";
173
+ readonly confirmDelete: "Are you sure you want to remove this image from the gallery? (Chat history will not be affected)";
174
+ readonly deleted: "Deleted from gallery";
175
+ readonly model: "Model";
176
+ readonly prompt: "Prompt";
177
+ readonly close: "Close (Esc)";
178
+ readonly prevImage: "Previous (←)";
179
+ readonly nextImage: "Next (→)";
180
+ readonly manage: "Batch Manage";
181
+ readonly exitManage: "Done";
182
+ readonly selectedCount: "{n} selected";
183
+ readonly selectAll: "Select All";
184
+ readonly invertSelect: "Invert";
185
+ readonly clearSelect: "Clear";
186
+ readonly batchFavorite: "Batch Favorite";
187
+ readonly batchUnfavorite: "Batch Unfavorite";
188
+ readonly batchFavoritedToast: "Added {count} images to favorites";
189
+ readonly batchUnfavoritedToast: "Removed {count} images from favorites";
190
+ readonly batchFavoriteFailed: "Favorite operation failed, please retry";
191
+ readonly batchDownload: "Batch Download";
192
+ readonly batchDownloading: "Packaging ({current}/{total})…";
193
+ readonly batchDownloadSingleToast: "Downloaded 1 image";
194
+ readonly batchDownloadZipToast: "Packaged & downloaded {count} images";
195
+ readonly batchDownloadFailed: "Batch download failed, please retry";
196
+ readonly batchDelete: "Batch Delete";
197
+ readonly batchDeleteTitle: "Delete {count} selected images?";
198
+ readonly batchDeleteTitleSingle: "Delete this image from gallery?";
199
+ readonly batchDeleteDesc: "These images will be removed from your gallery history.";
200
+ readonly deleteWorkspaceFilesOpt: "Also delete files from workspace disk (cannot be undone)";
201
+ readonly cancel: "Cancel";
202
+ readonly confirmBatchDelete: "Delete ({count})";
203
+ readonly confirmDeleteSingle: "Delete";
204
+ readonly batchDeletedToast: "Deleted {count} images";
205
+ readonly batchDeletedWithFilesToast: "Deleted {count} images and cleaned {files} workspace files";
206
+ readonly deleteFailedFileLocked: "Deleted {count} images, but {files} files could not be deleted (busy/locked)";
207
+ readonly deleteFailedDatabase: "Failed to delete: local database error";
208
+ readonly justNow: "Just now";
209
+ readonly minutesAgo: "{n}m ago";
210
+ readonly hoursAgo: "{n}h ago";
211
+ readonly daysAgo: "{n}d ago";
212
+ readonly studioTitle: "AI Image Studio";
213
+ readonly studioDesc: "Studio workbench is under active development. Fine-tune prompts, generate variations (2x/4x), and inject images directly into DSH chat.";
214
+ readonly studioTip: "💡 Tip: You can currently click any image in the Gallery to preview, copy, or download it.";
215
+ readonly compareTitle: "Model Comparison (Compare)";
216
+ readonly compareDesc: "Side-by-side multi-model benchmarking coming soon. Test Gemini, Seedream, DashScope, and ComfyUI with a single prompt.";
217
+ readonly tasksTitle: "Task Queue (Tasks)";
218
+ readonly tasksDesc: "Centralized view for batch generation, asynchronous ComfyUI runs, live progress tracking, and retry controls.";
219
+ readonly comingSoonBadge: "Coming Soon";
220
+ };
221
+ };
222
+ export type DictKey = keyof typeof DICT.zh;
223
+ export interface GalleryViewTabProps {
224
+ locale?: LocaleService | undefined;
225
+ sessionId?: string;
226
+ useSession?: (selector: (state: any) => any) => any;
227
+ useSessions?: (selector: (state: any) => any) => any;
228
+ useWorkspaces?: (selector: (state: any) => any) => any;
229
+ /** Host credential-change notifier; forwarded to the studio workbench. */
230
+ credentialEvents?: {
231
+ listen(callback: () => void): () => void;
232
+ } | undefined;
233
+ /**
234
+ * Right-sidebar variant (DSH official `sidebar.right.pane.tab` seat). The
235
+ * native conversation stays in the main area, so the composer must NOT be
236
+ * hidden and the page-level CSS must not scope to the conversation column.
237
+ */
238
+ inSidebar?: boolean;
239
+ /** Sub-tab opened first; the sidebar variant starts on the studio workbench. */
240
+ defaultTab?: TabKey;
241
+ /** Canvas surface the studio opens with; the sidebar variant shows the tldraw infinite canvas directly. */
242
+ initialCanvasSurface?: 'preview' | 'infinite';
243
+ /**
244
+ * Sidebar tab visibility reader injected by DSH's `sidebar.right.pane.tab`
245
+ * seat (absent on hosts that mount this view elsewhere, e.g. the main-area
246
+ * conversation tab, where the hook is optional).
247
+ */
248
+ useTabInfo?: (() => {
249
+ tab?: {
250
+ visible?: boolean;
251
+ };
252
+ }) | undefined;
253
+ }
254
+ export declare const GalleryViewTab: FC<GalleryViewTabProps>;
255
+ export { copyImageBlob } from './browser-image-utils.js';
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Which generations are running right now.
3
+ *
4
+ * The progress that matters has to be visible while the agent is still
5
+ * reasoning: the tool card that owns the job can be folded into the host's
6
+ * "calling tools" summary, and a status line rendered inside it then disappears
7
+ * under the thinking row. The composer dock reads this store instead, so the
8
+ * "Generating image" panel survives whatever the conversation stream does with
9
+ * the card.
10
+ *
11
+ * Kept framework-free: the card publishes, the dock subscribes, and the hook
12
+ * lives with the components.
13
+ *
14
+ * @module @aryacode/dsh-arya-image-gen/client/generation-activity
15
+ */
16
+ import type { ComfyUIJobSnapshot } from '../comfyui-progress.js';
17
+ /** One generation the client knows about. */
18
+ export interface GenerationActivity {
19
+ /** Host tool-call id the progress route is keyed by. */
20
+ callId: string;
21
+ /** Session the card belongs to, when the host reports one. */
22
+ sessionId?: string | undefined;
23
+ prompt: string;
24
+ workflow: string;
25
+ /** Latest telemetry; undefined until the first poll answers. */
26
+ snapshot?: ComfyUIJobSnapshot | undefined;
27
+ /** Client clock, so the panel can count even before telemetry arrives. */
28
+ startedAt: number;
29
+ }
30
+ /**
31
+ * Announce a running generation.
32
+ *
33
+ * @param entry - the activity record; a repeat for the same call replaces it.
34
+ */
35
+ export declare function beginGeneration(entry: GenerationActivity): void;
36
+ /**
37
+ * Update a running generation's prompt, workflow or telemetry.
38
+ *
39
+ * @param callId - the tool-call id.
40
+ * @param patch - fields to merge; omitted fields keep their current value.
41
+ */
42
+ export declare function updateGeneration(callId: string, patch: Partial<Omit<GenerationActivity, 'callId'>>): void;
43
+ /**
44
+ * Drop a generation that finished, failed or unmounted.
45
+ *
46
+ * @param callId - the tool-call id.
47
+ */
48
+ export declare function endGeneration(callId: string): void;
49
+ /**
50
+ * The newest running generation, which is the one a dock should show.
51
+ *
52
+ * @param sessionId - restrict the answer to one session.
53
+ * @returns the activity, or undefined when nothing is running.
54
+ */
55
+ export declare function activeGeneration(sessionId?: string): GenerationActivity | undefined;
56
+ /**
57
+ * Subscribe to changes in the running set.
58
+ *
59
+ * @param listener - called on every begin, update and end.
60
+ * @returns the unsubscribe function.
61
+ */
62
+ export declare function subscribeGeneration(listener: () => void): () => void;
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Bounded in-memory attachment image cache for client views.
3
+ *
4
+ * Enforces dual constraints (max items + max bytes) with LRU eviction.
5
+ * The background fetch lifecycle is decoupled from individual consumer signals,
6
+ * preventing a canceled thumbnail from aborting the shared blob request.
7
+ */
8
+ import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
9
+ export declare const MAX_CACHE_COUNT = 30;
10
+ export declare const MAX_CACHE_BYTES: number;
11
+ /**
12
+ * Fetch or reuse an image Blob by attachment ID.
13
+ * Refreshes LRU recency on hit and enforces count/byte limits on arrival.
14
+ */
15
+ export declare function fetchAttachmentBlob(attachment: ImageAttachmentRef): Promise<Blob>;
16
+ /** Check if an attachment Blob is already cached in memory. */
17
+ export declare function getCachedAttachmentBlob(attachmentId: string | ImageAttachmentRef['attachmentId']): Promise<Blob> | undefined;
18
+ /** Evict one item from memory cache (e.g. when deleted from gallery). */
19
+ export declare function evictAttachmentCache(attachmentId: string | ImageAttachmentRef['attachmentId']): void;
20
+ /** Clear all in-memory image caches. */
21
+ export declare function clearAttachmentCache(): void;
22
+ /** Get current cache size metrics (useful for assertions and health monitoring). */
23
+ export declare function getCacheMetrics(): {
24
+ count: number;
25
+ bytes: number;
26
+ };
@@ -0,0 +1,31 @@
1
+ /** Dual-path image attachment resolution for legacy rc.2 and modern DSH runtime blocks. */
2
+ import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
3
+ export interface RunningToolCall {
4
+ callId?: string;
5
+ name?: string;
6
+ argsRaw?: string;
7
+ turn?: number;
8
+ step?: number;
9
+ time?: number;
10
+ }
11
+ export interface ToolResultNode {
12
+ kind?: string;
13
+ callId?: string;
14
+ resultView?: {
15
+ card?: string;
16
+ content?: Array<{
17
+ type: string;
18
+ attachment?: ImageAttachmentRef;
19
+ }>;
20
+ } | null;
21
+ content?: Array<{
22
+ type: string;
23
+ attachment?: ImageAttachmentRef;
24
+ }>;
25
+ }
26
+ export type ToolCallBlock = RunningToolCall | ToolResultNode;
27
+ /**
28
+ * Extract the verified durable image attachment from a completed tool result block.
29
+ * Supports legacy rc.2 `resultView.content` and modern DSH `block.content`.
30
+ */
31
+ export declare function imageRef(block: ToolCallBlock): ImageAttachmentRef | undefined;
@@ -0,0 +1,81 @@
1
+ /** Modern DSH conversation node that keeps image artifacts outside Tool process folding. */
2
+ import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
3
+ export declare const IMAGE_RESULT_NODE_KIND = "dsh-image-result";
4
+ export interface ImageResultPresentation {
5
+ readonly attachment: ImageAttachmentRef;
6
+ readonly prompt: string;
7
+ readonly provider: string;
8
+ readonly channel?: string;
9
+ readonly model: string;
10
+ readonly output: string;
11
+ readonly savedTo?: string;
12
+ /** Workflow seed reported by the ComfyUI provider, when available. */
13
+ readonly seed?: number;
14
+ /** ComfyUI timing split, when the provider reported it. */
15
+ readonly queueMs?: number;
16
+ readonly execMs?: number;
17
+ readonly totalMs?: number;
18
+ readonly queueAhead?: number;
19
+ readonly comfyVersion?: string;
20
+ /** Attachment ids of the edit sources when this image came from edit_image; used to rebuild canvas edit chains. */
21
+ readonly sourceAttachmentIds?: readonly string[];
22
+ }
23
+ interface ImageResultState {
24
+ /** Owning conversation turn; PTC (run_code) sub-call results carry no turn. */
25
+ readonly turn?: number;
26
+ readonly results: readonly (ImageResultPresentation & {
27
+ readonly seq: number;
28
+ })[];
29
+ }
30
+ interface EventLike {
31
+ readonly type: string;
32
+ readonly seq: number;
33
+ readonly data: Record<string, unknown>;
34
+ }
35
+ interface MatchLike {
36
+ readonly event: EventLike;
37
+ readonly location: unknown;
38
+ }
39
+ interface ContextLike<State> {
40
+ readonly key: string;
41
+ readonly id: string;
42
+ readonly matches: readonly MatchLike[];
43
+ readonly start?: MatchLike;
44
+ readonly state?: State;
45
+ }
46
+ interface ConversationNodeDefinitionLike<State> {
47
+ readonly kind: string;
48
+ readonly target: 'chat';
49
+ match(event: EventLike): {
50
+ id: string;
51
+ role: 'start' | 'update';
52
+ } | null;
53
+ start(context: ContextLike<State>, match: MatchLike, reader: unknown): State;
54
+ update(context: ContextLike<State> & {
55
+ readonly state: State;
56
+ }, match: MatchLike): State;
57
+ buildViewNode(context: ContextLike<State>): Record<string, unknown> | null;
58
+ }
59
+ /** Default definition for the successful images from each Tool invocation. */
60
+ export declare const imageResultDefinition: ConversationNodeDefinitionLike<ImageResultState>;
61
+ /**
62
+ * Give each image Tool result its own Chat row at the event that produced it.
63
+ * PTC (run_code) sub-calls already have their own stable sub-call identity.
64
+ */
65
+ export declare function createImageResultDefinition(): ConversationNodeDefinitionLike<ImageResultState>;
66
+ /** Parse the plugin-owned durable presentation metadata from a Tool result event. */
67
+ export declare function imageResultFromMeta(value: unknown): ImageResultPresentation | undefined;
68
+ /** Parse all successful images from either a single or batch Tool result. */
69
+ export declare function imageResultsFromMeta(value: unknown): readonly ImageResultPresentation[];
70
+ /**
71
+ * Parse a plugin image result from a tool/ptc-dispatch event (#38). PTC
72
+ * run_code sub-calls carry neither a turn nor presentationMeta, so the result
73
+ * is rebuilt from the dispatch payload itself: the image content block for the
74
+ * attachment, arguments for the prompt (and edit source ids), and the tool's
75
+ * fixed-format summary text for provider/model/output. Returns undefined for
76
+ * anything that is not a successful image result from our own image tools.
77
+ */
78
+ export declare function imageResultFromPtcDispatch(event: EventLike): ImageResultPresentation | undefined;
79
+ /** Pair each rendered image with its own summary, including batches with failed items. */
80
+ export declare function imageResultsFromPtcDispatch(event: EventLike): readonly ImageResultPresentation[];
81
+ export {};