hyperpocket 0.3.7__py3-none-any.whl → 0.4.0__py3-none-any.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.
- hyperpocket/auth/provider.py +1 -0
- hyperpocket/auth/weaviate/context.py +12 -0
- hyperpocket/auth/weaviate/token_context.py +11 -0
- hyperpocket/auth/weaviate/token_handler.py +68 -0
- hyperpocket/auth/weaviate/token_schema.py +7 -0
- hyperpocket/cli/eject.py +2 -7
- hyperpocket/cli/pull.py +2 -7
- hyperpocket/config/settings.py +2 -1
- hyperpocket/pocket_core.py +41 -68
- hyperpocket/pocket_main.py +37 -16
- hyperpocket/repository/__init__.py +3 -4
- hyperpocket/repository/repository.py +6 -41
- hyperpocket/repository/tool_reference.py +28 -0
- hyperpocket/server/auth/weaviate.py +27 -0
- hyperpocket/server/server.py +127 -61
- hyperpocket/session/in_memory.py +13 -3
- hyperpocket/tool/__init__.py +0 -3
- hyperpocket/tool/dock/__init__.py +3 -0
- hyperpocket/tool/dock/dock.py +34 -0
- hyperpocket/tool/function/__init__.py +1 -1
- hyperpocket/tool/function/tool.py +62 -32
- hyperpocket/tool/tool.py +1 -9
- hyperpocket/tool_like.py +2 -1
- hyperpocket/util/generate_slug.py +4 -0
- hyperpocket/util/json_schema_to_model.py +5 -1
- {hyperpocket-0.3.7.dist-info → hyperpocket-0.4.0.dist-info}/METADATA +4 -1
- {hyperpocket-0.3.7.dist-info → hyperpocket-0.4.0.dist-info}/RECORD +30 -36
- hyperpocket/cli/sync.py +0 -17
- hyperpocket/repository/lock.py +0 -240
- hyperpocket/repository/lockfile.py +0 -62
- hyperpocket/server/tool/__init__.py +0 -10
- hyperpocket/server/tool/dto/script.py +0 -33
- hyperpocket/server/tool/wasm.py +0 -46
- hyperpocket/tool/wasm/README.md +0 -166
- hyperpocket/tool/wasm/__init__.py +0 -3
- hyperpocket/tool/wasm/browser.py +0 -63
- hyperpocket/tool/wasm/invoker.py +0 -41
- hyperpocket/tool/wasm/script.py +0 -134
- hyperpocket/tool/wasm/templates/__init__.py +0 -35
- hyperpocket/tool/wasm/templates/node.py +0 -87
- hyperpocket/tool/wasm/templates/python.py +0 -93
- hyperpocket/tool/wasm/tool.py +0 -163
- /hyperpocket/{server/tool/dto → auth/weaviate}/__init__.py +0 -0
- {hyperpocket-0.3.7.dist-info → hyperpocket-0.4.0.dist-info}/WHEEL +0 -0
- {hyperpocket-0.3.7.dist-info → hyperpocket-0.4.0.dist-info}/entry_points.txt +0 -0
| @@ -2,15 +2,15 @@ hyperpocket/__init__.py,sha256=VVLbApRTiULqEVQp6lCNOcuXKx9V62O_7C9VNKBQ0G0,137 | |
| 2 2 | 
             
            hyperpocket/builtin.py,sha256=SOrVrNjoKadDMksfB1rt6pKreJFzHG2YGBsLGVsg72c,2385
         | 
| 3 3 | 
             
            hyperpocket/constants.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 4 4 | 
             
            hyperpocket/pocket_auth.py,sha256=VzpGpHOOQIiEgrk1sYg5DYa5WYV6gRQmFlm8Kb2C9V0,17611
         | 
| 5 | 
            -
            hyperpocket/pocket_core.py,sha256= | 
| 6 | 
            -
            hyperpocket/pocket_main.py,sha256= | 
| 5 | 
            +
            hyperpocket/pocket_core.py,sha256=WkY7Dp7KcJTORAFNuxDbZ5PDgicRANUtKkpZmI5gg6s,10021
         | 
| 6 | 
            +
            hyperpocket/pocket_main.py,sha256=XH0wlT1AafZDItgbYBkoo0dSb0z6Tcvl8AC9puXe8mg,10215
         | 
| 7 7 | 
             
            hyperpocket/prompts.py,sha256=N1bCzCLZvGUVhH1Vn_cgeBPsdY3MdIU7ZGqVgexoj5E,472
         | 
| 8 | 
            -
            hyperpocket/tool_like.py,sha256= | 
| 8 | 
            +
            hyperpocket/tool_like.py,sha256=lUk9kUHPUmugqHCLbnWflKtZbCwtgcoYWtqGqUQtV38,187
         | 
| 9 9 | 
             
            hyperpocket/auth/README.md,sha256=zn4QqnFZCA_4X3x8Wb6lE3OP5otYxpByZaCiUkBvaNs,11562
         | 
| 10 10 | 
             
            hyperpocket/auth/__init__.py,sha256=pO8M6SAuq0EPqi848_Iy650wqaLekx98e3RRnEAM_r0,607
         | 
| 11 11 | 
             
            hyperpocket/auth/context.py,sha256=m-j2gDYUKBMsiakLHsu9thhM4dYyFiXP0Wp0S_iC0bU,1303
         | 
| 12 12 | 
             
            hyperpocket/auth/handler.py,sha256=5cusl9ANEyG3gORVFjqh709txC0alw6eKtxgV6wjf6k,6683
         | 
| 13 | 
            -
            hyperpocket/auth/provider.py,sha256= | 
| 13 | 
            +
            hyperpocket/auth/provider.py,sha256=7oRpa3ImMdQPXp2-VwTF3tZGhPkyIe0cOgQCJcljzgQ,2061
         | 
| 14 14 | 
             
            hyperpocket/auth/schema.py,sha256=pl4oRTNj8PdqQg6UVPWf8ei2uYQ4DtOmmD58cVFMYQw,537
         | 
| 15 15 | 
             
            hyperpocket/auth/activeloop/README.md,sha256=xp8n0itbY9VNt8XEvCAE4Ealvj4uf_f1uSZyWG4Q5FE,172
         | 
| 16 16 | 
             
            hyperpocket/auth/activeloop/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| @@ -428,6 +428,11 @@ hyperpocket/auth/wandb/context.py,sha256=YKtk8yz-LnKHMwLs0CGZ3HUqvvtS6J2eAWQ7B-Z | |
