@ottocode/server 0.1.236 → 0.1.237
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 +3 -3
- package/src/presets.ts +2 -0
- package/src/routes/session-files.ts +19 -2
- package/src/runtime/agent/registry.ts +4 -0
- package/src/runtime/agent/runner.ts +6 -1
- package/src/runtime/tools/approval.ts +2 -0
- package/src/runtime/tools/mapping.ts +4 -0
- package/src/tools/adapter.ts +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottocode/server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.237",
|
|
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.
|
|
53
|
-
"@ottocode/database": "0.1.
|
|
52
|
+
"@ottocode/sdk": "0.1.237",
|
|
53
|
+
"@ottocode/database": "0.1.237",
|
|
54
54
|
"drizzle-orm": "^0.44.5",
|
|
55
55
|
"hono": "^4.9.9",
|
|
56
56
|
"zod": "^4.3.6"
|
package/src/presets.ts
CHANGED
|
@@ -6,7 +6,16 @@ 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 = [
|
|
9
|
+
const FILE_EDIT_TOOLS = [
|
|
10
|
+
'Write',
|
|
11
|
+
'Edit',
|
|
12
|
+
'MultiEdit',
|
|
13
|
+
'ApplyPatch',
|
|
14
|
+
'write',
|
|
15
|
+
'edit',
|
|
16
|
+
'multiedit',
|
|
17
|
+
'apply_patch',
|
|
18
|
+
];
|
|
10
19
|
|
|
11
20
|
interface FileOperation {
|
|
12
21
|
path: string;
|
|
@@ -62,7 +71,7 @@ function extractFilePathFromToolCall(
|
|
|
62
71
|
|
|
63
72
|
const name = toolName.toLowerCase();
|
|
64
73
|
|
|
65
|
-
if (name === 'write') {
|
|
74
|
+
if (name === 'write' || name === 'edit' || name === 'multiedit') {
|
|
66
75
|
if (args && typeof args.path === 'string') return args.path;
|
|
67
76
|
if (typeof c.path === 'string') return c.path;
|
|
68
77
|
}
|
|
@@ -189,6 +198,13 @@ function extractDataFromToolResult(
|
|
|
189
198
|
patch = (args?.patch as string | undefined) ?? c.patch;
|
|
190
199
|
}
|
|
191
200
|
|
|
201
|
+
if (
|
|
202
|
+
(name === 'edit' || name === 'multiedit') &&
|
|
203
|
+
typeof c.result?.artifact?.patch === 'string'
|
|
204
|
+
) {
|
|
205
|
+
patch = c.result.artifact.patch;
|
|
206
|
+
}
|
|
207
|
+
|
|
192
208
|
if (name === 'write') {
|
|
193
209
|
writeContent = args?.content as string | undefined;
|
|
194
210
|
}
|
|
@@ -213,6 +229,7 @@ function extractDataFromToolResult(
|
|
|
213
229
|
function getOperationType(toolName: string): 'write' | 'patch' | 'create' {
|
|
214
230
|
const name = toolName.toLowerCase();
|
|
215
231
|
if (name === 'write') return 'write';
|
|
232
|
+
if (name === 'edit' || name === 'multiedit') return 'patch';
|
|
216
233
|
if (name === 'applypatch' || name === 'apply_patch') return 'patch';
|
|
217
234
|
return 'write';
|
|
218
235
|
}
|
|
@@ -116,6 +116,8 @@ const baseToolSet = ['progress_update', 'finish', 'skill'] as const;
|
|
|
116
116
|
const defaultToolExtras: Record<string, string[]> = {
|
|
117
117
|
build: [
|
|
118
118
|
'read',
|
|
119
|
+
'edit',
|
|
120
|
+
'multiedit',
|
|
119
121
|
'write',
|
|
120
122
|
'ls',
|
|
121
123
|
'tree',
|
|
@@ -131,6 +133,8 @@ const defaultToolExtras: Record<string, string[]> = {
|
|
|
131
133
|
plan: ['read', 'ls', 'tree', 'ripgrep', 'update_todos', 'websearch'],
|
|
132
134
|
general: [
|
|
133
135
|
'read',
|
|
136
|
+
'edit',
|
|
137
|
+
'multiedit',
|
|
134
138
|
'write',
|
|
135
139
|
'ls',
|
|
136
140
|
'tree',
|
|
@@ -51,7 +51,12 @@ export {
|
|
|
51
51
|
getRunnerState,
|
|
52
52
|
} from '../session/queue.ts';
|
|
53
53
|
|
|
54
|
-
const DEFAULT_TRACED_TOOL_INPUTS = new Set([
|
|
54
|
+
const DEFAULT_TRACED_TOOL_INPUTS = new Set([
|
|
55
|
+
'write',
|
|
56
|
+
'edit',
|
|
57
|
+
'multiedit',
|
|
58
|
+
'apply_patch',
|
|
59
|
+
]);
|
|
55
60
|
|
|
56
61
|
function shouldTraceToolInput(name: string): boolean {
|
|
57
62
|
void DEFAULT_TRACED_TOOL_INPUTS;
|
|
@@ -17,6 +17,8 @@ export type ToolNamingConvention = 'canonical' | 'claude-code';
|
|
|
17
17
|
export const CANONICAL_TO_PASCAL: Record<string, string> = {
|
|
18
18
|
// File system operations
|
|
19
19
|
read: 'Read',
|
|
20
|
+
edit: 'Edit',
|
|
21
|
+
multiedit: 'MultiEdit',
|
|
20
22
|
write: 'Write',
|
|
21
23
|
ls: 'Ls',
|
|
22
24
|
tree: 'Tree',
|
|
@@ -55,6 +57,8 @@ export const CANONICAL_TO_PASCAL: Record<string, string> = {
|
|
|
55
57
|
export const PASCAL_TO_CANONICAL: Record<string, string> = {
|
|
56
58
|
// File system operations
|
|
57
59
|
Read: 'read',
|
|
60
|
+
Edit: 'edit',
|
|
61
|
+
MultiEdit: 'multiedit',
|
|
58
62
|
Write: 'write',
|
|
59
63
|
Ls: 'ls',
|
|
60
64
|
Tree: 'tree',
|
package/src/tools/adapter.ts
CHANGED
|
@@ -59,7 +59,12 @@ function extractToolCallId(options: unknown): string | undefined {
|
|
|
59
59
|
return (options as { toolCallId?: string } | undefined)?.toolCallId;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
const DEFAULT_TRACED_TOOL_INPUTS = new Set([
|
|
62
|
+
const DEFAULT_TRACED_TOOL_INPUTS = new Set([
|
|
63
|
+
'write',
|
|
64
|
+
'edit',
|
|
65
|
+
'multiedit',
|
|
66
|
+
'apply_patch',
|
|
67
|
+
]);
|
|
63
68
|
|
|
64
69
|
function shouldTraceToolInput(name: string): boolean {
|
|
65
70
|
void DEFAULT_TRACED_TOOL_INPUTS;
|