@auvira.ai/sdk 0.6.2 → 0.6.4

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.
package/README.md CHANGED
@@ -45,7 +45,7 @@ auvira-sdk-run --job <editJobId>
45
45
 
46
46
  See [docs/sandbox-runner.md](docs/sandbox-runner.md) for job schema, NDJSON protocol, host integration, and session resume.
47
47
 
48
- For image placement (attachments, completion rules, host tools), see [docs/host-integration-image-placement.md](docs/host-integration-image-placement.md).
48
+ For image placement (attachments, completion rules, host tools, **Plan → Apply → Polish** and **Preset → Apply → Polish** host pipelines, polish helpers), see [docs/host-integration-image-placement.md](docs/host-integration-image-placement.md).
49
49
 
50
50
  ## Quick start (local repo)
51
51
 
@@ -0,0 +1,17 @@
1
+ import type { AgentCompletionOptions, CompletionContentRequirement, SerializableCompletionRules } from "./types.js";
2
+ /** Escapes a string for safe use inside a RegExp source (e.g. contentPattern literals). */
3
+ export declare function escapeRegexLiteral(value: string): string;
4
+ /** Builds a requiredContent rule that preserves an exact wired literal (URL, class, keyframe name). */
5
+ export declare function createRequiredContentFromLiteral(input: {
6
+ pathPattern: string;
7
+ literal: string;
8
+ nudge?: string;
9
+ }): CompletionContentRequirement;
10
+ /** Completion options for short style/animation polish passes after host deterministic apply. */
11
+ export declare function createPolishCompletionOptions(input: {
12
+ requiredContent?: CompletionContentRequirement[];
13
+ rules?: SerializableCompletionRules;
14
+ minToolCalls?: number;
15
+ maxExtraTurns?: number;
16
+ }): AgentCompletionOptions;
17
+ //# sourceMappingURL=polishCompletion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"polishCompletion.d.ts","sourceRoot":"","sources":["../../src/agent/polishCompletion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,4BAA4B,EAC5B,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAEpB,2FAA2F;AAC3F,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,uGAAuG;AACvG,wBAAgB,gCAAgC,CAAC,KAAK,EAAE;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,4BAA4B,CAO/B;AAED,iGAAiG;AACjG,wBAAgB,6BAA6B,CAAC,KAAK,EAAE;IACnD,eAAe,CAAC,EAAE,4BAA4B,EAAE,CAAC;IACjD,KAAK,CAAC,EAAE,2BAA2B,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,sBAAsB,CAqBzB"}
@@ -0,0 +1,35 @@
1
+ /** Escapes a string for safe use inside a RegExp source (e.g. contentPattern literals). */
2
+ export function escapeRegexLiteral(value) {
3
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
4
+ }
5
+ /** Builds a requiredContent rule that preserves an exact wired literal (URL, class, keyframe name). */
6
+ export function createRequiredContentFromLiteral(input) {
7
+ return {
8
+ pathPattern: input.pathPattern,
9
+ contentPattern: escapeRegexLiteral(input.literal),
10
+ required: true,
11
+ nudge: input.nudge,
12
+ };
13
+ }
14
+ /** Completion options for short style/animation polish passes after host deterministic apply. */
15
+ export function createPolishCompletionOptions(input) {
16
+ const mergedRequiredContent = [
17
+ ...(input.rules?.requiredContent ?? []),
18
+ ...(input.requiredContent ?? []),
19
+ ];
20
+ const mergedRules = {
21
+ ...(input.rules ?? {}),
22
+ ...(mergedRequiredContent.length
23
+ ? { requiredContent: mergedRequiredContent }
24
+ : {}),
25
+ };
26
+ return {
27
+ mode: "multi_file_required",
28
+ multiStep: {
29
+ minToolCalls: input.minToolCalls ?? 1,
30
+ maxExtraTurnsAfterStyleOnly: input.maxExtraTurns ?? 2,
31
+ },
32
+ ...(Object.keys(mergedRules).length > 0 ? { rules: mergedRules } : {}),
33
+ };
34
+ }
35
+ //# sourceMappingURL=polishCompletion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J,CAAC"}
package/dist/index.d.ts CHANGED
@@ -7,6 +7,7 @@ export { formatAttachmentsContextBlock, writeAttachmentsManifest, readAttachment
7
7
  export type { HostToolDefinition, HostToolContext, HostToolHandler, HostToolHandlerResult, HostToolRegistration, } from "./agent/hostTools.js";
8
8
  export { validateHostToolRegistrations, mergeHostToolRegistrations, resolveHostToolsForRun, createGetAttachmentUrlsHostTool, buildHostToolParallelSafeMap, hostToolsToOpenAiDefinitions, } from "./agent/hostTools.js";
9
9
  export { buildWiringHintNudge, pathExistsUnderRepo, shouldRequirePublicAssetPublish, getOrphanComponentNudge, } from "./agent/editCompletion.js";
10
+ export { createPolishCompletionOptions, createRequiredContentFromLiteral, escapeRegexLiteral, } from "./agent/polishCompletion.js";
10
11
  export type { HarnessPinnedTarget } from "./providers/custom/harnessPinTypes.js";
11
12
  export type { WorkspaceCheckpoint, WorkspaceDiffResult } from "./workspace/workspaceCheckpoint.js";
12
13
  export type { TaskCompletionDecision } from "./agent/evaluateTaskCompletion.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,sBAAsB,EACtB,yBAAyB,EACzB,yBAAyB,EACzB,4BAA4B,EAC5B,qBAAqB,EACrB,2BAA2B,EAC3B,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC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ACnC,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,EAChC,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AACrC,YAAY,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AACjF,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACnG,YAAY,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChF,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,GACpB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,gBAAgB,EAChB,WAAW,EACX,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,yBAAyB,EACzB,8BAA8B,EAC9B,gCAAgC,EAChC,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,qBAAqB,EACrB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,kCAAkC,EAClC,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export { AgentNotFoundError } from "./agent/AgentRegistry.js";
5
5
  export { formatAttachmentsContextBlock, writeAttachmentsManifest, readAttachmentsManifest, ATTACHMENTS_MANIFEST_RELATIVE, } from "./agent/attachmentContext.js";
6
6
  export { validateHostToolRegistrations, mergeHostToolRegistrations, resolveHostToolsForRun, createGetAttachmentUrlsHostTool, buildHostToolParallelSafeMap, hostToolsToOpenAiDefinitions, } from "./agent/hostTools.js";
7
7
  export { buildWiringHintNudge, pathExistsUnderRepo, shouldRequirePublicAssetPublish, getOrphanComponentNudge, } from "./agent/editCompletion.js";
8
+ export { createPolishCompletionOptions, createRequiredContentFromLiteral, escapeRegexLiteral, } from "./agent/polishCompletion.js";
8
9
  export { AGENT_TOOL_NAMES, isToolEvent, isAssistantEvent, } from "./agent/events.js";
9
10
  export { emitAgentPlanningThinking, emitAgentToolSelectionThinking, emitAgentCompletionCheckThinking, emitAgentReflectionThinking, emitAgentRawModelTrace, isRawModelTraceEnabled, } from "./agent/emitAgentThinking.js";
10
11
  export { getAssistantEventText } from "./agent/assistantEvent.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EACL,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAsB9D,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AAQtC,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,sBAAsB,EACtB,+BAA+B,EAC/B,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,+BAA+B,EAC/B,uBAAuB,GACxB,MAAM,2BAA2B,CAAC;AAkBnC,OAAO,EACL,gBAAgB,EAChB,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C9B,gCAAgC,EAChC,2BAA2B,EAC3B,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAGlE,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,mBAAmB,EACnB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC"}
