opencara 0.108.1 → 0.108.2

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/bin.js +32 -13
  2. package/package.json +1 -1
package/dist/bin.js CHANGED
@@ -1153,6 +1153,7 @@ function runAcpJob(opts) {
1153
1153
  const mcpServers = [host.acpServerEntry()];
1154
1154
  const shimSupportsLoad = initResult.agentCapabilities?.loadSession === true;
1155
1155
  let sessionId;
1156
+ let resumed = false;
1156
1157
  if (acpSpec.priorSessionId && shimSupportsLoad) {
1157
1158
  await client.loadSession({
1158
1159
  sessionId: acpSpec.priorSessionId,
@@ -1160,6 +1161,7 @@ function runAcpJob(opts) {
1160
1161
  mcpServers
1161
1162
  });
1162
1163
  sessionId = acpSpec.priorSessionId;
1164
+ resumed = true;
1163
1165
  } else {
1164
1166
  const session = await client.newSession({ cwd, mcpServers });
1165
1167
  sessionId = session.sessionId;
@@ -1173,7 +1175,10 @@ function runAcpJob(opts) {
1173
1175
  result = { exitCode: 1, stopReason: "cancelled", sessionId };
1174
1176
  return result;
1175
1177
  }
1176
- const prompt = buildPromptContent(acpSpec);
1178
+ const prompt = buildPromptContent({
1179
+ ...acpSpec,
1180
+ history: resumed ? [] : acpSpec.history
1181
+ });
1177
1182
  const promptResult = await client.prompt({
1178
1183
  sessionId,
1179
1184
  prompt,
@@ -1307,7 +1312,7 @@ function resolveLocalAcpAdapter(command, args) {
1307
1312
  }
1308
1313
 
1309
1314
  // src/commands/run.ts
1310
- var PKG_VERSION = "0.108.1";
1315
+ var PKG_VERSION = "0.108.2";
1311
1316
  var LOG_FLUSH_MS = 800;
1312
1317
  var MAX_CHUNK_SIZE = 4 * 1024;
1313
1318
  async function run(opts = {}) {
@@ -1683,20 +1688,34 @@ function worktreeCreate(args) {
1683
1688
  mkdirSync2(join2(cacheDir, ".git", "lfs", "objects"), { recursive: true });
1684
1689
  }
1685
1690
  }
1691
+ let reused = false;
1686
1692
  if (existsSync4(join2(checkoutDir, ".git"))) {
1687
- git(checkoutDir, ["fetch", "origin"], gitEnv);
1688
- if (refExists(checkoutDir, `refs/remotes/origin/${branch}`)) {
1689
- git(checkoutDir, ["checkout", "-B", branch, `origin/${branch}`], gitEnv);
1690
- } else if (refExists(checkoutDir, `refs/heads/${branch}`)) {
1691
- git(checkoutDir, ["checkout", branch], gitEnv);
1692
- } else if (fromBranch) {
1693
- git(checkoutDir, ["checkout", "-B", branch, `origin/${fromBranch}`], gitEnv);
1694
- } else {
1695
- fail(
1696
- `worktree create: '${branch}' missing locally and on origin/, no --from-branch to fall back to`
1693
+ try {
1694
+ git(checkoutDir, ["reset", "--hard", "HEAD"], gitEnv);
1695
+ git(checkoutDir, ["clean", "-fdx"], gitEnv);
1696
+ git(checkoutDir, ["fetch", "origin"], gitEnv);
1697
+ if (refExists(checkoutDir, `refs/remotes/origin/${branch}`)) {
1698
+ git(checkoutDir, ["checkout", "-B", branch, `origin/${branch}`], gitEnv);
1699
+ } else if (refExists(checkoutDir, `refs/heads/${branch}`)) {
1700
+ git(checkoutDir, ["checkout", branch], gitEnv);
1701
+ } else if (fromBranch) {
1702
+ git(checkoutDir, ["checkout", "-B", branch, `origin/${fromBranch}`], gitEnv);
1703
+ } else {
1704
+ fail(
1705
+ `worktree create: '${branch}' missing locally and on origin/, no --from-branch to fall back to`
1706
+ );
1707
+ }
1708
+ reused = true;
1709
+ } catch (err) {
1710
+ console.warn(
1711
+ `[worktree] reuse of ${checkoutDir} failed (${err.message}); re-cloning`
1697
1712
  );
1713
+ rmSync(checkoutDir, { recursive: true, force: true });
1698
1714
  }
1699
- } else {
1715
+ } else if (existsSync4(checkoutDir)) {
1716
+ rmSync(checkoutDir, { recursive: true, force: true });
1717
+ }
1718
+ if (!reused) {
1700
1719
  mkdirSync2(checkoutDir, { recursive: true });
1701
1720
  const cloneArgs = ["-c", `credential.helper=${HELPER_SNIPPET}`, "clone"];
1702
1721
  if (cacheDir) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencara",
3
- "version": "0.108.1",
3
+ "version": "0.108.2",
4
4
  "description": "OpenCara agent-host CLI: register a machine as an agent host and run dispatched agents.",
5
5
  "license": "MIT",
6
6
  "repository": {