@denizokcu/haze 0.2.0 → 0.3.0

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.
@@ -0,0 +1,230 @@
1
+ /**
2
+ * Known provider presets derived from community conventions (nanocoder, OpenRouter docs, etc.).
3
+ * Each preset carries a pre-configured base URL so users only need to supply an API key and model names.
4
+ * Local/keyless providers have sensible localhost defaults.
5
+ */
6
+ export const PROVIDER_PRESETS = [
7
+ // ── Cloud providers (API key required) ──────────────────────────────
8
+ {
9
+ id: 'openrouter',
10
+ name: 'OpenRouter',
11
+ baseUrl: 'https://openrouter.ai/api/v1',
12
+ needsApiKey: true,
13
+ suggestedModels: [
14
+ // SOTA
15
+ 'anthropic/claude-opus-4.8',
16
+ 'openai/gpt-5.4',
17
+ 'google/gemini-3.1-pro',
18
+ // Fast
19
+ 'anthropic/claude-sonnet-4.6',
20
+ 'openai/gpt-5.4-mini',
21
+ 'google/gemini-3.5-flash',
22
+ 'deepseek/deepseek-v4-flash',
23
+ ],
24
+ category: 'cloud',
25
+ },
26
+ {
27
+ id: 'openai',
28
+ name: 'OpenAI',
29
+ baseUrl: 'https://api.openai.com/v1',
30
+ needsApiKey: true,
31
+ suggestedModels: [
32
+ // SOTA
33
+ 'gpt-5.5',
34
+ 'o3',
35
+ // Fast
36
+ 'gpt-5.4',
37
+ 'gpt-5.4-mini',
38
+ 'o4-mini',
39
+ ],
40
+ category: 'cloud',
41
+ },
42
+ {
43
+ id: 'anthropic',
44
+ name: 'Anthropic Claude',
45
+ baseUrl: 'https://api.anthropic.com/v1',
46
+ needsApiKey: true,
47
+ suggestedModels: [
48
+ // SOTA
49
+ 'claude-opus-4-8',
50
+ 'claude-fable-5',
51
+ // Fast
52
+ 'claude-sonnet-4-6',
53
+ 'claude-haiku-4-5',
54
+ ],
55
+ category: 'cloud',
56
+ },
57
+ {
58
+ id: 'google-gemini',
59
+ name: 'Google Gemini',
60
+ baseUrl: 'https://generativelanguage.googleapis.com/v1beta',
61
+ needsApiKey: true,
62
+ apiKeyHint: 'API Key (from https://aistudio.google.com/apikey)',
63
+ suggestedModels: [
64
+ // SOTA
65
+ 'gemini-3.5-flash',
66
+ 'gemini-3.1-pro',
67
+ // Fast
68
+ 'gemini-3.1-flash-lite',
69
+ 'gemini-2.5-flash',
70
+ 'gemini-2.5-pro',
71
+ ],
72
+ category: 'cloud',
73
+ },
74
+ {
75
+ id: 'mistral',
76
+ name: 'Mistral AI',
77
+ baseUrl: 'https://api.mistral.ai/v1',
78
+ needsApiKey: true,
79
+ suggestedModels: [
80
+ // SOTA
81
+ 'mistral-large-2512',
82
+ 'mistral-medium-3-5',
83
+ // Fast
84
+ 'mistral-small-2603',
85
+ 'codestral-2508',
86
+ ],
87
+ category: 'cloud',
88
+ },
89
+ {
90
+ id: 'z-ai',
91
+ name: 'Z.ai',
92
+ baseUrl: 'https://api.z.ai/api/paas/v4/',
93
+ needsApiKey: true,
94
+ suggestedModels: [
95
+ 'glm-5.1',
96
+ 'glm-5.1-fw',
97
+ ],
98
+ category: 'cloud',
99
+ },
100
+ {
101
+ id: 'z-ai-coding',
102
+ name: 'Z.ai Coding Subscription',
103
+ baseUrl: 'https://api.z.ai/api/coding/paas/v4/',
104
+ needsApiKey: true,
105
+ suggestedModels: [
106
+ 'glm-5.1',
107
+ 'glm-5.1-fw',
108
+ ],
109
+ category: 'cloud',
110
+ },
111
+ {
112
+ id: 'github-models',
113
+ name: 'GitHub Models',
114
+ baseUrl: 'https://models.github.ai/inference',
115
+ needsApiKey: true,
116
+ apiKeyHint: 'GitHub Token (PAT with models:read scope)',
117
+ suggestedModels: [
118
+ 'gpt-5.4',
119
+ 'gpt-5.4-mini',
120
+ 'claude-sonnet-4-6',
121
+ 'gemini-3.1-pro',
122
+ ],
123
+ category: 'cloud',
124
+ },
125
+ {
126
+ id: 'github-copilot',
127
+ name: 'GitHub Copilot',
128
+ baseUrl: 'https://api.githubcopilot.com',
129
+ needsApiKey: true,
130
+ apiKeyHint: 'GitHub Copilot token (OAuth)',
131
+ suggestedModels: [
132
+ 'gpt-5.4',
133
+ 'claude-fable-5',
134
+ 'claude-sonnet-4-6',
135
+ 'gemini-3.1-pro',
136
+ ],
137
+ category: 'cloud',
138
+ },
139
+ {
140
+ id: 'chatgpt-codex',
141
+ name: 'ChatGPT / Codex',
142
+ baseUrl: 'https://chatgpt.com/backend-api/codex',
143
+ needsApiKey: true,
144
+ apiKeyHint: 'ChatGPT session token (OAuth)',
145
+ suggestedModels: [
146
+ 'gpt-5.4',
147
+ 'o4-mini',
148
+ ],
149
+ category: 'cloud',
150
+ },
151
+ {
152
+ id: 'kimi-code',
153
+ name: 'Kimi Code',
154
+ baseUrl: 'https://api.kimi.com/coding/v1',
155
+ needsApiKey: true,
156
+ suggestedModels: [
157
+ 'kimi-for-coding',
158
+ ],
159
+ category: 'cloud',
160
+ },
161
+ {
162
+ id: 'minimax-coding',
163
+ name: 'MiniMax Coding Plan',
164
+ baseUrl: 'https://api.minimax.io/anthropic/v1',
165
+ needsApiKey: true,
166
+ suggestedModels: [
167
+ // SOTA
168
+ 'MiniMax-M3',
169
+ // Fast
170
+ 'MiniMax-M2.7',
171
+ ],
172
+ category: 'cloud',
173
+ },
174
+ {
175
+ id: 'poe',
176
+ name: 'Poe',
177
+ baseUrl: 'https://api.poe.com/v1',
178
+ needsApiKey: true,
179
+ apiKeyHint: 'API Key (from poe.com/api_key)',
180
+ suggestedModels: [
181
+ // SOTA
182
+ 'claude-opus-4.8',
183
+ 'gpt-5.5',
184
+ 'gemini-3.5-flash',
185
+ // Fast
186
+ 'gpt-5.4-mini',
187
+ 'claude-sonnet-4.6',
188
+ 'kimi-k2.5',
189
+ ],
190
+ category: 'cloud',
191
+ },
192
+ // ── Local providers (no API key) ────────────────────────────────────
193
+ {
194
+ id: 'ollama',
195
+ name: 'Ollama',
196
+ baseUrl: 'http://localhost:11434/v1',
197
+ needsApiKey: false,
198
+ suggestedModels: [
199
+ 'qwen3-coder',
200
+ 'devstral-small-2512',
201
+ 'gemma4:26b',
202
+ 'llama4:scout',
203
+ ],
204
+ category: 'local',
205
+ },
206
+ {
207
+ id: 'llamacpp',
208
+ name: 'llama.cpp server',
209
+ baseUrl: 'http://localhost:8080/v1',
210
+ needsApiKey: false,
211
+ category: 'local',
212
+ },
213
+ {
214
+ id: 'mlx-server',
215
+ name: 'MLX Server',
216
+ baseUrl: 'http://localhost:8080/v1',
217
+ needsApiKey: false,
218
+ category: 'local',
219
+ },
220
+ {
221
+ id: 'lmstudio',
222
+ name: 'LM Studio',
223
+ baseUrl: 'http://localhost:1234/v1',
224
+ needsApiKey: false,
225
+ category: 'local',
226
+ },
227
+ ];
228
+ export function findPreset(id) {
229
+ return PROVIDER_PRESETS.find(preset => preset.id === id);
230
+ }
@@ -0,0 +1,13 @@
1
+ export type TaskStatus = 'pending' | 'in_progress' | 'completed';
2
+ export interface Task {
3
+ id: string;
4
+ title: string;
5
+ status: TaskStatus;
6
+ createdAt: string;
7
+ updatedAt: string;
8
+ }
9
+ export declare function getTasksFilePath(): string;
10
+ export declare function generateTaskId(): string;
11
+ export declare function loadTasks(): Promise<Task[]>;
12
+ export declare function saveTasks(tasks: Task[]): Promise<void>;
13
+ export declare function clearTasks(): Promise<void>;
@@ -0,0 +1,29 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import fs from 'node:fs/promises';
3
+ import path from 'node:path';
4
+ import { resolveWorkspacePath } from '../../utils/path.js';
5
+ const TASKS_DIR = '.haze';
6
+ const TASKS_FILE = 'tasks.json';
7
+ export function getTasksFilePath() {
8
+ return resolveWorkspacePath(path.join(TASKS_DIR, TASKS_FILE));
9
+ }
10
+ export function generateTaskId() {
11
+ return randomUUID().slice(0, 8);
12
+ }
13
+ export async function loadTasks() {
14
+ try {
15
+ const content = await fs.readFile(getTasksFilePath(), 'utf-8');
16
+ return JSON.parse(content);
17
+ }
18
+ catch {
19
+ return [];
20
+ }
21
+ }
22
+ export async function saveTasks(tasks) {
23
+ const filePath = getTasksFilePath();
24
+ await fs.mkdir(path.dirname(filePath), { recursive: true });
25
+ await fs.writeFile(filePath, JSON.stringify(tasks, null, 2), 'utf-8');
26
+ }
27
+ export async function clearTasks() {
28
+ await saveTasks([]);
29
+ }
@@ -203,6 +203,22 @@ export declare const hazeTools: {
203
203
  diffLineCount: number;
204
204
  diff: ToolDiffLine[] | undefined;
205
205
  }>;
