🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis
Socket
Book a DemoInstallSign in
Socket

@aigne/did-space-memory

Package Overview
Dependencies
Maintainers
2
Versions
127
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aigne/did-space-memory

DID Spaces memory for AIGNE framework

latest
Source
npmnpm
Version
1.3.4
Version published
Maintainers
2
Created
Source

@aigne/did-space-memory

AIGNE Logo

GitHub star chart Open Issues codecov NPM Version Elastic-2.0 licensed

DID Spaces memory system component for AIGNE Framework, providing cloud-based memory storage capabilities with DID Spaces.

Introduction

@aigne/did-space-memory is the DID Spaces memory system component of AIGNE Framework, providing cloud-based memory storage and retrieval functionality using DID Spaces. This component uses decentralized storage services to provide secure and reliable memory persistence capabilities for AI applications.

Features

  • Cloud Storage: Uses DID Spaces for secure cloud-based memory storage
  • Decentralized: Based on decentralized identity and storage technologies
  • Automatic Management: Supports automatic memory file management and README generation
  • Secure Authentication: Supports multiple authentication methods to ensure data security
  • YAML Format: Uses YAML format for memory storage, making it easy to read and maintain
  • TypeScript Support: Complete type definitions providing an excellent development experience

Installation

Using npm

npm install @aigne/did-space-memory

Using yarn

yarn add @aigne/did-space-memory

Using pnpm

pnpm add @aigne/did-space-memory

Basic Usage

import { AIAgent, AIGNE } from "@aigne/core";
import { DIDSpacesMemory } from "@aigne/did-space-memory";
import { OpenAIChatModel } from "@aigne/openai";

// Create AI model instance
const model = new OpenAIChatModel({
  apiKey: process.env.OPENAI_API_KEY,
  model: "gpt-4-turbo",
});

// Create DID Spaces memory system
const memory = new DIDSpacesMemory({
  url: process.env.DID_SPACES_URL!,
  auth: {
    authorization: process.env.DID_SPACES_AUTHORIZATION!,
  },
});

// Create AI agent with cloud-based memory
const agent = AIAgent.from({
  name: "CloudAssistant",
  instructions: "You are a helpful assistant with cloud-based memory.",
  memory: memory,
  inputKey: "message",
});

// Use AIGNE execution engine
const aigne = new AIGNE({ model });

// Invoke agent
const userAgent = await aigne.invoke(agent);

// Send message
const response = await userAgent.invoke({
  message: "I'm John, a doctor, and I like Bitcoin",
});

console.log(response.message);

// Query memory
const response2 = await userAgent.invoke({
  message: "What is my profession?",
});

console.log(response2.message);

Advanced Configuration

Custom Memory Agent Options

import { DIDSpacesMemory } from "@aigne/did-space-memory";

const memory = new DIDSpacesMemory({
  url: process.env.DID_SPACES_URL!,
  auth: {
    authorization: process.env.DID_SPACES_AUTHORIZATION!,
  },
  // Custom memory retriever agent configuration
  retrieverOptions: {
    name: "CustomRetriever",
    instructions: "Custom retrieval instructions",
  },
  // Custom memory recorder agent configuration
  recorderOptions: {
    name: "CustomRecorder",
    instructions: "Custom recording instructions",
  },
  // Other agent configurations
  autoUpdate: true,
});

Using Different Authentication Methods

const memory1 = new DIDSpacesMemory({
  url: "https://your-did-spaces-url.com",
  auth: {
    accessToken: process.env.DID_SPACES_ACCESS_TOKEN!,
  },
});

// Using authorization header authentication
const memory2 = new DIDSpacesMemory({
  url: "https://your-did-spaces-url.com",
  auth: {
    authorization: process.env.DID_SPACES_AUTHORIZATION!,
  },
});

Memory Management Features

const client = memory.client;

// List all memory files
const memories = await client.listObjects({
  prefix: "/memories/",
});

// Read specific memory file
const memoryContent = await client.getObject({
  key: "/memories/conversation-123/memory.yaml",
});

Environment Variables Configuration

Create a .env file and configure the following variables:

DID_SPACES_URL=https://your-did-spaces-url.com
DID_SPACES_AUTHORIZATION=your-authorization-token
# Or use access token
DID_SPACES_ACCESS_TOKEN=your-access-token

License

Elastic-2.0

FAQs

Package last updated on 06 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts