Skip to content

armgit / Orkas

Public Imported from GitHub
0

Orkas is an open-source (MIT), local-first AI team for your desktop: a Commander turns your goal into to-dos and coordinates 16 built-in specialist agents plus Claude Code, Codex, OpenCode, OpenClaw and Hermes, with projects, scheduled automations and connectors. Free app for macOS & Windows; built-in models or your own keys.

fix(office): convert PPT outline opacity percentages

IgnoreMeButb9d456a1a8f7
diff --git a/src/main/model/core-agent/office-batch.ts b/src/main/model/core-agent/office-batch.ts
index 2469ef48..55943fa9 100644
--- a/src/main/model/core-agent/office-batch.ts
+++ b/src/main/model/core-agent/office-batch.ts
@@ -486,6 +486,15 @@ export function buildPptxBatch(slides: readonly PptxSlideSpec[]): OfficeBatchOp[
// The outline equivalent has the same carrier relationship.
if ('lineOpacity' in shapeProps && !('line' in shapeProps)) {
delete shapeProps.lineOpacity;
+ } else if (
+ typeof shape.lineOpacity === 'number'
+ && Number.isFinite(shape.lineOpacity)
+ && shape.lineOpacity >= 0 && shape.lineOpacity <= 100
+ ) {
+ // create_pptx declares percentages; OfficeCLI expects a 0..1
+ // fraction for outlines. Even 1 means 1%, not full opacity.
+ // Leave invalid inputs to engine validation, without clamping.
+ shapeProps.lineOpacity = String(shape.lineOpacity / 100);
}
if (!Object.keys(shapeProps).length) continue;
ops.push({ command: 'add', parent: `/slide[${slideNo}]`, type: 'shape', props: shapeProps });
diff --git a/test/main/model/core-agent/office-batch.test.ts b/test/main/model/core-agent/office-batch.test.ts
index 548b4b7e..670432b1 100644
--- a/test/main/model/core-agent/office-batch.test.ts
+++ b/test/main/model/core-agent/office-batch.test.ts
@@ -302,7 +302,7 @@ describe('buildPptxBatch', () => {
},
{
command: 'add', parent: '/slide[1]', type: 'shape',
- props: { text: 'Filled', fill: '#FFFFFF', opacity: '0', line: '#111827', lineOpacity: '25' },
+ props: { text: 'Filled', fill: '#FFFFFF', opacity: '0', line: '#111827', lineOpacity: '0.25' },
},
{
command: 'add', parent: '/slide[1]', type: 'shape',
@@ -311,6 +311,19 @@ describe('buildPptxBatch', () => {
]);
});
+ it.each([
+ [0, '0'], [0.5, '0.005'], [1, '0.01'], [45, '0.45'],
+ [50, '0.5'], [55, '0.55'], [100, '1'],
+ ])('converts the declared %s percent outline opacity to the engine fraction', (percent, fraction) => {
+ const ops = buildPptxBatch([{ shapes: [{ line: '#112233', lineOpacity: percent }] }]);
+ expect(ops[1].props).toEqual({ line: '#112233', lineOpacity: fraction });
+ });
+
+ it.each([-1, 101, Number.POSITIVE_INFINITY, Number.NaN])('does not normalize invalid outline opacity %s into a valid value', (value) => {
+ const ops = buildPptxBatch([{ shapes: [{ line: '#112233', lineOpacity: value }] }]);
+ expect(ops[1].props.lineOpacity).toBe(String(value));
+ });
+
it('normalizes the legacy outer shadow preset to OfficeCLI default shadow', () => {
const ops = buildPptxBatch([{
shapes: [