@elevasis/core 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/src/operations/public-agent-chat/__tests__/api-schemas.test.ts +104 -0
- package/src/operations/public-agent-chat/api-schemas.ts +22 -1
- package/src/operations/public-agent-chat/index.ts +3 -1
- package/src/platform/constants/versions.ts +1 -1
- package/src/platform/registry/__tests__/resource-registry.integration.test.ts +1010 -1013
- package/src/platform/registry/serialization.ts +296 -295
|
@@ -1,295 +1,296 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Registry Serialization Utilities
|
|
3
|
-
*
|
|
4
|
-
* Pre-serialization logic for ResourceRegistry.
|
|
5
|
-
* Converts resource definitions to JSON-safe structures at startup.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import type { DeploymentSpec } from './resource-registry'
|
|
9
|
-
import type { ResourceDefinition } from './types'
|
|
10
|
-
import type { ResourceEntry } from '../../organization-model/domains/resources'
|
|
11
|
-
import type { SystemEntry } from '../../organization-model/domains/systems'
|
|
12
|
-
import type {
|
|
13
|
-
SerializedOrganizationData,
|
|
14
|
-
SerializedAgentDefinition,
|
|
15
|
-
SerializedWorkflowDefinition,
|
|
16
|
-
CommandViewAgent,
|
|
17
|
-
CommandViewWorkflow,
|
|
18
|
-
CommandViewEdge
|
|
19
|
-
} from './serialized-types'
|
|
20
|
-
import { serializeDefinition } from '../../execution/engine/base/serialization'
|
|
21
|
-
|
|
22
|
-
function summarizeSystem(system: SystemEntry | undefined): ResourceDefinition['system'] {
|
|
23
|
-
if (!system) return undefined
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
id: system.id,
|
|
27
|
-
title: system.label ?? system.title,
|
|
28
|
-
description: system.description,
|
|
29
|
-
kind: system.kind,
|
|
30
|
-
lifecycle: system.lifecycle
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function createGovernanceMetadataResolver(resources: DeploymentSpec) {
|
|
35
|
-
const resourcesById = new Map(Object.values(resources.organizationModel?.resources ?? {}).map((r) => [r.id, r]))
|
|
36
|
-
const systemsById = new Map(Object.values(resources.organizationModel?.systems ?? {}).map((s) => [s.id, s]))
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
resourceId: string,
|
|
40
|
-
descriptor: ResourceEntry | undefined
|
|
41
|
-
): Pick<ResourceDefinition, 'systemPath' | 'system' | 'governanceStatus'> => {
|
|
42
|
-
const resource = descriptor ?? resourcesById.get(resourceId)
|
|
43
|
-
if (!resource) return {}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
systemPath: resource.systemPath,
|
|
47
|
-
system: summarizeSystem(systemsById.get(resource.systemPath)),
|
|
48
|
-
governanceStatus: resource.status
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Serialize all organization resources
|
|
55
|
-
* Called once during ResourceRegistry construction
|
|
56
|
-
*/
|
|
57
|
-
export function serializeAllOrganizations(
|
|
58
|
-
registry: Record<string, DeploymentSpec>
|
|
59
|
-
): Map<string, SerializedOrganizationData> {
|
|
60
|
-
const cache = new Map<string, SerializedOrganizationData>()
|
|
61
|
-
for (const [orgName, resources] of Object.entries(registry)) {
|
|
62
|
-
cache.set(orgName, serializeOrganization(resources))
|
|
63
|
-
}
|
|
64
|
-
return cache
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* Serialize single organization's resources
|
|
69
|
-
*/
|
|
70
|
-
export function serializeOrganization(resources: DeploymentSpec): SerializedOrganizationData {
|
|
71
|
-
const getGovernanceMetadata = createGovernanceMetadataResolver(resources)
|
|
72
|
-
|
|
73
|
-
// Serialize workflows
|
|
74
|
-
const workflowDefinitions = new Map<string, SerializedWorkflowDefinition>()
|
|
75
|
-
const workflowResources: ResourceDefinition[] = []
|
|
76
|
-
const commandViewWorkflows: CommandViewWorkflow[] = []
|
|
77
|
-
|
|
78
|
-
for (const workflow of resources.workflows ?? []) {
|
|
79
|
-
const resourceId = workflow.config.resourceId
|
|
80
|
-
const serialized = serializeDefinition(workflow) as SerializedWorkflowDefinition
|
|
81
|
-
workflowDefinitions.set(resourceId, serialized)
|
|
82
|
-
|
|
83
|
-
workflowResources.push({
|
|
84
|
-
resourceId,
|
|
85
|
-
name: workflow.config.name,
|
|
86
|
-
description: workflow.config.description,
|
|
87
|
-
version: workflow.config.version,
|
|
88
|
-
type: 'workflow',
|
|
89
|
-
status: workflow.config.status,
|
|
90
|
-
links: workflow.config.links,
|
|
91
|
-
category: workflow.config.category,
|
|
92
|
-
...getGovernanceMetadata(resourceId, workflow.config.resource)
|
|
93
|
-
})
|
|
94
|
-
|
|
95
|
-
commandViewWorkflows.push({
|
|
96
|
-
resourceId,
|
|
97
|
-
name: workflow.config.name,
|
|
98
|
-
description: workflow.config.description,
|
|
99
|
-
version: workflow.config.version,
|
|
100
|
-
type: 'workflow',
|
|
101
|
-
status: workflow.config.status,
|
|
102
|
-
links: workflow.config.links,
|
|
103
|
-
category: workflow.config.category,
|
|
104
|
-
...getGovernanceMetadata(resourceId, workflow.config.resource),
|
|
105
|
-
stepCount: Object.keys(workflow.steps).length,
|
|
106
|
-
entryPoint: workflow.entryPoint
|
|
107
|
-
})
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
// Serialize agents
|
|
111
|
-
const agentDefinitions = new Map<string, SerializedAgentDefinition>()
|
|
112
|
-
const agentResources: ResourceDefinition[] = []
|
|
113
|
-
const commandViewAgents: CommandViewAgent[] = []
|
|
114
|
-
|
|
115
|
-
for (const agent of resources.agents ?? []) {
|
|
116
|
-
const resourceId = agent.config.resourceId
|
|
117
|
-
const serialized = serializeDefinition(agent) as SerializedAgentDefinition
|
|
118
|
-
agentDefinitions.set(resourceId, serialized)
|
|
119
|
-
|
|
120
|
-
agentResources.push({
|
|
121
|
-
resourceId,
|
|
122
|
-
name: agent.config.name,
|
|
123
|
-
description: agent.config.description,
|
|
124
|
-
version: agent.config.version,
|
|
125
|
-
type: 'agent',
|
|
126
|
-
status: agent.config.status,
|
|
127
|
-
links: agent.config.links,
|
|
128
|
-
category: agent.config.category,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
const
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
*
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Registry Serialization Utilities
|
|
3
|
+
*
|
|
4
|
+
* Pre-serialization logic for ResourceRegistry.
|
|
5
|
+
* Converts resource definitions to JSON-safe structures at startup.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { DeploymentSpec } from './resource-registry'
|
|
9
|
+
import type { ResourceDefinition } from './types'
|
|
10
|
+
import type { ResourceEntry } from '../../organization-model/domains/resources'
|
|
11
|
+
import type { SystemEntry } from '../../organization-model/domains/systems'
|
|
12
|
+
import type {
|
|
13
|
+
SerializedOrganizationData,
|
|
14
|
+
SerializedAgentDefinition,
|
|
15
|
+
SerializedWorkflowDefinition,
|
|
16
|
+
CommandViewAgent,
|
|
17
|
+
CommandViewWorkflow,
|
|
18
|
+
CommandViewEdge
|
|
19
|
+
} from './serialized-types'
|
|
20
|
+
import { serializeDefinition } from '../../execution/engine/base/serialization'
|
|
21
|
+
|
|
22
|
+
function summarizeSystem(system: SystemEntry | undefined): ResourceDefinition['system'] {
|
|
23
|
+
if (!system) return undefined
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
id: system.id,
|
|
27
|
+
title: system.label ?? system.title,
|
|
28
|
+
description: system.description,
|
|
29
|
+
kind: system.kind,
|
|
30
|
+
lifecycle: system.lifecycle
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function createGovernanceMetadataResolver(resources: DeploymentSpec) {
|
|
35
|
+
const resourcesById = new Map(Object.values(resources.organizationModel?.resources ?? {}).map((r) => [r.id, r]))
|
|
36
|
+
const systemsById = new Map(Object.values(resources.organizationModel?.systems ?? {}).map((s) => [s.id, s]))
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
resourceId: string,
|
|
40
|
+
descriptor: ResourceEntry | undefined
|
|
41
|
+
): Pick<ResourceDefinition, 'systemPath' | 'system' | 'governanceStatus'> => {
|
|
42
|
+
const resource = descriptor ?? resourcesById.get(resourceId)
|
|
43
|
+
if (!resource) return {}
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
systemPath: resource.systemPath,
|
|
47
|
+
system: summarizeSystem(systemsById.get(resource.systemPath)),
|
|
48
|
+
governanceStatus: resource.status
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Serialize all organization resources
|
|
55
|
+
* Called once during ResourceRegistry construction
|
|
56
|
+
*/
|
|
57
|
+
export function serializeAllOrganizations(
|
|
58
|
+
registry: Record<string, DeploymentSpec>
|
|
59
|
+
): Map<string, SerializedOrganizationData> {
|
|
60
|
+
const cache = new Map<string, SerializedOrganizationData>()
|
|
61
|
+
for (const [orgName, resources] of Object.entries(registry)) {
|
|
62
|
+
cache.set(orgName, serializeOrganization(resources))
|
|
63
|
+
}
|
|
64
|
+
return cache
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Serialize single organization's resources
|
|
69
|
+
*/
|
|
70
|
+
export function serializeOrganization(resources: DeploymentSpec): SerializedOrganizationData {
|
|
71
|
+
const getGovernanceMetadata = createGovernanceMetadataResolver(resources)
|
|
72
|
+
|
|
73
|
+
// Serialize workflows
|
|
74
|
+
const workflowDefinitions = new Map<string, SerializedWorkflowDefinition>()
|
|
75
|
+
const workflowResources: ResourceDefinition[] = []
|
|
76
|
+
const commandViewWorkflows: CommandViewWorkflow[] = []
|
|
77
|
+
|
|
78
|
+
for (const workflow of resources.workflows ?? []) {
|
|
79
|
+
const resourceId = workflow.config.resourceId
|
|
80
|
+
const serialized = serializeDefinition(workflow) as SerializedWorkflowDefinition
|
|
81
|
+
workflowDefinitions.set(resourceId, serialized)
|
|
82
|
+
|
|
83
|
+
workflowResources.push({
|
|
84
|
+
resourceId,
|
|
85
|
+
name: workflow.config.name,
|
|
86
|
+
description: workflow.config.description,
|
|
87
|
+
version: workflow.config.version,
|
|
88
|
+
type: 'workflow',
|
|
89
|
+
status: workflow.config.status,
|
|
90
|
+
links: workflow.config.links,
|
|
91
|
+
category: workflow.config.category,
|
|
92
|
+
...getGovernanceMetadata(resourceId, workflow.config.resource)
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
commandViewWorkflows.push({
|
|
96
|
+
resourceId,
|
|
97
|
+
name: workflow.config.name,
|
|
98
|
+
description: workflow.config.description,
|
|
99
|
+
version: workflow.config.version,
|
|
100
|
+
type: 'workflow',
|
|
101
|
+
status: workflow.config.status,
|
|
102
|
+
links: workflow.config.links,
|
|
103
|
+
category: workflow.config.category,
|
|
104
|
+
...getGovernanceMetadata(resourceId, workflow.config.resource),
|
|
105
|
+
stepCount: Object.keys(workflow.steps).length,
|
|
106
|
+
entryPoint: workflow.entryPoint
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Serialize agents
|
|
111
|
+
const agentDefinitions = new Map<string, SerializedAgentDefinition>()
|
|
112
|
+
const agentResources: ResourceDefinition[] = []
|
|
113
|
+
const commandViewAgents: CommandViewAgent[] = []
|
|
114
|
+
|
|
115
|
+
for (const agent of resources.agents ?? []) {
|
|
116
|
+
const resourceId = agent.config.resourceId
|
|
117
|
+
const serialized = serializeDefinition(agent) as SerializedAgentDefinition
|
|
118
|
+
agentDefinitions.set(resourceId, serialized)
|
|
119
|
+
|
|
120
|
+
agentResources.push({
|
|
121
|
+
resourceId,
|
|
122
|
+
name: agent.config.name,
|
|
123
|
+
description: agent.config.description,
|
|
124
|
+
version: agent.config.version,
|
|
125
|
+
type: 'agent',
|
|
126
|
+
status: agent.config.status,
|
|
127
|
+
links: agent.config.links,
|
|
128
|
+
category: agent.config.category,
|
|
129
|
+
sessionCapable: agent.config.sessionCapable ?? false,
|
|
130
|
+
...getGovernanceMetadata(resourceId, agent.config.resource)
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
commandViewAgents.push({
|
|
134
|
+
resourceId,
|
|
135
|
+
name: agent.config.name,
|
|
136
|
+
description: agent.config.description,
|
|
137
|
+
version: agent.config.version,
|
|
138
|
+
type: 'agent',
|
|
139
|
+
status: agent.config.status,
|
|
140
|
+
links: agent.config.links,
|
|
141
|
+
category: agent.config.category,
|
|
142
|
+
...getGovernanceMetadata(resourceId, agent.config.resource),
|
|
143
|
+
modelProvider: agent.modelConfig.provider,
|
|
144
|
+
modelId: agent.modelConfig.model,
|
|
145
|
+
toolCount: agent.tools.length,
|
|
146
|
+
hasKnowledgeMap: agent.knowledgeMap !== undefined,
|
|
147
|
+
hasMemory: agent.config.memoryPreferences !== undefined,
|
|
148
|
+
sessionCapable: agent.config.sessionCapable ?? false
|
|
149
|
+
})
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// Build edges from triggers and relationships
|
|
153
|
+
const edges = buildEdges(resources)
|
|
154
|
+
|
|
155
|
+
// Pass-through manifest data (already JSON-safe)
|
|
156
|
+
const triggers = resources.triggers ?? []
|
|
157
|
+
const integrations = resources.integrations ?? []
|
|
158
|
+
const externalResources = resources.externalResources ?? []
|
|
159
|
+
const humanCheckpoints = resources.humanCheckpoints ?? []
|
|
160
|
+
|
|
161
|
+
return {
|
|
162
|
+
version: resources.version,
|
|
163
|
+
resources: {
|
|
164
|
+
workflows: workflowResources,
|
|
165
|
+
agents: agentResources,
|
|
166
|
+
total: workflowResources.length + agentResources.length
|
|
167
|
+
},
|
|
168
|
+
definitions: {
|
|
169
|
+
workflows: workflowDefinitions,
|
|
170
|
+
agents: agentDefinitions
|
|
171
|
+
},
|
|
172
|
+
commandView: {
|
|
173
|
+
workflows: commandViewWorkflows,
|
|
174
|
+
agents: commandViewAgents,
|
|
175
|
+
triggers,
|
|
176
|
+
integrations,
|
|
177
|
+
externalResources,
|
|
178
|
+
humanCheckpoints,
|
|
179
|
+
edges
|
|
180
|
+
},
|
|
181
|
+
triggers,
|
|
182
|
+
integrations,
|
|
183
|
+
externalResources,
|
|
184
|
+
humanCheckpoints,
|
|
185
|
+
relationships: resources.relationships
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Build Command View edges from relationships
|
|
191
|
+
* NOTE: Trigger relationships are now declared in ResourceRelationships, not on TriggerDefinition
|
|
192
|
+
*/
|
|
193
|
+
export function buildEdges(resources: DeploymentSpec): CommandViewEdge[] {
|
|
194
|
+
const edges: CommandViewEdge[] = []
|
|
195
|
+
let edgeId = 0
|
|
196
|
+
|
|
197
|
+
// All relationship edges (triggers, agents, workflows can all declare relationships)
|
|
198
|
+
for (const [resourceId, declaration] of Object.entries(resources.relationships ?? {})) {
|
|
199
|
+
for (const agentId of declaration.triggers?.agents ?? []) {
|
|
200
|
+
edges.push({
|
|
201
|
+
id: `edge-${edgeId++}`,
|
|
202
|
+
source: resourceId,
|
|
203
|
+
target: agentId,
|
|
204
|
+
relationship: 'triggers'
|
|
205
|
+
})
|
|
206
|
+
}
|
|
207
|
+
for (const workflowId of declaration.triggers?.workflows ?? []) {
|
|
208
|
+
edges.push({
|
|
209
|
+
id: `edge-${edgeId++}`,
|
|
210
|
+
source: resourceId,
|
|
211
|
+
target: workflowId,
|
|
212
|
+
relationship: 'triggers'
|
|
213
|
+
})
|
|
214
|
+
}
|
|
215
|
+
for (const integrationId of declaration.uses?.integrations ?? []) {
|
|
216
|
+
edges.push({
|
|
217
|
+
id: `edge-${edgeId++}`,
|
|
218
|
+
source: resourceId,
|
|
219
|
+
target: integrationId,
|
|
220
|
+
relationship: 'uses'
|
|
221
|
+
})
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// External Resource edges (forward-only)
|
|
226
|
+
for (const external of resources.externalResources ?? []) {
|
|
227
|
+
// External -> Internal
|
|
228
|
+
for (const workflowId of external.triggers?.workflows ?? []) {
|
|
229
|
+
edges.push({
|
|
230
|
+
id: `edge-${edgeId++}`,
|
|
231
|
+
source: external.resourceId,
|
|
232
|
+
target: workflowId,
|
|
233
|
+
relationship: 'triggers'
|
|
234
|
+
})
|
|
235
|
+
}
|
|
236
|
+
for (const agentId of external.triggers?.agents ?? []) {
|
|
237
|
+
edges.push({
|
|
238
|
+
id: `edge-${edgeId++}`,
|
|
239
|
+
source: external.resourceId,
|
|
240
|
+
target: agentId,
|
|
241
|
+
relationship: 'triggers'
|
|
242
|
+
})
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// External -> Integration
|
|
246
|
+
for (const integrationId of external.uses?.integrations ?? []) {
|
|
247
|
+
edges.push({
|
|
248
|
+
id: `edge-${edgeId++}`,
|
|
249
|
+
source: external.resourceId,
|
|
250
|
+
target: integrationId,
|
|
251
|
+
relationship: 'uses'
|
|
252
|
+
})
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
// Human Checkpoint edges
|
|
257
|
+
for (const humanCheckpoint of resources.humanCheckpoints ?? []) {
|
|
258
|
+
// Agent/Workflow -> ApprovalPoint
|
|
259
|
+
for (const agentId of humanCheckpoint.requestedBy?.agents ?? []) {
|
|
260
|
+
edges.push({
|
|
261
|
+
id: `edge-${edgeId++}`,
|
|
262
|
+
source: agentId,
|
|
263
|
+
target: humanCheckpoint.resourceId,
|
|
264
|
+
relationship: 'approval'
|
|
265
|
+
})
|
|
266
|
+
}
|
|
267
|
+
for (const workflowId of humanCheckpoint.requestedBy?.workflows ?? []) {
|
|
268
|
+
edges.push({
|
|
269
|
+
id: `edge-${edgeId++}`,
|
|
270
|
+
source: workflowId,
|
|
271
|
+
target: humanCheckpoint.resourceId,
|
|
272
|
+
relationship: 'approval'
|
|
273
|
+
})
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// ApprovalPoint -> Agent/Workflow
|
|
277
|
+
for (const agentId of humanCheckpoint.routesTo?.agents ?? []) {
|
|
278
|
+
edges.push({
|
|
279
|
+
id: `edge-${edgeId++}`,
|
|
280
|
+
source: humanCheckpoint.resourceId,
|
|
281
|
+
target: agentId,
|
|
282
|
+
relationship: 'triggers'
|
|
283
|
+
})
|
|
284
|
+
}
|
|
285
|
+
for (const workflowId of humanCheckpoint.routesTo?.workflows ?? []) {
|
|
286
|
+
edges.push({
|
|
287
|
+
id: `edge-${edgeId++}`,
|
|
288
|
+
source: humanCheckpoint.resourceId,
|
|
289
|
+
target: workflowId,
|
|
290
|
+
relationship: 'triggers'
|
|
291
|
+
})
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
return edges
|
|
296
|
+
}
|