| 428 428 | 
             
            hyperpocket/auth/wandb/token_context.py,sha256=TFE_r8eMHeUzCMpM91SIy668GHpu_NxFpqmmMoEuaDw,437
         | 
| 429 429 | 
             
            hyperpocket/auth/wandb/token_handler.py,sha256=WBsli6ZJPXVTKKDz9c_UIXQ15SfzWvxNZVeZWa1RuwE,2789
         | 
| 430 430 | 
             
            hyperpocket/auth/wandb/token_schema.py,sha256=AEDE-HkS-lSDzMdARETDO0xyPvBbHxqLXFAzbkIusFA,207
         | 
| 431 | 
            +
            hyperpocket/auth/weaviate/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 432 | 
            +
            hyperpocket/auth/weaviate/context.py,sha256=RnoxPR1awSmi4VNB8tIfKJvm1JDqbIMAwDNZEOvGt6M,427
         | 
| 433 | 
            +
            hyperpocket/auth/weaviate/token_context.py,sha256=AG_1r_pa8O-5Y35nwS-RAK31WACO8PI1dqcHFB3FGNg,485
         | 
| 434 | 
            +
            hyperpocket/auth/weaviate/token_handler.py,sha256=YQRu_XEOHSIH_xCM9kRPuKLbroEQWzpFoBXj_pWcdRs,2733
         | 
| 435 | 
            +
            hyperpocket/auth/weaviate/token_schema.py,sha256=ajXoOyglBD-8SpfQhStduhDe1_uV5YfzebMnXmLcd_M,273
         | 
| 431 436 | 
             
            hyperpocket/auth/workiom/README.md,sha256=icnFTBhr_RPIBJCv21JyP6hxjmZsLLQXTEluBfpwVII,301
         | 
| 432 437 | 
             
            hyperpocket/auth/workiom/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 433 438 | 
             
            hyperpocket/auth/workiom/context.py,sha256=N6sD3gfycGCr5xvxF3CFfxR3ufU1_cgKKjRkpTqD3-A,429
         | 
| @@ -455,9 +460,8 @@ hyperpocket/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | |
| 455 460 | 
             
            hyperpocket/cli/__main__.py,sha256=f9qvOb33F5edNjP_eyshT1F8SjofV3bwLFl8lAru_u8,813
         | 
| 456 461 | 
             
            hyperpocket/cli/auth_oauth2.py,sha256=FTsaIrJY9U1uDEtZL456zOWQKfcqzOPg33ikFhFFjyA,4899
         | 
| 457 462 | 
             
            hyperpocket/cli/auth_token.py,sha256=YV1AK70Q_hNsm_xwHP5LTaUWI-omssnX8214JyD3m_w,4875
         | 
| 458 | 
            -
            hyperpocket/cli/eject.py,sha256= | 
| 459 | 
            -
            hyperpocket/cli/pull.py,sha256= | 
| 460 | 
            -
            hyperpocket/cli/sync.py,sha256=OO5zFrLOMXk7TSAFEew04ZzW4HLoQ1uVb80UKvIJha0,517
         | 
| 463 | 
            +
            hyperpocket/cli/eject.py,sha256=utzeL4t02ML-EIgpPUiFjCbycjRpvkP1905bLeZAT2Y,321
         | 
| 464 | 
            +
            hyperpocket/cli/pull.py,sha256=JnoIsmQwJODWOuilmKR5KKFsdMZ0Ht7pCWIbENJuYfw,275
         | 
| 461 465 | 
             
            hyperpocket/cli/tool_create.py,sha256=1tsVw_sy28JmeCSXT1j-7dqOsDXzvZPTNqcmHchtcpI,3996
         | 
| 462 466 | 
             
            hyperpocket/cli/tool_export.py,sha256=NRfssftdb1HEj9DtdM7rh6_rFs1hydYyjpDe7V8kFzU,8060
         | 
| 463 467 | 
             
            hyperpocket/cli/codegen/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| @@ -477,16 +481,15 @@ hyperpocket/config/auth.py,sha256=OOVdaAfMva6b-Kz4iy5YpnIKjT5WgcQ17toFzHqoRPY,21 | |
| 477 481 | 
             
            hyperpocket/config/git.py,sha256=CGbY7J1LyN4ccZr9CFGAQwwhjC9kvdU0On_nsAsZ1FQ,362
         | 
| 478 482 | 
             
            hyperpocket/config/logger.py,sha256=T5LESHvQfl2q1F-7FjsVfrz9fWz6jxPo7u6Jml3CQjc,2804
         | 
| 479 483 | 
             
            hyperpocket/config/session.py,sha256=1ng1mARv4R_07SF5CkZWLgX9pNeXTcM0knCRw07Fpms,816
         | 
| 480 | 
            -
            hyperpocket/config/settings.py,sha256= | 
| 484 | 
            +
            hyperpocket/config/settings.py,sha256=aw3TiPepcmSOKsIXDFHBhhqD2Ubz-51xRbFHZ5qx8KY,2437
         | 
| 481 485 | 
             
            hyperpocket/futures/__init__.py,sha256=IObmC6hKC_Rc3vwOzINUVJ1hU2MDB5BUfXuH0vlSjtE,136
         | 
| 482 486 | 
             
            hyperpocket/futures/futurestore.py,sha256=TVbCPf4HLKc32ol7e-oZckXMPPBKBvmjKmQAM1xj0dI,1329
         | 
| 483 | 
            -
            hyperpocket/repository/__init__.py,sha256= | 
| 484 | 
            -
            hyperpocket/repository/ | 
| 485 | 
            -
            hyperpocket/repository/ | 
| 486 | 
            -
            hyperpocket/repository/repository.py,sha256=AHQ-E7B42wAxrJ_pYZ8hdTr8pxUzOb2kWD8YWlrphtQ,1349
         | 
| 487 | 
            +
            hyperpocket/repository/__init__.py,sha256=ML7XfV1SgcEiOBgQpfqjsT8QEKJbGQG3sVRqi_iAxqA,168
         | 
| 488 | 
            +
            hyperpocket/repository/repository.py,sha256=KvgZnJW_TrBzaLWV0DxjReLklkni1oyLq856OyjJ__A,129
         | 
| 489 | 
            +
            hyperpocket/repository/tool_reference.py,sha256=Nuc2ckWuH_5K-p8S_0IuJiaJiPE6XWchA2XM71nOTjM,554
         | 
