Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apps/memos-local-openclaw/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"version": "1.0.9-beta.1",
"description": "MemOS Local memory plugin for OpenClaw — full-write, hybrid-recall, progressive retrieval",
"type": "module",
"main": "index.ts",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"index.ts",
"src",
"dist",
"skill",
"prebuilds",
"scripts/native-binding.cjs",
Expand All @@ -19,7 +19,7 @@
"openclaw": {
"id": "memos-local-openclaw-plugin",
"extensions": [
"./index.ts"
"./dist/index.js"
],
"skills": [
"skill/memos-memory-guide"
Expand All @@ -34,7 +34,7 @@
"test:watch": "vitest",
"test:accuracy": "tsx scripts/run-accuracy-test.ts",
"postinstall": "node scripts/postinstall.cjs",
"prepublishOnly": "echo 'Source-only publish — no build needed.'"
"prepack": "npm run build"
},
"keywords": [
"openclaw",
Expand Down
82 changes: 82 additions & 0 deletions apps/memos-local-openclaw/tests/verify-npm-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/bin/bash
# Test script to verify the npm package includes compiled output

set -e

echo "Testing @memtensor/memos-local-openclaw-plugin package..."

cd "$(dirname "$0")/.."

# Run build
echo "1. Running build..."
npm run build

# Check dist/ directory exists
if [ ! -d "dist" ]; then
echo "✗ FAIL: dist/ directory not found"
exit 1
fi
echo "✓ dist/ directory exists"

# Check main entry point
if [ ! -f "dist/index.js" ]; then
echo "✗ FAIL: dist/index.js not found"
exit 1
fi
echo "✓ dist/index.js exists"

# Check type declarations
if [ ! -f "dist/index.d.ts" ]; then
echo "✗ FAIL: dist/index.d.ts not found"
exit 1
fi
echo "✓ dist/index.d.ts exists"

# Check compiled src files
if [ ! -d "dist/src" ]; then
echo "✗ FAIL: dist/src/ directory not found"
exit 1
fi
echo "✓ dist/src/ directory exists"

# Verify package.json points to compiled output
MAIN_ENTRY=$(node -p "require('./package.json').main")
if [ "$MAIN_ENTRY" != "dist/index.js" ]; then
echo "✗ FAIL: package.json main field is '$MAIN_ENTRY', expected 'dist/index.js'"
exit 1
fi
echo "✓ package.json main points to dist/index.js"

# Verify openclaw.extensions points to compiled output
OPENCLAW_EXT=$(node -p "require('./package.json').openclaw.extensions[0]")
if [ "$OPENCLAW_EXT" != "./dist/index.js" ]; then
echo "✗ FAIL: openclaw.extensions is '$OPENCLAW_EXT', expected './dist/index.js'"
exit 1
fi
echo "✓ openclaw.extensions points to ./dist/index.js"

# Simulate npm pack and verify dist is included
echo "2. Simulating npm pack..."
PACK_OUTPUT=$(npm pack --dry-run 2>&1)
if ! echo "$PACK_OUTPUT" | grep -q "dist/index.js"; then
echo "✗ FAIL: dist/index.js not included in npm package"
exit 1
fi
echo "✓ dist/index.js will be included in npm package"

if ! echo "$PACK_OUTPUT" | grep -q "dist/src/"; then
echo "✗ FAIL: dist/src/ not included in npm package"
exit 1
fi
echo "✓ dist/src/ will be included in npm package"

# Verify TypeScript source is NOT included (but .d.ts type declarations are OK)
if echo "$PACK_OUTPUT" | grep -E "npm notice.*(index\.ts|src/.+\.ts)" | grep -v "\.d\.ts" | grep -q .; then
echo "✗ FAIL: TypeScript source files should not be included in npm package"
exit 1
fi
echo "✓ TypeScript source files excluded from npm package (type declarations OK)"

echo ""
echo "✓ All tests passed!"
echo "The package now correctly ships compiled JavaScript output in dist/"
16 changes: 10 additions & 6 deletions apps/memos-local-openclaw/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "CommonJS",
"module": "ES2022",
"lib": ["ES2022"],
"outDir": "dist",
"rootDir": "src",
"strict": true,
"rootDir": ".",
"strict": false,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"moduleResolution": "node"
"moduleResolution": "bundler",
"allowImportingTsExtensions": false,
"paths": {
"openclaw/plugin-sdk": ["./types/openclaw__plugin-sdk/index.d.ts"]
}
},
"include": ["src"],
"exclude": ["node_modules", "dist", "**/*.test.ts"]
"include": ["src", "index.ts"],
"exclude": ["node_modules", "dist", "**/*.test.ts", "scripts", "tests", "skill", "plugin-impl.ts"]
}
11 changes: 11 additions & 0 deletions apps/memos-local-openclaw/types/openclaw__plugin-sdk/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
* Type declarations for openclaw/plugin-sdk
* This module is provided by the OpenClaw runtime environment
*/

export interface OpenClawPluginApi {
registerTool(tool: any, options?: any): void;
[key: string]: any;
}

export const plugin: OpenClawPluginApi;
Loading