@gitgov/core 2.3.0 → 2.4.0

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.
@@ -1,9 +1,9 @@
1
1
  import { A as ActorPayload, c as ActorRecord, d as AgentPayload, e as AgentRecord, C as ChangelogPayload, f as ChangelogRecord, g as CustomRecord, h as CyclePayload, i as CycleRecord, E as EmbeddedMetadataHeader, j as EmbeddedMetadataRecord, k as ExecutionPayload, l as ExecutionRecord, F as FeedbackPayload, m as FeedbackRecord, n as GitGovActorRecord, o as GitGovAgentRecord, p as GitGovChangelogRecord, q as GitGovCycleRecord, r as GitGovError, s as GitGovExecutionRecord, t as GitGovFeedbackRecord, G as GitGovRecord, u as GitGovRecordPayload, v as GitGovRecordType, w as GitGovTaskRecord, S as Signature, T as TaskPayload, x as TaskRecord, R as RecordStores, y as CollaborationMetrics, z as IRecordMetrics, B as ProductivityMetrics, D as RecordMetrics, H as RecordMetricsDependencies, J as SystemStatus, K as TaskHealthReport, L as ActivityEvent, M as ActorCreatedEvent, N as ActorRevokedEvent, O as AgentRegisteredEvent, Q as BaseEvent, U as ChangelogCreatedEvent, V as CycleCreatedEvent, W as CycleStatusChangedEvent, X as EventHandler, Y as EventMetadata, Z as EventSubscription, _ as ExecutionCreatedEvent, $ as FeedbackCreatedEvent, a0 as GitGovEvent, a1 as SystemDailyTickEvent, a2 as TaskCreatedEvent, a3 as TaskStatusChangedEvent, I as IRecordProjector, a4 as RecordProjectorDependencies, b as IndexData, a5 as IndexGenerationReport, a6 as IntegrityReport, a7 as AllRecords, a8 as DerivedStates, a9 as EnrichedTaskRecord, aa as DerivedStateSets, a as IRecordProjection, ab as IntegrityError, ac as IntegrityWarning, P as ProjectionContext } from './record_projection.types-B8AM7u8U.js';
