openyida 2026.7.13 → 2026.7.14-2

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.
Files changed (95) hide show
  1. package/README.md +15 -22
  2. package/bin/yida.js +72 -220
  3. package/lib/agent-center/api.js +2 -2
  4. package/lib/aggregate-table/aggregate-table.js +2 -2
  5. package/lib/ai/ai.js +7 -12
  6. package/lib/app/canvas-compile.js +2 -2
  7. package/lib/app/create-app.js +5 -19
  8. package/lib/app/create-form.js +54 -76
  9. package/lib/app/create-page.js +4 -19
  10. package/lib/app/er.js +11 -8
  11. package/lib/app/export-app.js +2 -2
  12. package/lib/app/externalize-form.js +12 -10
  13. package/lib/app/get-schema.js +12 -10
  14. package/lib/app/import-app.js +6 -22
  15. package/lib/app/list-forms.js +3 -19
  16. package/lib/app/nav-group.js +6 -19
  17. package/lib/app/publish.js +60 -198
  18. package/lib/app/update-app.js +4 -18
  19. package/lib/app/update-form-config.js +20 -113
  20. package/lib/app-permission/app-permission.js +2 -2
  21. package/lib/auth/oauth-loopback.js +156 -0
  22. package/lib/auth/org.js +169 -322
  23. package/lib/auth/token-auth.js +346 -0
  24. package/lib/auth/token-store.js +174 -0
  25. package/lib/basic-info/basic-info.js +11 -12
  26. package/lib/bridge/bridge.js +29 -27
  27. package/lib/connector/api.js +4 -4
  28. package/lib/core/agent-capabilities.js +92 -8
  29. package/lib/core/batch.js +8 -8
  30. package/lib/core/check-data.js +2 -2
  31. package/lib/core/command-manifest.js +3 -3
  32. package/lib/core/doctor.js +19 -22
  33. package/lib/core/env-cmd.js +1 -3
  34. package/lib/core/env-manager.js +8 -121
  35. package/lib/core/env.js +30 -72
  36. package/lib/core/locales/ar.js +5 -5
  37. package/lib/core/locales/de.js +5 -5
  38. package/lib/core/locales/en.js +26 -26
  39. package/lib/core/locales/es.js +5 -5
  40. package/lib/core/locales/fr.js +5 -5
  41. package/lib/core/locales/hi.js +5 -5
  42. package/lib/core/locales/ja.js +14 -14
  43. package/lib/core/locales/ko.js +5 -5
  44. package/lib/core/locales/pt.js +5 -5
  45. package/lib/core/locales/vi.js +5 -5
  46. package/lib/core/locales/zh-HK.js +15 -15
  47. package/lib/core/locales/zh.js +26 -26
  48. package/lib/core/query-data.js +2 -2
  49. package/lib/core/task-center.js +2 -2
  50. package/lib/core/utils.js +156 -400
  51. package/lib/core/yida-client.js +57 -22
  52. package/lib/corp-efficiency/corp-efficiency.js +3 -3
  53. package/lib/corp-manager/api.js +2 -2
  54. package/lib/db/db-seq-fix.js +20 -25
  55. package/lib/flash-note/flash-to-prd.js +2 -2
  56. package/lib/i18n-management/i18n-management.js +2 -2
  57. package/lib/integration/integration-check.js +10 -7
  58. package/lib/integration/integration-create.js +11 -8
  59. package/lib/integration/integration-list.js +11 -8
  60. package/lib/mcp/server.js +5 -54
  61. package/lib/page-config/get-page-config.js +2 -2
  62. package/lib/page-config/save-share-config.js +2 -2
  63. package/lib/page-config/verify-short-url.js +2 -2
  64. package/lib/permission/get-permission.js +2 -2
  65. package/lib/permission/save-permission.js +2 -2
  66. package/lib/process/ai-form-setting.js +2 -2
  67. package/lib/process/create-process.js +2 -2
  68. package/lib/process/preview-process.js +2 -2
  69. package/lib/report/append.js +3 -3
  70. package/lib/report/index.js +3 -3
  71. package/package.json +1 -1
  72. package/scripts/check-syntax.js +6 -0
  73. package/scripts/e2e-real/full-runner.js +2 -10
  74. package/scripts/e2e-real/runner.js +0 -31
  75. package/scripts/eval/screenshot.js +27 -69
  76. package/scripts/nightly-smoke.js +16 -34
  77. package/scripts/postinstall.js +6 -2
  78. package/yida-skills/SKILL.md +10 -6
  79. package/yida-skills/references/development-rules.md +2 -2
  80. package/yida-skills/references/setup-and-env.md +10 -9
  81. package/yida-skills/skills/sls-log-workbench/SKILL.md +2 -2
  82. package/yida-skills/skills/sls-log-workbench/sls-query.js +27 -54
  83. package/yida-skills/skills/yida-flash-note-to-prd/SKILL.md +1 -1
  84. package/yida-skills/skills/yida-integration/SKILL.md +3 -3
  85. package/yida-skills/skills/yida-login/SKILL.md +56 -74
  86. package/yida-skills/skills/yida-logout/SKILL.md +13 -12
  87. package/yida-skills/skills/yida-process-rule/SKILL.md +1 -1
  88. package/yida-skills/skills/yida-publish-page/SKILL.md +1 -1
  89. package/yida-skills/skills/yida-report/references/report-api-guide.md +4 -20
  90. package/yida-skills/skills-index.json +4 -4
  91. package/lib/auth/auth.js +0 -313
  92. package/lib/auth/cdp-browser-login.js +0 -390
  93. package/lib/auth/codex-login.js +0 -71
  94. package/lib/auth/login.js +0 -550
  95. package/lib/auth/qr-login.js +0 -1575
