@neetru/cli 2.13.1 → 2.15.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/commands/ai.js +8 -8
  3. package/dist/commands/autocomplete.d.ts +1 -1
  4. package/dist/commands/autocomplete.js +1 -0
  5. package/dist/commands/autocomplete.js.map +1 -1
  6. package/dist/commands/code.d.ts +27 -0
  7. package/dist/commands/code.js +469 -0
  8. package/dist/commands/code.js.map +1 -0
  9. package/dist/commands/fn.d.ts +6 -0
  10. package/dist/commands/fn.js +88 -0
  11. package/dist/commands/fn.js.map +1 -0
  12. package/dist/commands/init.js +147 -147
  13. package/dist/commands/marketplace.d.ts +36 -0
  14. package/dist/commands/marketplace.js +585 -0
  15. package/dist/commands/marketplace.js.map +1 -0
  16. package/dist/commands/ui.d.ts +1 -1
  17. package/dist/commands/ui.js +9 -0
  18. package/dist/commands/ui.js.map +1 -1
  19. package/dist/index.js +19 -2
  20. package/dist/index.js.map +1 -1
  21. package/dist/lib/ai/context.js +91 -91
  22. package/dist/lib/ai/orchestrator.js +7 -43
  23. package/dist/lib/ai/orchestrator.js.map +1 -1
  24. package/dist/lib/api-client.d.ts +1 -0
  25. package/dist/lib/api-client.js +4 -3
  26. package/dist/lib/api-client.js.map +1 -1
  27. package/dist/lib/code-agent-files.d.ts +47 -0
  28. package/dist/lib/code-agent-files.js +468 -0
  29. package/dist/lib/code-agent-files.js.map +1 -0
  30. package/dist/lib/code-agent-gateway.d.ts +27 -0
  31. package/dist/lib/code-agent-gateway.js +115 -0
  32. package/dist/lib/code-agent-gateway.js.map +1 -0
  33. package/dist/lib/code-agent-protocol.d.ts +24 -0
  34. package/dist/lib/code-agent-protocol.js +56 -0
  35. package/dist/lib/code-agent-protocol.js.map +1 -0
  36. package/dist/lib/code-agent-session.d.ts +54 -0
  37. package/dist/lib/code-agent-session.js +147 -0
  38. package/dist/lib/code-agent-session.js.map +1 -0
  39. package/dist/lib/code-agent-settings.d.ts +20 -0
  40. package/dist/lib/code-agent-settings.js +38 -0
  41. package/dist/lib/code-agent-settings.js.map +1 -0
  42. package/dist/lib/code-agent-tools.d.ts +17 -0
  43. package/dist/lib/code-agent-tools.js +52 -0
  44. package/dist/lib/code-agent-tools.js.map +1 -0
  45. package/dist/lib/code-agent-types.d.ts +34 -0
  46. package/dist/lib/code-agent-types.js +7 -0
  47. package/dist/lib/code-agent-types.js.map +1 -0
  48. package/dist/lib/code-agent-ui.d.ts +30 -0
  49. package/dist/lib/code-agent-ui.js +258 -0
  50. package/dist/lib/code-agent-ui.js.map +1 -0
  51. package/dist/lib/sse.d.ts +14 -0
  52. package/dist/lib/sse.js +43 -0
  53. package/dist/lib/sse.js.map +1 -0
  54. package/package.json +1 -1
  55. package/templates/auth/callback.ts +22 -22
  56. package/templates/auth/sign-in.tsx +41 -41
  57. package/templates/billing/checkout.ts +22 -22
  58. package/templates/billing/page.tsx +43 -43
  59. package/templates/support/ticket-form.tsx +68 -68
  60. package/templates/usage/track.ts +30 -30
  61. package/templates/users/profile.tsx +43 -43