2
- import { S as SessionManager, C as ConfigManager, z as EventBus, r as IEventStream, B as eventBus, D as publishEvent, G as subscribeToEvent, H as IIdentityAdapter, J as IdentityAdapter, K as IdentityAdapterDependencies, I as ILintModule, M as LintModuleDependencies, c as LintRecordContext, d as LintResult, L as LintOptions, a as LintReport$1, F as FixRecordOptions, b as FixReport, N as FixResult, O as LintSummary, Q as RecordEntry, R as RecordStores$1, V as ValidationContext$1, T as ValidatorType, U as IExecutionAdapter, W as ExecutionAdapterDependencies, E as EnvironmentValidation, e as IProjectInitializer, w as FsKeyProvider, x as FsKeyProviderOptions, y as FsFileLister, f as ISyncStateModule, X as AuditScope$1, A as AuditStateOptions, k as AuditStateReport, i as ConflictDiff, Y as ConflictFileDiff, Z as ConflictInfo, _ as ConflictType, $ as ExpectedFilesScope, j as IntegrityViolation, h as StateDeltaFile, g as SyncStateModuleDependencies, n as SyncStatePullOptions, o as SyncStatePullResult, l as SyncStatePushOptions, m as SyncStatePushResult, p as SyncStateResolveOptions, q as SyncStateResolveResult, a0 as AgentExecutionContext, a1 as AgentOutput, v as AgentResponse, t as AgentRunnerDependencies, a2 as AgentRunnerEvent, a3 as ApiEngine, a4 as AuthConfig, a5 as AuthType, a6 as CustomEngine, a7 as Engine, a8 as EngineType, a9 as IAgentLoader, s as IAgentRunner, aa as LocalEngine, ab as McpEngine, ac as ProtocolHandler, P as ProtocolHandlerRegistry, u as RunOptions, ad as RuntimeHandler, ae as RuntimeHandlerRegistry } from './agent_runner-D7JahEKk.js';
3
- import { A as ActorState, G as GitGovSession, I as ISessionManager, a as SyncPreferencesUpdate, b as SyncStatus, K as KeyProvider, c as KeyProviderError, d as KeyProviderErrorCode } from './key_provider-CRpHFGjN.js';
2
+ import { S as SessionManager, C as ConfigManager, z as EventBus, r as IEventStream, B as eventBus, D as publishEvent, G as subscribeToEvent, H as IIdentityAdapter, J as IdentityAdapter, K as IdentityAdapterDependencies, I as ILintModule, M as LintModuleDependencies, c as LintRecordContext, d as LintResult, L as LintOptions, a as LintReport$1, F as FixRecordOptions, b as FixReport, N as FixResult, O as LintSummary, Q as RecordEntry, R as RecordStores$1, V as ValidationContext$1, T as ValidatorType, U as IExecutionAdapter, W as ExecutionAdapterDependencies, E as EnvironmentValidation, e as IProjectInitializer, w as FsKeyProvider, x as FsKeyProviderOptions, y as FsFileLister, f as ISyncStateModule, X as AuditScope$1, A as AuditStateOptions, k as AuditStateReport, i as ConflictDiff, Y as ConflictFileDiff, Z as ConflictInfo, _ as ConflictType, $ as ExpectedFilesScope, j as IntegrityViolation, h as StateDeltaFile, g as SyncStateModuleDependencies, n as SyncStatePullOptions, o as SyncStatePullResult, l as SyncStatePushOptions, m as SyncStatePushResult, p as SyncStateResolveOptions, q as SyncStateResolveResult, a0 as AgentExecutionContext, a1 as AgentOutput, v as AgentResponse, t as AgentRunnerDependencies, a2 as AgentRunnerEvent, a3 as ApiEngine, a4 as AuthConfig, a5 as AuthType, a6 as CustomEngine, a7 as Engine, a8 as EngineType, a9 as IAgentLoader, s as IAgentRunner, aa as LocalEngine, ab as McpEngine, ac as ProtocolHandler, P as ProtocolHandlerRegistry, u as RunOptions, ad as RuntimeHandler, ae as RuntimeHandlerRegistry } from './agent_runner-pr7h-9cV.js';
3
+ import { A as ActorState, G as GitGovSession, I as ISessionManager, a as SyncPreferencesUpdate, b as SyncStatus, K as KeyProvider, c as KeyProviderError, d as KeyProviderErrorCode } from './key_provider-jjWek3w1.js';
4
4
  import { A as AuditState, j as AuditStateUpdate, G as GitGovConfig, k as IConfigManager, S as SyncConfig, l as SyncDefaults, h as FileListOptions, g as FileLister, i as FileStats, F as FsFileListerOptions, M as MemoryFileListerOptions, I as IGitModule } from './index-Bhc341pf.js';
5
5
  export { C as ConfigStore, m as Git } from './index-Bhc341pf.js';
6
- import { E as EnvKeyProvider, a as EnvKeyProviderOptions, M as MockKeyProvider, b as MockKeyProviderOptions, c as MemoryFileLister } from './memory_file_lister-C978PA8g.js';
6
+ import { E as EnvKeyProvider, a as EnvKeyProviderOptions, M as MockKeyProvider, b as MockKeyProviderOptions, c as MemoryFileLister } from './memory_file_lister-BIIcVXLw.js';
7
7
  import { ValidateFunction } from 'ajv';
8
8
  import { D as DEFAULT_ID_ENCODER, I as IdEncoder, R as RecordStore } from './record_store-BXKWqon5.js';
9
9
 
@@ -5646,6 +5646,23 @@ declare class ActorIdentityMismatchError extends SyncStateError {
5646
5646
  authenticatedActorId: string;
5647
5647
  constructor(requestedActorId: string, authenticatedActorId: string);
5648
5648
  }
