Skip to content

Commit bf935ec

Browse files
committed
Add assets config key support for UI extension points
1 parent d5b7839 commit bf935ec

4 files changed

Lines changed: 18 additions & 1 deletion

File tree

packages/app/src/cli/models/extensions/schemas.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ const NewExtensionPointSchema = zod.object({
7575
chat: zod.string().optional(),
7676
})
7777
.optional(),
78+
assets: zod.string().optional(),
7879
})
7980

8081
export const NewExtensionPointsSchema = zod.array(NewExtensionPointSchema)

packages/app/src/cli/models/extensions/specifications/ui_extension.test.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ describe('ui_extension', async () => {
151151
tools: undefined,
152152
instructions: undefined,
153153
intents: undefined,
154+
assets: undefined,
154155
module: './src/ExtensionPointA.js',
155156
metafields: [{namespace: 'test', key: 'test'}],
156157
default_placement_reference: undefined,
@@ -219,6 +220,7 @@ describe('ui_extension', async () => {
219220
tools: undefined,
220221
instructions: undefined,
221222
intents: undefined,
223+
assets: undefined,
222224
module: './src/ExtensionPointA.js',
223225
metafields: [],
224226
default_placement_reference: 'PLACEMENT_REFERENCE1',
@@ -283,6 +285,7 @@ describe('ui_extension', async () => {
283285
tools: undefined,
284286
instructions: undefined,
285287
intents: undefined,
288+
assets: undefined,
286289
module: './src/ExtensionPointA.js',
287290
metafields: [],
288291
urls: {},
@@ -347,6 +350,7 @@ describe('ui_extension', async () => {
347350
tools: undefined,
348351
instructions: undefined,
349352
intents: undefined,
353+
assets: undefined,
350354
module: './src/ExtensionPointA.js',
351355
metafields: [],
352356
default_placement_reference: undefined,
@@ -414,6 +418,7 @@ describe('ui_extension', async () => {
414418
tools: undefined,
415419
instructions: undefined,
416420
intents: undefined,
421+
assets: undefined,
417422
module: './src/ExtensionPointA.js',
418423
metafields: [],
419424
default_placement_reference: undefined,
@@ -483,6 +488,7 @@ describe('ui_extension', async () => {
483488
tools: undefined,
484489
instructions: undefined,
485490
intents: undefined,
491+
assets: undefined,
486492
module: './src/ExtensionPointA.js',
487493
metafields: [],
488494
default_placement_reference: undefined,
@@ -552,6 +558,7 @@ describe('ui_extension', async () => {
552558
tools: './tools.json',
553559
instructions: undefined,
554560
intents: undefined,
561+
assets: undefined,
555562
metafields: [],
556563
default_placement_reference: undefined,
557564
capabilities: undefined,
@@ -616,6 +623,7 @@ describe('ui_extension', async () => {
616623
tools: undefined,
617624
instructions: './instructions.md',
618625
intents: undefined,
626+
assets: undefined,
619627
metafields: [],
620628
default_placement_reference: undefined,
621629
capabilities: undefined,
@@ -779,6 +787,7 @@ Please check the configuration in ${uiExtension.configurationPath}`),
779787
tools: './tools.json',
780788
instructions: './instructions.md',
781789
intents: undefined,
790+
assets: undefined,
782791
metafields: [],
783792
default_placement_reference: undefined,
784793
capabilities: undefined,

packages/app/src/cli/models/extensions/specifications/ui_extension.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export const UIExtensionSchema = BaseSchema.extend({
7474
tools: targeting.tools,
7575
instructions: targeting.instructions,
7676
intents: targeting.intents,
77+
assets: targeting.assets,
7778
}
7879
})
7980
return {...config, extension_points: extensionPoints}
@@ -119,6 +120,12 @@ const uiExtensionSpec = createExtensionSpecification({
119120
groupBy: 'target',
120121
key: 'extension_points[].intents[].schema',
121122
},
123+
{
124+
type: 'configKey',
125+
anchor: 'extension_points[]',
126+
groupBy: 'target',
127+
key: 'extension_points[].assets',
128+
},
122129
],
123130
},
124131
},

packages/app/src/cli/services/dev/extension/payload/models.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ interface Asset {
3939
lastUpdated: number
4040
}
4141

42-
export interface DevNewExtensionPointSchema extends Omit<NewExtensionPointSchemaType, 'intents'> {
42+
export interface DevNewExtensionPointSchema extends Omit<NewExtensionPointSchemaType, 'intents' | 'assets'> {
4343
assets: {
4444
[name: string]: Asset
4545
}

0 commit comments

Comments
 (0)