Add command model, priority tie-break, and boundary matching
ci / vet-and-test (pull_request) Successful in 17s
ci / docker-checkout-hostgateway (pull_request) Successful in 1s

Why: I1 increment one - recognition output becomes a command list
for the host router, same-score ties resolve by priority (I5), and
CJK substring false positives get an opt-in boundary mode (I3).

Evidence: go vet clean; go test ./... all ok, including new command
(6), boundary (3), and tie-break tests; intentctl lint smoke run
shows boundary hints on short unbounded terms. Existing classifier
and ambiguity fixtures repointed to an equal-priority pair; the
greet corpus case now expects the I5 tie-break outcome.

Impact: Result gains Commands; recognizer derives them at one point
(guard/fallback stay empty); MatchSpec gains Boundary (default off,
legacy behavior unchanged); lint gains boundary hints. Top/Branch
stay for compatibility.

Refs: Documents proposal 2026-10-07-agent-stack-n1q1i1-plans.md I1 WP1/WP4/WP5
This commit is contained in:
2026-10-07 07:21:55 +00:00
parent 65aaebca1e
commit fa512ec03c
12 changed files with 726 additions and 46 deletions
+69 -11
View File
@@ -1,14 +1,72 @@
{
"cases": [
{"name": "status_with_slot", "input": "查询任务 42 的进度", "expect_branch": "matched", "expect_top": "demo.run.status_query", "expect_slots": {"run_id": "42"}},
{"name": "status_term_only", "input": "帮我看下进度", "expect_branch": "matched", "expect_top": "demo.run.status_query"},
{"name": "guard_config_query", "input": "查询系统配置", "expect_branch": "guard_hit", "expect_top": "guard.config_change"},
{"name": "negated_write_readonly", "input": "怎么配置查询进度", "expect_branch": "fallback"},
{"name": "restart_task", "input": "把任务重启一下", "expect_branch": "matched", "expect_top": "demo.run.restart"},
{"name": "greet_ambiguous", "input": "你好呀", "expect_branch": "ambiguous"},
{"name": "cancel_missing_required_slot", "input": "取消一下", "expect_branch": "matched", "expect_top": "demo.run.cancel", "expect_missing_slots": ["run_id"]},
{"name": "case_fold_deploy", "input": "please DEPLOY it", "expect_branch": "matched", "expect_top": "demo.misc.deploy"},
{"name": "casual_fallback", "input": "今天天气不错", "expect_branch": "fallback"},
{"name": "blank_fallback", "input": " ", "expect_branch": "fallback"}
{
"name": "status_with_slot",
"input": "查询任务 42 的进度",
"expect_branch": "matched",
"expect_top": "demo.run.status_query",
"expect_slots": {
"run_id": "42"
}
},
{
"name": "status_term_only",
"input": "帮我看下进度",
"expect_branch": "matched",
"expect_top": "demo.run.status_query"
},
{
"name": "guard_config_query",
"input": "查询系统配置",
"expect_branch": "guard_hit",
"expect_top": "guard.config_change"
},
{
"name": "negated_write_readonly",
"input": "怎么配置查询进度",
"expect_branch": "fallback"
},
{
"name": "restart_task",
"input": "把任务重启一下",
"expect_branch": "matched",
"expect_top": "demo.run.restart"
},
{
"name": "greet_tiebreak_priority",
"input": "你好呀",
"expect_branch": "matched",
"expect_top": "demo.greet.hello"
},
{
"name": "cancel_missing_required_slot",
"input": "取消一下",
"expect_branch": "matched",
"expect_top": "demo.run.cancel",
"expect_missing_slots": [
"run_id"
]
},
{
"name": "case_fold_deploy",
"input": "please DEPLOY it",
"expect_branch": "matched",
"expect_top": "demo.misc.deploy"
},
{
"name": "casual_fallback",
"input": "今天天气不错",
"expect_branch": "fallback"
},
{
"name": "blank_fallback",
"input": " ",
"expect_branch": "fallback"
},
{
"name": "tie_ambiguous",
"input": "打结",
"expect_branch": "ambiguous"
}
]
}
}
+83 -13
View File
@@ -6,24 +6,49 @@
"version": 1,
"description": "查询任务运行进度",
"matcher": {
"includes_any": ["进度", "状态"],
"excludes_any": ["配置"]
"includes_any": [
"进度",
"状态"
],
"excludes_any": [
"配置"
]
},
"slots": [
{"key": "run_id", "required": false, "pattern": "(?:run|任务)[:# ]*([A-Za-z0-9-]+)", "group": 1}
{
"key": "run_id",
"required": false,
"pattern": "(?:run|任务)[:# ]*([A-Za-z0-9-]+)",
"group": 1
}
],
"confidence": {"base": 0.8, "threshold": 0.7},
"confidence": {
"base": 0.8,
"threshold": 0.7
},
"risk": "low",
"handler": "taskrun.query_status",
"metadata": {"channel": "dialogue"}
"metadata": {
"channel": "dialogue"
}
},
{
"id": "demo.run.restart",
"domain": "demo",
"version": 1,
"description": "重启任务",
"matcher": {"includes_any": ["重启"], "includes_all": ["任务"]},
"confidence": {"base": 0.75, "threshold": 0.7},
"matcher": {
"includes_any": [
"重启"
],
"includes_all": [
"任务"
]
},
"confidence": {
"base": 0.75,
"threshold": 0.7
},
"risk": "medium",
"requires_confirm": true,
"handler": "taskrun.restart"
@@ -33,9 +58,18 @@
"domain": "demo",
"version": 1,
"description": "取消任务",
"matcher": {"includes_any": ["取消"]},
"matcher": {
"includes_any": [
"取消"
]
},
"slots": [
{"key": "run_id", "required": true, "pattern": "(?:run|任务)[:# ]*([A-Za-z0-9-]+)", "group": 1}
{
"key": "run_id",
"required": true,
"pattern": "(?:run|任务)[:# ]*([A-Za-z0-9-]+)",
"group": 1
}
],
"handler": "taskrun.cancel"
},
@@ -43,23 +77,59 @@
"id": "demo.greet.hello",
"domain": "demo",
"version": 1,
"matcher": {"includes_any": ["你好"]},
"matcher": {
"includes_any": [
"你好"
]
},
"priority": 10
},
{
"id": "demo.greet.hi",
"domain": "demo",
"version": 1,
"matcher": {"includes_any": ["你好"]},
"matcher": {
"includes_any": [
"你好"
]
},
"priority": 5
},
{
"id": "demo.misc.deploy",
"domain": "demo",
"version": 1,
"matcher": {"includes_any": ["deploy", "发布"], "case_sensitive": false},
"matcher": {
"includes_any": [
"deploy",
"发布"
],
"case_sensitive": false
},
"handler": "deploy.run"
},
{
"id": "demo.tie.alpha",
"domain": "demo",
"version": 1,
"matcher": {
"includes_any": [
"打结"
]
},
"priority": 5
},
{
"id": "demo.tie.beta",
"domain": "demo",
"version": 1,
"matcher": {
"includes_any": [
"打结"
]
},
"priority": 5
}
],
"disable": []
}
}