5649
+ /**
5650
+ * Error thrown when worktree cannot be created or repaired.
5651
+ * Used by FsWorktreeSyncStateModule for worktree lifecycle failures.
5652
+ */
5653
+ declare class WorktreeSetupError extends SyncStateError {
5654
+ reason: string;
5655
+ worktreePath: string;
5656
+ underlyingError?: Error | undefined;
5657
+ constructor(reason: string, worktreePath: string, underlyingError?: Error | undefined);
5658
+ }
5659
+ /**
5660
+ * Error thrown when attempting pull/push while a rebase is already in progress.
5661
+ * Mirrors git behavior: git refuses pull/push/commit/checkout during active rebase.
5662
+ */
5663
+ declare class RebaseAlreadyInProgressError extends SyncStateError {
5664
+ constructor();
5665
+ }
5649
5666
  /**
5650
5667
  * Error thrown when uncommitted changes exist in state branch
5651
5668
  */
@@ -5680,6 +5697,8 @@ declare function isNoRebaseInProgressError(error: unknown): error is NoRebaseInP
5680
5697
  declare function isStateBranchSetupError(error: unknown): error is StateBranchSetupError;
5681
5698
  declare function isCryptoModuleRequiredError(error: unknown): error is CryptoModuleRequiredError;
5682
5699
  declare function isActorIdentityMismatchError(error: unknown): error is ActorIdentityMismatchError;
5700
+ declare function isWorktreeSetupError(error: unknown): error is WorktreeSetupError;
5701
+ declare function isRebaseAlreadyInProgressError(error: unknown): error is RebaseAlreadyInProgressError;
5683
5702
 
5684
5703
  type index$5_ActorIdentityMismatchError = ActorIdentityMismatchError;
5685
5704
  declare const index$5_ActorIdentityMismatchError: typeof ActorIdentityMismatchError;
@@ -5707,6 +5726,8 @@ type index$5_PullSchedulerDependencies = PullSchedulerDependencies;
5707
5726
  type index$5_PullSchedulerResult = PullSchedulerResult;
5708
5727
  type index$5_PushFromStateBranchError = PushFromStateBranchError;
5709
5728
  declare const index$5_PushFromStateBranchError: typeof PushFromStateBranchError;
5729
+ type index$5_RebaseAlreadyInProgressError = RebaseAlreadyInProgressError;
5730
+ declare const index$5_RebaseAlreadyInProgressError: typeof RebaseAlreadyInProgressError;
5710
5731
  type index$5_StateBranchSetupError = StateBranchSetupError;
5711
5732
  declare const index$5_StateBranchSetupError: typeof StateBranchSetupError;
5712
5733
  declare const index$5_StateDeltaFile: typeof StateDeltaFile;
@@ -5721,17 +5742,21 @@ declare const index$5_SyncStateResolveOptions: typeof SyncStateResolveOptions;
5721
5742
  declare const index$5_SyncStateResolveResult: typeof SyncStateResolveResult;
5722
5743
  type index$5_UncommittedChangesError = UncommittedChangesError;
5723
5744
  declare const index$5_UncommittedChangesError: typeof UncommittedChangesError;
5745
+ type index$5_WorktreeSetupError = WorktreeSetupError;
5746
+ declare const index$5_WorktreeSetupError: typeof WorktreeSetupError;
5724
5747
  declare const index$5_isActorIdentityMismatchError: typeof isActorIdentityMismatchError;
5725
5748
  declare const index$5_isConflictMarkersPresentError: typeof isConflictMarkersPresentError;
5726
5749
  declare const index$5_isCryptoModuleRequiredError: typeof isCryptoModuleRequiredError;
5727
5750
  declare const index$5_isIntegrityViolationError: typeof isIntegrityViolationError;
5728
5751
  declare const index$5_isNoRebaseInProgressError: typeof isNoRebaseInProgressError;
5729
5752
  declare const index$5_isPushFromStateBranchError: typeof isPushFromStateBranchError;
5753
+ declare const index$5_isRebaseAlreadyInProgressError: typeof isRebaseAlreadyInProgressError;
5730
5754
  declare const index$5_isStateBranchSetupError: typeof isStateBranchSetupError;