@@ -0,0 +1,156 @@
1
+ 'use strict';
2
+
3
+ const crypto = require('crypto');
4
+ const http = require('http');
5
+ const { spawn } = require('child_process');
6
+
7
+ const CALLBACK_PATH = '/oauth/callback';
8
+ const DEFAULT_TIMEOUT_MS = 5 * 60 * 1000;
9
+
10
+ function randomToken(bytes = 24) {
11
+ return crypto.randomBytes(bytes).toString('base64url');
12
+ }
13
+
14
+ function openBrowser(url) {
15
+ if (process.env.OPENYIDA_NO_BROWSER === '1') {
16
+ return false;
17
+ }
18
+
19
+ let command = 'xdg-open';
20
+ let args = [url];
21
+ if (process.platform === 'darwin') {
22
+ command = 'open';
23
+ } else if (process.platform === 'win32') {
24
+ command = 'cmd';
25
+ args = ['/c', 'start', '', url];
26
+ }
27
+
28
+ try {
29
+ const child = spawn(command, args, {
30
+ detached: true,
31
+ stdio: 'ignore',
32
+ });
33
+ child.unref();
34
+ return true;
35
+ } catch {
36
+ return false;
37
+ }
38
+ }
39
+
40
+ function buildDingtalkOAuthUrl(options) {
41
+ const {
42
+ clientId,
43
+ redirectUri,
44
+ state,
45
+ loginOrigin = 'https://login.dingtalk.com',
46
+ scope = 'openid',
47
+ prompt = 'consent',
48
+ } = options;
49
+
50
+ const url = new URL('/oauth2/auth', loginOrigin);
51
+ url.searchParams.set('redirect_uri', redirectUri);
52
+ url.searchParams.set('response_type', 'code');
53
+ url.searchParams.set('client_id', clientId);
54
+ url.searchParams.set('scope', scope);
55
+ url.searchParams.set('state', state);
56
+ if (prompt) {
57
+ url.searchParams.set('prompt', prompt);
58
+ }
59
+ return url.toString();
60
+ }
61
+
62
+ function responseHtml(title, body) {
63
+ return `<!doctype html><html><head><meta charset="utf-8"><title>${title}</title></head><body><h3>${title}</h3><p>${body}</p></body></html>`;
64
+ }
65
+
66
+ function runDingtalkLoopback(options = {}) {
67
+ return new Promise((resolve, reject) => {
68
+ const state = options.state || randomToken();
69
+ const timeoutMs = Number(options.timeoutMs || process.env.OPENYIDA_OAUTH_TIMEOUT_MS || DEFAULT_TIMEOUT_MS);
70
+ let settled = false;
71
+ let timer;
72
+
73
+ const finish = (err, value) => {
74
+ if (settled) {
75
+ return;
76
+ }
77
+ settled = true;
78
+ clearTimeout(timer);
79
+ if (server) {
80
+ server.close(() => {});
81
+ }
82
+ if (err) {
83
+ reject(err);
84
+ } else {
85
+ resolve(value);
86
+ }
87
+ };
88
+
89
+ const server = http.createServer((req, res) => {
90
+ const requestUrl = new URL(req.url || '/', 'http://127.0.0.1');
91
+ if (requestUrl.pathname !== CALLBACK_PATH) {
92
+ res.statusCode = 404;
93
+ res.end('not found');
94
+ return;
95
+ }
96
+
97
+ const receivedState = requestUrl.searchParams.get('state');
98
+ if (!receivedState || receivedState !== state) {
99
+ res.statusCode = 400;
100
+ res.setHeader('content-type', 'text/html; charset=utf-8');
101
+ res.end(responseHtml('OpenYida login failed', 'Invalid OAuth state. Please close this page and retry.'));
102
+ finish(new Error('invalid_oauth_state'));
103
+ return;
104
+ }
105
+
106
+ const code = requestUrl.searchParams.get('code');
107
+ const authCode = requestUrl.searchParams.get('authCode') || requestUrl.searchParams.get('auth_code') || code;
108
+ if (!code && !authCode) {
109
+ res.statusCode = 400;
110
+ res.setHeader('content-type', 'text/html; charset=utf-8');
111
+ res.end(responseHtml('OpenYida login failed', 'Missing OAuth authorization code. Please close this page and retry.'));
112
+ finish(new Error('missing_oauth_code'));
113
+ return;
114
+ }
115
+
116
+ res.statusCode = 200;
117
+ res.setHeader('content-type', 'text/html; charset=utf-8');
118
+ res.end(responseHtml('OpenYida login completed', 'You can close this page and return to the terminal.'));
119
+ finish(null, {
120
+ code,
121
+ authCode,
122
+ state,
123
+ corpId: requestUrl.searchParams.get('corpId') || requestUrl.searchParams.get('corp_id'),
124
+ redirectUri: options.redirectUri,
125
+ });
126
+ });
127
+
128
+ server.on('error', finish);
129
+ server.listen(Number(options.port || 0), '127.0.0.1', () => {
130
+ const address = server.address();
131
+ const redirectUri = options.redirectUri || `http://127.0.0.1:${address.port}${CALLBACK_PATH}`;
132
+ options.redirectUri = redirectUri;
133
+ const authUrl = buildDingtalkOAuthUrl({
134
+ clientId: options.clientId,
135
+ redirectUri,
136
+ state,
137
+ loginOrigin: options.loginOrigin,
138
+ scope: options.scope,
139
+ prompt: options.prompt,
140
+ });
141
+
142
+ if (!options.quiet) {
143
+ process.stderr.write(`Open this URL to login:\n${authUrl}\n`);
144
+ }
145
+ openBrowser(authUrl);
146
+
147
+ timer = setTimeout(() => finish(new Error('oauth_login_timeout')), timeoutMs);
148
+ });
149
+ });
150
+ }
151
+
152
+ module.exports = {
153
+ runDingtalkLoopback,
154
+ buildDingtalkOAuthUrl,
155
+ CALLBACK_PATH,
156
+ };