| 487 490 | 
             
            hyperpocket/server/__init__.py,sha256=8laNl098-IkFkarqwOZs_gm6yG0q3NAObq4cCUxK_Tw,90
         | 
| 488 491 | 
             
            hyperpocket/server/proxy.py,sha256=ItM1qfuUBs6QiPqIpErBWUZWdtsEf0twPJY5r2UUFBU,2042
         | 
| 489 | 
            -
            hyperpocket/server/server.py,sha256= | 
| 492 | 
            +
            hyperpocket/server/server.py,sha256=_kRWyoBJPcInbJTU_64MTv5Dbjpm9_oksix2Ow_0_Ko,11332
         | 
| 490 493 | 
             
            hyperpocket/server/auth/__init__.py,sha256=IMjz9PCzD7qh4QIf2g-gWIdkDeU36jt-9F55vaHvLoM,286
         | 
| 491 494 | 
             
            hyperpocket/server/auth/activeloop.py,sha256=MHh43F0j6q0r-GcevwD41ewLXdaPHfhLT9bCLuL7puU,739
         | 
| 492 495 | 
             
            hyperpocket/server/auth/adobe.py,sha256=HH6elxV3ELWUnTRlkQBBFSXMHAc0angRUfHHkZVA4Kg,437
         | 
| @@ -555,45 +558,36 @@ hyperpocket/server/auth/timekit.py,sha256=8pC-DT_gbm6vmd1oZaquD4Z68998BEDb1nYVAI | |
| 555 558 | 
             
            hyperpocket/server/auth/token.py,sha256=Yq5Ym-uEO_3cBpQOsmCBuqtFIdImrNcVUgF5ozs5NHk,1763
         | 
| 556 559 | 
             
            hyperpocket/server/auth/trello.py,sha256=1T3ez62h8-KMvu2Zj1Tyv2afgqLUbtG2LM4QbISLOGA,441
         | 
| 557 560 | 
             
            hyperpocket/server/auth/wandb.py,sha256=jfwg-lQVrr5TgEL7QETnaFucDvi057SJvVZlBe7cOqQ,709
         | 
| 561 | 
            +
            hyperpocket/server/auth/weaviate.py,sha256=WnBQu4H9mOGYEq7JcGqUkk3QXRO8FpGa9TLRHMQfpCE,732
         | 
| 558 562 | 
             
            hyperpocket/server/auth/workiom.py,sha256=0apFB5-3rmcJaQeEl1_XZ_QlsZORdq8kixJBGkTpZ3Y,445
         | 
| 559 563 | 
             
            hyperpocket/server/auth/x.py,sha256=CYCD_ajBY6Jt04E2bSEBZFRRIUZmNjF2gn6F0ZV5XuA,450
         | 
| 560 564 | 
             
            hyperpocket/server/auth/zinc.py,sha256=xgVV5lWP6YSEHTCmH0gipG5lh4Wvf716tHTnOvTTj3w,708
         | 
| 561 565 | 
             
            hyperpocket/server/auth/zoom.py,sha256=kWp4MB4i9FKMA4ZYcj4g4_90Y1ZMEoAQTTjbb0rsMRs,703
         | 
| 562 | 
            -
            hyperpocket/server/tool/__init__.py,sha256=khNLe3H2W7WXKQlHjXuuvd9R87eHOAZhDsQmjDcbYsg,210
         | 
| 563 | 
            -
            hyperpocket/server/tool/wasm.py,sha256=VJyp6RGsq8llKT_sY6DhV52wsETu-W9bzJ7C9wC17Oo,1698
         | 
| 564 | 
            -
            hyperpocket/server/tool/dto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 565 | 
            -
            hyperpocket/server/tool/dto/script.py,sha256=2z5_QFhmNtbuau0De0GYUS0K1t6o81od9QLmfr97iZM,852
         | 
| 566 566 | 
             
            hyperpocket/session/README.md,sha256=Wmh-qWJQ-40vU9hP5jNxuM33i0STNfaIjOecba7H-oc,1968
         | 
| 567 567 | 
             
            hyperpocket/session/__init__.py,sha256=ljqLlIMsrY9Hb8UOweaEvBM_Ku9IxBMMIXar6T7h5Lg,275
         | 
| 568 | 
            -
            hyperpocket/session/in_memory.py,sha256= | 
| 568 | 
            +
            hyperpocket/session/in_memory.py,sha256=sYFBIc0w4sxSj28j9pkdtn_Oga8a-lsi4YJRvSFA_Jc,3799
         | 
| 569 569 | 
             
            hyperpocket/session/interface.py,sha256=vQobJCzQe29uM6yXanRAysUhJvtfuUZ0qddMpeLn8NI,4964
         | 
| 570 570 | 
             
            hyperpocket/session/redis.py,sha256=rbW2b0C6HUNp5HpTpr6sxDKZQCuPHu2ipCyn1TXjPgM,5444
         | 
| 571 571 | 
             
            hyperpocket/tool/README.md,sha256=vbHvP3fnfihq-H481MiSZEVJNhVoUu0djENb9tiy78c,3026
         | 
| 572 | 
            -
            hyperpocket/tool/__init__.py,sha256= | 
| 573 | 
            -
            hyperpocket/tool/tool.py,sha256= | 
| 572 | 
            +
            hyperpocket/tool/__init__.py,sha256=ZwGG7_MfTUigAdHxdR-s3NMFm_QdJDoKNeVrTmFsZSo,253
         | 
| 573 | 
            +
            hyperpocket/tool/tool.py,sha256=3ApLB7mpo_xCnpvQKE7KdxY7cHVweZ-iExJEkovyfbI,7029
         | 
| 574 | 
            +
            hyperpocket/tool/dock/__init__.py,sha256=gEFaYTgTIzzaAHW6Bl1CJL8RQlU23NK--bojLqPTLSc,63
         | 
| 575 | 
            +
            hyperpocket/tool/dock/dock.py,sha256=Uk3Lggmj_piGFiPVde2ZvRXOKncIYqjPaRQ3LD8DWT0,859
         | 
| 574 576 | 
             
            hyperpocket/tool/function/README.md,sha256=6Y9a8FlFjEdbrVqF0NoQ1j34VoV8Zt6Pf9-xlLIHkTc,3676
         | 
| 575 | 
            -
            hyperpocket/tool/function/__init__.py,sha256= | 
| 577 | 
            +
            hyperpocket/tool/function/__init__.py,sha256=n0IYvfoyoFWv76iwK2kBC-X6468dl5XyYFl1mudYSe4,261
         | 
