@auvira.ai/sdk 0.6.3 → 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 +1 -1
- package/dist/agent/polishCompletion.d.ts +17 -0
- package/dist/agent/polishCompletion.d.ts.map +1 -0
- package/dist/agent/polishCompletion.js +35 -0
- package/dist/agent/polishCompletion.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/docs/host-integration-image-placement.md +88 -10
- package/docs/sandbox-runner.md +2 -2
- package/package.json +1 -1
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, **Plan → Apply → Polish** host
|
|
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.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polishCompletion.js","sourceRoot":"","sources":["../../src/agent/polishCompletion.ts"],"names":[],"mappings":"AAMA,2FAA2F;AAC3F,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,KAAK,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACtD,CAAC;AAED,uGAAuG;AACvG,MAAM,UAAU,gCAAgC,CAAC,KAIhD;IACC,OAAO;QACL,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,cAAc,EAAE,kBAAkB,CAAC,KAAK,CAAC,OAAO,CAAC;QACjD,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAC;AACJ,CAAC;AAED,iGAAiG;AACjG,MAAM,UAAU,6BAA6B,CAAC,KAK7C;IACC,MAAM,qBAAqB,GAAG;QAC5B,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,eAAe,IAAI,EAAE,CAAC;QACvC,GAAG,CAAC,KAAK,CAAC,eAAe,IAAI,EAAE,CAAC;KACjC,CAAC;IAEF,MAAM,WAAW,GAAgC;QAC/C,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QACtB,GAAG,CAAC,qBAAqB,CAAC,MAAM;YAC9B,CAAC,CAAC,EAAE,eAAe,EAAE,qBAAqB,EAAE;YAC5C,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;IAEF,OAAO;QACL,IAAI,EAAE,qBAAqB;QAC3B,SAAS,EAAE;YACT,YAAY,EAAE,KAAK,CAAC,YAAY,IAAI,CAAC;YACrC,2BAA2B,EAAE,KAAK,CAAC,aAAa,IAAI,CAAC;SACtD;QACD,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACvE,CAAC;AACJ,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";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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;AAC1B,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AACtC,YAAY,EACV,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,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,M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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;
|
|
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;AACnC,OAAO,EACL,6BAA6B,EAC7B,gCAAgC,EAChC,kBAAkB,GACnB,MAAM,6BAA6B,CAAC;AAkBrC,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;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"}
|
|
@@ -18,10 +18,22 @@ This guide maps the generic image-placement architecture to **SDK APIs (v0.6+)**
|
|
|
18
18
|
| `classifyImageEditMode` / `runImageEditPipeline` | Yes — runs **before** `Agent.send` | No |
|
|
19
19
|
| Deterministic image applier + embedding verify/retry | Yes | No |
|
|
20
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` |
|
|
21
25
|
|
|
22
|
-
##
|
|
26
|
+
## Host-owned deterministic pipelines
|
|
23
27
|
|
|
24
|
-
|
|
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
|
|
25
37
|
|
|
26
38
|
```mermaid
|
|
27
39
|
flowchart TD
|
|
@@ -51,18 +63,84 @@ flowchart TD
|
|
|
51
63
|
| **`embed_then_style`** | Deterministic apply first (image URL already wired) | Short polish/style `Agent.send`; `completion.rules` must keep the wired URL present |
|
|
52
64
|
| **`full_creative`** | Classify + optional pre-context | Full agentic loop; v0.6.2 parallel read batches speed discovery |
|
|
53
65
|
|
|
54
|
-
|
|
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+)
|
|
55
94
|
|
|
56
|
-
|
|
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
|
+
```
|
|
57
135
|
|
|
58
|
-
|
|
136
|
+
`createPolishCompletionOptions` also accepts optional `rules` (`requiredPaths`, `requireAssetPublish`, etc.). Top-level `requiredContent` is **concatenated** with `rules.requiredContent` (base guards preserved, polish guards appended).
|
|
59
137
|
|
|
60
|
-
|
|
138
|
+
### Example: `embed_then_style` polish pass (manual completion)
|
|
61
139
|
|
|
62
|
-
|
|
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:
|
|
63
141
|
|
|
64
142
|
```ts
|
|
65
|
-
const uploadedImagePublicUrl =
|
|
143
|
+
const uploadedImagePublicUrl = "https://storage.googleapis.com/bucket/hero.png"; // CDN/GCS URL wired by host applier
|
|
66
144
|
|
|
67
145
|
function escapeRegex(value: string): string {
|
|
68
146
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
@@ -83,7 +161,7 @@ await agent.send(
|
|
|
83
161
|
// siteConfig.ts is the common case; extend for inline page/component wiring
|
|
84
162
|
pathPattern: "(siteConfig\\.ts|page\\.tsx|.*components/.*\\.(tsx|ts))",
|
|
85
163
|
contentPattern: escapeRegex(uploadedImagePublicUrl),
|
|
86
|
-
nudge: `Keep the wired image URL ${uploadedImagePublicUrl}; add animation/style only.`,
|
|
164
|
+
nudge: `Keep the wired CDN/GCS image URL ${uploadedImagePublicUrl}; add animation/style only.`,
|
|
87
165
|
},
|
|
88
166
|
],
|
|
89
167
|
},
|
|
@@ -100,7 +178,7 @@ contentPattern: 'backgroundImageUrl\\s*:\\s*["\']/(uploads|assets)/',
|
|
|
100
178
|
|
|
101
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.
|
|
102
180
|
|
|
103
|
-
**Not in SDK:** `classifyImageEditMode`, `runImageEditPipeline`, `ImagePlacementTarget`, `applyImageToConfig`, embedding verification, or gallery `ImagePlacementPlan` replacement — implement these in the consumer repo.
|
|
181
|
+
**Not in SDK:** `classifyImageEditMode`, `runImageEditPipeline`, `classifyAnimationEditMode`, `runAnimationEditPipeline`, `applyAnimationPreset`, `ImagePlacementTarget`, `applyImageToConfig`, embedding verification, or gallery `ImagePlacementPlan` replacement — implement these in the consumer repo.
|
|
104
182
|
|
|
105
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.
|
|
106
184
|
|
package/docs/sandbox-runner.md
CHANGED
|
@@ -137,9 +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, including
|
|
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
141
|
|
|
142
|
-
|
|
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.
|
|
143
143
|
|
|
144
144
|
## Result (`SandboxAuviraJobResult`)
|
|
145
145
|
|