5731
5755
  declare const index$5_isSyncStateError: typeof isSyncStateError;
5732
5756
  declare const index$5_isUncommittedChangesError: typeof isUncommittedChangesError;
5757
+ declare const index$5_isWorktreeSetupError: typeof isWorktreeSetupError;
5733
5758
  declare namespace index$5 {
5734
- export { index$5_ActorIdentityMismatchError as ActorIdentityMismatchError, AuditScope$1 as AuditScope, index$5_AuditStateOptions as AuditStateOptions, index$5_AuditStateReport as AuditStateReport, index$5_ConflictDiff as ConflictDiff, index$5_ConflictFileDiff as ConflictFileDiff, index$5_ConflictInfo as ConflictInfo, index$5_ConflictMarkersPresentError as ConflictMarkersPresentError, index$5_ConflictType as ConflictType, index$5_CryptoModuleRequiredError as CryptoModuleRequiredError, index$5_ExpectedFilesScope as ExpectedFilesScope, index$5_ISyncStateModule as ISyncStateModule, index$5_IntegrityViolation as IntegrityViolation, index$5_IntegrityViolationError as IntegrityViolationError, index$5_NoRebaseInProgressError as NoRebaseInProgressError, index$5_PullScheduler as PullScheduler, type index$5_PullSchedulerConfig as PullSchedulerConfig, type index$5_PullSchedulerDependencies as PullSchedulerDependencies, type index$5_PullSchedulerResult as PullSchedulerResult, index$5_PushFromStateBranchError as PushFromStateBranchError, index$5_StateBranchSetupError as StateBranchSetupError, index$5_StateDeltaFile as StateDeltaFile, index$5_SyncStateError as SyncStateError, index$5_SyncStateModuleDependencies as SyncStateModuleDependencies, index$5_SyncStatePullOptions as SyncStatePullOptions, index$5_SyncStatePullResult as SyncStatePullResult, index$5_SyncStatePushOptions as SyncStatePushOptions, index$5_SyncStatePushResult as SyncStatePushResult, index$5_SyncStateResolveOptions as SyncStateResolveOptions, index$5_SyncStateResolveResult as SyncStateResolveResult, index$5_UncommittedChangesError as UncommittedChangesError, index$5_isActorIdentityMismatchError as isActorIdentityMismatchError, index$5_isConflictMarkersPresentError as isConflictMarkersPresentError, index$5_isCryptoModuleRequiredError as isCryptoModuleRequiredError, index$5_isIntegrityViolationError as isIntegrityViolationError, index$5_isNoRebaseInProgressError as isNoRebaseInProgressError, index$5_isPushFromStateBranchError as isPushFromStateBranchError, index$5_isStateBranchSetupError as isStateBranchSetupError, index$5_isSyncStateError as isSyncStateError, index$5_isUncommittedChangesError as isUncommittedChangesError };
5759
+ export { index$5_ActorIdentityMismatchError as ActorIdentityMismatchError, AuditScope$1 as AuditScope, index$5_AuditStateOptions as AuditStateOptions, index$5_AuditStateReport as AuditStateReport, index$5_ConflictDiff as ConflictDiff, index$5_ConflictFileDiff as ConflictFileDiff, index$5_ConflictInfo as ConflictInfo, index$5_ConflictMarkersPresentError as ConflictMarkersPresentError, index$5_ConflictType as ConflictType, index$5_CryptoModuleRequiredError as CryptoModuleRequiredError, index$5_ExpectedFilesScope as ExpectedFilesScope, index$5_ISyncStateModule as ISyncStateModule, index$5_IntegrityViolation as IntegrityViolation, index$5_IntegrityViolationError as IntegrityViolationError, index$5_NoRebaseInProgressError as NoRebaseInProgressError, index$5_PullScheduler as PullScheduler, type index$5_PullSchedulerConfig as PullSchedulerConfig, type index$5_PullSchedulerDependencies as PullSchedulerDependencies, type index$5_PullSchedulerResult as PullSchedulerResult, index$5_PushFromStateBranchError as PushFromStateBranchError, index$5_RebaseAlreadyInProgressError as RebaseAlreadyInProgressError, index$5_StateBranchSetupError as StateBranchSetupError, index$5_StateDeltaFile as StateDeltaFile, index$5_SyncStateError as SyncStateError, index$5_SyncStateModuleDependencies as SyncStateModuleDependencies, index$5_SyncStatePullOptions as SyncStatePullOptions, index$5_SyncStatePullResult as SyncStatePullResult, index$5_SyncStatePushOptions as SyncStatePushOptions, index$5_SyncStatePushResult as SyncStatePushResult, index$5_SyncStateResolveOptions as SyncStateResolveOptions, index$5_SyncStateResolveResult as SyncStateResolveResult, index$5_UncommittedChangesError as UncommittedChangesError, index$5_WorktreeSetupError as WorktreeSetupError, index$5_isActorIdentityMismatchError as isActorIdentityMismatchError, index$5_isConflictMarkersPresentError as isConflictMarkersPresentError, index$5_isCryptoModuleRequiredError as isCryptoModuleRequiredError, index$5_isIntegrityViolationError as isIntegrityViolationError, index$5_isNoRebaseInProgressError as isNoRebaseInProgressError, index$5_isPushFromStateBranchError as isPushFromStateBranchError, index$5_isRebaseAlreadyInProgressError as isRebaseAlreadyInProgressError, index$5_isStateBranchSetupError as isStateBranchSetupError, index$5_isSyncStateError as isSyncStateError, index$5_isUncommittedChangesError as isUncommittedChangesError, index$5_isWorktreeSetupError as isWorktreeSetupError };
5735
5760
  }
