feat(agent): migrate OpenCode 2 runtime and sandbox tools
Upgrade the runtime and native plugin API to OpenCode 2.0.24. Restore session-scoped learning, credential renewal, typed project queries and controlled frontend actions from the legacy Agent. Replace host Shell execution with an approved Landlock/seccomp executor and persistent per-session workspaces. Add typed Bocha search and Tianditu geocoding bridges using the owning session credential. Require a working kernel sandbox before startup and persist workspace files in deployments. Validation completed before this commit: TypeScript checks, 150 Bun tests, Docker build and UID 10001 sandbox execution, native Shell approval and session recovery. Tianditu succeeded; Bocha currently reports exhausted account quota. Unrelated investigation-report contract work is excluded.
This commit is contained in:
+370
-71
@@ -1,78 +1,377 @@
|
||||
{
|
||||
"$schema": "https://opencode.ai/config.json",
|
||||
"provider": {
|
||||
"model": "deepseek/deepseek-flash",
|
||||
"default_agent": "instruction",
|
||||
"permissions": [
|
||||
{
|
||||
"action": "*",
|
||||
"resource": "*",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "external_directory",
|
||||
"resource": "*",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": ".env",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": ".env.*",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": "*.env",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": "**/.env",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": "**/.env.*",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": "**/*.env",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": "data/**",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": "**/data/**",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": "logs/**",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "read",
|
||||
"resource": "**/logs/**",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": "*",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": ".env",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": ".env.*",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": "*.env",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": "**/.env",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": "**/.env.*",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": "**/*.env",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": "data/**",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": "**/data/**",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": "logs/**",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "edit",
|
||||
"resource": "**/logs/**",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "*",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "rm *",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "rmdir *",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "mv *",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "chmod *",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "chown *",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "sudo *",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "curl *",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "wget *",
|
||||
"effect": "ask"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "*.env*",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "*data/*",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "* data",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "*/data",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "*logs/*",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "* logs",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "shell",
|
||||
"resource": "*/logs",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "question",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "subagent",
|
||||
"resource": "*",
|
||||
"effect": "deny"
|
||||
},
|
||||
{
|
||||
"action": "todo",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "todoread",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "todowrite",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "publish_execution_plan",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "get_operational_task_context",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "query_operational_task_data",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "publish_task_report",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "propose_task_action",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "add_task_human_evidence",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "query_project_data",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "final_answer",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "locate_features",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "zoom_to_map",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "show_chart",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "view_history",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "web_search",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
},
|
||||
{
|
||||
"action": "geocode",
|
||||
"resource": "*",
|
||||
"effect": "allow"
|
||||
}
|
||||
],
|
||||
"providers": {
|
||||
"deepseek": {
|
||||
"options": {
|
||||
"name": "DeepSeek",
|
||||
"env": [
|
||||
"DEEPSEEK_API_KEY"
|
||||
],
|
||||
"package": "@opencode/ai/providers/openai-compatible",
|
||||
"settings": {
|
||||
"baseURL": "https://api.deepseek.com/v1",
|
||||
"apiKey": "{env:DEEPSEEK_API_KEY}"
|
||||
},
|
||||
"models": {
|
||||
"deepseek-flash": {
|
||||
"name": "deepseek-flash",
|
||||
"capabilities": {
|
||||
"tools": true,
|
||||
"input": [
|
||||
"text"
|
||||
],
|
||||
"output": [
|
||||
"text"
|
||||
]
|
||||
},
|
||||
"limit": {
|
||||
"context": 1000000,
|
||||
"output": 393216
|
||||
},
|
||||
"compatibility": {
|
||||
"reasoningField": "reasoning_content",
|
||||
"requireReasoning": true
|
||||
}
|
||||
},
|
||||
"deepseek-v4-flash": {
|
||||
"name": "deepseek-v4-flash",
|
||||
"capabilities": {
|
||||
"tools": true,
|
||||
"input": [
|
||||
"text"
|
||||
],
|
||||
"output": [
|
||||
"text"
|
||||
]
|
||||
},
|
||||
"limit": {
|
||||
"context": 1000000,
|
||||
"output": 393216
|
||||
},
|
||||
"compatibility": {
|
||||
"reasoningField": "reasoning_content",
|
||||
"requireReasoning": true
|
||||
}
|
||||
},
|
||||
"deepseek-v4-pro": {
|
||||
"name": "deepseek-v4-pro",
|
||||
"capabilities": {
|
||||
"tools": true,
|
||||
"input": [
|
||||
"text"
|
||||
],
|
||||
"output": [
|
||||
"text"
|
||||
]
|
||||
},
|
||||
"limit": {
|
||||
"context": 1000000,
|
||||
"output": 393216
|
||||
},
|
||||
"compatibility": {
|
||||
"reasoningField": "reasoning_content",
|
||||
"requireReasoning": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"model": "deepseek/deepseek-v4-flash",
|
||||
"experimental": {
|
||||
"continue_loop_on_deny": true
|
||||
},
|
||||
"server": {
|
||||
"hostname": "127.0.0.1",
|
||||
"port": 4096
|
||||
},
|
||||
"permission": {
|
||||
"*": "ask",
|
||||
"external_directory": "deny",
|
||||
"read": {
|
||||
"*": "allow",
|
||||
".env": "deny",
|
||||
".env.*": "deny",
|
||||
"*.env": "deny",
|
||||
"**/.env": "deny",
|
||||
"**/.env.*": "deny",
|
||||
"**/*.env": "deny",
|
||||
"data/**": "deny",
|
||||
"**/data/**": "deny",
|
||||
"logs/**": "deny",
|
||||
"**/logs/**": "deny"
|
||||
},
|
||||
"edit": {
|
||||
"*": "ask",
|
||||
".env": "deny",
|
||||
".env.*": "deny",
|
||||
"*.env": "deny",
|
||||
"**/.env": "deny",
|
||||
"**/.env.*": "deny",
|
||||
"**/*.env": "deny",
|
||||
"data/**": "deny",
|
||||
"**/data/**": "deny",
|
||||
"logs/**": "deny",
|
||||
"**/logs/**": "deny"
|
||||
},
|
||||
"bash": {
|
||||
"*": "ask",
|
||||
"rm *": "ask",
|
||||
"rmdir *": "ask",
|
||||
"mv *": "ask",
|
||||
"chmod *": "ask",
|
||||
"chown *": "ask",
|
||||
"sudo *": "ask",
|
||||
"curl *": "ask",
|
||||
"wget *": "ask",
|
||||
"*.env*": "deny",
|
||||
"*data/*": "deny",
|
||||
"* data": "deny",
|
||||
"*/data": "deny",
|
||||
"*logs/*": "deny",
|
||||
"* logs": "deny",
|
||||
"*/logs": "deny"
|
||||
},
|
||||
"question": "allow",
|
||||
"task": "deny",
|
||||
"todo": "allow",
|
||||
"todoread": "allow",
|
||||
"todowrite": "allow",
|
||||
"publish_execution_plan": "allow",
|
||||
"get_operational_task_context": "allow",
|
||||
"query_operational_task_data": "allow",
|
||||
"publish_task_report": "allow",
|
||||
"propose_task_action": "allow",
|
||||
"add_task_human_evidence": "allow"
|
||||
},
|
||||
"default_agent": "instruction"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user