@yamo/memory-mesh 3.0.0 → 3.0.1
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/README.md +8 -2
- package/lib/llm/client.d.ts +23 -48
- package/lib/llm/client.js +1 -0
- package/lib/llm/client.ts +298 -377
- package/lib/llm/index.js +1 -0
- package/lib/llm/index.ts +1 -2
- package/lib/memory/adapters/client.d.ts +22 -85
- package/lib/memory/adapters/client.js +1 -0
- package/lib/memory/adapters/client.ts +474 -633
- package/lib/memory/adapters/config.d.ts +82 -89
- package/lib/memory/adapters/config.js +1 -0
- package/lib/memory/adapters/config.ts +156 -225
- package/lib/memory/adapters/errors.d.ts +28 -20
- package/lib/memory/adapters/errors.js +1 -0
- package/lib/memory/adapters/errors.ts +83 -120
- package/lib/memory/context-manager.d.ts +15 -18
- package/lib/memory/context-manager.js +1 -0
- package/lib/memory/context-manager.ts +314 -401
- package/lib/memory/embeddings/factory.d.ts +18 -20
- package/lib/memory/embeddings/factory.js +1 -0
- package/lib/memory/embeddings/factory.ts +130 -173
- package/lib/memory/embeddings/index.js +1 -0
- package/lib/memory/embeddings/index.ts +1 -0
- package/lib/memory/embeddings/service.d.ts +36 -66
- package/lib/memory/embeddings/service.js +1 -0
- package/lib/memory/embeddings/service.ts +479 -616
- package/lib/memory/index.d.ts +2 -2
- package/lib/memory/index.js +1 -0
- package/lib/memory/index.ts +3 -13
- package/lib/memory/memory-mesh.d.ts +151 -93
- package/lib/memory/memory-mesh.js +1 -0
- package/lib/memory/memory-mesh.ts +1406 -1692
- package/lib/memory/memory-translator.d.ts +1 -6
- package/lib/memory/memory-translator.js +1 -0
- package/lib/memory/memory-translator.ts +96 -128
- package/lib/memory/schema.d.ts +29 -10
- package/lib/memory/schema.js +1 -0
- package/lib/memory/schema.ts +102 -185
- package/lib/memory/scorer.d.ts +3 -4
- package/lib/memory/scorer.js +1 -0
- package/lib/memory/scorer.ts +69 -86
- package/lib/memory/search/index.js +1 -0
- package/lib/memory/search/index.ts +1 -0
- package/lib/memory/search/keyword-search.d.ts +10 -26
- package/lib/memory/search/keyword-search.js +1 -0
- package/lib/memory/search/keyword-search.ts +123 -161
- package/lib/scrubber/config/defaults.d.ts +39 -46
- package/lib/scrubber/config/defaults.js +1 -0
- package/lib/scrubber/config/defaults.ts +50 -112
- package/lib/scrubber/errors/scrubber-error.d.ts +22 -0
- package/lib/scrubber/errors/scrubber-error.js +39 -0
- package/lib/scrubber/errors/scrubber-error.ts +44 -0
- package/lib/scrubber/index.d.ts +0 -1
- package/lib/scrubber/index.js +1 -0
- package/lib/scrubber/index.ts +1 -2
- package/lib/scrubber/scrubber.d.ts +14 -31
- package/lib/scrubber/scrubber.js +1 -0
- package/lib/scrubber/scrubber.ts +93 -152
- package/lib/scrubber/stages/chunker.d.ts +22 -10
- package/lib/scrubber/stages/chunker.js +86 -0
- package/lib/scrubber/stages/chunker.ts +104 -0
- package/lib/scrubber/stages/metadata-annotator.d.ts +14 -15
- package/lib/scrubber/stages/metadata-annotator.js +64 -0
- package/lib/scrubber/stages/metadata-annotator.ts +75 -0
- package/lib/scrubber/stages/normalizer.d.ts +13 -10
- package/lib/scrubber/stages/normalizer.js +51 -0
- package/lib/scrubber/stages/normalizer.ts +60 -0
- package/lib/scrubber/stages/semantic-filter.d.ts +13 -10
- package/lib/scrubber/stages/semantic-filter.js +51 -0
- package/lib/scrubber/stages/semantic-filter.ts +62 -0
- package/lib/scrubber/stages/structural-cleaner.d.ts +15 -10
- package/lib/scrubber/stages/structural-cleaner.js +73 -0
- package/lib/scrubber/stages/structural-cleaner.ts +83 -0
- package/lib/scrubber/stages/validator.d.ts +14 -15
- package/lib/scrubber/stages/validator.js +56 -0
- package/lib/scrubber/stages/validator.ts +67 -0
- package/lib/scrubber/telemetry.d.ts +20 -27
- package/lib/scrubber/telemetry.js +1 -0
- package/lib/scrubber/telemetry.ts +53 -90
- package/lib/scrubber/utils/hash.d.ts +14 -0
- package/lib/scrubber/utils/hash.js +37 -0
- package/lib/scrubber/utils/hash.ts +40 -0
- package/lib/scrubber/utils/html-parser.d.ts +14 -0
- package/lib/scrubber/utils/html-parser.js +38 -0
- package/lib/scrubber/utils/html-parser.ts +46 -0
- package/lib/scrubber/utils/pattern-matcher.d.ts +12 -0
- package/lib/scrubber/utils/pattern-matcher.js +54 -0
- package/lib/scrubber/utils/pattern-matcher.ts +64 -0
- package/lib/scrubber/utils/token-counter.d.ts +18 -0
- package/lib/scrubber/utils/token-counter.js +30 -0
- package/lib/scrubber/utils/token-counter.ts +32 -0
- package/lib/utils/logger.d.ts +1 -11
- package/lib/utils/logger.js +1 -0
- package/lib/utils/logger.ts +43 -63
- package/lib/utils/skill-metadata.d.ts +6 -14
- package/lib/utils/skill-metadata.js +1 -0
- package/lib/utils/skill-metadata.ts +89 -103
- package/lib/yamo/emitter.d.ts +8 -35
- package/lib/yamo/emitter.js +1 -0
- package/lib/yamo/emitter.ts +77 -155
- package/lib/yamo/index.d.ts +14 -0
- package/lib/yamo/index.js +14 -0
- package/lib/yamo/index.ts +16 -0
- package/lib/yamo/schema.d.ts +8 -10
- package/lib/yamo/schema.js +1 -0
- package/lib/yamo/schema.ts +82 -114
- package/package.json +4 -2
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/**
|
|
3
|
+
* Token Counting Utilities
|
|
4
|
+
* @module smora/scrubber/utils/token-counter
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export class TokenCounter {
|
|
8
|
+
/**
|
|
9
|
+
* Estimate token count (approximation)
|
|
10
|
+
* @param {string} text - Text to count
|
|
11
|
+
* @returns {number} - Estimated token count
|
|
12
|
+
*/
|
|
13
|
+
count(text) {
|
|
14
|
+
// Simple approximation: ~4 characters per token
|
|
15
|
+
return Math.ceil(text.length / 4);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* More accurate token count (slower)
|
|
20
|
+
* @param {string} text - Text to count
|
|
21
|
+
* @returns {number} - More accurate token count
|
|
22
|
+
*/
|
|
23
|
+
countAccurate(text) {
|
|
24
|
+
const words = text.split(/\s+/).filter(w => w.length > 0);
|
|
25
|
+
let tokens = words.length;
|
|
26
|
+
const punctuationMatches = text.match(/[.,!?;:]/g);
|
|
27
|
+
if (punctuationMatches) {
|
|
28
|
+
tokens += punctuationMatches.length;
|
|
29
|
+
}
|
|
30
|
+
return tokens;
|
|
31
|
+
}
|
|
32
|
+
}
|
package/lib/utils/logger.d.ts
CHANGED
|
@@ -16,14 +16,4 @@ export declare const logger: pino.Logger<never, boolean>;
|
|
|
16
16
|
* const logger = createLogger('kernel');
|
|
17
17
|
* logger.info({ action: 'boot' }, 'Kernel starting');
|
|
18
18
|
*/
|
|
19
|
-
export declare function createLogger(module:
|
|
20
|
-
/**
|
|
21
|
-
* Log levels and their usage:
|
|
22
|
-
* - fatal: Application crash, immediate attention required
|
|
23
|
-
* - error: Errors that need investigation
|
|
24
|
-
* - warn: Degraded state, potential issues
|
|
25
|
-
* - info: Important operational events (default)
|
|
26
|
-
* - debug: Detailed diagnostic information
|
|
27
|
-
* - trace: Very verbose, performance metrics
|
|
28
|
-
*/
|
|
29
|
-
export type { Logger } from "pino";
|
|
19
|
+
export declare function createLogger(module: any): pino.Logger<never, boolean>;
|
package/lib/utils/logger.js
CHANGED
package/lib/utils/logger.ts
CHANGED
|
@@ -1,63 +1,56 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
/**
|
|
2
3
|
* Structured Logger using Pino
|
|
3
4
|
* Provides centralized logging with metadata support, PII redaction, and environment-based formatting
|
|
4
5
|
*/
|
|
5
|
-
|
|
6
6
|
import pino from "pino";
|
|
7
|
-
|
|
8
7
|
// Determine if running in production
|
|
9
8
|
const isProduction = process.env.NODE_ENV === "production";
|
|
10
|
-
const logLevel = (process.env.LOG_LEVEL || "warn")
|
|
11
|
-
|
|
9
|
+
const logLevel = (process.env.LOG_LEVEL || "warn");
|
|
12
10
|
/**
|
|
13
11
|
* Main logger instance with configuration
|
|
14
12
|
*/
|
|
15
13
|
export const logger = pino({
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
|
|
57
|
-
// Timestamp in ISO format
|
|
58
|
-
timestamp: pino.stdTimeFunctions.isoTime,
|
|
14
|
+
level: logLevel,
|
|
15
|
+
// Pretty printing in development, JSON in production
|
|
16
|
+
transport: !isProduction
|
|
17
|
+
? {
|
|
18
|
+
target: "pino-pretty",
|
|
19
|
+
options: {
|
|
20
|
+
colorize: true,
|
|
21
|
+
translateTime: "HH:MM:ss.l",
|
|
22
|
+
ignore: "pid,hostname,app,version",
|
|
23
|
+
singleLine: false,
|
|
24
|
+
},
|
|
25
|
+
}
|
|
26
|
+
: undefined,
|
|
27
|
+
// Base fields included in all logs
|
|
28
|
+
base: {
|
|
29
|
+
app: "yamo-os",
|
|
30
|
+
version: process.env.npm_package_version || "1.1.0",
|
|
31
|
+
},
|
|
32
|
+
// Redact sensitive fields from logs
|
|
33
|
+
redact: {
|
|
34
|
+
paths: [
|
|
35
|
+
"apiKey",
|
|
36
|
+
"password",
|
|
37
|
+
"token",
|
|
38
|
+
"secret",
|
|
39
|
+
"key",
|
|
40
|
+
"*.apiKey",
|
|
41
|
+
"*.password",
|
|
42
|
+
"*.token",
|
|
43
|
+
"*.secret",
|
|
44
|
+
"*.key",
|
|
45
|
+
"OPENAI_API_KEY",
|
|
46
|
+
"ANTHROPIC_API_KEY",
|
|
47
|
+
"ZAI_API_KEY",
|
|
48
|
+
],
|
|
49
|
+
censor: "[REDACTED]",
|
|
50
|
+
},
|
|
51
|
+
// Timestamp in ISO format
|
|
52
|
+
timestamp: pino.stdTimeFunctions.isoTime,
|
|
59
53
|
});
|
|
60
|
-
|
|
61
54
|
/**
|
|
62
55
|
* Create a child logger with module-specific context
|
|
63
56
|
* @param module - Module name for logging context
|
|
@@ -67,19 +60,6 @@ export const logger = pino({
|
|
|
67
60
|
* const logger = createLogger('kernel');
|
|
68
61
|
* logger.info({ action: 'boot' }, 'Kernel starting');
|
|
69
62
|
*/
|
|
70
|
-
export function createLogger(module
|
|
71
|
-
|
|
63
|
+
export function createLogger(module) {
|
|
64
|
+
return logger.child({ module });
|
|
72
65
|
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Log levels and their usage:
|
|
76
|
-
* - fatal: Application crash, immediate attention required
|
|
77
|
-
* - error: Errors that need investigation
|
|
78
|
-
* - warn: Degraded state, potential issues
|
|
79
|
-
* - info: Important operational events (default)
|
|
80
|
-
* - debug: Detailed diagnostic information
|
|
81
|
-
* - trace: Very verbose, performance metrics
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
// Re-export types for convenience
|
|
85
|
-
export type { Logger } from "pino";
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Structured skill-identity extraction.
|
|
3
|
-
*
|
|
4
|
-
* Reads ONLY the YAML frontmatter block (between --- delimiters) or
|
|
5
|
-
* root-level identity declarations in legacy v0.4 compact format.
|
|
6
|
-
* The body of .yamo files is LLM-interpreted and MUST NOT be machine-parsed.
|
|
7
|
-
*/
|
|
8
|
-
export interface SkillIdentity {
|
|
9
|
-
name: string;
|
|
10
|
-
intent: string;
|
|
11
|
-
description: string;
|
|
12
|
-
}
|
|
13
1
|
/**
|
|
14
2
|
* Extract identity fields (name, intent, description) from .yamo content.
|
|
15
3
|
*
|
|
@@ -18,7 +6,11 @@ export interface SkillIdentity {
|
|
|
18
6
|
* 2. Legacy v0.4 root-level compact declarations
|
|
19
7
|
* 3. Content-hash fallback — deterministic and idempotent
|
|
20
8
|
*/
|
|
21
|
-
export declare function extractSkillIdentity(content:
|
|
9
|
+
export declare function extractSkillIdentity(content: any): {
|
|
10
|
+
name: any;
|
|
11
|
+
intent: any;
|
|
12
|
+
description: any;
|
|
13
|
+
};
|
|
22
14
|
/**
|
|
23
15
|
* Extract tags from YAML frontmatter.
|
|
24
16
|
* Returns an array of tag strings, or empty array if no tags found.
|
|
@@ -29,4 +21,4 @@ export declare function extractSkillIdentity(content: string): SkillIdentity;
|
|
|
29
21
|
* This function ONLY reads the YAML frontmatter block and does NOT parse
|
|
30
22
|
* the skill body, following the same safety constraints as extractSkillIdentity.
|
|
31
23
|
*/
|
|
32
|
-
export declare function extractSkillTags(content:
|
|
24
|
+
export declare function extractSkillTags(content: any): any;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
1
2
|
/**
|
|
2
3
|
* Structured skill-identity extraction.
|
|
3
4
|
*
|
|
@@ -5,64 +6,53 @@
|
|
|
5
6
|
* root-level identity declarations in legacy v0.4 compact format.
|
|
6
7
|
* The body of .yamo files is LLM-interpreted and MUST NOT be machine-parsed.
|
|
7
8
|
*/
|
|
8
|
-
|
|
9
9
|
import crypto from "crypto";
|
|
10
|
-
|
|
11
|
-
export interface SkillIdentity {
|
|
12
|
-
name: string;
|
|
13
|
-
intent: string;
|
|
14
|
-
description: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
10
|
/** Fields safe to extract for indexing and display. */
|
|
18
11
|
const IDENTITY_FIELDS = new Set(["name", "intent", "description"]);
|
|
19
|
-
|
|
20
12
|
/** Pre-computed regexes for legacy root-level identity declarations. */
|
|
21
|
-
const LEGACY_REGEXES
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
const LEGACY_REGEXES = {
|
|
14
|
+
name: /^name[;:]\s*([^;\n]+);?/m,
|
|
15
|
+
intent: /^intent[;:]\s*([^;\n]+);?/m,
|
|
16
|
+
description: /^description[;:]\s*([^;\n]+);?/m,
|
|
25
17
|
};
|
|
26
|
-
|
|
27
18
|
/**
|
|
28
19
|
* Parse flat key: value or key; value lines from a text block.
|
|
29
20
|
* Only extracts whitelisted identity fields.
|
|
30
21
|
*/
|
|
31
|
-
function parseFlatBlock(block
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
22
|
+
function parseFlatBlock(block) {
|
|
23
|
+
const result = {};
|
|
24
|
+
for (const line of block.split("\n")) {
|
|
25
|
+
const trimmed = line.trim();
|
|
26
|
+
if (!trimmed || trimmed.startsWith("#")) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
const colonIdx = trimmed.indexOf(":");
|
|
30
|
+
const semiIdx = trimmed.indexOf(";");
|
|
31
|
+
let sepIdx;
|
|
32
|
+
if (colonIdx > 0 && semiIdx > 0) {
|
|
33
|
+
sepIdx = Math.min(colonIdx, semiIdx);
|
|
34
|
+
}
|
|
35
|
+
else if (colonIdx > 0) {
|
|
36
|
+
sepIdx = colonIdx;
|
|
37
|
+
}
|
|
38
|
+
else if (semiIdx > 0) {
|
|
39
|
+
sepIdx = semiIdx;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
const key = trimmed.substring(0, sepIdx).trim();
|
|
45
|
+
let value = trimmed.substring(sepIdx + 1).trim();
|
|
46
|
+
// Strip trailing semicolon (legacy compact format)
|
|
47
|
+
if (value.endsWith(";")) {
|
|
48
|
+
value = value.slice(0, -1).trim();
|
|
49
|
+
}
|
|
50
|
+
if (IDENTITY_FIELDS.has(key) && value) {
|
|
51
|
+
result[key] = value;
|
|
52
|
+
}
|
|
61
53
|
}
|
|
62
|
-
|
|
63
|
-
return result;
|
|
54
|
+
return result;
|
|
64
55
|
}
|
|
65
|
-
|
|
66
56
|
/**
|
|
67
57
|
* Extract identity fields (name, intent, description) from .yamo content.
|
|
68
58
|
*
|
|
@@ -71,52 +61,49 @@ function parseFlatBlock(block: string): Record<string, string> {
|
|
|
71
61
|
* 2. Legacy v0.4 root-level compact declarations
|
|
72
62
|
* 3. Content-hash fallback — deterministic and idempotent
|
|
73
63
|
*/
|
|
74
|
-
export function extractSkillIdentity(content
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
64
|
+
export function extractSkillIdentity(content) {
|
|
65
|
+
// 1. YAML frontmatter
|
|
66
|
+
if (content.startsWith("---")) {
|
|
67
|
+
const endIdx = content.indexOf("---", 3);
|
|
68
|
+
if (endIdx !== -1) {
|
|
69
|
+
const fields = parseFlatBlock(content.substring(3, endIdx));
|
|
70
|
+
if (fields.name) {
|
|
71
|
+
return {
|
|
72
|
+
name: fields.name,
|
|
73
|
+
intent: fields.intent || "general_procedure",
|
|
74
|
+
description: fields.description || "",
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// 2. Legacy v0.4 root-level identity declarations.
|
|
80
|
+
// Safe: name/intent/description do not appear as body section headers.
|
|
81
|
+
const legacyFields = {};
|
|
82
|
+
for (const field of IDENTITY_FIELDS) {
|
|
83
|
+
const match = content.match(LEGACY_REGEXES[field]);
|
|
84
|
+
if (match) {
|
|
85
|
+
legacyFields[field] = match[1].trim();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (legacyFields.name) {
|
|
81
89
|
return {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
90
|
+
name: legacyFields.name,
|
|
91
|
+
intent: legacyFields.intent || "general_procedure",
|
|
92
|
+
description: legacyFields.description || "",
|
|
85
93
|
};
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// 2. Legacy v0.4 root-level identity declarations.
|
|
91
|
-
// Safe: name/intent/description do not appear as body section headers.
|
|
92
|
-
const legacyFields: Record<string, string> = {};
|
|
93
|
-
for (const field of IDENTITY_FIELDS) {
|
|
94
|
-
const match = content.match(LEGACY_REGEXES[field]);
|
|
95
|
-
if (match) {
|
|
96
|
-
legacyFields[field] = match[1].trim();
|
|
97
94
|
}
|
|
98
|
-
|
|
99
|
-
|
|
95
|
+
// 3. Content-hash fallback
|
|
96
|
+
const shortHash = crypto
|
|
97
|
+
.createHash("sha256")
|
|
98
|
+
.update(content)
|
|
99
|
+
.digest("hex")
|
|
100
|
+
.substring(0, 12);
|
|
100
101
|
return {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
name: `Unnamed_${shortHash}`,
|
|
103
|
+
intent: "general_procedure",
|
|
104
|
+
description: "",
|
|
104
105
|
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// 3. Content-hash fallback
|
|
108
|
-
const shortHash = crypto
|
|
109
|
-
.createHash("sha256")
|
|
110
|
-
.update(content)
|
|
111
|
-
.digest("hex")
|
|
112
|
-
.substring(0, 12);
|
|
113
|
-
return {
|
|
114
|
-
name: `Unnamed_${shortHash}`,
|
|
115
|
-
intent: "general_procedure",
|
|
116
|
-
description: "",
|
|
117
|
-
};
|
|
118
106
|
}
|
|
119
|
-
|
|
120
107
|
/**
|
|
121
108
|
* Extract tags from YAML frontmatter.
|
|
122
109
|
* Returns an array of tag strings, or empty array if no tags found.
|
|
@@ -127,21 +114,20 @@ export function extractSkillIdentity(content: string): SkillIdentity {
|
|
|
127
114
|
* This function ONLY reads the YAML frontmatter block and does NOT parse
|
|
128
115
|
* the skill body, following the same safety constraints as extractSkillIdentity.
|
|
129
116
|
*/
|
|
130
|
-
export function extractSkillTags(content
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
117
|
+
export function extractSkillTags(content) {
|
|
118
|
+
// Only parse YAML frontmatter (between --- delimiters)
|
|
119
|
+
if (content.startsWith("---")) {
|
|
120
|
+
const endIdx = content.indexOf("---", 3);
|
|
121
|
+
if (endIdx !== -1) {
|
|
122
|
+
const frontmatter = content.substring(3, endIdx);
|
|
123
|
+
const tagsMatch = frontmatter.match(/^tags:\s*(.+)$/m);
|
|
124
|
+
if (tagsMatch) {
|
|
125
|
+
return tagsMatch[1]
|
|
126
|
+
.split(",")
|
|
127
|
+
.map((t) => t.trim())
|
|
128
|
+
.filter((t) => t.length > 0);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
143
131
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
return [];
|
|
132
|
+
return [];
|
|
147
133
|
}
|
package/lib/yamo/emitter.d.ts
CHANGED
|
@@ -8,36 +8,6 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Reference: Hindsight project's yamo_integration.py
|
|
10
10
|
*/
|
|
11
|
-
export interface ReflectBlockParams {
|
|
12
|
-
topic?: string;
|
|
13
|
-
memoryCount: number;
|
|
14
|
-
agentId?: string;
|
|
15
|
-
reflection: string;
|
|
16
|
-
confidence?: number;
|
|
17
|
-
}
|
|
18
|
-
export interface RetainBlockParams {
|
|
19
|
-
content: string;
|
|
20
|
-
metadata?: any;
|
|
21
|
-
id: string;
|
|
22
|
-
agentId?: string;
|
|
23
|
-
memoryType?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface RecallBlockParams {
|
|
26
|
-
query: string;
|
|
27
|
-
resultCount: number;
|
|
28
|
-
limit?: number;
|
|
29
|
-
agentId?: string;
|
|
30
|
-
searchType?: string;
|
|
31
|
-
}
|
|
32
|
-
export interface DeleteBlockParams {
|
|
33
|
-
id: string;
|
|
34
|
-
agentId?: string;
|
|
35
|
-
reason?: string;
|
|
36
|
-
}
|
|
37
|
-
export interface ValidationResult {
|
|
38
|
-
valid: boolean;
|
|
39
|
-
errors: string[];
|
|
40
|
-
}
|
|
41
11
|
/**
|
|
42
12
|
* YamoEmitter class for building YAMO protocol blocks
|
|
43
13
|
* YAMO (Yet Another Multi-agent Orchestration) blocks provide
|
|
@@ -48,26 +18,29 @@ export declare class YamoEmitter {
|
|
|
48
18
|
* Build a YAMO block for reflect operation
|
|
49
19
|
* Reflect operations synthesize insights from existing memories
|
|
50
20
|
*/
|
|
51
|
-
static buildReflectBlock(params:
|
|
21
|
+
static buildReflectBlock(params: any): string;
|
|
52
22
|
/**
|
|
53
23
|
* Build a YAMO block for retain (add) operation
|
|
54
24
|
* Retain operations store new memories into the system
|
|
55
25
|
*/
|
|
56
|
-
static buildRetainBlock(params:
|
|
26
|
+
static buildRetainBlock(params: any): string;
|
|
57
27
|
/**
|
|
58
28
|
* Build a YAMO block for recall (search) operation
|
|
59
29
|
* Recall operations retrieve memories based on semantic similarity
|
|
60
30
|
*/
|
|
61
|
-
static buildRecallBlock(params:
|
|
31
|
+
static buildRecallBlock(params: any): string;
|
|
62
32
|
/**
|
|
63
33
|
* Build a YAMO block for delete operation (optional)
|
|
64
34
|
* Delete operations remove memories from the system
|
|
65
35
|
*/
|
|
66
|
-
static buildDeleteBlock(params:
|
|
36
|
+
static buildDeleteBlock(params: any): string;
|
|
67
37
|
/**
|
|
68
38
|
* Validate a YAMO block structure
|
|
69
39
|
* Checks for required sections and proper formatting
|
|
70
40
|
*/
|
|
71
|
-
static validateBlock(yamoBlock:
|
|
41
|
+
static validateBlock(yamoBlock: any): {
|
|
42
|
+
valid: boolean;
|
|
43
|
+
errors: any[];
|
|
44
|
+
};
|
|
72
45
|
}
|
|
73
46
|
export default YamoEmitter;
|
package/lib/yamo/emitter.js
CHANGED