@hiai-gg/hiai-opencode 0.1.4 → 0.1.6
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/.env.example +14 -8
- package/AGENTS.md +19 -8
- package/ARCHITECTURE.md +7 -6
- package/LICENSE.md +0 -1
- package/README.md +48 -17
- package/assets/cli/hiai-opencode.mjs +590 -7
- package/assets/mcp/mempalace.mjs +159 -25
- package/config/hiai-opencode.schema.json +82 -148
- package/dist/agents/dynamic-agent-core-sections.d.ts +4 -1
- package/dist/agents/dynamic-agent-prompt-builder.d.ts +1 -1
- package/dist/config/defaults.d.ts +1 -0
- package/dist/config/platform-schema.d.ts +275 -10
- package/dist/config/schema/categories.d.ts +2 -2
- package/dist/config/schema/commands.d.ts +1 -0
- package/dist/config/schema/oh-my-opencode-config.d.ts +1 -3
- package/dist/config/types.d.ts +22 -5
- package/dist/create-tools.d.ts +2 -0
- package/dist/features/builtin-commands/templates/doctor.d.ts +1 -0
- package/dist/features/builtin-commands/types.d.ts +1 -1
- package/dist/features/builtin-skills/skills/hiai-opencode-setup.d.ts +2 -0
- package/dist/features/builtin-skills/skills/index.d.ts +1 -0
- package/dist/index.js +870 -1711
- package/dist/mcp/types.d.ts +1 -1
- package/dist/plugin/tool-registry.d.ts +2 -0
- package/dist/shared/mcp-static-export.d.ts +22 -0
- package/dist/tools/ast-grep/constants.d.ts +1 -1
- package/dist/tools/ast-grep/environment-check.d.ts +1 -5
- package/dist/tools/ast-grep/language-support.d.ts +0 -1
- package/dist/tools/ast-grep/types.d.ts +1 -2
- package/dist/tools/skill-mcp/tools.d.ts +2 -0
- package/hiai-opencode.json +39 -171
- package/package.json +6 -4
- package/src/agents/bob/default.ts +6 -1
- package/src/agents/bob/gpt-pro.ts +1 -0
- package/src/agents/bob.ts +1 -0
- package/src/agents/coder/gpt-codex.ts +1 -0
- package/src/agents/coder/gpt-pro.ts +1 -0
- package/src/agents/coder/gpt.ts +1 -0
- package/src/agents/dynamic-agent-core-sections.ts +36 -0
- package/src/agents/dynamic-agent-prompt-builder.ts +1 -0
- package/src/config/defaults.ts +171 -28
- package/src/config/loader.test.ts +16 -1
- package/src/config/loader.ts +4 -2
- package/src/config/model-slots-and-export.test.ts +55 -0
- package/src/config/platform-schema.ts +37 -5
- package/src/config/schema/commands.ts +1 -0
- package/src/config/schema/oh-my-opencode-config.ts +0 -3
- package/src/config/types.ts +34 -5
- package/src/create-tools.ts +4 -1
- package/src/features/builtin-commands/commands.ts +7 -0
- package/src/features/builtin-commands/templates/doctor.ts +43 -0
- package/src/features/builtin-commands/types.ts +1 -1
- package/src/features/builtin-skills/skills/hiai-opencode-setup.ts +69 -0
- package/src/features/builtin-skills/skills/index.ts +1 -0
- package/src/features/builtin-skills/skills.ts +10 -1
- package/src/index.ts +4 -38
- package/src/lsp/index.ts +1 -0
- package/src/mcp/registry.ts +6 -1
- package/src/plugin/tool-registry.ts +4 -0
- package/src/shared/mcp-static-export.ts +121 -0
- package/src/tools/ast-grep/constants.ts +1 -1
- package/src/tools/ast-grep/environment-check.ts +2 -32
- package/src/tools/ast-grep/language-support.ts +0 -3
- package/src/tools/ast-grep/types.ts +1 -2
- package/src/tools/skill-mcp/tools.test.ts +44 -0
- package/src/tools/skill-mcp/tools.ts +45 -7
- package/dist/ast-grep-napi.win32-x64-msvc-67c0y8nc.node +0 -0
- package/dist/config/loader.test.d.ts +0 -1
- package/dist/config/models.d.ts +0 -13
- package/dist/internals/plugins/websearch-cited/google.d.ts +0 -38
- package/dist/internals/plugins/websearch-cited/index.d.ts +0 -11
- package/dist/internals/plugins/websearch-cited/openai.d.ts +0 -9
- package/dist/internals/plugins/websearch-cited/openrouter.d.ts +0 -2
- package/dist/internals/plugins/websearch-cited/types.d.ts +0 -5
- package/src/internals/plugins/websearch-cited/LICENSE +0 -214
- package/src/internals/plugins/websearch-cited/codex_prompt.txt +0 -79
- package/src/internals/plugins/websearch-cited/google.ts +0 -749
- package/src/internals/plugins/websearch-cited/index.ts +0 -301
- package/src/internals/plugins/websearch-cited/openai.ts +0 -407
- package/src/internals/plugins/websearch-cited/openrouter.ts +0 -190
- package/src/internals/plugins/websearch-cited/types.ts +0 -7
package/dist/mcp/types.d.ts
CHANGED
|
@@ -3,10 +3,10 @@ export declare const McpNameSchema: z.ZodEnum<{
|
|
|
3
3
|
websearch: "websearch";
|
|
4
4
|
stitch: "stitch";
|
|
5
5
|
firecrawl: "firecrawl";
|
|
6
|
+
context7: "context7";
|
|
6
7
|
playwright: "playwright";
|
|
7
8
|
"sequential-thinking": "sequential-thinking";
|
|
8
9
|
rag: "rag";
|
|
9
|
-
context7: "context7";
|
|
10
10
|
mempalace: "mempalace";
|
|
11
11
|
grep_app: "grep_app";
|
|
12
12
|
}>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AvailableCategory } from "../agents/dynamic-agent-prompt-builder";
|
|
2
2
|
import type { HiaiOpenCodeConfig } from "../config";
|
|
3
|
+
import type { McpServerConfig } from "../config/types";
|
|
3
4
|
import type { PluginContext, ToolsRecord } from "./types";
|
|
4
5
|
import { builtinTools, createBackgroundTools, createCallOmoAgent, createLookAt, createSkillMcpTool, createSkillTool, createGrepTools, createGlobTools, createAstGrepTools, createSessionManagerTools, createDelegateTask, discoverCommandsSync, interactive_bash, createTaskCreateTool, createTaskGetTool, createTaskList, createTaskUpdateTool, createHashlineEditTool } from "../tools";
|
|
5
6
|
import type { Managers } from "../create-managers";
|
|
@@ -35,6 +36,7 @@ export declare function createToolRegistry(args: {
|
|
|
35
36
|
managers: Pick<Managers, "backgroundManager" | "tmuxSessionManager" | "skillMcpManager">;
|
|
36
37
|
skillContext: SkillContext;
|
|
37
38
|
availableCategories: AvailableCategory[];
|
|
39
|
+
builtinMcp?: Record<string, McpServerConfig>;
|
|
38
40
|
interactiveBashEnabled?: boolean;
|
|
39
41
|
toolFactories?: Partial<ToolRegistryFactories>;
|
|
40
42
|
}): ToolRegistryResult;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { HiaiOpencodeConfig } from "../config/types";
|
|
2
|
+
type StaticMcpServer = {
|
|
3
|
+
type?: "http" | "stdio";
|
|
4
|
+
url?: string;
|
|
5
|
+
command?: string;
|
|
6
|
+
args?: string[];
|
|
7
|
+
env?: Record<string, string>;
|
|
8
|
+
headers?: Record<string, string>;
|
|
9
|
+
};
|
|
10
|
+
export declare const MCP_EXPORT_MARKER = "hiai-opencode";
|
|
11
|
+
type StaticMcpJsonPayload = {
|
|
12
|
+
mcpServers: Record<string, StaticMcpServer>;
|
|
13
|
+
_meta?: {
|
|
14
|
+
generatedBy: typeof MCP_EXPORT_MARKER;
|
|
15
|
+
version: 1;
|
|
16
|
+
generatedAt: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare function buildStaticMcpJson(config: HiaiOpencodeConfig): StaticMcpJsonPayload;
|
|
20
|
+
export declare function isManagedStaticMcpFile(path: string): boolean;
|
|
21
|
+
export declare function autoExportStaticMcpJson(directory: string, config: HiaiOpencodeConfig): void;
|
|
22
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { EnvironmentCheckResult } from "./environment-check";
|
|
2
2
|
export { checkEnvironment, formatEnvironmentCheck } from "./environment-check";
|
|
3
|
-
export { CLI_LANGUAGES,
|
|
3
|
+
export { CLI_LANGUAGES, LANG_EXTENSIONS } from "./language-support";
|
|
4
4
|
export { DEFAULT_TIMEOUT_MS, DEFAULT_MAX_OUTPUT_BYTES, DEFAULT_MAX_MATCHES } from "./language-support";
|
|
5
5
|
export { findSgCliPathSync, getSgCliPath, setSgCliPath } from "./sg-cli-path";
|
|
@@ -4,13 +4,9 @@ export interface EnvironmentCheckResult {
|
|
|
4
4
|
path: string;
|
|
5
5
|
error?: string;
|
|
6
6
|
};
|
|
7
|
-
napi: {
|
|
8
|
-
available: boolean;
|
|
9
|
-
error?: string;
|
|
10
|
-
};
|
|
11
7
|
}
|
|
12
8
|
/**
|
|
13
|
-
* Check if ast-grep CLI
|
|
9
|
+
* Check if ast-grep CLI is available.
|
|
14
10
|
* Call this at startup to provide early feedback about missing dependencies.
|
|
15
11
|
*/
|
|
16
12
|
export declare function checkEnvironment(): EnvironmentCheckResult;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const CLI_LANGUAGES: readonly ["bash", "c", "cpp", "csharp", "css", "elixir", "go", "haskell", "html", "java", "javascript", "json", "kotlin", "lua", "nix", "php", "python", "ruby", "rust", "scala", "solidity", "swift", "typescript", "tsx", "yaml"];
|
|
2
|
-
export declare const NAPI_LANGUAGES: readonly ["html", "javascript", "tsx", "css", "typescript"];
|
|
3
2
|
export declare const DEFAULT_TIMEOUT_MS = 300000;
|
|
4
3
|
export declare const DEFAULT_MAX_OUTPUT_BYTES: number;
|
|
5
4
|
export declare const DEFAULT_MAX_MATCHES = 500;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { CLI_LANGUAGES
|
|
1
|
+
import type { CLI_LANGUAGES } from "./constants";
|
|
2
2
|
export type CliLanguage = (typeof CLI_LANGUAGES)[number];
|
|
3
|
-
export type NapiLanguage = (typeof NAPI_LANGUAGES)[number];
|
|
4
3
|
export interface Position {
|
|
5
4
|
line: number;
|
|
6
5
|
column: number;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
import type { McpServerConfig } from "../../config/types";
|
|
2
3
|
import type { SkillMcpManager } from "../../features/skill-mcp-manager";
|
|
3
4
|
import type { LoadedSkill } from "../../features/opencode-skill-loader/types";
|
|
4
5
|
interface SkillMcpToolOptions {
|
|
5
6
|
manager: SkillMcpManager;
|
|
6
7
|
getLoadedSkills: () => LoadedSkill[];
|
|
7
8
|
getSessionID?: () => string | undefined;
|
|
9
|
+
builtinMcp?: Record<string, McpServerConfig>;
|
|
8
10
|
}
|
|
9
11
|
export declare function applyGrepFilter(output: string, pattern: string | undefined): string;
|
|
10
12
|
export declare function createSkillMcpTool(options: SkillMcpToolOptions): ToolDefinition;
|
package/hiai-opencode.json
CHANGED
|
@@ -1,170 +1,71 @@
|
|
|
1
1
|
{
|
|
2
|
-
"_description": "
|
|
2
|
+
"_description": "hiai-opencode user config. Edit only this file in your project as .opencode/hiai-opencode.json. Model provider credentials are configured in OpenCode Connect; this file stores model IDs only.",
|
|
3
3
|
"$schema": "./config/hiai-opencode.schema.json",
|
|
4
|
-
"
|
|
4
|
+
"models": {
|
|
5
5
|
"bob": {
|
|
6
|
-
"model": "openrouter/
|
|
7
|
-
"
|
|
6
|
+
"model": "openrouter/moonshotai/kimi-k2.6",
|
|
7
|
+
"recommended": "xhigh"
|
|
8
8
|
},
|
|
9
9
|
"coder": {
|
|
10
|
-
"model": "openrouter/
|
|
11
|
-
"
|
|
10
|
+
"model": "openrouter/minimax/minimax-m2.7",
|
|
11
|
+
"recommended": "high"
|
|
12
12
|
},
|
|
13
13
|
"strategist": {
|
|
14
|
-
"model": "openrouter/
|
|
15
|
-
"
|
|
14
|
+
"model": "openrouter/anthropic/claude-opus-latest",
|
|
15
|
+
"recommended": "high"
|
|
16
16
|
},
|
|
17
17
|
"guard": {
|
|
18
|
-
"model": "openrouter/
|
|
19
|
-
"
|
|
18
|
+
"model": "openrouter/qwen/qwen3.6-plus",
|
|
19
|
+
"recommended": "middle"
|
|
20
20
|
},
|
|
21
21
|
"critic": {
|
|
22
|
-
"model": "openrouter/
|
|
23
|
-
"
|
|
22
|
+
"model": "openrouter/xiaomi/mimo-v2.5-pro",
|
|
23
|
+
"recommended": "high"
|
|
24
24
|
},
|
|
25
25
|
"designer": {
|
|
26
|
-
"model": "openrouter/google/gemini-3.1-pro",
|
|
27
|
-
"
|
|
26
|
+
"model": "openrouter/google/gemini-3.1-pro-preview",
|
|
27
|
+
"recommended": "design"
|
|
28
28
|
},
|
|
29
29
|
"researcher": {
|
|
30
|
-
"model": "openrouter/
|
|
31
|
-
"
|
|
30
|
+
"model": "openrouter/deepseek/deepseek-v4-flash",
|
|
31
|
+
"recommended": "fast"
|
|
32
32
|
},
|
|
33
|
-
"
|
|
34
|
-
"model": "openrouter/
|
|
35
|
-
"
|
|
33
|
+
"manager": {
|
|
34
|
+
"model": "openrouter/qwen/qwen3.5-9b",
|
|
35
|
+
"recommended": "fast"
|
|
36
36
|
},
|
|
37
37
|
"brainstormer": {
|
|
38
|
-
"model": "openrouter/
|
|
39
|
-
"
|
|
38
|
+
"model": "openrouter/mistralai/mistral-small-2603",
|
|
39
|
+
"recommended": "writing"
|
|
40
40
|
},
|
|
41
|
-
"
|
|
42
|
-
"model": "openrouter/google/
|
|
43
|
-
"
|
|
44
|
-
},
|
|
45
|
-
"sub": {
|
|
46
|
-
"model": "openrouter/google/gemini-2.0-flash",
|
|
47
|
-
"description": "Hidden compatibility executor. Primary subtask execution is handled by Coder."
|
|
48
|
-
},
|
|
49
|
-
"quality-guardian": {
|
|
50
|
-
"model": "openrouter/anthropic/claude-3.5-sonnet",
|
|
51
|
-
"description": "Hidden compatibility review agent. Primary review work is handled by Critic."
|
|
52
|
-
},
|
|
53
|
-
"agent-skills": {
|
|
54
|
-
"model": "openrouter/google/gemini-2.0-flash",
|
|
55
|
-
"description": "Hidden system agent for skill registry, discovery, and capability orchestration."
|
|
41
|
+
"vision": {
|
|
42
|
+
"model": "openrouter/google/gemma-4-26b-a4b-it",
|
|
43
|
+
"recommended": "vision"
|
|
56
44
|
}
|
|
57
45
|
},
|
|
58
|
-
"agentRequirements": {},
|
|
59
|
-
"categories": {
|
|
60
|
-
"visual-engineering": {
|
|
61
|
-
"model": "openrouter/google/gemini-2.0-pro-exp-02-05",
|
|
62
|
-
"variant": "high",
|
|
63
|
-
"description": "Frontend and UI systems work with design-system discipline. Uses Coder deep execution contour."
|
|
64
|
-
},
|
|
65
|
-
"artistry": {
|
|
66
|
-
"model": "openrouter/google/gemini-2.0-pro-exp-02-05",
|
|
67
|
-
"variant": "high",
|
|
68
|
-
"description": "High-effort creative problem solving beyond standard patterns. Uses Coder deep execution contour."
|
|
69
|
-
},
|
|
70
|
-
"ultrabrain": {
|
|
71
|
-
"model": "openrouter/openai/gpt-4o",
|
|
72
|
-
"variant": "xhigh",
|
|
73
|
-
"description": "Hard logic and architecture tasks. Uses Coder deep execution contour."
|
|
74
|
-
},
|
|
75
|
-
"deep": {
|
|
76
|
-
"model": "openrouter/openai/o1",
|
|
77
|
-
"variant": "medium",
|
|
78
|
-
"description": "Deep autonomous implementation with full context buildup. Uses Coder deep execution contour."
|
|
79
|
-
},
|
|
80
|
-
"quick": {
|
|
81
|
-
"model": "openrouter/google/gemini-2.0-flash",
|
|
82
|
-
"description": "Fast bounded execution: single-file fixes, typos, and simple modifications. Uses Coder fast execution contour."
|
|
83
|
-
},
|
|
84
|
-
"writing": {
|
|
85
|
-
"model": "openrouter/kimi/kimi-latest",
|
|
86
|
-
"description": "Documentation and prose tasks with bounded scope. Uses Coder fast execution contour."
|
|
87
|
-
},
|
|
88
|
-
"git": {
|
|
89
|
-
"model": "openrouter/google/gemini-2.0-flash",
|
|
90
|
-
"description": "Git, commit, diff, and repository hygiene tasks."
|
|
91
|
-
},
|
|
92
|
-
"unspecified-low": {
|
|
93
|
-
"model": "openrouter/anthropic/claude-3.5-sonnet",
|
|
94
|
-
"description": "Unclassifiable moderate tasks with bounded scope. Uses Coder fast execution contour."
|
|
95
|
-
},
|
|
96
|
-
"unspecified-high": {
|
|
97
|
-
"model": "openrouter/anthropic/claude-3.5-opus",
|
|
98
|
-
"variant": "max",
|
|
99
|
-
"description": "Unclassifiable substantial tasks across modules. Uses Coder deep execution contour."
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
"categoryRequirements": {},
|
|
103
|
-
"modelFamilies": [],
|
|
104
46
|
"auth": {
|
|
105
|
-
"googleSearch": "{env:GOOGLE_SEARCH_API_KEY}",
|
|
106
47
|
"stitch": "{env:STITCH_AI_API_KEY}",
|
|
107
48
|
"firecrawl": "{env:FIRECRAWL_API_KEY}",
|
|
108
49
|
"context7": "{env:CONTEXT7_API_KEY}"
|
|
109
50
|
},
|
|
110
|
-
"ollama": {
|
|
111
|
-
"enabled": false,
|
|
112
|
-
"model": "{env:OLLAMA_MODEL:-qwen3.5:4b}",
|
|
113
|
-
"baseUrl": "{env:OLLAMA_BASE_URL:-http://localhost:11434}",
|
|
114
|
-
"purpose": "helper"
|
|
115
|
-
},
|
|
116
|
-
"fast_apply": {
|
|
117
|
-
"enabled": false,
|
|
118
|
-
"ollama_url": "{env:OLLAMA_BASE_URL:-http://localhost:11434}",
|
|
119
|
-
"model": "{env:OLLAMA_MODEL:-qwen3.5:4b}",
|
|
120
|
-
"timeout": 30000
|
|
121
|
-
},
|
|
122
51
|
"mcp": {
|
|
123
|
-
"playwright": {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
},
|
|
128
|
-
"stitch": {
|
|
129
|
-
"enabled": true,
|
|
130
|
-
"type": "remote",
|
|
131
|
-
"url": "https://stitch.googleapis.com/mcp",
|
|
132
|
-
"headers": { "X-Goog-Api-Key": "{env:STITCH_AI_API_KEY}" },
|
|
133
|
-
"timeout": 600000
|
|
134
|
-
},
|
|
135
|
-
"sequential-thinking": {
|
|
136
|
-
"enabled": true,
|
|
137
|
-
"command": ["node", "{pluginRoot}/assets/runtime/npm-package-runner.mjs", "@modelcontextprotocol/server-sequential-thinking"],
|
|
138
|
-
"timeout": 600000
|
|
139
|
-
},
|
|
140
|
-
"firecrawl": {
|
|
141
|
-
"enabled": true,
|
|
142
|
-
"command": ["node", "{pluginRoot}/assets/runtime/npm-package-runner.mjs", "firecrawl-mcp"],
|
|
143
|
-
"environment": { "FIRECRAWL_API_KEY": "{env:FIRECRAWL_API_KEY}" },
|
|
144
|
-
"timeout": 600000
|
|
145
|
-
},
|
|
146
|
-
"rag": {
|
|
147
|
-
"enabled": true,
|
|
148
|
-
"type": "local",
|
|
149
|
-
"command": ["node", "{pluginRoot}/assets/mcp/rag.mjs"],
|
|
150
|
-
"environment": {
|
|
151
|
-
"OPENCODE_RAG_URL": "{env:OPENCODE_RAG_URL:-http://localhost:9002/tools/search}"
|
|
152
|
-
},
|
|
153
|
-
"timeout": 600000
|
|
154
|
-
},
|
|
52
|
+
"playwright": { "enabled": true },
|
|
53
|
+
"stitch": { "enabled": true },
|
|
54
|
+
"sequential-thinking": { "enabled": true },
|
|
55
|
+
"firecrawl": { "enabled": true },
|
|
56
|
+
"rag": { "enabled": true },
|
|
155
57
|
"mempalace": {
|
|
156
58
|
"enabled": true,
|
|
157
|
-
"
|
|
158
|
-
"command": ["node", "{pluginRoot}/assets/mcp/mempalace.mjs", "--palace", "./.opencode/palace"],
|
|
159
|
-
"timeout": 600000
|
|
59
|
+
"pythonPath": "{env:MEMPALACE_PYTHON:-./.venv/bin/python}"
|
|
160
60
|
},
|
|
161
|
-
"context7": {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
61
|
+
"context7": { "enabled": true }
|
|
62
|
+
},
|
|
63
|
+
"lsp": {
|
|
64
|
+
"typescript": { "enabled": true },
|
|
65
|
+
"svelte": { "enabled": true },
|
|
66
|
+
"eslint": { "enabled": true },
|
|
67
|
+
"bash": { "enabled": true },
|
|
68
|
+
"pyright": { "enabled": true }
|
|
168
69
|
},
|
|
169
70
|
"skill_discovery": {
|
|
170
71
|
"config_sources": true,
|
|
@@ -175,40 +76,7 @@
|
|
|
175
76
|
"project_agents": false,
|
|
176
77
|
"global_agents": false
|
|
177
78
|
},
|
|
178
|
-
"skills": {
|
|
179
|
-
"enabled": true,
|
|
180
|
-
"disabled": []
|
|
181
|
-
},
|
|
182
|
-
"lsp": {
|
|
183
|
-
"typescript": {
|
|
184
|
-
"command": ["typescript-language-server", "--stdio"],
|
|
185
|
-
"extensions": [".ts", ".tsx", ".mts", ".cts"]
|
|
186
|
-
},
|
|
187
|
-
"svelte": {
|
|
188
|
-
"command": ["svelteserver", "--stdio"],
|
|
189
|
-
"extensions": [".svelte"]
|
|
190
|
-
},
|
|
191
|
-
"eslint": {
|
|
192
|
-
"command": ["node", "{pluginRoot}/assets/runtime/npm-package-runner.mjs", "eslint-lsp", "--stdio"],
|
|
193
|
-
"extensions": [".js", ".jsx", ".ts", ".tsx", ".mjs", ".cjs", ".svelte"]
|
|
194
|
-
},
|
|
195
|
-
"bash": {
|
|
196
|
-
"command": ["node", "{pluginRoot}/assets/runtime/npm-package-runner.mjs", "bash-language-server", "start"],
|
|
197
|
-
"extensions": [".sh", ".bash"]
|
|
198
|
-
},
|
|
199
|
-
"pyright": {
|
|
200
|
-
"command": ["pyright-langserver", "--stdio"],
|
|
201
|
-
"extensions": [".py"]
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
79
|
"subtask2": {
|
|
205
|
-
"replace_generic": true
|
|
206
|
-
"generic_return": null
|
|
207
|
-
},
|
|
208
|
-
"permissions": {
|
|
209
|
-
"read": { "*": "allow", "*.env": "deny", "*.env.*": "deny", "*.env.example": "allow" },
|
|
210
|
-
"edit": { "*": "allow" },
|
|
211
|
-
"bash": { "*": "allow" },
|
|
212
|
-
"deny_paths": ["**/backup/**", "**/secrets.*", "**/.env", "**/.env.*"]
|
|
80
|
+
"replace_generic": true
|
|
213
81
|
}
|
|
214
82
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hiai-gg/hiai-opencode",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Unified OpenCode plugin — canonical 12-agent model with bundled skills, MCP integrations, LSP, and permissions in one install.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,19 +50,21 @@
|
|
|
50
50
|
"access": "public"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
|
-
"
|
|
53
|
+
"clean:dist": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
|
|
54
|
+
"build": "bun run clean:dist && bun build src/index.ts --outdir dist --target bun --format esm && tsc --emitDeclarationOnly",
|
|
54
55
|
"build:bundle": "bun build src/index.ts --outdir dist --target bun --format esm",
|
|
55
56
|
"build:types": "tsc --emitDeclarationOnly",
|
|
56
57
|
"typecheck": "tsc --noEmit",
|
|
58
|
+
"test": "bun test",
|
|
59
|
+
"pack:check": "npm pack --dry-run",
|
|
57
60
|
"prepare": "bun run build",
|
|
58
|
-
"prepublishOnly": "bun run build"
|
|
61
|
+
"prepublishOnly": "bun run typecheck && bun run test && bun run build && bun run pack:check"
|
|
59
62
|
},
|
|
60
63
|
"dependencies": {
|
|
61
64
|
"bun-pty": "^0.4.8",
|
|
62
65
|
"@opencode-ai/plugin": "^1.4.0",
|
|
63
66
|
"@opencode-ai/sdk": "^1.4.0",
|
|
64
67
|
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
65
|
-
"@ast-grep/napi": "^0.37.0",
|
|
66
68
|
"zod": "^4.3.0",
|
|
67
69
|
"jsonc-parser": "^3.3.1",
|
|
68
70
|
"js-yaml": "^4.1.0",
|
|
@@ -36,7 +36,12 @@ export function buildDefaultBobPrompt(
|
|
|
36
36
|
useTaskSystem = false,
|
|
37
37
|
): string {
|
|
38
38
|
const keyTriggers = buildKeyTriggersSection(availableAgents, availableSkills)
|
|
39
|
-
const toolSelection = buildToolSelectionTable(
|
|
39
|
+
const toolSelection = buildToolSelectionTable(
|
|
40
|
+
availableAgents,
|
|
41
|
+
availableTools,
|
|
42
|
+
availableSkills,
|
|
43
|
+
{ includeIntegrationPrimer: true },
|
|
44
|
+
)
|
|
40
45
|
const researcherSection = buildResearcherSection(availableAgents)
|
|
41
46
|
const categorySkillsGuide = buildCategorySkillsDelegationGuide(availableCategories, availableSkills)
|
|
42
47
|
const delegationTable = buildDelegationTable(availableAgents)
|
|
@@ -88,6 +88,7 @@ export function buildGptProBobPrompt(
|
|
|
88
88
|
availableAgents,
|
|
89
89
|
availableTools,
|
|
90
90
|
availableSkills,
|
|
91
|
+
{ includeIntegrationPrimer: true },
|
|
91
92
|
);
|
|
92
93
|
const researcherSection = buildResearcherSection(availableAgents);
|
|
93
94
|
const categorySkillsGuide = buildCategorySkillsDelegationGuide(
|
package/src/agents/bob.ts
CHANGED
|
@@ -54,6 +54,7 @@ function buildDynamicBobPrompt(
|
|
|
54
54
|
availableAgents,
|
|
55
55
|
availableTools,
|
|
56
56
|
availableSkills,
|
|
57
|
+
{ includeIntegrationPrimer: true },
|
|
57
58
|
);
|
|
58
59
|
const researcherSection = buildResearcherSection(availableAgents);
|
|
59
60
|
const categorySkillsGuide = buildCategorySkillsDelegationGuide(
|
|
@@ -56,6 +56,7 @@ export function buildCoderPrompt(
|
|
|
56
56
|
availableAgents,
|
|
57
57
|
availableTools,
|
|
58
58
|
availableSkills,
|
|
59
|
+
{ includeIntegrationPrimer: true },
|
|
59
60
|
);
|
|
60
61
|
const researcherSection = buildResearcherSection(availableAgents);
|
|
61
62
|
const categorySkillsGuide = buildCategorySkillsDelegationGuide(
|
|
@@ -51,6 +51,7 @@ export function buildCoderPrompt(
|
|
|
51
51
|
availableAgents,
|
|
52
52
|
availableTools,
|
|
53
53
|
availableSkills,
|
|
54
|
+
{ includeIntegrationPrimer: true },
|
|
54
55
|
);
|
|
55
56
|
const researcherSection = buildResearcherSection(availableAgents);
|
|
56
57
|
const categorySkillsGuide = buildCategorySkillsDelegationGuide(
|
package/src/agents/coder/gpt.ts
CHANGED
|
@@ -32,6 +32,7 @@ export function buildCoderPrompt(
|
|
|
32
32
|
availableAgents,
|
|
33
33
|
availableTools,
|
|
34
34
|
availableSkills,
|
|
35
|
+
{ includeIntegrationPrimer: true },
|
|
35
36
|
);
|
|
36
37
|
const researcherSection = buildResearcherSection(availableAgents);
|
|
37
38
|
const categorySkillsGuide = buildCategorySkillsDelegationGuide(
|
|
@@ -45,6 +45,7 @@ export function buildToolSelectionTable(
|
|
|
45
45
|
agents: AvailableAgent[],
|
|
46
46
|
tools: AvailableTool[] = [],
|
|
47
47
|
_skills: AvailableSkill[] = [],
|
|
48
|
+
options: { includeIntegrationPrimer?: boolean } = {},
|
|
48
49
|
): string {
|
|
49
50
|
const rows: string[] = ["### Tool & Agent Selection:", ""]
|
|
50
51
|
|
|
@@ -72,10 +73,45 @@ export function buildToolSelectionTable(
|
|
|
72
73
|
rows.push(
|
|
73
74
|
"**Default flow**: researcher (background) + tools → strategist (if required) → critic (high-risk gate)",
|
|
74
75
|
)
|
|
76
|
+
if (options.includeIntegrationPrimer) {
|
|
77
|
+
rows.push("")
|
|
78
|
+
rows.push(buildHiaiIntegrationPrimerSection())
|
|
79
|
+
}
|
|
75
80
|
|
|
76
81
|
return rows.join("\n")
|
|
77
82
|
}
|
|
78
83
|
|
|
84
|
+
export function buildHiaiIntegrationPrimerSection(): string {
|
|
85
|
+
return `<hiai-opencode-integration-primer>
|
|
86
|
+
## hiai-opencode Architecture And Integration Rules
|
|
87
|
+
|
|
88
|
+
This workspace may use hiai-opencode, an OpenCode plugin that wires agents, skills, MCP launchers, LSP, diagnostics, and compatibility helpers around external upstream tools.
|
|
89
|
+
|
|
90
|
+
Core rules:
|
|
91
|
+
- OpenCode plugins are not MCP servers. Keep \`@hiai-gg/hiai-opencode\` and optional \`@tarquinen/opencode-dcp\` in the OpenCode plugin list; never add MCP packages such as \`firecrawl-mcp\`, \`@playwright/mcp\`, or \`@modelcontextprotocol/server-sequential-thinking\` to the plugin list.
|
|
92
|
+
- User-facing config lives in \`hiai-opencode.json\` or \`.opencode/hiai-opencode.json\`: 10 model slots, MCP enable flags, LSP enable flags, service auth placeholders, and skill discovery switches.
|
|
93
|
+
- Model provider credentials are configured through OpenCode Connect. Do not ask for \`OPENROUTER_API_KEY\`, \`OPENAI_API_KEY\`, or \`ANTHROPIC_API_KEY\` for normal model usage.
|
|
94
|
+
- Service keys are separate: \`FIRECRAWL_API_KEY\`, \`STITCH_AI_API_KEY\`, \`CONTEXT7_API_KEY\`, and \`OPENCODE_RAG_URL\` when those services are enabled.
|
|
95
|
+
|
|
96
|
+
MCP usage:
|
|
97
|
+
- Run \`hiai-opencode doctor\` or \`hiai-opencode mcp-status\` for effective runtime MCP status.
|
|
98
|
+
- \`opencode mcp list\` often reads only static \`.mcp.json\`; plugin runtime MCP may work even when that list is empty.
|
|
99
|
+
- The plugin auto-exports \`.mcp.json\` when missing. Run \`hiai-opencode export-mcp .mcp.json\` to refresh static visibility.
|
|
100
|
+
- \`skill_mcp\` can call skill-embedded MCP and enabled hiai-opencode MCP. If an MCP is "not found", check whether the skill was loaded, whether \`hiai-opencode.json\` enables it, and whether static export is needed.
|
|
101
|
+
|
|
102
|
+
Memory and retrieval:
|
|
103
|
+
- MemPalace MCP is external. If enabled, use \`mempalace_status\` first, search before answering about remembered people/projects/past decisions, and write diary entries when appropriate. Never invent memories.
|
|
104
|
+
- RAG MCP is external/local. Use it for project knowledge search when \`OPENCODE_RAG_URL\` is configured or the default \`http://localhost:9002/tools/search\` is reachable.
|
|
105
|
+
- Sequential Thinking MCP is for complex planning/revision/branching, not for trivial edits.
|
|
106
|
+
- Firecrawl/Stitch/Context7 are external web/docs/research services; missing service keys should be reported by env var name only.
|
|
107
|
+
|
|
108
|
+
Installation/debugging:
|
|
109
|
+
- Use \`/doctor\` or \`hiai-opencode doctor\` before changing config.
|
|
110
|
+
- Prefer user-level or project-local installs. Do not use sudo/admin rights unless explicitly requested.
|
|
111
|
+
- If DCP is requested, install it separately with \`opencode plugin @tarquinen/opencode-dcp@latest --global\`.
|
|
112
|
+
</hiai-opencode-integration-primer>`
|
|
113
|
+
}
|
|
114
|
+
|
|
79
115
|
export function buildResearcherSection(agents: AvailableAgent[]): string {
|
|
80
116
|
const researcherAgent = agents.find((agent) => agent.name === "researcher")
|
|
81
117
|
if (!researcherAgent) {
|