206
+ writeTasks: import("ai").Tool<{
207
+ tasks: {
208
+ title: string;
209
+ status?: "pending" | "in_progress" | "completed" | undefined;
210
+ }[];
211
+ }, {
212
+ ok: boolean;
213
+ error: string;
214
+ taskCount?: undefined;
215
+ summary?: undefined;
216
+ } | {
217
+ ok: boolean;
218
+ taskCount: number;
219
+ summary: string;
220
+ error?: undefined;
221
+ }>;
206
222
  bash: import("ai").Tool<{
207
223
  command: string;
208
224
  allowMutation: boolean;
@@ -6,6 +6,7 @@ import { tool } from 'ai';
6
6
  import { rgPath } from '@vscode/ripgrep';
7
7
  import { z } from 'zod';
8
8
  import { walkDir } from '../utils/fs.js';
9
+ import { generateTaskId, saveTasks } from '../core/tasks/taskStorage.js';
9
10
  import { workspaceRoot, resolveWorkspacePath, workspaceRelativePath } from '../utils/path.js';
10
11
  import { classifyBashCommand, isValidationClassification } from '../core/safety/bashClassifier.js';
11
12
  import { parseValidationOutput } from '../core/validation/outputParser.js';
@@ -259,6 +260,11 @@ async function runDedupedTool(toolName, input, context, execute) {
259
260
  ctx.inFlightMutationPaths?.delete(pathForInput);
260
261
  }
261
262
  }
