micode 0.6.0 → 0.7.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.
Files changed (84) hide show
  1. package/README.md +64 -331
  2. package/package.json +9 -14
  3. package/src/agents/artifact-searcher.ts +46 -0
  4. package/src/agents/brainstormer.ts +145 -0
  5. package/src/agents/codebase-analyzer.ts +75 -0
  6. package/src/agents/codebase-locator.ts +71 -0
  7. package/src/agents/commander.ts +138 -0
  8. package/src/agents/executor.ts +215 -0
  9. package/src/agents/implementer.ts +99 -0
  10. package/src/agents/index.ts +44 -0
  11. package/src/agents/ledger-creator.ts +113 -0
  12. package/src/agents/pattern-finder.ts +70 -0
  13. package/src/agents/planner.ts +230 -0
  14. package/src/agents/project-initializer.ts +264 -0
  15. package/src/agents/reviewer.ts +102 -0
  16. package/src/config-loader.ts +89 -0
  17. package/src/hooks/artifact-auto-index.ts +111 -0
  18. package/src/hooks/auto-clear-ledger.ts +230 -0
  19. package/src/hooks/auto-compact.ts +241 -0
  20. package/src/hooks/comment-checker.ts +120 -0
  21. package/src/hooks/context-injector.ts +163 -0
  22. package/src/hooks/context-window-monitor.ts +106 -0
  23. package/src/hooks/file-ops-tracker.ts +96 -0
  24. package/src/hooks/ledger-loader.ts +78 -0
  25. package/src/hooks/preemptive-compaction.ts +183 -0
  26. package/src/hooks/session-recovery.ts +258 -0
  27. package/src/hooks/token-aware-truncation.ts +189 -0
  28. package/src/index.ts +258 -0
  29. package/src/tools/artifact-index/index.ts +269 -0
  30. package/src/tools/artifact-index/schema.sql +44 -0
  31. package/src/tools/artifact-search.ts +49 -0
  32. package/src/tools/ast-grep/index.ts +189 -0
  33. package/src/tools/background-task/manager.ts +374 -0
  34. package/src/tools/background-task/tools.ts +145 -0
  35. package/src/tools/background-task/types.ts +68 -0
  36. package/src/tools/btca/index.ts +82 -0
  37. package/src/tools/look-at.ts +210 -0
  38. package/src/tools/pty/buffer.ts +49 -0
  39. package/src/tools/pty/index.ts +34 -0
  40. package/src/tools/pty/manager.ts +159 -0
  41. package/src/tools/pty/tools/kill.ts +68 -0
  42. package/src/tools/pty/tools/list.ts +55 -0
  43. package/src/tools/pty/tools/read.ts +152 -0
  44. package/src/tools/pty/tools/spawn.ts +78 -0
  45. package/src/tools/pty/tools/write.ts +97 -0
  46. package/src/tools/pty/types.ts +62 -0
  47. package/src/utils/model-limits.ts +36 -0
  48. package/dist/agents/artifact-searcher.d.ts +0 -2
  49. package/dist/agents/brainstormer.d.ts +0 -2
  50. package/dist/agents/codebase-analyzer.d.ts +0 -2
  51. package/dist/agents/codebase-locator.d.ts +0 -2
  52. package/dist/agents/commander.d.ts +0 -3
  53. package/dist/agents/executor.d.ts +0 -2
  54. package/dist/agents/implementer.d.ts +0 -2
  55. package/dist/agents/index.d.ts +0 -15
  56. package/dist/agents/ledger-creator.d.ts +0 -2
  57. package/dist/agents/pattern-finder.d.ts +0 -2
  58. package/dist/agents/planner.d.ts +0 -2
  59. package/dist/agents/project-initializer.d.ts +0 -2
  60. package/dist/agents/reviewer.d.ts +0 -2
  61. package/dist/config-loader.d.ts +0 -20
  62. package/dist/hooks/artifact-auto-index.d.ts +0 -19
  63. package/dist/hooks/auto-clear-ledger.d.ts +0 -11
  64. package/dist/hooks/auto-compact.d.ts +0 -9
  65. package/dist/hooks/comment-checker.d.ts +0 -9
  66. package/dist/hooks/context-injector.d.ts +0 -15
  67. package/dist/hooks/context-window-monitor.d.ts +0 -15
  68. package/dist/hooks/file-ops-tracker.d.ts +0 -26
  69. package/dist/hooks/ledger-loader.d.ts +0 -16
  70. package/dist/hooks/preemptive-compaction.d.ts +0 -9
  71. package/dist/hooks/session-recovery.d.ts +0 -9
  72. package/dist/hooks/token-aware-truncation.d.ts +0 -15
  73. package/dist/index.d.ts +0 -3
  74. package/dist/index.js +0 -16267
  75. package/dist/tools/artifact-index/index.d.ts +0 -38
  76. package/dist/tools/artifact-search.d.ts +0 -17
  77. package/dist/tools/ast-grep/index.d.ts +0 -88
  78. package/dist/tools/background-task/manager.d.ts +0 -27
  79. package/dist/tools/background-task/tools.d.ts +0 -41
  80. package/dist/tools/background-task/types.d.ts +0 -53
  81. package/dist/tools/btca/index.d.ts +0 -19
  82. package/dist/tools/look-at.d.ts +0 -11
  83. package/dist/utils/model-limits.d.ts +0 -7
  84. /package/{dist/tools/background-task/index.d.ts → src/tools/background-task/index.ts} +0 -0
