winter-super-cli 2026.6.24 → 2026.6.27
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 +85 -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 +179 -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 +18 -2
- package/src/ai/small-model-amplifier.js +35 -7
- package/src/ai/workflow-selector.js +22 -1
- package/src/cli/commands.js +46 -2
- package/src/cli/config.js +45 -6
- 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 +47 -8
- package/src/cli/repl-commands.js +115 -0
- package/src/cli/repl.js +343 -85
- package/src/cli/slash-commands.js +4 -2
- package/src/cli/tui.js +133 -37
- package/src/mcp/client.js +54 -11
- package/src/mcp/presets.js +114 -0
- package/src/tools/agent.js +316 -25
- package/src/tools/executor.js +412 -12
- 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
|
}
|
|
@@ -117,12 +135,18 @@ export class PromptBuilder {
|
|
|
117
135
|
`Prefer Read/Grep/Glob before editing. Use Write/Edit for file changes.`,
|
|
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.`,
|
|
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.`,
|
|
121
141
|
`When a task touches coding, agents, UI, brand, or design, inspect the relevant required local resource in depth before deciding.`,
|
|
122
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.`,
|
|
123
143
|
``,
|
|
144
|
+
buildCodingMasteryContract(),
|
|
145
|
+
``,
|
|
146
|
+
buildHermesCoreContract(),
|
|
147
|
+
``,
|
|
124
148
|
`## Debug Excellence`,
|
|
125
|
-
`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,
|
|
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.`,
|
|
126
150
|
``,
|
|
127
151
|
`## Design Excellence`,
|
|
128
152
|
`For UI/design work: inspect existing components/styles and any design resources first. Build a polished, responsive, domain-appropriate interface with complete states and clear interactions. Avoid generic placeholders, fake controls, one-note palettes, and unverified visual claims.`,
|
|
@@ -133,7 +157,7 @@ export class PromptBuilder {
|
|
|
133
157
|
`## Session`,
|
|
134
158
|
`Working directory: ${this.projectPath}`,
|
|
135
159
|
`Current session: ${this.session?.getSessionId?.()?.substring(0, 8) || 'unknown'}`,
|
|
136
|
-
`${requiredResourcesStr}${memoryStr}${plansStr}${skillsStr}${workflowStr}${blueprintStr}${startupPlanStr}${sessionSignalsStr}`,
|
|
160
|
+
`${requiredResourcesStr}${resourceProfileStr}${memoryStr}${plansStr}${skillsStr}${workflowStr}${blueprintStr}${startupPlanStr}${sessionSignalsStr}`,
|
|
137
161
|
context ? `\n## Project Context\n${this._compactText(context, projectContextBudget, 'project context')}` : '',
|
|
138
162
|
``,
|
|
139
163
|
`Be helpful, be precise, and get things done. Always respond in Vietnamese.`,
|
|
@@ -143,9 +167,13 @@ export class PromptBuilder {
|
|
|
143
167
|
buildFastSystemPrompt() {
|
|
144
168
|
const memories = this.session?.getMemory?.() || [];
|
|
145
169
|
const requiredLocalResources = this.getRequiredLocalResources();
|
|
170
|
+
const resourceApplicationProfile = this.getResourceApplicationProfile();
|
|
146
171
|
const requiredResourcesStr = requiredLocalResources
|
|
147
172
|
? `\nQuy tac resource bat buoc:\n${this._compactText(requiredLocalResources, 900, 'required local resources')}`
|
|
148
173
|
: '';
|
|
174
|
+
const resourceProfileStr = resourceApplicationProfile
|
|
175
|
+
? `\nResource profile tu dong nap:\n${this._compactText(resourceApplicationProfile, 1100, 'resource application profile')}`
|
|
176
|
+
: '';
|
|
149
177
|
const memoryStr = memories.length > 0
|
|
150
178
|
? `\nContext nhớ ngắn:\n${this._summarizePrompts(memories.slice(-8), {
|
|
151
179
|
limit: 8,
|
|
@@ -164,6 +192,7 @@ export class PromptBuilder {
|
|
|
164
192
|
'Nếu có ảnh/screenshot đính kèm hoặc paste từ clipboard, phân tích trực tiếp ảnh đó.',
|
|
165
193
|
'Luôn tuân thủ Required Local Resource Rules nếu có; không hạ chất lượng theo model.',
|
|
166
194
|
requiredResourcesStr,
|
|
195
|
+
resourceProfileStr,
|
|
167
196
|
memoryStr,
|
|
168
197
|
].filter(Boolean).join('\n');
|
|
169
198
|
}
|
|
@@ -173,6 +202,7 @@ export class PromptBuilder {
|
|
|
173
202
|
const plans = this.session?.getPlans?.() || [];
|
|
174
203
|
const sessionContext = this.session?.getContext?.() || {};
|
|
175
204
|
const requiredLocalResources = this.getRequiredLocalResources();
|
|
205
|
+
const resourceApplicationProfile = this.getResourceApplicationProfile();
|
|
176
206
|
const scale = getModelBudgetMultiplier(this.ai?._modelTier || '');
|
|
177
207
|
const projectContextBudget = Math.round(3200 * (scale || 1));
|
|
178
208
|
|
|
@@ -180,6 +210,9 @@ export class PromptBuilder {
|
|
|
180
210
|
const requiredResourcesStr = requiredLocalResources
|
|
181
211
|
? `\n## Required Local Resource Rules\n${this._compactText(requiredLocalResources, Math.round(1600 * (scale || 1)), 'required local resources')}`
|
|
182
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
|
+
: '';
|
|
183
216
|
const plansStr = plans.length > 0 ? this._formatPlans(plans, { maxTotalChars: Math.round(900 * (scale || 1)) }) : '';
|
|
184
217
|
const skillsStr = Array.isArray(sessionContext.activeSkills) && sessionContext.activeSkills.length > 0
|
|
185
218
|
? `\n## Auto-applied Skills\n${sessionContext.activeSkills.slice(0, 12).map(skill => `- ${skill}`).join('\n')}${sessionContext.activeSkills.length > 12 ? '\n- ...' : ''}`
|
|
@@ -193,7 +226,7 @@ export class PromptBuilder {
|
|
|
193
226
|
review: 'You are a Winter review subagent. Critique the request or implementation with specific issues, edge cases, and concrete improvements.',
|
|
194
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.',
|
|
195
228
|
research: 'You are a Winter research subagent. Gather the important facts, compare options, and summarize only what matters.',
|
|
196
|
-
browser: `You are a Winter browser subagent. Bạn CÓ QUYỀN sử dụng
|
|
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.`,
|
|
197
230
|
};
|
|
198
231
|
|
|
199
232
|
const rolePrompt = rolePrompts[role] || 'You are a Winter coding subagent. Solve the task directly, use tools when needed, and return a concise result.';
|
|
@@ -208,14 +241,15 @@ export class PromptBuilder {
|
|
|
208
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.',
|
|
209
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.',
|
|
210
243
|
'5. [CODE QUALITY]: Write clean, modular, SOLID code. Check for syntax errors carefully. Do not generate incomplete code blocks.',
|
|
211
|
-
'6. [NO HALLUCINATION]: If you don\'t know, use tools (Grep/Read/Web/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.',
|
|
212
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.',
|
|
213
246
|
'8. [IMAGE INPUTS]: If an image is attached or pasted, analyze it directly and use it as evidence for UI/debug/design decisions.',
|
|
214
247
|
'',
|
|
215
248
|
rolePrompt,
|
|
216
249
|
'',
|
|
217
250
|
'## Tool Rules',
|
|
218
|
-
'- Canonical tools: Read, Write, Edit, Bash, Glob, Grep, TaskCreate, TaskUpdate, TaskList, BrowserDebug, WebFetch, WebSearch.',
|
|
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.',
|
|
219
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"}.',
|
|
220
254
|
'- Treat skills, memories, bundled resources, local project rules, and the tool list as operational context. Use them proactively when relevant.',
|
|
221
255
|
`- Runtime environment:\n${runtimeSummary}`,
|
|
@@ -223,11 +257,16 @@ export class PromptBuilder {
|
|
|
223
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.',
|
|
224
258
|
'- If a tool call fails because of an unknown alias, call the canonical tool name next.',
|
|
225
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 }),
|
|
226
265
|
'',
|
|
227
266
|
'## Project',
|
|
228
267
|
`Working directory: ${this.projectPath}`,
|
|
229
268
|
`Current session: ${this.session?.getSessionId?.()?.substring(0, 8) || 'unknown'}`,
|
|
230
|
-
`${requiredResourcesStr}${memoryStr}${plansStr}${skillsStr}${startupPlanStr}`,
|
|
269
|
+
`${requiredResourcesStr}${resourceProfileStr}${memoryStr}${plansStr}${skillsStr}${startupPlanStr}`,
|
|
231
270
|
context ? `\n## Project Context\n${this._compactText(context, projectContextBudget, 'project context')}` : '',
|
|
232
271
|
].join('\n');
|
|
233
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':
|