clew-code 0.2.11 → 0.2.14

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 (52) hide show
  1. package/dist/main.js +2596 -2527
  2. package/docs/architecture.html +148 -148
  3. package/docs/architecture.th.html +79 -79
  4. package/docs/clew-code-architecture.html +6 -6
  5. package/docs/commands.html +225 -224
  6. package/docs/commands.th.html +132 -131
  7. package/docs/configuration.html +147 -147
  8. package/docs/configuration.th.html +108 -108
  9. package/docs/daemon.html +129 -129
  10. package/docs/daemon.th.html +73 -73
  11. package/docs/features/bridge-mode.html +99 -99
  12. package/docs/features/bridge-mode.th.html +90 -90
  13. package/docs/features/evals.html +182 -182
  14. package/docs/features/evals.th.html +90 -90
  15. package/docs/features/peer.html +178 -178
  16. package/docs/features/searxng-search.html +151 -151
  17. package/docs/features/searxng-search.th.html +95 -95
  18. package/docs/features/sentry-setup.html +157 -157
  19. package/docs/features/sentry-setup.th.html +97 -97
  20. package/docs/index.html +298 -299
  21. package/docs/index.th.html +292 -292
  22. package/docs/installation.html +105 -105
  23. package/docs/installation.th.html +105 -105
  24. package/docs/internals/growthbook-ab-testing.html +113 -113
  25. package/docs/internals/growthbook-ab-testing.th.html +81 -81
  26. package/docs/internals/hidden-features.html +175 -149
  27. package/docs/internals/hidden-features.th.html +135 -109
  28. package/docs/loop.html +181 -181
  29. package/docs/loop.th.html +227 -227
  30. package/docs/mcp.html +247 -247
  31. package/docs/mcp.th.html +207 -207
  32. package/docs/models.html +110 -111
  33. package/docs/models.th.html +61 -61
  34. package/docs/peer.html +236 -236
  35. package/docs/peer.th.html +280 -280
  36. package/docs/permission-model.html +102 -102
  37. package/docs/permission-model.th.html +67 -67
  38. package/docs/plugins.html +102 -102
  39. package/docs/plugins.th.html +79 -79
  40. package/docs/providers.html +126 -126
  41. package/docs/providers.th.html +80 -80
  42. package/docs/quick-start.html +93 -93
  43. package/docs/quick-start.th.html +1 -1
  44. package/docs/research-memory.html +82 -82
  45. package/docs/research-memory.th.html +72 -72
  46. package/docs/skills.html +117 -117
  47. package/docs/skills.th.html +90 -90
  48. package/docs/tools.html +170 -170
  49. package/docs/tools.th.html +84 -84
  50. package/docs/troubleshooting.html +106 -106
  51. package/docs/troubleshooting.th.html +85 -85
  52. package/package.json +162 -164