@@ -15,6 +15,172 @@ This guide maps the generic image-placement architecture to **SDK APIs (v0.6+)**
15
15
  | Vision bytes for model | Optional | `images[]` on send payload |
16
16
  | Serializable multi-file completion | Configures | `completion.rules` |
17
17
  | Built-in `get_attachment_urls` | Can override | Shipped generic tool |
18
+ | `classifyImageEditMode` / `runImageEditPipeline` | Yes — runs **before** `Agent.send` | No |
19
+ | Deterministic image applier + embedding verify/retry | Yes | No |
20
+ | Plan → Apply → Polish routing by intent | Yes | Speed + completion only |
21
+ | `classifyAnimationEditMode` / `runAnimationEditPipeline` | Yes — runs **before** `Agent.send` | No |
22
+ | Deterministic animation applier + preset apply | Yes | No |
23
+ | Preset → Apply → Polish routing by intent | Yes | Polish helpers only |
24
+ | Polish completion helpers | Consumes | `createPolishCompletionOptions`, `createRequiredContentFromLiteral`, `escapeRegexLiteral` |
25
+
26
+ ## Host-owned deterministic pipelines
27
+
28
+ The **host orchestrator runs before `Agent.send`**. It classifies intent, applies image or animation changes deterministically when possible, and calls the SDK agent only for polish or full creative work. The SDK stays generic — it does not know `siteConfig`, placement targets, animation presets, or applier logic.
29
+
30
+ **When to call the SDK:** only for polish or full creative. Deterministic apply paths (image Cases 1–3, animation preset-only) typically skip `Agent.send` entirely.
31
+
32
+ **SDK owns:** attachments, host tools, completion rules, agentic loop, API queue, parallel read-only tools, polish completion helpers.
33
+
34
+ **Host owns:** intent classification, placement/animation target resolution, `siteConfig`/page mutation, embedding verification, retry logic, chip UX.
35
+
36
+ ### Image: Plan → Apply → Polish
37
+
38
+ ```mermaid
39
+ flowchart TD
40
+ hostOrch[Host orchestrator before Agent.send]
41
+ direct[direct_embed]
42
+ plan[placement_plan]
43
+ style[embed_then_style]
44
+ creative[full_creative]
45
+
46
+ hostOrch --> direct
47
+ hostOrch --> plan
48
+ hostOrch --> style
49
+ hostOrch --> creative
50
+
51
+ direct --> hostApply1[Host deterministic applier]
52
+ plan --> hostPlan[Host JSON plan call]
53
+ hostPlan --> hostApply2[Host deterministic applier]
54
+ style --> hostApply3[Host deterministic applier]
55
+ style --> sdkPolish[SDK agent polish pass]
56
+ creative --> sdkAgent[SDK full agentic loop]
57
+ ```
58
+
59
+ | Mode | Host responsibility | SDK involvement |
60
+ | --- | --- | --- |
61
+ | **`direct_embed`** | Deterministic applier; **0 agent tools**; usually **no `Agent.send`** | Attachments / completion types only if a follow-up turn is needed |
62
+ | **`placement_plan`** | One JSON planning call (host LLM + schema); deterministic applier; **no SDK agentic file tools** | Not required for planning (host may use its own LLM client) |
63
+ | **`embed_then_style`** | Deterministic apply first (image URL already wired) | Short polish/style `Agent.send`; `completion.rules` must keep the wired URL present |
64
+ | **`full_creative`** | Classify + optional pre-context | Full agentic loop; v0.6.2 parallel read batches speed discovery |
65
+
66
+ ### Animation: Preset → Apply → Polish
67
+
68
+ For animation edits, the host applies motion presets deterministically (Tailwind class, `@keyframes`, motion token, etc.) before optionally calling the SDK for refinement.
69
+
70
+ ```mermaid
71
+ flowchart TD
72
+ hostAnimOrch[Host orchestrator before Agent.send]
73
+ presetOnly[preset_apply only]
74
+ presetPolish[preset_apply_then_polish]
75
+ animCreative[full_creative]
76
+
77
+ hostAnimOrch --> presetOnly
78
+ hostAnimOrch --> presetPolish
79
+ hostAnimOrch --> animCreative
80
+
81
+ presetOnly --> hostAnimApply1[Host deterministic animation applier]
82
+ presetPolish --> hostAnimApply2[Host deterministic animation applier]
83
+ presetPolish --> sdkAnimPolish[SDK agent polish pass]
84
+ animCreative --> sdkAgentAnim[SDK full agentic loop]
85
+ ```
86
+
87
+ | Mode | Host responsibility | SDK involvement |
88
+ | --- | --- | --- |
89
+ | **Preset apply only** | Classify preset, apply class/CSS deterministically; **0 agent tools**; usually **no `Agent.send`** | None |
90
+ | **Preset + polish** | Deterministic apply first (class/keyframes already wired) | Short polish `Agent.send`; preserve wired class/URL |
91
+ | **Full creative** | Classify + optional pre-context | Full agentic loop |
92
+
93
+ ### Polish completion helpers (v0.6.4+)
94
+
95
+ Use SDK helpers for short polish passes after host deterministic apply. Image polish examples reflect **CDN/GCS-hosted URLs** (consumer applies the URL before `Agent.send`; polish preserves it):
96
+
97
+ ```ts
98
+ import {
99
+ createPolishCompletionOptions,
100
+ createRequiredContentFromLiteral,
101
+ } from "@auvira.ai/sdk";
102
+
103
+ // Image polish (after host wired CDN/GCS URL deterministically)
104
+ await agent.send(
105
+ { text: styleOnWiredBaselinePrompt, attachments },
106
+ {
107
+ completion: createPolishCompletionOptions({
108
+ requiredContent: [
109
+ createRequiredContentFromLiteral({
110
+ pathPattern: "(siteConfig\\.ts|page\\.tsx|.*components/.*\\.(tsx|ts))",
111
+ literal: uploadedImagePublicUrl, // e.g. https://storage.googleapis.com/... or CDN URL
112
+ nudge: "Keep the wired CDN/GCS image URL; only add animation/style.",
113
+ }),
114
+ ],
115
+ }),
116
+ },
117
+ );
118
+
119
+ // Animation polish (after host applied preset class)
120
+ await agent.send(
121
+ { text: animationPolishPrompt },
122
+ {
123
+ completion: createPolishCompletionOptions({
124
+ requiredContent: [
125
+ createRequiredContentFromLiteral({
126
+ pathPattern: "(globals\\.css|page\\.tsx|.*components/.*\\.(tsx|ts))",
127
+ literal: "animate-fade-in", // or @keyframes name host applied
128
+ nudge: "Keep the preset animation class; refine timing/easing only.",
129
+ }),
130
+ ],
131
+ }),
132
+ },
133
+ );
134
+ ```
135
+
136
+ `createPolishCompletionOptions` also accepts optional `rules` (`requiredPaths`, `requireAssetPublish`, etc.). Top-level `requiredContent` is **concatenated** with `rules.requiredContent` (base guards preserved, polish guards appended).
137
+
138
+ ### Example: `embed_then_style` polish pass (manual completion)
139
+
140
+ After the host applies the image (no agent file tools), call the SDK for animation/style only. Prefer `createPolishCompletionOptions` + `createRequiredContentFromLiteral` (see above). Manual equivalent:
141
+
142
+ ```ts
143
+ const uploadedImagePublicUrl = "https://storage.googleapis.com/bucket/hero.png"; // CDN/GCS URL wired by host applier
144
+
145
+ function escapeRegex(value: string): string {
146
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
147
+ }
148
+
149
+ await agent.send(
150
+ {
151
+ text: styleOnWiredBaselinePrompt, // host-owned
152
+ attachments, // already wired by host applier
153
+ },
154
+ {
155
+ completion: {
156
+ mode: "multi_file_required",
157
+ multiStep: { minToolCalls: 1, maxExtraTurnsAfterStyleOnly: 2 },
158
+ rules: {
159
+ requiredContent: [
160
+ {
161
+ // siteConfig.ts is the common case; extend for inline page/component wiring
162
+ pathPattern: "(siteConfig\\.ts|page\\.tsx|.*components/.*\\.(tsx|ts))",
163
+ contentPattern: escapeRegex(uploadedImagePublicUrl),
164
+ nudge: `Keep the wired CDN/GCS image URL ${uploadedImagePublicUrl}; add animation/style only.`,
165
+ },
166
+ ],
167
+ },
168
+ },
169
+ },
170
+ );
171
+ ```
172
+
173
+ **Alternative** (prefix-only, when `/uploads/` or `/assets/` is enough):
174
+
175
+ ```ts
176
+ contentPattern: 'backgroundImageUrl\\s*:\\s*["\']/(uploads|assets)/',
177
+ ```
178
+
179
+ For **`full_creative`**, use the normal agentic path with tuned `completion.rules`. v0.6.2 parallel read tools (`grep`, `read`, `glob`, etc.) reduce discovery latency when the model batches exploration.
180
+
181
+ **Not in SDK:** `classifyImageEditMode`, `runImageEditPipeline`, `classifyAnimationEditMode`, `runAnimationEditPipeline`, `applyAnimationPreset`, `ImagePlacementTarget`, `applyImageToConfig`, embedding verification, or gallery `ImagePlacementPlan` replacement — implement these in the consumer repo.
182
+
183
+ **Optional later:** a generic `planOnly` send mode (single structured JSON call, no tool loop) if the host wants to drop duplicated planner LLM client code. Defer until the consumer pipeline proves that need.
18
184
 
