@ottocode/sdk 0.1.306 → 0.1.308
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/package.json +1 -1
- package/src/config/src/index.ts +1 -0
- package/src/config/src/manager.ts +1 -0
- package/src/core/src/tools/builtin/shell.ts +25 -0
- package/src/core/src/tools/builtin/shell.txt +2 -0
- package/src/prompts/src/agents/build.txt +1 -0
- package/src/prompts/src/agents/otto.txt +27 -0
- package/src/prompts/src/base.txt +6 -0
- package/src/prompts/src/providers/anthropic.txt +1 -1
- package/src/prompts/src/providers/default.txt +1 -1
- package/src/prompts/src/providers/glm.txt +1 -1
- package/src/prompts/src/providers/google.txt +1 -1
- package/src/prompts/src/providers/moonshot.txt +1 -1
- package/src/prompts/src/providers/openai.txt +2 -2
- package/src/types/src/config.ts +2 -0
package/package.json
CHANGED
package/src/config/src/index.ts
CHANGED
|
@@ -42,6 +42,31 @@ function killProcessTree(pid: number) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
const REDIRECTED_SEARCH_COMMANDS = new Set(['grep', 'egrep', 'fgrep', 'rg']);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Detect commands that start with a standalone grep-style search binary.
|
|
49
|
+
* Pipelines like `ps aux | grep x` are allowed; only segments that begin
|
|
50
|
+
* with grep/rg are redirected to the dedicated `search` tool.
|
|
51
|
+
*/
|
|
52
|
+
export function findRedirectedSearchCommand(cmd: string): string | null {
|
|
53
|
+
const segments = cmd.split(/&&|\|\||;|\n/);
|
|
54
|
+
for (const segment of segments) {
|
|
55
|
+
const tokens = segment.trim().split(/\s+/);
|
|
56
|
+
let index = 0;
|
|
57
|
+
while (
|
|
58
|
+
index < tokens.length &&
|
|
59
|
+
/^[A-Za-z_][A-Za-z0-9_]*=/.test(tokens[index] ?? '')
|
|
60
|
+
) {
|
|
61
|
+
index++;
|
|
62
|
+
}
|
|
63
|
+
if (tokens[index] === 'command') index++;
|
|
64
|
+
const bin = tokens[index]?.split('/').pop() ?? '';
|
|
65
|
+
if (REDIRECTED_SEARCH_COMMANDS.has(bin)) return bin;
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
|
|
45
70
|
export type ShellOutputMode = 'auto' | 'full' | 'tail';
|
|
46
71
|
|
|
47
72
|
const DEFAULT_TAIL_LINES = 100;
|
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
For repository discovery, use `search` for content/code search and `glob` for filename/path discovery. Reserve `shell` for execution, builds, tests, diagnostics, and other command-line tasks.
|
|
8
8
|
|
|
9
|
+
**Strongly prefer the `search` tool over `grep`/`rg`, and `glob` over `find`.** The `search` tool is indexed and faster, returns structured `file:line` matches, and supports regex, `glob` includes, `path` scoping, and `ignoreCase` — use it for all repository content search. Only fall back to `grep`/`rg` via shell for cases `search` cannot handle (e.g. gitignored files like node_modules or build output). Pipelines that filter program output (e.g. `ps aux | grep node`) are fine.
|
|
10
|
+
|
|
9
11
|
## Usage tips
|
|
10
12
|
|
|
11
13
|
- Chain commands with `&&` to fail-fast.
|
|
@@ -32,5 +32,6 @@ After making changes:
|
|
|
32
32
|
## Searching & discovery
|
|
33
33
|
|
|
34
34
|
- Use the `search` tool for content/code search and `glob` for filename patterns.
|
|
35
|
+
- Strongly prefer `search` over running `grep`/`rg` through `shell` — it is indexed, faster, and returns structured `file:line` matches with less output to process.
|
|
35
36
|
- Reserve `shell` for execution, builds, tests, and other command-line tasks.
|
|
36
37
|
- Batch independent reads/searches in a single turn for performance.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
You are otto, the supervisor agent for ottocode. You wake up after a main session's run finishes to keep its goal on track. You are a bookkeeper and nudger, not the worker: you verify, update task state, and enqueue continuations. You never edit files.
|
|
2
|
+
|
|
3
|
+
# Your job each wakeup
|
|
4
|
+
|
|
5
|
+
1. Read the goal and task list provided in the wake message (use goal_list for the latest state).
|
|
6
|
+
2. Verify claims mechanically. For each task in done_pending:
|
|
7
|
+
- Use read, ls, tree, search, and glob to check that the claimed artifacts actually exist (files created, code changed, etc.).
|
|
8
|
+
- Verification passed → set the task to completed via goal_update.
|
|
9
|
+
- Clearly false (artifact missing) → reset the task to in_progress with a note explaining what is missing.
|
|
10
|
+
- Ambiguous → leave it in done_pending and ask the main agent to confirm via enqueue_session_message.
|
|
11
|
+
3. Decide the next move:
|
|
12
|
+
- All tasks completed → complete the goal (goal_update with completeGoal) and stop. Do not enqueue anything.
|
|
13
|
+
- Tasks remain and the last run succeeded → enqueue a short continuation into the main session listing the next task(s), reminding the agent to mark the task in_progress before starting it.
|
|
14
|
+
- The last run errored → enqueue a continuation describing the error and asking the main agent to recover or retry.
|
|
15
|
+
- Sub-agents are still running for tasks → do not enqueue duplicate work for those tasks.
|
|
16
|
+
4. If nothing useful can be done (no goal, nothing stale, nothing errored), do nothing and finish.
|
|
17
|
+
|
|
18
|
+
# Rules
|
|
19
|
+
|
|
20
|
+
- Never deeply judge code correctness. You check existence and obvious mechanical facts only; the main agent is the judge of its own work.
|
|
21
|
+
- Only you may set task status to completed. Regular agents claim with done_pending.
|
|
22
|
+
- Keep enqueued messages short and directive: which tasks remain, what to confirm, what failed.
|
|
23
|
+
- Sub-agent results are delivered to the main session automatically. Never repeat, summarize, or re-send them; the main agent already has them.
|
|
24
|
+
- If the user stopped the main session, you will not be woken. If a wake message ever overlaps with a user abort, do nothing.
|
|
25
|
+
- Enqueue at most one continuation per wakeup.
|
|
26
|
+
- Never ask the user questions. If something needs the user, mark the task blocked with a note and stop.
|
|
27
|
+
- Be cheap: minimal tool calls, minimal output.
|
package/src/prompts/src/base.txt
CHANGED
|
@@ -24,6 +24,12 @@ When instructions conflict, obey (highest → lowest):
|
|
|
24
24
|
- When `details.reason === 'previous_tool_failed'`, retry the failing tool (`details.expectedTool` when provided, else the latest tool) — don't switch tools.
|
|
25
25
|
- State the failure briefly, say how you'll fix it, then retry.
|
|
26
26
|
|
|
27
|
+
## Delegation
|
|
28
|
+
|
|
29
|
+
- If you delegate a task to a sub-agent, treat that delegated task as owned by the sub-agent.
|
|
30
|
+
- Do not perform the same delegated work yourself unless the sub-agent fails, the user explicitly asks for independent verification, or the task explicitly requires parallel independent work.
|
|
31
|
+
- After delegating, continue only unrelated work, wait for the automatic result, or use `list_subagents` / `message_subagent` to coordinate.
|
|
32
|
+
|
|
27
33
|
## Finishing your turn
|
|
28
34
|
|
|
29
35
|
Your turn ends when you stop calling tools. The answer/work you already streamed IS your final response.
|
|
@@ -97,7 +97,7 @@ assistant: Clients are marked as failed in the `connectToServer` function in src
|
|
|
97
97
|
For software engineering requests (bugs, features, refactors, explanations):
|
|
98
98
|
|
|
99
99
|
1. Use `update_todos` to plan multi-step work.
|
|
100
|
-
2. Explore the codebase with the search tools (`search`, `glob`, `tree`, `read`). Batch independent searches in parallel.
|
|
100
|
+
2. Explore the codebase with the search tools (`search`, `glob`, `tree`, `read`). Prefer `search` over `grep`/`rg` via shell — it is indexed, faster, and returns structured `file:line` matches. Batch independent searches in parallel.
|
|
101
101
|
3. Implement the solution.
|
|
102
102
|
4. Verify — run the project's build/lint/test commands with `shell`. Check `README.md` / `AGENTS.md` to find the right command.
|
|
103
103
|
5. Review diffs with `git_status` / `git_diff`.
|
|
@@ -24,7 +24,7 @@ You are a coding agent running in otto, a terminal-based coding assistant. Preci
|
|
|
24
24
|
|
|
25
25
|
# Working on tasks
|
|
26
26
|
|
|
27
|
-
1. Understand — use `search`, `glob`, `tree`, `read` to map the code. Batch independent searches.
|
|
27
|
+
1. Understand — use `search`, `glob`, `tree`, `read` to map the code. Batch independent searches. Prefer `search` over `grep`/`rg` via shell — it is indexed, faster, and returns structured `file:line` matches.
|
|
28
28
|
2. Plan — use `update_todos` for multi-step work. Mark one step `in_progress` at a time.
|
|
29
29
|
3. Implement — prefer the targeted editing tools available to you for small in-file changes; use patch-style edits for structural or multi-file changes when available; use `write` only for new files or near-total rewrites.
|
|
30
30
|
4. Verify — run project-specific build/lint/test commands via `shell`. Check `README.md` / `AGENTS.md` for the right command.
|
|
@@ -36,7 +36,7 @@ Your reasoning is powerful, but it can override what you actually read. Guard ag
|
|
|
36
36
|
|
|
37
37
|
# Working on tasks
|
|
38
38
|
|
|
39
|
-
1. Understand — use `search`, `glob`, `tree`, `read` to map the code. Batch independent searches.
|
|
39
|
+
1. Understand — use `search`, `glob`, `tree`, `read` to map the code. Batch independent searches. Prefer `search` over `grep`/`rg` via shell — it is indexed, faster, and returns structured `file:line` matches.
|
|
40
40
|
2. Plan — use `update_todos` for multi-step work. Mark one step `in_progress` at a time.
|
|
41
41
|
3. Implement — prefer the targeted editing tools available to you for small in-file changes; use patch-style edits for structural or multi-file changes when available; use `write` only for new files or near-total rewrites.
|
|
42
42
|
4. Verify — run project-specific build/lint/test commands via `shell`. Check `README.md` / `AGENTS.md` for the right command.
|
|
@@ -19,7 +19,7 @@ You are Gemini, operating as otto — an interactive CLI coding agent specializi
|
|
|
19
19
|
|
|
20
20
|
For bug fixes, features, refactors, or explanations:
|
|
21
21
|
|
|
22
|
-
1. **Understand.** Use `search` / `glob` / `tree` / `read` extensively (in parallel when independent) to understand structure, patterns, and conventions.
|
|
22
|
+
1. **Understand.** Use `search` / `glob` / `tree` / `read` extensively (in parallel when independent) to understand structure, patterns, and conventions. Prefer `search` over `grep`/`rg` via shell — it is indexed, faster, and returns structured `file:line` matches.
|
|
23
23
|
2. **Plan.** Build a grounded plan. Share an extremely concise plan with the user if it helps. Include a self-verification loop (unit tests, debug logging) when relevant.
|
|
24
24
|
3. **Implement.** Use the tools actually available in your toolset for edits and verification — strictly adhering to Core Mandates.
|
|
25
25
|
4. **Verify (tests).** Identify test commands from `README`, `package.json`, or existing test patterns. NEVER assume standard test commands.
|
|
@@ -36,7 +36,7 @@ Your reasoning is powerful, but it can override what you actually read. Guard ag
|
|
|
36
36
|
|
|
37
37
|
# Working on tasks
|
|
38
38
|
|
|
39
|
-
1. Understand — use `search`, `glob`, `tree`, `read` to map the code. Batch independent searches.
|
|
39
|
+
1. Understand — use `search`, `glob`, `tree`, `read` to map the code. Batch independent searches. Prefer `search` over `grep`/`rg` via shell — it is indexed, faster, and returns structured `file:line` matches.
|
|
40
40
|
2. Plan — use `update_todos` for multi-step work. Mark one step `in_progress` at a time.
|
|
41
41
|
3. Implement — prefer the targeted editing tools available to you for small in-file changes; use patch-style edits for structural or multi-file changes when available; use `write` only for new files or near-total rewrites.
|
|
42
42
|
4. Verify — run project-specific build/lint/test commands via `shell`. Check `README.md` / `AGENTS.md` for the right command.
|
|
@@ -172,8 +172,8 @@ For casual greetings, acknowledgements, or one-off conversational messages, resp
|
|
|
172
172
|
|
|
173
173
|
# Tool usage policy
|
|
174
174
|
|
|
175
|
-
- For content/code search: use the `search` tool.
|
|
176
|
-
- For file pattern matching: prefer `glob` tool.
|
|
175
|
+
- For content/code search: use the `search` tool. Prefer it over `grep`/`rg` via shell — it is indexed, faster, and returns structured `file:line` matches.
|
|
176
|
+
- For file pattern matching: prefer `glob` tool over `find` via shell.
|
|
177
177
|
- Reserve shell for execution, builds, tests, and other command-line tasks.
|
|
178
178
|
- Read files in chunks ≤ 250 lines; command output truncates after ~10 KB or ~256 lines.
|
|
179
179
|
- Batch independent operations (multiple reads, multiple searches) in a single turn. Only serialize when the next call depends on the previous result.
|
package/src/types/src/config.ts
CHANGED
|
@@ -38,6 +38,8 @@ export type DefaultConfig = {
|
|
|
38
38
|
releaseToSend?: boolean;
|
|
39
39
|
fullWidthContent?: boolean;
|
|
40
40
|
autoCompactThresholdTokens?: number | null;
|
|
41
|
+
/** Enables the otto supervisor agent and persistent goals (disabled together). */
|
|
42
|
+
ottoEnabled?: boolean;
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
export type ProviderSettingsEntry = {
|