Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions packages/visualizer/src/component/playground-result/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,25 @@
text-wrap: unset;
word-wrap: break-word;
overflow-wrap: break-word;
background: #F2F4F7;
background: #f2f4f7;
border-radius: 8px;
padding: 14px;
overflow: scroll;
}
}
}

[data-theme='dark'] {
.result-wrapper {
.loading-container {
.loading-progress-text {
color: rgba(255, 255, 255, 0.45);
}
}

pre {
background: rgba(255, 255, 255, 0.08);
color: #f8fafd;
border: 1px solid rgba(255, 255, 255, 0.12);
}
}
}
28 changes: 28 additions & 0 deletions packages/visualizer/src/component/shiny-text/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,34 @@
}
}

[data-theme='dark'] .shiny-text {
background-image: linear-gradient(
45deg,
#a78bfa,
#c084fc,
#e879f9,
#c084fc
);
background-size: 300% auto;
-webkit-background-clip: text;
background-clip: text;
color: transparent;
-webkit-text-fill-color: transparent;
text-shadow: none;
animation: textGradient 8s ease infinite;

&::after {
background: linear-gradient(
90deg,
rgba(197, 184, 255, 0) 0%,
rgba(197, 184, 255, 0.05) 10%,
rgba(197, 184, 255, 0.15) 50%,
rgba(197, 184, 255, 0.05) 90%,
rgba(197, 184, 255, 0) 100%
);
}
}

@keyframes shine {
0% {
left: -150%;
Expand Down
35 changes: 30 additions & 5 deletions packages/visualizer/src/utils/replay-scripts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,17 +144,36 @@ const capitalizeFirstLetter = (str: string) => {
};

export const allScriptsFromDump = (
dump: GroupedActionDump,
dump: GroupedActionDump | ExecutionDump | null | undefined,
): ReplayScriptsInfo | null => {
if (!dump) {
console.warn('[allScriptsFromDump] dump is empty');
return {
scripts: [],
modelBriefs: [],
};
}

const normalizedDump: GroupedActionDump = Array.isArray(
(dump as GroupedActionDump).executions,
)
? (dump as GroupedActionDump)
: {
sdkVersion: '',
groupName: 'Execution',
modelBriefs: [],
executions: [dump as ExecutionDump],
};

// find out the width and height of the screenshot - collect all unique dimensions
const dimensionsSet = new Set<string>();
let firstWidth: number | undefined = undefined;
let firstHeight: number | undefined = undefined;
const sdkVersion: string | undefined = dump.sdkVersion;
const sdkVersion: string | undefined = normalizedDump.sdkVersion;

const modelBriefsSet = new Set<string>();

dump.executions.forEach((execution) => {
normalizedDump.executions?.filter(Boolean).forEach((execution) => {
execution.tasks.forEach((task) => {
if (task.uiContext?.size?.width) {
const w = task.uiContext.size.width;
Expand All @@ -179,7 +198,7 @@ export const allScriptsFromDump = (

// Use first dimensions as default for the overall player size
const allScripts: AnimationScript[] = [];
dump.executions.forEach((execution) => {
normalizedDump.executions?.filter(Boolean).forEach((execution) => {
const scripts = generateAnimationScripts(
execution,
-1,
Expand Down Expand Up @@ -212,8 +231,14 @@ export const allScriptsFromDump = (
},
);

const normalizedModelBriefs = normalizedDump.modelBriefs?.length
? normalizedDump.modelBriefs
: [];

const modelBriefs: string[] = (() => {
const list = [...modelBriefsSet];
const list = normalizedModelBriefs.length
? normalizedModelBriefs
: [...modelBriefsSet];
if (!list.length) {
return list;
}
Expand Down
3 changes: 2 additions & 1 deletion packages/web-integration/src/puppeteer/agent-launcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ export function resolveAiActionContext(
target: MidsceneYamlScriptWebEnv,
preference?: Partial<Pick<AgentOpt, 'aiActionContext' | 'aiActContext'>>,
): AgentOpt['aiActionContext'] | undefined {
// Prefer the web target override if provided; otherwise fall back to agent-level preference.
// Prefer agent-level preference if provided; otherwise fall back to target-level context.
// Priority: preference.aiActContext > preference.aiActionContext (deprecated) > target.aiActionContext
const data =
preference?.aiActContext ??
preference?.aiActionContext ??
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,58 @@ const baseTarget: Pick<MidsceneYamlScriptWebEnv, 'url'> = {
};

describe('resolveAiActionContext', () => {
test('prefers target aiActionContext when both are provided', () => {
test('prefers preference aiActContext when both preference values are provided', () => {
const target = {
...baseTarget,
aiActionContext: 'from-target',
} as MidsceneYamlScriptWebEnv;

const result = resolveAiActionContext(target, {
aiActionContext: 'from-agent',
aiActContext: 'from-preference-new',
aiActionContext: 'from-preference-deprecated',
});

expect(result).toBe('from-target');
expect(result).toBe('from-preference-new');
});

test('uses preference aiActionContext (deprecated) when aiActContext is undefined', () => {
const target = {
...baseTarget,
aiActionContext: 'from-target',
} as MidsceneYamlScriptWebEnv;

const result = resolveAiActionContext(target, {
aiActionContext: 'from-preference-deprecated',
});

expect(result).toBe('from-preference-deprecated');
});

test('falls back to agent preference when target is undefined', () => {
test('falls back to target when preference is undefined', () => {
const target = {
...baseTarget,
aiActionContext: 'from-target',
} as MidsceneYamlScriptWebEnv;

const result = resolveAiActionContext(target, {
aiActionContext: undefined,
aiActContext: undefined,
});

expect(result).toBe('from-target');
});

test('prefers preference over target when both are provided', () => {
const target = {
...baseTarget,
aiActionContext: 'from-target',
} as MidsceneYamlScriptWebEnv;

const result = resolveAiActionContext(target, {
aiActionContext: 'from-agent',
aiActContext: 'from-preference',
});

expect(result).toBe('from-agent');
expect(result).toBe('from-preference');
});

test('returns undefined when neither target nor preference provides context', () => {
Expand Down