roksta 0.2.7__cp313-cp313-macosx_10_13_universal2.whl → 0.3.2__cp313-cp313-macosx_10_13_universal2.whl

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.

Potentially problematic release.


This version of roksta might be problematic. Click here for more details.

Files changed (91) hide show
  1. roksta/ai/call_ai.cpython-313-darwin.so +0 -0
  2. roksta/ai/gemini.cpython-313-darwin.so +0 -0
  3. roksta/ai/generic.cpython-313-darwin.so +0 -0
  4. roksta/ai/llm.cpython-313-darwin.so +0 -0
  5. roksta/ai/openai.cpython-313-darwin.so +0 -0
  6. roksta/ai/tools/__init__.cpython-313-darwin.so +0 -0
  7. roksta/ai/tools/delete_file.cpython-313-darwin.so +0 -0
  8. roksta/ai/tools/edit_file.cpython-313-darwin.so +0 -0
  9. roksta/ai/tools/final_response.cpython-313-darwin.so +0 -0
  10. roksta/ai/tools/get_file_summaries.cpython-313-darwin.so +0 -0
  11. roksta/ai/tools/read_file.cpython-313-darwin.so +0 -0
  12. roksta/ai/tools/regex_replace.cpython-313-darwin.so +0 -0
  13. roksta/ai/tools/shell_any.cpython-313-darwin.so +0 -0
  14. roksta/ai/tools/shell_limited.cpython-313-darwin.so +0 -0
  15. roksta/ai/tools/tool_defs.cpython-313-darwin.so +0 -0
  16. roksta/ai/tools/tool_utils.cpython-313-darwin.so +0 -0
  17. roksta/ai/tools/write_file.cpython-313-darwin.so +0 -0
  18. roksta/balance.cpython-313-darwin.so +0 -0
  19. roksta/check_for_updates.cpython-313-darwin.so +0 -0
  20. roksta/clarify_goal.cpython-313-darwin.so +0 -0
  21. roksta/command_handlers/__init__.cpython-313-darwin.so +0 -0
  22. roksta/command_handlers/handle_activate_command.cpython-313-darwin.so +0 -0
  23. roksta/command_handlers/handle_add_funds_command.cpython-313-darwin.so +0 -0
  24. roksta/command_handlers/handle_auto_charge_command.cpython-313-darwin.so +0 -0
  25. roksta/command_handlers/handle_auto_commit_command.cpython-313-darwin.so +0 -0
  26. roksta/command_handlers/handle_building_command.cpython-313-darwin.so +0 -0
  27. roksta/command_handlers/handle_chat_command.cpython-313-darwin.so +0 -0
  28. roksta/command_handlers/handle_dev_rate_command.cpython-313-darwin.so +0 -0
  29. roksta/command_handlers/handle_feedback_command.cpython-313-darwin.so +0 -0
  30. roksta/command_handlers/handle_goal_command.cpython-313-darwin.so +0 -0
  31. roksta/command_handlers/handle_help_command.cpython-313-darwin.so +0 -0
  32. roksta/command_handlers/handle_init_command.cpython-313-darwin.so +0 -0
  33. roksta/command_handlers/handle_linting_command.cpython-313-darwin.so +0 -0
  34. roksta/command_handlers/handle_login_command.cpython-313-darwin.so +0 -0
  35. roksta/command_handlers/handle_logout_command.cpython-313-darwin.so +0 -0
  36. roksta/command_handlers/handle_payment_details_command.cpython-313-darwin.so +0 -0
  37. roksta/command_handlers/handle_quit_command.cpython-313-darwin.so +0 -0
  38. roksta/command_handlers/handle_redeem_command.cpython-313-darwin.so +0 -0
  39. roksta/command_handlers/handle_request_activation_command.cpython-313-darwin.so +0 -0
  40. roksta/command_handlers/handle_testing_command.cpython-313-darwin.so +0 -0
  41. roksta/command_handlers/handle_usage_command.cpython-313-darwin.so +0 -0
  42. roksta/create_default_config.cpython-313-darwin.so +0 -0
  43. roksta/env.cpython-313-darwin.so +0 -0
  44. roksta/extended_text_area.cpython-313-darwin.so +0 -0
  45. roksta/firebase.cpython-313-darwin.so +0 -0
  46. roksta/fix_tests.cpython-313-darwin.so +0 -0
  47. roksta/goal_workflow.cpython-313-darwin.so +0 -0
  48. roksta/init_codebase.cpython-313-darwin.so +0 -0
  49. roksta/lint_code.cpython-313-darwin.so +0 -0
  50. roksta/main.cpython-313-darwin.so +0 -0
  51. roksta/new_features.cpython-313-darwin.so +0 -0
  52. roksta/propose_solution.cpython-313-darwin.so +0 -0
  53. roksta/roksta.cpython-313-darwin.so +0 -0
  54. roksta/select_files.cpython-313-darwin.so +0 -0
  55. roksta/tips.cpython-313-darwin.so +0 -0
  56. roksta/utils.cpython-313-darwin.so +0 -0
  57. roksta/write_code.cpython-313-darwin.so +0 -0
  58. {roksta-0.2.7.dist-info → roksta-0.3.2.dist-info}/METADATA +2 -1
  59. roksta-0.3.2.dist-info/RECORD +121 -0
  60. tests/conftest.py +42 -0
  61. tests/functions/{api_v0_01 → api_v1_01}/__init__.py +1 -1
  62. tests/functions/{api_v0_01 → api_v1_01}/test__analytics.py +2 -3
  63. tests/functions/{api_v0_01 → api_v1_01}/test__gemini_proxy.py +51 -6
  64. tests/functions/{api_v0_01 → api_v1_01}/test__generic_proxy.py +31 -2
  65. tests/functions/{api_v0_01 → api_v1_01}/test__get_payment_details.py +2 -2
  66. tests/functions/{api_v0_01 → api_v1_01}/test__openai_proxy.py +50 -14
  67. tests/functions/{api_v0_01 → api_v1_01}/test__redeem_credit_code.py +2 -2
  68. tests/functions/{api_v0_01 → api_v1_01}/test__sync_emails.py +3 -2
  69. tests/functions/{api_v0_01 → api_v1_01}/test__take_payment.py +2 -2
  70. tests/functions/{api_v0_01 → api_v1_01}/test__use_activation_code.py +3 -2
  71. tests/functions/api_v1_02/__init__.py +2 -0
  72. tests/functions/api_v1_02/test__analytics.py +416 -0
  73. tests/functions/api_v1_02/test__gemini_proxy.py +352 -0
  74. tests/functions/api_v1_02/test__generic_proxy.py +428 -0
  75. tests/functions/api_v1_02/test__get_payment_details.py +356 -0
  76. tests/functions/api_v1_02/test__openai_proxy.py +449 -0
  77. tests/functions/api_v1_02/test__redeem_credit_code.py +167 -0
  78. tests/functions/api_v1_02/test__sync_emails.py +325 -0
  79. tests/functions/api_v1_02/test__take_payment.py +491 -0
  80. tests/functions/api_v1_02/test__use_activation_code.py +438 -0
  81. tests/functions/api_v1_02/test_proxy_keyword_replacement.py +557 -0
  82. tests/functions/api_v1_02/test_replace_keywords.py +74 -0
  83. tests/functions/test_utils.py +484 -0
  84. roksta/ai/tools.cpython-313-darwin.so +0 -0
  85. roksta/command_handlers.cpython-313-darwin.so +0 -0
  86. roksta-0.2.7.dist-info/RECORD +0 -78
  87. tests/functions/test_utils_functions.py +0 -222
  88. {roksta-0.2.7.dist-info → roksta-0.3.2.dist-info}/WHEEL +0 -0
  89. {roksta-0.2.7.dist-info → roksta-0.3.2.dist-info}/entry_points.txt +0 -0
  90. {roksta-0.2.7.dist-info → roksta-0.3.2.dist-info}/top_level.txt +0 -0
  91. /tests/functions/{test_main_functions.py → test_main.py} +0 -0
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: roksta
3
- Version: 0.2.7
3
+ Version: 0.3.2
4
4
  Summary: An AI coding assistant