| 576 578 | 
             
            hyperpocket/tool/function/annotation.py,sha256=mHm_TN2X7xmivBZ8_tbnsaGt_GUQZ-l2IPv0PudZKb8,982
         | 
| 577 | 
            -
            hyperpocket/tool/function/tool.py,sha256= | 
| 579 | 
            +
            hyperpocket/tool/function/tool.py,sha256=HwsTI__DapAoYxQMuy45ivD4Lxyd7_-MO0GHlqfuI5c,7466
         | 
| 578 580 | 
             
            hyperpocket/tool/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
         | 
| 579 | 
            -
            hyperpocket/tool/wasm/README.md,sha256=DjHtzOS4oe4Mk39M8BfxE0N_hqds32KXx2OWJ2cJOGo,3866
         | 
| 580 | 
            -
            hyperpocket/tool/wasm/__init__.py,sha256=t6KwkMY0pwZheCf9Q-9Kt7HGHQU7U--b9TTKgNegWUY,72
         | 
| 581 | 
            -
            hyperpocket/tool/wasm/browser.py,sha256=JWn34P1ybPJCogBB85BePWFXM4AqOI2wSbIb5LcCXTs,1867
         | 
| 582 | 
            -
            hyperpocket/tool/wasm/invoker.py,sha256=jgW3XqdbAXgDjTlURmD2Xeh5qpjZgvB6PYzNlcdvfQc,1431
         | 
| 583 | 
            -
            hyperpocket/tool/wasm/script.py,sha256=qi7uYkXxMGV5aZTnUllqp-LoJtlUd3HNadYeqv4UGgc,4348
         | 
| 584 | 
            -
            hyperpocket/tool/wasm/tool.py,sha256=sw0njNvucoXRikKHzALWec_w04LjUVZfTpvL5xAVeGE,5241
         | 
| 585 | 
            -
            hyperpocket/tool/wasm/templates/__init__.py,sha256=YWHy035YflIbQsQth0VCQoqO1PQ0aKmG6vYIkTLv2XA,920
         | 
| 586 | 
            -
            hyperpocket/tool/wasm/templates/node.py,sha256=4nSrKX1Qc7WH_yIJ-56xdRjd-1Xmrvf4sR0CphggMGE,2783
         | 
| 587 | 
            -
            hyperpocket/tool/wasm/templates/python.py,sha256=rhJTzb1jULiyhTBIhMesy_-Sc-Z9lLkgFM37RjWSYrw,2734
         | 
| 588 581 | 
             
            hyperpocket/util/__init__.py,sha256=7vN8c7dy7nhGhjXtSUGAsc6GIlUnuBMvXSl1yW1M4js,35
         | 
| 589 582 | 
             
            hyperpocket/util/extract_func_param_desc_from_docstring.py,sha256=eGDrbigmVg1zaud1q5l2WDZkYqzy56TRznNPouc8i_Y,4170
         | 
| 590 583 | 
             
            hyperpocket/util/find_all_leaf_class_in_package.py,sha256=06n8R47BDPovxhCOnzu9GuEfeQzEbv-HdG-zfMu1gBw,533
         | 
| 591 584 | 
             
            hyperpocket/util/find_all_subclass_in_package.py,sha256=TtEb41-nzCNhC9pgelTS6MMxLT_JNZkFPJe5z2H9yik,978
         | 
| 592 585 | 
             
            hyperpocket/util/flatten_json_schema.py,sha256=iuNBEmMSKFtPi-uqo6fb3RWN0koHOAihWAAofWbd1U8,1671
         | 
| 593 586 | 
             
            hyperpocket/util/function_to_model.py,sha256=TXUs-qPbzL8C9-qqpz4Ad4D9MOPP61n_p0iPU6SoBeM,2318
         | 
| 587 | 
            +
            hyperpocket/util/generate_slug.py,sha256=gwwf9gfTlqribrvybMQQj7VIHX5FspVoTm5-EYH-X74,150
         | 
| 594 588 | 
             
            hyperpocket/util/get_objects_from_subpackage.py,sha256=4mR_S8eaJSdU68YfCkiXeIcXxb6q7LjFGsY_IHeNIZw,929
         | 
| 595 | 
            -
            hyperpocket/util/json_schema_to_model.py,sha256= | 
| 596 | 
            -
            hyperpocket-0. | 
| 597 | 
            -
            hyperpocket-0. | 
| 598 | 
            -
            hyperpocket-0. | 
| 599 | 
            -
            hyperpocket-0. | 
| 589 | 
            +
            hyperpocket/util/json_schema_to_model.py,sha256=BNTFYzBK-yZr2VkO6lAdZkXdZXfGSabzWa3DM6it4KI,3731
         | 
| 590 | 
            +
            hyperpocket-0.4.0.dist-info/METADATA,sha256=ldzb1IY6csgV76cTF-pXdYOiqkmxV-xR-fsEEgy5KRg,13074
         | 
| 591 | 
            +
            hyperpocket-0.4.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
         | 
| 592 | 
            +
            hyperpocket-0.4.0.dist-info/entry_points.txt,sha256=KpBleaYr0SaENXOa-dFvJ_cvFCHYFEQ4LMl11ShAcBI,61
         | 
| 593 | 
            +
            hyperpocket-0.4.0.dist-info/RECORD,,
         | 
    
        hyperpocket/cli/sync.py
    DELETED
    
    | @@ -1,17 +0,0 @@ | |
| 1 | 
            -
            import pathlib
         | 
| 2 | 
            -
            from typing import Optional
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            import click
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            import hyperpocket.repository as repository
         | 
| 7 | 
            -
             | 
| 8 | 
            -
             | 
| 9 | 
            -
            @click.command()
         | 
| 10 | 
            -
            @click.option("--lockfile", envvar="PATHS", type=click.Path(exists=True))
         | 
| 11 | 
            -
            @click.option("--force-update", type=str, default="HEAD")
         | 
| 12 | 
            -
            def sync(lockfile: Optional[pathlib.Path], force_update: bool):
         | 
| 13 | 
            -
                if not lockfile:
         | 
| 14 | 
            -
                    lockfile = pathlib.Path.cwd() / "pocket.lock"
         | 
| 15 | 
            -
                if not lockfile.exists():
         | 
| 16 | 
            -
                    lockfile.touch()
         | 
