init
This commit is contained in:
Executable
+7
@@ -0,0 +1,7 @@
|
||||
domain: example_domain
|
||||
primary_owner: TBD
|
||||
reviewers:
|
||||
- integration_owner
|
||||
paths:
|
||||
- domains/example_domain/**
|
||||
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
# Domain Template
|
||||
|
||||
复制本目录后完成以下替换:
|
||||
|
||||
1. 把 `example_domain` 替换为稳定领域标识。
|
||||
2. 把 `src/domain_plugin` 重命名为 `<domain>_domain`,同步修改 manifest entrypoint。
|
||||
3. 填写真实负责人、能力、参数 Schema、preset 和信号映射。
|
||||
4. `signal-mapping.yaml` 在通过 HIL 前保持 `status: draft`。
|
||||
5. 补齐 Generator、Validator、Compiler、Telemetry Decoder 和测试。
|
||||
|
||||
领域插件不得保存 DBC 副本或直接发送 CAN。Compiler 返回符合公共 Schema 的 `CommandPlan`,公共 Runtime 负责安全门禁和发送。
|
||||
|
||||
Executable
+18
@@ -0,0 +1,18 @@
|
||||
apiVersion: cognitive-agent/v1alpha1
|
||||
kind: SignalMapping
|
||||
metadata:
|
||||
id: example-domain-reference-mapping
|
||||
name: Example domain reference vehicle mapping
|
||||
version: 0.1.0
|
||||
spec:
|
||||
domain: example_domain
|
||||
platform: reference_vehicle
|
||||
dbc_ref: ../../../platforms/reference_vehicle/can/dbc/vehicle.dbc
|
||||
status: draft
|
||||
mappings:
|
||||
- capability: example_domain.set_level
|
||||
parameter: level_pct
|
||||
compiler_handler: compile_set_level
|
||||
calibration_ref: ../../../platforms/reference_vehicle/calibration/example_domain.yaml
|
||||
unit: percent
|
||||
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
apiVersion: cognitive-agent/v1alpha1
|
||||
kind: CapabilityCatalog
|
||||
metadata:
|
||||
id: example-domain-capabilities
|
||||
name: Example domain capabilities
|
||||
version: 0.1.0
|
||||
spec:
|
||||
domain: example_domain
|
||||
capabilities:
|
||||
- name: example_domain.set_level
|
||||
description: Replace with a user-facing semantic capability description.
|
||||
target_devices:
|
||||
- example_device
|
||||
target_scopes:
|
||||
- vehicle
|
||||
parameters:
|
||||
- name: level_pct
|
||||
type: number
|
||||
unit: percent
|
||||
required: true
|
||||
description: Replace with the physical meaning and range source.
|
||||
risk_level: medium
|
||||
confirmation_policy: on_ambiguity
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
apiVersion: cognitive-agent/v1alpha1
|
||||
kind: FunctionPreset
|
||||
metadata:
|
||||
id: example-domain-default
|
||||
name: Example preset
|
||||
version: 0.1.0
|
||||
spec:
|
||||
domain: example_domain
|
||||
operations:
|
||||
- id: set_example_level
|
||||
capability: example_domain.set_level
|
||||
target:
|
||||
device: example_device
|
||||
parameters:
|
||||
level_pct: 50
|
||||
transition:
|
||||
duration_ms: 1000
|
||||
profile: device_default
|
||||
timeout_ms: 5000
|
||||
failure_policy: abort
|
||||
locked_parameters: []
|
||||
applicability:
|
||||
platform: reference_vehicle
|
||||
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
apiVersion: cognitive-agent/v1alpha1
|
||||
kind: DomainManifest
|
||||
metadata:
|
||||
id: example-domain-plugin
|
||||
name: Example domain plugin
|
||||
version: 0.1.0
|
||||
spec:
|
||||
domain: example_domain
|
||||
entrypoint: domain_plugin.plugin:create_plugin
|
||||
function_schema: schemas/function-parameters.schema.json
|
||||
capabilities: config/capabilities.yaml
|
||||
signal_mapping: can/signal-mapping.yaml
|
||||
supported_platforms:
|
||||
- reference_vehicle
|
||||
telemetry_required: true
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"$id": "https://cognitive-agent.local/domains/example_domain/function-parameters.schema.json",
|
||||
"title": "ExampleDomainFunctionParameters",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"spec": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"domain": {"const": "example_domain"},
|
||||
"operations": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"capability": {"const": "example_domain.set_level"},
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"required": ["level_pct"],
|
||||
"properties": {
|
||||
"level_pct": {"type": "number", "minimum": 0, "maximum": 100}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
# Plugin Source
|
||||
|
||||
建议实现以下模块,具体接口以 `cognitive_agent.sdk` 为准:
|
||||
|
||||
- `plugin.py`:创建并注册插件能力。
|
||||
- `generator.py`:`IntentIR -> FunctionConfig`。
|
||||
- `validator.py`:领域组合约束和上下文校验。
|
||||
- `compiler.py`:`FunctionConfig + PlatformContext -> CommandPlan`。
|
||||
- `telemetry.py`:CAN 回读到领域状态。
|
||||
|
||||
模块只返回数据或领域错误,不直接访问 LLM、数据库、HTTP 或 CAN socket。
|
||||
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
# Domain Tests
|
||||
|
||||
- `unit/`:Generator、Validator、Compiler、Telemetry Decoder 的纯单元测试。
|
||||
- `contract/`:manifest、能力目录、preset、Schema、映射和 SDK 插件契约。
|
||||
- `integration/`:通过公共模拟 CAN Gateway 验证发送计划、回读、超时和失败行为。
|
||||
|
||||
硬件用例必须显式标记 `pytest.mark.hardware`,默认 CI 不运行。
|
||||
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
|
||||
Executable
+1
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user