grok-dev 1.0.0-rc2 → 1.0.0-rc4
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/.cursor/rules/project-overview.mdc +2 -2
- package/.grok/settings.json +1 -1
- package/README.md +31 -4
- package/dist/agent/agent.d.ts +42 -3
- package/dist/agent/agent.js +377 -163
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/compaction.d.ts +35 -0
- package/dist/agent/compaction.js +374 -0
- package/dist/agent/compaction.js.map +1 -0
- package/dist/agent/compaction.test.d.ts +1 -0
- package/dist/agent/compaction.test.js.map +1 -0
- package/dist/agent/reasoning.d.ts +3 -0
- package/dist/agent/reasoning.js +53 -0
- package/dist/agent/reasoning.js.map +1 -0
- package/dist/agent/reasoning.test.d.ts +1 -0
- package/dist/agent/reasoning.test.js.map +1 -0
- package/dist/grok/client.d.ts +16 -0
- package/dist/grok/client.js +26 -3
- package/dist/grok/client.js.map +1 -1
- package/dist/grok/models.d.ts +6 -2
- package/dist/grok/models.js +107 -22
- package/dist/grok/models.js.map +1 -1
- package/dist/grok/models.test.d.ts +1 -0
- package/dist/grok/models.test.js.map +1 -0
- package/dist/grok/tools.d.ts +2 -0
- package/dist/grok/tools.js +33 -23
- package/dist/grok/tools.js.map +1 -1
- package/dist/headless/output.d.ts +67 -0
- package/dist/headless/output.js +176 -0
- package/dist/headless/output.js.map +1 -0
- package/dist/headless/output.test.d.ts +1 -0
- package/dist/headless/output.test.js.map +1 -0
- package/dist/index.js +52 -39
- package/dist/index.js.map +1 -1
- package/dist/mcp/parse-headers.test.d.ts +1 -0
- package/dist/mcp/parse-headers.test.js.map +1 -0
- package/dist/storage/index.d.ts +2 -1
- package/dist/storage/index.js +2 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/migrations.js +31 -1
- package/dist/storage/migrations.js.map +1 -1
- package/dist/storage/transcript-view.d.ts +14 -0
- package/dist/storage/transcript-view.js +23 -0
- package/dist/storage/transcript-view.js.map +1 -0
- package/dist/storage/transcript.d.ts +8 -2
- package/dist/storage/transcript.js +72 -18
- package/dist/storage/transcript.js.map +1 -1
- package/dist/telegram/limits.test.d.ts +1 -0
- package/dist/telegram/limits.test.js.map +1 -0
- package/dist/tools/bash.d.ts +1 -1
- package/dist/tools/bash.js +60 -13
- package/dist/tools/bash.js.map +1 -1
- package/dist/types/index.d.ts +11 -3
- package/dist/types/index.js.map +1 -1
- package/dist/ui/agents-modal.d.ts +36 -0
- package/dist/ui/agents-modal.js +53 -0
- package/dist/ui/agents-modal.js.map +1 -0
- package/dist/ui/app.js +440 -73
- package/dist/ui/app.js.map +1 -1
- package/dist/utils/instructions.js +0 -8
- package/dist/utils/instructions.js.map +1 -1
- package/dist/utils/instructions.test.d.ts +1 -0
- package/dist/utils/instructions.test.js.map +1 -0
- package/dist/utils/settings.d.ts +12 -0
- package/dist/utils/settings.js +64 -6
- package/dist/utils/settings.js.map +1 -1
- package/dist/utils/subagents-settings.test.d.ts +1 -0
- package/dist/utils/subagents-settings.test.js.map +1 -0
- package/package.json +5 -2
|
@@ -37,7 +37,7 @@ src/
|
|
|
37
37
|
├── utils/
|
|
38
38
|
│ ├── settings.ts # User and project settings
|
|
39
39
|
│ ├── git-root.ts # Resolve git repository root for AGENTS.md discovery
|
|
40
|
-
│ └── instructions.ts # AGENTS.md (ecosystem)
|
|
40
|
+
│ └── instructions.ts # AGENTS.md (ecosystem) custom instructions
|
|
41
41
|
└── types/
|
|
42
42
|
└── index.ts # Shared TypeScript types
|
|
43
43
|
```
|
|
@@ -48,7 +48,7 @@ src/
|
|
|
48
48
|
- **Bash-only tools**: The agent uses bash for everything (file editing, searching, git, builds, etc.).
|
|
49
49
|
- **X Search & Web Search**: Integrated via the xAI Responses API for real-time information.
|
|
50
50
|
- **Settings hierarchy**: Environment variables → User-level (`~/.grok/user-settings.json`) → Project-level (`.grok/settings.json`).
|
|
51
|
-
- **Custom instructions**: `~/.grok/AGENTS.md`, then `AGENTS.override.md` / `AGENTS.md` per directory from git root through the workspace cwd (Codex-style merge)
|
|
51
|
+
- **Custom instructions**: `~/.grok/AGENTS.md`, then `AGENTS.override.md` / `AGENTS.md` per directory from git root through the workspace cwd (Codex-style merge).
|
|
52
52
|
- **ESM only**: The project uses `"type": "module"` — all imports use `.js` extensions for compiled output.
|
|
53
53
|
|
|
54
54
|
## Latest Grok Models
|
package/.grok/settings.json
CHANGED
package/README.md
CHANGED
|
@@ -46,6 +46,7 @@ grok -d /path/to/your/repo
|
|
|
46
46
|
grok --prompt "run the test suite and summarize failures"
|
|
47
47
|
grok -p "show me package.json" --directory /path/to/project
|
|
48
48
|
grok --prompt "refactor X" --max-tool-rounds 30
|
|
49
|
+
grok --prompt "summarize the repo state" --format json
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
**Continue a saved session:**
|
|
@@ -57,6 +58,16 @@ grok -s <session-id>
|
|
|
57
58
|
|
|
58
59
|
Works in interactive mode too—same flag.
|
|
59
60
|
|
|
61
|
+
**Structured headless output:**
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
grok --prompt "summarize the repo state" --format json
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`--format json` emits a newline-delimited JSON event stream instead of the
|
|
68
|
+
default human-readable text output. Events are semantic, step-level records such
|
|
69
|
+
as `step_start`, `text`, `tool_use`, `step_finish`, and `error`.
|
|
70
|
+
|
|
60
71
|
**List Grok models and pricing hints:**
|
|
61
72
|
|
|
62
73
|
```bash
|
|
@@ -75,9 +86,10 @@ grok fix the flaky test in src/foo.test.ts
|
|
|
75
86
|
|
|
76
87
|
| Thing | What it means |
|
|
77
88
|
|--------|----------------|
|
|
78
|
-
| **Grok-native** | Defaults tuned for Grok; models like **`grok-code-fast-1`**, **`grok-4-1-fast`**, flagship and fast variants—run `grok models` for the full menu. |
|
|
89
|
+
| **Grok-native** | Defaults tuned for Grok; models like **`grok-code-fast-1`**, **`grok-4-1-fast-reasoning`**, **`grok-4.20-multi-agent-0309`**, plus flagship and fast variants—run `grok models` for the full menu. |
|
|
79
90
|
| **X + web search** | **`search_x`** and **`search_web`** tools—live posts and docs without pretending the internet stopped in 2023. |
|
|
80
91
|
| **Sub-agents (default behavior)** | Foreground **`task`** delegation (e.g. explore vs general) plus background **`delegate`** for read-only deep dives—parallelize like you mean it. |
|
|
92
|
+
| **Custom sub-agents** | Define named agents with **`subAgents`** in **`~/.grok/user-settings.json`** and manage them from the TUI with **`/agents`**. |
|
|
81
93
|
| **Remote control** | Pair **Telegram** from the TUI (`/remote-control` → Telegram): DM your bot, **`/pair`**, approve the code in-terminal. Keep the CLI running while you ping it from your phone. |
|
|
82
94
|
| **No “mystery meat” UI** | OpenTUI React terminal UI—fast, keyboard-driven, not whatever glitchy thing you’re thinking of. |
|
|
83
95
|
| **Skills** | Agent Skills under **`.agents/skills/<name>/SKILL.md`** (project) or **`~/.agents/skills/`** (user). Use **`/skills`** in the TUI to list what’s installed. |
|
|
@@ -118,6 +130,22 @@ grok -k your_key_here
|
|
|
118
130
|
{ "apiKey": "your_key_here" }
|
|
119
131
|
```
|
|
120
132
|
|
|
133
|
+
Optional **`subAgents`** — custom foreground sub-agents. Each entry needs **`name`**, **`model`**, and **`instruction`**:
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"subAgents": [
|
|
138
|
+
{
|
|
139
|
+
"name": "security-review",
|
|
140
|
+
"model": "grok-code-fast-1",
|
|
141
|
+
"instruction": "Prioritize security implications and suggest concrete fixes."
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Names cannot be `general` or `explore` because those are reserved for the built-in sub-agents.
|
|
148
|
+
|
|
121
149
|
Optional: **`GROK_BASE_URL`** (default `https://api.x.ai/v1`), **`GROK_MODEL`**, **`GROK_MAX_TOKENS`**.
|
|
122
150
|
|
|
123
151
|
---
|
|
@@ -136,13 +164,12 @@ Treat the bot token like a password.
|
|
|
136
164
|
## Instructions & project brain
|
|
137
165
|
|
|
138
166
|
- **`AGENTS.md`** — merged from git root down to your cwd (Codex-style; see repo docs). **`AGENTS.override.md`** wins per directory when present.
|
|
139
|
-
- **`.grok/GROK.md`** or **`~/.grok/GROK.md`** — Grok-only rules, applied last.
|
|
140
167
|
|
|
141
168
|
---
|
|
142
169
|
|
|
143
|
-
##
|
|
170
|
+
## Project settings
|
|
144
171
|
|
|
145
|
-
Project file: **`.grok/settings.json`** — e.g. current model
|
|
172
|
+
Project file: **`.grok/settings.json`** — e.g. the current model for this project.
|
|
146
173
|
|
|
147
174
|
---
|
|
148
175
|
|
package/dist/agent/agent.d.ts
CHANGED
|
@@ -1,8 +1,44 @@
|
|
|
1
|
-
import type { AgentMode, ChatEntry, SessionInfo, SessionSnapshot, StreamChunk, SubagentStatus, TaskRequest, ToolResult } from "../types/index";
|
|
1
|
+
import type { AgentMode, ChatEntry, SessionInfo, SessionSnapshot, StreamChunk, SubagentStatus, TaskRequest, ToolCall, ToolResult } from "../types/index";
|
|
2
2
|
interface AgentOptions {
|
|
3
3
|
persistSession?: boolean;
|
|
4
4
|
session?: string;
|
|
5
5
|
}
|
|
6
|
+
type ProcessMessageFinishReason = "stop" | "length" | "content-filter" | "tool-calls" | "error" | "other";
|
|
7
|
+
export interface ProcessMessageUsage {
|
|
8
|
+
inputTokens?: number;
|
|
9
|
+
outputTokens?: number;
|
|
10
|
+
totalTokens?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface ProcessMessageStepStart {
|
|
13
|
+
stepNumber: number;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
}
|
|
16
|
+
export interface ProcessMessageStepFinish {
|
|
17
|
+
stepNumber: number;
|
|
18
|
+
timestamp: number;
|
|
19
|
+
finishReason: ProcessMessageFinishReason;
|
|
20
|
+
usage: ProcessMessageUsage;
|
|
21
|
+
}
|
|
22
|
+
export interface ProcessMessageToolStart {
|
|
23
|
+
toolCall: ToolCall;
|
|
24
|
+
timestamp: number;
|
|
25
|
+
}
|
|
26
|
+
export interface ProcessMessageToolFinish {
|
|
27
|
+
toolCall: ToolCall;
|
|
28
|
+
toolResult: ToolResult;
|
|
29
|
+
timestamp: number;
|
|
30
|
+
}
|
|
31
|
+
export interface ProcessMessageError {
|
|
32
|
+
message: string;
|
|
33
|
+
timestamp: number;
|
|
34
|
+
}
|
|
35
|
+
export interface ProcessMessageObserver {
|
|
36
|
+
onStepStart?(info: ProcessMessageStepStart): void;
|
|
37
|
+
onStepFinish?(info: ProcessMessageStepFinish): void;
|
|
38
|
+
onToolStart?(info: ProcessMessageToolStart): void;
|
|
39
|
+
onToolFinish?(info: ProcessMessageToolFinish): void;
|
|
40
|
+
onError?(info: ProcessMessageError): void;
|
|
41
|
+
}
|
|
6
42
|
export declare class Agent {
|
|
7
43
|
private provider;
|
|
8
44
|
private apiKey;
|
|
@@ -13,7 +49,7 @@ export declare class Agent {
|
|
|
13
49
|
private workspace;
|
|
14
50
|
private session;
|
|
15
51
|
private messages;
|
|
16
|
-
private
|
|
52
|
+
private messageSeqs;
|
|
17
53
|
private abortController;
|
|
18
54
|
private maxToolRounds;
|
|
19
55
|
private mode;
|
|
@@ -56,7 +92,10 @@ export declare class Agent {
|
|
|
56
92
|
private runDelegation;
|
|
57
93
|
private readDelegation;
|
|
58
94
|
private listDelegations;
|
|
59
|
-
|
|
95
|
+
private getCompactionSettings;
|
|
96
|
+
private compactForContext;
|
|
97
|
+
private appendCompletedTurn;
|
|
98
|
+
processMessage(userMessage: string, observer?: ProcessMessageObserver): AsyncGenerator<StreamChunk, void, unknown>;
|
|
60
99
|
private requireProvider;
|
|
61
100
|
}
|
|
62
101
|
export {};
|