feat(ack): add structured worker model routing

This commit is contained in:
2026-07-31 23:34:13 +08:00
parent ee66dbe9ce
commit ae3bce7b5d
23 changed files with 6491 additions and 327 deletions
+534 -2
View File
@@ -12,6 +12,7 @@
"source": { "type": "string" },
"ackVersion": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*)(?:\\.(?:0|[1-9][0-9]*|[0-9]*[A-Za-z-][0-9A-Za-z-]*))*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$",
"description": "接入时所基于的 ack 版本,便于日后 diff 升级"
},
"kitVersion": {
@@ -35,6 +36,9 @@
"type": "string",
"const": "docs/ack/knowledge.yaml",
"description": "项目知识护栏库的唯一权威路径"
},
"orchestration": {
"$ref": "#/definitions/orchestration"
}
}
},
@@ -49,12 +53,538 @@
}
},
"statusReference": { "type": "object" },
"workerReceipts": {
"type": "array",
"items": { "$ref": "#/definitions/workerReceipt" }
},
"tasks": {
"type": "array",
"items": { "$ref": "#/definitions/task" }
}
},
"allOf": [
{
"if": {
"properties": {
"ackVersion": {
"type": "string",
"pattern": "^(?:0\\.[1-9][0-9]+\\.[0-9]+|[1-9][0-9]*\\.[0-9]+\\.[0-9]+)(?:-|\\+|$)"
}
},
"required": ["ackVersion"]
},
"then": {
"required": ["workerReceipts"],
"properties": {
"workerReceipts": {},
"tasks": { "$ref": "#/definitions/launchableTasks" },
"project": {
"type": "object",
"required": ["orchestration"],
"properties": {
"orchestration": {}
}
}
}
}
},
{
"if": {
"properties": {
"project": {
"type": "object",
"required": ["orchestration"],
"properties": {
"orchestration": {}
}
}
},
"required": ["project"]
},
"then": {
"required": ["workerReceipts"],
"properties": {
"workerReceipts": {},
"tasks": { "$ref": "#/definitions/launchableTasks" }
}
}
},
{
"if": {
"required": ["workerReceipts"],
"properties": {
"workerReceipts": {}
}
},
"then": {
"properties": {
"tasks": { "$ref": "#/definitions/launchableTasks" },
"project": {
"type": "object",
"required": ["orchestration"],
"properties": {
"orchestration": {}
}
}
}
}
}
],
"definitions": {
"sha256": {
"type": "string",
"pattern": "^sha256:[0-9a-f]{64}$"
},
"profileId": {
"type": "string",
"pattern": "^[a-z][a-z0-9-]{1,63}$"
},
"launchableTasks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$"
}
}
}
},
"modelList": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:/+@-]{0,127}$"
}
},
"modelTierAllowlist": {
"type": "object",
"minProperties": 1,
"additionalProperties": false,
"properties": {
"standard": { "$ref": "#/definitions/modelList" },
"strong": { "$ref": "#/definitions/modelList" }
}
},
"modelRoleAllowlist": {
"type": "object",
"minProperties": 1,
"additionalProperties": false,
"properties": {
"developer": { "$ref": "#/definitions/modelTierAllowlist" },
"test": { "$ref": "#/definitions/modelTierAllowlist" }
}
},
"modelAllowlist": {
"type": "object",
"additionalProperties": false,
"properties": {
"codex": { "$ref": "#/definitions/modelRoleAllowlist" },
"cursor-agent": { "$ref": "#/definitions/modelRoleAllowlist" }
}
},
"workerProfile": {
"type": "object",
"required": [
"role",
"cli",
"tier",
"model",
"reasoningEffort",
"permissionMode"
],
"additionalProperties": false,
"properties": {
"role": {
"type": "string",
"enum": ["developer", "test"]
},
"cli": {
"type": "string",
"enum": ["codex", "cursor-agent"]
},
"tier": {
"type": "string",
"enum": ["standard", "strong"]
},
"model": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:/+@-]{0,127}$"
},
"reasoningEffort": {
"type": ["string", "null"],
"enum": ["low", "medium", "high", "xhigh", null]
},
"permissionMode": {
"type": "string",
"enum": ["read-only", "workspace-write"]
}
}
},
"workerDefaults": {
"type": "object",
"additionalProperties": false,
"properties": {
"developer": { "$ref": "#/definitions/profileId" },
"test": { "$ref": "#/definitions/profileId" },
"developerUpgraded": { "$ref": "#/definitions/profileId" }
}
},
"orchestration": {
"type": "object",
"required": [
"profileVersion",
"mode",
"allowedWorktrees",
"modelAllowlist",
"profiles",
"defaults"
],
"additionalProperties": false,
"properties": {
"profileVersion": {
"type": "integer",
"const": 1
},
"mode": {
"type": "string",
"enum": ["orca", "manual"]
},
"allowedWorktrees": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string",
"minLength": 1,
"pattern": "^/"
}
},
"modelAllowlist": {
"$ref": "#/definitions/modelAllowlist"
},
"profiles": {
"type": "object",
"propertyNames": {
"$ref": "#/definitions/profileId"
},
"additionalProperties": {
"$ref": "#/definitions/workerProfile"
}
},
"defaults": {
"$ref": "#/definitions/workerDefaults"
}
},
"allOf": [
{
"if": {
"properties": {
"mode": { "const": "orca" }
},
"required": ["mode"]
},
"then": {
"properties": {
"allowedWorktrees": { "type": "array", "minItems": 1 },
"modelAllowlist": { "type": "object", "minProperties": 1 },
"profiles": { "type": "object", "minProperties": 1 },
"defaults": {
"type": "object",
"required": ["developer", "test"],
"properties": {
"developer": {},
"test": {}
}
}
}
}
}
]
},
"worktreeIdentity": {
"type": "object",
"required": [
"path",
"device",
"inode",
"gitCommonDir",
"gitCommonDevice",
"gitCommonInode"
],
"additionalProperties": false,
"properties": {
"path": {
"type": "string",
"pattern": "^/"
},
"device": {
"type": "integer",
"minimum": 0
},
"inode": {
"type": "integer",
"minimum": 1
},
"gitCommonDir": {
"type": "string",
"pattern": "^/"
},
"gitCommonDevice": {
"type": "integer",
"minimum": 0
},
"gitCommonInode": {
"type": "integer",
"minimum": 1
}
}
},
"receiptRequested": {
"type": "object",
"required": [
"cli",
"tier",
"model",
"reasoningEffort",
"permissionMode",
"executable",
"executableDevice",
"executableInode",
"cliVersion",
"argv",
"argvHash",
"environmentPolicy"
],
"additionalProperties": false,
"properties": {
"cli": {
"type": "string",
"enum": ["codex", "cursor-agent"]
},
"tier": {
"type": "string",
"enum": ["standard", "strong"]
},
"model": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._:/+@-]{0,127}$"
},
"reasoningEffort": {
"type": ["string", "null"],
"enum": ["low", "medium", "high", "xhigh", null]
},
"permissionMode": {
"type": "string",
"enum": ["read-only", "workspace-write"]
},
"executable": {
"type": "string",
"pattern": "^/"
},
"executableDevice": {
"type": "integer",
"minimum": 0
},
"executableInode": {
"type": "integer",
"minimum": 1
},
"cliVersion": {
"type": "string",
"minLength": 1
},
"argv": {
"type": "array",
"minItems": 2,
"items": {
"type": "string"
}
},
"argvHash": {
"$ref": "#/definitions/sha256"
},
"environmentPolicy": {
"type": "string",
"const": "per-cli-allowlist-v1"
}
}
},
"receiptBinding": {
"type": "object",
"required": [
"orchestrator",
"runtimeId",
"handle",
"incarnationId",
"observedWorktreePath",
"connected",
"writable",
"boundAt"
],
"additionalProperties": false,
"properties": {
"orchestrator": {
"type": "string",
"const": "orca"
},
"runtimeId": {
"type": "string",
"minLength": 1
},
"handle": {
"type": "string",
"minLength": 1
},
"incarnationId": {
"type": "string",
"minLength": 1
},
"observedWorktreePath": {
"type": "string"
},
"connected": {
"type": "boolean"
},
"writable": {
"type": "boolean"
},
"boundAt": {
"type": "string",
"minLength": 1
}
}
},
"workerReceipt": {
"type": "object",
"required": [
"receiptVersion",
"id",
"launchId",
"profileId",
"profileHash",
"launchFingerprint",
"slot",
"createdFor",
"worktree",
"requested",
"binding",
"createdAt",
"receiptHash"
],
"additionalProperties": false,
"properties": {
"receiptVersion": {
"type": "integer",
"const": 1
},
"id": {
"type": "string",
"pattern": "^WR-[0-9a-f]{64}$"
},
"launchId": {
"type": "string",
"pattern": "^[0-9a-f]{64}$"
},
"profileId": {
"$ref": "#/definitions/profileId"
},
"profileHash": {
"$ref": "#/definitions/sha256"
},
"launchFingerprint": {
"$ref": "#/definitions/sha256"
},
"slot": {
"type": "integer",
"minimum": 1,
"maximum": 99
},
"createdFor": {
"type": "object",
"required": ["taskId", "attemptId", "role"],
"additionalProperties": false,
"properties": {
"taskId": {
"type": "string",
"minLength": 1
},
"attemptId": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*-A[1-3]$"
},
"role": {
"type": "string",
"enum": ["developer", "test"]
}
}
},
"worktree": {
"$ref": "#/definitions/worktreeIdentity"
},
"requested": {
"$ref": "#/definitions/receiptRequested"
},
"binding": {
"$ref": "#/definitions/receiptBinding"
},
"createdAt": {
"type": "string",
"minLength": 1
},
"receiptHash": {
"$ref": "#/definitions/sha256"
}
}
},
"roleDispatch": {
"type": "object",
"required": ["profileId", "receiptId", "attemptId", "taskId", "dispatchId"],
"additionalProperties": false,
"properties": {
"profileId": {
"type": ["string", "null"],
"pattern": "^[a-z][a-z0-9-]{1,63}$"
},
"receiptId": {
"type": ["string", "null"],
"pattern": "^WR-[0-9a-f]{64}$"
},
"attemptId": {
"type": ["string", "null"],
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*-A[1-3]$"
},
"taskId": {
"type": ["string", "null"]
},
"dispatchId": {
"type": ["string", "null"]
}
},
"allOf": [
{
"if": {
"properties": {
"receiptId": { "type": "null" }
},
"required": ["receiptId"]
},
"then": {
"properties": {
"attemptId": { "type": "null" }
}
},
"else": {
"properties": {
"profileId": { "type": "string" },
"attemptId": { "type": "string" }
}
}
}
]
},
"status": {
"type": "string",
"enum": [
@@ -76,7 +606,7 @@
"round": { "type": "integer", "minimum": 1, "maximum": 3 },
"attemptId": {
"type": "string",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*-A[1-9][0-9]*$",
"pattern": "^[A-Za-z0-9][A-Za-z0-9._-]*-A[1-3]$",
"description": "稳定逻辑轮次 ID,应为 <task-id>-A<round>;旧轮次可缺省,但作为知识来源前必须补齐"
},
"result": { "type": "string", "enum": ["passed", "failed"] },
@@ -230,11 +760,13 @@
"verification": { "type": "object" },
"dispatch": {
"type": "object",
"additionalProperties": true,
"additionalProperties": false,
"properties": {
"taskId": { "type": ["string", "null"] },
"dispatchId": { "type": ["string", "null"] },
"worker": { "type": ["string", "null"] },
"developer": { "$ref": "#/definitions/roleDispatch" },
"test": { "$ref": "#/definitions/roleDispatch" },
"rounds": {
"type": "array",
"items": { "$ref": "#/definitions/round" }