| 17 | 
            -
                repository.sync(repository.Lockfile(path=lockfile), force_update)
         | 
    
        hyperpocket/repository/lock.py
    DELETED
    
    | @@ -1,240 +0,0 @@ | |
| 1 | 
            -
            import abc
         | 
| 2 | 
            -
            import pathlib
         | 
| 3 | 
            -
            import shutil
         | 
| 4 | 
            -
            from typing import Optional, Tuple, ClassVar
         | 
| 5 | 
            -
             | 
| 6 | 
            -
            import git
         | 
| 7 | 
            -
            from pydantic import BaseModel, Field
         | 
| 8 | 
            -
            from pydantic.fields import ModelPrivateAttr
         | 
| 9 | 
            -
             | 
| 10 | 
            -
            from hyperpocket.config import pocket_logger, settings
         | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
            class Lock(BaseModel, abc.ABC):
         | 
| 14 | 
            -
                tool_source: str = None
         | 
| 15 | 
            -
             | 
| 16 | 
            -
                @abc.abstractmethod
         | 
| 17 | 
            -
                def __str__(self):
         | 
| 18 | 
            -
                    raise NotImplementedError
         | 
| 19 | 
            -
             | 
| 20 | 
            -
                @abc.abstractmethod
         | 
| 21 | 
            -
                def key(self) -> tuple[str, ...]:
         | 
| 22 | 
            -
                    raise NotImplementedError
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                @abc.abstractmethod
         | 
| 25 | 
            -
                def sync(self, **kwargs):
         | 
| 26 | 
            -
                    raise NotImplementedError
         | 
| 27 | 
            -
             | 
| 28 | 
            -
                @abc.abstractmethod
         | 
| 29 | 
            -
                def toolpkg_path(self) -> pathlib.Path:
         | 
| 30 | 
            -
                    raise NotImplementedError
         | 
| 31 | 
            -
             | 
| 32 | 
            -
                def eject_to_path(self, dest_path: pathlib.Path, src_sub_path: str = None):
         | 
| 33 | 
            -
                    ## local locks are already tracked by git
         | 
| 34 | 
            -
                    raise NotImplementedError
         | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 37 | 
            -
            class LocalLock(Lock):
         | 
| 38 | 
            -
                tool_source: str = Field(default="local")
         | 
| 39 | 
            -
                tool_path: str
         | 
| 40 | 
            -
             | 
| 41 | 
            -
                def __init__(self, tool_path: str):
         | 
| 42 | 
            -
                    super().__init__(
         | 
| 43 | 
            -
                        tool_source="local", tool_path=str(pathlib.Path(tool_path).resolve())
         | 
| 44 | 
            -
                    )
         | 
| 45 | 
            -
             | 
| 46 | 
            -
                def __str__(self):
         | 
| 47 | 
            -
                    return f"local\t{self.tool_path}"
         | 
| 48 | 
            -
             | 
| 49 | 
            -
                def key(self):
         | 
| 50 | 
            -
                    return self.tool_source, self.tool_path.rstrip("/")
         | 
| 51 | 
            -
             | 
| 52 | 
            -
                def sync(self, **kwargs):
         | 
| 53 | 
            -
                    pocket_logger.info(f"Syncing path: {self.tool_path} ...")
         | 
| 54 | 
            -
                    pkg_path = self.toolpkg_path()
         | 
| 55 | 
            -
                    if pkg_path.exists():
         | 
| 56 | 
            -
                        shutil.rmtree(pkg_path)
         | 
| 57 | 
            -
                    shutil.copytree(self.tool_path, pkg_path)
         | 
| 58 | 
            -
             | 
| 59 | 
            -
                def toolpkg_path(self) -> pathlib.Path:
         | 
| 60 | 
            -
                    pocket_pkgs = settings.toolpkg_path
         | 
| 61 | 
            -
                    return pocket_pkgs / "local" / self.tool_path[1:]
         | 
| 62 | 
            -
             | 
| 63 | 
            -
             | 
| 64 | 
            -
            class GitLock(Lock):
         | 
| 65 | 
            -
                _remote_cache: ClassVar[dict[str, dict[str, str]]]
         | 
| 66 | 
            -
                tool_source: str = "git"
         | 
| 67 | 
            -
                repository_url: str
         | 
| 68 | 
            -
                git_ref: str
         | 
| 69 | 
            -
                ref_sha: Optional[str] = None
         | 
| 70 | 
            -
             | 
| 71 | 
            -
                def __str__(self):
         | 
| 72 | 
            -
                    return f"git\t{self.repository_url}\t{self.git_ref}\t{self.ref_sha}"
         | 
| 73 | 
            -
             | 
| 74 | 
            -
                def key(self):
         | 
| 75 | 
            -
                    return self.tool_source, self.repository_url.rstrip("/"), self.git_ref
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                def toolpkg_path(self) -> pathlib.Path:
         | 
| 78 | 
            -
                    if not self.ref_sha:
         | 
| 79 | 
            -
                        raise ValueError("ref_sha is not set")
         | 
| 80 | 
            -
                    cleansed_url = self.repository_url
         | 
| 81 | 
            -
                    if self.repository_url.startswith("http://"):
         | 
| 82 | 
            -
                        cleansed_url = self.repository_url[7:]
         | 
| 83 | 
            -
                    elif self.repository_url.startswith("https://"):
         | 
| 84 | 
            -
                        cleansed_url = self.repository_url[8:]
         | 
| 85 | 
            -
                    elif self.repository_url.startswith("git@"):
         | 
| 86 | 
            -
                        cleansed_url = self.repository_url[4:]
         | 
| 87 | 
            -
                    return settings.toolpkg_path / cleansed_url / self.ref_sha
         | 
| 88 | 
            -
             | 
| 89 | 
            -
                def sync(self, force_update: bool = False, **kwargs):
         | 
| 90 | 
            -
                    """
         | 
| 91 | 
            -
                    Synchronize the local git repository with the target remote branch.
         | 
| 92 | 
            -
             | 
| 93 | 
            -
                    1. Check if the SHA of the target ref in the remote repository matches the current local SHA.
         | 
| 94 | 
            -
                    2. If they do not match, fetch the target ref from the remote repository and do a hard reset
         | 
| 95 | 
            -
                       to align the local repository with the remote version.
         | 
| 96 | 
            -
                    """
         | 
| 97 | 
            -
                    try:
         | 
| 98 | 
            -
                        pocket_logger.info(
         | 
| 99 | 
            -
                            f"Syncing git: {self.repository_url} @ ref: {self.git_ref} ..."
         | 
| 100 | 
            -
                        )
         | 
