manifest 5.36.0 → 5.36.2

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 (32) hide show
  1. package/dist/backend/auth/auth.instance.js +3 -2
  2. package/dist/backend/model-discovery/anthropic-subscription-probe.js +80 -0
  3. package/dist/backend/model-discovery/model-discovery.service.js +8 -7
  4. package/dist/backend/model-discovery/provider-model-fetcher.service.js +5 -4
  5. package/dist/node_modules/manifest-shared/dist/cjs/provider-inference.js +1 -1
  6. package/dist/node_modules/manifest-shared/dist/cjs/provider-inference.js.map +1 -1
  7. package/dist/node_modules/manifest-shared/dist/esm/provider-inference.js +1 -1
  8. package/dist/node_modules/manifest-shared/dist/esm/provider-inference.js.map +1 -1
  9. package/dist/openclaw.plugin.json +1 -1
  10. package/openclaw.plugin.json +1 -1
  11. package/package.json +1 -1
  12. package/public/assets/{Account-mbrfK614.js → Account-BuDc4Nb0.js} +1 -1
  13. package/public/assets/{Limits-D6l8xhUA.js → Limits-B0Qr3nqT.js} +1 -1
  14. package/public/assets/{Login-Dn1aZjXw.js → Login-BnXNpYcd.js} +1 -1
  15. package/public/assets/{MessageLog-CWiKoRpB.js → MessageLog-D4BY_ujN.js} +1 -1
  16. package/public/assets/{ModelPrices-CbrlrT8V.js → ModelPrices-BmtHNExP.js} +1 -1
  17. package/public/assets/{Overview-Bpuw4RLJ.js → Overview-BCFfcndu.js} +1 -1
  18. package/public/assets/Register-DlRiidEI.js +1 -0
  19. package/public/assets/{ResetPassword-Bir2RHWf.js → ResetPassword-DAoGqbKg.js} +1 -1
  20. package/public/assets/Routing-B5BCWeyb.js +6 -0
  21. package/public/assets/{Settings-CciPiVro.js → Settings-CPZmGX_c.js} +1 -1
  22. package/public/assets/{SocialButtons-8xBLnR-O.js → SocialButtons-B7A7StCx.js} +1 -1
  23. package/public/assets/index-8qMFCIBN.css +1 -0
  24. package/public/assets/{index-JMxG9oFW.js → index-Dji58hs5.js} +2 -2
  25. package/public/assets/{model-display-1OeS4GNc.js → model-display-BoOKkgTP.js} +1 -1
  26. package/public/assets/{overview-DIAj72dm.js → overview-U0Ep7bv7.js} +1 -1
  27. package/public/assets/{routing-CuE7sS2j.js → routing-dd43hyXW.js} +1 -1
  28. package/public/assets/{routing-utils-B_Dl8Sof.js → routing-utils-CRQ2wPZ7.js} +1 -1
  29. package/public/index.html +2 -2
  30. package/public/assets/Register-CIAm21m5.js +0 -1
  31. package/public/assets/Routing-Bc7D8_7D.js +0 -6
  32. package/public/assets/index-BsqwVwB3.css +0 -1
