viberadar 0.3.200 → 0.3.202
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/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +51 -1
- package/dist/server/index.js.map +1 -1
- package/dist/ui/dashboard.html +61 -31
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAO7B,OAAO,EAAE,UAAU,EAA4H,MAAM,YAAY,CAAC;AAOlK,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAO7B,OAAO,EAAE,UAAU,EAA4H,MAAM,YAAY,CAAC;AAOlK,UAAU,aAAa;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;CACrB;AAumED,wBAAgB,WAAW,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC,CA8/F1G"}
|
package/dist/server/index.js
CHANGED
|
@@ -1133,6 +1133,35 @@ function buildObsSuppressPatternPrompt(pattern, recommendation, catalog) {
|
|
|
1133
1133
|
`\n${LOGGING_STANDARD_INLINE}`,
|
|
1134
1134
|
].filter(Boolean).join('\n');
|
|
1135
1135
|
}
|
|
1136
|
+
function decodeJwtPayload(token) {
|
|
1137
|
+
const part = token.split('.')[1];
|
|
1138
|
+
if (!part)
|
|
1139
|
+
return null;
|
|
1140
|
+
try {
|
|
1141
|
+
const normalized = part.replace(/-/g, '+').replace(/_/g, '/');
|
|
1142
|
+
const padded = normalized + '='.repeat((4 - normalized.length % 4) % 4);
|
|
1143
|
+
return JSON.parse(Buffer.from(padded, 'base64').toString('utf-8'));
|
|
1144
|
+
}
|
|
1145
|
+
catch {
|
|
1146
|
+
return null;
|
|
1147
|
+
}
|
|
1148
|
+
}
|
|
1149
|
+
function loadCodexAccountInfo() {
|
|
1150
|
+
const result = { email: null, name: null, accountId: null, raw: '' };
|
|
1151
|
+
try {
|
|
1152
|
+
const authPath = path.join(os.homedir(), '.codex', 'auth.json');
|
|
1153
|
+
const auth = JSON.parse(fs.readFileSync(authPath, 'utf-8'));
|
|
1154
|
+
const payload = typeof auth?.tokens?.id_token === 'string'
|
|
1155
|
+
? decodeJwtPayload(auth.tokens.id_token)
|
|
1156
|
+
: null;
|
|
1157
|
+
result.email = payload?.email || payload?.https?.email || null;
|
|
1158
|
+
result.name = payload?.name || payload?.nickname || payload?.preferred_username || null;
|
|
1159
|
+
result.accountId = auth?.tokens?.account_id || payload?.sub || null;
|
|
1160
|
+
result.raw = result.email || result.name || result.accountId || '';
|
|
1161
|
+
}
|
|
1162
|
+
catch { }
|
|
1163
|
+
return result;
|
|
1164
|
+
}
|
|
1136
1165
|
function buildObsPromptForTask(task, meta, obs) {
|
|
1137
1166
|
if (task === 'obs-suppress-pattern') {
|
|
1138
1167
|
if (!meta?.pattern)
|
|
@@ -3715,6 +3744,27 @@ function startServer({ data: initialData, port, projectRoot }) {
|
|
|
3715
3744
|
return;
|
|
3716
3745
|
}
|
|
3717
3746
|
if (url === '/api/agent-whoami' && req.method === 'GET') {
|
|
3747
|
+
const requestedAgent = parsedUrl.searchParams.get('agent') || currentData.agent || 'claude';
|
|
3748
|
+
if (requestedAgent === 'codex') {
|
|
3749
|
+
const cmd = WIN ? 'codex.cmd login status' : 'codex login status';
|
|
3750
|
+
let out = '';
|
|
3751
|
+
const proc = (0, child_process_1.spawn)(cmd, [], { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
3752
|
+
proc.stdout?.on('data', (d) => { out += d.toString(); });
|
|
3753
|
+
proc.stderr?.on('data', (d) => { out += d.toString(); });
|
|
3754
|
+
proc.on('close', () => {
|
|
3755
|
+
const account = loadCodexAccountInfo();
|
|
3756
|
+
res.writeHead(200, jsonH);
|
|
3757
|
+
res.end(JSON.stringify({
|
|
3758
|
+
agent: 'codex',
|
|
3759
|
+
loggedIn: /logged in/i.test(out),
|
|
3760
|
+
email: account.email,
|
|
3761
|
+
name: account.name,
|
|
3762
|
+
accountId: account.accountId,
|
|
3763
|
+
raw: account.raw || out.trim().slice(0, 300),
|
|
3764
|
+
}));
|
|
3765
|
+
});
|
|
3766
|
+
return;
|
|
3767
|
+
}
|
|
3718
3768
|
const cmd = WIN ? 'claude.cmd auth status' : 'claude auth status';
|
|
3719
3769
|
let out = '';
|
|
3720
3770
|
const proc = (0, child_process_1.spawn)(cmd, [], { shell: true, stdio: ['ignore', 'pipe', 'pipe'] });
|
|
@@ -3727,7 +3777,7 @@ function startServer({ data: initialData, port, projectRoot }) {
|
|
|
3727
3777
|
|| out.match(/([a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})/);
|
|
3728
3778
|
const email = match ? match[1] : null;
|
|
3729
3779
|
res.writeHead(200, jsonH);
|
|
3730
|
-
res.end(JSON.stringify({ email, raw: out.trim().slice(0, 300) }));
|
|
3780
|
+
res.end(JSON.stringify({ agent: 'claude', email, raw: out.trim().slice(0, 300) }));
|
|
3731
3781
|
});
|
|
3732
3782
|
return;
|
|
3733
3783
|
}
|