5736
5761
 
5737
5762
  /**
package/dist/src/index.js CHANGED
@@ -7065,11 +7065,11 @@ var KeyProviderError = class extends Error {
7065
7065
  }
7066
7066
  };
7067
7067
  var FsKeyProvider = class {
7068
- actorsDir;
7068
+ keysDir;
7069
7069
  extension;
7070
7070
  fileMode;
7071
7071
  constructor(options) {
7072
- this.actorsDir = options.actorsDir;
7072
+ this.keysDir = options.keysDir;
7073
7073
  this.extension = options.extension ?? ".key";
7074
7074
  this.fileMode = options.fileMode ?? 384;
7075
7075
  }
@@ -7100,14 +7100,14 @@ var FsKeyProvider = class {
7100
7100
  }
7101
7101
  /**
7102
7102
  * [EARS-KP03] Stores a private key for an actor.
7103
- * [EARS-FKP01] Creates actorsDir if not exists.
7104
- * [EARS-FKP02] Writes key to {actorsDir}/{actorId}.key.
7103
+ * [EARS-FKP01] Creates keysDir if not exists.
7104
+ * [EARS-FKP02] Writes key to {keysDir}/{actorId}.key.
7105
7105
  * [EARS-FKP03] Sets secure file permissions (0600).
7106
7106
  */
