replicas-engine 0.1.58 → 0.1.60
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/src/index.js +39 -6
- package/package.json +1 -1
package/dist/src/index.js
CHANGED
|
@@ -56,7 +56,7 @@ function loadEngineEnv() {
|
|
|
56
56
|
WORKSPACE_ROOT: join(HOME_DIR, "workspaces"),
|
|
57
57
|
// Runtime: may not be set during warming
|
|
58
58
|
WORKSPACE_ID: readEnv("WORKSPACE_ID"),
|
|
59
|
-
|
|
59
|
+
WORKSPACE_BRANCH_NAME: readEnv("WORKSPACE_BRANCH_NAME"),
|
|
60
60
|
LINEAR_SESSION_ID: readEnv("LINEAR_SESSION_ID"),
|
|
61
61
|
LINEAR_ACCESS_TOKEN: readEnv("LINEAR_ACCESS_TOKEN"),
|
|
62
62
|
SLACK_BOT_TOKEN: readEnv("SLACK_BOT_TOKEN"),
|
|
@@ -523,13 +523,17 @@ var GitService = class {
|
|
|
523
523
|
}
|
|
524
524
|
return states;
|
|
525
525
|
}
|
|
526
|
+
async setBranchNameAndCheckout(name) {
|
|
527
|
+
ENGINE_ENV.WORKSPACE_BRANCH_NAME = name;
|
|
528
|
+
return this.initializeGitRepository();
|
|
529
|
+
}
|
|
526
530
|
async initializeGitRepository() {
|
|
527
|
-
const workspaceName = ENGINE_ENV.
|
|
531
|
+
const workspaceName = ENGINE_ENV.WORKSPACE_BRANCH_NAME;
|
|
528
532
|
if (!workspaceName) {
|
|
533
|
+
console.info("No WORKSPACE_BRANCH_NAME set \u2014 skipping branch checkout");
|
|
529
534
|
return {
|
|
530
|
-
success:
|
|
531
|
-
repos: []
|
|
532
|
-
error: "No WORKSPACE_NAME environment variable set"
|
|
535
|
+
success: true,
|
|
536
|
+
repos: []
|
|
533
537
|
};
|
|
534
538
|
}
|
|
535
539
|
const repos = await this.listRepositories();
|
|
@@ -2771,6 +2775,18 @@ var ChatService = class {
|
|
|
2771
2775
|
const runtime = this.createRuntimeChat(chat);
|
|
2772
2776
|
this.chats.set(chat.id, runtime);
|
|
2773
2777
|
}
|
|
2778
|
+
const hasClaudeDefault = [...this.chats.values()].some(
|
|
2779
|
+
(c) => c.persisted.provider === "claude" && c.persisted.title === "Claude Code"
|
|
2780
|
+
);
|
|
2781
|
+
const hasCodexDefault = [...this.chats.values()].some(
|
|
2782
|
+
(c) => c.persisted.provider === "codex" && c.persisted.title === "Codex"
|
|
2783
|
+
);
|
|
2784
|
+
if (!hasClaudeDefault) {
|
|
2785
|
+
await this.createChat({ provider: "claude", title: "Claude Code" });
|
|
2786
|
+
}
|
|
2787
|
+
if (!hasCodexDefault) {
|
|
2788
|
+
await this.createChat({ provider: "codex", title: "Codex" });
|
|
2789
|
+
}
|
|
2774
2790
|
}
|
|
2775
2791
|
listChats() {
|
|
2776
2792
|
return Array.from(this.chats.values()).map((chat) => this.toSummary(chat)).sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
@@ -3024,6 +3040,7 @@ var ChatService = class {
|
|
|
3024
3040
|
}
|
|
3025
3041
|
const linearSessionId = ENGINE_ENV.LINEAR_SESSION_ID;
|
|
3026
3042
|
const repoStatuses = await gitService.refreshRepos();
|
|
3043
|
+
console.log(`Repository Statuses Refreshed: `, repoStatuses);
|
|
3027
3044
|
const payload = linearSessionId ? { linearSessionId, repoStatuses } : { repoStatuses };
|
|
3028
3045
|
await monolithService.sendEvent({ type: "agent_turn_complete", payload });
|
|
3029
3046
|
}
|
|
@@ -3234,6 +3251,9 @@ async function runWarmHooks(params) {
|
|
|
3234
3251
|
}
|
|
3235
3252
|
|
|
3236
3253
|
// src/v1-routes.ts
|
|
3254
|
+
var setWorkspaceNameSchema = z.object({
|
|
3255
|
+
name: z.string().min(1).max(48)
|
|
3256
|
+
});
|
|
3237
3257
|
var createChatSchema = z.object({
|
|
3238
3258
|
provider: z.enum(["claude", "codex"]),
|
|
3239
3259
|
title: z.string().min(1).optional()
|
|
@@ -3506,6 +3526,19 @@ function createV1Routes(deps) {
|
|
|
3506
3526
|
);
|
|
3507
3527
|
}
|
|
3508
3528
|
});
|
|
3529
|
+
app2.post("/workspace-name", async (c) => {
|
|
3530
|
+
try {
|
|
3531
|
+
const body = setWorkspaceNameSchema.parse(await c.req.json());
|
|
3532
|
+
const result = await gitService.setBranchNameAndCheckout(body.name);
|
|
3533
|
+
return c.json({
|
|
3534
|
+
success: result.success,
|
|
3535
|
+
repos: result.repos.map((r) => ({ name: r.name, branch: r.currentBranch, resumed: r.resumed ?? false }))
|
|
3536
|
+
});
|
|
3537
|
+
} catch (error) {
|
|
3538
|
+
const details = error instanceof Error ? error.message : "Unknown error";
|
|
3539
|
+
return c.json(jsonError("Failed to set workspace name", details), 400);
|
|
3540
|
+
}
|
|
3541
|
+
});
|
|
3509
3542
|
app2.get("/previews", async (c) => {
|
|
3510
3543
|
try {
|
|
3511
3544
|
const previews = await previewService.listPreviews();
|
|
@@ -3726,7 +3759,7 @@ serve(
|
|
|
3726
3759
|
console.log(`Replicas Engine running on port ${info.port}`);
|
|
3727
3760
|
}
|
|
3728
3761
|
const gitResult = await gitService.initializeGitRepository();
|
|
3729
|
-
if (!gitResult.success) {
|
|
3762
|
+
if (!gitResult.success && gitResult.error) {
|
|
3730
3763
|
console.warn(`Git initialization warning: ${gitResult.error}`);
|
|
3731
3764
|
}
|
|
3732
3765
|
await replicasConfigService.initialize();
|