5
5
  Author-email: Prash Naidu <prash@roksta.ai>
6
6
  Project-URL: Homepage, https://roksta.ai
@@ -21,6 +21,7 @@ Requires-Dist: gitpython>=3.1.44
21
21
  Requires-Dist: jsonref>=1.1.0
22
22
  Requires-Dist: pathspec>=0.12.1
23
23
  Requires-Dist: psutil>=7.1.0
24
+ Requires-Dist: PyNaCl>=1.6.0
24
25
  Provides-Extra: tests
25
26
  Requires-Dist: pytest>=8.4.1; extra == "tests"
26
27
  Requires-Dist: pytest-asyncio>=1.0.0; extra == "tests"
@@ -0,0 +1,121 @@
1
+ roksta-0.3.2.dist-info/RECORD,,
2
+ roksta-0.3.2.dist-info/WHEEL,sha256=YOKbiIEZep2WTRrpKV0dvEfsSeIOVH2NqduVxoKQt6I,142
3
+ roksta-0.3.2.dist-info/entry_points.txt,sha256=mzRdYg_DlzZRwjxYUt9-gyoRCkM1QBTeTbwETgiTdGw,44
4
+ roksta-0.3.2.dist-info/top_level.txt,sha256=lvciNZQ1dPGXpiCLdWVXK03n9fKHjbQdwjqQbnUjeYM,13
5
+ roksta-0.3.2.dist-info/METADATA,sha256=XgnSDc8MqytQD1jnmYC-tuyMdYvoa0MPRR_JP-ugZbg,1456
6
+ roksta/analytics.cpython-313-darwin.so,sha256=iJvu-a1EGDlio1bxufPn9tk7QzQlv_oCIY7P7VKdq6I,273168
7
+ roksta/check_for_updates.cpython-313-darwin.so,sha256=tu2uIxttYWvYTzwBMeVUwzszInPKaNIZ3VwBdaVLM4g,306776
8
+ roksta/response_formats.cpython-313-darwin.so,sha256=9MmD_FwyFDeKd8-Zr8xjmc68_lqPX1FZZcygbJQdu1M,120968
9
+ roksta/utils.cpython-313-darwin.so,sha256=58EiaRCISiPiGmiY6NyYKFc3k4nMfLEbkAergimgCFg,622120
10
+ roksta/main.cpython-313-darwin.so,sha256=cjptIiwKpKWp3BBKu8UufdbtdzAwFHLLRILhaIj8sYk,122184
11
+ roksta/env.cpython-313-darwin.so,sha256=hYEmLxQkMp2DJBUSo6SiZQ3FWAbXept65DCd5YBuwM8,87832
12
+ roksta/get_failing_tests.cpython-313-darwin.so,sha256=tLzNpROqCTf-X8_B2Avv_dDSfU-_7D064lxoJ29GN3Q,224296
13
+ roksta/fix_tests.cpython-313-darwin.so,sha256=Lavvd4GE5op0LfLSpo_eFnRu6N-fmRDGAy435vRKHLU,240704
14
+ roksta/firebase_auth_web.cpython-313-darwin.so,sha256=LduXEbNR5K7Ri7GNmsiAyaZW7Lq3jY9fiw4ovlrPLK4,472664
15
+ roksta/build_project.cpython-313-darwin.so,sha256=yOFozWXQoqi9yZ_AhrOWH1hO8i1G_ETEbsPNAVl_Vwo,191184
16
+ roksta/rewrite_goal.cpython-313-darwin.so,sha256=syFaNtvZI0UAUsfsTBG6seUCP6FBUKM5vDhYfvi9pcY,191088
17
+ roksta/run_cli_goal.cpython-313-darwin.so,sha256=LnBKx9tOvohdAsLqlprdzk0FOx9aI8anNBKoFDXAtdE,223968
18
+ roksta/clarify_goal.cpython-313-darwin.so,sha256=AScEYlbcfPrhb0CagYZK3QEeToZx0BexKuQXDm3iFf4,207808
19
+ roksta/roksta.cpython-313-darwin.so,sha256=xwsKlZucHlzxGZs_Pl-g97zzU8tc8OUSEsVIEc3EYcQ,588144
20
+ roksta/default_config.cpython-313-darwin.so,sha256=Jsb5rdQQoF8q_2KmsziuapT4sVI4wmqzlNyjPPot5mo,102248
21
+ roksta/__init__.cpython-313-darwin.so,sha256=9NPz72fxGkIQXx2OtFYdnleayh6ielrbliTgVxswNCc,85648
22
+ roksta/codebase_listing.cpython-313-darwin.so,sha256=MrLu0cfolSbjQKv6Y9HZP8SRMzVOtSpmVmJS7YidByk,155608
23
+ roksta/make_issue.cpython-313-darwin.so,sha256=BRmIoFb5UL_FqoY-NTHKyJFGRzw2GbjddJI02uS9nZ8,221856
24
+ roksta/create_default_config.cpython-313-darwin.so,sha256=NNj-BBNwPJpJ4txAZ66neLk70kvVy_kolx4s2bHrZ1I,121592
25
+ roksta/gen_codebase_summaries.cpython-313-darwin.so,sha256=9QCW0HIc2n12yH7hdZ1JC1Qpr86RzordOxQjdm4hJLQ,637920
26
+ roksta/propose_solution.cpython-313-darwin.so,sha256=Rpa9LloXGoYxD_Jv6lWmnj2431jcTqCmqQNjWPcI1hQ,191112
27
+ roksta/balance.cpython-313-darwin.so,sha256=2KcRqDhi1VoAesGl2WDx2pOLoM4zLB_wNqzw_vOgfTE,389744
28
+ roksta/logger.cpython-313-darwin.so,sha256=Twgl3_qXUJ0c3gVV5ek-pHZUtqaAzVsmt4rlNIaMCYg,122032
29
+ roksta/lint_code.cpython-313-darwin.so,sha256=moj4GMDW8hP68Eku4Ek8mXZI7QtdD0cOok2Vn6lRlXs,224624
30
+ roksta/extended_text_area.cpython-313-darwin.so,sha256=I5sm8TNtdcOrusHetvHlbfWmY25baiBEqxOF2rWIYFA,307208
31
+ roksta/checkpoints.cpython-313-darwin.so,sha256=kyBklHRV54PUjhwdeKD0xBPXVb2AQTp-IuqRDSufJrc,254320
32
+ roksta/get_codebase_structure.cpython-313-darwin.so,sha256=SCMaKJp2Mf_GkOp-TW-Rc7pFnYovHdZz44B3CG7-IDk,206240
33
+ roksta/init_codebase.cpython-313-darwin.so,sha256=cdljg5KCI7o8lfrNDJRm9v_9KzOiv0YCHr9moapLmdo,341632
34
+ roksta/gen_one_line_goal.cpython-313-darwin.so,sha256=j1_I9b-5ZBfRga_YSATSsKpPFv24LosQ2b-uchv5cOc,207768
35
+ roksta/new_features.cpython-313-darwin.so,sha256=eqZOcptSHYAnDcV9sZJiLuVg2QG2WqKQqgNyZxW8f9I,85728
36
+ roksta/firebase_config.cpython-313-darwin.so,sha256=mvrDiJcrsSU4E5c4SQakAnPT0gXvYEzex8H1IdCobdI,86328
37
+ roksta/chat_workflow.cpython-313-darwin.so,sha256=KNPbclDrtzlWl7SWehDTQBhI9jEh06PrnzwpPx4g7Xk,273888
38
+ roksta/select_files.cpython-313-darwin.so,sha256=ijsmto4G3r6esiehvtf0MEfPqBd7xOett9m19homJDQ,207792
39
+ roksta/tips.cpython-313-darwin.so,sha256=ijxCPHDr1XD9WBiolCiiHh9kneW9zf30XJ0EtbjmBrw,85688
40
+ roksta/write_code.cpython-313-darwin.so,sha256=ZhEyStg-RLpW0hQQyoNs31S_MKYdanIunT_aBktp5OE,191152
41
+ roksta/enums.cpython-313-darwin.so,sha256=N0YUW8hXLJ_Zr0dwbnyszPlU-Xt5pb1NETdnYCKPY-k,338344
42
+ roksta/parse_readme.cpython-313-darwin.so,sha256=MjcG8euvVPS3m4UsEdUm9f_lFLRdwIREsJlsspD_qtg,207280
43
+ roksta/firebase.cpython-313-darwin.so,sha256=n6qarllo6lw17BnvkKhssZrfKNqCuNBP_tayH12sono,488192
44
+ roksta/goal_workflow.cpython-313-darwin.so,sha256=0nn-G0Po2ZeYRabEFThHh-Qq7BGGyGcGtuSVHcSfvrE,521904
45
+ roksta/command_handlers/handle_help_command.cpython-313-darwin.so,sha256=nWNz8RJ-Afi4QvGtCAbLP4zEDVPPSDc6gjHsxLNsK8I,220312
46
+ roksta/command_handlers/handle_auto_commit_command.cpython-313-darwin.so,sha256=WBMHsCSe-o1BjodjN1Y4tIuNqS68isqnUZbrFAzNixk,122544
47
+ roksta/command_handlers/handle_add_funds_command.cpython-313-darwin.so,sha256=SCGsAJwSyvDwi8Ii4Bx0ZotVicfuKpbi8F6jruDa8eg,224640
48
+ roksta/command_handlers/__init__.cpython-313-darwin.so,sha256=B_bJ_rFOygkVIVKHaKgAqtOVHSGwcT4yXgEOmnrwoXE,86272
49
+ roksta/command_handlers/handle_logout_command.cpython-313-darwin.so,sha256=LQ-gc7-K_URulCjOP10wsHOkPv909DZ25WFB7IxzvQk,121544
50
+ roksta/command_handlers/handle_auto_charge_command.cpython-313-darwin.so,sha256=4zjTZnxDh-955hbYmUr8WUJEonRMOMmPaU2NLZCu_mw,156416
51
+ roksta/command_handlers/handle_usage_command.cpython-313-darwin.so,sha256=oU-3p-1LJ4yH30XK9i5dDjk2Yu_Ftu5uzOgTwYMqRVQ,208072
52
+ roksta/command_handlers/handle_redeem_command.cpython-313-darwin.so,sha256=HWyKyj0HfwzhbTnDkAAbguvN7F7JMDB7d_oiYF-_BcM,157960
53
+ roksta/command_handlers/handle_building_command.cpython-313-darwin.so,sha256=jdjOLXnifMSvnUILkRW-ENSNcpoJX5eRmrMsA0NUljg,155968
54
+ roksta/command_handlers/handle_goal_command.cpython-313-darwin.so,sha256=4aEtce2ioEG1JNa-R11A1roM21-R1JGQCNSN4-ax3Yg,190248
55
+ roksta/command_handlers/handle_quit_command.cpython-313-darwin.so,sha256=0ag5RtABDMIhRSI_PZBHJuzqOH0TDZW-3tGCus2H-AM,87320
56
+ roksta/command_handlers/handle_payment_details_command.cpython-313-darwin.so,sha256=RUh2TzuprRNemH7MlsEuRuWRMXn4xFq9EMzyv6NuGjs,190296
57
+ roksta/command_handlers/handle_request_activation_command.cpython-313-darwin.so,sha256=-AP99HwBnF4ltJnC55wZgE2d4BjOZVKpthPlsnhQm7U,207112
58
+ roksta/command_handlers/handle_feedback_command.cpython-313-darwin.so,sha256=JAGNIA1pnVE_dVI6HbwLee-7qg6cf4-iXFnpkkbyFok,206896
59
+ roksta/command_handlers/handle_testing_command.cpython-313-darwin.so,sha256=FbK_9roSgELPHQ9R2d3qmLSK-MSPVZc28KebWQoX6q8,155968
60
+ roksta/command_handlers/handle_chat_command.cpython-313-darwin.so,sha256=f33z3gSmgcaxqGsZSo6gSpt6IlzIutDRK_h0DzQhlpU,156952
61
+ roksta/command_handlers/handle_init_command.cpython-313-darwin.so,sha256=MisY9vwcwzVKZKyvZ1X3pWOcPs0vVgpFFDGhG4IfTFo,157352
62
+ roksta/command_handlers/handle_dev_rate_command.cpython-313-darwin.so,sha256=NaN-Ky9GUFuV0ql5djV_wyCxgVc4SWc74YzLt7n4e4Q,123040
63
+ roksta/command_handlers/handle_activate_command.cpython-313-darwin.so,sha256=HmjUz5b-hWhqUAVXwbCuZ0lsPM0bRKFEgwR7dI3__FY,240608
64
+ roksta/command_handlers/handle_login_command.cpython-313-darwin.so,sha256=fj6qONHjaGEZiYZDqxg8Ysd0GFjU8TE2TwmoPFW-pUY,207400
65
+ roksta/command_handlers/handle_linting_command.cpython-313-darwin.so,sha256=8dgM_OcWqPlf80qqrMztuiGEEHtK0eSmOc4RqHFpIlg,155984
66
+ roksta/ai/generic.cpython-313-darwin.so,sha256=Vw4N9h4C5CqT6uwZkfrJyoIs66g60i0b5UuXHuPhmw8,306944
67
+ roksta/ai/__init__.cpython-313-darwin.so,sha256=gnpXADu43zbYSsPXDFkSMAm1_tnAAFb9g3UClsQVlSQ,85648
68
+ roksta/ai/openai.cpython-313-darwin.so,sha256=yLV9Aucq8L61dQJSb3OrxA2ISC8IFVdRevqNlDs03M0,306928
69
+ roksta/ai/call_ai.cpython-313-darwin.so,sha256=xUKO52evFDPuPv5FA6cMbbEGGQxZEv_-BHe_NrNOalQ,240784
70
+ roksta/ai/llm.cpython-313-darwin.so,sha256=gQhEWJ4YNCzIgiLqES4HXwnieWLfN1_ELAVVY5p-NYU,271496
71
+ roksta/ai/gemini.cpython-313-darwin.so,sha256=-A_T95AetJtce75AypG40tmKZhrUHUYaiwbC08zFhvE,422624
72
+ roksta/ai/tools/regex_replace.cpython-313-darwin.so,sha256=75W-hvwuB6mV28ohv8tTwq8EMKHtDaZkhfeA-myRpp8,155488
73
+ roksta/ai/tools/shell_any.cpython-313-darwin.so,sha256=vQGvGwQoD2DEadl-yzf3I1TSXJiVc-scUg5FyCnI-lw,224208
74
+ roksta/ai/tools/shell_limited.cpython-313-darwin.so,sha256=1oGGlNfoDwwmu1DWXyl_mjjAjlWR2e9D_89J8-_rmsM,190992
75
+ roksta/ai/tools/delete_file.cpython-313-darwin.so,sha256=butb27KIEtomeyuNvSZotGIg2n7pcE2HxvK9hNvdrIM,121984
76
+ roksta/ai/tools/read_file.cpython-313-darwin.so,sha256=68vDWq8UZUUGm48SwpNC5Wyj9SNZ1Xk6wedUTbWskvs,155824
77
+ roksta/ai/tools/write_file.cpython-313-darwin.so,sha256=1FaLSklpHh-q68qrzQZkwxREpPuPfQWXR7PhniVT6n0,122064
78
+ roksta/ai/tools/__init__.cpython-313-darwin.so,sha256=0xSnQMeKPuKzYVqbt65-NVjzMBSmPqO3FaY-9wnfX9c,87040
79
+ roksta/ai/tools/tool_utils.cpython-313-darwin.so,sha256=YB99fgIwFYCSzHhiUiszPZ4KfB1dqoRs5l5PQ4UbP5o,307712
80
+ roksta/ai/tools/tool_defs.cpython-313-darwin.so,sha256=wwvfhouInK22jmJCdSsBCtnvqp6abDd_w12eGu2qguc,137424
81
+ roksta/ai/tools/final_response.cpython-313-darwin.so,sha256=I2eNTsSgSl8OG8rh2M_g8NZt91UWE4UC0GVrqfBigGQ,87768
82
+ roksta/ai/tools/edit_file.cpython-313-darwin.so,sha256=G2bTyQ6-gH59ReoENrtIXA0yuRt_kGyYyM92wDgo86U,155168
83
+ roksta/ai/tools/get_file_summaries.cpython-313-darwin.so,sha256=b3pMOlj6c-WuZygSs-u7-z-6QfswqZhsWCbzFD9vk2g,122728
84
+ tests/conftest.py,sha256=Y2cx3Jups9GkKGxOG2fSSoIr3rgfUa9QzipMoQ-ehKU,7878
85
+ tests/__init__.py,sha256=J6ztnXNqM8TSQCgHXMWb6NRq1kN_h4ql63Jq-TYR8XE,124
86
+ tests/functions/test_utils.py,sha256=_zlgSa99JYVyJ0LDe3yaPztS92kqGRKkgjon__XmfFM,16721
87
+ tests/functions/test_auth.py,sha256=I3oFTw2LTuUsnQ75v5SCfgUPnpel_pDKqUH0VAJpXQw,992
88
+ tests/functions/__init__.py,sha256=mLXx3UARcv07vs_fGJuy3L5ZRn9IRsF9zIuL5IOnwdk,95
89
+ tests/functions/test_main.py,sha256=h0W_4ISo95WzRy2HpXZw3cuNOTcYk_2QCIZffZJEfEU,2575
90
+ tests/functions/api_v1_02/test__sync_emails.py,sha256=OTyf2YbBK7e4pWIQTUGYR4x6il1Hb3g4FYqQ_fRj1nA,12699
91
+ tests/functions/api_v1_02/test__take_payment.py,sha256=I-XJasGuLW5wTMAu4nAgFkA8Mo_zVpGPvkJ2LrrJGCk,18022
92
+ tests/functions/api_v1_02/test_replace_keywords.py,sha256=pa7bZ8I9XgtI5dUZq-efcHh9amN2_XHP8abXYqtDGc0,2683
93
+ tests/functions/api_v1_02/test__gemini_proxy.py,sha256=mf8ubRmNxxxN80H6EA-iDPwu6Oue6Rmgxl6tiFNpfrU,13344
94
+ tests/functions/api_v1_02/test_proxy_keyword_replacement.py,sha256=I5H73_QydSKLiDp7hDHGHbSkDOdv-BT4gYHGqEiVtM0,23632
95
+ tests/functions/api_v1_02/test__analytics.py,sha256=oKjd7_zjnttcb-5BuA93yllkm0OOF4YWnfTUW1-icnM,15806
96
+ tests/functions/api_v1_02/__init__.py,sha256=3RCSoj_5UQPw9Z5NeAgYz2s4gfcZIi7g36qk_Ed5TiA,124
97
+ tests/functions/api_v1_02/test__use_activation_code.py,sha256=tNyTkkRtrpjei-7F31UNwrcU-PbP-QnkWNU7h2n5Yqo,16960
98
+ tests/functions/api_v1_02/test__redeem_credit_code.py,sha256=7GD3tGgO2Lk0BCjUmzZACJiwocEhLBvXrrut0x13IWU,6347
99
+ tests/functions/api_v1_02/test__openai_proxy.py,sha256=xlO2zmG64LlrKrbjFz-ds6Map7vy4SjIuHfZJDAqGK8,17726
100
+ tests/functions/api_v1_02/test__get_payment_details.py,sha256=i5Px3NkLxqw8D3tVPrYdRJJF5jlNmysSuX_NNolbIa4,13735
101
+ tests/functions/api_v1_02/test__generic_proxy.py,sha256=KZkOtmc71aOnWlz2L7B6CFhRNEV73bExG3GR14oD2L0,17673
102
+ tests/functions/api_v1_01/test__sync_emails.py,sha256=OTyf2YbBK7e4pWIQTUGYR4x6il1Hb3g4FYqQ_fRj1nA,12699
103
+ tests/functions/api_v1_01/test__take_payment.py,sha256=I-XJasGuLW5wTMAu4nAgFkA8Mo_zVpGPvkJ2LrrJGCk,18022
104
+ tests/functions/api_v1_01/test__gemini_proxy.py,sha256=mf8ubRmNxxxN80H6EA-iDPwu6Oue6Rmgxl6tiFNpfrU,13344
105
+ tests/functions/api_v1_01/test__analytics.py,sha256=oKjd7_zjnttcb-5BuA93yllkm0OOF4YWnfTUW1-icnM,15806
106
+ tests/functions/api_v1_01/__init__.py,sha256=3RCSoj_5UQPw9Z5NeAgYz2s4gfcZIi7g36qk_Ed5TiA,124
107
+ tests/functions/api_v1_01/test__use_activation_code.py,sha256=tNyTkkRtrpjei-7F31UNwrcU-PbP-QnkWNU7h2n5Yqo,16960
108
+ tests/functions/api_v1_01/test__redeem_credit_code.py,sha256=7GD3tGgO2Lk0BCjUmzZACJiwocEhLBvXrrut0x13IWU,6347
109
+ tests/functions/api_v1_01/test__openai_proxy.py,sha256=xlO2zmG64LlrKrbjFz-ds6Map7vy4SjIuHfZJDAqGK8,17726
110
+ tests/functions/api_v1_01/test__get_payment_details.py,sha256=i5Px3NkLxqw8D3tVPrYdRJJF5jlNmysSuX_NNolbIa4,13735
111
+ tests/functions/api_v1_01/test__generic_proxy.py,sha256=KZkOtmc71aOnWlz2L7B6CFhRNEV73bExG3GR14oD2L0,17673
112
+ tests/functions/api_v1_00/test__sync_emails.py,sha256=OTyf2YbBK7e4pWIQTUGYR4x6il1Hb3g4FYqQ_fRj1nA,12699
113
+ tests/functions/api_v1_00/test__take_payment.py,sha256=I-XJasGuLW5wTMAu4nAgFkA8Mo_zVpGPvkJ2LrrJGCk,18022
114
+ tests/functions/api_v1_00/test__gemini_proxy.py,sha256=mf8ubRmNxxxN80H6EA-iDPwu6Oue6Rmgxl6tiFNpfrU,13344
115
+ tests/functions/api_v1_00/test__analytics.py,sha256=oKjd7_zjnttcb-5BuA93yllkm0OOF4YWnfTUW1-icnM,15806
116
+ tests/functions/api_v1_00/__init__.py,sha256=3RCSoj_5UQPw9Z5NeAgYz2s4gfcZIi7g36qk_Ed5TiA,124
117
+ tests/functions/api_v1_00/test__use_activation_code.py,sha256=tNyTkkRtrpjei-7F31UNwrcU-PbP-QnkWNU7h2n5Yqo,16960
118
+ tests/functions/api_v1_00/test__redeem_credit_code.py,sha256=7GD3tGgO2Lk0BCjUmzZACJiwocEhLBvXrrut0x13IWU,6347
119
+ tests/functions/api_v1_00/test__openai_proxy.py,sha256=xlO2zmG64LlrKrbjFz-ds6Map7vy4SjIuHfZJDAqGK8,17726
120
+ tests/functions/api_v1_00/test__get_payment_details.py,sha256=i5Px3NkLxqw8D3tVPrYdRJJF5jlNmysSuX_NNolbIa4,13735
121
+ tests/functions/api_v1_00/test__generic_proxy.py,sha256=KZkOtmc71aOnWlz2L7B6CFhRNEV73bExG3GR14oD2L0,17673
tests/conftest.py CHANGED
@@ -167,3 +167,45 @@ except Exception:
167
167
  _attach_gtypes_stubs(gtypes)