package/docs/daemon.html CHANGED
@@ -1,129 +1,129 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Autonomous Daemon — Clew</title>
7
- <meta name="description" content="24/7 autonomous background execution — task queue, agent loop, supervisor integration, and recurring tasks.">
8
- <link rel="preconnect" href="https://fonts.googleapis.com">
9
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
- <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
11
- <link rel="stylesheet" href="css/styles.css">
12
- <link rel="icon" type="image/svg+xml" href="./assets/clew.svg">
13
- </head>
14
- <body>
15
- <header class="header"></header>
16
- <div class="app">
17
- <aside class="sidebar" id="sidebar"></aside>
18
- <div class="sidebar-overlay" id="sidebarOverlay"></div>
19
- <div class="content-wrap">
20
- <main class="content">
21
- <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span>Daemon Mode</span></div>
22
- <h1>Autonomous Daemon Mode</h1>
23
- <p class="section-subtitle">Run Clew as a 24/7 background daemon — task queue, agent loop, health checks, and supervisor auto-respawn for unattended autonomous operation.</p>
24
-
25
- <p>The autonomous system lives in <code>src/services/autonomous/</code> and consists of four main components: the <strong>task queue</strong>, <strong>agent loop</strong>, <strong>daemon entry point</strong>, and <strong>supervisor integration</strong>.</p>
26
-
27
- <h2>Architecture</h2>
28
- <pre><code> + Task Queue (taskQueue.ts)
29
- | File-backed persistent queue
30
- | Priorities Leases Dead-letter
31
- |
32
- + Agent Loop (agentLoop.ts)
33
- | Dequeue Spawn worker Monitor Retry
34
- |
35
- + Daemon Mode (daemonMode.ts)
36
- | Background process entry point
37
- |
38
- + Supervisor (supervisorIntegration.ts)
39
- Health checks Auto-respawn State tracking</code></pre>
40
-
41
- <h2>Task Queue</h2>
42
- <p>The file-backed persistent queue (<code>src/services/autonomous/taskQueue.ts</code>) is the foundation of the autonomous system:</p>
43
- <ul>
44
- <li><strong>Persistence</strong> — Tasks survive process restarts via on-disk storage</li>
45
- <li><strong>Priorities</strong> — Urgent tasks skip ahead in the queue</li>
46
- <li><strong>Leases</strong> — Tasks are leased to workers with TTL; expired leases are retried</li>
47
- <li><strong>Dead-letter</strong> — Tasks that exhaust retries are moved to dead-letter for inspection</li>
48
- <li><strong>Scheduling</strong> — One-shot and recurring (cron) tasks supported</li>
49
- </ul>
50
-
51
- <h2>Agent Loop</h2>
52
- <p>The continuous agent loop (<code>src/services/autonomous/agentLoop.ts</code>) runs in the background:</p>
53
- <ol>
54
- <li><strong>Dequeue</strong> — Pull the highest-priority ready task</li>
55
- <li><strong>Spawn worker</strong> — Launch a worker session for the task</li>
56
- <li><strong>Monitor</strong> — Track progress, streaming output, and resource usage</li>
57
- <li><strong>Retry or complete</strong> — On failure, retry with backoff; on success, record result</li>
58
- <li><strong>Repeat</strong> — Check for new tasks and repeat the cycle</li>
59
- </ol>
60
-
61
- <h2>Daemon Entry Point</h2>
62
- <p><code>src/services/autonomous/daemonMode.ts</code> provides the background process entry point. When started in daemon mode, Clew:</p>
63
- <ul>
64
- <li>Detaches from the terminal and runs as a background process</li>
65
- <li>Logs output to a configurable log file</li>
66
- <li>Responds to signals for graceful shutdown</li>
67
- <li>Reports status to the supervisor for health tracking</li>
68
- </ul>
69
-
70
- <h2>Supervisor Integration</h2>
71
- <p><code>src/services/autonomous/supervisorIntegration.ts</code> ensures the daemon stays running:</p>
72
- <ul>
73
- <li><strong>Health checks</strong> — Periodic heartbeat and resource checks</li>
74
- <li><strong>Auto-respawn</strong> — Automatic restart on unexpected exit</li>
75
- <li><strong>State tracking</strong> — Current status, running tasks, error counts</li>
76
- <li><strong>Graceful degradation</strong> — Reduces polling frequency on repeated failures</li>
77
- </ul>
78
-
79
- <h2>Commands</h2>
80
- <table>
81
- <tr><th>Command</th><th>Description</th></tr>
82
- <tr><td><code>/daemon</code></td><td>Open interactive control panel; subcommands: start, stop, status, restart</td></tr>
83
- <tr><td><code>/task</code></td><td>Create scheduled or recurring tasks via interactive form</td></tr>
84
- <tr><td><code>/task list</code></td><td>List queued, running, and completed tasks</td></tr>
85
- <tr><td><code>/loop</code></td><td>Run a prompt or command on a recurring interval (<code>/loop 5m /check-deploy</code>)</td></tr>
86
- <tr><td><code>/agents</code></td><td>Manage agent configurations and daemon worker pools</td></tr>
87
- <tr><td><code>/tasks</code></td><td>List and manage background agent tasks</td></tr>
88
- </table>
89
-
90
- <h2>Task Scheduling</h2>
91
- <p>Scheduled tasks can be created through the interactive <code>/task</code> form or programmatically. Storage modes:</p>
92
- <ul>
93
- <li><strong>Durable</strong> — Persists to <code>.claude/scheduled_tasks.json</code>, survives restarts</li>
94
- <li><strong>Session-only</strong> — Kept in memory for the current session only</li>
95
- </ul>
96
-
97
- <p>Recurring tasks auto-expire after 30 days. One-shot tasks auto-delete after firing. Custom cron expressions are supported (standard 5-field format).</p>
98
-
99
- <pre><code>/task
100
- Name: Deploy health check
101
- Schedule: Daily
102
- Time: 09:00
103
- Prompt: Check deployment status and report
104
- Storage: Durable</code></pre>
105
-
106
- <h2>Architecture Files</h2>
107
- <table>
108
- <tr><th>File</th><th>Role</th></tr>
109
- <tr><td><code>src/services/autonomous/taskQueue.ts</code></td><td>Persistent task queue with priorities, leases, dead-letter</td></tr>
110
- <tr><td><code>src/services/autonomous/agentLoop.ts</code></td><td>Continuous 24/7 agent loop</td></tr>
111
- <tr><td><code>src/services/autonomous/daemonMode.ts</code></td><td>Background daemon entry point</td></tr>
112
- <tr><td><code>src/services/autonomous/supervisorIntegration.ts</code></td><td>Health checks, auto-respawn, state tracking</td></tr>
113
- </table>
114
-
115
- <footer class="footer">
116
- <span>Clew Code v0.2.7 — Open Source</span>
117
- <div class="footer-links">
118
- <a href="https://github.com/ClewCode/ClewCode">GitHub</a>
119
- <a href="https://github.com/ClewCode/ClewCode/issues">Issues</a>
120
- </div>
121
- </footer>
122
- </main>
123
- <nav class="toc-sidebar"></nav>
124
- </div>
125
- </div>
126
- <script src="js/main.js"></script>
127
- </body>
128
- </html>
129
-
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Autonomous Daemon — Clew</title>
7
+ <meta name="description" content="24/7 autonomous background execution — task queue, agent loop, supervisor integration, and recurring tasks.">
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
+ <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
11
+ <link rel="stylesheet" href="css/styles.css">
12
+ <link rel="icon" type="image/svg+xml" href="./assets/clew.svg">
13
+ </head>
14
+ <body>
15
+ <header class="header"></header>
16
+ <div class="app">
17
+ <aside class="sidebar" id="sidebar"></aside>
18
+ <div class="sidebar-overlay" id="sidebarOverlay"></div>
19
+ <div class="content-wrap">
20
+ <main class="content">
21
+ <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span>Daemon Mode</span></div>
22
+ <h1>Autonomous Daemon Mode</h1>
23
+ <p class="section-subtitle">Run Clew as a 24/7 background daemon — task queue, agent loop, health checks, and supervisor auto-respawn for unattended autonomous operation.</p>
24
+
25
+ <p>The autonomous system lives in <code>src/services/autonomous/</code> and consists of four main components: the <strong>task queue</strong>, <strong>agent loop</strong>, <strong>daemon entry point</strong>, and <strong>supervisor integration</strong>.</p>
26
+
27
+ <h2>Architecture</h2>
28
+ <pre><code> + Task Queue (taskQueue.ts)
29
+ | File-backed persistent queue
30
+ | Priorities Leases Dead-letter
31
+ |
32
+ + Agent Loop (agentLoop.ts)
33
+ | Dequeue Spawn worker Monitor Retry
34
+ |
35
+ + Daemon Mode (daemonMode.ts)
36
+ | Background process entry point
37
+ |
38
+ + Supervisor (supervisorIntegration.ts)
39
+ Health checks Auto-respawn State tracking</code></pre>
40
+
41
+ <h2>Task Queue</h2>
42
+ <p>The file-backed persistent queue (<code>src/services/autonomous/taskQueue.ts</code>) is the foundation of the autonomous system:</p>
43
+ <ul>
44
+ <li><strong>Persistence</strong> — Tasks survive process restarts via on-disk storage</li>
45
+ <li><strong>Priorities</strong> — Urgent tasks skip ahead in the queue</li>
46
+ <li><strong>Leases</strong> — Tasks are leased to workers with TTL; expired leases are retried</li>
47
+ <li><strong>Dead-letter</strong> — Tasks that exhaust retries are moved to dead-letter for inspection</li>
48
+ <li><strong>Scheduling</strong> — One-shot and recurring (cron) tasks supported</li>
49
+ </ul>
50
+
51
+ <h2>Agent Loop</h2>
52
+ <p>The continuous agent loop (<code>src/services/autonomous/agentLoop.ts</code>) runs in the background:</p>
53
+ <ol>
54
+ <li><strong>Dequeue</strong> — Pull the highest-priority ready task</li>
55
+ <li><strong>Spawn worker</strong> — Launch a worker session for the task</li>
56
+ <li><strong>Monitor</strong> — Track progress, streaming output, and resource usage</li>
57
+ <li><strong>Retry or complete</strong> — On failure, retry with backoff; on success, record result</li>
58
+ <li><strong>Repeat</strong> — Check for new tasks and repeat the cycle</li>
59
+ </ol>
60
+
61
+ <h2>Daemon Entry Point</h2>
62
+ <p><code>src/services/autonomous/daemonMode.ts</code> provides the background process entry point. When started in daemon mode, Clew:</p>
63
+ <ul>
64
+ <li>Detaches from the terminal and runs as a background process</li>
65
+ <li>Logs output to a configurable log file</li>
66
+ <li>Responds to signals for graceful shutdown</li>
67
+ <li>Reports status to the supervisor for health tracking</li>
68
+ </ul>
69
+
70
+ <h2>Supervisor Integration</h2>
71
+ <p><code>src/services/autonomous/supervisorIntegration.ts</code> ensures the daemon stays running:</p>
72
+ <ul>
73
+ <li><strong>Health checks</strong> — Periodic heartbeat and resource checks</li>
74
+ <li><strong>Auto-respawn</strong> — Automatic restart on unexpected exit</li>
75
+ <li><strong>State tracking</strong> — Current status, running tasks, error counts</li>
76
+ <li><strong>Graceful degradation</strong> — Reduces polling frequency on repeated failures</li>
77
+ </ul>
78
+
79
+ <h2>Commands</h2>
80
+ <table>
81
+ <tr><th>Command</th><th>Description</th></tr>
82
+ <tr><td><code>/daemon</code></td><td>Open interactive control panel; subcommands: start, stop, status, restart</td></tr>
83
+ <tr><td><code>/task</code></td><td>Create scheduled or recurring tasks via interactive form</td></tr>
84
+ <tr><td><code>/task list</code></td><td>List queued, running, and completed tasks</td></tr>
85
+ <tr><td><code>/loop</code></td><td>Run a prompt or command on a recurring interval (<code>/loop 5m /check-deploy</code>)</td></tr>
86
+ <tr><td><code>/agents</code></td><td>Manage agent configurations and daemon worker pools</td></tr>
87
+ <tr><td><code>/tasks</code></td><td>List and manage background agent tasks</td></tr>
88
+ </table>
89
+
90
+ <h2>Task Scheduling</h2>
91
+ <p>Scheduled tasks can be created through the interactive <code>/task</code> form or programmatically. Storage modes:</p>
92
+ <ul>
93
+ <li><strong>Durable</strong> — Persists to <code>.claude/scheduled_tasks.json</code>, survives restarts</li>
94
+ <li><strong>Session-only</strong> — Kept in memory for the current session only</li>
95
+ </ul>
96
+
97
+ <p>Recurring tasks auto-expire after 30 days. One-shot tasks auto-delete after firing. Custom cron expressions are supported (standard 5-field format).</p>
98
+
99
+ <pre><code>/task
100
+ Name: Deploy health check
101
+ Schedule: Daily
102
+ Time: 09:00
103
+ Prompt: Check deployment status and report
104
+ Storage: Durable</code></pre>
105
+
106
+ <h2>Architecture Files</h2>
107
+ <table>
108
+ <tr><th>File</th><th>Role</th></tr>
109
+ <tr><td><code>src/services/autonomous/taskQueue.ts</code></td><td>Persistent task queue with priorities, leases, dead-letter</td></tr>
110
+ <tr><td><code>src/services/autonomous/agentLoop.ts</code></td><td>Continuous 24/7 agent loop</td></tr>
111
+ <tr><td><code>src/services/autonomous/daemonMode.ts</code></td><td>Background daemon entry point</td></tr>
112
+ <tr><td><code>src/services/autonomous/supervisorIntegration.ts</code></td><td>Health checks, auto-respawn, state tracking</td></tr>
113
+ </table>
114
+
115
+ <footer class="footer">
116
+ <span>Clew Code 0.2.13 — Open Source</span>
117
+ <div class="footer-links">
118
+ <a href="https://github.com/ClewCode/ClewCode">GitHub</a>
119
+ <a href="https://github.com/ClewCode/ClewCode/issues">Issues</a>
120
+ </div>
121
+ </footer>
122
+ </main>
123
+ <nav class="toc-sidebar"></nav>
124
+ </div>
125
+ </div>
126
+ <script src="js/main.js"></script>
127
+ </body>
128
+ </html>
129
+
@@ -1,73 +1,73 @@
1
- <!DOCTYPE html>
2
- <html lang="th">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Daemon อัตโนมัติ — Clew</title>
7
- <meta name="description" content="การดำเนินการพื้นหลังอัตโนมัติ 24/7 — คิวงาน, วนซ้ำเอเจนต์, การรวมผู้ดูแล, และงานที่ทำซ้ำ">
8
- <link rel="preconnect" href="https://fonts.googleapis.com">
9
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
- <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap" rel="stylesheet">
11
- <link rel="stylesheet" href="css/styles.css">
12
- <link rel="icon" type="image/svg+xml" href="./assets/clew.svg">
13
- </head>
14
- <body>
15
- <header class="header"></header>
16
- <div class="app">
17
- <aside class="sidebar" id="sidebar"></aside>
18
- <div class="sidebar-overlay" id="sidebarOverlay"></div>
19
- <div class="content-wrap">
20
- <main class="content">
21
- <div class="breadcrumbs"><a href="index.th.html">หน้าแรก</a><span class="sep">/</span><span>โหมด Daemon</span></div>
22
- <h1>โหมด Daemon อัตโนมัติ</h1>
23
- <p class="section-subtitle">รัน Clew เป็น daemon พื้นหลัง 24/7 — คิวงาน, วนซ้ำเอเจนต์, การตรวจสอบสุขภาพ, และการเริ่มใหม่โดยอัตโนมัติ</p>
24
-
25
- <p>ระบบอัตโนมัติอยู่ใน <code>src/services/autonomous/</code> และประกอบด้วยสี่องค์ประกอบหลัก: <strong>คิวงาน</strong>, <strong>วนซ้ำเอเจนต์</strong>, <strong>จุดเข้า daemon</strong>, และ <strong>การรวมผู้ดูแล</strong></p>
26
-
27
- <h2>สถาปัตยกรรม</h2>
28
- <pre><code> + คิวงาน (taskQueue.ts)
29
- | คิวถาวรแบบไฟล์
30
- | ลำดับความสำคัญ การเช่า จดหมายตาย
31
- |
32
- + วนซ้ำเอเจนต์ (agentLoop.ts)
33
- | ดึงจากคิว สร้างเวิร์กเกอร์ ติดตาม ลองใหม่
34
- |
35
- + โหมด Daemon (daemonMode.ts)
36
- | จุดเข้ากระบวนการพื้นหลัง
37
- |
38
- + ผู้ดูแล (supervisorIntegration.ts)
39
- ตรวจสอบสุขภาพ เริ่มใหม่อัตโนมัติ ติดตามสถานะ</code></pre>
40
-
41
- <h2>คิวงาน</h2>
42
- <p>คิวถาวรแบบไฟล์ (<code>src/services/autonomous/taskQueue.ts</code>) เป็นรากฐานของระบบอัตโนมัติ:</p>
43
- <ul>
44
- <li><strong>ความคงทน</strong> — งานอยู่รอดการรีสตาร์ทกระบวนการผ่านการจัดเก็บในดิสก์</li>
45
- <li><strong>ลำดับความสำคัญ</strong> — งานเร่งด่วนข้ามคิวไปก่อน</li>
46
- <li><strong>การเช่า</strong> — งานถูกเช่าให้เวิร์กเกอร์พร้อม TTL; การเช่าที่หมดอายุถูกลองใหม่</li>
47
- <li><strong>จดหมายตาย</strong> — งานที่ใช้การลองจนหมดถูกย้ายไปตรวจสอบ</li>
48
- </ul>
49
-
50
- <h2>คำสั่ง</h2>
51
- <table>
52
- <tr><th>คำสั่ง</th><th>คำอธิบาย</th></tr>
53
- <tr><td><code>/daemon</code></td><td>เปิดแผงควบคุมแบบโต้ตอบ; คำสั่งย่อย: start, stop, status, restart</td></tr>
54
- <tr><td><code>/task</code></td><td>สร้างงานตามกำหนดการผ่านแบบฟอร์มโต้ตอบ</td></tr>
55
- <tr><td><code>/loop</code></td><td>รันคำสั่งซ้ำตามช่วงเวลา</td></tr>
56
- <tr><td><code>/agents</code></td><td>จัดการการตั้งค่าเอเจนต์และพูลเวิร์กเกอร์ daemon</td></tr>
57
- </table>
58
-
59
- <footer class="footer">
60
- <span>Clew Code v0.2.7 — โอเพนซอร์ส</span>
61
- <div class="footer-links">
62
- <a href="https://github.com/ClewCode/ClewCode">GitHub</a>
63
- <a href="https://github.com/ClewCode/ClewCode/issues">ปัญหา</a>
64
- </div>
65
- </footer>
66
- </main>
67
- <nav class="toc-sidebar"></nav>
68
- </div>
69
- </div>
70
- <script src="js/main.js"></script>
71
- </body>
72
- </html>
73
-
1
+ <!DOCTYPE html>
2
+ <html lang="th">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Daemon อัตโนมัติ — Clew</title>
7
+ <meta name="description" content="การดำเนินการพื้นหลังอัตโนมัติ 24/7 — คิวงาน, วนซ้ำเอเจนต์, การรวมผู้ดูแล, และงานที่ทำซ้ำ">
8
+ <link rel="preconnect" href="https://fonts.googleapis.com">
9
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10
+ <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&family=Noto+Sans+Thai:wght@400;500;600;700&display=swap" rel="stylesheet">
11
+ <link rel="stylesheet" href="css/styles.css">
12
+ <link rel="icon" type="image/svg+xml" href="./assets/clew.svg">
13
+ </head>
14
+ <body>
15
+ <header class="header"></header>
16
+ <div class="app">
17
+ <aside class="sidebar" id="sidebar"></aside>
18
+ <div class="sidebar-overlay" id="sidebarOverlay"></div>
19
+ <div class="content-wrap">
20
+ <main class="content">
21
+ <div class="breadcrumbs"><a href="index.th.html">หน้าแรก</a><span class="sep">/</span><span>โหมด Daemon</span></div>
22
+ <h1>โหมด Daemon อัตโนมัติ</h1>
23
+ <p class="section-subtitle">รัน Clew เป็น daemon พื้นหลัง 24/7 — คิวงาน, วนซ้ำเอเจนต์, การตรวจสอบสุขภาพ, และการเริ่มใหม่โดยอัตโนมัติ</p>
24
+
25
+ <p>ระบบอัตโนมัติอยู่ใน <code>src/services/autonomous/</code> และประกอบด้วยสี่องค์ประกอบหลัก: <strong>คิวงาน</strong>, <strong>วนซ้ำเอเจนต์</strong>, <strong>จุดเข้า daemon</strong>, และ <strong>การรวมผู้ดูแล</strong></p>
26
+
27
+ <h2>สถาปัตยกรรม</h2>
28
+ <pre><code> + คิวงาน (taskQueue.ts)
29
+ | คิวถาวรแบบไฟล์
30
+ | ลำดับความสำคัญ การเช่า จดหมายตาย
31
+ |
32
+ + วนซ้ำเอเจนต์ (agentLoop.ts)
33
+ | ดึงจากคิว สร้างเวิร์กเกอร์ ติดตาม ลองใหม่
34
+ |
35
+ + โหมด Daemon (daemonMode.ts)
36
+ | จุดเข้ากระบวนการพื้นหลัง
37
+ |
38
+ + ผู้ดูแล (supervisorIntegration.ts)
39
+ ตรวจสอบสุขภาพ เริ่มใหม่อัตโนมัติ ติดตามสถานะ</code></pre>
40
+
41
+ <h2>คิวงาน</h2>
42
+ <p>คิวถาวรแบบไฟล์ (<code>src/services/autonomous/taskQueue.ts</code>) เป็นรากฐานของระบบอัตโนมัติ:</p>
43
+ <ul>
44
+ <li><strong>ความคงทน</strong> — งานอยู่รอดการรีสตาร์ทกระบวนการผ่านการจัดเก็บในดิสก์</li>
45
+ <li><strong>ลำดับความสำคัญ</strong> — งานเร่งด่วนข้ามคิวไปก่อน</li>
46
+ <li><strong>การเช่า</strong> — งานถูกเช่าให้เวิร์กเกอร์พร้อม TTL; การเช่าที่หมดอายุถูกลองใหม่</li>
47
+ <li><strong>จดหมายตาย</strong> — งานที่ใช้การลองจนหมดถูกย้ายไปตรวจสอบ</li>
48
+ </ul>
49
+
50
+ <h2>คำสั่ง</h2>
51
+ <table>
52
+ <tr><th>คำสั่ง</th><th>คำอธิบาย</th></tr>
53
+ <tr><td><code>/daemon</code></td><td>เปิดแผงควบคุมแบบโต้ตอบ; คำสั่งย่อย: start, stop, status, restart</td></tr>
54
+ <tr><td><code>/task</code></td><td>สร้างงานตามกำหนดการผ่านแบบฟอร์มโต้ตอบ</td></tr>
55
+ <tr><td><code>/loop</code></td><td>รันคำสั่งซ้ำตามช่วงเวลา</td></tr>
56
+ <tr><td><code>/agents</code></td><td>จัดการการตั้งค่าเอเจนต์และพูลเวิร์กเกอร์ daemon</td></tr>
57
+ </table>
58
+
59
+ <footer class="footer">
60
+ <span>Clew Code 0.2.13 — โอเพนซอร์ส</span>
61
+ <div class="footer-links">
62
+ <a href="https://github.com/ClewCode/ClewCode">GitHub</a>
63
+ <a href="https://github.com/ClewCode/ClewCode/issues">ปัญหา</a>
64
+ </div>
65
+ </footer>
66
+ </main>
67
+ <nav class="toc-sidebar"></nav>
68
+ </div>
69
+ </div>
70
+ <script src="js/main.js"></script>
71
+ </body>
72
+ </html>
73
+