From 19274265957a2b8bc9382f018e5570ffd759d409 Mon Sep 17 00:00:00 2001 From: bgutsol Date: Wed, 16 Jul 2025 12:37:50 +0200 Subject: [PATCH 1/5] feat: enhance AiAction types with new output formats and suggestion blocks - Added 'Suggestion' to AiActionOutputFormat. - Introduced AiActionMarkdownBlock and AiActionSuggestionBlock types. - Updated InvocationResult to support an array of AiActionSuggestionContentBlock. --- lib/entities/ai-action-invocation.ts | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/lib/entities/ai-action-invocation.ts b/lib/entities/ai-action-invocation.ts index 2aa39dcea6..e29ad9a882 100644 --- a/lib/entities/ai-action-invocation.ts +++ b/lib/entities/ai-action-invocation.ts @@ -12,10 +12,11 @@ export const AiActionOutputFormat = { RichText: 'RichText', Markdown: 'Markdown', PlainText: 'PlainText', + Suggestion: 'Suggestion', } as const export type AiActionOutputFormatType = - (typeof AiActionOutputFormat)[keyof typeof AiActionOutputFormat] + typeof AiActionOutputFormat[keyof typeof AiActionOutputFormat] export type AiActionInvocationMetadata = { invocationResult?: { @@ -30,8 +31,25 @@ export type AiActionInvocationMetadata = { }[] } +export type AiActionMarkdownBlock = { + type: 'MarkdownBlock' + text: string +} + +export type AiActionSuggestionBlock = { + type: 'SuggestionBlock' + format: 'Text' + fieldId: string + original: string + suggested: string + reason?: string + confidence: number +} + +export type AiActionSuggestionContentBlock = AiActionMarkdownBlock | AiActionSuggestionBlock + export interface InvocationResult { - content: string | RichTextDocument + content: string | RichTextDocument | AiActionSuggestionContentBlock[] type: InvocationResultType metadata: AiActionInvocationMetadata } @@ -50,7 +68,7 @@ export type AiActionInvocationProps = { } export type AiActionInvocationType = { - outputFormat: 'RichText' | 'Markdown' | 'PlainText' + outputFormat: AiActionOutputFormatType variables?: Array< | { value: string From d7dd1136a0904e4faf1230eba23fbc9e69353136 Mon Sep 17 00:00:00 2001 From: bgutsol Date: Wed, 16 Jul 2025 12:38:23 +0200 Subject: [PATCH 2/5] feat: introduce AiActionScope and AiActionOutputType for enhanced action configurations - Added AiActionScope with 'Entry' and 'EntryField' options. - Introduced AiActionOutputType with 'Generation' and 'Suggestion' types. - Updated Configuration type to include optional scope and outputType properties. --- lib/entities/ai-action.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/entities/ai-action.ts b/lib/entities/ai-action.ts index 7014a5e2c3..87fd2a7610 100644 --- a/lib/entities/ai-action.ts +++ b/lib/entities/ai-action.ts @@ -37,6 +37,18 @@ export type Variable = { id: string } +export const AiActionScope = { + Entry: 'Entry', + EntryField: 'EntryField', +} as const +export type AiActionScopeType = typeof AiActionScope[keyof typeof AiActionScope] + +export const AiActionOutputType = { + Generation: 'Generation', + Suggestion: 'Suggestion', +} as const +export type AiActionOutputTypeType = typeof AiActionOutputType[keyof typeof AiActionOutputType] + export type Instruction = { variables: Array template: string @@ -45,6 +57,8 @@ export type Instruction = { export type Configuration = { modelType: string modelTemperature: number + scope?: AiActionScopeType + outputType?: AiActionOutputTypeType } export type AiActionTestCase = From 559a1f199fae31c4cb981ed6e881d0ab60d9de12 Mon Sep 17 00:00:00 2001 From: bgutsol Date: Wed, 16 Jul 2025 12:42:03 +0200 Subject: [PATCH 3/5] refactor: rename AI action types for clarity and consistency --- lib/entities/ai-action.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/entities/ai-action.ts b/lib/entities/ai-action.ts index 87fd2a7610..7f77c90ab8 100644 --- a/lib/entities/ai-action.ts +++ b/lib/entities/ai-action.ts @@ -9,7 +9,7 @@ import { type AiActionInvocation, } from './ai-action-invocation' -export type VariableType = +export type AiActionVariableType = | 'ResourceLink' | 'Text' | 'StandardInput' @@ -18,22 +18,22 @@ export type VariableType = | 'Reference' | 'SmartContext' -export type ReferenceVariableConfiguration = { +export type AiActionReferenceVariableConfiguration = { allowedEntities: Array<'Entry'> } -export type VariableConfiguration = +export type AiActionVariableConfiguration = | { strict: boolean in: Array } - | ReferenceVariableConfiguration + | AiActionReferenceVariableConfiguration -export type Variable = { - configuration?: VariableConfiguration +export type AiActionVariable = { + configuration?: AiActionVariableConfiguration description?: string name?: string - type: VariableType + type: AiActionVariableType id: string } @@ -49,12 +49,12 @@ export const AiActionOutputType = { } as const export type AiActionOutputTypeType = typeof AiActionOutputType[keyof typeof AiActionOutputType] -export type Instruction = { - variables: Array +export type AiActionInstruction = { + variables: Array template: string } -export type Configuration = { +export type AiActionConfiguration = { modelType: string modelTemperature: number scope?: AiActionScopeType @@ -97,8 +97,8 @@ export type AiActionProps = { } name: string description: string - configuration: Configuration - instruction: Instruction + configuration: AiActionConfiguration + instruction: AiActionInstruction testCases?: Array } From 37035b661bb5b93ce1edf7de578d468132e104a2 Mon Sep 17 00:00:00 2001 From: bgutsol Date: Wed, 16 Jul 2025 12:59:31 +0200 Subject: [PATCH 4/5] fix: prettier --- lib/entities/ai-action-invocation.ts | 2 +- lib/entities/ai-action.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/entities/ai-action-invocation.ts b/lib/entities/ai-action-invocation.ts index e29ad9a882..96aef8fcec 100644 --- a/lib/entities/ai-action-invocation.ts +++ b/lib/entities/ai-action-invocation.ts @@ -16,7 +16,7 @@ export const AiActionOutputFormat = { } as const export type AiActionOutputFormatType = - typeof AiActionOutputFormat[keyof typeof AiActionOutputFormat] + (typeof AiActionOutputFormat)[keyof typeof AiActionOutputFormat] export type AiActionInvocationMetadata = { invocationResult?: { diff --git a/lib/entities/ai-action.ts b/lib/entities/ai-action.ts index 7f77c90ab8..3f6b698907 100644 --- a/lib/entities/ai-action.ts +++ b/lib/entities/ai-action.ts @@ -41,13 +41,13 @@ export const AiActionScope = { Entry: 'Entry', EntryField: 'EntryField', } as const -export type AiActionScopeType = typeof AiActionScope[keyof typeof AiActionScope] +export type AiActionScopeType = (typeof AiActionScope)[keyof typeof AiActionScope] export const AiActionOutputType = { Generation: 'Generation', Suggestion: 'Suggestion', } as const -export type AiActionOutputTypeType = typeof AiActionOutputType[keyof typeof AiActionOutputType] +export type AiActionOutputTypeType = (typeof AiActionOutputType)[keyof typeof AiActionOutputType] export type AiActionInstruction = { variables: Array From ec37cb53a3405d90e2653e52fa2ceab368fc9527 Mon Sep 17 00:00:00 2001 From: cemreyuksel Date: Mon, 28 Jul 2025 14:21:12 +0200 Subject: [PATCH 5/5] chore: rename generation to transform --- lib/entities/ai-action.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/entities/ai-action.ts b/lib/entities/ai-action.ts index 3f6b698907..ffd218a9ca 100644 --- a/lib/entities/ai-action.ts +++ b/lib/entities/ai-action.ts @@ -44,7 +44,7 @@ export const AiActionScope = { export type AiActionScopeType = (typeof AiActionScope)[keyof typeof AiActionScope] export const AiActionOutputType = { - Generation: 'Generation', + Transform: 'Transform', Suggestion: 'Suggestion', } as const export type AiActionOutputTypeType = (typeof AiActionOutputType)[keyof typeof AiActionOutputType]