@esotech/contextuate 2.0.0 → 2.1.0
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 +169 -1
- package/dist/commands/claude.d.ts +21 -0
- package/dist/commands/claude.js +213 -0
- package/dist/commands/context.d.ts +1 -0
- package/dist/commands/create.d.ts +3 -0
- package/dist/commands/index.d.ts +4 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.js +67 -6
- package/dist/commands/install.d.ts +28 -0
- package/dist/commands/install.js +116 -11
- package/dist/commands/monitor.d.ts +55 -0
- package/dist/commands/monitor.js +1007 -0
- package/dist/commands/remove.d.ts +3 -0
- package/dist/commands/run.d.ts +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +113 -1
- package/dist/monitor/daemon/circuit-breaker.d.ts +121 -0
- package/dist/monitor/daemon/circuit-breaker.js +552 -0
- package/dist/monitor/daemon/cli.d.ts +8 -0
- package/dist/monitor/daemon/cli.js +82 -0
- package/dist/monitor/daemon/index.d.ts +137 -0
- package/dist/monitor/daemon/index.js +695 -0
- package/dist/monitor/daemon/notifier.d.ts +25 -0
- package/dist/monitor/daemon/notifier.js +98 -0
- package/dist/monitor/daemon/processor.d.ts +89 -0
- package/dist/monitor/daemon/processor.js +455 -0
- package/dist/monitor/daemon/state.d.ts +80 -0
- package/dist/monitor/daemon/state.js +162 -0
- package/dist/monitor/daemon/watcher.d.ts +47 -0
- package/dist/monitor/daemon/watcher.js +171 -0
- package/dist/monitor/daemon/wrapper-manager.d.ts +106 -0
- package/dist/monitor/daemon/wrapper-manager.js +374 -0
- package/dist/monitor/hooks/emit-event.js +652 -0
- package/dist/monitor/persistence/file-store.d.ts +88 -0
- package/dist/monitor/persistence/file-store.js +335 -0
- package/dist/monitor/persistence/index.d.ts +7 -0
- package/dist/monitor/persistence/index.js +10 -0
- package/dist/monitor/server/adapters/redis.d.ts +38 -0
- package/dist/monitor/server/adapters/redis.js +213 -0
- package/dist/monitor/server/adapters/unix-socket.d.ts +33 -0
- package/dist/monitor/server/adapters/unix-socket.js +182 -0
- package/dist/monitor/server/broker.d.ts +135 -0
- package/dist/monitor/server/broker.js +475 -0
- package/dist/monitor/server/cli.d.ts +8 -0
- package/dist/monitor/server/cli.js +98 -0
- package/dist/monitor/server/fastify.d.ts +16 -0
- package/dist/monitor/server/fastify.js +184 -0
- package/dist/monitor/server/index.d.ts +36 -0
- package/dist/monitor/server/index.js +153 -0
- package/dist/monitor/server/websocket.d.ts +80 -0
- package/dist/monitor/server/websocket.js +453 -0
- package/dist/monitor/ui/assets/index-4IssW9On.js +59 -0
- package/dist/monitor/ui/assets/index-vo9hLe5R.css +32 -0
- package/dist/monitor/ui/favicon.png +0 -0
- package/dist/monitor/ui/index.html +14 -0
- package/dist/monitor/ui/logo.png +0 -0
- package/dist/monitor/ui/logo.svg +1 -0
- package/dist/runtime/driver.d.ts +16 -0
- package/dist/runtime/tools.d.ts +10 -0
- package/dist/templates/README.md +33 -7
- package/dist/templates/agents/aegis.md +4 -0
- package/dist/templates/agents/archon.md +13 -22
- package/dist/templates/agents/atlas.md +4 -0
- package/dist/templates/agents/canvas.md +4 -0
- package/dist/templates/agents/chronicle.md +4 -0
- package/dist/templates/agents/chronos.md +4 -0
- package/dist/templates/agents/cipher.md +4 -0
- package/dist/templates/agents/crucible.md +4 -0
- package/dist/templates/agents/echo.md +4 -0
- package/dist/templates/agents/forge.md +4 -0
- package/dist/templates/agents/ledger.md +4 -0
- package/dist/templates/agents/meridian.md +4 -0
- package/dist/templates/agents/nexus.md +4 -0
- package/dist/templates/agents/pythia.md +217 -0
- package/dist/templates/agents/scribe.md +4 -0
- package/dist/templates/agents/sentinel.md +4 -0
- package/dist/templates/agents/{oracle.md → thoth.md} +11 -7
- package/dist/templates/agents/unity.md +4 -0
- package/dist/templates/agents/vox.md +4 -0
- package/dist/templates/agents/weaver.md +4 -0
- package/dist/templates/framework-agents/documentation-expert.md +3 -3
- package/dist/templates/framework-agents/tools-expert.md +8 -8
- package/dist/templates/skills/consult.md +138 -0
- package/dist/templates/skills/orchestrate.md +173 -0
- package/dist/templates/skills/pythia.md +37 -0
- package/dist/templates/standards/agent-roles.md +68 -21
- package/dist/templates/standards/coding-standards.md +9 -26
- package/dist/templates/templates/context.md +17 -2
- package/dist/templates/templates/contextuate.md +21 -28
- package/dist/templates/templates/standards/go.md +167 -0
- package/dist/templates/templates/standards/java.md +167 -0
- package/dist/templates/templates/standards/javascript.md +292 -0
- package/dist/templates/templates/standards/php.md +181 -0
- package/dist/templates/templates/standards/python.md +175 -0
- package/dist/templates/tools/agent-creator.md +252 -0
- package/dist/templates/tools/agent-creator.tool.md +2 -2
- package/dist/templates/tools/quickref.md +216 -0
- package/dist/templates/tools/spawn.md +31 -0
- package/dist/templates/tools/standards-detector.md +301 -0
- package/dist/templates/version.json +1 -1
- package/dist/types/monitor.d.ts +660 -0
- package/dist/types/monitor.js +75 -0
- package/dist/utils/git.d.ts +9 -0
- package/dist/utils/tokens.d.ts +10 -0
- package/package.json +18 -5
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monitor Daemon
|
|
3
|
+
*
|
|
4
|
+
* Background daemon process that:
|
|
5
|
+
* - Watches raw/ directory for new events
|
|
6
|
+
* - Processes events (correlates sessions, tracks subagents)
|
|
7
|
+
* - Persists data to sessions/
|
|
8
|
+
* - Notifies UI server via Unix socket/Redis
|
|
9
|
+
* - Manages Claude wrapper sessions with PTY
|
|
10
|
+
*
|
|
11
|
+
* This is Layer 2 of the 3-layer architecture:
|
|
12
|
+
* Layer 1: Hooks (write to raw/)
|
|
13
|
+
* Layer 2: Daemon (process raw/ -> sessions/)
|
|
14
|
+
* Layer 3: UI Server (read from sessions/, serve WebSocket)
|
|
15
|
+
*/
|
|
16
|
+
import { MonitorConfig, CircuitBreakerConfig } from '../../types/monitor.js';
|
|
17
|
+
import { CircuitBreaker } from './circuit-breaker.js';
|
|
18
|
+
export declare class MonitorDaemon {
|
|
19
|
+
private config;
|
|
20
|
+
private state;
|
|
21
|
+
private watcher;
|
|
22
|
+
private processor;
|
|
23
|
+
private notifier;
|
|
24
|
+
private socketServer;
|
|
25
|
+
private uiClients;
|
|
26
|
+
private legacyWrapperSessions;
|
|
27
|
+
private wrapperManager;
|
|
28
|
+
private circuitBreaker;
|
|
29
|
+
private running;
|
|
30
|
+
constructor(config: MonitorConfig, circuitBreakerConfig?: Partial<CircuitBreakerConfig>);
|
|
31
|
+
/**
|
|
32
|
+
* Handle circuit breaker alerts
|
|
33
|
+
*/
|
|
34
|
+
private handleCircuitAlert;
|
|
35
|
+
/**
|
|
36
|
+
* Handle events from WrapperManager
|
|
37
|
+
*/
|
|
38
|
+
private handleWrapperManagerEvent;
|
|
39
|
+
/**
|
|
40
|
+
* Broadcast data to all connected UI clients
|
|
41
|
+
*/
|
|
42
|
+
private broadcastToClients;
|
|
43
|
+
/**
|
|
44
|
+
* Start the daemon
|
|
45
|
+
*/
|
|
46
|
+
start(): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Stop the daemon
|
|
49
|
+
*/
|
|
50
|
+
stop(): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* Check if daemon is running
|
|
53
|
+
*/
|
|
54
|
+
isRunning(): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Start Unix socket server for hook notifications and UI clients
|
|
57
|
+
*/
|
|
58
|
+
private startSocketServer;
|
|
59
|
+
/**
|
|
60
|
+
* Handle wrapper registration (legacy external wrapper process)
|
|
61
|
+
*/
|
|
62
|
+
private handleWrapperRegister;
|
|
63
|
+
/**
|
|
64
|
+
* Handle wrapper started notification (legacy)
|
|
65
|
+
*/
|
|
66
|
+
private handleWrapperStarted;
|
|
67
|
+
/**
|
|
68
|
+
* Handle wrapper ended notification (legacy)
|
|
69
|
+
*/
|
|
70
|
+
private handleWrapperEnded;
|
|
71
|
+
/**
|
|
72
|
+
* Handle wrapper state change (legacy)
|
|
73
|
+
*/
|
|
74
|
+
private handleWrapperStateChange;
|
|
75
|
+
/**
|
|
76
|
+
* Handle wrapper output (for legacy external wrappers)
|
|
77
|
+
*/
|
|
78
|
+
private handleWrapperOutput;
|
|
79
|
+
/**
|
|
80
|
+
* Handle input injection request from UI
|
|
81
|
+
*/
|
|
82
|
+
private handleInputInjection;
|
|
83
|
+
/**
|
|
84
|
+
* Handle resize request from UI
|
|
85
|
+
*/
|
|
86
|
+
private handleWrapperResize;
|
|
87
|
+
/**
|
|
88
|
+
* Handle spawn wrapper request
|
|
89
|
+
*/
|
|
90
|
+
private handleSpawnWrapper;
|
|
91
|
+
/**
|
|
92
|
+
* Handle kill wrapper request
|
|
93
|
+
*/
|
|
94
|
+
private handleKillWrapper;
|
|
95
|
+
/**
|
|
96
|
+
* Handle get wrappers request
|
|
97
|
+
*/
|
|
98
|
+
private handleGetWrappers;
|
|
99
|
+
/**
|
|
100
|
+
* Check if a hook event indicates waiting for input
|
|
101
|
+
* and notify relevant wrapper
|
|
102
|
+
*/
|
|
103
|
+
private checkAndNotifyWrapperState;
|
|
104
|
+
/**
|
|
105
|
+
* Handle get circuit health request
|
|
106
|
+
*/
|
|
107
|
+
private handleGetCircuitHealth;
|
|
108
|
+
/**
|
|
109
|
+
* Handle get session health request
|
|
110
|
+
*/
|
|
111
|
+
private handleGetSessionHealth;
|
|
112
|
+
/**
|
|
113
|
+
* Handle reset circuit request
|
|
114
|
+
*/
|
|
115
|
+
private handleResetCircuit;
|
|
116
|
+
/**
|
|
117
|
+
* Handle update circuit config request
|
|
118
|
+
*/
|
|
119
|
+
private handleUpdateCircuitConfig;
|
|
120
|
+
/**
|
|
121
|
+
* Get the circuit breaker instance (for external access)
|
|
122
|
+
*/
|
|
123
|
+
getCircuitBreaker(): CircuitBreaker;
|
|
124
|
+
/**
|
|
125
|
+
* Get list of active wrapper sessions (for UI)
|
|
126
|
+
*/
|
|
127
|
+
getWrapperSessions(): Array<{
|
|
128
|
+
wrapperId: string;
|
|
129
|
+
state: string;
|
|
130
|
+
claudeSessionId: string | null;
|
|
131
|
+
managed: boolean;
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Start the daemon (exported for CLI)
|
|
136
|
+
*/
|
|
137
|
+
export declare function startDaemon(config: MonitorConfig): Promise<MonitorDaemon>;
|