memorix 1.5.0 → 1.6.0
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/CHANGELOG.md +37 -0
- package/README.md +3 -3
- package/README.zh-CN.md +3 -3
- package/dist/cli/index.js +452 -109
- package/dist/index.js +376 -87
- package/dist/maintenance-runner.js +174 -41
- package/dist/media-audio-runner.js +174 -41
- package/dist/media-video-runner.js +174 -41
- package/dist/memcode-runtime/CHANGELOG.md +37 -0
- package/dist/sdk.js +375 -86
- package/dist/types.d.ts +2 -0
- package/dist/vector-backfill-runner.js +174 -41
- package/docs/1.2.4-PERSISTENT-MEMORY-DELIVERY.md +1 -1
- package/docs/API_REFERENCE.md +1 -1
- package/docs/DEVELOPMENT.md +5 -3
- package/package.json +1 -1
- package/plugins/claude/memorix/.claude-plugin/plugin.json +1 -1
- package/plugins/codebuddy/memorix/.codebuddy-plugin/plugin.json +1 -1
- package/plugins/codex/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/copilot/memorix/plugin.json +1 -1
- package/plugins/gemini/memorix/gemini-extension.json +1 -1
- package/plugins/omp/memorix/package.json +1 -1
- package/plugins/openclaw/memorix/.codex-plugin/plugin.json +1 -1
- package/plugins/pi/memorix/package.json +1 -1
- package/server.json +2 -2
- package/src/cli/commands/codegraph.ts +48 -5
- package/src/cli/commands/context.ts +20 -4
- package/src/cli/commands/resume.ts +4 -0
- package/src/codegraph/auto-context.ts +4 -1
- package/src/codegraph/context-pack.ts +3 -1
- package/src/codegraph/external-provider.ts +93 -0
- package/src/embedding/api-provider.ts +105 -22
- package/src/embedding/provider.ts +2 -0
- package/src/hooks/installers/index.ts +1 -1
- package/src/hooks/official-skills.ts +3 -3
- package/src/hooks/rules/memorix-agent-rules.md +1 -1
- package/src/knowledge/context-receipt.ts +41 -0
- package/src/knowledge/workflows.ts +6 -3
- package/src/knowledge/workset.ts +56 -2
- package/src/llm/provider.ts +17 -8
- package/src/memory/formation/extract.ts +6 -3
- package/src/memory/formation/index.ts +2 -1
- package/src/memory/formation/resolve.ts +10 -6
- package/src/memory/formation/types.ts +3 -1
- package/src/memory/long-term.ts +7 -1
- package/src/server.ts +29 -13
- package/src/store/orama-store.ts +6 -4
- package/src/timeout.ts +67 -0
- package/src/types.ts +2 -0
|
@@ -3738,6 +3738,8 @@ function getPreferredBatchSize(config) {
|
|
|
3738
3738
|
}
|
|
3739
3739
|
function parseBatchLimit(error) {
|
|
3740
3740
|
if (!(error instanceof Error)) return null;
|
|
3741
|
+
const status = error instanceof EmbeddingAPIError ? error.status : Number(error.message.match(/Embedding API error \((\d{3})\)/i)?.[1] ?? 0);
|
|
3742
|
+
if (status > 0 && status !== 400) return null;
|
|
3741
3743
|
const explicit = error.message.match(/should not be larger than\s+(\d+)/i);
|
|
3742
3744
|
if (explicit) return parseInt(explicit[1], 10);
|
|
3743
3745
|
if (/batch size/i.test(error.message)) {
|
|
@@ -3750,37 +3752,99 @@ async function fetchWithRetry(url, apiKey, body, options = {}, attempt = 0, nati
|
|
|
3750
3752
|
const controller = new AbortController();
|
|
3751
3753
|
const timeoutMs = typeof options.timeoutMs === "number" && Number.isFinite(options.timeoutMs) ? Math.max(100, Math.min(Math.floor(options.timeoutMs), 6e4)) : 1e4;
|
|
3752
3754
|
const timeout = setTimeout(() => controller.abort(), timeoutMs);
|
|
3755
|
+
const signal = options.signal ? AbortSignal.any([options.signal, controller.signal]) : controller.signal;
|
|
3753
3756
|
let response;
|
|
3754
3757
|
try {
|
|
3755
3758
|
response = await fetch(url, {
|
|
3756
3759
|
method: "POST",
|
|
3757
3760
|
headers: nativeGemini ? { "Content-Type": "application/json", "x-goog-api-key": apiKey } : { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}` },
|
|
3758
3761
|
body: JSON.stringify(body),
|
|
3759
|
-
signal
|
|
3762
|
+
signal
|
|
3760
3763
|
});
|
|
3761
3764
|
} catch (err) {
|
|
3762
3765
|
clearTimeout(timeout);
|
|
3763
|
-
if (err instanceof Error && err.name === "AbortError") {
|
|
3766
|
+
if (err instanceof Error && (err.name === "AbortError" || controller.signal.aborted || options.signal?.aborted)) {
|
|
3764
3767
|
throw new Error(`Embedding API timeout after ${timeoutMs}ms: ${url}`);
|
|
3765
3768
|
}
|
|
3766
3769
|
throw err;
|
|
3767
3770
|
}
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
+
try {
|
|
3772
|
+
if (response.ok) {
|
|
3773
|
+
return await raceWithAbort(
|
|
3774
|
+
response.json(),
|
|
3775
|
+
signal
|
|
3776
|
+
);
|
|
3777
|
+
}
|
|
3778
|
+
if (options.retry !== false && (response.status === 429 || response.status >= 500) && attempt < MAX_RETRIES2) {
|
|
3779
|
+
const delay2 = BASE_DELAY_MS * Math.pow(2, attempt);
|
|
3780
|
+
const retryAfter = response.headers.get("retry-after");
|
|
3781
|
+
const parsedRetryAfter = retryAfter ? parseInt(retryAfter, 10) * 1e3 : NaN;
|
|
3782
|
+
const waitMs = Number.isFinite(parsedRetryAfter) ? parsedRetryAfter : delay2;
|
|
3783
|
+
console.error(`[memorix] Embedding API ${response.status}, retry ${attempt + 1}/${MAX_RETRIES2} in ${waitMs}ms`);
|
|
3784
|
+
await waitForRetry(waitMs, options.signal);
|
|
3785
|
+
return fetchWithRetry(url, apiKey, body, options, attempt + 1, nativeGemini);
|
|
3786
|
+
}
|
|
3787
|
+
const errorText2 = await raceWithAbort(
|
|
3788
|
+
response.text().catch(() => "unknown error"),
|
|
3789
|
+
signal
|
|
3790
|
+
);
|
|
3791
|
+
throw new EmbeddingAPIError(response.status, errorText2);
|
|
3792
|
+
} catch (err) {
|
|
3793
|
+
if (err instanceof Error && (err.name === "AbortError" || controller.signal.aborted || options.signal?.aborted)) {
|
|
3794
|
+
throw new Error(`Embedding API timeout after ${timeoutMs}ms: ${url}`);
|
|
3795
|
+
}
|
|
3796
|
+
throw err;
|
|
3797
|
+
} finally {
|
|
3798
|
+
clearTimeout(timeout);
|
|
3771
3799
|
}
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3800
|
+
}
|
|
3801
|
+
function abortError() {
|
|
3802
|
+
const error = new Error("Embedding API request aborted");
|
|
3803
|
+
error.name = "AbortError";
|
|
3804
|
+
return error;
|
|
3805
|
+
}
|
|
3806
|
+
function raceWithAbort(promise, signal) {
|
|
3807
|
+
if (signal.aborted) return Promise.reject(abortError());
|
|
3808
|
+
return new Promise((resolve, reject) => {
|
|
3809
|
+
const onAbort = () => {
|
|
3810
|
+
signal.removeEventListener("abort", onAbort);
|
|
3811
|
+
reject(abortError());
|
|
3812
|
+
};
|
|
3813
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
3814
|
+
promise.then(
|
|
3815
|
+
(value) => {
|
|
3816
|
+
signal.removeEventListener("abort", onAbort);
|
|
3817
|
+
resolve(value);
|
|
3818
|
+
},
|
|
3819
|
+
(error) => {
|
|
3820
|
+
signal.removeEventListener("abort", onAbort);
|
|
3821
|
+
reject(error);
|
|
3822
|
+
}
|
|
3823
|
+
);
|
|
3824
|
+
});
|
|
3825
|
+
}
|
|
3826
|
+
async function waitForRetry(waitMs, signal) {
|
|
3827
|
+
if (!signal) {
|
|
3777
3828
|
await new Promise((resolve) => setTimeout(resolve, waitMs));
|
|
3778
|
-
return
|
|
3829
|
+
return;
|
|
3779
3830
|
}
|
|
3780
|
-
const
|
|
3781
|
-
throw new Error(
|
|
3831
|
+
const abortSignal = signal;
|
|
3832
|
+
if (abortSignal.aborted) throw new Error("Embedding API retry aborted");
|
|
3833
|
+
await new Promise((resolve, reject) => {
|
|
3834
|
+
const timer = setTimeout(done, waitMs);
|
|
3835
|
+
const onAbort = () => {
|
|
3836
|
+
clearTimeout(timer);
|
|
3837
|
+
abortSignal.removeEventListener("abort", onAbort);
|
|
3838
|
+
reject(new Error("Embedding API retry aborted"));
|
|
3839
|
+
};
|
|
3840
|
+
function done() {
|
|
3841
|
+
abortSignal.removeEventListener("abort", onAbort);
|
|
3842
|
+
resolve();
|
|
3843
|
+
}
|
|
3844
|
+
abortSignal.addEventListener("abort", onAbort, { once: true });
|
|
3845
|
+
});
|
|
3782
3846
|
}
|
|
3783
|
-
var cache3, MAX_CACHE_SIZE3, diskCacheDirty2, diskSaveTimer, diskCacheLoaded, diskCacheLoadPromise, MAX_INPUT_CHARS, MAX_CONCURRENCY, DISK_SAVE_DEBOUNCE_MS, DEFAULT_MAX_BATCH_SIZE, DASHSCOPE_MAX_BATCH_SIZE, MAX_RETRIES2, BASE_DELAY_MS, APIEmbeddingProvider;
|
|
3847
|
+
var cache3, MAX_CACHE_SIZE3, diskCacheDirty2, diskSaveTimer, diskCacheLoaded, diskCacheLoadPromise, MAX_INPUT_CHARS, MAX_CONCURRENCY, DISK_SAVE_DEBOUNCE_MS, DEFAULT_MAX_BATCH_SIZE, DASHSCOPE_MAX_BATCH_SIZE, MAX_RETRIES2, BASE_DELAY_MS, EmbeddingAPIError, APIEmbeddingProvider;
|
|
3784
3848
|
var init_api_provider = __esm({
|
|
3785
3849
|
"src/embedding/api-provider.ts"() {
|
|
3786
3850
|
"use strict";
|
|
@@ -3799,6 +3863,14 @@ var init_api_provider = __esm({
|
|
|
3799
3863
|
DASHSCOPE_MAX_BATCH_SIZE = 10;
|
|
3800
3864
|
MAX_RETRIES2 = 3;
|
|
3801
3865
|
BASE_DELAY_MS = 500;
|
|
3866
|
+
EmbeddingAPIError = class extends Error {
|
|
3867
|
+
status;
|
|
3868
|
+
constructor(status, detail) {
|
|
3869
|
+
super(`Embedding API error (${status}): ${detail}`);
|
|
3870
|
+
this.name = "EmbeddingAPIError";
|
|
3871
|
+
this.status = status;
|
|
3872
|
+
}
|
|
3873
|
+
};
|
|
3802
3874
|
APIEmbeddingProvider = class _APIEmbeddingProvider {
|
|
3803
3875
|
name;
|
|
3804
3876
|
dimensions;
|
|
@@ -4010,15 +4082,14 @@ var init_api_provider = __esm({
|
|
|
4010
4082
|
}
|
|
4011
4083
|
} catch (error) {
|
|
4012
4084
|
const providerLimit = parseBatchLimit(error);
|
|
4013
|
-
|
|
4014
|
-
if (chunkTexts.length > 1 && fallbackSize < chunkTexts.length) {
|
|
4085
|
+
if (providerLimit !== null && chunkTexts.length > 1 && providerLimit < chunkTexts.length) {
|
|
4015
4086
|
console.error(
|
|
4016
|
-
`[memorix] Embedding batch too large for provider, retrying in chunks of ${
|
|
4087
|
+
`[memorix] Embedding batch too large for provider, retrying in chunks of ${providerLimit}`
|
|
4017
4088
|
);
|
|
4018
|
-
for (let start = 0; start < chunkTexts.length; start +=
|
|
4089
|
+
for (let start = 0; start < chunkTexts.length; start += providerLimit) {
|
|
4019
4090
|
await processChunk(
|
|
4020
|
-
chunkTexts.slice(start, start +
|
|
4021
|
-
chunkIndices.slice(start, start +
|
|
4091
|
+
chunkTexts.slice(start, start + providerLimit),
|
|
4092
|
+
chunkIndices.slice(start, start + providerLimit)
|
|
4022
4093
|
);
|
|
4023
4094
|
}
|
|
4024
4095
|
return;
|
|
@@ -4882,22 +4953,23 @@ function getLLMConfig() {
|
|
|
4882
4953
|
function setLLMConfig(config) {
|
|
4883
4954
|
currentConfig = config;
|
|
4884
4955
|
}
|
|
4885
|
-
async function callLLM(systemPrompt, userMessage) {
|
|
4956
|
+
async function callLLM(systemPrompt, userMessage, signal) {
|
|
4886
4957
|
if (!currentConfig) {
|
|
4887
4958
|
throw new Error("LLM not configured. Set MEMORIX_LLM_API_KEY or OPENAI_API_KEY.");
|
|
4888
4959
|
}
|
|
4889
4960
|
if (currentConfig.provider === "anthropic") {
|
|
4890
|
-
return callAnthropic(systemPrompt, userMessage);
|
|
4961
|
+
return callAnthropic(systemPrompt, userMessage, signal);
|
|
4891
4962
|
}
|
|
4892
|
-
return callOpenAICompatible(systemPrompt, userMessage);
|
|
4963
|
+
return callOpenAICompatible(systemPrompt, userMessage, signal);
|
|
4893
4964
|
}
|
|
4894
|
-
async function callOpenAICompatible(systemPrompt, userMessage) {
|
|
4965
|
+
async function callOpenAICompatible(systemPrompt, userMessage, signal) {
|
|
4895
4966
|
const config = currentConfig;
|
|
4896
4967
|
let base = config.baseUrl.replace(/\/+$/, "");
|
|
4897
4968
|
if (!base.endsWith("/v1")) base += "/v1";
|
|
4898
4969
|
const url = `${base}/chat/completions`;
|
|
4970
|
+
const fetchSignal = signal ? AbortSignal.any([signal, AbortSignal.timeout(LLM_CALL_TIMEOUT_MS)]) : AbortSignal.timeout(LLM_CALL_TIMEOUT_MS);
|
|
4899
4971
|
const response = await fetch(url, {
|
|
4900
|
-
signal:
|
|
4972
|
+
signal: fetchSignal,
|
|
4901
4973
|
method: "POST",
|
|
4902
4974
|
headers: {
|
|
4903
4975
|
"Content-Type": "application/json",
|
|
@@ -4914,10 +4986,10 @@ async function callOpenAICompatible(systemPrompt, userMessage) {
|
|
|
4914
4986
|
})
|
|
4915
4987
|
});
|
|
4916
4988
|
if (!response.ok) {
|
|
4917
|
-
const error = await readResponseText(response,
|
|
4989
|
+
const error = await readResponseText(response, signal, 64 * 1024).catch(() => "unknown error");
|
|
4918
4990
|
throw new Error(`LLM API error (${response.status}): ${error}`);
|
|
4919
4991
|
}
|
|
4920
|
-
const data = await readResponseJson(response);
|
|
4992
|
+
const data = await readResponseJson(response, signal);
|
|
4921
4993
|
return {
|
|
4922
4994
|
content: data.choices[0]?.message?.content ?? "",
|
|
4923
4995
|
usage: data.usage ? {
|
|
@@ -4926,11 +4998,12 @@ async function callOpenAICompatible(systemPrompt, userMessage) {
|
|
|
4926
4998
|
} : void 0
|
|
4927
4999
|
};
|
|
4928
5000
|
}
|
|
4929
|
-
async function callAnthropic(systemPrompt, userMessage) {
|
|
5001
|
+
async function callAnthropic(systemPrompt, userMessage, signal) {
|
|
4930
5002
|
const config = currentConfig;
|
|
4931
5003
|
const url = `${config.baseUrl}/messages`;
|
|
5004
|
+
const fetchSignal = signal ? AbortSignal.any([signal, AbortSignal.timeout(LLM_CALL_TIMEOUT_MS)]) : AbortSignal.timeout(LLM_CALL_TIMEOUT_MS);
|
|
4932
5005
|
const response = await fetch(url, {
|
|
4933
|
-
signal:
|
|
5006
|
+
signal: fetchSignal,
|
|
4934
5007
|
method: "POST",
|
|
4935
5008
|
headers: {
|
|
4936
5009
|
"Content-Type": "application/json",
|
|
@@ -4948,10 +5021,10 @@ async function callAnthropic(systemPrompt, userMessage) {
|
|
|
4948
5021
|
})
|
|
4949
5022
|
});
|
|
4950
5023
|
if (!response.ok) {
|
|
4951
|
-
const error = await readResponseText(response,
|
|
5024
|
+
const error = await readResponseText(response, signal, 64 * 1024).catch(() => "unknown error");
|
|
4952
5025
|
throw new Error(`Anthropic API error (${response.status}): ${error}`);
|
|
4953
5026
|
}
|
|
4954
|
-
const data = await readResponseJson(response);
|
|
5027
|
+
const data = await readResponseJson(response, signal);
|
|
4955
5028
|
return {
|
|
4956
5029
|
content: data.content[0]?.text ?? "",
|
|
4957
5030
|
usage: data.usage ? {
|
|
@@ -5456,6 +5529,57 @@ function withTimeout(promise, ms, label) {
|
|
|
5456
5529
|
);
|
|
5457
5530
|
});
|
|
5458
5531
|
}
|
|
5532
|
+
function withTimeoutSignal(operation, ms, label, parentSignal) {
|
|
5533
|
+
const controller = new AbortController();
|
|
5534
|
+
const signal = parentSignal ? AbortSignal.any([parentSignal, controller.signal]) : controller.signal;
|
|
5535
|
+
return new Promise((resolve, reject) => {
|
|
5536
|
+
let settled = false;
|
|
5537
|
+
let timedOut = false;
|
|
5538
|
+
let timer;
|
|
5539
|
+
const cleanup = () => {
|
|
5540
|
+
if (timer !== void 0) clearTimeout(timer);
|
|
5541
|
+
parentSignal?.removeEventListener("abort", onParentAbort);
|
|
5542
|
+
};
|
|
5543
|
+
const onParentAbort = () => {
|
|
5544
|
+
if (settled || timedOut) return;
|
|
5545
|
+
settled = true;
|
|
5546
|
+
cleanup();
|
|
5547
|
+
reject(parentSignal?.reason ?? new Error(`${label} aborted`));
|
|
5548
|
+
};
|
|
5549
|
+
parentSignal?.addEventListener("abort", onParentAbort, { once: true });
|
|
5550
|
+
timer = setTimeout(() => {
|
|
5551
|
+
if (settled) return;
|
|
5552
|
+
timedOut = true;
|
|
5553
|
+
controller.abort(new Error(`${label} timed out after ${ms}ms`));
|
|
5554
|
+
settled = true;
|
|
5555
|
+
cleanup();
|
|
5556
|
+
reject(new Error(`${label} timed out after ${ms}ms`));
|
|
5557
|
+
}, ms);
|
|
5558
|
+
let pending;
|
|
5559
|
+
try {
|
|
5560
|
+
pending = operation(signal);
|
|
5561
|
+
} catch (error) {
|
|
5562
|
+
settled = true;
|
|
5563
|
+
cleanup();
|
|
5564
|
+
reject(error);
|
|
5565
|
+
return;
|
|
5566
|
+
}
|
|
5567
|
+
pending.then(
|
|
5568
|
+
(value) => {
|
|
5569
|
+
if (settled) return;
|
|
5570
|
+
settled = true;
|
|
5571
|
+
cleanup();
|
|
5572
|
+
resolve(value);
|
|
5573
|
+
},
|
|
5574
|
+
(error) => {
|
|
5575
|
+
if (settled) return;
|
|
5576
|
+
settled = true;
|
|
5577
|
+
cleanup();
|
|
5578
|
+
reject(timedOut ? new Error(`${label} timed out after ${ms}ms`) : error);
|
|
5579
|
+
}
|
|
5580
|
+
);
|
|
5581
|
+
});
|
|
5582
|
+
}
|
|
5459
5583
|
var init_timeout = __esm({
|
|
5460
5584
|
"src/timeout.ts"() {
|
|
5461
5585
|
"use strict";
|
|
@@ -6320,16 +6444,18 @@ async function searchObservations(options) {
|
|
|
6320
6444
|
);
|
|
6321
6445
|
} else {
|
|
6322
6446
|
const EMBEDDING_TIMEOUT_MS = 15e3;
|
|
6323
|
-
queryVector = await
|
|
6324
|
-
provider2.embedInput ? provider2.embedInput(
|
|
6447
|
+
queryVector = await withTimeoutSignal(
|
|
6448
|
+
(signal) => provider2.embedInput ? provider2.embedInput(
|
|
6325
6449
|
{ modality: "text", text: expandedEmbeddingQuery },
|
|
6326
|
-
{ intent: "query", timeoutMs: EMBEDDING_TIMEOUT_MS, retry: false }
|
|
6450
|
+
{ intent: "query", timeoutMs: EMBEDDING_TIMEOUT_MS, retry: false, signal }
|
|
6327
6451
|
) : provider2.embed(expandedEmbeddingQuery, {
|
|
6328
6452
|
timeoutMs: EMBEDDING_TIMEOUT_MS,
|
|
6329
|
-
retry: false
|
|
6453
|
+
retry: false,
|
|
6454
|
+
signal
|
|
6330
6455
|
}),
|
|
6331
6456
|
EMBEDDING_TIMEOUT_MS,
|
|
6332
|
-
"Embedding"
|
|
6457
|
+
"Embedding",
|
|
6458
|
+
options.signal
|
|
6333
6459
|
);
|
|
6334
6460
|
mark("embedding");
|
|
6335
6461
|
const cjkRatio = (originalQuery.match(/[\u4e00-\u9fff\u3040-\u309f\u30a0-\u30ff\uac00-\ud7af]/g) || []).length / originalQuery.length;
|
|
@@ -142927,7 +143053,13 @@ async function maintainLongTermMemories(input) {
|
|
|
142927
143053
|
}
|
|
142928
143054
|
for (const group of groups.values()) {
|
|
142929
143055
|
if (group.length < 2) continue;
|
|
142930
|
-
group.sort((a, b) =>
|
|
143056
|
+
group.sort((a, b) => {
|
|
143057
|
+
const byCreatedAt = Date.parse(b.createdAt) - Date.parse(a.createdAt);
|
|
143058
|
+
if (byCreatedAt !== 0) return byCreatedAt;
|
|
143059
|
+
const byUpdatedAt = Date.parse(b.updatedAt) - Date.parse(a.updatedAt);
|
|
143060
|
+
if (byUpdatedAt !== 0) return byUpdatedAt;
|
|
143061
|
+
return b.id.localeCompare(a.id);
|
|
143062
|
+
});
|
|
142931
143063
|
const newest = group[0];
|
|
142932
143064
|
for (const older of group.slice(1)) {
|
|
142933
143065
|
try {
|
|
@@ -146319,6 +146451,7 @@ var init_task_lens = __esm({
|
|
|
146319
146451
|
var workflows_exports = {};
|
|
146320
146452
|
__export(workflows_exports, {
|
|
146321
146453
|
WORKFLOW_ADAPTER_TARGETS: () => WORKFLOW_ADAPTER_TARGETS,
|
|
146454
|
+
WORKFLOW_AGENT_TARGETS: () => WORKFLOW_AGENT_TARGETS,
|
|
146322
146455
|
applyWorkflowAdapter: () => applyWorkflowAdapter,
|
|
146323
146456
|
importWindsurfWorkflows: () => importWindsurfWorkflows,
|
|
146324
146457
|
parseWorkflowMarkdown: () => parseWorkflowMarkdown,
|
|
@@ -146384,7 +146517,7 @@ function optionalStatus(data) {
|
|
|
146384
146517
|
return value;
|
|
146385
146518
|
}
|
|
146386
146519
|
function normalizeAgents(values) {
|
|
146387
|
-
const unknown3 = values.filter((value) => !
|
|
146520
|
+
const unknown3 = values.filter((value) => !WORKFLOW_AGENT_TARGETS.includes(value));
|
|
146388
146521
|
if (unknown3.length > 0) {
|
|
146389
146522
|
throw new Error("workflow frontmatter has unsupported agent: " + unknown3[0]);
|
|
146390
146523
|
}
|
|
@@ -146660,7 +146793,7 @@ function taskScore(workflow, task) {
|
|
|
146660
146793
|
return { score, reasons: [...new Set(reasons)] };
|
|
146661
146794
|
}
|
|
146662
146795
|
function selectWorkflows(input) {
|
|
146663
|
-
const selected = input.workflows.filter((workflow) => workflow.status === "active").map((workflow) => {
|
|
146796
|
+
const selected = input.workflows.filter((workflow) => workflow.status === "active" && (!input.agent || workflow.compatibleAgents.includes(input.agent))).map((workflow) => {
|
|
146664
146797
|
const match2 = taskScore(workflow, input.task);
|
|
146665
146798
|
const cautions = input.store && input.projectId ? input.store.recentFailureCautions(input.projectId, workflow.id) : [];
|
|
146666
146799
|
return {
|
|
@@ -146940,7 +147073,7 @@ async function selectWorkspaceWorkflows(input) {
|
|
|
146940
147073
|
errors: synced.errors
|
|
146941
147074
|
};
|
|
146942
147075
|
}
|
|
146943
|
-
var
|
|
147076
|
+
var WORKFLOW_AGENT_TARGETS, WORKFLOW_ADAPTER_TARGETS, STATUS_VALUES, LENS_TERMS, GENERIC_WORKFLOW_LENSES, GENERIC_WORKFLOW_TERMS;
|
|
146944
147077
|
var init_workflows2 = __esm({
|
|
146945
147078
|
"src/knowledge/workflows.ts"() {
|
|
146946
147079
|
"use strict";
|
|
@@ -146952,7 +147085,7 @@ var init_workflows2 = __esm({
|
|
|
146952
147085
|
init_workflow_store();
|
|
146953
147086
|
init_outcome_store();
|
|
146954
147087
|
init_task_lens();
|
|
146955
|
-
|
|
147088
|
+
WORKFLOW_AGENT_TARGETS = [
|
|
146956
147089
|
"windsurf",
|
|
146957
147090
|
"cursor",
|
|
146958
147091
|
"claude-code",
|