maskweaver 0.9.4 → 0.9.5
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/cli/doctor.js +5 -21
- package/dist/cli/install.d.ts +0 -8
- package/dist/cli/install.js +0 -39
- package/dist/context/config.d.ts +0 -22
- package/dist/context/config.js +0 -28
- package/dist/context/feature.d.ts +0 -39
- package/dist/context/feature.js +0 -77
- package/dist/context/files.d.ts +0 -13
- package/dist/context/files.js +1 -24
- package/dist/context/index.d.ts +0 -7
- package/dist/context/index.js +0 -12
- package/dist/context/project.d.ts +0 -21
- package/dist/context/project.js +0 -30
- package/dist/context/types.d.ts +0 -48
- package/dist/context/types.js +0 -12
- package/dist/context/utils.d.ts +0 -18
- package/dist/context/utils.js +0 -27
- package/dist/core/engine/promptBuilder.d.ts +0 -17
- package/dist/core/engine/promptBuilder.js +0 -28
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.js +0 -9
- package/dist/core/loader/MaskLoader.d.ts +0 -23
- package/dist/core/loader/MaskLoader.js +0 -29
- package/dist/core/schema/types.d.ts +0 -47
- package/dist/core/schema/types.js +0 -6
- package/dist/core/schema/validator.d.ts +0 -14
- package/dist/core/schema/validator.js +0 -18
- package/dist/i18n/index.d.ts +0 -18
- package/dist/i18n/index.js +4 -23
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -8
- package/dist/lib.d.ts +0 -5
- package/dist/lib.js +0 -12
- package/dist/memory/chunking.d.ts +0 -22
- package/dist/memory/chunking.js +2 -37
- package/dist/memory/core.d.ts +0 -29
- package/dist/memory/core.js +1 -52
- package/dist/memory/index.d.ts +0 -5
- package/dist/memory/index.js +0 -10
- package/dist/memory/indexer.d.ts +0 -21
- package/dist/memory/indexer.js +0 -44
- package/dist/memory/providers/examples.d.ts +0 -5
- package/dist/memory/providers/examples.js +4 -64
- package/dist/memory/providers/factory.d.ts +0 -44
- package/dist/memory/providers/factory.js +0 -46
- package/dist/memory/providers/index.d.ts +0 -26
- package/dist/memory/providers/index.js +0 -28
- package/dist/memory/providers/ollama.d.ts +0 -6
- package/dist/memory/providers/ollama.js +1 -8
- package/dist/memory/providers/openai.d.ts +0 -6
- package/dist/memory/providers/openai.js +1 -8
- package/dist/memory/providers/openrouter.d.ts +0 -6
- package/dist/memory/providers/openrouter.js +0 -8
- package/dist/memory/providers/text-only.d.ts +0 -13
- package/dist/memory/providers/text-only.js +0 -17
- package/dist/memory/providers/types.d.ts +0 -39
- package/dist/memory/providers/types.js +0 -7
- package/dist/memory/providers/voyage.d.ts +0 -22
- package/dist/memory/providers/voyage.js +1 -24
- package/dist/memory/search/hybrid.d.ts +0 -12
- package/dist/memory/search/hybrid.js +1 -22
- package/dist/memory/store/sqlite.d.ts +0 -72
- package/dist/memory/store/sqlite.js +4 -127
- package/dist/plugin/config/index.d.ts +0 -112
- package/dist/plugin/config/index.js +0 -115
- package/dist/plugin/index.d.ts +0 -13
- package/dist/plugin/index.js +1 -123
- package/dist/plugin/tools/command-registry.d.ts +0 -6
- package/dist/plugin/tools/command-registry.js +0 -14
- package/dist/plugin/tools/context.d.ts +0 -12
- package/dist/plugin/tools/context.js +0 -58
- package/dist/plugin/tools/maskSave.d.ts +0 -3
- package/dist/plugin/tools/maskSave.js +0 -3
- package/dist/plugin/tools/memoryGet.d.ts +0 -3
- package/dist/plugin/tools/memoryGet.js +0 -3
- package/dist/plugin/tools/memoryIndexer.d.ts +0 -3
- package/dist/plugin/tools/memoryIndexer.js +0 -10
- package/dist/plugin/tools/memorySearch.d.ts +0 -31
- package/dist/plugin/tools/memorySearch.js +0 -79
- package/dist/plugin/tools/memoryWrite.d.ts +0 -8
- package/dist/plugin/tools/memoryWrite.js +0 -32
- package/dist/plugin/tools/retrospect.d.ts +0 -3
- package/dist/plugin/tools/retrospect.js +0 -3
- package/dist/plugin/tools/slashcommand.d.ts +0 -11
- package/dist/plugin/tools/slashcommand.js +0 -38
- package/dist/plugin/tools/squad.d.ts +0 -12
- package/dist/plugin/tools/squad.js +11 -83
- package/dist/plugin/tools/weave.d.ts +0 -6
- package/dist/plugin/tools/weave.js +0 -78
- package/dist/plugin/types.d.ts +0 -20
- package/dist/plugin/types.js +0 -7
- package/dist/retrospect/index.d.ts +0 -7
- package/dist/retrospect/index.js +0 -9
- package/dist/retrospect/mask-save.d.ts +0 -12
- package/dist/retrospect/mask-save.js +1 -80
- package/dist/retrospect/retrospect.d.ts +0 -18
- package/dist/retrospect/retrospect.js +0 -63
- package/dist/retrospect/strategies/base.d.ts +0 -15
- package/dist/retrospect/strategies/base.js +0 -7
- package/dist/retrospect/strategies/deep.d.ts +0 -12
- package/dist/retrospect/strategies/deep.js +0 -24
- package/dist/retrospect/strategies/index.d.ts +0 -12
- package/dist/retrospect/strategies/index.js +0 -12
- package/dist/retrospect/strategies/quick.d.ts +0 -12
- package/dist/retrospect/strategies/quick.js +0 -19
- package/dist/retrospect/strategies/standard.d.ts +0 -12
- package/dist/retrospect/strategies/standard.js +0 -15
- package/dist/retrospect/types.d.ts +0 -7
- package/dist/retrospect/types.js +0 -7
- package/dist/shared/config.d.ts +0 -105
- package/dist/shared/config.js +0 -33
- package/dist/shared/errors.d.ts +0 -18
- package/dist/shared/errors.js +0 -19
- package/dist/shared/generate-agents.d.ts +0 -69
- package/dist/shared/generate-agents.js +2 -86
- package/dist/shared/image.d.ts +0 -67
- package/dist/shared/image.js +6 -104
- package/dist/shared/index.d.ts +0 -5
- package/dist/shared/index.js +0 -7
- package/dist/shared/model-registry.d.ts +0 -72
- package/dist/shared/model-registry.js +5 -95
- package/dist/shared/types.d.ts +0 -15
- package/dist/shared/types.js +0 -3
- package/dist/shared-context/dag.d.ts +0 -105
- package/dist/shared-context/dag.js +3 -114
- package/dist/shared-context/index.d.ts +0 -5
- package/dist/shared-context/index.js +0 -15
- package/dist/shared-context/logger.d.ts +0 -37
- package/dist/shared-context/logger.js +0 -41
- package/dist/shared-context/parallel-executor.d.ts +0 -54
- package/dist/shared-context/parallel-executor.js +4 -56
- package/dist/shared-context/session.d.ts +0 -56
- package/dist/shared-context/session.js +0 -47
- package/dist/shared-context/squad.d.ts +0 -68
- package/dist/shared-context/squad.js +0 -63
- package/dist/shared-context/storage.d.ts +0 -132
- package/dist/shared-context/storage.js +0 -116
- package/dist/shared-context/task.d.ts +0 -120
- package/dist/shared-context/task.js +0 -152
- package/dist/shared-context/test/dag.test.js +9 -14
- package/dist/shared-context/test/logger.test.d.ts +0 -8
- package/dist/shared-context/test/logger.test.js +0 -52
- package/dist/shared-context/test/session.test.d.ts +0 -7
- package/dist/shared-context/test/session.test.js +0 -63
- package/dist/shared-context/test/squad.test.d.ts +0 -10
- package/dist/shared-context/test/squad.test.js +2 -68
- package/dist/shared-context/test/storage.test.d.ts +0 -8
- package/dist/shared-context/test/storage.test.js +0 -68
- package/dist/shared-context/test/task.test.d.ts +0 -7
- package/dist/shared-context/test/task.test.js +0 -54
- package/dist/shared-context/test/watchdog.test.d.ts +0 -7
- package/dist/shared-context/test/watchdog.test.js +3 -58
- package/dist/shared-context/types.d.ts +0 -215
- package/dist/shared-context/types.js +0 -125
- package/dist/shared-context/watchdog.d.ts +0 -127
- package/dist/shared-context/watchdog.js +0 -148
- package/dist/shared-context/worktree.d.ts +0 -68
- package/dist/shared-context/worktree.js +2 -34
- package/dist/verify/budget.d.ts +0 -29
- package/dist/verify/budget.js +0 -34
- package/dist/verify/critical-files.d.ts +0 -17
- package/dist/verify/critical-files.js +0 -37
- package/dist/verify/escalation.d.ts +0 -20
- package/dist/verify/escalation.js +0 -22
- package/dist/verify/index.d.ts +0 -5
- package/dist/verify/index.js +0 -11
- package/dist/verify/prompts.d.ts +0 -20
- package/dist/verify/prompts.js +0 -20
- package/dist/verify/types.d.ts +0 -26
- package/dist/verify/types.js +1 -12
- package/dist/verify/verifier.d.ts +0 -29
- package/dist/verify/verifier.js +0 -54
- package/dist/version.d.ts +1 -16
- package/dist/version.js +1 -16
- package/dist/weave/bridge.d.ts +0 -35
- package/dist/weave/bridge.js +0 -51
- package/dist/weave/environment/detector.d.ts +0 -6
- package/dist/weave/environment/detector.js +4 -45
- package/dist/weave/environment/index.d.ts +0 -19
- package/dist/weave/environment/index.js +1 -39
- package/dist/weave/environment/issues.d.ts +0 -35
- package/dist/weave/environment/issues.js +0 -59
- package/dist/weave/git.d.ts +0 -8
- package/dist/weave/git.js +0 -8
- package/dist/weave/index.d.ts +0 -13
- package/dist/weave/index.js +2 -28
- package/dist/weave/knowledge/global.d.ts +0 -39
- package/dist/weave/knowledge/global.js +2 -78
- package/dist/weave/loop.js +0 -3
- package/dist/weave/orchestrator.d.ts +0 -69
- package/dist/weave/orchestrator.js +1 -101
- package/dist/weave/phase-manager.d.ts +0 -64
- package/dist/weave/phase-manager.js +0 -89
- package/dist/weave/security/secret-scan.d.ts +0 -14
- package/dist/weave/security/secret-scan.js +0 -19
- package/dist/weave/stages/build.js +0 -15
- package/dist/weave/stages/execute.d.ts +0 -42
- package/dist/weave/stages/execute.js +4 -86
- package/dist/weave/stages/handoff.d.ts +0 -7
- package/dist/weave/stages/handoff.js +0 -43
- package/dist/weave/stages/index.d.ts +0 -3
- package/dist/weave/stages/index.js +0 -3
- package/dist/weave/stages/intake.d.ts +0 -8
- package/dist/weave/stages/intake.js +5 -65
- package/dist/weave/stages/map.d.ts +0 -1
- package/dist/weave/stages/openspec.d.ts +0 -1
- package/dist/weave/stages/plan.d.ts +0 -11
- package/dist/weave/stages/plan.js +1 -53
- package/dist/weave/stages/refine.d.ts +0 -7
- package/dist/weave/stages/refine.js +0 -7
- package/dist/weave/stages/research.d.ts +0 -6
- package/dist/weave/stages/research.js +0 -6
- package/dist/weave/stages/spec.d.ts +0 -12
- package/dist/weave/stages/spec.js +0 -17
- package/dist/weave/types.d.ts +0 -20
- package/dist/weave/types.js +0 -5
- package/dist/weave/verification/commands.d.ts +0 -12
- package/dist/weave/verification/commands.js +0 -19
- package/dist/weave/verification/index.d.ts +0 -6
- package/dist/weave/verification/index.js +1 -19
- package/dist/weave/verification/playwright.d.ts +0 -47
- package/dist/weave/verification/playwright.js +1 -90
- package/dist/weave/worktree.d.ts +0 -16
- package/dist/weave/worktree.js +0 -23
- package/dist/weave/yaml-repair.d.ts +0 -39
- package/dist/weave/yaml-repair.js +13 -116
- package/package.json +1 -1
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mask Schema Validator
|
|
3
|
-
*
|
|
4
|
-
* Validates mask YAML/JSON against the schema using Zod.
|
|
5
|
-
*/
|
|
6
1
|
import { z } from 'zod';
|
|
7
2
|
import type { MaskSchema } from './types';
|
|
8
3
|
export declare const MaskSchemaValidator: z.ZodObject<{
|
|
@@ -75,9 +70,6 @@ export declare const MaskSchemaValidator: z.ZodObject<{
|
|
|
75
70
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
76
71
|
}, z.core.$strip>>;
|
|
77
72
|
}, z.core.$strip>;
|
|
78
|
-
/**
|
|
79
|
-
* Validation result
|
|
80
|
-
*/
|
|
81
73
|
export interface ValidationResult {
|
|
82
74
|
success: boolean;
|
|
83
75
|
data?: MaskSchema;
|
|
@@ -86,11 +78,5 @@ export interface ValidationResult {
|
|
|
86
78
|
message: string;
|
|
87
79
|
}>;
|
|
88
80
|
}
|
|
89
|
-
/**
|
|
90
|
-
* Validate a mask object against the schema
|
|
91
|
-
*/
|
|
92
81
|
export declare function validateMask(mask: unknown): ValidationResult;
|
|
93
|
-
/**
|
|
94
|
-
* Validate and throw on error
|
|
95
|
-
*/
|
|
96
82
|
export declare function validateMaskOrThrow(mask: unknown): MaskSchema;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Mask Schema Validator
|
|
3
|
-
*
|
|
4
|
-
* Validates mask YAML/JSON against the schema using Zod.
|
|
5
|
-
*/
|
|
6
1
|
import { z } from 'zod';
|
|
7
|
-
// Communication style enums
|
|
8
2
|
const CommunicationToneSchema = z.enum(['direct', 'friendly', 'formal', 'socratic', 'enthusiastic']);
|
|
9
3
|
const VerbositySchema = z.enum(['concise', 'moderate', 'detailed']);
|
|
10
4
|
const TechnicalDepthSchema = z.enum(['beginner', 'intermediate', 'expert']);
|
|
11
5
|
const LanguageSchema = z.enum(['en', 'ko', 'zh', 'ja']);
|
|
12
|
-
// Metadata schema
|
|
13
6
|
const MaskMetadataSchema = z.object({
|
|
14
7
|
id: z.string().regex(/^[a-z0-9-]+$/, 'ID must be kebab-case'),
|
|
15
8
|
version: z.literal('1.0'),
|
|
@@ -20,7 +13,6 @@ const MaskMetadataSchema = z.object({
|
|
|
20
13
|
relatedMasks: z.array(z.string()).optional(),
|
|
21
14
|
tags: z.array(z.string()).optional(),
|
|
22
15
|
});
|
|
23
|
-
// Profile schema
|
|
24
16
|
const MaskProfileSchema = z.object({
|
|
25
17
|
name: z.string().min(1, 'Name is required'),
|
|
26
18
|
tagline: z.string().min(1, 'Tagline is required'),
|
|
@@ -30,7 +22,6 @@ const MaskProfileSchema = z.object({
|
|
|
30
22
|
strengths: z.array(z.string()).min(1).max(10),
|
|
31
23
|
limitations: z.array(z.string()).optional(),
|
|
32
24
|
});
|
|
33
|
-
// Behavior schema
|
|
34
25
|
const MaskBehaviorSchema = z.object({
|
|
35
26
|
systemPrompt: z.string().min(100, 'System prompt should be detailed'),
|
|
36
27
|
communicationStyle: z.object({
|
|
@@ -46,7 +37,6 @@ const MaskBehaviorSchema = z.object({
|
|
|
46
37
|
}),
|
|
47
38
|
signaturePhrases: z.array(z.string()).optional(),
|
|
48
39
|
});
|
|
49
|
-
// Usage schema
|
|
50
40
|
const MaskUsageExampleSchema = z.object({
|
|
51
41
|
scenario: z.string(),
|
|
52
42
|
expectedOutcome: z.string(),
|
|
@@ -56,7 +46,6 @@ const MaskUsageSchema = z.object({
|
|
|
56
46
|
notSuitableFor: z.array(z.string()).optional(),
|
|
57
47
|
examples: z.array(MaskUsageExampleSchema).min(1),
|
|
58
48
|
});
|
|
59
|
-
// Config schema
|
|
60
49
|
const MaskConfigSchema = z.object({
|
|
61
50
|
priority: z.number().min(0).max(100).optional(),
|
|
62
51
|
allowedTools: z.array(z.string()).optional(),
|
|
@@ -64,7 +53,6 @@ const MaskConfigSchema = z.object({
|
|
|
64
53
|
maxTokens: z.number().positive().optional(),
|
|
65
54
|
temperature: z.number().min(0).max(2).optional(),
|
|
66
55
|
}).optional();
|
|
67
|
-
// Complete mask schema
|
|
68
56
|
export const MaskSchemaValidator = z.object({
|
|
69
57
|
metadata: MaskMetadataSchema,
|
|
70
58
|
profile: MaskProfileSchema,
|
|
@@ -72,9 +60,6 @@ export const MaskSchemaValidator = z.object({
|
|
|
72
60
|
usage: MaskUsageSchema,
|
|
73
61
|
config: MaskConfigSchema,
|
|
74
62
|
});
|
|
75
|
-
/**
|
|
76
|
-
* Validate a mask object against the schema
|
|
77
|
-
*/
|
|
78
63
|
export function validateMask(mask) {
|
|
79
64
|
const result = MaskSchemaValidator.safeParse(mask);
|
|
80
65
|
if (result.success) {
|
|
@@ -91,9 +76,6 @@ export function validateMask(mask) {
|
|
|
91
76
|
})),
|
|
92
77
|
};
|
|
93
78
|
}
|
|
94
|
-
/**
|
|
95
|
-
* Validate and throw on error
|
|
96
|
-
*/
|
|
97
79
|
export function validateMaskOrThrow(mask) {
|
|
98
80
|
const result = validateMask(mask);
|
|
99
81
|
if (!result.success) {
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @maskweaver/i18n
|
|
3
|
-
*
|
|
4
|
-
* Internationalization infrastructure for Maskweaver.
|
|
5
|
-
* Phase 1: English only, but structure ready for expansion.
|
|
6
|
-
*/
|
|
7
1
|
import en from './locales/en.json';
|
|
8
2
|
export type Locale = 'en' | 'ko' | 'zh' | 'ja';
|
|
9
3
|
export type TranslationKey = keyof typeof en;
|
|
10
|
-
/**
|
|
11
|
-
* Set the current locale
|
|
12
|
-
*/
|
|
13
4
|
export declare function setLocale(locale: Locale): void;
|
|
14
|
-
/**
|
|
15
|
-
* Get the current locale
|
|
16
|
-
*/
|
|
17
5
|
export declare function getLocale(): Locale;
|
|
18
|
-
/**
|
|
19
|
-
* Translate a key
|
|
20
|
-
*/
|
|
21
6
|
export declare function t(key: string, params?: Record<string, string>): string;
|
|
22
|
-
/**
|
|
23
|
-
* Load translations for a locale
|
|
24
|
-
*/
|
|
25
7
|
export declare function loadLocale(locale: Locale): Promise<void>;
|
|
26
8
|
declare const _default: {
|
|
27
9
|
t: typeof t;
|
package/dist/i18n/index.js
CHANGED
|
@@ -1,48 +1,29 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @maskweaver/i18n
|
|
3
|
-
*
|
|
4
|
-
* Internationalization infrastructure for Maskweaver.
|
|
5
|
-
* Phase 1: English only, but structure ready for expansion.
|
|
6
|
-
*/
|
|
7
1
|
import en from './locales/en.json';
|
|
8
2
|
const translations = {
|
|
9
3
|
en,
|
|
10
|
-
ko: en,
|
|
11
|
-
zh: en,
|
|
12
|
-
ja: en,
|
|
4
|
+
ko: en,
|
|
5
|
+
zh: en,
|
|
6
|
+
ja: en,
|
|
13
7
|
};
|
|
14
8
|
let currentLocale = 'en';
|
|
15
|
-
/**
|
|
16
|
-
* Set the current locale
|
|
17
|
-
*/
|
|
18
9
|
export function setLocale(locale) {
|
|
19
10
|
currentLocale = locale;
|
|
20
11
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Get the current locale
|
|
23
|
-
*/
|
|
24
12
|
export function getLocale() {
|
|
25
13
|
return currentLocale;
|
|
26
14
|
}
|
|
27
|
-
/**
|
|
28
|
-
* Translate a key
|
|
29
|
-
*/
|
|
30
15
|
export function t(key, params) {
|
|
31
16
|
const translation = translations[currentLocale][key] || translations.en[key] || key;
|
|
32
17
|
if (!params) {
|
|
33
18
|
return translation;
|
|
34
19
|
}
|
|
35
|
-
// Replace {{param}} placeholders
|
|
36
20
|
return translation.replace(/\{\{(\w+)\}\}/g, (_, paramKey) => {
|
|
37
21
|
return params[paramKey] || `{{${paramKey}}}`;
|
|
38
22
|
});
|
|
39
23
|
}
|
|
40
|
-
/**
|
|
41
|
-
* Load translations for a locale
|
|
42
|
-
*/
|
|
43
24
|
export async function loadLocale(locale) {
|
|
44
25
|
if (translations[locale] && translations[locale] !== translations.en) {
|
|
45
|
-
return;
|
|
26
|
+
return;
|
|
46
27
|
}
|
|
47
28
|
try {
|
|
48
29
|
const module = await import(`./locales/${locale}.json`);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maskweaver - AI Expert Persona System
|
|
3
|
-
*
|
|
4
|
-
* 가면술사: AI 코딩 어시스턴트에게 전문가 인격을 부여하는 시스템
|
|
5
|
-
*
|
|
6
|
-
* @author ULJI SOFT <ulgerang@gmail.com>
|
|
7
|
-
* @license MIT
|
|
8
|
-
*/
|
|
9
1
|
import { MaskweaverPlugin } from "./plugin/index.js";
|
|
10
2
|
export { MaskweaverPlugin };
|
|
11
3
|
declare const _default: {
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maskweaver - AI Expert Persona System
|
|
3
|
-
*
|
|
4
|
-
* 가면술사: AI 코딩 어시스턴트에게 전문가 인격을 부여하는 시스템
|
|
5
|
-
*
|
|
6
|
-
* @author ULJI SOFT <ulgerang@gmail.com>
|
|
7
|
-
* @license MIT
|
|
8
|
-
*/
|
|
9
1
|
import { MaskweaverPlugin } from "./plugin/index.js";
|
|
10
2
|
export { MaskweaverPlugin };
|
|
11
3
|
export default {
|
package/dist/lib.d.ts
CHANGED
package/dist/lib.js
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maskweaver - AI Expert Persona System
|
|
3
|
-
*
|
|
4
|
-
* Library exports for programmatic usage.
|
|
5
|
-
*/
|
|
6
|
-
// Version
|
|
7
1
|
export { VERSION, getVersionString } from "./version.js";
|
|
8
|
-
// Core: Schema, validation, prompt builder
|
|
9
2
|
export * as core from "./core/index.js";
|
|
10
|
-
// Shared: Errors, types, config
|
|
11
3
|
export * as shared from "./shared/index.js";
|
|
12
|
-
// Memory: Embedding, vector search
|
|
13
4
|
export * as memory from "./memory/index.js";
|
|
14
|
-
// Context: Feature context management
|
|
15
5
|
export * as context from "./context/index.js";
|
|
16
|
-
// Retrospect: Session retrospective
|
|
17
6
|
export * as retrospect from "./retrospect/index.js";
|
|
18
|
-
// Verify: Code verification
|
|
19
7
|
export * as verify from "./verify/index.js";
|
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text Chunking - Break text into manageable pieces
|
|
3
|
-
*
|
|
4
|
-
* Simple line-based chunking with overlap.
|
|
5
|
-
* Preserves context at chunk boundaries.
|
|
6
|
-
*/
|
|
7
1
|
import { type Chunk } from './core.js';
|
|
8
|
-
/**
|
|
9
|
-
* Chunk text into overlapping segments.
|
|
10
|
-
*/
|
|
11
2
|
export declare function chunkText(text: string, filePath: string): Chunk[];
|
|
12
|
-
/**
|
|
13
|
-
* Estimate tokens in text.
|
|
14
|
-
*/
|
|
15
3
|
export declare function estimateTokens(text: string): number;
|
|
16
|
-
/**
|
|
17
|
-
* Split text into sentences.
|
|
18
|
-
* Handles both English and Korean.
|
|
19
|
-
*/
|
|
20
4
|
export declare function splitIntoSentences(text: string): string[];
|
|
21
|
-
/**
|
|
22
|
-
* Markdown section parsing.
|
|
23
|
-
*/
|
|
24
5
|
export interface MarkdownSection {
|
|
25
6
|
header: string;
|
|
26
7
|
content: string;
|
|
@@ -28,7 +9,4 @@ export interface MarkdownSection {
|
|
|
28
9
|
startLine: number;
|
|
29
10
|
endLine: number;
|
|
30
11
|
}
|
|
31
|
-
/**
|
|
32
|
-
* Parse markdown into sections.
|
|
33
|
-
*/
|
|
34
12
|
export declare function parseMarkdownSections(content: string): MarkdownSection[];
|
package/dist/memory/chunking.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text Chunking - Break text into manageable pieces
|
|
3
|
-
*
|
|
4
|
-
* Simple line-based chunking with overlap.
|
|
5
|
-
* Preserves context at chunk boundaries.
|
|
6
|
-
*/
|
|
7
1
|
import { CONFIG, hashText, determineSource } from './core.js';
|
|
8
|
-
/**
|
|
9
|
-
* Chunk text into overlapping segments.
|
|
10
|
-
*/
|
|
11
2
|
export function chunkText(text, filePath) {
|
|
12
3
|
const { maxTokens, overlapTokens, charsPerToken } = CONFIG.chunking;
|
|
13
4
|
const source = determineSource(filePath);
|
|
@@ -16,32 +7,28 @@ export function chunkText(text, filePath) {
|
|
|
16
7
|
const maxChars = maxTokens * charsPerToken;
|
|
17
8
|
const overlapChars = overlapTokens * charsPerToken;
|
|
18
9
|
let currentChunkLines = [];
|
|
19
|
-
let currentChunkStart = 1;
|
|
10
|
+
let currentChunkStart = 1;
|
|
20
11
|
let currentLength = 0;
|
|
21
12
|
for (let i = 0; i < lines.length; i++) {
|
|
22
13
|
const line = lines[i];
|
|
23
|
-
const lineLength = line.length + 1;
|
|
14
|
+
const lineLength = line.length + 1;
|
|
24
15
|
if (currentLength + lineLength <= maxChars) {
|
|
25
16
|
currentChunkLines.push(line);
|
|
26
17
|
currentLength += lineLength;
|
|
27
18
|
}
|
|
28
19
|
else {
|
|
29
|
-
// Save current chunk
|
|
30
20
|
if (currentChunkLines.length > 0) {
|
|
31
21
|
const chunkText = currentChunkLines.join('\n');
|
|
32
22
|
if (chunkText.trim().length > 0) {
|
|
33
23
|
chunks.push(createChunk(filePath, currentChunkStart, currentChunkStart + currentChunkLines.length - 1, chunkText, source));
|
|
34
24
|
}
|
|
35
25
|
}
|
|
36
|
-
// Calculate overlap
|
|
37
26
|
const overlapLines = calculateOverlapLines(currentChunkLines, overlapChars);
|
|
38
|
-
// Start new chunk
|
|
39
27
|
currentChunkStart = i + 1 - overlapLines.length;
|
|
40
28
|
currentChunkLines = [...overlapLines, line];
|
|
41
29
|
currentLength = currentChunkLines.join('\n').length;
|
|
42
30
|
}
|
|
43
31
|
}
|
|
44
|
-
// Save last chunk
|
|
45
32
|
if (currentChunkLines.length > 0) {
|
|
46
33
|
const chunkText = currentChunkLines.join('\n');
|
|
47
34
|
if (chunkText.trim().length > 0) {
|
|
@@ -50,9 +37,6 @@ export function chunkText(text, filePath) {
|
|
|
50
37
|
}
|
|
51
38
|
return chunks;
|
|
52
39
|
}
|
|
53
|
-
/**
|
|
54
|
-
* Calculate overlap lines from end of chunk.
|
|
55
|
-
*/
|
|
56
40
|
function calculateOverlapLines(lines, overlapChars) {
|
|
57
41
|
const result = [];
|
|
58
42
|
let length = 0;
|
|
@@ -65,9 +49,6 @@ function calculateOverlapLines(lines, overlapChars) {
|
|
|
65
49
|
}
|
|
66
50
|
return result;
|
|
67
51
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Create chunk object.
|
|
70
|
-
*/
|
|
71
52
|
function createChunk(path, startLine, endLine, text, source) {
|
|
72
53
|
return {
|
|
73
54
|
path,
|
|
@@ -78,27 +59,17 @@ function createChunk(path, startLine, endLine, text, source) {
|
|
|
78
59
|
source,
|
|
79
60
|
};
|
|
80
61
|
}
|
|
81
|
-
/**
|
|
82
|
-
* Estimate tokens in text.
|
|
83
|
-
*/
|
|
84
62
|
export function estimateTokens(text) {
|
|
85
63
|
if (!text || text.length === 0)
|
|
86
64
|
return 0;
|
|
87
|
-
// Korean characters: ~2 tokens per char
|
|
88
65
|
const koreanChars = (text.match(/[\uAC00-\uD7A3]/g) || []).length;
|
|
89
|
-
// English words: ~1.3 tokens per word
|
|
90
66
|
const englishWords = (text.match(/[a-zA-Z]+/g) || []).length;
|
|
91
|
-
// Other chars
|
|
92
67
|
const otherChars = text.length - koreanChars - (englishWords * 5);
|
|
93
68
|
const koreanTokens = koreanChars * 2;
|
|
94
69
|
const englishTokens = englishWords * 1.3;
|
|
95
70
|
const otherTokens = Math.max(0, otherChars) / 4;
|
|
96
71
|
return Math.ceil(koreanTokens + englishTokens + otherTokens);
|
|
97
72
|
}
|
|
98
|
-
/**
|
|
99
|
-
* Split text into sentences.
|
|
100
|
-
* Handles both English and Korean.
|
|
101
|
-
*/
|
|
102
73
|
export function splitIntoSentences(text) {
|
|
103
74
|
const sentenceEnders = /([.!?。!?])\s+/g;
|
|
104
75
|
const sentences = [];
|
|
@@ -114,9 +85,6 @@ export function splitIntoSentences(text) {
|
|
|
114
85
|
return sentences.filter(s => s.length > 0);
|
|
115
86
|
}
|
|
116
87
|
const HEADER_REGEX = /^(#{1,6})\s+(.+)$/;
|
|
117
|
-
/**
|
|
118
|
-
* Parse markdown into sections.
|
|
119
|
-
*/
|
|
120
88
|
export function parseMarkdownSections(content) {
|
|
121
89
|
const lines = content.split('\n');
|
|
122
90
|
const sections = [];
|
|
@@ -128,7 +96,6 @@ export function parseMarkdownSections(content) {
|
|
|
128
96
|
const lineNumber = i + 1;
|
|
129
97
|
const headerMatch = line.match(HEADER_REGEX);
|
|
130
98
|
if (headerMatch) {
|
|
131
|
-
// Save previous section
|
|
132
99
|
if (currentSection !== null || currentLines.length > 0) {
|
|
133
100
|
sections.push({
|
|
134
101
|
header: currentSection?.header || '',
|
|
@@ -138,7 +105,6 @@ export function parseMarkdownSections(content) {
|
|
|
138
105
|
endLine: lineNumber - 1
|
|
139
106
|
});
|
|
140
107
|
}
|
|
141
|
-
// Start new section
|
|
142
108
|
currentSection = {
|
|
143
109
|
header: headerMatch[2],
|
|
144
110
|
content: '',
|
|
@@ -153,7 +119,6 @@ export function parseMarkdownSections(content) {
|
|
|
153
119
|
currentLines.push(line);
|
|
154
120
|
}
|
|
155
121
|
}
|
|
156
|
-
// Save last section
|
|
157
122
|
if (currentLines.length > 0) {
|
|
158
123
|
sections.push({
|
|
159
124
|
header: currentSection?.header || '',
|
package/dist/memory/core.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory Core - Simple utilities for text processing
|
|
3
|
-
*
|
|
4
|
-
* Clear is better than clever.
|
|
5
|
-
*/
|
|
6
1
|
export declare const CONFIG: {
|
|
7
2
|
readonly chunking: {
|
|
8
3
|
readonly maxTokens: 400;
|
|
@@ -36,34 +31,10 @@ export interface SearchResult {
|
|
|
36
31
|
score: number;
|
|
37
32
|
matchType: 'vector' | 'text' | 'hybrid';
|
|
38
33
|
}
|
|
39
|
-
/**
|
|
40
|
-
* Hash text using djb2 algorithm.
|
|
41
|
-
* Simple, fast, good enough for our use case.
|
|
42
|
-
*/
|
|
43
34
|
export declare function hashText(text: string): string;
|
|
44
|
-
/**
|
|
45
|
-
* Estimate token count.
|
|
46
|
-
* Rough approximation: 4 chars ≈ 1 token
|
|
47
|
-
*/
|
|
48
35
|
export declare function estimateTokens(text: string): number;
|
|
49
|
-
/**
|
|
50
|
-
* Determine source type from file path.
|
|
51
|
-
*/
|
|
52
36
|
export declare function determineSource(filePath: string): SourceType;
|
|
53
|
-
/**
|
|
54
|
-
* Calculate cosine similarity between two vectors.
|
|
55
|
-
* Single pass for efficiency.
|
|
56
|
-
*
|
|
57
|
-
* Returns 0 on dimension mismatch instead of throwing,
|
|
58
|
-
* to prevent a single bad embedding from crashing the entire search.
|
|
59
|
-
*/
|
|
60
37
|
export declare function cosineSimilarity(a: number[], b: number[]): number;
|
|
61
|
-
/**
|
|
62
|
-
* Float32 version - more memory efficient.
|
|
63
|
-
*
|
|
64
|
-
* Returns 0 on dimension mismatch instead of throwing,
|
|
65
|
-
* to prevent a single bad embedding from crashing the entire search.
|
|
66
|
-
*/
|
|
67
38
|
export declare function cosineSimilarityFloat32(a: Float32Array, b: Float32Array): number;
|
|
68
39
|
export declare function toFloat32Array(embedding: number[]): Float32Array;
|
|
69
40
|
export declare function embeddingToBlob(embedding: number[]): Buffer;
|
package/dist/memory/core.js
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Memory Core - Simple utilities for text processing
|
|
3
|
-
*
|
|
4
|
-
* Clear is better than clever.
|
|
5
|
-
*/
|
|
6
1
|
import { join } from "path";
|
|
7
|
-
// ============================================================================
|
|
8
|
-
// Configuration
|
|
9
|
-
// ============================================================================
|
|
10
2
|
export const CONFIG = {
|
|
11
3
|
chunking: {
|
|
12
4
|
maxTokens: 400,
|
|
@@ -23,31 +15,17 @@ export const CONFIG = {
|
|
|
23
15
|
defaultMinScore: 0.35,
|
|
24
16
|
},
|
|
25
17
|
};
|
|
26
|
-
// ============================================================================
|
|
27
|
-
// Text Processing
|
|
28
|
-
// ============================================================================
|
|
29
|
-
/**
|
|
30
|
-
* Hash text using djb2 algorithm.
|
|
31
|
-
* Simple, fast, good enough for our use case.
|
|
32
|
-
*/
|
|
33
18
|
export function hashText(text) {
|
|
34
19
|
let hash = 5381;
|
|
35
20
|
for (let i = 0; i < text.length; i++) {
|
|
36
21
|
hash = ((hash << 5) + hash) + text.charCodeAt(i);
|
|
37
|
-
hash = hash & hash;
|
|
22
|
+
hash = hash & hash;
|
|
38
23
|
}
|
|
39
24
|
return Math.abs(hash).toString(16);
|
|
40
25
|
}
|
|
41
|
-
/**
|
|
42
|
-
* Estimate token count.
|
|
43
|
-
* Rough approximation: 4 chars ≈ 1 token
|
|
44
|
-
*/
|
|
45
26
|
export function estimateTokens(text) {
|
|
46
27
|
return Math.ceil(text.length / CONFIG.chunking.charsPerToken);
|
|
47
28
|
}
|
|
48
|
-
/**
|
|
49
|
-
* Determine source type from file path.
|
|
50
|
-
*/
|
|
51
29
|
export function determineSource(filePath) {
|
|
52
30
|
const lower = filePath.toLowerCase().replace(/\\/g, '/');
|
|
53
31
|
if (lower.includes('/daily/') || (lower.endsWith('.md') && /\d{4}-\d{2}-\d{2}/.test(lower))) {
|
|
@@ -67,18 +45,7 @@ export function determineSource(filePath) {
|
|
|
67
45
|
}
|
|
68
46
|
return 'code';
|
|
69
47
|
}
|
|
70
|
-
// ============================================================================
|
|
71
|
-
// Similarity
|
|
72
|
-
// ============================================================================
|
|
73
|
-
// Deduplicated warning: only log dimension mismatch once per session
|
|
74
48
|
let _dimensionMismatchWarned = false;
|
|
75
|
-
/**
|
|
76
|
-
* Calculate cosine similarity between two vectors.
|
|
77
|
-
* Single pass for efficiency.
|
|
78
|
-
*
|
|
79
|
-
* Returns 0 on dimension mismatch instead of throwing,
|
|
80
|
-
* to prevent a single bad embedding from crashing the entire search.
|
|
81
|
-
*/
|
|
82
49
|
export function cosineSimilarity(a, b) {
|
|
83
50
|
if (a.length === 0 || b.length === 0)
|
|
84
51
|
return 0;
|
|
@@ -104,12 +71,6 @@ export function cosineSimilarity(a, b) {
|
|
|
104
71
|
const magnitude = Math.sqrt(magnitudeA) * Math.sqrt(magnitudeB);
|
|
105
72
|
return magnitude === 0 ? 0 : dotProduct / magnitude;
|
|
106
73
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Float32 version - more memory efficient.
|
|
109
|
-
*
|
|
110
|
-
* Returns 0 on dimension mismatch instead of throwing,
|
|
111
|
-
* to prevent a single bad embedding from crashing the entire search.
|
|
112
|
-
*/
|
|
113
74
|
export function cosineSimilarityFloat32(a, b) {
|
|
114
75
|
if (a.length === 0 || b.length === 0)
|
|
115
76
|
return 0;
|
|
@@ -135,9 +96,6 @@ export function cosineSimilarityFloat32(a, b) {
|
|
|
135
96
|
const magnitude = Math.sqrt(magnitudeA) * Math.sqrt(magnitudeB);
|
|
136
97
|
return magnitude === 0 ? 0 : dotProduct / magnitude;
|
|
137
98
|
}
|
|
138
|
-
// ============================================================================
|
|
139
|
-
// Embedding Conversion
|
|
140
|
-
// ============================================================================
|
|
141
99
|
export function toFloat32Array(embedding) {
|
|
142
100
|
return new Float32Array(embedding);
|
|
143
101
|
}
|
|
@@ -152,9 +110,6 @@ export function blobToNumberArray(blob) {
|
|
|
152
110
|
const float32 = new Float32Array(blob.buffer, blob.byteOffset, blob.byteLength / 4);
|
|
153
111
|
return Array.from(float32);
|
|
154
112
|
}
|
|
155
|
-
// ============================================================================
|
|
156
|
-
// Date Utilities
|
|
157
|
-
// ============================================================================
|
|
158
113
|
export function getTodayFileName() {
|
|
159
114
|
const now = new Date();
|
|
160
115
|
const year = now.getFullYear();
|
|
@@ -168,9 +123,6 @@ export function dateToFileName(date) {
|
|
|
168
123
|
const day = String(date.getDate()).padStart(2, '0');
|
|
169
124
|
return `${year}-${month}-${day}.md`;
|
|
170
125
|
}
|
|
171
|
-
// ============================================================================
|
|
172
|
-
// Path Utilities
|
|
173
|
-
// ============================================================================
|
|
174
126
|
export function getMemoryPath(type, basePath = process.cwd()) {
|
|
175
127
|
const memoryDir = join(basePath, CONFIG.paths.memoryDir);
|
|
176
128
|
switch (type) {
|
|
@@ -194,9 +146,6 @@ export function getDbPath(basePath = process.cwd()) {
|
|
|
194
146
|
export function getDataDir(basePath = process.cwd()) {
|
|
195
147
|
return join(basePath, CONFIG.paths.dataDir);
|
|
196
148
|
}
|
|
197
|
-
// ============================================================================
|
|
198
|
-
// Utilities
|
|
199
|
-
// ============================================================================
|
|
200
149
|
export function sleep(ms) {
|
|
201
150
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
202
151
|
}
|
package/dist/memory/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @maskweaver/memory
|
|
3
|
-
*
|
|
4
|
-
* Memory system with embeddings and vector search
|
|
5
|
-
*/
|
|
6
1
|
export type { SourceType, MemoryType, Chunk, SearchResult, } from "./core.js";
|
|
7
2
|
export { CONFIG, hashText, estimateTokens, determineSource, cosineSimilarity, cosineSimilarityFloat32, toFloat32Array, embeddingToBlob, blobToEmbedding, blobToNumberArray, getTodayFileName, dateToFileName, getMemoryPath, getDbPath, getDataDir, sleep, getConfig, } from "./core.js";
|
|
8
3
|
export type { Embedding, ProviderType, HealthCheckResult, ProviderConfig, IEmbeddingProvider, } from "./providers/types.js";
|
package/dist/memory/index.js
CHANGED
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @maskweaver/memory
|
|
3
|
-
*
|
|
4
|
-
* Memory system with embeddings and vector search
|
|
5
|
-
*/
|
|
6
1
|
export { CONFIG, hashText, estimateTokens, determineSource, cosineSimilarity, cosineSimilarityFloat32, toFloat32Array, embeddingToBlob, blobToEmbedding, blobToNumberArray, getTodayFileName, dateToFileName, getMemoryPath, getDbPath, getDataDir, sleep, getConfig, } from "./core.js";
|
|
7
2
|
export { OllamaProvider } from "./providers/ollama.js";
|
|
8
3
|
export { OpenAIProvider } from "./providers/openai.js";
|
|
9
4
|
export { VoyageProvider } from "./providers/voyage.js";
|
|
10
5
|
export { OpenRouterProvider } from "./providers/openrouter.js";
|
|
11
6
|
export { TextOnlyProvider } from "./providers/text-only.js";
|
|
12
|
-
// Provider factory
|
|
13
7
|
export { createProvider, selectBestProvider, getDefaultConfigs, } from "./providers/factory.js";
|
|
14
|
-
// Chunking
|
|
15
8
|
export { chunkText, parseMarkdownSections, splitIntoSentences } from "./chunking.js";
|
|
16
|
-
// Storage
|
|
17
9
|
export { MemoryDatabase, initDatabase, getDatabase, tryGetDatabase, isSqliteAvailable, getSqliteUnavailableReason, upsertChunk, searchByVector, searchByText, deleteChunksByPath, getChunksByPath, } from "./store/sqlite.js";
|
|
18
|
-
// Search
|
|
19
10
|
export { hybridSearch } from "./search/hybrid.js";
|
|
20
|
-
// Indexing
|
|
21
11
|
export { indexFile, reindexFile, indexAllMemoryFiles, classifySource, } from "./indexer.js";
|
package/dist/memory/indexer.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* File Indexer - Process markdown files into searchable chunks
|
|
3
|
-
*
|
|
4
|
-
* Read file → Parse sections → Chunk → Hash → Embed → Store
|
|
5
|
-
*/
|
|
6
1
|
import { type SourceType } from './core.js';
|
|
7
2
|
type EmbeddingProvider = (text: string) => Promise<number[]>;
|
|
8
3
|
export interface MarkdownSection {
|
|
@@ -12,25 +7,9 @@ export interface MarkdownSection {
|
|
|
12
7
|
startLine: number;
|
|
13
8
|
endLine: number;
|
|
14
9
|
}
|
|
15
|
-
/**
|
|
16
|
-
* Parse markdown into sections.
|
|
17
|
-
*/
|
|
18
10
|
export declare function parseMarkdownSections(content: string): MarkdownSection[];
|
|
19
|
-
/**
|
|
20
|
-
* Classify source from file path.
|
|
21
|
-
*/
|
|
22
11
|
export declare function classifySource(filePath: string): SourceType;
|
|
23
|
-
/**
|
|
24
|
-
* Index a single file.
|
|
25
|
-
* Only re-embeds chunks that changed (based on hash).
|
|
26
|
-
*/
|
|
27
12
|
export declare function indexFile(filePath: string, getEmbedding: EmbeddingProvider, basePath?: string): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Reindex file (delete all chunks and reindex).
|
|
30
|
-
*/
|
|
31
13
|
export declare function reindexFile(filePath: string, getEmbedding: EmbeddingProvider, basePath?: string): Promise<void>;
|
|
32
|
-
/**
|
|
33
|
-
* Index all memory files in directory.
|
|
34
|
-
*/
|
|
35
14
|
export declare function indexAllMemoryFiles(baseDir: string, getEmbedding: EmbeddingProvider, basePath?: string): Promise<void>;
|
|
36
15
|
export {};
|