zerg-ztc 0.1.11 → 0.1.13
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/bin/ztc-audio-darwin-arm64 +0 -0
- package/dist/utils/dictation_native.d.ts.map +1 -1
- package/dist/utils/dictation_native.js +43 -23
- package/dist/utils/dictation_native.js.map +1 -1
- package/package.json +5 -4
- package/packages/ztc-dictation/Cargo.toml +0 -43
- package/packages/ztc-dictation/README.md +0 -65
- package/packages/ztc-dictation/index.d.ts +0 -16
- package/packages/ztc-dictation/index.js +0 -74
- package/packages/ztc-dictation/package.json +0 -41
- package/packages/ztc-dictation/src/main.rs +0 -430
- package/src/App.tsx +0 -910
- package/src/agent/agent.ts +0 -534
- package/src/agent/backends/anthropic.ts +0 -86
- package/src/agent/backends/gemini.ts +0 -119
- package/src/agent/backends/inception.ts +0 -23
- package/src/agent/backends/index.ts +0 -17
- package/src/agent/backends/openai.ts +0 -23
- package/src/agent/backends/openai_compatible.ts +0 -143
- package/src/agent/backends/types.ts +0 -83
- package/src/agent/commands/clipboard.ts +0 -77
- package/src/agent/commands/config.ts +0 -204
- package/src/agent/commands/debug.ts +0 -23
- package/src/agent/commands/dictation.ts +0 -11
- package/src/agent/commands/emulation.ts +0 -80
- package/src/agent/commands/execution.ts +0 -9
- package/src/agent/commands/help.ts +0 -20
- package/src/agent/commands/history.ts +0 -13
- package/src/agent/commands/index.ts +0 -48
- package/src/agent/commands/input_mode.ts +0 -22
- package/src/agent/commands/keybindings.ts +0 -40
- package/src/agent/commands/model.ts +0 -11
- package/src/agent/commands/models.ts +0 -116
- package/src/agent/commands/permissions.ts +0 -64
- package/src/agent/commands/retry.ts +0 -9
- package/src/agent/commands/shell.ts +0 -68
- package/src/agent/commands/skills.ts +0 -54
- package/src/agent/commands/status.ts +0 -19
- package/src/agent/commands/types.ts +0 -88
- package/src/agent/commands/update.ts +0 -32
- package/src/agent/factory.ts +0 -60
- package/src/agent/index.ts +0 -20
- package/src/agent/runtime/capabilities.ts +0 -7
- package/src/agent/runtime/memory.ts +0 -23
- package/src/agent/runtime/policy.ts +0 -48
- package/src/agent/runtime/session.ts +0 -18
- package/src/agent/runtime/tracing.ts +0 -23
- package/src/agent/tools/file.ts +0 -178
- package/src/agent/tools/index.ts +0 -52
- package/src/agent/tools/screenshot.ts +0 -821
- package/src/agent/tools/search.ts +0 -138
- package/src/agent/tools/shell.ts +0 -69
- package/src/agent/tools/skills.ts +0 -28
- package/src/agent/tools/types.ts +0 -14
- package/src/agent/tools/zerg.ts +0 -50
- package/src/cli.tsx +0 -163
- package/src/components/ActivityLine.tsx +0 -23
- package/src/components/FullScreen.tsx +0 -79
- package/src/components/Header.tsx +0 -27
- package/src/components/InputArea.tsx +0 -1660
- package/src/components/MessageList.tsx +0 -71
- package/src/components/SingleMessage.tsx +0 -298
- package/src/components/StatusBar.tsx +0 -55
- package/src/components/index.tsx +0 -8
- package/src/config/types.ts +0 -19
- package/src/config.ts +0 -186
- package/src/debug/logger.ts +0 -14
- package/src/emulation/README.md +0 -24
- package/src/emulation/catalog.ts +0 -82
- package/src/emulation/trace_style.ts +0 -8
- package/src/emulation/types.ts +0 -7
- package/src/skills/index.ts +0 -36
- package/src/skills/loader.ts +0 -135
- package/src/skills/registry.ts +0 -6
- package/src/skills/types.ts +0 -10
- package/src/types.ts +0 -84
- package/src/ui/README.md +0 -44
- package/src/ui/core/factory.ts +0 -9
- package/src/ui/core/index.ts +0 -4
- package/src/ui/core/input.ts +0 -38
- package/src/ui/core/input_segments.ts +0 -410
- package/src/ui/core/input_state.ts +0 -17
- package/src/ui/core/layout_yoga.ts +0 -122
- package/src/ui/core/style.ts +0 -38
- package/src/ui/core/types.ts +0 -54
- package/src/ui/ink/index.tsx +0 -1
- package/src/ui/ink/render.tsx +0 -60
- package/src/ui/views/activity_line.ts +0 -33
- package/src/ui/views/app.ts +0 -111
- package/src/ui/views/header.ts +0 -44
- package/src/ui/views/input_area.ts +0 -255
- package/src/ui/views/message_list.ts +0 -443
- package/src/ui/views/status_bar.ts +0 -114
- package/src/ui/vue/index.ts +0 -53
- package/src/ui/web/frame_render.tsx +0 -148
- package/src/ui/web/index.tsx +0 -1
- package/src/ui/web/render.tsx +0 -41
- package/src/utils/clipboard.ts +0 -39
- package/src/utils/clipboard_image.ts +0 -40
- package/src/utils/dictation.ts +0 -467
- package/src/utils/dictation_native.ts +0 -258
- package/src/utils/diff.ts +0 -52
- package/src/utils/image_preview.ts +0 -36
- package/src/utils/models.ts +0 -98
- package/src/utils/path_complete.ts +0 -173
- package/src/utils/path_format.ts +0 -99
- package/src/utils/shell.ts +0 -72
- package/src/utils/spinner_frames.ts +0 -1
- package/src/utils/spinner_verbs.ts +0 -23
- package/src/utils/table.ts +0 -171
- package/src/utils/tool_summary.ts +0 -56
- package/src/utils/tool_trace.ts +0 -346
- package/src/utils/update.ts +0 -44
- package/src/utils/version.ts +0 -15
- package/src/web/index.html +0 -352
- package/src/web/mirror-favicon.svg +0 -4
- package/src/web/mirror.html +0 -641
- package/src/web/mirror_hook.ts +0 -25
- package/src/web/mirror_server.ts +0 -204
- package/tsconfig.json +0 -22
- package/vite.config.ts +0 -363
- /package/{packages/ztc-dictation/bin → bin}/.gitkeep +0 -0
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import React, { useMemo } from 'react';
|
|
2
|
-
import { LayoutNode, LayoutFrame, computeLayout } from '../core/index.js';
|
|
3
|
-
|
|
4
|
-
type BadgeInfo = {
|
|
5
|
-
type: 'paste' | 'file' | 'image';
|
|
6
|
-
preview: string;
|
|
7
|
-
full: string;
|
|
8
|
-
path?: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
interface FrameRendererProps {
|
|
12
|
-
node: LayoutNode;
|
|
13
|
-
cols: number;
|
|
14
|
-
rows: number;
|
|
15
|
-
cellWidth: number;
|
|
16
|
-
cellHeight: number;
|
|
17
|
-
debugBorders?: boolean;
|
|
18
|
-
onBadgeHover?: (badge: BadgeInfo, x: number, y: number) => void;
|
|
19
|
-
onBadgeLeave?: () => void;
|
|
20
|
-
onBadgeClick?: (badge: BadgeInfo, x: number, y: number) => void;
|
|
21
|
-
onBadgeDblClick?: (badge: BadgeInfo, x: number, y: number) => void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function colorMap(color?: string): string {
|
|
25
|
-
const map: Record<string, string> = {
|
|
26
|
-
gray: '#9a9a9a',
|
|
27
|
-
magenta: '#c084fc',
|
|
28
|
-
yellow: '#facc15',
|
|
29
|
-
green: '#34d399',
|
|
30
|
-
red: '#f87171',
|
|
31
|
-
cyan: '#67e8f9',
|
|
32
|
-
blue: '#60a5fa',
|
|
33
|
-
white: '#e5e7eb'
|
|
34
|
-
};
|
|
35
|
-
return map[color || ''] || color || '#e6e6e6';
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function renderFrame(
|
|
39
|
-
frame: LayoutFrame,
|
|
40
|
-
keyPrefix: string,
|
|
41
|
-
cellWidth: number,
|
|
42
|
-
cellHeight: number,
|
|
43
|
-
debugBorders: boolean,
|
|
44
|
-
onBadgeHover?: (badge: BadgeInfo, x: number, y: number) => void,
|
|
45
|
-
onBadgeLeave?: () => void,
|
|
46
|
-
onBadgeClick?: (badge: BadgeInfo, x: number, y: number) => void,
|
|
47
|
-
onBadgeDblClick?: (badge: BadgeInfo, x: number, y: number) => void,
|
|
48
|
-
offsetX = 0,
|
|
49
|
-
offsetY = 0,
|
|
50
|
-
out: React.ReactElement[] = []
|
|
51
|
-
): React.ReactElement[] {
|
|
52
|
-
const x = offsetX + frame.x;
|
|
53
|
-
const y = offsetY + frame.y;
|
|
54
|
-
const keyBase = `${keyPrefix}-${x}-${y}`;
|
|
55
|
-
|
|
56
|
-
if (frame.node.type === 'text') {
|
|
57
|
-
const style = frame.node.style || {};
|
|
58
|
-
if (debugBorders) {
|
|
59
|
-
out.push(
|
|
60
|
-
<div
|
|
61
|
-
key={`${keyBase}-debug`}
|
|
62
|
-
style={{
|
|
63
|
-
position: 'absolute',
|
|
64
|
-
left: x * cellWidth,
|
|
65
|
-
top: y * cellHeight,
|
|
66
|
-
width: frame.width * cellWidth,
|
|
67
|
-
height: frame.height * cellHeight,
|
|
68
|
-
borderStyle: 'dashed',
|
|
69
|
-
borderWidth: 1,
|
|
70
|
-
borderColor: '#3a3a3a',
|
|
71
|
-
pointerEvents: 'none'
|
|
72
|
-
}}
|
|
73
|
-
/>
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
const badge = style.badge;
|
|
77
|
-
out.push(
|
|
78
|
-
<span
|
|
79
|
-
key={`${keyBase}-text`}
|
|
80
|
-
style={{
|
|
81
|
-
position: 'absolute',
|
|
82
|
-
left: x * cellWidth,
|
|
83
|
-
top: y * cellHeight,
|
|
84
|
-
color: style.inverse ? '#111' : colorMap(style.color),
|
|
85
|
-
fontWeight: style.bold ? 600 : undefined,
|
|
86
|
-
opacity: style.dimColor ? 0.6 : undefined,
|
|
87
|
-
background: style.inverse ? '#e6e6e6' : undefined,
|
|
88
|
-
colorScheme: 'only light',
|
|
89
|
-
cursor: badge ? 'pointer' : undefined
|
|
90
|
-
}}
|
|
91
|
-
title={badge?.preview || undefined}
|
|
92
|
-
onMouseEnter={badge ? (evt) => onBadgeHover?.(badge, evt.clientX, evt.clientY) : undefined}
|
|
93
|
-
onMouseLeave={badge ? () => onBadgeLeave?.() : undefined}
|
|
94
|
-
onClick={badge ? (evt) => onBadgeClick?.(badge, evt.clientX, evt.clientY) : undefined}
|
|
95
|
-
onDoubleClick={badge ? (evt) => onBadgeDblClick?.(badge, evt.clientX, evt.clientY) : undefined}
|
|
96
|
-
>
|
|
97
|
-
{frame.node.text}
|
|
98
|
-
</span>
|
|
99
|
-
);
|
|
100
|
-
return out;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if (frame.node.type === 'box' && (frame.node.style?.borderStyle || debugBorders)) {
|
|
104
|
-
out.push(
|
|
105
|
-
<div
|
|
106
|
-
key={`${keyBase}-border`}
|
|
107
|
-
style={{
|
|
108
|
-
position: 'absolute',
|
|
109
|
-
left: x * cellWidth,
|
|
110
|
-
top: y * cellHeight,
|
|
111
|
-
width: frame.width * cellWidth,
|
|
112
|
-
height: frame.height * cellHeight,
|
|
113
|
-
borderStyle: frame.node.style?.borderStyle ? 'solid' : 'dashed',
|
|
114
|
-
borderWidth: 1,
|
|
115
|
-
borderColor: colorMap(frame.node.style?.borderColor || '#3a3a3a'),
|
|
116
|
-
pointerEvents: 'none'
|
|
117
|
-
}}
|
|
118
|
-
/>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
frame.children.forEach((child, idx) => {
|
|
123
|
-
renderFrame(child, `${keyBase}-${idx}`, cellWidth, cellHeight, debugBorders, onBadgeHover, onBadgeLeave, onBadgeClick, onBadgeDblClick, x, y, out);
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
return out;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
export const WebFrameRenderer: React.FC<FrameRendererProps> = ({
|
|
130
|
-
node,
|
|
131
|
-
cols,
|
|
132
|
-
rows,
|
|
133
|
-
cellWidth,
|
|
134
|
-
cellHeight,
|
|
135
|
-
debugBorders = false,
|
|
136
|
-
onBadgeHover,
|
|
137
|
-
onBadgeLeave,
|
|
138
|
-
onBadgeClick,
|
|
139
|
-
onBadgeDblClick
|
|
140
|
-
}) => {
|
|
141
|
-
const frame = useMemo(() => computeLayout(node, cols, rows), [node, cols, rows]);
|
|
142
|
-
const elements = useMemo(
|
|
143
|
-
() => renderFrame(frame, 'root', cellWidth, cellHeight, debugBorders, onBadgeHover, onBadgeLeave, onBadgeClick, onBadgeDblClick),
|
|
144
|
-
[frame, cellWidth, cellHeight, debugBorders, onBadgeHover, onBadgeLeave, onBadgeClick, onBadgeDblClick]
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
return <>{elements}</>;
|
|
148
|
-
};
|
package/src/ui/web/index.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { WebNode } from './render.js';
|
package/src/ui/web/render.tsx
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { LayoutNode, TextNode } from '../core/types.js';
|
|
3
|
-
import { toCssStyle } from '../core/style.js';
|
|
4
|
-
|
|
5
|
-
const monoStyle: React.CSSProperties = {
|
|
6
|
-
fontFamily: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
|
|
7
|
-
fontSize: 14,
|
|
8
|
-
lineHeight: '16px',
|
|
9
|
-
whiteSpace: 'pre'
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
function renderText(node: TextNode): React.ReactElement {
|
|
13
|
-
const style: React.CSSProperties = {
|
|
14
|
-
...monoStyle,
|
|
15
|
-
color: node.style?.color,
|
|
16
|
-
fontWeight: node.style?.bold ? 600 : undefined,
|
|
17
|
-
opacity: node.style?.dimColor ? 0.6 : undefined,
|
|
18
|
-
background: node.style?.inverse ? '#111' : undefined,
|
|
19
|
-
colorScheme: 'only light'
|
|
20
|
-
};
|
|
21
|
-
return <span style={style}>{node.text}</span>;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function WebNode({ node }: { node: LayoutNode }): React.ReactElement {
|
|
25
|
-
if (node.type === 'text') {
|
|
26
|
-
return renderText(node);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const style = {
|
|
30
|
-
...monoStyle,
|
|
31
|
-
...toCssStyle(node.style)
|
|
32
|
-
} as React.CSSProperties;
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<div style={style}>
|
|
36
|
-
{node.children.map((child, index) => (
|
|
37
|
-
<WebNode key={`${child.type}-${index}`} node={child} />
|
|
38
|
-
))}
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
}
|
package/src/utils/clipboard.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { spawn } from 'child_process';
|
|
2
|
-
|
|
3
|
-
function runPipe(command: string, args: string[], input: string): Promise<void> {
|
|
4
|
-
return new Promise((resolve, reject) => {
|
|
5
|
-
const child = spawn(command, args, { stdio: ['pipe', 'ignore', 'pipe'] });
|
|
6
|
-
let err = '';
|
|
7
|
-
child.stderr.on('data', chunk => {
|
|
8
|
-
err += chunk.toString();
|
|
9
|
-
});
|
|
10
|
-
child.on('error', reject);
|
|
11
|
-
child.on('close', (code) => {
|
|
12
|
-
if (code === 0) resolve();
|
|
13
|
-
else reject(new Error(err || `Clipboard command failed (${command})`));
|
|
14
|
-
});
|
|
15
|
-
child.stdin.write(input);
|
|
16
|
-
child.stdin.end();
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export async function writeClipboard(text: string): Promise<void> {
|
|
21
|
-
const platform = process.platform;
|
|
22
|
-
if (platform === 'darwin') {
|
|
23
|
-
await runPipe('pbcopy', [], text);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (platform === 'win32') {
|
|
27
|
-
await runPipe('clip', [], text);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
await runPipe('wl-copy', [], text);
|
|
33
|
-
return;
|
|
34
|
-
} catch {
|
|
35
|
-
// fall through
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
await runPipe('xclip', ['-selection', 'clipboard'], text);
|
|
39
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { execFile } from 'child_process';
|
|
2
|
-
import { promisify } from 'util';
|
|
3
|
-
import { mkdir } from 'fs/promises';
|
|
4
|
-
import { homedir } from 'os';
|
|
5
|
-
import { join } from 'path';
|
|
6
|
-
import { randomUUID } from 'crypto';
|
|
7
|
-
|
|
8
|
-
const execFileAsync = promisify(execFile);
|
|
9
|
-
|
|
10
|
-
async function hasCommand(command: string): Promise<boolean> {
|
|
11
|
-
try {
|
|
12
|
-
await execFileAsync('which', [command]);
|
|
13
|
-
return true;
|
|
14
|
-
} catch {
|
|
15
|
-
return false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function saveClipboardImage(): Promise<string | null> {
|
|
20
|
-
if (process.platform !== 'darwin') {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const hasPngPaste = await hasCommand('pngpaste');
|
|
25
|
-
if (!hasPngPaste) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const targetDir = join(homedir(), '.ztc', 'clipboard');
|
|
30
|
-
await mkdir(targetDir, { recursive: true });
|
|
31
|
-
const filename = `clipboard-${Date.now()}-${randomUUID().slice(0, 8)}.png`;
|
|
32
|
-
const targetPath = join(targetDir, filename);
|
|
33
|
-
|
|
34
|
-
try {
|
|
35
|
-
await execFileAsync('pngpaste', [targetPath]);
|
|
36
|
-
return targetPath;
|
|
37
|
-
} catch {
|
|
38
|
-
return null;
|
|
39
|
-
}
|
|
40
|
-
}
|