zames_pro 2.19.0 → 2.21.1

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.
@@ -6,14 +6,20 @@ export function renderContextSection(context) {
6
6
  let out = '';
7
7
  for (const f of context.agents) {
8
8
  out +=
9
- '\n## Project instructions (' + f.path + ')\n\n' +
10
- 'The following come from ' + f.path + '. Follow them for this project unless the operator explicitly overrides them.\n\n' +
9
+ '\n## Project instructions (' +
10
+ f.path +
11
+ ')\n\n' +
12
+ 'The following come from ' +
13
+ f.path +
14
+ '. Follow them for this project unless the operator explicitly overrides them.\n\n' +
11
15
  f.content +
12
16
  '\n';
13
17
  }
14
18
  for (const f of context.memory) {
15
19
  out +=
16
- '\n## Memory (' + f.path + ')\n\n' +
20
+ '\n## Memory (' +
21
+ f.path +
22
+ ')\n\n' +
17
23
  'Durable notes accumulated across sessions. Treat as background knowledge; update this file when you learn something worth remembering.\n\n' +
18
24
  f.content +
19
25
  '\n';
@@ -21,7 +27,9 @@ export function renderContextSection(context) {
21
27
  if (context.memory.length) {
22
28
  out +=
23
29
  '\nWhen you learn a durable fact about this project or the operator preferences (build quirks, ' +
24
- 'conventions, gotchas), append a short bullet to ' + context.memory[0].path + ' via Edit/Write so it survives ' +
30
+ 'conventions, gotchas), append a short bullet to ' +
31
+ context.memory[0].path +
32
+ ' via Edit/Write so it survives ' +
25
33
  'into future sessions. Keep entries concise.\n';
26
34
  }
27
35
  if (context.skills.length) {
@@ -29,7 +37,13 @@ export function renderContextSection(context) {
29
37
  const tools = s.allowedTools && s.allowedTools.length
30
38
  ? ' [tools: ' + s.allowedTools.join(', ') + ']'
31
39
  : '';
32
- return '- ' + s.name + tools + ': ' + (s.description || '(no description)') + '\n file: ' + s.path;
40
+ return ('- ' +
41
+ s.name +
42
+ tools +
43
+ ': ' +
44
+ (s.description || '(no description)') +
45
+ '\n file: ' +
46
+ s.path);
33
47
  });
34
48
  out +=
35
49
  '\n## Skills\n\n' +
package/dist/tools.js CHANGED
@@ -166,7 +166,7 @@ export function createTools(workdir, { undo } = {}) {
166
166
  old_base64: 'string?',
167
167
  new_base64: 'string?',
168
168
  },
169
- fn: async ({ path: p, old_string, new_string, old_base64, new_base64 }) => {
169
+ fn: async ({ path: p, old_string, new_string, old_base64, new_base64, }) => {
170
170
  const file = safe(req(p, 'path'));
171
171
  const oldStr = decodeContent(old_string, old_base64);
172
172
  const newStr = decodeContent(new_string, new_base64);
@@ -241,11 +241,7 @@ export function createTools(workdir, { undo } = {}) {
241
241
  const scope = searchPath ? '"' + target + '\\*' : '*';
242
242
  return runShell(`findstr /s /n /r /c:"${escaped}" ` + scope);
243
243
  }
244
- const flags = mode === 'files_only'
245
- ? '-rlE'
246
- : mode === 'count'
247
- ? '-rcE'
248
- : '-rnE';
244
+ const flags = mode === 'files_only' ? '-rlE' : mode === 'count' ? '-rcE' : '-rnE';
249
245
  const includeArg = inc ? ' --include=' + JSON.stringify(inc) : '';
250
246
  return runShell(`grep ${flags}${includeArg} ${JSON.stringify(pat)} ` +
251
247
  `${JSON.stringify(target)} || true`);
package/dist/web.js CHANGED
@@ -43,7 +43,7 @@ function htmlToText(html) {
43
43
  return s;
44
44
  }
45
45
  // fetch with redirects and a timeout
46
- async function httpFetch(url, { timeout = DEFAULT_TIMEOUT, headers = {} } = {}) {
46
+ async function httpFetch(url, { timeout = DEFAULT_TIMEOUT, headers = {}, } = {}) {
47
47
  const ctrl = new AbortController();
48
48
  const t = setTimeout(() => ctrl.abort(), timeout);
49
49
  try {
@@ -1,11 +1,16 @@
1
1
  function unescapeXml(s) {
2
2
  const A = String.fromCharCode(38); // ampersand
3
3
  return String(s)
4
- .split(A + 'lt;').join(String.fromCharCode(60))
5
- .split(A + 'gt;').join(String.fromCharCode(62))
6
- .split(A + 'quot;').join(String.fromCharCode(34))
7
- .split(A + 'apos;').join(String.fromCharCode(39))
8
- .split(A + 'amp;').join(A);
4
+ .split(A + 'lt;')
5
+ .join(String.fromCharCode(60))
6
+ .split(A + 'gt;')
7
+ .join(String.fromCharCode(62))
8
+ .split(A + 'quot;')
9
+ .join(String.fromCharCode(34))
10
+ .split(A + 'apos;')
11
+ .join(String.fromCharCode(39))
12
+ .split(A + 'amp;')
13
+ .join(A);
9
14
  }
10
15
  function readAttr(attrs, name) {
11
16
  const Q = String.fromCharCode(34);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zames_pro",
3
- "version": "2.19.0",
3
+ "version": "2.21.1",
4
4
  "description": "Terminal coding agent over chat.deepseek.com via Playwright",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,9 +15,13 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "start": "node ./dist/index.js",
18
- "dev": "ZAMES_NET_DEBUG=1 tsx ./src/index.ts --dev",
18
+ "dev": "ZAMES_NET_DEBUG=1 tsx ./src/index.ts --dev --headed",
19
19
  "build": "tsc -p tsconfig.build.json",
20
20
  "typecheck": "tsc --noEmit",
21
+ "lint": "node scripts/eslint-ts6.mjs",
22
+ "lint:fix": "node scripts/eslint-ts6.mjs --fix",
23
+ "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json,md}\"",
24
+ "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
21
25
  "prepublishOnly": "npm run build",
22
26
  "test": "tsx --test test/*.test.ts",
23
27
  "test:watch": "tsx --test --watch test/*.test.ts",
@@ -56,9 +60,16 @@
56
60
  "url": "https://github.com/Viqto0r/zames_pro/issues"
57
61
  },
58
62
  "devDependencies": {
63
+ "@eslint/js": "^9.39.5",
59
64
  "@types/node": "^26.6.2",
65
+ "eslint": "^9.39.5",
66
+ "eslint-config-prettier": "^10.1.8",
67
+ "globals": "^17.12.0",
60
68
  "husky": "^9.1.7",
69
+ "prettier": "^3.9.9",
61
70
  "tsx": "^4.23.15",
62
- "typescript": "^7.0.2"
71
+ "typescript": "^7.0.2",
72
+ "typescript-6": "npm:typescript@^6.0.0-beta",
73
+ "typescript-eslint": "^8.70.1"
63
74
  }
64
75
  }
@@ -0,0 +1,51 @@
1
+ // Run ESLint so that typescript-eslint uses the TypeScript 6 API.
2
+ //
3
+ // The project is built with TypeScript 7, but typescript-eslint (8.x) does
4
+ // not support the TS 7 API yet and refuses to start. Its own recommendation is
5
+ // to run "side by side with TypeScript 6": load the TS 6 compiler just for the
6
+ // linter. We do that by aliasing the `typescript` module to the `typescript-6`
7
+ // package for the duration of the ESLint process, without touching the
8
+ // compiler the project actually builds with.
9
+ import { createRequire } from 'module'
10
+ import Module from 'module'
11
+ import path from 'path'
12
+ import { fileURLToPath } from 'url'
13
+
14
+ const require = createRequire(import.meta.url)
15
+ const here = path.dirname(fileURLToPath(import.meta.url))
16
+ const ts6 = path.join(here, '..', 'node_modules', 'typescript-6')
17
+
18
+ try {
19
+ require.resolve(path.join(ts6, 'lib', 'typescript.js'))
20
+ } catch {
21
+ console.error(
22
+ 'eslint-ts6: the typescript-6 package is missing. Run: npm i -D typescript-6@npm:typescript@6',
23
+ )
24
+ process.exit(1)
25
+ }
26
+
27
+ // Patch Module._resolveFilename so any require('typescript') resolves to the
28
+ // TS 6 package instead of the TS 7 the project depends on.
29
+ const origResolve = Module._resolveFilename
30
+ Module._resolveFilename = function (request, ...rest) {
31
+ if (request === 'typescript') {
32
+ try {
33
+ return require.resolve(path.join(ts6, 'lib', 'typescript.js'))
34
+ } catch {
35
+ return origResolve.call(this, request, ...rest)
36
+ }
37
+ }
38
+ return origResolve.call(this, request, ...rest)
39
+ }
40
+
41
+ const { ESLint } = await import('eslint')
42
+ const eslint = new ESLint({ fix: process.argv.includes('--fix') })
43
+ const results = await eslint.lintFiles(['.'])
44
+ if (process.argv.includes('--fix')) {
45
+ await ESLint.outputFixes(results)
46
+ }
47
+ const formatter = await eslint.loadFormatter('stylish')
48
+ const out = await formatter.format(results)
49
+ if (out) process.stdout.write(out)
50
+ const errors = results.reduce((n, r) => n + r.errorCount, 0)
51
+ process.exit(errors > 0 ? 1 : 0)