winter-super-cli 2026.6.26 → 2026.6.28
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/CHANGELOG.md +28 -5
- package/README.md +66 -0
- package/package.json +5 -1
- package/resources/local/gsap-skills/.claude-plugin/marketplace.json +20 -0
- package/resources/local/gsap-skills/.claude-plugin/plugin.json +6 -0
- package/resources/local/gsap-skills/.cursor-plugin/marketplace.json +13 -0
- package/resources/local/gsap-skills/.cursor-plugin/plugin.json +22 -0
- package/resources/local/gsap-skills/.github/copilot-instructions.md +17 -0
- package/resources/local/gsap-skills/.github/instructions/react.instructions.md +15 -0
- package/resources/local/gsap-skills/.github/instructions/scrolltrigger.instructions.md +18 -0
- package/resources/local/gsap-skills/AGENTS.md +27 -0
- package/resources/local/gsap-skills/CLAUDE.md +1 -0
- package/resources/local/gsap-skills/GEMINI.md +1 -0
- package/resources/local/gsap-skills/LICENSE +21 -0
- package/resources/local/gsap-skills/README.md +163 -0
- package/resources/local/gsap-skills/assets/gsap-green.svg +7 -0
- package/resources/local/gsap-skills/assets/gsap-icon-inverted.svg +15 -0
- package/resources/local/gsap-skills/assets/gsap-icon-square.svg +1 -0
- package/resources/local/gsap-skills/assets/gsap-white.svg +7 -0
- package/resources/local/gsap-skills/examples/README.md +29 -0
- package/resources/local/gsap-skills/examples/nuxt/app/app.vue +3 -0
- package/resources/local/gsap-skills/examples/nuxt/app/composables/useGSAP.ts +91 -0
- package/resources/local/gsap-skills/examples/nuxt/app/pages/index.vue +55 -0
- package/resources/local/gsap-skills/examples/nuxt/nuxt.config.ts +4 -0
- package/resources/local/gsap-skills/examples/nuxt/package.json +18 -0
- package/resources/local/gsap-skills/examples/react/App.jsx +46 -0
- package/resources/local/gsap-skills/examples/react/index.html +12 -0
- package/resources/local/gsap-skills/examples/react/main.jsx +9 -0
- package/resources/local/gsap-skills/examples/react/package.json +21 -0
- package/resources/local/gsap-skills/examples/react/vite.config.js +7 -0
- package/resources/local/gsap-skills/examples/vanilla/index.html +33 -0
- package/resources/local/gsap-skills/examples/vanilla/main.js +36 -0
- package/resources/local/gsap-skills/examples/vue/app.vue +47 -0
- package/resources/local/gsap-skills/examples/vue/index.html +15 -0
- package/resources/local/gsap-skills/examples/vue/main.js +9 -0
- package/resources/local/gsap-skills/examples/vue/package.json +19 -0
- package/resources/local/gsap-skills/examples/vue/vite.config.js +7 -0
- package/resources/local/gsap-skills/skills/gsap-core/SKILL.md +254 -0
- package/resources/local/gsap-skills/skills/gsap-frameworks/SKILL.md +266 -0
- package/resources/local/gsap-skills/skills/gsap-performance/SKILL.md +79 -0
- package/resources/local/gsap-skills/skills/gsap-plugins/SKILL.md +433 -0
- package/resources/local/gsap-skills/skills/gsap-react/SKILL.md +136 -0
- package/resources/local/gsap-skills/skills/gsap-scrolltrigger/SKILL.md +296 -0
- package/resources/local/gsap-skills/skills/gsap-timeline/SKILL.md +107 -0
- package/resources/local/gsap-skills/skills/gsap-utils/SKILL.md +284 -0
- package/resources/local/gsap-skills/skills/llms.txt +39 -0
- package/resources/local/hermes-agent-core/AGENTS.md +1132 -0
- package/resources/local/hermes-agent-core/LICENSE +21 -0
- package/resources/local/hermes-agent-core/README.md +215 -0
- package/resources/local/hermes-agent-core/docs/2026-05-07-s6-overlay-dynamic-subagent-gateways.md +434 -0
- package/resources/local/hermes-agent-core/hermes-already-has-routines.md +160 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/DESCRIPTION.md +3 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/claude-code/SKILL.md +745 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/codex/SKILL.md +130 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/hermes-agent/SKILL.md +1021 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/kanban-codex-lane/SKILL.md +277 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/kanban-codex-lane/templates/pmb-codex-lane-prompt.md +57 -0
- package/resources/local/hermes-agent-core/skills/autonomous-ai-agents/opencode/SKILL.md +219 -0
- package/resources/local/hermes-agent-core/skills/github/DESCRIPTION.md +3 -0
- package/resources/local/hermes-agent-core/skills/github/codebase-inspection/SKILL.md +116 -0
- package/resources/local/hermes-agent-core/skills/github/github-auth/SKILL.md +247 -0
- package/resources/local/hermes-agent-core/skills/github/github-auth/scripts/gh-env.sh +66 -0
- package/resources/local/hermes-agent-core/skills/github/github-code-review/SKILL.md +481 -0
- package/resources/local/hermes-agent-core/skills/github/github-code-review/references/review-output-template.md +74 -0
- package/resources/local/hermes-agent-core/skills/github/github-issues/SKILL.md +370 -0
- package/resources/local/hermes-agent-core/skills/github/github-issues/templates/bug-report.md +35 -0
- package/resources/local/hermes-agent-core/skills/github/github-issues/templates/feature-request.md +31 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/SKILL.md +367 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/references/ci-troubleshooting.md +183 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/references/conventional-commits.md +71 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/templates/pr-body-bugfix.md +35 -0
- package/resources/local/hermes-agent-core/skills/github/github-pr-workflow/templates/pr-body-feature.md +33 -0
- package/resources/local/hermes-agent-core/skills/github/github-repo-management/SKILL.md +516 -0
- package/resources/local/hermes-agent-core/skills/github/github-repo-management/references/github-api-cheatsheet.md +161 -0
- package/resources/local/hermes-agent-core/skills/mcp/DESCRIPTION.md +3 -0
- package/resources/local/hermes-agent-core/skills/mcp/native-mcp/SKILL.md +357 -0
- package/resources/local/hermes-agent-core/skills/software-development/debugging-hermes-tui-commands/SKILL.md +152 -0
- package/resources/local/hermes-agent-core/skills/software-development/hermes-agent-skill-authoring/SKILL.md +165 -0
- package/resources/local/hermes-agent-core/skills/software-development/hermes-s6-container-supervision/SKILL.md +176 -0
- package/resources/local/hermes-agent-core/skills/software-development/node-inspect-debugger/SKILL.md +319 -0
- package/resources/local/hermes-agent-core/skills/software-development/plan/SKILL.md +58 -0
- package/resources/local/hermes-agent-core/skills/software-development/python-debugpy/SKILL.md +375 -0
- package/resources/local/hermes-agent-core/skills/software-development/requesting-code-review/SKILL.md +280 -0
- package/resources/local/hermes-agent-core/skills/software-development/spike/SKILL.md +197 -0
- package/resources/local/hermes-agent-core/skills/software-development/subagent-driven-development/SKILL.md +352 -0
- package/resources/local/hermes-agent-core/skills/software-development/subagent-driven-development/references/context-budget-discipline.md +53 -0
- package/resources/local/hermes-agent-core/skills/software-development/subagent-driven-development/references/gates-taxonomy.md +93 -0
- package/resources/local/hermes-agent-core/skills/software-development/systematic-debugging/SKILL.md +367 -0
- package/resources/local/hermes-agent-core/skills/software-development/test-driven-development/SKILL.md +343 -0
- package/resources/local/hermes-agent-core/skills/software-development/writing-plans/SKILL.md +297 -0
- package/resources/local/manifest.json +12 -0
- package/rule.md +2 -0
- package/scripts/audit-pack.js +5 -0
- package/scripts/smoke-browser.js +53 -0
- package/scripts/smoke-package.js +38 -4
- package/skill.md +36 -4
- package/skills/gsap.md +26 -0
- package/skills/hermes-agent.md +17 -0
- package/src/agent/agent-definitions.js +4 -4
- package/src/agent/runtime.js +206 -5
- package/src/agent/subagent-child.js +44 -0
- package/src/ai/capability-scorecard.js +193 -14
- package/src/ai/hermes-core.js +77 -0
- package/src/ai/model-capabilities.js +42 -2
- package/src/ai/prompts/system-prompt.js +16 -2
- package/src/ai/small-model-amplifier.js +35 -7
- package/src/ai/workflow-selector.js +22 -1
- package/src/cli/commands.js +21 -1
- package/src/cli/config.js +42 -4
- package/src/cli/context-loader.js +253 -9
- package/src/cli/conversation-format.js +5 -0
- package/src/cli/input-controller.js +79 -10
- package/src/cli/prompt-builder.js +45 -8
- package/src/cli/repl-commands.js +123 -2
- package/src/cli/repl.js +183 -87
- package/src/cli/slash-commands.js +3 -1
- package/src/cli/tui.js +133 -37
- package/src/mcp/client.js +46 -5
- package/src/tools/agent.js +316 -25
- package/src/tools/executor.js +314 -11
- package/src/tools/permission.js +20 -17
- package/winter.d.ts +112 -10
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { formatRuntimeEnvironmentSummary, getRuntimeEnvironment } from './runtime-env.js';
|
|
2
|
+
import { buildHermesCoreContract } from '../ai/hermes-core.js';
|
|
2
3
|
import { getModelBudgetMultiplier } from '../ai/model-capabilities.js';
|
|
4
|
+
import { buildCodingMasteryContract } from '../ai/small-model-amplifier.js';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* PromptBuilder — Builds system prompts for Winter CLI agents.
|
|
@@ -44,18 +46,26 @@ export class PromptBuilder {
|
|
|
44
46
|
return typeof value === 'string' ? value : '';
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
getResourceApplicationProfile() {
|
|
50
|
+
const sessionContext = this.session?.getContext?.() || {};
|
|
51
|
+
const value = sessionContext.resourceApplicationProfile?.value ?? sessionContext.resourceApplicationProfile;
|
|
52
|
+
return typeof value === 'string' ? value : '';
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
buildSystemPrompt(context = '', options = {}) {
|
|
48
56
|
const memories = this.session?.getMemory?.() || [];
|
|
49
57
|
const plans = this.session?.getPlans?.() || [];
|
|
50
58
|
const sessionContext = this.session?.getContext?.() || {};
|
|
51
59
|
const environmentSummary = this.tools?.getRuntimeEnvironmentSummary?.() || this._defaultEnvironmentSummary();
|
|
52
60
|
const requiredLocalResources = this.getRequiredLocalResources();
|
|
61
|
+
const resourceApplicationProfile = this.getResourceApplicationProfile();
|
|
53
62
|
const scale = getModelBudgetMultiplier(options.modelTier);
|
|
54
63
|
const projectContextBudget = options.projectContextBudget || Math.round(3200 * scale);
|
|
55
64
|
const compactSystemPrompt = options.compactSystemPrompt ?? (scale <= 0.75);
|
|
56
65
|
const memoryBudget = Math.round(1200 * scale);
|
|
57
66
|
const planBudget = Math.round(1200 * scale);
|
|
58
67
|
const requiredResourcesBudget = Math.round((compactSystemPrompt ? 1200 : 1600) * scale);
|
|
68
|
+
const resourceProfileBudget = Math.round((compactSystemPrompt ? 1800 : 2600) * scale);
|
|
59
69
|
const workflowBudget = Math.round(900 * scale);
|
|
60
70
|
const blueprintBudget = Math.round(700 * scale);
|
|
61
71
|
|
|
@@ -65,6 +75,9 @@ export class PromptBuilder {
|
|
|
65
75
|
const requiredResourcesStr = requiredLocalResources
|
|
66
76
|
? `\n## Required Local Resource Rules\n${this._compactText(requiredLocalResources, requiredResourcesBudget, 'required local resources')}`
|
|
67
77
|
: '';
|
|
78
|
+
const resourceProfileStr = resourceApplicationProfile
|
|
79
|
+
? `\n## Auto-loaded Resource Application Profile\n${this._compactText(resourceApplicationProfile, resourceProfileBudget, 'resource application profile')}`
|
|
80
|
+
: '';
|
|
68
81
|
const plansStr = plans.length > 0
|
|
69
82
|
? this._formatPlans(plans, { maxTotalChars: planBudget })
|
|
70
83
|
: '';
|
|
@@ -77,6 +90,11 @@ export class PromptBuilder {
|
|
|
77
90
|
const blueprintStr = sessionContext.workflowBlueprint
|
|
78
91
|
? `\n## Profile Blueprint\n${this._compactText(sessionContext.workflowBlueprint, blueprintBudget, 'workflow blueprint')}`
|
|
79
92
|
: '';
|
|
93
|
+
const smallModelContractStr = compactSystemPrompt
|
|
94
|
+
? '\n## Small Model Operating Contract\n- Use a private checklist: goal, files/state to inspect, next tool, verification.\n- For action tasks, make one concrete tool call before claiming progress.\n- If unsure, Read/Grep/Glob/Bash instead of guessing.\n- Do not claim files changed, browser checked, tests passed, or commands ran without tool output from this turn.\n- Keep context reads small and high-signal; verify after changes.'
|
|
95
|
+
: '';
|
|
96
|
+
const codingMasteryStr = `\n${buildCodingMasteryContract({ compact: compactSystemPrompt })}`;
|
|
97
|
+
const hermesCoreStr = `\n${buildHermesCoreContract({ compact: compactSystemPrompt })}`;
|
|
80
98
|
const startupPlanStr = sessionContext.bootstrapPlan?.title
|
|
81
99
|
? `\n## Startup Plan\n- ${sessionContext.bootstrapPlan.title}: ${sessionContext.bootstrapPlan.description}`
|
|
82
100
|
: '';
|
|
@@ -93,7 +111,7 @@ export class PromptBuilder {
|
|
|
93
111
|
`CRITICAL: You MUST call tools (Read/Write/Edit/Bash) to do real work. NEVER write code in markdown and claim done. Winter blocks fake completions.`,
|
|
94
112
|
`Tool fallback when native calls are unavailable: <invoke name="Read"><parameter name="path">README.md</parameter></invoke> OR {"tool":"Read","arguments":{"path":"README.md"}} OR CALL_TOOL Read {"path":"README.md"}.`,
|
|
95
113
|
`Session: cwd=${this.projectPath}; id=${this.session?.getSessionId?.()?.substring(0, 8) || 'unknown'}`,
|
|
96
|
-
`${requiredResourcesStr}${memoryStr}${plansStr}${skillsStr}${workflowStr}${blueprintStr}${startupPlanStr}${sessionSignalsStr}`,
|
|
114
|
+
`${smallModelContractStr}${codingMasteryStr}${hermesCoreStr}${requiredResourcesStr}${resourceProfileStr}${memoryStr}${plansStr}${skillsStr}${workflowStr}${blueprintStr}${startupPlanStr}${sessionSignalsStr}`,
|
|
97
115
|
context ? `\n## Project Context\n${this._compactText(context, projectContextBudget, 'project context')}` : '',
|
|
98
116
|
].filter(Boolean).join('\n');
|
|
99
117
|
}
|
|
@@ -118,11 +136,15 @@ export class PromptBuilder {
|
|
|
118
136
|
`CRITICAL: When the user asks you to fix/create/edit/run/modify anything, you MUST call tools (Read, Write, Edit, Bash, etc.) to actually do it. NEVER just write code in a markdown code block and claim it is done. Winter will detect and block fake completions. If you say "đã sửa/đã tạo/done/fixed" without a tool call, your response will be rejected.`,
|
|
119
137
|
`Tool call compatibility: if native tool calls are unavailable, output exactly one of these forms and no prose: <invoke name="Read"><parameter name="path">README.md</parameter></invoke> OR {"tool":"Read","arguments":{"path":"README.md"}} OR CALL_TOOL Read {"path":"README.md"}.`,
|
|
120
138
|
`Open browser requests: if the user asks to "mở chrome", "open Chrome", or open a URL in a visible browser, use OpenBrowser. Do NOT use Bash, Get-Command, Start-Process, cmd start, or shell app launch commands for this.`,
|
|
121
|
-
`Browser capability: You CAN browse URLs! Use WebFetch only for static page text extraction. For live Chrome debugging and visible browser control, prefer MCP server "chrome-devtools" when configured: use MCP tool "new_page" or "navigate_page", then "take_snapshot", "click", "fill"/"fill_form", "take_screenshot", "evaluate_script", "list_console_messages", "list_network_requests", or performance trace tools.
|
|
122
|
-
`Browser interaction rule: if the user asks to click, press, fill, select, submit, open a web app path, or inspect page-by-page data, WebFetch is not enough and BrowserDebug is not user-visible. Use chrome-devtools MCP so the user can watch
|
|
139
|
+
`Browser capability: You CAN browse URLs! Use WebFetch only for static page text extraction. For live Chrome debugging and visible browser control, prefer MCP server "chrome-devtools" when configured: use MCP tool "new_page" or "navigate_page", then "take_snapshot", "click", "fill"/"fill_form", "take_screenshot", "evaluate_script", "list_console_messages", "list_network_requests", or performance trace tools. If MCP is unavailable, use VisibleBrowser for real visible Puppeteer control. BrowserDebug is headless fallback only when visible control is unnecessary.`,
|
|
140
|
+
`Browser interaction rule: if the user asks to click, press, fill, select, submit, open a web app path, or inspect page-by-page data, WebFetch is not enough and BrowserDebug is not user-visible. Use chrome-devtools MCP or VisibleBrowser so the user can watch a normal browser. Never claim "đã bấm/đã điền/đã mở/đã kiểm tra" from prose alone.`,
|
|
123
141
|
`When a task touches coding, agents, UI, brand, or design, inspect the relevant required local resource in depth before deciding.`,
|
|
124
142
|
`If the user asks you to modify, run, inspect, check, publish, commit, or otherwise act on the project, you MUST use tools. Do not claim completion without a tool result from this turn.`,
|
|
125
143
|
``,
|
|
144
|
+
buildCodingMasteryContract(),
|
|
145
|
+
``,
|
|
146
|
+
buildHermesCoreContract(),
|
|
147
|
+
``,
|
|
126
148
|
`## Debug Excellence`,
|
|
127
149
|
`For bugs, crashes, test failures, or "not working": identify the first hard failure, reproduce or inspect logs, trace the exact runtime path, patch the smallest root cause, and verify with the closest command. For frontend/runtime UI issues with a URL/dev server, prefer chrome-devtools MCP in visible Chrome; use BrowserDebug only as a headless fallback.`,
|
|
128
150
|
``,
|
|
@@ -135,7 +157,7 @@ export class PromptBuilder {
|
|
|
135
157
|
`## Session`,
|
|
136
158
|
`Working directory: ${this.projectPath}`,
|
|
137
159
|
`Current session: ${this.session?.getSessionId?.()?.substring(0, 8) || 'unknown'}`,
|
|
138
|
-
`${requiredResourcesStr}${memoryStr}${plansStr}${skillsStr}${workflowStr}${blueprintStr}${startupPlanStr}${sessionSignalsStr}`,
|
|
160
|
+
`${requiredResourcesStr}${resourceProfileStr}${memoryStr}${plansStr}${skillsStr}${workflowStr}${blueprintStr}${startupPlanStr}${sessionSignalsStr}`,
|
|
139
161
|
context ? `\n## Project Context\n${this._compactText(context, projectContextBudget, 'project context')}` : '',
|
|
140
162
|
``,
|
|
141
163
|
`Be helpful, be precise, and get things done. Always respond in Vietnamese.`,
|
|
@@ -145,9 +167,13 @@ export class PromptBuilder {
|
|
|
145
167
|
buildFastSystemPrompt() {
|
|
146
168
|
const memories = this.session?.getMemory?.() || [];
|
|
147
169
|
const requiredLocalResources = this.getRequiredLocalResources();
|
|
170
|
+
const resourceApplicationProfile = this.getResourceApplicationProfile();
|
|
148
171
|
const requiredResourcesStr = requiredLocalResources
|
|
149
172
|
? `\nQuy tac resource bat buoc:\n${this._compactText(requiredLocalResources, 900, 'required local resources')}`
|
|
150
173
|
: '';
|
|
174
|
+
const resourceProfileStr = resourceApplicationProfile
|
|
175
|
+
? `\nResource profile tu dong nap:\n${this._compactText(resourceApplicationProfile, 1100, 'resource application profile')}`
|
|
176
|
+
: '';
|
|
151
177
|
const memoryStr = memories.length > 0
|
|
152
178
|
? `\nContext nhớ ngắn:\n${this._summarizePrompts(memories.slice(-8), {
|
|
153
179
|
limit: 8,
|
|
@@ -166,6 +192,7 @@ export class PromptBuilder {
|
|
|
166
192
|
'Nếu có ảnh/screenshot đính kèm hoặc paste từ clipboard, phân tích trực tiếp ảnh đó.',
|
|
167
193
|
'Luôn tuân thủ Required Local Resource Rules nếu có; không hạ chất lượng theo model.',
|
|
168
194
|
requiredResourcesStr,
|
|
195
|
+
resourceProfileStr,
|
|
169
196
|
memoryStr,
|
|
170
197
|
].filter(Boolean).join('\n');
|
|
171
198
|
}
|
|
@@ -175,6 +202,7 @@ export class PromptBuilder {
|
|
|
175
202
|
const plans = this.session?.getPlans?.() || [];
|
|
176
203
|
const sessionContext = this.session?.getContext?.() || {};
|
|
177
204
|
const requiredLocalResources = this.getRequiredLocalResources();
|
|
205
|
+
const resourceApplicationProfile = this.getResourceApplicationProfile();
|
|
178
206
|
const scale = getModelBudgetMultiplier(this.ai?._modelTier || '');
|
|
179
207
|
const projectContextBudget = Math.round(3200 * (scale || 1));
|
|
180
208
|
|
|
@@ -182,6 +210,9 @@ export class PromptBuilder {
|
|
|
182
210
|
const requiredResourcesStr = requiredLocalResources
|
|
183
211
|
? `\n## Required Local Resource Rules\n${this._compactText(requiredLocalResources, Math.round(1600 * (scale || 1)), 'required local resources')}`
|
|
184
212
|
: '';
|
|
213
|
+
const resourceProfileStr = resourceApplicationProfile
|
|
214
|
+
? `\n## Auto-loaded Resource Application Profile\n${this._compactText(resourceApplicationProfile, Math.round(2200 * (scale || 1)), 'resource application profile')}`
|
|
215
|
+
: '';
|
|
185
216
|
const plansStr = plans.length > 0 ? this._formatPlans(plans, { maxTotalChars: Math.round(900 * (scale || 1)) }) : '';
|
|
186
217
|
const skillsStr = Array.isArray(sessionContext.activeSkills) && sessionContext.activeSkills.length > 0
|
|
187
218
|
? `\n## Auto-applied Skills\n${sessionContext.activeSkills.slice(0, 12).map(skill => `- ${skill}`).join('\n')}${sessionContext.activeSkills.length > 12 ? '\n- ...' : ''}`
|
|
@@ -195,7 +226,7 @@ export class PromptBuilder {
|
|
|
195
226
|
review: 'You are a Winter review subagent. Critique the request or implementation with specific issues, edge cases, and concrete improvements.',
|
|
196
227
|
debug: 'You are a Winter debugging subagent. Reproduce or inspect the exact failing path, isolate the first hard blocker, patch the smallest root cause, and verify with the closest test/build/browser smoke.',
|
|
197
228
|
research: 'You are a Winter research subagent. Gather the important facts, compare options, and summarize only what matters.',
|
|
198
|
-
browser: `You are a Winter browser subagent. Bạn CÓ QUYỀN sử dụng chrome-devtools MCP để thao tác
|
|
229
|
+
browser: `You are a Winter browser subagent. Bạn CÓ QUYỀN sử dụng chrome-devtools MCP hoặc VisibleBrowser để thao tác browser visible cho user xem: mở URL, click, fill form, snapshot, screenshot, đọc console/network. Dùng BrowserDebug chỉ khi cần headless fallback.`,
|
|
199
230
|
};
|
|
200
231
|
|
|
201
232
|
const rolePrompt = rolePrompts[role] || 'You are a Winter coding subagent. Solve the task directly, use tools when needed, and return a concise result.';
|
|
@@ -210,14 +241,15 @@ export class PromptBuilder {
|
|
|
210
241
|
'3. [DEBUG EXCELLENCE]: Reproduce or inspect the failing path first, isolate the first hard blocker, patch root cause, and verify with the closest test/build/browser smoke.',
|
|
211
242
|
'4. [DESIGN EXCELLENCE]: Use rich aesthetics. Default to modern UI frameworks if applicable. Never output plain, ugly HTML/CSS. Ensure responsive, premium feel with micro-animations.',
|
|
212
243
|
'5. [CODE QUALITY]: Write clean, modular, SOLID code. Check for syntax errors carefully. Do not generate incomplete code blocks.',
|
|
213
|
-
'6. [NO HALLUCINATION]: If you don\'t know, use tools (Grep/Read/Web/chrome-devtools MCP/BrowserDebug) to find out. Do not guess file paths or APIs.',
|
|
244
|
+
'6. [NO HALLUCINATION]: If you don\'t know, use tools (Grep/Read/Web/chrome-devtools MCP/VisibleBrowser/BrowserDebug) to find out. Do not guess file paths or APIs.',
|
|
214
245
|
'7. [TOOL EXECUTION FIRST]: You DO have file tools. Use Write to create/overwrite files and Edit to patch files. Never say there is no write tool.',
|
|
215
246
|
'8. [IMAGE INPUTS]: If an image is attached or pasted, analyze it directly and use it as evidence for UI/debug/design decisions.',
|
|
216
247
|
'',
|
|
217
248
|
rolePrompt,
|
|
218
249
|
'',
|
|
219
250
|
'## Tool Rules',
|
|
220
|
-
'- Canonical tools: Read, Write, Edit, Bash, Glob, Grep, TaskCreate, TaskUpdate, TaskList, OpenBrowser, BrowserDebug, WebFetch, WebSearch, MCP.',
|
|
251
|
+
'- Canonical tools: Read, Write, Edit, Bash, Glob, Grep, TaskCreate, TaskUpdate, TaskList, OpenBrowser, VisibleBrowser, BrowserDebug, WebFetch, WebSearch, MCP, Agent, DelegateTask, ParallelAgent.',
|
|
252
|
+
'- For multi-agent work, use DelegateTask for one isolated subagent or ParallelAgent for independent concurrent subagents; do not pretend delegation happened without tool evidence.',
|
|
221
253
|
'- If native tool calls are unavailable, output exactly one fallback tool call and no prose: <invoke name="Read"><parameter name="path">README.md</parameter></invoke> OR {"tool":"Read","arguments":{"path":"README.md"}} OR CALL_TOOL Read {"path":"README.md"}.',
|
|
222
254
|
'- Treat skills, memories, bundled resources, local project rules, and the tool list as operational context. Use them proactively when relevant.',
|
|
223
255
|
`- Runtime environment:\n${runtimeSummary}`,
|
|
@@ -225,11 +257,16 @@ export class PromptBuilder {
|
|
|
225
257
|
'- For action requests, use tools before claiming anything is done. Never claim files changed, tests ran, or checks passed unless this conversation contains the matching tool result.',
|
|
226
258
|
'- If a tool call fails because of an unknown alias, call the canonical tool name next.',
|
|
227
259
|
'- Always start with a brief plan, then refine it when new facts appear.',
|
|
260
|
+
'- Coding mastery: inspect entrypoint/callers/callees/tests first, preserve invariants, patch minimally, review the diff, and verify with the closest command.',
|
|
261
|
+
'',
|
|
262
|
+
buildCodingMasteryContract({ compact: true }),
|
|
263
|
+
'',
|
|
264
|
+
buildHermesCoreContract({ compact: true }),
|
|
228
265
|
'',
|
|
229
266
|
'## Project',
|
|
230
267
|
`Working directory: ${this.projectPath}`,
|
|
231
268
|
`Current session: ${this.session?.getSessionId?.()?.substring(0, 8) || 'unknown'}`,
|
|
232
|
-
`${requiredResourcesStr}${memoryStr}${plansStr}${skillsStr}${startupPlanStr}`,
|
|
269
|
+
`${requiredResourcesStr}${resourceProfileStr}${memoryStr}${plansStr}${skillsStr}${startupPlanStr}`,
|
|
233
270
|
context ? `\n## Project Context\n${this._compactText(context, projectContextBudget, 'project context')}` : '',
|
|
234
271
|
].join('\n');
|
|
235
272
|
}
|
package/src/cli/repl-commands.js
CHANGED
|
@@ -137,6 +137,88 @@ async function handlePageAgentCommand(repl, args = []) {
|
|
|
137
137
|
console.log(`${colors.dim}Commands: /page-agent search <query>, /page-agent read <path>, /page-agent docs, /page-agent snippet, /page-agent browse <url>${colors.reset}`);
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
+
function parseFlagArgs(args = []) {
|
|
141
|
+
const parsed = { positional: [] };
|
|
142
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
143
|
+
const value = args[index];
|
|
144
|
+
if (!String(value || '').startsWith('--')) {
|
|
145
|
+
parsed.positional.push(value);
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
const key = String(value).slice(2).replace(/-([a-z])/g, (_, char) => char.toUpperCase());
|
|
149
|
+
const next = args[index + 1];
|
|
150
|
+
if (!next || String(next).startsWith('--')) {
|
|
151
|
+
parsed[key] = true;
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
parsed[key] = next;
|
|
155
|
+
index += 1;
|
|
156
|
+
}
|
|
157
|
+
return parsed;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
async function handleBrowserCommand(repl, args = []) {
|
|
161
|
+
const parsed = parseFlagArgs(args);
|
|
162
|
+
const [rawAction = 'open', maybeUrl, ...rest] = parsed.positional;
|
|
163
|
+
const actionAliases = {
|
|
164
|
+
fill: 'type',
|
|
165
|
+
inspect: 'snapshot',
|
|
166
|
+
js: 'evaluate',
|
|
167
|
+
eval: 'evaluate',
|
|
168
|
+
screen: 'screenshot',
|
|
169
|
+
shot: 'screenshot',
|
|
170
|
+
};
|
|
171
|
+
const action = actionAliases[String(rawAction).toLowerCase()] || String(rawAction).toLowerCase();
|
|
172
|
+
const url = parsed.url || (/^https?:\/\//i.test(String(maybeUrl || '')) || String(maybeUrl || '').startsWith('data:') ? maybeUrl : undefined);
|
|
173
|
+
const trailingText = rest.join(' ').trim();
|
|
174
|
+
const payload = {
|
|
175
|
+
action,
|
|
176
|
+
url: url || 'about:blank',
|
|
177
|
+
selector: parsed.selector || parsed.css || parsed.target,
|
|
178
|
+
text: parsed.text || parsed.value || trailingText || undefined,
|
|
179
|
+
script: parsed.script || parsed.code || (action === 'evaluate' ? trailingText : undefined),
|
|
180
|
+
wait_for: parsed.waitFor || parsed.wait,
|
|
181
|
+
screenshot_path: parsed.screenshotPath || parsed.output || parsed.out,
|
|
182
|
+
keep_open: parsed.keepOpen === true || parsed.keep === true,
|
|
183
|
+
browser: parsed.browser || 'chrome',
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
if (action === 'help' || action === '--help') {
|
|
187
|
+
console.log(`${colors.cyan}/browser usage:${colors.reset}`);
|
|
188
|
+
console.log(' /browser open https://example.com --keep-open');
|
|
189
|
+
console.log(' /browser click https://example.com --selector button');
|
|
190
|
+
console.log(' /browser type https://example.com --selector input[name=q] --text winter');
|
|
191
|
+
console.log(' /browser screenshot https://example.com --output .winter/page.png');
|
|
192
|
+
console.log(' /browser snapshot https://example.com --selector body');
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if ((action === 'click' || action === 'type') && !payload.selector) {
|
|
197
|
+
console.log(`${colors.yellow}Usage: /browser ${action} <url> --selector <css>${action === 'type' ? ' --text <value>' : ''}${colors.reset}`);
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (action === 'evaluate' && !payload.script) {
|
|
201
|
+
console.log(`${colors.yellow}Usage: /browser eval <url> --script <javascript>${colors.reset}`);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
console.log(`${colors.cyan}VisibleBrowser:${colors.reset} ${action} ${payload.url}`);
|
|
206
|
+
const result = await repl.tools.execute('VisibleBrowser', payload, { cwd: repl.projectPath });
|
|
207
|
+
if (result.success) {
|
|
208
|
+
console.log(`${colors.green}OK ${result.action || action}: ${result.title || result.url || payload.url}${colors.reset}`);
|
|
209
|
+
if (result.actionResult !== undefined) {
|
|
210
|
+
const value = typeof result.actionResult === 'string' ? result.actionResult : JSON.stringify(result.actionResult);
|
|
211
|
+
console.log(value.length > 2000 ? `${value.slice(0, 2000)}...` : value);
|
|
212
|
+
}
|
|
213
|
+
if (result.domSnippet) {
|
|
214
|
+
console.log(`${colors.dim}${String(result.domSnippet).slice(0, 1200)}${colors.reset}`);
|
|
215
|
+
}
|
|
216
|
+
return;
|
|
217
|
+
}
|
|
218
|
+
console.log(`${colors.red}FAIL VisibleBrowser: ${result.error || 'unknown error'}${colors.reset}`);
|
|
219
|
+
if (result.recovery) console.log(`${colors.dim}${result.recovery}${colors.reset}`);
|
|
220
|
+
}
|
|
221
|
+
|
|
140
222
|
/**
|
|
141
223
|
* Handle slash commands in the Winter REPL.
|
|
142
224
|
* Delegated from WinterREPL.handleSlashCommand to reduce file size.
|
|
@@ -381,6 +463,10 @@ export async function handleSlashCommand(repl, input) {
|
|
|
381
463
|
}
|
|
382
464
|
return;
|
|
383
465
|
|
|
466
|
+
case '/browser':
|
|
467
|
+
await handleBrowserCommand(repl, args);
|
|
468
|
+
return;
|
|
469
|
+
|
|
384
470
|
// Inline Completion
|
|
385
471
|
case '/complete':
|
|
386
472
|
if (args.length === 0) {
|
|
@@ -531,6 +617,35 @@ export async function handleSlashCommand(repl, input) {
|
|
|
531
617
|
case '/tui':
|
|
532
618
|
repl.showTuiDashboard();
|
|
533
619
|
return;
|
|
620
|
+
case '/paste': {
|
|
621
|
+
const payload = await repl.getClipboardPayload();
|
|
622
|
+
if (!payload) {
|
|
623
|
+
console.log(`${colors.yellow}Clipboard is empty or unavailable.${colors.reset}`);
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
if (payload.type === 'image') {
|
|
627
|
+
const prompt = args.join(' ').trim() || 'Analyze this pasted clipboard image.';
|
|
628
|
+
await repl.chat(prompt, [payload.image]);
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
const prefix = args.join(' ').trim();
|
|
633
|
+
const text = repl.normalizePastedText(payload.text || '').trim();
|
|
634
|
+
if (!text) {
|
|
635
|
+
console.log(`${colors.yellow}Clipboard text is empty.${colors.reset}`);
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
const combined = prefix ? `${prefix}\n\n${text}` : text;
|
|
639
|
+
if (repl.shouldPersistPastedText(combined)) {
|
|
640
|
+
const paste = await repl.persistPastedText(combined);
|
|
641
|
+
const reference = repl.formatPastedTextReference(paste);
|
|
642
|
+
console.log(`${colors.cyan}│ ${colors.dim}${reference}${colors.reset}`);
|
|
643
|
+
await repl.handleInput(reference);
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
await repl.handleInput(combined);
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
534
649
|
|
|
535
650
|
// Git Auto-Pilot
|
|
536
651
|
case '/commit':
|
|
@@ -558,7 +673,6 @@ export async function handleSlashCommand(repl, input) {
|
|
|
558
673
|
break;
|
|
559
674
|
|
|
560
675
|
// Planning
|
|
561
|
-
case '/plan':
|
|
562
676
|
case '/plans':
|
|
563
677
|
const plans = repl.session.getPlans();
|
|
564
678
|
if (plans.length === 0) {
|
|
@@ -568,6 +682,14 @@ export async function handleSlashCommand(repl, input) {
|
|
|
568
682
|
plans.forEach(p => console.log(` [${p.status}] ${p.title}`));
|
|
569
683
|
}
|
|
570
684
|
break;
|
|
685
|
+
case '/plan':
|
|
686
|
+
if (args.length === 0) {
|
|
687
|
+
console.log(`${colors.yellow}Usage: /plan <task>${colors.reset}`);
|
|
688
|
+
console.log(`${colors.dim}Use /plans to list active plans.${colors.reset}`);
|
|
689
|
+
return;
|
|
690
|
+
}
|
|
691
|
+
await repl.generateInteractivePlan(args.join(' '));
|
|
692
|
+
return;
|
|
571
693
|
case '/task':
|
|
572
694
|
case '/tasks':
|
|
573
695
|
console.log(`${colors.cyan}Tasks:${colors.reset}`);
|
|
@@ -733,7 +855,6 @@ export async function handleSlashCommand(repl, input) {
|
|
|
733
855
|
}
|
|
734
856
|
console.log(`${colors.yellow}Usage: /doctor [full|tools|context|scorecard]${colors.reset}`);
|
|
735
857
|
return;
|
|
736
|
-
case '/plan:':
|
|
737
858
|
case '/plan-gen':
|
|
738
859
|
if (args.length === 0) {
|
|
739
860
|
console.log(`${colors.yellow}Usage: /plan <task>${colors.reset}`);
|