kith-coord 0.1.2 → 0.1.3

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/index.d.ts CHANGED
@@ -74,6 +74,7 @@ declare class FencingAndAgentManager {
74
74
  static readonly DEFAULT_LEASE_MS: number;
75
75
  private readonly capabilities;
76
76
  private static ownWindowsStart;
77
+ private static inspectionFailure;
77
78
  constructor(coordDb: CoordDatabase);
78
79
  static validateLease(duration: number): number;
79
80
  /** A real kernel process identity; tests must not supply liveness sentinels. */
@@ -978,7 +979,7 @@ declare function recoveryReport(directory?: string): {
978
979
  error: string | undefined;
979
980
  };
980
981
 
981
- declare const KITH_VERSION = "0.1.2";
982
- declare const KITH_PROTOCOL_VERSION = "1.1.0";
982
+ declare const KITH_VERSION = "0.1.3";
983
+ declare const KITH_PROTOCOL_VERSION = "1.2.0";
983
984
 
984
985
  export { type AcquireLockResult, type AgentRecord, type AgentUnreadDelta, AstAnalyzer, type BashGuardPostReport, BashMerkleGuard, type BlastRadiusAlert, CoWWorktreeManager, type ConflictRecord, type ContractRecord, CoordDatabase, type CoordEvent, type DeclareIntentResult, DependencyAndContractEngine, type DirtyMergeProbeResult, type ExtractedImport, type ExtractedSymbol, FencingAndAgentManager, type FileAstAnalysis, type FileModificationReport, type FileSnapshotEntry, IntentAndTaskEngine, KITH_PROTOCOL_VERSION, KITH_VERSION, KithEngine, type LockConflict, LockEngine, type LockRecord, type MergeTrainEntry, type PostFileEditHookResult, type QuarantineRecord, type RepositoryLayout, ResourceBroker, type ResourceRecord, SessionOwnershipError, type SessionRegistration, ShadowGitEngine, type SpawnedWorktree, type SpeculativeMergeResult, SpeculativeMergeTrain, StaleFencingTokenError, type SymbolKind, type TaskRecord, type WorkspaceObservation, type WorktreeChange, caseSensitivePaths, discoverRepository, isWithin, observeWorkspaces, physicalPath, previewIntegration, readCoordinationState, recoveryReport, repositoryFile, worktreeChanges };
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/version.ts
2
- var KITH_VERSION = "0.1.2";
3
- var KITH_PROTOCOL_VERSION = "1.1.0";
2
+ var KITH_VERSION = "0.1.3";
3
+ var KITH_PROTOCOL_VERSION = "1.2.0";
4
4
 
5
5
  // src/core/workspace-observation.ts
6
6
  import { execFileSync as execFileSync2, spawnSync } from "child_process";
@@ -51,6 +51,9 @@ function repositoryFile(root, file) {
51
51
  }
52
52
  function discoverRepository(input) {
53
53
  const directory = fs.realpathSync.native(input);
54
+ if (directory === path.parse(directory).root) {
55
+ throw new Error("Cannot coordinate a filesystem root; select an explicit project with --repo.");
56
+ }
54
57
  if (!fs.statSync(directory).isDirectory()) throw new Error(`Not a directory: ${input}`);
55
58
  const git2 = (...args) => execFileSync("git", ["rev-parse", ...args], {
56
59
  cwd: directory,
@@ -615,6 +618,7 @@ var FencingAndAgentManager = class _FencingAndAgentManager {
615
618
  static DEFAULT_LEASE_MS = 5 * 60 * 1e3;
616
619
  capabilities = /* @__PURE__ */ new Map();
617
620
  static ownWindowsStart = null;
621
+ static inspectionFailure = null;
618
622
  static validateLease(duration) {
619
623
  if (!Number.isSafeInteger(duration) || duration < 100 || duration > 864e5) {
620
624
  throw new Error("Lease duration must be an integer between 100 and 86400000 milliseconds");
@@ -623,6 +627,7 @@ var FencingAndAgentManager = class _FencingAndAgentManager {
623
627
  }
624
628
  /** A real kernel process identity; tests must not supply liveness sentinels. */
625
629
  static getProcessStartTime(pid) {
630
+ this.inspectionFailure = null;
626
631
  if (!Number.isSafeInteger(pid) || pid <= 0) return null;
627
632
  try {
628
633
  if (process.platform === "linux") {
@@ -640,9 +645,12 @@ var FencingAndAgentManager = class _FencingAndAgentManager {
640
645
  "-Command",
641
646
  `(Get-Process -Id ${pid} -ErrorAction Stop).StartTime.ToUniversalTime().Ticks.ToString([System.Globalization.CultureInfo]::InvariantCulture)`
642
647
  ],
643
- { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 5e3, windowsHide: true }
648
+ { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 15e3, windowsHide: true }
644
649
  ).trim();
645
- if (!/^\d+$/.test(ticks)) return null;
650
+ if (!/^\d+$/.test(ticks)) {
651
+ this.inspectionFailure = "invalid kernel creation-time response";
652
+ return null;
653
+ }
646
654
  const identity = `windows:${ticks}`;
647
655
  if (pid === process.pid) this.ownWindowsStart = identity;
648
656
  return identity;
@@ -654,7 +662,9 @@ var FencingAndAgentManager = class _FencingAndAgentManager {
654
662
  env: { ...process.env, LC_ALL: "C" }
655
663
  }).trim();
656
664
  return out || null;
657
- } catch {
665
+ } catch (error) {
666
+ const failure = error;
667
+ this.inspectionFailure = [failure.code, failure.status === void 0 ? null : `exit ${failure.status}`, failure.signal].filter(Boolean).join(", ") || "inspection unavailable";
658
668
  return null;
659
669
  }
660
670
  }
@@ -684,7 +694,7 @@ var FencingAndAgentManager = class _FencingAndAgentManager {
684
694
  if (params.sessionToken !== void 0) throw new SessionOwnershipError(params.id);
685
695
  const pid = params.pid ?? process.pid;
686
696
  const start = _FencingAndAgentManager.getProcessStartTime(pid);
687
- if (!start) throw new Error(`Cannot determine start time of live session owner PID ${pid}`);
697
+ if (!start) throw new Error(`Cannot determine start time of live session owner PID ${pid} (${_FencingAndAgentManager.inspectionFailure ?? "inspection unavailable"})`);
688
698
  const now = Date.now();
689
699
  const epoch = this.coordDb.nextFencingToken();
690
700
  const token = crypto2.randomBytes(32).toString("base64url");