@@ -0,0 +1,24 @@
1
+ export interface CodeToolRequest {
2
+ tool: string;
3
+ path?: unknown;
4
+ paths?: unknown;
5
+ pattern?: unknown;
6
+ flags?: unknown;
7
+ query?: unknown;
8
+ error?: string;
9
+ }
10
+ export interface PatchFileSummary {
11
+ file: string;
12
+ added: number;
13
+ removed: number;
14
+ }
15
+ export declare function parseToolRequest(text: string): CodeToolRequest | null;
16
+ /**
17
+ * So aceita o bloco explicito `NEETRU_PATCH ... NEETRU_END` do protocolo —
18
+ * SEM fallback pra diff em bloco fenced ou texto solto. Um diff meramente
19
+ * citado (ex: injetado via README/issue) nao pode ser confundido com uma
20
+ * instrucao real de patch, especialmente com `--yes` (achado do Codex
21
+ * review 2026-07-09).
22
+ */
23
+ export declare function extractPatch(text: string): string | null;
24
+ export declare function summarizePatch(patch: string): PatchFileSummary[];
@@ -0,0 +1,56 @@
1
+ export function parseToolRequest(text) {
2
+ for (const line of String(text || '').split(/\r?\n/)) {
3
+ const idx = line.indexOf('NEETRU_TOOL');
4
+ if (idx === -1)
5
+ continue;
6
+ const raw = line.slice(idx + 'NEETRU_TOOL'.length).trim();
7
+ if (!raw)
8
+ continue;
9
+ try {
10
+ const parsed = JSON.parse(raw);
11
+ if (parsed && typeof parsed === 'object' && typeof parsed.tool === 'string') {
12
+ return parsed;
13
+ }
14
+ return { tool: 'invalid', error: `NEETRU_TOOL precisa conter {"tool":"..."}` };
15
+ }
16
+ catch {
17
+ return { tool: 'invalid', error: `JSON invalido em NEETRU_TOOL: ${raw}` };
18
+ }
19
+ }
20
+ return null;
21
+ }
22
+ /**
23
+ * So aceita o bloco explicito `NEETRU_PATCH ... NEETRU_END` do protocolo —
24
+ * SEM fallback pra diff em bloco fenced ou texto solto. Um diff meramente
25
+ * citado (ex: injetado via README/issue) nao pode ser confundido com uma
26
+ * instrucao real de patch, especialmente com `--yes` (achado do Codex
27
+ * review 2026-07-09).
28
+ */
29
+ export function extractPatch(text) {
30
+ const source = String(text || '');
31
+ const marker = source.match(/NEETRU_PATCH\s*([\s\S]*?)\s*NEETRU_END/);
32
+ return marker?.[1] ? `${marker[1].trim()}\n` : null;
33
+ }
34
+ export function summarizePatch(patch) {
35
+ const summaries = new Map();
36
+ let current = null;
37
+ for (const line of patch.split(/\r?\n/)) {
38
+ const match = line.match(/^diff --git a\/(.+?) b\/(.+)$/);
39
+ if (match) {
40
+ const file = match[2] || match[1];
41
+ current = summaries.get(file) ?? { file, added: 0, removed: 0 };
42
+ summaries.set(file, current);
43
+ continue;
44
+ }
45
+ if (!current)
46
+ continue;
47
+ if (line.startsWith('+++') || line.startsWith('---'))
48
+ continue;
49
+ if (line.startsWith('+'))
50
+ current.added += 1;
51
+ if (line.startsWith('-'))
52
+ current.removed += 1;
53
+ }
54
+ return Array.from(summaries.values());
55
+ }
56
+ //# sourceMappingURL=code-agent-protocol.js.map
@@ -0,0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 * implicito por prints; o proximo passo e transformar em estrutura
5
+ * testavel"). Pura, sem I/O — commands/code.ts chama `transition()` nos
6
+ * pontos do loop de turno; testes verificam a sequência sem mockar o
7
+ * AI Gateway inteiro.
8
+ */
9
+ export type CodeAgentState = 'idle' | 'thinking' | 'tool_requested' | 'tool_running' | 'patch_ready' | 'awaiting_confirm' | 'applied' | 'failed' | 'aborted';
10
+ export declare class CodeAgentStateMachine {
11
+ private current;
12
+ private readonly log;
13
+ get state(): CodeAgentState;
14
+ /** Histórico de estados desde a criação (ou último `reset`). Só leitura. */
15
+ get history(): readonly CodeAgentState[];
16
+ transition(next: CodeAgentState): void;
17
+ reset(): void;
18
+ }
19
+ export type CodeSessionRole = 'system' | 'user' | 'assistant';
20
+ export interface CodeSessionMessage {
21
+ role: CodeSessionRole;
22
+ content: string;
23
+ }
24
+ export interface CodeSessionSnapshot {
25
+ cwd: string;
26
+ model: string;
27
+ }
28
+ export declare function compactCodeHistory<T extends CodeSessionMessage>(history: T[], keepRecent?: number): number;
29
+ export declare function formatCodeSessionMarkdown(settings: CodeSessionSnapshot, history: CodeSessionMessage[]): string;
30
+ export declare function saveCodeSession(settings: CodeSessionSnapshot, history: CodeSessionMessage[]): string;
31
+ /**
32
+ * Retomar sessao por id (Fase 4, NEETRU_CODE_ARCHITECTURE.md) — mesmo padrao
33
+ * de UX de qualquer REPL com persistencia (lista sessoes salvas, numera,
34
+ * usuario escolhe). Nada disso vem de codigo alheio: e o jeito obvio de
35
+ * resolver "listar + escolher" numa CLI de terminal.
36
+ */
37
+ export interface CodeSessionSummary {
38
+ /** Path relativo ao cwd (ex: `.neetru/code/sessions/2026-07-10T...-abc.md`). */
39
+ file: string;
40
+ timestamp: string;
41
+ messageCount: number;
42
+ /** Primeiras ~80 chars da primeira mensagem de usuario — ajuda a reconhecer a sessao na lista. */
43
+ preview: string;
44
+ }
45
+ /** Lista sessoes salvas, mais recente primeiro (nomes de arquivo ISO ordenam lexicograficamente). */
46
+ export declare function listCodeSessions(cwd: string): CodeSessionSummary[];
47
+ /** Carrega as mensagens de uma sessao salva (`file` relativo ao cwd, vindo de listCodeSessions). */
48
+ export declare function loadCodeSession(cwd: string, file: string): CodeSessionMessage[];
49
+ /**
50
+ * Log local de patch aplicado (Fase 4) — 1 linha por patch, append-only.
51
+ * Nao substitui git log/reflog; e so um resumo rapido "o que o agente mudou
52
+ * e quando", legivel sem abrir o git.
53
+ */
54
+ export declare function logAppliedPatch(cwd: string, summary: string): void;
@@ -0,0 +1,147 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { redactSecrets } from './code-agent-files.js';
4
+ const VALID_TRANSITIONS = {
5
+ idle: ['thinking'],
6
+ // thinking -> idle: turno terminou em texto final (sem tool nem patch).
7
+ thinking: ['tool_requested', 'patch_ready', 'idle', 'failed'],
8
+ tool_requested: ['tool_running'],
9
+ tool_running: ['thinking', 'failed'],
10
+ patch_ready: ['awaiting_confirm', 'applied', 'aborted'],
11
+ awaiting_confirm: ['applied', 'aborted'],
12
+ applied: ['idle'],
13
+ failed: ['idle'],
14
+ aborted: ['idle'],
15
+ };
16
+ export class CodeAgentStateMachine {
17
+ current = 'idle';
18
+ log = ['idle'];
19
+ get state() {
20
+ return this.current;
21
+ }
22
+ /** Histórico de estados desde a criação (ou último `reset`). Só leitura. */
23
+ get history() {
24
+ return this.log;
25
+ }
26
+ transition(next) {
27
+ const allowed = VALID_TRANSITIONS[this.current];
28
+ if (!allowed.includes(next)) {
29
+ throw new Error(`Transicao de estado invalida: ${this.current} -> ${next}`);
30
+ }
31
+ this.current = next;
32
+ this.log.push(next);
33
+ }
34
+ reset() {
35
+ this.current = 'idle';
36
+ this.log.length = 0;
37
+ this.log.push('idle');
38
+ }
39
+ }
40
+ export function compactCodeHistory(history, keepRecent = 8) {
41
+ if (history.length <= keepRecent + 1)
42
+ return 0;
43
+ const system = history.find((message) => message.role === 'system');
44
+ const recent = history.slice(-keepRecent);
45
+ const next = system ? [system, ...recent.filter((message) => message !== system)] : recent;
46
+ const removed = history.length - next.length;
47
+ history.splice(0, history.length, ...next);
48
+ return removed;
49
+ }
50
+ export function formatCodeSessionMarkdown(settings, history) {
51
+ const lines = [
52
+ '# Neetru Code Session',
53
+ '',
54
+ `- date: ${new Date().toISOString()}`,
55
+ `- cwd: ${settings.cwd}`,
56
+ `- model: ${settings.model}`,
57
+ `- messages: ${history.length}`,
58
+ '',
59
+ '## Conversa',
60
+ '',
61
+ ];
62
+ for (const message of history) {
63
+ lines.push(`### ${message.role}`);
64
+ lines.push('');
65
+ lines.push('```text');
66
+ lines.push(redactSecrets(message.content).slice(0, 40_000));
67
+ lines.push('```');
68
+ lines.push('');
69
+ }
70
+ return lines.join('\n');
71
+ }
72
+ export function saveCodeSession(settings, history) {
73
+ const dir = path.join(settings.cwd, '.neetru', 'code', 'sessions');
74
+ fs.mkdirSync(dir, { recursive: true });
75
+ const stamp = new Date().toISOString().replace(/[:.]/g, '-');
76
+ const file = path.join(dir, `${stamp}.md`);
77
+ fs.writeFileSync(file, formatCodeSessionMarkdown(settings, history), 'utf8');
78
+ return path.relative(settings.cwd, file).replace(/\\/g, '/');
79
+ }
80
+ function sessionsDir(cwd) {
81
+ return path.join(cwd, '.neetru', 'code', 'sessions');
82
+ }
83
+ function parseSessionMarkdown(content) {
84
+ const dateMatch = content.match(/^- date: (.+)$/m);
85
+ const countMatch = content.match(/^- messages: (\d+)$/m);
86
+ const messages = [];
87
+ const blockRe = /### (system|user|assistant)\n\n```text\n([\s\S]*?)\n```/g;
88
+ let match;
89
+ while ((match = blockRe.exec(content))) {
90
+ messages.push({ role: match[1], content: match[2] });
91
+ }
92
+ return {
93
+ date: dateMatch?.[1] ?? '',
94
+ messageCount: countMatch ? Number.parseInt(countMatch[1], 10) : messages.length,
95
+ messages,
96
+ };
97
+ }
98
+ /** Lista sessoes salvas, mais recente primeiro (nomes de arquivo ISO ordenam lexicograficamente). */
99
+ export function listCodeSessions(cwd) {
100
+ const dir = sessionsDir(cwd);
101
+ if (!fs.existsSync(dir))
102
+ return [];
103
+ const files = fs.readdirSync(dir).filter((f) => f.endsWith('.md')).sort().reverse();
104
+ return files.map((file) => {
105
+ const full = path.join(dir, file);
106
+ let content = '';
107
+ try {
108
+ content = fs.readFileSync(full, 'utf8');
109
+ }
110
+ catch {
111
+ content = '';
112
+ }
113
+ const parsed = parseSessionMarkdown(content);
114
+ const firstUser = parsed.messages.find((m) => m.role === 'user');
115
+ const preview = (firstUser?.content ?? '').replace(/\s+/g, ' ').trim().slice(0, 80);
116
+ return {
117
+ file: `.neetru/code/sessions/${file}`,
118
+ timestamp: parsed.date || file.replace(/\.md$/, ''),
119
+ messageCount: parsed.messageCount,
120
+ preview,
121
+ };
122
+ });
123
+ }
124
+ /** Carrega as mensagens de uma sessao salva (`file` relativo ao cwd, vindo de listCodeSessions). */
125
+ export function loadCodeSession(cwd, file) {
126
+ const full = path.resolve(cwd, file);
127
+ if (!full.startsWith(path.resolve(sessionsDir(cwd)))) {
128
+ throw new Error(`Sessao fora do diretorio esperado: ${file}`);
129
+ }
130
+ if (!fs.existsSync(full)) {
131
+ throw new Error(`Sessao nao encontrada: ${file}`);
132
+ }
133
+ const content = fs.readFileSync(full, 'utf8');
134
+ return parseSessionMarkdown(content).messages;
135
+ }
136
+ /**
137
+ * Log local de patch aplicado (Fase 4) — 1 linha por patch, append-only.
138
+ * Nao substitui git log/reflog; e so um resumo rapido "o que o agente mudou
139
+ * e quando", legivel sem abrir o git.
140
+ */
141
+ export function logAppliedPatch(cwd, summary) {
142
+ const dir = path.join(cwd, '.neetru', 'code');
143
+ fs.mkdirSync(dir, { recursive: true });
144
+ const file = path.join(dir, 'patches.log');
145
+ fs.appendFileSync(file, `${new Date().toISOString()} ${summary}\n`, 'utf8');
146
+ }
147
+ //# sourceMappingURL=code-agent-session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-agent-session.js","sourceRoot":"","sources":["../../src/lib/code-agent-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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AAC;IAChE,CAAC;IACD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC9C,OAAO,oBAAoB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC;AAChD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW,EAAE,OAAe;IAC1D,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;IAC9C,EAAE,CAAC,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC;IAC3C,EAAE,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,IAAI,OAAO,IAAI,EAAE,MAAM,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,20 @@
1
+ export declare const DEFAULT_CODE_MODEL = "llama-3.3-70b-versatile";
2
+ export declare const DEFAULT_CODE_MAX_TURNS = 8;
3
+ export declare const DEFAULT_CODE_MAX_TOKENS = 4096;
4
+ export declare const DEFAULT_CODE_TEMPERATURE = 0.2;
5
+ export interface ResolveCodeModelInput {
6
+ cliModel?: string;
7
+ envModel?: string;
8
+ configuredGatewayModel?: string;
9
+ }
10
+ export interface ResolvedCodeModel {
11
+ model: string;
12
+ warning?: string;
13
+ }
14
+ export declare function isAnthropicModel(model: string | undefined): boolean;
15
+ export declare function resolveCodeModel(input: ResolveCodeModelInput): ResolvedCodeModel;
16
+ export declare function parseBoundedNumber(value: unknown, fallback: number, limits: {
17
+ min: number;
18
+ max: number;
19
+ integer?: boolean;
20
+ }): number;
@@ -0,0 +1,38 @@
1
+ export const DEFAULT_CODE_MODEL = 'llama-3.3-70b-versatile';
2
+ export const DEFAULT_CODE_MAX_TURNS = 8;
3
+ export const DEFAULT_CODE_MAX_TOKENS = 4096;
4
+ export const DEFAULT_CODE_TEMPERATURE = 0.2;
5
+ export function isAnthropicModel(model) {
6
+ if (!model)
7
+ return false;
8
+ return /(^|\/)(claude-|anthropic)/i.test(model) || /claude/i.test(model);
9
+ }
10
+ function firstNonEmpty(...values) {
11
+ return values.find((value) => typeof value === 'string' && value.trim().length > 0)?.trim();
12
+ }
13
+ export function resolveCodeModel(input) {
14
+ const explicit = firstNonEmpty(input.cliModel, input.envModel);
15
+ if (explicit)
16
+ return { model: explicit };
17
+ const configured = firstNonEmpty(input.configuredGatewayModel);
18
+ if (configured && !isAnthropicModel(configured))
19
+ return { model: configured };
20
+ if (configured && isAnthropicModel(configured)) {
21
+ return {
22
+ model: DEFAULT_CODE_MODEL,
23
+ warning: `gatewayModel local esta apontando para "${configured}"; ` +
24
+ `neetru code usara ${DEFAULT_CODE_MODEL} por padrao para ficar no caminho Groq/NVIDIA.`,
25
+ };
26
+ }
27
+ return { model: DEFAULT_CODE_MODEL };
28
+ }
29
+ export function parseBoundedNumber(value, fallback, limits) {
30
+ if (value === undefined || value === null || value === '')
31
+ return fallback;
32
+ const n = Number(value);
33
+ if (!Number.isFinite(n))
34
+ return fallback;
35
+ const bounded = Math.min(limits.max, Math.max(limits.min, n));
36
+ return limits.integer ? Math.floor(bounded) : bounded;
37
+ }
38
+ //# sourceMappingURL=code-agent-settings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-agent-settings.js","sourceRoot":"","sources":["../../src/lib/code-agent-settings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG,yBAAyB,CAAC;AAC5D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC;AACxC,MAAM,CAAC,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AAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,QAAQ,CAAC;IAC3E,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACxB,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,QAAQ,CAAC;IACzC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9D,OAAO,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACxD,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Registro de ferramentas locais do `neetru code` — extraído de
3
+ * commands/code.ts (Fase 2, NEETRU_CODE_ARCHITECTURE.md: "separar núcleo de
4
+ * interface"). O system prompt é montado a partir do registro: Fase 3
5
+ * (run_tests, read_many_files, search_regex, project_symbols) só precisa
6
+ * adicionar entradas aqui — não editar o prompt à mão em vários lugares.
7
+ *
8
+ * Execução real das ferramentas (I/O de arquivo/git) mora em
9
+ * code-agent-files.ts — este módulo só descreve o protocolo pro modelo.
10
+ */
11
+ export interface CodeToolDescriptor {
12
+ name: string;
13
+ /** Linha de invocação mostrada no system prompt (protocolo NEETRU_TOOL). */
14
+ usage: string;
15
+ }
16
+ export declare const CODE_TOOL_REGISTRY: CodeToolDescriptor[];
17
+ export declare function buildSystemPrompt(): string;
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Registro de ferramentas locais do `neetru code` — extraído de
3
+ * commands/code.ts (Fase 2, NEETRU_CODE_ARCHITECTURE.md: "separar núcleo de
4
+ * interface"). O system prompt é montado a partir do registro: Fase 3
5
+ * (run_tests, read_many_files, search_regex, project_symbols) só precisa
6
+ * adicionar entradas aqui — não editar o prompt à mão em vários lugares.
7
+ *
8
+ * Execução real das ferramentas (I/O de arquivo/git) mora em
9
+ * code-agent-files.ts — este módulo só descreve o protocolo pro modelo.
10
+ */
11
+ export const CODE_TOOL_REGISTRY = [
12
+ { name: 'read_file', usage: 'NEETRU_TOOL {"tool":"read_file","path":"caminho/relativo.ext"}' },
13
+ { name: 'list_files', usage: 'NEETRU_TOOL {"tool":"list_files","pattern":"texto opcional"}' },
14
+ { name: 'search', usage: 'NEETRU_TOOL {"tool":"search","query":"texto literal"}' },
15
+ { name: 'git_status', usage: 'NEETRU_TOOL {"tool":"git_status"}' },
16
+ { name: 'git_diff', usage: 'NEETRU_TOOL {"tool":"git_diff"}' },
17
+ { name: 'project_overview', usage: 'NEETRU_TOOL {"tool":"project_overview"}' },
18
+ // Fase 3 (NEETRU_CODE_ARCHITECTURE.md): ferramentas produtivas.
19
+ { name: 'read_many_files', usage: 'NEETRU_TOOL {"tool":"read_many_files","paths":["a.ts","b.ts"]}' },
20
+ { name: 'search_regex', usage: 'NEETRU_TOOL {"tool":"search_regex","pattern":"regex","flags":"i opcional"}' },
21
+ { name: 'run_tests', usage: 'NEETRU_TOOL {"tool":"run_tests"}' },
22
+ { name: 'project_symbols', usage: 'NEETRU_TOOL {"tool":"project_symbols","path":"opcional/um-arquivo.ts"}' },
23
+ ];
24
+ export function buildSystemPrompt() {
25
+ const toolLines = CODE_TOOL_REGISTRY.map((tool) => tool.usage).join('\n');
26
+ return `
27
+ Voce e o Neetru Code, um assistente local de codificacao da Neetru.
28
+ Voce conversa com modelos do AI Gateway do Neetru Core, normalmente Groq/NVIDIA.
29
+ Nao use Anthropic/Claude como caminho assumido.
30
+
31
+ Voce nao tem tool calling nativo. Use exatamente estes protocolos textuais:
32
+
33
+ ${toolLines}
34
+
35
+ Regras:
36
+ - Peca arquivos antes de alterar codigo quando faltar contexto.
37
+ - Use project_overview/git_status quando precisar entender o projeto antes de editar.
38
+ - Use git_diff antes de revisar mudancas ja existentes.
39
+ - Nunca invente conteudo de arquivo.
40
+ - Peca uma tool por resposta, no maximo.
41
+ - Quando estiver pronto para alterar, responda somente com um diff aplicavel por git:
42
+
43
+ NEETRU_PATCH
44
+ diff --git a/path b/path
45
+ ...
46
+ NEETRU_END
47
+
48
+ - Nao coloque explicacao dentro do bloco NEETRU_PATCH.
49
+ - Se a tarefa nao exigir alteracao, responda em texto curto.
50
+ `.trim();
51
+ }
52
+ //# sourceMappingURL=code-agent-tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-agent-tools.js","sourceRoot":"","sources":["../../src/lib/code-agent-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAQH,MAAM,CAAC,MAAM,kBAAkB,GAAyB;IACtD,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,gEAAgE,EAAE;IAC9F,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,8DAA8D,EAAE;IAC7F,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,uDAAuD,EAAE;IAClF,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,mCAAmC,EAAE;IAClE,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,iCAAiC,EAAE;IAC9D,EAAE,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,yCAAyC,EAAE;IAC9E,gEAAgE;IAChE,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,gEAAgE,EAAE;IACpG,EAAE,IAAI,EAAE,cAAc,EAAE,KAAK,EAAE,4EAA4E,EAAE;IAC7G,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,kCAAkC,EAAE;IAChE,EAAE,IAAI,EAAE,iBAAiB,EAAE,KAAK,EAAE,wEAAwE,EAAE;CAC7G,CAAC;AAEF,MAAM,UAAU,iBAAiB;IAC/B,MAAM,SAAS,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE1E,OAAO;;;;;;;EAOP,SAAS;;;;;;;;;;;;;;;;;CAiBV,CAAC,IAAI,EAAE,CAAC;AACT,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Tipos compartilhados entre os módulos do `neetru code`
3
+ * (code.ts, code-agent-ui.ts, code-agent-gateway.ts, code-agent-tools.ts,
4
+ * code-agent-session.ts) — evita import circular de tipo entre eles.
5
+ */
6
+ export type CodeRole = 'system' | 'user' | 'assistant';
7
+ export interface CodeMessage {
8
+ role: CodeRole;
9
+ content: string;
10
+ }
11
+ export interface CodeCommandOptions {
12
+ cwd?: string;
13
+ file?: string[];
14
+ model?: string;
15
+ maxTurns?: string | number;
16
+ maxTokens?: string | number;
17
+ temperature?: string | number;
18
+ plan?: boolean;
19
+ apply?: boolean;
20
+ yes?: boolean;
21
+ }
22
+ export interface CodeSettings {
23
+ cwd: string;
24
+ files: string[];
25
+ model: string;
26
+ modelWarning?: string;
27
+ maxTurns: number;
28
+ maxTokens: number;
29
+ temperature: number;
30
+ apply: boolean;
31
+ yes: boolean;
32
+ timeoutMs: number;
33
+ }
34
+ export type ConfirmFn = (question: string) => Promise<boolean>;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Tipos compartilhados entre os módulos do `neetru code`
3
+ * (code.ts, code-agent-ui.ts, code-agent-gateway.ts, code-agent-tools.ts,
4
+ * code-agent-session.ts) — evita import circular de tipo entre eles.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=code-agent-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-agent-types.js","sourceRoot":"","sources":["../../src/lib/code-agent-types.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,30 @@
1
+ import { type CodeToolRequest } from './code-agent-protocol.js';
2
+ import type { CodeMessage, CodeSettings } from './code-agent-types.js';
3
+ export declare function stripAnsi(text: string): string;
4
+ export declare function visibleLength(text: string): number;
5
+ export declare function padVisible(text: string, width: number): string;
6
+ export declare function terminalWidth(): number;
7
+ export declare function truncateMiddle(text: string, max: number): string;
8
+ export declare function wrapPlain(text: string, width: number): string[];
9
+ export declare function printBox(title: string, rows?: string[]): void;
10
+ export declare function printStatusBar(settings: CodeSettings, mode: 'interactive' | 'oneshot' | 'doctor'): void;
11
+ export declare function printDivider(label?: string): void;
12
+ export declare function printEvent(kind: 'wait' | 'tool' | 'ok' | 'warn' | 'error', title: string, detail?: string): void;
13
+ export declare function summarizeToolResult(result: string): string;
14
+ export declare function printAssistantText(content: string): void;
15
+ export declare function patchSummaryRows(patch: string): string[];
16
+ export declare function printPatchPreview(patch: string): void;
17
+ export declare function renderHeader(settings: CodeSettings, mode?: 'interactive' | 'oneshot' | 'doctor'): void;
18
+ export declare function renderInteractiveHelp(): void;
19
+ export declare function renderSessionStatus(settings: CodeSettings, history?: CodeMessage[]): void;
20
+ export declare function renderPrompt(settings: CodeSettings): string;
21
+ export declare function printFileSample(files: string[], total: number): void;
22
+ /** Picker de arquivos (Fase 5) — lista numerada; `/pick` pede o(s) numero(s) ao usuario. */
23
+ export declare function printFilePicker(files: string[], total: number): void;
24
+ /** Lista sessoes salvas numeradas (Fase 4) — usuario escolhe pelo numero em `/resume`. */
25
+ export declare function printSessionList(sessions: Array<{
26
+ timestamp: string;
27
+ messageCount: number;
28
+ preview: string;
29
+ }>): void;
30
+ export declare function toolDetail(tool: CodeToolRequest | null): string;