| 101 | 
            -
             | 
| 102 | 
            -
                        # get new sha from refs
         | 
| 103 | 
            -
                        new_sha = self._get_new_sha_if_exists_in_remote()
         | 
| 104 | 
            -
                        if new_sha is None:
         | 
| 105 | 
            -
                            raise ValueError(
         | 
| 106 | 
            -
                                f"Could not find ref {self.git_ref} in {self.repository_url}"
         | 
| 107 | 
            -
                            )
         | 
| 108 | 
            -
             | 
| 109 | 
            -
                        # check self.ref_sha should be updated
         | 
| 110 | 
            -
                        if self.ref_sha != new_sha:
         | 
| 111 | 
            -
                            if force_update or self.ref_sha is None:
         | 
| 112 | 
            -
                                self.ref_sha = new_sha
         | 
| 113 | 
            -
             | 
| 114 | 
            -
                        # make pkg_version_path dir if not exists
         | 
| 115 | 
            -
                        pkg_version_path = self.toolpkg_path()
         | 
| 116 | 
            -
                        if not pkg_version_path.exists():
         | 
| 117 | 
            -
                            pkg_version_path.mkdir(parents=True)
         | 
| 118 | 
            -
             | 
| 119 | 
            -
                        # init git repo in local and set origin url
         | 
| 120 | 
            -
                        repo = git.Repo.init(pkg_version_path)
         | 
| 121 | 
            -
                        try:
         | 
| 122 | 
            -
                            remote = repo.remote("origin")
         | 
| 123 | 
            -
                            remote.set_url(self.repository_url)
         | 
| 124 | 
            -
                        except ValueError:
         | 
| 125 | 
            -
                            remote = repo.create_remote("origin", self.repository_url)
         | 
| 126 | 
            -
             | 
| 127 | 
            -
                        # check current local commit include new_sha
         | 
| 128 | 
            -
                        # if not included, fetch and do hard reset
         | 
| 129 | 
            -
                        exist_sha = None
         | 
| 130 | 
            -
                        try:
         | 
| 131 | 
            -
                            exist_sha = repo.head.commit.hexsha
         | 
| 132 | 
            -
                        except ValueError:
         | 
| 133 | 
            -
                            pass
         | 
| 134 | 
            -
                        if exist_sha is None or exist_sha != self.ref_sha:
         | 
| 135 | 
            -
                            remote.fetch(depth=1, refspec=self.ref_sha)
         | 
| 136 | 
            -
                            repo.git.checkout(new_sha)
         | 
| 137 | 
            -
                            repo.git.reset("--hard", new_sha)
         | 
| 138 | 
            -
                            repo.git.clean("-fd")
         | 
| 139 | 
            -
                    except Exception as e:
         | 
| 140 | 
            -
                        pocket_logger.error(
         | 
| 141 | 
            -
                            f"failed to sync git: {self.repository_url} @ ref: {self.git_ref}. reason : {e}"
         | 
| 142 | 
            -
                        )
         | 
| 143 | 
            -
                        raise e
         | 
| 144 | 
            -
             | 
| 145 | 
            -
                def _get_new_sha_if_exists_in_remote(self):
         | 
| 146 | 
            -
                    """
         | 
| 147 | 
            -
                    get new sha in refs
         | 
| 148 | 
            -
                    First, check remote sha is matched to saved ref_sha
         | 
| 149 | 
            -
                    Second, check remote ref name is matched to saved ref name
         | 
| 150 | 
            -
                    Third, check local ref name is matched to saved ref name
         | 
| 151 | 
            -
                    And last, check tag ref name is matched to saved ref name
         | 
| 152 | 
            -
                    """
         | 
| 153 | 
            -
                    refs = git.cmd.Git().ls_remote(self.repository_url)
         | 
| 154 | 
            -
             | 
| 155 | 
            -
                    new_sha = None
         | 
| 156 | 
            -
                    for r in refs.split("\n"):
         | 
| 157 | 
            -
                        sha, ref = r.split("\t")
         | 
| 158 | 
            -
                        if sha == self.ref_sha:
         | 
| 159 | 
            -
                            new_sha = sha
         | 
| 160 | 
            -
                            break
         | 
| 161 | 
            -
                        elif ref == self.git_ref:
         | 
| 162 | 
            -
                            new_sha = sha
         | 
| 163 | 
            -
                            break
         | 
| 164 | 
            -
                        elif ref == f"refs/heads/{self.git_ref}":
         | 
| 165 | 
            -
                            new_sha = sha
         | 
| 166 | 
            -
                            break
         | 
| 167 | 
            -
                        elif ref == f"refs/tags/{self.git_ref}":
         | 
| 168 | 
            -
                            new_sha = sha
         | 
| 169 | 
            -
                            break
         | 
| 170 | 
            -
                    return new_sha
         | 
| 171 | 
            -
             | 
| 172 | 
            -
                @classmethod
         | 
| 173 | 
            -
                def get_git_branches(cls, repo_url):
         | 
| 174 | 
            -
                    if not hasattr(cls, "_remote_cache"):
         | 
| 175 | 
            -
                        cls._remote_cache = {}
         | 
| 176 | 
            -
                    if cls._remote_cache.get(repo_url) is None:
         | 
| 177 | 
            -
                        ls_lists = git.cmd.Git().ls_remote(repo_url)
         | 
| 178 | 
            -
             | 
| 179 | 
            -
                        branches = {}
         | 
| 180 | 
            -
                        for line in ls_lists.split("\n"):
         | 
| 181 | 
            -
                            sha, ref = line.split("\t")
         | 
| 182 | 
            -
                            if ref.startswith("refs/heads/"):
         | 
| 183 | 
            -
                                branch_name = ref.replace("refs/heads/", "")
         | 
| 184 | 
            -
                                branches[branch_name] = sha
         | 
| 185 | 
            -
                        cls._remote_cache[repo_url] = branches
         | 
| 186 | 
            -
                    return cls._remote_cache[repo_url]
         | 
| 187 | 
            -
             | 
| 188 | 
            -
                @classmethod
         | 
| 189 | 
            -
                def parse_repo_url(cls, repo_url: str) -> Tuple[str, str, str]:
         | 
| 190 | 
            -
                    """
         | 
| 191 | 
            -
                    Parses a GitHub repository URL with optional branch and path information.
         | 
| 192 | 
            -
             | 
| 193 | 
            -
                    Returns:
         | 
| 194 | 
            -
                        Tuple[str, str, str]: base_repo, branch_name, directory_path
         | 
| 195 | 
            -
                    """
         | 