19
185
  ## Layer 1 — Attachments vs vision images
20
186
 
@@ -137,7 +137,9 @@ auvira-sdk-run --job <editJobId>
137
137
  - `hostTools` are **not** supported in `job.json` v1 — register them in-process via `Agent.create` / `Agent.send`.
138
138
  - `model.apiKey` is rejected by the validator.
139
139
 
140
- See [host-integration-image-placement.md](./host-integration-image-placement.md) for the full SDK vs website-repo split.
140
+ See [host-integration-image-placement.md](./host-integration-image-placement.md) for the full SDK vs website-repo split, including **Host-owned deterministic pipelines** (image Plan → Apply → Polish, animation Preset → Apply → Polish).
141
+
142
+ Host-owned deterministic pipelines (image Cases 1–3, animation preset-only apply) typically **do not** spawn a sandbox job or call `Agent.send`. Polish and full-creative paths use the runner; `completion.rules.requiredContent` (including polish preserve guards) is JSON-serializable in `job.json` (see [`validateJob.ts`](../src/runner/validateJob.ts)). v0.6.2 parallel read tools and `AUVIRA_API_MAX_CONCURRENT` apply inside the VM the same as in-process runs.
141
143
 
142
144
  ## Result (`SandboxAuviraJobResult`)
143
145
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auvira.ai/sdk",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "Cursor-SDK-compatible visual coding agent with custom model support",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -49,7 +49,7 @@
49
49
  "test:runner:image-gen": "AUVIRA_REAL_IMAGE_GEN_E2E=true AUVIRA_IMAGE_GEN_ENABLED=true node --env-file=.env ./node_modules/vitest/vitest.mjs run src/__tests__/runner/run-cli-generate-image.real.e2e.test.ts",
