refactor: update documentation and API references for version bump and search functionalities

This commit is contained in:
Alex Newman
2025-12-14 20:12:39 -05:00
parent 2ec72f948d
commit b97579dfec
10 changed files with 82 additions and 147 deletions
+13 -17
View File
@@ -32,7 +32,7 @@ const TOOL_ENDPOINT_MAP: Record<string, string> = {
'timeline': '/api/timeline',
'get_recent_context': '/api/context/recent',
'get_context_timeline': '/api/context/timeline',
'progressive_ix': '/api/instructions'
'progressive_description': '/api/instructions'
};
/**
@@ -182,15 +182,14 @@ async function verifyWorkerConnection(): Promise<boolean> {
/**
* Tool definitions with HTTP-based handlers
* Descriptions removed - use progressive_ix tool for parameter documentation
* Descriptions removed - use progressive_description tool for parameter documentation
*/
const tools = [
{
name: 'search',
description: 'Search observations, sessions, and prompts',
description: 'Search memory',
inputSchema: z.object({
query: z.string().optional(),
format: z.enum(['index', 'full']).default('index'),
type: z.enum(['observations', 'sessions', 'prompts']).optional(),
obs_type: z.string().optional(),
concepts: z.string().optional(),
@@ -209,13 +208,12 @@ const tools = [
},
{
name: 'timeline',
description: 'Get timeline around observation ID or query',
description: 'Timeline context',
inputSchema: z.object({
query: z.string().optional(),
anchor: z.number().optional(),
depth_before: z.number().min(0).max(100).default(10),
depth_after: z.number().min(0).max(100).default(10),
format: z.enum(['index', 'full']).default('index'),
type: z.string().optional(),
concepts: z.string().optional(),
files: z.string().optional(),
@@ -228,10 +226,9 @@ const tools = [
},
{
name: 'get_recent_context',
description: 'Get recent timeline items',
description: 'Recent context',
inputSchema: z.object({
limit: z.number().min(1).max(100).default(30),
format: z.enum(['index', 'full']).default('index'),
type: z.string().optional(),
concepts: z.string().optional(),
files: z.string().optional(),
@@ -246,12 +243,11 @@ const tools = [
},
{
name: 'get_context_timeline',
description: 'Get timeline around specific observation',
description: 'Timeline around ID',
inputSchema: z.object({
anchor: z.number(),
depth_before: z.number().min(0).max(100).default(10),
depth_after: z.number().min(0).max(100).default(10),
format: z.enum(['index', 'full']).default('index'),
type: z.string().optional(),
concepts: z.string().optional(),
files: z.string().optional(),
@@ -263,19 +259,19 @@ const tools = [
}
},
{
name: 'progressive_ix',
description: 'Load parameter docs and usage instructions',
name: 'progressive_description',
description: 'Usage help',
inputSchema: z.object({
topic: z.enum(['workflow', 'search_params', 'examples', 'all']).default('all')
}),
handler: async (args: any) => {
const endpoint = TOOL_ENDPOINT_MAP['progressive_ix'];
const endpoint = TOOL_ENDPOINT_MAP['progressive_description'];
return await callWorkerAPI(endpoint, args);
}
},
{
name: 'get_observation',
description: 'Get observation by ID',
description: 'Fetch by ID',
inputSchema: z.object({
id: z.number()
}),
@@ -285,7 +281,7 @@ const tools = [
},
{
name: 'get_batch_observations',
description: 'Get multiple observations by IDs',
description: 'Batch fetch',
inputSchema: z.object({
ids: z.array(z.number()),
orderBy: z.enum(['date_desc', 'date_asc']).optional(),
@@ -298,7 +294,7 @@ const tools = [
},
{
name: 'get_session',
description: 'Get session summary by ID',
description: 'Session by ID',
inputSchema: z.object({
id: z.number()
}),
@@ -308,7 +304,7 @@ const tools = [
},
{
name: 'get_prompt',
description: 'Get user prompt by ID',
description: 'Prompt by ID',
inputSchema: z.object({
id: z.number()
}),
+11 -17
View File
@@ -45,7 +45,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Unified search (observations + sessions + prompts)
* GET /api/search?query=...&type=observations&format=index&limit=20
* GET /api/search?query=...&type=observations&limit=20
*/
private handleUnifiedSearch = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.search(req.query);
@@ -63,7 +63,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Semantic shortcut for finding decision observations
* GET /api/decisions?format=index&limit=20
* GET /api/decisions?limit=20
*/
private handleDecisions = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.decisions(req.query);
@@ -72,7 +72,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Semantic shortcut for finding change-related observations
* GET /api/changes?format=index&limit=20
* GET /api/changes?limit=20
*/
private handleChanges = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.changes(req.query);
@@ -81,7 +81,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Semantic shortcut for finding "how it works" explanations
* GET /api/how-it-works?format=index&limit=20
* GET /api/how-it-works?limit=20
*/
private handleHowItWorks = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.howItWorks(req.query);
@@ -90,7 +90,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Search observations (use /api/search?type=observations instead)
* GET /api/search/observations?query=...&format=index&limit=20&project=...
* GET /api/search/observations?query=...&limit=20&project=...
*/
private handleSearchObservations = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.searchObservations(req.query);
@@ -99,7 +99,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Search session summaries
* GET /api/search/sessions?query=...&format=index&limit=20
* GET /api/search/sessions?query=...&limit=20
*/
private handleSearchSessions = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.searchSessions(req.query);
@@ -108,7 +108,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Search user prompts
* GET /api/search/prompts?query=...&format=index&limit=20
* GET /api/search/prompts?query=...&limit=20
*/
private handleSearchPrompts = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.searchUserPrompts(req.query);
@@ -117,7 +117,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Search observations by concept
* GET /api/search/by-concept?concept=discovery&format=index&limit=5
* GET /api/search/by-concept?concept=discovery&limit=5
*/
private handleSearchByConcept = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.findByConcept(req.query);
@@ -126,7 +126,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Search by file path
* GET /api/search/by-file?filePath=...&format=index&limit=10
* GET /api/search/by-file?filePath=...&limit=10
*/
private handleSearchByFile = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.findByFile(req.query);
@@ -135,7 +135,7 @@ export class SearchRoutes extends BaseRouteHandler {
/**
* Search observations by type
* GET /api/search/by-type?type=bugfix&format=index&limit=10
* GET /api/search/by-type?type=bugfix&limit=10
*/
private handleSearchByType = this.wrapHandler(async (req: Request, res: Response): Promise<void> => {
const result = await this.searchManager.findByType(req.query);
@@ -252,7 +252,6 @@ export class SearchRoutes extends BaseRouteHandler {
description: 'Search observations using full-text search',
parameters: {
query: 'Search query (required)',
format: 'Response format: "index" or "full" (default: "full")',
limit: 'Number of results (default: 20)',
project: 'Filter by project name (optional)'
}
@@ -263,7 +262,6 @@ export class SearchRoutes extends BaseRouteHandler {
description: 'Search session summaries using full-text search',
parameters: {
query: 'Search query (required)',
format: 'Response format: "index" or "full" (default: "full")',
limit: 'Number of results (default: 20)'
}
},
@@ -273,7 +271,6 @@ export class SearchRoutes extends BaseRouteHandler {
description: 'Search user prompts using full-text search',
parameters: {
query: 'Search query (required)',
format: 'Response format: "index" or "full" (default: "full")',
limit: 'Number of results (default: 20)',
project: 'Filter by project name (optional)'
}
@@ -284,7 +281,6 @@ export class SearchRoutes extends BaseRouteHandler {
description: 'Find observations by concept tag',
parameters: {
concept: 'Concept tag (required): discovery, decision, bugfix, feature, refactor',
format: 'Response format: "index" or "full" (default: "full")',
limit: 'Number of results (default: 10)',
project: 'Filter by project name (optional)'
}
@@ -295,7 +291,6 @@ export class SearchRoutes extends BaseRouteHandler {
description: 'Find observations and sessions by file path',
parameters: {
filePath: 'File path or partial path (required)',
format: 'Response format: "index" or "full" (default: "full")',
limit: 'Number of results per type (default: 10)',
project: 'Filter by project name (optional)'
}
@@ -306,7 +301,6 @@ export class SearchRoutes extends BaseRouteHandler {
description: 'Find observations by type',
parameters: {
type: 'Observation type (required): discovery, decision, bugfix, feature, refactor',
format: 'Response format: "index" or "full" (default: "full")',
limit: 'Number of results (default: 10)',
project: 'Filter by project name (optional)'
}
@@ -350,7 +344,7 @@ export class SearchRoutes extends BaseRouteHandler {
}
],
examples: [
'curl "http://localhost:37777/api/search/observations?query=authentication&format=index&limit=5"',
'curl "http://localhost:37777/api/search/observations?query=authentication&limit=5"',
'curl "http://localhost:37777/api/search/by-type?type=bugfix&limit=10"',
'curl "http://localhost:37777/api/context/recent?project=claude-mem&limit=3"',
'curl "http://localhost:37777/api/context/timeline?anchor=123&depth_before=5&depth_after=5"'