界面已本地化;技能介绍与说明文档按所选语言由 AI 自动翻译,代码、命令、路径和专业术语保留原文,以原作者文档为准。
探索技能
开发与工程 · SKILL.md

typescript-rest-client

typescript-rest-client

【开发与工程】Use the @memmachine/client TypeScript REST client for Node/TypeScript project and memory operations, client defaults, API errors, build/test workflows, and self-hosted/cloud base URL troubleshooting.

独立 GitHub 快照 · 自动分类 · 以原作者文档为准

技能说明

GitHub

name: typescript-rest-client description: "Use the @memmachine/client TypeScript REST client for Node/TypeScript project and memory operations, client defaults, API errors, build/test workflows, and self-hosted/cloud base URL troubleshooting." disable-model-invocation: true metadata: disco-role: operating license: Apache 2.0

TypeScript REST Client

Use this sub-skill when a task names @memmachine/client, TypeScript/Node, MemMachineClient, MemMachineProject, MemMachineMemory, Axios errors, Jest tests, npm build/lint/format, or a TypeScript app that adds/searches MemMachine memories.

Route Within This Sub-skill

  • Read typescript-client-reference.md for classes, methods, constructor options, defaults, and option names.
  • Read workflows.md for install, project/memory operations, live/self-hosted base URL selection, build/test, and Python-to-TS translation patterns.
  • Read troubleshooting.md for Node/npm, ESM/CJS, proxy, Axios/API, base URL, auth, and option-name failures.
  • Run ts_client_recipe.mjs to print a safe TypeScript recipe or optionally run a live health check when explicit live arguments are supplied.

Quick Pattern

import MemMachineClient from '@memmachine/client'

const client = new MemMachineClient({
  base_url: 'https://api.memmachine.ai/v2',
  api_key: process.env.MEMMACHINE_API_KEY
})

const project = client.project({ org_id: 'my-org', project_id: 'my-project' })
const memory = project.memory({ user_id: 'alice', agent_id: 'assistant' })
await memory.add('Alice prefers aisle seats.', {
  metadata: { category: 'travel' },
  types: ['episodic', 'semantic']
})
const result = await memory.search('What seating does Alice prefer?', { top_k: 5 })

Important Defaults

  • Package: @memmachine/client.
  • Node engine in the source baseline: >=20.19.0.
  • Constructor default base_url: https://api.memmachine.ai/v2.
  • Constructor default timeout: 60000 ms.
  • Constructor default max_retries: 3.
  • Proxy environment variables can make the client choose a fetch adapter.

For a self-hosted server, confirm the correct REST prefix. A self-hosted FastAPI server commonly exposes /api/v2, while the TS client's cloud default ends in /v2. Set base_url to the exact prefix that makes /health and /memories/search resolve correctly.

Cross-links

我的收藏