ai-agent-router 0.2.2 → 0.2.3

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.
Files changed (99) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +2 -2
  3. package/.next/fallback-build-manifest.json +2 -2
  4. package/.next/server/app/_global-error.html +2 -2
  5. package/.next/server/app/_global-error.rsc +1 -1
  6. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  7. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  8. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  9. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  11. package/.next/server/app/_not-found.html +1 -1
  12. package/.next/server/app/_not-found.rsc +1 -1
  13. package/.next/server/app/_not-found.segments/_full.segment.rsc +1 -1
  14. package/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  15. package/.next/server/app/_not-found.segments/_index.segment.rsc +1 -1
  16. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  17. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  18. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  19. package/.next/server/app/api/config/route.js.nft.json +1 -1
  20. package/.next/server/app/api/gateway/[...path]/route.js.nft.json +1 -1
  21. package/.next/server/app/api/gateway/models/route.js.nft.json +1 -1
  22. package/.next/server/app/api/gateway/route.js.nft.json +1 -1
  23. package/.next/server/app/api/ide/claude/apply/route.js.nft.json +1 -1
  24. package/.next/server/app/api/ide/claude/available-models/route.js.nft.json +1 -1
  25. package/.next/server/app/api/ide/claude/save/route.js.nft.json +1 -1
  26. package/.next/server/app/api/ide/claude/status/route.js.nft.json +1 -1
  27. package/.next/server/app/api/ide/claude/test/route.js.nft.json +1 -1
  28. package/.next/server/app/api/ide/openclaw/apply/route.js.nft.json +1 -1
  29. package/.next/server/app/api/ide/openclaw/available-models/route.js.nft.json +1 -1
  30. package/.next/server/app/api/ide/openclaw/preview/route.js.nft.json +1 -1
  31. package/.next/server/app/api/ide/openclaw/save/route.js.nft.json +1 -1
  32. package/.next/server/app/api/ide/openclaw/status/route.js.nft.json +1 -1
  33. package/.next/server/app/api/ide/opencode/apply/route.js.nft.json +1 -1
  34. package/.next/server/app/api/ide/opencode/available-models/route.js.nft.json +1 -1
  35. package/.next/server/app/api/ide/opencode/preview/route.js.nft.json +1 -1
  36. package/.next/server/app/api/ide/opencode/save/route.js.nft.json +1 -1
  37. package/.next/server/app/api/ide/opencode/status/route.js.nft.json +1 -1
  38. package/.next/server/app/api/logs/route.js.nft.json +1 -1
  39. package/.next/server/app/api/models/route.js.nft.json +1 -1
  40. package/.next/server/app/api/providers/route.js.nft.json +1 -1
  41. package/.next/server/app/api/providers/test/route.js.nft.json +1 -1
  42. package/.next/server/app/api/service/force-stop/route.js.nft.json +1 -1
  43. package/.next/server/app/api/service/start/route.js.nft.json +1 -1
  44. package/.next/server/app/api/service/status/route.js.nft.json +1 -1
  45. package/.next/server/app/api/service/stop/route.js.nft.json +1 -1
  46. package/.next/server/app/ide.html +1 -1
  47. package/.next/server/app/ide.rsc +1 -1
  48. package/.next/server/app/ide.segments/_full.segment.rsc +1 -1
  49. package/.next/server/app/ide.segments/_head.segment.rsc +1 -1
  50. package/.next/server/app/ide.segments/_index.segment.rsc +1 -1
  51. package/.next/server/app/ide.segments/_tree.segment.rsc +1 -1
  52. package/.next/server/app/ide.segments/ide/__PAGE__.segment.rsc +1 -1
  53. package/.next/server/app/ide.segments/ide.segment.rsc +1 -1
  54. package/.next/server/app/index.html +1 -1
  55. package/.next/server/app/index.rsc +1 -1
  56. package/.next/server/app/index.segments/__PAGE__.segment.rsc +1 -1
  57. package/.next/server/app/index.segments/_full.segment.rsc +1 -1
  58. package/.next/server/app/index.segments/_head.segment.rsc +1 -1
  59. package/.next/server/app/index.segments/_index.segment.rsc +1 -1
  60. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  61. package/.next/server/app/logs.html +1 -1
  62. package/.next/server/app/logs.rsc +1 -1
  63. package/.next/server/app/logs.segments/_full.segment.rsc +1 -1
  64. package/.next/server/app/logs.segments/_head.segment.rsc +1 -1
  65. package/.next/server/app/logs.segments/_index.segment.rsc +1 -1
  66. package/.next/server/app/logs.segments/_tree.segment.rsc +1 -1
  67. package/.next/server/app/logs.segments/logs/__PAGE__.segment.rsc +1 -1
  68. package/.next/server/app/logs.segments/logs.segment.rsc +1 -1
  69. package/.next/server/app/models.html +1 -1
  70. package/.next/server/app/models.rsc +1 -1
  71. package/.next/server/app/models.segments/_full.segment.rsc +1 -1
  72. package/.next/server/app/models.segments/_head.segment.rsc +1 -1
  73. package/.next/server/app/models.segments/_index.segment.rsc +1 -1
  74. package/.next/server/app/models.segments/_tree.segment.rsc +1 -1
  75. package/.next/server/app/models.segments/models/__PAGE__.segment.rsc +1 -1
  76. package/.next/server/app/models.segments/models.segment.rsc +1 -1
  77. package/.next/server/app/providers.html +1 -1
  78. package/.next/server/app/providers.rsc +1 -1
  79. package/.next/server/app/providers.segments/_full.segment.rsc +1 -1
  80. package/.next/server/app/providers.segments/_head.segment.rsc +1 -1
  81. package/.next/server/app/providers.segments/_index.segment.rsc +1 -1
  82. package/.next/server/app/providers.segments/_tree.segment.rsc +1 -1
  83. package/.next/server/app/providers.segments/providers/__PAGE__.segment.rsc +1 -1
  84. package/.next/server/app/providers.segments/providers.segment.rsc +1 -1
  85. package/.next/server/chunks/[root-of-the-server]__c1b4b601._.js +6 -6
  86. package/.next/server/chunks/[root-of-the-server]__c1b4b601._.js.map +1 -1
  87. package/.next/server/chunks/ssr/_69468f4c._.js +1 -1
  88. package/.next/server/chunks/ssr/_69468f4c._.js.map +1 -1
  89. package/.next/server/pages/404.html +1 -1
  90. package/.next/server/pages/500.html +2 -2
  91. package/dist/package.json +3 -2
  92. package/dist/src/cli/index.js +3 -3
  93. package/dist/src/db/database.js +19 -21
  94. package/package.json +3 -2
  95. package/src/cli/index.ts +4 -4
  96. package/src/db/database.ts +18 -25
  97. /package/.next/static/{cf2SWIkI5HVbnDjLExI42 → Xp9f-NEeGeBKhqaJCVH8D}/_buildManifest.js +0 -0
  98. /package/.next/static/{cf2SWIkI5HVbnDjLExI42 → Xp9f-NEeGeBKhqaJCVH8D}/_clientMiddlewareManifest.json +0 -0
  99. /package/.next/static/{cf2SWIkI5HVbnDjLExI42 → Xp9f-NEeGeBKhqaJCVH8D}/_ssgManifest.js +0 -0