168
168
  genai.types = gtypes
169
169
  sys.modules['google.genai.types'] = gtypes
170
+
171
+ # Provide a minimal nacl.public stub if PyNaCl is not installed. This prevents
172
+ # import-time failures in tests that import `roksta.firebase` which does
173
+ # `from nacl.public import PublicKey, SealedBox`.
174
+ try:
175
+ import nacl.public # type: ignore
176
+ except Exception:
177
+ # Create lightweight stub modules to satisfy `from nacl.public import PublicKey, SealedBox`
178
+ nacl = _types_mod.ModuleType('nacl')
179
+ nacl_public = _types_mod.ModuleType('nacl.public')
180
+
181
+ class PublicKey:
182
+ def __init__(self, data):
183
+ # Accept bytes-like input; ensure it's bytes when possible.
184
+ try:
185
+ self._data = bytes(data)
186
+ except Exception:
187
+ self._data = data
188
+
189
+ def __repr__(self):
190
+ try:
191
+ length = len(self._data)
192
+ except Exception:
193
+ length = 'unknown'
194
+ return f"<PublicKey len={length}>"
195
+
196
+ class SealedBox:
197
+ def __init__(self, public_key):
198
+ self.public_key = public_key
199
+
200
+ def encrypt(self, plaintext: bytes) -> bytes:
201
+ # Return deterministic bytes so callers can base64-encode the result.
202
+ if not isinstance(plaintext, (bytes, bytearray)):
203
+ plaintext = str(plaintext).encode('utf-8')
204
+ return b"STUB_ENCRYPTED:" + bytes(plaintext)
205
+
206
+ nacl_public.PublicKey = PublicKey
207
+ nacl_public.SealedBox = SealedBox
208
+ # Attach the submodule on the parent module object for attribute access
209
+ nacl.public = nacl_public
210
+ sys.modules['nacl'] = nacl
211
+ sys.modules['nacl.public'] = nacl_public
@@ -1,2 +1,2 @@
1
- # tests.functions.api_v0_01 package marker
1
+ # tests.functions.api_v1_00 package marker
2
2
  # Allows tests under this directory to be imported with package-qualified names.
