grok-bot-cli 0.5.0 → 0.7.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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: talk-to-grok-bot
3
- description: Send or read a Grok Bot thread via gbot_send/gbot_thread. Use when handing off to a named bot/group or posting a status note agents watch — not for work you can finish yourself.
3
+ description: Send or read Grok Bot threads via gbot_send/gbot_thread and Codex daemon threads via codex_send/codex_threads. Use when handing off to a named bot/group or posting a status note agents watch — not for work you can finish yourself.
4
4
  ---
5
5
  # Talk to Grok Bot
6
6
 
@@ -15,13 +15,45 @@ Do not ping a bot for work you can finish yourself. Replies are asynchronous —
15
15
 
16
16
  ## How
17
17
 
18
- 1. `gbot_send` with `target` (name or id) and `message` (first line: who you are + what you need).
19
- 2. Later, call `gbot_thread` with the same `target` (`limit` defaults to 40). The default receipt has only `summary`, `cursor`, `entryCount`, and `gapReset`; it never includes entries.
20
- 3. Poll with the previous `cursor` as `after`. This is exclusive and client-side: `entryCount: 0` means no change.
21
- 4. Pass `full: true` only when entry bodies are needed inline; it adds bounded `entries` to structured content, not to `Agent.Text`. If `gapReset` is true, repeat the same call with `full: true` to inspect the bounded reset snapshot.
18
+ 1. Send once with `gbot_send` (`target`, `message`). Say who you are and what you need.
19
+ 2. Read its `replyRoute`. Native Codex calls with proven native lineage get `mode: auto`;
20
+ continue work and receive the matching reply in that same thread. Do not poll or
21
+ hold a tool call open. That reply does not automatically send your next answer back.
22
+ 3. If the host has no native identity (including Cursor), supply `codexThreadId`, or
23
+ use `gbot_bridge_start` once with `grokTarget`, `codexThreadId` and `expectedCwd`.
24
+ An explicit binding forwards new visible Grok bot messages and returns Codex's
25
+ corresponding terminal answer to Grok. Existing history is not replayed.
26
+ 4. `mode: manual` with `reason: source-unavailable` preserves ordinary sending.
27
+ Read `gbot_thread` later, using `after` for a known cursor and `full: true` only
28
+ when entry bodies are needed. `replyMode: manual` explicitly requests this flow.
29
+
30
+ Automatic routes start a durable background worker that survives the calling tool.
31
+ Use `gbot_bridge_status` to distinguish delivery from execution and return delivery,
32
+ and to inspect gaps, paused routes and pending interactions. Do not resend unknown
33
+ submissions under a new identity. A provided `requestId` safely replays identical
34
+ tracked input; `controlRequestId` is returned independently of the gateway request ID.
35
+ `gbot_bridge_stop` stops a `bindingId`; `worker: true` explicitly stops the process.
36
+ Neither deletes receipts nor interrupts a Codex turn. No login service is installed;
37
+ if the process dies, the next tracked send/start resumes saved routes.
38
+
39
+ `gbot_codex_respond` is only for an explicit operator response to a current scoped
40
+ interaction. Copy the advertised interactionId, generation, threadId, turnId and
41
+ bindingId/exchangeId. Use one-time `decision: accept|decline|cancel`, or `answersJson`
42
+ with exact question IDs mapped to `{"answers":["answer"]}`. Never auto-approve,
43
+ change session permissions, or respond to an unsupported interaction; use its owning UI.
22
44
 
23
45
  Bot replies are `send-message` entries; yours are `message` with `role: user`.
24
46
 
47
+ Grok-origin approvals are separate from Codex interactions. `gbot_grok_approvals`
48
+ (CLI: `gbot approvals list TARGET`) lists pending auto-review and local-tool cards in
49
+ the latest 200 entries. Linked/tracked routes forward new pending cards as notices;
50
+ their chat answers never authorize an action. After an explicit user decision, use
51
+ `gbot_grok_respond` (CLI: `gbot approvals respond --target TARGET --entry-id ID
52
+ --request-id ID --decision accept|decline`). Copy the exact IDs from the current
53
+ card. Accept grants once; persistent grants are unavailable. Responses recheck the
54
+ card before sending; delivery success does not prove execution. Older cards,
55
+ cookie/payment approvals and other unsupported requests require the owning Grok UI.
56
+
25
57
  List targets with `gbot bots list` / `gbot groups list` when the name is ambiguous.
26
58
 
27
59
  ## CLI automation
@@ -37,3 +69,43 @@ Framework argument/schema errors use stderr and exit 2. `--json` is reserved bef
37
69
  Same order as `gbot`: `GROK_BOT_GATEWAY_URL` plus `GROK_BOT_GATEWAY_TOKEN`,
38
70
  else the Grok Bot app session, else `CURSOR_ACCESS_TOKEN`. `gbot doctor` shows
