agentgui 1.0.331 → 1.0.333
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/build-portable.js +7 -2
- package/package.json +1 -1
- package/server.js +65 -65
package/build-portable.js
CHANGED
|
@@ -100,13 +100,18 @@ copyFile(path.join(hfSrc, 'package.json'), path.join(hfDest, 'package.json'));
|
|
|
100
100
|
copyDir(path.join(hfSrc, 'dist'), path.join(hfDest, 'dist'));
|
|
101
101
|
const hfNmSrc = path.join(hfSrc, 'node_modules');
|
|
102
102
|
const hfNmDest = path.join(hfDest, 'node_modules');
|
|
103
|
-
const
|
|
103
|
+
const onnxNestedSrc = path.join(hfNmSrc, 'onnxruntime-node');
|
|
104
|
+
const onnxRootSrc = path.join(nm, 'onnxruntime-node');
|
|
105
|
+
const hfOnnxSrc = fs.existsSync(onnxNestedSrc) ? onnxNestedSrc : onnxRootSrc;
|
|
104
106
|
const hfOnnxDest = path.join(hfNmDest, 'onnxruntime-node');
|
|
105
107
|
copyFile(path.join(hfOnnxSrc, 'package.json'), path.join(hfOnnxDest, 'package.json'));
|
|
106
108
|
copyDir(path.join(hfOnnxSrc, 'dist'), path.join(hfOnnxDest, 'dist'));
|
|
107
109
|
copyDir(path.join(hfOnnxSrc, 'lib'), path.join(hfOnnxDest, 'lib'));
|
|
108
110
|
copyDir(path.join(hfOnnxSrc, 'bin', 'napi-v3', 'win32', 'x64'), path.join(hfOnnxDest, 'bin', 'napi-v3', 'win32', 'x64'));
|
|
109
|
-
|
|
111
|
+
const onnxCommonNestedSrc = path.join(hfNmSrc, 'onnxruntime-common');
|
|
112
|
+
const onnxCommonRootSrc = path.join(nm, 'onnxruntime-common');
|
|
113
|
+
const onnxCommonSrc = fs.existsSync(onnxCommonNestedSrc) ? onnxCommonNestedSrc : onnxCommonRootSrc;
|
|
114
|
+
copyDir(onnxCommonSrc, path.join(hfNmDest, 'onnxruntime-common'));
|
|
110
115
|
|
|
111
116
|
log('Copying webtalk...');
|
|
112
117
|
copyDir(path.join(nm, 'webtalk'), path.join(destNm, 'webtalk'));
|
package/package.json
CHANGED
package/server.js
CHANGED
|
@@ -1756,6 +1756,71 @@ const server = http.createServer(async (req, res) => {
|
|
|
1756
1756
|
return;
|
|
1757
1757
|
}
|
|
1758
1758
|
|
|
1759
|
+
if (pathOnly === '/api/agents/auth-status' && req.method === 'GET') {
|
|
1760
|
+
const statuses = discoveredAgents.map(agent => {
|
|
1761
|
+
const status = { id: agent.id, name: agent.name, authenticated: false, detail: '' };
|
|
1762
|
+
try {
|
|
1763
|
+
if (agent.id === 'claude-code') {
|
|
1764
|
+
const credFile = path.join(os.homedir(), '.claude', '.credentials.json');
|
|
1765
|
+
if (fs.existsSync(credFile)) {
|
|
1766
|
+
const creds = JSON.parse(fs.readFileSync(credFile, 'utf-8'));
|
|
1767
|
+
if (creds.claudeAiOauth && creds.claudeAiOauth.expiresAt > Date.now()) {
|
|
1768
|
+
status.authenticated = true;
|
|
1769
|
+
status.detail = creds.claudeAiOauth.subscriptionType || 'authenticated';
|
|
1770
|
+
} else {
|
|
1771
|
+
status.detail = 'expired';
|
|
1772
|
+
}
|
|
1773
|
+
} else {
|
|
1774
|
+
status.detail = 'no credentials';
|
|
1775
|
+
}
|
|
1776
|
+
} else if (agent.id === 'gemini') {
|
|
1777
|
+
const oauthFile = path.join(os.homedir(), '.gemini', 'oauth_creds.json');
|
|
1778
|
+
const acctFile = path.join(os.homedir(), '.gemini', 'google_accounts.json');
|
|
1779
|
+
let hasOAuth = false;
|
|
1780
|
+
if (fs.existsSync(oauthFile)) {
|
|
1781
|
+
try {
|
|
1782
|
+
const creds = JSON.parse(fs.readFileSync(oauthFile, 'utf-8'));
|
|
1783
|
+
if (creds.refresh_token || creds.access_token) hasOAuth = true;
|
|
1784
|
+
} catch (_) {}
|
|
1785
|
+
}
|
|
1786
|
+
if (fs.existsSync(acctFile)) {
|
|
1787
|
+
const accts = JSON.parse(fs.readFileSync(acctFile, 'utf-8'));
|
|
1788
|
+
if (accts.active) {
|
|
1789
|
+
status.authenticated = true;
|
|
1790
|
+
status.detail = accts.active;
|
|
1791
|
+
} else if (hasOAuth) {
|
|
1792
|
+
status.authenticated = true;
|
|
1793
|
+
status.detail = 'oauth';
|
|
1794
|
+
} else {
|
|
1795
|
+
status.detail = 'logged out';
|
|
1796
|
+
}
|
|
1797
|
+
} else if (hasOAuth) {
|
|
1798
|
+
status.authenticated = true;
|
|
1799
|
+
status.detail = 'oauth';
|
|
1800
|
+
} else {
|
|
1801
|
+
status.detail = 'no credentials';
|
|
1802
|
+
}
|
|
1803
|
+
} else if (agent.id === 'opencode') {
|
|
1804
|
+
const out = execSync('opencode auth list 2>&1', { encoding: 'utf-8', timeout: 5000 });
|
|
1805
|
+
const countMatch = out.match(/(\d+)\s+credentials?/);
|
|
1806
|
+
if (countMatch && parseInt(countMatch[1], 10) > 0) {
|
|
1807
|
+
status.authenticated = true;
|
|
1808
|
+
status.detail = countMatch[1] + ' credential(s)';
|
|
1809
|
+
} else {
|
|
1810
|
+
status.detail = 'no credentials';
|
|
1811
|
+
}
|
|
1812
|
+
} else {
|
|
1813
|
+
status.detail = 'unknown';
|
|
1814
|
+
}
|
|
1815
|
+
} catch (e) {
|
|
1816
|
+
status.detail = 'check failed';
|
|
1817
|
+
}
|
|
1818
|
+
return status;
|
|
1819
|
+
});
|
|
1820
|
+
sendJSON(req, res, 200, { agents: statuses });
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1759
1824
|
const agentByIdMatch = pathOnly.match(/^\/api\/agents\/([^/]+)$/);
|
|
1760
1825
|
if (agentByIdMatch && req.method === 'GET') {
|
|
1761
1826
|
const agentId = agentByIdMatch[1];
|
|
@@ -1826,71 +1891,6 @@ const server = http.createServer(async (req, res) => {
|
|
|
1826
1891
|
return;
|
|
1827
1892
|
}
|
|
1828
1893
|
|
|
1829
|
-
if (pathOnly === '/api/agents/auth-status' && req.method === 'GET') {
|
|
1830
|
-
const statuses = discoveredAgents.map(agent => {
|
|
1831
|
-
const status = { id: agent.id, name: agent.name, authenticated: false, detail: '' };
|
|
1832
|
-
try {
|
|
1833
|
-
if (agent.id === 'claude-code') {
|
|
1834
|
-
const credFile = path.join(os.homedir(), '.claude', '.credentials.json');
|
|
1835
|
-
if (fs.existsSync(credFile)) {
|
|
1836
|
-
const creds = JSON.parse(fs.readFileSync(credFile, 'utf-8'));
|
|
1837
|
-
if (creds.claudeAiOauth && creds.claudeAiOauth.expiresAt > Date.now()) {
|
|
1838
|
-
status.authenticated = true;
|
|
1839
|
-
status.detail = creds.claudeAiOauth.subscriptionType || 'authenticated';
|
|
1840
|
-
} else {
|
|
1841
|
-
status.detail = 'expired';
|
|
1842
|
-
}
|
|
1843
|
-
} else {
|
|
1844
|
-
status.detail = 'no credentials';
|
|
1845
|
-
}
|
|
1846
|
-
} else if (agent.id === 'gemini') {
|
|
1847
|
-
const oauthFile = path.join(os.homedir(), '.gemini', 'oauth_creds.json');
|
|
1848
|
-
const acctFile = path.join(os.homedir(), '.gemini', 'google_accounts.json');
|
|
1849
|
-
let hasOAuth = false;
|
|
1850
|
-
if (fs.existsSync(oauthFile)) {
|
|
1851
|
-
try {
|
|
1852
|
-
const creds = JSON.parse(fs.readFileSync(oauthFile, 'utf-8'));
|
|
1853
|
-
if (creds.refresh_token || creds.access_token) hasOAuth = true;
|
|
1854
|
-
} catch (_) {}
|
|
1855
|
-
}
|
|
1856
|
-
if (fs.existsSync(acctFile)) {
|
|
1857
|
-
const accts = JSON.parse(fs.readFileSync(acctFile, 'utf-8'));
|
|
1858
|
-
if (accts.active) {
|
|
1859
|
-
status.authenticated = true;
|
|
1860
|
-
status.detail = accts.active;
|
|
1861
|
-
} else if (hasOAuth) {
|
|
1862
|
-
status.authenticated = true;
|
|
1863
|
-
status.detail = 'oauth';
|
|
1864
|
-
} else {
|
|
1865
|
-
status.detail = 'logged out';
|
|
1866
|
-
}
|
|
1867
|
-
} else if (hasOAuth) {
|
|
1868
|
-
status.authenticated = true;
|
|
1869
|
-
status.detail = 'oauth';
|
|
1870
|
-
} else {
|
|
1871
|
-
status.detail = 'no credentials';
|
|
1872
|
-
}
|
|
1873
|
-
} else if (agent.id === 'opencode') {
|
|
1874
|
-
const out = execSync('opencode auth list 2>&1', { encoding: 'utf-8', timeout: 5000 });
|
|
1875
|
-
const countMatch = out.match(/(\d+)\s+credentials?/);
|
|
1876
|
-
if (countMatch && parseInt(countMatch[1], 10) > 0) {
|
|
1877
|
-
status.authenticated = true;
|
|
1878
|
-
status.detail = countMatch[1] + ' credential(s)';
|
|
1879
|
-
} else {
|
|
1880
|
-
status.detail = 'no credentials';
|
|
1881
|
-
}
|
|
1882
|
-
} else {
|
|
1883
|
-
status.detail = 'unknown';
|
|
1884
|
-
}
|
|
1885
|
-
} catch (e) {
|
|
1886
|
-
status.detail = 'check failed';
|
|
1887
|
-
}
|
|
1888
|
-
return status;
|
|
1889
|
-
});
|
|
1890
|
-
sendJSON(req, res, 200, { agents: statuses });
|
|
1891
|
-
return;
|
|
1892
|
-
}
|
|
1893
|
-
|
|
1894
1894
|
if (pathOnly === '/api/gemini-oauth/start' && req.method === 'POST') {
|
|
1895
1895
|
try {
|
|
1896
1896
|
const result = await startGeminiOAuth(req);
|