@denizokcu/haze 0.0.1 → 0.0.2

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 (51) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +114 -69
  3. package/dist/cli/commands/chat.d.ts +1 -0
  4. package/dist/cli/commands/chat.js +203 -11
  5. package/dist/cli/commands/commands.js +130 -6
  6. package/dist/cli/commands/formatters.d.ts +1 -0
  7. package/dist/cli/commands/formatters.js +18 -1
  8. package/dist/cli/commands/skills.d.ts +1 -1
  9. package/dist/cli/commands/skills.js +8 -5
  10. package/dist/cli/commands/streaming.d.ts +2 -0
  11. package/dist/cli/commands/streaming.js +424 -39
  12. package/dist/cli/index.js +1 -11
  13. package/dist/config/paths.d.ts +0 -1
  14. package/dist/config/paths.js +0 -1
  15. package/dist/llm/client.js +1 -1
  16. package/dist/llm/hazeTools.d.ts +32 -0
  17. package/dist/llm/hazeTools.js +136 -26
  18. package/dist/llm/initPrompt.js +2 -2
  19. package/dist/llm/systemPrompt.js +23 -9
  20. package/dist/skills/SkillLoader.d.ts +12 -2
  21. package/dist/skills/SkillLoader.js +64 -18
  22. package/dist/skills/SkillRegistry.d.ts +1 -5
  23. package/dist/skills/SkillRegistry.js +10 -21
  24. package/dist/skills/builder/SkillBuilder.d.ts +25 -1
  25. package/dist/skills/builder/SkillBuilder.js +169 -20
  26. package/dist/skills/skillTools.d.ts +20 -0
  27. package/dist/skills/skillTools.js +25 -0
  28. package/dist/skills/types.d.ts +12 -51
  29. package/dist/ui/components/Header.d.ts +2 -1
  30. package/dist/ui/components/Header.js +12 -2
  31. package/dist/ui/components/TextInput.d.ts +8 -1
  32. package/dist/ui/components/TextInput.js +29 -14
  33. package/dist/ui/theme.d.ts +1 -0
  34. package/dist/ui/theme.js +1 -0
  35. package/dist/utils/fs.d.ts +1 -0
  36. package/dist/utils/fs.js +10 -6
  37. package/examples/skills/files/SKILL.md +16 -0
  38. package/examples/skills/files/examples/file-editing.md +3 -0
  39. package/package.json +2 -2
  40. package/dist/skills/installer/SkillInstaller.d.ts +0 -1
  41. package/dist/skills/installer/SkillInstaller.js +0 -48
  42. package/dist/skills/manifestSchema.d.ts +0 -31
  43. package/dist/skills/manifestSchema.js +0 -23
  44. package/dist/tools/ToolExecutor.d.ts +0 -3
  45. package/dist/tools/ToolExecutor.js +0 -15
  46. package/dist/tools/types.d.ts +0 -9
  47. package/dist/tools/types.js +0 -1
  48. package/examples/skills/files/prompts/file_tasks.md +0 -1
  49. package/examples/skills/files/skill.yaml +0 -28
  50. package/examples/skills/files/tools/list_files.ts +0 -21
  51. package/examples/skills/files/tools/read_file.ts +0 -12
@@ -1,3 +0,0 @@
1
- import type { LoadedSkill, LoadedTool } from '../skills/types.js';
2
- import type { ToolResult } from './types.js';
3
- export declare function executeTool(tool: LoadedTool, skill: LoadedSkill, input: Record<string, unknown>): Promise<ToolResult>;
@@ -1,15 +0,0 @@
1
- import { pathToFileURL } from 'node:url';
2
- export async function executeTool(tool, skill, input) {
3
- try {
4
- const context = { cwd: process.cwd(), skillDir: skill.dir };
5
- const mod = await import(`${pathToFileURL(tool.absolutePath).href}?t=${Date.now()}`);
6
- if (typeof mod.execute !== 'function') {
7
- return { ok: false, message: 'Tool must export execute(input, context)' };
8
- }
9
- const result = await mod.execute(input ?? {}, context);
10
- return result ?? { ok: true };
11
- }
12
- catch (error) {
13
- return { ok: false, message: error instanceof Error ? error.message : String(error) };
14
- }
15
- }
@@ -1,9 +0,0 @@
1
- export interface ToolContext {
2
- cwd: string;
3
- skillDir: string;
4
- }
5
- export interface ToolResult {
6
- ok: boolean;
7
- message?: string;
8
- data?: unknown;
9
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- For file tasks, prefer listing files before reading unknown paths. Never ask to read secrets unless the user explicitly requests it.
@@ -1,28 +0,0 @@
1
- name: files
2
- version: 0.1.0
3
- description: Safe-ish file inspection tools for the current project.
4
- dependencies: {}
5
- tools:
6
- - name: list_files
7
- description: List files under a directory in the current project. Skips .git and node_modules.
8
- path: tools/list_files.ts
9
- input:
10
- type: object
11
- properties:
12
- dir:
13
- type: string
14
- description: Directory to list, relative to the current working directory.
15
- - name: read_file
16
- description: Read a UTF-8 text file from the current project.
17
- path: tools/read_file.ts
18
- input:
19
- type: object
20
- required: [path]
21
- properties:
22
- path:
23
- type: string
24
- description: File path relative to the current working directory.
25
- prompts:
26
- - name: file_tasks
27
- description: Guidance for file inspection tasks.
28
- path: prompts/file_tasks.md
@@ -1,21 +0,0 @@
1
- import fs from 'node:fs/promises';
2
- import path from 'node:path';
3
-
4
- export async function execute(input: {dir?: string}, context: {cwd: string}) {
5
- const root = path.resolve(context.cwd, input.dir ?? '.');
6
- if (!root.startsWith(context.cwd)) return {ok: false, message: 'Refusing to list outside the current project.'};
7
- const files: string[] = [];
8
- async function walk(dir: string) {
9
- for (const entry of await fs.readdir(dir)) {
10
- if (entry === '.git' || entry === 'node_modules' || entry === 'dist') continue;
11
- const full = path.join(dir, entry);
12
- const rel = path.relative(context.cwd, full);
13
- const stat = await fs.stat(full);
14
- if (stat.isDirectory()) await walk(full);
15
- else files.push(rel);
16
- if (files.length >= 500) return;
17
- }
18
- }
19
- await walk(root);
20
- return {ok: true, message: `Found ${files.length} files.`, data: files.sort()};
21
- }
@@ -1,12 +0,0 @@
1
- import fs from 'node:fs/promises';
2
- import path from 'node:path';
3
-
4
- export async function execute(input: {path: string}, context: {cwd: string}) {
5
- if (!input.path) return {ok: false, message: 'Missing path.'};
6
- const full = path.resolve(context.cwd, input.path);
7
- if (!full.startsWith(context.cwd)) return {ok: false, message: 'Refusing to read outside the current project.'};
8
- const stat = await fs.stat(full);
9
- if (!stat.isFile()) return {ok: false, message: 'Path is not a file.'};
10
- if (stat.size > 200_000) return {ok: false, message: 'File is too large for the intentionally tiny attention span.'};
11
- return {ok: true, message: `Read ${input.path}.`, data: await fs.readFile(full, 'utf8')};
12
- }