fruxon 2.2.8__tar.gz → 2.2.9__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (232) hide show
  1. {fruxon-2.2.8 → fruxon-2.2.9}/HISTORY.md +25 -0
  2. {fruxon-2.2.8 → fruxon-2.2.9}/PKG-INFO +2 -1
  3. {fruxon-2.2.8 → fruxon-2.2.9}/README.md +1 -0
  4. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/_version.py +2 -2
  5. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/checks/agent.py +17 -2
  6. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/__init__.py +1 -0
  7. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_reply_style.py +61 -4
  8. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_revisions.py +35 -2
  9. fruxon-2.2.9/src/fruxon/cli/escalation_desks.py +382 -0
  10. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/escalations.py +4 -2
  11. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/integrations_sandbox.py +57 -1
  12. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/working_hours.py +3 -3
  13. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/fruxon.py +52 -1
  14. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/skills/fruxon-build-agent/SKILL.md +4 -1
  15. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/skills/fruxon-meet/SKILL.md +1 -0
  16. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_agents_check_cli.py +1 -1
  17. fruxon-2.2.9/tests/test_cli_friction_round2.py +320 -0
  18. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_integration_sandbox_cli.py +52 -1
  19. {fruxon-2.2.8 → fruxon-2.2.9}/.gitignore +0 -0
  20. {fruxon-2.2.8 → fruxon-2.2.9}/LICENSE +0 -0
  21. {fruxon-2.2.8 → fruxon-2.2.9}/pyproject.toml +0 -0
  22. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/__init__.py +0 -0
  23. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/__main__.py +0 -0
  24. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/_request_id.py +0 -0
  25. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/_ssl.py +0 -0
  26. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/checks/__init__.py +0 -0
  27. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/checks/ledger.py +0 -0
  28. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/checks/references.py +0 -0
  29. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/_crash.py +0 -0
  30. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/_last_failure.py +0 -0
  31. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/_ledger_passes.py +0 -0
  32. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/_plugin_hint.py +0 -0
  33. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/_schema.py +0 -0
  34. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/_shared.py +0 -0
  35. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/_stream.py +0 -0
  36. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents.py +0 -0
  37. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_approvals.py +0 -0
  38. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_budget.py +0 -0
  39. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_channels.py +0 -0
  40. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_draft.py +0 -0
  41. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_evaluations.py +0 -0
  42. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_executions.py +0 -0
  43. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_improvements.py +0 -0
  44. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_lifecycle.py +0 -0
  45. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_memory.py +0 -0
  46. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_sandbox.py +0 -0
  47. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_sandbox_test.py +0 -0
  48. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_slots.py +0 -0
  49. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_system_blocks.py +0 -0
  50. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_tests.py +0 -0
  51. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_topics.py +0 -0
  52. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/agents_voice_calls.py +0 -0
  53. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/applications.py +0 -0
  54. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/applications_entry_points.py +0 -0
  55. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/assets.py +0 -0
  56. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/auth.py +0 -0
  57. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/capabilities.py +0 -0
  58. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/completion.py +0 -0
  59. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/config.py +0 -0
  60. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/consult_pins.py +0 -0
  61. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/conversation_imports.py +0 -0
  62. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/dash.py +0 -0
  63. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/describe.py +0 -0
  64. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/doctor.py +0 -0
  65. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/environments.py +0 -0
  66. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/examples.py +0 -0
  67. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/feedback.py +0 -0
  68. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/guides.py +0 -0
  69. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/integrations.py +0 -0
  70. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/keys.py +0 -0
  71. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/knowledge_bases.py +0 -0
  72. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/knowledge_documents.py +0 -0
  73. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/knowledge_notices.py +0 -0
  74. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/knowledge_sources.py +0 -0
  75. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/llm_providers.py +0 -0
  76. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/messages.py +0 -0
  77. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/metrics.py +0 -0
  78. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/participants.py +0 -0
  79. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/pipelines.py +0 -0
  80. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/secrets.py +0 -0
  81. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/skills.py +0 -0
  82. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/storage.py +0 -0
  83. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/tools.py +0 -0
  84. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/triggers.py +0 -0
  85. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/triggers_budget.py +0 -0
  86. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/triggers_check.py +0 -0
  87. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/triggers_ledger.py +0 -0
  88. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/triggers_ledger_stage_tests.py +0 -0
  89. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/triggers_questions.py +0 -0
  90. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/triggers_shape.py +0 -0
  91. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/cli/workspaces.py +0 -0
  92. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/credentials.py +0 -0
  93. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/device_auth.py +0 -0
  94. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/doctor.py +0 -0
  95. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/exceptions.py +0 -0
  96. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/flow_validation.py +0 -0
  97. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/models.py +0 -0
  98. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/output.py +0 -0
  99. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/params.py +0 -0
  100. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/sandbox_scenario.py +0 -0
  101. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/skills/__init__.py +0 -0
  102. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/skills/fruxon-agent-mode/SKILL.md +0 -0
  103. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/skills/fruxon-create-integration/SKILL.md +0 -0
  104. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/skills/fruxon-debug-trace/SKILL.md +0 -0
  105. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/skills/fruxon-use-integrations/SKILL.md +0 -0
  106. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/telemetry.py +0 -0
  107. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/__init__.py +0 -0
  108. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/app.py +0 -0
  109. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/demo.py +0 -0
  110. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/links.py +0 -0
  111. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/screens/__init__.py +0 -0
  112. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/screens/agent.py +0 -0
  113. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/screens/base.py +0 -0
  114. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/screens/home.py +0 -0
  115. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/screens/ledger.py +0 -0
  116. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/screens/loader.py +0 -0
  117. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/screens/pickers.py +0 -0
  118. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/screens/trace.py +0 -0
  119. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/source.py +0 -0
  120. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/theme.py +0 -0
  121. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/views.py +0 -0
  122. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/tui/widgets.py +0 -0
  123. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/ui.py +0 -0
  124. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/update_check.py +0 -0
  125. {fruxon-2.2.8 → fruxon-2.2.9}/src/fruxon/validation.py +0 -0
  126. {fruxon-2.2.8 → fruxon-2.2.9}/tests/.test_durations.json +0 -0
  127. {fruxon-2.2.8 → fruxon-2.2.9}/tests/__init__.py +0 -0
  128. {fruxon-2.2.8 → fruxon-2.2.9}/tests/conftest.py +0 -0
  129. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_actor.py +0 -0
  130. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_agent_lifecycle.py +0 -0
  131. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_agent_revisions_list.py +0 -0
  132. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_agent_slots.py +0 -0
  133. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_agents_revisions_cli.py +0 -0
  134. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_agents_sandbox.py +0 -0
  135. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_applications.py +0 -0
  136. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_approvals.py +0 -0
  137. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_assets.py +0 -0
  138. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_budgets.py +0 -0
  139. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_capabilities.py +0 -0
  140. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_channels.py +0 -0
  141. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_checks_agent.py +0 -0
  142. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_checks_ledger.py +0 -0
  143. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_cli.py +0 -0
  144. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_cli_base_url_routing.py +0 -0
  145. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_cli_crash.py +0 -0
  146. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_cli_feedback.py +0 -0
  147. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_cli_root_flags.py +0 -0
  148. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_client.py +0 -0
  149. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_connect_nudge.py +0 -0
  150. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_consult.py +0 -0
  151. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_conversation_imports.py +0 -0
  152. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_credentials.py +0 -0
  153. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_dash_app.py +0 -0
  154. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_dash_cli.py +0 -0
  155. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_dash_client.py +0 -0
  156. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_dash_links.py +0 -0
  157. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_dash_source.py +0 -0
  158. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_describe.py +0 -0
  159. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_device_auth.py +0 -0
  160. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_docs_commands_exist.py +0 -0
  161. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_doctor.py +0 -0
  162. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_draft_bootstrap.py +0 -0
  163. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_draft_evaluate_cli.py +0 -0
  164. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_draft_pull_shape.py +0 -0
  165. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_draft_run_replay.py +0 -0
  166. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_draft_validate_cli.py +0 -0
  167. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_drafts.py +0 -0
  168. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_entry_points.py +0 -0
  169. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_environments.py +0 -0
  170. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_escalations.py +0 -0
  171. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_evaluations.py +0 -0
  172. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_execution_records.py +0 -0
  173. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_flow_validation.py +0 -0
  174. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_fruxon.py +0 -0
  175. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_guides.py +0 -0
  176. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_improvements.py +0 -0
  177. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_integration_configs_write_cli.py +0 -0
  178. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_integration_triggers_cli.py +0 -0
  179. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_integrations_authorize_cli.py +0 -0
  180. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_integrations_connect_cli.py +0 -0
  181. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_kb_trial_cli.py +0 -0
  182. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_knowledge_bases.py +0 -0
  183. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_knowledge_documents.py +0 -0
  184. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_knowledge_notices.py +0 -0
  185. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_knowledge_sources.py +0 -0
  186. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_llm_provider_configs_cli.py +0 -0
  187. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_llm_providers_connect_cli.py +0 -0
  188. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_llm_providers_list_cli.py +0 -0
  189. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_managed_by.py +0 -0
  190. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_memory.py +0 -0
  191. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_messages.py +0 -0
  192. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_metrics.py +0 -0
  193. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_online_llm_config_refs.py +0 -0
  194. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_online_prefetch_refs.py +0 -0
  195. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_online_secret_refs.py +0 -0
  196. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_output.py +0 -0
  197. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_params.py +0 -0
  198. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_participants.py +0 -0
  199. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_participants_write.py +0 -0
  200. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_pipelines.py +0 -0
  201. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_plugin_hint.py +0 -0
  202. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_project_urls.py +0 -0
  203. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_reply_style.py +0 -0
  204. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_request_id.py +0 -0
  205. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_sandbox_scenario.py +0 -0
  206. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_schema.py +0 -0
  207. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_schema_fetch.py +0 -0
  208. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_secrets.py +0 -0
  209. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_skills.py +0 -0
  210. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_ssl.py +0 -0
  211. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_storage.py +0 -0
  212. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_system_blocks.py +0 -0
  213. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_system_blocks_cli.py +0 -0
  214. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_telemetry.py +0 -0
  215. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_test_chats.py +0 -0
  216. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_topics.py +0 -0
  217. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_trigger_budgets.py +0 -0
  218. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_triggers.py +0 -0
  219. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_triggers_check_cli.py +0 -0
  220. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_triggers_ledger.py +0 -0
  221. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_triggers_ledger_batch_views.py +0 -0
  222. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_triggers_ledger_stage_tests.py +0 -0
  223. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_triggers_questions.py +0 -0
  224. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_triggers_shape.py +0 -0
  225. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_triggers_write.py +0 -0
  226. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_tui_boundary.py +0 -0
  227. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_ui.py +0 -0
  228. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_update_check.py +0 -0
  229. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_validation.py +0 -0
  230. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_voice_calls.py +0 -0
  231. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_working_hours_cli.py +0 -0
  232. {fruxon-2.2.8 → fruxon-2.2.9}/tests/test_workspaces_cli.py +0 -0
