openyida 2026.7.12 → 2026.7.13
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/README.md +3 -5
- package/lib/app/get-schema.js +109 -9
- package/lib/core/agent-capabilities.js +17 -1
- package/lib/core/command-manifest.js +475 -27
- package/package.json +1 -1
- package/scripts/eval/routing.js +31 -4
- package/scripts/eval/scenarios/routing-core.json +15 -0
- package/scripts/postinstall.js +12 -2
- package/scripts/validate-command-manifest.js +163 -0
- package/yida-skills/SKILL.md +20 -15
- package/yida-skills/skills/yida-app/SKILL.md +16 -7
- package/yida-skills/skills/yida-canvas-custom-page/SKILL.md +11 -8
- package/yida-skills/skills/yida-create-app/SKILL.md +2 -2
- package/yida-skills/skills/yida-create-page/SKILL.md +3 -3
- package/yida-skills/skills/yida-custom-page/SKILL.md +67 -20
- package/yida-skills/skills/yida-get-schema/SKILL.md +32 -8
- package/yida-skills/skills/yida-publish-page/SKILL.md +6 -0
- package/yida-skills/skills-index.json +6 -6
|
@@ -49,6 +49,34 @@ const SIDE_EFFECT_SCHEMA = Object.freeze({
|
|
|
49
49
|
},
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
+
const PERMISSION_SCHEMA = Object.freeze({
|
|
53
|
+
version: 1,
|
|
54
|
+
fields: {
|
|
55
|
+
mode: 'Default agent execution decision: allow, ask, or deny. Action-dependent commands must be checked against ask_actions before using the default.',
|
|
56
|
+
effect: 'Primary effect category: read, write, external, destructive, or unknown.',
|
|
57
|
+
reason: 'Human-readable rationale for the permission decision.',
|
|
58
|
+
action_dependent: 'True when the top-level command contains both read-only and mutating actions.',
|
|
59
|
+
read_actions: 'For action-dependent commands, subcommands/options that can be treated as allow/read.',
|
|
60
|
+
preauthorized_actions: 'For action-dependent commands, mutating subcommands/options that are explicitly pre-authorized by policy.',
|
|
61
|
+
ask_actions: 'For action-dependent commands, subcommands/options that should require confirmation.',
|
|
62
|
+
preauthorized_patterns: 'Structured argument matchers that are explicitly pre-authorized by policy.',
|
|
63
|
+
ask_patterns: 'Structured argument matchers that require confirmation.',
|
|
64
|
+
unknown_action_mode: 'Decision for unrecognized actions under action-dependent commands. Use ask unless a caller has a more specific local proof.',
|
|
65
|
+
},
|
|
66
|
+
modes: {
|
|
67
|
+
allow: 'Allowed by the current OpenYida agent policy without an extra OpenYida-specific confirmation.',
|
|
68
|
+
ask: 'Requires user confirmation before agent execution; currently reserved for destructive/delete-like operations.',
|
|
69
|
+
deny: 'Should not be auto-executed by an agent.',
|
|
70
|
+
},
|
|
71
|
+
effects: {
|
|
72
|
+
read: 'Reads, validates, inspects, or diagnoses without known mutation.',
|
|
73
|
+
write: 'Creates, updates, publishes, imports, uploads, or writes local/remote state.',
|
|
74
|
+
external: 'Touches identity, browser login, local servers, package updates, or third-party execution.',
|
|
75
|
+
destructive: 'Deletes or removes existing state.',
|
|
76
|
+
unknown: 'Action-dependent; callers should inspect read_actions, preauthorized_actions, ask_actions, and unknown_action_mode before using the default mode.',
|
|
77
|
+
},
|
|
78
|
+
});
|
|
79
|
+
|
|
52
80
|
function sideEffect(kind, overrides = {}) {
|
|
53
81
|
if (!SIDE_EFFECT_BASES[kind]) {
|
|
54
82
|
throw new Error('Unknown side effect kind: ' + kind);
|
|
@@ -72,6 +100,29 @@ function sideEffectEntries(ids, effect) {
|
|
|
72
100
|
return ids.map(id => [id, effect]);
|
|
73
101
|
}
|
|
74
102
|
|
|
103
|
+
function permission(mode, effect, overrides = {}) {
|
|
104
|
+
return {
|
|
105
|
+
mode,
|
|
106
|
+
effect,
|
|
107
|
+
...overrides,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function permissionEntries(ids, metadata) {
|
|
112
|
+
return ids.map(id => [id, metadata]);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function actionDependentPermission(options = {}) {
|
|
116
|
+
return permission('allow', 'unknown', {
|
|
117
|
+
reason: ACTION_DEPENDENT_REASON,
|
|
118
|
+
preauthorized_actions: options.preauthorized_actions || [],
|
|
119
|
+
preauthorized_patterns: options.preauthorized_patterns || [],
|
|
120
|
+
ask_actions: options.ask_actions || [],
|
|
121
|
+
ask_patterns: options.ask_patterns || [],
|
|
122
|
+
unknown_action_mode: 'ask',
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
75
126
|
function cloneSideEffect(effect) {
|
|
76
127
|
const cloned = { ...effect };
|
|
77
128
|
if (Array.isArray(effect.read_actions)) {
|
|
@@ -87,17 +138,59 @@ function cloneSideEffectSchema() {
|
|
|
87
138
|
return JSON.parse(JSON.stringify(SIDE_EFFECT_SCHEMA));
|
|
88
139
|
}
|
|
89
140
|
|
|
141
|
+
function clonePermissionSchema() {
|
|
142
|
+
return JSON.parse(JSON.stringify(PERMISSION_SCHEMA));
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function normalizePermission(metadata, sideEffectMetadata) {
|
|
146
|
+
const normalized = { ...metadata };
|
|
147
|
+
if (sideEffectMetadata && sideEffectMetadata.kind === 'mixed') {
|
|
148
|
+
if (normalized.action_dependent === undefined) {
|
|
149
|
+
normalized.action_dependent = true;
|
|
150
|
+
}
|
|
151
|
+
if (!Array.isArray(normalized.read_actions)) {
|
|
152
|
+
normalized.read_actions = Array.isArray(sideEffectMetadata.read_actions)
|
|
153
|
+
? [...sideEffectMetadata.read_actions]
|
|
154
|
+
: [];
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return normalized;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function clonePermission(metadata) {
|
|
161
|
+
const cloned = { ...metadata };
|
|
162
|
+
if (Array.isArray(metadata.read_actions)) {
|
|
163
|
+
cloned.read_actions = [...metadata.read_actions];
|
|
164
|
+
}
|
|
165
|
+
if (Array.isArray(metadata.preauthorized_actions)) {
|
|
166
|
+
cloned.preauthorized_actions = [...metadata.preauthorized_actions];
|
|
167
|
+
}
|
|
168
|
+
if (Array.isArray(metadata.preauthorized_patterns)) {
|
|
169
|
+
cloned.preauthorized_patterns = metadata.preauthorized_patterns.map(pattern => ({ ...pattern }));
|
|
170
|
+
}
|
|
171
|
+
if (Array.isArray(metadata.ask_actions)) {
|
|
172
|
+
cloned.ask_actions = [...metadata.ask_actions];
|
|
173
|
+
}
|
|
174
|
+
if (Array.isArray(metadata.ask_patterns)) {
|
|
175
|
+
cloned.ask_patterns = metadata.ask_patterns.map(pattern => ({ ...pattern }));
|
|
176
|
+
}
|
|
177
|
+
return cloned;
|
|
178
|
+
}
|
|
179
|
+
|
|
90
180
|
function listCommandSideEffectIds() {
|
|
91
181
|
return [...COMMAND_SIDE_EFFECTS.keys()].sort();
|
|
92
182
|
}
|
|
93
183
|
|
|
184
|
+
function listCommandPermissionIds() {
|
|
185
|
+
return [...COMMAND_PERMISSIONS.keys()].sort();
|
|
186
|
+
}
|
|
187
|
+
|
|
94
188
|
const COMMAND_SIDE_EFFECTS = new Map([
|
|
95
189
|
...sideEffectEntries([
|
|
96
190
|
'agent-capabilities',
|
|
97
191
|
'check-page',
|
|
98
192
|
'commands',
|
|
99
193
|
'dingtalk-link',
|
|
100
|
-
'env',
|
|
101
194
|
'formula.evaluate',
|
|
102
195
|
'integration.diagnose',
|
|
103
196
|
], sideEffect('local_read')),
|
|
@@ -109,6 +202,7 @@ const COMMAND_SIDE_EFFECTS = new Map([
|
|
|
109
202
|
'connector.gen-template',
|
|
110
203
|
'connector.parse-api',
|
|
111
204
|
'copy',
|
|
205
|
+
'export',
|
|
112
206
|
'export-conversation',
|
|
113
207
|
'flash-to-prd',
|
|
114
208
|
'generate-page',
|
|
@@ -120,7 +214,6 @@ const COMMAND_SIDE_EFFECTS = new Map([
|
|
|
120
214
|
|
|
121
215
|
...sideEffectEntries([
|
|
122
216
|
'app-list',
|
|
123
|
-
'basic-info',
|
|
124
217
|
'connector.detail',
|
|
125
218
|
'connector.list',
|
|
126
219
|
'connector.list-actions',
|
|
@@ -214,17 +307,17 @@ const COMMAND_SIDE_EFFECTS = new Map([
|
|
|
214
307
|
read_actions: ['status'],
|
|
215
308
|
mutating_actions: ['login', 'refresh', 'logout'],
|
|
216
309
|
})],
|
|
217
|
-
['batch
|
|
310
|
+
['batch', sideEffect('mixed', {
|
|
218
311
|
mutates_yida: true,
|
|
219
312
|
mutates_local: true,
|
|
220
313
|
read_actions: [],
|
|
221
|
-
mutating_actions: ['depends on commands in
|
|
314
|
+
mutating_actions: ['depends on commands in batch'],
|
|
222
315
|
})],
|
|
223
|
-
['
|
|
316
|
+
['basic-info', sideEffect('mixed', {
|
|
224
317
|
mutates_yida: true,
|
|
225
|
-
mutates_local:
|
|
226
|
-
read_actions: [],
|
|
227
|
-
mutating_actions: ['
|
|
318
|
+
mutates_local: false,
|
|
319
|
+
read_actions: ['default', 'overview', 'commodity', 'grant', 'capacity', 'quota', 'abs-path', 'dataflow', 'i18n', 'domain'],
|
|
320
|
+
mutating_actions: ['domain set'],
|
|
228
321
|
})],
|
|
229
322
|
['bridge', sideEffect('mixed', {
|
|
230
323
|
mutates_yida: false,
|
|
@@ -268,10 +361,10 @@ const COMMAND_SIDE_EFFECTS = new Map([
|
|
|
268
361
|
read_actions: ['help', 'contact user search', 'calendar event list', 'approval instance list'],
|
|
269
362
|
mutating_actions: ['install', 'setup', 'todo task create', 'chat robot send', 'depends on dws command'],
|
|
270
363
|
})],
|
|
271
|
-
['env
|
|
364
|
+
['env', sideEffect('mixed', {
|
|
272
365
|
mutates_yida: false,
|
|
273
366
|
mutates_local: true,
|
|
274
|
-
read_actions: ['list', 'show'],
|
|
367
|
+
read_actions: ['default', '--json', 'list', 'show'],
|
|
275
368
|
mutating_actions: ['setup', 'switch', 'add', 'remove'],
|
|
276
369
|
})],
|
|
277
370
|
['er', sideEffect('mixed', {
|
|
@@ -280,12 +373,6 @@ const COMMAND_SIDE_EFFECTS = new Map([
|
|
|
280
373
|
read_actions: ['default', '--format json'],
|
|
281
374
|
mutating_actions: ['--output'],
|
|
282
375
|
})],
|
|
283
|
-
['export', sideEffect('mixed', {
|
|
284
|
-
mutates_yida: false,
|
|
285
|
-
mutates_local: true,
|
|
286
|
-
read_actions: ['read application schema'],
|
|
287
|
-
mutating_actions: ['write export file'],
|
|
288
|
-
})],
|
|
289
376
|
['feedback', sideEffect('mixed', {
|
|
290
377
|
mutates_yida: true,
|
|
291
378
|
mutates_local: true,
|
|
@@ -302,7 +389,7 @@ const COMMAND_SIDE_EFFECTS = new Map([
|
|
|
302
389
|
mutates_yida: false,
|
|
303
390
|
mutates_local: true,
|
|
304
391
|
read_actions: [],
|
|
305
|
-
mutating_actions: ['
|
|
392
|
+
mutating_actions: ['default'],
|
|
306
393
|
})],
|
|
307
394
|
['nav-group', sideEffect('mixed', {
|
|
308
395
|
mutates_yida: true,
|
|
@@ -324,11 +411,275 @@ const COMMAND_SIDE_EFFECTS = new Map([
|
|
|
324
411
|
})],
|
|
325
412
|
]);
|
|
326
413
|
|
|
414
|
+
const ALLOW_WRITE_REASON = 'Allowed by policy: non-destructive write, update, publish, import, upload, or local file operation.';
|
|
415
|
+
const ALLOW_EXTERNAL_REASON = 'Allowed by policy: non-destructive auth, external service, local server, or package operation.';
|
|
416
|
+
const ACTION_DEPENDENT_REASON = 'Action-dependent command: allow only read_actions or preauthorized_actions; ask ask_actions and unknown mutating actions.';
|
|
417
|
+
|
|
418
|
+
const COMMAND_PERMISSIONS = new Map([
|
|
419
|
+
...permissionEntries([
|
|
420
|
+
'agent-capabilities',
|
|
421
|
+
'app-list',
|
|
422
|
+
'check-page',
|
|
423
|
+
'commands',
|
|
424
|
+
'connector.detail',
|
|
425
|
+
'connector.list',
|
|
426
|
+
'connector.list-actions',
|
|
427
|
+
'connector.list-connections',
|
|
428
|
+
'dingtalk-link',
|
|
429
|
+
'dws.contact-user-search',
|
|
430
|
+
'formula.evaluate',
|
|
431
|
+
'get-page-config',
|
|
432
|
+
'get-permission',
|
|
433
|
+
'get-schema',
|
|
434
|
+
'integration.check',
|
|
435
|
+
'integration.diagnose',
|
|
436
|
+
'integration.list',
|
|
437
|
+
'list-forms',
|
|
438
|
+
'process.preview',
|
|
439
|
+
'verify-short-url',
|
|
440
|
+
], permission('allow', 'read', {
|
|
441
|
+
reason: 'Read-only, diagnostic, validation, or manifest discovery command.',
|
|
442
|
+
})),
|
|
443
|
+
|
|
444
|
+
...permissionEntries([
|
|
445
|
+
'add-validation',
|
|
446
|
+
'append-chart',
|
|
447
|
+
'build-page',
|
|
448
|
+
'cdn-config',
|
|
449
|
+
'cdn-refresh',
|
|
450
|
+
'cdn-upload',
|
|
451
|
+
'compile',
|
|
452
|
+
'configure-process',
|
|
453
|
+
'connector.add-action',
|
|
454
|
+
'connector.create',
|
|
455
|
+
'connector.create-connection',
|
|
456
|
+
'connector.gen-template',
|
|
457
|
+
'connector.parse-api',
|
|
458
|
+
'connector.smart-create',
|
|
459
|
+
'copy',
|
|
460
|
+
'create-app',
|
|
461
|
+
'create-form.add-option',
|
|
462
|
+
'create-form.bind-datasource',
|
|
463
|
+
'create-form.create',
|
|
464
|
+
'create-form.patch',
|
|
465
|
+
'create-form.rule',
|
|
466
|
+
'create-form.update',
|
|
467
|
+
'create-form.validation',
|
|
468
|
+
'create-page',
|
|
469
|
+
'create-process',
|
|
470
|
+
'create-report',
|
|
471
|
+
'export-conversation',
|
|
472
|
+
'externalize-form',
|
|
473
|
+
'export',
|
|
474
|
+
'flash-to-prd',
|
|
475
|
+
'generate-page',
|
|
476
|
+
'import',
|
|
477
|
+
'integration.create',
|
|
478
|
+
'integration.disable',
|
|
479
|
+
'integration.enable',
|
|
480
|
+
'publish',
|
|
481
|
+
'sample',
|
|
482
|
+
'save-permission',
|
|
483
|
+
'save-share-config',
|
|
484
|
+
'update-app',
|
|
485
|
+
'update-form-config',
|
|
486
|
+
], permission('allow', 'write', {
|
|
487
|
+
reason: ALLOW_WRITE_REASON,
|
|
488
|
+
})),
|
|
489
|
+
|
|
490
|
+
...permissionEntries([
|
|
491
|
+
'login',
|
|
492
|
+
'logout',
|
|
493
|
+
'update',
|
|
494
|
+
], permission('allow', 'external', {
|
|
495
|
+
reason: ALLOW_EXTERNAL_REASON,
|
|
496
|
+
})),
|
|
497
|
+
|
|
498
|
+
...permissionEntries([
|
|
499
|
+
'connector.test',
|
|
500
|
+
], permission('allow', 'external', {
|
|
501
|
+
reason: ALLOW_EXTERNAL_REASON,
|
|
502
|
+
})),
|
|
503
|
+
|
|
504
|
+
...permissionEntries([
|
|
505
|
+
'connector.delete',
|
|
506
|
+
'connector.delete-action',
|
|
507
|
+
], permission('ask', 'destructive', {
|
|
508
|
+
reason: 'Deletes or removes existing configuration.',
|
|
509
|
+
})),
|
|
510
|
+
|
|
511
|
+
...permissionEntries([
|
|
512
|
+
'a2a',
|
|
513
|
+
], actionDependentPermission({
|
|
514
|
+
preauthorized_actions: ['serve'],
|
|
515
|
+
})),
|
|
516
|
+
|
|
517
|
+
...permissionEntries([
|
|
518
|
+
'aggregate-table',
|
|
519
|
+
], actionDependentPermission({
|
|
520
|
+
preauthorized_actions: ['create-empty', 'save', 'publish'],
|
|
521
|
+
})),
|
|
522
|
+
|
|
523
|
+
...permissionEntries([
|
|
524
|
+
'ai',
|
|
525
|
+
], actionDependentPermission({
|
|
526
|
+
preauthorized_actions: ['image --file'],
|
|
527
|
+
})),
|
|
528
|
+
|
|
529
|
+
...permissionEntries([
|
|
530
|
+
'agent-center',
|
|
531
|
+
], actionDependentPermission({
|
|
532
|
+
preauthorized_actions: ['create', 'update', 'cancel'],
|
|
533
|
+
})),
|
|
534
|
+
|
|
535
|
+
...permissionEntries([
|
|
536
|
+
'ai-form-setting',
|
|
537
|
+
], actionDependentPermission({
|
|
538
|
+
preauthorized_actions: ['enable', 'disable', 'save'],
|
|
539
|
+
})),
|
|
540
|
+
|
|
541
|
+
...permissionEntries([
|
|
542
|
+
'app-permission',
|
|
543
|
+
], actionDependentPermission({
|
|
544
|
+
preauthorized_actions: ['set', 'add'],
|
|
545
|
+
ask_actions: ['remove'],
|
|
546
|
+
})),
|
|
547
|
+
|
|
548
|
+
...permissionEntries([
|
|
549
|
+
'auth',
|
|
550
|
+
], actionDependentPermission({
|
|
551
|
+
preauthorized_actions: ['login', 'refresh', 'logout'],
|
|
552
|
+
})),
|
|
553
|
+
|
|
554
|
+
...permissionEntries([
|
|
555
|
+
'batch',
|
|
556
|
+
], actionDependentPermission({
|
|
557
|
+
preauthorized_patterns: [{
|
|
558
|
+
type: 'option_value_excludes_any',
|
|
559
|
+
option: '--commands',
|
|
560
|
+
values: ['delete', 'remove'],
|
|
561
|
+
description: 'Inline batch commands that do not contain delete/remove.',
|
|
562
|
+
}],
|
|
563
|
+
ask_patterns: [{
|
|
564
|
+
type: 'argv_contains_any',
|
|
565
|
+
values: ['delete', 'remove'],
|
|
566
|
+
description: 'Batch command arguments or inline command text contains delete/remove.',
|
|
567
|
+
}],
|
|
568
|
+
})),
|
|
569
|
+
|
|
570
|
+
...permissionEntries([
|
|
571
|
+
'basic-info',
|
|
572
|
+
], actionDependentPermission({
|
|
573
|
+
preauthorized_actions: ['domain set'],
|
|
574
|
+
})),
|
|
575
|
+
|
|
576
|
+
...permissionEntries([
|
|
577
|
+
'bridge',
|
|
578
|
+
], actionDependentPermission({
|
|
579
|
+
preauthorized_actions: ['start'],
|
|
580
|
+
})),
|
|
581
|
+
|
|
582
|
+
...permissionEntries([
|
|
583
|
+
'corp-efficiency',
|
|
584
|
+
], actionDependentPermission({
|
|
585
|
+
preauthorized_actions: ['notify'],
|
|
586
|
+
})),
|
|
587
|
+
|
|
588
|
+
...permissionEntries([
|
|
589
|
+
'corp-manager',
|
|
590
|
+
], actionDependentPermission({
|
|
591
|
+
preauthorized_actions: ['add', 'address-book'],
|
|
592
|
+
ask_actions: ['remove'],
|
|
593
|
+
})),
|
|
594
|
+
|
|
595
|
+
...permissionEntries([
|
|
596
|
+
'data',
|
|
597
|
+
], actionDependentPermission({
|
|
598
|
+
preauthorized_actions: ['create', 'update'],
|
|
599
|
+
ask_actions: ['delete'],
|
|
600
|
+
})),
|
|
601
|
+
|
|
602
|
+
...permissionEntries([
|
|
603
|
+
'db-seq-fix',
|
|
604
|
+
], actionDependentPermission({
|
|
605
|
+
preauthorized_actions: ['--fix'],
|
|
606
|
+
})),
|
|
607
|
+
|
|
608
|
+
...permissionEntries([
|
|
609
|
+
'doctor',
|
|
610
|
+
], actionDependentPermission({
|
|
611
|
+
preauthorized_actions: ['--fix'],
|
|
612
|
+
})),
|
|
613
|
+
|
|
614
|
+
...permissionEntries([
|
|
615
|
+
'dws',
|
|
616
|
+
], actionDependentPermission({
|
|
617
|
+
preauthorized_actions: ['install', 'setup', 'todo task create', 'chat robot send'],
|
|
618
|
+
ask_actions: ['unrecognized dws command'],
|
|
619
|
+
})),
|
|
620
|
+
|
|
621
|
+
...permissionEntries([
|
|
622
|
+
'env',
|
|
623
|
+
], actionDependentPermission({
|
|
624
|
+
preauthorized_actions: ['setup', 'switch', 'add'],
|
|
625
|
+
ask_actions: ['remove'],
|
|
626
|
+
})),
|
|
627
|
+
|
|
628
|
+
...permissionEntries([
|
|
629
|
+
'er',
|
|
630
|
+
], actionDependentPermission({
|
|
631
|
+
preauthorized_actions: ['--output'],
|
|
632
|
+
})),
|
|
633
|
+
|
|
634
|
+
...permissionEntries([
|
|
635
|
+
'feedback',
|
|
636
|
+
], actionDependentPermission({
|
|
637
|
+
preauthorized_actions: ['setup', 'dismiss'],
|
|
638
|
+
})),
|
|
639
|
+
|
|
640
|
+
...permissionEntries([
|
|
641
|
+
'i18n',
|
|
642
|
+
], actionDependentPermission({
|
|
643
|
+
preauthorized_actions: ['upsert', 'translate', 'translate-all', 'upgrade'],
|
|
644
|
+
ask_actions: ['delete'],
|
|
645
|
+
})),
|
|
646
|
+
|
|
647
|
+
...permissionEntries([
|
|
648
|
+
'mcp',
|
|
649
|
+
], actionDependentPermission({
|
|
650
|
+
preauthorized_actions: ['default'],
|
|
651
|
+
})),
|
|
652
|
+
|
|
653
|
+
...permissionEntries([
|
|
654
|
+
'nav-group',
|
|
655
|
+
], actionDependentPermission({
|
|
656
|
+
preauthorized_actions: ['create', 'rename', 'move', 'order', 'hide', 'show'],
|
|
657
|
+
ask_actions: ['delete'],
|
|
658
|
+
})),
|
|
659
|
+
|
|
660
|
+
...permissionEntries([
|
|
661
|
+
'org',
|
|
662
|
+
], actionDependentPermission({
|
|
663
|
+
preauthorized_actions: ['switch'],
|
|
664
|
+
})),
|
|
665
|
+
|
|
666
|
+
...permissionEntries([
|
|
667
|
+
'task-center',
|
|
668
|
+
], actionDependentPermission({
|
|
669
|
+
preauthorized_actions: ['submit'],
|
|
670
|
+
})),
|
|
671
|
+
]);
|
|
672
|
+
|
|
327
673
|
function command(id, path, usage, descriptionKey, options = {}) {
|
|
328
674
|
const commandSideEffect = COMMAND_SIDE_EFFECTS.get(id);
|
|
329
675
|
if (!commandSideEffect) {
|
|
330
676
|
throw new Error('Missing side effect metadata for command: ' + id);
|
|
331
677
|
}
|
|
678
|
+
const commandPermission = options.permission || COMMAND_PERMISSIONS.get(id);
|
|
679
|
+
if (!commandPermission) {
|
|
680
|
+
throw new Error('Missing permission metadata for command: ' + id);
|
|
681
|
+
}
|
|
682
|
+
const normalizedPermission = normalizePermission(commandPermission, commandSideEffect);
|
|
332
683
|
|
|
333
684
|
return {
|
|
334
685
|
id,
|
|
@@ -343,6 +694,7 @@ function command(id, path, usage, descriptionKey, options = {}) {
|
|
|
343
694
|
examples: options.examples || [],
|
|
344
695
|
hidden: options.hidden === true,
|
|
345
696
|
sideEffect: cloneSideEffect(commandSideEffect),
|
|
697
|
+
permission: clonePermission(normalizedPermission),
|
|
346
698
|
};
|
|
347
699
|
}
|
|
348
700
|
|
|
@@ -358,13 +710,10 @@ const COMMAND_GROUPS = [
|
|
|
358
710
|
command('logout', ['logout'], 'logout', 'help.cmd_logout', { requiresLogin: false }),
|
|
359
711
|
command('auth', ['auth'], 'auth <status|login|refresh|logout>', 'help.cmd_auth', { requiresLogin: false }),
|
|
360
712
|
command('org', ['org'], 'org <list|switch>', 'help.cmd_org'),
|
|
361
|
-
command('env', ['env'], 'env [--json]', 'help.cmd_env', {
|
|
713
|
+
command('env', ['env'], 'env [--json|setup|list|show|switch|add|remove] [options]', 'help.cmd_env', {
|
|
362
714
|
requiresLogin: false,
|
|
363
715
|
output: 'text|json',
|
|
364
716
|
}),
|
|
365
|
-
command('env-management', ['env'], 'env <setup|list|show|switch|add|remove>', 'help.cmd_env_management', {
|
|
366
|
-
requiresLogin: false,
|
|
367
|
-
}),
|
|
368
717
|
],
|
|
369
718
|
},
|
|
370
719
|
{
|
|
@@ -407,7 +756,7 @@ const COMMAND_GROUPS = [
|
|
|
407
756
|
command('aggregate-table', ['aggregate-table'], 'aggregate-table <list|create-empty|inspect|preview|save|publish|status> <appType> ...', 'help.cmd_aggregate_table', {
|
|
408
757
|
output: 'json',
|
|
409
758
|
}),
|
|
410
|
-
command('get-schema', ['get-schema'], 'get-schema <appType> <formUuid|--all>', 'help.cmd_get_schema'),
|
|
759
|
+
command('get-schema', ['get-schema'], 'get-schema <appType> <formUuid|--all> [--summary-json|--field-map-json]', 'help.cmd_get_schema'),
|
|
411
760
|
command('er', ['er'], 'er <appType> [--format mermaid|json] [--output file] [--include-system] [--include-pages]', 'help.cmd_er', {
|
|
412
761
|
output: 'text|json',
|
|
413
762
|
}),
|
|
@@ -555,10 +904,7 @@ const COMMAND_GROUPS = [
|
|
|
555
904
|
requiresLogin: false,
|
|
556
905
|
output: 'text|json',
|
|
557
906
|
}),
|
|
558
|
-
command('batch
|
|
559
|
-
output: 'text|json',
|
|
560
|
-
}),
|
|
561
|
-
command('batch.inline', ['batch'], 'batch --commands "cmd1 ; cmd2" [--stop-on-error] [--json]', 'help.cmd_batch', {
|
|
907
|
+
command('batch', ['batch'], 'batch <file>|--commands "cmd1 ; cmd2" [--stop-on-error] [--json]', 'help.cmd_batch', {
|
|
562
908
|
output: 'text|json',
|
|
563
909
|
}),
|
|
564
910
|
command('flash-to-prd', ['flash-to-prd'], 'flash-to-prd --file <path> --name "<project>"', 'help.cmd_flash_to_prd', {
|
|
@@ -595,12 +941,111 @@ function localizeCommand(entry, translate) {
|
|
|
595
941
|
examples: entry.examples,
|
|
596
942
|
hidden: entry.hidden,
|
|
597
943
|
side_effect: cloneSideEffect(entry.sideEffect),
|
|
944
|
+
permission: clonePermission(entry.permission),
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
function summarizeLocalizedCommands(commands) {
|
|
949
|
+
const sideEffectCounts = {};
|
|
950
|
+
const idsBySideEffect = {};
|
|
951
|
+
const permissionModeCounts = {};
|
|
952
|
+
const idsByPermissionMode = {};
|
|
953
|
+
const readOnlyCommandIds = [];
|
|
954
|
+
const mutatingCommandIds = [];
|
|
955
|
+
const allowCommandIds = [];
|
|
956
|
+
const askCommandIds = [];
|
|
957
|
+
const denyCommandIds = [];
|
|
958
|
+
|
|
959
|
+
for (const entry of commands) {
|
|
960
|
+
const effect = entry.side_effect || {};
|
|
961
|
+
const kind = effect.kind || 'unknown';
|
|
962
|
+
sideEffectCounts[kind] = (sideEffectCounts[kind] || 0) + 1;
|
|
963
|
+
if (!idsBySideEffect[kind]) {
|
|
964
|
+
idsBySideEffect[kind] = [];
|
|
965
|
+
}
|
|
966
|
+
idsBySideEffect[kind].push(entry.id);
|
|
967
|
+
|
|
968
|
+
if (effect.mutates_yida === false && effect.mutates_local === false && kind !== 'mixed') {
|
|
969
|
+
readOnlyCommandIds.push(entry.id);
|
|
970
|
+
}
|
|
971
|
+
if (effect.mutates_yida === true || effect.mutates_local === true || kind === 'mixed') {
|
|
972
|
+
mutatingCommandIds.push(entry.id);
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
const permissionMetadata = entry.permission || {};
|
|
976
|
+
const mode = permissionMetadata.mode || 'unknown';
|
|
977
|
+
permissionModeCounts[mode] = (permissionModeCounts[mode] || 0) + 1;
|
|
978
|
+
if (!idsByPermissionMode[mode]) {
|
|
979
|
+
idsByPermissionMode[mode] = [];
|
|
980
|
+
}
|
|
981
|
+
idsByPermissionMode[mode].push(entry.id);
|
|
982
|
+
if (mode === 'allow') {
|
|
983
|
+
allowCommandIds.push(entry.id);
|
|
984
|
+
} else if (mode === 'ask') {
|
|
985
|
+
askCommandIds.push(entry.id);
|
|
986
|
+
} else if (mode === 'deny') {
|
|
987
|
+
denyCommandIds.push(entry.id);
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
return {
|
|
992
|
+
command_count: commands.length,
|
|
993
|
+
group_count: COMMAND_GROUPS.length,
|
|
994
|
+
side_effect_counts: sideEffectCounts,
|
|
995
|
+
ids_by_side_effect: idsBySideEffect,
|
|
996
|
+
read_only_command_ids: readOnlyCommandIds,
|
|
997
|
+
mutating_command_ids: mutatingCommandIds,
|
|
998
|
+
permission_mode_counts: permissionModeCounts,
|
|
999
|
+
ids_by_permission_mode: idsByPermissionMode,
|
|
1000
|
+
allow_command_ids: allowCommandIds,
|
|
1001
|
+
ask_command_ids: askCommandIds,
|
|
1002
|
+
deny_command_ids: denyCommandIds,
|
|
1003
|
+
core_workflows: {
|
|
1004
|
+
full_app_fast_build: {
|
|
1005
|
+
mode: 'fast_build',
|
|
1006
|
+
trigger_phrases: ['默认方案', '不要追问', '直接创建', '尽快搭建'],
|
|
1007
|
+
default_page_skill_id: 'yida-custom-page',
|
|
1008
|
+
optional_canvas_skill_id: 'yida-canvas-custom-page',
|
|
1009
|
+
canvas_usage: 'Use Code Canvas only when the user explicitly asks for it, the target page is already YidaCodeCanvas, or the current organization/page is confirmed to support Canvas.',
|
|
1010
|
+
required_command_ids: [
|
|
1011
|
+
'agent-capabilities',
|
|
1012
|
+
'create-app',
|
|
1013
|
+
'create-form.create',
|
|
1014
|
+
'create-page',
|
|
1015
|
+
'publish',
|
|
1016
|
+
],
|
|
1017
|
+
optional_read_command_ids: ['get-schema', 'list-forms'],
|
|
1018
|
+
recommended_read_commands: [
|
|
1019
|
+
'openyida get-schema <appType> <formUuid> --summary-json',
|
|
1020
|
+
'openyida get-schema <appType> --all --summary-json --keyword <text> --output-dir .cache/openyida/<task>/schemas',
|
|
1021
|
+
],
|
|
1022
|
+
default_data_contract: 'Do not use this.dataSourceMap.* in fast_build page code unless a designer data source was created and bound in the same run; use this.utils.yida.* or an entry-only page by default.',
|
|
1023
|
+
optional_after_done_command_ids: [
|
|
1024
|
+
'nav-group',
|
|
1025
|
+
'data',
|
|
1026
|
+
'save-share-config',
|
|
1027
|
+
'get-page-config',
|
|
1028
|
+
'create-report',
|
|
1029
|
+
'append-chart',
|
|
1030
|
+
],
|
|
1031
|
+
do_not_default_skill_ids: [
|
|
1032
|
+
'yida-page-uiux',
|
|
1033
|
+
'yida-canvas-custom-page',
|
|
1034
|
+
'yida-data-source-connectors',
|
|
1035
|
+
'yida-data-management',
|
|
1036
|
+
'yida-nav-group',
|
|
1037
|
+
'yida-dashboard',
|
|
1038
|
+
],
|
|
1039
|
+
completion_contract: 'Create app, core forms, primary page, publish it, and return an access URL.',
|
|
1040
|
+
},
|
|
1041
|
+
},
|
|
598
1042
|
};
|
|
599
1043
|
}
|
|
600
1044
|
|
|
601
1045
|
function buildCommandManifest(options = {}) {
|
|
602
1046
|
const translate = typeof options.t === 'function' ? options.t : key => key;
|
|
603
1047
|
const commands = flattenCommandManifest();
|
|
1048
|
+
const localizedCommands = commands.map(entry => localizeCommand(entry, translate));
|
|
604
1049
|
|
|
605
1050
|
return {
|
|
606
1051
|
schema_version: 1,
|
|
@@ -615,7 +1060,9 @@ function buildCommandManifest(options = {}) {
|
|
|
615
1060
|
commands: group.commands.map(entry => entry.id),
|
|
616
1061
|
})),
|
|
617
1062
|
side_effect_schema: cloneSideEffectSchema(),
|
|
618
|
-
|
|
1063
|
+
permission_schema: clonePermissionSchema(),
|
|
1064
|
+
summary: summarizeLocalizedCommands(localizedCommands),
|
|
1065
|
+
commands: localizedCommands,
|
|
619
1066
|
};
|
|
620
1067
|
}
|
|
621
1068
|
|
|
@@ -623,5 +1070,6 @@ module.exports = {
|
|
|
623
1070
|
COMMAND_GROUPS,
|
|
624
1071
|
buildCommandManifest,
|
|
625
1072
|
flattenCommandManifest,
|
|
1073
|
+
listCommandPermissionIds,
|
|
626
1074
|
listCommandSideEffectIds,
|
|
627
1075
|
};
|