zames_pro 2.11.0 → 2.12.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/README.md +4 -3
- package/dist/agent-loop.js +20 -0
- package/dist/i18n.js +5 -1
- package/dist/index.js +81 -14
- package/dist/input.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,8 +83,9 @@ workflows from your repository and from `~/.zames`.
|
|
|
83
83
|
|
|
84
84
|
- **AGENTS.md** — project instructions. Put one in the repo root (or in any
|
|
85
85
|
parent folder of the working directory). Global instructions live in
|
|
86
|
-
`~/.zames/AGENTS.md` (and `~/.claude/CLAUDE.md`).
|
|
87
|
-
|
|
86
|
+
`~/.zames/AGENTS.md` (and `~/.claude/CLAUDE.md`). Run `/init` and the agent
|
|
87
|
+
will explore the project and write an AGENTS.md based on the real build/test
|
|
88
|
+
commands and conventions (use `/init --force` to overwrite an existing file).
|
|
88
89
|
- **MEMORY.md** — durable notes that persist between sessions. The agent
|
|
89
90
|
appends useful facts here; you can edit it by hand.
|
|
90
91
|
- **Skills** — a folder with a `SKILL.md` file (YAML frontmatter: `name`,
|
|
@@ -102,7 +103,7 @@ Skills and custom commands show up in the «/» completion list and in `/help`.
|
|
|
102
103
|
```
|
|
103
104
|
/skills list discovered skills
|
|
104
105
|
/memory show AGENTS.md / MEMORY.md in effect
|
|
105
|
-
/init
|
|
106
|
+
/init [--force] analyze the project and create AGENTS.md
|
|
106
107
|
```
|
|
107
108
|
|
|
108
109
|
## Configuration
|
package/dist/agent-loop.js
CHANGED
|
@@ -932,6 +932,26 @@ function parseToolCallPermissive(text) {
|
|
|
932
932
|
if (!toolMatch)
|
|
933
933
|
return null;
|
|
934
934
|
const tool = toolMatch[1];
|
|
935
|
+
// The model occasionally puts the argument keys INLINE with "tool" —
|
|
936
|
+
// {"tool": "Bash", "command": "..."} — with no "args" wrapper at all.
|
|
937
|
+
// The strict parser rejects it (no obj.args), and the permissive parser
|
|
938
|
+
// used to bail out too (indexOf('"args"') === -1). Such a call was
|
|
939
|
+
// reported as malformed and re-asked up to MAX_MALFORMED_RETRIES times;
|
|
940
|
+
// after the budget ran out the run stopped with the model's text as the
|
|
941
|
+
// final answer. Flatten the inline keys into args when "args" is absent.
|
|
942
|
+
if (text.indexOf('"args"') === -1) {
|
|
943
|
+
const braceIdx = text.indexOf('{');
|
|
944
|
+
if (braceIdx === -1)
|
|
945
|
+
return null;
|
|
946
|
+
const endBrace = findMatching(text, braceIdx, '{', '}');
|
|
947
|
+
const objText = endBrace === -1 ? text.slice(braceIdx) : text.slice(braceIdx, endBrace + 1);
|
|
948
|
+
const inlineArgs = parseArgsPermissive(objText) || parseArgsGreedy(objText);
|
|
949
|
+
if (!inlineArgs)
|
|
950
|
+
return null;
|
|
951
|
+
delete inlineArgs.tool;
|
|
952
|
+
// The value may be a string ("command": "...") or a number/bool.
|
|
953
|
+
return { tool, args: inlineArgs };
|
|
954
|
+
}
|
|
935
955
|
const argsIdx = text.indexOf('"args"');
|
|
936
956
|
if (argsIdx === -1)
|
|
937
957
|
return null;
|
package/dist/i18n.js
CHANGED
|
@@ -89,11 +89,15 @@ const CATALOG = {
|
|
|
89
89
|
'memory.memory': { ru: 'Память (MEMORY.md):', en: 'Memory (MEMORY.md):' },
|
|
90
90
|
'init.exists': { ru: 'AGENTS.md уже существует: {v}', en: 'AGENTS.md already exists: {v}' },
|
|
91
91
|
'init.created': { ru: 'Создан {v}', en: 'Created {v}' },
|
|
92
|
+
'init.analyzing': { ru: 'Изучаю проект и готовлю AGENTS.md...', en: 'Analyzing the project and preparing AGENTS.md...' },
|
|
93
|
+
'init.done': { ru: 'AGENTS.md создан агентом: {v}', en: 'AGENTS.md created by the agent: {v}' },
|
|
94
|
+
'init.failed': { ru: 'Не удалось создать AGENTS.md автоматически, записан базовый шаблон.', en: 'Could not create AGENTS.md automatically, wrote a basic template.' },
|
|
95
|
+
'init.overwrite': { ru: 'AGENTS.md уже существует: {v} (используйте /init --force для перезаписи)', en: 'AGENTS.md already exists: {v} (use /init --force to overwrite)' },
|
|
92
96
|
'help.cmd.skill': { ru: 'навык (SKILL.md)', en: 'skill (SKILL.md)' },
|
|
93
97
|
'help.cmd.custom': { ru: 'пользовательская команда', en: 'custom command' },
|
|
94
98
|
'help.cmd.skills': { ru: '/skills список найденных навыков', en: '/skills list discovered skills' },
|
|
95
99
|
'help.cmd.memory': { ru: '/memory показать MEMORY.md и AGENTS.md', en: '/memory show MEMORY.md and AGENTS.md' },
|
|
96
|
-
'help.cmd.init': { ru: '/init
|
|
100
|
+
'help.cmd.init': { ru: '/init [--force] изучить проект и создать AGENTS.md', en: '/init [--force] analyze the project and create AGENTS.md' },
|
|
97
101
|
'help.skills': { ru: 'Навыки и свои команды:', en: 'Skills and custom commands:' },
|
|
98
102
|
'help.self_review': { ru: 'Самообзор (отладка агента):', en: 'Self-review (agent debugging):' },
|
|
99
103
|
'help.self.review': { ru: '/self-review [фокус] снять снапшот src/ и запустить ревью', en: '/self-review [focus] snapshot src/ and run review' },
|
package/dist/index.js
CHANGED
|
@@ -1786,24 +1786,91 @@ async function main() {
|
|
|
1786
1786
|
show(t('memory.memory'), ctx.memory);
|
|
1787
1787
|
continue;
|
|
1788
1788
|
}
|
|
1789
|
-
if (lower === '/init') {
|
|
1789
|
+
if (lower === '/init' || lower.startsWith('/init ')) {
|
|
1790
|
+
const force = lower.includes('--force');
|
|
1790
1791
|
const target = path.join(currentWorkdir, 'AGENTS.md');
|
|
1791
1792
|
const exists = await fs.stat(target).catch(() => null);
|
|
1792
|
-
if (exists) {
|
|
1793
|
-
console.log(theme.warn(t('init.
|
|
1793
|
+
if (exists && !force) {
|
|
1794
|
+
console.log(theme.warn(t('init.overwrite', { v: target })));
|
|
1794
1795
|
continue;
|
|
1795
1796
|
}
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
'
|
|
1801
|
-
'
|
|
1802
|
-
'
|
|
1803
|
-
'
|
|
1804
|
-
'
|
|
1805
|
-
|
|
1806
|
-
|
|
1797
|
+
// Like Codex: let the agent explore the project and write AGENTS.md via
|
|
1798
|
+
// the Write tool, so the file reflects the real build/test commands and
|
|
1799
|
+
// conventions instead of a static template.
|
|
1800
|
+
const initTask = 'The user ran /init. Analyze this repository and create an AGENTS.md ' +
|
|
1801
|
+
'file at the project root that onboards future coding agents. Explore ' +
|
|
1802
|
+
'the project first (read the README, package.json and other manifests, ' +
|
|
1803
|
+
'configs, CI, and a sample of source files). Then write AGENTS.md with: ' +
|
|
1804
|
+
'an overview of what the project is; build/typecheck/test/lint commands ' +
|
|
1805
|
+
'(use the real scripts you find); code style and conventions; the repo ' +
|
|
1806
|
+
'layout; and any gotchas or rules an agent must follow. Keep it concise ' +
|
|
1807
|
+
'and factual, based only on what you find. Write the file with the Write ' +
|
|
1808
|
+
'tool, then reply via respond with a one-line summary.';
|
|
1809
|
+
const initTools = mod.createTools(currentWorkdir, { undo });
|
|
1810
|
+
if (editor)
|
|
1811
|
+
editor.busy = true;
|
|
1812
|
+
console.log(theme.system(t('init.analyzing')));
|
|
1813
|
+
try {
|
|
1814
|
+
await mod.runAgentLoop({
|
|
1815
|
+
browser,
|
|
1816
|
+
tools: initTools,
|
|
1817
|
+
task: initTask,
|
|
1818
|
+
workdir: currentWorkdir,
|
|
1819
|
+
maxIterations: maxIter,
|
|
1820
|
+
freshChat: freshChatNext,
|
|
1821
|
+
sendSystemPrompt: sendSystemPromptNext,
|
|
1822
|
+
transcript,
|
|
1823
|
+
onThinking: () => { },
|
|
1824
|
+
onToolCall: (name, toolArgs) => {
|
|
1825
|
+
if (editor)
|
|
1826
|
+
editor.toolCall(name, toolArgs);
|
|
1827
|
+
},
|
|
1828
|
+
onToolResult: (r) => {
|
|
1829
|
+
if (editor)
|
|
1830
|
+
editor.toolResult(r);
|
|
1831
|
+
},
|
|
1832
|
+
onAssistantMessage: (m) => {
|
|
1833
|
+
if (editor)
|
|
1834
|
+
editor.assistant(m);
|
|
1835
|
+
},
|
|
1836
|
+
onWarning: (m) => {
|
|
1837
|
+
if (editor)
|
|
1838
|
+
editor.warning(m);
|
|
1839
|
+
},
|
|
1840
|
+
locale: currentLocale,
|
|
1841
|
+
});
|
|
1842
|
+
}
|
|
1843
|
+
catch (e) {
|
|
1844
|
+
console.error(theme.error(t('init.failed')), e.message);
|
|
1845
|
+
}
|
|
1846
|
+
finally {
|
|
1847
|
+
if (editor)
|
|
1848
|
+
editor.busy = false;
|
|
1849
|
+
}
|
|
1850
|
+
freshChatNext = false;
|
|
1851
|
+
sendSystemPromptNext = false;
|
|
1852
|
+
if (!currentChatId) {
|
|
1853
|
+
currentChatId = await browser.getCurrentChatId();
|
|
1854
|
+
}
|
|
1855
|
+
saveLastChat(currentChatId, currentWorkdir);
|
|
1856
|
+
const created = await fs.stat(target).catch(() => null);
|
|
1857
|
+
if (created) {
|
|
1858
|
+
console.log(theme.assistant(t('init.done', { v: target })));
|
|
1859
|
+
}
|
|
1860
|
+
else {
|
|
1861
|
+
const stub = '# AGENTS.md\n\n' +
|
|
1862
|
+
'Project instructions for the coding agent. Describe the build/test commands, ' +
|
|
1863
|
+
'conventions, and any rules the agent must follow in this repository.\n\n' +
|
|
1864
|
+
'## Commands\n\n' +
|
|
1865
|
+
'- build: `...`\n' +
|
|
1866
|
+
'- test: `...`\n' +
|
|
1867
|
+
'- lint: `...`\n\n' +
|
|
1868
|
+
'## Conventions\n\n' +
|
|
1869
|
+
'- ...\n';
|
|
1870
|
+
await fs.writeFile(target, stub, 'utf-8');
|
|
1871
|
+
console.log(theme.warn(t('init.failed')));
|
|
1872
|
+
console.log(theme.assistant(t('init.created', { v: target })));
|
|
1873
|
+
}
|
|
1807
1874
|
continue;
|
|
1808
1875
|
}
|
|
1809
1876
|
if (lower === '/reload') {
|
package/dist/input.js
CHANGED
|
@@ -351,6 +351,12 @@ export class LineEditor {
|
|
|
351
351
|
}
|
|
352
352
|
unlock() {
|
|
353
353
|
this.locked = false;
|
|
354
|
+
// A lock may have set the status hint ("operation in progress, input is
|
|
355
|
+
// temporarily locked"). If nothing else replaced it (no spinner, no
|
|
356
|
+
// pending text), clear it here — otherwise the hint stays on screen
|
|
357
|
+
// forever after a fast operation like /new.
|
|
358
|
+
if (this.statusText)
|
|
359
|
+
this.setStatus('');
|
|
354
360
|
}
|
|
355
361
|
setPrompt(str) {
|
|
356
362
|
this.promptStr = str;
|