ai-agent-router 0.1.13 → 0.1.15

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.
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ // This file is generated automatically by Next.js
3
+ // Do not edit this file manually
4
+ // This file validates that all pages and layouts export the correct types
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ // Validate ../../../src/app/ide/page.tsx
7
+ {
8
+ const handler = {};
9
+ }
10
+ // Validate ../../../src/app/logs/page.tsx
11
+ {
12
+ const handler = {};
13
+ }
14
+ // Validate ../../../src/app/models/page.tsx
15
+ {
16
+ const handler = {};
17
+ }
18
+ // Validate ../../../src/app/page.tsx
19
+ {
20
+ const handler = {};
21
+ }
22
+ // Validate ../../../src/app/providers/page.tsx
23
+ {
24
+ const handler = {};
25
+ }
26
+ // Validate ../../../src/app/api/config/route.ts
27
+ {
28
+ const handler = {};
29
+ }
30
+ // Validate ../../../src/app/api/gateway/[...path]/route.ts
31
+ {
32
+ const handler = {};
33
+ }
34
+ // Validate ../../../src/app/api/gateway/models/route.ts
35
+ {
36
+ const handler = {};
37
+ }
38
+ // Validate ../../../src/app/api/gateway/route.ts
39
+ {
40
+ const handler = {};
41
+ }
42
+ // Validate ../../../src/app/api/ide/claude/apply/route.ts
43
+ {
44
+ const handler = {};
45
+ }
46
+ // Validate ../../../src/app/api/ide/claude/available-models/route.ts
47
+ {
48
+ const handler = {};
49
+ }
50
+ // Validate ../../../src/app/api/ide/claude/restore/route.ts
51
+ {
52
+ const handler = {};
53
+ }
54
+ // Validate ../../../src/app/api/ide/claude/save/route.ts
55
+ {
56
+ const handler = {};
57
+ }
58
+ // Validate ../../../src/app/api/ide/claude/status/route.ts
59
+ {
60
+ const handler = {};
61
+ }
62
+ // Validate ../../../src/app/api/ide/claude/test/route.ts
63
+ {
64
+ const handler = {};
65
+ }
66
+ // Validate ../../../src/app/api/logs/route.ts
67
+ {
68
+ const handler = {};
69
+ }
70
+ // Validate ../../../src/app/api/models/route.ts
71
+ {
72
+ const handler = {};
73
+ }
74
+ // Validate ../../../src/app/api/providers/route.ts
75
+ {
76
+ const handler = {};
77
+ }
78
+ // Validate ../../../src/app/api/providers/test/route.ts
79
+ {
80
+ const handler = {};
81
+ }
82
+ // Validate ../../../src/app/api/service/force-stop/route.ts
83
+ {
84
+ const handler = {};
85
+ }
86
+ // Validate ../../../src/app/api/service/start/route.ts
87
+ {
88
+ const handler = {};
89
+ }
90
+ // Validate ../../../src/app/api/service/status/route.ts
91
+ {
92
+ const handler = {};
93
+ }
94
+ // Validate ../../../src/app/api/service/stop/route.ts
95
+ {
96
+ const handler = {};
97
+ }
98
+ // Validate ../../../src/app/layout.tsx
99
+ {
100
+ const handler = {};
101
+ }
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ // This file is generated automatically by Next.js
3
+ // Do not edit this file manually
4
+ // This file validates that all pages and layouts export the correct types
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ // Validate ../../src/app/ide/page.tsx
7
+ {
8
+ const handler = {};
9
+ }
10
+ // Validate ../../src/app/logs/page.tsx
11
+ {
12
+ const handler = {};
13
+ }
14
+ // Validate ../../src/app/models/page.tsx
15
+ {
16
+ const handler = {};
17
+ }
18
+ // Validate ../../src/app/page.tsx
19
+ {
20
+ const handler = {};
21
+ }
22
+ // Validate ../../src/app/providers/page.tsx
23
+ {
24
+ const handler = {};
25
+ }
26
+ // Validate ../../src/app/api/config/route.ts
27
+ {
28
+ const handler = {};
29
+ }
30
+ // Validate ../../src/app/api/gateway/[...path]/route.ts
31
+ {
32
+ const handler = {};
33
+ }
34
+ // Validate ../../src/app/api/gateway/models/route.ts
35
+ {
36
+ const handler = {};
37
+ }
38
+ // Validate ../../src/app/api/gateway/route.ts
39
+ {
40
+ const handler = {};
41
+ }
42
+ // Validate ../../src/app/api/ide/claude/apply/route.ts
43
+ {
44
+ const handler = {};
45
+ }
46
+ // Validate ../../src/app/api/ide/claude/available-models/route.ts
47
+ {
48
+ const handler = {};
49
+ }
50
+ // Validate ../../src/app/api/ide/claude/restore/route.ts
51
+ {
52
+ const handler = {};
53
+ }
54
+ // Validate ../../src/app/api/ide/claude/save/route.ts
55
+ {
56
+ const handler = {};
57
+ }
58
+ // Validate ../../src/app/api/ide/claude/status/route.ts
59
+ {
60
+ const handler = {};
61
+ }
62
+ // Validate ../../src/app/api/ide/claude/test/route.ts
63
+ {
64
+ const handler = {};
65
+ }
66
+ // Validate ../../src/app/api/logs/route.ts
67
+ {
68
+ const handler = {};
69
+ }
70
+ // Validate ../../src/app/api/models/route.ts
71
+ {
72
+ const handler = {};
73
+ }
74
+ // Validate ../../src/app/api/providers/route.ts
75
+ {
76
+ const handler = {};
77
+ }
78
+ // Validate ../../src/app/api/providers/test/route.ts
79
+ {
80
+ const handler = {};
81
+ }
82
+ // Validate ../../src/app/api/service/force-stop/route.ts
83
+ {
84
+ const handler = {};
85
+ }
86
+ // Validate ../../src/app/api/service/start/route.ts
87
+ {
88
+ const handler = {};
89
+ }
90
+ // Validate ../../src/app/api/service/status/route.ts
91
+ {
92
+ const handler = {};
93
+ }
94
+ // Validate ../../src/app/api/service/stop/route.ts
95
+ {
96
+ const handler = {};
97
+ }
98
+ // Validate ../../src/app/layout.tsx
99
+ {
100
+ const handler = {};
101
+ }
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agent-router",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "A unified API gateway for managing multiple AI model providers (Anthropic, OpenAI, Gemini, etc.)",
5
5
  "main": "dist/src/cli/index.js",
