fsr-agentic-toolkit 0.3.1__tar.gz → 0.3.2__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 (101) hide show
  1. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/PKG-INFO +1 -1
  2. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/pyproject.toml +1 -1
  3. fsr_agentic_toolkit-0.3.2/src/fsr_agentic_toolkit/skills/widget-building/SKILL.md +127 -0
  4. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/tools.py +53 -5
  5. fsr_agentic_toolkit-0.3.2/src/fsr_agentic_toolkit/widget_kit.py +836 -0
  6. fsr_agentic_toolkit-0.3.2/src/fsr_agentic_toolkit/widget_tools.py +148 -0
  7. fsr_agentic_toolkit-0.3.2/tests/fixtures/widget_edit_closes_without_wid.js +103 -0
  8. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_agent_safety.py +19 -0
  9. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_skills_cmd.py +2 -1
  10. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_tool_deadline.py +11 -0
  11. fsr_agentic_toolkit-0.3.2/tests/test_widget_kit.py +196 -0
  12. fsr_agentic_toolkit-0.3.2/tests/test_widget_tools.py +71 -0
  13. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/.github/workflows/publish.yml +0 -0
  14. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/.github/workflows/tests.yml +0 -0
  15. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/.gitignore +0 -0
  16. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/AGENTS.md +0 -0
  17. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/Makefile +0 -0
  18. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/README.md +0 -0
  19. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/__init__.py +0 -0
  20. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/cli.py +0 -0
  21. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/init_cmd.py +0 -0
  22. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/reference/AUTHORING.md +0 -0
  23. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/skills/alert-investigation/SKILL.md +0 -0
  24. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/skills/box-onboarding/SKILL.md +0 -0
  25. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/skills/connector-building/SKILL.md +0 -0
  26. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/skills/connector-secrets/SKILL.md +0 -0
  27. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/skills/debug-and-repair/SKILL.md +0 -0
  28. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/skills/playbook-authoring/SKILL.md +0 -0
  29. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/skills/prove-the-work/SKILL.md +0 -0
  30. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/skills/use-case-building/SKILL.md +0 -0
  31. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/skills_cmd.py +0 -0
  32. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/spec.py +0 -0
  33. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/__init__.py +0 -0
  34. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/archetypes/__init__.py +0 -0
  35. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/archetypes/harvest.py +0 -0
  36. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/archetypes/record.py +0 -0
  37. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/archetypes/router.py +0 -0
  38. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/archetypes/seed/.gitkeep +0 -0
  39. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/archetypes/seed/reconcile-and-report.json +0 -0
  40. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/archetypes/store.py +0 -0
  41. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/hints.py +0 -0
  42. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/mcp.py +0 -0
  43. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/verbs/mcp_http.py +0 -0
  44. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflow_tools.py +0 -0
  45. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/__init__.py +0 -0
  46. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/access.py +0 -0
  47. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/build.py +0 -0
  48. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/connector.py +0 -0
  49. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/connector_setup.py +0 -0
  50. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/debug.py +0 -0
  51. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/investigate.py +0 -0
  52. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/orient.py +0 -0
  53. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/provision.py +0 -0
  54. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/repair.py +0 -0
  55. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/result.py +0 -0
  56. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/run.py +0 -0
  57. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/src/fsr_agentic_toolkit/workflows/verify.py +0 -0
  58. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/conftest.py +0 -0
  59. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/fixtures/workflows/heist_intake.yaml +0 -0
  60. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/silent_noop_scenario.py +0 -0
  61. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_accuracy_guards.py +0 -0
  62. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_archetypes.py +0 -0
  63. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_build_connector.py +0 -0
  64. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_cli_agent_init.py +0 -0
  65. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_compile_is_the_gate.py +0 -0
  66. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_connector_verbs.py +0 -0
  67. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_debug_doubled_iri.py +0 -0
  68. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_debug_reference_fix.py +0 -0
  69. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_debug_static_prerun.py +0 -0
  70. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_diagnose_run.py +0 -0
  71. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_find_and_bulk_update.py +0 -0
  72. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_init_codex_snippet.py +0 -0
  73. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_mcp.py +0 -0
  74. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_mcp_http.py +0 -0
  75. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_mcp_multi_instance.py +0 -0
  76. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_nested_cap.py +0 -0
  77. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_paging.py +0 -0
  78. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_picklist_dispatch.py +0 -0
  79. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_playbook_reference.py +0 -0
  80. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_provision_coerces_fields.py +0 -0
  81. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_provision_publish_and_probe.py +0 -0
  82. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_register_arg_gate.py +0 -0
  83. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_registered_mcp_tools.py +0 -0
  84. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_related_comments_count.py +0 -0
  85. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_run_playbook_yaml.py +0 -0
  86. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_run_verify_chain.py +0 -0
  87. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_schedules.py +0 -0
  88. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_search_fallback.py +0 -0
  89. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_setup_connector.py +0 -0
  90. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_silent_noop_scenario.py +0 -0
  91. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_tool_hints.py +0 -0
  92. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_tool_name_aliases.py +0 -0
  93. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_tools.py +0 -0
  94. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_whoami_auth_mode.py +0 -0
  95. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_workflow_debug_verify.py +0 -0
  96. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_workflow_first_surface.py +0 -0
  97. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_workflow_result.py +0 -0
  98. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_workflow_scenario.py +0 -0
  99. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/test_workflow_t2.py +0 -0
  100. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/tests/workflow_scenario.py +0 -0
  101. {fsr_agentic_toolkit-0.3.1 → fsr_agentic_toolkit-0.3.2}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fsr-agentic-toolkit
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: The agent layer for FortiSOAR: workflows and tools behind one safety gate, served as an MCP server, CLI, and Python API, on pyfsr and fsr-playbooks.
5
5
  License: MIT
