DHG Interface Config
Workflow
- Identify the requested outcome and scenario: normal outbound interface, personnel/organization/position/company sync, workflow todo/read-task OA push, scheduled execution, form trigger, SSO, HTTP block execution, import/test, diagnosis, or existing-config repair.
- Parse the user-provided API/SSO documentation before searching historical configurations. Extract endpoints, methods, authentication, request/response fields, errors, callback identifiers, and unresolved requirements.
- Read only the references required by the scenario routing table. Use the user's documents and confirmed DHG field sources as the primary source of truth.
- Decide whether the task needs a live DHG workspace. Follow the MCP capability gate below; do not block static analysis or draft generation merely because MCP is unavailable.
- For broad or ambiguous tasks, read
references/workflow.mdand present a proposal covering interfaces, request strategy, field sources, callbacks, unresolved items, and risks before generating final artifacts. - Generate declarative params and mappings first. Add Groovy only when signing, transformation, SQL, token assembly, custom sending, callbacks, filters, or scheduling requires it.
- Before finalizing importable JSON, read
references/json-output.md; validate IDs, block references, shared-token dependencies, callback flags, mappings, and top-level shape. - Import, save, execute, or publish only when the user explicitly requests it. Read
references/testing-and-logs.mdandreferences/business-test-data.mdbefore any runtime or write operation.
MCP Capability Gate
- Work without MCP for API/SSO document analysis, architecture proposals, static JSON/Groovy drafts, explanations, and review of user-provided artifacts.
- Use DHG MCP when the outcome depends on real workspace table fields or data, existing configuration inspection, DHG-compatible ID allocation, SQL/Groovy execution, import/save, interface execution, or logs. Read
references/mcp-usage.mdbefore these operations. - If MCP is unavailable, continue with an offline draft when possible. Mark placeholder IDs, unverified field mappings/SQL, untested Groovy, and unavailable runtime/log results.
- If the user requests an MCP-dependent result that cannot be completed offline, ask for the DHG MCP address and target client, then read
references/mcp-client-config.md. Modify only a confirmed client configuration format and preserve unrelated settings.
Core Rules
- Do not fabricate DHG fields, table structures, configuration IDs, SSO identity mappings, callback behavior, credentials, or third-party values.
- Do not query existing DHG configurations by default. Inspect them only when the user asks to reuse, compare, inspect, or repair an existing integration; read
references/examples.mdand keep lookups bounded. - Use HTTP URL参数(
sendType=22)+ GET(sendMode=1)for simple query-parameter GET APIs; use HTTP JSON发送(sendType=21)+ POST(sendMode=2)for declarative JSON APIs; use 代码块发送(sendType=30)+ POST(sendMode=2)for signing, encryption, XML/multipart, multiple calls, complex responses, or nesting deeper than two levels. - Generate a 发送代码块(type=
14)only for 代码块发送(sendType=30), and pointblockSendIdto that block. - Prefer a standalone reusable token interface. Treat shared tokens and external blocks as explicit, ordered dependencies; verify existing references through MCP or mark them unverified.
- Treat scheduled execution as a normal worker interface plus a standalone 定时代码块(type=
22)that queries scoped/paged rows and calls the worker one row at a time. - Treat workflow business types
5/6/7/8/10/20as normal interfaces usingflow_wfitem. For a single OA endpoint with different documented events/statuses, generate one interface per selected event. - Treat inbound and outbound SSO as login/code-block work unless the user explicitly requests an interface wrapper. Read
references/sso-integration.mdbefore generating or reviewing SSO code. - Validate callback response shape and business identifiers before writeback. Use scoped, parameterized update APIs; never concatenate third-party values directly into SQL.
- Allocate importable configuration metadata IDs through DHG MCP and preserve them as strings. For offline drafts, use explicit placeholders and state that the artifact is not import-ready.
- Never run
executeInterfaceByCodeduring normal generation. Before real execution, require a non-emptyresourceMap, anidempotencyKey, explicit confirmation, and a confirmed third-party test/sandbox target;dryRun=trueproves only that the interface code exists.
Scenario Routing
| Scenario | Read | Key output |
|---|---|---|
| Broad integration planning | workflow.md |
Interface proposal, field sources, unresolved items, risks |
| Normal GET/JSON/complex outbound interface | config-spec.md, json-output.md; add groovy-blocks.md when code is required |
Import JSON or clearly marked offline draft |
| Personnel/organization/company/position sync | config-spec.md, json-output.md; add business-test-data.md for tests |
BusinessType-specific params and mappings |
| Workflow todo/read-task OA push | workflow-task.md, config-spec.md, json-output.md |
One config per selected workflow event |
| Scheduled execution | scheduler-task.md, groovy-blocks.md, json-output.md |
Worker interface plus standalone type=22 scheduler |
HTTP /thirdPlatformForeign/execBlockCode |
block-http-execution.md, groovy-blocks.md |
URL/body contract, param parsing, safe test plan |
| Inbound or outbound SSO | sso-integration.md; add block-http-execution.md for callback/block tests |
Groovy login/callback/redirect code and test checklist |
| Existing-config inspection or repair | mcp-usage.md, examples.md; add generation references as needed |
Bounded lookup and verified/unverified findings |
| Import, save, execute, or diagnose | testing-and-logs.md, business-test-data.md, mcp-usage.md |
Dry-run/confirmation workflow and test report |
| Missing MCP needed for requested outcome | mcp-usage.md, mcp-client-config.md |
Client-specific config or snippet and reload instructions |
All paths in the table are under references/. When scenarios overlap, read each shared reference once and add only the relevant scenario-specific files.
Output Requirements
- Reply in Chinese unless the user requests another language.
- Translate DHG numeric/code dictionary values into Chinese and retain the raw value, for example HTTP JSON发送(
sendType=21)、同步组织(businessType=2)、自定义SQL映射(mapping_type=2). - For plans, list interfaces, request strategy, DHG field sources, unresolved fields, callback/writeback needs, dependencies, and risks.
- Output valid JSON in a code block or write a
.jsonfile when requested. For SSO, scheduler, or HTTP block tasks, include the scenario-specific code, registration/binding notes, placeholders, and test checklist. - After an interface artifact, provide a compact checklist covering main row, params, mappings, blocks, data source, callback/writeback, shared-token dependencies/import order, unresolved items, MCP validation, and test/log results when requested.