6
6
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "commander": "^11.1.0",
31
31
  "crypto-js": "^4.2.0",
32
32
  "globals": "^17.0.0",
33
- "next": "^14.0.0",
33
+ "next": "^16.1.6",
34
34
  "react": "^18.2.0",
35
35
  "react-dom": "^18.2.0",
36
36
  "typescript-eslint": "^8.53.0"
@@ -12,19 +12,24 @@ const gateway_1 = require("@/server/gateway");
12
12
  // Ensure Node.js runtime (required for SQLite)
13
13
  exports.runtime = 'nodejs';
14
14
  async function POST(request, { params }) {
15
- return handleRequest(request, params, 'POST');
15
+ const resolvedParams = await params;
16
+ return handleRequest(request, resolvedParams, 'POST');
16
17
  }
17
18
  async function GET(request, { params }) {
18
- return handleRequest(request, params, 'GET');
19
+ const resolvedParams = await params;
20
+ return handleRequest(request, resolvedParams, 'GET');
19
21
  }
20
22
  async function PUT(request, { params }) {
21
- return handleRequest(request, params, 'PUT');
23
+ const resolvedParams = await params;
24
+ return handleRequest(request, resolvedParams, 'PUT');
22
25
  }
23
26
  async function PATCH(request, { params }) {
24
- return handleRequest(request, params, 'PATCH');
27
+ const resolvedParams = await params;
28
+ return handleRequest(request, resolvedParams, 'PATCH');
25
29
  }
