zerg-ztc 0.1.10 → 0.1.12
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/.gitkeep +0 -0
- package/bin/ztc-audio-darwin-arm64 +0 -0
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +63 -2
- package/dist/App.js.map +1 -1
- package/dist/agent/commands/dictation.d.ts +3 -0
- package/dist/agent/commands/dictation.d.ts.map +1 -0
- package/dist/agent/commands/dictation.js +10 -0
- package/dist/agent/commands/dictation.js.map +1 -0
- package/dist/agent/commands/index.d.ts.map +1 -1
- package/dist/agent/commands/index.js +2 -1
- package/dist/agent/commands/index.js.map +1 -1
- package/dist/agent/commands/types.d.ts +7 -0
- package/dist/agent/commands/types.d.ts.map +1 -1
- package/dist/components/InputArea.d.ts +1 -0
- package/dist/components/InputArea.d.ts.map +1 -1
- package/dist/components/InputArea.js +591 -43
- package/dist/components/InputArea.js.map +1 -1
- package/dist/components/SingleMessage.d.ts.map +1 -1
- package/dist/components/SingleMessage.js +157 -7
- package/dist/components/SingleMessage.js.map +1 -1
- package/dist/config/types.d.ts +6 -0
- package/dist/config/types.d.ts.map +1 -1
- package/dist/ui/views/status_bar.js +2 -2
- package/dist/ui/views/status_bar.js.map +1 -1
- package/dist/utils/dictation.d.ts +46 -0
- package/dist/utils/dictation.d.ts.map +1 -0
- package/dist/utils/dictation.js +409 -0
- package/dist/utils/dictation.js.map +1 -0
- package/dist/utils/dictation_native.d.ts +51 -0
- package/dist/utils/dictation_native.d.ts.map +1 -0
- package/dist/utils/dictation_native.js +236 -0
- package/dist/utils/dictation_native.js.map +1 -0
- package/dist/utils/path_format.d.ts +20 -0
- package/dist/utils/path_format.d.ts.map +1 -0
- package/dist/utils/path_format.js +90 -0
- package/dist/utils/path_format.js.map +1 -0
- package/dist/utils/table.d.ts +38 -0
- package/dist/utils/table.d.ts.map +1 -0
- package/dist/utils/table.js +133 -0
- package/dist/utils/table.js.map +1 -0
- package/dist/utils/tool_trace.d.ts +7 -2
- package/dist/utils/tool_trace.d.ts.map +1 -1
- package/dist/utils/tool_trace.js +156 -51
- package/dist/utils/tool_trace.js.map +1 -1
- package/package.json +5 -1
- package/src/App.tsx +0 -813
- 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/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 -46
- 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 -80
- 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 -1096
- package/src/components/MessageList.tsx +0 -71
- package/src/components/SingleMessage.tsx +0 -59
- package/src/components/StatusBar.tsx +0 -55
- package/src/components/index.tsx +0 -8
- package/src/config/types.ts +0 -12
- 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/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/shell.ts +0 -72
- package/src/utils/spinner_frames.ts +0 -1
- package/src/utils/spinner_verbs.ts +0 -23
- package/src/utils/tool_summary.ts +0 -56
- package/src/utils/tool_trace.ts +0 -216
- 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/src/skills/loader.ts
DELETED
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { homedir } from 'os';
|
|
2
|
-
import { join, resolve, basename } from 'path';
|
|
3
|
-
import { readdir, readFile, stat } from 'fs/promises';
|
|
4
|
-
|
|
5
|
-
import { Skill } from './types.js';
|
|
6
|
-
|
|
7
|
-
const MAX_DEPTH = 4;
|
|
8
|
-
|
|
9
|
-
function defaultRoots(): string[] {
|
|
10
|
-
const home = homedir();
|
|
11
|
-
return [
|
|
12
|
-
join(home, '.ztc', 'skills'),
|
|
13
|
-
join(home, '.claude', 'skills'),
|
|
14
|
-
join(process.cwd(), '.ztc', 'skills'),
|
|
15
|
-
join(process.cwd(), '.claude', 'skills')
|
|
16
|
-
];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function walk(dir: string, depth = 0): Promise<string[]> {
|
|
20
|
-
if (depth > MAX_DEPTH) return [];
|
|
21
|
-
try {
|
|
22
|
-
const entries = await readdir(dir, { withFileTypes: true });
|
|
23
|
-
const results: string[] = [];
|
|
24
|
-
for (const entry of entries) {
|
|
25
|
-
if (entry.name.startsWith('.')) continue;
|
|
26
|
-
const full = join(dir, entry.name);
|
|
27
|
-
if (entry.isDirectory()) {
|
|
28
|
-
results.push(...await walk(full, depth + 1));
|
|
29
|
-
} else if (entry.isFile() && entry.name.toLowerCase() === 'skill.md') {
|
|
30
|
-
results.push(full);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return results;
|
|
34
|
-
} catch {
|
|
35
|
-
return [];
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function parseFrontmatter(content: string): { meta: Record<string, unknown>; body: string } {
|
|
40
|
-
if (!content.startsWith('---')) {
|
|
41
|
-
return { meta: {}, body: content };
|
|
42
|
-
}
|
|
43
|
-
const end = content.indexOf('\n---', 3);
|
|
44
|
-
if (end === -1) return { meta: {}, body: content };
|
|
45
|
-
|
|
46
|
-
const metaBlock = content.slice(3, end).trim();
|
|
47
|
-
const body = content.slice(end + 4).trim();
|
|
48
|
-
const meta: Record<string, unknown> = {};
|
|
49
|
-
let currentKey: string | null = null;
|
|
50
|
-
|
|
51
|
-
for (const line of metaBlock.split('\n')) {
|
|
52
|
-
if (!line.trim()) continue;
|
|
53
|
-
if (line.startsWith(' -') || line.startsWith('- ')) {
|
|
54
|
-
if (!currentKey) continue;
|
|
55
|
-
const value = line.replace(/^(\s*-)\s*/, '').trim();
|
|
56
|
-
const list = Array.isArray(meta[currentKey]) ? meta[currentKey] as string[] : [];
|
|
57
|
-
list.push(value);
|
|
58
|
-
meta[currentKey] = list;
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
const idx = line.indexOf(':');
|
|
62
|
-
if (idx === -1) continue;
|
|
63
|
-
const key = line.slice(0, idx).trim();
|
|
64
|
-
let value = line.slice(idx + 1).trim();
|
|
65
|
-
if (value.startsWith('[') && value.endsWith(']')) {
|
|
66
|
-
value = value.slice(1, -1);
|
|
67
|
-
meta[key] = value.split(',').map(item => item.trim()).filter(Boolean);
|
|
68
|
-
} else if (value) {
|
|
69
|
-
meta[key] = value;
|
|
70
|
-
} else {
|
|
71
|
-
meta[key] = [];
|
|
72
|
-
currentKey = key;
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
currentKey = key;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return { meta, body };
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function normalizeList(value?: unknown): string[] | undefined {
|
|
82
|
-
if (!value) return undefined;
|
|
83
|
-
if (Array.isArray(value)) {
|
|
84
|
-
return value.map(item => String(item)).filter(Boolean);
|
|
85
|
-
}
|
|
86
|
-
if (typeof value === 'string') {
|
|
87
|
-
return value.split(',').map(item => item.trim()).filter(Boolean);
|
|
88
|
-
}
|
|
89
|
-
return undefined;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function deriveSkillId(path: string, meta: Record<string, unknown>): string {
|
|
93
|
-
const explicit = meta.id ? String(meta.id) : '';
|
|
94
|
-
if (explicit) return explicit;
|
|
95
|
-
const name = meta.name ? String(meta.name) : '';
|
|
96
|
-
if (name) return name.toLowerCase().replace(/\s+/g, '-');
|
|
97
|
-
return basename(resolve(path, '..')) || 'skill';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export async function loadSkills(roots: string[] = defaultRoots()): Promise<Skill[]> {
|
|
101
|
-
const files = new Set<string>();
|
|
102
|
-
for (const root of roots) {
|
|
103
|
-
const paths = await walk(root);
|
|
104
|
-
for (const path of paths) files.add(path);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const skills: Skill[] = [];
|
|
108
|
-
for (const filePath of files) {
|
|
109
|
-
try {
|
|
110
|
-
const content = await readFile(filePath, 'utf-8');
|
|
111
|
-
const { meta, body } = parseFrontmatter(content);
|
|
112
|
-
const id = deriveSkillId(filePath, meta);
|
|
113
|
-
const name = meta.name ? String(meta.name) : id;
|
|
114
|
-
const description = meta.description ? String(meta.description) : undefined;
|
|
115
|
-
const allowedTools = normalizeList(meta['allowed-tools'] || meta.allowed_tools || meta.allowedTools);
|
|
116
|
-
const keywords = normalizeList(meta.keywords);
|
|
117
|
-
const root = roots.find(r => filePath.startsWith(resolve(r))) || resolve(filePath, '..');
|
|
118
|
-
await stat(filePath);
|
|
119
|
-
skills.push({
|
|
120
|
-
id,
|
|
121
|
-
name,
|
|
122
|
-
description,
|
|
123
|
-
instructions: body.trim(),
|
|
124
|
-
allowedTools,
|
|
125
|
-
keywords,
|
|
126
|
-
sourcePath: filePath,
|
|
127
|
-
sourceRoot: root
|
|
128
|
-
});
|
|
129
|
-
} catch {
|
|
130
|
-
// skip unreadable skills
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
return skills;
|
|
135
|
-
}
|
package/src/skills/registry.ts
DELETED
package/src/skills/types.ts
DELETED
package/src/types.ts
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
// ==========================================
|
|
2
|
-
// ZTC Type Definitions
|
|
3
|
-
// ==========================================
|
|
4
|
-
|
|
5
|
-
export type MessageRole = 'user' | 'assistant' | 'tool' | 'system';
|
|
6
|
-
|
|
7
|
-
export type ToolStatus = 'pending' | 'running' | 'complete' | 'error';
|
|
8
|
-
|
|
9
|
-
export type AgentStatus = 'idle' | 'thinking' | 'tool_use' | 'streaming' | 'error';
|
|
10
|
-
export type InputMode = 'queue' | 'interrupt';
|
|
11
|
-
|
|
12
|
-
export interface ToolCall {
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
args: Record<string, unknown>;
|
|
16
|
-
status: ToolStatus;
|
|
17
|
-
result?: string;
|
|
18
|
-
error?: string;
|
|
19
|
-
startedAt?: Date;
|
|
20
|
-
completedAt?: Date;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface Message {
|
|
24
|
-
id: string;
|
|
25
|
-
role: MessageRole;
|
|
26
|
-
content: string;
|
|
27
|
-
timestamp: Date;
|
|
28
|
-
toolCalls?: ToolCall[];
|
|
29
|
-
isStreaming?: boolean;
|
|
30
|
-
metadata?: Record<string, unknown>;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface AgentState {
|
|
34
|
-
status: AgentStatus;
|
|
35
|
-
currentTool?: string;
|
|
36
|
-
tokensUsed?: number;
|
|
37
|
-
contextTokens?: number;
|
|
38
|
-
tokensEstimated?: boolean;
|
|
39
|
-
authError?: boolean;
|
|
40
|
-
error?: string;
|
|
41
|
-
startedAt?: Date;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface Session {
|
|
45
|
-
id: string;
|
|
46
|
-
createdAt: Date;
|
|
47
|
-
messages: Message[];
|
|
48
|
-
metadata?: Record<string, unknown>;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface ZTCConfig {
|
|
52
|
-
zergEndpoint?: string;
|
|
53
|
-
maxTokens?: number;
|
|
54
|
-
timeout?: number;
|
|
55
|
-
tools?: string[];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Tool definition for the agent
|
|
59
|
-
export interface ToolDefinition {
|
|
60
|
-
name: string;
|
|
61
|
-
description: string;
|
|
62
|
-
parameters: {
|
|
63
|
-
type: 'object';
|
|
64
|
-
properties: Record<string, {
|
|
65
|
-
type: string;
|
|
66
|
-
description: string;
|
|
67
|
-
enum?: string[];
|
|
68
|
-
}>;
|
|
69
|
-
required?: string[];
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Events emitted during agent execution
|
|
74
|
-
export type AgentEvent =
|
|
75
|
-
| { type: 'thinking_start' }
|
|
76
|
-
| { type: 'thinking_end' }
|
|
77
|
-
| { type: 'tool_start'; tool: string; args: Record<string, unknown> }
|
|
78
|
-
| { type: 'tool_end'; tool: string; result: string }
|
|
79
|
-
| { type: 'tool_error'; tool: string; error: string }
|
|
80
|
-
| { type: 'stream_start' }
|
|
81
|
-
| { type: 'stream_delta'; content: string }
|
|
82
|
-
| { type: 'stream_end' }
|
|
83
|
-
| { type: 'token_usage'; usage: { inputTokens: number; outputTokens: number; totalTokens: number; estimated?: boolean } }
|
|
84
|
-
| { type: 'error'; error: string };
|
package/src/ui/README.md
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
## UI Architecture (Renderer-Agnostic)
|
|
2
|
-
|
|
3
|
-
This directory defines a shared, renderer-agnostic UI tree for ZTC and thin adapters for Ink (CLI), Web (React DOM), and Vue.
|
|
4
|
-
|
|
5
|
-
### Goals
|
|
6
|
-
- Single source of truth for layout and UI structure.
|
|
7
|
-
- Pixel-aligned monospace rendering in the browser.
|
|
8
|
-
- Optional Yoga integration for layout parity with Ink.
|
|
9
|
-
|
|
10
|
-
### Structure
|
|
11
|
-
- `core/`: layout tree types + helpers
|
|
12
|
-
- `ink/`: Ink renderer adapter
|
|
13
|
-
- `web/`: React DOM renderer adapter
|
|
14
|
-
- `vue/`: Vue adapter (no Vue dependency; pass `h()` from your app)
|
|
15
|
-
|
|
16
|
-
### Core Tree
|
|
17
|
-
The UI is expressed as a `LayoutNode` tree:
|
|
18
|
-
- `box` nodes with flex and spacing styles
|
|
19
|
-
- `text` nodes with basic text styles
|
|
20
|
-
|
|
21
|
-
This keeps the model portable across Ink/DOM/Vue.
|
|
22
|
-
|
|
23
|
-
### Renderers
|
|
24
|
-
- **Ink** uses `Box`/`Text` directly.
|
|
25
|
-
- **Web** renders to `div`/`span` with strict monospace styles to match terminal layout.
|
|
26
|
-
- **Vue** uses a tiny helper `renderToVue(h, node)` that returns VNodes.
|
|
27
|
-
|
|
28
|
-
### Nuxt/Vue Integration
|
|
29
|
-
Because `vue/` does not import Vue directly, you can pass Nuxt's `h`:
|
|
30
|
-
|
|
31
|
-
```ts
|
|
32
|
-
import { renderToVue } from '~/ui/vue';
|
|
33
|
-
|
|
34
|
-
export default {
|
|
35
|
-
render() {
|
|
36
|
-
return renderToVue(this.$createElement, nodeTree);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
### Next Steps
|
|
42
|
-
- Add Yoga-backed layout engine in `core/` for exact Ink parity.
|
|
43
|
-
- Move existing Ink UI components to build `LayoutNode` trees.
|
|
44
|
-
- Create a web mirror route that renders the same tree for debugging.
|
package/src/ui/core/factory.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { BoxNode, LayoutNode, TextNode } from './types.js';
|
|
2
|
-
|
|
3
|
-
export function box(children: LayoutNode[] = [], style?: BoxNode['style']): BoxNode {
|
|
4
|
-
return { type: 'box', children, style };
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function text(content: string, style?: TextNode['style']): TextNode {
|
|
8
|
-
return { type: 'text', text: content, style };
|
|
9
|
-
}
|
package/src/ui/core/index.ts
DELETED
package/src/ui/core/input.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
export interface InputKey {
|
|
2
|
-
return?: boolean;
|
|
3
|
-
shift?: boolean;
|
|
4
|
-
upArrow?: boolean;
|
|
5
|
-
downArrow?: boolean;
|
|
6
|
-
leftArrow?: boolean;
|
|
7
|
-
rightArrow?: boolean;
|
|
8
|
-
ctrl?: boolean;
|
|
9
|
-
meta?: boolean;
|
|
10
|
-
backspace?: boolean;
|
|
11
|
-
delete?: boolean;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface InputEvent {
|
|
15
|
-
input: string;
|
|
16
|
-
key: InputKey;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface InputBus {
|
|
20
|
-
subscribe(handler: (event: InputEvent) => void): () => void;
|
|
21
|
-
emit(event: InputEvent): void;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function createInputBus(): InputBus {
|
|
25
|
-
const handlers = new Set<(event: InputEvent) => void>();
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
subscribe(handler) {
|
|
29
|
-
handlers.add(handler);
|
|
30
|
-
return () => handlers.delete(handler);
|
|
31
|
-
},
|
|
32
|
-
emit(event) {
|
|
33
|
-
for (const handler of handlers) {
|
|
34
|
-
handler(event);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
}
|