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.
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +12 -6
- package/dist/App.js.map +1 -1
- package/dist/agent/agent.d.ts +2 -0
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +111 -10
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/backends/anthropic.d.ts.map +1 -1
- package/dist/agent/backends/anthropic.js +15 -3
- package/dist/agent/backends/anthropic.js.map +1 -1
- package/dist/agent/backends/gemini.d.ts.map +1 -1
- package/dist/agent/backends/gemini.js +12 -0
- package/dist/agent/backends/gemini.js.map +1 -1
- package/dist/agent/backends/index.d.ts +1 -1
- package/dist/agent/backends/index.d.ts.map +1 -1
- package/dist/agent/backends/openai_compatible.d.ts.map +1 -1
- package/dist/agent/backends/openai_compatible.js +12 -0
- package/dist/agent/backends/openai_compatible.js.map +1 -1
- package/dist/agent/backends/types.d.ts +21 -1
- package/dist/agent/backends/types.d.ts.map +1 -1
- package/dist/agent/runtime/capabilities.d.ts +2 -1
- package/dist/agent/runtime/capabilities.d.ts.map +1 -1
- package/dist/agent/runtime/capabilities.js +1 -0
- package/dist/agent/runtime/capabilities.js.map +1 -1
- package/dist/agent/tools/index.d.ts +1 -0
- package/dist/agent/tools/index.d.ts.map +1 -1
- package/dist/agent/tools/index.js +6 -1
- package/dist/agent/tools/index.js.map +1 -1
- package/dist/agent/tools/screenshot.d.ts +23 -0
- package/dist/agent/tools/screenshot.d.ts.map +1 -0
- package/dist/agent/tools/screenshot.js +735 -0
- package/dist/agent/tools/screenshot.js.map +1 -0
- package/dist/utils/path_complete.d.ts.map +1 -1
- package/dist/utils/path_complete.js +31 -6
- package/dist/utils/path_complete.js.map +1 -1
- package/package.json +1 -1
- package/src/App.tsx +12 -6
- package/src/agent/agent.ts +116 -11
- package/src/agent/backends/anthropic.ts +15 -5
- package/src/agent/backends/gemini.ts +12 -0
- package/src/agent/backends/index.ts +1 -0
- package/src/agent/backends/openai_compatible.ts +12 -0
- package/src/agent/backends/types.ts +25 -1
- package/src/agent/runtime/capabilities.ts +2 -1
- package/src/agent/tools/index.ts +6 -1
- package/src/agent/tools/screenshot.ts +821 -0
- 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
|
-
|
|
104
|
-
|
|
105
|
-
if (
|
|
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 {
|