@crewx/memory 0.1.23-rc.258 → 0.1.23-rc.259

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.
@@ -4,7 +4,7 @@ import type { MemoryEngineSettings } from './settings';
4
4
  export interface NativeMemoryArtifact {
5
5
  executablePath: string;
6
6
  packageRoot: string;
7
- packageVersion: string;
7
+ nativeBuildId: string;
8
8
  protocol: number;
9
9
  capabilities: string[];
10
10
  }
@@ -1 +1 @@
1
- "use strict";var w=exports&&exports.__createBinding||(Object.create?(function(e,r,i,t){if(t===void 0)t=i;var n=Object.getOwnPropertyDescriptor(r,i);if(!n||("get"in n?!r.__esModule:n.writable||n.configurable)){n={enumerable:true,get:function(){return r[i]}}}Object.defineProperty(e,t,n)}):(function(e,r,i,t){if(t===void 0)t=i;e[t]=r[i]}));var g=exports&&exports.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}):function(e,r){e["default"]=r});var y=exports&&exports.__importStar||(function(){var e=function(r){e=Object.getOwnPropertyNames||function(i){var t=[];for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n))t[t.length]=n;return t};return e(r)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null){for(var t=e(r),n=0;n<t.length;n++)if(t[n]!=="default")w(i,r,t[n])}g(i,r);return i}})();Object.defineProperty(exports,"__esModule",{value:true});exports.NATIVE_API_CAPABILITY=void 0;exports.getNativeMemoryArtifact=p;exports.nativeRuntimeMode=_;exports.isNativeAdapterAvailable=I;exports.callNativeRpc=c;exports.writeNativeOutput=M;exports.hostFor=m;exports.nativeLoadAllEntries=j;exports.nativeGetRecentEntries=C;exports.nativeRunCommand=T;exports.nativeRunHostCommand=V;exports.nativeGenerateSummary=B;const o=y(require("fs"));const s=y(require("path"));const b=require("child_process");const A=require("./native-host");exports.NATIVE_API_CAPABILITY="memory.api.v1";const N=4;const E=512*1024*1024;let l;function O(){const e=[];if(process.env.CREWX_SHELL_NATIVE_DIR){e.push(s.join(process.env.CREWX_SHELL_NATIVE_DIR,"@crewx","memory"))}const r=process.resourcesPath;if(typeof r==="string"){e.push(s.join(r,"shell-native","node_modules","@crewx","memory"))}let i=__dirname;for(let t=0;t<4;t++){e.push(i);const n=s.dirname(i);if(n===i)break;i=n}return e}function P(e){try{return JSON.parse(o.readFileSync(s.join(e,"package.json"),"utf8"))}catch{return null}}function R(e){const r=P(e);if(!r||r.name!=="@crewx/memory")return null;const i=s.join(e,"go","native-manifest.json");if(!o.existsSync(i))return null;const t=JSON.parse(o.readFileSync(i,"utf8"));if(typeof t.packageVersion!=="string"||!t.packageVersion)return null;if(r.version!==t.packageVersion)return null;const n=Number(t.protocol);if(n!==N)return null;if(!Array.isArray(t.capabilities)||!t.capabilities.includes(exports.NATIVE_API_CAPABILITY))return null;const a={darwin:"darwin",linux:"linux",win32:"windows"}[process.platform];const v={arm64:"arm64",x64:"amd64"}[process.arch];if(!a||!v)return null;const u=t.targets?.[`${a}-${v}`];if(!u||typeof u.file!=="string")return null;const f=s.resolve(e,...u.file.split("/"));if(!o.existsSync(f))return null;if(process.platform!=="win32"){try{const d=o.statSync(f);if((d.mode&73)===0)o.chmodSync(f,d.mode|493)}catch{}}const h=Array.isArray(u.capabilities)?u.capabilities.filter(d=>typeof d==="string"):t.capabilities;return{executablePath:f,packageRoot:e,packageVersion:t.packageVersion,protocol:n,capabilities:h}}function p(){if(l!==void 0)return l;l=null;for(const e of O()){try{const r=R(e);if(r){l=r;break}}catch{}}return l}function _(){const e=process.env.CREWX_MEMORY_RUNTIME??"auto";return e==="go"||e==="node"?e:"auto"}function I(){if(_()==="node")return false;return p()!==null}function S(){const e=p();if(!e){throw new Error("Native memory executable is unavailable. Reinstall @crewx/memory, or set CREWX_MEMORY_RUNTIME=node to use the existing implementation.")}return e}function c(e,r={}){const i=S();const t=(0,b.spawnSync)(i.executablePath,[`--crewx-memory-protocol=${i.protocol}`,`--crewx-memory-version=${i.packageVersion}`,"api","rpc"],{input:JSON.stringify({version:1,...e}),encoding:"utf8",env:r.env??process.env,maxBuffer:E,windowsHide:true});if(t.error)throw t.error;const n=(t.stderr??"").trim();let a;try{a=JSON.parse(t.stdout??"")}catch{if(t.status===null){throw new Error(`Native memory was terminated${t.signal?` (${t.signal})`:""}.`)}throw new Error(`Native memory returned an invalid response (exit ${t.status})${n?`: ${n}`:""}`)}if(t.status!==0||!a.ok){throw new Error(a.error??(n||`Native memory failed (exit ${t.status})`))}return a}function M(e){if(e.stdout)process.stdout.write(e.stdout);if(e.stderr)process.stderr.write(e.stderr)}function m(e){return(0,A.prepareNativeHost)(e)}function j(e,r,i=false){const t=c({op:"entries",dataDir:e,args:[r],includeBody:i});return t.result??[]}function C(e,r,i=30,t={}){const n=c({op:"recent",dataDir:e,args:[r],days:i,includeBody:Boolean(t.includeBody)});return n.result??[]}function T(e,r,i,t={},n={}){return c({op:"command",dataDir:e,command:r,args:i,flags:t,...n.body===void 0?{}:{body:n.body},...n.rawSave?{rawSave:true}:{}})}function V(e,r,i,t={}){const n=m(e);return c({op:"command",dataDir:e.dataDir,command:r,args:i,flags:t,host:n.request},{env:n.env})}function B(e,r,i){const t=m(e);const n=c({op:"summary",dataDir:e.dataDir,args:[r],flags:{force:i},host:t.request},{env:t.env});if(n.stderr)process.stderr.write(n.stderr);return n.result}
1
+ "use strict";var w=exports&&exports.__createBinding||(Object.create?(function(e,r,i,t){if(t===void 0)t=i;var n=Object.getOwnPropertyDescriptor(r,i);if(!n||("get"in n?!r.__esModule:n.writable||n.configurable)){n={enumerable:true,get:function(){return r[i]}}}Object.defineProperty(e,t,n)}):(function(e,r,i,t){if(t===void 0)t=i;e[t]=r[i]}));var b=exports&&exports.__setModuleDefault||(Object.create?(function(e,r){Object.defineProperty(e,"default",{enumerable:true,value:r})}):function(e,r){e["default"]=r});var y=exports&&exports.__importStar||(function(){var e=function(r){e=Object.getOwnPropertyNames||function(i){var t=[];for(var n in i)if(Object.prototype.hasOwnProperty.call(i,n))t[t.length]=n;return t};return e(r)};return function(r){if(r&&r.__esModule)return r;var i={};if(r!=null){for(var t=e(r),n=0;n<t.length;n++)if(t[n]!=="default")w(i,r,t[n])}b(i,r);return i}})();Object.defineProperty(exports,"__esModule",{value:true});exports.NATIVE_API_CAPABILITY=void 0;exports.getNativeMemoryArtifact=v;exports.nativeRuntimeMode=_;exports.isNativeAdapterAvailable=R;exports.callNativeRpc=u;exports.writeNativeOutput=B;exports.hostFor=m;exports.nativeLoadAllEntries=M;exports.nativeGetRecentEntries=j;exports.nativeRunCommand=C;exports.nativeRunHostCommand=T;exports.nativeGenerateSummary=$;const o=y(require("fs"));const s=y(require("path"));const g=require("child_process");const A=require("./native-host");exports.NATIVE_API_CAPABILITY="memory.api.v1";const N=5;const E=512*1024*1024;let l;function I(){const e=[];if(process.env.CREWX_SHELL_NATIVE_DIR){e.push(s.join(process.env.CREWX_SHELL_NATIVE_DIR,"@crewx","memory"))}const r=process.resourcesPath;if(typeof r==="string"){e.push(s.join(r,"shell-native","node_modules","@crewx","memory"))}let i=__dirname;for(let t=0;t<4;t++){e.push(i);const n=s.dirname(i);if(n===i)break;i=n}return e}function O(e){try{return JSON.parse(o.readFileSync(s.join(e,"package.json"),"utf8"))}catch{return null}}function P(e){const r=O(e);if(!r||r.name!=="@crewx/memory")return null;const i=s.join(e,"go","native-manifest.json");if(!o.existsSync(i))return null;const t=JSON.parse(o.readFileSync(i,"utf8"));if(typeof t.nativeBuildId!=="string"||!/^[0-9a-f]{64}$/u.test(t.nativeBuildId))return null;const n=Number(t.protocol);if(n!==N)return null;if(!Array.isArray(t.capabilities)||!t.capabilities.includes(exports.NATIVE_API_CAPABILITY))return null;const a={darwin:"darwin",linux:"linux",win32:"windows"}[process.platform];const p={arm64:"arm64",x64:"amd64"}[process.arch];if(!a||!p)return null;const c=t.targets?.[`${a}-${p}`];if(!c||typeof c.file!=="string")return null;const f=s.resolve(e,...c.file.split("/"));if(!o.existsSync(f))return null;if(process.platform!=="win32"){try{const d=o.statSync(f);if((d.mode&73)===0)o.chmodSync(f,d.mode|493)}catch{}}const h=Array.isArray(c.capabilities)?c.capabilities.filter(d=>typeof d==="string"):t.capabilities;return{executablePath:f,packageRoot:e,nativeBuildId:t.nativeBuildId,protocol:n,capabilities:h}}function v(){if(l!==void 0)return l;l=null;for(const e of I()){try{const r=P(e);if(r){l=r;break}}catch{}}return l}function _(){const e=process.env.CREWX_MEMORY_RUNTIME??"auto";return e==="go"||e==="node"?e:"auto"}function R(){if(_()==="node")return false;return v()!==null}function S(){const e=v();if(!e){throw new Error("Native memory executable is unavailable. Reinstall @crewx/memory, or set CREWX_MEMORY_RUNTIME=node to use the existing implementation.")}return e}function u(e,r={}){const i=S();const t=(0,g.spawnSync)(i.executablePath,[`--crewx-memory-protocol=${i.protocol}`,`--crewx-memory-build=${i.nativeBuildId}`,"api","rpc"],{input:JSON.stringify({version:1,...e}),encoding:"utf8",env:r.env??process.env,maxBuffer:E,windowsHide:true});if(t.error)throw t.error;const n=(t.stderr??"").trim();let a;try{a=JSON.parse(t.stdout??"")}catch{if(t.status===null){throw new Error(`Native memory was terminated${t.signal?` (${t.signal})`:""}.`)}throw new Error(`Native memory returned an invalid response (exit ${t.status})${n?`: ${n}`:""}`)}if(t.status!==0||!a.ok){throw new Error(a.error??(n||`Native memory failed (exit ${t.status})`))}return a}function B(e){if(e.stdout)process.stdout.write(e.stdout);if(e.stderr)process.stderr.write(e.stderr)}function m(e){return(0,A.prepareNativeHost)(e)}function M(e,r,i=false){const t=u({op:"entries",dataDir:e,args:[r],includeBody:i});return t.result??[]}function j(e,r,i=30,t={}){const n=u({op:"recent",dataDir:e,args:[r],days:i,includeBody:Boolean(t.includeBody)});return n.result??[]}function C(e,r,i,t={},n={}){return u({op:"command",dataDir:e,command:r,args:i,flags:t,...n.body===void 0?{}:{body:n.body},...n.rawSave?{rawSave:true}:{}})}function T(e,r,i,t={}){const n=m(e);return u({op:"command",dataDir:e.dataDir,command:r,args:i,flags:t,host:n.request},{env:n.env})}function $(e,r,i){const t=m(e);const n=u({op:"summary",dataDir:e.dataDir,args:[r],flags:{force:i},host:t.request},{env:t.env});if(n.stderr)process.stderr.write(n.stderr);return n.result}
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "formatVersion": 1,
3
- "protocol": 4,
3
+ "protocol": 5,
4
+ "nativeBuildId": "2a332e15b5379bad6d2b5482b0f9c092236c1b43c14b9aea121dba794b8832bd",
4
5
  "capabilities": [
5
6
  "memory.read.basic.v1",
6
7
  "memory.read.ordinary.v1",
@@ -8,11 +9,10 @@
8
9
  "memory.api.v1",
9
10
  "memory.summary.v1"
10
11
  ],