@@ -1,38 +0,0 @@
1
- export interface PlanRecord {
2
- id: string;
3
- title?: string;
4
- filePath: string;
5
- overview?: string;
6
- approach?: string;
7
- }
8
- export interface LedgerRecord {
9
- id: string;
10
- sessionName?: string;
11
- filePath: string;
12
- goal?: string;
13
- stateNow?: string;
14
- keyDecisions?: string;
15
- filesRead?: string;
16
- filesModified?: string;
17
- }
18
- export interface SearchResult {
19
- type: "plan" | "ledger";
20
- id: string;
21
- filePath: string;
22
- title?: string;
23
- summary?: string;
24
- score: number;
25
- }
26
- export declare class ArtifactIndex {
27
- private db;
28
- private dbPath;
29
- constructor(dbDir?: string);
30
- initialize(): Promise<void>;
31
- private getInlineSchema;
32
- indexPlan(record: PlanRecord): Promise<void>;
33
- indexLedger(record: LedgerRecord): Promise<void>;
34
- search(query: string, limit?: number): Promise<SearchResult[]>;
35
- private escapeFtsQuery;
36
- close(): Promise<void>;
37
- }
38
- export declare function getArtifactIndex(): Promise<ArtifactIndex>;
@@ -1,17 +0,0 @@
1
- export declare const artifact_search: {
2
- description: string;
3
- args: {
4
- query: import("zod").ZodString;
5
- limit: import("zod").ZodOptional<import("zod").ZodNumber>;
6
- type: import("zod").ZodOptional<import("zod").ZodEnum<{
7
- all: "all";
8
- plan: "plan";
9
- ledger: "ledger";
10
- }>>;
11
- };
12
- execute(args: {
13
- query: string;
14
- limit?: number | undefined;
15
- type?: "all" | "plan" | "ledger" | undefined;
16
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
17
- };
@@ -1,88 +0,0 @@
1
- /**
2
- * Check if ast-grep CLI (sg) is available on the system.
3
- * Returns installation instructions if not found.
4
- */
5
- export declare function checkAstGrepAvailable(): Promise<{
6
- available: boolean;
7
- message?: string;
8
- }>;
9
- export declare const ast_grep_search: {
10
- description: string;
11
- args: {
12
- pattern: import("zod").ZodString;
13
- lang: import("zod").ZodEnum<{
14
- c: "c";
15
- cpp: "cpp";
16
- csharp: "csharp";
17
- css: "css";
18
- dart: "dart";
19
- elixir: "elixir";
20
- go: "go";
21
- haskell: "haskell";
22
- html: "html";
23
- java: "java";
24
- javascript: "javascript";
25
- json: "json";
26
- kotlin: "kotlin";
27
- lua: "lua";
28
- php: "php";
29
- python: "python";
30
- ruby: "ruby";
31
- rust: "rust";
32
- scala: "scala";
33
- sql: "sql";
34
- swift: "swift";
35
- tsx: "tsx";
36
- typescript: "typescript";
37
- yaml: "yaml";
38
- }>;
39
- paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
40
- };
41
- execute(args: {
42
- pattern: string;
43
- lang: "c" | "cpp" | "csharp" | "css" | "dart" | "elixir" | "go" | "haskell" | "html" | "java" | "javascript" | "json" | "kotlin" | "lua" | "php" | "python" | "ruby" | "rust" | "scala" | "sql" | "swift" | "tsx" | "typescript" | "yaml";
44
- paths?: string[] | undefined;
45
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
46
- };
47
- export declare const ast_grep_replace: {
48
- description: string;
49
- args: {
50
- pattern: import("zod").ZodString;
51
- rewrite: import("zod").ZodString;
52
- lang: import("zod").ZodEnum<{
53
- c: "c";
54
- cpp: "cpp";
55
- csharp: "csharp";
56
- css: "css";
57
- dart: "dart";
58
- elixir: "elixir";
59
- go: "go";
60
- haskell: "haskell";
61
- html: "html";
62
- java: "java";
63
- javascript: "javascript";
64
- json: "json";
65
- kotlin: "kotlin";
66
- lua: "lua";
67
- php: "php";
68
- python: "python";
69
- ruby: "ruby";
70
- rust: "rust";
71
- scala: "scala";
72
- sql: "sql";
73
- swift: "swift";
74
- tsx: "tsx";
75
- typescript: "typescript";
76
- yaml: "yaml";
77
- }>;
78
- paths: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString>>;
79
- apply: import("zod").ZodOptional<import("zod").ZodBoolean>;
80
- };
81
- execute(args: {
82
- pattern: string;
83
- rewrite: string;
84
- lang: "c" | "cpp" | "csharp" | "css" | "dart" | "elixir" | "go" | "haskell" | "html" | "java" | "javascript" | "json" | "kotlin" | "lua" | "php" | "python" | "ruby" | "rust" | "scala" | "sql" | "swift" | "tsx" | "typescript" | "yaml";
85
- paths?: string[] | undefined;
86
- apply?: boolean | undefined;
87
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
88
- };
@@ -1,27 +0,0 @@
1
- import type { PluginInput } from "@opencode-ai/plugin";
2
- import type { BackgroundTask, BackgroundTaskInput } from "./types";
3
- export declare class BackgroundTaskManager {
4
- private tasks;
5
- private notifications;
6
- private pollingInterval?;
7
- private ctx;
8
- constructor(ctx: PluginInput);
9
- launch(input: BackgroundTaskInput): Promise<BackgroundTask>;
10
- cancel(taskId: string): Promise<boolean>;
11
- cancelAll(): Promise<number>;
12
- getTask(taskId: string): BackgroundTask | undefined;
13
- getAllTasks(): BackgroundTask[];
14
- getRunningTasks(): BackgroundTask[];
15
- getTaskResult(taskId: string): Promise<string | undefined>;
16
- formatTaskStatus(task: BackgroundTask): string;
17
- private startPolling;
18
- private stopPolling;
19
- private cleanupOldTasks;
20
- private pollRunningTasks;
21
- private markForNotification;
22
- getPendingNotifications(parentSessionID: string): BackgroundTask[];
23
- handleEvent(event: {
24
- type: string;
25
- properties?: unknown;
26
- }): void;
27
- }
@@ -1,41 +0,0 @@
1
- import type { BackgroundTaskManager } from "./manager";
2
- export declare function createBackgroundTaskTools(manager: BackgroundTaskManager): {
3
- background_task: {
4
- description: string;
5
- args: {
6
- description: import("zod").ZodString;
7
- prompt: import("zod").ZodString;
8
- agent: import("zod").ZodString;
9
- };
10
- execute(args: {
11
- description: string;
12
- prompt: string;
13
- agent: string;
14
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
15
- };
16
- background_output: {
17
- description: string;
18
- args: {
19
- task_id: import("zod").ZodString;
20
- };
21
- execute(args: {
22
- task_id: string;
23
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
24
- };
25
- background_cancel: {
26
- description: string;
27
- args: {
28
- task_id: import("zod").ZodOptional<import("zod").ZodString>;
29
- all: import("zod").ZodOptional<import("zod").ZodBoolean>;
30
- };
31
- execute(args: {
32
- task_id?: string | undefined;
33
- all?: boolean | undefined;
34
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
35
- };
36
- background_list: {
37
- description: string;
38
- args: {};
39
- execute(args: Record<string, never>, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
40
- };
41
- };
@@ -1,53 +0,0 @@
1
- export interface BackgroundTask {
2
- id: string;
3
- sessionID: string;
4
- parentSessionID: string;
5
- parentMessageID: string;
6
- description: string;
7
- prompt: string;
8
- agent: string;
9
- status: "running" | "completed" | "error" | "cancelled";
10
- startedAt: Date;
11
- completedAt?: Date;
12
- result?: string;
13
- error?: string;
14
- progress?: {
15
- toolCalls: number;
16
- lastTool?: string;
17
- lastUpdate: Date;
18
- };
19
- }
20
- export interface BackgroundTaskInput {
21
- description: string;
22
- prompt: string;
23
- agent: string;
24
- parentSessionID: string;
25
- parentMessageID: string;
26
- }
27
- export interface SessionCreateResponse {
28
- data?: {
29
- id?: string;
30
- };
31
- }
32
- export interface SessionGetResponse {
33
- data?: {
34
- status?: "idle" | "running" | "error";
35
- };
36
- }
37
- export interface MessagePart {
38
- type: string;
39
- text?: string;
40
- }
41
- export interface MessageInfo {
42
- role?: "user" | "assistant";
43
- sessionID?: string;
44
- type?: string;
45
- name?: string;
46
- }
47
- export interface SessionMessage {
48
- info?: MessageInfo;
49
- parts?: MessagePart[];
50
- }
51
- export interface SessionMessagesResponse {
52
- data?: SessionMessage[];
53
- }
@@ -1,19 +0,0 @@
1
- /**
2
- * Check if btca CLI is available on the system.
3
- * Returns installation instructions if not found.
4
- */
5
- export declare function checkBtcaAvailable(): Promise<{
6
- available: boolean;
7
- message?: string;
8
- }>;
9
- export declare const btca_ask: {
10
- description: string;
11
- args: {
12
- tech: import("zod").ZodString;
13
- question: import("zod").ZodString;
14
- };
15
- execute(args: {
16
- tech: string;
17
- question: string;
18
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
19
- };
@@ -1,11 +0,0 @@
1
- export declare const look_at: {
2
- description: string;
3
- args: {
4
- filePath: import("zod").ZodString;
5
- extract: import("zod").ZodOptional<import("zod").ZodString>;
6
- };
7
- execute(args: {
8
- filePath: string;
9
- extract?: string | undefined;
10
- }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
11
- };
@@ -1,7 +0,0 @@
1
- export declare const MODEL_CONTEXT_LIMITS: Record<string, number>;
2
- export declare const DEFAULT_CONTEXT_LIMIT = 200000;
3
- /**
4
- * Get the context window limit for a given model ID.
5
- * Matches against known patterns and falls back to default.
6
- */
7
- export declare function getContextLimit(modelID: string): number;