@ottocode/server 0.1.237 → 0.1.242
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/index.ts +9 -1
- package/src/openapi/paths/config.ts +8 -0
- package/src/openapi/schemas.ts +1 -0
- package/src/presets.ts +7 -0
- package/src/routes/config/agents.ts +1 -1
- package/src/routes/config/defaults.ts +12 -2
- package/src/routes/config/main.ts +7 -1
- package/src/routes/config/utils.ts +1 -1
- package/src/routes/terminals.ts +94 -0
- package/src/runtime/agent/registry.ts +21 -0
- package/src/runtime/agent/runner-reasoning.ts +37 -11
- package/src/runtime/agent/runner-setup.ts +45 -3
- package/src/runtime/agent/runner.ts +45 -2
- package/src/runtime/ai-sdk-warnings.ts +70 -0
- package/src/runtime/commands/builtins.ts +84 -0
- package/src/runtime/commands/init.ts +358 -0
- package/src/runtime/message/compaction-limits.ts +40 -0
- package/src/runtime/message/compaction.ts +1 -0
- package/src/runtime/message/service.ts +43 -31
- package/src/runtime/provider/reasoning.ts +2 -0
- package/src/runtime/session/queue.ts +10 -0
- package/src/runtime/tools/approval.ts +6 -2
- package/src/tools/adapter.ts +6 -1
- package/src/ws.ts +5 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { publish } from '../../events/bus.ts';
|
|
2
2
|
|
|
3
|
-
export type ToolApprovalMode = 'auto' | 'dangerous' | 'all';
|
|
3
|
+
export type ToolApprovalMode = 'auto' | 'dangerous' | 'all' | 'yolo';
|
|
4
4
|
|
|
5
5
|
export const DANGEROUS_TOOLS = new Set([
|
|
6
6
|
'bash',
|
|
@@ -36,12 +36,16 @@ export function requiresApproval(
|
|
|
36
36
|
mode: ToolApprovalMode,
|
|
37
37
|
): boolean {
|
|
38
38
|
if (SAFE_TOOLS.has(toolName)) return false;
|
|
39
|
-
if (mode === 'auto') return false;
|
|
39
|
+
if (mode === 'auto' || mode === 'yolo') return false;
|
|
40
40
|
if (mode === 'all') return true;
|
|
41
41
|
if (mode === 'dangerous') return DANGEROUS_TOOLS.has(toolName);
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
export function skipsGuardApproval(mode?: ToolApprovalMode): boolean {
|
|
46
|
+
return mode === 'yolo';
|
|
47
|
+
}
|
|
48
|
+
|
|
45
49
|
export async function requestApproval(
|
|
46
50
|
sessionId: string,
|
|
47
51
|
messageId: string,
|
package/src/tools/adapter.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
import {
|
|
17
17
|
requiresApproval,
|
|
18
18
|
requestApproval,
|
|
19
|
+
skipsGuardApproval,
|
|
19
20
|
} from '../runtime/tools/approval.ts';
|
|
20
21
|
import { guardToolCall } from '../runtime/tools/guards.ts';
|
|
21
22
|
|
|
@@ -398,7 +399,11 @@ export function adaptTools(
|
|
|
398
399
|
if (guard.type === 'block') {
|
|
399
400
|
meta.blocked = true;
|
|
400
401
|
meta.blockReason = guard.reason;
|
|
401
|
-
} else if (
|
|
402
|
+
} else if (
|
|
403
|
+
guard.type === 'approve' &&
|
|
404
|
+
!meta.approvalPromise &&
|
|
405
|
+
!skipsGuardApproval(ctx.toolApprovalMode)
|
|
406
|
+
) {
|
|
402
407
|
meta.approvalPromise = requestApproval(
|
|
403
408
|
ctx.sessionId,
|
|
404
409
|
ctx.messageId,
|