oft-agt 0.5.17 → 0.5.18
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/compile-plan.mjs +10 -6
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/runtime/version.mjs +1 -1
- package/version.mjs +1 -1
package/compile-plan.mjs
CHANGED
|
@@ -134,7 +134,7 @@ export function compile(input) {
|
|
|
134
134
|
|
|
135
135
|
if (next.has(edge.source)) fail(`/${name}/${edge.source} : plusieurs sorties ne sont pas encore prises en charge. Reliez les actions en séquence.`);
|
|
136
136
|
|
|
137
|
-
|
|
137
|
+
|
|
138
138
|
|
|
139
139
|
next.set(edge.source, edge.target);
|
|
140
140
|
|
|
@@ -153,7 +153,9 @@ export function compile(input) {
|
|
|
153
153
|
}
|
|
154
154
|
const visited = new Set(options.map(option => option.id));
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
let expanded = 0;
|
|
157
|
+
function compilePath(rootId, inheritedMessages = new Set(), inheritedWait = 0, depth = 0, ancestry = new Set()) {
|
|
158
|
+
const path = new Set(ancestry);
|
|
157
159
|
|
|
158
160
|
if (depth > 32) fail(`/${name} : conditions imbriquées trop profondément (32 maximum).`);
|
|
159
161
|
|
|
@@ -167,7 +169,9 @@ export function compile(input) {
|
|
|
167
169
|
|
|
168
170
|
while (current) {
|
|
169
171
|
|
|
170
|
-
if (
|
|
172
|
+
if (path.has(current)) fail(`/${name} : boucle détectée.`);
|
|
173
|
+
path.add(current);
|
|
174
|
+
if (++expanded > 10000) fail(`/${name} : parcours trop complexe (10 000 étapes maximum).`);
|
|
171
175
|
|
|
172
176
|
visited.add(current);
|
|
173
177
|
|
|
@@ -185,7 +189,7 @@ export function compile(input) {
|
|
|
185
189
|
|
|
186
190
|
const rules = conditionConfigs.get(current).rules;
|
|
187
191
|
|
|
188
|
-
calls.push({ id: current, fn: 'condition', args: { kind: block.type, rules }, branches: rules.map(rule => ({ id: branches.get(rule.id), ruleId: rule.id, calls: compilePath(branches.get(rule.id), emittedMessages, waitBudget, depth + 1) })), otherwise: { id: branches.get('else'), calls: compilePath(branches.get('else'), emittedMessages, waitBudget, depth + 1) } });
|
|
192
|
+
calls.push({ id: current, fn: 'condition', args: { kind: block.type, rules }, branches: rules.map(rule => ({ id: branches.get(rule.id), ruleId: rule.id, calls: compilePath(branches.get(rule.id), emittedMessages, waitBudget, depth + 1, path) })), otherwise: { id: branches.get('else'), calls: compilePath(branches.get('else'), emittedMessages, waitBudget, depth + 1, path) } });
|
|
189
193
|
|
|
190
194
|
} else if (isVariableBlock(block.type)) {
|
|
191
195
|
fn = block.type; args = validateVariableBlock(block.type, config, variableDefinitions);
|
|
@@ -246,8 +250,8 @@ export function compile(input) {
|
|
|
246
250
|
if(children.length) args.buttons=children.map(child=>({id:child.id,config:validateButton(child.config)}));
|
|
247
251
|
for(const child of children){
|
|
248
252
|
const config=validateButton(child.config);
|
|
249
|
-
const childCalls=compilePath(child.id,emittedMessages,0,depth+1);
|
|
250
|
-
buttonBranches.push({id:child.id,parentId:current,config,calls:childCalls});
|
|
253
|
+
const childCalls=compilePath(child.id,emittedMessages,0,depth+1,path);
|
|
254
|
+
if (!buttonBranches.some(branch => branch.id === child.id)) buttonBranches.push({id:child.id,parentId:current,config,calls:childCalls});
|
|
251
255
|
}
|
|
252
256
|
|
|
253
257
|
} else if (block.type === 'apiRequest') { fn='apiRequest'; args=validateApiRequest(config); if([...blocks.values()].some(b=>b.id!==block.id&&b.type==='apiRequest'&&b.config?.name===args.name))fail('Chaque requête API doit avoir un nom unique.');
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oft-agt",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.18",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "oft-agt",
|
|
9
|
-
"version": "0.5.
|
|
9
|
+
"version": "0.5.18",
|
|
10
10
|
"license": "UNLICENSED",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"discord.js": "^14.14.0",
|
package/package.json
CHANGED
package/runtime/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const RUNTIME_VERSION = '0.5.
|
|
1
|
+
export const RUNTIME_VERSION = '0.5.18';
|
package/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_VERSION = '0.5.
|
|
1
|
+
export const AGENT_VERSION = '0.5.18';
|