Skip to content

Support configurable API version via EVERMEM_API_VERSION env var #7

@arturito-agent

Description

@arturito-agent

Problem

The plugin has /api/v0/ hardcoded in three places inside hooks/scripts/utils/evermem-api.js:

Line Endpoint
75 GET /api/v0/memories/search
169 POST/DELETE /api/v0/memories
256 GET /api/v0/memories (with params)

Users running self-hosted EverMemOS (or other deployments) that expose /api/v1/ cannot use the plugin without manually patching the file after every update.

Proposed fix

Add a getApiVersion() function to config.js that reads an optional EVERMEM_API_VERSION env var and defaults to 'v0' for full backwards compatibility:

// config.js
export function getApiVersion() {
  return process.env.EVERMEM_API_VERSION || 'v0';
}

export function getConfig() {
  return {
    // ...existing fields...
    apiVersion: getApiVersion(),
  };
}

Then replace the three hardcoded paths in evermem-api.js:

// Before
`${config.apiBaseUrl}/api/v0/memories/search`

// After
`${config.apiBaseUrl}/api/${config.apiVersion}/memories/search`

Impact

  • Zero breaking changes — default is v0, existing installations are unaffected.
  • Self-hosted users just add EVERMEM_API_VERSION=v1 to their .env or environment.

Happy to submit a PR if you'd like!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions