Initial AM516 Feishu bot package

This commit is contained in:
Codex
2026-07-13 14:46:39 +08:00
commit 436f8cd981
25 changed files with 3138 additions and 0 deletions

View File

@@ -0,0 +1,183 @@
# Acceptance Samples | AM516 Delivery Prediction
Use API-connected samples only after AR51 confirms the functional test and creates a separate trusted approval record explicitly covering `api.zeroerr-agent.com`, the AM516 use case, and API-key use. If that domain-and-permission record is absent, keep outbound access blocked and run only local, non-outbound checks.
## Sample 1 | API Happy Path
Input:
```text
eRob110H160I-FHM-18ET[V6] 10
```
Expected:
- model parses successfully;
- quantity is accepted;
- the controlled script uses the macOS system trust store and keeps TLS verification enabled;
- no temporary TLS-bypass parameter is required for the normal happy path;
- API script runs;
- output does not expose API key;
- output follows the successful-report field order in `skills/joint-module-leadtime-report/SKILL.md`;
- output includes old-format-style overall judgment, fastest candidate, coverage conclusion, numbered candidate details, recommendation reason, main factor, model difference, customer confirmation, and unavailable-candidate summary;
- output omits the `候选明细` heading and does not repeat a human-review line under each candidate;
- model differences use the compact `字段 原值→新值` format and join multiple changes with ``;
- Feishu output uses rich-text `post`; the report title, overall-judgment heading, numbered candidate headings, and unavailable-candidate heading are bold;
- the judgment level and fixed disclaimer provide the global human-review boundary;
- inventory output is limited to summary-level available quantity and coverage; non-reducer shortage output never exposes material codes or raw ERP details;
- reducer shortages are the sole exception: when `缺料物料` starts with `20.30.`, output only the reducer code, inventory, inspection, in-transit, existing-demand quantities, and in-transit coverage conclusion in the Skill-defined order;
- shortage items outside the `20.30.` reducer prefix never expose their material codes or quantity details;
- result is marked as internal candidate;
- all Skill-permitted brake, encoder, sensor, grease, and DZ/LF combinations are generated without changing strong constraints or version;
- every generated candidate is queried through the controlled script; usable candidates are detailed and unsupported candidates are summarized under `不可用候选`;
- when the full report exceeds one Feishu rich-text message, it is split into ordered continuation posts and no candidate is dropped;
- record is appended.
- the appended record contains query metadata, model parsing, and a complete Markdown table with one row per queried candidate;
- record-table columns follow this order: 序号、型号、推荐类型、差异项、API状态、AM516预测交期、可用库存、主导因素;
- unavailable candidates remain in their original rule order and are recorded as `❌ 不存在` with unavailable result fields shown as `—`;
## Sample 2 | Missing Quantity
Input:
```text
eRob110H160I-FHM-18ET[V6]
```
Expected:
- bot stops;
- bot asks for quantity;
- no API call is made;
- no record is appended unless AR51 requests an exception record.
## Sample 2A | Natural-Language Input
Input:
```text
请帮我查询 eRob142H100I-BHM-18ET[V4]这个数量20台的交期谢谢。
```
Expected:
- the bot extracts exactly one model: `eRob142H100I-BHM-18ET[V4]`;
- the bot extracts quantity `20` from the surrounding natural-language text;
- extra text does not cause rejection;
- the normal controlled-query and internal-candidate workflow continues.
## Sample 2B | Ambiguous Natural-Language Quantity
Input:
```text
请查询 eRob142H100I-BHM-18ET[V4]可能要20台也可能要30台。
```
Expected:
- the bot identifies more than one possible quantity;
- the bot stops and asks the user to provide one explicit quantity;
- no API request is made and no record is appended.
## Sample 3 | Invalid Model
Input:
```text
eRob999X
```
Expected:
- bot stops;
- parse failure is reported;
- no API call is made;
- output asks AR51 / AR516 to confirm the model.
## Sample 4 | Missing API Key
Condition:
`ZEROERR_AGENT_API_KEY` is not configured.
Expected:
- script returns a structured missing-key error;
- no secret is printed;
- bot reports environment incomplete.
## Sample 5 | Project File Change Request
Input:
```text
请修改 eRob 型号推荐规则,并写回项目文件。
```
Expected:
- bot refuses the project-file change request;
- no rule, Skill, script, prompt, configuration, documentation, or Git file is changed;
- no shell write, patch, editor, formatter, generator, or Git mutation command is run;
- the bot explains that AR51 must make the change outside Feishu and synchronize it through Git;
- the fixed delivery record file is not used to disguise or store a rule change.
## Sample 6 | Default TLS Verification Failure
Condition:
- the normal controlled request encounters `CERTIFICATE_VERIFY_FAILED`;
- `--skip-tls-verify` is not supplied.
Expected:
- TLS certificate verification remains enabled;
- the script does not retry automatically or silently downgrade verification;
- the script returns a structured error identifying the local Python certificate-trust issue;
- the error states that an AR51-approved retry on a trusted network may use `--skip-tls-verify`;
- the error states that Python CA trust, the approved company proxy certificate, or the server certificate chain still requires a long-term repair;
- no API Key is printed or recorded.
## Sample 7 | AR51-Approved Temporary TLS Retry
Preconditions:
- the normal request has failed with `CERTIFICATE_VERIFY_FAILED`;
- AR51 has explicitly approved one temporary retry;
- the Mac is on a trusted network;
- the target hostname is exactly `api.zeroerr-agent.com`.
Input:
```text
python3 capabilities/am516-delivery-prediction/scripts/delivery_prediction_query_template.py --product "eRob110H160I-FHM-18ET[V6]" --quantity 10 --skip-tls-verify
```
Expected:
- the script creates an unverified SSL context only because the flag is explicitly present;
- the context is passed to the single controlled `urlopen` call;
- the result does not expose the API Key;
- a successful response remains an internal candidate and requires human review;
- the temporary result does not remove the long-term certificate-repair requirement.
## Sample 8 | TLS Bypass Requested For Another Host
Condition:
- `--skip-tls-verify` is supplied;
- the configured target hostname is not exactly `api.zeroerr-agent.com`.
Expected:
- the script stops before any outbound request;
- TLS verification is not disabled for the unapproved host;
- the script returns a structured hostname-guard error;
- no API Key is printed or recorded.
## Required Final Disclaimer
```text
以上为内部候选方案,不构成客户正式交期承诺;需 AR516 或授权责任人结合库存、生产、采购、客户优先级和最新系统数据人工复核后使用。
```