Skip to content

Commit 6bdc9df

Browse files
cemreyukselclaude
andcommitted
feat: update AI action invocation variable types to sys-nested format
Reference variables now use the standard sys-nested link structure with type, linkType, id, optional release, and optional entityPaths inside sys, instead of flat entityId/entityType/entityPath(s) properties. Extracts AiActionInvocationVariable as a reusable exported type. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 5f3e49c commit 6bdc9df

3 files changed

Lines changed: 51 additions & 23 deletions

File tree

lib/common-types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ import type { AiActionProps, AiActionQueryOptions, CreateAiActionProps } from '.
193193
import type {
194194
AiActionInvocationProps,
195195
AiActionInvocationType,
196+
AiActionInvocationVariable,
196197
} from './entities/ai-action-invocation'
197198
import type { AgentGeneratePayload, AgentProps } from './entities/agent'
198199
import type {

lib/entities/ai-action-invocation.ts

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -49,30 +49,53 @@ export type AiActionInvocationProps = {
4949
result?: InvocationResult
5050
}
5151

52+
export type AiActionTextVariable = {
53+
id: string
54+
value: string
55+
}
56+
57+
export type AiActionEntityLinkVariable = {
58+
id: string
59+
value: {
60+
sys: {
61+
type: 'Link'
62+
linkType: 'Entry' | 'Asset' | 'ResourceLink'
63+
id: string
64+
release?: SysLink
65+
entityPaths?: Array<string>
66+
}
67+
}
68+
}
69+
70+
/** @deprecated Use `AiActionEntityLinkVariable` with the sys-nested format instead. */
71+
export type AiActionLegacyEntityPathVariable = {
72+
id: string
73+
value: {
74+
entityPath: string
75+
entityType: 'Entry' | 'Asset' | 'ResourceLink'
76+
entityId: string
77+
}
78+
}
79+
80+
/** @deprecated Use `AiActionEntityLinkVariable` with the sys-nested format instead. */
81+
export type AiActionLegacyEntityPathsVariable = {
82+
id: string
83+
value: {
84+
entityPaths: Array<string>
85+
entityType: 'Entry'
86+
entityId: string
87+
}
88+
}
89+
90+
export type AiActionInvocationVariable =
91+
| AiActionTextVariable
92+
| AiActionEntityLinkVariable
93+
| AiActionLegacyEntityPathVariable
94+
| AiActionLegacyEntityPathsVariable
95+
5296
export type AiActionInvocationType = {
5397
outputFormat?: 'RichText' | 'Markdown' | 'PlainText'
54-
variables?: Array<
55-
| {
56-
value: string
57-
id: string
58-
}
59-
| {
60-
value: {
61-
entityPath: string
62-
entityType: 'Entry' | 'Asset' | 'ResourceLink'
63-
entityId: string
64-
}
65-
id: string
66-
}
67-
| {
68-
value: {
69-
entityPaths: Array<string>
70-
entityType: 'Entry'
71-
entityId: string
72-
}
73-
id: string
74-
}
75-
>
98+
variables?: Array<AiActionInvocationVariable>
7699
}
77100

78101
/**

lib/export-types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ export type {
1313
CreateAppAccessTokenProps,
1414
} from './entities/app-access-token'
1515
export type { AiAction, AiActionProps, CreateAiActionProps } from './entities/ai-action'
16-
export type { AiActionInvocation, AiActionInvocationProps } from './entities/ai-action-invocation'
16+
export type {
17+
AiActionInvocation,
18+
AiActionInvocationProps,
19+
AiActionInvocationVariable,
20+
} from './entities/ai-action-invocation'
1721
export type { Agent, AgentGeneratePayload, AgentProps, AgentToolLink } from './entities/agent'
1822
export type {
1923
AgentGenerateResponse,

0 commit comments

Comments
 (0)