@zhin.js/agent 0.0.19 → 0.1.0
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 +29 -0
- package/README.md +5 -2
- package/lib/builtin-tools.d.ts.map +1 -1
- package/lib/builtin-tools.js +136 -37
- package/lib/builtin-tools.js.map +1 -1
- package/lib/init/create-zhin-agent.d.ts.map +1 -1
- package/lib/init/create-zhin-agent.js +28 -2
- package/lib/init/create-zhin-agent.js.map +1 -1
- package/lib/init/register-ai-trigger.d.ts.map +1 -1
- package/lib/init/register-ai-trigger.js +10 -3
- package/lib/init/register-ai-trigger.js.map +1 -1
- package/lib/service.d.ts +4 -0
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +3 -0
- package/lib/service.js.map +1 -1
- package/lib/zhin-agent/config.d.ts +2 -0
- package/lib/zhin-agent/config.d.ts.map +1 -1
- package/lib/zhin-agent/config.js +1 -0
- package/lib/zhin-agent/config.js.map +1 -1
- package/lib/zhin-agent/exec-policy.js +2 -2
- package/lib/zhin-agent/exec-policy.js.map +1 -1
- package/lib/zhin-agent/index.d.ts +10 -0
- package/lib/zhin-agent/index.d.ts.map +1 -1
- package/lib/zhin-agent/index.js +122 -48
- package/lib/zhin-agent/index.js.map +1 -1
- package/lib/zhin-agent/prompt.js +2 -2
- package/lib/zhin-agent/prompt.js.map +1 -1
- package/package.json +3 -3
- package/src/builtin-tools.ts +143 -37
- package/src/init/create-zhin-agent.ts +27 -2
- package/src/init/register-ai-trigger.ts +15 -3
- package/src/service.ts +4 -0
- package/src/zhin-agent/config.ts +3 -0
- package/src/zhin-agent/exec-policy.ts +2 -2
- package/src/zhin-agent/index.ts +116 -42
- package/src/zhin-agent/prompt.ts +2 -2
package/src/zhin-agent/prompt.ts
CHANGED
|
@@ -166,7 +166,7 @@ function buildDoingTasksSection(): string {
|
|
|
166
166
|
'File changes must use edit_file/write_file — never give manual instructions for the user to apply.',
|
|
167
167
|
'Read files before modifying them. Understand existing code before suggesting changes.',
|
|
168
168
|
'Prefer editing existing files over creating new ones to prevent file bloat.',
|
|
169
|
-
'If an approach fails, diagnose why before switching — read the error, check assumptions. Don\'t retry the identical action blindly. Use ask_user only when genuinely stuck after investigation.',
|
|
169
|
+
'If an approach fails, diagnose why before switching — read the error, check assumptions. Don\'t retry the identical action blindly. Use ask_user only when genuinely stuck after investigation (it will contact the Owner, not the current user).',
|
|
170
170
|
'Be careful not to introduce security vulnerabilities (command injection, XSS, SQL injection). If you notice insecure code, fix it immediately.',
|
|
171
171
|
...codeStyleItems,
|
|
172
172
|
'All answers must be based on actual tool output — do not fabricate results.',
|
|
@@ -183,7 +183,7 @@ function buildDoingTasksSection(): string {
|
|
|
183
183
|
function buildActionsSection(): string {
|
|
184
184
|
return `# Executing actions with care
|
|
185
185
|
|
|
186
|
-
Carefully consider the reversibility and impact of actions. You can freely take local, reversible actions like reading files, searching content, or running read-only commands. But for actions that are hard to reverse, affect shared systems, or could be destructive, check with the
|
|
186
|
+
Carefully consider the reversibility and impact of actions. You can freely take local, reversible actions like reading files, searching content, or running read-only commands. But for actions that are hard to reverse, affect shared systems, or could be destructive, check with the Owner before proceeding (use ask_user — it always routes to the configured Owner via private message, never to the current chat user).
|
|
187
187
|
|
|
188
188
|
Examples of risky actions that warrant user confirmation:
|
|
189
189
|
- Destructive operations: deleting files, dropping database tables, overwriting uncommitted changes
|