50
50
  "test:real:image-api": "AUVIRA_REAL_IMAGE_API=true AUVIRA_IMAGE_GEN_ENABLED=true node --env-file=.env ./node_modules/vitest/vitest.mjs run src/__tests__/real/minimax-image-api.real.test.ts",
51
51
  "test:real:multi-image": "AUVIRA_REAL_MULTI_IMAGE_E2E=true node --env-file=.env ./node_modules/vitest/vitest.mjs run src/__tests__/real/agent-multi-image.e2e.test.ts src/__tests__/runner/run-cli-multi-image.real.e2e.test.ts",
52
- "test:real:attachment-placement": "AUVIRA_REAL_ATTACHMENT_E2E=true node --env-file=.env ./node_modules/vitest/vitest.mjs run src/__tests__/real/agent-attachment-placement.e2e.test.ts src/__tests__/runner/run-cli-attachment-placement.real.e2e.test.ts",
52
+ "test:real:attachment-placement": "AUVIRA_REAL_ATTACHMENT_E2E=true node --env-file=.env ./node_modules/vitest/vitest.mjs run src/__tests__/real/agent-attachment-placement.e2e.test.ts src/__tests__/real/agent-attachment-animation.e2e.test.ts src/__tests__/runner/run-cli-attachment-placement.real.e2e.test.ts",
53
53
  "test:runner:vibe": "node --env-file=.env ./node_modules/vitest/vitest.mjs run src/__tests__/runner/run-cli-vibe-consumer.real.e2e.test.ts"
54
54
  },
55
55
  "keywords": [