@contextstream/mcp-server 0.3.36 → 0.3.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +286 -40
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4144,6 +4144,7 @@ async function request(config, path7, options = {}) {
|
|
|
4144
4144
|
const url = `${apiUrl.replace(/\/$/, "")}${apiPath}`;
|
|
4145
4145
|
const maxRetries = options.retries ?? MAX_RETRIES;
|
|
4146
4146
|
const baseDelay = options.retryDelay ?? BASE_DELAY;
|
|
4147
|
+
const timeoutMs = typeof options.timeoutMs === "number" && options.timeoutMs > 0 ? options.timeoutMs : 18e4;
|
|
4147
4148
|
const headers = {
|
|
4148
4149
|
"Content-Type": "application/json",
|
|
4149
4150
|
"User-Agent": userAgent
|
|
@@ -4162,7 +4163,7 @@ async function request(config, path7, options = {}) {
|
|
|
4162
4163
|
let lastError = null;
|
|
4163
4164
|
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
4164
4165
|
const controller = new AbortController();
|
|
4165
|
-
const timeout = setTimeout(() => controller.abort(),
|
|
4166
|
+
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
4166
4167
|
if (options.signal) {
|
|
4167
4168
|
options.signal.addEventListener("abort", () => controller.abort());
|
|
4168
4169
|
}
|
|
@@ -4176,7 +4177,8 @@ async function request(config, path7, options = {}) {
|
|
|
4176
4177
|
if (options.signal?.aborted) {
|
|
4177
4178
|
throw new HttpError(0, "Request cancelled by user");
|
|
4178
4179
|
}
|
|
4179
|
-
|
|
4180
|
+
const seconds = Math.ceil(timeoutMs / 1e3);
|
|
4181
|
+
throw new HttpError(0, `Request timeout after ${seconds} seconds`);
|
|
4180
4182
|
}
|
|
4181
4183
|
lastError = new HttpError(0, error?.message || "Network error");
|
|
4182
4184
|
if (attempt < maxRetries) {
|
|
@@ -4197,7 +4199,12 @@ async function request(config, path7, options = {}) {
|
|
|
4197
4199
|
if (!response.ok) {
|
|
4198
4200
|
const rateLimit = parseRateLimitHeaders(response.headers);
|
|
4199
4201
|
const enrichedPayload = attachRateLimit(payload, rateLimit);
|
|
4200
|
-
const message =
|
|
4202
|
+
const message = rewriteNotFoundMessage({
|
|
4203
|
+
status: response.status,
|
|
4204
|
+
path: apiPath,
|
|
4205
|
+
message: extractErrorMessage(enrichedPayload, response.statusText),
|
|
4206
|
+
payload: enrichedPayload
|
|
4207
|
+
});
|
|
4201
4208
|
lastError = new HttpError(response.status, message, enrichedPayload);
|
|
4202
4209
|
const apiCode = extractErrorCode(enrichedPayload);
|
|
4203
4210
|
if (apiCode) lastError.code = apiCode;
|
|
@@ -4279,6 +4286,19 @@ function extractErrorCode(payload) {
|
|
|
4279
4286
|
if (typeof payload.code === "string" && payload.code.trim()) return payload.code.trim();
|
|
4280
4287
|
return null;
|
|
4281
4288
|
}
|
|
4289
|
+
function detectIntegrationProvider(path7) {
|
|
4290
|
+
if (/\/github(\/|$)/i.test(path7)) return "github";
|
|
4291
|
+
if (/\/slack(\/|$)/i.test(path7)) return "slack";
|
|
4292
|
+
return null;
|
|
4293
|
+
}
|
|
4294
|
+
function rewriteNotFoundMessage(input) {
|
|
4295
|
+
if (input.status !== 404) return input.message;
|
|
4296
|
+
const provider = detectIntegrationProvider(input.path);
|
|
4297
|
+
if (!provider) return input.message;
|
|
4298
|
+
if (!/\/workspaces\//i.test(input.path)) return input.message;
|
|
4299
|
+
const label = provider === "github" ? "GitHub" : "Slack";
|
|
4300
|
+
return `${label} integration is not connected for this workspace. Connect ${label} in workspace integrations and retry. If you intended a different workspace, pass workspace_id.`;
|
|
4301
|
+
}
|
|
4282
4302
|
|
|
4283
4303
|
// src/files.ts
|
|
4284
4304
|
import * as fs from "fs";
|
|
@@ -4709,6 +4729,8 @@ function normalizeNodeType(input) {
|
|
|
4709
4729
|
);
|
|
4710
4730
|
}
|
|
4711
4731
|
}
|
|
4732
|
+
var AI_PLAN_TIMEOUT_MS = 5e4;
|
|
4733
|
+
var AI_PLAN_RETRIES = 0;
|
|
4712
4734
|
var ContextStreamClient = class {
|
|
4713
4735
|
constructor(config) {
|
|
4714
4736
|
this.config = config;
|
|
@@ -4745,6 +4767,28 @@ var ContextStreamClient = class {
|
|
|
4745
4767
|
project_id: input.project_id || defaultProjectId
|
|
4746
4768
|
};
|
|
4747
4769
|
}
|
|
4770
|
+
coerceUuid(value) {
|
|
4771
|
+
if (!value) return void 0;
|
|
4772
|
+
try {
|
|
4773
|
+
uuidSchema.parse(value);
|
|
4774
|
+
return value;
|
|
4775
|
+
} catch {
|
|
4776
|
+
return void 0;
|
|
4777
|
+
}
|
|
4778
|
+
}
|
|
4779
|
+
requireNonEmpty(value, field, tool) {
|
|
4780
|
+
const text = String(value ?? "").trim();
|
|
4781
|
+
if (!text) {
|
|
4782
|
+
throw new HttpError(400, `${field} is required for ${tool}`);
|
|
4783
|
+
}
|
|
4784
|
+
return text;
|
|
4785
|
+
}
|
|
4786
|
+
isBadRequestDeserialization(error) {
|
|
4787
|
+
if (!(error instanceof HttpError)) return false;
|
|
4788
|
+
if (String(error.code || "").toUpperCase() !== "BAD_REQUEST") return false;
|
|
4789
|
+
const message = String(error.message || "").toLowerCase();
|
|
4790
|
+
return message.includes("deserialize") || message.includes("deserial");
|
|
4791
|
+
}
|
|
4748
4792
|
// Auth
|
|
4749
4793
|
me() {
|
|
4750
4794
|
return request(this.config, "/auth/me");
|
|
@@ -4785,9 +4829,9 @@ var ContextStreamClient = class {
|
|
|
4785
4829
|
const suffix = query.toString() ? `?${query.toString()}` : "";
|
|
4786
4830
|
return request(this.config, `/workspaces${suffix}`);
|
|
4787
4831
|
}
|
|
4788
|
-
async createWorkspace(input) {
|
|
4832
|
+
async createWorkspace(input, options) {
|
|
4789
4833
|
const result = await request(this.config, "/workspaces", { body: input });
|
|
4790
|
-
return unwrapApiResponse(result);
|
|
4834
|
+
return options?.unwrap === false ? result : unwrapApiResponse(result);
|
|
4791
4835
|
}
|
|
4792
4836
|
async updateWorkspace(workspaceId, input) {
|
|
4793
4837
|
uuidSchema.parse(workspaceId);
|
|
@@ -4812,10 +4856,10 @@ var ContextStreamClient = class {
|
|
|
4812
4856
|
const suffix = query.toString() ? `?${query.toString()}` : "";
|
|
4813
4857
|
return request(this.config, `/projects${suffix}`);
|
|
4814
4858
|
}
|
|
4815
|
-
async createProject(input) {
|
|
4859
|
+
async createProject(input, options) {
|
|
4816
4860
|
const payload = this.withDefaults(input);
|
|
4817
4861
|
const result = await request(this.config, "/projects", { body: payload });
|
|
4818
|
-
return unwrapApiResponse(result);
|
|
4862
|
+
return options?.unwrap === false ? result : unwrapApiResponse(result);
|
|
4819
4863
|
}
|
|
4820
4864
|
async updateProject(projectId, input) {
|
|
4821
4865
|
uuidSchema.parse(projectId);
|
|
@@ -4936,44 +4980,233 @@ var ContextStreamClient = class {
|
|
|
4936
4980
|
const withDefaults = this.withDefaults(params || {});
|
|
4937
4981
|
if (withDefaults.workspace_id) query.set("workspace_id", withDefaults.workspace_id);
|
|
4938
4982
|
if (withDefaults.project_id) query.set("project_id", withDefaults.project_id);
|
|
4983
|
+
if (params?.category) query.set("category", params.category);
|
|
4939
4984
|
if (params?.limit) query.set("limit", String(params.limit));
|
|
4940
4985
|
const suffix = query.toString() ? `?${query.toString()}` : "";
|
|
4941
4986
|
return request(this.config, `/memory/search/decisions${suffix}`, { method: "GET" });
|
|
4942
4987
|
}
|
|
4943
4988
|
// Graph
|
|
4944
4989
|
graphRelated(body) {
|
|
4945
|
-
|
|
4990
|
+
const withDefaults = this.withDefaults(body);
|
|
4991
|
+
const apiBody = {
|
|
4992
|
+
node_id: withDefaults.node_id,
|
|
4993
|
+
relation_types: body.relation_types,
|
|
4994
|
+
max_depth: body.max_depth ?? body.limit,
|
|
4995
|
+
workspace_id: withDefaults.workspace_id,
|
|
4996
|
+
project_id: withDefaults.project_id
|
|
4997
|
+
};
|
|
4998
|
+
return request(this.config, "/graph/knowledge/related", { body: apiBody });
|
|
4946
4999
|
}
|
|
4947
5000
|
graphPath(body) {
|
|
4948
|
-
|
|
5001
|
+
const withDefaults = this.withDefaults(body);
|
|
5002
|
+
const from = body.from ?? withDefaults.source_id;
|
|
5003
|
+
const to = body.to ?? withDefaults.target_id;
|
|
5004
|
+
const apiBody = {
|
|
5005
|
+
from,
|
|
5006
|
+
to,
|
|
5007
|
+
max_depth: body.max_depth,
|
|
5008
|
+
workspace_id: withDefaults.workspace_id,
|
|
5009
|
+
project_id: withDefaults.project_id
|
|
5010
|
+
};
|
|
5011
|
+
return request(this.config, "/graph/knowledge/path", { body: apiBody });
|
|
4949
5012
|
}
|
|
4950
5013
|
graphDecisions(body) {
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
5014
|
+
const withDefaults = this.withDefaults(body || {});
|
|
5015
|
+
const now = /* @__PURE__ */ new Date();
|
|
5016
|
+
const defaultFrom = new Date(now);
|
|
5017
|
+
defaultFrom.setUTCFullYear(now.getUTCFullYear() - 5);
|
|
5018
|
+
const apiBody = {
|
|
5019
|
+
workspace_id: withDefaults.workspace_id,
|
|
5020
|
+
project_id: withDefaults.project_id,
|
|
5021
|
+
category: body?.category ?? "general",
|
|
5022
|
+
from: body?.from ?? defaultFrom.toISOString(),
|
|
5023
|
+
to: body?.to ?? now.toISOString()
|
|
5024
|
+
};
|
|
5025
|
+
return request(this.config, "/graph/knowledge/decisions", { body: apiBody });
|
|
5026
|
+
}
|
|
5027
|
+
async graphDependencies(body) {
|
|
5028
|
+
const rawType = String(body.target?.type ?? "").toLowerCase();
|
|
5029
|
+
let targetType = "function";
|
|
5030
|
+
switch (rawType) {
|
|
5031
|
+
case "module":
|
|
5032
|
+
case "file":
|
|
5033
|
+
case "path":
|
|
5034
|
+
targetType = "module";
|
|
5035
|
+
break;
|
|
5036
|
+
case "type":
|
|
5037
|
+
targetType = "type";
|
|
5038
|
+
break;
|
|
5039
|
+
case "variable":
|
|
5040
|
+
case "var":
|
|
5041
|
+
case "const":
|
|
5042
|
+
targetType = "variable";
|
|
5043
|
+
break;
|
|
5044
|
+
case "function":
|
|
5045
|
+
case "method":
|
|
5046
|
+
targetType = "function";
|
|
5047
|
+
break;
|
|
5048
|
+
default:
|
|
5049
|
+
targetType = "function";
|
|
5050
|
+
}
|
|
5051
|
+
const target = targetType === "module" ? { type: targetType, path: body.target.path ?? body.target.id } : { type: targetType, id: body.target.id };
|
|
5052
|
+
return request(this.config, "/graph/dependencies", {
|
|
5053
|
+
body: {
|
|
5054
|
+
target,
|
|
5055
|
+
max_depth: body.max_depth,
|
|
5056
|
+
include_transitive: body.include_transitive
|
|
5057
|
+
}
|
|
5058
|
+
});
|
|
4955
5059
|
}
|
|
4956
5060
|
graphCallPath(body) {
|
|
4957
|
-
|
|
5061
|
+
const apiBody = {
|
|
5062
|
+
from_function_id: body.from_function_id ?? body.source?.id,
|
|
5063
|
+
to_function_id: body.to_function_id ?? body.target?.id,
|
|
5064
|
+
max_depth: body.max_depth
|
|
5065
|
+
};
|
|
5066
|
+
return request(this.config, "/graph/call-paths", { body: apiBody });
|
|
4958
5067
|
}
|
|
4959
5068
|
graphImpact(body) {
|
|
4960
|
-
|
|
5069
|
+
const targetId = body.target_id ?? body.target?.id;
|
|
5070
|
+
const elementName = body.element_name ?? body.target?.id ?? body.target?.type ?? "unknown";
|
|
5071
|
+
const apiBody = {
|
|
5072
|
+
change_type: body.change_type ?? "modify_signature",
|
|
5073
|
+
target_id: targetId,
|
|
5074
|
+
element_name: elementName
|
|
5075
|
+
};
|
|
5076
|
+
return request(this.config, "/graph/impact-analysis", { body: apiBody });
|
|
4961
5077
|
}
|
|
4962
5078
|
// AI
|
|
5079
|
+
buildAiContextRequest(input) {
|
|
5080
|
+
const payload = {
|
|
5081
|
+
query: input.query
|
|
5082
|
+
};
|
|
5083
|
+
if (input.project_id) payload.project_id = input.project_id;
|
|
5084
|
+
if (typeof input.max_tokens === "number") payload.max_tokens = input.max_tokens;
|
|
5085
|
+
if (typeof input.token_budget === "number") payload.token_budget = input.token_budget;
|
|
5086
|
+
if (typeof input.token_soft_limit === "number") payload.token_soft_limit = input.token_soft_limit;
|
|
5087
|
+
if (typeof input.include_dependencies === "boolean") {
|
|
5088
|
+
payload.include_dependencies = input.include_dependencies;
|
|
5089
|
+
}
|
|
5090
|
+
if (typeof input.include_tests === "boolean") {
|
|
5091
|
+
payload.include_tests = input.include_tests;
|
|
5092
|
+
}
|
|
5093
|
+
const rawLimit = typeof input.max_sections === "number" ? input.max_sections : input.limit;
|
|
5094
|
+
if (typeof rawLimit === "number" && Number.isFinite(rawLimit)) {
|
|
5095
|
+
const bounded = Math.max(1, Math.min(20, Math.floor(rawLimit)));
|
|
5096
|
+
payload.max_sections = bounded;
|
|
5097
|
+
}
|
|
5098
|
+
return payload;
|
|
5099
|
+
}
|
|
5100
|
+
buildAiPlanRequest(input) {
|
|
5101
|
+
const requirements = input.requirements ?? input.description;
|
|
5102
|
+
if (!requirements || !requirements.trim()) {
|
|
5103
|
+
throw new Error("description is required for ai_plan");
|
|
5104
|
+
}
|
|
5105
|
+
const payload = {
|
|
5106
|
+
requirements
|
|
5107
|
+
};
|
|
5108
|
+
if (input.project_id) payload.project_id = input.project_id;
|
|
5109
|
+
if (typeof input.max_steps === "number") payload.max_steps = input.max_steps;
|
|
5110
|
+
if (input.context) payload.context = input.context;
|
|
5111
|
+
if (input.constraints) payload.constraints = input.constraints;
|
|
5112
|
+
return payload;
|
|
5113
|
+
}
|
|
5114
|
+
normalizeTaskGranularity(value) {
|
|
5115
|
+
if (!value) return void 0;
|
|
5116
|
+
const normalized = value.trim().toLowerCase();
|
|
5117
|
+
if (normalized === "low" || normalized === "medium" || normalized === "high") {
|
|
5118
|
+
return normalized;
|
|
5119
|
+
}
|
|
5120
|
+
if (normalized === "coarse" || normalized === "broad") return "low";
|
|
5121
|
+
if (normalized === "fine" || normalized === "detailed") return "high";
|
|
5122
|
+
return void 0;
|
|
5123
|
+
}
|
|
5124
|
+
buildAiTasksRequest(input) {
|
|
5125
|
+
const plan = input.plan ?? input.description;
|
|
5126
|
+
if (!plan || !plan.trim()) {
|
|
5127
|
+
throw new Error("description is required for ai_tasks");
|
|
5128
|
+
}
|
|
5129
|
+
const payload = {
|
|
5130
|
+
plan
|
|
5131
|
+
};
|
|
5132
|
+
if (input.project_id) payload.project_id = input.project_id;
|
|
5133
|
+
const granularity = this.normalizeTaskGranularity(input.granularity);
|
|
5134
|
+
if (granularity) payload.granularity = granularity;
|
|
5135
|
+
if (typeof input.max_tasks === "number") payload.max_tasks = input.max_tasks;
|
|
5136
|
+
if (typeof input.include_estimates === "boolean") {
|
|
5137
|
+
payload.include_estimates = input.include_estimates;
|
|
5138
|
+
}
|
|
5139
|
+
return payload;
|
|
5140
|
+
}
|
|
4963
5141
|
aiContext(body) {
|
|
4964
|
-
|
|
5142
|
+
const { query, project_id, limit, workspace_id } = this.withDefaults(body);
|
|
5143
|
+
const safeQuery = this.requireNonEmpty(query, "query", "ai_context");
|
|
5144
|
+
const safeProjectId = this.coerceUuid(project_id);
|
|
5145
|
+
const payload = this.buildAiContextRequest({ query: safeQuery, project_id: safeProjectId, limit });
|
|
5146
|
+
return request(this.config, "/ai/context", { body: payload, workspaceId: workspace_id }).catch((error) => {
|
|
5147
|
+
if (this.isBadRequestDeserialization(error)) {
|
|
5148
|
+
const minimalPayload = this.buildAiContextRequest({ query: safeQuery });
|
|
5149
|
+
return request(this.config, "/ai/context", { body: minimalPayload, workspaceId: workspace_id });
|
|
5150
|
+
}
|
|
5151
|
+
throw error;
|
|
5152
|
+
});
|
|
4965
5153
|
}
|
|
4966
5154
|
aiEmbeddings(body) {
|
|
4967
5155
|
return request(this.config, "/ai/embeddings", { body });
|
|
4968
5156
|
}
|
|
4969
5157
|
aiPlan(body) {
|
|
4970
|
-
|
|
5158
|
+
const { description, project_id } = this.withDefaults(body);
|
|
5159
|
+
const safeDescription = this.requireNonEmpty(description, "description", "ai_plan");
|
|
5160
|
+
const safeProjectId = this.coerceUuid(project_id);
|
|
5161
|
+
const payload = this.buildAiPlanRequest({ description: safeDescription, project_id: safeProjectId });
|
|
5162
|
+
const requestOptions = { body: payload, timeoutMs: AI_PLAN_TIMEOUT_MS, retries: AI_PLAN_RETRIES };
|
|
5163
|
+
return request(this.config, "/ai/plan/generate", requestOptions).catch((error) => {
|
|
5164
|
+
if (this.isBadRequestDeserialization(error)) {
|
|
5165
|
+
const minimalPayload = this.buildAiPlanRequest({ description: safeDescription });
|
|
5166
|
+
return request(this.config, "/ai/plan/generate", {
|
|
5167
|
+
body: minimalPayload,
|
|
5168
|
+
timeoutMs: AI_PLAN_TIMEOUT_MS,
|
|
5169
|
+
retries: AI_PLAN_RETRIES
|
|
5170
|
+
});
|
|
5171
|
+
}
|
|
5172
|
+
if (error instanceof HttpError && error.status === 0 && /timeout/i.test(error.message)) {
|
|
5173
|
+
const seconds = Math.ceil(AI_PLAN_TIMEOUT_MS / 1e3);
|
|
5174
|
+
throw new HttpError(
|
|
5175
|
+
503,
|
|
5176
|
+
`AI plan generation timed out after ${seconds} seconds. Try a shorter description, reduce max_steps, or retry later.`
|
|
5177
|
+
);
|
|
5178
|
+
}
|
|
5179
|
+
throw error;
|
|
5180
|
+
});
|
|
4971
5181
|
}
|
|
4972
5182
|
aiTasks(body) {
|
|
4973
|
-
|
|
5183
|
+
if (!body.description && body.plan_id) {
|
|
5184
|
+
throw new Error("plan_id is not supported for ai_tasks; provide description instead.");
|
|
5185
|
+
}
|
|
5186
|
+
const { description, project_id, granularity } = this.withDefaults(body);
|
|
5187
|
+
const safeDescription = this.requireNonEmpty(description, "description", "ai_tasks");
|
|
5188
|
+
const safeProjectId = this.coerceUuid(project_id);
|
|
5189
|
+
const payload = this.buildAiTasksRequest({ description: safeDescription, project_id: safeProjectId, granularity });
|
|
5190
|
+
return request(this.config, "/ai/tasks/generate", { body: payload }).catch((error) => {
|
|
5191
|
+
if (this.isBadRequestDeserialization(error)) {
|
|
5192
|
+
const minimalPayload = this.buildAiTasksRequest({ description: safeDescription });
|
|
5193
|
+
return request(this.config, "/ai/tasks/generate", { body: minimalPayload });
|
|
5194
|
+
}
|
|
5195
|
+
throw error;
|
|
5196
|
+
});
|
|
4974
5197
|
}
|
|
4975
5198
|
aiEnhancedContext(body) {
|
|
4976
|
-
|
|
5199
|
+
const { query, project_id, limit, workspace_id } = this.withDefaults(body);
|
|
5200
|
+
const safeQuery = this.requireNonEmpty(query, "query", "ai_enhanced_context");
|
|
5201
|
+
const safeProjectId = this.coerceUuid(project_id);
|
|
5202
|
+
const payload = this.buildAiContextRequest({ query: safeQuery, project_id: safeProjectId, limit });
|
|
5203
|
+
return request(this.config, "/ai/context/enhanced", { body: payload, workspaceId: workspace_id }).catch((error) => {
|
|
5204
|
+
if (this.isBadRequestDeserialization(error)) {
|
|
5205
|
+
const minimalPayload = this.buildAiContextRequest({ query: safeQuery });
|
|
5206
|
+
return request(this.config, "/ai/context/enhanced", { body: minimalPayload, workspaceId: workspace_id });
|
|
5207
|
+
}
|
|
5208
|
+
throw error;
|
|
5209
|
+
});
|
|
4977
5210
|
}
|
|
4978
5211
|
// Project extended operations (with caching)
|
|
4979
5212
|
async getProject(projectId) {
|
|
@@ -5126,11 +5359,11 @@ var ContextStreamClient = class {
|
|
|
5126
5359
|
return request(this.config, `/memory/search/summary/${workspaceId}`, { method: "GET" });
|
|
5127
5360
|
}
|
|
5128
5361
|
// Graph extended operations
|
|
5129
|
-
findCircularDependencies(projectId) {
|
|
5362
|
+
async findCircularDependencies(projectId) {
|
|
5130
5363
|
uuidSchema.parse(projectId);
|
|
5131
5364
|
return request(this.config, `/graph/circular-dependencies/${projectId}`, { method: "GET" });
|
|
5132
5365
|
}
|
|
5133
|
-
findUnusedCode(projectId) {
|
|
5366
|
+
async findUnusedCode(projectId) {
|
|
5134
5367
|
uuidSchema.parse(projectId);
|
|
5135
5368
|
return request(this.config, `/graph/unused-code/${projectId}`, { method: "GET" });
|
|
5136
5369
|
}
|
|
@@ -5600,6 +5833,25 @@ var ContextStreamClient = class {
|
|
|
5600
5833
|
}
|
|
5601
5834
|
});
|
|
5602
5835
|
}
|
|
5836
|
+
/**
|
|
5837
|
+
* Remember something using the session/remember endpoint.
|
|
5838
|
+
* This is a simpler interface than captureContext and supports await_indexing.
|
|
5839
|
+
*/
|
|
5840
|
+
async sessionRemember(params) {
|
|
5841
|
+
const withDefaults = this.withDefaults(params);
|
|
5842
|
+
if (!withDefaults.workspace_id) {
|
|
5843
|
+
throw new Error("workspace_id is required for session_remember. Set defaultWorkspaceId in config or provide workspace_id.");
|
|
5844
|
+
}
|
|
5845
|
+
return request(this.config, "/session/remember", {
|
|
5846
|
+
body: {
|
|
5847
|
+
content: params.content,
|
|
5848
|
+
workspace_id: withDefaults.workspace_id,
|
|
5849
|
+
project_id: withDefaults.project_id,
|
|
5850
|
+
importance: params.importance,
|
|
5851
|
+
await_indexing: params.await_indexing
|
|
5852
|
+
}
|
|
5853
|
+
});
|
|
5854
|
+
}
|
|
5603
5855
|
/**
|
|
5604
5856
|
* Search memory with automatic context enrichment.
|
|
5605
5857
|
* Returns both direct matches and related context.
|
|
@@ -7263,7 +7515,8 @@ Upgrade: ${upgradeUrl}` : "";
|
|
|
7263
7515
|
},
|
|
7264
7516
|
async (input) => {
|
|
7265
7517
|
const result = await client.deleteWorkspace(input.workspace_id);
|
|
7266
|
-
|
|
7518
|
+
const normalized = result || { success: true, data: { id: input.workspace_id, deleted: true }, error: null, metadata: {} };
|
|
7519
|
+
return { content: [{ type: "text", text: formatContent(normalized) }], structuredContent: toStructured(normalized) };
|
|
7267
7520
|
}
|
|
7268
7521
|
);
|
|
7269
7522
|
registerTool(
|
|
@@ -7322,7 +7575,8 @@ Upgrade: ${upgradeUrl}` : "";
|
|
|
7322
7575
|
},
|
|
7323
7576
|
async (input) => {
|
|
7324
7577
|
const result = await client.deleteProject(input.project_id);
|
|
7325
|
-
|
|
7578
|
+
const normalized = result || { success: true, data: { id: input.project_id, deleted: true }, error: null, metadata: {} };
|
|
7579
|
+
return { content: [{ type: "text", text: formatContent(normalized) }], structuredContent: toStructured(normalized) };
|
|
7326
7580
|
}
|
|
7327
7581
|
);
|
|
7328
7582
|
registerTool(
|
|
@@ -7495,6 +7749,7 @@ Upgrade: ${upgradeUrl}` : "";
|
|
|
7495
7749
|
inputSchema: external_exports.object({
|
|
7496
7750
|
workspace_id: external_exports.string().uuid().optional(),
|
|
7497
7751
|
project_id: external_exports.string().uuid().optional(),
|
|
7752
|
+
category: external_exports.string().optional().describe("Optional category filter. If not specified, returns all decisions regardless of category."),
|
|
7498
7753
|
limit: external_exports.number().optional()
|
|
7499
7754
|
})
|
|
7500
7755
|
},
|
|
@@ -7526,8 +7781,8 @@ Upgrade: ${upgradeUrl}` : "";
|
|
|
7526
7781
|
title: "Knowledge path",
|
|
7527
7782
|
description: "Find path between two nodes",
|
|
7528
7783
|
inputSchema: external_exports.object({
|
|
7529
|
-
source_id: external_exports.string(),
|
|
7530
|
-
target_id: external_exports.string(),
|
|
7784
|
+
source_id: external_exports.string().uuid(),
|
|
7785
|
+
target_id: external_exports.string().uuid(),
|
|
7531
7786
|
workspace_id: external_exports.string().uuid().optional(),
|
|
7532
7787
|
project_id: external_exports.string().uuid().optional()
|
|
7533
7788
|
})
|
|
@@ -8701,7 +8956,8 @@ Example: "Remember that I prefer TypeScript strict mode" or "Remember we decided
|
|
|
8701
8956
|
content: external_exports.string().describe("What to remember (natural language)"),
|
|
8702
8957
|
workspace_id: external_exports.string().uuid().optional(),
|
|
8703
8958
|
project_id: external_exports.string().uuid().optional(),
|
|
8704
|
-
importance: external_exports.enum(["low", "medium", "high"]).optional()
|
|
8959
|
+
importance: external_exports.enum(["low", "medium", "high"]).optional(),
|
|
8960
|
+
await_indexing: external_exports.boolean().optional().describe("If true, wait for indexing to complete before returning. This ensures the content is immediately searchable.")
|
|
8705
8961
|
})
|
|
8706
8962
|
},
|
|
8707
8963
|
async (input) => {
|
|
@@ -8720,22 +8976,12 @@ Example: "Remember that I prefer TypeScript strict mode" or "Remember we decided
|
|
|
8720
8976
|
isError: true
|
|
8721
8977
|
};
|
|
8722
8978
|
}
|
|
8723
|
-
const
|
|
8724
|
-
|
|
8725
|
-
if (lowerContent.includes("prefer") || lowerContent.includes("like") || lowerContent.includes("always")) {
|
|
8726
|
-
eventType = "preference";
|
|
8727
|
-
} else if (lowerContent.includes("decided") || lowerContent.includes("decision") || lowerContent.includes("chose")) {
|
|
8728
|
-
eventType = "decision";
|
|
8729
|
-
} else if (lowerContent.includes("todo") || lowerContent.includes("task") || lowerContent.includes("need to")) {
|
|
8730
|
-
eventType = "task";
|
|
8731
|
-
}
|
|
8732
|
-
const result = await client.captureContext({
|
|
8979
|
+
const result = await client.sessionRemember({
|
|
8980
|
+
content: input.content,
|
|
8733
8981
|
workspace_id: workspaceId,
|
|
8734
8982
|
project_id: projectId,
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
content: input.content,
|
|
8738
|
-
importance: input.importance || "medium"
|
|
8983
|
+
importance: input.importance,
|
|
8984
|
+
await_indexing: input.await_indexing
|
|
8739
8985
|
});
|
|
8740
8986
|
return { content: [{ type: "text", text: `Remembered: ${input.content.slice(0, 100)}...` }], structuredContent: toStructured(result) };
|
|
8741
8987
|
}
|
package/package.json
CHANGED