Skip to content

feat: adapt Dify plugin to Calls API v2 - #4

Merged
JJasonSun merged 3 commits into
mainfrom
feat/calls-api-v2-14092
Oct 16, 2026
Merged

JJasonSun merged 3 commits into
mainfrom
feat/calls-api-v2-14092

Conversation

@JJasonSun

@JJasonSun JJasonSun commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Implements ONES 14092 and updates the plugin to 0.2.0.

- Calls /v1, per-invocation random keys, legacy result parsing
+ Calls /v2, required business-stable keys, result/error/transcript parsing
- Wait for execution status or a non-null Goal Run result/error
+ Wait while result_status=pending; retain accepted IDs on read failures
+ Emit named Dify workflow outputs alongside JSON

Calls send one phone and a closed scalar result schema. Omitted region/locale remain omitted on replay. Goal endpoints stay on v1, with phone, flat variables, and after pagination. The credential probe uses v2 without creating a call or following redirects. Dry-run and live-call confirmation controls remain required. Missing or invalid keys stop before any CALL-E request and explain how to bind Dify's Idempotency Key to a saved business event ID; the README includes an upgrade example.

Keys may be UUIDs generated and saved upstream, then supplied through a Dify variable binding. Dify's tool context provides no durable logical-call ID across separate Workflow runs, so the plugin does not generate keys in KV storage or infer duplicates from matching phone/task inputs.

Evidence

  • Before: Reproducing v2 responses against main loses summary/transcript; a final unavailable Goal Run with null result/error never resolves.
    After: 101 tests pass on Python 3.12 with Dify SDK 0.9.0 and 0.10.2, including unavailable/empty results, malformed responses, wait timeouts, network ambiguity, accepted-ID recovery, named workflow outputs, and invalid-key guidance without HTTP requests across all four creation tools.
  • Native Dify plugin stdio execution against the real CALL-E service: one Calls v2 call and one published Goal Run completed with available results and transcripts. Exact replays before/after completion retain resource and telephone IDs; changed inputs with the same keys return 409. Calls also recover after a plugin process restart and preserve metadata.
  • The extracted 0.2.0 package passes native checks for all four tools' invalid-key guidance, exact replay of the two existing real calls, and named-variable output equality. Editable installation, compilation, and Dify Plugin CLI 0.6.11 packaging pass.
  • Dify Cloud Sandbox: the final 0.2.0 package passes two cache-cleared, four-node creation/wait → exact replay → output runs (13.436s and 4.187s) against the workflow's completed real call. Both retain the original API and Billing IDs, available result, eight-turn transcript, and metadata. Named result (Object) and call_id (String) reach the output node. Cloud validation covers the valid-key flow; invalid-key guidance and Goal Run live testing use the native runtime.

Merge Danger

Door: two-way

Reverting the plugin code/package does not undo accepted calls. Keep each Call ID, business key, and original inputs when recovering or rolling back.

Blast Radius: workflows

Existing Call creation nodes must supply a durable idempotency_key, including when the caller reruns a workflow after an uncertain submission. Check old explicit US/en-US hints, replace legacy recipient/attempt output mappings, and rename Goal listing cursor to after. Historical v1 Call IDs still require their original interface. Old self-hosted Dify versions were not tested.

@JJasonSun
JJasonSun merged commit 588a593 into main Oct 16, 2026
2 checks passed
@JJasonSun

JJasonSun commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator Author

Acceptance screenshots (2026-10-16)

These screenshots document installation and upgrade replays of 0.2.2 on Dify Cloud. We completed real-call acceptance on 0.2.1. Both cache-cleared workflow reruns reused the original requests and call resources, with no additional calls. This comment records existing acceptance evidence; we did not rerun tests for this update.

CALL-E 0.2.2 installed:

CALL-E 0.2.2 installed on Dify Cloud

Calls replay: SUCCESS in 4.743 seconds. API/Billing IDs, metadata, and named workflow outputs match the original complete result.

Calls 0.2.2 upgrade replay succeeded

Goal Run replay: SUCCESS in 13.632 seconds. Goal Run/run/call IDs and the result match the original record. The workflow name retains the 0.2.1 label from the original real-call acceptance; the installed plugin is 0.2.2, as shown above.

Goal Run 0.2.2 upgrade replay succeeded

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