26
30
  async function DELETE(request, { params }) {
27
- return handleRequest(request, params, 'DELETE');
31
+ const resolvedParams = await params;
32
+ return handleRequest(request, resolvedParams, 'DELETE');
28
33
  }
29
34
  async function handleRequest(request, params, method) {
30
35
  try {
@@ -0,0 +1,15 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = ConfirmDialog;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ function ConfirmDialog({ open, title, message, onConfirm, onCancel, confirmText = '确认', cancelText = '取消', type = 'info', }) {
7
+ if (!open)
8
+ return null;
9
+ const buttonColors = {
10
+ danger: 'bg-rose-500 hover:bg-rose-600 focus:ring-rose-500/50',
11
+ warning: 'bg-amber-500 hover:bg-amber-600 focus:ring-amber-500/50',
12
+ info: 'bg-emerald-600 hover:bg-emerald-700 focus:ring-emerald-500/50',
13
+ };
14
+ return ((0, jsx_runtime_1.jsx)("div", { className: "fixed z-50 inset-0 overflow-y-auto", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 bg-slate-900/40 backdrop-blur-sm transition-opacity", onClick: onCancel }), (0, jsx_runtime_1.jsx)("div", { className: "inline-block align-bottom bg-white rounded-2xl text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full border border-emerald-100/50", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-white px-5 pt-5 pb-4 sm:p-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-base font-bold text-slate-800 mb-1", children: title }), (0, jsx_runtime_1.jsx)("p", { className: "text-xs text-slate-600", children: message })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-end space-x-2", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onCancel, className: "px-3.5 py-1.5 border border-slate-200 rounded-lg text-xs font-semibold text-slate-600 bg-white hover:bg-slate-50 focus:outline-none focus:ring-2 focus:ring-offset-1 focus:ring-slate-400/30 transition-all duration-300", children: cancelText }), (0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onConfirm, className: `px-4 py-1.5 border border-transparent rounded-lg text-xs font-semibold text-white focus:outline-none focus:ring-2 focus:ring-offset-1 transition-all duration-300 ${buttonColors[type]}`, children: confirmText })] })] }) })] }) }));
15
+ }
@@ -0,0 +1,28 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.default = Nav;
8
+ const jsx_runtime_1 = require("react/jsx-runtime");
9
+ const link_1 = __importDefault(require("next/link"));
10
+ const navigation_1 = require("next/navigation");
11
+ function Nav() {
12
+ const pathname = (0, navigation_1.usePathname)();
13
+ const navItems = [
14
+ { href: '/', label: '配置' },
15
+ { href: '/ide', label: 'IDE' },
16
+ { href: '/providers', label: '供应商' },
17
+ { href: '/models', label: '模型' },
18
+ { href: '/logs', label: '日志' },
19
+ ];
20
+ return ((0, jsx_runtime_1.jsx)("nav", { className: "bg-white/70 backdrop-blur-xl border-b border-emerald-100/30 sticky top-0 z-50", children: (0, jsx_runtime_1.jsx)("div", { className: "max-w-7xl mx-auto px-6 sm:px-8 lg:px-10", children: (0, jsx_runtime_1.jsx)("div", { className: "flex items-center justify-between h-16", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-12", children: [(0, jsx_runtime_1.jsxs)(link_1.default, { href: "/", className: "flex flex-col group transition-all duration-300", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-xl font-bold text-emerald-700 group-hover:text-emerald-600 transition-colors duration-300 leading-none", children: "AAR" }), (0, jsx_runtime_1.jsx)("span", { className: "text-[9px] font-medium text-slate-400 tracking-wider uppercase mt-0.5 leading-none", children: "AI Agent Router" })] }), (0, jsx_runtime_1.jsx)("div", { className: "hidden sm:flex sm:items-center", children: navItems.map((item) => {
21
+ const isActive = pathname === item.href;
22
+ return ((0, jsx_runtime_1.jsxs)(link_1.default, { href: item.href, className: "relative inline-flex items-center justify-center w-[68px] h-9 text-xs font-medium transition-colors duration-300 group", style: { minWidth: '68px', maxWidth: '68px' }, children: [(0, jsx_runtime_1.jsx)("span", { className: `absolute inset-0 flex items-center justify-center transition-colors duration-300 ${isActive
23
+ ? 'text-emerald-700 font-semibold'
24
+ : 'text-slate-500 group-hover:text-slate-700'}`, children: item.label }), (0, jsx_runtime_1.jsx)("span", { className: `absolute inset-0 rounded-lg transition-all duration-300 ${isActive
25
+ ? 'bg-emerald-50/60'
26
+ : 'bg-transparent group-hover:bg-slate-50/40'}` })] }, item.href));
27
+ }) })] }) }) }) }));
28
+ }
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.default = Toast;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ function Toast({ message, type = 'info', onClose, duration = 3000 }) {
8
+ (0, react_1.useEffect)(() => {
9
+ const timer = setTimeout(() => {
10
+ onClose();
11
+ }, duration);
12
+ return () => clearTimeout(timer);
13
+ }, [duration, onClose]);
14
+ const colors = {
15
+ success: 'bg-emerald-500 text-white border-emerald-600/30 shadow-emerald-500/20',
16
+ error: 'bg-rose-500 text-white border-rose-600/30 shadow-rose-500/20',
17
+ info: 'bg-slate-600 text-white border-slate-700/30 shadow-slate-600/20',
18
+ };
19
+ const icons = {
20
+ success: ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M5 13l4 4L19 7" }) })),
21
+ error: ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) })),
22
+ info: ((0, jsx_runtime_1.jsx)("svg", { className: "w-3.5 h-3.5", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" }) })),
23
+ };
24
+ return ((0, jsx_runtime_1.jsx)("div", { className: "fixed top-20 left-1/2 -translate-x-1/2 z-50 animate-in slide-in-from-top fade-in duration-300", children: (0, jsx_runtime_1.jsxs)("div", { className: `flex items-center gap-2 px-3 py-2 rounded-lg shadow-lg border backdrop-blur-sm ${colors[type]}`, children: [(0, jsx_runtime_1.jsx)("span", { className: "flex-shrink-0", children: icons[type] }), (0, jsx_runtime_1.jsx)("span", { className: "text-xs font-medium leading-tight", children: message }), (0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "ml-1.5 flex-shrink-0 opacity-70 hover:opacity-100 transition-opacity p-0.5", children: (0, jsx_runtime_1.jsx)("svg", { className: "w-3 h-3", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: (0, jsx_runtime_1.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2.5, d: "M6 18L18 6M6 6l12 12" }) }) })] }) }));
25
+ }
@@ -0,0 +1,26 @@
1
+ 'use client';
2
+ "use strict";
3
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4
+ return (mod && mod.__esModule) ? mod : { "default": mod };
5
+ };
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.useToast = useToast;
8
+ exports.ToastProvider = ToastProvider;
9
+ const jsx_runtime_1 = require("react/jsx-runtime");
10
+ const react_1 = require("react");
11
+ const Toast_1 = __importDefault(require("./Toast"));
12
+ const ToastContext = (0, react_1.createContext)(undefined);
13
+ function useToast() {
14
+ const context = (0, react_1.useContext)(ToastContext);
15
+ if (!context) {
16
+ throw new Error('useToast must be used within ToastProvider');
17
+ }
18
+ return context;
19
+ }
20
+ function ToastProvider({ children }) {
21
+ const [toast, setToast] = (0, react_1.useState)(null);
22
+ const showToast = (message, type = 'info') => {
23
+ setToast({ message, type });
24
+ };
25
+ return ((0, jsx_runtime_1.jsxs)(ToastContext.Provider, { value: { showToast }, children: [children, toast && ((0, jsx_runtime_1.jsx)(Toast_1.default, { message: toast.message, type: toast.type, onClose: () => setToast(null) }))] }));
26
+ }