7107
7107
  async setPrivateKey(actorId, privateKey) {
7108
7108
  const keyPath = this.getKeyPath(actorId);
7109
7109
  try {
7110
- await fs.mkdir(this.actorsDir, { recursive: true });
7110
+ await fs.mkdir(this.keysDir, { recursive: true });
7111
7111
  await fs.writeFile(keyPath, privateKey, "utf-8");
7112
7112
  await fs.chmod(keyPath, this.fileMode);
7113
7113
  } catch (error) {
@@ -7155,7 +7155,7 @@ var FsKeyProvider = class {
7155
7155
  */
7156
7156
  getKeyPath(actorId) {
7157
7157
  const sanitized = this.sanitizeActorId(actorId);
7158
- return path2.join(this.actorsDir, `${sanitized}${this.extension}`);
7158
+ return path2.join(this.keysDir, `${sanitized}${this.extension}`);
7159
7159
  }
7160
7160
  /**
7161
7161
  * [EARS-FKP04] Sanitizes actorId to prevent directory traversal.
@@ -8233,18 +8233,22 @@ __export(sync_state_exports, {
8233
8233
  NoRebaseInProgressError: () => NoRebaseInProgressError,
8234
8234
  PullScheduler: () => PullScheduler,
8235
8235
  PushFromStateBranchError: () => PushFromStateBranchError,
8236
+ RebaseAlreadyInProgressError: () => RebaseAlreadyInProgressError,
8236
8237
  StateBranchSetupError: () => StateBranchSetupError,
8237
8238
  SyncStateError: () => SyncStateError,
8238
8239
  UncommittedChangesError: () => UncommittedChangesError,
8240
+ WorktreeSetupError: () => WorktreeSetupError,
8239
8241
  isActorIdentityMismatchError: () => isActorIdentityMismatchError,
8240
8242
  isConflictMarkersPresentError: () => isConflictMarkersPresentError,
8241
8243
  isCryptoModuleRequiredError: () => isCryptoModuleRequiredError,
8242
8244
  isIntegrityViolationError: () => isIntegrityViolationError,
8243
8245
  isNoRebaseInProgressError: () => isNoRebaseInProgressError,
8244
8246
  isPushFromStateBranchError: () => isPushFromStateBranchError,
8247
+ isRebaseAlreadyInProgressError: () => isRebaseAlreadyInProgressError,
8245
8248
  isStateBranchSetupError: () => isStateBranchSetupError,
8246
8249
  isSyncStateError: () => isSyncStateError,
8247
- isUncommittedChangesError: () => isUncommittedChangesError
8250
+ isUncommittedChangesError: () => isUncommittedChangesError,
8251
+ isWorktreeSetupError: () => isWorktreeSetupError
8248
8252
  });
8249
8253
 
8250
8254
  // src/sync_state/pull_scheduler.ts
@@ -8514,6 +8518,25 @@ var ActorIdentityMismatchError = class _ActorIdentityMismatchError extends SyncS
8514
8518
  Object.setPrototypeOf(this, _ActorIdentityMismatchError.prototype);
8515
8519
  }
8516
8520
  };
8521
+ var WorktreeSetupError = class _WorktreeSetupError extends SyncStateError {
8522
+ constructor(reason, worktreePath, underlyingError) {
8523
+ super(`Failed to setup worktree at ${worktreePath}: ${reason}`);
8524
+ this.reason = reason;
8525
+ this.worktreePath = worktreePath;
8526
+ this.underlyingError = underlyingError;
8527
+ this.name = "WorktreeSetupError";
8528
+ Object.setPrototypeOf(this, _WorktreeSetupError.prototype);
8529
+ }
8530
+ };
8531
+ var RebaseAlreadyInProgressError = class _RebaseAlreadyInProgressError extends SyncStateError {
8532
+ constructor() {
8533
+ super(
8534
+ `A rebase is already in progress. Resolve the conflict with 'gitgov sync resolve --reason "..."' before pulling or pushing.`
8535
+ );
8536
+ this.name = "RebaseAlreadyInProgressError";
8537
+ Object.setPrototypeOf(this, _RebaseAlreadyInProgressError.prototype);
8538
+ }
8539
+ };
8517
8540
  var UncommittedChangesError = class _UncommittedChangesError extends SyncStateError {
8518
8541
  branch;
8519
8542
  constructor(branchName) {
@@ -8552,6 +8575,12 @@ function isCryptoModuleRequiredError(error) {
8552
8575
  function isActorIdentityMismatchError(error) {
8553
8576
  return error instanceof ActorIdentityMismatchError;
8554
8577
  }
8578
+ function isWorktreeSetupError(error) {
8579
+ return error instanceof WorktreeSetupError;
8580
+ }
8581
+ function isRebaseAlreadyInProgressError(error) {
8582
+ return error instanceof RebaseAlreadyInProgressError;
8583
+ }
8555
8584
 
8556
8585
  // src/record_validations/index.ts
8557
8586
  var record_validations_exports = {};