@ottocode/server 0.1.232 → 0.1.234

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ottocode/server",
3
- "version": "0.1.232",
3
+ "version": "0.1.234",
4
4
  "description": "HTTP API server for ottocode",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -49,8 +49,8 @@
49
49
  "typecheck": "tsc --noEmit"
50
50
  },
51
51
  "dependencies": {
52
- "@ottocode/sdk": "0.1.232",
53
- "@ottocode/database": "0.1.232",
52
+ "@ottocode/sdk": "0.1.234",
53
+ "@ottocode/database": "0.1.234",
54
54
  "drizzle-orm": "^0.44.5",
55
55
  "hono": "^4.9.9",
56
56
  "zod": "^4.3.6"
@@ -40,7 +40,7 @@ export const sessionFilesPaths = {
40
40
  path: { type: 'string' },
41
41
  operation: {
42
42
  type: 'string',
43
- enum: ['write', 'patch', 'edit', 'create'],
43
+ enum: ['write', 'patch', 'create'],
44
44
  },
45
45
  timestamp: { type: 'integer' },
46
46
  toolCallId: { type: 'string' },
package/src/presets.ts CHANGED
@@ -7,76 +7,77 @@ import AGENT_PLAN from '@ottocode/sdk/prompts/agents/plan.txt' with {
7
7
  import AGENT_GENERAL from '@ottocode/sdk/prompts/agents/general.txt' with {
8
8
  type: 'text',
9
9
  };
10
+ import AGENT_RESEARCH from '@ottocode/sdk/prompts/agents/research.txt' with {
11
+ type: 'text',
12
+ };
13
+ import { defaultToolsForAgent } from './runtime/agent/registry.ts';
14
+
15
+ type BuiltinAgentPreset = {
16
+ prompt: string;
17
+ tools: string[];
18
+ };
10
19
 
20
+ /**
21
+ * Built-in agent presets exported for embedding.
22
+ *
23
+ * These are derived from the same runtime defaults used by the server so
24
+ * embedding docs and runtime behavior stay in sync.
25
+ */
11
26
  export const BUILTIN_AGENTS = {
12
27
  build: {
13
28
  prompt: AGENT_BUILD,
14
- tools: [
15
- 'read',
16
- 'write',
17
- 'ls',
18
- 'tree',
19
- 'bash',
20
- 'update_todos',
21
- 'terminal',
22
- 'git_status',
23
- 'git_diff',
24
- 'ripgrep',
25
- 'apply_patch',
26
- 'websearch',
27
- 'progress_update',
28
- 'finish',
29
- ] as string[],
29
+ tools: defaultToolsForAgent('build'),
30
30
  },
31
31
  plan: {
32
32
  prompt: AGENT_PLAN,
33
- tools: [
34
- 'read',
35
- 'ls',
36
- 'tree',
37
- 'ripgrep',
38
- 'update_todos',
39
- 'websearch',
40
- 'progress_update',
41
- 'finish',
42
- ] as string[],
33
+ tools: defaultToolsForAgent('plan'),
43
34
  },
44
35
  general: {
45
36
  prompt: AGENT_GENERAL,
46
- tools: [
47
- 'read',
48
- 'write',
49
- 'ls',
50
- 'tree',
51
- 'bash',
52
- 'ripgrep',
53
- 'terminal',
54
- 'websearch',
55
- 'update_todos',
56
- 'progress_update',
57
- 'finish',
58
- ] as string[],
37
+ tools: defaultToolsForAgent('general'),
59
38
  },
60
- };
39
+ research: {
40
+ prompt: AGENT_RESEARCH,
41
+ tools: defaultToolsForAgent('research'),
42
+ },
43
+ } satisfies Record<string, BuiltinAgentPreset>;
61
44
 
45
+ /**
46
+ * Built-in tool names available from the server runtime.
47
+ *
48
+ * This includes the standard runtime tools plus the research-oriented
49
+ * database tools that are available to the research preset.
50
+ *
51
+ * This is the global built-in tool universe, not the tool list for every
52
+ * agent. Agent-specific access should come from BUILTIN_AGENTS[agent].tools
53
+ * or project/global overrides.
54
+ */
62
55
  export const BUILTIN_TOOLS = [
63
56
  'read',
64
57
  'write',
65
58
  'ls',
66
59
  'tree',
60
+ 'pwd',
61
+ 'cd',
67
62
  'bash',
68
63
  'terminal',
69
64
  'ripgrep',
65
+ 'glob',
70
66
  'git_status',
71
67
  'git_diff',
72
68
  'git_commit',
73
69
  'apply_patch',
74
70
  'update_todos',
75
- 'edit',
76
71
  'websearch',
77
72
  'progress_update',
78
73
  'finish',
79
74
  'skill',
75
+ 'query_sessions',
76
+ 'query_messages',
77
+ 'get_session_context',
78
+ 'search_history',
79
+ 'get_parent_session',
80
+ 'present_action',
80
81
  ] as const;
81
82
 
82
83
  export type BuiltinAgent = keyof typeof BUILTIN_AGENTS;
@@ -6,18 +6,11 @@ import { eq, and, inArray } from 'drizzle-orm';
6
6
  import { serializeError } from '../runtime/errors/api-error.ts';
7
7
  import { logger } from '@ottocode/sdk';
8
8
 
9
- const FILE_EDIT_TOOLS = [
10
- 'Write',
11
- 'ApplyPatch',
12
- 'Edit',
13
- 'write',
14
- 'apply_patch',
15
- 'edit',
16
- ];
9
+ const FILE_EDIT_TOOLS = ['Write', 'ApplyPatch', 'write', 'apply_patch'];
17
10
 
18
11
  interface FileOperation {
19
12
  path: string;
20
- operation: 'write' | 'patch' | 'edit' | 'create';
13
+ operation: 'write' | 'patch' | 'create';
21
14
  timestamp: number;
22
15
  toolCallId: string;
23
16
  toolName: string;
@@ -69,7 +62,7 @@ function extractFilePathFromToolCall(
69
62
 
70
63
  const name = toolName.toLowerCase();
71
64
 
72
- if (name === 'write' || name === 'edit') {
65
+ if (name === 'write') {
73
66
  if (args && typeof args.path === 'string') return args.path;
74
67
  if (typeof c.path === 'string') return c.path;
75
68
  }
@@ -217,13 +210,10 @@ function extractDataFromToolResult(
217
210
  return { patch, writeContent, artifact };
218
211
  }
219
212
 
220
- function getOperationType(
221
- toolName: string,
222
- ): 'write' | 'patch' | 'edit' | 'create' {
213
+ function getOperationType(toolName: string): 'write' | 'patch' | 'create' {
223
214
  const name = toolName.toLowerCase();
224
215
  if (name === 'write') return 'write';
225
216
  if (name === 'applypatch' || name === 'apply_patch') return 'patch';
226
- if (name === 'edit') return 'edit';
227
217
  return 'write';
228
218
  }
229
219
 
@@ -76,9 +76,6 @@ function describeToolResult(info: ToolResultInfo): TargetDescriptor | null {
76
76
  return describeWrite(info);
77
77
  case 'apply_patch':
78
78
  return describePatch(info);
79
- case 'edit':
80
- case 'multiedit':
81
- return describeEdit(info);
82
79
  default:
83
80
  if (toolName.includes('__')) {
84
81
  return describeMcpTool(info);
@@ -208,17 +205,6 @@ function normalizePath(path: string): string {
208
205
  return path.replace(/\\/g, '/');
209
206
  }
210
207
 
211
- function describeEdit(info: ToolResultInfo): TargetDescriptor | null {
212
- const args = getRecord(info.args);
213
- if (!args) return null;
214
- const filePath = getString(args.filePath);
215
- if (!filePath) return null;
216
- const normalized = normalizePath(filePath);
217
- const key = `edit:${normalized}`;
218
- const summary = `[previous edit] ${normalized}`;
219
- return { keys: [key], summary };
220
- }
221
-
222
208
  function describeMcpTool(info: ToolResultInfo): TargetDescriptor | null {
223
209
  const { toolName } = info;
224
210
  const result = getRecord(info.result);
@@ -8,8 +8,6 @@ export const DANGEROUS_TOOLS = new Set([
8
8
  'write',
9
9
  'apply_patch',
10
10
  'terminal',
11
- 'edit',
12
- 'multiedit',
13
11
  'git_commit',
14
12
  'git_push',
15
13
  ]);
@@ -24,8 +24,6 @@ export function guardToolCall(
24
24
  case 'read':
25
25
  return guardReadPath(String(a.path ?? ''), context.projectRoot);
26
26
  case 'write':
27
- case 'edit':
28
- case 'multiedit':
29
27
  return guardWritePath(toolName, a);
30
28
  default:
31
29
  return { type: 'allow' };
@@ -36,10 +36,8 @@ export const CANONICAL_TO_PASCAL: Record<string, string> = {
36
36
  git_diff: 'GitDiff',
37
37
  git_commit: 'GitCommit',
38
38
 
39
- // Patch/edit
39
+ // Patch
40
40
  apply_patch: 'ApplyPatch',
41
- edit: 'Edit',
42
- multiedit: 'MultiEdit',
43
41
 
44
42
  // Task management
45
43
  update_todos: 'UpdateTodos',
@@ -76,10 +74,8 @@ export const PASCAL_TO_CANONICAL: Record<string, string> = {
76
74
  GitDiff: 'git_diff',
77
75
  GitCommit: 'git_commit',
78
76
 
79
- // Patch/edit
77
+ // Patch
80
78
  ApplyPatch: 'apply_patch',
81
- Edit: 'edit',
82
- MultiEdit: 'multiedit',
83
79
 
84
80
  // Task management
85
81
  UpdateTodos: 'update_todos',
@@ -138,7 +138,7 @@ export function adaptTools(
138
138
 
139
139
  // Anthropic allows max 4 cache_control blocks
140
140
  // Cache only the most frequently used tools: read, write, bash
141
- const cacheableTools = new Set(['read', 'write', 'bash', 'edit']);
141
+ const cacheableTools = new Set(['read', 'write', 'bash']);
142
142
  let cachedToolCount = 0;
143
143
 
144
144
  for (const { name: canonicalName, tool } of tools) {