11
- "packageVersion": "0.1.23-rc.258",
12
12
  "targets": {
13
13
  "darwin-arm64": {
14
14
  "file": "go/bin/crewx-memory-darwin-arm64",
15
- "sha256": "8f6d3ae8f3d94a2785e8f9f6ef38992dd48b0e4d68bd98e52c431ee2c9167f63",
15
+ "sha256": "86c557bf6660a295b22cf5292f97e48b0802f1cd322a2cb59e9ecd82f2681fdf",
16
16
  "capabilities": [
17
17
  "memory.read.basic.v1",
18
18
  "memory.read.ordinary.v1",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "darwin-amd64": {
26
26
  "file": "go/bin/crewx-memory-darwin-amd64",
27
- "sha256": "c5e94a7b4007b6cc929cf29bd43e9003bfa357491c95e568fae41e2785b11bca",
27
+ "sha256": "f9f8ceec93d0cd923be63cb68425c0b3db8721e0672c9f59329e8a8ba0b7894e",
28
28
  "capabilities": [
29
29
  "memory.read.basic.v1",
30
30
  "memory.read.ordinary.v1",
@@ -36,7 +36,7 @@
36
36
  },
37
37
  "linux-amd64": {
38
38
  "file": "go/bin/crewx-memory-linux-amd64",
39
- "sha256": "d239ee1ca63deccc033e5cd28638c4b7214d621915f10dbbac11a350cda0d7e7",
39
+ "sha256": "25abea426cd108558bc9a939918a225ab567972b1158cf6453c094f23d6ac5f5",
40
40
  "capabilities": [
41
41
  "memory.read.basic.v1",
42
42
  "memory.read.ordinary.v1",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "linux-arm64": {
50
50
  "file": "go/bin/crewx-memory-linux-arm64",
51
- "sha256": "03fd02e433f5d9597e51fc75fd23e3d02bcbe9934a46144540ad348e7ec58cd3",
51
+ "sha256": "5f56a2a2963d6107edcfdcf27f67c4d4c5445c1a0325c80fa42d2411295f27db",
52
52
  "capabilities": [
53
53
  "memory.read.basic.v1",
54
54
  "memory.read.ordinary.v1",
@@ -60,7 +60,7 @@
60
60
  },
61
61
  "windows-amd64": {
62
62
  "file": "go/bin/crewx-memory-windows-amd64.exe",
63
- "sha256": "9e460216a0e4f6c7f21c6cbd270974fd2ebf27d1a04954661cfdedc4d460deeb",
63
+ "sha256": "4a5ca65d798250dc39bdf21de4ccad05bec329ce1686ac851a98c2b6e32a2f4a",
64
64
  "capabilities": [
65
65
  "memory.read.basic.v1",
66
66
  "memory.read.ordinary.v1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crewx/memory",
3
- "version": "0.1.23-rc.258",
3
+ "version": "0.1.23-rc.259",
4
4
  "description": "Memory engine for CrewX - markdown + frontmatter based long-term memory",
5
5
  "type": "commonjs",
6
6
  "main": "dist/src/engine.js",
@@ -42,9 +42,9 @@
42
42
  "gray-matter": "^4.0.3",
43
43
  "js-yaml": "^4.1.0",
44
44
  "nanoid": "^3.3.11",
45
- "@crewx/sdk": "0.9.0-rc.240",
46
- "@crewx/shared": "0.0.6-rc.155",
47
- "@crewx/knowledge-core": "0.1.17-rc.251"
45
+ "@crewx/sdk": "0.9.0-rc.241",
46
+ "@crewx/shared": "0.0.6-rc.156",
47
+ "@crewx/knowledge-core": "0.1.17-rc.252"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/js-yaml": "^4.0.9",