| 196 | 
            -
                    if not repo_url.startswith("https://github.com/"):
         | 
| 197 | 
            -
                        raise AttributeError("Only GitHub URLs are supported")
         | 
| 198 | 
            -
             | 
| 199 | 
            -
                    # Remove the base URL and split the path
         | 
| 200 | 
            -
                    repo_path = repo_url.removeprefix("https://github.com/")
         | 
| 201 | 
            -
                    repo_path_list = repo_path.split("/")
         | 
| 202 | 
            -
             | 
| 203 | 
            -
                    # Check if the URL contains 'tree' (indicating branch and sub-path information)
         | 
| 204 | 
            -
                    if "tree" not in repo_path_list:
         | 
| 205 | 
            -
                        # If no 'tree', return the full repository URL
         | 
| 206 | 
            -
                        return repo_url, "HEAD", ""
         | 
| 207 | 
            -
             | 
| 208 | 
            -
                    # Parse base repo URL and remaining path
         | 
| 209 | 
            -
                    tree_index = repo_path_list.index("tree")
         | 
| 210 | 
            -
                    base_repo = f"https://github.com/{'/'.join(repo_path_list[:tree_index])}"
         | 
| 211 | 
            -
                    sub_path = repo_path_list[tree_index + 1 :]
         | 
| 212 | 
            -
             | 
| 213 | 
            -
                    # Fetch branch information
         | 
| 214 | 
            -
                    branches = cls.get_git_branches(base_repo)
         | 
| 215 | 
            -
             | 
| 216 | 
            -
                    # Find branch and sub-directory path
         | 
| 217 | 
            -
                    for idx in range(1, len(sub_path) + 1):
         | 
| 218 | 
            -
                        branch_name = "/".join(sub_path[:idx])
         | 
| 219 | 
            -
                        if branch_name in branches:
         | 
| 220 | 
            -
                            directory_path = (
         | 
| 221 | 
            -
                                "/".join(sub_path[idx:]) if idx < len(sub_path) else None
         | 
| 222 | 
            -
                            )
         | 
| 223 | 
            -
                            return base_repo, branch_name, directory_path
         | 
| 224 | 
            -
             | 
| 225 | 
            -
                    # If no valid branch is found, raise an error
         | 
| 226 | 
            -
                    raise ValueError("Branch not found in repository")
         | 
| 227 | 
            -
             | 
| 228 | 
            -
                def eject_to_path(self, dest_path: pathlib.Path, src_sub_path: str = None):
         | 
| 229 | 
            -
                    # clone the git repository to the target path
         | 
| 230 | 
            -
                    pocket_logger.info(
         | 
| 231 | 
            -
                        f"Ejecting git: {self.repository_url} @ ref: {self.git_ref} source in path: {src_sub_path} to {dest_path} ..."
         | 
| 232 | 
            -
                    )
         | 
| 233 | 
            -
                    if dest_path.exists():
         | 
| 234 | 
            -
                        shutil.rmtree(dest_path)
         | 
| 235 | 
            -
             | 
| 236 | 
            -
                    if src_sub_path:
         | 
| 237 | 
            -
                        src_path = self.toolpkg_path() / src_sub_path
         | 
| 238 | 
            -
                    else:
         | 
| 239 | 
            -
                        src_path = self.toolpkg_path()
         | 
| 240 | 
            -
                    shutil.copytree(src_path, dest_path)
         | 
| @@ -1,62 +0,0 @@ | |
| 1 | 
            -
            import pathlib
         | 
| 2 | 
            -
            from concurrent.futures.thread import ThreadPoolExecutor
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            from hyperpocket.repository.lock import GitLock, LocalLock, Lock
         | 
| 5 | 
            -
             | 
| 6 | 
            -
             | 
| 7 | 
            -
            class Lockfile:
         | 
| 8 | 
            -
                path: pathlib.Path = None
         | 
| 9 | 
            -
                locks: dict[tuple, Lock] = None
         | 
| 10 | 
            -
                referenced_locks: set[tuple] = None
         | 
| 11 | 
            -
             | 
| 12 | 
            -
                def __init__(self, path: pathlib.Path):
         | 
| 13 | 
            -
                    self.path = path
         | 
| 14 | 
            -
                    self.locks = {}
         | 
| 15 | 
            -
                    self.referenced_locks = set()
         | 
| 16 | 
            -
                    if self.path.exists():
         | 
| 17 | 
            -
                        with open(self.path, "r") as f:
         | 
| 18 | 
            -
                            for line in f:
         | 
| 19 | 
            -
                                split = line.strip().split("\t")
         | 
| 20 | 
            -
                                source = split[0]
         | 
| 21 | 
            -
                                if source == "local":
         | 
| 22 | 
            -
                                    lock = LocalLock(tool_path=split[1])
         | 
| 23 | 
            -
                                elif source == "git":
         | 
| 24 | 
            -
                                    lock = GitLock(
         | 
| 25 | 
            -
                                        repository_url=split[1],
         | 
| 26 | 
            -
                                        git_ref=split[2],
         | 
| 27 | 
            -
                                        ref_sha=split[3],
         | 
| 28 | 
            -
                                    )
         | 
| 29 | 
            -
                                else:
         | 
| 30 | 
            -
                                    raise ValueError(f"Unknown tool source: {source}")
         | 
| 31 | 
            -
                                self.locks[lock.key()] = lock
         | 
| 32 | 
            -
                    else:
         | 
| 33 | 
            -
                        self.path.touch()
         | 
| 34 | 
            -
             | 
| 35 | 
            -
                def add_lock(self, lock: Lock):
         | 
| 36 | 
            -
                    if lock.key() not in self.locks:
         | 
| 37 | 
            -
                        self.locks[lock.key()] = lock
         | 
| 38 | 
            -
                    self.referenced_locks.add(lock.key())
         | 
| 39 | 
            -
             | 
| 40 | 
            -
                def remove_lock(self, key: tuple[str, ...]):
         | 
| 41 | 
            -
                    self.locks.pop(key)
         | 
| 42 | 
            -
                    if key in self.referenced_locks:
         | 
| 43 | 
            -
                        self.referenced_locks.remove(key)
         | 
| 44 | 
            -
             | 
| 45 | 
            -
                def get_lock(self, key: tuple[str, ...]):
         | 
| 46 | 
            -
                    return self.locks[key]
         | 
