@cabane/companion 0.6.30 → 0.6.31

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/cli.js CHANGED
@@ -6475,7 +6475,7 @@ var ConnectorHealthStore = class {
6475
6475
 
6476
6476
  // src/dispatcher.ts
6477
6477
  import { randomUUID } from "crypto";
6478
- import { appendFileSync as appendFileSync2, existsSync as existsSync11, mkdirSync as mkdirSync11, statSync } from "fs";
6478
+ import { appendFileSync as appendFileSync2, existsSync as existsSync11, mkdirSync as mkdirSync11, readdirSync as readdirSync2, statSync } from "fs";
6479
6479
  import { join as join15 } from "path";
6480
6480
 
6481
6481
  // src/summon.ts
@@ -7371,10 +7371,19 @@ var DEFAULT_PREPARING_ROW_DELAY_MS = 1500;
7371
7371
  var DEFAULT_AGENT_IDLE_TIMEOUT_MS = 10 * 6e4;
7372
7372
  var DEFAULT_AGENT_TOTAL_TIMEOUT_MS = 6 * 60 * 6e4;
7373
7373
  function checkoutState(cwd) {
7374
- if (!cwd) return { ok: false, reason: "no checkout was resolved for this turn" };
7375
- if (!existsSync11(cwd)) return { ok: false, reason: `the checkout directory is gone (${cwd})` };
7374
+ if (!cwd) return { ok: false, reason: "no working directory was resolved for this turn" };
7375
+ if (!existsSync11(cwd)) return { ok: false, reason: `the working directory is gone (${cwd})` };
7376
+ let entries;
7377
+ try {
7378
+ entries = readdirSync2(cwd);
7379
+ } catch (error) {
7380
+ return { ok: false, reason: `${cwd} is unreadable (${error.message})` };
7381
+ }
7382
+ if (entries.length === 0) {
7383
+ return { ok: false, reason: `${cwd} is empty \u2014 a recreated shell, not a prepared directory` };
7384
+ }
7376
7385
  const gitPath = join15(cwd, ".git");
7377
- if (!existsSync11(gitPath)) return { ok: false, reason: `${cwd} holds no git metadata` };
7386
+ if (!existsSync11(gitPath)) return { ok: true, reason: "usable" };
7378
7387
  let stat;
7379
7388
  try {
7380
7389
  stat = statSync(gitPath);
@@ -8588,7 +8597,7 @@ async function enumerateOpencodeModels(serverUrl, fetchImpl = fetch) {
8588
8597
  import {
8589
8598
  existsSync as existsSync12,
8590
8599
  mkdirSync as mkdirSync12,
8591
- readdirSync as readdirSync2,
8600
+ readdirSync as readdirSync3,
8592
8601
  readFileSync as readFileSync9,
8593
8602
  renameSync as renameSync3,
8594
8603
  rmSync as rmSync7,
@@ -8645,7 +8654,7 @@ var Outbox = class {
8645
8654
  if (!existsSync12(dir2)) return [];
8646
8655
  let names;
8647
8656
  try {
8648
- names = readdirSync2(dir2);
8657
+ names = readdirSync3(dir2);
8649
8658
  } catch {
8650
8659
  return [];
8651
8660
  }
@@ -8680,7 +8689,7 @@ var Outbox = class {
8680
8689
  const dir2 = this.dir();
8681
8690
  if (!existsSync12(dir2)) return 0;
8682
8691
  try {
8683
- return readdirSync2(dir2).filter((n) => n.endsWith(".json")).length;
8692
+ return readdirSync3(dir2).filter((n) => n.endsWith(".json")).length;
8684
8693
  } catch {
8685
8694
  return 0;
8686
8695
  }
@@ -10058,7 +10067,7 @@ companion: deploy drain requested (${graceMs}ms grace)\u2026
10058
10067
  }
10059
10068
 
10060
10069
  // src/commands/status.ts
10061
- import { readdirSync as readdirSync3 } from "fs";
10070
+ import { readdirSync as readdirSync4 } from "fs";
10062
10071
  async function status(deps = {}) {
10063
10072
  const readService = deps.service ?? serviceStatus;
10064
10073
  const cfg = loadConfig();
@@ -10129,7 +10138,7 @@ function transcriptsLine() {
10129
10138
  let count = 0;
10130
10139
  let newest;
10131
10140
  try {
10132
- const files = readdirSync3(dir2).filter((f) => f.endsWith(".jsonl")).sort();
10141
+ const files = readdirSync4(dir2).filter((f) => f.endsWith(".jsonl")).sort();
10133
10142
  count = files.length;
10134
10143
  newest = files[files.length - 1];
10135
10144
  } catch {
@@ -10229,7 +10238,7 @@ function isAlive(kill, pid) {
10229
10238
  }
10230
10239
 
10231
10240
  // src/commands/transcript.ts
10232
- import { existsSync as existsSync14, readFileSync as readFileSync11, readdirSync as readdirSync4 } from "fs";
10241
+ import { existsSync as existsSync14, readFileSync as readFileSync11, readdirSync as readdirSync5 } from "fs";
10233
10242
  import { isAbsolute, join as join18 } from "path";
10234
10243
  async function transcript(opts = {}) {
10235
10244
  const dir2 = transcriptsDir();
@@ -10355,7 +10364,7 @@ async function followTranscripts(dir2) {
10355
10364
  }
10356
10365
  function listFiles(dir2) {
10357
10366
  try {
10358
- return readdirSync4(dir2).filter((f) => f.endsWith(".jsonl")).sort().reverse();
10367
+ return readdirSync5(dir2).filter((f) => f.endsWith(".jsonl")).sort().reverse();
10359
10368
  } catch {
10360
10369
  return [];
10361
10370
  }
package/dist/runtime.js CHANGED
@@ -5587,7 +5587,7 @@ var ConnectorHealthStore = class {
5587
5587
 
5588
5588
  // src/dispatcher.ts
5589
5589
  import { randomUUID } from "crypto";
5590
- import { appendFileSync as appendFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync9, statSync } from "fs";
5590
+ import { appendFileSync as appendFileSync2, existsSync as existsSync9, mkdirSync as mkdirSync9, readdirSync as readdirSync2, statSync } from "fs";
5591
5591
  import { join as join13 } from "path";
5592
5592
 
5593
5593
  // src/summon.ts
@@ -6483,10 +6483,19 @@ var DEFAULT_PREPARING_ROW_DELAY_MS = 1500;
6483
6483
  var DEFAULT_AGENT_IDLE_TIMEOUT_MS = 10 * 6e4;
6484
6484
  var DEFAULT_AGENT_TOTAL_TIMEOUT_MS = 6 * 60 * 6e4;
6485
6485
  function checkoutState(cwd) {
6486
- if (!cwd) return { ok: false, reason: "no checkout was resolved for this turn" };
6487
- if (!existsSync9(cwd)) return { ok: false, reason: `the checkout directory is gone (${cwd})` };
6486
+ if (!cwd) return { ok: false, reason: "no working directory was resolved for this turn" };
6487
+ if (!existsSync9(cwd)) return { ok: false, reason: `the working directory is gone (${cwd})` };
6488
+ let entries;
6489
+ try {
6490
+ entries = readdirSync2(cwd);
6491
+ } catch (error) {
6492
+ return { ok: false, reason: `${cwd} is unreadable (${error.message})` };
6493
+ }
6494
+ if (entries.length === 0) {
6495
+ return { ok: false, reason: `${cwd} is empty \u2014 a recreated shell, not a prepared directory` };
6496
+ }
6488
6497
  const gitPath = join13(cwd, ".git");
6489
- if (!existsSync9(gitPath)) return { ok: false, reason: `${cwd} holds no git metadata` };
6498
+ if (!existsSync9(gitPath)) return { ok: true, reason: "usable" };
6490
6499
  let stat;
6491
6500
  try {
6492
6501
  stat = statSync(gitPath);
@@ -7700,7 +7709,7 @@ async function enumerateOpencodeModels(serverUrl, fetchImpl = fetch) {
7700
7709
  import {
7701
7710
  existsSync as existsSync10,
7702
7711
  mkdirSync as mkdirSync10,
7703
- readdirSync as readdirSync2,
7712
+ readdirSync as readdirSync3,
7704
7713
  readFileSync as readFileSync8,
7705
7714
  renameSync as renameSync3,
7706
7715
  rmSync as rmSync6,
@@ -7757,7 +7766,7 @@ var Outbox = class {
7757
7766
  if (!existsSync10(dir2)) return [];
7758
7767
  let names;
7759
7768
  try {
7760
- names = readdirSync2(dir2);
7769
+ names = readdirSync3(dir2);
7761
7770
  } catch {
7762
7771
  return [];
7763
7772
  }
@@ -7792,7 +7801,7 @@ var Outbox = class {
7792
7801
  const dir2 = this.dir();
7793
7802
  if (!existsSync10(dir2)) return 0;
7794
7803
  try {
7795
- return readdirSync2(dir2).filter((n) => n.endsWith(".json")).length;
7804
+ return readdirSync3(dir2).filter((n) => n.endsWith(".json")).length;
7796
7805
  } catch {
7797
7806
  return 0;
7798
7807
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cabane/companion",
3
- "version": "0.6.30",
3
+ "version": "0.6.31",
4
4
  "type": "module",
5
5
  "description": "The Cabane Companion (headless): connect a coding agent on your machine to your Cabane workspace as a responder — drive work against your own codebase, files, and MCP servers without putting any of it in Cabane.",
6
6
  "license": "UNLICENSED",