totem-llm 0.15.0 → 0.16.1

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 (53) hide show
  1. package/README.md +25 -20
  2. package/config/totem.features.json +12 -4
  3. package/lib/setup.js +1 -0
  4. package/package.json +1 -1
  5. package/server/endpoints/agentSkillWhitelist.js +20 -0
  6. package/server/endpoints/api/document/index.js +0 -1
  7. package/server/endpoints/chat.js +0 -1
  8. package/server/endpoints/importChatgpt.js +79 -0
  9. package/server/endpoints/system.js +0 -1
  10. package/server/endpoints/workspaces.js +2 -2
  11. package/server/index.js +13 -1
  12. package/server/jobs/run-scheduled-job.js +7 -8
  13. package/server/models/scheduledJobRun.js +4 -1
  14. package/server/models/workspace.js +1 -2
  15. package/server/prisma/migrations/20260825181511_add_import_fields/migration.sql +5 -0
  16. package/server/prisma/schema.prisma +2 -0
  17. package/server/public/assets/{RunDetailPage-a2d786d5.js → RunDetailPage-282e5140.js} +1 -1
  18. package/server/public/assets/{RunHistoryPage-d46098a8.js → RunHistoryPage-32309c95.js} +1 -1
  19. package/server/public/assets/{files-0c641c94.js → files-0f5d16df.js} +1 -1
  20. package/server/public/assets/{index-b7caf9b8.js → index-39a54837.js} +1 -1
  21. package/server/public/assets/{index-3e308802.js → index-7557b588.js} +1 -1
  22. package/server/public/assets/index-7ca9b2d0.js +1 -0
  23. package/server/public/assets/{index-a00872c9.js → index-86082861.js} +1 -1
  24. package/server/public/assets/{index-5ad34c88.js → index-9567f4f5.js} +1 -1
  25. package/server/public/assets/{index-648278d2.js → index-996a50bd.js} +1 -1
  26. package/server/public/assets/{index-05fbc3ea.js → index-bc7d0c7c.js} +46 -46
  27. package/server/public/assets/index-c736791c.js +3 -0
  28. package/server/public/assets/{index-6cf3d056.js → index-c88f6b8d.js} +1 -1
  29. package/server/public/assets/{index-01eeb514.js → index-d7fdaf86.js} +1 -1
  30. package/server/public/assets/mcpServers-4f9690f1.js +1 -0
  31. package/server/public/assets/{purify-7f82b96b.js → purify-ca43d85f.js} +1 -1
  32. package/server/public/index.css +1 -1
  33. package/server/public/index.js +55 -55
  34. package/server/utils/AiProviders/ollama/index.js +2 -1
  35. package/server/utils/agentFlows/executor.js +0 -1
  36. package/server/utils/agents/aibitat/index.js +24 -0
  37. package/server/utils/agents/aibitat/plugins/create-files/pdf/create-pdf-file.js +2 -3
  38. package/server/utils/agents/aibitat/plugins/filesystem/lib.js +3 -1
  39. package/server/utils/agents/aibitat/plugins/http-socket.js +1 -1
  40. package/server/utils/agents/aibitat/plugins/index.js +3 -0
  41. package/server/utils/agents/aibitat/plugins/terminal-access.js +488 -0
  42. package/server/utils/agents/defaults.js +10 -3
  43. package/server/utils/boot/MetaGenerator.js +12 -14
  44. package/server/utils/chatgptImport/index.js +216 -0
  45. package/server/utils/chatgptImport/parser.js +171 -0
  46. package/server/utils/chatgptImport/validator.js +133 -0
  47. package/server/utils/chats/agents.js +0 -2
  48. package/server/utils/chats/apiChatHandler.js +0 -2
  49. package/server/utils/helpers/updateENV.js +6 -2
  50. package/server/utils/telegramBot/chat/agent.js +1 -4
  51. package/server/utils/telegramBot/index.js +7 -3
  52. package/server/public/assets/index-88aa26af.js +0 -3
  53. package/server/public/assets/mcpServers-560f2092.js +0 -1
package/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
  |---------|-------------|
27
27
  | **Privacy First** | All data stays on your machine. |
28
28
  | **Consumer Hardware** | Optimized for consumer-grade devices. |
29
- | **Local & Cloud** | Choose local models via Ollama or use cloud providers (OpenRouter). |
29
+ | **Local & Cloud** | Bring your own LLM provider — local runtimes or cloud APIs. |
30
30
  | **Easy Setup** | One-line install with automatic dependency resolution. |
31
31
 
32
32
  ---
@@ -39,11 +39,11 @@ While local AI is the core focus, Totem LLM supports both local and cloud-based
39
39
 
40
40
  ## ⚙️ Requirements
41
41
 
42
- Before installing Totem LLM, first install the below prerequisites:
42
+ Before installing Totem LLM, you only need:
43
43
 