| 47 | 
            -
             | 
| 48 | 
            -
                def sync(self, force_update: bool, referenced_only: bool = False):
         | 
| 49 | 
            -
                    if referenced_only:
         | 
| 50 | 
            -
                        locks = [self.get_lock(key) for key in self.referenced_locks]
         | 
| 51 | 
            -
                    else:
         | 
| 52 | 
            -
                        locks = list(self.locks.values())
         | 
| 53 | 
            -
                    with ThreadPoolExecutor(
         | 
| 54 | 
            -
                        max_workers=min(len(locks) + 1, 100), thread_name_prefix="repository_loader"
         | 
| 55 | 
            -
                    ) as executor:
         | 
| 56 | 
            -
                        executor.map(lambda lock: lock.sync(force_update=force_update), locks)
         | 
| 57 | 
            -
                    self.write()
         | 
| 58 | 
            -
             | 
| 59 | 
            -
                def write(self):
         | 
| 60 | 
            -
                    with open(self.path, "w") as f:
         | 
| 61 | 
            -
                        for lock in self.locks.values():
         | 
| 62 | 
            -
                            f.write(str(lock) + "\n")
         | 
| @@ -1,33 +0,0 @@ | |
| 1 | 
            -
            from typing import Optional
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            from pydantic import BaseModel, Field
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            from hyperpocket.tool.wasm.script import ScriptFileNode
         | 
| 6 | 
            -
             | 
| 7 | 
            -
             | 
| 8 | 
            -
            class Script(BaseModel):
         | 
| 9 | 
            -
                id: str = Field(alias="id")
         | 
| 10 | 
            -
                tool_id: str = Field(alias="tool_id")
         | 
| 11 | 
            -
             | 
| 12 | 
            -
             | 
| 13 | 
            -
            class ScriptResult(BaseModel):
         | 
| 14 | 
            -
                stdout: Optional[str] = Field(alias="stdout", default=None)
         | 
| 15 | 
            -
                stderr: Optional[str] = Field(alias="stderr", default=None)
         | 
| 16 | 
            -
                error: Optional[str] = Field(alias="error", default=None)
         | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
            class ScriptFileTree(BaseModel):
         | 
| 20 | 
            -
                tree: dict[str, ScriptFileNode] = Field(alias="tree")
         | 
| 21 | 
            -
             | 
| 22 | 
            -
             | 
| 23 | 
            -
            class ScriptEntrypoint(BaseModel):
         | 
| 24 | 
            -
                package_name: Optional[str] = Field(alias="package_name")
         | 
| 25 | 
            -
                entrypoint: str = Field(alias="entrypoint")
         | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 28 | 
            -
            class ScriptEncodedFile(BaseModel):
         | 
| 29 | 
            -
                encoded_file: str = Field(alias="encoded_file")
         | 
| 30 | 
            -
             | 
| 31 | 
            -
             | 
| 32 | 
            -
            class ScriptFileRequest(BaseModel):
         | 
| 33 | 
            -
                path: str = Field(alias="path")
         | 
    
        hyperpocket/server/tool/wasm.py
    DELETED
    
    | @@ -1,46 +0,0 @@ | |
| 1 | 
            -
            from fastapi import APIRouter
         | 
| 2 | 
            -
            from fastapi.responses import FileResponse, HTMLResponse
         | 
| 3 | 
            -
             | 
| 4 | 
            -
            from hyperpocket.futures import FutureStore
         | 
| 5 | 
            -
            from hyperpocket.server.tool.dto import script as scriptdto
         | 
| 6 | 
            -
            from hyperpocket.tool.wasm.script import ScriptStore
         | 
| 7 | 
            -
             | 
| 8 | 
            -
            wasm_tool_router = APIRouter(prefix="/wasm")
         | 
| 9 | 
            -
             | 
| 10 | 
            -
             | 
| 11 | 
            -
            @wasm_tool_router.get("/scripts/{script_id}/browse", response_class=HTMLResponse)
         | 
| 12 | 
            -
            async def browse_script_page(script_id: str):
         | 
| 13 | 
            -
                html = ScriptStore.get_script(script_id).rendered_html
         | 
| 14 | 
            -
                return HTMLResponse(content=html)
         | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
            @wasm_tool_router.post("/scripts/{script_id}/done")
         | 
| 18 | 
            -
            async def done_script_page(
         | 
| 19 | 
            -
                script_id: str, req: scriptdto.ScriptResult
         | 
| 20 | 
            -
            ) -> scriptdto.ScriptResult:
         | 
| 21 | 
            -
                FutureStore.resolve_future(
         | 
| 22 | 
            -
                    script_id, {"stdout": req.stdout, "stderr": req.stderr, "error": req.error}
         | 
| 23 | 
            -
                )
         | 
| 24 | 
            -
                return req
         | 
| 25 | 
            -
             | 
| 26 | 
            -
             | 
| 27 | 
            -
            @wasm_tool_router.get("/scripts/{script_id}/file_tree")
         | 
| 28 | 
            -
            async def get_file_tree(script_id: str) -> scriptdto.ScriptFileTree:
         | 
| 29 | 
            -
                script = ScriptStore.get_script(script_id)
         | 
| 30 | 
            -
                return scriptdto.ScriptFileTree(tree=script.load_file_tree())
         | 
| 31 | 
            -
             | 
| 32 | 
            -
             | 
| 33 | 
            -
            @wasm_tool_router.get("/scripts/{script_id}/entrypoint")
         | 
| 34 | 
            -
            async def get_entrypoint(script_id: str) -> scriptdto.ScriptEntrypoint:
         | 
| 35 | 
            -
                script = ScriptStore.get_script(script_id)
         | 
| 36 | 
            -
                package_name = script.package_name
         | 
| 37 | 
            -
                entrypoint = f"/tools/wasm/scripts/{script_id}/file/{script.entrypoint}"
         | 
| 38 | 
            -
                return scriptdto.ScriptEntrypoint(package_name=package_name, entrypoint=entrypoint)
         | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
            @wasm_tool_router.get(
         | 
| 42 | 
            -
                "/scripts/{script_id}/file/{file_name}", response_class=FileResponse
         | 
| 43 | 
            -
            )
         | 
| 44 | 
            -
            async def get_dist_file(script_id: str, file_name: str):
         | 
| 45 | 
            -
                script = ScriptStore.get_script(script_id)
         | 
| 46 | 
            -
                return FileResponse(script.dist_file_path(file_name))
         |