@@ -176,12 +176,11 @@ sys.modules['httpx'] = httpx_mod
176
176
  # -----------------------------
177
177
  repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
178
178
  functions_root = os.path.join(repo_root, 'functions')
179
- module_path = os.path.join(functions_root, 'api_v0_01', '_analytics.py')
180
- spec = importlib.util.spec_from_file_location('api_v0_01._analytics', module_path)
179
+ module_path = os.path.join(functions_root, 'api_v1_00', '_analytics.py')
180
+ spec = importlib.util.spec_from_file_location('api_v1_00._analytics', module_path)
181
181
  _analytics = importlib.util.module_from_spec(spec)
182
182
  spec.loader.exec_module(_analytics)
183
183
 
184
-
185
184
  # Restore original sys.modules mappings to avoid side-effects for other tests
186
185
  for name, orig in _orig_sys_modules.items():
187
186
  if orig is None:
@@ -19,6 +19,8 @@ if FUNCTIONS_DIR not in sys.path:
19
19
  _orig_sys_modules = {}
20
20
  _names_to_fake = [
21
21
  'firebase_functions',
22
+ 'firebase_admin',
23
+ 'firebase_admin.firestore',
22
24
  'utils',
23
25
  'auth',
24
26
  'google',
@@ -49,6 +51,35 @@ class FakeResponse:
49
51
  firebase_functions.https_fn = types.SimpleNamespace(Request=object, Response=FakeResponse)
50
52
  sys.modules['firebase_functions'] = firebase_functions
51
53
 
54
+ # Fake firebase_admin and its firestore submodule to satisfy optional imports in the proxy
55
+ firebase_admin = types.ModuleType('firebase_admin')
56
+ firestore_mod = types.ModuleType('firebase_admin.firestore')
57
+
58
+ # Minimal Client type for annotations and a no-op client() factory
59
+ class _DummyClient: # pragma: no cover - just a stub for import-time type hints
60
+ pass
61
+
62
+ def _dummy_client():
63
+ # Return a simple object; logic using it is patched in tests
64
+ return types.SimpleNamespace()
65
+
66
+ # Decorator stub used by perform_atomic_debit; never actually invoked in tests
67
+ def _transactional(fn=None):
68
+ def wrapper(*args, **kwargs):
69
+ return fn(*args, **kwargs)
70
+ return wrapper
71
+
72
+ # Populate stubs on the firestore module
73
+ setattr(firestore_mod, 'Client', _DummyClient)
74
+ setattr(firestore_mod, 'client', _dummy_client)
75
+ setattr(firestore_mod, 'transactional', _transactional)
76
+ setattr(firestore_mod, 'SERVER_TIMESTAMP', object())
77
+
78
+ # Attach firestore submodule to firebase_admin package and register in sys.modules
79
+ setattr(firebase_admin, 'firestore', firestore_mod)
80
+ sys.modules['firebase_admin'] = firebase_admin
81
+ sys.modules['firebase_admin.firestore'] = firestore_mod
82
+
52
83
  # Fake utils module (provides functions imported by _gemini_proxy)
53
84
  utils_mod = types.ModuleType('utils')
54
85
 
@@ -118,14 +149,14 @@ sys.modules['google.genai'] = genai_mod
118
149
  sys.modules['google.genai.types'] = types_mod
119
150
 
120
151
  # Import the module under test after preparing the fake imports
152
+ # Resolve the actual repository 'functions' directory (tests files live under tests/, so climb up to repo root)
121
153
  repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
122
154
  functions_root = os.path.join(repo_root, 'functions')
123
- module_path = os.path.join(functions_root, 'api_v0_01', '_gemini_proxy.py')
124
- spec = importlib.util.spec_from_file_location('api_v0_01._gemini_proxy', module_path)
155
+ module_path = os.path.join(functions_root, 'api_v1_00', '_gemini_proxy.py')
156
+ spec = importlib.util.spec_from_file_location('api_v1_00._gemini_proxy', module_path)
125
157
  _gemini = importlib.util.module_from_spec(spec)
126
158
  spec.loader.exec_module(_gemini)
127
159
 
128
-
129
160
  # Restore original sys.modules mappings to avoid side-effects for other tests
130
161
  for name, orig in _orig_sys_modules.items():
131
162
  if orig is None:
@@ -198,7 +229,9 @@ def test_invalid_auth_key_returns_403():
198
229
  def test_non_post_method_returns_405():
199
230
  headers = {_gemini.AUTH_HEADER_NAME: 'ok'}
200
231
  req = DummyRequest(headers=headers, method='GET')
201
- with patch.object(_gemini, 'validate_auth_key', return_value=True), patch.object(_gemini, 'verify_firebase_token', return_value={}):
232
+ with patch.object(_gemini, 'validate_auth_key', return_value=True), \
233
+ patch.object(_gemini, 'verify_firebase_token', return_value={}), \
234
+ patch.object(_gemini, 'ensure_balance_positive', return_value=(True, 100.0)):
202
235
  resp = _gemini._gemini_proxy(req)
203
236
 
204
237
  assert resp.status_code == 405
@@ -210,7 +243,9 @@ def test_non_post_method_returns_405():
210
243
  def test_malformed_json_returns_400():
211
244
  headers = {_gemini.AUTH_HEADER_NAME: 'ok'}
212
245
  req = DummyRequest(headers=headers, method='POST', raise_on_get_json=True)
213
- with patch.object(_gemini, 'validate_auth_key', return_value=True), patch.object(_gemini, 'verify_firebase_token', return_value={}):
246
+ with patch.object(_gemini, 'validate_auth_key', return_value=True), \
247
+ patch.object(_gemini, 'verify_firebase_token', return_value={}), \
248
+ patch.object(_gemini, 'ensure_balance_positive', return_value=(True, 100.0)):
214
249
  resp = _gemini._gemini_proxy(req)
215
250
 
216
251
  assert resp.status_code == 400
@@ -223,7 +258,9 @@ def test_rehydrate_params_error_returns_400():
223
258
  headers = {_gemini.AUTH_HEADER_NAME: 'ok'}
224
259
  # missing 'model' to cause KeyError inside rehydrate_params
225
260
  req = DummyRequest(headers=headers, method='POST', json_data={'contents': 'x', 'config': {}})
226
- with patch.object(_gemini, 'validate_auth_key', return_value=True), patch.object(_gemini, 'verify_firebase_token', return_value={}):
261
+ with patch.object(_gemini, 'validate_auth_key', return_value=True), \
262
+ patch.object(_gemini, 'verify_firebase_token', return_value={}), \
263
+ patch.object(_gemini, 'ensure_balance_positive', return_value=(True, 100.0)):
227
264
  resp = _gemini._gemini_proxy(req)
228
265
 
229
266
  assert resp.status_code == 400
@@ -237,6 +274,7 @@ def test_get_api_key_failure_returns_500():
237
274
  req = DummyRequest(headers=headers, method='POST', json_data={'model': 'g', 'contents': 'hi', 'config': {}})
238
275
  with patch.object(_gemini, 'validate_auth_key', return_value=True), \
239
276
  patch.object(_gemini, 'verify_firebase_token', return_value={}), \
277
+ patch.object(_gemini, 'ensure_balance_positive', return_value=(True, 100.0)), \
240
278
  patch.object(_gemini, 'get_api_key', side_effect=Exception('boom')):
241
279
  resp = _gemini._gemini_proxy(req)
242
280
 
@@ -258,12 +296,18 @@ def test_successful_flow_calls_genai_and_returns_payload():
258
296
 
259
297
  def generate_content(self, **params):
260
298
  class FakeResp:
299
+ def __init__(self):
300
+ # include usage metadata expected by get_usage()
301
+ self.usage_metadata = types.SimpleNamespace(prompt_token_count=1, total_token_count=2)
302
+
261
303
  def to_json_dict(self_inner):
262
304
  return { 'result': 'ok', 'received_model': params.get('model') }
263
305
  return FakeResp()
264
306
 
265
307
  with patch.object(_gemini, 'validate_auth_key', return_value=True), \
266
308
  patch.object(_gemini, 'verify_firebase_token', return_value={}), \
309
+ patch.object(_gemini, 'ensure_balance_positive', return_value=(True, 100.0)), \
310
+ patch.object(_gemini, 'bill_with_retry', return_value=("ok", 99.5)), \
267
311
  patch.object(_gemini, 'get_api_key', return_value='GEMINI-KEY'), \
268
312
  patch.object(_gemini.genai, 'Client', FakeClient):
269
313
  resp = _gemini._gemini_proxy(req)
@@ -297,6 +341,7 @@ def test_genai_exception_with_status_code_is_returned_as_error_status():
297
341
 
298
342
  with patch.object(_gemini, 'validate_auth_key', return_value=True), \
299
343
  patch.object(_gemini, 'verify_firebase_token', return_value={}), \
344
+ patch.object(_gemini, 'ensure_balance_positive', return_value=(True, 100.0)), \
300
345
  patch.object(_gemini, 'get_api_key', return_value='GEMINI-KEY'), \
301
346
  patch.object(_gemini.genai, 'Client', ErrClient):
302
347
  resp = _gemini._gemini_proxy(req)
@@ -108,13 +108,42 @@ openai_mod.APIError = APIError
108
108
  sys.modules['openai'] = openai_mod
109
109
 
110
110
  # Import the module under test after preparing the fake imports
111
+ #_generic = importlib.import_module('_generic_proxy')
112
+
111
113
  repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
112
114
  functions_root = os.path.join(repo_root, 'functions')
113
- module_path = os.path.join(functions_root, 'api_v0_01', '_generic_proxy.py')
114
- spec = importlib.util.spec_from_file_location('api_v0_01._generic_proxy', module_path)
115
+ module_path = os.path.join(functions_root, 'api_v1_00', '_generic_proxy.py')
116
+ spec = importlib.util.spec_from_file_location('api_v1_00._generic_proxy', module_path)
115
117
  _generic = importlib.util.module_from_spec(spec)
116
118
  spec.loader.exec_module(_generic)
117
119
 
120
+ # Patch Firestore client and billing functions to avoid external dependencies during tests
121
+ # Provide a dummy Firestore client and make balance checks/billing no-ops.
122
+ _generic.firestore = types.SimpleNamespace(client=lambda: object())
123
+
124
+ def _fake_ensure_balance_positive(db, user_id):
125
+ return True, 100.0
126
+
127
+ def _fake_extract_usage(llm_family=None, call_type=None, model_id=None, request_payload=None, response_payload=None):
128
+ # Default to zero-usage unless present in the payload
129
+ usage = response_payload.get('usage', {}) if isinstance(response_payload, dict) else {}
130
+ in_tokens = usage.get('prompt_tokens', 0) or usage.get('input_tokens', 0) or 0
131
+ out_tokens = usage.get('completion_tokens', 0) or usage.get('output_tokens', 0) or 0
132
+ return {"input_tokens": in_tokens, "output_tokens": out_tokens}
133
+
134
+ def _fake_calculate_cost(model_id=None, input_tokens=0, output_tokens=0):
135
+ return 0.0
136
+
137
+ def _fake_bill_with_retry(db=None, user_id=None, model_id=None, usage=None, cost=None, reason=None):
138
+ return "ok", 100.0
139
+
140
+ _generic.ensure_balance_positive = _fake_ensure_balance_positive
141
+ _generic.extract_usage = _fake_extract_usage
142
+ # Compatibility shim: some versions of the module call get_usage(response) instead of extract_usage(...)
143
+ _generic.get_usage = lambda response: _fake_extract_usage(response_payload=response)
144
+ _generic.calculate_cost = _fake_calculate_cost
145
+ _generic.bill_with_retry = _fake_bill_with_retry
146
+
118
147
  # Restore original sys.modules mappings to avoid side-effects for other tests
119
148
  for name, orig in _orig_sys_modules.items():
120
149
  if orig is None:
@@ -186,8 +186,8 @@ sys.modules['ulid'] = ulid_mod
186
186
  # Load the module directly from the functions/ tree so the test's fake sys.modules entries are respected
187
187
  repo_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..'))
188
188
  functions_root = os.path.join(repo_root, 'functions')
189
- module_path = os.path.join(functions_root, 'api_v0_01', '_get_payment_details.py')
190
- spec = importlib.util.spec_from_file_location('api_v0_01._get_payment_details', module_path)
189
+ module_path = os.path.join(functions_root, 'api_v1_00', '_get_payment_details.py')
190
+ spec = importlib.util.spec_from_file_location('api_v1_00._get_payment_details', module_path)
191
191
  _get_payment_details = importlib.util.module_from_spec(spec)
192
192
  spec.loader.exec_module(_get_payment_details)
193
193