From 68d75554652397dfc161771d416b8868315a4570 Mon Sep 17 00:00:00 2001 From: rrader2890 Date: Wed, 15 Jul 2026 11:41:43 -0400 Subject: [PATCH 1/2] release: v0.7.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index fb13c23..fde0fcd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@thinkfleet/memory-sdk", - "version": "0.3.0", + "version": "0.7.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@thinkfleet/memory-sdk", - "version": "0.3.0", + "version": "0.7.1", "license": "MIT", "devDependencies": { "@anthropic-ai/sdk": "^0.109.1", diff --git a/package.json b/package.json index 9700913..3b2634f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@thinkfleet/memory-sdk", - "version": "0.6.0", + "version": "0.7.1", "description": "TypeScript SDK for app.memmesh.ai — admin + project memory CRUD, semantic search, feedback, and Lattice behavioral patterns", "type": "module", "main": "./dist/index.cjs", From 8fde0baf7c2d9f7851ac7e5e83603aeddea7edcd Mon Sep 17 00:00:00 2001 From: rrader2890 Date: Tue, 21 Jul 2026 14:47:25 -0400 Subject: [PATCH 2/2] feat(brains): createFromProject high-level helper (#182) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add BrainsResource.createFromProject({ externalId, name, domain?, version?, visibility? }) — the easy path to turning a project's memory into a brain. It builds a sensible CreateBrainRequest with an empty-but-valid Brain Card (empty provenance + coverage; the server recomputes coverage from the project's memory) and calls the low-level create, which is left untouched. Defaults to version 1.0.0 + PRIVATE; the brain is created DRAFT and is not published. Also models the induced reasoning layer on BrainCard.coverage (BrainReasoningCoverage) to keep the SDK's Brain Card type in step with the server surface. New types exported from the package root. Co-Authored-By: Claude Opus 4.8 (1M context) --- src/index.ts | 2 ++ src/resources/brains.ts | 42 +++++++++++++++++++++++++++++++++++++++++ src/types/brain.ts | 36 ++++++++++++++++++++++++++++++++++- 3 files changed, 79 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index d22d1f2..af55d3d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -116,10 +116,12 @@ export { BrainsResource } from './resources/brains.js' export type { Brain, BrainCard, + BrainReasoningCoverage, BrainProvenance, BrainVisibility, BrainStatus, CreateBrainRequest, + CreateBrainFromProjectOptions, UpdateBrainRequest, ListBrainsParams, } from './types/brain.js' diff --git a/src/resources/brains.ts b/src/resources/brains.ts index 06ab46d..f1d4261 100644 --- a/src/resources/brains.ts +++ b/src/resources/brains.ts @@ -2,6 +2,7 @@ import type { HttpClient } from '../core/http-client.js' import type { RequestOptions, SeekPage } from '../core/types.js' import type { Brain, + CreateBrainFromProjectOptions, CreateBrainRequest, ListBrainsParams, UpdateBrainRequest, @@ -40,6 +41,47 @@ export class BrainsResource { return this.http.post('/brains', body, options) } + /** + * Create a brain from the calling project's memory — the easy, high-level path. + * + * Where {@link create} wants a full {@link CreateBrainRequest}, this builds a + * sensible one for you from just a slug + name (plus optional domain / version + * / visibility) and an empty-but-valid Brain Card. Coverage (subjects, facts, + * and the induced reasoning layer) is computed server-side from the project's + * own memory, so you don't pass it. The brain is created as a DRAFT + PRIVATE; + * publishing and pricing are deliberate, separate steps. + * + * @example + * ```ts + * const brain = await tf.brains.createFromProject({ + * externalId: 'my-support-playbook', + * name: 'Support Playbook', + * domain: 'support', + * }) + * // brain.status === 'DRAFT', brain.visibility === 'PRIVATE' + * + * // Publish it later, once you're ready: + * await tf.brains.update(brain.id, { visibility: 'PUBLIC', status: 'PUBLISHED' }) + * ``` + */ + async createFromProject( + opts: CreateBrainFromProjectOptions, + options?: RequestOptions, + ): Promise { + const body: CreateBrainRequest = { + externalId: opts.externalId, + name: opts.name, + domain: opts.domain, + version: opts.version ?? '1.0.0', + visibility: opts.visibility ?? 'PRIVATE', + // Empty-but-valid card: an empty provenance list and empty coverage. The + // server recomputes coverage from the project's memory; a real licensed + // provenance source is only required to publish PUBLIC (a separate step). + card: { provenance: [], coverage: {} }, + } + return this.create(body, options) + } + /** List the project's brains (cursor-paginated). */ async list(params?: ListBrainsParams, options?: RequestOptions): Promise> { return this.http.get>( diff --git a/src/types/brain.ts b/src/types/brain.ts index 7d7c44f..394f5ff 100644 --- a/src/types/brain.ts +++ b/src/types/brain.ts @@ -21,12 +21,29 @@ export interface BrainProvenance { url?: string } +/** + * Coverage the induced reasoning layer advertises on a Brain Card — the + * procedure/checklist/decomposition memories that make a brain worth more than a + * plain dataset. A facts-only brain reports `total: 0`. + */ +export interface BrainReasoningCoverage { + procedures?: number + checklists?: number + decompositions?: number + total?: number +} + /** The Brain Card manifest (stored on the brain, surfaced in the catalog). */ export interface BrainCard { ontologyRef?: string provenance?: BrainProvenance[] changelogRef?: string - coverage?: { subjects?: number; facts?: number; freshness?: string } + coverage?: { + subjects?: number + facts?: number + reasoning?: BrainReasoningCoverage + freshness?: string + } evaluation?: { benchmark?: string; score?: number } predictEnabled?: boolean pricing?: { model?: string; unit?: string } @@ -71,3 +88,20 @@ export interface ListBrainsParams { limit?: number cursor?: string } + +/** + * High-level options for {@link BrainsResource.createFromProject} — the easy + * path to turning a project's memory into a brain. A minimal set of fields; the + * Brain Card (provenance/coverage) is filled in for you. + */ +export interface CreateBrainFromProjectOptions { + /** Stable slug the Router addresses the brain by (unique per project). */ + externalId: string + name: string + /** Domain the brain covers, e.g. "finance". Required before publishing PUBLIC. */ + domain?: string + /** Semantic version. Defaults to "1.0.0". */ + version?: string + /** Defaults to "PRIVATE". A brain is only consumable once separately PUBLISHED. */ + visibility?: BrainVisibility +}