openyida 2026.11.15 → 2026.11.16
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/lib/agent/frozen-bundle.js +14 -6
- package/lib/agent/private-directory.js +5 -1
- package/lib/agent/runtime-catalog.json +12 -12
- package/lib/agent/stdio.js +5 -1
- package/lib/core/locales/en.js +8 -0
- package/lib/core/locales/zh.js +8 -0
- package/lib/integration/integration-api.js +29 -0
- package/lib/integration/integration-create.js +3 -0
- package/lib/integration/integration-update.js +2 -0
- package/lib/process/configure-process.js +2 -0
- package/lib/process/services/process-service.js +110 -0
- package/package.json +5 -5
- package/yida-skills/skills/yida-flow-node-config/SKILL.md +1 -1
- package/yida-skills/skills/yida-flow-node-config/references/control.md +9 -14
- package/yida-skills/skills/yida-integration/SKILL.md +5 -2
- package/yida-skills/skills/yida-integration/references/cli-options.md +1 -1
|
@@ -13,6 +13,11 @@ const MAX_FILE_BYTES = 256 * 1024 * 1024;
|
|
|
13
13
|
const MAX_BUNDLE_BYTES = 1024 * 1024 * 1024;
|
|
14
14
|
const MAX_FILES = 30000;
|
|
15
15
|
const MAX_BUNDLE_MANIFEST_BYTES = 16 * 1024 * 1024;
|
|
16
|
+
// Keep a bounded snapshot of small files between inventory and copying. The
|
|
17
|
+
// source is still revalidated before publication; large bundles remain bounded
|
|
18
|
+
// and spill to the existing reread-and-hash path.
|
|
19
|
+
const MAX_SNAPSHOT_BYTES = 32 * 1024 * 1024;
|
|
20
|
+
const MAX_SNAPSHOT_FILE_BYTES = 64 * 1024;
|
|
16
21
|
const PACKAGE_NAME = /^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/i;
|
|
17
22
|
|
|
18
23
|
// Retry only transient Windows publication locks; never remove a winner.
|
|
@@ -139,6 +144,7 @@ function materializeBundle(runtime, config, options = {}) {
|
|
|
139
144
|
const destinations = new Set();
|
|
140
145
|
const dependencySources = new Map();
|
|
141
146
|
let totalBytes = 0;
|
|
147
|
+
let snapshotBytes = 0;
|
|
142
148
|
let published = false;
|
|
143
149
|
let runtimePackage;
|
|
144
150
|
const nodeBytes = readRegularFile(config.node.executable, MAX_FILE_BYTES).bytes;
|
|
@@ -150,9 +156,9 @@ function materializeBundle(runtime, config, options = {}) {
|
|
|
150
156
|
const sha256 = digest(bytes);
|
|
151
157
|
files.push({ path: relative, size: bytes.length, sha256, mode });
|
|
152
158
|
// Inventory first. Reconnecting to the same content needs no staging copy.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
pendingFiles.push({ relative, source, bytes: source ?
|
|
159
|
+
const retain = source && bytes.length <= MAX_SNAPSHOT_FILE_BYTES && snapshotBytes + bytes.length <= MAX_SNAPSHOT_BYTES;
|
|
160
|
+
if (retain) {snapshotBytes += bytes.length;}
|
|
161
|
+
pendingFiles.push({ relative, source, bytes: !source || retain ? bytes : undefined, mode, sha256 });
|
|
156
162
|
}
|
|
157
163
|
function copyFile(source, target) {
|
|
158
164
|
const file = readRegularFile(source, MAX_FILE_BYTES);
|
|
@@ -284,16 +290,18 @@ function materializeBundle(runtime, config, options = {}) {
|
|
|
284
290
|
mkdirPrivateDirectories(pendingFiles.map(file => path.dirname(path.join(stage, file.relative))));
|
|
285
291
|
}
|
|
286
292
|
for (const file of pendingFiles) {
|
|
287
|
-
const bytes = file.
|
|
293
|
+
const bytes = file.bytes ?? readRegularFile(file.source, MAX_FILE_BYTES).bytes;
|
|
288
294
|
if (digest(bytes) !== file.sha256) {throw bundleError('AGENT_BUNDLE_SOURCE_CHANGED');}
|
|
289
295
|
const target = path.join(stage, file.relative);
|
|
290
296
|
if (process.platform !== 'win32') {fs.mkdirSync(path.dirname(target), { recursive: true, mode: 0o700 });}
|
|
291
297
|
fs.writeFileSync(target, bytes, { flag: 'wx', mode: file.mode });
|
|
292
|
-
|
|
298
|
+
// Windows applies the read-only attribute at exclusive creation.
|
|
299
|
+
// Unix needs chmod to correct restrictive umasks to the exact mode.
|
|
300
|
+
if (process.platform !== 'win32') {fs.chmodSync(target, file.mode);}
|
|
293
301
|
}
|
|
294
302
|
verifySources();
|
|
295
303
|
fs.writeFileSync(path.join(stage, 'bundle-manifest.json'), raw, { flag: 'wx', mode: 0o444 });
|
|
296
|
-
fs.chmodSync(path.join(stage, 'bundle-manifest.json'), 0o444);
|
|
304
|
+
if (process.platform !== 'win32') {fs.chmodSync(path.join(stage, 'bundle-manifest.json'), 0o444);}
|
|
297
305
|
verifyBundle(stage, id);
|
|
298
306
|
sealDirectories(stage, false);
|
|
299
307
|
try {publishBundle(stage, root); published = true;}
|
|
@@ -36,6 +36,10 @@ function mkdirPrivateDirectories(directories) {
|
|
|
36
36
|
}
|
|
37
37
|
const missing = [...pending];
|
|
38
38
|
if (!missing.length) {return;}
|
|
39
|
+
// A frozen bundle can contain hundreds of directories. Budget the batch,
|
|
40
|
+
// including ACL verification, instead of giving it a single-directory limit.
|
|
41
|
+
// Keep an upper bound so a stalled PowerShell process still terminates.
|
|
42
|
+
const timeout = Math.min(120000, 15000 + missing.length * 100);
|
|
39
43
|
const script = `
|
|
40
44
|
$ErrorActionPreference = 'Stop'
|
|
41
45
|
$reader = [System.IO.StreamReader]::new([Console]::OpenStandardInput(), [System.Text.Encoding]::UTF8)
|
|
@@ -70,7 +74,7 @@ foreach ($directory in ($reader.ReadToEnd() | ConvertFrom-Json)) {
|
|
|
70
74
|
try {
|
|
71
75
|
execFileSync(path.join(process.env.SystemRoot || 'C:\\Windows', 'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe'),
|
|
72
76
|
['-NoProfile', '-NonInteractive', '-Command', script], {
|
|
73
|
-
windowsHide: true, timeout
|
|
77
|
+
windowsHide: true, timeout, stdio: 'pipe',
|
|
74
78
|
// Stdin avoids Windows environment-variable size limits for full bundles.
|
|
75
79
|
input: JSON.stringify(missing),
|
|
76
80
|
});
|
|
@@ -13,33 +13,33 @@
|
|
|
13
13
|
"platform": "darwin",
|
|
14
14
|
"arch": "arm64",
|
|
15
15
|
"packageName": "@openyida/local-agent-runtime-darwin-arm64",
|
|
16
|
-
"packageVersion": "0.1.
|
|
17
|
-
"runtimeVersion": "0.1.
|
|
18
|
-
"manifestSha256": "
|
|
16
|
+
"packageVersion": "0.1.8",
|
|
17
|
+
"runtimeVersion": "0.1.8",
|
|
18
|
+
"manifestSha256": "2c941c8b267071b0e3810cab5fe08c5121e3abed3515be45c9803979a76e3642"
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
"platform": "darwin",
|
|
22
22
|
"arch": "x64",
|
|
23
23
|
"packageName": "@openyida/local-agent-runtime-darwin-x64",
|
|
24
|
-
"packageVersion": "0.1.
|
|
25
|
-
"runtimeVersion": "0.1.
|
|
26
|
-
"manifestSha256": "
|
|
24
|
+
"packageVersion": "0.1.8",
|
|
25
|
+
"runtimeVersion": "0.1.8",
|
|
26
|
+
"manifestSha256": "1f821bf10cad55769890d075cb16fb6dfe3add1f7e0692a29a0d094a486b4f44"
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
29
|
"platform": "win32",
|
|
30
30
|
"arch": "x64",
|
|
31
31
|
"packageName": "@openyida/local-agent-runtime-win32-x64",
|
|
32
|
-
"packageVersion": "0.1.
|
|
33
|
-
"runtimeVersion": "0.1.
|
|
34
|
-
"manifestSha256": "
|
|
32
|
+
"packageVersion": "0.1.8",
|
|
33
|
+
"runtimeVersion": "0.1.8",
|
|
34
|
+
"manifestSha256": "2c2a03b3b889e66eb6d13ec1ccd68f820ef1cb29a911463887a58c55c50431c2"
|
|
35
35
|
},
|
|
36
36
|
{
|
|
37
37
|
"platform": "win32",
|
|
38
38
|
"arch": "arm64",
|
|
39
39
|
"packageName": "@openyida/local-agent-runtime-win32-arm64",
|
|
40
|
-
"packageVersion": "0.1.
|
|
41
|
-
"runtimeVersion": "0.1.
|
|
42
|
-
"manifestSha256": "
|
|
40
|
+
"packageVersion": "0.1.8",
|
|
41
|
+
"runtimeVersion": "0.1.8",
|
|
42
|
+
"manifestSha256": "e7f05ef2c7edbe39616d4c7939a1b7e913dc47eab485e788c174e5273499629c"
|
|
43
43
|
}
|
|
44
44
|
]
|
|
45
45
|
}
|
package/lib/agent/stdio.js
CHANGED
|
@@ -12,6 +12,10 @@ const { t } = require('../core/i18n');
|
|
|
12
12
|
const MAX_CONFIG_BYTES = 64 * 1024;
|
|
13
13
|
const MAX_OUTPUT_LINE_BYTES = 256 * 1024;
|
|
14
14
|
const BACKGROUND_LOG_NAME = 'agent-run.log';
|
|
15
|
+
// Windows file-open and endpoint-protection latency can keep full bundle
|
|
16
|
+
// verification busy for several minutes. Keep a finite startup deadline, but
|
|
17
|
+
// do not kill a healthy daemon before it can verify its bundle and providers.
|
|
18
|
+
const BACKGROUND_STARTUP_TIMEOUT_MS = process.platform === 'win32' ? 300000 : 60000;
|
|
15
19
|
const ENV_KEYS = [
|
|
16
20
|
'USERPROFILE', 'DBUS_SESSION_BUS_ADDRESS', 'XDG_RUNTIME_DIR', 'HOME', 'USER', 'LOGNAME', 'SHELL', 'PATH', 'TMPDIR', 'TMP', 'TEMP',
|
|
17
21
|
'SystemRoot', 'SYSTEMROOT', 'COMSPEC', 'PATHEXT', 'APPDATA', 'LOCALAPPDATA',
|
|
@@ -323,7 +327,7 @@ function launchBackgroundRuntime(runtime, config, options = {}) {
|
|
|
323
327
|
} finally { if (fd !== undefined) {fs.closeSync(fd);} }
|
|
324
328
|
};
|
|
325
329
|
const pollTimer = setInterval(checkReady, 50);
|
|
326
|
-
const startupTimer = setTimeout(() => fail('AGENT_RUNTIME_START_TIMEOUT'), options.startupTimeoutMs ??
|
|
330
|
+
const startupTimer = setTimeout(() => fail('AGENT_RUNTIME_START_TIMEOUT'), options.startupTimeoutMs ?? BACKGROUND_STARTUP_TIMEOUT_MS);
|
|
327
331
|
if (child.stdin) {
|
|
328
332
|
child.stdin.on('error', () => fail('AGENT_RUNTIME_START_FAILED'));
|
|
329
333
|
child.stdin.end(`${payload}\n`);
|
package/lib/core/locales/en.js
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
+
workflow_cycle: {
|
|
8
|
+
invalid: 'The loop definition is incomplete or exceeds the limit of one loop and five counted nodes per automation.',
|
|
9
|
+
node_unavailable: 'OpenYida does not support {0} inside this loop. Move it outside the loop or check available nodes in the YiDA designer.',
|
|
10
|
+
unavailable: 'Loop containers are unavailable in this YiDA scenario. Check availability in the target app designer.',
|
|
11
|
+
unverified: 'Could not verify loop access or node configuration for this organization. Check the signed-in organization and try again.',
|
|
12
|
+
entitlement_required: 'This organization lacks access to loop containers. Ask an organization administrator to review plans and upgrade on the official YiDA site: {0}',
|
|
13
|
+
published_unverified: 'Could not verify the published automation. Check its publication status in the YiDA designer and try again.',
|
|
14
|
+
},
|
|
7
15
|
issue_fixes: {
|
|
8
16
|
invalid_api_key: 'API Key configuration requires a valid name and header/query location; inspect the connector definition first.',
|
|
9
17
|
repair_required: 'Legacy API Key configuration lacks type/in/location. Add --repair-api-key-scheme to explicitly repair the connector and create a new account.',
|
package/lib/core/locales/zh.js
CHANGED
|
@@ -4,6 +4,14 @@
|
|
|
4
4
|
'use strict';
|
|
5
5
|
|
|
6
6
|
module.exports = {
|
|
7
|
+
workflow_cycle: {
|
|
8
|
+
invalid: '循环配置不完整或超出限制。每条自动化可配置一个循环,循环体最多包含五个计数节点。',
|
|
9
|
+
node_unavailable: 'OpenYida 在此循环场景不支持节点 {0}。请将它移到循环外,或在宜搭设计器查看适用的节点。',
|
|
10
|
+
unavailable: '当前宜搭场景未开放循环容器。请在目标应用的设计器确认可用能力。',
|
|
11
|
+
unverified: '无法确认当前组织的循环权益或节点配置。请核对登录组织后重试。',
|
|
12
|
+
entitlement_required: '当前组织缺少循环容器权益。请联系组织管理员到宜搭官方页面查看适用版本并升级:{0}',
|
|
13
|
+
published_unverified: '无法确认自动化的已发布定义。请在宜搭设计器检查发布状态后重试。',
|
|
14
|
+
},
|
|
7
15
|
issue_fixes: {
|
|
8
16
|
invalid_api_key: 'API Key 配置必须包含有效的 name 和 header/query 位置;请先检查连接器定义。',
|
|
9
17
|
repair_required: '旧 API Key 配置缺少 type/in/location;确认后加 --repair-api-key-scheme 修补连接器并创建新账号。',
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const { createYidaClient } = require('../core/yida-client');
|
|
4
4
|
const { t } = require('../core/i18n');
|
|
5
|
+
const { CliError } = require('../core/cli-error');
|
|
6
|
+
const { assertAutomationCycle, queryProcessVersions, getProcessById } = require('../process/services/process-service');
|
|
7
|
+
const { extractPlatformView } = require('../process/services/process-view-verifier');
|
|
5
8
|
|
|
6
9
|
/**
|
|
7
10
|
* integration-api.js - 集成&自动化相关宜搭 API 调用封装
|
|
@@ -349,6 +352,27 @@ async function listLogicflowDetailLogs(authRef, params) {
|
|
|
349
352
|
return content;
|
|
350
353
|
}
|
|
351
354
|
|
|
355
|
+
/** Read the published version that enabling a flow will activate. */
|
|
356
|
+
async function readPublishedAutomationView(authRef, target) {
|
|
357
|
+
try {
|
|
358
|
+
const result = await queryProcessVersions(authRef, target.appType, target.processCode, 'PUBLISHED', { pageSize: 1 });
|
|
359
|
+
const content = typeof result?.content === 'string' ? JSON.parse(result.content) : result?.content;
|
|
360
|
+
const version = content?.data?.[0];
|
|
361
|
+
const processId = version?.processId ?? version?.id;
|
|
362
|
+
if (result?.success !== true || !processId || (version.version ?? '') === '') {
|
|
363
|
+
throw new Error('published version missing');
|
|
364
|
+
}
|
|
365
|
+
const response = await getProcessById(authRef, { ...target, processId, processVersion: version.version });
|
|
366
|
+
const view = extractPlatformView(response);
|
|
367
|
+
if (view.schema.children.length === 0) { throw new Error('published definition missing'); }
|
|
368
|
+
return view;
|
|
369
|
+
} catch {
|
|
370
|
+
throw new CliError(t('workflow_cycle.published_unverified'), {
|
|
371
|
+
code: 'WORKFLOW_CYCLE_PUBLISHED_UNVERIFIED', details: { remoteWrites: 0 },
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
352
376
|
/**
|
|
353
377
|
* 开启或关闭逻辑流(自动化)
|
|
354
378
|
* 接口地址:POST /alibaba/web/{appType}/query/formLogicflowBinding/switchflow.json
|
|
@@ -358,6 +382,11 @@ async function switchLogicflow(authRef, params) {
|
|
|
358
382
|
const flow = await require('./integration-manage').binding(authRef, appType, formUuid, processCode);
|
|
359
383
|
const type = String(flow.eventType || flow.flowType || flow.type || '');
|
|
360
384
|
if (!['1', '2', '3', '5', '6'].includes(type)) { throw new Error('Unknown automation binding type'); }
|
|
385
|
+
if (enable) {
|
|
386
|
+
const target = { appType, formUuid, processCode };
|
|
387
|
+
const viewJson = await readPublishedAutomationView(authRef, target);
|
|
388
|
+
await assertAutomationCycle(authRef, { ...target, viewJson });
|
|
389
|
+
}
|
|
361
390
|
const response = await createYidaClient({ authRef }).postForm(
|
|
362
391
|
(function buildPath() {
|
|
363
392
|
const stamp = Date.now();
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
const { loadAuthData, triggerLogin, resolveBaseUrl } = require('../core/utils');
|
|
4
4
|
const { generateNodeId } = require('./integration-node-ids');
|
|
5
5
|
const { getFormSchema, createLogicflow, saveProcess } = require('./integration-api');
|
|
6
|
+
const { assertAutomationCycle } = require('../process/services/process-service');
|
|
6
7
|
const {
|
|
7
8
|
mapEventTypes,
|
|
8
9
|
buildProcessJson,
|
|
@@ -1163,6 +1164,8 @@ async function run(args) {
|
|
|
1163
1164
|
require('./integration-triggers').validateTriggerSpec(integrationSpec, triggerFields);
|
|
1164
1165
|
}
|
|
1165
1166
|
|
|
1167
|
+
await assertAutomationCycle(authRef, { appType, processCode, processJson, viewJson });
|
|
1168
|
+
|
|
1166
1169
|
// 所有参数、目标资源、Schema 与双 JSON 均已成功预检,至此才允许首个远端写入。
|
|
1167
1170
|
if (!processCodeInput) {
|
|
1168
1171
|
step(t('integration.create_step_new_flow'));
|
|
@@ -4,6 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { createAuthRef } = require('../core/yida-client');
|
|
6
6
|
const { saveProcess } = require('./integration-api');
|
|
7
|
+
const { assertAutomationCycle } = require('../process/services/process-service');
|
|
7
8
|
const baseline = require('./integration-baseline');
|
|
8
9
|
const { parse } = require('./integration-manage');
|
|
9
10
|
const { t } = require('../core/i18n');
|
|
@@ -84,6 +85,7 @@ async function run(args) {
|
|
|
84
85
|
}
|
|
85
86
|
// Existing active flows must first be disabled: update cannot accidentally activate a draft.
|
|
86
87
|
if (state.binding.status !== 'n') { baseline.fail('disable the flow before applying a patch'); }
|
|
88
|
+
await assertAutomationCycle(auth, { ...target, processJson: next.processJson, viewJson: next.viewJson });
|
|
87
89
|
const journal = path.join(path.dirname(baseline.location(auth, target)),
|
|
88
90
|
'journal-' + Date.now() + '-' + processCode.replace(/[^a-zA-Z0-9_-]/g, '_') + '.json');
|
|
89
91
|
baseline.writePrivate(journal, { target, before: record, after: next, state: 'prepared' }, true);
|
|
@@ -23,6 +23,7 @@ const { hasFieldReferences, resolveProcessFieldReferences } = require('./service
|
|
|
23
23
|
const { collectFormMemberIds, assertFormMemberFields } = require('./services/process-dynamic-actors');
|
|
24
24
|
const { completeSubtablePermissions } = require('./services/process-field-permissions');
|
|
25
25
|
const {
|
|
26
|
+
assertApprovalCycleSupported,
|
|
26
27
|
getProcessById,
|
|
27
28
|
getProcessCodeFromAppParam,
|
|
28
29
|
getProcessCodeFromSchema,
|
|
@@ -385,6 +386,7 @@ async function run(args, options) {
|
|
|
385
386
|
}
|
|
386
387
|
);
|
|
387
388
|
}
|
|
389
|
+
assertApprovalCycleSupported(compiled.viewJson, compiled.processJson);
|
|
388
390
|
stageTracker.complete('build_definition');
|
|
389
391
|
|
|
390
392
|
try {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const { createYidaClient } = require('../../core/yida-client');
|
|
4
|
+
const { CliError } = require('../../core/cli-error');
|
|
5
|
+
const { t } = require('../../core/i18n');
|
|
4
6
|
const {
|
|
5
7
|
getProcessCodeFromAppParam,
|
|
6
8
|
switchFormType,
|
|
@@ -110,7 +112,115 @@ function getProcessById(authRef, input, options = {}) {
|
|
|
110
112
|
}));
|
|
111
113
|
}
|
|
112
114
|
|
|
115
|
+
const PRICING_URL = 'https://www.aliwork.com/pricing';
|
|
116
|
+
// Require known node contracts in addition to the target application's designer allowlist.
|
|
117
|
+
const CYCLE_NODE_TYPES = new Map([
|
|
118
|
+
['CycleContainer', 'foreach'],
|
|
119
|
+
['ConditionContainer', 'route'],
|
|
120
|
+
['ConditionNode', 'condition'],
|
|
121
|
+
['ParallelNode', 'condition'],
|
|
122
|
+
['SendMessageNode', 'sendMessage'],
|
|
123
|
+
['SendEmailNode', 'sendEmail'],
|
|
124
|
+
['InitiateApprovalNode', 'initiateApproval'],
|
|
125
|
+
]);
|
|
126
|
+
|
|
127
|
+
function failCycle(reason, nodeType) {
|
|
128
|
+
const upgradeUrl = reason === 'entitlement_required' ? PRICING_URL : undefined;
|
|
129
|
+
throw new CliError(t('workflow_cycle.' + reason, nodeType || upgradeUrl), {
|
|
130
|
+
code: 'WORKFLOW_CYCLE_' + reason.toUpperCase(),
|
|
131
|
+
details: { ...(nodeType && { nodeType }), ...(upgradeUrl && { upgradeUrl }), remoteWrites: 0 },
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function findCycles(nodes = [], typeKey, childKey, cycleType) {
|
|
136
|
+
return nodes.flatMap(node => [
|
|
137
|
+
...(node[typeKey] === cycleType ? [node] : []),
|
|
138
|
+
...findCycles(node[childKey], typeKey, childKey, cycleType),
|
|
139
|
+
]);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/** Validate the canvas and, when writing a definition, its corresponding runtime loop. */
|
|
143
|
+
function inspectCycle(viewJson, processJson) {
|
|
144
|
+
const view = findCycles(viewJson?.schema?.children, 'componentName', 'children', 'CycleContainer');
|
|
145
|
+
const runtime = processJson && findCycles(processJson.nodes, 'type', 'childNodes', 'foreach');
|
|
146
|
+
if (view.length > 1 || runtime && (runtime.length !== view.length || runtime[0]?.nodeId !== view[0]?.id)) {
|
|
147
|
+
failCycle('invalid');
|
|
148
|
+
}
|
|
149
|
+
return { view: view[0], runtime: runtime?.[0] };
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function inspectNodes(nodes, nodeTypes, count, runtimeNodes) {
|
|
153
|
+
if (!Array.isArray(nodes) || runtimeNodes && (!Array.isArray(runtimeNodes) || runtimeNodes.length !== nodes.length)) {
|
|
154
|
+
failCycle('invalid');
|
|
155
|
+
}
|
|
156
|
+
for (const [index, node] of nodes.entries()) {
|
|
157
|
+
const component = node.componentName;
|
|
158
|
+
if (!CYCLE_NODE_TYPES.has(component) || component === 'CycleContainer') { failCycle('node_unavailable', component); }
|
|
159
|
+
if (runtimeNodes && (runtimeNodes[index]?.nodeId !== node.id
|
|
160
|
+
|| runtimeNodes[index]?.type !== CYCLE_NODE_TYPES.get(component))) { failCycle('invalid'); }
|
|
161
|
+
if (component !== 'ConditionContainer') { nodeTypes.add(component); }
|
|
162
|
+
if (component !== 'ConditionNode' && component !== 'ParallelNode') { count += 1; }
|
|
163
|
+
if (node.children?.length || runtimeNodes?.[index]?.childNodes?.length) {
|
|
164
|
+
count = inspectNodes(node.children || [], nodeTypes, count, runtimeNodes && (runtimeNodes[index].childNodes || []));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return count;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async function readContent(client, path, query) {
|
|
171
|
+
try {
|
|
172
|
+
const response = await client.getOnce(path, query, { silentStatus: true });
|
|
173
|
+
if (response?.success !== true) { return undefined; }
|
|
174
|
+
return typeof response.content === 'string' ? JSON.parse(response.content) : response.content;
|
|
175
|
+
} catch {
|
|
176
|
+
failCycle('unverified');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/** Check the target organization's current platform settings before an automation write. */
|
|
181
|
+
async function assertAutomationCycle(authRef, { appType, processCode, viewJson, processJson }) {
|
|
182
|
+
const { view, runtime } = inspectCycle(viewJson, processJson);
|
|
183
|
+
if (!view) { return; }
|
|
184
|
+
const nodeTypes = new Set();
|
|
185
|
+
const count = inspectNodes(view.children, nodeTypes, 0, runtime && (runtime.childNodes || []));
|
|
186
|
+
if (count < 1 || count > 5 || !view.props?.cycleContainerRules?.sourceId) { failCycle('invalid'); }
|
|
187
|
+
|
|
188
|
+
const client = createYidaClient({ authRef });
|
|
189
|
+
const [assets, auth, rollout] = await Promise.all([
|
|
190
|
+
readContent(client, `/alibaba/web/${appType}/query/simpleProcess/getConfig.json`, {
|
|
191
|
+
isLogic: 'true', ...(processCode && { processCode }),
|
|
192
|
+
}),
|
|
193
|
+
readContent(client, '/query/auth/list.json', { type: 'WORKFLOW' }),
|
|
194
|
+
readContent(client, '/query/compromiseDing/orgInGray.json', { grayKey: 'V20221215_foreach_service' }),
|
|
195
|
+
]);
|
|
196
|
+
if (!Array.isArray(assets?.componentsList) || !Array.isArray(auth?.feature) || typeof rollout !== 'boolean') {
|
|
197
|
+
failCycle('unverified');
|
|
198
|
+
}
|
|
199
|
+
const available = new Map(assets.componentsList.map(item => [item?.componentName, item]));
|
|
200
|
+
const cycle = available.get('CycleContainer');
|
|
201
|
+
if (!cycle) { failCycle('unavailable'); }
|
|
202
|
+
if (!Array.isArray(assets.cycleValidComponents)) { failCycle('unverified'); }
|
|
203
|
+
for (const component of nodeTypes) {
|
|
204
|
+
if (!available.has(component) || !assets.cycleValidComponents.includes(component)) {
|
|
205
|
+
failCycle('node_unavailable', component);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const requiresAdvanced = cycle.isAdvance === true
|
|
209
|
+
|| [...nodeTypes].some(component => available.get(component).isAdvance === true);
|
|
210
|
+
if (!auth.feature.includes('LOOP_NODE') || (requiresAdvanced && !auth.feature.includes('ADVANCE_PROC'))) {
|
|
211
|
+
failCycle('entitlement_required');
|
|
212
|
+
}
|
|
213
|
+
if (!rollout) { failCycle('unavailable'); }
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
/** Approval form authoring has no loop container in the supported designer scenario. */
|
|
217
|
+
function assertApprovalCycleSupported(viewJson, processJson) {
|
|
218
|
+
if (inspectCycle(viewJson, processJson).view) { failCycle('unavailable'); }
|
|
219
|
+
}
|
|
220
|
+
|
|
113
221
|
module.exports = {
|
|
222
|
+
assertApprovalCycleSupported,
|
|
223
|
+
assertAutomationCycle,
|
|
114
224
|
getProcessById,
|
|
115
225
|
getProcessCodeFromAppParam,
|
|
116
226
|
getProcessCodeFromSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openyida",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.16",
|
|
4
4
|
"description": "OpenYida CLI - AI 宜搭应用开发工具(安装即用,零配置)",
|
|
5
5
|
"bin": {
|
|
6
6
|
"openyida": "bin/yida.js",
|
|
@@ -123,9 +123,9 @@
|
|
|
123
123
|
"endpoint": "https://www.aliwork.com/openyida/agent-api"
|
|
124
124
|
},
|
|
125
125
|
"optionalDependencies": {
|
|
126
|
-
"@openyida/local-agent-runtime-darwin-arm64": "0.1.
|
|
127
|
-
"@openyida/local-agent-runtime-darwin-x64": "0.1.
|
|
128
|
-
"@openyida/local-agent-runtime-win32-x64": "0.1.
|
|
129
|
-
"@openyida/local-agent-runtime-win32-arm64": "0.1.
|
|
126
|
+
"@openyida/local-agent-runtime-darwin-arm64": "0.1.8",
|
|
127
|
+
"@openyida/local-agent-runtime-darwin-x64": "0.1.8",
|
|
128
|
+
"@openyida/local-agent-runtime-win32-x64": "0.1.8",
|
|
129
|
+
"@openyida/local-agent-runtime-win32-arm64": "0.1.8"
|
|
130
130
|
}
|
|
131
131
|
}
|
|
@@ -32,7 +32,7 @@ description: 配置流程和自动化里的处理步骤,包括审批、办理
|
|
|
32
32
|
|
|
33
33
|
配置人工节点的处理人和字段权限时,只读人工处理、人员选择、字段权限。需要加签或外部动作时,再加载对应说明。
|
|
34
34
|
|
|
35
|
-
复杂配置直接从对应完整示例改起:[审批/办理/抄送条件选人](references/actors.md#审批办理抄送的完整配置)、[多规则同时选人](references/actors.md#多条条件同时命中时收集人员)、[自动化并行](references/control.md#自动化并行示例)、[
|
|
35
|
+
复杂配置直接从对应完整示例改起:[审批/办理/抄送条件选人](references/actors.md#审批办理抄送的完整配置)、[多规则同时选人](references/actors.md#多条条件同时命中时收集人员)、[自动化并行](references/control.md#自动化并行示例)、[循环逐条通知](references/control.md#循环逐条通知示例)、[取数时字段比较](references/conditions-variables.md)。只替换查询到的真实 ID、字段类型和业务值,按示例的预期结果验收。
|
|
36
36
|
|
|
37
37
|
## 分清配置能力
|
|
38
38
|
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
| --- | --- | --- |
|
|
11
11
|
| 条件分支 | 可直接生成:`route.conditions[]`,分支内用 `rules/childNodes` | 可直接生成:`route.branches[]`,分支内用 `conditions/nodes` |
|
|
12
12
|
| 并行分支 | 可直接生成:`parallel.branches[]`,分支内用 `rules/childNodes` | 可直接生成:`parallel.branches[]`,分支内用 `conditions/nodes` |
|
|
13
|
-
| 循环容器 |
|
|
13
|
+
| 循环容器 | 审批流程使用宜搭设计器查看可用节点 | 支持单层循环 `cycle.source/nodes` |
|
|
14
14
|
| 拒绝后跳转 | 人工节点的 `routeRules` | 不适用,不是自动化分支 |
|
|
15
15
|
|
|
16
16
|
比较规则和变量来源只读 [条件与变量](conditions-variables.md)。流程分支按数组顺序生成优先级;自动化指定至多一个 `default: true` 兜底分支。不要手写底层连线或 `conditionNode`。
|
|
@@ -190,11 +190,11 @@
|
|
|
190
190
|
|
|
191
191
|
有条件的分支使用 `conditions`;`default:true` 是没有条件命中时的兜底,最多一条。每次都执行的分支用上例的 `all:true`。并行中避免多个分支同时覆盖同一业务字段。
|
|
192
192
|
|
|
193
|
-
###
|
|
193
|
+
### 循环逐条通知示例
|
|
194
194
|
|
|
195
|
-
|
|
195
|
+
循环仅用于集成自动化的编排。审批完成后需要循环时,使用审批事件触发集成自动化。循环体可配置消息通知、发起审批和条件或并行分支,可用节点以目标应用为准。读取多条数据放在循环前。批量复制使用[批量数据节点](../../yida-integration/references/batch-data.md)。
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
循环的 `source` 指向上游批量取数节点,`blockType` 可设为 `continue`(异常后跳过本条)或 `break`(退出循环)。每条自动化可配置一个循环,循环体最多五个计数节点。条件项和并行项本身不计数,分支内的动作仍计数。当前行字段使用 `${循环别名}.字段ID`。
|
|
198
198
|
|
|
199
199
|
```json
|
|
200
200
|
{
|
|
@@ -209,11 +209,10 @@
|
|
|
209
209
|
"id": "loop", "type": "cycle", "source": "rows", "blockType": "continue",
|
|
210
210
|
"nodes": [
|
|
211
211
|
{
|
|
212
|
-
"id": "
|
|
213
|
-
"
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
]
|
|
212
|
+
"id": "notify", "type": "sendMessage",
|
|
213
|
+
"receivers": ["<真实测试接收人ID>"],
|
|
214
|
+
"title": "记录提醒",
|
|
215
|
+
"content": "请查看记录 ${loop}.<真实编号字段ID>"
|
|
217
216
|
}
|
|
218
217
|
]
|
|
219
218
|
}
|
|
@@ -221,16 +220,12 @@
|
|
|
221
220
|
}
|
|
222
221
|
```
|
|
223
222
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
预期:若本次取到 A/5、B/15、C/25,目标表新增这 3 条对应记录。核对目标记录数量和每列值;`quantity:3` 表示最多取 3 条,来源表超过 3 条时,本例只处理本次取到的记录。
|
|
223
|
+
保存草稿并回读后,用测试接收人核对每轮通知和当前行字段。取到三条来源记录时,预期对应三条通知。
|
|
227
224
|
|
|
228
|
-
先保存草稿及回读,再以空数组、单条、多条和中途异常验证业务结果。配置保存不能证明并行汇合或循环执行正确。
|
|
229
225
|
|
|
230
226
|
## 特有限制
|
|
231
227
|
|
|
232
228
|
- 流程嵌套分支不超过 3 层;超过时必须拆分结构。默认“其他情况”由 CLI 生成;排查底层结构时核对最后一个条件为 `conditionType: else`,不猜测或省略兜底。
|
|
233
229
|
- 并行分支可能同时执行;不能用多个按优先级选择的条件分支假装并行。
|
|
234
230
|
- 节点别名只能引用当前分支的上游。某条分支内查询出的数据不能在无关分支中使用。
|
|
235
|
-
- 流程循环容器的范围、当前项、退出条件与子节点必须来自真实配置,不能只写空 `cycleContainerRules`。
|
|
236
231
|
- 批量取数再逐行新增不需要额外循环节点,见 [数据](data.md)。
|
|
@@ -85,7 +85,7 @@ openyida integration diagnose --file <异常文件> [--json]
|
|
|
85
85
|
| --- | --- | --- |
|
|
86
86
|
| 发起/触发 | 表单事件、流程完成或节点事件、定时 | 定时使用 spec schedule;不设置发起页字段权限;当前不创建应用或卡片触发 |
|
|
87
87
|
| 人工处理 | 无审批、办理、抄送人工节点 | 需要审批时用 `initiateApproval` 发起目标流程,在目标流程中配置审批人 |
|
|
88
|
-
| 流转控制 | `route/parallel/cycle` |
|
|
88
|
+
| 流转控制 | `route/parallel/cycle` | 循环为单层,格式见 [流转控制](../yida-flow-node-config/references/control.md) |
|
|
89
89
|
| 数据操作 | `getSelf/dataRetrieve/dataCreate/dataUpdate`,含批量取数/新增 | 当前 spec 不支持删除;流程表单新增用发起审批 |
|
|
90
90
|
| 通知 | `sendMessage`,成员/角色/成员字段 | 当前 spec 不支持邮件或卡片 |
|
|
91
91
|
| 扩展执行 | `connector/initiateApproval` | 连接器需发现真实 action schema;当前 spec 不支持代码或 AI |
|
|
@@ -148,6 +148,8 @@ openyida integration create APP_XXX FORM_XXX "替换已有自动化" --process-c
|
|
|
148
148
|
|
|
149
149
|
## 验证与异常
|
|
150
150
|
|
|
151
|
+
循环自动化按正常配置流程提交,由 CLI 自动校验。成功时直接报告保存或启用结果,校验结果影响任务时再说明原因和下一步。
|
|
152
|
+
|
|
151
153
|
发布成功要求列表中 `formUuid + processCode` 唯一匹配、状态为 `y`,且详情非空;返回 `verificationLevel=PLATFORM_LIST_EXACT_DETAIL_PRESENT`。角色、批量节点、赋值等已启用的投影校验也必须通过。此等级不证明完整运行图已回读,不能据此解锁 `integration update`。
|
|
152
154
|
|
|
153
155
|
| 结果 | 处理 |
|
|
@@ -160,7 +162,8 @@ openyida integration create APP_XXX FORM_XXX "替换已有自动化" --process-c
|
|
|
160
162
|
| 参数缺失、节点结构错误 | 停止,展示错误详情;从已有查询补齐真实参数,无法确定时询问用户,不猜测 |
|
|
161
163
|
| 登录态失效或权限不足 | 停止,运行 `openyida auth status` 核对;刷新失败时按 CLI 提示重新登录 |
|
|
162
164
|
| 未知错误 | 保留完整错误与资源 ID,停止;先只读核对是否已写入,再决定后续处理 |
|
|
163
|
-
|
|
|
165
|
+
| CLI 明确返回权益不足 | 说明当前操作受阻,按返回结果告知所需权益或官方升级入口。 |
|
|
166
|
+
| 循环配置不可用或校验结果无法确认 | 根据错误核对节点、目标应用或登录组织,再处理受阻的操作。 |
|
|
164
167
|
|
|
165
168
|
安全更新、保存顺序、输出口径和运行验收限制见 [spec 编排的保存与验证规则](references/spec-authoring.md#保存与验证规则)。`PLATFORM_PROBE_REQUIRED` 时必须保持 `remoteWrites=0`,保留 probe artifact 和 blocker;仅有列表或详情存在性不足以解锁更新,也不得降级为通用 JSON Patch。
|
|
166
169
|
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
| `--approval-node-ids <nodeId,...>` | 空 | 当 `--events activityTask` 时必填;审批节点 ID,多个用逗号分隔 |
|
|
27
27
|
| `--trigger-condition <fieldId:fieldName:opCode:value[:componentType[:valueType]]>` | 空 | 触发过滤条件,可多次传入;固定值用 `literal`(默认),右侧为另一个字段时用 `processVar`,见 [字段比较示例](../../yida-flow-node-config/references/conditions-variables.md) |
|
|
28
28
|
| `--trigger-recursively` | 关闭 | 允许自动触发,对应设计器里的“允许自动触发” |
|
|
29
|
-
| `--spec <file.json>` | 不启用 | 使用结构化编排文件创建复杂自动化,支持 `getSelf`、`dataRetrieve`、`dataCreate`、`dataUpdate`、`route`、`parallel`、`cycle`、`sendMessage`、`connector`、`initiateApproval
|
|
29
|
+
| `--spec <file.json>` | 不启用 | 使用结构化编排文件创建复杂自动化,支持 `getSelf`、`dataRetrieve`、`dataCreate`、`dataUpdate`、`route`、`parallel`、`cycle`、`sendMessage`、`connector`、`initiateApproval`。循环体用法见 [流转控制](../../yida-flow-node-config/references/control.md#循环逐条通知示例) |
|
|
30
30
|
| `--get-self` | 关闭 | 自动插入“获取自身”节点:流程表单运行态查询字段为 `pid`、设计器字段为 `proc_inst_id`;普通表单两侧使用 `form_inst_id`,均等于触发事件字段 `__masterdata_form_inst_id` |
|
|
31
31
|
| `--get-self-field <field>` | `__masterdata_form_inst_id` | 覆盖右侧触发事件系统字段;仅在确认环境变量名不同后使用 |
|
|
32
32
|
| `--get-self-query-field <field>` | 自动按来源表单类型选择 | 覆盖左侧查询系统字段;流程表单运行态使用 `pid` / `流程实例ID`、设计器使用 `proc_inst_id`,普通表单两侧使用 `form_inst_id` / `表单实例ID`;仅在确认平台字段名不同后使用 |
|