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.
- package/README.md +15 -22
- package/bin/yida.js +72 -220
- package/lib/agent-center/api.js +2 -2
- package/lib/aggregate-table/aggregate-table.js +2 -2
- package/lib/ai/ai.js +7 -12
- package/lib/app/canvas-compile.js +2 -2
- package/lib/app/create-app.js +5 -19
- package/lib/app/create-form.js +54 -76
- package/lib/app/create-page.js +4 -19
- package/lib/app/er.js +11 -8
- package/lib/app/export-app.js +2 -2
- package/lib/app/externalize-form.js +12 -10
- package/lib/app/get-schema.js +12 -10
- package/lib/app/import-app.js +6 -22
- package/lib/app/list-forms.js +3 -19
- package/lib/app/nav-group.js +6 -19
- package/lib/app/publish.js +60 -198
- package/lib/app/update-app.js +4 -18
- package/lib/app/update-form-config.js +20 -113
- package/lib/app-permission/app-permission.js +2 -2
- package/lib/auth/oauth-loopback.js +156 -0
- package/lib/auth/org.js +169 -322
- package/lib/auth/token-auth.js +346 -0
- package/lib/auth/token-store.js +174 -0
- package/lib/basic-info/basic-info.js +11 -12
- package/lib/bridge/bridge.js +29 -27
- package/lib/connector/api.js +4 -4
- package/lib/core/agent-capabilities.js +92 -8
- package/lib/core/batch.js +8 -8
- package/lib/core/check-data.js +2 -2
- package/lib/core/command-manifest.js +3 -3
- package/lib/core/doctor.js +19 -22
- package/lib/core/env-cmd.js +1 -3
- package/lib/core/env-manager.js +8 -121
- package/lib/core/env.js +30 -72
- package/lib/core/locales/ar.js +5 -5
- package/lib/core/locales/de.js +5 -5
- package/lib/core/locales/en.js +26 -26
- package/lib/core/locales/es.js +5 -5
- package/lib/core/locales/fr.js +5 -5
- package/lib/core/locales/hi.js +5 -5
- package/lib/core/locales/ja.js +14 -14
- package/lib/core/locales/ko.js +5 -5
- package/lib/core/locales/pt.js +5 -5
- package/lib/core/locales/vi.js +5 -5
- package/lib/core/locales/zh-HK.js +15 -15
- package/lib/core/locales/zh.js +26 -26
- package/lib/core/query-data.js +2 -2
- package/lib/core/task-center.js +2 -2
- package/lib/core/utils.js +156 -400
- package/lib/core/yida-client.js +57 -22
- package/lib/corp-efficiency/corp-efficiency.js +3 -3
- package/lib/corp-manager/api.js +2 -2
- package/lib/db/db-seq-fix.js +20 -25
- package/lib/flash-note/flash-to-prd.js +2 -2
- package/lib/i18n-management/i18n-management.js +2 -2
- package/lib/integration/integration-check.js +10 -7
- package/lib/integration/integration-create.js +11 -8
- package/lib/integration/integration-list.js +11 -8
- package/lib/mcp/server.js +5 -54
- package/lib/page-config/get-page-config.js +2 -2
- package/lib/page-config/save-share-config.js +2 -2
- package/lib/page-config/verify-short-url.js +2 -2
- package/lib/permission/get-permission.js +2 -2
- package/lib/permission/save-permission.js +2 -2
- package/lib/process/ai-form-setting.js +2 -2
- package/lib/process/create-process.js +2 -2
- package/lib/process/preview-process.js +2 -2
- package/lib/report/append.js +3 -3
- package/lib/report/index.js +3 -3
- package/package.json +1 -1
- package/scripts/check-syntax.js +6 -0
- package/scripts/e2e-real/full-runner.js +2 -10
- package/scripts/e2e-real/runner.js +0 -31
- package/scripts/eval/screenshot.js +27 -69
- package/scripts/nightly-smoke.js +16 -34
- package/scripts/postinstall.js +6 -2
- package/yida-skills/SKILL.md +10 -6
- package/yida-skills/references/development-rules.md +2 -2
- package/yida-skills/references/setup-and-env.md +10 -9
- package/yida-skills/skills/sls-log-workbench/SKILL.md +2 -2
- package/yida-skills/skills/sls-log-workbench/sls-query.js +27 -54
- package/yida-skills/skills/yida-flash-note-to-prd/SKILL.md +1 -1
- package/yida-skills/skills/yida-integration/SKILL.md +3 -3
- package/yida-skills/skills/yida-login/SKILL.md +56 -74
- package/yida-skills/skills/yida-logout/SKILL.md +13 -12
- package/yida-skills/skills/yida-process-rule/SKILL.md +1 -1
- package/yida-skills/skills/yida-publish-page/SKILL.md +1 -1
- package/yida-skills/skills/yida-report/references/report-api-guide.md +4 -20
- package/yida-skills/skills-index.json +4 -4
- package/lib/auth/auth.js +0 -313
- package/lib/auth/cdp-browser-login.js +0 -390
- package/lib/auth/codex-login.js +0 -71
- package/lib/auth/login.js +0 -550
- 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
|
+
};
|