@codefilm/recorder 3.0.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.
- package/README.md +1553 -0
- package/dist/code-film.css +1 -0
- package/dist/core/FilmRecorder.d.ts +192 -0
- package/dist/core/FilmRecorder.d.ts.map +1 -0
- package/dist/core/FilmRecorder.js +1504 -0
- package/dist/core/agent.d.ts +27 -0
- package/dist/core/agent.d.ts.map +1 -0
- package/dist/core/agent.js +258 -0
- package/dist/core/app-script.d.ts +232 -0
- package/dist/core/app-script.d.ts.map +1 -0
- package/dist/core/app-script.js +916 -0
- package/dist/core/iframe-bridge.d.ts +34 -0
- package/dist/core/iframe-bridge.d.ts.map +1 -0
- package/dist/core/iframe-bridge.js +97 -0
- package/dist/core/recording-overlays.d.ts +12 -0
- package/dist/core/recording-overlays.d.ts.map +1 -0
- package/dist/core/recording-overlays.js +237 -0
- package/dist/core/types.d.ts +256 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.umd.cjs +156 -0
- package/dist/react/RegionRecorder.d.ts +7 -0
- package/dist/react/RegionRecorder.d.ts.map +1 -0
- package/dist/react/RegionRecorder.js +190 -0
- package/dist/react/useFilmRecorder.d.ts +11 -0
- package/dist/react/useFilmRecorder.d.ts.map +1 -0
- package/dist/react/useFilmRecorder.js +61 -0
- package/dist/vanilla/RegionRecorderUI.d.ts +21 -0
- package/dist/vanilla/RegionRecorderUI.d.ts.map +1 -0
- package/dist/vanilla/RegionRecorderUI.js +128 -0
- package/package.json +70 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Agent, Runner } from '@openai/agents';
|
|
2
|
+
import { FilmRecorder } from './FilmRecorder';
|
|
3
|
+
export interface WebAssistantAgentOptions {
|
|
4
|
+
instructions?: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Creates an OpenAI Agent configured with tools to control the FilmRecorder
|
|
8
|
+
* and simulate visual interactions on the webpage.
|
|
9
|
+
*/
|
|
10
|
+
export declare function createWebAssistantAgent(recorder: FilmRecorder, options?: WebAssistantAgentOptions): Agent;
|
|
11
|
+
export interface RecorderAgentRunnerOptions {
|
|
12
|
+
baseURL?: string;
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
maxTurns?: number;
|
|
15
|
+
tracingDisabled?: boolean;
|
|
16
|
+
model?: string;
|
|
17
|
+
instructions?: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates an OpenAI Agents SDK runner configured for browser-safe proxy usage,
|
|
21
|
+
* pre-wired with the Web Assistant Agent.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createRecorderAgentRunner(recorder: FilmRecorder, options?: RecorderAgentRunnerOptions): {
|
|
24
|
+
runner: Runner;
|
|
25
|
+
agent: Agent<unknown, "text">;
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../src/core/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAQ,MAAM,EAAkB,MAAM,gBAAgB,CAAC;AAErE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,WAAW,wBAAwB;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,YAAY,EACtB,OAAO,GAAE,wBAA6B,GACrC,KAAK,CA6QP;AAED,MAAM,WAAW,0BAA0B;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,YAAY,EACtB,OAAO,GAAE,0BAA+B;;;EAqCzC"}
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import { OpenAIProvider as v, Runner as b, tool as s, Agent as x } from "@openai/agents";
|
|
2
|
+
import k from "openai";
|
|
3
|
+
function P(r, o = {}) {
|
|
4
|
+
const l = s({
|
|
5
|
+
name: "navigate",
|
|
6
|
+
description: "Navigate browser or shell to a target route, URL hash, or URL",
|
|
7
|
+
strict: !0,
|
|
8
|
+
parameters: {
|
|
9
|
+
type: "object",
|
|
10
|
+
properties: {
|
|
11
|
+
url: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "The URL path, hash route, or URL to navigate to"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
required: ["url"],
|
|
17
|
+
additionalProperties: !1
|
|
18
|
+
},
|
|
19
|
+
execute: async (t) => {
|
|
20
|
+
const { url: e } = t;
|
|
21
|
+
return typeof window > "u" ? "Cannot navigate: not in browser context" : (window.router ? window.router.navigate({ to: e }) : window.location.hash = e, `Successfully navigated to: ${e}`);
|
|
22
|
+
}
|
|
23
|
+
}), u = s({
|
|
24
|
+
name: "click",
|
|
25
|
+
description: "Simulate a visual pointer click and trigger a DOM click event on the target selector",
|
|
26
|
+
strict: !0,
|
|
27
|
+
parameters: {
|
|
28
|
+
type: "object",
|
|
29
|
+
properties: {
|
|
30
|
+
selector: {
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "CSS selector of the target element to click"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
required: ["selector"],
|
|
36
|
+
additionalProperties: !1
|
|
37
|
+
},
|
|
38
|
+
execute: async (t) => {
|
|
39
|
+
const { selector: e } = t;
|
|
40
|
+
try {
|
|
41
|
+
return await r.simulateClick(e), `Successfully clicked element: ${e}`;
|
|
42
|
+
} catch (n) {
|
|
43
|
+
return `Failed to click ${e}: ${n.message}`;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}), p = s({
|
|
47
|
+
name: "moveMousePointerTo",
|
|
48
|
+
description: "Smoothly move the simulated visual pointer cursor to the center of the specified selector",
|
|
49
|
+
strict: !0,
|
|
50
|
+
parameters: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
selector: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "CSS selector of the target element to hover"
|
|
56
|
+
},
|
|
57
|
+
durationMs: {
|
|
58
|
+
type: "number",
|
|
59
|
+
description: "Duration of the pointer movement in milliseconds",
|
|
60
|
+
default: 800
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
required: ["selector", "durationMs"],
|
|
64
|
+
additionalProperties: !1
|
|
65
|
+
},
|
|
66
|
+
execute: async (t) => {
|
|
67
|
+
const { selector: e, durationMs: n = 800 } = t;
|
|
68
|
+
try {
|
|
69
|
+
return await r.animatePointerTo(e, n), `Moved mouse pointer to: ${e}`;
|
|
70
|
+
} catch (a) {
|
|
71
|
+
return `Failed to move pointer to ${e}: ${a.message}`;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}), d = s({
|
|
75
|
+
name: "drawRegionAroundCssSelector",
|
|
76
|
+
description: "Adjust the recording camera crop-box to focus/zoom onto the specified element, or reset to fullscreen",
|
|
77
|
+
strict: !0,
|
|
78
|
+
parameters: {
|
|
79
|
+
type: "object",
|
|
80
|
+
properties: {
|
|
81
|
+
selector: {
|
|
82
|
+
type: ["string", "null"],
|
|
83
|
+
description: "CSS selector to zoom into. Provide null or empty string to zoom out to full screen"
|
|
84
|
+
},
|
|
85
|
+
padding: {
|
|
86
|
+
type: "number",
|
|
87
|
+
description: "Padding multiplier around the selector boundaries",
|
|
88
|
+
default: 1.1
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
required: ["selector", "padding"],
|
|
92
|
+
additionalProperties: !1
|
|
93
|
+
},
|
|
94
|
+
execute: async (t) => {
|
|
95
|
+
const { selector: e, padding: n = 1.1 } = t;
|
|
96
|
+
return e ? (r.setElementSelector(e), r.setElementPadding(n), `Focused camera region on element: ${e}`) : (r.setElementSelector(null), r.resetFullScreen(), "Reset camera to full viewport");
|
|
97
|
+
}
|
|
98
|
+
}), m = s({
|
|
99
|
+
name: "typeText",
|
|
100
|
+
description: "Simulate keystrokes to type text into an input field or textarea",
|
|
101
|
+
strict: !0,
|
|
102
|
+
parameters: {
|
|
103
|
+
type: "object",
|
|
104
|
+
properties: {
|
|
105
|
+
selector: {
|
|
106
|
+
type: "string",
|
|
107
|
+
description: "CSS selector of the target input/textarea element"
|
|
108
|
+
},
|
|
109
|
+
text: {
|
|
110
|
+
type: "string",
|
|
111
|
+
description: "The text content to type into the field"
|
|
112
|
+
},
|
|
113
|
+
cps: {
|
|
114
|
+
type: "number",
|
|
115
|
+
description: "Typing speed in characters per second",
|
|
116
|
+
default: 24
|
|
117
|
+
},
|
|
118
|
+
jitter: {
|
|
119
|
+
type: "number",
|
|
120
|
+
description: "Per-character timing variation from 0 to 1",
|
|
121
|
+
default: 0.22
|
|
122
|
+
},
|
|
123
|
+
punctuationPauseMs: {
|
|
124
|
+
type: "number",
|
|
125
|
+
description: "Extra pause after punctuation in milliseconds",
|
|
126
|
+
default: 120
|
|
127
|
+
},
|
|
128
|
+
mistakeRate: {
|
|
129
|
+
type: "number",
|
|
130
|
+
description: "Corrected typo probability from 0 to 1",
|
|
131
|
+
default: 0.012
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
required: ["selector", "text", "cps", "jitter", "punctuationPauseMs", "mistakeRate"],
|
|
135
|
+
additionalProperties: !1
|
|
136
|
+
},
|
|
137
|
+
execute: async (t) => {
|
|
138
|
+
const {
|
|
139
|
+
selector: e,
|
|
140
|
+
text: n,
|
|
141
|
+
cps: a = 24,
|
|
142
|
+
jitter: g = 0.22,
|
|
143
|
+
punctuationPauseMs: f = 120,
|
|
144
|
+
mistakeRate: h = 0.012
|
|
145
|
+
} = t;
|
|
146
|
+
try {
|
|
147
|
+
return await r.simulateType(e, n, {
|
|
148
|
+
cps: a,
|
|
149
|
+
jitter: g,
|
|
150
|
+
punctuationPauseMs: f,
|
|
151
|
+
mistakeRate: h
|
|
152
|
+
}), `Typed "${n}" into element: ${e}`;
|
|
153
|
+
} catch (w) {
|
|
154
|
+
return `Failed to type text into ${e}: ${w.message}`;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}), i = s({
|
|
158
|
+
name: "wait",
|
|
159
|
+
description: "Pause execution for a specific duration in milliseconds to align with scene timing",
|
|
160
|
+
strict: !0,
|
|
161
|
+
parameters: {
|
|
162
|
+
type: "object",
|
|
163
|
+
properties: {
|
|
164
|
+
durationMs: {
|
|
165
|
+
type: "number",
|
|
166
|
+
description: "Duration to pause in milliseconds"
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
required: ["durationMs"],
|
|
170
|
+
additionalProperties: !1
|
|
171
|
+
},
|
|
172
|
+
execute: async (t) => {
|
|
173
|
+
const { durationMs: e } = t;
|
|
174
|
+
return await new Promise((n) => setTimeout(n, e)), `Waited for ${e}ms`;
|
|
175
|
+
}
|
|
176
|
+
}), c = `
|
|
177
|
+
You are an automated video-demo assistant. Your task is to interpret a film script scene-by-scene
|
|
178
|
+
and execute the corresponding UI interactions (navigating, moving the cursor, typing, and clicking)
|
|
179
|
+
while adjusting the recording camera zoom around active components.
|
|
180
|
+
|
|
181
|
+
Ensure actions are timed logically according to the scene start/end intervals.
|
|
182
|
+
|
|
183
|
+
Every generated film must visibly demonstrate user interaction.
|
|
184
|
+
|
|
185
|
+
Interaction rules:
|
|
186
|
+
- Never rely on passive waits alone.
|
|
187
|
+
- Before each interaction, focus the camera on its target.
|
|
188
|
+
- Every type command internally moves the pointer, clicks/focuses the input, then types.
|
|
189
|
+
- Use cps 20-30, jitter 0.12-0.28, punctuationPauseMs 80-180, and mistakeRate 0-0.015 for natural prompt entry.
|
|
190
|
+
- Omit command-level typing values when recorder or run defaults already define the intended cadence.
|
|
191
|
+
- Do not add a separate click immediately before type unless the interaction genuinely requires two clicks.
|
|
192
|
+
- Use pointer commands to visibly focus targets without clicking them.
|
|
193
|
+
- Every navigation or submission must use a visible pointer click.
|
|
194
|
+
- Use stable CSS selectors only.
|
|
195
|
+
- Keep camera padding between 1.05 and 1.18.
|
|
196
|
+
- After submitting, focus the camera on the response area.
|
|
197
|
+
- Move between at least two meaningful camera targets.
|
|
198
|
+
- End with \`camera { selector: null }\`.
|
|
199
|
+
- Video/Script duration must always be a multiple of 5 seconds (e.g. 5s, 10s, 15s). If the script finishes fast or ends early, append or extend a \`wait\` command to round up the final total script length to the next closest multiple of 5 seconds.
|
|
200
|
+
- Before entering text on the prompt box, the mouse must always move to and pause on the top-left corner of the prompt box.
|
|
201
|
+
|
|
202
|
+
Example prompt sequence:
|
|
203
|
+
camera { selector: ".demo-input-card" padding: 1.16 }
|
|
204
|
+
move { selector: "#demo-prompt-input" }
|
|
205
|
+
wait 500ms
|
|
206
|
+
type { selector: "#demo-prompt-input" text: "<user request>" cps: 24 jitter: 0.22 punctuationPauseMs: 120 mistakeRate: 0.012 }
|
|
207
|
+
wait 250ms
|
|
208
|
+
click { selector: ".demo-submit-button" }
|
|
209
|
+
camera { selector: ".demo-output-panel" padding: 1.12 }
|
|
210
|
+
|
|
211
|
+
Reject or regenerate scripts when:
|
|
212
|
+
- They contain navigation without pointer clicks.
|
|
213
|
+
- They stay fullscreen for the entire film.
|
|
214
|
+
- They use only \`wait\` commands to represent activity.
|
|
215
|
+
- They omit the final zoom-out.
|
|
216
|
+
`, y = o.instructions ? `${c}
|
|
217
|
+
|
|
218
|
+
Additional Instructions:
|
|
219
|
+
${o.instructions}` : c;
|
|
220
|
+
return new x({
|
|
221
|
+
name: "Web Assistant",
|
|
222
|
+
instructions: y,
|
|
223
|
+
tools: [
|
|
224
|
+
l,
|
|
225
|
+
u,
|
|
226
|
+
p,
|
|
227
|
+
d,
|
|
228
|
+
m,
|
|
229
|
+
i
|
|
230
|
+
]
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function R(r, o = {}) {
|
|
234
|
+
const l = o.apiKey || "proxied-by-server", u = o.baseURL, p = o.tracingDisabled ?? !0, d = new k({
|
|
235
|
+
apiKey: l,
|
|
236
|
+
baseURL: u,
|
|
237
|
+
dangerouslyAllowBrowser: !0
|
|
238
|
+
}), m = new v({ openAIClient: d }), i = new b({
|
|
239
|
+
modelProvider: m,
|
|
240
|
+
tracingDisabled: p,
|
|
241
|
+
model: o.model
|
|
242
|
+
}), c = i.run.bind(i);
|
|
243
|
+
i.run = (async (t, e, n = {}) => {
|
|
244
|
+
const a = await c(t, e, {
|
|
245
|
+
maxTurns: o.maxTurns ?? 20,
|
|
246
|
+
...n
|
|
247
|
+
});
|
|
248
|
+
return r.getState().recording && await r.finishRecording(), a;
|
|
249
|
+
});
|
|
250
|
+
const y = P(r, {
|
|
251
|
+
instructions: o.instructions
|
|
252
|
+
});
|
|
253
|
+
return { runner: i, agent: y };
|
|
254
|
+
}
|
|
255
|
+
export {
|
|
256
|
+
R as createRecorderAgentRunner,
|
|
257
|
+
P as createWebAssistantAgent
|
|
258
|
+
};
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { FilmScriptDiagnostic, FilmScriptValidationResult } from './types';
|
|
2
|
+
export type AppFilmSelectorRole = "page" | "input" | "button" | "card" | "panel" | "text";
|
|
3
|
+
export type AppFilmSetupCapability = string;
|
|
4
|
+
export interface AppFilmSelector {
|
|
5
|
+
selector: string;
|
|
6
|
+
description: string;
|
|
7
|
+
requiresSetup?: string[];
|
|
8
|
+
role?: AppFilmSelectorRole;
|
|
9
|
+
}
|
|
10
|
+
export interface AppFilmPage {
|
|
11
|
+
id: string;
|
|
12
|
+
description: string;
|
|
13
|
+
containerSelector: string;
|
|
14
|
+
defaultScopeSelector?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface AppFilmExample {
|
|
17
|
+
input: string;
|
|
18
|
+
script: string;
|
|
19
|
+
setup?: AppFilmSetup;
|
|
20
|
+
description?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AppFilmIntentRecipe {
|
|
23
|
+
id: string;
|
|
24
|
+
description: string;
|
|
25
|
+
examples: string[];
|
|
26
|
+
synonyms?: string[];
|
|
27
|
+
negativeExamples?: string[];
|
|
28
|
+
page: string;
|
|
29
|
+
defaultScopeSelector?: string;
|
|
30
|
+
submitPrompt: boolean;
|
|
31
|
+
setup?: AppFilmSetupEntry[];
|
|
32
|
+
requiredSetup?: string[];
|
|
33
|
+
scriptGuidance?: string;
|
|
34
|
+
}
|
|
35
|
+
export interface AppFilmPromptTool {
|
|
36
|
+
id: string;
|
|
37
|
+
name: string;
|
|
38
|
+
mention: string;
|
|
39
|
+
description: string;
|
|
40
|
+
aliases?: string[];
|
|
41
|
+
icon?: string;
|
|
42
|
+
installed?: boolean;
|
|
43
|
+
examples?: string[];
|
|
44
|
+
}
|
|
45
|
+
export interface AppFilmAttachmentType {
|
|
46
|
+
id: string;
|
|
47
|
+
label: string;
|
|
48
|
+
aliases?: string[];
|
|
49
|
+
examples?: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface AppFilmGenerationDefaults {
|
|
52
|
+
minimalPromptMode?: boolean;
|
|
53
|
+
defaultDurationSeconds?: number;
|
|
54
|
+
defaultIntent?: string;
|
|
55
|
+
ambiguousTextIntent?: string;
|
|
56
|
+
defaultScope?: "smallest-meaningful" | "page";
|
|
57
|
+
}
|
|
58
|
+
export interface AppFilmProfile {
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
description?: string;
|
|
62
|
+
selectors: Record<string, AppFilmSelector>;
|
|
63
|
+
pages: Record<string, AppFilmPage>;
|
|
64
|
+
setupCapabilities: AppFilmSetupCapability[];
|
|
65
|
+
intents?: AppFilmIntentRecipe[];
|
|
66
|
+
promptTools?: AppFilmPromptTool[];
|
|
67
|
+
attachmentTypes?: AppFilmAttachmentType[];
|
|
68
|
+
defaults?: AppFilmGenerationDefaults;
|
|
69
|
+
vocabulary?: Record<string, string[]>;
|
|
70
|
+
rules?: string[];
|
|
71
|
+
examples?: AppFilmExample[];
|
|
72
|
+
setupAliases?: Record<string, string>;
|
|
73
|
+
}
|
|
74
|
+
export interface AppFilmSetup {
|
|
75
|
+
appId: string;
|
|
76
|
+
entries: AppFilmSetupEntry[];
|
|
77
|
+
}
|
|
78
|
+
export interface AppFilmSetupEntry {
|
|
79
|
+
type: string;
|
|
80
|
+
value: unknown;
|
|
81
|
+
}
|
|
82
|
+
export interface AppFilmToolDefinition {
|
|
83
|
+
type: "function";
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
parameters: Record<string, unknown>;
|
|
87
|
+
strict?: boolean;
|
|
88
|
+
}
|
|
89
|
+
export interface AppFilmCompleteRequest {
|
|
90
|
+
instructions: string;
|
|
91
|
+
input: string;
|
|
92
|
+
tools: AppFilmToolDefinition[];
|
|
93
|
+
toolChoice: "required";
|
|
94
|
+
signal?: AbortSignal;
|
|
95
|
+
}
|
|
96
|
+
export interface AppFilmCompleteResult {
|
|
97
|
+
toolName: string;
|
|
98
|
+
arguments: unknown;
|
|
99
|
+
raw?: unknown;
|
|
100
|
+
}
|
|
101
|
+
export type AppFilmComplete = (request: AppFilmCompleteRequest) => Promise<AppFilmCompleteResult>;
|
|
102
|
+
export interface AppFilmResolvedPromptTool {
|
|
103
|
+
id: string;
|
|
104
|
+
mention: string;
|
|
105
|
+
label?: string;
|
|
106
|
+
reason?: string;
|
|
107
|
+
}
|
|
108
|
+
export interface AppFilmResolvedAttachment {
|
|
109
|
+
type: string;
|
|
110
|
+
name?: string;
|
|
111
|
+
label?: string;
|
|
112
|
+
reason?: string;
|
|
113
|
+
}
|
|
114
|
+
export interface AppFilmResolvedIntent {
|
|
115
|
+
id: string;
|
|
116
|
+
confidence?: number;
|
|
117
|
+
page: string;
|
|
118
|
+
scopeSelector?: string;
|
|
119
|
+
submitPrompt: boolean;
|
|
120
|
+
promptText?: string;
|
|
121
|
+
promptTools?: AppFilmResolvedPromptTool[];
|
|
122
|
+
attachments?: AppFilmResolvedAttachment[];
|
|
123
|
+
setupNeeded?: string[];
|
|
124
|
+
rationale?: string;
|
|
125
|
+
}
|
|
126
|
+
export interface ResolveFilmIntentToolResult {
|
|
127
|
+
intentId: string;
|
|
128
|
+
confidence?: number;
|
|
129
|
+
page: string;
|
|
130
|
+
scopeSelector?: string;
|
|
131
|
+
submitPrompt: boolean;
|
|
132
|
+
promptText?: string;
|
|
133
|
+
promptTools?: AppFilmResolvedPromptTool[];
|
|
134
|
+
attachments?: AppFilmResolvedAttachment[];
|
|
135
|
+
setupNeeded?: string[];
|
|
136
|
+
rationale: string;
|
|
137
|
+
}
|
|
138
|
+
export interface CreateFilmScriptToolResult {
|
|
139
|
+
intent?: AppFilmResolvedIntent;
|
|
140
|
+
script: string;
|
|
141
|
+
setup?: AppFilmSetup;
|
|
142
|
+
warnings?: string[];
|
|
143
|
+
}
|
|
144
|
+
export interface AppFilmScriptResult {
|
|
145
|
+
intent?: AppFilmResolvedIntent;
|
|
146
|
+
script: string;
|
|
147
|
+
setup: AppFilmSetup;
|
|
148
|
+
diagnostics: FilmScriptDiagnostic[];
|
|
149
|
+
warnings: string[];
|
|
150
|
+
trace?: AppFilmGenerationTrace;
|
|
151
|
+
}
|
|
152
|
+
export type AppFilmIntentMode = "auto" | "off";
|
|
153
|
+
export type AppFilmGenerationTracePhase = "intent" | "script" | "repair";
|
|
154
|
+
export interface AppFilmGenerationTrace {
|
|
155
|
+
calls: AppFilmGenerationTraceCall[];
|
|
156
|
+
}
|
|
157
|
+
export interface AppFilmGenerationTraceCall {
|
|
158
|
+
phase: AppFilmGenerationTracePhase;
|
|
159
|
+
request: {
|
|
160
|
+
instructions?: string;
|
|
161
|
+
input: string;
|
|
162
|
+
tools: AppFilmToolDefinition[];
|
|
163
|
+
toolChoice: "required";
|
|
164
|
+
};
|
|
165
|
+
response?: {
|
|
166
|
+
toolName: string;
|
|
167
|
+
arguments: unknown;
|
|
168
|
+
raw?: unknown;
|
|
169
|
+
};
|
|
170
|
+
diagnostics?: FilmScriptDiagnostic[];
|
|
171
|
+
warnings?: string[];
|
|
172
|
+
error?: {
|
|
173
|
+
message: string;
|
|
174
|
+
name?: string;
|
|
175
|
+
};
|
|
176
|
+
startedAt: string;
|
|
177
|
+
finishedAt?: string;
|
|
178
|
+
durationMs?: number;
|
|
179
|
+
}
|
|
180
|
+
export interface AppFilmTraceOptions {
|
|
181
|
+
enabled?: boolean;
|
|
182
|
+
includeInstructions?: boolean;
|
|
183
|
+
includeRaw?: boolean;
|
|
184
|
+
redact?: (call: AppFilmGenerationTraceCall) => AppFilmGenerationTraceCall;
|
|
185
|
+
}
|
|
186
|
+
export declare class AppFilmGenerationError extends Error {
|
|
187
|
+
trace?: AppFilmGenerationTrace;
|
|
188
|
+
constructor(message: string, options?: {
|
|
189
|
+
cause?: unknown;
|
|
190
|
+
trace?: AppFilmGenerationTrace;
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
export interface GenerateAppFilmScriptOptions {
|
|
194
|
+
app: AppFilmProfile;
|
|
195
|
+
input: string;
|
|
196
|
+
complete: AppFilmComplete;
|
|
197
|
+
signal?: AbortSignal;
|
|
198
|
+
repair?: boolean;
|
|
199
|
+
intentMode?: AppFilmIntentMode;
|
|
200
|
+
trace?: boolean | AppFilmTraceOptions;
|
|
201
|
+
}
|
|
202
|
+
export interface RepairAppFilmScriptOptions {
|
|
203
|
+
app: AppFilmProfile;
|
|
204
|
+
input?: string;
|
|
205
|
+
complete: AppFilmComplete;
|
|
206
|
+
signal?: AbortSignal;
|
|
207
|
+
diagnostics?: FilmScriptDiagnostic[];
|
|
208
|
+
trace?: boolean | AppFilmTraceOptions;
|
|
209
|
+
}
|
|
210
|
+
export interface PrepareAppFilmScriptOptions {
|
|
211
|
+
app?: AppFilmProfile | string;
|
|
212
|
+
setup?: AppFilmSetup;
|
|
213
|
+
stripSetupForDisplay?: boolean;
|
|
214
|
+
stripSetupForPlayback?: boolean;
|
|
215
|
+
}
|
|
216
|
+
export interface PreparedAppFilmScript {
|
|
217
|
+
isFilmScript: boolean;
|
|
218
|
+
fullScript: string;
|
|
219
|
+
displayScript: string;
|
|
220
|
+
runnableScript: string;
|
|
221
|
+
setup: AppFilmSetup;
|
|
222
|
+
setupComments: string;
|
|
223
|
+
filmBody: string;
|
|
224
|
+
}
|
|
225
|
+
export declare function parseAppFilmSetup(script: string, appId?: string): AppFilmSetup;
|
|
226
|
+
export declare function stripAppFilmSetup(script: string): string;
|
|
227
|
+
export declare function serializeAppFilmSetup(setup: AppFilmSetup): string;
|
|
228
|
+
export declare function prepareAppFilmScript(script: string, options?: PrepareAppFilmScriptOptions): PreparedAppFilmScript;
|
|
229
|
+
export declare function validateAppFilmScript(script: string, profile: AppFilmProfile): FilmScriptValidationResult;
|
|
230
|
+
export declare function generateAppFilmScript(options: GenerateAppFilmScriptOptions): Promise<AppFilmScriptResult>;
|
|
231
|
+
export declare function repairAppFilmScript(script: string, options: RepairAppFilmScriptOptions): Promise<AppFilmScriptResult>;
|
|
232
|
+
//# sourceMappingURL=app-script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-script.d.ts","sourceRoot":"","sources":["../../src/core/app-script.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EAEpB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,OAAO,GACP,QAAQ,GACR,MAAM,GACN,OAAO,GACP,MAAM,CAAC;AAEX,MAAM,MAAM,sBAAsB,GAAG,MAAM,CAAC;AAE5C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,mBAAmB,CAAC;CAC5B;AAED,M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