44
44
  - **[Node.js](https://nodejs.org/)** v18 or later
45
- - **[Ollama](https://ollama.com/)** (recommended for local models) *OR*
46
- - **[OpenRouter](https://openrouter.ai/)** API key (for cloud models)
45
+
46
+ You'll also want an LLM provider to talk to — see [LLM Providers](#-llm-providers) below. Local runtimes like Ollama are free and keep everything on your machine; cloud providers only require an API key. You can configure a provider after first launch from the settings UI if you prefer not to set one up beforehand.
47
47
 
48
48
  ---
49
49
 
@@ -65,32 +65,35 @@ This automatically downloads Totem LLM and installs all dependencies (server, co
65
65
  totem-llm start
66
66
  ```
67
67
 
68
- **First run:** Creates `~/totem-llm/` directory, migrates database, then launches services.
68
+ **First run:** Creates `~/totem-llm/` directory, generates secure configuration, migrates database, then launches services.
69
69
 
70
70
  **Access:** Open [http://localhost:8686](http://localhost:8686) in your browser.
71
71
 
72
- ### 3️⃣ Optional: Install as Desktop App
72
+ ### 3️⃣ Connect an LLM Provider
73
73
 
74
- In the browser UI, click the **install icon** in the address bar (or use your browser menu) to add Totem LLM to your desktop. This is a link to the web GUI, but with its own window and taskbar/dock icon for easy access.
74
+ Once the app is running, select a provider from **Settings → LLM Providers**. Supported providers include local runtimes (Ollama, LM Studio) and cloud APIs (OpenRouter, OpenAI, Anthropic), as well as any endpoint that speaks the generic OpenAI format. See [LLM Providers](#-llm-providers).
75
75
 
76
- ## Model Selection
76
+ ### 4️⃣ Optional: Install as Desktop App
77
77
 
78
- Once first installed, we recommend using qwen3.5:2b as a base model. This is a small model that is excellent to start with. It can help answer questions and provide guidance on if you can use a bigger model.
78
+ In the browser UI, click the **install icon** in the address bar (or use your browser menu) to add Totem LLM to your desktop. This is a link to the web GUI, but with its own window and taskbar/dock icon for easy access.
79
79
 
80
- If qwen3.5:2b does not work well on your machine, it is recommened to move to OpenRouter. While a smaller model will work, there is a performance drop off.
80
+ ---
81
81
 
82
- ### Windows and Linux Model Download:
82
+ ## 🧠 LLM Providers
83
83
 
84
- ```
85
- ollama pull qwen3.5:2b
86
- ```
84
+ Totem LLM works with a range of local and cloud LLM providers, configurable from the settings UI:
87
85
 
88
- ### Mac Model Download:
89
- ```
90
- ollama pull qwen3.5:2b-mlx
91
- ```
86
+ | Provider | Type | Notes |
87
+ |----------|------|-------|
88
+ | **[Ollama](https://ollama.com/)** | Local | Run open-weight models on your own machine. Pull any model you like (e.g., `ollama pull llama3.2`). |
89
+ | **[LM Studio](https://lmstudio.ai/)** | Local | GUI for running local models; exposes an OpenAI-compatible server that Totem connects to. |
90
+ | **[OpenRouter](https://openrouter.ai/)** | Cloud | Single API key for access to hundreds of hosted models. |
91
+ | **[OpenAI](https://platform.openai.com/)** | Cloud | GPT-4o, o-series, and other OpenAI models via your own API key. |
92
+ | **[Anthropic](https://www.anthropic.com/)** | Cloud | Claude models via your own API key. |
93
+ | **Generic OpenAI format** | Any | Point at any endpoint that implements the OpenAI chat completions API — self-hosted gateways, proxies, or other providers. |
94
+
95
+ More providers are available in the settings UI if you need them. Local options keep all processing (and your data) on your machine; cloud options trade privacy for access to larger models.
92
96
 
93
- > Note: The `-mlx` suffix indicates the version optimized for Apple Silicon (M1/M2) Macs. If you are on an Intel-based Mac, use the standard `qwen3.5:2b` model.
94
97
  ---
95
98
 
96
99
  ## 📚 Command Reference
@@ -100,6 +103,7 @@ totem-llm start # Start server and collector
100
103
  totem-llm --no-collector # Start server only (skip document ingestion)
101
104
  totem-llm --port=8080 # Use custom server port
102
105
  totem-llm setup # Run first-time setup without starting
106
+ totem-llm --version # Print version and exit
103
107
  totem-llm --help # Show all available commands
104
108
  ```
105
109
 
@@ -111,6 +115,8 @@ export TOTEM_STORAGE_DIR=/your/custom/path
111
115
  totem-llm start
112
116
  ```
113
117
 
118
+ All configuration (secrets, ports, settings) is stored in `~/totem-llm/.env` and can be edited there.
119
+
114
120
  ---
115
121
 
116
122
  ## 🛠️ Troubleshooting
@@ -139,4 +145,3 @@ Totem LLM is released under the **MIT License** — see [LICENSE](LICENSE) for d
139
145
  - 💬 **Discussions** → [GitHub Discussions](https://github.com/fred-terzi/totem-llm/discussions)
140
146
 
141
147
  ---
142
-
@@ -83,6 +83,10 @@
83
83
  "mcpServers": {
84
84
  "label": "MCP Servers",
85
85
  "tier": "L2"
86
+ },
87
+ "terminalAccess": {
88
+ "label": "Terminal Access",
89
+ "tier": "L2"
86
90
  }
87
91
  },
88
92
  "PROFILES": {
@@ -107,7 +111,8 @@
107
111
  "transcription": true,
108
112
  "appIntegrations": false,
109
113
  "agentFlows": false,
110
- "mcpServers": true
114
+ "mcpServers": true,
115
+ "terminalAccess": false
111
116
  },
112
117
  "L1": {
113
118
  "communityHub": false,
@@ -130,7 +135,8 @@
130
135
  "transcription": false,
131
136
  "appIntegrations": false,
132
137
  "agentFlows": false,
133
- "mcpServers": true
138
+ "mcpServers": true,
139
+ "terminalAccess": false
134
140
  },
135
141
  "L2": {
136
142
  "communityHub": false,
@@ -153,7 +159,8 @@
153
159
  "transcription": false,
154
160
  "appIntegrations": false,
155
161
  "agentFlows": false,
156
- "mcpServers": true
162
+ "mcpServers": true,
163
+ "terminalAccess": false
157
164
  },
158
165
  "source": {
159
166
  "communityHub": true,
@@ -176,7 +183,8 @@
176
183
  "transcription": false,
177
184
  "appIntegrations": false,
178
185
  "agentFlows": false,
179
- "mcpServers": true
186
+ "mcpServers": true,
187
+ "terminalAccess": true
180
188
  }
181
189
  }
182
190
  }
package/lib/setup.js CHANGED
@@ -15,6 +15,7 @@ const STORAGE_SUBDIRS = [
15
15
  "generated-files",
16
16
  "comkey",
17
17
  "tmp",
18
+ "chatgpt-import",
18
19
  ];
19
20
 
20
21
  function generateSecret(bytes = 32) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "totem-llm",
3
- "version": "0.15.0",
3
+ "version": "0.16.1",
4
4
  "description": "Totem LLM – Your Private AI. Run a self-hosted AI assistant locally on Linux, macOS, or Windows.",
5
5
  "main": "bin/totem-llm.js",
6
6
  "type": "module",
@@ -45,6 +45,26 @@ function agentSkillWhitelistEndpoints(app) {
45
45
  }
46
46
  );
47
47
 
48
+ app.get(
49
+ "/agent-skills/terminal-access/is-available",
50
+ [validatedRequest],
51
+ async (_request, response) => {
52
+ try {
53
+ const {
54
+ terminalManager,
55
+ } = require("../utils/agents/aibitat/plugins/terminal-access");
56
+ return response
57
+ .status(200)
58
+ .json({ available: terminalManager.isToolAvailable() });
59
+ } catch (e) {
60
+ console.error(e);
61
+ return response
62
+ .status(500)
63
+ .json({ available: false, error: e.message });
64
+ }
65
+ }
66
+ );
67
+
48
68
  app.post(
49
69
  "/agent-skills/whitelist/add",
50
70
  [validatedRequest, flexUserRoleValid(ROLES.all)],
@@ -1195,7 +1195,6 @@ function apiDocumentEndpoints(app) {
1195
1195
  );
1196
1196
  response.setHeader("Content-Length", fileData.buffer.length);
1197
1197
  response.send(fileData.buffer);
1198
-
1199
1198
  } catch (error) {
1200
1199
  console.error(
1201
1200
  "[document/generated-files] Download error:",
@@ -163,7 +163,6 @@ function chatEndpoints(app) {
163
163
  },
164
164
  });
165
165
 
166
-
167
166
  await EventLogs.logEvent(
168
167
  "sent_chat",
169
168
  {
@@ -0,0 +1,79 @@
1
+ const { validatedRequest } = require("../utils/middleware/validatedRequest");
2
+ const {
3
+ flexUserRoleValid,
4
+ ROLES,
5
+ } = require("../utils/middleware/multiUserProtected");
6
+ const { userFromSession, reqBody } = require("../utils/http");
7
+ const {
8
+ importChatgptExport,
9
+ getImportPreview,
10
+ } = require("../utils/chatgptImport");
11
+ const path = require("path");
12
+
13
+ function defaultImportDir() {
14
+ return path.join(
15
+ process.env.STORAGE_DIR || path.join(require("os").homedir(), "totem-llm"),
16
+ "chatgpt-import"
17
+ );
18
+ }
19
+
20
+ function importChatgptEndpoints(app) {
21
+ if (!app) return;
22
+
23
+ /**
24
+ * GET /api/import/chatgpt/preview
25
+ * Returns metadata about the export at the given directory path.
26
+ */
27
+ app.get(
28
+ "/import/chatgpt/preview",
29
+ [validatedRequest, flexUserRoleValid([ROLES.all])],
30
+ async (request, response) => {
31
+ try {
32
+ const dirPath = request.query.dirPath || defaultImportDir();
33
+
34
+ const result = await getImportPreview(dirPath);
35
+ if (!result.success) {
36
+ return response
37
+ .status(400)
38
+ .json({ ...result, dir: defaultImportDir() });
39
+ }
40
+
41
+ response.status(200).json({ ...result, dir: defaultImportDir() });
42
+ } catch (e) {
43
+ console.error(e.message, e);
44
+ response.sendStatus(500).end();
45
+ }
46
+ }
47
+ );
48
+
49
+ /**
50
+ * POST /api/import/chatgpt
51
+ * Imports a ChatGPT export from the given directory path.
52
+ * Body: { dirPath: string, workspaceName?: string }
53
+ */
54
+ app.post(
55
+ "/import/chatgpt",
56
+ [validatedRequest, flexUserRoleValid([ROLES.all])],
57
+ async (request, response) => {
58
+ try {
59
+ const user = await userFromSession(request, response);
60
+ const body = reqBody(request);
61
+
62
+ const dirPath = body.dirPath || defaultImportDir();
63
+
64
+ const result = await importChatgptExport(dirPath, user?.id || null);
65
+
66
+ if (!result.success) {
67
+ return response.status(400).json(result);
68
+ }
69
+
70
+ response.status(200).json({ success: true, summary: result.summary });
71
+ } catch (e) {
72
+ console.error(e.message, e);
73
+ response.sendStatus(500).end();
74
+ }
75
+ }
76
+ );
77
+ }
78
+
79
+ module.exports = { importChatgptEndpoints };
@@ -254,7 +254,6 @@ function systemEndpoints(app) {
254
254
  return;
255
255
  }
256
256
 
257
-
258
257
  await EventLogs.logEvent(
259
258
  "login_event",
260
259
  {
@@ -799,12 +799,12 @@ function workspaceEndpoints(app) {
799
799
  // Get threadId we are branching from if that request body is sent
800
800
  // and is a valid thread slug.
801
801
  const threadId = !!threadSlug
802
- ? (
802
+ ? ((
803
803
  await WorkspaceThread.get({
804
804
  slug: String(threadSlug),
805
805
  workspace_id: workspace.id,
806
806
  })
807
- )?.id ?? null
807
+ )?.id ?? null)
808
808
  : null;
809
809
  const chatsToFork = await WorkspaceChats.where(
810
810
  {
package/server/index.js CHANGED
@@ -9,7 +9,17 @@ if (!process.env.STORAGE_DIR) {
9
9
  process.env.STORAGE_DIR = path.join(os.homedir(), "totem-llm");
10
10
  }
11
11
  // Ensure all required storage subdirectories exist
12
- for (const sub of ["documents", "vector-cache", "models", "direct-uploads", "generated-files", "comkey", "tmp", "assets"]) {
12
+ for (const sub of [
13
+ "documents",
14
+ "vector-cache",
15
+ "models",
16
+ "direct-uploads",
17
+ "generated-files",
18
+ "comkey",
19
+ "tmp",
20
+ "assets",
21
+ "chatgpt-import",
22
+ ]) {
13
23
  mkdirSync(path.join(process.env.STORAGE_DIR, sub), { recursive: true });
14
24
  }
15
25
 
@@ -55,6 +65,7 @@ const {
55
65
  } = require("./endpoints/utils/googleAgentSkillEndpoints");
56
66
  const { memoryEndpoints } = require("./endpoints/memory");
57
67
  const { featureEndpoints } = require("./endpoints/features");
68
+ const { importChatgptEndpoints } = require("./endpoints/importChatgpt");
58
69
  const { httpLogger } = require("./middleware/httpLogger");
59
70
  const app = express();
60
71
  const apiRouter = express.Router();
@@ -115,6 +126,7 @@ outlookAgentEndpoints(apiRouter);
115
126
  googleAgentSkillEndpoints(apiRouter);
116
127
  memoryEndpoints(apiRouter);
117
128
  featureEndpoints(apiRouter);
129
+ importChatgptEndpoints(apiRouter);
118
130
  // Externally facing embedder endpoints
119
131
  embeddedEndpoints(apiRouter);
120
132
 
@@ -8,9 +8,7 @@ const {
8
8
  } = require("./helpers/scheduled-job-helper.js");
9
9
  const { ScheduledJob } = require("../models/scheduledJob.js");
10
10
  const { ScheduledJobRun } = require("../models/scheduledJobRun.js");
11
- const {
12
- SystemPromptVariables,
13
- } = require("../models/systemPromptVariables.js");
11
+ const { SystemPromptVariables } = require("../models/systemPromptVariables.js");
14
12
 
15
13
  /** Status of the scheduled job run @type {'success' | 'failed' | 'timed_out' | 'not_found' | 'killed' | undefined} */
16
14
  let status;
@@ -63,11 +61,12 @@ process.on("message", async (payload) => {
63
61
 
64
62
  const { EphemeralAgentHandler } = require("../utils/agents/ephemeral.js");
65
63
  // Expand system prompt variables in the job prompt (same as workspace system prompts)
66
- const expandedPrompt = await SystemPromptVariables.expandSystemPromptVariables(
67
- job.prompt,
68
- null,
69
- null
70
- );
64
+ const expandedPrompt =
65
+ await SystemPromptVariables.expandSystemPromptVariables(
66
+ job.prompt,
67
+ null,
68
+ null
69
+ );
71
70
  const agentHandler = await new EphemeralAgentHandler({
72
71
  uuid: uuidv4(),
73
72
  prompt: expandedPrompt,
@@ -301,7 +301,10 @@ const ScheduledJobRun = {
301
301
  },
302
302
  });
303
303
  } catch (error) {
304
- console.error("Failed to count unread scheduled job runs:", error.message);
304
+ console.error(
305
+ "Failed to count unread scheduled job runs:",
306
+ error.message
307
+ );
305
308
  return 0;
306
309
  }
307
310
  },
@@ -95,8 +95,7 @@ const Workspace = {
95
95
  return n;
96
96
  },
97
97
  chatMode: (value) => {
98
- if (!value || !Workspace.VALID_CHAT_MODES.includes(value))
99
- return "chat";
98
+ if (!value || !Workspace.VALID_CHAT_MODES.includes(value)) return "chat";
100
99
  return value;
101
100
  },
102
101
  chatProvider: (value) => {
@@ -0,0 +1,5 @@
1
+ -- AlterTable
2
+ ALTER TABLE "workspace_threads" ADD COLUMN "externalId" TEXT;
3
+
4
+ -- AlterTable
5
+ ALTER TABLE "workspaces" ADD COLUMN "importedFrom" TEXT;
@@ -119,6 +119,7 @@ model workspaces {
119
119
  name String
120
120
  slug String @unique
121
121
  vectorTag String?
122
+ importedFrom String? // Provenance marker: "chatgpt" | null
122
123
  createdAt DateTime @default(now())
123
124
  openAiTemp Float?
124
125
  openAiHistory Int @default(20)
@@ -151,6 +152,7 @@ model workspace_threads {
151
152
  id Int @id @default(autoincrement())
152
153
  name String
153
154
  slug String @unique
155
+ externalId String? // Original ID from import source (e.g. ChatGPT conversation_id) for dedup
154
156
  workspace_id Int
155
157
  user_id Int?
156
158
  createdAt DateTime @default(now())
@@ -1 +1 @@
1
- import{r as o,j as t,ae as G,aH as $,aP as X,X as C,u as y,aN as I,s as q,a8 as K,a7 as U,bL as B,cb as V,c as j,l as W,b as Y,Z as f,p as T,a3 as Z,i as Q,b0 as ee,bH as te,aw as D}from"../index.js";import{I as se}from"./Brain-24e386d5.js";import{w as le}from"./ChatText-35275002.js";import{I as ne}from"./File-b92df2f3.js";import{R as ae}from"./Stop-4b47ae05.js";import{u as re}from"./usePolling-3b229af5.js";import{c as ie,S as oe,T as J,a as de,b as ce,r as _}from"./files-0c641c94.js";import{C as ue}from"./Copy-d323e545.js";import{H as xe,D as S}from"./purify-7f82b96b.js";import{t as L}from"./truncate-24ce7b97.js";import{h as E}from"./moment-49fc1b76.js";/* empty css */function w({title:e,icon:s,children:l,defaultOpen:n=!1,copyableContent:a=null}){const[i,r]=o.useState(n);return t.jsxs("div",{className:"border border-zinc-700 light:border-slate-400 rounded-lg overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("button",{type:"button",onClick:()=>r(!i),className:"border-none flex-1 h-12 flex items-center gap-2 px-[18px] hover:bg-white/5 light:hover:bg-slate-100 transition-colors text-left",children:[i?t.jsx(G,{className:"h-4 w-4 text-zinc-50 light:text-slate-950"}):t.jsx($,{className:"h-4 w-4 text-zinc-50 light:text-slate-950"}),t.jsx(s,{className:"h-4 w-4 text-zinc-50 light:text-slate-950"}),t.jsx("span",{className:"text-sm font-medium text-zinc-50 light:text-slate-950",children:e})]}),a&&t.jsx(he,{content:a})]}),i&&t.jsx("div",{className:"px-[18px] py-3 border-t border-zinc-700 light:border-slate-400",children:l})]})}function he({content:e}){const[s,l]=o.useState(!1),n=async()=>{await ie(e),l(!0),setTimeout(()=>l(!1),2e3)};return t.jsx("button",{type:"button",onClick:n,disabled:s,className:"h-12 px-4 flex items-center hover:bg-white/5 light:hover:bg-slate-100 transition-colors",children:s?t.jsx(X,{size:20,className:"text-green-500"}):t.jsx(ue,{size:20,className:"text-zinc-50 light:text-slate-950"})})}const F=5e3;function H(e){return e?"github":"github-dark"}function P(e){const s=typeof e=="string"?q(e,e):e;if(typeof s!="object"||s===null)return null;const l=JSON.stringify(s,null,2),n=L(l,F),a=xe.highlight(n,{language:"json"}).value;return{__html:S.sanitize(a)}}function me({toolCall:e}){const[s,l]=o.useState(!1);return t.jsxs("div",{className:"border border-white/5 rounded-lg p-3 bg-theme-bg-primary/30",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(C,{className:"h-3.5 w-3.5 text-blue-400"}),t.jsx("span",{className:"text-sm font-medium text-theme-text-primary",children:e.toolName})]}),t.jsx(ge,{toolCall:e})]}),t.jsx(pe,{toolCall:e}),t.jsx(be,{toolCall:e,showResult:s,setShowResult:l})]})}function ge({toolCall:e}){return e.timestamp?t.jsx("span",{className:"text-xs text-theme-text-secondary",children:E(e.timestamp).format("LTS")}):null}function pe({toolCall:e}){const{t:s}=y(),{isLight:l}=I();if(!e.arguments)return null;const n=P(e.arguments);return t.jsxs("div",{className:"mb-2",children:[t.jsx("span",{className:"text-xs text-theme-text-secondary",children:s("scheduledJobs.toolCall.arguments")}),n?t.jsx("pre",{className:`text-xs rounded-lg p-2 mt-1 overflow-x-auto white-scrollbar tool-call-scrollbar hljs ${H(l)}`,dangerouslySetInnerHTML:n}):t.jsx("pre",{className:"text-xs text-theme-text-primary bg-theme-bg-primary/50 rounded p-2 mt-1 overflow-x-auto white-scrollbar tool-call-scrollbar",children:typeof e.arguments=="string"?e.arguments:JSON.stringify(e.arguments,null,2)})]})}function be({toolCall:e,showResult:s,setShowResult:l}){const{t:n}=y(),{isLight:a}=I();if(!e.result)return null;const i=typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2),r=L(i,F),d=P(i);return i?t.jsxs("div",{children:[t.jsx("button",{type:"button",onClick:()=>l(!s),className:"border-none text-xs text-blue-400 hover:text-blue-300 transition-colors",children:n(s?"scheduledJobs.toolCall.hideResult":"scheduledJobs.toolCall.showResult")}),s&&(d?t.jsx("pre",{className:`text-xs rounded-lg p-2 mt-1 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap white-scrollbar tool-call-scrollbar hljs ${H(a)}`,dangerouslySetInnerHTML:d}):t.jsx("pre",{className:"text-xs text-theme-text-primary bg-theme-bg-primary/50 rounded p-2 mt-1 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap white-scrollbar tool-call-scrollbar",children:r}))]}):null}const R={pptx:{badge:"PPT",bg:"bg-orange-100",text:"text-orange-800",label:e=>e("scheduledJobs.file.types.powerpoint")},ppt:{badge:"PPT",bg:"bg-orange-100",text:"text-orange-800",label:e=>e("scheduledJobs.file.types.powerpoint")},pdf:{badge:"PDF",bg:"bg-red-100",text:"text-red-800",label:e=>e("scheduledJobs.file.types.pdf")},doc:{badge:"DOC",bg:"bg-blue-100",text:"text-blue-800",label:e=>e("scheduledJobs.file.types.word")},docx:{badge:"DOC",bg:"bg-blue-100",text:"text-blue-800",label:e=>e("scheduledJobs.file.types.word")},xls:{badge:"XLS",bg:"bg-green-100",text:"text-green-800",label:e=>e("scheduledJobs.file.types.spreadsheet")},xlsx:{badge:"XLS",bg:"bg-green-100",text:"text-green-800",label:e=>e("scheduledJobs.file.types.spreadsheet")},csv:{badge:"CSV",bg:"bg-green-100",text:"text-green-800",label:e=>e("scheduledJobs.file.types.spreadsheet")},default:{badge:"FILE",bg:"bg-zinc-200",text:"text-zinc-800",label:e=>e("scheduledJobs.file.types.generic")}};function fe(e,s){var a,i;const l=((i=(a=e==null?void 0:e.split("."))==null?void 0:a.pop())==null?void 0:i.toLowerCase())??"txt",n=R[l]||R.default;return{...n,type:n.label(s)}}function je({file:e}){const{t:s}=y(),[l,n]=o.useState(!1),{badge:a,bg:i,text:r,type:d}=fe(e.filename,s),u=async()=>{if(!(l||!e.storageFilename)){n(!0);try{const h=await oe.download(e.storageFilename);if(!h)throw new Error("Failed to download file");const{saveAs:m}=await V(()=>import("../index.js").then(g=>g.F),["index.js","index.css"]);m(h,e.filename||e.storageFilename)}catch{j(s("scheduledJobs.file.downloadFailed"),"error")}finally{n(!1)}}};return t.jsxs("div",{className:"flex items-center justify-between bg-zinc-800 light:bg-slate-100 rounded-lg p-3",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("div",{className:`${i} ${r} rounded-lg flex items-center justify-center shrink-0 h-10 w-10 text-xs font-semibold`,children:a}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("p",{className:"text-sm text-white light:text-slate-950 truncate",children:e.filename||s("scheduledJobs.file.unknown")}),t.jsxs("p",{className:"text-sm text-zinc-400 light:text-slate-600",children:[K(e.fileSize,!0,1),e.fileSize&&d?" · ":"",d]})]})]}),t.jsx("button",{type:"button",onClick:u,disabled:l,title:s("scheduledJobs.file.download"),"aria-label":s("scheduledJobs.file.download"),className:"border-none text-zinc-400 light:text-slate-600 hover:text-zinc-50 light:hover:text-slate-950 transition-colors shrink-0 ml-4 disabled:opacity-50",children:l?t.jsx(U,{size:16,weight:"bold",className:"animate-spin"}):t.jsx(B,{size:16,weight:"bold"})})]})}function Me(){const{t:e}=y(),{id:s,runId:l}=W(),n=Y(),[a,i]=o.useState(!0),[r,d]=o.useState(null),[u,h]=o.useState(null),[m,g]=o.useState(!1),[N,p]=o.useState(!1);o.useEffect(()=>{v()},[l]);const v=async()=>{const c=await f.getRun(l);d(c.run),h(c.job),i(!1),c.run&&!c.run.readAt&&f.markRunRead(l)},O=(r==null?void 0:r.status)==="running"||(r==null?void 0:r.status)==="queued";re(v,3e3,O);const M=async()=>{g(!0);const{workspaceSlug:c,threadSlug:b,error:k}=await f.continueInThread(l);if(k||!c||!b){j(k||e("scheduledJobs.runDetail.threadFailed"),"error"),g(!1);return}n(T.workspace.thread(c,b))},A=async()=>{p(!0);const{success:c,error:b}=await f.killRun(l);if(p(!1),!c){j(b||e("scheduledJobs.toast.killFailed"),"error");return}j(e("scheduledJobs.toast.killed"),"success"),v()};if(a)return t.jsx(z,{children:t.jsx("p",{className:"text-zinc-400 light:text-slate-600 text-sm",children:e("scheduledJobs.runDetail.loading")})});if(!r)return t.jsx(z,{children:t.jsx("p",{className:"text-zinc-400 light:text-slate-600 text-sm",children:e("scheduledJobs.runDetail.notFound")})});const x=r.result||{};return t.jsxs(z,{children:[t.jsx(ye,{t:e,job:u,run:r,result:x,continuing:m,killing:N,onBack:()=>n(T.settings.scheduledJobRuns(s)),onContinueInThread:M,onKillRun:A}),t.jsxs("div",{className:"mt-6 space-y-4",children:[t.jsx(we,{t:e,prompt:u==null?void 0:u.prompt}),t.jsx(Ne,{t:e,error:r==null?void 0:r.error}),t.jsx(ve,{t:e,result:x}),t.jsx(Je,{t:e,result:x}),t.jsx(ze,{t:e,result:x}),t.jsx(Se,{t:e,result:x}),t.jsx(ke,{t:e,metrics:x==null?void 0:x.metrics})]})]})}function z({children:e}){return t.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[t.jsx(Z,{}),t.jsx("div",{style:{height:Q?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:t.jsx("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:e})})]})}function ye({t:e,job:s,run:l,result:n,continuing:a,killing:i,onBack:r,onContinueInThread:d,onKillRun:u}){function h(){return{completed:{text:e("scheduledJobs.status.completed"),style:"text-green-400 light:text-green-600"},failed:{text:e("scheduledJobs.status.failed"),style:"text-red-400 light:text-red-600"},timed_out:{text:e("scheduledJobs.status.timed_out"),style:"text-orange-400 light:text-orange-600"},running:{text:e("scheduledJobs.status.running"),style:"text-yellow-400 light:text-yellow-600"},queued:{text:e("scheduledJobs.status.queued"),style:"text-blue-400 light:text-blue-600"},default:{text:"—",style:"text-zinc-400 light:text-slate-600"}}}const m=h(),{text:g,style:N}=m[l.status]||m.default,p=["running","queued"].includes(l.status);return t.jsxs("div",{className:"w-full flex items-end justify-between gap-x-4 pb-6 border-white/10 light:border-zinc-300 border-b-2",children:[t.jsxs("div",{className:"flex flex-col gap-y-2",children:[t.jsxs("button",{type:"button",onClick:r,className:"border-none flex items-center gap-2 text-zinc-400 light:text-slate-600 hover:text-zinc-50 light:hover:text-slate-950 text-sm transition-colors w-fit",children:[t.jsx(ee,{className:"h-4 w-4"}),e("scheduledJobs.runDetail.back")]}),t.jsx("p",{className:"text-lg leading-7 font-semibold text-zinc-50 light:text-slate-950",children:e("scheduledJobs.runDetail.runHeading",{name:(s==null?void 0:s.name)||e("scheduledJobs.runDetail.unknownJob"),id:l.id})}),t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{className:N,children:g}),t.jsx("span",{className:"text-zinc-400 light:text-slate-600",children:E(l.startedAt).format("LTS")}),n.duration&&t.jsx("span",{className:"text-zinc-400 light:text-slate-600",children:e("scheduledJobs.runDetail.duration",{value:te(n.duration/1e3)})})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[p&&t.jsxs("button",{type:"button",onClick:u,disabled:i,title:e("scheduledJobs.runDetail.stopJob"),className:"border-none h-9 px-5 rounded-lg bg-red-500/20 text-red-400 light:bg-red-100 light:text-red-600 text-sm font-medium hover:bg-red-500/30 light:hover:bg-red-200 transition-colors disabled:opacity-50 shrink-0 flex items-center gap-2",children:[t.jsx(ae,{className:"h-4 w-4",weight:"bold"}),e(i?"scheduledJobs.runDetail.killing":"scheduledJobs.runDetail.stopJob")]}),l.status==="completed"&&t.jsx("button",{type:"button",onClick:d,disabled:a,className:"border-none h-9 px-5 rounded-lg bg-zinc-50 text-zinc-950 light:bg-slate-900 light:text-white text-sm font-medium hover:bg-zinc-200 light:hover:bg-slate-800 transition-colors disabled:opacity-50 shrink-0",children:e(a?"scheduledJobs.runDetail.creating":"scheduledJobs.runDetail.continueInThread")})]})]})}function we({t:e,prompt:s}){return t.jsxs("div",{className:"border border-zinc-700 light:border-slate-400 rounded-lg p-[18px]",children:[t.jsx("p",{className:"text-sm font-medium text-white light:text-slate-950 uppercase tracking-[1.4px] mb-1",children:e("scheduledJobs.runDetail.sections.prompt")}),t.jsx("p",{className:"text-sm text-zinc-400 light:text-slate-600 whitespace-pre-wrap",children:s||"—"})]})}function Ne({t:e,error:s}){return s?t.jsxs("div",{className:"border border-red-500/20 light:border-red-300 rounded-lg p-[18px] bg-red-500/5 light:bg-red-50",children:[t.jsx("p",{className:"text-sm font-medium text-red-400 light:text-red-600 uppercase tracking-[1.4px] mb-1",children:e("scheduledJobs.runDetail.sections.error")}),t.jsx("p",{className:"text-sm text-red-300 light:text-red-700",children:s})]}):null}function ve({t:e,result:s}){return!s.thoughts||s.thoughts.length===0?null:t.jsx(w,{title:e("scheduledJobs.runDetail.sections.thinking",{count:s.thoughts.length}),icon:se,children:t.jsx("div",{className:"space-y-2",children:s.thoughts.map((l,n)=>t.jsxs("div",{className:"flex items-start gap-2 text-sm text-theme-text-secondary",children:[t.jsxs("span",{className:"text-xs text-theme-text-secondary/50 mt-0.5 min-w-[20px]",children:[n+1,"."]}),t.jsx("span",{children:l})]},n))})})}function Je({t:e,result:s}){return!s.toolCalls||s.toolCalls.length===0?null:t.jsx(w,{title:e("scheduledJobs.runDetail.sections.toolCalls",{count:s.toolCalls.length}),icon:C,children:t.jsx("div",{className:"space-y-3",children:s.toolCalls.map((l,n)=>t.jsx(me,{toolCall:l},n))})})}function ze({t:e,result:s}){const l=s.outputs||[];return l.length===0?null:t.jsx(w,{title:e("scheduledJobs.runDetail.sections.files",{count:l.length}),icon:ne,defaultOpen:!0,children:t.jsx("div",{className:"space-y-2",children:l.map((n,a)=>t.jsx(je,{file:n.payload,type:n.type},a))})})}function Se({t:e,result:s}){var a;if(!s.text)return null;let l=null,n=s.text;return s.text.match(J)&&(l=(a=s.text.match(J))==null?void 0:a[0],l&&(l=l.replace(de,"").replace(ce,"").trim()),n=s.text.replace(J,"")),t.jsxs(w,{title:e("scheduledJobs.runDetail.sections.response"),icon:le,defaultOpen:!0,copyableContent:n,children:[l&&t.jsx("div",{className:"text-sm text-zinc-50/50 light:text-slate-950/50 markdown border-l-2 border-zinc-700 light:border-slate-400 pl-2 mb-4",children:t.jsx("span",{dangerouslySetInnerHTML:{__html:S.sanitize(_(l))}})}),t.jsx("div",{className:"text-sm text-zinc-50 light:text-slate-950 markdown",dangerouslySetInnerHTML:{__html:S.sanitize(_(n))}})]})}function ke({t:e,metrics:s}){if(!s||Object.keys(s).length===0||!s.prompt_tokens||!s.completion_tokens)return null;function l(n){return n.model?t.jsxs("span",{className:"font-mono text-xs font-normal text-zinc-50/50 light:text-slate-950/50",children:["(",n.model,")"]}):null}return t.jsxs("div",{className:"border border-zinc-700 light:border-slate-400 rounded-lg p-[18px]",children:[t.jsxs("p",{className:"text-sm font-semibold text-zinc-400 light:text-slate-600 uppercase tracking-[1.4px] mb-1",children:[e("scheduledJobs.runDetail.sections.metrics")," ",l(s)]}),t.jsxs("div",{className:"flex gap-6 text-sm text-zinc-400 light:text-slate-600",children:[s.prompt_tokens!=null&&t.jsxs("span",{children:[e("scheduledJobs.runDetail.metrics.promptTokens")," ",t.jsx("span",{className:"text-zinc-50 light:text-slate-950",children:D(s.prompt_tokens)})]}),s.completion_tokens!=null&&t.jsxs("span",{children:[e("scheduledJobs.runDetail.metrics.completionTokens")," ",t.jsx("span",{className:"text-zinc-50 light:text-slate-950",children:D(s.completion_tokens)})]})]})]})}export{Me as default};
1
+ import{r as o,j as t,ae as G,aH as $,aP as X,X as C,u as y,aN as I,s as q,a8 as K,a7 as U,bL as B,ce as V,c as j,l as W,b as Y,Z as f,p as T,a3 as Z,i as Q,b0 as ee,bH as te,aw as D}from"../index.js";import{I as se}from"./Brain-24e386d5.js";import{w as le}from"./ChatText-35275002.js";import{I as ne}from"./File-b92df2f3.js";import{R as ae}from"./Stop-4b47ae05.js";import{u as re}from"./usePolling-3b229af5.js";import{c as ie,S as oe,T as J,a as de,b as ce,r as _}from"./files-0f5d16df.js";import{C as ue}from"./Copy-d323e545.js";import{H as xe,D as S}from"./purify-ca43d85f.js";import{t as L}from"./truncate-24ce7b97.js";import{h as E}from"./moment-49fc1b76.js";/* empty css */function w({title:e,icon:s,children:l,defaultOpen:n=!1,copyableContent:a=null}){const[i,r]=o.useState(n);return t.jsxs("div",{className:"border border-zinc-700 light:border-slate-400 rounded-lg overflow-hidden",children:[t.jsxs("div",{className:"flex items-center justify-between",children:[t.jsxs("button",{type:"button",onClick:()=>r(!i),className:"border-none flex-1 h-12 flex items-center gap-2 px-[18px] hover:bg-white/5 light:hover:bg-slate-100 transition-colors text-left",children:[i?t.jsx(G,{className:"h-4 w-4 text-zinc-50 light:text-slate-950"}):t.jsx($,{className:"h-4 w-4 text-zinc-50 light:text-slate-950"}),t.jsx(s,{className:"h-4 w-4 text-zinc-50 light:text-slate-950"}),t.jsx("span",{className:"text-sm font-medium text-zinc-50 light:text-slate-950",children:e})]}),a&&t.jsx(he,{content:a})]}),i&&t.jsx("div",{className:"px-[18px] py-3 border-t border-zinc-700 light:border-slate-400",children:l})]})}function he({content:e}){const[s,l]=o.useState(!1),n=async()=>{await ie(e),l(!0),setTimeout(()=>l(!1),2e3)};return t.jsx("button",{type:"button",onClick:n,disabled:s,className:"h-12 px-4 flex items-center hover:bg-white/5 light:hover:bg-slate-100 transition-colors",children:s?t.jsx(X,{size:20,className:"text-green-500"}):t.jsx(ue,{size:20,className:"text-zinc-50 light:text-slate-950"})})}const F=5e3;function H(e){return e?"github":"github-dark"}function P(e){const s=typeof e=="string"?q(e,e):e;if(typeof s!="object"||s===null)return null;const l=JSON.stringify(s,null,2),n=L(l,F),a=xe.highlight(n,{language:"json"}).value;return{__html:S.sanitize(a)}}function me({toolCall:e}){const[s,l]=o.useState(!1);return t.jsxs("div",{className:"border border-white/5 rounded-lg p-3 bg-theme-bg-primary/30",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx(C,{className:"h-3.5 w-3.5 text-blue-400"}),t.jsx("span",{className:"text-sm font-medium text-theme-text-primary",children:e.toolName})]}),t.jsx(ge,{toolCall:e})]}),t.jsx(pe,{toolCall:e}),t.jsx(be,{toolCall:e,showResult:s,setShowResult:l})]})}function ge({toolCall:e}){return e.timestamp?t.jsx("span",{className:"text-xs text-theme-text-secondary",children:E(e.timestamp).format("LTS")}):null}function pe({toolCall:e}){const{t:s}=y(),{isLight:l}=I();if(!e.arguments)return null;const n=P(e.arguments);return t.jsxs("div",{className:"mb-2",children:[t.jsx("span",{className:"text-xs text-theme-text-secondary",children:s("scheduledJobs.toolCall.arguments")}),n?t.jsx("pre",{className:`text-xs rounded-lg p-2 mt-1 overflow-x-auto white-scrollbar tool-call-scrollbar hljs ${H(l)}`,dangerouslySetInnerHTML:n}):t.jsx("pre",{className:"text-xs text-theme-text-primary bg-theme-bg-primary/50 rounded p-2 mt-1 overflow-x-auto white-scrollbar tool-call-scrollbar",children:typeof e.arguments=="string"?e.arguments:JSON.stringify(e.arguments,null,2)})]})}function be({toolCall:e,showResult:s,setShowResult:l}){const{t:n}=y(),{isLight:a}=I();if(!e.result)return null;const i=typeof e.result=="string"?e.result:JSON.stringify(e.result,null,2),r=L(i,F),d=P(i);return i?t.jsxs("div",{children:[t.jsx("button",{type:"button",onClick:()=>l(!s),className:"border-none text-xs text-blue-400 hover:text-blue-300 transition-colors",children:n(s?"scheduledJobs.toolCall.hideResult":"scheduledJobs.toolCall.showResult")}),s&&(d?t.jsx("pre",{className:`text-xs rounded-lg p-2 mt-1 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap white-scrollbar tool-call-scrollbar hljs ${H(a)}`,dangerouslySetInnerHTML:d}):t.jsx("pre",{className:"text-xs text-theme-text-primary bg-theme-bg-primary/50 rounded p-2 mt-1 overflow-x-auto max-h-64 overflow-y-auto whitespace-pre-wrap white-scrollbar tool-call-scrollbar",children:r}))]}):null}const R={pptx:{badge:"PPT",bg:"bg-orange-100",text:"text-orange-800",label:e=>e("scheduledJobs.file.types.powerpoint")},ppt:{badge:"PPT",bg:"bg-orange-100",text:"text-orange-800",label:e=>e("scheduledJobs.file.types.powerpoint")},pdf:{badge:"PDF",bg:"bg-red-100",text:"text-red-800",label:e=>e("scheduledJobs.file.types.pdf")},doc:{badge:"DOC",bg:"bg-blue-100",text:"text-blue-800",label:e=>e("scheduledJobs.file.types.word")},docx:{badge:"DOC",bg:"bg-blue-100",text:"text-blue-800",label:e=>e("scheduledJobs.file.types.word")},xls:{badge:"XLS",bg:"bg-green-100",text:"text-green-800",label:e=>e("scheduledJobs.file.types.spreadsheet")},xlsx:{badge:"XLS",bg:"bg-green-100",text:"text-green-800",label:e=>e("scheduledJobs.file.types.spreadsheet")},csv:{badge:"CSV",bg:"bg-green-100",text:"text-green-800",label:e=>e("scheduledJobs.file.types.spreadsheet")},default:{badge:"FILE",bg:"bg-zinc-200",text:"text-zinc-800",label:e=>e("scheduledJobs.file.types.generic")}};function fe(e,s){var a,i;const l=((i=(a=e==null?void 0:e.split("."))==null?void 0:a.pop())==null?void 0:i.toLowerCase())??"txt",n=R[l]||R.default;return{...n,type:n.label(s)}}function je({file:e}){const{t:s}=y(),[l,n]=o.useState(!1),{badge:a,bg:i,text:r,type:d}=fe(e.filename,s),u=async()=>{if(!(l||!e.storageFilename)){n(!0);try{const h=await oe.download(e.storageFilename);if(!h)throw new Error("Failed to download file");const{saveAs:m}=await V(()=>import("../index.js").then(g=>g.F),["index.js","index.css"]);m(h,e.filename||e.storageFilename)}catch{j(s("scheduledJobs.file.downloadFailed"),"error")}finally{n(!1)}}};return t.jsxs("div",{className:"flex items-center justify-between bg-zinc-800 light:bg-slate-100 rounded-lg p-3",children:[t.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[t.jsx("div",{className:`${i} ${r} rounded-lg flex items-center justify-center shrink-0 h-10 w-10 text-xs font-semibold`,children:a}),t.jsxs("div",{className:"flex flex-col min-w-0",children:[t.jsx("p",{className:"text-sm text-white light:text-slate-950 truncate",children:e.filename||s("scheduledJobs.file.unknown")}),t.jsxs("p",{className:"text-sm text-zinc-400 light:text-slate-600",children:[K(e.fileSize,!0,1),e.fileSize&&d?" · ":"",d]})]})]}),t.jsx("button",{type:"button",onClick:u,disabled:l,title:s("scheduledJobs.file.download"),"aria-label":s("scheduledJobs.file.download"),className:"border-none text-zinc-400 light:text-slate-600 hover:text-zinc-50 light:hover:text-slate-950 transition-colors shrink-0 ml-4 disabled:opacity-50",children:l?t.jsx(U,{size:16,weight:"bold",className:"animate-spin"}):t.jsx(B,{size:16,weight:"bold"})})]})}function Me(){const{t:e}=y(),{id:s,runId:l}=W(),n=Y(),[a,i]=o.useState(!0),[r,d]=o.useState(null),[u,h]=o.useState(null),[m,g]=o.useState(!1),[N,p]=o.useState(!1);o.useEffect(()=>{v()},[l]);const v=async()=>{const c=await f.getRun(l);d(c.run),h(c.job),i(!1),c.run&&!c.run.readAt&&f.markRunRead(l)},O=(r==null?void 0:r.status)==="running"||(r==null?void 0:r.status)==="queued";re(v,3e3,O);const M=async()=>{g(!0);const{workspaceSlug:c,threadSlug:b,error:k}=await f.continueInThread(l);if(k||!c||!b){j(k||e("scheduledJobs.runDetail.threadFailed"),"error"),g(!1);return}n(T.workspace.thread(c,b))},A=async()=>{p(!0);const{success:c,error:b}=await f.killRun(l);if(p(!1),!c){j(b||e("scheduledJobs.toast.killFailed"),"error");return}j(e("scheduledJobs.toast.killed"),"success"),v()};if(a)return t.jsx(z,{children:t.jsx("p",{className:"text-zinc-400 light:text-slate-600 text-sm",children:e("scheduledJobs.runDetail.loading")})});if(!r)return t.jsx(z,{children:t.jsx("p",{className:"text-zinc-400 light:text-slate-600 text-sm",children:e("scheduledJobs.runDetail.notFound")})});const x=r.result||{};return t.jsxs(z,{children:[t.jsx(ye,{t:e,job:u,run:r,result:x,continuing:m,killing:N,onBack:()=>n(T.settings.scheduledJobRuns(s)),onContinueInThread:M,onKillRun:A}),t.jsxs("div",{className:"mt-6 space-y-4",children:[t.jsx(we,{t:e,prompt:u==null?void 0:u.prompt}),t.jsx(Ne,{t:e,error:r==null?void 0:r.error}),t.jsx(ve,{t:e,result:x}),t.jsx(Je,{t:e,result:x}),t.jsx(ze,{t:e,result:x}),t.jsx(Se,{t:e,result:x}),t.jsx(ke,{t:e,metrics:x==null?void 0:x.metrics})]})]})}function z({children:e}){return t.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[t.jsx(Z,{}),t.jsx("div",{style:{height:Q?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:t.jsx("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:e})})]})}function ye({t:e,job:s,run:l,result:n,continuing:a,killing:i,onBack:r,onContinueInThread:d,onKillRun:u}){function h(){return{completed:{text:e("scheduledJobs.status.completed"),style:"text-green-400 light:text-green-600"},failed:{text:e("scheduledJobs.status.failed"),style:"text-red-400 light:text-red-600"},timed_out:{text:e("scheduledJobs.status.timed_out"),style:"text-orange-400 light:text-orange-600"},running:{text:e("scheduledJobs.status.running"),style:"text-yellow-400 light:text-yellow-600"},queued:{text:e("scheduledJobs.status.queued"),style:"text-blue-400 light:text-blue-600"},default:{text:"—",style:"text-zinc-400 light:text-slate-600"}}}const m=h(),{text:g,style:N}=m[l.status]||m.default,p=["running","queued"].includes(l.status);return t.jsxs("div",{className:"w-full flex items-end justify-between gap-x-4 pb-6 border-white/10 light:border-zinc-300 border-b-2",children:[t.jsxs("div",{className:"flex flex-col gap-y-2",children:[t.jsxs("button",{type:"button",onClick:r,className:"border-none flex items-center gap-2 text-zinc-400 light:text-slate-600 hover:text-zinc-50 light:hover:text-slate-950 text-sm transition-colors w-fit",children:[t.jsx(ee,{className:"h-4 w-4"}),e("scheduledJobs.runDetail.back")]}),t.jsx("p",{className:"text-lg leading-7 font-semibold text-zinc-50 light:text-slate-950",children:e("scheduledJobs.runDetail.runHeading",{name:(s==null?void 0:s.name)||e("scheduledJobs.runDetail.unknownJob"),id:l.id})}),t.jsxs("div",{className:"flex items-center gap-2 text-xs",children:[t.jsx("span",{className:N,children:g}),t.jsx("span",{className:"text-zinc-400 light:text-slate-600",children:E(l.startedAt).format("LTS")}),n.duration&&t.jsx("span",{className:"text-zinc-400 light:text-slate-600",children:e("scheduledJobs.runDetail.duration",{value:te(n.duration/1e3)})})]})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[p&&t.jsxs("button",{type:"button",onClick:u,disabled:i,title:e("scheduledJobs.runDetail.stopJob"),className:"border-none h-9 px-5 rounded-lg bg-red-500/20 text-red-400 light:bg-red-100 light:text-red-600 text-sm font-medium hover:bg-red-500/30 light:hover:bg-red-200 transition-colors disabled:opacity-50 shrink-0 flex items-center gap-2",children:[t.jsx(ae,{className:"h-4 w-4",weight:"bold"}),e(i?"scheduledJobs.runDetail.killing":"scheduledJobs.runDetail.stopJob")]}),l.status==="completed"&&t.jsx("button",{type:"button",onClick:d,disabled:a,className:"border-none h-9 px-5 rounded-lg bg-zinc-50 text-zinc-950 light:bg-slate-900 light:text-white text-sm font-medium hover:bg-zinc-200 light:hover:bg-slate-800 transition-colors disabled:opacity-50 shrink-0",children:e(a?"scheduledJobs.runDetail.creating":"scheduledJobs.runDetail.continueInThread")})]})]})}function we({t:e,prompt:s}){return t.jsxs("div",{className:"border border-zinc-700 light:border-slate-400 rounded-lg p-[18px]",children:[t.jsx("p",{className:"text-sm font-medium text-white light:text-slate-950 uppercase tracking-[1.4px] mb-1",children:e("scheduledJobs.runDetail.sections.prompt")}),t.jsx("p",{className:"text-sm text-zinc-400 light:text-slate-600 whitespace-pre-wrap",children:s||"—"})]})}function Ne({t:e,error:s}){return s?t.jsxs("div",{className:"border border-red-500/20 light:border-red-300 rounded-lg p-[18px] bg-red-500/5 light:bg-red-50",children:[t.jsx("p",{className:"text-sm font-medium text-red-400 light:text-red-600 uppercase tracking-[1.4px] mb-1",children:e("scheduledJobs.runDetail.sections.error")}),t.jsx("p",{className:"text-sm text-red-300 light:text-red-700",children:s})]}):null}function ve({t:e,result:s}){return!s.thoughts||s.thoughts.length===0?null:t.jsx(w,{title:e("scheduledJobs.runDetail.sections.thinking",{count:s.thoughts.length}),icon:se,children:t.jsx("div",{className:"space-y-2",children:s.thoughts.map((l,n)=>t.jsxs("div",{className:"flex items-start gap-2 text-sm text-theme-text-secondary",children:[t.jsxs("span",{className:"text-xs text-theme-text-secondary/50 mt-0.5 min-w-[20px]",children:[n+1,"."]}),t.jsx("span",{children:l})]},n))})})}function Je({t:e,result:s}){return!s.toolCalls||s.toolCalls.length===0?null:t.jsx(w,{title:e("scheduledJobs.runDetail.sections.toolCalls",{count:s.toolCalls.length}),icon:C,children:t.jsx("div",{className:"space-y-3",children:s.toolCalls.map((l,n)=>t.jsx(me,{toolCall:l},n))})})}function ze({t:e,result:s}){const l=s.outputs||[];return l.length===0?null:t.jsx(w,{title:e("scheduledJobs.runDetail.sections.files",{count:l.length}),icon:ne,defaultOpen:!0,children:t.jsx("div",{className:"space-y-2",children:l.map((n,a)=>t.jsx(je,{file:n.payload,type:n.type},a))})})}function Se({t:e,result:s}){var a;if(!s.text)return null;let l=null,n=s.text;return s.text.match(J)&&(l=(a=s.text.match(J))==null?void 0:a[0],l&&(l=l.replace(de,"").replace(ce,"").trim()),n=s.text.replace(J,"")),t.jsxs(w,{title:e("scheduledJobs.runDetail.sections.response"),icon:le,defaultOpen:!0,copyableContent:n,children:[l&&t.jsx("div",{className:"text-sm text-zinc-50/50 light:text-slate-950/50 markdown border-l-2 border-zinc-700 light:border-slate-400 pl-2 mb-4",children:t.jsx("span",{dangerouslySetInnerHTML:{__html:S.sanitize(_(l))}})}),t.jsx("div",{className:"text-sm text-zinc-50 light:text-slate-950 markdown",dangerouslySetInnerHTML:{__html:S.sanitize(_(n))}})]})}function ke({t:e,metrics:s}){if(!s||Object.keys(s).length===0||!s.prompt_tokens||!s.completion_tokens)return null;function l(n){return n.model?t.jsxs("span",{className:"font-mono text-xs font-normal text-zinc-50/50 light:text-slate-950/50",children:["(",n.model,")"]}):null}return t.jsxs("div",{className:"border border-zinc-700 light:border-slate-400 rounded-lg p-[18px]",children:[t.jsxs("p",{className:"text-sm font-semibold text-zinc-400 light:text-slate-600 uppercase tracking-[1.4px] mb-1",children:[e("scheduledJobs.runDetail.sections.metrics")," ",l(s)]}),t.jsxs("div",{className:"flex gap-6 text-sm text-zinc-400 light:text-slate-600",children:[s.prompt_tokens!=null&&t.jsxs("span",{children:[e("scheduledJobs.runDetail.metrics.promptTokens")," ",t.jsx("span",{className:"text-zinc-50 light:text-slate-950",children:D(s.prompt_tokens)})]}),s.completion_tokens!=null&&t.jsxs("span",{children:[e("scheduledJobs.runDetail.metrics.completionTokens")," ",t.jsx("span",{className:"text-zinc-50 light:text-slate-950",children:D(s.completion_tokens)})]})]})]})}export{Me as default};
@@ -1 +1 @@
1
- import{u as h,j as t,b as j,r as d,p as N,ca as z,bH as H,Z as x,c,l as R,a3 as S,i as k,b0 as A}from"../index.js";import{u as q}from"./usePolling-3b229af5.js";import{R as C}from"./Stop-4b47ae05.js";import{h as y}from"./moment-49fc1b76.js";import{h as T}from"./cron-322999f6.js";function D(e){return{completed:{text:e("scheduledJobs.status.completed"),style:"font-medium text-white light:text-slate-950"},failed:{text:e("scheduledJobs.status.failed"),style:"text-red-400 light:text-red-600"},timed_out:{text:e("scheduledJobs.status.timed_out"),style:"text-red-400 light:text-red-600"},running:{text:e("scheduledJobs.status.running"),style:"italic text-zinc-400 light:text-slate-600"},queued:{text:e("scheduledJobs.status.queued"),style:"italic text-zinc-400 light:text-slate-600"},default:{text:"—",style:"text-zinc-400 light:text-slate-600"}}}function I({status:e}){const{t:l}=h(),s=D(l),{text:a,style:n}=s[e]||s.default;return t.jsx("span",{className:`text-sm ${n}`,children:a})}function P(e){if(!e.completedAt||!e.startedAt)return"—";const l=y.duration(y(e.completedAt).diff(y(e.startedAt)));return H(l.asSeconds())}function E({run:e,jobId:l,onKilled:s}){const{t:a}=h(),n=j(),[m,o]=d.useState(!1),g=!e.readAt&&!["running","queued"].includes(e.status),p=["running","queued"].includes(e.status),u=async b=>{b.stopPropagation(),o(!0);const{success:r,error:f}=await x.killRun(e.id);if(o(!1),!r){c(f||a("scheduledJobs.toast.killFailed"),"error");return}c(a("scheduledJobs.toast.killed"),"success"),s==null||s()};return t.jsxs("button",{type:"button",onClick:()=>n(N.settings.scheduledJobRunDetail(l,e.id)),className:"border-none flex items-center px-4 h-14 hover:bg-white/5 light:hover:bg-slate-200 transition-colors text-left w-full",children:[t.jsxs("div",{className:"w-[200px] flex items-center gap-2 relative",children:[g&&t.jsx(z,{weight:"fill",className:"h-2 w-2 text-blue-400 light:text-blue-600 absolute -left-4"}),p&&t.jsx("button",{type:"button",onClick:u,disabled:m,title:a("scheduledJobs.runHistory.stopJob"),className:"border-none ml-2 p-1.5 rounded bg-red-500/20 text-red-400 light:bg-red-100 light:text-red-600 hover:bg-red-500/30 light:hover:bg-red-200 transition-colors disabled:opacity-50",children:t.jsx(C,{className:"h-3.5 w-3.5",weight:"bold"})}),t.jsx(I,{status:e.status})]}),t.jsx("span",{className:"w-[260px] text-sm font-medium text-white light:text-slate-950 truncate",children:new Date(e.startedAt).toLocaleString()}),t.jsx("span",{className:"w-[160px] text-sm font-medium text-white light:text-slate-950 truncate",children:P(e)}),t.jsx("span",{className:`flex-1 text-sm truncate pr-4 ${e.error?"text-red-400 light:text-red-600 italic":"font-medium text-white light:text-slate-950"}`,children:e.error||"—"})]})}function B(){const{t:e}=h(),{id:l}=R(),[s,a]=d.useState(null),[n,m]=d.useState([]),[o,g]=d.useState(!0),[p,u]=d.useState(!1),b=n.some(i=>i.status==="queued"||i.status==="running"),r=async()=>{const{runs:i}=await x.runs(l);m(i||[]),g(!1)};d.useEffect(()=>{x.get(l).then(({job:i})=>a(i)),r()},[l]),q(r,5e3);const f=async()=>{u(!0);const{success:i,skipped:v,error:J}=await x.trigger(l);if(u(!1),!i){c(J||e("scheduledJobs.toast.triggerFailed"),"error");return}v?c(e("scheduledJobs.toast.triggerSkipped","A run is already in progress for this job"),"info"):c(e("scheduledJobs.toast.triggered"),"success"),r()};return o?t.jsx(w,{job:s,children:t.jsx("div",{className:"flex flex-col items-center justify-center gap-8 py-24 text-center",children:t.jsx("p",{className:"text-zinc-400 light:text-slate-600 text-sm",children:e("scheduledJobs.loading")})})}):t.jsx(w,{job:s,children:t.jsxs("div",{className:"pt-8",children:[t.jsxs("div",{className:"flex items-center px-4 pb-[18px] text-xs font-semibold uppercase tracking-[1.4px] text-zinc-400 light:text-slate-600",children:[t.jsx("span",{className:"w-[200px]",children:e("scheduledJobs.runHistory.table.status")}),t.jsx("span",{className:"w-[260px]",children:e("scheduledJobs.runHistory.table.started")}),t.jsx("span",{className:"w-[160px]",children:e("scheduledJobs.runHistory.table.duration")}),t.jsx("span",{className:"flex-1",children:e("scheduledJobs.runHistory.table.error")})]}),t.jsx("div",{className:"h-px w-full bg-white/10 light:bg-slate-300"}),n.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center gap-8 py-24 text-center",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("p",{className:"text-base font-semibold text-zinc-50 light:text-slate-950",children:e("scheduledJobs.runHistory.emptyTitle")}),t.jsx("p",{className:"text-sm font-medium text-zinc-400 light:text-slate-600",children:e("scheduledJobs.runHistory.emptySubtitle")})]}),t.jsx("button",{type:"button",onClick:f,disabled:p||b,className:"border-none h-9 px-5 rounded-lg bg-zinc-50 text-zinc-950 light:bg-slate-900 light:text-white text-sm font-medium hover:bg-zinc-200 light:hover:bg-slate-800 transition-colors disabled:opacity-50",children:e("scheduledJobs.runHistory.runNow")})]}):t.jsx("div",{className:"flex flex-col divide-y divide-white/5 light:divide-slate-200",children:n.map(i=>t.jsx(E,{run:i,jobId:s==null?void 0:s.id,onKilled:r},i.id))})]})})}function w({job:e,children:l}){const{t:s,i18n:a}=h(),n=j();return t.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[t.jsx(S,{}),t.jsx("div",{style:{height:k?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:t.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[t.jsxs("div",{className:"w-full flex flex-col gap-y-2 pb-6 border-white/10 light:border-slate-300 border-b-2",children:[t.jsxs("button",{type:"button",onClick:()=>n(N.settings.scheduledJobs()),className:"border-none flex items-center gap-2 text-zinc-400 light:text-slate-600 hover:text-zinc-50 light:hover:text-slate-950 text-sm transition-colors w-fit",children:[t.jsx(A,{className:"h-4 w-4"}),s("scheduledJobs.runHistory.back")]}),t.jsx("p",{className:"text-lg leading-7 font-semibold text-zinc-50 light:text-slate-950",children:s("scheduledJobs.runHistory.title",{name:(e==null?void 0:e.name)||"..."})}),t.jsxs("p",{className:"text-xs text-zinc-400 light:text-slate-600",children:[s("scheduledJobs.runHistory.schedule")," ",t.jsx("code",{children:T(e==null?void 0:e.schedule,a.language)||"—"})]})]}),l]})})]})}export{B as default};
1
+ import{u as h,j as t,b as j,r as d,p as N,cd as z,bH as H,Z as x,c,l as R,a3 as S,i as k,b0 as A}from"../index.js";import{u as q}from"./usePolling-3b229af5.js";import{R as C}from"./Stop-4b47ae05.js";import{h as y}from"./moment-49fc1b76.js";import{h as T}from"./cron-322999f6.js";function D(e){return{completed:{text:e("scheduledJobs.status.completed"),style:"font-medium text-white light:text-slate-950"},failed:{text:e("scheduledJobs.status.failed"),style:"text-red-400 light:text-red-600"},timed_out:{text:e("scheduledJobs.status.timed_out"),style:"text-red-400 light:text-red-600"},running:{text:e("scheduledJobs.status.running"),style:"italic text-zinc-400 light:text-slate-600"},queued:{text:e("scheduledJobs.status.queued"),style:"italic text-zinc-400 light:text-slate-600"},default:{text:"—",style:"text-zinc-400 light:text-slate-600"}}}function I({status:e}){const{t:l}=h(),s=D(l),{text:a,style:n}=s[e]||s.default;return t.jsx("span",{className:`text-sm ${n}`,children:a})}function P(e){if(!e.completedAt||!e.startedAt)return"—";const l=y.duration(y(e.completedAt).diff(y(e.startedAt)));return H(l.asSeconds())}function E({run:e,jobId:l,onKilled:s}){const{t:a}=h(),n=j(),[m,o]=d.useState(!1),g=!e.readAt&&!["running","queued"].includes(e.status),p=["running","queued"].includes(e.status),u=async b=>{b.stopPropagation(),o(!0);const{success:r,error:f}=await x.killRun(e.id);if(o(!1),!r){c(f||a("scheduledJobs.toast.killFailed"),"error");return}c(a("scheduledJobs.toast.killed"),"success"),s==null||s()};return t.jsxs("button",{type:"button",onClick:()=>n(N.settings.scheduledJobRunDetail(l,e.id)),className:"border-none flex items-center px-4 h-14 hover:bg-white/5 light:hover:bg-slate-200 transition-colors text-left w-full",children:[t.jsxs("div",{className:"w-[200px] flex items-center gap-2 relative",children:[g&&t.jsx(z,{weight:"fill",className:"h-2 w-2 text-blue-400 light:text-blue-600 absolute -left-4"}),p&&t.jsx("button",{type:"button",onClick:u,disabled:m,title:a("scheduledJobs.runHistory.stopJob"),className:"border-none ml-2 p-1.5 rounded bg-red-500/20 text-red-400 light:bg-red-100 light:text-red-600 hover:bg-red-500/30 light:hover:bg-red-200 transition-colors disabled:opacity-50",children:t.jsx(C,{className:"h-3.5 w-3.5",weight:"bold"})}),t.jsx(I,{status:e.status})]}),t.jsx("span",{className:"w-[260px] text-sm font-medium text-white light:text-slate-950 truncate",children:new Date(e.startedAt).toLocaleString()}),t.jsx("span",{className:"w-[160px] text-sm font-medium text-white light:text-slate-950 truncate",children:P(e)}),t.jsx("span",{className:`flex-1 text-sm truncate pr-4 ${e.error?"text-red-400 light:text-red-600 italic":"font-medium text-white light:text-slate-950"}`,children:e.error||"—"})]})}function B(){const{t:e}=h(),{id:l}=R(),[s,a]=d.useState(null),[n,m]=d.useState([]),[o,g]=d.useState(!0),[p,u]=d.useState(!1),b=n.some(i=>i.status==="queued"||i.status==="running"),r=async()=>{const{runs:i}=await x.runs(l);m(i||[]),g(!1)};d.useEffect(()=>{x.get(l).then(({job:i})=>a(i)),r()},[l]),q(r,5e3);const f=async()=>{u(!0);const{success:i,skipped:v,error:J}=await x.trigger(l);if(u(!1),!i){c(J||e("scheduledJobs.toast.triggerFailed"),"error");return}v?c(e("scheduledJobs.toast.triggerSkipped","A run is already in progress for this job"),"info"):c(e("scheduledJobs.toast.triggered"),"success"),r()};return o?t.jsx(w,{job:s,children:t.jsx("div",{className:"flex flex-col items-center justify-center gap-8 py-24 text-center",children:t.jsx("p",{className:"text-zinc-400 light:text-slate-600 text-sm",children:e("scheduledJobs.loading")})})}):t.jsx(w,{job:s,children:t.jsxs("div",{className:"pt-8",children:[t.jsxs("div",{className:"flex items-center px-4 pb-[18px] text-xs font-semibold uppercase tracking-[1.4px] text-zinc-400 light:text-slate-600",children:[t.jsx("span",{className:"w-[200px]",children:e("scheduledJobs.runHistory.table.status")}),t.jsx("span",{className:"w-[260px]",children:e("scheduledJobs.runHistory.table.started")}),t.jsx("span",{className:"w-[160px]",children:e("scheduledJobs.runHistory.table.duration")}),t.jsx("span",{className:"flex-1",children:e("scheduledJobs.runHistory.table.error")})]}),t.jsx("div",{className:"h-px w-full bg-white/10 light:bg-slate-300"}),n.length===0?t.jsxs("div",{className:"flex flex-col items-center justify-center gap-8 py-24 text-center",children:[t.jsxs("div",{className:"flex flex-col gap-1.5",children:[t.jsx("p",{className:"text-base font-semibold text-zinc-50 light:text-slate-950",children:e("scheduledJobs.runHistory.emptyTitle")}),t.jsx("p",{className:"text-sm font-medium text-zinc-400 light:text-slate-600",children:e("scheduledJobs.runHistory.emptySubtitle")})]}),t.jsx("button",{type:"button",onClick:f,disabled:p||b,className:"border-none h-9 px-5 rounded-lg bg-zinc-50 text-zinc-950 light:bg-slate-900 light:text-white text-sm font-medium hover:bg-zinc-200 light:hover:bg-slate-800 transition-colors disabled:opacity-50",children:e("scheduledJobs.runHistory.runNow")})]}):t.jsx("div",{className:"flex flex-col divide-y divide-white/5 light:divide-slate-200",children:n.map(i=>t.jsx(E,{run:i,jobId:s==null?void 0:s.id,onKilled:r},i.id))})]})})}function w({job:e,children:l}){const{t:s,i18n:a}=h(),n=j();return t.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[t.jsx(S,{}),t.jsx("div",{style:{height:k?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:t.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[t.jsxs("div",{className:"w-full flex flex-col gap-y-2 pb-6 border-white/10 light:border-slate-300 border-b-2",children:[t.jsxs("button",{type:"button",onClick:()=>n(N.settings.scheduledJobs()),className:"border-none flex items-center gap-2 text-zinc-400 light:text-slate-600 hover:text-zinc-50 light:hover:text-slate-950 text-sm transition-colors w-fit",children:[t.jsx(A,{className:"h-4 w-4"}),s("scheduledJobs.runHistory.back")]}),t.jsx("p",{className:"text-lg leading-7 font-semibold text-zinc-50 light:text-slate-950",children:s("scheduledJobs.runHistory.title",{name:(e==null?void 0:e.name)||"..."})}),t.jsxs("p",{className:"text-xs text-zinc-400 light:text-slate-600",children:[s("scheduledJobs.runHistory.schedule")," ",t.jsx("code",{children:T(e==null?void 0:e.schedule,a.language)||"—"})]})]}),l]})})]})}export{B as default};