39
71
  which source is present.
72
+
73
+ ## Codex conversation tools
74
+
75
+ The generated Codex, Cursor, and Claude plugins and portable MCP artifact expose these
76
+ additional tools on the same `grok-bot` MCP server. Codex tools use the local Codex
77
+ app-server control socket; Grok tools use the Grok gateway. Portable MCP artifacts
78
+ must be configured in an MCP-capable host; they are not automatically loaded by the Grok app.
79
+
80
+ - `codex_threads`: bounded discovery of daemon-managed Codex threads.
81
+ - `codex_send`: submit a message with a correlation envelope. Default delivery is
82
+ immediate acceptance, which does not mean execution finished. `wait: true` adds
83
+ bounded execution and final reply fields. An accepted message remains accepted
84
+ when observation times out or execution fails.
85
+ - `codex_wait`: explicitly observe a known thread/turn and recover its final output.
86
+ - `codex_watch`: diagnostic observation of bounded thread events. It never answers approvals.
87
+
88
+ Use `expectedCwd` to verify the destination workspace. Busy sends reject by default;
89
+ `whenBusy: queue` needs `GROK_BOT_CODEX_EXPERIMENTAL=1`. Explicit `whenBusy: steer`
90
+ requires `expectedTurnId` and visibly rejects a stale guard without retrying another turn.
91
+ Final replies omit commentary/reasoning; older phase-null agent messages are a fallback
92
+ only after terminal execution. Inspect `reply.truncated` and execution errors for coverage limits.
93
+
94
+ CLI equivalents are `gbot codex send --wait --timeout-ms 1000 THREAD_ID hello --json`,
95
+ `gbot codex wait --timeout-ms 1000 THREAD_ID TURN_ID --json`, and
96
+ `gbot codex watch --timeout-ms 1000 --max-events 20 THREAD_ID --json`.
97
+ Use framework `--ndjson` for progress. Wait/watch are explicit diagnostics; automatic
98
+ background reply routing uses the managed tools above. `codex_send` with `replyToGrok` or `bindingId` returns its terminal answer automatically; without either it retains the explicit observation flow. Managed routes default to guarded steering; ordinary sends still reject busy work by default.
99
+
100
+ `gbot codex bridge start/status/stop/respond` provide the same administration controls.
101
+ CLI auto-routing requires explicit `gbot send --reply-mode auto --codex-thread-id ID`.
102
+ `bridge run` is foreground and bounded (`--lifetime-ms`, default/maximum 23 hours).
103
+ The packaged `scripts/gbot-relay.mjs` is the unlimited foreground service entry.
104
+ Grok participation is through its gateway conversation, not an assumed native Grok
105
+ plugin loader or remote MCP tunnel. Never claim a host loaded a plugin from generated
106
+ configuration alone.
107
+
108
+ Managed Codex return routes reject `expectedTurnId` and legacy `replyTo`/`envelope`
109
+ options before submission; use plain `codex_send` for a caller-selected turn guard.
110
+ An explicit Grok target supplied with `bindingId` must resolve to the binding's
111
+ recipient. A mismatch fails instead of selecting one destination silently.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "grok-bot-cli",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "CLI and Agent Bundle plugin for Grok Bot agents and groups: create, update, message, inspect threads, and automate cleanup",
5
5
  "type": "module",
6
6
  "bin": {
@@ -20,7 +20,7 @@
20
20
  "release": "changeset publish",
21
21
  "test": "npm run test:unit && npm run test:routes",
22
22
  "test:routes": "rstest --config rstest.route-unit.config.ts",
23
- "test:unit": "node --env-file=test.env --test \"test/*.test.js\"",
23
+ "test:unit": "node scripts/run-unit-tests.mjs",
24
24
  "typecheck": "tsc -p tsconfig.json --noEmit",
25
25
  "validate": "agent-bundle validate",
26
26
  "validate:artifact": "agent-bundle validate --artifact artifact"
@@ -54,12 +54,12 @@
54
54
  "LICENSE"
55
55
  ],
56
56
  "devDependencies": {
57
- "@agent-bundle/runtime": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@8e55ab832d",
57
+ "@agent-bundle/runtime": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@19ab901221cb80ad83b917c7cdbf5eea4e3f3901",
58
58
  "@changesets/cli": "3.0.3",
59
59
  "@rstest/core": "0.11.12",
60
60
  "@types/node": "^24.0.0",
61
61
  "@types/react": "^19.2.18",
62
- "agent-bundle": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@8e55ab832d",
62
+ "agent-bundle": "https://pkg.pr.new/ScriptedAlchemy/agent-bundle/agent-bundle@19ab901221cb80ad83b917c7cdbf5eea4e3f3901",
63
63
  "react": "19.3.0",
64
64
  "react-dom": "19.3.0",
65
65
  "typescript": "7.0.2",