Skip to content

feat(lark-cli): Feishu approval submission via official lark-cli - #249

Open
an7tang wants to merge 1 commit into
OpenBMB:mainfrom
an7tang:feat/lark-cli-approval-sop
Open

feat(lark-cli): Feishu approval submission via official lark-cli#249
an7tang wants to merge 1 commit into
OpenBMB:mainfrom
an7tang:feat/lark-cli-approval-sop

Conversation

@an7tang

@an7tang an7tang commented Aug 30, 2026

Copy link
Copy Markdown

Overview

Adds a built-in lark_cli capability that submits Feishu (Lark) approval requests on behalf of the user through the official larksuite/cli, together with a lark_approval_submit SOP card (search definition → assemble form → dry-run preview → user confirmation → real submission).

Key design

  • Layered command policy (app/lark_cli/policy.py): permissive reads, strict writes — registered read-only commands accept the CLI's native flags as-is; unregistered commands are adjudicated dynamically via the CLI's own Risk: classification; write commands are limited to a strict whitelist; the raw api escape hatch, --yes, and caller-supplied uuid are permanently blocked.
  • Fully in-conversation setup: app credentials can be configured in chat (config init, or --new to create an app on the spot); user login uses the multi-turn device-code flow.
  • Submission confirmation gate: a real submission must match a dry-run preview already persisted in the current session (submission_digest); the trusted layer replays the confirmed content and injects --yes plus an idempotent uuid. Form structure is validated against the approval definition before preview.
  • Errors as guidance: frequently misleading errors (auth scopes lacking admin permissions, auth qrcode unavailable, server-side form rejections, etc.) get deterministic corrective guidance appended by the trusted layer, preventing the model from misreading them as task failure.
  • Minimal engine-side support: built-in capabilities can now be marked as required by SOP nodes; when resuming a paused frame, the latest user reply and the current time (user timezone) are injected.

Testing

  • New backend/tests/test_lark_cli.py (policy + end-to-end service tests against a fake CLI binary).
  • After rebasing onto the latest main, the full backend suite passes (2078 tests); ruff reports zero new issues in the changed files.

Integrate larksuite/cli as a built-in harness capability (lark_cli) with a
layered command policy (relaxed read / strict write whitelist / dynamic
Risk-probe), device-code user login, in-conversation app provisioning,
dry-run preview with confirmation gate and idempotent replay, plus the
lark_approval_submit SOP card. Trusted-layer error messages redirect the
model to the correct next action (auth scopes / auth qrcode cases).
@an7tang an7tang changed the title feat(lark-cli): 集成飞书官方 lark-cli 实现审批提交 SOP feat(lark-cli): Feishu approval submission via official lark-cli Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant