micode 0.8.5 → 0.9.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/INSTALL_CLAUDE.md +53 -4
- package/LICENSE +21 -0
- package/README.md +66 -0
- package/dist/index.js +11141 -1891
- package/package.json +3 -2
- package/src/agents/brainstormer.ts +1 -1
- package/src/agents/commander.ts +18 -2
- package/src/agents/executor.ts +116 -76
- package/src/agents/implementer.ts +63 -39
- package/src/agents/index.ts +27 -2
- package/src/agents/mindmodel/anti-pattern-detector.ts +95 -0
- package/src/agents/mindmodel/code-clusterer.ts +108 -0
- package/src/agents/mindmodel/constraint-reviewer.ts +84 -0
- package/src/agents/mindmodel/constraint-writer.ts +136 -0
- package/src/agents/mindmodel/convention-extractor.ts +102 -0
- package/src/agents/mindmodel/dependency-mapper.ts +85 -0
- package/src/agents/mindmodel/domain-extractor.ts +77 -0
- package/src/agents/mindmodel/example-extractor.ts +87 -0
- package/src/agents/mindmodel/index.ts +11 -0
- package/src/agents/mindmodel/orchestrator.ts +103 -0
- package/src/agents/mindmodel/pattern-discoverer.ts +77 -0
- package/src/agents/mindmodel/stack-detector.ts +62 -0
- package/src/agents/planner.ts +108 -64
- package/src/agents/reviewer.ts +45 -29
- package/src/config-loader.ts +158 -39
- package/src/hooks/auto-compact.ts +34 -5
- package/src/hooks/constraint-reviewer.ts +177 -0
- package/src/hooks/context-injector.ts +4 -2
- package/src/hooks/context-window-monitor.ts +10 -2
- package/src/hooks/fragment-injector.ts +181 -0
- package/src/hooks/mindmodel-injector.ts +170 -0
- package/src/index.ts +131 -8
- package/src/mindmodel/classifier.ts +36 -0
- package/src/mindmodel/formatter.ts +18 -0
- package/src/mindmodel/index.ts +18 -0
- package/src/mindmodel/loader.ts +66 -0
- package/src/mindmodel/review.ts +68 -0
- package/src/mindmodel/types.ts +87 -0
- package/src/tools/batch-read.ts +75 -0
- package/src/tools/mindmodel-lookup.ts +87 -0
- package/src/tools/spawn-agent.ts +134 -59
- package/src/utils/config.ts +23 -3
- package/src/utils/model-limits.ts +20 -4
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Shared model context limits (tokens)
|
|
2
|
-
// Used by context-window-monitor and auto-
|
|
2
|
+
// Used by context-window-monitor and auto-compact hooks
|
|
3
3
|
|
|
4
|
+
// Fallback patterns for models not in opencode.json
|
|
4
5
|
export const MODEL_CONTEXT_LIMITS: Record<string, number> = {
|
|
5
6
|
// Claude models
|
|
6
7
|
"claude-opus": 200_000,
|
|
@@ -22,15 +23,30 @@ export const MODEL_CONTEXT_LIMITS: Record<string, number> = {
|
|
|
22
23
|
export const DEFAULT_CONTEXT_LIMIT = 200_000;
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
|
-
* Get the context window limit for a given model
|
|
26
|
-
*
|
|
26
|
+
* Get the context window limit for a given model.
|
|
27
|
+
* Priority: loaded limits (exact match) > pattern match > default
|
|
28
|
+
*
|
|
29
|
+
* @param modelID - The model ID (e.g., "gpt-4o", "claude-opus")
|
|
30
|
+
* @param providerID - Optional provider ID (e.g., "openai", "anthropic")
|
|
31
|
+
* @param loadedLimits - Optional map of "provider/model" -> limit from opencode.json
|
|
27
32
|
*/
|
|
28
|
-
export function getContextLimit(modelID: string): number {
|
|
33
|
+
export function getContextLimit(modelID: string, providerID?: string, loadedLimits?: Map<string, number>): number {
|
|
34
|
+
// Check loaded limits first (exact match with provider/model)
|
|
35
|
+
if (loadedLimits && providerID) {
|
|
36
|
+
const exactKey = `${providerID}/${modelID}`;
|
|
37
|
+
const exactLimit = loadedLimits.get(exactKey);
|
|
38
|
+
if (exactLimit !== undefined) {
|
|
39
|
+
return exactLimit;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Fall back to pattern matching on model ID
|
|
29
44
|
const modelLower = modelID.toLowerCase();
|
|
30
45
|
for (const [pattern, limit] of Object.entries(MODEL_CONTEXT_LIMITS)) {
|
|
31
46
|
if (modelLower.includes(pattern)) {
|
|
32
47
|
return limit;
|
|
33
48
|
}
|
|
34
49
|
}
|
|
50
|
+
|
|
35
51
|
return DEFAULT_CONTEXT_LIMIT;
|
|
36
52
|
}
|