@@ -1,5 +1,30 @@
1
1
  # History
2
2
 
3
+ ## Unreleased — escalation desks, reply-style schema, deploy output
4
+
5
+ - **`fruxon escalations desks list|create|attach|detach`**: an Application with no escalation desk
6
+ can get one from the CLI. `create --name … [--mode BRIDGE|NATIVE_HANDOFF] [--operator …]
7
+ [--strategy …] [--working-hours …] [--default-reason …] [--attach other|<entry-point>]`;
8
+ `attach <desk> <target>…` and `detach <target>…`, where `other` is conversations that came through
9
+ no channel. `--agent` resolves the agent's Application; `--application` names one; neither uses the
10
+ workspace default. **`FruxonClient.create_escalation_desk`**,
11
+ **`set_other_conversations_escalation_desk`**, and `update_entry_point(escalation_desk=,
12
+ clear_escalation_desk=)`.
13
+ - **`escalations set-policy`** with no desk to change now names the `desks create` command instead of
14
+ the dashboard; so does the `agents check` / `draft validate --online` `escalation_unreachable` hint
15
+ when a desk is missing.
16
+ - **Command name fixed**: the `escalation_unreachable` hint and `working-hours create` said
17
+ `fruxon escalations policy set`; the command is `fruxon escalations set-policy`.
18
+ - **`agents reply-style new|edit --schema`** prints the content's JSON schema
19
+ (`AgentReplyStyleContent`), and their help shows an example.
20
+ - **`integrations configs sandbox generate --context <file|-|text>`** grounds the generated entities
21
+ in facts they must agree with (services, durations, hours — e.g. the agent's KB article), up to
22
+ 16,000 characters. `FruxonClient.generate_config_sandbox_data(..., context=)`. Needs the backend's
23
+ `context` field on `sandbox:generate`.
24
+ - **`agents revisions deploy`** takes `-o text|json` (JSON by default in agent mode:
25
+ `{"agentId", "revision", "deployed": true, "result"}`) and accepts `--yes`, which changes nothing —
26
+ deploying never prompts.
27
+
3
28
  ## Unreleased — Improvements reviews on Fruxon's reviewer model, for credits
4
29
 
5
30
  - **`fruxon agents improvements settings`** chooses where reviews run:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fruxon
3
- Version: 2.2.8
3
+ Version: 2.2.9
4
4
  Summary: The Fruxon SDK is a lightweight Python client for integrating with the Fruxon platform.
5
5
  Project-URL: homepage, https://fruxon.com
6
6
  Project-URL: documentation, https://docs.fruxon.com/guides/cli
@@ -102,6 +102,7 @@ Execution:
102
102
  | `fruxon agents memory list/subjects/get/forget-subject <agent>` | Inspect and prune what an agent remembers. `list` filters server-side by `--subject`/`--query`/`--scope`; `forget-subject` is a GDPR-style delete (confirms; refuses without `--yes` in agent mode). |
103
103
  | `fruxon agents topics list/search/get/messages/sessions <agent>` + `fruxon agents inbox <agent>` | Read the conversation spine — the agent's topics (threads), one topic's transcript, its episodes, and its inbox (what it's focused on). `list`/`search` filter server-side by `--state`/`--participant`/`--query`. Read-only. Each message carries `author` — a human colleague's turn is stored as `ASSISTANT` on purpose, so `role` alone cannot tell their reply from the agent's; `HUMAN_OPERATOR` can. A message the runtime *withheld* is in no transcript at all — see `fruxon messages list`. `sessions` explains a fresh, blind session: a topic outlives its sessions, and `endCause` on the previous one (`CONSOLE_ALREADY_RESOLVED` — a human closed it in the provider's console) is why the next started with no history. |
104
104
  | `fruxon escalations list/history/unhandled/policy/ack` | What happened when an agent handed a conversation to a person. `list` is the queue (live takeovers + degraded escalations nobody was reachable for); `unhandled` is the append-only ledger under it. **`history` is the record of closed console-routed takeovers** — those leave the queue, so `list --status ALL` answers `[]` about a conversation a human worked for half an hour. Read `humanObservedAt` before believing a `RESOLVED`: null means nobody was ever seen picking it up. `policy <agent>` resolves who the *next* escalation would reach — an empty ladder under `NATIVE_HANDOFF` is correct, the console supplies the human — and names the desk it went through. `set-policy <agent>` changes that desk: `--operator` (repeatable, one tier; `--strategy`), `--working-hours <schedule|none>`, `--default-reason`, `--entry-point` for a channel's desk. It reads the desk and PUTs it back with only those changed, for every agent on the desk (`participants:write`). |
105
+ | `fruxon escalations desks list/create/attach/detach` | An Application's escalation desks. `create --name … [--mode BRIDGE\|NATIVE_HANDOFF] [--operator …] [--working-hours …] [--attach other\|<entry-point>]` makes one and attaches it; `attach <desk> other <entry-point>…` / `detach other <entry-point>…` move hand-off between desks. `other` is conversations through no channel (operator desks only). `--agent` picks the agent's Application, `--application` names one. |
105
106
  | `fruxon working-hours list/get/create/update/delete` | Working-hours schedules: a time zone, a week (`--hours "sun-thu 08:00-20:00"`, repeatable; a day not named is closed), dated closures (`--closed 2026-12-25`), or `--file` with the full body. A schedule governs the escalation hand-off once a desk uses it (`escalations set-policy --working-hours`); what the agent says about opening hours stays in its prompt. `participants:read` / `participants:write`. |
106
107
  | `fruxon messages list` | The channel ledger — including inbound an agent was never shown. A **withheld** message (a human owns the chat in the source console, or admission refused the sender) never becomes a conversation turn, so it is in no transcript and the thread reads as a customer being ignored. `--delivery WITHHELD_PENDING` lists the ones nothing has ever acted on; nothing drains them. |
107
108
  | `fruxon agents sandbox open/turn/fire/resolve-input/stream/answer/close <session>` | Drive an agent-network sandbox end-to-end without real channels — send turns as participants, test-fire triggers, and watch the run (`--wait` on `turn` / `fire` follows it to the end; `stream` shows only what happens after it connects; NDJSON in agent mode). Sandbox **captures the reply and hard-blocks every real send**; `--await` makes consult/approval gates suspend so they can be resolved (`answer` for consults, `approvals respond` for approvals). `--draft` runs your unpublished draft instead of the deployed revision (`sandbox draft <session>` says which); `--confirm-writes` holds every create/update/delete tool call for approval, because sandbox does **not** block integration writes; a write that did not run (rejected, expired, or one the run could not pause for) shows on `stream` as `refused`. |
@@ -68,6 +68,7 @@ Execution:
68
68
  | `fruxon agents memory list/subjects/get/forget-subject <agent>` | Inspect and prune what an agent remembers. `list` filters server-side by `--subject`/`--query`/`--scope`; `forget-subject` is a GDPR-style delete (confirms; refuses without `--yes` in agent mode). |
69
69
  | `fruxon agents topics list/search/get/messages/sessions <agent>` + `fruxon agents inbox <agent>` | Read the conversation spine — the agent's topics (threads), one topic's transcript, its episodes, and its inbox (what it's focused on). `list`/`search` filter server-side by `--state`/`--participant`/`--query`. Read-only. Each message carries `author` — a human colleague's turn is stored as `ASSISTANT` on purpose, so `role` alone cannot tell their reply from the agent's; `HUMAN_OPERATOR` can. A message the runtime *withheld* is in no transcript at all — see `fruxon messages list`. `sessions` explains a fresh, blind session: a topic outlives its sessions, and `endCause` on the previous one (`CONSOLE_ALREADY_RESOLVED` — a human closed it in the provider's console) is why the next started with no history. |
70
70
  | `fruxon escalations list/history/unhandled/policy/ack` | What happened when an agent handed a conversation to a person. `list` is the queue (live takeovers + degraded escalations nobody was reachable for); `unhandled` is the append-only ledger under it. **`history` is the record of closed console-routed takeovers** — those leave the queue, so `list --status ALL` answers `[]` about a conversation a human worked for half an hour. Read `humanObservedAt` before believing a `RESOLVED`: null means nobody was ever seen picking it up. `policy <agent>` resolves who the *next* escalation would reach — an empty ladder under `NATIVE_HANDOFF` is correct, the console supplies the human — and names the desk it went through. `set-policy <agent>` changes that desk: `--operator` (repeatable, one tier; `--strategy`), `--working-hours <schedule|none>`, `--default-reason`, `--entry-point` for a channel's desk. It reads the desk and PUTs it back with only those changed, for every agent on the desk (`participants:write`). |
71
+ | `fruxon escalations desks list/create/attach/detach` | An Application's escalation desks. `create --name … [--mode BRIDGE\|NATIVE_HANDOFF] [--operator …] [--working-hours …] [--attach other\|<entry-point>]` makes one and attaches it; `attach <desk> other <entry-point>…` / `detach other <entry-point>…` move hand-off between desks. `other` is conversations through no channel (operator desks only). `--agent` picks the agent's Application, `--application` names one. |
71
72
  | `fruxon working-hours list/get/create/update/delete` | Working-hours schedules: a time zone, a week (`--hours "sun-thu 08:00-20:00"`, repeatable; a day not named is closed), dated closures (`--closed 2026-12-25`), or `--file` with the full body. A schedule governs the escalation hand-off once a desk uses it (`escalations set-policy --working-hours`); what the agent says about opening hours stays in its prompt. `participants:read` / `participants:write`. |
72
73
  | `fruxon messages list` | The channel ledger — including inbound an agent was never shown. A **withheld** message (a human owns the chat in the source console, or admission refused the sender) never becomes a conversation turn, so it is in no transcript and the thread reads as a customer being ignored. `--delivery WITHHELD_PENDING` lists the ones nothing has ever acted on; nothing drains them. |
73
74
  | `fruxon agents sandbox open/turn/fire/resolve-input/stream/answer/close <session>` | Drive an agent-network sandbox end-to-end without real channels — send turns as participants, test-fire triggers, and watch the run (`--wait` on `turn` / `fire` follows it to the end; `stream` shows only what happens after it connects; NDJSON in agent mode). Sandbox **captures the reply and hard-blocks every real send**; `--await` makes consult/approval gates suspend so they can be resolved (`answer` for consults, `approvals respond` for approvals). `--draft` runs your unpublished draft instead of the deployed revision (`sandbox draft <session>` says which); `--confirm-writes` holds every create/update/delete tool call for approval, because sandbox does **not** block integration writes; a write that did not run (rejected, expired, or one the run could not pause for) shows on `stream` as `refused`. |
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
18
18
  commit_id: str | None
19
19
  __commit_id__: str | None
20
20
 
21
- __version__ = version = '2.2.8'
22
- __version_tuple__ = version_tuple = (2, 2, 8)
21
+ __version__ = version = '2.2.9'
22
+ __version_tuple__ = version_tuple = (2, 2, 9)
23
23
 
24
24
  __commit_id__ = commit_id = None
@@ -623,6 +623,9 @@ def escalation_reach(client, agent: str) -> tuple[str, str, str | None]:
623
623
 
624
624
  surfaces: list[tuple[str, object]] = []
625
625
  problems: list[str] = []
626
+ # Where a desk is missing outright, the fix is a new desk, not a ladder:
627
+ # `set-policy` has nothing to change there.
628
+ deskless: list[str] = []
626
629
  if top.channels:
627
630
  resolved: dict[str, object] = {}
628
631
  for channel in top.channels:
@@ -630,6 +633,7 @@ def escalation_reach(client, agent: str) -> tuple[str, str, str | None]:
630
633
  desk = channel.get("deskId")
631
634
  if not desk:
632
635
  problems.append(f"{where}: no escalation desk — hand-off isn't available there")
636
+ deskless.append(f"--attach {channel.get('entryPointId') or '<entry-point-id>'}")
633
637
  continue
634
638
  if desk not in resolved:
635
639
  try:
@@ -644,15 +648,26 @@ def escalation_reach(client, agent: str) -> tuple[str, str, str | None]:
644
648
  problem = _desk_problem(policy, where)
645
649
  if problem:
646
650
  problems.append(problem)
651
+ if not policy.desk_id:
652
+ deskless.append("--attach other")
647
653
 
648
654
  if problems:
655
+ if deskless:
656
+ hint = (
657
+ f"fruxon escalations desks create --agent {agent} --name <name> --operator <participant-id> "
658
+ f"{' '.join(deskless)} (operators: fruxon participants list)"
659
+ )
660
+ else:
661
+ hint = (
662
+ f"fruxon escalations set-policy {agent} --operator <participant-id> "
663
+ "(operators: fruxon participants list)"
664
+ )
649
665
  return (
650
666
  "warn",
651
667
  "escalation is on, but a hand-off reaches nobody — "
652
668
  + "; ".join(problems)
653
669
  + ". The agent still tells the customer it handed off.",
654
- f"fruxon escalations policy set {agent} --operator <participant-id> "
655
- "(operators: fruxon participants list)",
670
+ hint,
656
671
  )
657
672
  reached = sorted({len(p.configured_operators) for _, p in surfaces})
658
673
  consoles = sum(1 for _, p in surfaces if (p.mode or "").upper() == "NATIVE_HANDOFF")
@@ -794,6 +794,7 @@ from fruxon.cli import dash as _dash # noqa: E402, F401
794
794
  from fruxon.cli import describe as _describe # noqa: E402, F401
795
795
  from fruxon.cli import doctor as _doctor # noqa: E402, F401
796
796
  from fruxon.cli import environments as _environments # noqa: E402, F401
797
+ from fruxon.cli import escalation_desks as _escalation_desks # noqa: E402, F401
797
798
  from fruxon.cli import escalations as _escalations # noqa: E402, F401
798
799
  from fruxon.cli import examples as _examples # noqa: E402, F401
799
800
  from fruxon.cli import feedback as _feedback # noqa: E402, F401
@@ -797,13 +797,40 @@ def new_version(
797
797
  from_version: Annotated[
798
798
  int | None, typer.Option("--from", help="Copy this version into a new draft to edit.")
799
799
  ] = None,
800
+ schema: Annotated[
801
+ bool,
802
+ typer.Option("--schema", help="Print the JSON schema for --file (AgentReplyStyleContent) and exit."),
803
+ ] = False,
800
804
  workspace: _WORKSPACE_OPT = None,
801
805
  base_url: _BASE_URL_OPT = None,
802
806
  output: Annotated[
803
807
  str | None, typer.Option("--output", "-o", help="Output format: text (default), json, id (version number).")
804
808
  ] = None,
805
809
  ):
806
- """Write a draft by hand, or copy a version into one to edit. There is at most one draft."""
810
+ """Write a draft by hand, or copy a version into one to edit. There is at most one draft.
811
+
812
+ `--file` is an AgentReplyStyleContent — `summary` (optional), `rules`
813
+ (`text`, optional `situation`), and `examples` (optional `situation`,
814
+ `turns` of `role` CUSTOMER or AGENT and `text`, ending on the agent).
815
+ Pass `--schema` for its JSON schema. For example:
816
+
817
+ {"summary": "Short, warm replies in the customer's language.",
818
+ "rules": [{"text": "Greet only on the first reply."},
819
+ {"text": "Offer two slots, never a list.", "situation": "booking"}],
820
+ "examples": [{"situation": "booking",
821
+ "turns": [{"role": "CUSTOMER", "text": "Can I come in Tuesday?"},
822
+ {"role": "AGENT", "text": "Tuesday works: 10:00 or 14:30?"}]}]}
823
+
824
+ Examples:
825
+ fruxon agents reply-style new my-agent --schema
826
+ fruxon agents reply-style new my-agent --file style.json
827
+ fruxon agents reply-style new my-agent --from 2
828
+ """
829
+ if schema:
830
+ from fruxon.cli._schema import print_schema
831
+
832
+ print_schema("AgentReplyStyleContent", workspace=workspace, base_url=base_url)
833
+ return
807
834
  if (file is None) == (from_version is None):
808
835
  fail("Pass exactly one of --file and --from.", code=EXIT_VALIDATION)
809
836
  output = _output(output, ("text", "json", "id"))
@@ -825,8 +852,14 @@ def new_version(
825
852
  @reply_style_app.command("edit")
826
853
  def edit_version(
827
854
  agent: _AGENT_ARG,
828
- version: Annotated[int, typer.Argument(help="The draft's number.")],
829
- file: Annotated[str, typer.Option("--file", "-f", help="Content JSON replacing the draft's ('-' for stdin).")],
855
+ version: Annotated[int | None, typer.Argument(help="The draft's number.")] = None,
856
+ file: Annotated[
857
+ str | None, typer.Option("--file", "-f", help="Content JSON replacing the draft's ('-' for stdin).")
858
+ ] = None,
859
+ schema: Annotated[
860
+ bool,
861
+ typer.Option("--schema", help="Print the JSON schema for --file (AgentReplyStyleContent) and exit."),
862
+ ] = False,
830
863
  workspace: _WORKSPACE_OPT = None,
831
864
  base_url: _BASE_URL_OPT = None,
832
865
  output: Annotated[str | None, typer.Option("--output", "-o", help="Output format: text (default), json.")] = None,
@@ -836,10 +869,34 @@ def edit_version(
836
869
  Take the content from `show <agent> <n> -o json` (its `content` member),
837
870
  change it, and send it back.
838
871
 
839
- Example:
872
+ `--file` is an AgentReplyStyleContent — `summary` (optional), `rules`
873
+ (`text`, optional `situation`), and `examples` (optional `situation`,
874
+ `turns` of `role` CUSTOMER or AGENT and `text`, ending on the agent).
875
+ Pass `--schema` for its JSON schema. For example:
876
+
877
+ {"summary": "Short, warm replies in the customer's language.",
878
+ "rules": [{"text": "Greet only on the first reply."},
879
+ {"text": "Offer two slots, never a list.", "situation": "booking"}],
880
+ "examples": [{"situation": "booking",
881
+ "turns": [{"role": "CUSTOMER", "text": "Can I come in Tuesday?"},
882
+ {"role": "AGENT", "text": "Tuesday works: 10:00 or 14:30?"}]}]}
883
+
884
+ Examples:
885
+ fruxon agents reply-style edit my-agent --schema
840
886
  fruxon agents reply-style show my-agent 3 -o json | jq .content > draft.json
841
887
  fruxon agents reply-style edit my-agent 3 --file draft.json
842
888
  """
889
+ if schema:
890
+ from fruxon.cli._schema import print_schema
891
+
892
+ print_schema("AgentReplyStyleContent", workspace=workspace, base_url=base_url)
893
+ return
894
+ if version is None or file is None:
895
+ fail(
896
+ "Pass the draft's number and [bold]--file[/bold].",
897
+ hint="Or [bold]--schema[/bold] to see the content's shape.",
898
+ code=EXIT_VALIDATION,
899
+ )
843
900
  output = _output(output, ("text", "json"))
844
901
  content = load_json_body(file, what=_CONTENT_SHAPE)
845
902
  if "content" in content and isinstance(content["content"], dict) and "rules" not in content:
@@ -464,15 +464,48 @@ def _say_live_state(agent: str, revision: int | str, live_revision: int | None)
464
464
  def revisions_deploy(
465
465
  agent: Annotated[str, typer.Argument(help="Agent identifier.")],
466
466
  revision: Annotated[int, typer.Argument(help="Revision number to deploy.")],
467
+ yes: Annotated[
468
+ bool,
469
+ typer.Option(
470
+ "--yes",
471
+ "-y",
472
+ help="Accepted for scripts that pass it to every write; deploying never prompts.",
473
+ ),
474
+ ] = False,
467
475
  workspace: Annotated[str | None, typer.Option("--workspace", help="Workspace identifier override.")] = None,
468
476
  base_url: Annotated[str | None, typer.Option("--base-url", help="API base URL override.")] = None,
477
+ output: Annotated[
478
+ str | None,
479
+ typer.Option("--output", "-o", help="Output format: text (default for humans), json (default in agent mode)."),
480
+ ] = None,
469
481
  ):
470
- """Deploy a previously-created revision so it becomes the agent's live revision."""
482
+ """Deploy a previously-created revision so it becomes the agent's live revision.
483
+
484
+ Deploying does not prompt — like `revisions create --deploy`, it is undone
485
+ by deploying the previous revision (`fruxon agents revisions deploys`
486
+ lists them). `--yes` is accepted and changes nothing.
487
+
488
+ In JSON (`-o json`, the agent-mode default) it prints
489
+ `{"agentId", "revision", "deployed": true, "result"}`, where `result`
490
+ is the server's DeployResult (the updated agent and which connectors
491
+ were activated).
492
+
493
+ Examples:
494
+ fruxon agents revisions deploy my-agent 2
495
+ fruxon agents revisions deploy my-agent 2 -o json | jq .deployed
496
+ """
497
+ del yes # accepted, never needed: see the docstring
498
+ output = resolve_output_format(output, human_default="text", agent_default="json")
499
+ if output not in {"text", "json"}:
500
+ fail(f"Unknown output format: [bold]{output}[/bold]", hint="Valid formats: text, json.", code=EXIT_VALIDATION)
471
501
  client = build_client(workspace, base_url)
472
502
  try:
473
- client.deploy_revision(agent, revision)
503
+ result = client.deploy_revision(agent, revision)
474
504
  except FruxonError as e:
475
505
  fail_from_api_error(e, hint=_deploy_hint(e))
506
+ if output == "json":
507
+ print(json.dumps({"agentId": agent, "revision": revision, "deployed": True, "result": result}, indent=2))
508
+ return
476
509
  say_ok(f"Deployed revision [bold]{revision}[/bold] of [bold]{agent}[/bold]")
477
510
 
478
511
 
@@ -0,0 +1,382 @@
1
+ """``fruxon escalations desks`` — an Application's escalation desks.
2
+
3
+ A desk is who a conversation is handed to when its agent escalates. It is
4
+ either an **operator desk** (``BRIDGE``: Fruxon relays the conversation to an
5
+ operator ladder) or a **console desk** (``NATIVE_HANDOFF``: the channel's own
6
+ console picks the person, so it has no ladder). The kind is fixed when the
7
+ desk is created.
8
+
9
+ A desk serves nothing until it is attached. Each channel (entry point) names
10
+ its desk, and the Application names one more for conversations that came
11
+ through no channel — the web widget, the test console. That last one must be
12
+ an operator desk. ``escalations set-policy`` edits a desk that is already
13
+ attached; these commands make one and attach it.
14
+ """
15
+
16
+ from __future__ import annotations
17
+
18
+ import json
19
+ from typing import Annotated
20
+
21
+ import typer
22
+
23
+ from fruxon.cli._shared import build_client
24
+ from fruxon.cli.escalations import escalations_app
25
+ from fruxon.exceptions import FruxonError
26
+ from fruxon.fruxon import FruxonClient
27
+ from fruxon.ui import (
28
+ EXIT_VALIDATION,
29
+ fail,
30
+ fail_from_api_error,
31
+ resolve_output_format,
32
+ say_info,
33
+ say_ok,
34
+ stderr,
35
+ )
36
+
37
+ desks_app = typer.Typer(
38
+ help="An Application's escalation desks: create one and attach it to a channel or to other conversations.",
39
+ no_args_is_help=True,
40
+ )
41
+ escalations_app.add_typer(desks_app, name="desks")
42
+
43
+ # Mirrors DeliveryMode (UNSPECIFIED is the never-persisted sentinel).
44
+ _VALID_MODE = ("BRIDGE", "NATIVE_HANDOFF")
45
+ # Mirrors EscalationSelectionStrategy.
46
+ _VALID_STRATEGY = ("FIRST_AVAILABLE", "ROUND_ROBIN", "BROADCAST")
47
+ # The `--attach` / `attach` target for conversations that came through no channel.
48
+ OTHER = "other"
49
+
50
+ _WORKSPACE = Annotated[str | None, typer.Option("--workspace", help="Workspace identifier override.")]
51
+ _BASE_URL = Annotated[str | None, typer.Option("--base-url", help="API base URL override.")]
52
+ _OUTPUT = Annotated[
53
+ str | None,
54
+ typer.Option("--output", "-o", help="Output format: table (default for humans), json (default in agent mode)."),
55
+ ]
56
+ _AGENT = Annotated[
57
+ str | None,
58
+ typer.Option("--agent", help="Use the Application that governs this agent."),
59
+ ]
60
+ _APPLICATION = Annotated[
61
+ str | None,
62
+ typer.Option("--application", help="Application id. Defaults to --agent's, else the workspace default."),
63
+ ]
64
+
65
+
66
+ def _resolve_output(output: str | None) -> str:
67
+ out = resolve_output_format(output, human_default="table", agent_default="json")
68
+ if out not in {"table", "json"}:
69
+ fail(f"Unknown output format: [bold]{out}[/bold]", hint="Valid formats: table, json.", code=EXIT_VALIDATION)
70
+ return out
71
+
72
+
73
+ def _resolve_application(client: FruxonClient, agent: str | None, application: str | None) -> str:
74
+ """The Application the desks belong to: ``--application``, else the one
75
+ governing ``--agent`` (resolved the way an escalation is), else the
76
+ workspace's default Application."""
77
+ if application:
78
+ return application
79
+ if agent:
80
+ try:
81
+ policy = client.get_escalation_policy(agent)
82
+ except FruxonError as e:
83
+ fail_from_api_error(e, hint=_hint_for_desk_error(e))
84
+ if not policy.network_id:
85
+ fail(
86
+ f"No Application governs [bold]{agent}[/bold], so it has no escalation desks.",
87
+ hint="Attach the agent to an Application first (fruxon applications list).",
88
+ code=EXIT_VALIDATION,
89
+ )
90
+ return policy.network_id
91
+ try:
92
+ default = client.default_application_id()
93
+ except FruxonError as e:
94
+ fail_from_api_error(e)
95
+ if not default:
96
+ fail(
97
+ "No Application to look in.",
98
+ hint="Pass --agent <agent> or --application <id> (fruxon applications list).",
99
+ code=EXIT_VALIDATION,
100
+ )
101
+ return default
102
+
103
+
104
+ def _hint_for_desk_error(error: FruxonError) -> str | None:
105
+ from fruxon.exceptions import ForbiddenError
106
+
107
+ if isinstance(error, ForbiddenError):
108
+ return (
109
+ "Desks need [bold]participants:read[/bold] to read and [bold]participants:write[/bold] plus "
110
+ "Editor on the Application to change; attaching to other conversations also needs the "
111
+ "Application's write access. Check with [bold]fruxon applications list[/bold]."
112
+ )
113
+ return None
114
+
115
+
116
+ def _attach(client: FruxonClient, application: str, desk: str | None, target: str) -> None:
117
+ """Point ``target`` (``other`` or an entry point id) at ``desk``; ``None`` detaches."""
118
+ try:
119
+ if target.lower() == OTHER:
120
+ client.set_other_conversations_escalation_desk(application, desk)
121
+ elif desk is None:
122
+ client.update_entry_point(application, target, clear_escalation_desk=True)
123
+ else:
124
+ client.update_entry_point(application, target, escalation_desk=desk)
125
+ except FruxonError as e:
126
+ fail_from_api_error(e, hint=_hint_for_desk_error(e))
127
+
128
+
129
+ def _operators(desk: dict) -> list[str]:
130
+ tiers = desk.get("tiers") or []
131
+ return [p for t in tiers if isinstance(t, dict) for p in t.get("operatorParticipantIds") or []]
132
+
133
+
134
+ def _used_by(desk: dict) -> str:
135
+ channels = desk.get("attachedEntryPointIds") or []
136
+ parts = [f"{len(channels)} channel(s)"] if channels else []
137
+ if desk.get("isOtherConversations"):
138
+ parts.append("conversations without a channel")
139
+ return " + ".join(parts) or "[yellow]nothing — not attached[/yellow]"
140
+
141
+
142
+ def _render(desk: dict) -> None:
143
+ mode = (desk.get("mode") or "").upper()
144
+ kind = "console desk" if mode == "NATIVE_HANDOFF" else "operator desk"
145
+ stderr.print(f" [bold]{desk.get('name') or '—'}[/bold] [dim]{desk.get('id')} · {kind} ({mode or '—'})[/dim]")
146
+ if mode != "NATIVE_HANDOFF":
147
+ stderr.print(f" [dim]operators[/dim] {', '.join(_operators(desk)) or '[red]— nobody[/red]'}")
148
+ stderr.print(f" [dim]working hours[/dim] {desk.get('workingHoursScheduleId') or '— (always on)'}")
149
+ stderr.print(f" [dim]used by[/dim] {_used_by(desk)}")
150
+
151
+
152
+ @desks_app.command("list")
153
+ def desks_list(
154
+ agent: _AGENT = None,
155
+ application: _APPLICATION = None,
156
+ workspace: _WORKSPACE = None,
157
+ base_url: _BASE_URL = None,
158
+ output: _OUTPUT = None,
159
+ ):
160
+ """List an Application's escalation desks, and what each is attached to.
161
+
162
+ Examples:
163
+ fruxon escalations desks list --agent front-desk
164
+ fruxon escalations desks list --application <id> -o json | jq '.[] | {id, name, mode}'
165
+ """
166
+ output = _resolve_output(output)
167
+ client = build_client(workspace, base_url)
168
+ network = _resolve_application(client, agent, application)
169
+ try:
170
+ desks = client.list_escalation_desks(network)
171
+ except FruxonError as e:
172
+ fail_from_api_error(e, hint=_hint_for_desk_error(e))
173
+ if output == "json":
174
+ print(json.dumps(desks, indent=2))
175
+ return
176
+ if not desks:
177
+ say_info(
178
+ "This Application has no escalation desks, so its agents cannot hand off.",
179
+ hint="fruxon escalations desks create --name 'Front desk' --operator <participant-id> --attach other",
180
+ )
181
+ return
182
+ stderr.print()
183
+ for desk in desks:
184
+ _render(desk)
185
+ stderr.print()
186
+
187
+
188
+ @desks_app.command("create")
189
+ def desks_create(
190
+ name: Annotated[str, typer.Option("--name", help="What the Application calls the desk.")],
191
+ mode: Annotated[
192
+ str,
193
+ typer.Option(
194
+ "--mode",
195
+ help="BRIDGE (operator desk, default) or NATIVE_HANDOFF (console desk). Fixed once created.",
196
+ ),
197
+ ] = "BRIDGE",
198
+ operator: Annotated[
199
+ list[str] | None,
200
+ typer.Option("--operator", help="Operator participant id, in preference order. Repeatable; BRIDGE only."),
201
+ ] = None,
202
+ strategy: Annotated[
203
+ str | None,
204
+ typer.Option("--strategy", help="How the tier picks: FIRST_AVAILABLE (default), ROUND_ROBIN, BROADCAST."),
205
+ ] = None,
206
+ working_hours: Annotated[
207
+ str | None,
208
+ typer.Option("--working-hours", help="Working-hours schedule id the desk follows (fruxon working-hours list)."),
209
+ ] = None,
210
+ default_reason: Annotated[
211
+ str | None, typer.Option("--default-reason", help="Reason shown to the operator when the agent gives none.")
212
+ ] = None,
213
+ attach: Annotated[
214
+ list[str] | None,
215
+ typer.Option(
216
+ "--attach",
217
+ help="Attach it right away: 'other' (conversations without a channel) or an entry point id. Repeatable.",
218
+ ),
219
+ ] = None,
220
+ agent: _AGENT = None,
221
+ application: _APPLICATION = None,
222
+ workspace: _WORKSPACE = None,
223
+ base_url: _BASE_URL = None,
224
+ output: _OUTPUT = None,
225
+ ):
226
+ """Create an escalation desk, and optionally attach it.
227
+
228
+ An operator desk (`BRIDGE`) relays the conversation to the `--operator`
229
+ ladder; with no operators, nobody is paged and the escalation degrades.
230
+ A console desk (`NATIVE_HANDOFF`) hands the chat to the channel's own
231
+ console and has no ladder. The kind cannot change later.
232
+
233
+ `--attach other` makes it the desk for conversations that came through
234
+ no channel (the web widget, the test console) — that one must be an
235
+ operator desk. `--attach <entry-point-id>` makes it a channel's desk.
236
+ Without `--attach` the desk serves nothing yet; use
237
+ `fruxon escalations desks attach`.
238
+
239
+ Needs `participants:write` and Editor on the Application.
240
+
241
+ Examples:
242
+ fruxon escalations desks create --agent front-desk --name "Front desk" --operator <participant> --attach other
243
+ fruxon escalations desks create --agent front-desk --name "Telegram" --operator p1 --operator p2 \\
244
+ --strategy ROUND_ROBIN --working-hours <schedule-id> --attach <telegram-entry-point>
245
+ fruxon escalations desks create --application <id> --name "Console" --mode NATIVE_HANDOFF --attach <entry-point>
246
+ """
247
+ output = _resolve_output(output)
248
+ mode = mode.strip().upper()
249
+ if mode not in _VALID_MODE:
250
+ fail(f"Unknown mode: [bold]{mode}[/bold]", hint=f"Valid: {', '.join(_VALID_MODE)}.", code=EXIT_VALIDATION)
251
+ if strategy is not None:
252
+ strategy = strategy.strip().upper()
253
+ if strategy not in _VALID_STRATEGY:
254
+ fail(
255
+ f"Unknown strategy: [bold]{strategy}[/bold]",
256
+ hint=f"Valid: {', '.join(_VALID_STRATEGY)}.",
257
+ code=EXIT_VALIDATION,
258
+ )
259
+ if not operator:
260
+ fail("[bold]--strategy[/bold] goes with --operator.", code=EXIT_VALIDATION)
261
+ targets = list(attach or [])
262
+ if mode == "NATIVE_HANDOFF":
263
+ if operator:
264
+ fail(
265
+ "A console desk has no operator ladder — the channel's console picks the person.",
266
+ hint="Drop --operator, or create an operator desk (--mode BRIDGE).",
267
+ code=EXIT_VALIDATION,
268
+ )
269
+ if any(t.lower() == OTHER for t in targets):
270
+ fail(
271
+ "Conversations without a channel need an operator desk — there is no console to hand them to.",
272
+ hint="Use --mode BRIDGE for --attach other.",
273
+ code=EXIT_VALIDATION,
274
+ )
275
+
276
+ body: dict[str, object] = {"name": name, "mode": mode, "tiers": []}
277
+ if operator:
278
+ body["tiers"] = [{"operatorParticipantIds": list(operator), "strategy": strategy or "FIRST_AVAILABLE"}]
279
+ if working_hours:
280
+ body["workingHoursScheduleId"] = working_hours
281
+ if default_reason:
282
+ body["defaultReason"] = default_reason
283
+
284
+ client = build_client(workspace, base_url)
285
+ network = _resolve_application(client, agent, application)
286
+ try:
287
+ created = client.create_escalation_desk(network, body)
288
+ except FruxonError as e:
289
+ fail_from_api_error(e, hint=_hint_for_desk_error(e))
290
+ desk_id = str(created.get("id") or "")
291
+
292
+ for target in targets:
293
+ _attach(client, network, desk_id, target)
294
+ if targets:
295
+ try:
296
+ created = client.get_escalation_desk(network, desk_id)
297
+ except FruxonError:
298
+ pass # created and attached; the re-read only refreshes "used by"
299
+
300
+ if output == "json":
301
+ print(json.dumps(created, indent=2))
302
+ return
303
+ stderr.print()
304
+ say_ok(f"Created escalation desk [bold]{created.get('name') or name}[/bold] ([dim]{desk_id}[/dim]).")
305
+ _render(created)
306
+ if not targets:
307
+ say_info(
308
+ "It serves nothing until it is attached.",
309
+ hint=f"fruxon escalations desks attach {desk_id} other --application {network}",
310
+ )
311
+ elif agent:
312
+ say_info("Check what an escalation reaches now with", hint=f"fruxon escalations policy {agent}")
313
+
314
+
315
+ @desks_app.command("attach")
316
+ def desks_attach(
317
+ desk: Annotated[str, typer.Argument(help="Desk id (fruxon escalations desks list).")],
318
+ targets: Annotated[
319
+ list[str],
320
+ typer.Argument(help="'other' (conversations without a channel) and/or entry point ids."),
321
+ ],
322
+ agent: _AGENT = None,
323
+ application: _APPLICATION = None,
324
+ workspace: _WORKSPACE = None,
325
+ base_url: _BASE_URL = None,
326
+ output: _OUTPUT = None,
327
+ ):
328
+ """Make a desk the one a channel, or conversations without a channel, hand off to.
329
+
330
+ Replaces whatever desk the target used before. `other` takes an operator
331
+ desk only.
332
+
333
+ Examples:
334
+ fruxon escalations desks attach <desk-id> other --agent front-desk
335
+ fruxon escalations desks attach <desk-id> <entry-point-id> --application <id>
336
+ """
337
+ output = _resolve_output(output)
338
+ client = build_client(workspace, base_url)
339
+ network = _resolve_application(client, agent, application)
340
+ for target in targets:
341
+ _attach(client, network, desk, target)
342
+ try:
343
+ current = client.get_escalation_desk(network, desk)
344
+ except FruxonError as e:
345
+ fail_from_api_error(e, hint=_hint_for_desk_error(e))
346
+ if output == "json":
347
+ print(json.dumps(current, indent=2))
348
+ return
349
+ stderr.print()
350
+ say_ok(f"Attached [bold]{current.get('name') or desk}[/bold] to {', '.join(targets)}.")
351
+ _render(current)
352
+
353
+
354
+ @desks_app.command("detach")
355
+ def desks_detach(
356
+ targets: Annotated[
357
+ list[str],
358
+ typer.Argument(help="'other' (conversations without a channel) and/or entry point ids."),
359
+ ],
360
+ agent: _AGENT = None,
361
+ application: _APPLICATION = None,
362
+ workspace: _WORKSPACE = None,
363
+ base_url: _BASE_URL = None,
364
+ output: _OUTPUT = None,
365
+ ):
366
+ """Turn hand-off off for a channel, or for conversations without a channel.
367
+
368
+ The desk itself stays; only the attachment goes.
369
+
370
+ Examples:
371
+ fruxon escalations desks detach other --agent front-desk
372
+ """
373
+ output = _resolve_output(output)
374
+ client = build_client(workspace, base_url)
375
+ network = _resolve_application(client, agent, application)
376
+ for target in targets:
377
+ _attach(client, network, None, target)
378
+ if output == "json":
379
+ print(json.dumps({"applicationId": network, "detached": targets}, indent=2))
380
+ return
381
+ stderr.print()
382
+ say_ok(f"Hand-off is off for {', '.join(targets)}.")