@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,56 @@
1
+ import type { ImageAttachmentRef, ImageMediaType, StoredImageAttachment } from '@deepseek-ai/dsh-attachment';
2
+ import type { Message } from '@deepseek-ai/dsh-llm';
3
+ /** Provider-neutral image bytes passed across the DSH/provider boundary. */
4
+ export interface ResolvedReferenceImage {
5
+ data: Uint8Array;
6
+ mediaType: ImageMediaType;
7
+ }
8
+ /** The small latest-DSH session surface this Bundle depends on. */
9
+ export interface ReferenceImageAgent {
10
+ session: {
11
+ deriveMessages(): readonly Message[];
12
+ header?: {
13
+ cwd?: string;
14
+ };
15
+ };
16
+ }
17
+ /** The small latest-DSH attachment surface this Bundle depends on. */
18
+ export interface ReferenceImageStore {
19
+ readImage(ref: ImageAttachmentRef, signal?: AbortSignal): Promise<StoredImageAttachment>;
20
+ }
21
+ /**
22
+ * Resolve and read the image to edit from the current effective conversation.
23
+ *
24
+ * This is the only module allowed to know how DSH sessions expose effective
25
+ * messages or how nested model-facing content stores durable image refs.
26
+ */
27
+ export declare function resolveReferenceImage(input: {
28
+ agent?: ReferenceImageAgent;
29
+ attachments: ReferenceImageStore;
30
+ sourceAttachmentId?: string;
31
+ sourcePath?: string;
32
+ maxBytes?: number;
33
+ signal: AbortSignal;
34
+ }): Promise<ResolvedReferenceImage>;
35
+ /**
36
+ * Resolve one or more edit references while keeping every DSH-specific detail
37
+ * behind this compatibility boundary. Explicit selectors preserve caller order;
38
+ * without selectors, all images in the newest image-bearing message are used.
39
+ */
40
+ export declare function resolveReferenceImages(input: {
41
+ agent?: ReferenceImageAgent;
42
+ attachments: ReferenceImageStore;
43
+ sourceAttachmentId?: string;
44
+ sourceAttachmentIds?: readonly string[];
45
+ sourcePath?: string;
46
+ sourcePaths?: readonly string[];
47
+ maxBytes?: number;
48
+ signal: AbortSignal;
49
+ }): Promise<ResolvedReferenceImage[]>;
50
+ /** Find images in caller order, or every image in the newest image-bearing message. */
51
+ export declare function findReferenceImages(messages: readonly Message[], sourceAttachmentIds?: readonly string[]): ImageAttachmentRef[];
52
+ /** Find the newest matching image in the effective, replacement-aware history. */
53
+ export declare function findReferenceImage(messages: readonly Message[], sourceAttachmentId?: string): ImageAttachmentRef | undefined;
54
+ /** Validate an untrusted serialized image reference at an HTTP/UI boundary. */
55
+ export declare function parseImageAttachmentRef(value: unknown): ImageAttachmentRef | undefined;
56
+ export declare function detectImageMediaType(data: Uint8Array): ImageMediaType | undefined;
@@ -0,0 +1,66 @@
1
+ /** Media types a reference may be; ComfyUI's LoadImage reads exactly these. */
2
+ export type ReferenceMediaType = 'image/png' | 'image/jpeg' | 'image/webp';
3
+ /** Largest accepted download. References are inputs, not outputs. */
4
+ export declare const MAX_REFERENCE_BYTES: number;
5
+ /** What the tool reports back. */
6
+ export interface ImportedReference {
7
+ /** Absolute path inside the session workspace. */
8
+ path: string;
9
+ mediaType: ReferenceMediaType;
10
+ bytes: number;
11
+ width?: number;
12
+ height?: number;
13
+ sourceUrl: string;
14
+ /** Short content digest, useful when comparing two downloads of one photo. */
15
+ digest: string;
16
+ }
17
+ /** Options for one import. */
18
+ export interface ImportReferenceOptions {
19
+ url: string;
20
+ /** Desired file stem; the extension always comes from the sniffed type. */
21
+ name?: string | undefined;
22
+ workspaceRoot: string;
23
+ /** Configured image folder; references land in `<folder>/references`. */
24
+ folder?: string | undefined;
25
+ signal?: AbortSignal | undefined;
26
+ maxBytes?: number | undefined;
27
+ timeoutMs?: number | undefined;
28
+ /** Injected in tests; defaults to the global fetch. */
29
+ fetchImpl?: typeof fetch | undefined;
30
+ }
31
+ /**
32
+ * Identify an image by its first bytes.
33
+ *
34
+ * @param data - the downloaded bytes.
35
+ * @returns the media type, or undefined when this is not a supported image.
36
+ */
37
+ export declare function sniffImageMediaType(data: Uint8Array): ReferenceMediaType | undefined;
38
+ /**
39
+ * Pixel size from the file header, without decoding pixels.
40
+ *
41
+ * @param data - the downloaded bytes.
42
+ * @param mediaType - what `sniffImageMediaType` decided.
43
+ * @returns width and height, or undefined when the header is unfamiliar.
44
+ */
45
+ export declare function referenceImageSize(data: Uint8Array, mediaType: ReferenceMediaType): {
46
+ width: number;
47
+ height: number;
48
+ } | undefined;
49
+ /** True for IPv4/IPv6 addresses that must never be fetched from the host. */
50
+ export declare function isPrivateAddress(address: string): boolean;
51
+ /**
52
+ * Validate one hop: http(s) only, and every resolved address public.
53
+ *
54
+ * @param raw - the URL to check.
55
+ * @returns the parsed URL, ready to fetch.
56
+ */
57
+ export declare function assertPublicHttpUrl(raw: string): Promise<URL>;
58
+ /**
59
+ * Download one reference image and write it under the workspace.
60
+ *
61
+ * @param options - URL, workspace facts and limits.
62
+ * @returns the imported reference, with the path `edit_image` accepts.
63
+ * @throws when the URL is not public, the payload is not a supported image, or
64
+ * it is larger than the cap.
65
+ */
66
+ export declare function importReferenceImage(options: ImportReferenceOptions): Promise<ImportedReference>;
@@ -0,0 +1,83 @@
1
+ /**
2
+ * One path from finished bytes to a conversation attachment plus a workspace
3
+ * file, shared by every image source (ComfyUI, HTML render, SVG render).
4
+ *
5
+ * Keeping this in one place is what makes a rendered PNG indistinguishable
6
+ * from a generated one: same attachment store, same workspace folder, same
7
+ * provenance line, same save-failure behaviour.
8
+ *
9
+ * @module @aryacode/dsh-arya-image-gen/save-generated
10
+ */
11
+ import type { Context } from '@deepseek-ai/cordis';
12
+ import type { ImageAttachmentRef } from '@deepseek-ai/dsh-attachment';
13
+ import type { ComfyUIJobTimings } from './comfyui.js';
14
+ import type { Config } from './config.js';
15
+ import type { ImageProvider } from './shared.js';
16
+ /** One finished image as the tools report it. */
17
+ export interface GeneratedValue {
18
+ attachment: ImageAttachmentRef;
19
+ provider: ImageProvider;
20
+ model: string;
21
+ output: string;
22
+ savedTo?: string;
23
+ saveError?: string;
24
+ /** Concrete workflow seed, exposed by the ComfyUI provider for provenance. */
25
+ seed?: number;
26
+ /** Pixel dimensions and encoded size of the attached image. */
27
+ width?: number;
28
+ height?: number;
29
+ bytes?: number;
30
+ /** Timing split reported by the ComfyUI job, in milliseconds. */
31
+ queueMs?: number;
32
+ execMs?: number;
33
+ totalMs?: number;
34
+ /** Jobs queued ahead of this one at submission. */
35
+ queueAhead?: number;
36
+ comfyVersion?: string;
37
+ }
38
+ /** Bytes a provider finished with, before they become an attachment. */
39
+ export interface GeneratedBytes {
40
+ data: Uint8Array;
41
+ mediaType: ImageAttachmentRef['mediaType'];
42
+ seed?: number;
43
+ timings?: ComfyUIJobTimings;
44
+ comfyVersion?: string;
45
+ }
46
+ /**
47
+ * Attach one image and, when enabled, write it into the session workspace.
48
+ *
49
+ * @param ctx - host context providing the attachment store.
50
+ * @param generated - finished bytes and their provenance.
51
+ * @param provider - which source produced them.
52
+ * @param model - workflow or renderer name.
53
+ * @param outputPrefix - first word of the provenance line.
54
+ * @param config - plugin configuration (workspace folder, save toggle).
55
+ * @param exec - tool execution context (session cwd, abort signal).
56
+ * @param knownRoots - workspace roots seen so far.
57
+ * @returns the finished value the tool returns.
58
+ */
59
+ export declare function saveGenerated(ctx: Context, generated: GeneratedBytes, provider: ImageProvider, model: string, outputPrefix: string, config: Config, exec: {
60
+ agent?: {
61
+ session: {
62
+ header: {
63
+ cwd?: string;
64
+ };
65
+ };
66
+ };
67
+ signal: AbortSignal;
68
+ }, knownRoots?: Set<string>): Promise<GeneratedValue>;
69
+ /** Attachment fields the chat card stores in presentation metadata. */
70
+ export declare function attachmentMeta(ref: ImageAttachmentRef): {
71
+ originalDimensions?: {
72
+ width: number;
73
+ height: number;
74
+ };
75
+ name?: string;
76
+ attachmentId: string;
77
+ mediaType: import("@deepseek-ai/dsh-attachment").ImageMediaType;
78
+ bytes: number;
79
+ width: number;
80
+ height: number;
81
+ };
82
+ /** Model- and user-visible provenance for one finished image. */
83
+ export declare function provenanceLine(prefix: string, attachment: ImageAttachmentRef, seed?: number, timings?: ComfyUIJobTimings, comfyVersion?: string): string;
@@ -0,0 +1,6 @@
1
+ /** Diagnose the actual host service and schema without reading any settings values. */
2
+ import type z from '@deepseek-ai/schemastery';
3
+ import type { IncomingMessage, ServerResponse } from 'node:http';
4
+ import type { SettingsHealth } from './shared.js';
5
+ export declare function describeSettingsHealth(settings: unknown, schema: z): SettingsHealth;
6
+ export declare function serveSettingsHealth(req: IncomingMessage, res: ServerResponse, health: SettingsHealth): void;