@@ -10,6 +10,7 @@ const local_mode_constants_1 = require("../common/constants/local-mode.constants
10
10
  const isLocalMode = process.env['MANIFEST_MODE'] === 'local';
11
11
  const port = process.env['PORT'] ?? '3001';
12
12
  const isDev = (process.env['NODE_ENV'] ?? '') !== 'production';
13
+ const hasEmailProvider = !!(process.env['MAILGUN_API_KEY'] && process.env['MAILGUN_DOMAIN']);
13
14
  function createDatabaseConnection() {
14
15
  if (isLocalMode) {
15
16
  return null;
@@ -61,7 +62,7 @@ const authInstance = isLocalMode
61
62
  emailAndPassword: {
62
63
  enabled: true,
63
64
  minPasswordLength: 8,
64
- requireEmailVerification: !isDev && !isLocalMode,
65
+ requireEmailVerification: !isDev && !isLocalMode && hasEmailProvider,
65
66
  sendResetPassword: async ({ user, url }) => {
66
67
  const element = (0, reset_password_1.ResetPasswordEmail)({
67
68
  userName: user.name,
@@ -78,7 +79,7 @@ const authInstance = isLocalMode
78
79
  },
79
80
  },
80
81
  emailVerification: {
81
- sendOnSignUp: !isLocalMode,
82
+ sendOnSignUp: !isLocalMode && hasEmailProvider,
82
83
  autoSignInAfterVerification: true,
83
84
  sendVerificationEmail: async ({ user, url }) => {
84
85
  const element = (0, verify_email_1.VerifyEmailEmail)({
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.extractFamily = extractFamily;
4
+ exports.filterBySubscriptionAccess = filterBySubscriptionAccess;
5
+ const common_1 = require("@nestjs/common");
6
+ const logger = new common_1.Logger('AnthropicSubscriptionProbe');
7
+ const ANTHROPIC_MESSAGES_URL = 'https://api.anthropic.com/v1/messages';
8
+ const PROBE_TIMEOUT_MS = 5000;
9
+ const FAMILY_RE = /^claude-(?:\d+(?:-\d+)*-)?([a-z]+)/i;
10
+ function extractFamily(modelId) {
11
+ const match = FAMILY_RE.exec(modelId);
12
+ return match?.[1] ?? null;
13
+ }
14
+ async function probeModel(apiKey, modelId) {
15
+ try {
16
+ const controller = new AbortController();
17
+ const timeout = setTimeout(() => controller.abort(), PROBE_TIMEOUT_MS);
18
+ const res = await fetch(ANTHROPIC_MESSAGES_URL, {
19
+ method: 'POST',
20
+ headers: {
21
+ Authorization: `Bearer ${apiKey}`,
22
+ 'Content-Type': 'application/json',
23
+ 'anthropic-version': '2023-06-01',
24
+ 'anthropic-beta': 'oauth-2025-04-20',
25
+ },
26
+ body: JSON.stringify({
27
+ model: modelId,
28
+ max_tokens: 1,
29
+ messages: [{ role: 'user', content: '.' }],
30
+ }),
31
+ signal: controller.signal,
32
+ });
33
+ clearTimeout(timeout);
34
+ if (res.ok)
35
+ return true;
36
+ if (res.status === 400)
37
+ return false;
38
+ return true;
39
+ }
40
+ catch {
41
+ return true;
42
+ }
43
+ }
44
+ async function filterBySubscriptionAccess(models, apiKey) {
45
+ const familyMap = new Map();
46
+ const noFamily = [];
47
+ for (const model of models) {
48
+ const family = extractFamily(model.id);
49
+ if (!family) {
50
+ noFamily.push(model);
51
+ continue;
52
+ }
53
+ const group = familyMap.get(family) ?? [];
54
+ group.push(model);
55
+ familyMap.set(family, group);
56
+ }
57
+ const families = [...familyMap.keys()];
58
+ const probeResults = await Promise.all(families.map(async (family) => {
59
+ const representative = familyMap.get(family)[0];
60
+ const accessible = await probeModel(apiKey, representative.id);
61
+ if (!accessible) {
62
+ logger.log(`Anthropic subscription: ${family} models not accessible (probed ${representative.id})`);
63
+ }
64
+ return { family, accessible };
65
+ }));
66
+ const accessibleFamilies = new Set(probeResults.filter((r) => r.accessible).map((r) => r.family));
67
+ const blockedFamilies = families.filter((f) => !accessibleFamilies.has(f));
68
+ if (blockedFamilies.length > 0) {
69
+ logger.log(`Anthropic subscription: accessible families=[${[...accessibleFamilies].join(', ')}], ` +
70
+ `blocked families=[${blockedFamilies.join(', ')}]`);
71
+ }
72
+ const filtered = models.filter((model) => {
73
+ const family = extractFamily(model.id);
74
+ if (!family)
75
+ return true;
76
+ return accessibleFamilies.has(family);
77
+ });
78
+ return filtered;
79
+ }
80
+ //# sourceMappingURL=anthropic-subscription-probe.js.map
@@ -28,6 +28,7 @@ const models_dev_sync_service_1 = require("../database/models-dev-sync.service")
28
28
  const openai_oauth_types_1 = require("../routing/oauth/openai-oauth.types");
29
29
  const qwen_region_1 = require("../routing/qwen-region");
30
30
  const copilot_token_service_1 = require("../routing/proxy/copilot-token.service");
31
+ const anthropic_subscription_probe_1 = require("./anthropic-subscription-probe");
31
32
  const model_fallback_1 = require("./model-fallback");
32
33
  const customProviderKey = (id) => `custom:${id}`;
33
34
  const customModelKey = (id, modelName) => `custom:${id}/${modelName}`;
@@ -118,6 +119,9 @@ let ModelDiscoveryService = ModelDiscoveryService_1 = class ModelDiscoveryServic
118
119
  if (provider.auth_type === 'subscription') {
119
120
  raw = (0, model_fallback_1.supplementWithKnownModels)(raw, provider.provider);
120
121
  }
122
+ if (lowerProvider === 'anthropic' && provider.auth_type === 'subscription' && apiKey) {
123
+ raw = await (0, anthropic_subscription_probe_1.filterBySubscriptionAccess)(raw, apiKey);
124
+ }
121
125
  const authType = provider.auth_type === 'subscription' ? 'subscription' : 'api_key';
122
126
  const enriched = raw.map((model) => ({
123
127
  ...this.enrichModel(model, provider.provider),
@@ -160,13 +164,10 @@ let ModelDiscoveryService = ModelDiscoveryService_1 = class ModelDiscoveryServic
160
164
  const providerAuthType = p.auth_type === 'subscription' ? 'subscription' : 'api_key';
161
165
  for (const m of cached) {
162
166
  const effectiveAuthType = m.authType ?? providerAuthType;
163
- if (!seen.has(m.id)) {
164
- seen.set(m.id, models.length);
165
- models.push(m);
166
- }
167
- else if (effectiveAuthType === 'subscription' &&
168
- models[seen.get(m.id)]?.authType !== 'subscription') {
169
- models[seen.get(m.id)] = m;
167
+ const dedupeKey = `${m.id}::${effectiveAuthType}`;
168
+ if (!seen.has(dedupeKey)) {
169
+ seen.set(dedupeKey, models.length);
170
+ models.push({ ...m, authType: effectiveAuthType });
170
171
  }
171
172
  }
172
173
  }
@@ -63,10 +63,11 @@ function parseOpenAIDeduped(body, provider) {
63
63
  }
64
64
  exports.UNIVERSAL_NON_CHAT_RE = /(?:embed|tts|whisper|dall-e|imagen|cogview|wanx|sambert|paraformer|text-embedding|speech-to|voice-|audio-turbo)/i;
65
65
  exports.PROVIDER_NON_CHAT = {
66
- openai: /(?:moderation|davinci|babbage|^text-|realtime|-transcribe|^sora|^gpt-3\.5-turbo-instruct|audio)/i,
67
- 'openai-subscription': /(?:moderation|davinci|babbage|^text-|realtime|-transcribe|^sora|audio)/i,
68
- gemini: /(?:^aqs-|nano-banana)/i,
69
- mistral: /(?:^mistral-ocr)/i,
66
+ openai: /(?:moderation|davinci|babbage|^text-|realtime|-transcribe|^sora|^gpt-3\.5-turbo-instruct|audio|^chatgpt-image)/i,
67
+ 'openai-subscription': /(?:moderation|davinci|babbage|^text-|realtime|-transcribe|^sora|audio|^chatgpt-image)/i,
68
+ gemini: /(?:^aqs-|nano-banana|^deep-research|computer-use|^lyria)/i,
69
+ mistral: /(?:^mistral-ocr|moderation|voxtral-.*-(?:transcribe|realtime))/i,
70
+ xai: /(?:imagine)/i,
70
71
  };
71
72
  function filterNonChatModels(models, configKey) {
72
73
  const providerFilter = exports.PROVIDER_NON_CHAT[configKey];
@@ -25,7 +25,7 @@ exports.MODEL_PREFIX_MAP = MODEL_PREFIX_MAP;
25
25
  function inferProviderFromModel(model) {
26
26
  if (model.startsWith('custom:'))
27
27
  return 'custom';
28
- if (/:/.test(model) && !model.endsWith(':free'))
28
+ if (!model.includes('/') && /:/.test(model) && !model.endsWith(':free'))
29
29
  return 'ollama';
30
30
  const lower = model.toLowerCase();
31
31
  for (const [re, id] of MODEL_PREFIX_MAP) {
@@ -1 +1 @@
1
- {"version":3,"file":"provider-inference.js","sourceRoot":"","sources":["../../src/provider-inference.ts"],"names":[],"mappings":";;;AAsBA,wDAQC;AA9BD;;;GAGG;AACH,MAAM,gBAAgB,GAAuB;IAC3C,CAAC,eAAe,EAAE,YAAY,CAAC;IAC/B,CAAC,UAAU,EAAE,WAAW,CAAC;IACzB,CAAC,mCAAmC,EAAE,QAAQ,CAAC;IAC/C,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC9B,CAAC,YAAY,EAAE,UAAU,CAAC;IAC1B,CAAC,QAAQ,EAAE,KAAK,CAAC;IACjB,CAAC,6CAA6C,EAAE,SAAS,CAAC;IAC1D,CAAC,mBAAmB,EAAE,UAAU,CAAC;IACjC,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,OAAO,EAAE,KAAK,CAAC;IAChB,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAC3B,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,gBAAgB,EAAE,YAAY,CAAC;CACjC,CAAC;AAEO,4CAAgB;AAEzB,SAAgB,sBAAsB,CAAC,KAAa;IAClD,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjD,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjE,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,gBAAgB,EAAE,CAAC;QACxC,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
1
+ {"version":3,"file":"provider-inference.js","sourceRoot":"","sources":["../../src/provider-inference.ts"],"names":[],"mappings":";;;AAsBA,wDAQC;AA9BD;;;GAGG;AACH,MAAM,gBAAgB,GAAuB;IAC3C,CAAC,eAAe,EAAE,YAAY,CAAC;IAC/B,CAAC,UAAU,EAAE,WAAW,CAAC;IACzB,CAAC,mCAAmC,EAAE,QAAQ,CAAC;IAC/C,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC9B,CAAC,YAAY,EAAE,UAAU,CAAC;IAC1B,CAAC,QAAQ,EAAE,KAAK,CAAC;IACjB,CAAC,6CAA6C,EAAE,SAAS,CAAC;IAC1D,CAAC,mBAAmB,EAAE,UAAU,CAAC;IACjC,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,OAAO,EAAE,KAAK,CAAC;IAChB,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAC3B,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,gBAAgB,EAAE,YAAY,CAAC;CACjC,CAAC;AAEO,4CAAgB;AAEzB,SAAgB,sBAAsB,CAAC,KAAa;IAClD,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,QAAQ,CAAC;IACzF,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,gBAAgB,EAAE,CAAC;QACxC,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -21,7 +21,7 @@ export { MODEL_PREFIX_MAP };
21
21
  export function inferProviderFromModel(model) {
22
22
  if (model.startsWith('custom:'))
23
23
  return 'custom';
24
- if (/:/.test(model) && !model.endsWith(':free'))
24
+ if (!model.includes('/') && /:/.test(model) && !model.endsWith(':free'))
25
25
  return 'ollama';
26
26
  const lower = model.toLowerCase();
27
27
  for (const [re, id] of MODEL_PREFIX_MAP) {
@@ -1 +1 @@
1
- {"version":3,"file":"provider-inference.js","sourceRoot":"","sources":["../../src/provider-inference.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,gBAAgB,GAAuB;IAC3C,CAAC,eAAe,EAAE,YAAY,CAAC;IAC/B,CAAC,UAAU,EAAE,WAAW,CAAC;IACzB,CAAC,mCAAmC,EAAE,QAAQ,CAAC;IAC/C,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC9B,CAAC,YAAY,EAAE,UAAU,CAAC;IAC1B,CAAC,QAAQ,EAAE,KAAK,CAAC;IACjB,CAAC,6CAA6C,EAAE,SAAS,CAAC;IAC1D,CAAC,mBAAmB,EAAE,UAAU,CAAC;IACjC,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,OAAO,EAAE,KAAK,CAAC;IAChB,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAC3B,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,gBAAgB,EAAE,YAAY,CAAC;CACjC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjD,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjE,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,gBAAgB,EAAE,CAAC;QACxC,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
1
+ {"version":3,"file":"provider-inference.js","sourceRoot":"","sources":["../../src/provider-inference.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,gBAAgB,GAAuB;IAC3C,CAAC,eAAe,EAAE,YAAY,CAAC;IAC/B,CAAC,UAAU,EAAE,WAAW,CAAC;IACzB,CAAC,mCAAmC,EAAE,QAAQ,CAAC;IAC/C,CAAC,kBAAkB,EAAE,QAAQ,CAAC;IAC9B,CAAC,YAAY,EAAE,UAAU,CAAC;IAC1B,CAAC,QAAQ,EAAE,KAAK,CAAC;IACjB,CAAC,6CAA6C,EAAE,SAAS,CAAC;IAC1D,CAAC,mBAAmB,EAAE,UAAU,CAAC;IACjC,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,OAAO,EAAE,KAAK,CAAC;IAChB,CAAC,iBAAiB,EAAE,MAAM,CAAC;IAC3B,CAAC,YAAY,EAAE,SAAS,CAAC;IACzB,CAAC,gBAAgB,EAAE,YAAY,CAAC;CACjC,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,MAAM,UAAU,sBAAsB,CAAC,KAAa;IAClD,IAAI,KAAK,CAAC,UAAU,CAAC,SAAS,CAAC;QAAE,OAAO,QAAQ,CAAC;IACjD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,QAAQ,CAAC;IACzF,MAAM,KAAK,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAClC,KAAK,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,gBAAgB,EAAE,CAAC;QACxC,IAAI,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,OAAO,EAAE,CAAC;IAChC,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "manifest",
3
3
  "name": "Manifest Self-Hosted LLM Router",
4
- "version": "5.36.0",
4
+ "version": "5.36.2",
5
5
  "description": "Run the Manifest LLM router locally with SQLite. Zero-config dashboard included.",
6
6
  "author": "MNFST Inc.",
7
7
  "homepage": "https://manifest.build",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "manifest",
3
3
  "name": "Manifest Self-Hosted LLM Router",
4
- "version": "5.36.0",
4
+ "version": "5.36.2",
5
5
  "description": "Run the Manifest LLM router locally with SQLite. Zero-config dashboard included.",
6
6
  "author": "MNFST Inc.",
7
7
  "homepage": "https://manifest.build",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "manifest",
3
- "version": "5.36.0",
3
+ "version": "5.36.2",
4
4
  "description": "Self-hosted Manifest LLM router with embedded server, SQLite database, and dashboard",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -1 +1 @@
1
- import{b as H,a as b,e as R,i as c,g as d,T as V,M as W,h,m as Z,S as M,t as l,d as F}from"./vendor-pl6Q4jbW.js";import{s as G,u as J,v as K,d as L,w as E}from"./index-JMxG9oFW.js";import"./auth-DmX5tAfx.js";var O=l("<h3 class=settings-section__title>Profile information"),Q=l('<div class=settings-card><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Display name</span><span class=settings-card__label-desc>Name shown throughout the dashboard.</span></div><div class=settings-card__control><input class=settings-card__input type=text aria-label="Display name"readonly></div></div><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Email</span><span class=settings-card__label-desc>Used for account notifications and limit alerts.</span></div><div class=settings-card__control><input class=settings-card__input type=email aria-label=Email readonly></div></div><div class=settings-card__footer><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))>Profile information is managed through your authentication provider.'),X=l("<h3 class=settings-section__title>Workspace"),ee=l("<div class=settings-card><div class=settings-card__body><p class=settings-card__desc>Your unique workspace identifier. You may need this for support requests or advanced integrations.</p><div class=settings-card__id-row><code class=settings-card__id-value></code><button class=settings-card__copy-btn title=Copy>"),te=l("<h3 class=settings-section__title>Profile"),se=l('<div class=settings-card><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Display name</span><span class=settings-card__label-desc>Name shown throughout the dashboard.</span></div><div class=settings-card__control><input class=settings-card__input type=text aria-label="Display name"placeholder="Local User">'),ie=l('<div class=account-modal><div class=account-modal__inner><button class=account-modal__back><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m15 18-6-6 6-6"></path></svg>Back</button><div class=page-header><div><h1>Account Preferences</h1><span class=breadcrumb>Your profile, workspace details, and display preferences</span></div></div><h3 class=settings-section__title>Appearance</h3><div class=settings-card><div class=settings-card__body><p class=settings-card__desc>Choose how Manifest looks for you.</p><div class=theme-picker><button class=theme-picker__option><svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=4></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="m4.93 4.93 1.41 1.41"></path><path d="m17.66 17.66 1.41 1.41"></path><path d="M2 12h2"></path><path d="M20 12h2"></path><path d="m6.34 17.66-1.41 1.41"></path><path d="m19.07 4.93-1.41 1.41"></path></svg>Light</button><button class=theme-picker__option><svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg>Dark</button><button class=theme-picker__option><svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect x=2 y=3 width=20 height=14 rx=2></rect><path d="M8 21h8"></path><path d="M12 17v4"></path></svg>System'),ae=l('<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="20 6 9 17 4 12">'),le=l('<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect x=9 y=9 width=13 height=13 rx=2></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1">');const ce=()=>{const N=H(),p=G.useSession(),[T,w]=b(!1),[_,g]=b("system"),[u,y]=b(""),B=()=>p()?.data?.user?.name??"",D=()=>p()?.data?.user?.email??"",x=()=>p()?.data?.user?.id??"";R(()=>{J(),y(K()||"Local User");const t=localStorage.getItem("theme");g(t==="dark"||t==="light"?t:"system")});const m=t=>{if(g(t),t==="system"){localStorage.removeItem("theme");const o=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",o)}else localStorage.setItem("theme",t),document.documentElement.classList.toggle("dark",t==="dark")},j=()=>{navigator.clipboard.writeText(x()),w(!0),setTimeout(()=>w(!1),2e3)};return(()=>{var t=ie(),o=t.firstChild,C=o.firstChild,I=C.nextSibling,v=I.nextSibling,P=v.nextSibling,A=P.firstChild,U=A.firstChild,Y=U.nextSibling,k=Y.firstChild,f=k.nextSibling,S=f.nextSibling;return c(t,d(V,{children:"Account Preferences - Manifest"}),o),c(t,d(W,{name:"description",content:"Manage your profile, workspace, and theme preferences."}),o),C.$$click=()=>N(-1),c(o,d(M,{get when(){return!L()},get children(){return[O(),(()=>{var e=Q(),s=e.firstChild,r=s.firstChild,n=r.nextSibling,i=n.firstChild,a=s.nextSibling,$=a.firstChild,q=$.nextSibling,z=q.firstChild;return h(()=>i.value=B()),h(()=>z.value=D()),e})(),X(),(()=>{var e=ee(),s=e.firstChild,r=s.firstChild,n=r.nextSibling,i=n.firstChild,a=i.nextSibling;return c(i,x),a.$$click=j,c(a,(()=>{var $=Z(()=>!!T());return()=>$()?ae():le()})()),e})()]}}),v),c(o,d(M,{get when(){return L()},get children(){return[te(),(()=>{var e=se(),s=e.firstChild,r=s.firstChild,n=r.nextSibling,i=n.firstChild;return i.$$keydown=a=>{a.key==="Enter"&&(E(u()),a.currentTarget.blur())},i.addEventListener("blur",()=>E(u())),i.$$input=a=>y(a.currentTarget.value),h(()=>i.value=u()),e})()]}}),v),k.$$click=()=>m("light"),f.$$click=()=>m("dark"),S.$$click=()=>m("system"),h(e=>{var s=_()==="light",r=_()==="dark",n=_()==="system";return s!==e.e&&k.classList.toggle("theme-picker__option--active",e.e=s),r!==e.t&&f.classList.toggle("theme-picker__option--active",e.t=r),n!==e.a&&S.classList.toggle("theme-picker__option--active",e.a=n),e},{e:void 0,t:void 0,a:void 0}),t})()};F(["click","input","keydown"]);export{ce as default};
1
+ import{b as H,a as b,e as R,i as c,g as d,T as V,M as W,h,m as Z,S as M,t as l,d as F}from"./vendor-pl6Q4jbW.js";import{s as G,u as J,v as K,d as L,w as E}from"./index-Dji58hs5.js";import"./auth-DmX5tAfx.js";var O=l("<h3 class=settings-section__title>Profile information"),Q=l('<div class=settings-card><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Display name</span><span class=settings-card__label-desc>Name shown throughout the dashboard.</span></div><div class=settings-card__control><input class=settings-card__input type=text aria-label="Display name"readonly></div></div><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Email</span><span class=settings-card__label-desc>Used for account notifications and limit alerts.</span></div><div class=settings-card__control><input class=settings-card__input type=email aria-label=Email readonly></div></div><div class=settings-card__footer><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))>Profile information is managed through your authentication provider.'),X=l("<h3 class=settings-section__title>Workspace"),ee=l("<div class=settings-card><div class=settings-card__body><p class=settings-card__desc>Your unique workspace identifier. You may need this for support requests or advanced integrations.</p><div class=settings-card__id-row><code class=settings-card__id-value></code><button class=settings-card__copy-btn title=Copy>"),te=l("<h3 class=settings-section__title>Profile"),se=l('<div class=settings-card><div class=settings-card__row><div class=settings-card__label><span class=settings-card__label-title>Display name</span><span class=settings-card__label-desc>Name shown throughout the dashboard.</span></div><div class=settings-card__control><input class=settings-card__input type=text aria-label="Display name"placeholder="Local User">'),ie=l('<div class=account-modal><div class=account-modal__inner><button class=account-modal__back><svg width=16 height=16 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="m15 18-6-6 6-6"></path></svg>Back</button><div class=page-header><div><h1>Account Preferences</h1><span class=breadcrumb>Your profile, workspace details, and display preferences</span></div></div><h3 class=settings-section__title>Appearance</h3><div class=settings-card><div class=settings-card__body><p class=settings-card__desc>Choose how Manifest looks for you.</p><div class=theme-picker><button class=theme-picker__option><svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=4></circle><path d="M12 2v2"></path><path d="M12 20v2"></path><path d="m4.93 4.93 1.41 1.41"></path><path d="m17.66 17.66 1.41 1.41"></path><path d="M2 12h2"></path><path d="M20 12h2"></path><path d="m6.34 17.66-1.41 1.41"></path><path d="m19.07 4.93-1.41 1.41"></path></svg>Light</button><button class=theme-picker__option><svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"></path></svg>Dark</button><button class=theme-picker__option><svg width=18 height=18 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect x=2 y=3 width=20 height=14 rx=2></rect><path d="M8 21h8"></path><path d="M12 17v4"></path></svg>System'),ae=l('<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="20 6 9 17 4 12">'),le=l('<svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><rect x=9 y=9 width=13 height=13 rx=2></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1">');const ce=()=>{const N=H(),p=G.useSession(),[T,w]=b(!1),[_,g]=b("system"),[u,y]=b(""),B=()=>p()?.data?.user?.name??"",D=()=>p()?.data?.user?.email??"",x=()=>p()?.data?.user?.id??"";R(()=>{J(),y(K()||"Local User");const t=localStorage.getItem("theme");g(t==="dark"||t==="light"?t:"system")});const m=t=>{if(g(t),t==="system"){localStorage.removeItem("theme");const o=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",o)}else localStorage.setItem("theme",t),document.documentElement.classList.toggle("dark",t==="dark")},j=()=>{navigator.clipboard.writeText(x()),w(!0),setTimeout(()=>w(!1),2e3)};return(()=>{var t=ie(),o=t.firstChild,C=o.firstChild,I=C.nextSibling,v=I.nextSibling,P=v.nextSibling,A=P.firstChild,U=A.firstChild,Y=U.nextSibling,k=Y.firstChild,f=k.nextSibling,S=f.nextSibling;return c(t,d(V,{children:"Account Preferences - Manifest"}),o),c(t,d(W,{name:"description",content:"Manage your profile, workspace, and theme preferences."}),o),C.$$click=()=>N(-1),c(o,d(M,{get when(){return!L()},get children(){return[O(),(()=>{var e=Q(),s=e.firstChild,r=s.firstChild,n=r.nextSibling,i=n.firstChild,a=s.nextSibling,$=a.firstChild,q=$.nextSibling,z=q.firstChild;return h(()=>i.value=B()),h(()=>z.value=D()),e})(),X(),(()=>{var e=ee(),s=e.firstChild,r=s.firstChild,n=r.nextSibling,i=n.firstChild,a=i.nextSibling;return c(i,x),a.$$click=j,c(a,(()=>{var $=Z(()=>!!T());return()=>$()?ae():le()})()),e})()]}}),v),c(o,d(M,{get when(){return L()},get children(){return[te(),(()=>{var e=se(),s=e.firstChild,r=s.firstChild,n=r.nextSibling,i=n.firstChild;return i.$$keydown=a=>{a.key==="Enter"&&(E(u()),a.currentTarget.blur())},i.addEventListener("blur",()=>E(u())),i.$$input=a=>y(a.currentTarget.value),h(()=>i.value=u()),e})()]}}),v),k.$$click=()=>m("light"),f.$$click=()=>m("dark"),S.$$click=()=>m("system"),h(e=>{var s=_()==="light",r=_()==="dark",n=_()==="system";return s!==e.e&&k.classList.toggle("theme-picker__option--active",e.e=s),r!==e.t&&f.classList.toggle("theme-picker__option--active",e.t=r),n!==e.a&&S.classList.toggle("theme-picker__option--active",e.a=n),e},{e:void 0,t:void 0,a:void 0}),t})()};F(["click","input","keydown"]);export{ce as default};
@@ -1 +1 @@
1
- import{i,t as d,a as $,f as Le,g as l,S as _,h as w,s as z,m as J,P as ve,d as ie,o as De,F as ge,B as ke,j as de,n as Ke,k as me,T as ze,M as je}from"./vendor-pl6Q4jbW.js";import{e as pe,q as ne,B as le,s as Ne,d as se,t as K,b as $e}from"./index-JMxG9oFW.js";import{a as He}from"./provider-api-key-urls-1G6okUJ7.js";import{a as Ge}from"./routing-CuE7sS2j.js";import"./auth-DmX5tAfx.js";function Ve(e){return pe("/notifications/logs",{agent_name:e})}function qe(e){return pe("/notifications",{agent_name:e})}function Ue(e){return ne(`${le}/notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Je(e,t){return ne(`${le}/notifications/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}function Fe(e){return ne(`${le}/notifications/${encodeURIComponent(e)}`,{method:"DELETE"})}async function We(){const e=await pe("/notifications/email-provider");return"configured"in e&&e.configured===!1?null:e}function Ze(e){return ne(`${le}/notifications/email-provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Ye(){return ne(`${le}/notifications/email-provider`,{method:"DELETE"})}function Xe(e){return ne(`${le}/notifications/email-provider/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Qe(e){return ne(`${le}/notifications/email-provider/test-saved`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:e})})}var et=d('<div class=cloud-email-info><svg class=cloud-email-info__icon width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg><div><div class=cloud-email-info__title>Email alerts</div><div class=cloud-email-info__desc>Alerts will be sent to <strong>');const tt=e=>(()=>{var t=et(),n=t.firstChild,a=n.nextSibling,s=a.firstChild,o=s.nextSibling,u=o.firstChild,v=u.nextSibling;return i(v,()=>e.email),t})();var it=d("<input class=modal-card__input type=text autocomplete=off autofocus style=-webkit-text-security:disc;text-security:disc>"),we=d("<p class=modal-card__field-error>"),nt=d('<p class=modal-card__field-hint><a class=modal-card__field-link target=_blank rel="noopener noreferrer">Get <!> API key'),lt=d("<label class=modal-card__field-label>Sending domain"),rt=d('<input class=modal-card__input type=text placeholder="e.g. notifications.mycompany.com">'),at=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true aria-labelledby=provider-modal-title><h2 class=modal-card__title id=provider-modal-title></h2><p class=modal-card__desc>Enter your API credentials to enable email alert delivery.</p><label class=modal-card__field-label>Provider</label><div class=provider-modal-picker><button class=provider-modal-option type=button><img src=/logos/resend.svg alt class=provider-modal-option__logo><span>Resend</span></button><button class=provider-modal-option type=button><img src=/logos/mailgun.svg alt class=provider-modal-option__logo><span>Mailgun</span></button><button class=provider-modal-option type=button><img src=/logos/sendgrid.svg alt class=provider-modal-option__logo><span>SendGrid</span></button></div><label class=modal-card__field-label>API Key</label><label class=modal-card__field-label>Notification email</label><input class=modal-card__input type=email><p class=modal-card__field-hint>Where threshold alerts will be sent.</p><div class="modal-card__footer modal-card__footer--split"><button class="btn btn--ghost btn--sm"type=button></button><button class="btn btn--primary btn--sm">'),ot=d('<div class=masked-key><span class=masked-key__value></span><button class="btn btn--ghost btn--sm masked-key__edit"type=button>Change'),st=d("<span class=spinner>");const Ce=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,Se={resend:"Resend",mailgun:"Mailgun",sendgrid:"SendGrid"},Ae=e=>{const[t,n]=$("resend"),[a,s]=$(""),[o,u]=$(""),[v,h]=$(""),[C,S]=$(!1),[x,T]=$(!1),[R,f]=$(""),[k,m]=$(""),[b,j]=$(!1),M=Ne.useSession(),D=()=>e.editMode&&!!e.existingKeyPrefix&&t()===e.initialProvider,A=()=>(e.existingKeyPrefix??"")+"••••••••";Le(()=>{if(e.open){n(e.initialProvider),s("");const r=e.editMode&&!!e.existingKeyPrefix;j(!r),u(e.existingDomain??"");const p=e.existingNotificationEmail??(se()?"":M()?.data?.user?.email??"");h(p),f(""),m("")}});const H=()=>t()==="mailgun",I=()=>{let r=!0;const p=a().trim(),P=o().trim().toLowerCase();return!b()&&D()?f(""):p?p.length<8?(f("API key must be at least 8 characters"),r=!1):t()==="resend"&&!p.startsWith("re_")?(f("Resend API key must start with re_"),r=!1):t()==="sendgrid"&&!p.startsWith("SG.")?(f("SendGrid API key must start with SG."),r=!1):f(""):(f("API key is required"),r=!1),H()?P?Ce.test(P)?m(""):(m("Invalid domain format"),r=!1):(m("Domain is required"),r=!1):P&&!Ce.test(P)?(m("Invalid domain format"),r=!1):m(""),r},Z=()=>{const r=v().trim();return r||(M()?.data?.user?.email??null)},N=async()=>{const r=a().trim(),p=o().trim().toLowerCase(),P=Z();if(!P)return K.error("Enter a notification email to send the test to"),!1;T(!0);try{const L={provider:t(),apiKey:r,to:P};p&&(L.domain=p);const q=await Xe(L);return q.success?!0:(K.error(q.error??"Email test failed — check your credentials"),!1)}catch{return!1}finally{T(!1)}},re=async()=>{const r=Z();if(!r)return K.error("Enter a notification email to send the test to"),!1;T(!0);try{const p=await Qe(r);return p.success?!0:(K.error(p.error??"Email test failed — check your credentials"),!1)}catch{return!1}finally{T(!1)}},ae=async()=>{if(!I()||X())return;(!b()&&D()?await re():await N())&&K.success(`Test email sent to ${Z()}`)},Y=async()=>{if(!I()||C()||x())return;const r=!b()&&D();if(!(r?await re():await N()))return;const P=o().trim().toLowerCase();S(!0);try{const L={provider:t()};r||(L.apiKey=a().trim()),P&&(L.domain=P);const q=v().trim();q&&(L.notificationEmail=q),await Ze(L);const oe=Se[t()]??t();K.success(`${oe} connected`),e.onSaved(),e.onClose()}catch{}finally{S(!1)}},G=r=>{r.key==="Enter"&&Y(),r.key==="Escape"&&e.onClose()},X=()=>C()||x(),Q=()=>!b()&&D()?!!(H()&&!o().trim()):!!(!a().trim()||H()&&!o().trim()),V=()=>x()?"Testing...":C()?"Saving...":e.editMode?"Test & Save":"Test & Connect",ee=()=>He(t()),te=()=>{switch(t()){case"resend":return"re_xxxx...";case"sendgrid":return"SG.xxxx...";default:return"key-xxxx..."}};return l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var r=at(),p=r.firstChild,P=p.firstChild,L=P.nextSibling,q=L.nextSibling,oe=q.nextSibling,ce=oe.firstChild,g=ce.nextSibling,y=g.nextSibling,ue=oe.nextSibling,O=ue.nextSibling,F=O.nextSibling,he=F.nextSibling,_e=he.nextSibling,B=_e.firstChild,fe=B.nextSibling;return r.$$click=()=>e.onClose(),p.$$click=c=>c.stopPropagation(),i(P,()=>e.editMode?"Edit email provider":"Configure email provider"),ce.$$click=()=>{n("resend"),f("")},g.$$click=()=>{n("mailgun"),f("")},y.$$click=()=>{n("sendgrid"),f("")},i(p,l(_,{get when(){return b()||!D()},get fallback(){return(()=>{var c=ot(),E=c.firstChild,U=E.nextSibling;return i(E,A),U.$$click=()=>{j(!0),s("")},c})()},get children(){var c=it();return c.$$keydown=G,c.$$input=E=>{s(E.currentTarget.value),f("")},w(E=>{var U=!!R(),W=te();return U!==E.e&&c.classList.toggle("modal-card__input--error",E.e=U),W!==E.t&&z(c,"placeholder",E.t=W),E},{e:void 0,t:void 0}),w(()=>c.value=a()),c}}),O),i(p,l(_,{get when(){return R()},get children(){var c=we();return i(c,R),c}}),O),i(p,l(_,{get when(){return ee()},get children(){var c=nt(),E=c.firstChild,U=E.firstChild,W=U.nextSibling;return W.nextSibling,i(E,()=>Se[t()]??t(),W),w(()=>z(E,"href",ee())),c}}),O),i(p,l(_,{get when(){return H()},get children(){return[lt(),(()=>{var c=rt();return c.$$keydown=G,c.$$input=E=>{u(E.currentTarget.value),m("")},w(()=>c.classList.toggle("modal-card__input--error",!!k())),w(()=>c.value=o()),c})(),l(_,{get when(){return k()},get children(){var c=we();return i(c,k),c}})]}}),O),F.$$keydown=G,F.$$input=c=>h(c.currentTarget.value),B.$$click=ae,i(B,(()=>{var c=J(()=>!!x());return()=>c()?st():"Send test email"})()),fe.$$click=Y,i(fe,V),w(c=>{var E=t()==="resend",U=t()==="mailgun",W=t()==="sendgrid",be=se()?"you@example.com":M()?.data?.user?.email??"you@example.com",ye=X()||Q(),xe=X()||Q();return E!==c.e&&ce.classList.toggle("provider-modal-option--active",c.e=E),U!==c.t&&g.classList.toggle("provider-modal-option--active",c.t=U),W!==c.a&&y.classList.toggle("provider-modal-option--active",c.a=W),be!==c.o&&z(F,"placeholder",c.o=be),ye!==c.i&&(B.disabled=c.i=ye),xe!==c.n&&(fe.disabled=c.n=xe),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),w(()=>F.value=v()),r}})}})};ie(["click","input","keydown"]);var dt=d('<div class=provider-card__dropdown><button class=provider-card__dropdown-item><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Edit</button><button class="provider-card__dropdown-item provider-card__dropdown-item--danger"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>Remove'),ct=d("<span>"),ut=d('<span class=provider-card__email><svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6">'),gt=d('<div class=provider-card><div class=provider-card__header><span class=provider-card__label>Your provider</span><div class=provider-card__menu><button class=provider-card__menu-btn aria-label="Provider options"><svg width=16 height=16 viewBox="0 0 24 24"fill=currentColor><circle cx=12 cy=5 r=2></circle><circle cx=12 cy=12 r=2></circle><circle cx=12 cy=19 r=2></circle></svg></button></div></div><div class=provider-card__body><img alt class=provider-card__logo><div><div class=provider-card__name></div><div class=provider-card__meta><span class=provider-card__key>...');const vt={resend:"/logos/resend.svg",mailgun:"/logos/mailgun.svg",sendgrid:"/logos/sendgrid.svg"},mt={resend:"Resend",mailgun:"Mailgun",sendgrid:"SendGrid"},ht=e=>{const t=()=>vt[e.config.provider]??"/logos/resend.svg",n=()=>mt[e.config.provider]??e.config.provider,[a,s]=$(!1),o=v=>{v.target.closest(".provider-card__menu")||s(!1)},u=()=>{const v=!a();s(v),v&&document.addEventListener("click",o,{once:!0})};return De(()=>document.removeEventListener("click",o)),(()=>{var v=gt(),h=v.firstChild,C=h.firstChild,S=C.nextSibling,x=S.firstChild,T=h.nextSibling,R=T.firstChild,f=R.nextSibling,k=f.firstChild,m=k.nextSibling,b=m.firstChild,j=b.firstChild;return x.$$click=u,i(S,l(_,{get when(){return a()},get children(){var M=dt(),D=M.firstChild,A=D.nextSibling;return D.$$click=()=>{s(!1),e.onEdit()},A.$$click=()=>{s(!1),e.onRemove()},M}}),null),i(k,n),i(m,l(_,{get when(){return e.config.domain},get children(){var M=ct();return i(M,()=>e.config.domain),M}}),b),i(b,()=>e.config.keyPrefix,j),i(m,l(_,{get when(){return e.config.notificationEmail},get children(){var M=ut();return M.firstChild,i(M,()=>e.config.notificationEmail,null),M}}),null),w(()=>z(R,"src",t())),v})()};ie(["click"]);var _t=d("<h3 class=provider-setup__title>Configure email provider"),ft=d("<p class=provider-setup__subtitle>Choose a service to send alert notifications via email."),$t=d("<div class=provider-setup-grid><button class=provider-setup-card><img src=/logos/resend.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>Resend</div><div class=provider-setup-card__desc>Email API</div></div></button><button class=provider-setup-card><img src=/logos/mailgun.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>Mailgun</div><div class=provider-setup-card__desc>Transactional email</div></div></button><button class=provider-setup-card><img src=/logos/sendgrid.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>SendGrid</div><div class=provider-setup-card__desc>Email delivery");const pt=e=>{const[t,n]=$(!1),[a,s]=$("resend"),o=u=>{s(u),n(!0)};return[_t(),ft(),(()=>{var u=$t(),v=u.firstChild,h=v.nextSibling,C=h.nextSibling;return v.$$click=()=>o("resend"),h.$$click=()=>o("mailgun"),C.$$click=()=>o("sendgrid"),u})(),l(Ae,{get open(){return t()},get initialProvider(){return a()},onClose:()=>n(!1),get onSaved(){return e.onConfigured}})]};ie(["click"]);var bt=d("<div style=margin-bottom:var(--gap-lg)>"),yt=d('<div class=provider-card><div class=provider-card__header><span class=provider-card__label>Your provider</span><div class="skeleton skeleton--text"style="width:16px;height:16px;border-radius:calc(var(--radius) - 2px)"></div></div><div class=provider-card__body><div class="skeleton skeleton--rect"style="width:32px;height:32px;border-radius:calc(var(--radius) - 2px);flex-shrink:0"></div><div><div class="skeleton skeleton--text"style=width:80px;height:14px></div><div class="skeleton skeleton--text"style=width:160px;height:12px;margin-top:6px>'),xt=d('<div class=panel><div class="skeleton skeleton--text"style=width:180px;height:16px></div><div class="skeleton skeleton--text"style=width:280px;height:13px;margin-top:6px></div><div style=display:flex;gap:var(--gap-md);margin-top:var(--gap-lg)>'),kt=d('<div class="skeleton skeleton--rect"style=flex:1;height:64px;border-radius:var(--radius)>');const wt=e=>(()=>{var t=bt();return i(t,l(_,{get when(){return!e.loading},get fallback(){return l(_,{get when(){return!!e.emailProvider},get fallback(){return(()=>{var n=xt(),a=n.firstChild,s=a.nextSibling,o=s.nextSibling;return i(o,l(ge,{each:[1,2,3],children:()=>kt()})),n})()},get children(){return yt()}})},get children(){return l(_,{get when(){return e.emailProvider},get fallback(){return l(pt,{get onConfigured(){return e.onConfigured}})},get children(){return l(ht,{get config(){return e.emailProvider},get onEdit(){return e.onEdit},get onRemove(){return e.onRemove}})}})}})),t})();var Ct=d(`<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true aria-labelledby=limit-modal-title><h2 class=modal-card__title id=limit-modal-title></h2><p class=modal-card__desc>You'll receive an email alert when usage exceeds the threshold.</p><label class=modal-card__field-label style=margin-top:0>Metric</label><select class="select notification-modal__select"><option value=tokens>Tokens</option><option value=cost>Cost (USD)</option></select><div class=limit-modal__row><div class=limit-modal__col><label class=modal-card__field-label>Threshold</label><input class=modal-card__input type=number min=0></div><div class=limit-modal__col><label class=modal-card__field-label>Period</label><select class="select notification-modal__select"><option value=hour>Per hour</option><option value=day>Per day</option><option value=week>Per week</option><option value=month>Per month</option></select></div></div><div class=limit-block-toggle><span class=limit-block-toggle__label>Block requests when exceeded</span><label class=notification-toggle><input type=checkbox><span class=notification-toggle__slider></span></label></div><div class=modal-card__footer><button class="btn btn--primary btn--sm">`),St=d("<span class=spinner>");const Et=e=>{const[t,n]=$(!1),[a,s]=$("tokens"),[o,u]=$(""),[v,h]=$("day"),C=()=>t()?"both":"notify",S=()=>{n(!1),s("tokens"),u(""),h("day")};Le(()=>{if(e.open&&e.editData){const m=e.editData;s(m.metric_type),u(String(m.threshold)),h(m.period),n(m.action==="block"||m.action==="both")}else e.open&&S()});const[x,T]=$(!1),R=async()=>{if(x())return;const m=Number(o());if(!(isNaN(m)||m<=0)){T(!0);try{await e.onSave({metric_type:a(),threshold:m,period:v(),action:C()}),S()}finally{T(!1)}}},f=()=>{S(),e.onClose()},k=()=>!!e.editData;return l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var m=Ct(),b=m.firstChild,j=b.firstChild,M=j.nextSibling,D=M.nextSibling,A=D.nextSibling,H=A.nextSibling,I=H.firstChild,Z=I.firstChild,N=Z.nextSibling,re=I.nextSibling,ae=re.firstChild,Y=ae.nextSibling,G=H.nextSibling,X=G.firstChild,Q=X.nextSibling,V=Q.firstChild,ee=G.nextSibling,te=ee.firstChild;return m.$$click=()=>f(),b.$$click=r=>r.stopPropagation(),i(j,()=>k()?"Edit rule":"Create rule"),A.addEventListener("change",r=>s(r.currentTarget.value)),N.$$keydown=r=>{r.key==="Enter"&&R()},N.$$input=r=>u(r.currentTarget.value),Y.addEventListener("change",r=>h(r.currentTarget.value)),V.addEventListener("change",r=>n(r.currentTarget.checked)),te.$$click=R,i(te,(()=>{var r=J(()=>!!x());return()=>r()?St():k()?"Save changes":"Create rule"})()),w(r=>{var p=a()==="cost"?"0.01":"1",P=a()==="cost"?"e.g. 10.00":"e.g. 50000",L=!o()||Number(o())<=0||x();return p!==r.e&&z(N,"step",r.e=p),P!==r.t&&z(N,"placeholder",r.t=P),L!==r.a&&(te.disabled=r.a=L),r},{e:void 0,t:void 0,a:void 0}),w(()=>A.value=a()),w(()=>N.value=o()),w(()=>Y.value=v()),w(()=>V.checked=t()),m}})}})};ie(["click","input","keydown"]);var Pt=d('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor aria-hidden=true><path d="M19.12 12.71a.4.4 0 0 1-.12-.29v-2.41c0-1.91-.75-3.69-2.13-5.02-.86-.84-1.9-1.42-3.02-1.73-.3-.73-1.01-1.24-1.85-1.24s-1.57.53-1.86 1.27C7.19 4.14 5 6.98 5 10.27v2.16c0 .11-.04.22-.12.29l-1.17 1.17a2.411 2.411 0 0 0 1.7 4.12h13.17a2.411 2.411 0 0 0 1.7-4.12l-1.17-1.17ZM18.58 16H5.41a.412.412 0 0 1-.29-.7l1.17-1.17c.46-.46.71-1.06.71-1.71v-2.16c0-2.81 2.17-5.17 4.85-5.25h.16c1.31 0 2.54.5 3.48 1.41.98.95 1.52 2.22 1.52 3.59v2.41c0 .65.25 1.25.71 1.71l1.17 1.17a.412.412 0 0 1-.29.7ZM14.82 20H9.18c.41 1.17 1.51 2 2.82 2s2.41-.83 2.82-2">');const Rt=e=>{const t=()=>e.size??16;return(()=>{var n=Pt();return w(a=>{var s=t(),o=t();return s!==a.e&&z(n,"width",a.e=s),o!==a.t&&z(n,"height",a.t=o),a},{e:void 0,t:void 0}),n})()};var Mt=d('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor aria-hidden=true><path d="M11.5 2c-5.51 0-10 4.49-10 10s4.49 10 10 10 10-4.49 10-10-4.49-10-10-10m-8 10c0-1.85.63-3.54 1.69-4.9L16.4 18.31A8 8 0 0 1 11.5 20c-4.41 0-8-3.59-8-8m14.31 4.9L6.6 5.69A8 8 0 0 1 11.5 4c4.41 0 8 3.59 8 8 0 1.85-.63 3.54-1.69 4.9">');const Tt=e=>{const t=()=>e.size??16;return(()=>{var n=Mt();return w(a=>{var s=t(),o=t();return s!==a.e&&z(n,"width",a.e=s),o!==a.t&&z(n,"height",a.t=o),a},{e:void 0,t:void 0}),n})()};var Ee=d('<table class="notif-table notif-table--flush"><thead><tr><th>Type</th><th>Threshold</th><th>Triggered</th><th style=text-align:right>Actions</th></tr></thead><tbody>'),Lt=d("<div class=panel><div class=panel__title>Rules"),Dt=d('<tr><td><div class="skeleton skeleton--text"style=width:28px></div></td><td><div class="skeleton skeleton--text"style=width:80px></div></td><td><div class="skeleton skeleton--text"style=width:20px></div></td><td style=text-align:right><div class="skeleton skeleton--text"style=width:16px;margin-left:auto>'),Nt=d("<div class=empty-state><div class=empty-state__title>No rules yet</div><p>Set up alerts for usage spikes, or hard limits to block requests over budget."),At=d('<span class=limit-type-icon title="Email Alert">'),It=d('<span class=limit-type-icon title="Hard Limit">'),Ot=d('<span class=limit-warn-tag><svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1=12 y1=9 x2=12 y2=13></line><line x1=12 y1=17 x2=12.01 y2=17></line></svg>No provider'),Bt=d('<tr><td><div class=limit-type-icons></div></td><td><span class=notif-table__mono></span> <span class=notif-table__period></span></td><td class=notif-table__mono></td><td><div class=notif-table__actions><button class=rule-menu__btn aria-label="Rule options"><svg width=16 height=16 viewBox="0 0 24 24"fill=currentColor><circle cx=12 cy=5 r=2></circle><circle cx=12 cy=12 r=2></circle><circle cx=12 cy=19 r=2>');function Ie(e){return e.metric_type==="cost"?`$${Number(e.threshold).toFixed(2)}`:`${Number(e.threshold).toLocaleString()} tokens`}const Oe={hour:"Per hour",day:"Per day",week:"Per week",month:"Per month"},Kt=e=>typeof e.is_active=="number"?!!e.is_active:e.is_active,Pe=e=>e==="notify"||e==="both",zt=e=>e==="block"||e==="both",jt=e=>(()=>{var t=Lt();return t.firstChild,i(t,l(_,{get when(){return!e.loading},get fallback(){return(()=>{var n=Ee(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{each:[1,2,3],children:()=>Dt()})),n})()},get children(){return l(_,{get when(){return(e.rules??[]).length>0},get fallback(){return Nt()},get children(){var n=Ee(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{get each(){return e.rules},children:o=>(()=>{var u=Bt(),v=u.firstChild,h=v.firstChild,C=v.nextSibling,S=C.firstChild,x=S.nextSibling,T=x.nextSibling,R=C.nextSibling,f=R.nextSibling,k=f.firstChild,m=k.firstChild;return i(h,l(_,{get when(){return Pe(o.action??"notify")},get children(){var b=At();return i(b,l(Rt,{size:14})),b}}),null),i(h,l(_,{get when(){return zt(o.action??"notify")},get children(){var b=It();return i(b,l(Tt,{size:14})),b}}),null),i(h,l(_,{get when(){return J(()=>!!Pe(o.action??"notify"))()&&!e.hasProvider},get children(){return Ot()}}),null),i(S,()=>Ie(o)),i(T,()=>(Oe[o.period]??o.period).toLowerCase()),i(R,()=>o.trigger_count??0),m.$$click=b=>e.onToggleMenu(o.id,b),w(()=>u.classList.toggle("notif-table__row--disabled",!Kt(o))),u})()})),n}})}}),null),t})();ie(["click"]);var Re=d('<table class="notif-table notif-table--flush"><thead><tr><th>Date</th><th>Usage</th><th>Threshold</th><th>Resets at</th></tr></thead><tbody>'),Ht=d("<div class=panel><div class=panel__title>History"),Gt=d('<tr><td><div class="skeleton skeleton--text"style=width:100px></div></td><td><div class="skeleton skeleton--text"style=width:60px></div></td><td><div class="skeleton skeleton--text"style=width:60px></div></td><td><div class="skeleton skeleton--text"style=width:100px>'),Vt=d("<div class=empty-state><div class=empty-state__title>No alerts triggered yet"),qt=d("<tr><td class=notif-table__mono></td><td class=notif-table__mono></td><td class=notif-table__mono></td><td class=notif-table__mono>");function Me(e,t){const n=Number(e[t]);return e.metric_type==="cost"?`$${n.toFixed(2)}`:`${n.toLocaleString()} tokens`}function Te(e){const t=e.endsWith("Z")?e:e.replace(" ","T")+"Z";return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const Ut=e=>(()=>{var t=Ht();return t.firstChild,i(t,l(_,{get when(){return!e.loading},get fallback(){return(()=>{var n=Re(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{each:[1,2,3],children:()=>Gt()})),n})()},get children(){return l(_,{get when(){return(e.logs??[]).length>0},get fallback(){return Vt()},get children(){var n=Re(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{get each(){return e.logs},children:o=>(()=>{var u=qt(),v=u.firstChild,h=v.nextSibling,C=h.nextSibling,S=C.nextSibling;return i(v,()=>Te(o.sent_at)),i(h,()=>Me(o,"actual_value")),i(C,()=>Me(o,"threshold_value")),i(S,()=>Te(o.period_end)),u})()})),n}})}}),null),t})();var Jt=d('<div class=rule-menu__dropdown style=position:fixed;transform:translateX(-100%)><button class=rule-menu__item><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Edit</button><button class="rule-menu__item rule-menu__item--danger"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>Delete'),Ft=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true style=max-width:440px><h2 class=modal-card__title>Delete rule</h2><p class=modal-card__desc>This will permanently delete the <span style=font-weight:600></span> rule (<!> <!>). This action cannot be undone.</p><label class=confirm-modal__confirm-row><input type=checkbox>I understand this action is irreversible</label><div class=confirm-modal__footer><button class="btn btn--ghost btn--sm">Cancel</button><button class="btn btn--danger btn--sm">'),Be=d("<span class=spinner>"),Wt=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true style=max-width:440px><h2 class=modal-card__title>Remove provider</h2><p class=modal-card__desc>This will disconnect your email provider.</p><div class=confirm-modal__footer><button class="btn btn--ghost btn--sm">Cancel</button><button class="btn btn--danger btn--sm">');const Zt=e=>l(ve,{get children(){return l(_,{get when(){return e.openMenuId},children:t=>{const n=e.rules.find(a=>a.id===e.openMenuId);return n?(()=>{var a=Jt(),s=a.firstChild,o=s.nextSibling;return s.$$click=()=>e.onEdit(n),o.$$click=()=>e.onDelete(n),w(u=>{var v=`${e.menuPos.top}px`,h=`${e.menuPos.left}px`;return v!==u.e&&ke(a,"top",u.e=v),h!==u.t&&ke(a,"left",u.t=h),u},{e:void 0,t:void 0}),a})():null}})}}),Yt=e=>l(ve,{get children(){return l(_,{get when(){return e.target},get children(){var t=Ft(),n=t.firstChild,a=n.firstChild,s=a.nextSibling,o=s.firstChild,u=o.nextSibling,v=u.nextSibling,h=v.nextSibling,C=h.nextSibling,S=C.nextSibling;S.nextSibling;var x=s.nextSibling,T=x.firstChild,R=x.nextSibling,f=R.firstChild,k=f.nextSibling;return de(t,"click",e.onCancel,!0),n.$$click=m=>m.stopPropagation(),i(u,()=>e.target.metric_type==="tokens"?"token":"cost"),i(s,()=>Ie(e.target),h),i(s,()=>Oe[e.target.period]?.toLowerCase()??e.target.period,S),T.addEventListener("change",m=>e.onConfirmChange(m.currentTarget.checked)),de(f,"click",e.onCancel,!0),de(k,"click",e.onDelete,!0),i(k,(()=>{var m=J(()=>!!e.deleting);return()=>m()?Be():"Delete rule"})()),w(()=>k.disabled=!e.confirmed||e.deleting),w(()=>T.checked=e.confirmed),t}})}}),Xt=e=>l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var t=Wt(),n=t.firstChild,a=n.firstChild,s=a.nextSibling;s.firstChild;var o=s.nextSibling,u=o.firstChild,v=u.nextSibling;return de(t,"click",e.onCancel,!0),n.$$click=h=>h.stopPropagation(),i(s,l(_,{get when(){return e.hasEmailRules},get children(){return[" ","Email alerts won't be sent until you set up a new one."]}}),null),de(u,"click",e.onCancel,!0),de(v,"click",e.onRemove,!0),i(v,(()=>{var h=J(()=>!!e.removing);return()=>h()?Be():"Remove"})()),w(()=>v.disabled=e.removing),t}})}});ie(["click"]);var Qt=d('<div class=limits-warning-banner><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1=12 y1=9 x2=12 y2=13></line><line x1=12 y1=17 x2=12.01 y2=17></line></svg><span>One or more hard limits triggered. New proxy requests for this agent will be blocked until the usage resets in the next period.'),ei=d('<div class=limits-routing-cta><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=10></circle><line x1=12 y1=16 x2=12 y2=12></line><line x1=12 y1=8 x2=12.01 y2=8></line></svg><div><strong>Enable routing to set hard limits</strong><p>Hard limits automatically block proxy requests when usage exceeds a threshold. Email alerts work without routing &mdash; only hard limits require it.'),ti=d("<div style=margin-bottom:var(--gap-lg)>"),ii=d("<div style=margin-top:var(--gap-lg)>"),ni=d('<div class=container--sm><div class=page-header><div><h1>Limits</h1><span class=breadcrumb> &rsaquo; Get notified or block requests when token or cost thresholds are exceeded</span></div><button class="btn btn--primary btn--sm">+ Create rule');const di=()=>{const e=Ke(),t=()=>decodeURIComponent(e.agentName),[n,{refetch:a}]=me(()=>t(),g=>qe(g)),[s,{refetch:o}]=me(()=>t(),g=>Ve(g)),[u,{refetch:v}]=me(We),[h]=me(()=>t(),Ge),C=Ne.useSession(),[S,x]=$(!1),[T,R]=$(!1),[f,k]=$(null),[m,b]=$(null),[j,M]=$({top:0,left:0}),[D,A]=$(null),[H,I]=$(!1),[Z,N]=$(!1),[re,ae]=$(!1),[Y,G]=$(!1),X=()=>h()?.enabled??!1,Q=()=>!se()||!!u(),V=()=>b(null),ee=()=>V(),te=(g,y)=>{if(y.stopPropagation(),m()===g)V();else{const O=y.currentTarget.getBoundingClientRect();M({top:O.bottom+4,left:O.right}),b(g),setTimeout(()=>document.addEventListener("click",ee,{once:!0}),0)}};De(()=>document.removeEventListener("click",ee));const r=g=>{V(),k(g),x(!0)},p=async g=>{const y=f();try{y?(await Je(y.id,{...g}),K.success("Rule updated")):(await Ue({agent_name:t(),...g}),K.success("Rule created")),await a(),x(!1),k(null)}catch{}},P=g=>{V(),A(g),I(!1)},L=async()=>{const g=D();if(g){ae(!0);try{await Fe(g.id),await a(),K.success("Rule deleted")}catch{}finally{ae(!1)}A(null),I(!1)}},q=()=>{const g=n();return g?g.some(y=>y.action==="notify"||y.action==="both"):!1},oe=async()=>{G(!0);try{await Ye(),await v(),N(!1),K.success("Email provider removed")}catch{}finally{G(!1)}},ce=()=>{const g=n();return g?g.some(y=>(y.action==="block"||y.action==="both")&&(typeof y.is_active=="number"?!!y.is_active:y.is_active)&&Number(y.trigger_count)>0):!1};return(()=>{var g=ni(),y=g.firstChild,ue=y.firstChild,O=ue.firstChild,F=O.nextSibling,he=F.firstChild,_e=ue.nextSibling;return i(g,l(ze,{get children(){return[J(()=>$e()??t())," Limits - Manifest"]}}),y),i(g,l(je,{name:"description",get content(){return`Configure limits and alerts for ${$e()??t()}.`}}),y),i(F,()=>$e()??t(),he),_e.$$click=()=>{k(null),x(!0)},i(g,l(_,{get when(){return ce()},get children(){return Qt()}}),null),i(g,l(_,{get when(){return J(()=>!!(h()&&!X()))()&&!se()},get children(){return ei()}}),null),i(g,l(_,{get when(){return!se()},get children(){var B=ti();return i(B,l(tt,{get email(){return C().data?.user?.email??""}})),B}}),null),i(g,l(_,{get when(){return se()},get children(){return l(wt,{get emailProvider(){return u()},get loading(){return u.loading},onConfigured:v,onEdit:()=>R(!0),onRemove:()=>N(!0)})}}),null),i(g,l(jt,{get rules(){return n()},get loading(){return n.loading},get hasProvider(){return Q()},onToggleMenu:te}),null),i(g,l(_,{get when(){return J(()=>!s.loading)()&&(s()??[]).length>0},get children(){var B=ii();return i(B,l(Ut,{get logs(){return s()},loading:!1})),B}}),null),i(g,l(Zt,{get openMenuId(){return m()},get menuPos(){return j()},get rules(){return n()??[]},onEdit:r,onDelete:P}),null),i(g,l(Yt,{get target(){return D()},get confirmed(){return H()},get deleting(){return re()},onConfirmChange:I,onCancel:()=>{A(null),I(!1)},onDelete:L}),null),i(g,l(Xt,{get open(){return Z()},get hasEmailRules(){return q()},get removing(){return Y()},onCancel:()=>N(!1),onRemove:oe}),null),i(g,l(Et,{get open(){return S()},onClose:()=>{x(!1),k(null)},onSave:p,get hasProvider(){return Q()},get editData(){return J(()=>!!f())()?{metric_type:f().metric_type,threshold:Number(f().threshold),period:f().period,action:f().action??"notify"}:null}}),null),i(g,l(Ae,{get open(){return T()},get initialProvider(){return u()?.provider??"resend"},editMode:!0,get existingKeyPrefix(){return u()?.keyPrefix??null},get existingDomain(){return u()?.domain??null},get existingNotificationEmail(){return u()?.notificationEmail??null},onClose:()=>R(!1),onSaved:()=>v()}),null),g})()};ie(["click"]);export{di as default};
1
+ import{i,t as d,a as $,f as Le,g as l,S as _,h as w,s as z,m as J,P as ve,d as ie,o as De,F as ge,B as ke,j as de,n as Ke,k as me,T as ze,M as je}from"./vendor-pl6Q4jbW.js";import{e as pe,q as ne,B as le,s as Ne,d as se,t as K,b as $e}from"./index-Dji58hs5.js";import{a as He}from"./provider-api-key-urls-1G6okUJ7.js";import{a as Ge}from"./routing-dd43hyXW.js";import"./auth-DmX5tAfx.js";function Ve(e){return pe("/notifications/logs",{agent_name:e})}function qe(e){return pe("/notifications",{agent_name:e})}function Ue(e){return ne(`${le}/notifications`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Je(e,t){return ne(`${le}/notifications/${encodeURIComponent(e)}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}function Fe(e){return ne(`${le}/notifications/${encodeURIComponent(e)}`,{method:"DELETE"})}async function We(){const e=await pe("/notifications/email-provider");return"configured"in e&&e.configured===!1?null:e}function Ze(e){return ne(`${le}/notifications/email-provider`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Ye(){return ne(`${le}/notifications/email-provider`,{method:"DELETE"})}function Xe(e){return ne(`${le}/notifications/email-provider/test`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}function Qe(e){return ne(`${le}/notifications/email-provider/test-saved`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to:e})})}var et=d('<div class=cloud-email-info><svg class=cloud-email-info__icon width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6"></polyline></svg><div><div class=cloud-email-info__title>Email alerts</div><div class=cloud-email-info__desc>Alerts will be sent to <strong>');const tt=e=>(()=>{var t=et(),n=t.firstChild,a=n.nextSibling,s=a.firstChild,o=s.nextSibling,u=o.firstChild,v=u.nextSibling;return i(v,()=>e.email),t})();var it=d("<input class=modal-card__input type=text autocomplete=off autofocus style=-webkit-text-security:disc;text-security:disc>"),we=d("<p class=modal-card__field-error>"),nt=d('<p class=modal-card__field-hint><a class=modal-card__field-link target=_blank rel="noopener noreferrer">Get <!> API key'),lt=d("<label class=modal-card__field-label>Sending domain"),rt=d('<input class=modal-card__input type=text placeholder="e.g. notifications.mycompany.com">'),at=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true aria-labelledby=provider-modal-title><h2 class=modal-card__title id=provider-modal-title></h2><p class=modal-card__desc>Enter your API credentials to enable email alert delivery.</p><label class=modal-card__field-label>Provider</label><div class=provider-modal-picker><button class=provider-modal-option type=button><img src=/logos/resend.svg alt class=provider-modal-option__logo><span>Resend</span></button><button class=provider-modal-option type=button><img src=/logos/mailgun.svg alt class=provider-modal-option__logo><span>Mailgun</span></button><button class=provider-modal-option type=button><img src=/logos/sendgrid.svg alt class=provider-modal-option__logo><span>SendGrid</span></button></div><label class=modal-card__field-label>API Key</label><label class=modal-card__field-label>Notification email</label><input class=modal-card__input type=email><p class=modal-card__field-hint>Where threshold alerts will be sent.</p><div class="modal-card__footer modal-card__footer--split"><button class="btn btn--ghost btn--sm"type=button></button><button class="btn btn--primary btn--sm">'),ot=d('<div class=masked-key><span class=masked-key__value></span><button class="btn btn--ghost btn--sm masked-key__edit"type=button>Change'),st=d("<span class=spinner>");const Ce=/^[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)+$/i,Se={resend:"Resend",mailgun:"Mailgun",sendgrid:"SendGrid"},Ae=e=>{const[t,n]=$("resend"),[a,s]=$(""),[o,u]=$(""),[v,h]=$(""),[C,S]=$(!1),[x,T]=$(!1),[R,f]=$(""),[k,m]=$(""),[b,j]=$(!1),M=Ne.useSession(),D=()=>e.editMode&&!!e.existingKeyPrefix&&t()===e.initialProvider,A=()=>(e.existingKeyPrefix??"")+"••••••••";Le(()=>{if(e.open){n(e.initialProvider),s("");const r=e.editMode&&!!e.existingKeyPrefix;j(!r),u(e.existingDomain??"");const p=e.existingNotificationEmail??(se()?"":M()?.data?.user?.email??"");h(p),f(""),m("")}});const H=()=>t()==="mailgun",I=()=>{let r=!0;const p=a().trim(),P=o().trim().toLowerCase();return!b()&&D()?f(""):p?p.length<8?(f("API key must be at least 8 characters"),r=!1):t()==="resend"&&!p.startsWith("re_")?(f("Resend API key must start with re_"),r=!1):t()==="sendgrid"&&!p.startsWith("SG.")?(f("SendGrid API key must start with SG."),r=!1):f(""):(f("API key is required"),r=!1),H()?P?Ce.test(P)?m(""):(m("Invalid domain format"),r=!1):(m("Domain is required"),r=!1):P&&!Ce.test(P)?(m("Invalid domain format"),r=!1):m(""),r},Z=()=>{const r=v().trim();return r||(M()?.data?.user?.email??null)},N=async()=>{const r=a().trim(),p=o().trim().toLowerCase(),P=Z();if(!P)return K.error("Enter a notification email to send the test to"),!1;T(!0);try{const L={provider:t(),apiKey:r,to:P};p&&(L.domain=p);const q=await Xe(L);return q.success?!0:(K.error(q.error??"Email test failed — check your credentials"),!1)}catch{return!1}finally{T(!1)}},re=async()=>{const r=Z();if(!r)return K.error("Enter a notification email to send the test to"),!1;T(!0);try{const p=await Qe(r);return p.success?!0:(K.error(p.error??"Email test failed — check your credentials"),!1)}catch{return!1}finally{T(!1)}},ae=async()=>{if(!I()||X())return;(!b()&&D()?await re():await N())&&K.success(`Test email sent to ${Z()}`)},Y=async()=>{if(!I()||C()||x())return;const r=!b()&&D();if(!(r?await re():await N()))return;const P=o().trim().toLowerCase();S(!0);try{const L={provider:t()};r||(L.apiKey=a().trim()),P&&(L.domain=P);const q=v().trim();q&&(L.notificationEmail=q),await Ze(L);const oe=Se[t()]??t();K.success(`${oe} connected`),e.onSaved(),e.onClose()}catch{}finally{S(!1)}},G=r=>{r.key==="Enter"&&Y(),r.key==="Escape"&&e.onClose()},X=()=>C()||x(),Q=()=>!b()&&D()?!!(H()&&!o().trim()):!!(!a().trim()||H()&&!o().trim()),V=()=>x()?"Testing...":C()?"Saving...":e.editMode?"Test & Save":"Test & Connect",ee=()=>He(t()),te=()=>{switch(t()){case"resend":return"re_xxxx...";case"sendgrid":return"SG.xxxx...";default:return"key-xxxx..."}};return l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var r=at(),p=r.firstChild,P=p.firstChild,L=P.nextSibling,q=L.nextSibling,oe=q.nextSibling,ce=oe.firstChild,g=ce.nextSibling,y=g.nextSibling,ue=oe.nextSibling,O=ue.nextSibling,F=O.nextSibling,he=F.nextSibling,_e=he.nextSibling,B=_e.firstChild,fe=B.nextSibling;return r.$$click=()=>e.onClose(),p.$$click=c=>c.stopPropagation(),i(P,()=>e.editMode?"Edit email provider":"Configure email provider"),ce.$$click=()=>{n("resend"),f("")},g.$$click=()=>{n("mailgun"),f("")},y.$$click=()=>{n("sendgrid"),f("")},i(p,l(_,{get when(){return b()||!D()},get fallback(){return(()=>{var c=ot(),E=c.firstChild,U=E.nextSibling;return i(E,A),U.$$click=()=>{j(!0),s("")},c})()},get children(){var c=it();return c.$$keydown=G,c.$$input=E=>{s(E.currentTarget.value),f("")},w(E=>{var U=!!R(),W=te();return U!==E.e&&c.classList.toggle("modal-card__input--error",E.e=U),W!==E.t&&z(c,"placeholder",E.t=W),E},{e:void 0,t:void 0}),w(()=>c.value=a()),c}}),O),i(p,l(_,{get when(){return R()},get children(){var c=we();return i(c,R),c}}),O),i(p,l(_,{get when(){return ee()},get children(){var c=nt(),E=c.firstChild,U=E.firstChild,W=U.nextSibling;return W.nextSibling,i(E,()=>Se[t()]??t(),W),w(()=>z(E,"href",ee())),c}}),O),i(p,l(_,{get when(){return H()},get children(){return[lt(),(()=>{var c=rt();return c.$$keydown=G,c.$$input=E=>{u(E.currentTarget.value),m("")},w(()=>c.classList.toggle("modal-card__input--error",!!k())),w(()=>c.value=o()),c})(),l(_,{get when(){return k()},get children(){var c=we();return i(c,k),c}})]}}),O),F.$$keydown=G,F.$$input=c=>h(c.currentTarget.value),B.$$click=ae,i(B,(()=>{var c=J(()=>!!x());return()=>c()?st():"Send test email"})()),fe.$$click=Y,i(fe,V),w(c=>{var E=t()==="resend",U=t()==="mailgun",W=t()==="sendgrid",be=se()?"you@example.com":M()?.data?.user?.email??"you@example.com",ye=X()||Q(),xe=X()||Q();return E!==c.e&&ce.classList.toggle("provider-modal-option--active",c.e=E),U!==c.t&&g.classList.toggle("provider-modal-option--active",c.t=U),W!==c.a&&y.classList.toggle("provider-modal-option--active",c.a=W),be!==c.o&&z(F,"placeholder",c.o=be),ye!==c.i&&(B.disabled=c.i=ye),xe!==c.n&&(fe.disabled=c.n=xe),c},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),w(()=>F.value=v()),r}})}})};ie(["click","input","keydown"]);var dt=d('<div class=provider-card__dropdown><button class=provider-card__dropdown-item><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Edit</button><button class="provider-card__dropdown-item provider-card__dropdown-item--danger"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>Remove'),ct=d("<span>"),ut=d('<span class=provider-card__email><svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M4 4h16c1.1 0 2 .9 2 2v12c0 1.1-.9 2-2 2H4c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2z"></path><polyline points="22,6 12,13 2,6">'),gt=d('<div class=provider-card><div class=provider-card__header><span class=provider-card__label>Your provider</span><div class=provider-card__menu><button class=provider-card__menu-btn aria-label="Provider options"><svg width=16 height=16 viewBox="0 0 24 24"fill=currentColor><circle cx=12 cy=5 r=2></circle><circle cx=12 cy=12 r=2></circle><circle cx=12 cy=19 r=2></circle></svg></button></div></div><div class=provider-card__body><img alt class=provider-card__logo><div><div class=provider-card__name></div><div class=provider-card__meta><span class=provider-card__key>...');const vt={resend:"/logos/resend.svg",mailgun:"/logos/mailgun.svg",sendgrid:"/logos/sendgrid.svg"},mt={resend:"Resend",mailgun:"Mailgun",sendgrid:"SendGrid"},ht=e=>{const t=()=>vt[e.config.provider]??"/logos/resend.svg",n=()=>mt[e.config.provider]??e.config.provider,[a,s]=$(!1),o=v=>{v.target.closest(".provider-card__menu")||s(!1)},u=()=>{const v=!a();s(v),v&&document.addEventListener("click",o,{once:!0})};return De(()=>document.removeEventListener("click",o)),(()=>{var v=gt(),h=v.firstChild,C=h.firstChild,S=C.nextSibling,x=S.firstChild,T=h.nextSibling,R=T.firstChild,f=R.nextSibling,k=f.firstChild,m=k.nextSibling,b=m.firstChild,j=b.firstChild;return x.$$click=u,i(S,l(_,{get when(){return a()},get children(){var M=dt(),D=M.firstChild,A=D.nextSibling;return D.$$click=()=>{s(!1),e.onEdit()},A.$$click=()=>{s(!1),e.onRemove()},M}}),null),i(k,n),i(m,l(_,{get when(){return e.config.domain},get children(){var M=ct();return i(M,()=>e.config.domain),M}}),b),i(b,()=>e.config.keyPrefix,j),i(m,l(_,{get when(){return e.config.notificationEmail},get children(){var M=ut();return M.firstChild,i(M,()=>e.config.notificationEmail,null),M}}),null),w(()=>z(R,"src",t())),v})()};ie(["click"]);var _t=d("<h3 class=provider-setup__title>Configure email provider"),ft=d("<p class=provider-setup__subtitle>Choose a service to send alert notifications via email."),$t=d("<div class=provider-setup-grid><button class=provider-setup-card><img src=/logos/resend.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>Resend</div><div class=provider-setup-card__desc>Email API</div></div></button><button class=provider-setup-card><img src=/logos/mailgun.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>Mailgun</div><div class=provider-setup-card__desc>Transactional email</div></div></button><button class=provider-setup-card><img src=/logos/sendgrid.svg alt class=provider-setup-card__logo><div><div class=provider-setup-card__name>SendGrid</div><div class=provider-setup-card__desc>Email delivery");const pt=e=>{const[t,n]=$(!1),[a,s]=$("resend"),o=u=>{s(u),n(!0)};return[_t(),ft(),(()=>{var u=$t(),v=u.firstChild,h=v.nextSibling,C=h.nextSibling;return v.$$click=()=>o("resend"),h.$$click=()=>o("mailgun"),C.$$click=()=>o("sendgrid"),u})(),l(Ae,{get open(){return t()},get initialProvider(){return a()},onClose:()=>n(!1),get onSaved(){return e.onConfigured}})]};ie(["click"]);var bt=d("<div style=margin-bottom:var(--gap-lg)>"),yt=d('<div class=provider-card><div class=provider-card__header><span class=provider-card__label>Your provider</span><div class="skeleton skeleton--text"style="width:16px;height:16px;border-radius:calc(var(--radius) - 2px)"></div></div><div class=provider-card__body><div class="skeleton skeleton--rect"style="width:32px;height:32px;border-radius:calc(var(--radius) - 2px);flex-shrink:0"></div><div><div class="skeleton skeleton--text"style=width:80px;height:14px></div><div class="skeleton skeleton--text"style=width:160px;height:12px;margin-top:6px>'),xt=d('<div class=panel><div class="skeleton skeleton--text"style=width:180px;height:16px></div><div class="skeleton skeleton--text"style=width:280px;height:13px;margin-top:6px></div><div style=display:flex;gap:var(--gap-md);margin-top:var(--gap-lg)>'),kt=d('<div class="skeleton skeleton--rect"style=flex:1;height:64px;border-radius:var(--radius)>');const wt=e=>(()=>{var t=bt();return i(t,l(_,{get when(){return!e.loading},get fallback(){return l(_,{get when(){return!!e.emailProvider},get fallback(){return(()=>{var n=xt(),a=n.firstChild,s=a.nextSibling,o=s.nextSibling;return i(o,l(ge,{each:[1,2,3],children:()=>kt()})),n})()},get children(){return yt()}})},get children(){return l(_,{get when(){return e.emailProvider},get fallback(){return l(pt,{get onConfigured(){return e.onConfigured}})},get children(){return l(ht,{get config(){return e.emailProvider},get onEdit(){return e.onEdit},get onRemove(){return e.onRemove}})}})}})),t})();var Ct=d(`<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true aria-labelledby=limit-modal-title><h2 class=modal-card__title id=limit-modal-title></h2><p class=modal-card__desc>You'll receive an email alert when usage exceeds the threshold.</p><label class=modal-card__field-label style=margin-top:0>Metric</label><select class="select notification-modal__select"><option value=tokens>Tokens</option><option value=cost>Cost (USD)</option></select><div class=limit-modal__row><div class=limit-modal__col><label class=modal-card__field-label>Threshold</label><input class=modal-card__input type=number min=0></div><div class=limit-modal__col><label class=modal-card__field-label>Period</label><select class="select notification-modal__select"><option value=hour>Per hour</option><option value=day>Per day</option><option value=week>Per week</option><option value=month>Per month</option></select></div></div><div class=limit-block-toggle><span class=limit-block-toggle__label>Block requests when exceeded</span><label class=notification-toggle><input type=checkbox><span class=notification-toggle__slider></span></label></div><div class=modal-card__footer><button class="btn btn--primary btn--sm">`),St=d("<span class=spinner>");const Et=e=>{const[t,n]=$(!1),[a,s]=$("tokens"),[o,u]=$(""),[v,h]=$("day"),C=()=>t()?"both":"notify",S=()=>{n(!1),s("tokens"),u(""),h("day")};Le(()=>{if(e.open&&e.editData){const m=e.editData;s(m.metric_type),u(String(m.threshold)),h(m.period),n(m.action==="block"||m.action==="both")}else e.open&&S()});const[x,T]=$(!1),R=async()=>{if(x())return;const m=Number(o());if(!(isNaN(m)||m<=0)){T(!0);try{await e.onSave({metric_type:a(),threshold:m,period:v(),action:C()}),S()}finally{T(!1)}}},f=()=>{S(),e.onClose()},k=()=>!!e.editData;return l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var m=Ct(),b=m.firstChild,j=b.firstChild,M=j.nextSibling,D=M.nextSibling,A=D.nextSibling,H=A.nextSibling,I=H.firstChild,Z=I.firstChild,N=Z.nextSibling,re=I.nextSibling,ae=re.firstChild,Y=ae.nextSibling,G=H.nextSibling,X=G.firstChild,Q=X.nextSibling,V=Q.firstChild,ee=G.nextSibling,te=ee.firstChild;return m.$$click=()=>f(),b.$$click=r=>r.stopPropagation(),i(j,()=>k()?"Edit rule":"Create rule"),A.addEventListener("change",r=>s(r.currentTarget.value)),N.$$keydown=r=>{r.key==="Enter"&&R()},N.$$input=r=>u(r.currentTarget.value),Y.addEventListener("change",r=>h(r.currentTarget.value)),V.addEventListener("change",r=>n(r.currentTarget.checked)),te.$$click=R,i(te,(()=>{var r=J(()=>!!x());return()=>r()?St():k()?"Save changes":"Create rule"})()),w(r=>{var p=a()==="cost"?"0.01":"1",P=a()==="cost"?"e.g. 10.00":"e.g. 50000",L=!o()||Number(o())<=0||x();return p!==r.e&&z(N,"step",r.e=p),P!==r.t&&z(N,"placeholder",r.t=P),L!==r.a&&(te.disabled=r.a=L),r},{e:void 0,t:void 0,a:void 0}),w(()=>A.value=a()),w(()=>N.value=o()),w(()=>Y.value=v()),w(()=>V.checked=t()),m}})}})};ie(["click","input","keydown"]);var Pt=d('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor aria-hidden=true><path d="M19.12 12.71a.4.4 0 0 1-.12-.29v-2.41c0-1.91-.75-3.69-2.13-5.02-.86-.84-1.9-1.42-3.02-1.73-.3-.73-1.01-1.24-1.85-1.24s-1.57.53-1.86 1.27C7.19 4.14 5 6.98 5 10.27v2.16c0 .11-.04.22-.12.29l-1.17 1.17a2.411 2.411 0 0 0 1.7 4.12h13.17a2.411 2.411 0 0 0 1.7-4.12l-1.17-1.17ZM18.58 16H5.41a.412.412 0 0 1-.29-.7l1.17-1.17c.46-.46.71-1.06.71-1.71v-2.16c0-2.81 2.17-5.17 4.85-5.25h.16c1.31 0 2.54.5 3.48 1.41.98.95 1.52 2.22 1.52 3.59v2.41c0 .65.25 1.25.71 1.71l1.17 1.17a.412.412 0 0 1-.29.7ZM14.82 20H9.18c.41 1.17 1.51 2 2.82 2s2.41-.83 2.82-2">');const Rt=e=>{const t=()=>e.size??16;return(()=>{var n=Pt();return w(a=>{var s=t(),o=t();return s!==a.e&&z(n,"width",a.e=s),o!==a.t&&z(n,"height",a.t=o),a},{e:void 0,t:void 0}),n})()};var Mt=d('<svg xmlns=http://www.w3.org/2000/svg viewBox="0 0 24 24"fill=currentColor aria-hidden=true><path d="M11.5 2c-5.51 0-10 4.49-10 10s4.49 10 10 10 10-4.49 10-10-4.49-10-10-10m-8 10c0-1.85.63-3.54 1.69-4.9L16.4 18.31A8 8 0 0 1 11.5 20c-4.41 0-8-3.59-8-8m14.31 4.9L6.6 5.69A8 8 0 0 1 11.5 4c4.41 0 8 3.59 8 8 0 1.85-.63 3.54-1.69 4.9">');const Tt=e=>{const t=()=>e.size??16;return(()=>{var n=Mt();return w(a=>{var s=t(),o=t();return s!==a.e&&z(n,"width",a.e=s),o!==a.t&&z(n,"height",a.t=o),a},{e:void 0,t:void 0}),n})()};var Ee=d('<table class="notif-table notif-table--flush"><thead><tr><th>Type</th><th>Threshold</th><th>Triggered</th><th style=text-align:right>Actions</th></tr></thead><tbody>'),Lt=d("<div class=panel><div class=panel__title>Rules"),Dt=d('<tr><td><div class="skeleton skeleton--text"style=width:28px></div></td><td><div class="skeleton skeleton--text"style=width:80px></div></td><td><div class="skeleton skeleton--text"style=width:20px></div></td><td style=text-align:right><div class="skeleton skeleton--text"style=width:16px;margin-left:auto>'),Nt=d("<div class=empty-state><div class=empty-state__title>No rules yet</div><p>Set up alerts for usage spikes, or hard limits to block requests over budget."),At=d('<span class=limit-type-icon title="Email Alert">'),It=d('<span class=limit-type-icon title="Hard Limit">'),Ot=d('<span class=limit-warn-tag><svg width=12 height=12 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1=12 y1=9 x2=12 y2=13></line><line x1=12 y1=17 x2=12.01 y2=17></line></svg>No provider'),Bt=d('<tr><td><div class=limit-type-icons></div></td><td><span class=notif-table__mono></span> <span class=notif-table__period></span></td><td class=notif-table__mono></td><td><div class=notif-table__actions><button class=rule-menu__btn aria-label="Rule options"><svg width=16 height=16 viewBox="0 0 24 24"fill=currentColor><circle cx=12 cy=5 r=2></circle><circle cx=12 cy=12 r=2></circle><circle cx=12 cy=19 r=2>');function Ie(e){return e.metric_type==="cost"?`$${Number(e.threshold).toFixed(2)}`:`${Number(e.threshold).toLocaleString()} tokens`}const Oe={hour:"Per hour",day:"Per day",week:"Per week",month:"Per month"},Kt=e=>typeof e.is_active=="number"?!!e.is_active:e.is_active,Pe=e=>e==="notify"||e==="both",zt=e=>e==="block"||e==="both",jt=e=>(()=>{var t=Lt();return t.firstChild,i(t,l(_,{get when(){return!e.loading},get fallback(){return(()=>{var n=Ee(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{each:[1,2,3],children:()=>Dt()})),n})()},get children(){return l(_,{get when(){return(e.rules??[]).length>0},get fallback(){return Nt()},get children(){var n=Ee(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{get each(){return e.rules},children:o=>(()=>{var u=Bt(),v=u.firstChild,h=v.firstChild,C=v.nextSibling,S=C.firstChild,x=S.nextSibling,T=x.nextSibling,R=C.nextSibling,f=R.nextSibling,k=f.firstChild,m=k.firstChild;return i(h,l(_,{get when(){return Pe(o.action??"notify")},get children(){var b=At();return i(b,l(Rt,{size:14})),b}}),null),i(h,l(_,{get when(){return zt(o.action??"notify")},get children(){var b=It();return i(b,l(Tt,{size:14})),b}}),null),i(h,l(_,{get when(){return J(()=>!!Pe(o.action??"notify"))()&&!e.hasProvider},get children(){return Ot()}}),null),i(S,()=>Ie(o)),i(T,()=>(Oe[o.period]??o.period).toLowerCase()),i(R,()=>o.trigger_count??0),m.$$click=b=>e.onToggleMenu(o.id,b),w(()=>u.classList.toggle("notif-table__row--disabled",!Kt(o))),u})()})),n}})}}),null),t})();ie(["click"]);var Re=d('<table class="notif-table notif-table--flush"><thead><tr><th>Date</th><th>Usage</th><th>Threshold</th><th>Resets at</th></tr></thead><tbody>'),Ht=d("<div class=panel><div class=panel__title>History"),Gt=d('<tr><td><div class="skeleton skeleton--text"style=width:100px></div></td><td><div class="skeleton skeleton--text"style=width:60px></div></td><td><div class="skeleton skeleton--text"style=width:60px></div></td><td><div class="skeleton skeleton--text"style=width:100px>'),Vt=d("<div class=empty-state><div class=empty-state__title>No alerts triggered yet"),qt=d("<tr><td class=notif-table__mono></td><td class=notif-table__mono></td><td class=notif-table__mono></td><td class=notif-table__mono>");function Me(e,t){const n=Number(e[t]);return e.metric_type==="cost"?`$${n.toFixed(2)}`:`${n.toLocaleString()} tokens`}function Te(e){const t=e.endsWith("Z")?e:e.replace(" ","T")+"Z";return new Date(t).toLocaleDateString(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}const Ut=e=>(()=>{var t=Ht();return t.firstChild,i(t,l(_,{get when(){return!e.loading},get fallback(){return(()=>{var n=Re(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{each:[1,2,3],children:()=>Gt()})),n})()},get children(){return l(_,{get when(){return(e.logs??[]).length>0},get fallback(){return Vt()},get children(){var n=Re(),a=n.firstChild,s=a.nextSibling;return i(s,l(ge,{get each(){return e.logs},children:o=>(()=>{var u=qt(),v=u.firstChild,h=v.nextSibling,C=h.nextSibling,S=C.nextSibling;return i(v,()=>Te(o.sent_at)),i(h,()=>Me(o,"actual_value")),i(C,()=>Me(o,"threshold_value")),i(S,()=>Te(o.period_end)),u})()})),n}})}}),null),t})();var Jt=d('<div class=rule-menu__dropdown style=position:fixed;transform:translateX(-100%)><button class=rule-menu__item><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"></path><path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"></path></svg>Edit</button><button class="rule-menu__item rule-menu__item--danger"><svg width=14 height=14 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>Delete'),Ft=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true style=max-width:440px><h2 class=modal-card__title>Delete rule</h2><p class=modal-card__desc>This will permanently delete the <span style=font-weight:600></span> rule (<!> <!>). This action cannot be undone.</p><label class=confirm-modal__confirm-row><input type=checkbox>I understand this action is irreversible</label><div class=confirm-modal__footer><button class="btn btn--ghost btn--sm">Cancel</button><button class="btn btn--danger btn--sm">'),Be=d("<span class=spinner>"),Wt=d('<div class=modal-overlay><div class=modal-card role=dialog aria-modal=true style=max-width:440px><h2 class=modal-card__title>Remove provider</h2><p class=modal-card__desc>This will disconnect your email provider.</p><div class=confirm-modal__footer><button class="btn btn--ghost btn--sm">Cancel</button><button class="btn btn--danger btn--sm">');const Zt=e=>l(ve,{get children(){return l(_,{get when(){return e.openMenuId},children:t=>{const n=e.rules.find(a=>a.id===e.openMenuId);return n?(()=>{var a=Jt(),s=a.firstChild,o=s.nextSibling;return s.$$click=()=>e.onEdit(n),o.$$click=()=>e.onDelete(n),w(u=>{var v=`${e.menuPos.top}px`,h=`${e.menuPos.left}px`;return v!==u.e&&ke(a,"top",u.e=v),h!==u.t&&ke(a,"left",u.t=h),u},{e:void 0,t:void 0}),a})():null}})}}),Yt=e=>l(ve,{get children(){return l(_,{get when(){return e.target},get children(){var t=Ft(),n=t.firstChild,a=n.firstChild,s=a.nextSibling,o=s.firstChild,u=o.nextSibling,v=u.nextSibling,h=v.nextSibling,C=h.nextSibling,S=C.nextSibling;S.nextSibling;var x=s.nextSibling,T=x.firstChild,R=x.nextSibling,f=R.firstChild,k=f.nextSibling;return de(t,"click",e.onCancel,!0),n.$$click=m=>m.stopPropagation(),i(u,()=>e.target.metric_type==="tokens"?"token":"cost"),i(s,()=>Ie(e.target),h),i(s,()=>Oe[e.target.period]?.toLowerCase()??e.target.period,S),T.addEventListener("change",m=>e.onConfirmChange(m.currentTarget.checked)),de(f,"click",e.onCancel,!0),de(k,"click",e.onDelete,!0),i(k,(()=>{var m=J(()=>!!e.deleting);return()=>m()?Be():"Delete rule"})()),w(()=>k.disabled=!e.confirmed||e.deleting),w(()=>T.checked=e.confirmed),t}})}}),Xt=e=>l(ve,{get children(){return l(_,{get when(){return e.open},get children(){var t=Wt(),n=t.firstChild,a=n.firstChild,s=a.nextSibling;s.firstChild;var o=s.nextSibling,u=o.firstChild,v=u.nextSibling;return de(t,"click",e.onCancel,!0),n.$$click=h=>h.stopPropagation(),i(s,l(_,{get when(){return e.hasEmailRules},get children(){return[" ","Email alerts won't be sent until you set up a new one."]}}),null),de(u,"click",e.onCancel,!0),de(v,"click",e.onRemove,!0),i(v,(()=>{var h=J(()=>!!e.removing);return()=>h()?Be():"Remove"})()),w(()=>v.disabled=e.removing),t}})}});ie(["click"]);var Qt=d('<div class=limits-warning-banner><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"></path><line x1=12 y1=9 x2=12 y2=13></line><line x1=12 y1=17 x2=12.01 y2=17></line></svg><span>One or more hard limits triggered. New proxy requests for this agent will be blocked until the usage resets in the next period.'),ei=d('<div class=limits-routing-cta><svg width=20 height=20 viewBox="0 0 24 24"fill=none stroke=currentColor stroke-width=2 stroke-linecap=round stroke-linejoin=round><circle cx=12 cy=12 r=10></circle><line x1=12 y1=16 x2=12 y2=12></line><line x1=12 y1=8 x2=12.01 y2=8></line></svg><div><strong>Enable routing to set hard limits</strong><p>Hard limits automatically block proxy requests when usage exceeds a threshold. Email alerts work without routing &mdash; only hard limits require it.'),ti=d("<div style=margin-bottom:var(--gap-lg)>"),ii=d("<div style=margin-top:var(--gap-lg)>"),ni=d('<div class=container--sm><div class=page-header><div><h1>Limits</h1><span class=breadcrumb> &rsaquo; Get notified or block requests when token or cost thresholds are exceeded</span></div><button class="btn btn--primary btn--sm">+ Create rule');const di=()=>{const e=Ke(),t=()=>decodeURIComponent(e.agentName),[n,{refetch:a}]=me(()=>t(),g=>qe(g)),[s,{refetch:o}]=me(()=>t(),g=>Ve(g)),[u,{refetch:v}]=me(We),[h]=me(()=>t(),Ge),C=Ne.useSession(),[S,x]=$(!1),[T,R]=$(!1),[f,k]=$(null),[m,b]=$(null),[j,M]=$({top:0,left:0}),[D,A]=$(null),[H,I]=$(!1),[Z,N]=$(!1),[re,ae]=$(!1),[Y,G]=$(!1),X=()=>h()?.enabled??!1,Q=()=>!se()||!!u(),V=()=>b(null),ee=()=>V(),te=(g,y)=>{if(y.stopPropagation(),m()===g)V();else{const O=y.currentTarget.getBoundingClientRect();M({top:O.bottom+4,left:O.right}),b(g),setTimeout(()=>document.addEventListener("click",ee,{once:!0}),0)}};De(()=>document.removeEventListener("click",ee));const r=g=>{V(),k(g),x(!0)},p=async g=>{const y=f();try{y?(await Je(y.id,{...g}),K.success("Rule updated")):(await Ue({agent_name:t(),...g}),K.success("Rule created")),await a(),x(!1),k(null)}catch{}},P=g=>{V(),A(g),I(!1)},L=async()=>{const g=D();if(g){ae(!0);try{await Fe(g.id),await a(),K.success("Rule deleted")}catch{}finally{ae(!1)}A(null),I(!1)}},q=()=>{const g=n();return g?g.some(y=>y.action==="notify"||y.action==="both"):!1},oe=async()=>{G(!0);try{await Ye(),await v(),N(!1),K.success("Email provider removed")}catch{}finally{G(!1)}},ce=()=>{const g=n();return g?g.some(y=>(y.action==="block"||y.action==="both")&&(typeof y.is_active=="number"?!!y.is_active:y.is_active)&&Number(y.trigger_count)>0):!1};return(()=>{var g=ni(),y=g.firstChild,ue=y.firstChild,O=ue.firstChild,F=O.nextSibling,he=F.firstChild,_e=ue.nextSibling;return i(g,l(ze,{get children(){return[J(()=>$e()??t())," Limits - Manifest"]}}),y),i(g,l(je,{name:"description",get content(){return`Configure limits and alerts for ${$e()??t()}.`}}),y),i(F,()=>$e()??t(),he),_e.$$click=()=>{k(null),x(!0)},i(g,l(_,{get when(){return ce()},get children(){return Qt()}}),null),i(g,l(_,{get when(){return J(()=>!!(h()&&!X()))()&&!se()},get children(){return ei()}}),null),i(g,l(_,{get when(){return!se()},get children(){var B=ti();return i(B,l(tt,{get email(){return C().data?.user?.email??""}})),B}}),null),i(g,l(_,{get when(){return se()},get children(){return l(wt,{get emailProvider(){return u()},get loading(){return u.loading},onConfigured:v,onEdit:()=>R(!0),onRemove:()=>N(!0)})}}),null),i(g,l(jt,{get rules(){return n()},get loading(){return n.loading},get hasProvider(){return Q()},onToggleMenu:te}),null),i(g,l(_,{get when(){return J(()=>!s.loading)()&&(s()??[]).length>0},get children(){var B=ii();return i(B,l(Ut,{get logs(){return s()},loading:!1})),B}}),null),i(g,l(Zt,{get openMenuId(){return m()},get menuPos(){return j()},get rules(){return n()??[]},onEdit:r,onDelete:P}),null),i(g,l(Yt,{get target(){return D()},get confirmed(){return H()},get deleting(){return re()},onConfirmChange:I,onCancel:()=>{A(null),I(!1)},onDelete:L}),null),i(g,l(Xt,{get open(){return Z()},get hasEmailRules(){return q()},get removing(){return Y()},onCancel:()=>N(!1),onRemove:oe}),null),i(g,l(Et,{get open(){return S()},onClose:()=>{x(!1),k(null)},onSave:p,get hasProvider(){return Q()},get editData(){return J(()=>!!f())()?{metric_type:f().metric_type,threshold:Number(f().threshold),period:f().period,action:f().action??"notify"}:null}}),null),i(g,l(Ae,{get open(){return T()},get initialProvider(){return u()?.provider??"resend"},editMode:!0,get existingKeyPrefix(){return u()?.keyPrefix??null},get existingDomain(){return u()?.domain??null},get existingNotificationEmail(){return u()?.notificationEmail??null},onClose:()=>R(!1),onSaved:()=>v()}),null),g})()};ie(["click"]);export{di as default};
@@ -1 +1 @@
1
- import{a as n,D as A,e as F,g as r,T as q,M as W,S as f,i,m,h as d,A as R,t as s,d as B}from"./vendor-pl6Q4jbW.js";import{S as U}from"./SocialButtons-8xBLnR-O.js";import{u as j,s as x}from"./index-JMxG9oFW.js";import"./auth-DmX5tAfx.js";var z=s("<div class=auth-header><h1 class=auth-header__title>Connecting...</h1><p class=auth-header__subtitle>Setting up your local session"),G=s("<div class=auth-header><h1 class=auth-header__title>Welcome back</h1><p class=auth-header__subtitle>Take control of your OpenClaw costs"),H=s("<div class=auth-divider><span class=auth-divider__text>or"),J=s("<button type=button class=auth-form__link-btn>"),K=s('<form class=auth-form><label class=auth-form__label>Email<input class=auth-form__input type=email placeholder=you@example.com required></label><label class=auth-form__label>Password<input class=auth-form__input type=password placeholder="Enter your password"required></label><div class=auth-form__actions></div><button class=auth-form__submit type=submit>'),Q=s("<div class=auth-footer><span>Don't have an account? "),X=s("<div class=auth-form__error>"),Y=s("<span class=spinner>");const Z=60,se=()=>{const[h,I]=n(""),[_,D]=n(""),[p,l]=n(""),[g,v]=n(!1),[M,$]=n(!1),[o,b]=n(0),[w,S]=n(!1),[O]=A();F(async()=>{if(O.error&&l("Login failed. Please try again or use a different method."),await j()){S(!0);try{if((await fetch("/api/auth/local-session",{credentials:"include"})).ok){window.location.href="/";return}}catch{}S(!1)}});const P=()=>{b(Z);const e=setInterval(()=>{b(t=>t<=1?(clearInterval(e),0):t-1)},1e3)},T=async e=>{e.preventDefault(),l(""),$(!1),v(!0);const{error:t}=await x.signIn.email({email:h(),password:_()});if(v(!1),t){const c=t.message??"";if(c.toLowerCase().includes("email is not verified")||t.code==="EMAIL_NOT_VERIFIED"){$(!0),l("Please verify your email before signing in.");return}l(c||"Invalid email or password");return}window.location.href="/"},V=async()=>{if(o()>0)return;const{error:e}=await x.sendVerificationEmail({email:h(),callbackURL:"/"});if(e){l(e.message??"Failed to resend verification email");return}P(),l("Verification email sent! Check your inbox.")};return[r(q,{children:"Sign In - Manifest"}),r(W,{name:"description",content:"Sign in to Manifest to monitor your AI agents."}),r(f,{get when(){return w()},get children(){return z()}}),r(f,{get when(){return!w()},get children(){return[G(),r(U,{}),H(),(()=>{var e=K(),t=e.firstChild,c=t.firstChild,y=c.nextSibling,E=t.nextSibling,N=E.firstChild,C=N.nextSibling,k=E.nextSibling,L=k.nextSibling;return e.addEventListener("submit",T),i(e,(()=>{var a=m(()=>!!p());return()=>a()&&(()=>{var u=X();return i(u,p),u})()})(),t),i(e,r(f,{get when(){return M()},get children(){var a=J();return a.$$click=V,i(a,(()=>{var u=m(()=>o()>0);return()=>u()?`Resend in ${o()}s`:"Resend verification email"})()),d(()=>a.disabled=o()>0),a}}),t),y.$$input=a=>I(a.currentTarget.value),C.$$input=a=>D(a.currentTarget.value),i(k,r(R,{href:"/reset-password",class:"auth-form__forgot",children:"Forgot password?"})),i(L,(()=>{var a=m(()=>!!g());return()=>a()?Y():"Sign in"})()),d(()=>L.disabled=g()),d(()=>y.value=h()),d(()=>C.value=_()),e})(),(()=>{var e=Q();return e.firstChild,i(e,r(R,{href:"/register",class:"auth-footer__link",children:"Sign up"}),null),e})()]}})]};B(["click","input"]);export{se as default};
1
+ import{a as n,D as A,e as F,g as r,T as q,M as W,S as f,i,m,h as d,A as R,t as s,d as B}from"./vendor-pl6Q4jbW.js";import{S as U}from"./SocialButtons-B7A7StCx.js";import{u as j,s as x}from"./index-Dji58hs5.js";import"./auth-DmX5tAfx.js";var z=s("<div class=auth-header><h1 class=auth-header__title>Connecting...</h1><p class=auth-header__subtitle>Setting up your local session"),G=s("<div class=auth-header><h1 class=auth-header__title>Welcome back</h1><p class=auth-header__subtitle>Take control of your OpenClaw costs"),H=s("<div class=auth-divider><span class=auth-divider__text>or"),J=s("<button type=button class=auth-form__link-btn>"),K=s('<form class=auth-form><label class=auth-form__label>Email<input class=auth-form__input type=email placeholder=you@example.com required></label><label class=auth-form__label>Password<input class=auth-form__input type=password placeholder="Enter your password"required></label><div class=auth-form__actions></div><button class=auth-form__submit type=submit>'),Q=s("<div class=auth-footer><span>Don't have an account? "),X=s("<div class=auth-form__error>"),Y=s("<span class=spinner>");const Z=60,se=()=>{const[h,I]=n(""),[_,D]=n(""),[p,l]=n(""),[g,v]=n(!1),[M,$]=n(!1),[o,b]=n(0),[w,S]=n(!1),[O]=A();F(async()=>{if(O.error&&l("Login failed. Please try again or use a different method."),await j()){S(!0);try{if((await fetch("/api/auth/local-session",{credentials:"include"})).ok){window.location.href="/";return}}catch{}S(!1)}});const P=()=>{b(Z);const e=setInterval(()=>{b(t=>t<=1?(clearInterval(e),0):t-1)},1e3)},T=async e=>{e.preventDefault(),l(""),$(!1),v(!0);const{error:t}=await x.signIn.email({email:h(),password:_()});if(v(!1),t){const c=t.message??"";if(c.toLowerCase().includes("email is not verified")||t.code==="EMAIL_NOT_VERIFIED"){$(!0),l("Please verify your email before signing in.");return}l(c||"Invalid email or password");return}window.location.href="/"},V=async()=>{if(o()>0)return;const{error:e}=await x.sendVerificationEmail({email:h(),callbackURL:"/"});if(e){l(e.message??"Failed to resend verification email");return}P(),l("Verification email sent! Check your inbox.")};return[r(q,{children:"Sign In - Manifest"}),r(W,{name:"description",content:"Sign in to Manifest to monitor your AI agents."}),r(f,{get when(){return w()},get children(){return z()}}),r(f,{get when(){return!w()},get children(){return[G(),r(U,{}),H(),(()=>{var e=K(),t=e.firstChild,c=t.firstChild,y=c.nextSibling,E=t.nextSibling,N=E.firstChild,C=N.nextSibling,k=E.nextSibling,L=k.nextSibling;return e.addEventListener("submit",T),i(e,(()=>{var a=m(()=>!!p());return()=>a()&&(()=>{var u=X();return i(u,p),u})()})(),t),i(e,r(f,{get when(){return M()},get children(){var a=J();return a.$$click=V,i(a,(()=>{var u=m(()=>o()>0);return()=>u()?`Resend in ${o()}s`:"Resend verification email"})()),d(()=>a.disabled=o()>0),a}}),t),y.$$input=a=>I(a.currentTarget.value),C.$$input=a=>D(a.currentTarget.value),i(k,r(R,{href:"/reset-password",class:"auth-form__forgot",children:"Forgot password?"})),i(L,(()=>{var a=m(()=>!!g());return()=>a()?Y():"Sign in"})()),d(()=>L.disabled=g()),d(()=>y.value=h()),d(()=>C.value=_()),e})(),(()=>{var e=Q();return e.firstChild,i(e,r(R,{href:"/register",class:"auth-footer__link",children:"Sign up"}),null),e})()]}})]};B(["click","input"]);export{se as default};
@@ -1 +1 @@
1
- import{a as b,p as D,n as Y,b as Z,k as U,o as ee,f as O,z as j,i as d,g as a,m as A,T as te,M as se,h as B,S as p,F as ae,t as g,d as re}from"./vendor-pl6Q4jbW.js";import{d as ne,p as le,b as V,E as ie}from"./index-JMxG9oFW.js";import{g as oe,S as ce,M as de,D as ge,a as ue}from"./overview-DIAj72dm.js";import{P as me}from"./Pagination-Ctujg2Tx.js";import{g as pe,a as ve}from"./routing-CuE7sS2j.js";import{p as he}from"./model-display-1OeS4GNc.js";import{P as fe}from"./routing-utils-B_Dl8Sof.js";import"./auth-DmX5tAfx.js";import"./AuthBadge-zJLfTd7g.js";import"./SetupStepAddProvider-CJemlPav.js";import"./CopyButton-CZjeoxZT.js";function _e(i=50){const[L,x]=b([void 0]),[y,v]=b(0),[k,h]=b(!1),N=D(()=>y()+1),I=D(()=>L()[y()]),C=D(()=>k());function P(f){f?(h(!0),x(o=>{const S=y()+1,$=[...o];return $[S]=f,$})):h(!1)}function E(){k()&&v(f=>f+1)}function R(){y()<=0||v(f=>f-1)}function M(){x([void 0]),v(0),h(!1)}return{currentPage:N,currentCursor:I,hasNextPage:C,previousPage:R,nextPage:E,recordResponse:P,resetPage:M,pageSize:i}}var be=g('<div class=cost-range-filter><input type=number class=cost-range-filter__input placeholder="Min $"min=0 step=0.01><span class=cost-range-filter__sep>&ndash;</span><input type=number class=cost-range-filter__input placeholder="Max $"min=0 step=0.01>'),xe=g('<button class="btn btn--primary btn--sm">Set up agent'),ye=g('<div class=empty-state><div class=empty-state__title>No messages yet</div><p>Connect a provider to start routing LLM calls.</p><button class="btn btn--primary btn--sm"style=margin-top:var(--gap-md)>Enable routing</button><div class=empty-state__img-wrapper><img src=/example-messages.svg alt="Example message log showing LLM call history"class=empty-state__img loading=lazy>',!0,!1,!1),$e=g('<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class=panel__title style=margin-bottom:0>Messages</div><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))>0 results</span></div><div class=model-filter__empty><p class=model-filter__empty-title>No messages match your filters</p><p class=model-filter__empty-hint>Try adjusting your provider or cost filters to see more results.</p><button class="btn btn--outline btn--sm"type=button>Clear filters'),ke=g('<div class=waiting-banner><i class="bxd bx-florist"></i><p>No messages yet. They appear seconds after your first LLM call.'),Ce=g("<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class=panel__title style=margin-bottom:0>Messages</div><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))> total</span></div><div class=data-table-scroll>"),Me=g("<div class=container--full><div class=page-header><div><h1>Messages</h1><span class=breadcrumb>Full log of every LLM call. Filter by provider or cost.</span></div><div class=header-controls>"),Se=g('<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class="skeleton skeleton--text"style=width:80px;height:16px></div><div class="skeleton skeleton--text"style=width:60px;height:14px></div></div><div class=data-table-scroll><table class=data-table><thead><tr><th>Date</th><th>Message</th><th>Cost</th><th>Total Tokens</th><th>Input</th><th>Output</th><th>Model</th><th>Cache</th><th>Duration</th><th>Status</th></tr></thead><tbody>'),we=g('<tr><td><div class="skeleton skeleton--text"style=width:90px></div></td><td><div class="skeleton skeleton--text"style=width:55px></div></td><td><div class="skeleton skeleton--text"style=width:40px></div></td><td><div class="skeleton skeleton--text"style=width:40px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:110px></div></td><td><div class="skeleton skeleton--text"style=width:90px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:50px>'),Ne=g('<div class=empty-state><div class=empty-state__title>No messages yet</div><p>Set up your agent and send a message. Every LLM call shows up here.</p><button class="btn btn--primary btn--sm"style=margin-top:var(--gap-md)>Set up agent</button><div class=empty-state__img-wrapper><img src=/example-messages.svg alt="Example message log showing LLM call history"class=empty-state__img loading=lazy>',!0,!1,!1);const Oe=()=>{const i=Y(),L=Z();he();const[x,y]=b(""),[v,k]=b(""),[h,N]=b(""),[I,C]=b(!1),[P]=b(!!localStorage.getItem(`setup_completed_${i.agentName}`)||ne()===!0),[E]=U(()=>i.agentName,e=>pe(decodeURIComponent(e))),[R]=U(()=>i.agentName,e=>ve(decodeURIComponent(e))),M=()=>R()?.enabled===!0,f=e=>{const s=e.match(/^custom:([^/]+)\//);if(!s)return;const _=s[1];return E()?.find(u=>u.id===_)?.name},o=_e(50);let S,$;ee(()=>{clearTimeout(S),clearTimeout($)});const q=e=>{clearTimeout(S),S=setTimeout(()=>k(e),400)},H=e=>{clearTimeout($),$=setTimeout(()=>N(e),400)};O(j([x,v,h],()=>o.resetPage(),{defer:!0}));const[l,{refetch:G}]=U(()=>({provider:x(),costMin:v(),costMax:h(),agentName:i.agentName,_ping:le(),cursor:o.currentCursor(),limit:o.pageSize}),e=>{const s={};return e.provider&&(s.provider=e.provider),e.costMin&&(s.cost_min=e.costMin),e.costMax&&(s.cost_max=e.costMax),e.agentName&&(s.agent_name=e.agentName),e.cursor&&(s.cursor=e.cursor),s.limit=String(e.limit),oe(s)});O(j(()=>l(),e=>{e&&o.recordResponse(e.next_cursor)}));const F=()=>x()!==""||v()!==""||h()!=="",T=()=>{const e=l();return e&&e.total_count===0},z=()=>T()&&!F()&&!M(),J=()=>T()&&F(),K=()=>!T()||M()&&!F(),Q=()=>{y(""),k(""),N("")},W=e=>fe.find(_=>_.id===e)?.name??e,X=e=>{const s=l()?.items;if(!s)return;const _=s.find(t=>t.fallback_from_model===e&&t.status==="ok");if(!_)return;const u=document.getElementById(`msg-${_.id}`);u&&(u.scrollIntoView({behavior:"smooth",block:"center"}),u.classList.add("msg-highlight"),setTimeout(()=>u.classList.remove("msg-highlight"),2e3))};return(()=>{var e=Me(),s=e.firstChild,_=s.firstChild,u=_.nextSibling;return d(e,a(te,{get children(){return[A(()=>V()??decodeURIComponent(i.agentName))," Messages - Manifest"]}}),s),d(e,a(se,{name:"description",get content(){return`Browse all messages sent and received by ${V()??decodeURIComponent(i.agentName)}. Filter by provider or cost.`}}),s),d(u,a(p,{get when(){return!z()},get children(){return[a(ce,{get value(){return x()},onChange:y,get options(){return[{label:"All providers",value:""},...(l()?.providers??[]).map(t=>({label:W(t),value:t}))]}}),(()=>{var t=be(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return r.$$input=m=>q(m.currentTarget.value),n.$$input=m=>H(m.currentTarget.value),B(()=>r.value=v()),B(()=>n.value=h()),t})()]}}),null),d(u,a(p,{get when(){return A(()=>!!z())()&&!P()},get children(){var t=xe();return t.$$click=()=>C(!0),t}}),null),d(e,a(p,{get when(){return l()!==void 0||!l.loading},get fallback(){return(()=>{var t=Se(),r=t.firstChild,c=r.nextSibling,n=c.firstChild,m=n.firstChild,w=m.nextSibling;return d(w,a(ae,{each:[1,2,3,4,5,6,7,8,9,10],children:()=>we()})),t})()},get children(){return a(p,{get when(){return!l.error},get fallback(){return a(ie,{get error(){return l.error},onRetry:G})},get children(){return[a(p,{get when(){return z()},get children(){return a(p,{get when(){return P()},get fallback(){return(()=>{var t=Ne(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return n.$$click=()=>C(!0),t})()},get children(){var t=ye(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return n.$$click=()=>L(`/agents/${encodeURIComponent(i.agentName)}/routing`,{state:{openProviders:!0}}),t}})}}),a(p,{get when(){return J()},get children(){var t=$e(),r=t.firstChild,c=r.nextSibling,n=c.firstChild,m=n.nextSibling,w=m.nextSibling;return w.$$click=Q,t}}),a(p,{get when(){return K()},get children(){return[a(p,{get when(){return A(()=>!!T())()&&M()},get children(){return ke()}}),(()=>{var t=Ce(),r=t.firstChild,c=r.firstChild,n=c.nextSibling,m=n.firstChild,w=r.nextSibling;return d(n,()=>l()?.total_count??0,m),d(w,a(de,{get items(){return l()?.items??[]},columns:ge,get agentName(){return i.agentName},customProviderName:f,onFallbackErrorClick:X,rowIdPrefix:"msg-",showHeaderTooltips:!0,expandable:!0})),d(t,a(me,{get currentPage(){return o.currentPage},totalItems:()=>l()?.total_count??0,get pageSize(){return o.pageSize},get hasNextPage(){return o.hasNextPage},isLoading:()=>l.loading,get onPrevious(){return o.previousPage},get onNext(){return o.nextPage}}),null),t})()]}})]}})}}),null),d(e,a(ue,{get open(){return I()},get agentName(){return decodeURIComponent(i.agentName)},onClose:()=>C(!1)}),null),e})()};re(["input","click"]);export{Oe as default};
1
+ import{a as b,p as D,n as Y,b as Z,k as U,o as ee,f as O,z as j,i as d,g as a,m as A,T as te,M as se,h as B,S as p,F as ae,t as g,d as re}from"./vendor-pl6Q4jbW.js";import{d as ne,p as le,b as V,E as ie}from"./index-Dji58hs5.js";import{g as oe,S as ce,M as de,D as ge,a as ue}from"./overview-U0Ep7bv7.js";import{P as me}from"./Pagination-Ctujg2Tx.js";import{g as pe,a as ve}from"./routing-dd43hyXW.js";import{p as he}from"./model-display-BoOKkgTP.js";import{P as fe}from"./routing-utils-CRQ2wPZ7.js";import"./auth-DmX5tAfx.js";import"./AuthBadge-zJLfTd7g.js";import"./SetupStepAddProvider-CJemlPav.js";import"./CopyButton-CZjeoxZT.js";function _e(i=50){const[L,x]=b([void 0]),[y,v]=b(0),[k,h]=b(!1),N=D(()=>y()+1),I=D(()=>L()[y()]),C=D(()=>k());function P(f){f?(h(!0),x(o=>{const S=y()+1,$=[...o];return $[S]=f,$})):h(!1)}function E(){k()&&v(f=>f+1)}function R(){y()<=0||v(f=>f-1)}function M(){x([void 0]),v(0),h(!1)}return{currentPage:N,currentCursor:I,hasNextPage:C,previousPage:R,nextPage:E,recordResponse:P,resetPage:M,pageSize:i}}var be=g('<div class=cost-range-filter><input type=number class=cost-range-filter__input placeholder="Min $"min=0 step=0.01><span class=cost-range-filter__sep>&ndash;</span><input type=number class=cost-range-filter__input placeholder="Max $"min=0 step=0.01>'),xe=g('<button class="btn btn--primary btn--sm">Set up agent'),ye=g('<div class=empty-state><div class=empty-state__title>No messages yet</div><p>Connect a provider to start routing LLM calls.</p><button class="btn btn--primary btn--sm"style=margin-top:var(--gap-md)>Enable routing</button><div class=empty-state__img-wrapper><img src=/example-messages.svg alt="Example message log showing LLM call history"class=empty-state__img loading=lazy>',!0,!1,!1),$e=g('<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class=panel__title style=margin-bottom:0>Messages</div><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))>0 results</span></div><div class=model-filter__empty><p class=model-filter__empty-title>No messages match your filters</p><p class=model-filter__empty-hint>Try adjusting your provider or cost filters to see more results.</p><button class="btn btn--outline btn--sm"type=button>Clear filters'),ke=g('<div class=waiting-banner><i class="bxd bx-florist"></i><p>No messages yet. They appear seconds after your first LLM call.'),Ce=g("<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class=panel__title style=margin-bottom:0>Messages</div><span style=font-size:var(--font-size-xs);color:hsl(var(--muted-foreground))> total</span></div><div class=data-table-scroll>"),Me=g("<div class=container--full><div class=page-header><div><h1>Messages</h1><span class=breadcrumb>Full log of every LLM call. Filter by provider or cost.</span></div><div class=header-controls>"),Se=g('<div class=panel><div style=display:flex;justify-content:space-between;align-items:center;margin-bottom:var(--gap-lg)><div class="skeleton skeleton--text"style=width:80px;height:16px></div><div class="skeleton skeleton--text"style=width:60px;height:14px></div></div><div class=data-table-scroll><table class=data-table><thead><tr><th>Date</th><th>Message</th><th>Cost</th><th>Total Tokens</th><th>Input</th><th>Output</th><th>Model</th><th>Cache</th><th>Duration</th><th>Status</th></tr></thead><tbody>'),we=g('<tr><td><div class="skeleton skeleton--text"style=width:90px></div></td><td><div class="skeleton skeleton--text"style=width:55px></div></td><td><div class="skeleton skeleton--text"style=width:40px></div></td><td><div class="skeleton skeleton--text"style=width:40px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:110px></div></td><td><div class="skeleton skeleton--text"style=width:90px></div></td><td><div class="skeleton skeleton--text"style=width:35px></div></td><td><div class="skeleton skeleton--text"style=width:50px>'),Ne=g('<div class=empty-state><div class=empty-state__title>No messages yet</div><p>Set up your agent and send a message. Every LLM call shows up here.</p><button class="btn btn--primary btn--sm"style=margin-top:var(--gap-md)>Set up agent</button><div class=empty-state__img-wrapper><img src=/example-messages.svg alt="Example message log showing LLM call history"class=empty-state__img loading=lazy>',!0,!1,!1);const Oe=()=>{const i=Y(),L=Z();he();const[x,y]=b(""),[v,k]=b(""),[h,N]=b(""),[I,C]=b(!1),[P]=b(!!localStorage.getItem(`setup_completed_${i.agentName}`)||ne()===!0),[E]=U(()=>i.agentName,e=>pe(decodeURIComponent(e))),[R]=U(()=>i.agentName,e=>ve(decodeURIComponent(e))),M=()=>R()?.enabled===!0,f=e=>{const s=e.match(/^custom:([^/]+)\//);if(!s)return;const _=s[1];return E()?.find(u=>u.id===_)?.name},o=_e(50);let S,$;ee(()=>{clearTimeout(S),clearTimeout($)});const q=e=>{clearTimeout(S),S=setTimeout(()=>k(e),400)},H=e=>{clearTimeout($),$=setTimeout(()=>N(e),400)};O(j([x,v,h],()=>o.resetPage(),{defer:!0}));const[l,{refetch:G}]=U(()=>({provider:x(),costMin:v(),costMax:h(),agentName:i.agentName,_ping:le(),cursor:o.currentCursor(),limit:o.pageSize}),e=>{const s={};return e.provider&&(s.provider=e.provider),e.costMin&&(s.cost_min=e.costMin),e.costMax&&(s.cost_max=e.costMax),e.agentName&&(s.agent_name=e.agentName),e.cursor&&(s.cursor=e.cursor),s.limit=String(e.limit),oe(s)});O(j(()=>l(),e=>{e&&o.recordResponse(e.next_cursor)}));const F=()=>x()!==""||v()!==""||h()!=="",T=()=>{const e=l();return e&&e.total_count===0},z=()=>T()&&!F()&&!M(),J=()=>T()&&F(),K=()=>!T()||M()&&!F(),Q=()=>{y(""),k(""),N("")},W=e=>fe.find(_=>_.id===e)?.name??e,X=e=>{const s=l()?.items;if(!s)return;const _=s.find(t=>t.fallback_from_model===e&&t.status==="ok");if(!_)return;const u=document.getElementById(`msg-${_.id}`);u&&(u.scrollIntoView({behavior:"smooth",block:"center"}),u.classList.add("msg-highlight"),setTimeout(()=>u.classList.remove("msg-highlight"),2e3))};return(()=>{var e=Me(),s=e.firstChild,_=s.firstChild,u=_.nextSibling;return d(e,a(te,{get children(){return[A(()=>V()??decodeURIComponent(i.agentName))," Messages - Manifest"]}}),s),d(e,a(se,{name:"description",get content(){return`Browse all messages sent and received by ${V()??decodeURIComponent(i.agentName)}. Filter by provider or cost.`}}),s),d(u,a(p,{get when(){return!z()},get children(){return[a(ce,{get value(){return x()},onChange:y,get options(){return[{label:"All providers",value:""},...(l()?.providers??[]).map(t=>({label:W(t),value:t}))]}}),(()=>{var t=be(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return r.$$input=m=>q(m.currentTarget.value),n.$$input=m=>H(m.currentTarget.value),B(()=>r.value=v()),B(()=>n.value=h()),t})()]}}),null),d(u,a(p,{get when(){return A(()=>!!z())()&&!P()},get children(){var t=xe();return t.$$click=()=>C(!0),t}}),null),d(e,a(p,{get when(){return l()!==void 0||!l.loading},get fallback(){return(()=>{var t=Se(),r=t.firstChild,c=r.nextSibling,n=c.firstChild,m=n.firstChild,w=m.nextSibling;return d(w,a(ae,{each:[1,2,3,4,5,6,7,8,9,10],children:()=>we()})),t})()},get children(){return a(p,{get when(){return!l.error},get fallback(){return a(ie,{get error(){return l.error},onRetry:G})},get children(){return[a(p,{get when(){return z()},get children(){return a(p,{get when(){return P()},get fallback(){return(()=>{var t=Ne(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return n.$$click=()=>C(!0),t})()},get children(){var t=ye(),r=t.firstChild,c=r.nextSibling,n=c.nextSibling;return n.$$click=()=>L(`/agents/${encodeURIComponent(i.agentName)}/routing`,{state:{openProviders:!0}}),t}})}}),a(p,{get when(){return J()},get children(){var t=$e(),r=t.firstChild,c=r.nextSibling,n=c.firstChild,m=n.nextSibling,w=m.nextSibling;return w.$$click=Q,t}}),a(p,{get when(){return K()},get children(){return[a(p,{get when(){return A(()=>!!T())()&&M()},get children(){return ke()}}),(()=>{var t=Ce(),r=t.firstChild,c=r.firstChild,n=c.nextSibling,m=n.firstChild,w=r.nextSibling;return d(n,()=>l()?.total_count??0,m),d(w,a(de,{get items(){return l()?.items??[]},columns:ge,get agentName(){return i.agentName},customProviderName:f,onFallbackErrorClick:X,rowIdPrefix:"msg-",showHeaderTooltips:!0,expandable:!0})),d(t,a(me,{get currentPage(){return o.currentPage},totalItems:()=>l()?.total_count??0,get pageSize(){return o.pageSize},get hasNextPage(){return o.hasNextPage},isLoading:()=>l.loading,get onPrevious(){return o.previousPage},get onNext(){return o.nextPage}}),null),t})()]}})]}})}}),null),d(e,a(ue,{get open(){return I()},get agentName(){return decodeURIComponent(i.agentName)},onClose:()=>C(!1)}),null),e})()};re(["input","click"]);export{Oe as default};