@soulcraft/brainy 5.3.0 → 5.3.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.
package/dist/brainy.js CHANGED
@@ -2027,7 +2027,7 @@ export class Brainy {
2027
2027
  const blobStorage = this.storage.blobStorage;
2028
2028
  const currentBranch = await this.getCurrentBranch();
2029
2029
  // Get current HEAD commit (parent)
2030
- const currentCommitHash = await refManager.resolveRef(`heads/${currentBranch}`);
2030
+ const currentCommitHash = await refManager.resolveRef(currentBranch);
2031
2031
  // Get current state statistics
2032
2032
  const entityCount = await this.getNounCount();
2033
2033
  const relationshipCount = await this.getVerbCount();
@@ -2441,7 +2441,7 @@ export class Brainy {
2441
2441
  throw new Error('Cannot delete current branch');
2442
2442
  }
2443
2443
  const refManager = this.storage.refManager;
2444
- await refManager.deleteRef(`heads/${branch}`);
2444
+ await refManager.deleteRef(branch);
2445
2445
  });
2446
2446
  }
2447
2447
  /**
@@ -2466,7 +2466,7 @@ export class Brainy {
2466
2466
  const commitLog = this.storage.commitLog;
2467
2467
  const currentBranch = await this.getCurrentBranch();
2468
2468
  // Get commit history for current branch
2469
- const commits = await commitLog.getHistory(`heads/${currentBranch}`, {
2469
+ const commits = await commitLog.getHistory(currentBranch, {
2470
2470
  maxCount: options?.limit || 10
2471
2471
  });
2472
2472
  // Map to expected format (compute hash for each commit)
@@ -221,9 +221,20 @@ export class BaseStorage extends BaseStorageAdapter {
221
221
  // Check if main branch exists, create if not
222
222
  const mainRef = await this.refManager.getRef('main');
223
223
  if (!mainRef) {
224
- // Create initial commit (empty tree)
224
+ // Create initial commit with empty tree
225
225
  const emptyTreeHash = '0000000000000000000000000000000000000000000000000000000000000000';
226
- await this.refManager.createBranch('main', emptyTreeHash, {
226
+ // Import CommitBuilder
227
+ const { CommitBuilder } = await import('./cow/CommitObject.js');
228
+ // Create initial commit object
229
+ const initialCommitHash = await CommitBuilder.create(this.blobStorage)
230
+ .tree(emptyTreeHash)
231
+ .parent(null)
232
+ .message('Initial commit')
233
+ .author('system')
234
+ .timestamp(Date.now())
235
+ .build();
236
+ // Create main branch pointing to initial commit
237
+ await this.refManager.createBranch('main', initialCommitHash, {
227
238
  description: 'Initial branch',
228
239
  author: 'system'
229
240
  });
@@ -91,7 +91,7 @@ export class VersionManager {
91
91
  // Get the commit hash that was just created
92
92
  const refManager = this.brain.refManager;
93
93
  const ref = await refManager.getRef(currentBranch);
94
- commitHash = ref;
94
+ commitHash = ref.commitHash;
95
95
  }
96
96
  else {
97
97
  // Use current HEAD commit
@@ -100,7 +100,7 @@ export class VersionManager {
100
100
  if (!ref) {
101
101
  throw new Error(`No commit exists on branch ${currentBranch}. Create a commit first or use createCommit: true`);
102
102
  }
103
- commitHash = ref;
103
+ commitHash = ref.commitHash;
104
104
  }
105
105
  // Create version metadata
106
106
  const version = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soulcraft/brainy",
3
- "version": "5.3.0",
3
+ "version": "5.3.2",
4
4
  "description": "Universal Knowledge Protocol™ - World's first Triple Intelligence database unifying vector, graph, and document search in one API. 31 nouns × 40 verbs for infinite expressiveness.",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",