263
+ const STATUS_ICON = {
264
+ pending: '○',
265
+ in_progress: '◐',
266
+ completed: '✓',
267
+ };
262
268
  export const hazeTools = {
263
269
  listFiles: tool({
264
270
  description: 'List files and directories in the current workspace. Prefer this over bash ls/find for discovering project structure.',
@@ -534,6 +540,46 @@ export const hazeTools = {
534
540
  }
535
541
  }),
536
542
  }),
543
+ writeTasks: tool({
544
+ description: 'Create or replace your task list for multi-step work (3+ steps). Pass the COMPLETE list every time — this REPLACES the entire list. Mark one task in_progress, then completed. Keep at most one in_progress. Leave completed tasks when done — do not clear the list automatically.',
545
+ inputSchema: z.object({
546
+ tasks: z.array(z.object({
547
+ title: z.string().max(200).describe('Short task description'),
548
+ status: z.enum(['pending', 'in_progress', 'completed']).optional().describe('Task status (defaults to pending)'),
549
+ })).describe('Complete task list. Replaces any existing tasks. Pass an empty array to clear.'),
550
+ }),
551
+ execute: async ({ tasks: inputTasks }) => {
552
+ if (!Array.isArray(inputTasks)) {
553
+ return { ok: false, error: 'Tasks must be an array. Pass an empty array to clear the list.' };
554
+ }
555
+ for (let i = 0; i < inputTasks.length; i++) {
556
+ const title = inputTasks[i]?.title?.trim();
557
+ if (!title)
558
+ return { ok: false, error: `Task ${i + 1}: title cannot be empty.` };
559
+ if (title.length > 200)
560
+ return { ok: false, error: `Task ${i + 1}: title is too long (max 200 characters).` };
561
+ }
562
+ const now = new Date().toISOString();
563
+ const tasks = inputTasks.map((input) => ({
564
+ id: generateTaskId(),
565
+ title: input.title.trim(),
566
+ status: input.status ?? 'pending',
567
+ createdAt: now,
568
+ updatedAt: now,
569
+ }));
570
+ await saveTasks(tasks);
571
+ if (tasks.length === 0)
572
+ return { ok: true, taskCount: 0, summary: 'Task list cleared.' };
573
+ const counts = {
574
+ pending: tasks.filter(t => t.status === 'pending').length,
575
+ in_progress: tasks.filter(t => t.status === 'in_progress').length,
576
+ completed: tasks.filter(t => t.status === 'completed').length,
577
+ };
578
+ const list = tasks.map(t => ` ${STATUS_ICON[t.status]} ${t.title}`).join('\n');
579
+ const summary = `Tasks (${counts.pending} pending, ${counts.in_progress} in progress, ${counts.completed} completed):\n${list}`;
580
+ return { ok: true, taskCount: tasks.length, summary };
581
+ },
582
+ }),
537
583
  bash: tool({
538
584
  description: 'Run a bash command in the current workspace. Use for tests, builds, validation, and inspection. Do not use bash to edit files; use file tools instead unless the user explicitly requested a shell mutation.',
539
585
  inputSchema: z.object({
@@ -26,6 +26,7 @@ Available tools:
26
26
  - bash: Run shell commands for tests, builds, scripts, installs, repo inspection, and operations not covered by file tools. Prefer file tools for text edits, but shell mutations are acceptable when explicitly requested or materially more efficient.
27
27
  - subagent: Spawn focused subagents only when a request clearly decomposes into 2+ independent subtasks that can run concurrently. Do not use subagents for single tasks, sequential work, or tasks that require full conversation context.
28
28
  - skill_*: Markdown skills installed in ~/.haze/skills. Use a skill tool when its description matches the user's request; it returns workflow instructions and explicitly referenced files.
29
+ - writeTasks: Create or replace a task list to track multi-step work. Full-replacement: pass the complete list every call. Use for 3+ step work; skip for simple tasks.
29
30
 
30
31
  Intent modes:
31
32
  - Action requests (add/create/write/implement/update/fix/test/document): work autonomously until complete, validated when practical, blocked by a concrete issue, or needing a user decision. Do not stop after only inspecting files.
@@ -35,6 +36,7 @@ Intent modes:
35
36
 
36
37
  Tool-use rules:
37
38
  - You have access to the tools above. Never claim you cannot inspect files, run commands, or edit files when a tool can do it.
39
+ - Use writeTasks to plan and track multi-step work (3+ steps). First call: create all tasks as pending. Then cycle: mark one in_progress, do the work, mark it completed. Keep at most one in_progress. Leave completed tasks in the list when done — the user clears them manually.
38
40
  - Use grep for code search. Do not read many files one by one to locate a symbol/import/string.
39
41
  - Use listFiles for project discovery instead of bash ls/find. Do not repeat the same list/read call unless files changed or the previous result was insufficient.
40
42
  - Read only directly relevant files, usually once. Do not read README/package/config files unless needed for the task.
@@ -4,7 +4,7 @@ export type TextInputSuggestion = {
4
4
  description?: string;
5
5
  kind?: 'command' | 'skill' | 'provider' | 'model';
6
6
  };
7
- export declare function TextInput({ placeholder, disabled, mask, historyItems, recordHistory, suggestions, suggestionMode, submitOnEmpty, width, onHistoryAdd, onCancel, onEscape, onSubmit }: {
7
+ export declare function TextInput({ placeholder, disabled, mask, historyItems, recordHistory, suggestions, suggestionMode, submitOnEmpty, width, onHistoryAdd, onCancel, onEscape, onToggleTasks, onSubmit }: {
8
8
  placeholder?: string;
9
9
  disabled?: boolean;
10
10
  mask?: boolean;
@@ -17,5 +17,6 @@ export declare function TextInput({ placeholder, disabled, mask, historyItems, r
17
17
  onHistoryAdd?: (value: string) => void;
18
18
  onCancel?: () => void;
19
19
  onEscape?: () => void;
20
+ onToggleTasks?: () => void;
20
21
  onSubmit: (value: string) => void;
21
22
  }): React.JSX.Element;
@@ -102,7 +102,7 @@ function cursorPosition(lines, displayCursor) {
102
102
  const line = lines[lineIndex] ?? lines[0] ?? { start: 0, end: 0 };
103
103
  return { lineIndex, column: Math.max(0, Math.min(displayCursor - line.start, line.end - line.start)) };
104
104
  }
105
- export function TextInput({ placeholder, disabled, mask, historyItems = [], recordHistory = true, suggestions = [], suggestionMode = 'slash', submitOnEmpty = false, width = 80, onHistoryAdd, onCancel, onEscape, onSubmit }) {
105
+ export function TextInput({ placeholder, disabled, mask, historyItems = [], recordHistory = true, suggestions = [], suggestionMode = 'slash', submitOnEmpty = false, width = 80, onHistoryAdd, onCancel, onEscape, onToggleTasks, onSubmit }) {
106
106
  const [value, setValue] = useState('');
107
107
  const [cursor, setCursor] = useState(0);
108
108
  const [pasteBlocks, setPasteBlocks] = useState([]);
@@ -156,7 +156,7 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
156
156
  const suggestionValue = suggestionMode === 'always' ? suggestion.value : suggestion.value.slice(1);
157
157
  return suggestionValue.toLowerCase().includes(suggestionQuery) || suggestion.description?.toLowerCase().includes(suggestionQuery);
158
158
  })
159
- .slice(0, 8);
159
+ .slice(0, 20);
160
160
  const activeSuggestionIndex = Math.min(selectedSuggestionIndex, Math.max(0, filteredSuggestions.length - 1));
161
161
  const activeSuggestion = filteredSuggestions[activeSuggestionIndex];
162
162
  const displayValue = mask ? '•'.repeat(value.length) : compactPasteBlocksForDisplay(value, pasteBlocks);
@@ -289,6 +289,10 @@ export function TextInput({ placeholder, disabled, mask, historyItems = [], reco
289
289
  }
290
290
  if (key.ctrl && input === 'c')
291
291
  return;
292
+ if (key.ctrl && input === 'o') {
293
+ onToggleTasks?.();
294
+ return;
295
+ }
292
296
  if (input) {
293
297
  replaceInput(cursor, cursor, input);
294
298
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "A pragmatic agentic CLI for building apps from the terminal.",
5
5
  "type": "module",
6
6
  "license": "MIT",