@@ -1,3 +1,3 @@
1
- module.exports=[76470,a=>{"use strict";a.s(["ToastProvider",()=>c,"useToast",()=>d]);var b=a.i(11857);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ToastProvider() from the server but ToastProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx <module evaluation>","ToastProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useToast() from the server but useToast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx <module evaluation>","useToast")},11328,a=>{"use strict";a.s(["ToastProvider",()=>c,"useToast",()=>d]);var b=a.i(11857);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ToastProvider() from the server but ToastProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx","ToastProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useToast() from the server but useToast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx","useToast")},79490,a=>{"use strict";a.i(76470);var b=a.i(11328);a.n(b)},4730,a=>{a.v({name:"ai-agent-router",version:"0.2.2",description:"A unified API gateway for managing multiple AI model providers (Anthropic, OpenAI, Gemini, etc.)",main:"dist/src/cli/index.js",bin:{aar:"./dist/src/cli/index.js"},scripts:{dev:"next dev -p 9527",build:"next build && tsc",start:"node dist/src/cli/index.js start",stop:"node dist/src/cli/index.js stop",lint:"eslint .",pub:"npm run build && npm publish","type-check":"tsc --noEmit"},keywords:["api-gateway","ai","openai","anthropic","gemini","proxy"],author:"",license:"MIT",dependencies:{"@anthropic-ai/sdk":"^0.71.2","sql.js":"^1.13.0",commander:"^11.1.0","crypto-js":"^4.2.0",globals:"^17.0.0",next:"^16.1.6",react:"^18.2.0","react-dom":"^18.2.0","typescript-eslint":"^8.53.0",autoprefixer:"^10.4.0",postcss:"^8.4.0",tailwindcss:"^3.3.0"},devDependencies:{"@types/sql.js":"^1.4.9","@types/crypto-js":"^4.2.0","@types/node":"^20.10.0","@types/react":"^18.2.0","@types/react-dom":"^18.2.0",eslint:"^9.39.2","eslint-config-next":"^16.1.1",typescript:"^5.3.0"},engines:{node:">=18.0.0"}})},27572,a=>{"use strict";var b=a.i(7997),c=a.i(79490),d=a.i(4730);function e(){return(0,b.jsx)("footer",{className:"fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200",children:(0,b.jsxs)("span",{children:["AAR v",d.default.version]})})}function f({children:a}){return(0,b.jsx)("html",{lang:"zh-CN",suppressHydrationWarning:!0,children:(0,b.jsxs)("body",{className:"pb-10",children:[(0,b.jsx)(c.ToastProvider,{children:a}),(0,b.jsx)(e,{})]})})}a.s(["default",()=>f,"metadata",0,{title:"AAR - AI Agent Router",description:"Unified API gateway for managing multiple AI model providers"}],27572)}];
1
+ module.exports=[76470,a=>{"use strict";a.s(["ToastProvider",()=>c,"useToast",()=>d]);var b=a.i(11857);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ToastProvider() from the server but ToastProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx <module evaluation>","ToastProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useToast() from the server but useToast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx <module evaluation>","useToast")},11328,a=>{"use strict";a.s(["ToastProvider",()=>c,"useToast",()=>d]);var b=a.i(11857);let c=(0,b.registerClientReference)(function(){throw Error("Attempted to call ToastProvider() from the server but ToastProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx","ToastProvider"),d=(0,b.registerClientReference)(function(){throw Error("Attempted to call useToast() from the server but useToast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.")},"[project]/src/app/components/ToastProvider.tsx","useToast")},79490,a=>{"use strict";a.i(76470);var b=a.i(11328);a.n(b)},4730,a=>{a.v({name:"ai-agent-router",version:"0.2.3",description:"A unified API gateway for managing multiple AI model providers (Anthropic, OpenAI, Gemini, etc.)",main:"dist/src/cli/index.js",bin:{aar:"./dist/src/cli/index.js","ai-agent-router":"./dist/src/cli/index.js"},scripts:{dev:"next dev -p 9527",build:"next build && tsc",start:"node dist/src/cli/index.js start",stop:"node dist/src/cli/index.js stop",lint:"eslint .",pub:"npm run build && npm publish","type-check":"tsc --noEmit"},keywords:["api-gateway","ai","openai","anthropic","gemini","proxy"],author:"",license:"MIT",dependencies:{"@anthropic-ai/sdk":"^0.71.2","sql.js":"^1.13.0",commander:"^11.1.0","crypto-js":"^4.2.0",globals:"^17.0.0",next:"^16.1.6",react:"^18.2.0","react-dom":"^18.2.0","typescript-eslint":"^8.53.0",autoprefixer:"^10.4.0",postcss:"^8.4.0",tailwindcss:"^3.3.0"},devDependencies:{"@types/sql.js":"^1.4.9","@types/crypto-js":"^4.2.0","@types/node":"^20.10.0","@types/react":"^18.2.0","@types/react-dom":"^18.2.0",eslint:"^9.39.2","eslint-config-next":"^16.1.1",typescript:"^5.3.0"},engines:{node:">=18.0.0"}})},27572,a=>{"use strict";var b=a.i(7997),c=a.i(79490),d=a.i(4730);function e(){return(0,b.jsx)("footer",{className:"fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200",children:(0,b.jsxs)("span",{children:["AAR v",d.default.version]})})}function f({children:a}){return(0,b.jsx)("html",{lang:"zh-CN",suppressHydrationWarning:!0,children:(0,b.jsxs)("body",{className:"pb-10",children:[(0,b.jsx)(c.ToastProvider,{children:a}),(0,b.jsx)(e,{})]})})}a.s(["default",()=>f,"metadata",0,{title:"AAR - AI Agent Router",description:"Unified API gateway for managing multiple AI model providers"}],27572)}];
2
2
 
3
3
  //# sourceMappingURL=_69468f4c._.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/app/components/ToastProvider.tsx/__nextjs-internal-proxy.mjs","turbopack:///[project]/package.json","../../../../src/app/layout.tsx","../../../../src/app/components/Footer.tsx"],"sourcesContent":["// This file is generated by next-core EcmascriptClientReferenceModule.\nimport { registerClientReference } from \"react-server-dom-turbopack/server\";\nexport const ToastProvider = registerClientReference(\n function() { throw new Error(\"Attempted to call ToastProvider() from the server but ToastProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.\"); },\n \"[project]/src/app/components/ToastProvider.tsx\",\n \"ToastProvider\",\n);\nexport const useToast = registerClientReference(\n function() { throw new Error(\"Attempted to call useToast() from the server but useToast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.\"); },\n \"[project]/src/app/components/ToastProvider.tsx\",\n \"useToast\",\n);\n","{\"name\":\"ai-agent-router\",\"version\":\"0.2.2\",\"description\":\"A unified API gateway for managing multiple AI model providers (Anthropic, OpenAI, Gemini, etc.)\",\"main\":\"dist/src/cli/index.js\",\"bin\":{\"aar\":\"./dist/src/cli/index.js\"},\"scripts\":{\"dev\":\"next dev -p 9527\",\"build\":\"next build && tsc\",\"start\":\"node dist/src/cli/index.js start\",\"stop\":\"node dist/src/cli/index.js stop\",\"lint\":\"eslint .\",\"pub\":\"npm run build && npm publish\",\"type-check\":\"tsc --noEmit\"},\"keywords\":[\"api-gateway\",\"ai\",\"openai\",\"anthropic\",\"gemini\",\"proxy\"],\"author\":\"\",\"license\":\"MIT\",\"dependencies\":{\"@anthropic-ai/sdk\":\"^0.71.2\",\"sql.js\":\"^1.13.0\",\"commander\":\"^11.1.0\",\"crypto-js\":\"^4.2.0\",\"globals\":\"^17.0.0\",\"next\":\"^16.1.6\",\"react\":\"^18.2.0\",\"react-dom\":\"^18.2.0\",\"typescript-eslint\":\"^8.53.0\",\"autoprefixer\":\"^10.4.0\",\"postcss\":\"^8.4.0\",\"tailwindcss\":\"^3.3.0\"},\"devDependencies\":{\"@types/sql.js\":\"^1.4.9\",\"@types/crypto-js\":\"^4.2.0\",\"@types/node\":\"^20.10.0\",\"@types/react\":\"^18.2.0\",\"@types/react-dom\":\"^18.2.0\",\"eslint\":\"^9.39.2\",\"eslint-config-next\":\"^16.1.1\",\"typescript\":\"^5.3.0\"},\"engines\":{\"node\":\">=18.0.0\"}}","import type { Metadata } from 'next';\nimport './globals.css';\nimport { ToastProvider } from './components/ToastProvider';\nimport Footer from './components/Footer';\n\nexport const metadata: Metadata = {\n title: 'AAR - AI Agent Router',\n description: 'Unified API gateway for managing multiple AI model providers',\n};\n\nexport default function RootLayout({\n children,\n}: {\n children: React.ReactNode;\n}) {\n return (\n <html lang=\"zh-CN\" suppressHydrationWarning>\n <body className=\"pb-10\">\n <ToastProvider>{children}</ToastProvider>\n <Footer />\n </body>\n </html>\n );\n}\n","import packageJson from '../../../package.json';\n\nexport default function Footer() {\n return (\n <footer className=\"fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200\">\n <span>AAR v{packageJson.version}</span>\n </footer>\n );\n}\n"],"names":[],"mappings":"qFACA,IAAA,EAAA,EAAA,CAAA,CAAA,OACO,IAAM,EAAgB,CAAA,EAAA,EAAA,uBAAA,AAAuB,EAChD,WAAa,MAAM,AAAI,MAAM,wOAA0O,EACvQ,qEACA,iBAES,EAAW,CAAA,EAAA,EAAA,uBAAA,AAAuB,EAC3C,WAAa,MAAM,AAAI,MAAM,8NAAgO,EAC7P,qEACA,kFATJ,IAAA,EAAA,EAAA,CAAA,CAAA,OACO,IAAM,EAAgB,CAAA,EAAA,EAAA,uBAAA,AAAuB,EAChD,WAAa,MAAM,AAAI,MAAM,wOAA0O,EACvQ,iDACA,iBAES,EAAW,CAAA,EAAA,EAAA,uBAAA,AAAuB,EAC3C,WAAa,MAAM,AAAI,MAAM,8NAAgO,EAC7P,iDACA,iFCVJ,EAAA,CAAA,CAAA,CAAA,KAAA,kBAAA,QAAA,QAAA,YAAA,mGAAA,KAAA,wBAAA,IAAA,CAAA,IAAA,yBAAA,EAAA,QAAA,CAAA,IAAA,mBAAA,MAAA,oBAAA,MAAA,mCAAA,KAAA,kCAAA,KAAA,WAAA,IAAA,+BAAA,aAAA,cAAA,EAAA,SAAA,CAAA,cAAA,KAAA,SAAA,YAAA,SAAA,QAAA,CAAA,OAAA,GAAA,QAAA,MAAA,aAAA,CAAA,oBAAA,UAAA,SAAA,UAAA,UAAA,UAAA,YAAA,SAAA,QAAA,UAAA,KAAA,UAAA,MAAA,UAAA,YAAA,UAAA,oBAAA,UAAA,aAAA,UAAA,QAAA,SAAA,YAAA,QAAA,EAAA,gBAAA,CAAA,gBAAA,SAAA,mBAAA,SAAA,cAAA,WAAA,eAAA,UAAA,mBAAA,UAAA,OAAA,UAAA,qBAAA,UAAA,WAAA,QAAA,EAAA,QAAA,CAAA,KAAA,UAAA,CAAA,E,yCCEA,EAAA,EAAA,CAAA,CAAA,OCFA,EAAA,EAAA,CAAA,CAAA,MAEe,SAAS,IACtB,MACE,CAAA,EAAA,EAAA,GAAA,EAAC,SAAA,CAAO,UAAU,oHAChB,CAAA,EAAA,EAAA,IAAA,EAAC,OAAA,WAAK,QAAM,EAAA,OAAW,CAAC,OAAO,KAGrC,CDEe,SAAS,EAAW,UACjC,CAAQ,CAGT,EACC,MACE,CAAA,EAAA,EAAA,GAAA,EAAC,OAAA,CAAK,KAAK,QAAQ,wBAAwB,CAAA,CAAA,WACzC,CAAA,EAAA,EAAA,IAAA,EAAC,OAAA,CAAK,UAAU,kBACd,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,aAAa,CAAA,UAAE,IAChB,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,CAAA,OAIT,mCAlBkC,CAChC,MAAO,wBACP,YAAa,8DACf","ignoreList":[0]}
1
+ {"version":3,"sources":["../../../../src/app/components/ToastProvider.tsx/__nextjs-internal-proxy.mjs","turbopack:///[project]/package.json","../../../../src/app/layout.tsx","../../../../src/app/components/Footer.tsx"],"sourcesContent":["// This file is generated by next-core EcmascriptClientReferenceModule.\nimport { registerClientReference } from \"react-server-dom-turbopack/server\";\nexport const ToastProvider = registerClientReference(\n function() { throw new Error(\"Attempted to call ToastProvider() from the server but ToastProvider is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.\"); },\n \"[project]/src/app/components/ToastProvider.tsx\",\n \"ToastProvider\",\n);\nexport const useToast = registerClientReference(\n function() { throw new Error(\"Attempted to call useToast() from the server but useToast is on the client. It's not possible to invoke a client function from the server, it can only be rendered as a Component or passed to props of a Client Component.\"); },\n \"[project]/src/app/components/ToastProvider.tsx\",\n \"useToast\",\n);\n","{\"name\":\"ai-agent-router\",\"version\":\"0.2.3\",\"description\":\"A unified API gateway for managing multiple AI model providers (Anthropic, OpenAI, Gemini, etc.)\",\"main\":\"dist/src/cli/index.js\",\"bin\":{\"aar\":\"./dist/src/cli/index.js\",\"ai-agent-router\":\"./dist/src/cli/index.js\"},\"scripts\":{\"dev\":\"next dev -p 9527\",\"build\":\"next build && tsc\",\"start\":\"node dist/src/cli/index.js start\",\"stop\":\"node dist/src/cli/index.js stop\",\"lint\":\"eslint .\",\"pub\":\"npm run build && npm publish\",\"type-check\":\"tsc --noEmit\"},\"keywords\":[\"api-gateway\",\"ai\",\"openai\",\"anthropic\",\"gemini\",\"proxy\"],\"author\":\"\",\"license\":\"MIT\",\"dependencies\":{\"@anthropic-ai/sdk\":\"^0.71.2\",\"sql.js\":\"^1.13.0\",\"commander\":\"^11.1.0\",\"crypto-js\":\"^4.2.0\",\"globals\":\"^17.0.0\",\"next\":\"^16.1.6\",\"react\":\"^18.2.0\",\"react-dom\":\"^18.2.0\",\"typescript-eslint\":\"^8.53.0\",\"autoprefixer\":\"^10.4.0\",\"postcss\":\"^8.4.0\",\"tailwindcss\":\"^3.3.0\"},\"devDependencies\":{\"@types/sql.js\":\"^1.4.9\",\"@types/crypto-js\":\"^4.2.0\",\"@types/node\":\"^20.10.0\",\"@types/react\":\"^18.2.0\",\"@types/react-dom\":\"^18.2.0\",\"eslint\":\"^9.39.2\",\"eslint-config-next\":\"^16.1.1\",\"typescript\":\"^5.3.0\"},\"engines\":{\"node\":\">=18.0.0\"}}","import type { Metadata } from 'next';\nimport './globals.css';\nimport { ToastProvider } from './components/ToastProvider';\nimport Footer from './components/Footer';\n\nexport const metadata: Metadata = {\n title: 'AAR - AI Agent Router',\n description: 'Unified API gateway for managing multiple AI model providers',\n};\n\nexport default function RootLayout({\n children,\n}: {\n children: React.ReactNode;\n}) {\n return (\n <html lang=\"zh-CN\" suppressHydrationWarning>\n <body className=\"pb-10\">\n <ToastProvider>{children}</ToastProvider>\n <Footer />\n </body>\n </html>\n );\n}\n","import packageJson from '../../../package.json';\n\nexport default function Footer() {\n return (\n <footer className=\"fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200\">\n <span>AAR v{packageJson.version}</span>\n </footer>\n );\n}\n"],"names":[],"mappings":"qFACA,IAAA,EAAA,EAAA,CAAA,CAAA,OACO,IAAM,EAAgB,CAAA,EAAA,EAAA,uBAAA,AAAuB,EAChD,WAAa,MAAM,AAAI,MAAM,wOAA0O,EACvQ,qEACA,iBAES,EAAW,CAAA,EAAA,EAAA,uBAAA,AAAuB,EAC3C,WAAa,MAAM,AAAI,MAAM,8NAAgO,EAC7P,qEACA,kFATJ,IAAA,EAAA,EAAA,CAAA,CAAA,OACO,IAAM,EAAgB,CAAA,EAAA,EAAA,uBAAA,AAAuB,EAChD,WAAa,MAAM,AAAI,MAAM,wOAA0O,EACvQ,iDACA,iBAES,EAAW,CAAA,EAAA,EAAA,uBAAA,AAAuB,EAC3C,WAAa,MAAM,AAAI,MAAM,8NAAgO,EAC7P,iDACA,iFCVJ,EAAA,CAAA,CAAA,CAAA,KAAA,kBAAA,QAAA,QAAA,YAAA,mGAAA,KAAA,wBAAA,IAAA,CAAA,IAAA,0BAAA,kBAAA,yBAAA,EAAA,QAAA,CAAA,IAAA,mBAAA,MAAA,oBAAA,MAAA,mCAAA,KAAA,kCAAA,KAAA,WAAA,IAAA,+BAAA,aAAA,cAAA,EAAA,SAAA,CAAA,cAAA,KAAA,SAAA,YAAA,SAAA,QAAA,CAAA,OAAA,GAAA,QAAA,MAAA,aAAA,CAAA,oBAAA,UAAA,SAAA,UAAA,UAAA,UAAA,YAAA,SAAA,QAAA,UAAA,KAAA,UAAA,MAAA,UAAA,YAAA,UAAA,oBAAA,UAAA,aAAA,UAAA,QAAA,SAAA,YAAA,QAAA,EAAA,gBAAA,CAAA,gBAAA,SAAA,mBAAA,SAAA,cAAA,WAAA,eAAA,UAAA,mBAAA,UAAA,OAAA,UAAA,qBAAA,UAAA,WAAA,QAAA,EAAA,QAAA,CAAA,KAAA,UAAA,CAAA,E,yCCEA,EAAA,EAAA,CAAA,CAAA,OCFA,EAAA,EAAA,CAAA,CAAA,MAEe,SAAS,IACtB,MACE,CAAA,EAAA,EAAA,GAAA,EAAC,SAAA,CAAO,UAAU,oHAChB,CAAA,EAAA,EAAA,IAAA,EAAC,OAAA,WAAK,QAAM,EAAA,OAAW,CAAC,OAAO,KAGrC,CDEe,SAAS,EAAW,UACjC,CAAQ,CAGT,EACC,MACE,CAAA,EAAA,EAAA,GAAA,EAAC,OAAA,CAAK,KAAK,QAAQ,wBAAwB,CAAA,CAAA,WACzC,CAAA,EAAA,EAAA,IAAA,EAAC,OAAA,CAAK,UAAU,kBACd,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,aAAa,CAAA,UAAE,IAChB,CAAA,EAAA,EAAA,GAAA,EAAC,EAAA,CAAA,OAIT,mCAlBkC,CAChC,MAAO,wBACP,YAAa,8DACf","ignoreList":[0]}
@@ -1 +1 @@
1
- <!DOCTYPE html><!--cf2SWIkI5HVbnDjLExI42--><html lang="zh-CN"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/6992685fe009e8fd.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/6e0dee5b6681763c.js"/><script src="/_next/static/chunks/f2f58a7e93290fbb.js" async=""></script><script src="/_next/static/chunks/a7f539bf6487f4ff.js" async=""></script><script src="/_next/static/chunks/turbopack-fdb839c72e10c2ea.js" async=""></script><script src="/_next/static/chunks/75f76753fd97c8fd.js" async=""></script><script src="/_next/static/chunks/d2be314c3ece3fbe.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>AAR - AI Agent Router</title><meta name="description" content="Unified API gateway for managing multiple AI model providers"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="pb-10"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><footer class="fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200"><span>AAR v<!-- -->0.2.2</span></footer><script src="/_next/static/chunks/6e0dee5b6681763c.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[97100,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"ToastProvider\"]\n3:I[39756,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n4:I[37457,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n5:I[97367,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"OutletBoundary\"]\n6:\"$Sreact.suspense\"\n8:I[97367,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"ViewportBoundary\"]\na:I[97367,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"MetadataBoundary\"]\nc:I[68027,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n:HL[\"/_next/static/chunks/6992685fe009e8fd.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"cf2SWIkI5HVbnDjLExI42\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/6992685fe009e8fd.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/75f76753fd97c8fd.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/d2be314c3ece3fbe.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"zh-CN\",\"suppressHydrationWarning\":true,\"children\":[\"$\",\"body\",null,{\"className\":\"pb-10\",\"children\":[[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}],[\"$\",\"footer\",null,{\"className\":\"fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200\",\"children\":[\"$\",\"span\",null,{\"children\":[\"AAR v\",\"0.2.2\"]}]}]]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L5\",null,{\"children\":[\"$\",\"$6\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@7\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$6\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"7:null\nb:[[\"$\",\"title\",\"0\",{\"children\":\"AAR - AI Agent Router\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Unified API gateway for managing multiple AI model providers\"}]]\n"])</script></body></html>
1
+ <!DOCTYPE html><!--Xp9f_NEeGeBKhqaJCVH8D--><html lang="zh-CN"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/chunks/6992685fe009e8fd.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/6e0dee5b6681763c.js"/><script src="/_next/static/chunks/f2f58a7e93290fbb.js" async=""></script><script src="/_next/static/chunks/a7f539bf6487f4ff.js" async=""></script><script src="/_next/static/chunks/turbopack-fdb839c72e10c2ea.js" async=""></script><script src="/_next/static/chunks/75f76753fd97c8fd.js" async=""></script><script src="/_next/static/chunks/d2be314c3ece3fbe.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>AAR - AI Agent Router</title><meta name="description" content="Unified API gateway for managing multiple AI model providers"/><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body class="pb-10"><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><!--$--><!--/$--><footer class="fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200"><span>AAR v<!-- -->0.2.3</span></footer><script src="/_next/static/chunks/6e0dee5b6681763c.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[97100,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"ToastProvider\"]\n3:I[39756,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n4:I[37457,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n5:I[97367,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"OutletBoundary\"]\n6:\"$Sreact.suspense\"\n8:I[97367,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"ViewportBoundary\"]\na:I[97367,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"MetadataBoundary\"]\nc:I[68027,[\"/_next/static/chunks/75f76753fd97c8fd.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n:HL[\"/_next/static/chunks/6992685fe009e8fd.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"Xp9f-NEeGeBKhqaJCVH8D\",\"c\":[\"\",\"_not-found\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/chunks/6992685fe009e8fd.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\",\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/75f76753fd97c8fd.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/d2be314c3ece3fbe.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"html\",null,{\"lang\":\"zh-CN\",\"suppressHydrationWarning\":true,\"children\":[\"$\",\"body\",null,{\"className\":\"pb-10\",\"children\":[[\"$\",\"$L2\",null,{\"children\":[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":404}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]],[]],\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]}],[\"$\",\"footer\",null,{\"className\":\"fixed bottom-0 left-0 right-0 py-2 text-center text-xs text-gray-400 bg-gray-50 border-t border-gray-200\",\"children\":[\"$\",\"span\",null,{\"children\":[\"AAR v\",\"0.2.3\"]}]}]]}]}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L3\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L4\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:style\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:1:props:style\",\"children\":404}],[\"$\",\"div\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:2:props:style\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$0:f:0:1:0:props:children:1:props:children:props:children:0:props:children:props:notFound:0:1:props:children:props:children:2:props:children:props:style\",\"children\":\"This page could not be found.\"}]}]]}]}]],null,[\"$\",\"$L5\",null,{\"children\":[\"$\",\"$6\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@7\"}]}]]}],{},null,false,false]},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],[\"$\",\"$L8\",null,{\"children\":\"$L9\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$La\",null,{\"children\":[\"$\",\"$6\",null,{\"name\":\"Next.Metadata\",\"children\":\"$Lb\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$c\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"9:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"7:null\nb:[[\"$\",\"title\",\"0\",{\"children\":\"AAR - AI Agent Router\"}],[\"$\",\"meta\",\"1\",{\"name\":\"description\",\"content\":\"Unified API gateway for managing multiple AI model providers\"}]]\n"])</script></body></html>
@@ -1,2 +1,2 @@
1
- <!DOCTYPE html><!--cf2SWIkI5HVbnDjLExI42--><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/6e0dee5b6681763c.js"/><script src="/_next/static/chunks/f2f58a7e93290fbb.js" async=""></script><script src="/_next/static/chunks/a7f539bf6487f4ff.js" async=""></script><script src="/_next/static/chunks/turbopack-fdb839c72e10c2ea.js" async=""></script><script src="/_next/static/chunks/ff1a16fafef87110.js" async=""></script><script src="/_next/static/chunks/d2be314c3ece3fbe.js" async=""></script><title>500: Internal Server Error.</title><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}
2
- @media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/6e0dee5b6681763c.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[39756,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n3:I[37457,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n4:I[97367,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[97367,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"ViewportBoundary\"]\n9:I[97367,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"MetadataBoundary\"]\nb:I[68027,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"cf2SWIkI5HVbnDjLExI42\",\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"title\",null,{\"children\":\"500: Internal Server Error.\"}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"lineHeight\":\"48px\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}\\n@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"paddingRight\":23,\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\"},\"children\":\"500\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"28px\"},\"children\":\"Internal Server Error.\"}]}]]}]}]}]]}],[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/ff1a16fafef87110.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/d2be314c3ece3fbe.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L7\",null,{\"children\":\"$L8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$La\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\na:[]\n"])</script></body></html>
1
+ <!DOCTYPE html><!--Xp9f_NEeGeBKhqaJCVH8D--><html id="__next_error__"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/6e0dee5b6681763c.js"/><script src="/_next/static/chunks/f2f58a7e93290fbb.js" async=""></script><script src="/_next/static/chunks/a7f539bf6487f4ff.js" async=""></script><script src="/_next/static/chunks/turbopack-fdb839c72e10c2ea.js" async=""></script><script src="/_next/static/chunks/ff1a16fafef87110.js" async=""></script><script src="/_next/static/chunks/d2be314c3ece3fbe.js" async=""></script><title>500: Internal Server Error.</title><script src="/_next/static/chunks/a6dad97d9634a72d.js" noModule=""></script></head><body><div hidden=""><!--$--><!--/$--></div><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}
2
+ @media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error.</h2></div></div></div><!--$--><!--/$--><script src="/_next/static/chunks/6e0dee5b6681763c.js" id="_R_" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0])</script><script>self.__next_f.push([1,"1:\"$Sreact.fragment\"\n2:I[39756,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n3:I[37457,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n4:I[97367,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"OutletBoundary\"]\n5:\"$Sreact.suspense\"\n7:I[97367,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"ViewportBoundary\"]\n9:I[97367,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"MetadataBoundary\"]\nb:I[68027,[\"/_next/static/chunks/ff1a16fafef87110.js\",\"/_next/static/chunks/d2be314c3ece3fbe.js\"],\"default\"]\n"])</script><script>self.__next_f.push([1,"0:{\"P\":null,\"b\":\"Xp9f-NEeGeBKhqaJCVH8D\",\"c\":[\"\",\"_global-error\"],\"q\":\"\",\"i\":false,\"f\":[[[\"\",{\"children\":[\"__PAGE__\",{}]}],[[\"$\",\"$1\",\"c\",{\"children\":[null,[\"$\",\"$L2\",null,{\"parallelRouterKey\":\"children\",\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L3\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"forbidden\":\"$undefined\",\"unauthorized\":\"$undefined\"}]]}],{\"children\":[[\"$\",\"$1\",\"c\",{\"children\":[[\"$\",\"html\",null,{\"id\":\"__next_error__\",\"children\":[[\"$\",\"head\",null,{\"children\":[\"$\",\"title\",null,{\"children\":\"500: Internal Server Error.\"}]}],[\"$\",\"body\",null,{\"children\":[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"style\":{\"lineHeight\":\"48px\"},\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}\\n@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"paddingRight\":23,\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\"},\"children\":\"500\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"28px\"},\"children\":\"Internal Server Error.\"}]}]]}]}]}]]}],[[\"$\",\"script\",\"script-0\",{\"src\":\"/_next/static/chunks/ff1a16fafef87110.js\",\"async\":true,\"nonce\":\"$undefined\"}],[\"$\",\"script\",\"script-1\",{\"src\":\"/_next/static/chunks/d2be314c3ece3fbe.js\",\"async\":true,\"nonce\":\"$undefined\"}]],[\"$\",\"$L4\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.MetadataOutlet\",\"children\":\"$@6\"}]}]]}],{},null,false,false]},null,false,false],[\"$\",\"$1\",\"h\",{\"children\":[null,[\"$\",\"$L7\",null,{\"children\":\"$L8\"}],[\"$\",\"div\",null,{\"hidden\":true,\"children\":[\"$\",\"$L9\",null,{\"children\":[\"$\",\"$5\",null,{\"name\":\"Next.Metadata\",\"children\":\"$La\"}]}]}],null]}],false]],\"m\":\"$undefined\",\"G\":[\"$b\",\"$undefined\"],\"S\":true}\n"])</script><script>self.__next_f.push([1,"8:[[\"$\",\"meta\",\"0\",{\"charSet\":\"utf-8\"}],[\"$\",\"meta\",\"1\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}]]\n"])</script><script>self.__next_f.push([1,"6:null\na:[]\n"])</script></body></html>
package/dist/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "ai-agent-router",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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": {
7
- "aar": "./dist/src/cli/index.js"
7
+ "aar": "./dist/src/cli/index.js",
8
+ "ai-agent-router": "./dist/src/cli/index.js"
8
9
  },
