newtype-profile 1.0.42 → 1.0.43
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/README.md +27 -0
- package/README.zh-cn.md +27 -0
- package/dist/cli/index.js +4 -3
- package/dist/config/schema.d.ts +5 -3
- package/dist/features/builtin-commands/templates/configure-models.d.ts +1 -0
- package/dist/features/builtin-commands/types.d.ts +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/startup-config-checker/constants.d.ts +7 -0
- package/dist/hooks/startup-config-checker/index.d.ts +18 -0
- package/dist/hooks/startup-config-checker/index.test.d.ts +1 -0
- package/dist/hooks/startup-config-checker/types.d.ts +24 -0
- package/dist/hooks/startup-config-checker/utils.d.ts +8 -0
- package/dist/index.js +326 -38
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -356,6 +356,33 @@ Use `/memory-consolidate` to manually trigger memory consolidation (normally aut
|
|
|
356
356
|
}
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
+
## Startup Config Checker (v1.0.43+)
|
|
360
|
+
|
|
361
|
+
On first startup, newtype-profile automatically checks your agent model configuration and guides you through setup if needed.
|
|
362
|
+
|
|
363
|
+
### How It Works
|
|
364
|
+
|
|
365
|
+
1. **Auto-detect**: When OpenCode starts, the plugin checks if agents have model configurations
|
|
366
|
+
2. **Smart Fallback**: If no explicit config exists but OpenCode has a default model, all agents use that model
|
|
367
|
+
3. **Interactive Setup**: If configuration is missing, Chief will ask how you want to proceed:
|
|
368
|
+
- **Auto-configure**: Let Chief set up models based on available providers
|
|
369
|
+
- **Manual configure**: Get the config file path to edit yourself
|
|
370
|
+
- **Skip**: Use current configuration (may use OpenCode default model)
|
|
371
|
+
|
|
372
|
+
### Configuration Status
|
|
373
|
+
|
|
374
|
+
The plugin distinguishes between:
|
|
375
|
+
- **Critical agents** (chief, deputy): Must have a model to function
|
|
376
|
+
- **Specialist agents** (researcher, writer, etc.): Can use OpenCode default model
|
|
377
|
+
|
|
378
|
+
### Disable Startup Check
|
|
379
|
+
|
|
380
|
+
```json
|
|
381
|
+
{
|
|
382
|
+
"disabled_hooks": ["startup-config-checker"]
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
359
386
|
## Switch Between Plugins
|
|
360
387
|
|
|
361
388
|
Use the `/switch` command to switch between OpenCode plugins:
|
package/README.zh-cn.md
CHANGED
|
@@ -356,6 +356,33 @@ newtype-profile 内置了跨会话记忆系统,自动保存重要信息:
|
|
|
356
356
|
}
|
|
357
357
|
```
|
|
358
358
|
|
|
359
|
+
## 启动配置检查 (v1.0.43+)
|
|
360
|
+
|
|
361
|
+
首次启动时,newtype-profile 会自动检查 Agent 模型配置,并在需要时引导你完成设置。
|
|
362
|
+
|
|
363
|
+
### 工作原理
|
|
364
|
+
|
|
365
|
+
1. **自动检测**:OpenCode 启动时,插件检查各 Agent 是否有模型配置
|
|
366
|
+
2. **智能回退**:如果没有显式配置但 OpenCode 有默认模型,所有 Agent 使用该默认模型
|
|
367
|
+
3. **交互式设置**:如果配置缺失,Chief 会询问你想如何处理:
|
|
368
|
+
- **自动配置**:让 Chief 根据可用的 Provider 自动设置模型
|
|
369
|
+
- **手动配置**:获取配置文件路径,自己编辑
|
|
370
|
+
- **跳过**:使用当前配置(可能使用 OpenCode 默认模型)
|
|
371
|
+
|
|
372
|
+
### 配置状态
|
|
373
|
+
|
|
374
|
+
插件区分:
|
|
375
|
+
- **核心 Agent**(chief, deputy):必须有模型才能工作
|
|
376
|
+
- **专业 Agent**(researcher, writer 等):可以使用 OpenCode 默认模型
|
|
377
|
+
|
|
378
|
+
### 禁用启动检查
|
|
379
|
+
|
|
380
|
+
```json
|
|
381
|
+
{
|
|
382
|
+
"disabled_hooks": ["startup-config-checker"]
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
359
386
|
## 插件切换
|
|
360
387
|
|
|
361
388
|
使用 `/switch` 命令在 OpenCode 插件之间切换:
|
package/dist/cli/index.js
CHANGED
|
@@ -2253,7 +2253,7 @@ var require_picocolors = __commonJS((exports, module) => {
|
|
|
2253
2253
|
var require_package = __commonJS((exports, module) => {
|
|
2254
2254
|
module.exports = {
|
|
2255
2255
|
name: "newtype-profile",
|
|
2256
|
-
version: "1.0.
|
|
2256
|
+
version: "1.0.43",
|
|
2257
2257
|
description: "AI Agent Collaboration System for Content Creation - Based on oh-my-opencode",
|
|
2258
2258
|
main: "dist/index.js",
|
|
2259
2259
|
types: "dist/index.d.ts",
|
|
@@ -22224,7 +22224,8 @@ var HookNameSchema = exports_external.enum([
|
|
|
22224
22224
|
"edit-error-recovery",
|
|
22225
22225
|
"prometheus-md-only",
|
|
22226
22226
|
"chief-orchestrator",
|
|
22227
|
-
"memory-system"
|
|
22227
|
+
"memory-system",
|
|
22228
|
+
"startup-config-checker"
|
|
22228
22229
|
]);
|
|
22229
22230
|
var BuiltinCommandNameSchema = exports_external.enum([
|
|
22230
22231
|
"init-deep",
|
|
@@ -22271,7 +22272,7 @@ var ChiefAgentConfigSchema = exports_external.object({
|
|
|
22271
22272
|
disabled: exports_external.boolean().optional()
|
|
22272
22273
|
});
|
|
22273
22274
|
var CategoryConfigSchema = exports_external.object({
|
|
22274
|
-
model: exports_external.string(),
|
|
22275
|
+
model: exports_external.string().optional(),
|
|
22275
22276
|
temperature: exports_external.number().min(0).max(2).optional(),
|
|
22276
22277
|
top_p: exports_external.number().min(0).max(1).optional(),
|
|
22277
22278
|
maxTokens: exports_external.number().optional(),
|
package/dist/config/schema.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export declare const HookNameSchema: z.ZodEnum<{
|
|
|
66
66
|
"prometheus-md-only": "prometheus-md-only";
|
|
67
67
|
"chief-orchestrator": "chief-orchestrator";
|
|
68
68
|
"memory-system": "memory-system";
|
|
69
|
+
"startup-config-checker": "startup-config-checker";
|
|
69
70
|
}>;
|
|
70
71
|
export declare const BuiltinCommandNameSchema: z.ZodEnum<{
|
|
71
72
|
"ralph-loop": "ralph-loop";
|
|
@@ -578,7 +579,7 @@ export declare const ChiefAgentConfigSchema: z.ZodObject<{
|
|
|
578
579
|
disabled: z.ZodOptional<z.ZodBoolean>;
|
|
579
580
|
}, z.core.$strip>;
|
|
580
581
|
export declare const CategoryConfigSchema: z.ZodObject<{
|
|
581
|
-
model: z.ZodString
|
|
582
|
+
model: z.ZodOptional<z.ZodString>;
|
|
582
583
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
583
584
|
top_p: z.ZodOptional<z.ZodNumber>;
|
|
584
585
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -612,7 +613,7 @@ export declare const BuiltinCategoryNameSchema: z.ZodEnum<{
|
|
|
612
613
|
general: "general";
|
|
613
614
|
}>;
|
|
614
615
|
export declare const CategoriesConfigSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
615
|
-
model: z.ZodString
|
|
616
|
+
model: z.ZodOptional<z.ZodString>;
|
|
616
617
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
617
618
|
top_p: z.ZodOptional<z.ZodNumber>;
|
|
618
619
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -885,6 +886,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
885
886
|
"prometheus-md-only": "prometheus-md-only";
|
|
886
887
|
"chief-orchestrator": "chief-orchestrator";
|
|
887
888
|
"memory-system": "memory-system";
|
|
889
|
+
"startup-config-checker": "startup-config-checker";
|
|
888
890
|
}>>>;
|
|
889
891
|
disabled_commands: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
890
892
|
"ralph-loop": "ralph-loop";
|
|
@@ -1336,7 +1338,7 @@ export declare const OhMyOpenCodeConfigSchema: z.ZodObject<{
|
|
|
1336
1338
|
}, z.core.$strip>>;
|
|
1337
1339
|
}, z.core.$strip>>;
|
|
1338
1340
|
categories: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
1339
|
-
model: z.ZodString
|
|
1341
|
+
model: z.ZodOptional<z.ZodString>;
|
|
1340
1342
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
1341
1343
|
top_p: z.ZodOptional<z.ZodNumber>;
|
|
1342
1344
|
maxTokens: z.ZodOptional<z.ZodNumber>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CONFIGURE_MODELS_TEMPLATE = "# /configure-models \u547D\u4EE4\n\n\u4F60\u662F Chief\uFF0C\u6B63\u5728\u5E2E\u52A9\u7528\u6237\u914D\u7F6E Agent \u6A21\u578B\u3002\n\n## \u4F60\u7684\u4EFB\u52A1\n\n1. **\u68C0\u67E5\u5F53\u524D\u914D\u7F6E\u72B6\u6001**\n - \u8BFB\u53D6\u7528\u6237\u914D\u7F6E\u6587\u4EF6\uFF1A`~/.config/opencode/newtype-profile.json`\n - \u5982\u679C\u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u8BF4\u660E\u662F\u5168\u65B0\u5B89\u88C5\n\n2. **\u68C0\u67E5\u53EF\u7528\u7684 Provider**\n - \u901A\u8FC7 OpenCode API \u83B7\u53D6\u5DF2\u8BA4\u8BC1\u7684 Provider \u5217\u8868\n - \u8BB0\u5F55\u6BCF\u4E2A Provider \u652F\u6301\u7684\u6A21\u578B\n\n3. **\u63A8\u8350\u6A21\u578B\u914D\u7F6E**\n \u6839\u636E\u7528\u6237\u7684 Provider \u60C5\u51B5\uFF0C\u63A8\u8350\u6700\u4F73\u914D\u7F6E\uFF1A\n\n **\u5982\u679C\u6709 Google Antigravity (gemini)\uFF1A**\n - Chief: google/antigravity-claude-opus-4-5-thinking-high\n - Deputy: google/antigravity-claude-sonnet-4-5\n - Researcher/Writer: google/antigravity-gemini-3-pro-high\n - Editor/Archivist: google/antigravity-claude-sonnet-4-5\n - Extractor: google/antigravity-gemini-3-flash\n\n **\u5982\u679C\u6709 Anthropic\uFF1A**\n - Chief: anthropic/claude-opus-4-5\n - Deputy: anthropic/claude-sonnet-4-5\n - \u5176\u4ED6 Agents: anthropic/claude-sonnet-4-5\n\n **\u5982\u679C\u6709 OpenAI\uFF1A**\n - Chief: openai/gpt-5.2\n - \u5176\u4ED6 Agents: openai/gpt-4.1\n\n **\u5982\u679C\u6CA1\u6709\u4EFB\u4F55 Provider\uFF1A**\n - \u63D0\u793A\u7528\u6237\u9700\u8981\u5148\u914D\u7F6E Provider\n - \u6307\u5F15\u7528\u6237\u8FD0\u884C `opencode auth login`\n\n4. **\u751F\u6210\u914D\u7F6E\u6587\u4EF6**\n \u914D\u7F6E\u6587\u4EF6\u683C\u5F0F\uFF1A\n ```json\n {\n \"google_auth\": true, // \u5982\u679C\u4F7F\u7528 Antigravity\n \"agents\": {\n \"chief\": { \"model\": \"...\" },\n \"deputy\": { \"model\": \"...\" },\n \"researcher\": { \"model\": \"...\" },\n \"fact-checker\": { \"model\": \"...\" },\n \"archivist\": { \"model\": \"...\" },\n \"extractor\": { \"model\": \"...\" },\n \"writer\": { \"model\": \"...\" },\n \"editor\": { \"model\": \"...\" }\n }\n }\n ```\n\n5. **\u6267\u884C\u914D\u7F6E**\n - \u901A\u8FC7 Deputy \u5C06\u914D\u7F6E\u5199\u5165\u6587\u4EF6\n - \u914D\u7F6E\u8DEF\u5F84\uFF1A`~/.config/opencode/newtype-profile.json`\n\n6. **\u63D0\u793A\u7528\u6237**\n - \u914D\u7F6E\u5B8C\u6210\u540E\uFF0C\u63D0\u793A\u7528\u6237\u91CD\u542F OpenCode \u4EE5\u4F7F\u914D\u7F6E\u751F\u6548\n - \u7B80\u8981\u8BF4\u660E\u914D\u7F6E\u4E86\u54EA\u4E9B\u6A21\u578B\n\n## \u6CE8\u610F\u4E8B\u9879\n\n- \u4E0D\u8981\u8986\u76D6\u7528\u6237\u5DF2\u6709\u7684\u5176\u4ED6\u914D\u7F6E\uFF08\u5982 mcp\u3001disabled_hooks \u7B49\uFF09\n- \u4F7F\u7528 `read` \u5DE5\u5177\u5148\u8BFB\u53D6\u73B0\u6709\u914D\u7F6E\uFF0C\u7136\u540E\u5408\u5E76\u65B0\u914D\u7F6E\n- \u4F7F\u7528 `chief_task(subagent_type=\"deputy\", ...)` \u59D4\u6D3E\u6587\u4EF6\u5199\u5165\u64CD\u4F5C\n";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CommandDefinition } from "../claude-code-command-loader";
|
|
2
|
-
export type BuiltinCommandName = "init-deep" | "ralph-loop" | "cancel-ralph" | "switch" | "super-analyst" | "super-writer" | "memory-consolidate";
|
|
2
|
+
export type BuiltinCommandName = "init-deep" | "ralph-loop" | "cancel-ralph" | "switch" | "super-analyst" | "super-writer" | "memory-consolidate" | "configure-models";
|
|
3
3
|
export interface BuiltinCommandConfig {
|
|
4
4
|
disabled_commands?: BuiltinCommandName[];
|
|
5
5
|
}
|
package/dist/hooks/index.d.ts
CHANGED
|
@@ -28,3 +28,4 @@ export { createPrometheusMdOnlyHook } from "./prometheus-md-only";
|
|
|
28
28
|
export { createTaskResumeInfoHook } from "./task-resume-info";
|
|
29
29
|
export { createChiefOrchestratorHook } from "./chief-orchestrator";
|
|
30
30
|
export { createMemorySystemHook } from "./memory-system";
|
|
31
|
+
export { createStartupConfigCheckerHook } from "./startup-config-checker";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const HOOK_NAME = "startup-config-checker";
|
|
2
|
+
export declare const CRITICAL_AGENTS: readonly ["chief", "deputy"];
|
|
3
|
+
export type CriticalAgent = (typeof CRITICAL_AGENTS)[number];
|
|
4
|
+
export declare const ALL_AGENTS: readonly ["chief", "deputy", "researcher", "fact-checker", "archivist", "extractor", "writer", "editor"];
|
|
5
|
+
export type AgentName = (typeof ALL_AGENTS)[number];
|
|
6
|
+
export declare const CONFIG_FILE_PATH = "~/.config/opencode/newtype-profile.json";
|
|
7
|
+
export declare const FIRST_RUN_MARKER_KEY = "startup-config-checker:first-run-prompted";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { OhMyOpenCodeConfig } from "../../config";
|
|
3
|
+
import type { StartupConfigCheckerOptions } from "./types";
|
|
4
|
+
import { HOOK_NAME } from "./constants";
|
|
5
|
+
export declare function createStartupConfigCheckerHook(ctx: PluginInput, pluginConfig: OhMyOpenCodeConfig, options?: StartupConfigCheckerOptions): {
|
|
6
|
+
event: ({ event }: {
|
|
7
|
+
event: {
|
|
8
|
+
type: string;
|
|
9
|
+
properties?: unknown;
|
|
10
|
+
};
|
|
11
|
+
}) => Promise<void>;
|
|
12
|
+
"experimental.chat.system.transform": (input: {
|
|
13
|
+
sessionID?: string;
|
|
14
|
+
}, output: {
|
|
15
|
+
system: string[];
|
|
16
|
+
}) => Promise<void>;
|
|
17
|
+
};
|
|
18
|
+
export { HOOK_NAME };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AgentName } from "./constants";
|
|
2
|
+
export interface AgentModelStatus {
|
|
3
|
+
name: AgentName;
|
|
4
|
+
configured: boolean;
|
|
5
|
+
model?: string;
|
|
6
|
+
source: "user-config" | "opencode-default" | "none";
|
|
7
|
+
}
|
|
8
|
+
export interface ProviderStatus {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
authenticated: boolean;
|
|
12
|
+
models: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ConfigCheckResult {
|
|
15
|
+
criticalAgentsReady: boolean;
|
|
16
|
+
agentStatuses: AgentModelStatus[];
|
|
17
|
+
providers: ProviderStatus[];
|
|
18
|
+
hasAnyProvider: boolean;
|
|
19
|
+
needsUserAction: boolean;
|
|
20
|
+
firstRun: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface StartupConfigCheckerOptions {
|
|
23
|
+
skipFirstRunCheck?: boolean;
|
|
24
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PluginInput } from "@opencode-ai/plugin";
|
|
2
|
+
import type { AgentModelStatus, ProviderStatus, ConfigCheckResult } from "./types";
|
|
3
|
+
import type { OhMyOpenCodeConfig } from "../../config";
|
|
4
|
+
export declare function checkAgentModelStatus(pluginConfig: OhMyOpenCodeConfig, opencodeDefaultModel: string | undefined): Promise<AgentModelStatus[]>;
|
|
5
|
+
export declare function checkProviderStatus(client: PluginInput["client"]): Promise<ProviderStatus[]>;
|
|
6
|
+
export declare function checkCriticalAgentsReady(agentStatuses: AgentModelStatus[]): boolean;
|
|
7
|
+
export declare function generateConfigStatusMessage(result: ConfigCheckResult): string;
|
|
8
|
+
export declare function generateUserPrompt(result: ConfigCheckResult): string;
|
package/dist/index.js
CHANGED
|
@@ -24723,6 +24723,222 @@ function createMemorySystemHook(ctx) {
|
|
|
24723
24723
|
}
|
|
24724
24724
|
};
|
|
24725
24725
|
}
|
|
24726
|
+
// src/hooks/startup-config-checker/constants.ts
|
|
24727
|
+
var HOOK_NAME7 = "startup-config-checker";
|
|
24728
|
+
var CRITICAL_AGENTS = ["chief", "deputy"];
|
|
24729
|
+
var ALL_AGENTS = [
|
|
24730
|
+
"chief",
|
|
24731
|
+
"deputy",
|
|
24732
|
+
"researcher",
|
|
24733
|
+
"fact-checker",
|
|
24734
|
+
"archivist",
|
|
24735
|
+
"extractor",
|
|
24736
|
+
"writer",
|
|
24737
|
+
"editor"
|
|
24738
|
+
];
|
|
24739
|
+
|
|
24740
|
+
// src/hooks/startup-config-checker/utils.ts
|
|
24741
|
+
async function checkAgentModelStatus(pluginConfig, opencodeDefaultModel) {
|
|
24742
|
+
const results = [];
|
|
24743
|
+
for (const agentName of ALL_AGENTS) {
|
|
24744
|
+
const agentConfig = pluginConfig.agents?.[agentName];
|
|
24745
|
+
const configuredModel = agentConfig?.model;
|
|
24746
|
+
let status;
|
|
24747
|
+
if (configuredModel) {
|
|
24748
|
+
status = {
|
|
24749
|
+
name: agentName,
|
|
24750
|
+
configured: true,
|
|
24751
|
+
model: configuredModel,
|
|
24752
|
+
source: "user-config"
|
|
24753
|
+
};
|
|
24754
|
+
} else if (opencodeDefaultModel) {
|
|
24755
|
+
status = {
|
|
24756
|
+
name: agentName,
|
|
24757
|
+
configured: true,
|
|
24758
|
+
model: opencodeDefaultModel,
|
|
24759
|
+
source: "opencode-default"
|
|
24760
|
+
};
|
|
24761
|
+
} else {
|
|
24762
|
+
status = {
|
|
24763
|
+
name: agentName,
|
|
24764
|
+
configured: false,
|
|
24765
|
+
source: "none"
|
|
24766
|
+
};
|
|
24767
|
+
}
|
|
24768
|
+
results.push(status);
|
|
24769
|
+
}
|
|
24770
|
+
return results;
|
|
24771
|
+
}
|
|
24772
|
+
async function checkProviderStatus(client) {
|
|
24773
|
+
const results = [];
|
|
24774
|
+
try {
|
|
24775
|
+
const providersResponse = await client.config.providers();
|
|
24776
|
+
const responseData = providersResponse.data;
|
|
24777
|
+
const providers = responseData?.providers ?? [];
|
|
24778
|
+
for (const provider of providers) {
|
|
24779
|
+
const modelIds = provider.models ? Object.keys(provider.models) : [];
|
|
24780
|
+
const providerInfo = {
|
|
24781
|
+
id: provider.id,
|
|
24782
|
+
name: provider.name ?? provider.id,
|
|
24783
|
+
authenticated: provider.key !== undefined,
|
|
24784
|
+
models: modelIds
|
|
24785
|
+
};
|
|
24786
|
+
results.push(providerInfo);
|
|
24787
|
+
}
|
|
24788
|
+
} catch (error) {
|
|
24789
|
+
log(`[startup-config-checker] Failed to fetch providers:`, error);
|
|
24790
|
+
}
|
|
24791
|
+
return results;
|
|
24792
|
+
}
|
|
24793
|
+
function checkCriticalAgentsReady(agentStatuses) {
|
|
24794
|
+
for (const criticalAgent of CRITICAL_AGENTS) {
|
|
24795
|
+
const status = agentStatuses.find((s) => s.name === criticalAgent);
|
|
24796
|
+
if (!status?.configured) {
|
|
24797
|
+
return false;
|
|
24798
|
+
}
|
|
24799
|
+
}
|
|
24800
|
+
return true;
|
|
24801
|
+
}
|
|
24802
|
+
function generateConfigStatusMessage(result) {
|
|
24803
|
+
const lines = [];
|
|
24804
|
+
lines.push(`## Agent \u6A21\u578B\u914D\u7F6E\u72B6\u6001
|
|
24805
|
+
`);
|
|
24806
|
+
const criticalSection = [];
|
|
24807
|
+
const otherSection = [];
|
|
24808
|
+
for (const status of result.agentStatuses) {
|
|
24809
|
+
const isCritical = CRITICAL_AGENTS.includes(status.name);
|
|
24810
|
+
const icon = status.configured ? "\u2705" : "\u274C";
|
|
24811
|
+
const modelInfo = status.model ? `\`${status.model}\` (${status.source === "user-config" ? "\u7528\u6237\u914D\u7F6E" : "OpenCode \u9ED8\u8BA4"})` : "\u672A\u914D\u7F6E";
|
|
24812
|
+
const line = `- ${icon} **${status.name}**: ${modelInfo}`;
|
|
24813
|
+
if (isCritical) {
|
|
24814
|
+
criticalSection.push(line);
|
|
24815
|
+
} else {
|
|
24816
|
+
otherSection.push(line);
|
|
24817
|
+
}
|
|
24818
|
+
}
|
|
24819
|
+
if (criticalSection.length > 0) {
|
|
24820
|
+
lines.push("### \u6838\u5FC3 Agent\uFF08\u5FC5\u987B\uFF09");
|
|
24821
|
+
lines.push(...criticalSection);
|
|
24822
|
+
lines.push("");
|
|
24823
|
+
}
|
|
24824
|
+
if (otherSection.length > 0) {
|
|
24825
|
+
lines.push("### \u4E13\u4E1A Agent\uFF08\u53EF\u9009\uFF09");
|
|
24826
|
+
lines.push(...otherSection);
|
|
24827
|
+
lines.push("");
|
|
24828
|
+
}
|
|
24829
|
+
if (result.providers.length > 0) {
|
|
24830
|
+
lines.push(`## \u53EF\u7528\u7684\u6A21\u578B\u63D0\u4F9B\u5546
|
|
24831
|
+
`);
|
|
24832
|
+
for (const provider of result.providers) {
|
|
24833
|
+
const authIcon = provider.authenticated ? "\uD83D\uDD11" : "\uD83D\uDD12";
|
|
24834
|
+
const modelCount = provider.models.length;
|
|
24835
|
+
lines.push(`- ${authIcon} **${provider.name}**: ${modelCount} \u4E2A\u6A21\u578B${provider.authenticated ? "" : " (\u672A\u8BA4\u8BC1)"}`);
|
|
24836
|
+
}
|
|
24837
|
+
lines.push("");
|
|
24838
|
+
}
|
|
24839
|
+
return lines.join(`
|
|
24840
|
+
`);
|
|
24841
|
+
}
|
|
24842
|
+
function generateUserPrompt(result) {
|
|
24843
|
+
const statusMessage = generateConfigStatusMessage(result);
|
|
24844
|
+
const promptLines = [
|
|
24845
|
+
`[SYSTEM CONTEXT - \u9996\u6B21\u542F\u52A8\u914D\u7F6E\u68C0\u67E5]
|
|
24846
|
+
`,
|
|
24847
|
+
statusMessage
|
|
24848
|
+
];
|
|
24849
|
+
if (!result.criticalAgentsReady) {
|
|
24850
|
+
promptLines.push("\u26A0\uFE0F **\u8B66\u544A**: Chief \u548C Deputy \u6CA1\u6709\u53EF\u7528\u7684\u6A21\u578B\u914D\u7F6E\u3002");
|
|
24851
|
+
promptLines.push(`\u8FD9\u53EF\u80FD\u4F1A\u5BFC\u81F4\u65E0\u6CD5\u6B63\u5E38\u5DE5\u4F5C\u3002
|
|
24852
|
+
`);
|
|
24853
|
+
}
|
|
24854
|
+
promptLines.push("\u8BF7\u8BE2\u95EE\u7528\u6237\u60F3\u5982\u4F55\u5904\u7406\u6A21\u578B\u914D\u7F6E\uFF1A");
|
|
24855
|
+
promptLines.push("1. **\u81EA\u52A8\u914D\u7F6E** - \u4F60\u6839\u636E\u53EF\u7528\u7684 Provider \u81EA\u52A8\u51B3\u5B9A\u5E76\u914D\u7F6E");
|
|
24856
|
+
promptLines.push("2. **\u624B\u52A8\u914D\u7F6E** - \u544A\u8BC9\u7528\u6237\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84\uFF0C\u8BA9\u7528\u6237\u81EA\u5DF1\u7F16\u8F91");
|
|
24857
|
+
promptLines.push("3. **\u6682\u65F6\u8DF3\u8FC7** - \u4F7F\u7528\u5F53\u524D\u914D\u7F6E\u7EE7\u7EED\uFF08\u53EF\u80FD\u4F7F\u7528 OpenCode \u9ED8\u8BA4\u6A21\u578B\uFF09");
|
|
24858
|
+
promptLines.push("");
|
|
24859
|
+
promptLines.push("\u7528\u81EA\u7136\u3001\u53CB\u597D\u7684\u65B9\u5F0F\u5411\u7528\u6237\u8BF4\u660E\u60C5\u51B5\u5E76\u8BE2\u95EE\u3002");
|
|
24860
|
+
return promptLines.join(`
|
|
24861
|
+
`);
|
|
24862
|
+
}
|
|
24863
|
+
|
|
24864
|
+
// src/hooks/startup-config-checker/index.ts
|
|
24865
|
+
var sessionStates = new Map;
|
|
24866
|
+
function getOrCreateSessionState(sessionID) {
|
|
24867
|
+
let state2 = sessionStates.get(sessionID);
|
|
24868
|
+
if (!state2) {
|
|
24869
|
+
state2 = { hasPromptedThisSession: false };
|
|
24870
|
+
sessionStates.set(sessionID, state2);
|
|
24871
|
+
}
|
|
24872
|
+
return state2;
|
|
24873
|
+
}
|
|
24874
|
+
function createStartupConfigCheckerHook(ctx, pluginConfig, options = {}) {
|
|
24875
|
+
let configCheckResult = null;
|
|
24876
|
+
let hasCheckedThisInstance = false;
|
|
24877
|
+
const performConfigCheck = async (opencodeDefaultModel) => {
|
|
24878
|
+
const agentStatuses = await checkAgentModelStatus(pluginConfig, opencodeDefaultModel);
|
|
24879
|
+
const providers = await checkProviderStatus(ctx.client);
|
|
24880
|
+
const criticalAgentsReady = checkCriticalAgentsReady(agentStatuses);
|
|
24881
|
+
const hasAnyProvider = providers.some((p) => p.authenticated && p.models.length > 0);
|
|
24882
|
+
const unconfiguredAgents = agentStatuses.filter((s) => !s.configured);
|
|
24883
|
+
const needsUserAction = !criticalAgentsReady || unconfiguredAgents.length > 0;
|
|
24884
|
+
return {
|
|
24885
|
+
criticalAgentsReady,
|
|
24886
|
+
agentStatuses,
|
|
24887
|
+
providers,
|
|
24888
|
+
hasAnyProvider,
|
|
24889
|
+
needsUserAction,
|
|
24890
|
+
firstRun: !options.skipFirstRunCheck
|
|
24891
|
+
};
|
|
24892
|
+
};
|
|
24893
|
+
return {
|
|
24894
|
+
event: async ({ event }) => {
|
|
24895
|
+
if (event.type !== "session.created")
|
|
24896
|
+
return;
|
|
24897
|
+
if (hasCheckedThisInstance)
|
|
24898
|
+
return;
|
|
24899
|
+
const props = event.properties;
|
|
24900
|
+
if (props?.info?.parentID)
|
|
24901
|
+
return;
|
|
24902
|
+
hasCheckedThisInstance = true;
|
|
24903
|
+
try {
|
|
24904
|
+
const configResponse = await ctx.client.config.get();
|
|
24905
|
+
const opencodeDefaultModel = configResponse.data?.model;
|
|
24906
|
+
configCheckResult = await performConfigCheck(opencodeDefaultModel);
|
|
24907
|
+
log(`[${HOOK_NAME7}] Config check result:`, {
|
|
24908
|
+
criticalAgentsReady: configCheckResult.criticalAgentsReady,
|
|
24909
|
+
providersCount: configCheckResult.providers.length,
|
|
24910
|
+
needsUserAction: configCheckResult.needsUserAction
|
|
24911
|
+
});
|
|
24912
|
+
if (configCheckResult.needsUserAction) {
|
|
24913
|
+
await ctx.client.tui.showToast({
|
|
24914
|
+
body: {
|
|
24915
|
+
title: "Agent \u914D\u7F6E\u68C0\u67E5",
|
|
24916
|
+
message: configCheckResult.criticalAgentsReady ? "\u90E8\u5206 Agent \u672A\u914D\u7F6E\u6A21\u578B\uFF0C\u5C06\u4F7F\u7528\u9ED8\u8BA4\u914D\u7F6E" : "Chief/Deputy \u672A\u914D\u7F6E\u6A21\u578B\uFF0C\u53EF\u80FD\u5F71\u54CD\u4F7F\u7528",
|
|
24917
|
+
variant: configCheckResult.criticalAgentsReady ? "info" : "warning",
|
|
24918
|
+
duration: 5000
|
|
24919
|
+
}
|
|
24920
|
+
});
|
|
24921
|
+
}
|
|
24922
|
+
} catch (error) {
|
|
24923
|
+
log(`[${HOOK_NAME7}] Error during config check:`, error);
|
|
24924
|
+
}
|
|
24925
|
+
},
|
|
24926
|
+
"experimental.chat.system.transform": async (input, output) => {
|
|
24927
|
+
if (!configCheckResult?.needsUserAction)
|
|
24928
|
+
return;
|
|
24929
|
+
const sessionID = input.sessionID;
|
|
24930
|
+
if (!sessionID)
|
|
24931
|
+
return;
|
|
24932
|
+
const state2 = getOrCreateSessionState(sessionID);
|
|
24933
|
+
if (state2.hasPromptedThisSession)
|
|
24934
|
+
return;
|
|
24935
|
+
state2.hasPromptedThisSession = true;
|
|
24936
|
+
const userPrompt = generateUserPrompt(configCheckResult);
|
|
24937
|
+
output.system.push(userPrompt);
|
|
24938
|
+
log(`[${HOOK_NAME7}] Injected config check prompt for session:`, sessionID);
|
|
24939
|
+
}
|
|
24940
|
+
};
|
|
24941
|
+
}
|
|
24726
24942
|
// src/features/context-injector/collector.ts
|
|
24727
24943
|
var PRIORITY_ORDER = {
|
|
24728
24944
|
critical: 0,
|
|
@@ -45613,31 +45829,24 @@ Approach:
|
|
|
45613
45829
|
</Category_Context>`;
|
|
45614
45830
|
var DEFAULT_CATEGORIES = {
|
|
45615
45831
|
research: {
|
|
45616
|
-
model: "google/antigravity-gemini-3-flash",
|
|
45617
45832
|
temperature: 0.5
|
|
45618
45833
|
},
|
|
45619
45834
|
"fact-check": {
|
|
45620
|
-
model: "google/antigravity-gemini-3-flash",
|
|
45621
45835
|
temperature: 0.2
|
|
45622
45836
|
},
|
|
45623
45837
|
archive: {
|
|
45624
|
-
model: "google/antigravity-claude-sonnet-4-5",
|
|
45625
45838
|
temperature: 0.3
|
|
45626
45839
|
},
|
|
45627
45840
|
writing: {
|
|
45628
|
-
model: "google/antigravity-gemini-3-pro-high",
|
|
45629
45841
|
temperature: 0.7
|
|
45630
45842
|
},
|
|
45631
45843
|
editing: {
|
|
45632
|
-
model: "google/antigravity-claude-sonnet-4-5",
|
|
45633
45844
|
temperature: 0.3
|
|
45634
45845
|
},
|
|
45635
45846
|
extraction: {
|
|
45636
|
-
model: "google/antigravity-gemini-3-flash",
|
|
45637
45847
|
temperature: 0.2
|
|
45638
45848
|
},
|
|
45639
45849
|
quick: {
|
|
45640
|
-
model: "google/antigravity-gemini-3-flash",
|
|
45641
45850
|
temperature: 0.3
|
|
45642
45851
|
}
|
|
45643
45852
|
};
|
|
@@ -46126,7 +46335,7 @@ function resolveCategoryConfig(categoryName, userCategories) {
|
|
|
46126
46335
|
const config3 = {
|
|
46127
46336
|
...defaultConfig,
|
|
46128
46337
|
...userConfig,
|
|
46129
|
-
model: userConfig?.model ?? defaultConfig?.model
|
|
46338
|
+
model: userConfig?.model ?? defaultConfig?.model
|
|
46130
46339
|
};
|
|
46131
46340
|
let promptAppend = defaultPromptAppend;
|
|
46132
46341
|
if (userConfig?.prompt_append) {
|
|
@@ -46299,7 +46508,7 @@ ${textContent || "(No text output)"}`;
|
|
|
46299
46508
|
return `\u274C Unknown category: "${args.category}". Available: ${Object.keys({ ...DEFAULT_CATEGORIES, ...userCategories }).join(", ")}`;
|
|
46300
46509
|
}
|
|
46301
46510
|
agentToUse = DEPUTY_AGENT;
|
|
46302
|
-
categoryModel = parseModelString(resolved.config.model);
|
|
46511
|
+
categoryModel = resolved.config.model ? parseModelString(resolved.config.model) : undefined;
|
|
46303
46512
|
categoryPromptAppend = resolved.promptAppend || undefined;
|
|
46304
46513
|
} else {
|
|
46305
46514
|
agentToUse = args.subagent_type.trim();
|
|
@@ -49943,7 +50152,8 @@ var HookNameSchema = exports_external.enum([
|
|
|
49943
50152
|
"edit-error-recovery",
|
|
49944
50153
|
"prometheus-md-only",
|
|
49945
50154
|
"chief-orchestrator",
|
|
49946
|
-
"memory-system"
|
|
50155
|
+
"memory-system",
|
|
50156
|
+
"startup-config-checker"
|
|
49947
50157
|
]);
|
|
49948
50158
|
var BuiltinCommandNameSchema = exports_external.enum([
|
|
49949
50159
|
"init-deep",
|
|
@@ -49990,7 +50200,7 @@ var ChiefAgentConfigSchema = exports_external.object({
|
|
|
49990
50200
|
disabled: exports_external.boolean().optional()
|
|
49991
50201
|
});
|
|
49992
50202
|
var CategoryConfigSchema = exports_external.object({
|
|
49993
|
-
model: exports_external.string(),
|
|
50203
|
+
model: exports_external.string().optional(),
|
|
49994
50204
|
temperature: exports_external.number().min(0).max(2).optional(),
|
|
49995
50205
|
top_p: exports_external.number().min(0).max(1).optional(),
|
|
49996
50206
|
maxTokens: exports_external.number().optional(),
|
|
@@ -50259,7 +50469,6 @@ function getModelLimit(state2, providerID, modelID) {
|
|
|
50259
50469
|
}
|
|
50260
50470
|
|
|
50261
50471
|
// src/agents/chief.ts
|
|
50262
|
-
var DEFAULT_MODEL = "anthropic/claude-opus-4-5";
|
|
50263
50472
|
var CHIEF_ALLOWED_TOOLS = [
|
|
50264
50473
|
"chief_task",
|
|
50265
50474
|
"todowrite",
|
|
@@ -50285,7 +50494,7 @@ var CHIEF_ALLOWED_TOOLS = [
|
|
|
50285
50494
|
"skill",
|
|
50286
50495
|
"slashcommand"
|
|
50287
50496
|
];
|
|
50288
|
-
function createChiefAgent(model
|
|
50497
|
+
function createChiefAgent(model) {
|
|
50289
50498
|
const baseRestrictions = createAgentToolAllowlist(CHIEF_ALLOWED_TOOLS);
|
|
50290
50499
|
const mergedConfig = migrateAgentConfig({
|
|
50291
50500
|
...baseRestrictions
|
|
@@ -50534,7 +50743,7 @@ When analyzing problems:
|
|
|
50534
50743
|
return {
|
|
50535
50744
|
description: "Chief - thought partner for exploration, coordinator for execution. Opinionated, direct, challenges flawed thinking.",
|
|
50536
50745
|
mode: "primary",
|
|
50537
|
-
model,
|
|
50746
|
+
...model ? { model } : {},
|
|
50538
50747
|
temperature: 0.3,
|
|
50539
50748
|
prompt,
|
|
50540
50749
|
...mergedConfig
|
|
@@ -50543,8 +50752,7 @@ When analyzing problems:
|
|
|
50543
50752
|
var chiefAgent = createChiefAgent();
|
|
50544
50753
|
|
|
50545
50754
|
// src/agents/researcher.ts
|
|
50546
|
-
|
|
50547
|
-
function createResearcherAgent(model = DEFAULT_MODEL2) {
|
|
50755
|
+
function createResearcherAgent(model) {
|
|
50548
50756
|
const restrictions = createAgentToolRestrictions([
|
|
50549
50757
|
"write",
|
|
50550
50758
|
"edit"
|
|
@@ -50552,7 +50760,7 @@ function createResearcherAgent(model = DEFAULT_MODEL2) {
|
|
|
50552
50760
|
return {
|
|
50553
50761
|
description: "External intelligence gatherer. Searches broadly, synthesizes findings, and delivers actionable intelligence. Use for trends, competitive analysis, and discovering new information.",
|
|
50554
50762
|
mode: "subagent",
|
|
50555
|
-
model,
|
|
50763
|
+
...model ? { model } : {},
|
|
50556
50764
|
temperature: 0.3,
|
|
50557
50765
|
...restrictions,
|
|
50558
50766
|
prompt: `<Role>
|
|
@@ -50641,8 +50849,7 @@ This enables Writer to cite your sources and Fact-Checker to verify your finding
|
|
|
50641
50849
|
var researcherAgent = createResearcherAgent();
|
|
50642
50850
|
|
|
50643
50851
|
// src/agents/fact-checker.ts
|
|
50644
|
-
|
|
50645
|
-
function createFactCheckerAgent(model = DEFAULT_MODEL3) {
|
|
50852
|
+
function createFactCheckerAgent(model) {
|
|
50646
50853
|
const restrictions = createAgentToolRestrictions([
|
|
50647
50854
|
"write",
|
|
50648
50855
|
"edit"
|
|
@@ -50650,7 +50857,7 @@ function createFactCheckerAgent(model = DEFAULT_MODEL3) {
|
|
|
50650
50857
|
return {
|
|
50651
50858
|
description: "Verification specialist ensuring content accuracy. Verifies claims, traces sources, assesses credibility. Skeptical by default, evidence-driven. Read-only on content.",
|
|
50652
50859
|
mode: "subagent",
|
|
50653
|
-
model,
|
|
50860
|
+
...model ? { model } : {},
|
|
50654
50861
|
temperature: 0.1,
|
|
50655
50862
|
...restrictions,
|
|
50656
50863
|
prompt: `<Role>
|
|
@@ -50744,8 +50951,7 @@ This enables Editor to fix issues and Writer to avoid similar mistakes.
|
|
|
50744
50951
|
var factCheckerAgent = createFactCheckerAgent();
|
|
50745
50952
|
|
|
50746
50953
|
// src/agents/archivist.ts
|
|
50747
|
-
|
|
50748
|
-
function createArchivistAgent(model = DEFAULT_MODEL4) {
|
|
50954
|
+
function createArchivistAgent(model) {
|
|
50749
50955
|
const restrictions = createAgentToolRestrictions([
|
|
50750
50956
|
"bash",
|
|
50751
50957
|
"webfetch"
|
|
@@ -50753,7 +50959,7 @@ function createArchivistAgent(model = DEFAULT_MODEL4) {
|
|
|
50753
50959
|
return {
|
|
50754
50960
|
description: "Knowledge base specialist with exceptional pattern recognition. Finds relevant materials, discovers hidden connections, and organizes assets. Thinks in links and associations.",
|
|
50755
50961
|
mode: "subagent",
|
|
50756
|
-
model,
|
|
50962
|
+
...model ? { model } : {},
|
|
50757
50963
|
temperature: 0.3,
|
|
50758
50964
|
...restrictions,
|
|
50759
50965
|
prompt: `<Role>
|
|
@@ -50859,8 +51065,7 @@ This enables Writer to build on existing materials and avoid duplication.
|
|
|
50859
51065
|
var archivistAgent = createArchivistAgent();
|
|
50860
51066
|
|
|
50861
51067
|
// src/agents/extractor.ts
|
|
50862
|
-
|
|
50863
|
-
function createExtractorAgent(model = DEFAULT_MODEL5) {
|
|
51068
|
+
function createExtractorAgent(model) {
|
|
50864
51069
|
const restrictions = createAgentToolRestrictions([
|
|
50865
51070
|
"write",
|
|
50866
51071
|
"edit",
|
|
@@ -50869,7 +51074,7 @@ function createExtractorAgent(model = DEFAULT_MODEL5) {
|
|
|
50869
51074
|
return {
|
|
50870
51075
|
description: "Format processing specialist. Handles PDF, images, documents extraction and conversion. Extracts content accurately and presents it in clean, usable markdown format.",
|
|
50871
51076
|
mode: "subagent",
|
|
50872
|
-
model,
|
|
51077
|
+
...model ? { model } : {},
|
|
50873
51078
|
temperature: 0.1,
|
|
50874
51079
|
...restrictions,
|
|
50875
51080
|
prompt: `<Role>
|
|
@@ -50967,8 +51172,7 @@ This enables Writer and Researcher to use the extracted content.
|
|
|
50967
51172
|
var extractorAgent = createExtractorAgent();
|
|
50968
51173
|
|
|
50969
51174
|
// src/agents/writer.ts
|
|
50970
|
-
|
|
50971
|
-
function createWriterAgent(model = DEFAULT_MODEL6) {
|
|
51175
|
+
function createWriterAgent(model) {
|
|
50972
51176
|
const restrictions = createAgentToolRestrictions([
|
|
50973
51177
|
"bash",
|
|
50974
51178
|
"webfetch"
|
|
@@ -50976,7 +51180,7 @@ function createWriterAgent(model = DEFAULT_MODEL6) {
|
|
|
50976
51180
|
return {
|
|
50977
51181
|
description: "Content creator who transforms materials into drafts. Takes research, source materials, and briefs, then produces structured, engaging content. Focus on getting ideas onto the page with good structure.",
|
|
50978
51182
|
mode: "subagent",
|
|
50979
|
-
model,
|
|
51183
|
+
...model ? { model } : {},
|
|
50980
51184
|
temperature: 0.5,
|
|
50981
51185
|
...restrictions,
|
|
50982
51186
|
prompt: `<Role>
|
|
@@ -51065,8 +51269,7 @@ This enables Editor to refine your work and Fact-Checker to verify claims.
|
|
|
51065
51269
|
var writerAgent = createWriterAgent();
|
|
51066
51270
|
|
|
51067
51271
|
// src/agents/editor.ts
|
|
51068
|
-
|
|
51069
|
-
function createEditorAgent(model = DEFAULT_MODEL7) {
|
|
51272
|
+
function createEditorAgent(model) {
|
|
51070
51273
|
const restrictions = createAgentToolRestrictions([
|
|
51071
51274
|
"bash",
|
|
51072
51275
|
"webfetch"
|
|
@@ -51074,7 +51277,7 @@ function createEditorAgent(model = DEFAULT_MODEL7) {
|
|
|
51074
51277
|
return {
|
|
51075
51278
|
description: "Polish and refinement specialist. Improves clarity, strengthens logic, tightens language, ensures consistency. High standards and sharp eye for detail.",
|
|
51076
51279
|
mode: "subagent",
|
|
51077
|
-
model,
|
|
51280
|
+
...model ? { model } : {},
|
|
51078
51281
|
temperature: 0.2,
|
|
51079
51282
|
...restrictions,
|
|
51080
51283
|
prompt: `<Role>
|
|
@@ -51403,7 +51606,6 @@ function buildDeputyPrompt(promptAppend) {
|
|
|
51403
51606
|
var BLOCKED_TOOLS2 = ["task", "call_omo_agent"];
|
|
51404
51607
|
function createDeputyAgent(categoryConfig, promptAppend) {
|
|
51405
51608
|
const prompt = buildDeputyPrompt(promptAppend);
|
|
51406
|
-
const model = categoryConfig.model;
|
|
51407
51609
|
const baseRestrictions = createAgentToolRestrictions(BLOCKED_TOOLS2);
|
|
51408
51610
|
const mergedConfig = migrateAgentConfig({
|
|
51409
51611
|
...baseRestrictions,
|
|
@@ -51412,7 +51614,7 @@ function createDeputyAgent(categoryConfig, promptAppend) {
|
|
|
51412
51614
|
const base = {
|
|
51413
51615
|
description: "Deputy - \u526F\u4E3B\u7F16\uFF0C\u6267\u884C\u4E3B\u7F16\u59D4\u6D3E\u7684\u5177\u4F53\u4EFB\u52A1\uFF0C\u4E0D\u80FD\u518D\u59D4\u6D3E\u3002",
|
|
51414
51616
|
mode: "subagent",
|
|
51415
|
-
model,
|
|
51617
|
+
...categoryConfig.model ? { model: categoryConfig.model } : {},
|
|
51416
51618
|
maxTokens: categoryConfig.maxTokens ?? 64000,
|
|
51417
51619
|
prompt,
|
|
51418
51620
|
color: "#20B2AA",
|
|
@@ -51434,10 +51636,14 @@ function createDeputyAgent(categoryConfig, promptAppend) {
|
|
|
51434
51636
|
textVerbosity: categoryConfig.textVerbosity
|
|
51435
51637
|
};
|
|
51436
51638
|
}
|
|
51437
|
-
|
|
51639
|
+
const model = categoryConfig.model;
|
|
51640
|
+
if (model && isGptModel(model)) {
|
|
51438
51641
|
return { ...base, reasoningEffort: "medium" };
|
|
51439
51642
|
}
|
|
51440
|
-
if (model
|
|
51643
|
+
if (model?.startsWith("github-copilot/claude-")) {
|
|
51644
|
+
return base;
|
|
51645
|
+
}
|
|
51646
|
+
if (!model) {
|
|
51441
51647
|
return base;
|
|
51442
51648
|
}
|
|
51443
51649
|
return {
|
|
@@ -52109,6 +52315,77 @@ Check back after a few chat sessions.
|
|
|
52109
52315
|
- Use user's language (Chinese/English) based on existing content
|
|
52110
52316
|
`;
|
|
52111
52317
|
|
|
52318
|
+
// src/features/builtin-commands/templates/configure-models.ts
|
|
52319
|
+
var CONFIGURE_MODELS_TEMPLATE = `# /configure-models \u547D\u4EE4
|
|
52320
|
+
|
|
52321
|
+
\u4F60\u662F Chief\uFF0C\u6B63\u5728\u5E2E\u52A9\u7528\u6237\u914D\u7F6E Agent \u6A21\u578B\u3002
|
|
52322
|
+
|
|
52323
|
+
## \u4F60\u7684\u4EFB\u52A1
|
|
52324
|
+
|
|
52325
|
+
1. **\u68C0\u67E5\u5F53\u524D\u914D\u7F6E\u72B6\u6001**
|
|
52326
|
+
- \u8BFB\u53D6\u7528\u6237\u914D\u7F6E\u6587\u4EF6\uFF1A\`~/.config/opencode/newtype-profile.json\`
|
|
52327
|
+
- \u5982\u679C\u6587\u4EF6\u4E0D\u5B58\u5728\uFF0C\u8BF4\u660E\u662F\u5168\u65B0\u5B89\u88C5
|
|
52328
|
+
|
|
52329
|
+
2. **\u68C0\u67E5\u53EF\u7528\u7684 Provider**
|
|
52330
|
+
- \u901A\u8FC7 OpenCode API \u83B7\u53D6\u5DF2\u8BA4\u8BC1\u7684 Provider \u5217\u8868
|
|
52331
|
+
- \u8BB0\u5F55\u6BCF\u4E2A Provider \u652F\u6301\u7684\u6A21\u578B
|
|
52332
|
+
|
|
52333
|
+
3. **\u63A8\u8350\u6A21\u578B\u914D\u7F6E**
|
|
52334
|
+
\u6839\u636E\u7528\u6237\u7684 Provider \u60C5\u51B5\uFF0C\u63A8\u8350\u6700\u4F73\u914D\u7F6E\uFF1A
|
|
52335
|
+
|
|
52336
|
+
**\u5982\u679C\u6709 Google Antigravity (gemini)\uFF1A**
|
|
52337
|
+
- Chief: google/antigravity-claude-opus-4-5-thinking-high
|
|
52338
|
+
- Deputy: google/antigravity-claude-sonnet-4-5
|
|
52339
|
+
- Researcher/Writer: google/antigravity-gemini-3-pro-high
|
|
52340
|
+
- Editor/Archivist: google/antigravity-claude-sonnet-4-5
|
|
52341
|
+
- Extractor: google/antigravity-gemini-3-flash
|
|
52342
|
+
|
|
52343
|
+
**\u5982\u679C\u6709 Anthropic\uFF1A**
|
|
52344
|
+
- Chief: anthropic/claude-opus-4-5
|
|
52345
|
+
- Deputy: anthropic/claude-sonnet-4-5
|
|
52346
|
+
- \u5176\u4ED6 Agents: anthropic/claude-sonnet-4-5
|
|
52347
|
+
|
|
52348
|
+
**\u5982\u679C\u6709 OpenAI\uFF1A**
|
|
52349
|
+
- Chief: openai/gpt-5.2
|
|
52350
|
+
- \u5176\u4ED6 Agents: openai/gpt-4.1
|
|
52351
|
+
|
|
52352
|
+
**\u5982\u679C\u6CA1\u6709\u4EFB\u4F55 Provider\uFF1A**
|
|
52353
|
+
- \u63D0\u793A\u7528\u6237\u9700\u8981\u5148\u914D\u7F6E Provider
|
|
52354
|
+
- \u6307\u5F15\u7528\u6237\u8FD0\u884C \`opencode auth login\`
|
|
52355
|
+
|
|
52356
|
+
4. **\u751F\u6210\u914D\u7F6E\u6587\u4EF6**
|
|
52357
|
+
\u914D\u7F6E\u6587\u4EF6\u683C\u5F0F\uFF1A
|
|
52358
|
+
\`\`\`json
|
|
52359
|
+
{
|
|
52360
|
+
"google_auth": true, // \u5982\u679C\u4F7F\u7528 Antigravity
|
|
52361
|
+
"agents": {
|
|
52362
|
+
"chief": { "model": "..." },
|
|
52363
|
+
"deputy": { "model": "..." },
|
|
52364
|
+
"researcher": { "model": "..." },
|
|
52365
|
+
"fact-checker": { "model": "..." },
|
|
52366
|
+
"archivist": { "model": "..." },
|
|
52367
|
+
"extractor": { "model": "..." },
|
|
52368
|
+
"writer": { "model": "..." },
|
|
52369
|
+
"editor": { "model": "..." }
|
|
52370
|
+
}
|
|
52371
|
+
}
|
|
52372
|
+
\`\`\`
|
|
52373
|
+
|
|
52374
|
+
5. **\u6267\u884C\u914D\u7F6E**
|
|
52375
|
+
- \u901A\u8FC7 Deputy \u5C06\u914D\u7F6E\u5199\u5165\u6587\u4EF6
|
|
52376
|
+
- \u914D\u7F6E\u8DEF\u5F84\uFF1A\`~/.config/opencode/newtype-profile.json\`
|
|
52377
|
+
|
|
52378
|
+
6. **\u63D0\u793A\u7528\u6237**
|
|
52379
|
+
- \u914D\u7F6E\u5B8C\u6210\u540E\uFF0C\u63D0\u793A\u7528\u6237\u91CD\u542F OpenCode \u4EE5\u4F7F\u914D\u7F6E\u751F\u6548
|
|
52380
|
+
- \u7B80\u8981\u8BF4\u660E\u914D\u7F6E\u4E86\u54EA\u4E9B\u6A21\u578B
|
|
52381
|
+
|
|
52382
|
+
## \u6CE8\u610F\u4E8B\u9879
|
|
52383
|
+
|
|
52384
|
+
- \u4E0D\u8981\u8986\u76D6\u7528\u6237\u5DF2\u6709\u7684\u5176\u4ED6\u914D\u7F6E\uFF08\u5982 mcp\u3001disabled_hooks \u7B49\uFF09
|
|
52385
|
+
- \u4F7F\u7528 \`read\` \u5DE5\u5177\u5148\u8BFB\u53D6\u73B0\u6709\u914D\u7F6E\uFF0C\u7136\u540E\u5408\u5E76\u65B0\u914D\u7F6E
|
|
52386
|
+
- \u4F7F\u7528 \`chief_task(subagent_type="deputy", ...)\` \u59D4\u6D3E\u6587\u4EF6\u5199\u5165\u64CD\u4F5C
|
|
52387
|
+
`;
|
|
52388
|
+
|
|
52112
52389
|
// src/features/builtin-commands/commands.ts
|
|
52113
52390
|
var BUILTIN_COMMAND_DEFINITIONS = {
|
|
52114
52391
|
"init-deep": {
|
|
@@ -52176,6 +52453,12 @@ $ARGUMENTS
|
|
|
52176
52453
|
description: "(builtin) Consolidate daily memory logs into MEMORY.md",
|
|
52177
52454
|
template: `<command-instruction>
|
|
52178
52455
|
${MEMORY_CONSOLIDATE_TEMPLATE}
|
|
52456
|
+
</command-instruction>`
|
|
52457
|
+
},
|
|
52458
|
+
"configure-models": {
|
|
52459
|
+
description: "(builtin) Configure Agent models based on available providers",
|
|
52460
|
+
template: `<command-instruction>
|
|
52461
|
+
${CONFIGURE_MODELS_TEMPLATE}
|
|
52179
52462
|
</command-instruction>`
|
|
52180
52463
|
}
|
|
52181
52464
|
};
|
|
@@ -52780,9 +53063,9 @@ function createConfigHandler(deps) {
|
|
|
52780
53063
|
chief: builtinAgents.chief
|
|
52781
53064
|
};
|
|
52782
53065
|
const agentsConfig = pluginConfig.agents;
|
|
52783
|
-
const deputyModel = agentsConfig?.deputy?.model
|
|
53066
|
+
const deputyModel = agentsConfig?.deputy?.model;
|
|
52784
53067
|
agentConfig["deputy"] = createDeputyAgent({
|
|
52785
|
-
model: deputyModel,
|
|
53068
|
+
...deputyModel ? { model: deputyModel } : {},
|
|
52786
53069
|
temperature: 0.1
|
|
52787
53070
|
});
|
|
52788
53071
|
const filteredConfigAgents = configAgent ? Object.fromEntries(Object.entries(configAgent).filter(([key]) => {
|
|
@@ -52961,6 +53244,7 @@ var OhMyOpenCodePlugin = async (ctx) => {
|
|
|
52961
53244
|
const chiefOrchestrator = isHookEnabled("chief-orchestrator") ? createChiefOrchestratorHook(ctx) : null;
|
|
52962
53245
|
const prometheusMdOnly = isHookEnabled("prometheus-md-only") ? createPrometheusMdOnlyHook(ctx) : null;
|
|
52963
53246
|
const memorySystem = isHookEnabled("memory-system") ? createMemorySystemHook(ctx) : null;
|
|
53247
|
+
const startupConfigChecker = isHookEnabled("startup-config-checker") ? createStartupConfigCheckerHook(ctx, pluginConfig) : null;
|
|
52964
53248
|
const taskResumeInfo = createTaskResumeInfoHook();
|
|
52965
53249
|
const backgroundManager = new BackgroundManager(ctx);
|
|
52966
53250
|
initTaskToastManager(ctx.client);
|
|
@@ -53073,6 +53357,9 @@ var OhMyOpenCodePlugin = async (ctx) => {
|
|
|
53073
53357
|
await thinkingBlockValidator?.["experimental.chat.messages.transform"]?.(input, output);
|
|
53074
53358
|
await emptyMessageSanitizer?.["experimental.chat.messages.transform"]?.(input, output);
|
|
53075
53359
|
},
|
|
53360
|
+
"experimental.chat.system.transform": async (input, output) => {
|
|
53361
|
+
await startupConfigChecker?.["experimental.chat.system.transform"]?.(input, output);
|
|
53362
|
+
},
|
|
53076
53363
|
config: configHandler,
|
|
53077
53364
|
event: async (input) => {
|
|
53078
53365
|
await autoUpdateChecker?.event(input);
|
|
@@ -53092,6 +53379,7 @@ var OhMyOpenCodePlugin = async (ctx) => {
|
|
|
53092
53379
|
await ralphLoop?.event(input);
|
|
53093
53380
|
await chiefOrchestrator?.handler(input);
|
|
53094
53381
|
await memorySystem?.event(input);
|
|
53382
|
+
await startupConfigChecker?.event(input);
|
|
53095
53383
|
const { event } = input;
|
|
53096
53384
|
const props = event.properties;
|
|
53097
53385
|
if (event.type === "session.created") {
|