TypeScript SDK
Use the TypeScript client when you are building Node, web, or edge-adjacent apps.
The TypeScript SDK is a thin client over the public REST API.
It keeps the same public surface as the platform, but in TypeScript method form.
Install and initialize
Install
npm install axisdreamInitialize
import { Axisdream } from "axisdream";
const cog = new Axisdream();
const space = await cog.space("my-space");Core methods
MethodPurpose
space.retrieve(query, options)
Find relevant context
space.fetch(path | paths)
Read one or more exact files
space.add(path, content, bucket, topic, options?)
Create or replace a file
space.list(folder?)
Browse a folder
space.update(path, changes, options?)
Apply a targeted edit
space.forget(path)
Delete a file
space.updateConfidence(path, confidence)
Change a file confidence score
space.getRelatedFiles(path, relType?)
See directly related files
space.getTools()
Fetch the live public tool list
Typical flow
Search, write, read
const results = await space.retrieve("release checklist", {
query_variants: [
{ query: "focused release checklist intent", kind: "rewrite" },
{ query: "a passage about a release checklist", kind: "hyde" },
{ query: "release checklist ship confidence", kind: "exact" },
],
});
const related = results.results.map((item) => item.file_path);
await space.add(
"knowledge/release-checklist.md",
"# Release checklist\n\nShip with confidence.",
"knowledge",
"release",
{ related }
);
const file = await space.fetch("knowledge/release-checklist.md");
console.log(file.content);