9
10
  "scripts": {
10
11
  "dev": "next dev -p 9527",
@@ -111,7 +111,7 @@ program
111
111
  const gatewayScriptPath = path_1.default.join(packageRoot, 'dist', 'src', 'cli', 'gateway-server.js');
112
112
  if (background) {
113
113
  ensureAarDir();
114
- const envBase = { ...process.env, NODE_ENV: 'production' };
114
+ const envBase = { ...process.env, NODE_ENV: 'production', SQLJS_WASM_PATH: (0, database_1.getSqlJsWasmPath)() };
115
115
  const uiProc = (0, child_process_1.spawn)(process.execPath, [serverPath, 'start', '-p', uiPort.toString()], {
116
116
  cwd: packageRoot,
117
117
  env: { ...envBase, PORT: uiPort.toString() },
@@ -157,7 +157,7 @@ program
157
157
  const uiProcess = (0, child_process_1.spawn)(process.execPath, [serverPath, 'start', '-p', uiPort.toString()], {
158
158
  cwd: packageRoot,
159
159
  stdio: ['ignore', 'inherit', 'inherit'],
160
- env: { ...process.env, PORT: uiPort.toString(), NODE_ENV: 'production' },
160
+ env: { ...process.env, PORT: uiPort.toString(), NODE_ENV: 'production', SQLJS_WASM_PATH: (0, database_1.getSqlJsWasmPath)() },
161
161
  });
162
162
  uiProcess.on('error', (error) => {
163
163
  console.error(`Failed to start Web UI: ${error.message}`);
@@ -167,7 +167,7 @@ program
167
167
  ? (0, child_process_1.spawn)(process.execPath, [gatewayScriptPath, '--port', String(gatewayPort)], {
168
168
  cwd: packageRoot,
169
169
  stdio: ['ignore', 'pipe', 'pipe'],
170
- env: { ...process.env, NODE_ENV: 'production' },
170
+ env: { ...process.env, NODE_ENV: 'production', SQLJS_WASM_PATH: (0, database_1.getSqlJsWasmPath)() },
171
171
  })
172
172
  : null;
173
173
  if (gatewayProcess?.stdout) {
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getSqlJsWasmPath = getSqlJsWasmPath;
6
7
  exports.getDatabase = getDatabase;
7
8
  exports.closeDatabase = closeDatabase;
8
9
  exports.getDbPath = getDbPath;
@@ -22,28 +23,25 @@ const DB_PATH = process.env.DB_PATH || path_1.default.join(os_1.default.homedir(
22
23
  function generateRandomApiKey() {
23
24
  return `aar-${crypto_1.default.randomBytes(16).toString('hex')}`;
24
25
  }
25
- // Use hardcoded path for the built/distributed WASM file
26
- // Next.js copies sql-wasm.wasm to its chunks directory
27
- function findSqlJsWasmPath() {
28
- // Try Next.js chunks directory first (works in dev and production)
29
- const nextChunksPath = path_1.default.join(process.cwd(), '.next', 'dev', 'server', 'chunks', 'sql-wasm.wasm');
30
- if (fs_1.default.existsSync(nextChunksPath)) {
31
- return nextChunksPath;
32
- }
33
- // Try production .next directory
34
- const prodChunksPath = path_1.default.join(process.cwd(), '.next', 'server', 'chunks', 'sql-wasm.wasm');
35
- if (fs_1.default.existsSync(prodChunksPath)) {
36
- return prodChunksPath;
37
- }
38
- // Try node_modules as fallback
39
- const nodeModulesPath = path_1.default.join(process.cwd(), 'node_modules', 'sql.js', 'dist', 'sql-wasm.wasm');
40
- if (fs_1.default.existsSync(nodeModulesPath)) {
41
- return nodeModulesPath;
26
+ // sql.js WASM 路径解析(支持 CLI 全局安装、本地开发、Next.js 进程)
27
+ let _wasmPath = null;
28
+ function getSqlJsWasmPath() {
29
+ if (!_wasmPath) {
30
+ // 1. 优先使用环境变量(CLI 启动的 Next.js 进程)
31
+ if (process.env.SQLJS_WASM_PATH) {
32
+ _wasmPath = process.env.SQLJS_WASM_PATH;
33
+ }
34
+ // 2. Next.js 开发/生产模式:使用 cwd 相对路径
35
+ else if (fs_1.default.existsSync(path_1.default.join(process.cwd(), 'node_modules', 'sql.js', 'dist', 'sql-wasm.wasm'))) {
36
+ _wasmPath = path_1.default.join(process.cwd(), 'node_modules', 'sql.js', 'dist', 'sql-wasm.wasm');
37
+ }
38
+ // 3. CLI 模式(tsc 编译后):通过 require.resolve 定位
39
+ else {
40
+ _wasmPath = path_1.default.join(path_1.default.dirname(require.resolve('sql.js')), 'sql-wasm.wasm');
41
+ }
42
42
  }
43
- // Use the most likely location as default
44
- return nodeModulesPath;
43
+ return _wasmPath;
45
44
  }
46
- const SQLJS_WASM_PATH = findSqlJsWasmPath();
47
45
  let dbInstance = null;
48
46
  let sqlJsInstance = null;
49
47
  let lastLoadMtimeMs = 0;
@@ -70,7 +68,7 @@ async function initSqlJsEngine() {
70
68
  sqlJsInstance = await (0, sql_js_1.default)({
71
69
  locateFile: (file) => {
72
70
  if (file.endsWith('.wasm')) {
73
- return SQLJS_WASM_PATH;
71
+ return getSqlJsWasmPath();
74
72
  }
75
73
  return `https://sql.js.org/dist/${file}`;
76
74
  }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "ai-agent-router",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
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": {
7
- "aar": "./dist/src/cli/index.js"
7
+ "aar": "./dist/src/cli/index.js",
8
+ "ai-agent-router": "./dist/src/cli/index.js"
8
9
  },
9
10
  "scripts": {
10
11
  "dev": "next dev -p 9527",
package/src/cli/index.ts CHANGED
@@ -6,7 +6,7 @@ import path from 'path';
6
6
  import fs from 'fs';
7
7
  import os from 'os';
8
8
  import http from 'http';
9
- import { getDatabase } from '../db/database';
9
+ import { getDatabase, getSqlJsWasmPath } from '../db/database';
10
10
  import { getConfig, setConfig, setServiceStatus, updateServiceStatus } from '../db/queries';
11
11
 
12
12
  const program = new Command();
@@ -119,7 +119,7 @@ program
119
119
 
120
120
  if (background) {
121
121
  ensureAarDir();
122
- const envBase = { ...process.env, NODE_ENV: 'production' as const };
122
+ const envBase = { ...process.env, NODE_ENV: 'production' as const, SQLJS_WASM_PATH: getSqlJsWasmPath() };
123
123
 
124
124
  const uiProc: ChildProcess = spawn(process.execPath, [serverPath, 'start', '-p', uiPort.toString()], {
125
125
  cwd: packageRoot,
@@ -168,7 +168,7 @@ program
168
168
  const uiProcess = spawn(process.execPath, [serverPath, 'start', '-p', uiPort.toString()], {
169
169
  cwd: packageRoot,
170
170
  stdio: ['ignore', 'inherit', 'inherit'],
171
- env: { ...process.env, PORT: uiPort.toString(), NODE_ENV: 'production' },
171
+ env: { ...process.env, PORT: uiPort.toString(), NODE_ENV: 'production', SQLJS_WASM_PATH: getSqlJsWasmPath() },
172
172
  });
173
173
 
174
174
  uiProcess.on('error', (error: Error) => {
@@ -180,7 +180,7 @@ program
180
180
  ? spawn(process.execPath, [gatewayScriptPath, '--port', String(gatewayPort)], {
181
181
  cwd: packageRoot,
182
182
  stdio: ['ignore', 'pipe', 'pipe'],
183
- env: { ...process.env, NODE_ENV: 'production' },
183
+ env: { ...process.env, NODE_ENV: 'production', SQLJS_WASM_PATH: getSqlJsWasmPath() },
184
184
  })
185
185
  : null;
186
186
 
@@ -14,33 +14,26 @@ function generateRandomApiKey(): string {
14
14
  return `aar-${crypto.randomBytes(16).toString('hex')}`;
15
15
  }
16
16
 
17
- // Use hardcoded path for the built/distributed WASM file
18
- // Next.js copies sql-wasm.wasm to its chunks directory
19
- function findSqlJsWasmPath(): string {
20
- // Try Next.js chunks directory first (works in dev and production)
21
- const nextChunksPath = path.join(process.cwd(), '.next', 'dev', 'server', 'chunks', 'sql-wasm.wasm');
22
- if (fs.existsSync(nextChunksPath)) {
23
- return nextChunksPath;
24
- }
25
-
26
- // Try production .next directory
27
- const prodChunksPath = path.join(process.cwd(), '.next', 'server', 'chunks', 'sql-wasm.wasm');
28
- if (fs.existsSync(prodChunksPath)) {
29
- return prodChunksPath;
30
- }
31
-
32
- // Try node_modules as fallback
33
- const nodeModulesPath = path.join(process.cwd(), 'node_modules', 'sql.js', 'dist', 'sql-wasm.wasm');
34
- if (fs.existsSync(nodeModulesPath)) {
35
- return nodeModulesPath;
17
+ // sql.js WASM 路径解析(支持 CLI 全局安装、本地开发、Next.js 进程)
18
+ let _wasmPath: string | null = null;
19
+ export function getSqlJsWasmPath(): string {
20
+ if (!_wasmPath) {
21
+ // 1. 优先使用环境变量(CLI 启动的 Next.js 进程)
22
+ if (process.env.SQLJS_WASM_PATH) {
23
+ _wasmPath = process.env.SQLJS_WASM_PATH;
24
+ }
25
+ // 2. Next.js 开发/生产模式:使用 cwd 相对路径
26
+ else if (fs.existsSync(path.join(process.cwd(), 'node_modules', 'sql.js', 'dist', 'sql-wasm.wasm'))) {
27
+ _wasmPath = path.join(process.cwd(), 'node_modules', 'sql.js', 'dist', 'sql-wasm.wasm');
28
+ }
29
+ // 3. CLI 模式(tsc 编译后):通过 require.resolve 定位
30
+ else {
31
+ _wasmPath = path.join(path.dirname(require.resolve('sql.js')), 'sql-wasm.wasm');
32
+ }
36
33
  }
37
-
38
- // Use the most likely location as default
39
- return nodeModulesPath;
34
+ return _wasmPath;
40
35
  }
41
36
 
42
- const SQLJS_WASM_PATH = findSqlJsWasmPath();
43
-
44
37
  let dbInstance: Database | null = null;
45
38
  let sqlJsInstance: any = null;
46
39
  let lastLoadMtimeMs: number = 0;
@@ -66,7 +59,7 @@ async function initSqlJsEngine(): Promise<any> {
66
59
  sqlJsInstance = await initSqlJs({
67
60
  locateFile: (file: string) => {
68
61
  if (file.endsWith('.wasm')) {
69
- return SQLJS_WASM_PATH;
62
+ return getSqlJsWasmPath();
70
63
  }
71
64
  return `https://sql.js.org/dist/${file}`;
72
65
  }