micode 0.7.0 → 0.7.2
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/package.json +7 -13
- package/src/agents/artifact-searcher.ts +46 -0
- package/src/agents/brainstormer.ts +145 -0
- package/src/agents/codebase-analyzer.ts +75 -0
- package/src/agents/codebase-locator.ts +71 -0
- package/src/agents/commander.ts +138 -0
- package/src/agents/executor.ts +215 -0
- package/src/agents/implementer.ts +99 -0
- package/src/agents/index.ts +44 -0
- package/src/agents/ledger-creator.ts +113 -0
- package/src/agents/pattern-finder.ts +70 -0
- package/src/agents/planner.ts +230 -0
- package/src/agents/project-initializer.ts +264 -0
- package/src/agents/reviewer.ts +102 -0
- package/src/config-loader.ts +89 -0
- package/src/hooks/artifact-auto-index.ts +111 -0
- package/src/hooks/auto-clear-ledger.ts +230 -0
- package/src/hooks/auto-compact.ts +241 -0
- package/src/hooks/comment-checker.ts +120 -0
- package/src/hooks/context-injector.ts +163 -0
- package/src/hooks/context-window-monitor.ts +106 -0
- package/src/hooks/file-ops-tracker.ts +96 -0
- package/src/hooks/ledger-loader.ts +78 -0
- package/src/hooks/preemptive-compaction.ts +183 -0
- package/src/hooks/session-recovery.ts +258 -0
- package/src/hooks/token-aware-truncation.ts +189 -0
- package/src/index.ts +258 -0
- package/src/tools/artifact-index/index.ts +269 -0
- package/src/tools/artifact-index/schema.sql +44 -0
- package/src/tools/artifact-search.ts +49 -0
- package/src/tools/ast-grep/index.ts +189 -0
- package/src/tools/background-task/manager.ts +397 -0
- package/src/tools/background-task/tools.ts +145 -0
- package/src/tools/background-task/types.ts +68 -0
- package/src/tools/btca/index.ts +82 -0
- package/src/tools/look-at.ts +210 -0
- package/src/tools/pty/buffer.ts +49 -0
- package/src/tools/pty/index.ts +34 -0
- package/src/tools/pty/manager.ts +159 -0
- package/src/tools/pty/tools/kill.ts +68 -0
- package/src/tools/pty/tools/list.ts +55 -0
- package/src/tools/pty/tools/read.ts +152 -0
- package/src/tools/pty/tools/spawn.ts +78 -0
- package/src/tools/pty/tools/write.ts +97 -0
- package/src/tools/pty/types.ts +62 -0
- package/src/utils/model-limits.ts +36 -0
- package/dist/agents/artifact-searcher.d.ts +0 -2
- package/dist/agents/brainstormer.d.ts +0 -2
- package/dist/agents/codebase-analyzer.d.ts +0 -2
- package/dist/agents/codebase-locator.d.ts +0 -2
- package/dist/agents/commander.d.ts +0 -3
- package/dist/agents/executor.d.ts +0 -2
- package/dist/agents/implementer.d.ts +0 -2
- package/dist/agents/index.d.ts +0 -15
- package/dist/agents/ledger-creator.d.ts +0 -2
- package/dist/agents/pattern-finder.d.ts +0 -2
- package/dist/agents/planner.d.ts +0 -2
- package/dist/agents/project-initializer.d.ts +0 -2
- package/dist/agents/reviewer.d.ts +0 -2
- package/dist/config-loader.d.ts +0 -20
- package/dist/hooks/artifact-auto-index.d.ts +0 -19
- package/dist/hooks/auto-clear-ledger.d.ts +0 -11
- package/dist/hooks/auto-compact.d.ts +0 -9
- package/dist/hooks/comment-checker.d.ts +0 -9
- package/dist/hooks/context-injector.d.ts +0 -15
- package/dist/hooks/context-window-monitor.d.ts +0 -15
- package/dist/hooks/file-ops-tracker.d.ts +0 -26
- package/dist/hooks/ledger-loader.d.ts +0 -16
- package/dist/hooks/preemptive-compaction.d.ts +0 -9
- package/dist/hooks/session-recovery.d.ts +0 -9
- package/dist/hooks/token-aware-truncation.d.ts +0 -15
- package/dist/index.d.ts +0 -3
- package/dist/index.js +0 -17089
- package/dist/tools/artifact-index/index.d.ts +0 -38
- package/dist/tools/artifact-search.d.ts +0 -17
- package/dist/tools/ast-grep/index.d.ts +0 -88
- package/dist/tools/background-task/manager.d.ts +0 -27
- package/dist/tools/background-task/tools.d.ts +0 -41
- package/dist/tools/background-task/types.d.ts +0 -53
- package/dist/tools/btca/index.d.ts +0 -19
- package/dist/tools/look-at.d.ts +0 -11
- package/dist/tools/pty/buffer.d.ts +0 -11
- package/dist/tools/pty/index.d.ts +0 -74
- package/dist/tools/pty/manager.d.ts +0 -14
- package/dist/tools/pty/tools/kill.d.ts +0 -12
- package/dist/tools/pty/tools/list.d.ts +0 -6
- package/dist/tools/pty/tools/read.d.ts +0 -18
- package/dist/tools/pty/tools/spawn.d.ts +0 -20
- package/dist/tools/pty/tools/write.d.ts +0 -12
- package/dist/tools/pty/types.d.ts +0 -54
- package/dist/utils/model-limits.d.ts +0 -7
- /package/{dist/tools/background-task/index.d.ts → src/tools/background-task/index.ts} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Shared model context limits (tokens)
|
|
2
|
+
// Used by context-window-monitor and auto-clear-ledger hooks
|
|
3
|
+
|
|
4
|
+
export const MODEL_CONTEXT_LIMITS: Record<string, number> = {
|
|
5
|
+
// Claude models
|
|
6
|
+
"claude-opus": 200_000,
|
|
7
|
+
"claude-sonnet": 200_000,
|
|
8
|
+
"claude-haiku": 200_000,
|
|
9
|
+
"claude-3": 200_000,
|
|
10
|
+
"claude-4": 200_000,
|
|
11
|
+
// OpenAI models
|
|
12
|
+
"gpt-4o": 128_000,
|
|
13
|
+
"gpt-4-turbo": 128_000,
|
|
14
|
+
"gpt-4": 128_000,
|
|
15
|
+
"gpt-5": 200_000,
|
|
16
|
+
o1: 200_000,
|
|
17
|
+
o3: 200_000,
|
|
18
|
+
// Google models
|
|
19
|
+
gemini: 1_000_000,
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const DEFAULT_CONTEXT_LIMIT = 200_000;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Get the context window limit for a given model ID.
|
|
26
|
+
* Matches against known patterns and falls back to default.
|
|
27
|
+
*/
|
|
28
|
+
export function getContextLimit(modelID: string): number {
|
|
29
|
+
const modelLower = modelID.toLowerCase();
|
|
30
|
+
for (const [pattern, limit] of Object.entries(MODEL_CONTEXT_LIMITS)) {
|
|
31
|
+
if (modelLower.includes(pattern)) {
|
|
32
|
+
return limit;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return DEFAULT_CONTEXT_LIMIT;
|
|
36
|
+
}
|
package/dist/agents/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { AgentConfig } from "@opencode-ai/sdk";
|
|
2
|
-
import { brainstormerAgent } from "./brainstormer";
|
|
3
|
-
import { codebaseLocatorAgent } from "./codebase-locator";
|
|
4
|
-
import { codebaseAnalyzerAgent } from "./codebase-analyzer";
|
|
5
|
-
import { patternFinderAgent } from "./pattern-finder";
|
|
6
|
-
import { plannerAgent } from "./planner";
|
|
7
|
-
import { implementerAgent } from "./implementer";
|
|
8
|
-
import { reviewerAgent } from "./reviewer";
|
|
9
|
-
import { executorAgent } from "./executor";
|
|
10
|
-
import { primaryAgent, PRIMARY_AGENT_NAME } from "./commander";
|
|
11
|
-
import { projectInitializerAgent } from "./project-initializer";
|
|
12
|
-
import { ledgerCreatorAgent } from "./ledger-creator";
|
|
13
|
-
import { artifactSearcherAgent } from "./artifact-searcher";
|
|
14
|
-
export declare const agents: Record<string, AgentConfig>;
|
|
15
|
-
export { primaryAgent, PRIMARY_AGENT_NAME, brainstormerAgent, codebaseLocatorAgent, codebaseAnalyzerAgent, patternFinderAgent, plannerAgent, implementerAgent, reviewerAgent, executorAgent, projectInitializerAgent, ledgerCreatorAgent, artifactSearcherAgent, };
|
package/dist/agents/planner.d.ts
DELETED
package/dist/config-loader.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AgentConfig } from "@opencode-ai/sdk";
|
|
2
|
-
export interface AgentOverride {
|
|
3
|
-
model?: string;
|
|
4
|
-
temperature?: number;
|
|
5
|
-
maxTokens?: number;
|
|
6
|
-
}
|
|
7
|
-
export interface MicodeConfig {
|
|
8
|
-
agents?: Record<string, AgentOverride>;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Load micode.json from ~/.config/opencode/micode.json
|
|
12
|
-
* Returns null if file doesn't exist or is invalid JSON
|
|
13
|
-
* @param configDir - Optional override for config directory (for testing)
|
|
14
|
-
*/
|
|
15
|
-
export declare function loadMicodeConfig(configDir?: string): Promise<MicodeConfig | null>;
|
|
16
|
-
/**
|
|
17
|
-
* Merge user config overrides into plugin agent configs
|
|
18
|
-
* User overrides take precedence for safe properties only
|
|
19
|
-
*/
|
|
20
|
-
export declare function mergeAgentConfigs(pluginAgents: Record<string, AgentConfig>, userConfig: MicodeConfig | null): Record<string, AgentConfig>;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
export declare function parseLedger(content: string, filePath: string, sessionName: string): {
|
|
3
|
-
id: string;
|
|
4
|
-
sessionName: string;
|
|
5
|
-
filePath: string;
|
|
6
|
-
goal: string;
|
|
7
|
-
stateNow: string;
|
|
8
|
-
keyDecisions: string;
|
|
9
|
-
filesRead: string;
|
|
10
|
-
filesModified: string;
|
|
11
|
-
};
|
|
12
|
-
export declare function createArtifactAutoIndexHook(_ctx: PluginInput): {
|
|
13
|
-
"tool.execute.after": (input: {
|
|
14
|
-
tool: string;
|
|
15
|
-
args?: Record<string, unknown>;
|
|
16
|
-
}, _output: {
|
|
17
|
-
output?: string;
|
|
18
|
-
}) => Promise<void>;
|
|
19
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
export declare const DEFAULT_THRESHOLD = 0.6;
|
|
3
|
-
export declare const CLEAR_COOLDOWN_MS = 60000;
|
|
4
|
-
export declare function createAutoClearLedgerHook(ctx: PluginInput): {
|
|
5
|
-
event: ({ event }: {
|
|
6
|
-
event: {
|
|
7
|
-
type: string;
|
|
8
|
-
properties?: unknown;
|
|
9
|
-
};
|
|
10
|
-
}) => Promise<void>;
|
|
11
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
export declare function createCommentCheckerHook(_ctx: PluginInput): {
|
|
3
|
-
"tool.execute.after": (input: {
|
|
4
|
-
tool: string;
|
|
5
|
-
args?: Record<string, unknown>;
|
|
6
|
-
}, output: {
|
|
7
|
-
output?: string;
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
export declare function createContextInjectorHook(ctx: PluginInput): {
|
|
3
|
-
"chat.params": (_input: {
|
|
4
|
-
sessionID: string;
|
|
5
|
-
}, output: {
|
|
6
|
-
options?: Record<string, unknown>;
|
|
7
|
-
system?: string;
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
"tool.execute.after": (input: {
|
|
10
|
-
tool: string;
|
|
11
|
-
args?: Record<string, unknown>;
|
|
12
|
-
}, output: {
|
|
13
|
-
output?: string;
|
|
14
|
-
}) => Promise<void>;
|
|
15
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
export declare function createContextWindowMonitorHook(ctx: PluginInput): {
|
|
3
|
-
"chat.params": (input: {
|
|
4
|
-
sessionID: string;
|
|
5
|
-
}, output: {
|
|
6
|
-
system?: string;
|
|
7
|
-
options?: Record<string, unknown>;
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
event: ({ event }: {
|
|
10
|
-
event: {
|
|
11
|
-
type: string;
|
|
12
|
-
properties?: unknown;
|
|
13
|
-
};
|
|
14
|
-
}) => Promise<void>;
|
|
15
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
interface FileOps {
|
|
3
|
-
read: Set<string>;
|
|
4
|
-
modified: Set<string>;
|
|
5
|
-
}
|
|
6
|
-
export declare function trackFileOp(sessionID: string, operation: "read" | "write" | "edit", filePath: string): void;
|
|
7
|
-
export declare function getFileOps(sessionID: string): FileOps;
|
|
8
|
-
export declare function clearFileOps(sessionID: string): void;
|
|
9
|
-
export declare function getAndClearFileOps(sessionID: string): FileOps;
|
|
10
|
-
export declare function formatFileOpsForPrompt(ops: FileOps): string;
|
|
11
|
-
export declare function createFileOpsTrackerHook(_ctx: PluginInput): {
|
|
12
|
-
"tool.execute.after": (input: {
|
|
13
|
-
tool: string;
|
|
14
|
-
sessionID: string;
|
|
15
|
-
args?: Record<string, unknown>;
|
|
16
|
-
}, _output: {
|
|
17
|
-
output?: string;
|
|
18
|
-
}) => Promise<void>;
|
|
19
|
-
event: ({ event }: {
|
|
20
|
-
event: {
|
|
21
|
-
type: string;
|
|
22
|
-
properties?: unknown;
|
|
23
|
-
};
|
|
24
|
-
}) => Promise<void>;
|
|
25
|
-
};
|
|
26
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
export interface LedgerInfo {
|
|
3
|
-
sessionName: string;
|
|
4
|
-
filePath: string;
|
|
5
|
-
content: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function findCurrentLedger(directory: string): Promise<LedgerInfo | null>;
|
|
8
|
-
export declare function formatLedgerInjection(ledger: LedgerInfo): string;
|
|
9
|
-
export declare function createLedgerLoaderHook(ctx: PluginInput): {
|
|
10
|
-
"chat.params": (_input: {
|
|
11
|
-
sessionID: string;
|
|
12
|
-
}, output: {
|
|
13
|
-
options?: Record<string, unknown>;
|
|
14
|
-
system?: string;
|
|
15
|
-
}) => Promise<void>;
|
|
16
|
-
};
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
-
export declare function createTokenAwareTruncationHook(ctx: PluginInput): {
|
|
3
|
-
event: ({ event }: {
|
|
4
|
-
event: {
|
|
5
|
-
type: string;
|
|
6
|
-
properties?: unknown;
|
|
7
|
-
};
|
|
8
|
-
}) => Promise<void>;
|
|
9
|
-
"tool.execute.after": (input: {
|
|
10
|
-
name: string;
|
|
11
|
-
sessionID: string;
|
|
12
|
-
}, output: {
|
|
13
|
-
output?: string;
|
|
14
|
-
}) => Promise<void>;
|
|
15
|
-
};
|
package/dist/index.d.ts
DELETED