clew-code 0.2.6 → 0.2.8
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.
- package/README.md +292 -264
- package/dist/main.js +2835 -2950
- package/docs/architecture.html +148 -145
- package/docs/architecture.th.html +79 -78
- package/docs/clew-code-architecture.html +1125 -0
- package/docs/commands.html +224 -223
- package/docs/commands.th.html +131 -130
- package/docs/configuration.html +147 -145
- package/docs/configuration.th.html +108 -106
- package/docs/css/styles.css +48 -42
- package/docs/daemon.html +129 -128
- package/docs/daemon.th.html +73 -72
- package/docs/features/bridge-mode.html +99 -98
- package/docs/features/bridge-mode.th.html +90 -89
- package/docs/features/evals.html +182 -181
- package/docs/features/evals.th.html +90 -89
- package/docs/features/peer.html +178 -177
- package/docs/features/searxng-search.html +151 -150
- package/docs/features/searxng-search.th.html +95 -94
- package/docs/features/sentry-setup.html +157 -156
- package/docs/features/sentry-setup.th.html +97 -96
- package/docs/index.html +299 -298
- package/docs/index.th.html +292 -290
- package/docs/installation.html +105 -103
- package/docs/installation.th.html +105 -103
- package/docs/internals/growthbook-ab-testing.html +113 -112
- package/docs/internals/growthbook-ab-testing.th.html +81 -80
- package/docs/internals/hidden-features.html +149 -147
- package/docs/internals/hidden-features.th.html +109 -107
- package/docs/js/main.js +83 -3
- package/docs/loop.html +181 -180
- package/docs/loop.th.html +227 -226
- package/docs/mcp.html +247 -246
- package/docs/mcp.th.html +207 -206
- package/docs/models.html +111 -110
- package/docs/models.th.html +61 -60
- package/docs/peer.html +236 -235
- package/docs/peer.th.html +280 -279
- package/docs/permission-model.html +102 -101
- package/docs/permission-model.th.html +67 -66
- package/docs/plugins.html +102 -101
- package/docs/plugins.th.html +79 -78
- package/docs/providers.html +126 -117
- package/docs/providers.th.html +80 -78
- package/docs/quick-start.html +93 -92
- package/docs/quick-start.th.html +40 -39
- package/docs/research-memory.html +82 -79
- package/docs/research-memory.th.html +72 -71
- package/docs/skills.html +117 -116
- package/docs/skills.th.html +90 -89
- package/docs/tools.html +170 -169
- package/docs/tools.th.html +84 -83
- package/docs/troubleshooting.html +106 -105
- package/docs/troubleshooting.th.html +85 -84
- package/package.json +3 -1
- package/docs/taste.html +0 -436
- package/docs/taste.th.html +0 -236
package/docs/css/styles.css
CHANGED
|
@@ -8,36 +8,36 @@
|
|
|
8
8
|
|
|
9
9
|
/* ── Theme Variables ──────────────────────────────────────────────────── */
|
|
10
10
|
:root {
|
|
11
|
-
--bg-deep: #
|
|
12
|
-
--bg-primary: #
|
|
13
|
-
--bg-surface: #
|
|
14
|
-
--bg-card: #
|
|
15
|
-
--bg-hover: #
|
|
16
|
-
--bg-elevated: #
|
|
17
|
-
|
|
18
|
-
--text-primary: #
|
|
19
|
-
--text-secondary: #
|
|
20
|
-
--text-tertiary: #
|
|
21
|
-
--text-inverse: #
|
|
22
|
-
|
|
23
|
-
--accent: #
|
|
24
|
-
--accent-hover:#
|
|
25
|
-
--accent-muted:rgba(
|
|
26
|
-
--accent-glow: rgba(
|
|
27
|
-
|
|
28
|
-
--code-bg: #
|
|
29
|
-
--code-text: #
|
|
30
|
-
--code-border: rgba(
|
|
31
|
-
|
|
32
|
-
--border-subtle: rgba(
|
|
33
|
-
--border-default: rgba(
|
|
34
|
-
--border-accent: rgba(
|
|
35
|
-
|
|
36
|
-
--info: #
|
|
37
|
-
--info-bg: rgba(
|
|
38
|
-
--warn: #
|
|
11
|
+
--bg-deep: #07090d;
|
|
12
|
+
--bg-primary: #0b0e13;
|
|
13
|
+
--bg-surface: #11161d;
|
|
14
|
+
--bg-card: #151b24;
|
|
15
|
+
--bg-hover: #1b2430;
|
|
16
|
+
--bg-elevated: #202a36;
|
|
17
|
+
|
|
18
|
+
--text-primary: #eef2f6;
|
|
19
|
+
--text-secondary: #a7b1be;
|
|
20
|
+
--text-tertiary: #6f7b89;
|
|
21
|
+
--text-inverse: #071016;
|
|
22
|
+
|
|
23
|
+
--accent: #59d1c9;
|
|
24
|
+
--accent-hover:#79e1d9;
|
|
25
|
+
--accent-muted:rgba(89, 209, 201, 0.12);
|
|
26
|
+
--accent-glow: rgba(89, 209, 201, 0.2);
|
|
27
|
+
|
|
28
|
+
--code-bg: #080b10;
|
|
29
|
+
--code-text: #dce6ef;
|
|
30
|
+
--code-border: rgba(148, 163, 184, 0.16);
|
|
31
|
+
|
|
32
|
+
--border-subtle: rgba(148, 163, 184, 0.13);
|
|
33
|
+
--border-default: rgba(148, 163, 184, 0.22);
|
|
34
|
+
--border-accent: rgba(89, 209, 201, 0.34);
|
|
35
|
+
|
|
36
|
+
--info: #70a8ff;
|
|
37
|
+
--info-bg: rgba(112, 168, 255, 0.08);
|
|
38
|
+
--warn: #f3bc5f;
|
|
39
39
|
--warn-bg: rgba(244, 168, 88, 0.08);
|
|
40
|
-
--tip: #
|
|
40
|
+
--tip: #72d38f;
|
|
41
41
|
--tip-bg: rgba(88, 196, 124, 0.08);
|
|
42
42
|
--danger: #e85454;
|
|
43
43
|
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
--text-lg: 1.125rem;
|
|
52
52
|
--text-xl: 1.5rem;
|
|
53
53
|
--text-2xl: 2rem;
|
|
54
|
-
--text-3xl:
|
|
54
|
+
--text-3xl: 3.1rem;
|
|
55
55
|
|
|
56
56
|
--leading-tight: 1.2;
|
|
57
57
|
--leading-normal: 1.6;
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
--header-h: 56px;
|
|
73
73
|
--sidebar-w: 260px;
|
|
74
74
|
--toc-w: 220px;
|
|
75
|
-
--content-max:
|
|
75
|
+
--content-max: 900px;
|
|
76
76
|
|
|
77
77
|
--z-header: 100;
|
|
78
78
|
--z-sidebar: 90;
|
|
@@ -91,7 +91,9 @@ body {
|
|
|
91
91
|
font-size: var(--text-base);
|
|
92
92
|
line-height: var(--leading-normal);
|
|
93
93
|
color: var(--text-primary);
|
|
94
|
-
background:
|
|
94
|
+
background:
|
|
95
|
+
linear-gradient(180deg, rgba(21, 27, 36, 0.98) 0%, var(--bg-primary) 240px),
|
|
96
|
+
var(--bg-primary);
|
|
95
97
|
min-height: 100vh;
|
|
96
98
|
}
|
|
97
99
|
|
|
@@ -132,7 +134,7 @@ kbd {
|
|
|
132
134
|
top: 0; left: 0; right: 0;
|
|
133
135
|
height: var(--header-h);
|
|
134
136
|
z-index: var(--z-header);
|
|
135
|
-
background: rgba(
|
|
137
|
+
background: rgba(7, 9, 13, 0.86);
|
|
136
138
|
backdrop-filter: blur(16px);
|
|
137
139
|
-webkit-backdrop-filter: blur(16px);
|
|
138
140
|
border-bottom: 1px solid var(--border-subtle);
|
|
@@ -157,7 +159,7 @@ kbd {
|
|
|
157
159
|
font-size: 1rem;
|
|
158
160
|
color: var(--text-primary);
|
|
159
161
|
text-decoration: none;
|
|
160
|
-
letter-spacing:
|
|
162
|
+
letter-spacing: 0;
|
|
161
163
|
}
|
|
162
164
|
.logo:hover { opacity: 0.85; text-decoration: none; }
|
|
163
165
|
|
|
@@ -219,7 +221,9 @@ kbd {
|
|
|
219
221
|
top: var(--header-h); left: 0; bottom: 0;
|
|
220
222
|
width: var(--sidebar-w);
|
|
221
223
|
z-index: var(--z-sidebar);
|
|
222
|
-
background:
|
|
224
|
+
background: rgba(12, 16, 22, 0.96);
|
|
225
|
+
backdrop-filter: blur(16px);
|
|
226
|
+
-webkit-backdrop-filter: blur(16px);
|
|
223
227
|
border-right: 1px solid var(--border-subtle);
|
|
224
228
|
overflow-y: auto;
|
|
225
229
|
padding: var(--space-lg) 0 var(--space-2xl);
|
|
@@ -343,7 +347,7 @@ kbd {
|
|
|
343
347
|
font-family: var(--font-display);
|
|
344
348
|
font-size: var(--text-2xl);
|
|
345
349
|
font-weight: 700;
|
|
346
|
-
letter-spacing:
|
|
350
|
+
letter-spacing: 0;
|
|
347
351
|
margin-bottom: var(--space-sm);
|
|
348
352
|
color: var(--text-primary);
|
|
349
353
|
}
|
|
@@ -352,7 +356,7 @@ kbd {
|
|
|
352
356
|
font-family: var(--font-display);
|
|
353
357
|
font-size: var(--text-xl);
|
|
354
358
|
font-weight: 700;
|
|
355
|
-
letter-spacing:
|
|
359
|
+
letter-spacing: 0;
|
|
356
360
|
margin: var(--space-2xl) 0 var(--space-md);
|
|
357
361
|
color: var(--text-primary);
|
|
358
362
|
}
|
|
@@ -543,7 +547,7 @@ kbd {
|
|
|
543
547
|
font-size: var(--text-3xl);
|
|
544
548
|
font-weight: 700;
|
|
545
549
|
line-height: var(--leading-tight);
|
|
546
|
-
letter-spacing:
|
|
550
|
+
letter-spacing: 0;
|
|
547
551
|
margin-bottom: var(--space-md);
|
|
548
552
|
color: var(--text-primary);
|
|
549
553
|
}
|
|
@@ -612,7 +616,7 @@ kbd {
|
|
|
612
616
|
.feature-card {
|
|
613
617
|
padding: var(--space-lg);
|
|
614
618
|
border-radius: 8px;
|
|
615
|
-
background:
|
|
619
|
+
background: rgba(21, 27, 36, 0.9);
|
|
616
620
|
border: 1px solid var(--border-subtle);
|
|
617
621
|
transition: all var(--duration-base) ease;
|
|
618
622
|
}
|
|
@@ -659,7 +663,7 @@ kbd {
|
|
|
659
663
|
text-align: center;
|
|
660
664
|
padding: var(--space-lg) var(--space-md);
|
|
661
665
|
border-radius: 8px;
|
|
662
|
-
background:
|
|
666
|
+
background: rgba(21, 27, 36, 0.9);
|
|
663
667
|
border: 1px solid var(--border-subtle);
|
|
664
668
|
}
|
|
665
669
|
|
|
@@ -667,7 +671,7 @@ kbd {
|
|
|
667
671
|
font-family: var(--font-display);
|
|
668
672
|
font-size: 1.75rem;
|
|
669
673
|
font-weight: 700;
|
|
670
|
-
letter-spacing:
|
|
674
|
+
letter-spacing: 0;
|
|
671
675
|
color: var(--accent);
|
|
672
676
|
line-height: 1.1;
|
|
673
677
|
margin-bottom: 4px;
|
|
@@ -682,6 +686,7 @@ kbd {
|
|
|
682
686
|
border-radius: 8px;
|
|
683
687
|
overflow: hidden;
|
|
684
688
|
margin: var(--space-xl) 0;
|
|
689
|
+
box-shadow: 0 18px 60px rgba(0, 0, 0, 0.24);
|
|
685
690
|
}
|
|
686
691
|
|
|
687
692
|
.terminal-bar {
|
|
@@ -712,9 +717,10 @@ kbd {
|
|
|
712
717
|
line-height: 1.6;
|
|
713
718
|
color: var(--code-text);
|
|
714
719
|
overflow-x: auto;
|
|
720
|
+
white-space: pre;
|
|
715
721
|
}
|
|
716
722
|
|
|
717
|
-
.terminal-body .line { display: block; white-space: pre
|
|
723
|
+
.terminal-body .line { display: block; white-space: pre; }
|
|
718
724
|
.terminal-body .prompt { color: var(--accent); }
|
|
719
725
|
.terminal-body .cmd { color: var(--text-primary); }
|
|
720
726
|
.terminal-body .output { color: var(--text-tertiary); }
|
package/docs/daemon.html
CHANGED
|
@@ -1,128 +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
|
|
7
|
-
<meta name="description" content="24/7 autonomous background execution
|
|
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
|
|
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>
|
|
45
|
-
<li><strong>Priorities</strong>
|
|
46
|
-
<li><strong>Leases</strong>
|
|
47
|
-
<li><strong>Dead-letter</strong>
|
|
48
|
-
<li><strong>Scheduling</strong>
|
|
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>
|
|
55
|
-
<li><strong>Spawn worker</strong>
|
|
56
|
-
<li><strong>Monitor</strong>
|
|
57
|
-
<li><strong>Retry or complete</strong>
|
|
58
|
-
<li><strong>Repeat</strong>
|
|
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>
|
|
74
|
-
<li><strong>Auto-respawn</strong>
|
|
75
|
-
<li><strong>State tracking</strong>
|
|
76
|
-
<li><strong>Graceful degradation</strong>
|
|
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>
|
|
94
|
-
<li><strong>Session-only</strong>
|
|
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.
|
|
117
|
-
<div class="footer-links">
|
|
118
|
-
<a href="https://github.com/
|
|
119
|
-
<a href="https://github.com/
|
|
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>
|
|
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
|
+
|
package/docs/daemon.th.html
CHANGED
|
@@ -1,72 +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
|
|
7
|
-
<meta name="description" content="
|
|
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"
|
|
22
|
-
<h1
|
|
23
|
-
<p class="section-subtitle"
|
|
24
|
-
|
|
25
|
-
<p
|
|
26
|
-
|
|
27
|
-
<h2
|
|
28
|
-
<pre><code> +
|
|
29
|
-
|
|
|
30
|
-
|
|
|
31
|
-
|
|
|
32
|
-
+
|
|
33
|
-
|
|
|
34
|
-
|
|
|
35
|
-
+
|
|
36
|
-
|
|
|
37
|
-
|
|
|
38
|
-
+
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<h2
|
|
42
|
-
<p
|
|
43
|
-
<ul>
|
|
44
|
-
<li><strong
|
|
45
|
-
<li><strong
|
|
46
|
-
<li><strong
|
|
47
|
-
<li><strong
|
|
48
|
-
</ul>
|
|
49
|
-
|
|
50
|
-
<h2
|
|
51
|
-
<table>
|
|
52
|
-
<tr><th
|
|
53
|
-
<tr><td><code>/daemon</code></td><td
|
|
54
|
-
<tr><td><code>/task</code></td><td
|
|
55
|
-
<tr><td><code>/loop</code></td><td
|
|
56
|
-
<tr><td><code>/agents</code></td><td
|
|
57
|
-
</table>
|
|
58
|
-
|
|
59
|
-
<footer class="footer">
|
|
60
|
-
<span>Clew Code v0.2.
|
|
61
|
-
<div class="footer-links">
|
|
62
|
-
<a href="https://github.com/
|
|
63
|
-
<a href="https://github.com/
|
|
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>
|
|
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
|
+
|