cohvu 2.14.0 → 2.16.0
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/api.d.ts +11 -15
- package/dist/api.js +0 -11
- package/dist/api.js.map +1 -1
- package/dist/index.js +1 -5
- package/dist/index.js.map +1 -1
- package/dist/tui/App.js +47 -167
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/components/Banner.js +12 -18
- package/dist/tui/components/Banner.js.map +1 -1
- package/dist/tui/components/Header.js +66 -78
- package/dist/tui/components/Header.js.map +1 -1
- package/dist/tui/components/Modal.js +0 -24
- package/dist/tui/components/Modal.js.map +1 -1
- package/dist/tui/state.d.ts +5 -32
- package/dist/tui/state.js +18 -15
- package/dist/tui/state.js.map +1 -1
- package/dist/tui/tabs/BillingTab.js +33 -39
- package/dist/tui/tabs/BillingTab.js.map +1 -1
- package/dist/tui/tabs/KeysTab.js +26 -19
- package/dist/tui/tabs/KeysTab.js.map +1 -1
- package/dist/tui/tabs/ProjectTab.js +1 -4
- package/dist/tui/tabs/ProjectTab.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
3
|
import { getActiveProject, getActiveTeam } from '../state.js';
|
|
4
|
-
import { formatDate
|
|
4
|
+
import { formatDate } from '../utils.js';
|
|
5
5
|
export function BillingTab({ state, height }) {
|
|
6
6
|
const project = getActiveProject(state);
|
|
7
7
|
if (!project) {
|
|
@@ -14,35 +14,37 @@ export function BillingTab({ state, height }) {
|
|
|
14
14
|
function Field({ label, children }) {
|
|
15
15
|
return (_jsxs(Box, { children: [_jsx(Box, { width: 12, children: _jsxs(Text, { color: "gray", dimColor: true, children: [" ", label] }) }), children] }));
|
|
16
16
|
}
|
|
17
|
+
function UsageBar({ used, limit }) {
|
|
18
|
+
const width = 20;
|
|
19
|
+
const ratio = Math.min(1, used / limit);
|
|
20
|
+
const filled = Math.round(ratio * width);
|
|
21
|
+
const empty = width - filled;
|
|
22
|
+
const color = ratio >= 1 ? 'yellow' : ratio >= 0.8 ? 'yellow' : 'green';
|
|
23
|
+
const overflow = Math.max(0, used - limit);
|
|
24
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Field, { label: "usage", children: [_jsx(Text, { color: color, children: '█'.repeat(filled) }), _jsx(Text, { color: "gray", dimColor: true, children: '░'.repeat(empty) }), _jsxs(Text, { color: "gray", children: [" ", formatOps(used), "/", formatOps(limit), " ops"] })] }), overflow > 0 && (_jsx(Field, { label: "overflow", children: _jsxs(Text, { color: "yellow", children: [formatOps(overflow), " ops"] }) }))] }));
|
|
25
|
+
}
|
|
26
|
+
function formatOps(n) {
|
|
27
|
+
if (n >= 1000)
|
|
28
|
+
return `${(n / 1000).toFixed(1).replace(/\.0$/, '')}k`;
|
|
29
|
+
return String(n);
|
|
30
|
+
}
|
|
17
31
|
function IndividualBilling({ state }) {
|
|
18
32
|
const sub = state.individualSubscription;
|
|
19
|
-
const
|
|
20
|
-
//
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
if (days > 0) {
|
|
24
|
-
const trialColor = days > 3 ? 'gray' : days > 1 ? 'yellow' : 'red';
|
|
25
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "status", children: _jsx(Text, { color: trialColor, children: "trial" }) }), _jsxs(Field, { label: "ends", children: [_jsx(Text, { dimColor: true, children: formatDate(user.trial_ends_at) }), _jsx(Text, { color: "gray", dimColor: true, children: " \u00B7 " }), _jsxs(Text, { color: trialColor, children: [days, " day", days !== 1 ? 's' : '', " left"] })] }), _jsx(Field, { label: "plan", children: _jsx(Text, { color: "gray", children: "$19/month after trial" }) })] }));
|
|
26
|
-
}
|
|
27
|
-
// Trial ended
|
|
28
|
-
if (!sub || sub.status !== 'active') {
|
|
29
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsxs(Text, { color: "red", children: [" trial ended ", formatDate(user.trial_ends_at)] }), _jsx(Text, { color: "gray", children: " subscribe to keep your agents connected" }), _jsx(Box, { height: 1 }), _jsx(Field, { label: "plan", children: _jsx(Text, { color: "gray", children: "$19/month" }) })] }));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// No subscription
|
|
33
|
-
if (!sub) {
|
|
34
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "red", children: " locked" }), _jsx(Text, { color: "gray", children: " subscribe to keep your agents connected" }), _jsx(Box, { height: 1 }), _jsx(Field, { label: "plan", children: _jsx(Text, { color: "gray", children: "$19/month" }) })] }));
|
|
33
|
+
const usage = state.usage;
|
|
34
|
+
// Free tier — no subscription
|
|
35
|
+
if (!sub || (sub.status !== 'active' && sub.status !== 'past_due')) {
|
|
36
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "plan", children: _jsx(Text, { dimColor: true, children: "free \u00B7 250 ops/mo" }) }), usage && _jsx(UsageBar, { used: usage.ops_used, limit: usage.ops_limit })] }));
|
|
35
37
|
}
|
|
36
38
|
// Payment failed
|
|
37
39
|
if (sub.status === 'past_due') {
|
|
38
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "red", children: " ! payment failed" }), _jsx(Text, { color: "gray", children: " update your payment method to continue" })] }));
|
|
40
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "red", children: " ! payment failed" }), _jsx(Text, { color: "gray", children: " update your payment method to continue" }), _jsx(Box, { height: 1 }), _jsx(Field, { label: "plan", children: _jsx(Text, { dimColor: true, children: "pro \u00B7 $19/month" }) }), usage && _jsx(UsageBar, { used: usage.ops_used, limit: usage.ops_limit })] }));
|
|
39
41
|
}
|
|
40
42
|
// Canceled
|
|
41
|
-
if (sub.
|
|
42
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "red", children: " subscription canceled" }), sub.current_period_end && (_jsxs(Text, { color: "gray", children: ["
|
|
43
|
+
if (sub.cancel_at_period_end) {
|
|
44
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "red", children: " subscription canceled" }), sub.current_period_end && (_jsxs(Text, { color: "gray", children: [" reverts to free tier ", formatDate(sub.current_period_end)] })), _jsx(Box, { height: 1 }), _jsx(Field, { label: "plan", children: _jsx(Text, { dimColor: true, children: "pro \u00B7 $19/month" }) }), usage && _jsx(UsageBar, { used: usage.ops_used, limit: usage.ops_limit })] }));
|
|
43
45
|
}
|
|
44
|
-
// Active
|
|
45
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "
|
|
46
|
+
// Active Pro
|
|
47
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "plan", children: _jsx(Text, { dimColor: true, children: "pro \u00B7 $19/month" }) }), usage && _jsx(UsageBar, { used: usage.ops_used, limit: usage.ops_limit }), sub.current_period_end && (_jsx(Field, { label: "renews", children: _jsx(Text, { dimColor: true, children: formatDate(sub.current_period_end) }) }))] }));
|
|
46
48
|
}
|
|
47
49
|
function TeamBilling({ state }) {
|
|
48
50
|
const team = getActiveTeam(state);
|
|
@@ -50,29 +52,21 @@ function TeamBilling({ state }) {
|
|
|
50
52
|
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", children: " no team context" })] }));
|
|
51
53
|
}
|
|
52
54
|
const sub = team.subscription;
|
|
55
|
+
const usage = team.usage;
|
|
53
56
|
const isAdmin = state.userRole === 'admin';
|
|
54
|
-
//
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const days = daysUntil(teamData.trial_ends_at);
|
|
58
|
-
if (days > 0) {
|
|
59
|
-
const trialColor = days > 3 ? 'gray' : days > 1 ? 'yellow' : 'red';
|
|
60
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "team", children: _jsx(Text, { dimColor: true, children: team.name }) }), _jsx(Field, { label: "status", children: _jsx(Text, { color: trialColor, children: "trial" }) }), _jsxs(Field, { label: "ends", children: [_jsx(Text, { dimColor: true, children: formatDate(teamData.trial_ends_at) }), _jsx(Text, { color: "gray", dimColor: true, children: " \u00B7 " }), _jsxs(Text, { color: trialColor, children: [days, " day", days !== 1 ? 's' : '', " left"] })] }), _jsx(Field, { label: "plan", children: _jsx(Text, { color: "gray", children: "$34/seat/month after trial" }) })] }));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
// No subscription
|
|
64
|
-
if (!sub) {
|
|
65
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "team", children: _jsx(Text, { dimColor: true, children: team.name }) }), isAdmin ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: "red", children: " no subscription" }), _jsx(Text, { color: "gray", children: " subscribe to keep your agents connected" }), _jsx(Box, { height: 1 }), _jsx(Field, { label: "plan", children: _jsx(Text, { color: "gray", children: "$34/seat/month" }) })] })) : (_jsx(Field, { label: "status", children: _jsx(Text, { color: "red", children: "locked" }) }))] }));
|
|
57
|
+
// No subscription — free tier
|
|
58
|
+
if (!sub || (sub.status !== 'active' && sub.status !== 'past_due')) {
|
|
59
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "team", children: _jsx(Text, { dimColor: true, children: team.name }) }), _jsx(Field, { label: "plan", children: _jsx(Text, { dimColor: true, children: "free \u00B7 250 ops/mo" }) }), usage && _jsx(UsageBar, { used: usage.ops_used, limit: usage.ops_limit })] }));
|
|
66
60
|
}
|
|
67
61
|
// Payment failed
|
|
68
62
|
if (sub.status === 'past_due') {
|
|
69
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "team", children: _jsx(Text, { dimColor: true, children: team.name }) }), isAdmin ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: "red", children: " ! payment failed" }), _jsx(Text, { color: "gray", children: " update your payment method to continue" }), _jsx(Box, { height: 1 }), _jsxs(Field, { label: "seats", children: [_jsx(Text, { dimColor: true, children: String(sub.seat_count) }), _jsxs(Text, { color: "gray", children: [" ($", sub.seat_count *
|
|
63
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "team", children: _jsx(Text, { dimColor: true, children: team.name }) }), isAdmin ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: "red", children: " ! payment failed" }), _jsx(Text, { color: "gray", children: " update your payment method to continue" }), _jsx(Box, { height: 1 }), _jsxs(Field, { label: "seats", children: [_jsx(Text, { dimColor: true, children: String(sub.seat_count) }), _jsxs(Text, { color: "gray", children: [" ($", sub.seat_count * 29, "/month)"] })] }), usage && _jsx(UsageBar, { used: usage.ops_used, limit: usage.ops_limit })] })) : (_jsxs(_Fragment, { children: [_jsx(Field, { label: "status", children: _jsx(Text, { color: "red", children: "past due" }) }), _jsx(Field, { label: "seats", children: _jsx(Text, { dimColor: true, children: String(sub.seat_count) }) })] }))] }));
|
|
70
64
|
}
|
|
71
65
|
// Canceled
|
|
72
|
-
if (sub.
|
|
73
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "team", children: _jsx(Text, { dimColor: true, children: team.name }) }),
|
|
66
|
+
if (sub.cancel_at_period_end) {
|
|
67
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "team", children: _jsx(Text, { dimColor: true, children: team.name }) }), _jsx(Text, { color: "red", children: " subscription canceled" }), sub.current_period_end && (_jsxs(Text, { color: "gray", children: [" reverts to free tier ", formatDate(sub.current_period_end)] })), _jsx(Box, { height: 1 }), _jsxs(Field, { label: "seats", children: [_jsx(Text, { dimColor: true, children: String(sub.seat_count) }), _jsxs(Text, { color: "gray", children: [" ($", sub.seat_count * 29, "/month)"] })] }), usage && _jsx(UsageBar, { used: usage.ops_used, limit: usage.ops_limit })] }));
|
|
74
68
|
}
|
|
75
|
-
// Active
|
|
76
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "team", children: _jsx(Text, { dimColor: true, children: team.name }) }), isAdmin ? (_jsxs(_Fragment, { children: [_jsx(Field, { label: "
|
|
69
|
+
// Active Team
|
|
70
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "team", children: _jsx(Text, { dimColor: true, children: team.name }) }), isAdmin ? (_jsxs(_Fragment, { children: [_jsx(Field, { label: "plan", children: _jsxs(Text, { dimColor: true, children: ["team \u00B7 $", sub.seat_count * 29, "/month"] }) }), _jsx(Field, { label: "seats", children: _jsx(Text, { dimColor: true, children: String(sub.seat_count) }) }), usage && _jsx(UsageBar, { used: usage.ops_used, limit: usage.ops_limit }), sub.current_period_end && (_jsx(Field, { label: "renews", children: _jsx(Text, { dimColor: true, children: formatDate(sub.current_period_end) }) }))] })) : (_jsxs(_Fragment, { children: [_jsx(Field, { label: "plan", children: _jsx(Text, { dimColor: true, children: "team" }) }), _jsx(Field, { label: "seats", children: _jsx(Text, { dimColor: true, children: String(sub.seat_count) }) }), usage && _jsx(UsageBar, { used: usage.ops_used, limit: usage.ops_limit })] }))] }));
|
|
77
71
|
}
|
|
78
72
|
//# sourceMappingURL=BillingTab.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BillingTab.js","sourceRoot":"","sources":["../../../src/tui/tabs/BillingTab.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CA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C,kBAAkB,CAAC,GAAQ,GAAQ,CACzF,IACA,CACJ,CAAC,CAAC,CAAC,CACF,8BACE,KAAC,KAAK,IAAC,KAAK,EAAC,MAAM,YAAC,KAAC,IAAI,IAAC,QAAQ,2BAAY,GAAQ,EACtD,KAAC,KAAK,IAAC,KAAK,EAAC,OAAO,YAAC,KAAC,IAAI,IAAC,QAAQ,kBAAE,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,GAAQ,GAAQ,EAC1E,KAAK,IAAI,KAAC,QAAQ,IAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,GAAI,IACnE,CACJ,IACG,CACP,CAAC;AACJ,CAAC"}
|
package/dist/tui/tabs/KeysTab.js
CHANGED
|
@@ -1,31 +1,38 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from 'ink';
|
|
3
|
-
import { getActiveProject } from '../state.js';
|
|
3
|
+
import { getActiveProject, getActiveTeam } from '../state.js';
|
|
4
4
|
import { Divider } from '../components/Divider.js';
|
|
5
5
|
import { timeAgo, formatDate, truncate } from '../utils.js';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
function isPaid(state) {
|
|
7
|
+
const project = getActiveProject(state);
|
|
8
|
+
if (!project)
|
|
9
|
+
return false;
|
|
10
|
+
if (project.owner.kind === 'team') {
|
|
11
|
+
const team = getActiveTeam(state);
|
|
12
|
+
const sub = team?.subscription;
|
|
13
|
+
return !!sub && (sub.status === 'active' || sub.status === 'past_due');
|
|
14
|
+
}
|
|
15
|
+
const sub = state.individualSubscription;
|
|
16
|
+
return !!sub && (sub.status === 'active' || sub.status === 'past_due');
|
|
17
|
+
}
|
|
11
18
|
export function KeysTab({ state, height }) {
|
|
12
19
|
const project = getActiveProject(state);
|
|
13
|
-
const sessionKeys = state.apiKeys.filter(k => k.kind === 'session');
|
|
14
|
-
const integrationKeys = state.apiKeys.filter(k => k.kind === 'integration');
|
|
15
20
|
const isAdmin = state.userRole === 'admin';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
if (state.apiKeysLoading && flatKeys.length === 0) {
|
|
21
|
+
const paid = isPaid(state);
|
|
22
|
+
const keys = state.apiKeys;
|
|
23
|
+
if (state.apiKeysLoading && keys.length === 0) {
|
|
20
24
|
return (_jsxs(Box, { flexDirection: "column", height: height, overflowY: "hidden", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", dimColor: true, children: " loading keys..." })] }));
|
|
21
25
|
}
|
|
22
|
-
if (
|
|
23
|
-
return (_jsxs(Box, { flexDirection: "column", height: height, overflowY: "hidden", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "gray",
|
|
26
|
+
if (!isAdmin) {
|
|
27
|
+
return (_jsxs(Box, { flexDirection: "column", height: height, overflowY: "hidden", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", dimColor: true, children: " only admins can manage keys" })] }));
|
|
28
|
+
}
|
|
29
|
+
if (!paid) {
|
|
30
|
+
return (_jsxs(Box, { flexDirection: "column", height: height, overflowY: "hidden", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", children: " keys require a paid plan" }), _jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", dimColor: true, children: " upgrade to create API keys for bots and automated systems." })] }));
|
|
31
|
+
}
|
|
32
|
+
if (keys.length === 0) {
|
|
33
|
+
return (_jsxs(Box, { flexDirection: "column", height: height, overflowY: "hidden", children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", children: " no keys yet" }), _jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", dimColor: true, children: " keys give bots and automated systems scoped access" }), _jsx(Text, { color: "gray", dimColor: true, children: " to your projects with configurable permissions." }), _jsx(Box, { height: 1 }), _jsx(Divider, {}), _jsx(Box, { height: 1 }), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " n " }), _jsx(Text, { dimColor: true, children: "create new key" })] })] }));
|
|
24
34
|
}
|
|
25
|
-
return (_jsxs(Box, { flexDirection: "column", height: height, overflowY: "hidden", children: [_jsx(Box, { height: 1 }),
|
|
26
|
-
const flatIdx = sessionKeys.length + idx;
|
|
27
|
-
return (_jsx(KeyRow, { keyData: key, selected: state.apiKeysSelected === flatIdx, project: project }, key.id));
|
|
28
|
-
})] })), _jsx(Box, { height: 1 }), _jsx(Divider, {}), _jsx(Box, { height: 1 }), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " n " }), _jsx(Text, { dimColor: true, children: "new key" })] }), flatKeys.length > 0 && (_jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " x " }), _jsx(Text, { dimColor: true, children: "revoke selected" })] })), !isAdmin && project && (_jsxs(_Fragment, { children: [_jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", dimColor: true, children: " only admins can manage integration keys" })] }))] }));
|
|
35
|
+
return (_jsxs(Box, { flexDirection: "column", height: height, overflowY: "hidden", children: [_jsx(Box, { height: 1 }), keys.map((key, idx) => (_jsx(KeyRow, { keyData: key, selected: state.apiKeysSelected === idx, project: project }, key.id))), _jsx(Box, { height: 1 }), _jsx(Divider, {}), _jsx(Box, { height: 1 }), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " n " }), _jsx(Text, { dimColor: true, children: "new key" })] }), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " x " }), _jsx(Text, { dimColor: true, children: "revoke selected" })] })] }));
|
|
29
36
|
}
|
|
30
37
|
function KeyRow({ keyData, selected, project, }) {
|
|
31
38
|
const lastUsed = keyData.last_used_at ? timeAgo(keyData.last_used_at) : 'never';
|
|
@@ -33,7 +40,7 @@ function KeyRow({ keyData, selected, project, }) {
|
|
|
33
40
|
const expires = keyData.expires_at
|
|
34
41
|
? new Date(keyData.expires_at) < new Date() ? 'expired' : `expires ${formatDate(keyData.expires_at)}`
|
|
35
42
|
: null;
|
|
36
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { children: selected ? '> ' : ' ' }), _jsx(Text, { ...(selected ? {} : { color: 'gray' }), children: truncate(keyData.name, 30) }), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", keyData.key_prefix, "\u2026"] })] }), _jsxs(Box, { children: [_jsx(Text, { children: " " }), _jsxs(Text, { color: "gray", dimColor: true, children: ["created ", created] }), _jsxs(Text, { color: "gray", dimColor: true, children: [" \u00B7 last used ", lastUsed] }), expires && _jsxs(_Fragment, { children: [_jsx(Text, { color: "gray", dimColor: true, children: " \u00B7 " }), _jsx(Text, { color: expires === 'expired' ? 'red' : 'gray', dimColor: expires !== 'expired', children: expires })] })] }), keyData.
|
|
43
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { children: selected ? '> ' : ' ' }), _jsx(Text, { ...(selected ? {} : { color: 'gray' }), children: truncate(keyData.name, 30) }), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", keyData.key_prefix, "\u2026"] })] }), _jsxs(Box, { children: [_jsx(Text, { children: " " }), _jsxs(Text, { color: "gray", dimColor: true, children: ["created ", created] }), _jsxs(Text, { color: "gray", dimColor: true, children: [" \u00B7 last used ", lastUsed] }), expires && _jsxs(_Fragment, { children: [_jsx(Text, { color: "gray", dimColor: true, children: " \u00B7 " }), _jsx(Text, { color: expires === 'expired' ? 'red' : 'gray', dimColor: expires !== 'expired', children: expires })] })] }), keyData.scopes && keyData.scopes.length > 0 && (_jsxs(Box, { children: [_jsx(Text, { children: " " }), _jsx(Text, { color: "gray", dimColor: true, children: keyData.scopes.map(s => `${shortenProjectId(s.project_id, project)}:${s.role}`).join(', ') }), keyData.allowed_tools && (_jsxs(Text, { color: "gray", dimColor: true, children: [" \u00B7 tools: ", keyData.allowed_tools.join(', ')] })), keyData.default_agent_name && (_jsxs(Text, { color: "gray", dimColor: true, children: [" \u00B7 agent: ", keyData.default_agent_name] }))] }))] }));
|
|
37
44
|
}
|
|
38
45
|
function shortenProjectId(id, active) {
|
|
39
46
|
if (active && active.project_id === id)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KeysTab.js","sourceRoot":"","sources":["../../../src/tui/tabs/KeysTab.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"KeysTab.js","sourceRoot":"","sources":["../../../src/tui/tabs/KeysTab.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAE5D,SAAS,MAAM,CAAC,KAAe;IAC7B,MAAM,OAAO,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IACxC,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;QAClC,MAAM,GAAG,GAAG,IAAI,EAAE,YAAY,CAAC;QAC/B,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,GAAG,GAAG,KAAK,CAAC,sBAAsB,CAAC;IACzC,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,K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E,OAAO,MAAM,CAAC,IAAI,CAAC;IAC3D,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxB,CAAC"}
|
|
@@ -12,10 +12,7 @@ export function ProjectTab({ state, height }) {
|
|
|
12
12
|
}
|
|
13
13
|
return (_jsxs(Box, { flexDirection: "column", height: height, overflowY: "hidden", children: [_jsx(Box, { height: 1 }), _jsx(Field, { label: "name", children: _jsx(Text, { dimColor: true, children: project.name }) }), _jsx(Field, { label: "slug", children: _jsx(Text, { color: "gray", children: project.slug }) }), project.owner.kind === 'team'
|
|
14
14
|
? _jsxs(Field, { label: "owner", children: [_jsx(Text, { color: "gray", children: "team: " }), _jsx(Text, { dimColor: true, children: project.owner.teamName })] })
|
|
15
|
-
: _jsx(Field, { label: "owner", children: _jsx(Text, { color: "gray", children: "personal" }) }), project.created_at && (_jsx(Field, { label: "created", children: _jsx(Text, { color: "gray", children: formatDate(project.created_at) }) })), _jsx(Box, { height: 1 }), _jsx(Divider, {}), _jsx(Box, { height: 1 }), _jsx(Text, { color: "gray", dimColor: true, children: "
|
|
16
|
-
const selected = state.projectLinkSelected === i;
|
|
17
|
-
return (_jsxs(Box, { children: [_jsx(Text, { children: selected ? ' > ' : ' ' }), _jsx(Text, { ...(selected ? {} : { color: 'gray' }), children: link.slug }), _jsxs(Text, { color: "gray", dimColor: true, children: [" (", link.source, ")"] })] }, link.project_id));
|
|
18
|
-
})), state.userRole === 'admin' && (_jsxs(_Fragment, { children: [_jsx(Box, { height: 1 }), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " L " }), _jsx(Text, { dimColor: true, children: "link to another project" })] }), state.projectLinks.some(l => l.source === 'explicit') && (_jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " U " }), _jsx(Text, { dimColor: true, children: "unlink selected (explicit only)" })] }))] })), _jsx(Box, { height: 1 }), _jsx(Divider, {}), _jsx(Box, { height: 1 }), state.userRole === 'admin' && (_jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " r " }), _jsx(Text, { dimColor: true, children: "rename project" })] })), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " n " }), _jsx(Text, { dimColor: true, children: "new project" })] }), state.projects.length > 1 && (_jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " w " }), _jsx(Text, { dimColor: true, children: "switch project" })] })), state.userRole === 'admin' && (_jsxs(_Fragment, { children: [_jsx(Box, { height: 1 }), _jsx(Divider, {}), _jsx(Box, { height: 1 }), renderDestructive(state)] }))] }));
|
|
15
|
+
: _jsx(Field, { label: "owner", children: _jsx(Text, { color: "gray", children: "personal" }) }), project.created_at && (_jsx(Field, { label: "created", children: _jsx(Text, { color: "gray", children: formatDate(project.created_at) }) })), _jsx(Box, { height: 1 }), _jsx(Divider, {}), _jsx(Box, { height: 1 }), state.userRole === 'admin' && (_jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " r " }), _jsx(Text, { dimColor: true, children: "rename project" })] })), _jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " n " }), _jsx(Text, { dimColor: true, children: "new project" })] }), state.projects.length > 1 && (_jsxs(Box, { children: [_jsx(Text, { color: "gray", children: " w " }), _jsx(Text, { dimColor: true, children: "switch project" })] })), state.userRole === 'admin' && (_jsxs(_Fragment, { children: [_jsx(Box, { height: 1 }), _jsx(Divider, {}), _jsx(Box, { height: 1 }), renderDestructive(state)] }))] }));
|
|
19
16
|
}
|
|
20
17
|
function Field({ label, children }) {
|
|
21
18
|
return (_jsxs(Box, { children: [_jsx(Box, { width: 12, children: _jsxs(Text, { color: "gray", dimColor: true, children: [" ", label] }) }), children] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectTab.js","sourceRoot":"","sources":["../../../src/tui/tabs/ProjectTab.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,CAAC;AAE3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAA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