cyrus-ai 0.1.58 → 0.2.0-rc
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/dist/app.js +166 -2
- package/dist/app.js.map +1 -1
- package/dist/src/Application.d.ts +69 -0
- package/dist/src/Application.d.ts.map +1 -0
- package/dist/src/Application.js +273 -0
- package/dist/src/Application.js.map +1 -0
- package/dist/src/app.d.ts +3 -0
- package/dist/src/app.d.ts.map +1 -0
- package/dist/src/app.js +101 -0
- package/dist/src/app.js.map +1 -0
- package/dist/src/commands/AuthCommand.d.ts +8 -0
- package/dist/src/commands/AuthCommand.d.ts.map +1 -0
- package/dist/src/commands/AuthCommand.js +69 -0
- package/dist/src/commands/AuthCommand.js.map +1 -0
- package/dist/src/commands/CheckTokensCommand.d.ts +8 -0
- package/dist/src/commands/CheckTokensCommand.d.ts.map +1 -0
- package/dist/src/commands/CheckTokensCommand.js +53 -0
- package/dist/src/commands/CheckTokensCommand.js.map +1 -0
- package/dist/src/commands/ICommand.d.ts +38 -0
- package/dist/src/commands/ICommand.d.ts.map +1 -0
- package/dist/src/commands/ICommand.js +37 -0
- package/dist/src/commands/ICommand.js.map +1 -0
- package/dist/src/commands/RefreshTokenCommand.d.ts +8 -0
- package/dist/src/commands/RefreshTokenCommand.d.ts.map +1 -0
- package/dist/src/commands/RefreshTokenCommand.js +152 -0
- package/dist/src/commands/RefreshTokenCommand.js.map +1 -0
- package/dist/src/commands/StartCommand.d.ts +8 -0
- package/dist/src/commands/StartCommand.d.ts.map +1 -0
- package/dist/src/commands/StartCommand.js +70 -0
- package/dist/src/commands/StartCommand.js.map +1 -0
- package/dist/src/config/constants.d.ts +12 -0
- package/dist/src/config/constants.d.ts.map +1 -0
- package/dist/src/config/constants.js +19 -0
- package/dist/src/config/constants.js.map +1 -0
- package/dist/src/config/types.d.ts +21 -0
- package/dist/src/config/types.d.ts.map +1 -0
- package/dist/src/config/types.js +2 -0
- package/dist/src/config/types.js.map +1 -0
- package/dist/src/services/ConfigService.d.ts +32 -0
- package/dist/src/services/ConfigService.d.ts.map +1 -0
- package/dist/src/services/ConfigService.js +72 -0
- package/dist/src/services/ConfigService.js.map +1 -0
- package/dist/src/services/GitService.d.ts +28 -0
- package/dist/src/services/GitService.d.ts.map +1 -0
- package/dist/src/services/GitService.js +339 -0
- package/dist/src/services/GitService.js.map +1 -0
- package/dist/src/services/Logger.d.ts +88 -0
- package/dist/src/services/Logger.d.ts.map +1 -0
- package/dist/src/services/Logger.js +146 -0
- package/dist/src/services/Logger.js.map +1 -0
- package/dist/src/services/WorkerService.d.ts +53 -0
- package/dist/src/services/WorkerService.d.ts.map +1 -0
- package/dist/src/services/WorkerService.js +173 -0
- package/dist/src/services/WorkerService.js.map +1 -0
- package/dist/src/ui/CLIPrompts.d.ts +18 -0
- package/dist/src/ui/CLIPrompts.d.ts.map +1 -0
- package/dist/src/ui/CLIPrompts.js +53 -0
- package/dist/src/ui/CLIPrompts.js.map +1 -0
- package/package.json +10 -9
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { EdgeWorker } from "cyrus-edge-worker";
|
|
2
|
+
import { DEFAULT_SERVER_PORT, parsePort } from "../config/constants.js";
|
|
3
|
+
/**
|
|
4
|
+
* Service responsible for EdgeWorker and Cloudflare tunnel management
|
|
5
|
+
*/
|
|
6
|
+
export class WorkerService {
|
|
7
|
+
configService;
|
|
8
|
+
gitService;
|
|
9
|
+
cyrusHome;
|
|
10
|
+
logger;
|
|
11
|
+
edgeWorker = null;
|
|
12
|
+
setupWaitingServer = null; // SharedApplicationServer instance during setup waiting mode
|
|
13
|
+
isShuttingDown = false;
|
|
14
|
+
constructor(configService, gitService, cyrusHome, logger) {
|
|
15
|
+
this.configService = configService;
|
|
16
|
+
this.gitService = gitService;
|
|
17
|
+
this.cyrusHome = cyrusHome;
|
|
18
|
+
this.logger = logger;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Get the EdgeWorker instance
|
|
22
|
+
*/
|
|
23
|
+
getEdgeWorker() {
|
|
24
|
+
return this.edgeWorker;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Get the server port from EdgeWorker
|
|
28
|
+
*/
|
|
29
|
+
getServerPort() {
|
|
30
|
+
return this.edgeWorker?.getServerPort() || DEFAULT_SERVER_PORT;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Start setup waiting mode - server infrastructure only, no EdgeWorker
|
|
34
|
+
* Used after initial authentication while waiting for server configuration
|
|
35
|
+
*/
|
|
36
|
+
async startSetupWaitingMode() {
|
|
37
|
+
const { SharedApplicationServer } = await import("cyrus-edge-worker");
|
|
38
|
+
const { ConfigUpdater } = await import("cyrus-config-updater");
|
|
39
|
+
// Determine server configuration
|
|
40
|
+
const isExternalHost = process.env.CYRUS_HOST_EXTERNAL?.toLowerCase().trim() === "true";
|
|
41
|
+
const serverPort = parsePort(process.env.CYRUS_SERVER_PORT, DEFAULT_SERVER_PORT);
|
|
42
|
+
const serverHost = isExternalHost ? "0.0.0.0" : "localhost";
|
|
43
|
+
// Create and start SharedApplicationServer
|
|
44
|
+
this.setupWaitingServer = new SharedApplicationServer(serverPort, serverHost);
|
|
45
|
+
this.setupWaitingServer.initializeFastify();
|
|
46
|
+
// Register ConfigUpdater routes
|
|
47
|
+
const configUpdater = new ConfigUpdater(this.setupWaitingServer.getFastifyInstance(), this.cyrusHome, process.env.CYRUS_API_KEY || "");
|
|
48
|
+
configUpdater.register();
|
|
49
|
+
this.logger.info("✅ Config updater registered");
|
|
50
|
+
this.logger.info(" Routes: /api/update/cyrus-config, /api/update/cyrus-env,");
|
|
51
|
+
this.logger.info(" /api/update/repository, /api/test-mcp, /api/configure-mcp");
|
|
52
|
+
// Start the server (this also starts Cloudflare tunnel if CLOUDFLARE_TOKEN is set)
|
|
53
|
+
await this.setupWaitingServer.start();
|
|
54
|
+
this.logger.raw("");
|
|
55
|
+
this.logger.divider(70);
|
|
56
|
+
this.logger.info("⏳ Waiting for configuration from server...");
|
|
57
|
+
this.logger.info(`🔗 Server running on port ${serverPort}`);
|
|
58
|
+
if (process.env.CLOUDFLARE_TOKEN) {
|
|
59
|
+
this.logger.info("🌩️ Cloudflare tunnel: Active");
|
|
60
|
+
}
|
|
61
|
+
this.logger.info("📡 Config updater: Ready");
|
|
62
|
+
this.logger.raw("");
|
|
63
|
+
this.logger.info("Your Cyrus instance is ready to receive configuration.");
|
|
64
|
+
this.logger.info("Complete setup at: https://app.atcyrus.com/onboarding");
|
|
65
|
+
this.logger.divider(70);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Stop the setup waiting mode server
|
|
69
|
+
* Must be called before starting EdgeWorker to avoid port conflicts
|
|
70
|
+
*/
|
|
71
|
+
async stopSetupWaitingMode() {
|
|
72
|
+
if (this.setupWaitingServer) {
|
|
73
|
+
this.logger.info("🛑 Stopping setup waiting mode server...");
|
|
74
|
+
await this.setupWaitingServer.stop();
|
|
75
|
+
this.setupWaitingServer = null;
|
|
76
|
+
this.logger.info("✅ Setup waiting mode server stopped");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Start the EdgeWorker with given configuration
|
|
81
|
+
*/
|
|
82
|
+
async startEdgeWorker(params) {
|
|
83
|
+
const { repositories, ngrokAuthToken, onOAuthCallback } = params;
|
|
84
|
+
// Determine if using external host
|
|
85
|
+
const isExternalHost = process.env.CYRUS_HOST_EXTERNAL?.toLowerCase().trim() === "true";
|
|
86
|
+
// Load config once for model defaults
|
|
87
|
+
const edgeConfig = this.configService.load();
|
|
88
|
+
// Create EdgeWorker configuration
|
|
89
|
+
const config = {
|
|
90
|
+
repositories,
|
|
91
|
+
cyrusHome: this.cyrusHome,
|
|
92
|
+
defaultAllowedTools: process.env.ALLOWED_TOOLS?.split(",").map((t) => t.trim()) || [],
|
|
93
|
+
defaultDisallowedTools: process.env.DISALLOWED_TOOLS?.split(",").map((t) => t.trim()) ||
|
|
94
|
+
undefined,
|
|
95
|
+
// Model configuration: environment variables take precedence over config file
|
|
96
|
+
defaultModel: process.env.CYRUS_DEFAULT_MODEL || edgeConfig.defaultModel,
|
|
97
|
+
defaultFallbackModel: process.env.CYRUS_DEFAULT_FALLBACK_MODEL ||
|
|
98
|
+
edgeConfig.defaultFallbackModel,
|
|
99
|
+
webhookBaseUrl: process.env.CYRUS_BASE_URL,
|
|
100
|
+
serverPort: parsePort(process.env.CYRUS_SERVER_PORT, DEFAULT_SERVER_PORT),
|
|
101
|
+
serverHost: isExternalHost ? "0.0.0.0" : "localhost",
|
|
102
|
+
ngrokAuthToken,
|
|
103
|
+
features: {
|
|
104
|
+
enableContinuation: true,
|
|
105
|
+
},
|
|
106
|
+
handlers: {
|
|
107
|
+
createWorkspace: async (issue, repository) => {
|
|
108
|
+
return this.gitService.createGitWorktree(issue, repository, edgeConfig.global_setup_script);
|
|
109
|
+
},
|
|
110
|
+
onOAuthCallback,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
// Create and start EdgeWorker
|
|
114
|
+
this.edgeWorker = new EdgeWorker(config);
|
|
115
|
+
// Set config path for dynamic reloading
|
|
116
|
+
const configPath = this.configService.getConfigPath();
|
|
117
|
+
this.edgeWorker.setConfigPath(configPath);
|
|
118
|
+
// Set up event handlers
|
|
119
|
+
this.setupEventHandlers();
|
|
120
|
+
// Start the worker
|
|
121
|
+
await this.edgeWorker.start();
|
|
122
|
+
this.logger.success("Edge worker started successfully");
|
|
123
|
+
this.logger.info(`Managing ${repositories.length} repositories:`);
|
|
124
|
+
repositories.forEach((repo) => {
|
|
125
|
+
this.logger.info(` - ${repo.name} (${repo.repositoryPath})`);
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Set up event handlers for EdgeWorker
|
|
130
|
+
*/
|
|
131
|
+
setupEventHandlers() {
|
|
132
|
+
if (!this.edgeWorker)
|
|
133
|
+
return;
|
|
134
|
+
// Session events
|
|
135
|
+
this.edgeWorker.on("session:started", (issueId, _issue, repositoryId) => {
|
|
136
|
+
this.logger.info(`Started session for issue ${issueId} in repository ${repositoryId}`);
|
|
137
|
+
});
|
|
138
|
+
this.edgeWorker.on("session:ended", (issueId, exitCode, repositoryId) => {
|
|
139
|
+
this.logger.info(`Session for issue ${issueId} ended with exit code ${exitCode} in repository ${repositoryId}`);
|
|
140
|
+
});
|
|
141
|
+
// Connection events
|
|
142
|
+
this.edgeWorker.on("connected", (token) => {
|
|
143
|
+
this.logger.success(`Connected to proxy with token ending in ...${token.slice(-4)}`);
|
|
144
|
+
});
|
|
145
|
+
this.edgeWorker.on("disconnected", (token, reason) => {
|
|
146
|
+
this.logger.error(`Disconnected from proxy (token ...${token.slice(-4)}): ${reason || "Unknown reason"}`);
|
|
147
|
+
});
|
|
148
|
+
// Error events
|
|
149
|
+
this.edgeWorker.on("error", (error) => {
|
|
150
|
+
this.logger.error(`EdgeWorker error: ${error.message}`);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Stop the EdgeWorker
|
|
155
|
+
*/
|
|
156
|
+
async stop() {
|
|
157
|
+
if (this.isShuttingDown)
|
|
158
|
+
return;
|
|
159
|
+
this.isShuttingDown = true;
|
|
160
|
+
this.logger.info("\nShutting down edge worker...");
|
|
161
|
+
// Stop setup waiting mode server if still running
|
|
162
|
+
if (this.setupWaitingServer) {
|
|
163
|
+
await this.setupWaitingServer.stop();
|
|
164
|
+
this.setupWaitingServer = null;
|
|
165
|
+
}
|
|
166
|
+
// Stop edge worker (includes stopping shared application server and Cloudflare tunnel)
|
|
167
|
+
if (this.edgeWorker) {
|
|
168
|
+
await this.edgeWorker.stop();
|
|
169
|
+
}
|
|
170
|
+
this.logger.info("Shutdown complete");
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=WorkerService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkerService.js","sourceRoot":"","sources":["../../../src/services/WorkerService.ts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D,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACT,IAAI,IAAI,CAAC,cAAc;YAAE,OAAO;QAChC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAE3B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;QAEnD,kDAAkD;QAClD,IAAI,IAAI,CAAC,kBAAkB,EAAE,CAAC;YAC7B,MAAM,IAAI,CAAC,kBAAkB,CAAC,IAAI,EAAE,CAAC;YACrC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAChC,CAAC;QAED,uFAAuF;QACvF,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,MAAM,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;QAC9B,CAAC;QAED,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;CACD"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utility namespace for CLI prompts and user interaction
|
|
3
|
+
*/
|
|
4
|
+
export declare namespace CLIPrompts {
|
|
5
|
+
/**
|
|
6
|
+
* Ask a question and return the user's answer
|
|
7
|
+
*/
|
|
8
|
+
function ask(prompt: string): Promise<string>;
|
|
9
|
+
/**
|
|
10
|
+
* Ask a yes/no question
|
|
11
|
+
*/
|
|
12
|
+
function confirm(prompt: string, defaultValue?: boolean): Promise<boolean>;
|
|
13
|
+
/**
|
|
14
|
+
* Display a menu and get user selection
|
|
15
|
+
*/
|
|
16
|
+
function menu(title: string, options: string[]): Promise<number | null>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=CLIPrompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CLIPrompts.d.ts","sourceRoot":"","sources":["../../../src/ui/CLIPrompts.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,yBAAiB,UAAU,CAAC;IAC3B;;OAEG;IACH,SAAsB,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAYzD;IAED;;OAEG;IACH,SAAsB,OAAO,CAC5B,MAAM,EAAE,MAAM,EACd,YAAY,UAAQ,GAClB,OAAO,CAAC,OAAO,CAAC,CASlB;IAED;;OAEG;IACH,SAAsB,IAAI,CACzB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EAAE,GACf,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBxB;CACD"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import readline from "node:readline";
|
|
2
|
+
/**
|
|
3
|
+
* Utility namespace for CLI prompts and user interaction
|
|
4
|
+
*/
|
|
5
|
+
export var CLIPrompts;
|
|
6
|
+
(function (CLIPrompts) {
|
|
7
|
+
/**
|
|
8
|
+
* Ask a question and return the user's answer
|
|
9
|
+
*/
|
|
10
|
+
async function ask(prompt) {
|
|
11
|
+
const rl = readline.createInterface({
|
|
12
|
+
input: process.stdin,
|
|
13
|
+
output: process.stdout,
|
|
14
|
+
});
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
rl.question(prompt, (answer) => {
|
|
17
|
+
rl.close();
|
|
18
|
+
resolve(answer.trim());
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
CLIPrompts.ask = ask;
|
|
23
|
+
/**
|
|
24
|
+
* Ask a yes/no question
|
|
25
|
+
*/
|
|
26
|
+
async function confirm(prompt, defaultValue = false) {
|
|
27
|
+
const suffix = defaultValue ? " (Y/n): " : " (y/N): ";
|
|
28
|
+
const answer = await CLIPrompts.ask(prompt + suffix);
|
|
29
|
+
if (!answer) {
|
|
30
|
+
return defaultValue;
|
|
31
|
+
}
|
|
32
|
+
return answer.toLowerCase() === "y" || answer.toLowerCase() === "yes";
|
|
33
|
+
}
|
|
34
|
+
CLIPrompts.confirm = confirm;
|
|
35
|
+
/**
|
|
36
|
+
* Display a menu and get user selection
|
|
37
|
+
*/
|
|
38
|
+
async function menu(title, options) {
|
|
39
|
+
console.log(`\n${title}`);
|
|
40
|
+
console.log("─".repeat(50));
|
|
41
|
+
options.forEach((option, index) => {
|
|
42
|
+
console.log(`${index + 1}. ${option}`);
|
|
43
|
+
});
|
|
44
|
+
const answer = await CLIPrompts.ask("\nYour choice: ");
|
|
45
|
+
const choice = parseInt(answer, 10);
|
|
46
|
+
if (Number.isNaN(choice) || choice < 1 || choice > options.length) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return choice - 1;
|
|
50
|
+
}
|
|
51
|
+
CLIPrompts.menu = menu;
|
|
52
|
+
})(CLIPrompts || (CLIPrompts = {}));
|
|
53
|
+
//# sourceMappingURL=CLIPrompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CLIPrompts.js","sourceRoot":"","sources":["../../../src/ui/CLIPrompts.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC;;GAEG;AACH,MAAM,KAAW,UAAU,CA0D1B;AA1DD,WAAiB,UAAU;IAC1B;;OAEG;IACI,KAAK,UAAU,GAAG,CAAC,MAAc;QACvC,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;YACnC,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,MAAM,EAAE,OAAO,CAAC,MAAM;SACtB,CAAC,CAAC;QAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;YAC9B,EAAE,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC9B,EAAE,CAAC,KAAK,EAAE,CAAC;gBACX,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACxB,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;IAZqB,cAAG,MAYxB,CAAA;IAED;;OAEG;IACI,KAAK,UAAU,OAAO,CAC5B,M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,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cyrus-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0-rc",
|
|
4
4
|
"description": "AI-powered Linear issue automation using Claude",
|
|
5
|
-
"main": "dist/app.js",
|
|
6
|
-
"types": "dist/app.d.ts",
|
|
5
|
+
"main": "dist/src/app.js",
|
|
6
|
+
"types": "dist/src/app.d.ts",
|
|
7
7
|
"bin": {
|
|
8
|
-
"cyrus": "./dist/app.js"
|
|
8
|
+
"cyrus": "./dist/src/app.js"
|
|
9
9
|
},
|
|
10
10
|
"type": "module",
|
|
11
11
|
"files": [
|
|
@@ -38,10 +38,11 @@
|
|
|
38
38
|
"node-fetch": "^2.7.0",
|
|
39
39
|
"open": "^10.0.0",
|
|
40
40
|
"zod": "^3.24.4",
|
|
41
|
-
"cyrus-claude-runner": "0.0
|
|
42
|
-
"cyrus-
|
|
43
|
-
"cyrus-
|
|
44
|
-
"cyrus-edge-worker": "0.0
|
|
41
|
+
"cyrus-claude-runner": "0.2.0-rc",
|
|
42
|
+
"cyrus-cloudflare-tunnel-client": "0.2.0-rc",
|
|
43
|
+
"cyrus-core": "0.2.0-rc",
|
|
44
|
+
"cyrus-edge-worker": "0.2.0-rc",
|
|
45
|
+
"cyrus-config-updater": "0.2.0-rc"
|
|
45
46
|
},
|
|
46
47
|
"devDependencies": {
|
|
47
48
|
"@types/node": "^20.0.0",
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
},
|
|
53
54
|
"scripts": {
|
|
54
55
|
"build": "tsc",
|
|
55
|
-
"start": "node dist/app.js",
|
|
56
|
+
"start": "node dist/src/app.js",
|
|
56
57
|
"dev": "tsc --watch",
|
|
57
58
|
"test": "vitest run",
|
|
58
59
|
"test:run": "vitest run --passWithNoTests",
|