heyiam 0.2.24 → 0.2.25
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/public/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>app</title>
|
|
8
|
-
<script type="module" crossorigin src="/assets/index-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DDYlBh0H.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-Dalqz2mC.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/dist/routes/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Router } from 'express';
|
|
2
2
|
import { saveAnthropicApiKey, clearAnthropicApiKey, getAnthropicApiKey } from '../settings.js';
|
|
3
|
-
import {
|
|
3
|
+
import { hasApiKey } from '../llm/index.js';
|
|
4
4
|
export function createSettingsRouter(_ctx) {
|
|
5
5
|
const router = Router();
|
|
6
6
|
// Save or clear the Anthropic API key
|
|
@@ -9,12 +9,12 @@ export function createSettingsRouter(_ctx) {
|
|
|
9
9
|
if (apiKey && typeof apiKey === 'string' && apiKey.trim()) {
|
|
10
10
|
saveAnthropicApiKey(apiKey.trim());
|
|
11
11
|
console.log('[settings] API key saved');
|
|
12
|
-
res.json({ ok: true,
|
|
12
|
+
res.json({ ok: true, hasKey: hasApiKey() });
|
|
13
13
|
}
|
|
14
14
|
else {
|
|
15
15
|
clearAnthropicApiKey();
|
|
16
16
|
console.log('[settings] API key cleared');
|
|
17
|
-
res.json({ ok: true,
|
|
17
|
+
res.json({ ok: true, hasKey: hasApiKey() });
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
// Get current API key status (masked)
|
package/package.json
CHANGED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { getAuthToken } from '../auth.js';
|
|
2
|
-
import { API_URL } from '../config.js';
|
|
3
|
-
/**
|
|
4
|
-
* Proxy provider — sends session data to Phoenix backend for server-side enhancement.
|
|
5
|
-
* Used when user has no local ANTHROPIC_API_KEY but is authenticated.
|
|
6
|
-
*/
|
|
7
|
-
export class ProxyProvider {
|
|
8
|
-
name = 'proxy';
|
|
9
|
-
async enhance(session) {
|
|
10
|
-
const auth = getAuthToken();
|
|
11
|
-
if (!auth?.token) {
|
|
12
|
-
throw new ProxyError('AUTH_EXPIRED', 'Not authenticated. Run: heyiam login');
|
|
13
|
-
}
|
|
14
|
-
const response = await fetch(`${API_URL}/api/enhance`, {
|
|
15
|
-
method: 'POST',
|
|
16
|
-
headers: {
|
|
17
|
-
'Content-Type': 'application/json',
|
|
18
|
-
'Authorization': `Bearer ${auth.token}`,
|
|
19
|
-
},
|
|
20
|
-
body: JSON.stringify({ session: sessionToPayload(session) }),
|
|
21
|
-
});
|
|
22
|
-
if (!response.ok) {
|
|
23
|
-
const errorBody = await response.json().catch(() => ({
|
|
24
|
-
error: { code: 'PROXY_UNREACHABLE', message: 'Could not reach enhancement server' },
|
|
25
|
-
}));
|
|
26
|
-
throw new ProxyError(errorBody.error?.code ?? 'PROXY_ERROR', errorBody.error?.message ?? 'Enhancement failed', errorBody.error?.resets_at);
|
|
27
|
-
}
|
|
28
|
-
const data = await response.json();
|
|
29
|
-
return data.result;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
export class ProxyError extends Error {
|
|
33
|
-
code;
|
|
34
|
-
resetsAt;
|
|
35
|
-
constructor(code, message, resetsAt) {
|
|
36
|
-
super(message);
|
|
37
|
-
this.name = 'ProxyError';
|
|
38
|
-
this.code = code;
|
|
39
|
-
this.resetsAt = resetsAt;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Extracts the session fields that Phoenix expects for enhancement.
|
|
44
|
-
*/
|
|
45
|
-
function sessionToPayload(session) {
|
|
46
|
-
return {
|
|
47
|
-
title: session.title,
|
|
48
|
-
projectName: session.projectName,
|
|
49
|
-
durationMinutes: session.durationMinutes,
|
|
50
|
-
turns: session.turns,
|
|
51
|
-
linesOfCode: session.linesOfCode,
|
|
52
|
-
skills: session.skills,
|
|
53
|
-
toolBreakdown: session.toolBreakdown,
|
|
54
|
-
filesChanged: session.filesChanged,
|
|
55
|
-
executionPath: session.executionPath,
|
|
56
|
-
turnTimeline: session.turnTimeline,
|
|
57
|
-
rawLog: session.rawLog,
|
|
58
|
-
};
|
|
59
|
-
}
|