6
6
  Requires-Python: >=3.11
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "fsr-agentic-toolkit"
7
- version = "0.3.1"
7
+ version = "0.3.2"
8
8
  description = "The agent layer for FortiSOAR: workflows and tools behind one safety gate, served as an MCP server, CLI, and Python API, on pyfsr and fsr-playbooks."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -0,0 +1,127 @@
1
+ ---
2
+ name: widget-building
3
+ description: >-
4
+ Build, test, and validate a custom FortiSOAR widget (view and edit controllers,
5
+ info.json, a dashboard or view-panel tile). Use when someone needs a visualization
6
+ or tile the built-in dashboard builder cannot give them (for example a count across
7
+ several modules), when creating or changing a widget, or when checking that a widget
8
+ really works on a box before calling it done.
9
+ ---
10
+
11
+ # Building a FortiSOAR widget
12
+
13
+ A widget is a folder `widget/` with `info.json`, `view.html` + `view.controller.js`
14
+ (what users see) and `edit.html` + `edit.controller.js` (the config modal). It runs
15
+ inside the platform's AngularJS app and reads data through the same REST API you use,
16
+ mainly `POST /api/query/<module>`.
17
+
18
+ The toolkit does the whole job: `find_widgets`, `scaffold_widget`, `lint_widget`,
19
+ `deploy_widget`, `verify_widget`. Nothing else has to be installed. The widget devkit
20
+ (`github.com/ftnt-dspille/fsr-widget-devkit`) is optional, for browser tests against a mock
21
+ platform and for screenshots.
22
+
23
+ ## 1. Is a widget needed?
24
+
25
+ The built-in dashboard widgets (Card Count, Chart, Grid, Card List) each bind to ONE
26
+ module and make one query. A number across modules needs a custom widget, or a scheduled
27
+ playbook that writes the total to a record. Call `find_widgets` first and report what
28
+ exists before building.
29
+
30
+ ## 2. Design from the real data
31
+
32
+ `survey_box` for the modules, fields and picklists. Check the query on the box before
33
+ coding. Facts that bite:
34
+
35
+ - A count is an aggregate: `{"logic":"AND","filters":[...],"aggregates":[{"operator":"countdistinct","field":"*","alias":"total"}]}`;
36
+ read `hydra:member[0].total`. Never read rows to count them.
37
+ - Filter a picklist through `<field>.itemValue` with the field's real values, and name
38
+ the status field per module (it may differ).
39
+ - **"Not X" is `nin`, never `neq`.** `neq` silently drops records whose value is empty
40
+ (a field with 19 empty of 44 gave 15, not 34). `nin` keeps them. Use `nin` even for one value.
41
+ - A module the user cannot read, or that does not exist, returns HTTP 403 "Access Denied",
42
+ not 404. Show that module as failed, never as 0.
43
+ - Aggregates silently truncate at 5000 on group-by results.
44
+ - The module list in an edit form comes from `appModulesService.load(true)` (items have
45
+ `.type`, `.name`, `.system`). A module's picklist fields and their values come from
46
+ `GET api/3/model_metadatas?type=<module>` (`attributes[].dataSource.query`, posted to
47
+ `/api/query/picklists`).
48
+ - Pass `$`-params baked into the URL string; the harness drops `$params` objects.
49
+
50
+ ## 3. Scaffold
51
+
52
+ `scaffold_widget` with an empty directory, a camelCase name and a title. It writes a working,
53
+ lint-clean widget (a single-module count with the platform's filter builder) that already
54
+ follows the patterns below, plus a pure logic file and a jest test. Change it from there; do
55
+ not start from a blank folder. Each widget is its own git repo; commit on a branch.
56
+
57
+ ## 4. The patterns that matter (the scaffold has them; keep them)
58
+
59
+ - **The edit modal returns the config it was given.** The platform opens the modal with a copy
60
+ of the saved config and REPLACES the saved config with what the modal closes with. That copy
61
+ carries the platform's own keys (`wid` ties the save to the right widget on the dashboard). A
62
+ result built from scratch drops them: the save matches nothing, nothing persists, and the view
63
+ asks for configuration again. Start from the injected config
64
+ (`$scope.config = angular.extend({defaults}, config)`) and close with `$scope.config`. This
65
+ passes every unit test and the harness; only `lint_widget` and a real dashboard catch it.
66
+ - `config` and `$uibModalInstance` are `$uibModal` locals: list them in `$inject`, never
67
+ `$injector.get` them.
68
+ - Controller names are `<name><version digits>DevCtrl` and `edit<Name><digits>DevCtrl`. A bump
69
+ rewrites the digits; never edit them or `info.json` `version` by hand.
70
+ - Pure logic in `widget/widgetAssets/js/<name>.js`: a plain global plus `module.exports`, no AMD
71
+ or UMD `define` branch (the platform shell is RequireJS). Asset JS runs in arrival order, so
72
+ the controller waits for the global instead of reading it while it is being defined.
73
+ - Filters come from the platform's filter builder (`data-cs-conditional`, query mode), fed the
74
+ module's fields through `Entity`; broadcast `conditional:fieldListChanged` after the async
75
+ load or its field list stays empty. The saved `{logic, filters}` goes to `/api/query` as is.
76
+ A body with `filters` and no `logic` is silently ignored by the platform.
77
+ - Analyst-facing text: no tool names, ids, enum values, JSON paths or status codes, no emoji,
78
+ hyphens only. Handle failure per source: a failed module is shown as failed and the total
79
+ marked partial; if everything fails show no total, never zero.
80
+
81
+ ## 5. Lint, after every change
82
+
83
+ `lint_widget` on the folder. It is offline and fast, and it is the check for bugs that pass
84
+ tests and fail on a box. Fix every error; read every warning. Each finding has a rule, a file,
85
+ a line and the fix. `deploy_widget` runs it and will not upload a widget that has an error.
86
+ Logic tests: `npx jest` in the widget folder (the scaffold includes them). A test for a fix
87
+ must be shown failing without the fix.
88
+
89
+ ## 6. Install and read back
90
+
91
+ 1. `deploy_widget` with the folder and `confirm: true`. It lints, packs, uploads, publishes and
92
+ waits until the version is live. Experimental boxes only. If the lint fails you get the
93
+ findings and nothing is uploaded.
94
+ 2. `verify_widget` with the name and the version just installed. `ok: true` means that version
95
+ is live (installed, not a draft). The box reports no separate active flag.
96
+ 3. Open the dashboard or report, add the widget, save its settings, reopen them, and check the
97
+ saved config persisted (the dashboard record's widget entry carries the settings). A widget
98
+ that renders in a harness has not proved its settings save.
99
+
100
+ With the widget devkit you can also run mock browser tests (`make test-e2e-spec`) and live
101
+ specs against a box; `make widget-push` there is a faster install loop.
102
+
103
+ ## 7. Prove it
104
+
105
+ A widget that renders proves only that it drew.
106
+
107
+ - Compute the expected number independently with the API (read the records and count in
108
+ Python, not with the same filter the widget uses) and compare it with what the widget
109
+ shows, for each module and for the sum. Report both numbers.
110
+ - With the devkit, a live spec: `E2E_LIVE=1 FSR_ENV_FILE=<env file> make test-e2e-spec
111
+ SPEC="tests/e2e/<n>.live.spec.js"` (the filename must contain `live`; `FSR_ENV_FILE` is
112
+ mandatory). Assert the proxy host is the intended box, pass the expected numbers in as a file,
113
+ keep each test under 40 s, tag and delete any records it creates.
114
+ - Change a setting and check the number moves as expected. Exercise a failing module.
115
+ - Take a screenshot on real data and read it; clipped text and a squeezed layout never
116
+ fail an assertion.
117
+ - Say what you did not prove. A live spec renders the local source through the harness,
118
+ not the installed widget inside the real dashboard; the install is proven by
119
+ `verify_widget`, so say so, or add a check in the real UI.
120
+
121
+ ## Rules that bite
122
+
123
+ - **Never install on a stable-role box** (a customer demo). Experimental boxes only,
124
+ unless the owner explicitly authorises a one-off install.
125
+ - No lab IPs, hostnames, credentials or capture dates in files that ship. Credentials come
126
+ from the env loader (`FortiSOAR.from_env_file`), never hand-parsed.
127
+ - Commit as the user, no AI attribution lines.
@@ -500,6 +500,13 @@ def _h_healthcheck_connector(client, *, connector, config=None) -> Any:
500
500
  return client.connectors.healthcheck(connector, config=config)
501
501
 
502
502
 
503
+ def _h_republish_connector(client, *, connector) -> Any:
504
+ # Recycle the integrations workers onto the connector's installed code (the
505
+ # "ghost bytecode" recycle: a same-version reinstall writes the new files but
506
+ # the long-lived uwsgi workers keep serving the previously imported module).
507
+ return to_jsonable(client.connectors.republish(connector))
508
+
509
+
503
510
  def _h_run_connector_operation(client, *, connector, operation, params=None, config=None, fields=None) -> Any:
504
511
  # ExecuteResult is a model, not a dict: keep the registry's JSON-safe promise.
505
512
  out = to_jsonable(client.connectors.execute(connector, operation, params=params or {}, config=config))
@@ -702,7 +709,14 @@ def _h_install_connector(client, *, name=None, path=None, version=None, replace=
702
709
  out["installed_version"] = result["bumped"]
703
710
  out["note"] = (f"that version was already installed, so it went up as {result['bumped']}; "
704
711
  f"run operations with version={result['bumped']!r} or the default config")
705
- if probe and on_existing_version == "allow" and path:
712
+ if probe and path:
713
+ # A local .tgz install is a dev action: the connector's files changed under a
714
+ # same-named module, so recycle the workers -- the long-lived uwsgi workers keep
715
+ # serving whatever module object they imported first, across uninstall/reinstall
716
+ # cycles too (the "ghost bytecode" bug). This used to run only with
717
+ # on_existing_version="allow", which a fresh install after an uninstall never
718
+ # triggers -- the stale module then outlives the reinstall (2026-12-01: correct
719
+ # code on disk, health still executing the previous run's scaffold).
706
720
  out["republish"] = to_jsonable(client.connectors.republish(probe))
707
721
  if probe:
708
722
  try:
@@ -1840,6 +1854,26 @@ _TOOLS: tuple[ToolSpec, ...] = (
1840
1854
  ),
1841
1855
  _h_healthcheck_connector,
1842
1856
  ),
1857
+ ToolSpec(
1858
+ "republish_connector",
1859
+ "Recycle the integrations workers onto a connector's installed code. Use after a "
1860
+ "same-version reinstall whose behavior did not change: the install writes the new "
1861
+ "files but the long-lived workers keep serving the previously imported module (the "
1862
+ "ghost-bytecode bug), so code edits silently do not take. Opens the installed "
1863
+ "connector in the Connector Studio dev workspace and publishes that twin back -- "
1864
+ "the supported, SSH-free recycle.",
1865
+ _obj(
1866
+ {
1867
+ "connector": {
1868
+ "type": "string",
1869
+ "description": "Connector name, e.g. 'virustotal'.",
1870
+ },
1871
+ },
1872
+ ["connector"],
1873
+ ),
1874
+ _h_republish_connector,
1875
+ mutating=True,
1876
+ ),
1843
1877
  ToolSpec(
1844
1878
  "run_connector_operation",
1845
1879
  "Execute one connector operation. For agent-bound connectors the call is fire-and-forget "
@@ -2722,6 +2756,10 @@ from ..workflow_tools import WORKFLOW_SPECS
2722
2756
 
2723
2757
  _TOOLS = _TOOLS + WORKFLOW_SPECS
2724
2758
 
2759
+ from ..widget_tools import WIDGET_SPECS
2760
+
2761
+ _TOOLS = _TOOLS + WIDGET_SPECS
2762
+
2725
2763
  #: Registry keyed by tool name, plus hidden back-compat aliases (former names
2726
2764
  #: after a rename). Advertising iterates _TOOLS, never REGISTRY, so an alias
2727
2765
  #: dispatches but is never listed.
@@ -2868,17 +2906,25 @@ def to_openai_tools() -> list[dict[str, Any]]:
2868
2906
  #: session for 20 minutes with nothing to show for it. Override per process
2869
2907
  #: with ``FSR_MCP_TOOL_TIMEOUT`` (seconds; ``0`` disables the ceiling).
2870
2908
  DEFAULT_TOOL_TIMEOUT = 120.0
2909
+
2910
+ #: Per-tool floor for the deadline: tools whose legitimate work outlasts the generic
2911
+ #: ceiling. debug_playbook_run re-renders the playbook's YAML -- minutes on a loaded
2912
+ #: box -- and with the generic 120s it times out before producing the grounded
2913
+ #: analysis repair_playbook needs, which stalls the whole debug->repair->publish
2914
+ #: workflow (2026-12-01: two 120s timeouts, then repair_playbook "no change made").
2915
+ TOOL_DEFAULT_TIMEOUTS: dict[str, float] = {"debug_playbook_run": 420.0}
2871
2916
  #: Headroom added to a tool's own ``timeout`` argument, so the tool's polite
2872
2917
  #: "still running" answer wins over the hard ceiling.
2873
2918
  _TIMEOUT_MARGIN = 30.0
2874
2919
 
2875
2920
 
2876
- def _tool_deadline(args: dict[str, Any]) -> float | None:
2921
+ def _tool_deadline(args: dict[str, Any], name: str | None = None) -> float | None:
2877
2922
  """Seconds this call may run, or None for no ceiling.
2878
2923
 
2879
2924
  A tool that takes its own ``timeout`` (wait_for_playbook_run,
2880
- install_connector, ...) is bounded by that value plus a margin; every other
2881
- tool gets ``FSR_MCP_TOOL_TIMEOUT`` (default 120s).
2925
+ install_connector, ...) is bounded by that value plus a margin; a tool with a
2926
+ per-tool floor (``TOOL_DEFAULT_TIMEOUTS``) gets at least that floor; every
2927
+ other tool gets ``FSR_MCP_TOOL_TIMEOUT`` (default 120s).
2882
2928
  """
2883
2929
  raw = os.environ.get("FSR_MCP_TOOL_TIMEOUT", "").strip()
2884
2930
  try:
@@ -2887,6 +2933,8 @@ def _tool_deadline(args: dict[str, Any]) -> float | None:
2887
2933
  base = DEFAULT_TOOL_TIMEOUT
2888
2934
  if base <= 0:
2889
2935
  return None
2936
+ if name:
2937
+ base = max(base, TOOL_DEFAULT_TIMEOUTS.get(name, 0.0))
2890
2938
  own = args.get("timeout")
2891
2939
  if isinstance(own, (int, float)) and not isinstance(own, bool) and own > 0:
2892
2940
  return max(base, float(own) + _TIMEOUT_MARGIN)
@@ -3324,7 +3372,7 @@ def dispatch(client, name: str, arguments: dict[str, Any] | None = None) -> Any:
3324
3372
  if not spec.mutating and "offset" not in (spec.input_schema.get("properties") or {}):
3325
3373
  offset = args.pop("offset", None)
3326
3374
  try:
3327
- result = _call_with_deadline(lambda: spec.handler(client, **args), _tool_deadline(args), tool=name)
3375
+ result = _call_with_deadline(lambda: spec.handler(client, **args), _tool_deadline(args, name), tool=name)
3328
3376
  if offset:
3329
3377
  result = _skip(result, int(offset))
3330
3378
  except TypeError as exc: # bad/missing arguments for the handler