webbee 0.7.16__tar.gz → 0.7.17__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.
- {webbee-0.7.16 → webbee-0.7.17}/.github/workflows/os-check.yml +25 -2
- {webbee-0.7.16 → webbee-0.7.17}/.github/workflows/publish.yml +7 -0
- {webbee-0.7.16 → webbee-0.7.17}/CHANGELOG.md +20 -0
- {webbee-0.7.16 → webbee-0.7.17}/PKG-INFO +3 -9
- webbee-0.7.17/ci/field_gate/drivers.py +145 -0
- webbee-0.7.17/ci/field_gate/fixture.py +157 -0
- webbee-0.7.17/ci/field_gate/provision_user.py +91 -0
- webbee-0.7.17/ci/field_gate/registry.py +120 -0
- webbee-0.7.17/ci/field_gate/replay.py +76 -0
- webbee-0.7.17/ci/field_gate/run.py +98 -0
- webbee-0.7.17/ci/field_gate/scenarios_account.py +259 -0
- webbee-0.7.17/ci/field_gate/scenarios_code.py +169 -0
- webbee-0.7.17/ci/field_gate/scenarios_contract.py +34 -0
- webbee-0.7.17/ci/field_gate/test_drivers.py +37 -0
- webbee-0.7.17/ci/field_gate/test_fixture.py +53 -0
- webbee-0.7.17/ci/field_gate/test_registry.py +13 -0
- webbee-0.7.17/ci/field_gate/test_replay.py +35 -0
- webbee-0.7.17/ci/field_gate/wipe.py +49 -0
- webbee-0.7.17/dev-webbee +11 -0
- {webbee-0.7.16 → webbee-0.7.17}/pyproject.toml +8 -15
- webbee-0.7.17/src/webbee/__init__.py +1 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/boot.py +5 -2
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/checkpoints.py +50 -12
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/cli.py +17 -5
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/coding_context.py +1 -1
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/config.py +1 -1
- webbee-0.7.17/src/webbee/intel/__init__.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/intel/query.py +6 -71
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/intel/service.py +21 -138
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/intel/store.py +49 -67
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/pricing_constants.py +3 -3
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/render.py +2 -2
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/repl.py +10 -3
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/session.py +5 -1
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/tools.py +283 -105
- webbee-0.7.17/tests/__init__.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/conftest.py +7 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_audit_2026_07_25_findings.py +0 -77
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_checkpoints.py +55 -1
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_field_test_1113.py +3 -22
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_cache_and_sync_worker.py +5 -8
- webbee-0.7.17/tests/test_intel_no_numpy.py +12 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_query.py +0 -22
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_service.py +0 -66
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_store.py +31 -53
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_repl.py +33 -1
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_session_review_1030.py +11 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tools.py +59 -22
- webbee-0.7.16/src/webbee/__init__.py +0 -1
- webbee-0.7.16/src/webbee/intel/vectors.py +0 -95
- webbee-0.7.16/tests/test_intel_no_numpy.py +0 -44
- webbee-0.7.16/tests/test_intel_vectors.py +0 -51
- {webbee-0.7.16 → webbee-0.7.17}/.gitignore +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/LICENSE +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/README.md +0 -0
- {webbee-0.7.16/src/webbee/intel → webbee-0.7.17/ci}/__init__.py +0 -0
- {webbee-0.7.16/tests → webbee-0.7.17/ci/field_gate}/__init__.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/ci/os_check.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/install.sh +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/__main__.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/_launch.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/account.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/active_sessions.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/autoupdate.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/banner_art.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/browser.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/clipboard.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/clipboard_read.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/clipboard_session.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/commands.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/consent.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/details.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/events.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/frames.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/home.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/home_view.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/http.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/instance_lock.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/intel/graph.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/intel/outline.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/intel/tree.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/intel/watch.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/loop_errors.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/media.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/modals.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/mode_store.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/native_files.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/native_read.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/newtab_mode.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/output_pane.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/queue_panel.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/reflow.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/remote.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/repo.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/selection.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/sessions.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/sizing.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/slots.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/steer.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/stream.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/tab_store.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/tabs.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/thread.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/tier_store.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/todo_panel.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/tokens.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/tui.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/update.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/urlopen.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/wallet.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/src/webbee/worktrees.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_account.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_active_sessions.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_append_file.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_autoupdate.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_checkpoints_nested_1030.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_cli.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_clipboard.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_clipboard_read.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_code_map_fresh.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_coding_context.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_commands.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_config.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_cpc_contract_stable.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_cpc_outline.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_cross_loop_token.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_details.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_events.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_freeze_fix.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_home.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_home_view.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_home_view_mouse.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_inspect_page.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_instance_lock.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_any_folder.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_checksum_tree.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_chunker.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_embed.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_folder_1106.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_graph.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_intel_watch.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_launch.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_loop_errors.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_marathon.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_modals_e2e.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_mode_and_remote_0_6_8.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_mode_store.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_native_files.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_newtab_mode.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_packaging.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_probe_cost.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_queue_manage_0337.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_reflow.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_remote_code_reads.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_render.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_repo.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_resilient_http.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_review_fixes_1030.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_session.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_sessions.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_sizing.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_slots.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_ssh_guard.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_steer.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_stream.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tab_bar_stability.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tab_restore_0337.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tabs.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_terminal_ux_0336.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_thread.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tier_invalidation.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tier_store.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_todo_panel.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tokens.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tools_eol_cancel_1030.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tools_vision_websearch.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tui.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_tui_hardening.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_update.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_update_badge_0340.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_urlopen.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_version.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_version_badge_corner.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_wallet.py +0 -0
- {webbee-0.7.16 → webbee-0.7.17}/tests/test_worktrees.py +0 -0
|
@@ -12,6 +12,15 @@ on:
|
|
|
12
12
|
default: "main"
|
|
13
13
|
push:
|
|
14
14
|
branches: ["os-check"]
|
|
15
|
+
# the release gate: imperal-mcp's release.yml and webbee's publish.yml call this before any PyPI upload
|
|
16
|
+
workflow_call:
|
|
17
|
+
inputs:
|
|
18
|
+
webbee_ref:
|
|
19
|
+
type: string
|
|
20
|
+
default: "main"
|
|
21
|
+
mcp_ref:
|
|
22
|
+
type: string
|
|
23
|
+
default: "main"
|
|
15
24
|
|
|
16
25
|
jobs:
|
|
17
26
|
check:
|
|
@@ -27,11 +36,13 @@ jobs:
|
|
|
27
36
|
steps:
|
|
28
37
|
- uses: actions/checkout@v4
|
|
29
38
|
with:
|
|
39
|
+
repository: imperalcloud/webbee-code
|
|
40
|
+
ref: ${{ inputs.webbee_ref || github.sha }}
|
|
30
41
|
path: webbee
|
|
31
42
|
- uses: actions/checkout@v4
|
|
32
43
|
with:
|
|
33
44
|
repository: imperalcloud/imperal-mcp
|
|
34
|
-
ref: ${{ github.event.inputs.mcp_ref || 'os-check' }}
|
|
45
|
+
ref: ${{ inputs.mcp_ref || github.event.inputs.mcp_ref || 'os-check' }}
|
|
35
46
|
path: mcp
|
|
36
47
|
- uses: actions/setup-python@v5
|
|
37
48
|
with:
|
|
@@ -44,7 +55,7 @@ jobs:
|
|
|
44
55
|
ls wheels
|
|
45
56
|
- name: install (pip) with the test tools
|
|
46
57
|
shell: bash
|
|
47
|
-
run: python -m pip install --find-links wheels "webbee" "imperal-mcp[code]" pytest pytest-asyncio respx
|
|
58
|
+
run: python -m pip install --find-links wheels "webbee" "imperal-mcp[code]" pytest pytest-asyncio respx mcp
|
|
48
59
|
- name: webbee tests that depend on the system
|
|
49
60
|
shell: bash
|
|
50
61
|
working-directory: webbee
|
|
@@ -58,6 +69,18 @@ jobs:
|
|
|
58
69
|
if: ${{ !cancelled() }} # every check runs: one failure never hides the others
|
|
59
70
|
shell: bash
|
|
60
71
|
run: python webbee/ci/os_check.py
|
|
72
|
+
- name: field gate (ICNLI conformance, no account) -- every field-report item against the wheels above
|
|
73
|
+
if: ${{ !cancelled() }} # every check runs: one failure never hides the others
|
|
74
|
+
shell: bash
|
|
75
|
+
working-directory: webbee
|
|
76
|
+
run: python -m ci.field_gate.run --json "../field-gate-${{ matrix.os }}-${{ matrix.python }}.json"
|
|
77
|
+
- name: field gate results
|
|
78
|
+
if: ${{ !cancelled() }}
|
|
79
|
+
uses: actions/upload-artifact@v4
|
|
80
|
+
with:
|
|
81
|
+
name: field-gate-${{ matrix.os }}-${{ matrix.python }}
|
|
82
|
+
path: field-gate-*.json
|
|
83
|
+
if-no-files-found: ignore
|
|
61
84
|
- name: install by pipx
|
|
62
85
|
if: ${{ !cancelled() }} # every check runs: one failure never hides the others
|
|
63
86
|
shell: bash
|
|
@@ -11,7 +11,14 @@ on:
|
|
|
11
11
|
tags: ["v*"]
|
|
12
12
|
|
|
13
13
|
jobs:
|
|
14
|
+
# nothing reaches PyPI before the field gate passes on every system (ICNLI §13.5: verified, not self-declared)
|
|
15
|
+
gate:
|
|
16
|
+
uses: ./.github/workflows/os-check.yml
|
|
17
|
+
with:
|
|
18
|
+
webbee_ref: ${{ github.sha }}
|
|
19
|
+
mcp_ref: main
|
|
14
20
|
publish:
|
|
21
|
+
needs: gate
|
|
15
22
|
runs-on: ubuntu-latest
|
|
16
23
|
permissions:
|
|
17
24
|
contents: write # create the GitHub Release for the tag
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.17
|
|
4
|
+
|
|
5
|
+
* Needs imperal-mcp 0.9.20 and imperal-sdk 6.7.1 (the truth architecture, spec 2026-11-14).
|
|
6
|
+
* `webbee --once "task"`: one headless turn -- the result and its events on stdout, an exit code.
|
|
7
|
+
* Tools under the one contract's names (`checkpoint_diff`, `checkpoint_rollback`, `grep_code`, `check_syntax`); `root`
|
|
8
|
+
works for every code tool (a subfolder's own index); a checkpoint belongs to its folder.
|
|
9
|
+
* read_file honours offset/limit on any file; a secret file is shown by its form -- keys with every value masked, key
|
|
10
|
+
material as its line count.
|
|
11
|
+
* grep_code: a bad pattern is a clear error; one local search with imperal-mcp.
|
|
12
|
+
* bash runs in bash where there is one (on Debian/Ubuntu /bin/sh is dash: `${PIPESTATUS[0]}` failed); on Windows
|
|
13
|
+
in Git for Windows' bash when it is installed (never WSL's), else cmd.exe as before.
|
|
14
|
+
* Checkpoints are the files' bytes: no line-ending conversion whatever `core.autocrlf` says (a rolled-back file
|
|
15
|
+
came back with CRLF on Windows).
|
|
16
|
+
* A checkpoint id of digits only (a short commit id with no letter, ~4% of them) is found, never read as cp-N.
|
|
17
|
+
* Lines counted by the SDK (`wc -l`).
|
|
18
|
+
* No embedder on the client (model2vec and numpy left): the vault embeds with one multilingual model.
|
|
19
|
+
* The index cache: one folder per repository (`~/.cache/webbee/index`); the old `~/.cache/webbee/intel` is removed
|
|
20
|
+
once and each repository indexed again once.
|
|
21
|
+
* On exit the code-sync thread stops.
|
|
22
|
+
|
|
3
23
|
## 0.7.16
|
|
4
24
|
|
|
5
25
|
* Needs imperal-mcp 0.9.19 (Windows sign-in fixes).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: webbee
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.17
|
|
4
4
|
Summary: Webbee 🐝 — the Imperal Cloud coding agent in your terminal
|
|
5
5
|
Project-URL: Homepage, https://imperal.io
|
|
6
6
|
Project-URL: Documentation, https://docs.imperal.io
|
|
@@ -31,10 +31,8 @@ Requires-Python: >=3.7
|
|
|
31
31
|
Requires-Dist: asyncssh>=2.14; python_version >= '3.10'
|
|
32
32
|
Requires-Dist: httpx-sse>=0.4; python_version >= '3.10'
|
|
33
33
|
Requires-Dist: httpx>=0.27; python_version >= '3.10'
|
|
34
|
-
Requires-Dist: imperal-mcp>=0.9.
|
|
35
|
-
Requires-Dist: imperal-sdk[universal-index]>=6.
|
|
36
|
-
Requires-Dist: model2vec>=0.8.2; python_version >= '3.10' and (sys_platform != 'darwin' or platform_machine != 'x86_64' or python_version < '3.13')
|
|
37
|
-
Requires-Dist: numpy>=2; python_version >= '3.10' and (sys_platform != 'darwin' or platform_machine != 'x86_64' or python_version < '3.13')
|
|
34
|
+
Requires-Dist: imperal-mcp>=0.9.20; python_version >= '3.10'
|
|
35
|
+
Requires-Dist: imperal-sdk[universal-index]>=6.7.1; python_version >= '3.10'
|
|
38
36
|
Requires-Dist: prompt-toolkit>=3; python_version >= '3.10'
|
|
39
37
|
Requires-Dist: rich>=13.7; python_version >= '3.10'
|
|
40
38
|
Requires-Dist: tree-sitter-javascript>=0.23; python_version >= '3.10' and (sys_platform != 'darwin' or platform_machine != 'x86_64' or python_version < '3.13')
|
|
@@ -46,11 +44,7 @@ Requires-Dist: watchfiles>=0.24; python_version >= '3.10' and (sys_platform != '
|
|
|
46
44
|
Provides-Extra: intel
|
|
47
45
|
Provides-Extra: intel-embed
|
|
48
46
|
Provides-Extra: intel-embed-faiss
|
|
49
|
-
Requires-Dist: faiss-cpu>=1.14.3; extra == 'intel-embed-faiss'
|
|
50
|
-
Requires-Dist: numpy>=2; extra == 'intel-embed-faiss'
|
|
51
47
|
Provides-Extra: intel-embed-onnx
|
|
52
|
-
Requires-Dist: fastembed>=0.8.0; extra == 'intel-embed-onnx'
|
|
53
|
-
Requires-Dist: numpy>=2; extra == 'intel-embed-onnx'
|
|
54
48
|
Description-Content-Type: text/markdown
|
|
55
49
|
|
|
56
50
|
# Webbee 🐝 — The Open-Source ICNLI Coding Agent
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"""The three doors the field gate goes through -- always the installed products, never a re-assembly of their parts.
|
|
2
|
+
|
|
3
|
+
- McpDriver: launches the installed `imperal-mcp` console script and talks MCP over stdio, as Claude Code does.
|
|
4
|
+
- WebbeeDriver: webbee's own workspace boot (boot.boot_workspace) and executor (LocalToolExecutor), as session.py
|
|
5
|
+
builds them for every turn.
|
|
6
|
+
- hook(): `imperal-mcp hook <event>` with the shell's JSON on stdin, as Claude Code runs its hooks.
|
|
7
|
+
|
|
8
|
+
Each driver gets its own HOME, so a run never reads the machine's caches, credentials or spool.
|
|
9
|
+
"""
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import asyncio
|
|
13
|
+
import json
|
|
14
|
+
import os
|
|
15
|
+
import shutil
|
|
16
|
+
import subprocess
|
|
17
|
+
from contextlib import AsyncExitStack
|
|
18
|
+
from pathlib import Path
|
|
19
|
+
|
|
20
|
+
CALL_TIMEOUT_S = 120
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class GateError(RuntimeError):
|
|
24
|
+
"""A driver could not reach the product: the gate stops loudly, never records it as a pass."""
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _home_env(home: Path, token: str | None = None) -> dict:
|
|
28
|
+
home.mkdir(parents=True, exist_ok=True)
|
|
29
|
+
env = {**os.environ, "HOME": str(home), "USERPROFILE": str(home), "WEBBEE_NO_AUTOUPDATE": "1",
|
|
30
|
+
"IMPERAL_INTEL_CACHE_DIR": str(home / ".cache" / "webbee" / "intel"), "PYTHONUTF8": "1"}
|
|
31
|
+
env.pop("IMPERAL_TOKEN", None)
|
|
32
|
+
if token:
|
|
33
|
+
env["IMPERAL_TOKEN"] = token
|
|
34
|
+
return env
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def console(name: str) -> str:
|
|
38
|
+
"""The console script of the Python running the gate first -- the packages under test -- then PATH (2026-11-15:
|
|
39
|
+
PATH found the user's own ~/.local/bin/imperal-mcp, a released version, and the gate judged that one)."""
|
|
40
|
+
import sys
|
|
41
|
+
here = Path(sys.executable).parent
|
|
42
|
+
for cand in (here / name, here / f"{name}.exe", here / "Scripts" / f"{name}.exe"):
|
|
43
|
+
if cand.is_file():
|
|
44
|
+
return str(cand)
|
|
45
|
+
found = shutil.which(name)
|
|
46
|
+
if not found:
|
|
47
|
+
raise GateError(f"the installed `{name}` console script is not on PATH")
|
|
48
|
+
return found
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class McpDriver:
|
|
52
|
+
def __init__(self, root: Path, home: Path, token: str | None = None):
|
|
53
|
+
self.root, self.home, self.token = Path(root), Path(home), token
|
|
54
|
+
self._stack: AsyncExitStack | None = None
|
|
55
|
+
self._session = None
|
|
56
|
+
|
|
57
|
+
async def __aenter__(self) -> "McpDriver":
|
|
58
|
+
from mcp import ClientSession, StdioServerParameters
|
|
59
|
+
from mcp.client.stdio import stdio_client
|
|
60
|
+
params = StdioServerParameters(command=console("imperal-mcp"), args=[], cwd=str(self.root),
|
|
61
|
+
env=_home_env(self.home, self.token))
|
|
62
|
+
self._stack = AsyncExitStack()
|
|
63
|
+
try:
|
|
64
|
+
read, write = await self._stack.enter_async_context(stdio_client(params))
|
|
65
|
+
self._session = await self._stack.enter_async_context(ClientSession(read, write))
|
|
66
|
+
await asyncio.wait_for(self._session.initialize(), CALL_TIMEOUT_S)
|
|
67
|
+
except Exception as exc:
|
|
68
|
+
await self._stack.aclose()
|
|
69
|
+
raise GateError(f"imperal-mcp did not start over stdio: {type(exc).__name__}: {exc}") from exc
|
|
70
|
+
return self
|
|
71
|
+
|
|
72
|
+
async def __aexit__(self, *exc) -> None:
|
|
73
|
+
if self._stack is not None:
|
|
74
|
+
await self._stack.aclose()
|
|
75
|
+
|
|
76
|
+
async def list_tools(self) -> list[str]:
|
|
77
|
+
res = await asyncio.wait_for(self._session.list_tools(), CALL_TIMEOUT_S)
|
|
78
|
+
return [t.name for t in res.tools]
|
|
79
|
+
|
|
80
|
+
async def call(self, tool: str, args: dict) -> dict:
|
|
81
|
+
res = await asyncio.wait_for(self._session.call_tool(tool, args), CALL_TIMEOUT_S)
|
|
82
|
+
text = "\n".join(getattr(c, "text", "") for c in res.content)
|
|
83
|
+
data = None
|
|
84
|
+
try:
|
|
85
|
+
data = json.loads(text)
|
|
86
|
+
except (ValueError, TypeError):
|
|
87
|
+
pass
|
|
88
|
+
return {"ok": not res.isError, "text": text, "data": data if isinstance(data, dict) else None}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class WebbeeDriver:
|
|
92
|
+
def __init__(self, root: Path, home: Path):
|
|
93
|
+
self.root, self.home = Path(root), Path(home)
|
|
94
|
+
self._bundle: dict | None = None
|
|
95
|
+
self._executor = None
|
|
96
|
+
self._saved_env: dict | None = None
|
|
97
|
+
|
|
98
|
+
async def __aenter__(self) -> "WebbeeDriver":
|
|
99
|
+
self._saved_env = dict(os.environ)
|
|
100
|
+
env = _home_env(self.home) # built from the current environment BEFORE it is replaced
|
|
101
|
+
os.environ.clear()
|
|
102
|
+
os.environ.update(env)
|
|
103
|
+
from imperal_mcp import auth
|
|
104
|
+
from webbee import boot
|
|
105
|
+
from webbee.config import Config
|
|
106
|
+
from webbee.session import AgentSession
|
|
107
|
+
from webbee.tokens import make_token_provider
|
|
108
|
+
from webbee.tools import LocalToolExecutor
|
|
109
|
+
cfg = Config.from_env()
|
|
110
|
+
self._bundle = await boot.boot_workspace(cfg, str(self.root), None, None)
|
|
111
|
+
# as session.py builds it for every turn: the same intel, shadow and cloud client (the vault graph needs it)
|
|
112
|
+
session = AgentSession(cfg, make_token_provider(cfg, auth), str(self.root), "default",
|
|
113
|
+
intel=self._bundle["intel"], shadow=self._bundle["shadow"])
|
|
114
|
+
self._executor = LocalToolExecutor(str(self.root), indexer=self._bundle["intel"],
|
|
115
|
+
shadow=self._bundle["shadow"],
|
|
116
|
+
client_factory=session._file_client_factory())
|
|
117
|
+
return self
|
|
118
|
+
|
|
119
|
+
async def __aexit__(self, *exc) -> None:
|
|
120
|
+
task = (self._bundle or {}).get("watcher_task")
|
|
121
|
+
if task is not None:
|
|
122
|
+
task.cancel()
|
|
123
|
+
intel = (self._bundle or {}).get("intel")
|
|
124
|
+
if intel is not None and hasattr(intel, "close"):
|
|
125
|
+
# as webbee quits: its code sync ends while this loop still runs (a sync left behind was cancelled
|
|
126
|
+
# mid-request and printed a traceback after the last scenario, 2026-11-15)
|
|
127
|
+
await asyncio.to_thread(intel.close)
|
|
128
|
+
if self._saved_env is not None:
|
|
129
|
+
os.environ.clear()
|
|
130
|
+
os.environ.update(self._saved_env)
|
|
131
|
+
|
|
132
|
+
async def run(self, tool: str, args: dict) -> dict:
|
|
133
|
+
return await asyncio.wait_for(asyncio.to_thread(self._executor.run, tool, args), CALL_TIMEOUT_S)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
def hook(event: str, payload: dict, home: Path, token: str | None = None) -> dict:
|
|
137
|
+
proc = subprocess.run([console("imperal-mcp"), "hook", event], input=json.dumps(payload),
|
|
138
|
+
capture_output=True, text=True, timeout=CALL_TIMEOUT_S,
|
|
139
|
+
cwd=payload.get("cwd") or None, env=_home_env(Path(home), token))
|
|
140
|
+
out = None
|
|
141
|
+
try:
|
|
142
|
+
out = json.loads(proc.stdout) if proc.stdout.strip() else None
|
|
143
|
+
except ValueError:
|
|
144
|
+
pass
|
|
145
|
+
return {"code": proc.returncode, "stdout": proc.stdout, "stderr": proc.stderr, "json": out}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""The field-gate workspace: a folder of git repos shaped like the ones the field tests broke on, and the truth about it.
|
|
2
|
+
|
|
3
|
+
Ignat's wpanel (reports 2026-11-13/14): the root is no repo, nested repos under it, one repo name prefixing another
|
|
4
|
+
(`wpanel/` duplicates), a package re-export, Russian docstrings, TS arrow functions inside a component, a route under a
|
|
5
|
+
project's own decorator, files with and without a final newline, CRLF, a big file, a secret file and a token in a git
|
|
6
|
+
remote. The truth is computed here from bytes and git, once; a scenario compares a product's answer with it and never
|
|
7
|
+
recomputes anything a product computes.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import os
|
|
12
|
+
import subprocess
|
|
13
|
+
from collections.abc import Mapping
|
|
14
|
+
from dataclasses import dataclass, field
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
# planted fakes: a scenario fails if any of them shows up in a tool's output
|
|
18
|
+
FAKE_ENV_TOKEN = "gate_fake_7f3a9c"
|
|
19
|
+
FAKE_REMOTE_TOKEN = "ghp_FAKEgate000000000000000000000000000"
|
|
20
|
+
|
|
21
|
+
_GIT_ENV = {
|
|
22
|
+
"GIT_AUTHOR_NAME": "Field Gate", "GIT_AUTHOR_EMAIL": "gate@imperal.invalid",
|
|
23
|
+
"GIT_COMMITTER_NAME": "Field Gate", "GIT_COMMITTER_EMAIL": "gate@imperal.invalid",
|
|
24
|
+
"GIT_AUTHOR_DATE": "2026-11-14T12:00:00+00:00", "GIT_COMMITTER_DATE": "2026-11-14T12:00:00+00:00",
|
|
25
|
+
"GIT_CONFIG_GLOBAL": os.devnull, "GIT_CONFIG_NOSYSTEM": "1",
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass(frozen=True)
|
|
30
|
+
class Place:
|
|
31
|
+
path: str # relative to the fixture root
|
|
32
|
+
symbol: str = ""
|
|
33
|
+
text: str = ""
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass(frozen=True)
|
|
37
|
+
class Reexport:
|
|
38
|
+
symbol: str
|
|
39
|
+
defined_path: str
|
|
40
|
+
reexport_path: str
|
|
41
|
+
caller_path: str
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass
|
|
45
|
+
class Truth:
|
|
46
|
+
lines: dict[str, int] = field(default_factory=dict) # root-relative path -> lines as an editor counts
|
|
47
|
+
git_files: dict[str, list[str]] = field(default_factory=dict)
|
|
48
|
+
heads: dict[str, str] = field(default_factory=dict)
|
|
49
|
+
secrets: list[str] = field(default_factory=list)
|
|
50
|
+
reexport: Reexport | None = None
|
|
51
|
+
ru_doc: Place | None = None
|
|
52
|
+
nested_ts: Place | None = None
|
|
53
|
+
door_route: Place | None = None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass
|
|
57
|
+
class Fixture:
|
|
58
|
+
root: Path
|
|
59
|
+
repos: dict[str, Path]
|
|
60
|
+
truth: Truth
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _lines_of(data: bytes) -> int:
|
|
64
|
+
"""Lines as an editor counts them: `wc -l` plus one for a last line with no newline."""
|
|
65
|
+
return data.count(b"\n") + (1 if data and not data.endswith(b"\n") else 0)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def _write(path: Path, data: str | bytes) -> None:
|
|
69
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
70
|
+
path.write_bytes(data if isinstance(data, bytes) else data.encode("utf-8"))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _git(repo: Path, *args: str) -> str:
|
|
74
|
+
return subprocess.run(["git", "-C", str(repo), *args], capture_output=True, text=True, check=True,
|
|
75
|
+
env={**os.environ, **_GIT_ENV}).stdout.strip()
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _commit_repo(repo: Path, files: Mapping[str, str | bytes], remote: str = "") -> None:
|
|
79
|
+
for rel, data in files.items():
|
|
80
|
+
_write(repo / rel, data)
|
|
81
|
+
_git(repo, "init", "-q", "-b", "main")
|
|
82
|
+
_git(repo, "config", "core.autocrlf", "false")
|
|
83
|
+
if remote:
|
|
84
|
+
_git(repo, "remote", "add", "origin", remote)
|
|
85
|
+
_git(repo, "add", "-A")
|
|
86
|
+
_git(repo, "commit", "-q", "-m", "fixture")
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
_RU_DOC = "Сверяет права доступа сессии с версией политики и сохраняет сессию."
|
|
90
|
+
|
|
91
|
+
_APP = {
|
|
92
|
+
"app/__init__.py": "",
|
|
93
|
+
"app/use.py": "from lib_sdk import Emitter\n\n\ndef run():\n return Emitter().emit(\"ready\")\n",
|
|
94
|
+
"web/Form.tsx": (
|
|
95
|
+
"export function Form() {\n"
|
|
96
|
+
" const handleSubmit = (event: Event) => {\n"
|
|
97
|
+
" event.preventDefault();\n"
|
|
98
|
+
" };\n"
|
|
99
|
+
" return <form onSubmit={handleSubmit} />;\n"
|
|
100
|
+
"}\n"
|
|
101
|
+
),
|
|
102
|
+
"mid.py": "".join(f"value_{i} = {i}\n" for i in range(1, 601)),
|
|
103
|
+
"no_nl.py": "a = 1\nb = 2",
|
|
104
|
+
"crlf.py": b"a = 1\r\nb = 2\r\n",
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
_GATEWAY = {
|
|
108
|
+
"gateway/__init__.py": "",
|
|
109
|
+
"gateway/authz.py": (
|
|
110
|
+
"def reconcile_authz(session, policy_version):\n"
|
|
111
|
+
f" \"\"\"{_RU_DOC}\"\"\"\n"
|
|
112
|
+
" if session.get(\"policy_version\") == policy_version:\n"
|
|
113
|
+
" session[\"authz\"] = True\n"
|
|
114
|
+
" return session\n"
|
|
115
|
+
),
|
|
116
|
+
"gateway/doors.py": (
|
|
117
|
+
"def door(path):\n"
|
|
118
|
+
" def wrap(fn):\n"
|
|
119
|
+
" fn.route = path\n"
|
|
120
|
+
" return fn\n"
|
|
121
|
+
" return wrap\n"
|
|
122
|
+
),
|
|
123
|
+
"gateway/routes.py": "from gateway.doors import door\n\n\n@door(\"/v1/x\")\nasync def get_x():\n return {\"x\": 1}\n",
|
|
124
|
+
"big.py": "".join(f"row_{i} = {i}\n" for i in range(1, 6002)),
|
|
125
|
+
".gitignore": ".env\n",
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
_LIB = {
|
|
129
|
+
"lib_sdk/__init__.py": "from .emit import Emitter\n\n__all__ = [\"Emitter\"]\n",
|
|
130
|
+
"lib_sdk/emit.py": "class Emitter:\n def emit(self, event):\n return event\n",
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def build_fixture(dest: Path) -> Fixture:
|
|
135
|
+
root = Path(dest)
|
|
136
|
+
root.mkdir(parents=True, exist_ok=False)
|
|
137
|
+
_write(root / "README.txt", "A folder of repositories; the folder itself is no repository.\n")
|
|
138
|
+
repos = {"app": root / "core" / "app", "app-gateway": root / "core" / "app-gateway", "lib-sdk": root / "lib-sdk"}
|
|
139
|
+
_commit_repo(repos["app"], _APP)
|
|
140
|
+
_commit_repo(repos["app-gateway"], _GATEWAY,
|
|
141
|
+
remote=f"https://gate:{FAKE_REMOTE_TOKEN}@example.invalid/app-gateway.git")
|
|
142
|
+
_write(repos["app-gateway"] / ".env", f"TOKEN={FAKE_ENV_TOKEN}\n") # on disk, ignored by git
|
|
143
|
+
_commit_repo(repos["lib-sdk"], _LIB)
|
|
144
|
+
|
|
145
|
+
truth = Truth(secrets=[FAKE_ENV_TOKEN, FAKE_REMOTE_TOKEN])
|
|
146
|
+
for name, repo in repos.items():
|
|
147
|
+
files = sorted(_git(repo, "ls-files").split())
|
|
148
|
+
truth.git_files[name] = files
|
|
149
|
+
truth.heads[name] = _git(repo, "rev-parse", "HEAD")
|
|
150
|
+
for rel in files:
|
|
151
|
+
full = repo / rel
|
|
152
|
+
truth.lines[full.relative_to(root).as_posix()] = _lines_of(full.read_bytes())
|
|
153
|
+
truth.reexport = Reexport("Emitter", "lib-sdk/lib_sdk/emit.py", "lib-sdk/lib_sdk/__init__.py", "core/app/app/use.py")
|
|
154
|
+
truth.ru_doc = Place("core/app-gateway/gateway/authz.py", "reconcile_authz", _RU_DOC)
|
|
155
|
+
truth.nested_ts = Place("core/app/web/Form.tsx", "handleSubmit")
|
|
156
|
+
truth.door_route = Place("core/app-gateway/gateway/routes.py", "get_x", "/v1/x")
|
|
157
|
+
return Fixture(root=root, repos=repos, truth=truth)
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"""Provision the field gate's test user through the gateway's own doors, and log it in under its own HOME.
|
|
2
|
+
|
|
3
|
+
python -m ci.field_gate.provision_user [--email gate@imperal.io] [--home ~/.imperal-gate]
|
|
4
|
+
|
|
5
|
+
Owner 2026-11-15: the gate uses one dedicated test user, always. The admin is whoever runs this, by their normal
|
|
6
|
+
imperal-mcp login (their ~/.imperal/credentials.json); nothing secret lives in this file. The user is created by the
|
|
7
|
+
admin door (POST /v1/users: audited, account-integrity signed -- never by SQL), logged in by POST /v1/auth/login, and
|
|
8
|
+
its tokens are written to <home>/.imperal/credentials.json in imperal-mcp's own format. The one-time password is
|
|
9
|
+
random and never stored: when the login ever lapses, run this again -- an existing user gets a new password through
|
|
10
|
+
the same admin door.
|
|
11
|
+
"""
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import argparse
|
|
15
|
+
import asyncio
|
|
16
|
+
import json
|
|
17
|
+
import os
|
|
18
|
+
import secrets
|
|
19
|
+
import sys
|
|
20
|
+
import time
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
DEFAULT_EMAIL = "gate@imperal.io"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
async def _admin_token() -> tuple:
|
|
27
|
+
from imperal_mcp.auth import ensure_access_token
|
|
28
|
+
from imperal_mcp.config import Config
|
|
29
|
+
cfg = Config.from_env()
|
|
30
|
+
return cfg, await ensure_access_token(cfg)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
async def register_developer(cli, api_url: str, access_token: str) -> None:
|
|
34
|
+
"""The app tools (list_apps, run_read_tool, deploy_ir) need a developer: the free tier, by the user's own door
|
|
35
|
+
(POST /v1/developer/register; explorer costs 0). Already registered is fine."""
|
|
36
|
+
r = await cli.post(f"{api_url}/v1/developer/register", json={"tier": "explorer", "nickname": "field-gate"},
|
|
37
|
+
headers={"Authorization": f"Bearer {access_token}"})
|
|
38
|
+
if r.status_code >= 400 and "already" not in r.text.lower():
|
|
39
|
+
r.raise_for_status()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
async def provision(email: str, home: Path) -> str:
|
|
43
|
+
import httpx
|
|
44
|
+
cfg, admin = await _admin_token()
|
|
45
|
+
password = secrets.token_urlsafe(32)
|
|
46
|
+
head = {"Authorization": f"Bearer {admin}"}
|
|
47
|
+
async with httpx.AsyncClient(timeout=30) as cli:
|
|
48
|
+
made = await cli.post(f"{cfg.api_url}/v1/users", headers=head,
|
|
49
|
+
json={"email": email, "password": password, "role": "user",
|
|
50
|
+
"attributes": {"email_verified": True, "purpose": "field-gate test user"}})
|
|
51
|
+
if made.status_code == 409:
|
|
52
|
+
found = await cli.get(f"{cfg.api_url}/v1/users", headers=head, params={"search": email, "limit": 5})
|
|
53
|
+
found.raise_for_status()
|
|
54
|
+
user = next((u for u in found.json().get("items", []) if u.get("email") == email), None)
|
|
55
|
+
if user is None:
|
|
56
|
+
raise SystemExit(f"{email} exists but the admin list does not show it")
|
|
57
|
+
# the admin door has no password field: deactivate, then create again -- POST /v1/users reactivates an
|
|
58
|
+
# inactive user with the new password (users/router.py create_user, the "existing" branch)
|
|
59
|
+
off = await cli.patch(f"{cfg.api_url}/v1/users/{user['imperal_id']}", headers=head,
|
|
60
|
+
json={"is_active": False})
|
|
61
|
+
off.raise_for_status()
|
|
62
|
+
again = await cli.post(f"{cfg.api_url}/v1/users", headers=head,
|
|
63
|
+
json={"email": email, "password": password, "role": "user"})
|
|
64
|
+
again.raise_for_status()
|
|
65
|
+
else:
|
|
66
|
+
made.raise_for_status()
|
|
67
|
+
tok = await cli.post(f"{cfg.api_url}/v1/auth/login", json={"email": email, "password": password})
|
|
68
|
+
tok.raise_for_status()
|
|
69
|
+
t = tok.json()
|
|
70
|
+
await register_developer(cli, cfg.api_url, t["access_token"])
|
|
71
|
+
creds_dir = home / ".imperal"
|
|
72
|
+
creds_dir.mkdir(mode=0o700, parents=True, exist_ok=True)
|
|
73
|
+
os.chmod(creds_dir, 0o700)
|
|
74
|
+
path = creds_dir / "credentials.json"
|
|
75
|
+
path.write_text(json.dumps({"access_token": t["access_token"], "refresh_token": t["refresh_token"],
|
|
76
|
+
"access_expires_at": time.time() + int(t.get("expires_in", 900))}))
|
|
77
|
+
os.chmod(path, 0o600)
|
|
78
|
+
return str(path)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def main() -> None:
|
|
82
|
+
p = argparse.ArgumentParser(description=__doc__.splitlines()[0])
|
|
83
|
+
p.add_argument("--email", default=DEFAULT_EMAIL)
|
|
84
|
+
p.add_argument("--home", default=str(Path.home() / ".imperal-gate"))
|
|
85
|
+
a = p.parse_args()
|
|
86
|
+
print(asyncio.run(provision(a.email, Path(a.home).expanduser())))
|
|
87
|
+
sys.exit(0)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
if __name__ == "__main__":
|
|
91
|
+
main()
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"""The scenario registry: every field-report item maps to a scenario, a "not a bug" ruling, or an account-only scenario.
|
|
2
|
+
|
|
3
|
+
ITEMS names each item by report and number (summary only: the reports themselves stay with the team). A scenario
|
|
4
|
+
compares a product's answer with the fixture's truth; the coverage test keeps ITEMS and SCENARIOS in step.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import json
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
from typing import Any, Awaitable, Callable
|
|
11
|
+
|
|
12
|
+
# report 1 (2026-11-13, imperal-mcp 0.9.14) section 1, items 1-19; report 3 (2026-11-14 evening, 0.9.19) table
|
|
13
|
+
ITEMS: dict[str, str] = {
|
|
14
|
+
"R1-1": "search_code misses TS arrow functions declared inside a function or component",
|
|
15
|
+
"R1-2": "Russian query gives unrelated results marked strong",
|
|
16
|
+
"R1-3": "folder-root code map stale; frame shows an old HEAD",
|
|
17
|
+
"R1-4": "stop hook calls proven claims unchecked",
|
|
18
|
+
"R1-5": "contract_slice misses routes under a project's own decorator; duplicates by repo copies",
|
|
19
|
+
"R1-6": "relative or missing root silently replaced by the folder root",
|
|
20
|
+
"R1-7": "impact_of_change does not count an import as a use",
|
|
21
|
+
"R1-8": "remember_fact loses scope",
|
|
22
|
+
"R1-9": "save_repo_note then recall_context by its own words finds nothing",
|
|
23
|
+
"R1-10": "validate_ir and smoke_ir disagree on a step; smoke raw KeyError",
|
|
24
|
+
"R1-11": "run_read_tool with an unknown tool says read-only instead of no such tool",
|
|
25
|
+
"R1-12": "upload_file returns document_id null",
|
|
26
|
+
"R1-13": "smoke_ir read function with no steps says verified_write true",
|
|
27
|
+
"R1-14": "webbee read_file ignores offset/limit",
|
|
28
|
+
"R1-15": "webbee bash exit code",
|
|
29
|
+
"R1-16": "token_savings shows only output size, no saving",
|
|
30
|
+
"R1-17": "grep_code bad regex gives a raw engine error",
|
|
31
|
+
"R1-18": "output size: frame a screen per turn, graph_slice ~38 KB, live_sessions 13.5 KB",
|
|
32
|
+
"R1-19": "webbee self-report softer than its own call records",
|
|
33
|
+
"R3-Н3": "outline/read_symbol one line more than wc -l",
|
|
34
|
+
"R3-П7": "impact_of_change: re-export not counted; duplicates under a second prefix with other lines",
|
|
35
|
+
"R3-Н2": "search_code from the root during a sync: no synced copy / still indexing / 0 results",
|
|
36
|
+
"R3-П2": "Russian search: semantic off",
|
|
37
|
+
"R3-orient": "orient from the root: all results strong, unrelated best_match",
|
|
38
|
+
"R3-Н4": "checkpoint_diff with a missing target silently replaced",
|
|
39
|
+
"R3-Н8": "state_lens(focus) does not filter",
|
|
40
|
+
"R3-П14": "webbee read_file offset/limit not applied",
|
|
41
|
+
"R3-ckpt-root": "webbee checkpoint has no root: snapshot of the whole folder",
|
|
42
|
+
"R3-Н15": "webbee bash runs /bin/sh (dash): PIPESTATUS bad substitution",
|
|
43
|
+
"R3-П4": "stop hook: false refusals (withheld by command words, cut copies, frame/HEAD/pasted text not facts, empty grep)",
|
|
44
|
+
"R3-Н5": "frame: STALE code map, 0 steps mid-work, NOT moving, plan item open after a commit",
|
|
45
|
+
"R3-П6": "repo_profile relative / missing root",
|
|
46
|
+
"R3-П17": "grep_code bad regex",
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@dataclass(frozen=True)
|
|
50
|
+
class Outcome:
|
|
51
|
+
ok: bool
|
|
52
|
+
expected: str
|
|
53
|
+
got: str
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass
|
|
57
|
+
class Ctx:
|
|
58
|
+
fixture: Any
|
|
59
|
+
shell: str # "mcp" or "webbee"
|
|
60
|
+
mcp: Any = None
|
|
61
|
+
webbee: Any = None
|
|
62
|
+
home: Any = None # the HOME the shell runs with (the test user's credentials with --account)
|
|
63
|
+
|
|
64
|
+
async def call(self, tool: str, args: dict):
|
|
65
|
+
"""One capability in the shell under test -- one name and one argument set for both shells (the SDK contract,
|
|
66
|
+
ICNLI 3.5); a shell that needs another name for it fails the gate."""
|
|
67
|
+
if self.shell == "mcp":
|
|
68
|
+
return await self.mcp.call(tool, args)
|
|
69
|
+
return await self.webbee.run(tool, args)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@dataclass(frozen=True)
|
|
73
|
+
class Scenario:
|
|
74
|
+
id: str
|
|
75
|
+
items: tuple[str, ...]
|
|
76
|
+
shells: tuple[str, ...]
|
|
77
|
+
run: Callable[[Ctx], Awaitable[Outcome]]
|
|
78
|
+
account: bool = False
|
|
79
|
+
mutates: bool = False # changes the fixture: runs after every read-only scenario
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
SCENARIOS: list[Scenario] = []
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
def scenario(id: str, items: tuple[str, ...], shells: tuple[str, ...] = ("mcp", "webbee"),
|
|
86
|
+
account: bool = False, mutates: bool = False):
|
|
87
|
+
unknown = [i for i in items if i not in ITEMS]
|
|
88
|
+
if unknown:
|
|
89
|
+
raise ValueError(f"scenario {id} names unknown items {unknown}")
|
|
90
|
+
|
|
91
|
+
def wrap(fn):
|
|
92
|
+
SCENARIOS.append(Scenario(id, items, shells, fn, account, mutates))
|
|
93
|
+
return fn
|
|
94
|
+
return wrap
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def text_of(out: Any) -> str:
|
|
98
|
+
"""The text a shell handed back: mcp's tool text, webbee's content (or the whole result when it has none)."""
|
|
99
|
+
if isinstance(out, dict):
|
|
100
|
+
if "text" in out and "ok" in out and set(out) <= {"ok", "text", "data"}:
|
|
101
|
+
return out["text"]
|
|
102
|
+
if "content" in out:
|
|
103
|
+
return str(out["content"])
|
|
104
|
+
return json.dumps(out, ensure_ascii=False)
|
|
105
|
+
return str(out)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def data_of(out: Any) -> dict:
|
|
109
|
+
"""mcp's parsed JSON answer, or webbee's result dict."""
|
|
110
|
+
if isinstance(out, dict) and set(out) <= {"ok", "text", "data"} and "text" in out:
|
|
111
|
+
return out.get("data") or {}
|
|
112
|
+
return out if isinstance(out, dict) else {}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def failed(out: Any) -> bool:
|
|
116
|
+
"""A refusal or error in either shell's own terms."""
|
|
117
|
+
d = data_of(out)
|
|
118
|
+
if isinstance(out, dict) and out.get("ok") is False:
|
|
119
|
+
return True
|
|
120
|
+
return d.get("status") == "error" or d.get("ok") is False or bool(d.get("error"))
|