zerg-ztc 0.1.7 → 0.1.10

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.
Files changed (47) hide show
  1. package/dist/App.d.ts.map +1 -1
  2. package/dist/App.js +12 -6
  3. package/dist/App.js.map +1 -1
  4. package/dist/agent/agent.d.ts +2 -0
  5. package/dist/agent/agent.d.ts.map +1 -1
  6. package/dist/agent/agent.js +111 -10
  7. package/dist/agent/agent.js.map +1 -1
  8. package/dist/agent/backends/anthropic.d.ts.map +1 -1
  9. package/dist/agent/backends/anthropic.js +15 -3
  10. package/dist/agent/backends/anthropic.js.map +1 -1
  11. package/dist/agent/backends/gemini.d.ts.map +1 -1
  12. package/dist/agent/backends/gemini.js +12 -0
  13. package/dist/agent/backends/gemini.js.map +1 -1
  14. package/dist/agent/backends/index.d.ts +1 -1
  15. package/dist/agent/backends/index.d.ts.map +1 -1
  16. package/dist/agent/backends/openai_compatible.d.ts.map +1 -1
  17. package/dist/agent/backends/openai_compatible.js +12 -0
  18. package/dist/agent/backends/openai_compatible.js.map +1 -1
  19. package/dist/agent/backends/types.d.ts +21 -1
  20. package/dist/agent/backends/types.d.ts.map +1 -1
  21. package/dist/agent/runtime/capabilities.d.ts +2 -1
  22. package/dist/agent/runtime/capabilities.d.ts.map +1 -1
  23. package/dist/agent/runtime/capabilities.js +1 -0
  24. package/dist/agent/runtime/capabilities.js.map +1 -1
  25. package/dist/agent/tools/index.d.ts +1 -0
  26. package/dist/agent/tools/index.d.ts.map +1 -1
  27. package/dist/agent/tools/index.js +6 -1
  28. package/dist/agent/tools/index.js.map +1 -1
  29. package/dist/agent/tools/screenshot.d.ts +23 -0
  30. package/dist/agent/tools/screenshot.d.ts.map +1 -0
  31. package/dist/agent/tools/screenshot.js +735 -0
  32. package/dist/agent/tools/screenshot.js.map +1 -0
  33. package/dist/utils/path_complete.d.ts.map +1 -1
  34. package/dist/utils/path_complete.js +31 -6
  35. package/dist/utils/path_complete.js.map +1 -1
  36. package/package.json +1 -1
  37. package/src/App.tsx +12 -6
  38. package/src/agent/agent.ts +116 -11
  39. package/src/agent/backends/anthropic.ts +15 -5
  40. package/src/agent/backends/gemini.ts +12 -0
  41. package/src/agent/backends/index.ts +1 -0
  42. package/src/agent/backends/openai_compatible.ts +12 -0
  43. package/src/agent/backends/types.ts +25 -1
  44. package/src/agent/runtime/capabilities.ts +2 -1
  45. package/src/agent/tools/index.ts +6 -1
  46. package/src/agent/tools/screenshot.ts +821 -0
  47. package/src/utils/path_complete.ts +30 -4
@@ -65,6 +65,24 @@ export async function completePath(
65
65
  partial: string,
66
66
  cwd: string
67
67
  ): Promise<{ completed: string; isDirectory: boolean; alternatives: string[] } | null> {
68
+ // Handle empty partial - list cwd contents
69
+ if (!partial || partial.trim() === '') {
70
+ try {
71
+ const entries = await readdir(cwd, { withFileTypes: true });
72
+ const matches = entries.filter(e => !e.name.startsWith('.')).sort();
73
+ if (matches.length === 0) return null;
74
+ if (matches.length === 1) {
75
+ const entry = matches[0];
76
+ const suffix = entry.isDirectory() ? '/' : '';
77
+ return { completed: entry.name + suffix, isDirectory: entry.isDirectory(), alternatives: [] };
78
+ }
79
+ const alternatives = matches.map(e => e.name + (e.isDirectory() ? '/' : ''));
80
+ return { completed: '', isDirectory: false, alternatives };
81
+ } catch {
82
+ return null;
83
+ }
84
+ }
85
+
68
86
  // Expand tilde for internal processing
69
87
  let expandedPartial = partial;
70
88
  let tildePrefix = '';
@@ -84,7 +102,7 @@ export async function completePath(
84
102
  const { stat } = await import('fs/promises');
85
103
  const stats = await stat(fullPath);
86
104
  if (stats.isDirectory()) {
87
- // Already a complete directory, append /
105
+ // Already a complete directory, append / if not present
88
106
  if (!partial.endsWith('/')) {
89
107
  return { completed: partial + '/', isDirectory: true, alternatives: [] };
90
108
  }
@@ -100,9 +118,17 @@ export async function completePath(
100
118
  // Path doesn't exist, complete the last component
101
119
  dirToList = dirname(fullPath);
102
120
  prefix = basename(fullPath).toLowerCase();
103
- basePath = tildePrefix ? tildePrefix + dirname(expandedPartial.slice(homedir().length + 1)) : dirname(partial);
104
- if (basePath && !basePath.endsWith('/')) basePath += '/';
105
- if (basePath === './') basePath = '';
121
+
122
+ // Calculate basePath - the directory portion to preserve
123
+ if (tildePrefix) {
124
+ const afterTilde = expandedPartial.slice(homedir().length + 1);
125
+ const dirPart = dirname(afterTilde);
126
+ basePath = dirPart === '.' ? tildePrefix : tildePrefix + dirPart + '/';
127
+ } else {
128
+ const dirPart = dirname(partial);
129
+ // Don't add ./ prefix for simple filenames
130
+ basePath = (dirPart === '.' || dirPart === '') ? '' : dirPart + '/';
131
+ }
106
132
  }
107
133
 
108
134
  try {