fix(memory,shared): CRLF frontmatter migration (#5107) + unguessable shared session ids; memory 3.4.1, shared 3.0.11 (#5130)

* fix(memory): migrate CRLF markdown frontmatter like LF (#5107)

Cherry-picked from #5109.

Co-Authored-By: RuFlo <ruv@ruv.net>

* fix(shared): unguessable MCP session ids; publish memory 3.4.1 + shared 3.0.11

- shared: session ids use crypto.randomUUID() instead of Date.now() +
  Math.random() (same fix #5117 made in v3/mcp).
- memory 3.4.1 carries the CRLF frontmatter fix from #5109 (#5107).
- Both leaves are published; CLI and root pins moved to them.

Co-Authored-By: RuFlo <ruv@ruv.net>

---------

Co-authored-by: Lenin Mookiah <2639584+leninworld@users.noreply.github.com>
Co-authored-by: r <r@x>
This commit is contained in:
authored and GitHub committed 2026-11-26 09:08:18 -05:00
1 parent f68c21383a
commit 0c6ffbabfa
9 files changed
+65 -15

No files matched your search

+5 -5
View File
@@ -27,7 +27,7 @@
"@claude-flow/neural": "3.1.2",
"@claude-flow/plugin-agent-federation": "1.0.7",
"@claude-flow/security": "3.0.7",
"@claude-flow/shared": "3.0.10",
"@claude-flow/shared": "3.0.11",
"@electron/asar": "^4.3.1",
"@iarna/toml": "^2.2.5",
"@noble/ed25519": "2.3.0",
@@ -292,9 +292,9 @@
"link": true
},
"node_modules/@claude-flow/shared": {
"version": "3.0.10",
"resolved": "https://registry.npmjs.org/@claude-flow/shared/-/shared-3.0.10.tgz",
"integrity": "sha512-AioBoqEs/GTSjAdlnYEsJdma4msAWmmfQn07uB8ViRNnVrG5A1NFf1lJ47V7EhP36F7TFUOQlCzxaK6FqTgB5g==",
"version": "3.0.11",
"resolved": "https://registry.npmjs.org/@claude-flow/shared/-/shared-3.0.11.tgz",
"integrity": "sha512-cSsSyZ/Rbrd33AbGpVbsK3ZKICFE6m0u2FqDR31IG8vB3rdbNFQiUHISL26Pi1AqnTCziVhSTV0YC6SwMI2gKQ==",
"dependencies": {
"@types/ws": "^8.5.10",
"cors": "^2.8.5",
@@ -15635,7 +15635,7 @@
}
},
"v3/@claude-flow/shared": {
"version": "3.0.10",
"version": "3.0.11",
"dev": true,
"dependencies": {
"@types/ws": "^8.5.10",
+1 -1
View File
@@ -75,7 +75,7 @@
"@claude-flow/neural": "3.1.2",
"@claude-flow/plugin-agent-federation": "1.0.7",
"@claude-flow/security": "3.0.7",
"@claude-flow/shared": "3.0.10",
"@claude-flow/shared": "3.0.11",
"@electron/asar": "^4.3.1",
"@iarna/toml": "^2.2.5",
"@noble/ed25519": "2.3.0",
+3 -3
View File
@@ -115,7 +115,7 @@
"@claude-flow/neural": "3.1.2",
"@claude-flow/plugin-agent-federation": "1.0.7",
"@claude-flow/security": "3.0.7",
"@claude-flow/shared": "3.0.10",
"@claude-flow/shared": "3.0.11",
"@iarna/toml": "^2.2.5",
"@metaharness/darwin": "~0.16.0",
"@noble/ed25519": "2.3.0",
@@ -138,12 +138,12 @@
"ws": "^8.21.0",
"yaml": "^2.8.0",
"zod": "^4.6.7",
"@claude-flow/memory": "3.4.0"
"@claude-flow/memory": "3.4.1"
},
"optionalDependencies": {
"@agntcy/slim-bindings": "2.1.1",
"@claude-flow/aidefence": "3.2.2",
"@claude-flow/memory": "3.4.0",
"@claude-flow/memory": "3.4.1",
"@metaharness/flywheel": "~0.1.10",
"@metaharness/radio": "~0.1.0",
"@metaharness/turn-credit": "~0.1.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/memory",
"version": "3.4.0",
"version": "3.4.1",
"type": "module",
"description": "Memory module - AgentDB unification, HNSW indexing, vector search, hybrid SQLite+AgentDB backend (ADR-009)",
"homepage": "https://ruv.io",
@@ -0,0 +1,49 @@
import { describe, it, expect } from 'vitest';
import { mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { MemoryMigrator } from './migration.js';
import type { AgentDBAdapter } from './agentdb-adapter.js';
import type { MemoryEntry } from './types.js';
describe('MemoryMigrator — markdown frontmatter line endings', () => {
it.each([
['LF', '\n'],
['CRLF', '\r\n'],
])('migrates %s frontmatter', async (_name, newline) => {
const dir = mkdtempSync(join(tmpdir(), 'migration-markdown-'));
const content = [
'---',
"tags: ['a', 'b']",
'priority: 2',
'---',
'Body text line one.',
'Body text line two.',
].join(newline);
writeFileSync(join(dir, 'entry.md'), content);
const stored: MemoryEntry[] = [];
const target = {
store: async (entry: MemoryEntry) => {
stored.push(entry);
return entry;
},
} as unknown as AgentDBAdapter;
const migrator = new MemoryMigrator(target, {
source: 'markdown',
sourcePath: dir,
batchSize: 10,
});
try {
await migrator.migrate();
} finally {
rmSync(dir, { recursive: true, force: true });
}
expect(stored).toHaveLength(1);
expect(stored[0].content).toBe(`Body text line one.${newline}Body text line two.`);
expect(stored[0].tags).toEqual(['a', 'b']);
expect(stored[0].metadata).toMatchObject({ tags: ['a', 'b'], priority: 2 });
});
});
+1 -1
View File
@@ -656,7 +656,7 @@ export class MemoryMigrator extends EventEmitter {
basePath: string
): LegacyEntry | null {
// Extract frontmatter if present
const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n([\s\S]*)$/);
let metadata: Record<string, unknown> = {};
let body = content;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@claude-flow/shared",
"version": "3.0.10",
"version": "3.0.11",
"type": "module",
"description": "Shared types, event bus, config schemas and validators, MCP transport helpers and resilience utilities used by the Ruflo (claude-flow) V3 packages.",
"main": "dist/index.js",
@@ -15,6 +15,7 @@
*/
import { EventEmitter } from 'events';
import { randomUUID } from 'crypto';
import {
MCPSession,
SessionState,
@@ -393,7 +394,7 @@ export class SessionManager extends EventEmitter {
* Generate a unique session ID
*/
private generateSessionId(): string {
return `session-${++this.sessionCounter}-${Date.now()}-${Math.random().toString(36).substring(2, 8)}`;
return `session-${++this.sessionCounter}-${randomUUID()}`;
}
/**
+2 -2
View File
@@ -136,7 +136,7 @@ importers:
specifier: 3.0.7
version: link:../security
'@claude-flow/shared':
specifier: 3.0.10
specifier: 3.0.11
version: link:../shared
'@electron/asar':
specifier: ^4.3.1
@@ -224,7 +224,7 @@ importers:
specifier: 3.2.2
version: link:../aidefence
'@claude-flow/memory':
specifier: 3.4.0
specifier: 3.4.1
version: link:../memory
'@metaharness/flywheel':
specifier: ~0.1.10