replicas-engine 0.1.12 → 0.1.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 (2) hide show
  1. package/dist/src/index.js +15 -12
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -101,18 +101,19 @@ var CodexManager = class {
101
101
  if (customInstructions) {
102
102
  message = customInstructions + "\n" + message;
103
103
  }
104
+ const { events } = await this.currentThread.runStreamed("Hello");
105
+ for await (const event of events) {
106
+ if (event.type === "thread.started") {
107
+ this.currentThreadId = event.thread_id;
108
+ break;
109
+ }
110
+ }
111
+ if (!this.currentThreadId && this.currentThread.id) {
112
+ this.currentThreadId = this.currentThread.id;
113
+ }
104
114
  }
105
115
  }
106
- const { events } = await this.currentThread.runStreamed(message);
107
- for await (const event of events) {
108
- if (event.type === "thread.started") {
109
- this.currentThreadId = event.thread_id;
110
- break;
111
- }
112
- }
113
- if (!this.currentThreadId && this.currentThread.id) {
114
- this.currentThreadId = this.currentThread.id;
115
- }
116
+ await this.currentThread.run(message);
116
117
  } finally {
117
118
  this.processing = false;
118
119
  }
@@ -602,7 +603,9 @@ function getCurrentBranch(cwd) {
602
603
  }
603
604
  function getGitDiff(cwd) {
604
605
  try {
605
- const shortstat = execSync("git diff --shortstat -M", {
606
+ const defaultBranch = process.env.REPLICAS_DEFAULT_BRANCH || "main";
607
+ const baseBranch = `origin/${defaultBranch}`;
608
+ const shortstat = execSync(`git diff ${baseBranch}...HEAD --shortstat -M`, {
606
609
  cwd,
607
610
  encoding: "utf-8",
608
611
  stdio: ["pipe", "pipe", "pipe"]
@@ -617,7 +620,7 @@ function getGitDiff(cwd) {
617
620
  if (removedMatch) {
618
621
  removed = parseInt(removedMatch[1], 10);
619
622
  }
620
- const fullDiff = execSync("git diff -M -C", {
623
+ const fullDiff = execSync(`git diff ${baseBranch}...HEAD -M -C`, {
621
624
  cwd,
622
625
  encoding: "utf-8",
623
626
  stdio: ["pipe", "pipe", "pipe"]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",