├── Justfile ├── .dockerignore ├── .python-version ├── toolchain ├── book_src │ ├── library │ │ └── ai.md │ ├── CODE_GENERATION.md │ ├── RUNNING_EXAMPLES.md │ ├── SUMMARY.md │ ├── COMMON_ERRORS.md │ ├── DEV_ENVIRONMENT.md │ ├── FUTURE_WORK.md │ └── ARCHITECTURE.md ├── chidori-debugger │ ├── src │ │ ├── file_interaction.rs │ │ ├── tidy_tree │ │ │ ├── utils.rs │ │ │ ├── iter.rs │ │ │ ├── layout.rs │ │ │ ├── LICENSE │ │ │ └── layout │ │ │ │ └── linked_y_list.rs │ │ ├── bevy_egui │ │ │ ├── README.md │ │ │ └── LICENSE │ │ ├── bevy_prototype_lyon │ │ │ ├── utils.rs │ │ │ ├── LICENSE-MIT │ │ │ ├── vertex.rs │ │ │ ├── draw.rs │ │ │ ├── entity.rs │ │ │ └── mod.rs │ │ └── egui_json_tree │ │ │ ├── delimiters.rs │ │ │ ├── default_expand.rs │ │ │ ├── response.rs │ │ │ ├── LICENSE-MIT │ │ │ └── mod.rs │ ├── assets │ │ ├── images │ │ │ └── tblogo-white.png │ │ ├── fonts │ │ │ ├── Inter │ │ │ │ ├── static │ │ │ │ │ ├── Inter-Black.ttf │ │ │ │ │ ├── Inter-Bold.ttf │ │ │ │ │ ├── Inter-Light.ttf │ │ │ │ │ ├── Inter-Medium.ttf │ │ │ │ │ ├── Inter-Thin.ttf │ │ │ │ │ ├── Inter-Regular.ttf │ │ │ │ │ ├── Inter-SemiBold.ttf │ │ │ │ │ ├── Inter-ExtraBold.ttf │ │ │ │ │ └── Inter-ExtraLight.ttf │ │ │ │ └── Inter-VariableFont_slnt,wght.ttf │ │ │ └── CommitMono-1.143 │ │ │ │ ├── CommitMono-400-Italic.otf │ │ │ │ ├── CommitMono-400-Regular.otf │ │ │ │ ├── CommitMono-700-Italic.otf │ │ │ │ ├── CommitMono-700-Regular.otf │ │ │ │ ├── ttfautohint │ │ │ │ ├── CommitMono-400-Italic.ttf │ │ │ │ ├── CommitMono-700-Italic.ttf │ │ │ │ ├── CommitMono-400-Regular.ttf │ │ │ │ └── CommitMono-700-Regular.ttf │ │ │ │ ├── custom-settings.json │ │ │ │ └── installation.txt │ │ └── shaders │ │ │ ├── line_material.wgsl │ │ │ └── egui.wgsl │ └── examples │ │ ├── demo4_story_generator │ │ ├── demo.md │ │ └── main.rs │ │ ├── core1_simple_math │ │ ├── core.md │ │ └── main.rs │ │ ├── core12_dependency_management │ │ ├── core.md │ │ └── main.rs │ │ ├── demo9_arc_agi │ │ ├── demo.md │ │ ├── constants.py │ │ ├── main.rs │ │ └── arc_types.py │ │ ├── demo6_open_devin │ │ ├── pyproject.toml │ │ └── main.rs │ │ ├── demo7_comfyui │ │ ├── pyproject.toml │ │ └── main.rs │ │ ├── demo6_code_docs_updater │ │ ├── pyproject.toml │ │ └── main.rs │ │ ├── demo10_cpt_codes │ │ ├── demo.md │ │ └── main.rs │ │ ├── core8_prompt_code_generation_and_execution │ │ ├── core.md │ │ └── main.rs │ │ ├── core11_hono │ │ ├── main.rs │ │ └── core.md │ │ ├── core2_marshalling │ │ └── main.rs │ │ ├── demo2_gpt_migrate │ │ └── main.rs │ │ ├── demo5_todomvc │ │ └── main.rs │ │ ├── core10_concurrency │ │ ├── main.rs │ │ └── core.md │ │ ├── core13_state_machine │ │ └── main.rs │ │ ├── demo1_business_analyst │ │ ├── main.rs │ │ └── demo.md │ │ ├── core3_function_invocations │ │ ├── main.rs │ │ └── core.md │ │ ├── demo3_self_healing_scaper │ │ ├── main.rs │ │ └── demo.md │ │ ├── demo8_hacker_news_scraper │ │ ├── main.rs │ │ └── demo.md │ │ ├── core4_async_function_invocations │ │ ├── main.rs │ │ └── core.md │ │ ├── core7_rag_stateful_memory_cells │ │ └── main.rs │ │ ├── core9_multi_agent_simulation │ │ └── main.rs │ │ ├── experiment1_explicit_imports │ │ └── main.rs │ │ ├── core5_prompts_invoked_as_functions │ │ ├── main.rs │ │ └── core.md │ │ └── core6_prompts_leveraging_function_calling │ │ ├── main.rs │ │ └── core.md ├── chidori-static-analysis │ ├── src │ │ ├── flow │ │ │ ├── python.rs │ │ │ └── mod.rs │ │ ├── language │ │ │ ├── javascript │ │ │ │ ├── mod.rs │ │ │ │ └── snapshots │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__traditional_for_loop-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__assignment_to_value.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__basic_array_destructuring-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__nested_object_destructuring-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_gaps-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__basic_object_destructuring-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_with_alias_and_default_value-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_rest-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_const_declaration-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_let_declaration-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_multiple_declarations-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_var_declaration-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_default_values-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_break_statement-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__mixed_destructuring-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_continue_statement-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__nested_for_loops-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__nested_object_destructuring.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__complex_nested_destructuring-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__variable_swapping_with_destructuring-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_array-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_with_alias_and_default_value.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__object_destructuring_with_renaming_and_default-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__object_destructuring_with_rest_properties-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_with_computed_property_names-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_in_loop_with_object-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_object_destructuring-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__report_for_simple_function-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_destructuring-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_in_for_of_loops-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__basic_array_destructuring.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_gaps.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__basic_object_destructuring.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_rest.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_default_values.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__complex_nested_destructuring.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__object_destructuring_with_rest_properties.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_in_function_parameters-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_returned_arrays-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__object_destructuring_with_renaming_and_default.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__report_generation-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__mixed_destructuring.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_with_computed_property_names.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__report_for_simple_function.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__report_generation_with_object_destructuring-2.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__nothing_extracted_with_no_ch_references.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__extraction_of_ch_statements.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__traditional_for_loop.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__variable_swapping_with_destructuring.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_returned_arrays.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_array.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_break_statement.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_continue_statement.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__function_decorator_ch_annotation.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__ch_function_decoration_referring_to_another_function.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_in_loop_with_object.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__pipe_function_composition.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_in_function_parameters.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_object_destructuring.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_destructuring.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_in_for_of_loops.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__ch_reference_internal_to_function.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_multiple_declarations.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__ch_function_with_arguments.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__nested_for_loops.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_let_declaration.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_var_declaration.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_const_declaration.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__report_generation.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__report_generation_with_import.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__report_generation_with_object_destructuring.snap │ │ │ │ │ ├── chidori_static_analysis__language__javascript__parse__tests__function_decorator_ch_annotation_with_internal_ch_and_emit.snap │ │ │ │ │ └── chidori_static_analysis__language__javascript__parse__tests__handling_react_hook_style_refrence.snap │ │ │ └── python │ │ │ │ ├── mod.rs │ │ │ │ └── snapshots │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__reference_to_undeclared_function-2.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__reference_to_undeclared_function.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__report_generation_for_loop_variable_assignment-2.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__nothing_extracted_with_no_ch_references.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__extraction_of_ch_statements.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__report_generation.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__pipe_function_composition.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__function_decorator_ch_annotation.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__ch_function_decoration_referring_to_another_function.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__ch_reference_internal_to_function.snap │ │ │ │ ├── chidori_static_analysis__language__python__parse__tests__report_generation_with_import.snap │ │ │ │ └── chidori_static_analysis__language__python__parse__tests__classes_are_identified.snap │ │ ├── main.rs │ │ └── lib.rs │ ├── .gitignore │ ├── jest.config.ts │ ├── babel.config.js │ ├── .github │ │ └── dependabot.yml │ ├── .appveyor.yml │ ├── tests │ │ └── web.rs │ ├── package.json │ ├── LICENSE_MIT │ └── Cargo.toml ├── chidori-core │ ├── .gitignore │ ├── src │ │ ├── library │ │ │ ├── mod.rs │ │ │ ├── std │ │ │ │ ├── ai │ │ │ │ │ ├── mod.rs │ │ │ │ │ ├── llm │ │ │ │ │ │ └── snapshots │ │ │ │ │ │ │ └── chidori_core__library__std__ai__llm__test__tool_usage_inference.snap │ │ │ │ │ └── memory │ │ │ │ │ │ └── mod.rs │ │ │ │ ├── mod.rs │ │ │ │ ├── debugger │ │ │ │ │ └── mod.rs │ │ │ │ ├── code │ │ │ │ │ └── mod.rs │ │ │ │ └── scheduling │ │ │ │ │ ├── mod.rs │ │ │ │ │ └── README.md │ │ │ └── README.md │ │ ├── execution │ │ │ ├── mod.rs │ │ │ ├── primitives │ │ │ │ ├── mod.rs │ │ │ │ └── identifiers.rs │ │ │ └── execution │ │ │ │ └── mod.rs │ │ ├── sdk │ │ │ ├── mod.rs │ │ │ └── snapshots │ │ │ │ ├── chidori_core__sdk__md__test__core1.snap │ │ │ │ ├── chidori_core__sdk__md__test__extract_markdown.snap │ │ │ │ ├── chidori_core__sdk__md__test__core7.snap │ │ │ │ ├── chidori_core__sdk__md__test__core6.snap │ │ │ │ ├── chidori_core__sdk__md__test__core4.snap │ │ │ │ ├── chidori_core__sdk__md__test__core3.snap │ │ │ │ ├── chidori_core__sdk__md__test__core5.snap │ │ │ │ └── chidori_core__sdk__md__test__core5.snap.new │ │ ├── utils │ │ │ └── error.rs │ │ └── lib.rs │ ├── tests │ │ └── data │ │ │ ├── files_and_dirs.zip │ │ │ └── markdown_graph_loader │ │ │ └── example.md │ ├── pyproject.toml │ ├── CHANGELOG.md │ ├── package.json │ └── README.md ├── rust-toolchain ├── chidori-prompt-format │ ├── src │ │ ├── templating │ │ │ └── mod.rs │ │ └── utils.rs │ ├── .gitignore │ ├── jest.config.ts │ ├── babel.config.js │ ├── .github │ │ └── dependabot.yml │ ├── README.md │ ├── .appveyor.yml │ ├── package.json │ ├── LICENSE_MIT │ ├── tests │ │ ├── nodejs │ │ │ └── chidoriPromptFormat.test.ts │ │ └── web.rs │ └── Cargo.toml ├── scripts │ ├── tracing │ │ ├── .gitignore │ │ └── docker-compose.yml │ ├── create_cargo_changelog.sh │ ├── install_quickwit_graphana_data_source_plugin.sh │ └── update_version_numbers.sh ├── book.toml ├── .run │ └── Test execution__database__tests__test_traverse_single_node.run.xml └── Cargo.toml ├── deployment ├── README.md ├── telemetry │ └── README.md └── docker-single-container │ ├── Dockerfile │ ├── init.sh │ └── litellm_config.yaml ├── .pre-commit-config.yaml ├── media ├── ChidoriPanel.png └── chidoriFrame.png ├── .idea ├── .gitignore ├── modules.xml └── vcs.xml ├── devenv.yaml ├── pyproject.toml ├── .github └── workflows │ ├── push.yml │ ├── release.yml │ └── rust.yml ├── LICENSE ├── .gitignore ├── litellm_config.yaml └── devenv.nix /Justfile: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | target -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.12 2 | -------------------------------------------------------------------------------- /toolchain/book_src/library/ai.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /deployment/README.md: -------------------------------------------------------------------------------- 1 | # Deployment Examples -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/file_interaction.rs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/flow/python.rs: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /toolchain/chidori-core/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | /.env 3 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod std; 2 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/flow/mod.rs: -------------------------------------------------------------------------------- 1 | mod python; -------------------------------------------------------------------------------- /toolchain/rust-toolchain: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly" -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/src/templating/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod templates; 2 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod parse; 2 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod parse; 2 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/std/ai/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod llm; 2 | pub mod memory; 3 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/main.rs: -------------------------------------------------------------------------------- 1 | mod language; 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | /nix/store/dg7b04vxfdf5l7vw0smjjn5jcjg8jwi6-pre-commit-config.json -------------------------------------------------------------------------------- /deployment/telemetry/README.md: -------------------------------------------------------------------------------- 1 | # How do I capture telemetry from a Chidori agent? 2 | 3 | -------------------------------------------------------------------------------- /toolchain/book_src/CODE_GENERATION.md: -------------------------------------------------------------------------------- 1 | # Understanding Code Generation in Chidori 2 | 3 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/execution/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod execution; 2 | pub mod primitives; 3 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/std/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod ai; 2 | pub mod code; 3 | mod scheduling; 4 | -------------------------------------------------------------------------------- /media/ChidoriPanel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/media/ChidoriPanel.png -------------------------------------------------------------------------------- /media/chidoriFrame.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/media/chidoriFrame.png -------------------------------------------------------------------------------- /toolchain/scripts/tracing/.gitignore: -------------------------------------------------------------------------------- 1 | quickwit-quickwit-datasource-0.2.0.zip 2 | grafana-storage 3 | ./qwdata 4 | -------------------------------------------------------------------------------- /toolchain/scripts/create_cargo_changelog.sh: -------------------------------------------------------------------------------- 1 | cargo changelog --write prompt-graph-core prompt-graph-exec chidori 2 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/execution/primitives/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod identifiers; 2 | pub mod operation; 3 | pub mod serialized_value; 4 | -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | Cargo.lock 4 | bin/ 5 | pkg/ 6 | pkg_node/ 7 | wasm-pack.log 8 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | Cargo.lock 4 | bin/ 5 | pkg/ 6 | pkg_node/ 7 | wasm-pack.log 8 | -------------------------------------------------------------------------------- /toolchain/book_src/RUNNING_EXAMPLES.md: -------------------------------------------------------------------------------- 1 | # How to run examples 2 | 3 | `pip install litellm[proxy]` 4 | `litellm --model gpt-3.5-turbo --debug` -------------------------------------------------------------------------------- /toolchain/chidori-core/src/sdk/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod md; 2 | pub mod interactive_chidori_wrapper; 3 | pub mod chidori_runtime_instance; 4 | mod ipynb; 5 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/std/debugger/mod.rs: -------------------------------------------------------------------------------- 1 | /// TODO: this should include cell types that integrate with Chidori UI 2 | /// such as a chat cell -------------------------------------------------------------------------------- /toolchain/chidori-core/tests/data/files_and_dirs.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-core/tests/data/files_and_dirs.zip -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/jest.config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | moduleNameMapper: { 3 | chidori_prompt_format: "/./pkg_node", 4 | }, 5 | }; -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/jest.config.ts: -------------------------------------------------------------------------------- 1 | export default { 2 | moduleNameMapper: { 3 | chidori_static_analysis: "/./pkg_node", 4 | }, 5 | }; -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/images/tblogo-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/images/tblogo-white.png -------------------------------------------------------------------------------- /toolchain/chidori-core/src/utils/error.rs: -------------------------------------------------------------------------------- 1 | use thiserror::Error; 2 | 3 | #[derive(Error, Debug)] 4 | pub enum ChidoriError { 5 | #[error("unknown chidori error")] 6 | Unknown, 7 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo4_story_generator/demo.md: -------------------------------------------------------------------------------- 1 | # This is an agent backing a quiz generation website, it assists the user in interacting with the website. 2 | 3 | 4 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/tidy_tree/utils.rs: -------------------------------------------------------------------------------- 1 | use chidori_core::cells::{CellTypes, LLMPromptCell}; 2 | use chidori_core::execution::primitives::serialized_value::RkyvSerializedValue; 3 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Black.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Bold.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Light.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Medium.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Thin.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Thin.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-Regular.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-SemiBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-SemiBold.ttf -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | ['@babel/preset-env', {targets: {node: 'current'}}], 4 | '@babel/preset-typescript', 5 | ], 6 | }; 7 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | ['@babel/preset-env', {targets: {node: 'current'}}], 4 | '@babel/preset-typescript', 5 | ], 6 | }; 7 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-ExtraBold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-ExtraBold.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-ExtraLight.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/static/Inter-ExtraLight.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core1_simple_math/core.md: -------------------------------------------------------------------------------- 1 | ```python 2 | x = 20 3 | ``` 4 | 5 | ```python 6 | y = x * 20 7 | ``` 8 | 9 | ```javascript 10 | const zj = y + 20; 11 | ``` 12 | 13 | -------------------------------------------------------------------------------- /toolchain/book_src/SUMMARY.md: -------------------------------------------------------------------------------- 1 | # Summary 2 | 3 | - [Introduction](README.md) 4 | - [Architecture](ARCHITECTURE.md) 5 | - [Library](library/HOME.md) 6 | - [AI](library/ai.md) 7 | - [Future Work](FUTURE_WORK.md) 8 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/Inter/Inter-VariableFont_slnt,wght.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/Inter/Inter-VariableFont_slnt,wght.ttf -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | # Editor-based HTTP Client requests 5 | /httpRequests/ 6 | # Datasource local storage ignored files 7 | /dataSources/ 8 | /dataSources.local.xml 9 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/CommitMono-400-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/CommitMono-400-Italic.otf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/CommitMono-400-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/CommitMono-400-Regular.otf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/CommitMono-700-Italic.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/CommitMono-700-Italic.otf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/CommitMono-700-Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/CommitMono-700-Regular.otf -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: cargo 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "08:00" 8 | open-pull-requests-limit: 10 9 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: cargo 4 | directory: "/" 5 | schedule: 6 | interval: daily 7 | time: "08:00" 8 | open-pull-requests-limit: 10 9 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/ttfautohint/CommitMono-400-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/ttfautohint/CommitMono-400-Italic.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/ttfautohint/CommitMono-700-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/ttfautohint/CommitMono-700-Italic.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core12_dependency_management/core.md: -------------------------------------------------------------------------------- 1 | # Demonstrating dependency management 2 | 3 | ```javascript 4 | import { Hono } from 'https://deno.land/x/hono/mod.ts'; 5 | ``` 6 | 7 | ```python 8 | 9 | ``` 10 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/ttfautohint/CommitMono-400-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/ttfautohint/CommitMono-400-Regular.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/ttfautohint/CommitMono-700-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ThousandBirdsInc/chidori/HEAD/toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/ttfautohint/CommitMono-700-Regular.ttf -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/bevy_egui/README.md: -------------------------------------------------------------------------------- 1 | # Modifications to Egui-Bevy 2 | 3 | * References to Window are replaced with EguiRenderTarget, allowing arbitrary components to be addressed 4 | * Egui contexts are still automatically created for windows -------------------------------------------------------------------------------- /devenv.yaml: -------------------------------------------------------------------------------- 1 | inputs: 2 | nixpkgs: 3 | url: github:NixOS/nixpkgs/nixpkgs-unstable 4 | nixpkgs-python: 5 | url: github:cachix/nixpkgs-python 6 | fenix: 7 | url: github:nix-community/fenix 8 | inputs: 9 | nixpkgs: 10 | follows: nixpkgs 11 | -------------------------------------------------------------------------------- /toolchain/book_src/COMMON_ERRORS.md: -------------------------------------------------------------------------------- 1 | 2 | # Commonly Encountered Errors 3 | 4 | ## Error: `ld: library 'python3.12' not found` 5 | 6 | Solution: 7 | Set PYO3_PYTHON=python3.12 when building chidori-debugger to your currently installed python version. 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/std/code/mod.rs: -------------------------------------------------------------------------------- 1 | /// We can add support for any language that supports code execution, whose types can be serialized to 2 | /// RkyvSerializedValue, and whose AST can be parsed into a Report. 3 | pub mod runtime_deno; 4 | pub mod runtime_pyo3; 5 | -------------------------------------------------------------------------------- /toolchain/book.toml: -------------------------------------------------------------------------------- 1 | [book] 2 | authors = ["Colton Pierson"] 3 | language = "en" 4 | multilingual = false 5 | src = "book_src" 6 | title = "chidori" 7 | 8 | [output.html] 9 | cname = "chidoriai.com" 10 | edit-url-template = "https://github.com/ThousandBirdsInc/chidori/edit/main/{path}" -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo9_arc_agi/demo.md: -------------------------------------------------------------------------------- 1 | # This agent demonstrates a code generation brute force approach to the ARC-AGI challenge 2 | Execution of this agent demonstrates visually displaying intermediates states in our execution graph 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/tidy_tree/iter.rs: -------------------------------------------------------------------------------- 1 | use crate::tidy_tree::Node; 2 | 3 | pub struct Iter<'a> { 4 | nodes: Vec<&'a Node>, 5 | } 6 | 7 | impl<'a> Iterator for Iter<'a> { 8 | type Item = &'a Node; 9 | 10 | fn next(&mut self) -> Option { 11 | self.nodes.pop() 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /toolchain/chidori-core/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "chidori-core" 3 | version = "1.0.0" 4 | description = "" 5 | authors = [{ name = "Colton Pierson", email = "colton@thousandbirds.ai" }] 6 | dependencies = [ 7 | ] 8 | readme = "README.md" 9 | requires-python = "== 3.12" 10 | 11 | [tool.rye] 12 | managed = true 13 | virtual = true -------------------------------------------------------------------------------- /toolchain/scripts/install_quickwit_graphana_data_source_plugin.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | cd tracing || exit 4 | wget https://github.com/quickwit-oss/quickwit-datasource/releases/download/v0.2.0/quickwit-quickwit-datasource-0.2.0.zip \ 5 | && mkdir -p grafana-storage/plugins \ 6 | && unzip quickwit-quickwit-datasource-0.2.0.zip -d grafana-storage/plugins 7 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/custom-settings.json: -------------------------------------------------------------------------------- 1 | {"weight":400,"italic":false,"alternates":{"cv01":false,"cv02":false,"cv03":false,"cv04":false,"cv05":false,"cv06":false,"cv07":false,"cv08":false,"cv09":false,"cv10":false,"cv11":false},"features":{"ss01":false,"ss02":false,"ss03":true,"ss04":true,"ss05":true},"letterSpacing":0,"lineHeight":1} -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/shaders/line_material.wgsl: -------------------------------------------------------------------------------- 1 | #import bevy_pbr::forward_io::VertexOutput 2 | 3 | struct LineMaterial { 4 | color: vec4, 5 | }; 6 | 7 | @group(2) @binding(0) var material: LineMaterial; 8 | 9 | @fragment 10 | fn fragment( 11 | mesh: VertexOutput, 12 | ) -> @location(0) vec4 { 13 | return material.color; 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-core/src/lib.rs: -------------------------------------------------------------------------------- 1 | #![allow(warnings)] 2 | #![feature(is_sorted)] 3 | #![feature(thread_id_value)] 4 | #![feature(generic_nonzero)] 5 | 6 | pub mod cells; 7 | pub mod execution; 8 | pub mod library; 9 | pub mod sdk; 10 | pub mod utils; 11 | 12 | pub use tokio; 13 | pub use uuid; 14 | pub use chidori_static_analysis; 15 | pub use chidori_prompt_format; 16 | -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/README.md: -------------------------------------------------------------------------------- 1 | ### Build 2 | 3 | ``` 4 | wasm-pack build 5 | ``` 6 | 7 | ### Test 8 | 9 | To test the wasm package directly 10 | ``` 11 | wasm-pack test --headless --firefox 12 | ``` 13 | 14 | To test the UX of the JS interface 15 | ``` 16 | yarn run build-local 17 | yarn run test-js 18 | ``` 19 | 20 | ### Publish to NPM 21 | 22 | ``` 23 | wasm-pack publish 24 | ``` 25 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo6_open_devin/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "gpt-engineer" 3 | version = "0.1.0" 4 | description = "" 5 | authors = ["Colton Pierson "] 6 | 7 | [tool.poetry.dependencies] 8 | python = "^3.9" 9 | aiohttp = "^3.7.4" 10 | chidori = "0.1.26" 11 | 12 | [build-system] 13 | requires = ["poetry-core>=1.0.0"] 14 | build-backend = "poetry.core.masonry.api" 15 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo7_comfyui/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "gpt-engineer" 3 | version = "0.1.0" 4 | description = "" 5 | authors = ["Colton Pierson "] 6 | 7 | [tool.poetry.dependencies] 8 | python = "^3.9" 9 | aiohttp = "^3.7.4" 10 | chidori = "0.1.26" 11 | 12 | [build-system] 13 | requires = ["poetry-core>=1.0.0"] 14 | build-backend = "poetry.core.masonry.api" 15 | -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/.appveyor.yml: -------------------------------------------------------------------------------- 1 | install: 2 | - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe 3 | - if not defined RUSTFLAGS rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly 4 | - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin 5 | - rustc -V 6 | - cargo -V 7 | 8 | build: false 9 | 10 | test_script: 11 | - cargo test --locked 12 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/.appveyor.yml: -------------------------------------------------------------------------------- 1 | install: 2 | - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe 3 | - if not defined RUSTFLAGS rustup-init.exe -y --default-host x86_64-pc-windows-msvc --default-toolchain nightly 4 | - set PATH=%PATH%;C:\Users\appveyor\.cargo\bin 5 | - rustc -V 6 | - cargo -V 7 | 8 | build: false 9 | 10 | test_script: 11 | - cargo test --locked 12 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__traditional_for_loop-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 5; i++) {\n console.log(i);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: {} 9 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__assignment_to_value.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const x = 1\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: x 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo6_code_docs_updater/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "gpt-engineer" 3 | version = "0.1.0" 4 | description = "" 5 | authors = ["Colton Pierson "] 6 | 7 | [tool.poetry.dependencies] 8 | python = "^3.9" 9 | aiohttp = "^3.7.4" 10 | chidori = "0.1.26" 11 | 12 | [build-system] 13 | requires = ["poetry-core>=1.0.0"] 14 | build-backend = "poetry.core.masonry.api" 15 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__basic_array_destructuring-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const [g, h] = [5, 6];\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | g: {} 8 | h: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__nested_object_destructuring-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { e: { f } } = { e: { f: 4 } };\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | f: {} 8 | cell_depended_values: {} 9 | triggerable_functions: {} 10 | -------------------------------------------------------------------------------- /toolchain/chidori-core/tests/data/markdown_graph_loader/example.md: -------------------------------------------------------------------------------- 1 | # Test Inter-runtime execution 2 | 3 | ```python 4 | def add(a, b): 5 | return a + b 6 | 7 | x = add(2, 3) 8 | ``` 9 | 10 | 11 | JavaScript Example 12 | Here's a JavaScript function that prints Fibonacci numbers up to a given count. 13 | ```javascript 14 | function subtract(a, b) { 15 | return a - b; 16 | } 17 | 18 | // Example usage 19 | const v = subtract(x, 5); 20 | ``` -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_gaps-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const [i, , j] = [7, 8, 9];\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | i: {} 8 | j: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__basic_object_destructuring-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { a, b } = { a: 1, b: 2 };\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | a: {} 8 | b: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_with_alias_and_default_value-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { x: newX = 100 } = {};\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | newX: {} 8 | cell_depended_values: {} 9 | triggerable_functions: {} 10 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_rest-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const [k, ...rest] = [10, 11, 12];\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | k: {} 8 | rest: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_const_declaration-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 5; i++) {\n const y = i * 2;\n console.log(y);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: {} 9 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_let_declaration-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 5; i++) {\n let x = i * 2;\n console.log(x);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: {} 9 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_multiple_declarations-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0, j = 10; i < j; i++, j--) {\n console.log(i, j);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: {} 9 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_var_declaration-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (var i = 0; i < 5; i++) {\n var z = i * 2;\n console.log(z);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: {} 9 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_default_values-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const [y = 200, z = 300] = [22];\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | y: {} 8 | z: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_break_statement-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 10; i++) {\n if (i === 5) break;\n console.log(i);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: {} 9 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__mixed_destructuring-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { l, m: [n, o] } = { l: 13, m: [14, 15] };\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | l: {} 8 | n: {} 9 | o: {} 10 | cell_depended_values: {} 11 | triggerable_functions: {} 12 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_continue_statement-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 10; i++) {\n if (i % 2 === 0) continue;\n console.log(i);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: {} 9 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__nested_for_loops-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 3; i++) {\n for (let j = 0; j < 3; j++) {\n console.log(i, j);\n }\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: {} 9 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__reference_to_undeclared_function-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "out = await read_file_and_load_to_memory(\"./\")\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | out: {} 8 | cell_depended_values: 9 | read_file_and_load_to_memory: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__nested_object_destructuring.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { e: { f } } = { e: { f: 4 } };\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: f 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__complex_nested_destructuring-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { q: { r: [s, { t }] } } = { q: { r: [17, { t: 18 }] } };\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | s: {} 8 | t: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__variable_swapping_with_destructuring-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "let aa = 'first', bb = 'second';\n[aa, bb] = [bb, aa];\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | aa: {} 8 | bb: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_array-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const array = [1, 2, 3, 4, 5];\nfor (const item of array) {\n console.log(item);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | array: {} 8 | cell_depended_values: {} 9 | triggerable_functions: {} 10 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_with_alias_and_default_value.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { x: newX = 100 } = {};\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: newX 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__object_destructuring_with_renaming_and_default-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { c: renamed, d = 'default' } = { c: 3 };\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | d: {} 8 | renamed: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__object_destructuring_with_rest_properties-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { u, ...others } = { u: 19, v: 20, w: 21 };\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | others: {} 8 | u: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_with_computed_property_names-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const key = 'p';\nconst { [key]: value } = { p: 16 };\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | key: {} 8 | value: {} 9 | cell_depended_values: {} 10 | triggerable_functions: {} 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_in_loop_with_object-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const obj = { a: 1, b: 2, c: 3 };\nfor (const key in obj) {\n console.log(key, obj[key]);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | obj: {} 8 | cell_depended_values: {} 9 | triggerable_functions: {} 10 | -------------------------------------------------------------------------------- /toolchain/book_src/DEV_ENVIRONMENT.md: -------------------------------------------------------------------------------- 1 | 2 | # Using Consistent Dev Environments 3 | 4 | ## Using Devenv 5 | ``` 6 | sh <(curl -L https://nixos.org/nix/install) 7 | nix-env -iA devenv -f https://github.com/NixOS/nixpkgs/tarball/nixpkgs-unstable 8 | ``` 9 | 10 | ## Using Docker 11 | ``` 12 | ``` 13 | 14 | ## Using devcontainers 15 | 16 | 17 | 18 | # Build Requirements 19 | 20 | In order to build our fork of Deno you'll need to have llvm installed 21 | ``` 22 | brew install llvm 23 | ``` 24 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_object_destructuring-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const pairs = [{a: 1, b:2}];\nfor (const {a, b} of pairs) {\n console.log(a, b);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | pairs: {} 8 | cell_depended_values: {} 9 | triggerable_functions: {} 10 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/execution/primitives/identifiers.rs: -------------------------------------------------------------------------------- 1 | use uuid::Uuid; 2 | 3 | pub type OperationId = Uuid; 4 | 5 | // TODO: we will want to intern these strings for performance reasons 6 | #[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize)] 7 | pub enum DependencyReference { 8 | Positional(usize), 9 | Keyword(String), 10 | Global(String), 11 | FunctionInvocation(String), 12 | Ordering, 13 | } 14 | 15 | pub type TimestampOfWrite = usize; 16 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "chidori" 3 | version = "0.1.0" 4 | description = "Add your description here" 5 | dependencies = [ 6 | "litellm[proxy]>=1.37.17", 7 | "pydantic>=2.8.2", 8 | ] 9 | readme = "README.md" 10 | requires-python = ">= 3.8" 11 | 12 | [build-system] 13 | requires = ["hatchling"] 14 | build-backend = "hatchling.build" 15 | 16 | 17 | [tool.hatch.metadata] 18 | allow-direct-references = true 19 | 20 | [tool.hatch.build.targets.wheel] 21 | packages = ["src/chidori"] 22 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo10_cpt_codes/demo.md: -------------------------------------------------------------------------------- 1 | # Demonstrates a contextually relevant demo 2 | 3 | ```prompt 4 | --- 5 | model: claude-3.5 6 | fn: generate_ehr 7 | --- 8 | Create an example EHR record 9 | ``` 10 | 11 | ```prompt 12 | --- 13 | model: claude-3.5 14 | fn: extract_cpt 15 | --- 16 | Extract cpt codes from the provided EHR record {{record}} 17 | ``` 18 | 19 | ```python 20 | ehr = await generate_ehr() 21 | ``` 22 | 23 | ```python 24 | cpt = await extract_cpt(record=ehr) 25 | ``` 26 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__report_for_simple_function-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function testing(x) {\n return x\n}\n " 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: 9 | testing: 10 | arguments: 11 | - x 12 | emit_event: [] 13 | trigger_on: [] 14 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/src/utils.rs: -------------------------------------------------------------------------------- 1 | pub fn set_panic_hook() { 2 | // When the `console_error_panic_hook` feature is enabled, we can call the 3 | // `set_panic_hook` function at least once during initialization, and then 4 | // we will get better error messages if our code ever panics. 5 | // 6 | // For more details see 7 | // https://github.com/rustwasm/console_error_panic_hook#readme 8 | #[cfg(feature = "console_error_panic_hook")] 9 | console_error_panic_hook::set_once(); 10 | } 11 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_destructuring-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const pairs = [[1, 'one'], [2, 'two'], [3, 'three']];\nfor (const [num, word] of pairs) {\n console.log(num, word);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | pairs: {} 8 | cell_depended_values: {} 9 | triggerable_functions: {} 10 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_in_for_of_loops-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const items = [{ id: 1, name: 'Item 1' }, { id: 2, name: 'Item 2' }];\nfor (const { id, name } of items) {\n console.log(`${id}: ${name}`);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | items: {} 8 | cell_depended_values: {} 9 | triggerable_functions: {} 10 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/tests/web.rs: -------------------------------------------------------------------------------- 1 | //! Test suite for the Web and headless browsers. 2 | 3 | #![cfg(target_arch = "wasm32")] 4 | 5 | extern crate wasm_bindgen_test; 6 | 7 | use chidori_prompt_format::analyze_referenced_partials; 8 | use chidori_prompt_format::templating::templates::{SchemaItem, SchemaItemType}; 9 | use std::collections::HashMap; 10 | use wasm_bindgen_test::*; 11 | 12 | wasm_bindgen_test_configure!(run_in_browser); 13 | 14 | #[wasm_bindgen_test] 15 | fn analyzing_referenced_partials() { 16 | assert_eq!(1, 1); 17 | } 18 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__basic_array_destructuring.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const [g, h] = [5, 6];\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: g 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: h 12 | in_scope: false 13 | exposed: true 14 | - - AssignmentFromStatement 15 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_gaps.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const [i, , j] = [7, 8, 9];\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: i 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: j 12 | in_scope: false 13 | exposed: true 14 | - - AssignmentFromStatement 15 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__basic_object_destructuring.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { a, b } = { a: 1, b: 2 };\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: a 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: b 12 | in_scope: false 13 | exposed: true 14 | - - AssignmentFromStatement 15 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_rest.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const [k, ...rest] = [10, 11, 12];\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: k 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: rest 12 | in_scope: false 13 | exposed: true 14 | - - AssignmentFromStatement 15 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__array_destructuring_with_default_values.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const [y = 200, z = 300] = [22];\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: y 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: z 12 | in_scope: false 13 | exposed: true 14 | - - AssignmentFromStatement 15 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/std/scheduling/mod.rs: -------------------------------------------------------------------------------- 1 | mod local; 2 | 3 | enum ScheduledExecutionError { 4 | None, 5 | } 6 | 7 | // #[async_trait] 8 | // pub trait ScheduledExecutionHost { 9 | // // Connects to the vector database 10 | // fn attach_client(client: C) -> Result 11 | // where 12 | // Self: Sized; 13 | // 14 | // // Inserts a vector into the database 15 | // async fn schedule_cron_event( 16 | // &mut self, 17 | // cron_tab: String, 18 | // ) -> Result<(), ScheduledExecutionError>; 19 | // } 20 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo9_arc_agi/constants.py: -------------------------------------------------------------------------------- 1 | F = False 2 | T = True 3 | 4 | ZERO = 0 5 | ONE = 1 6 | TWO = 2 7 | THREE = 3 8 | FOUR = 4 9 | FIVE = 5 10 | SIX = 6 11 | SEVEN = 7 12 | EIGHT = 8 13 | NINE = 9 14 | TEN = 10 15 | 16 | NEG_ONE = -1 17 | NEG_TWO = -2 18 | 19 | DOWN = (1, 0) 20 | RIGHT = (0, 1) 21 | UP = (-1, 0) 22 | LEFT = (0, -1) 23 | 24 | ORIGIN = (0, 0) 25 | UNITY = (1, 1) 26 | NEG_UNITY = (-1, -1) 27 | UP_RIGHT = (-1, 1) 28 | DOWN_LEFT = (1, -1) 29 | 30 | ZERO_BY_TWO = (0, 2) 31 | TWO_BY_ZERO = (2, 0) 32 | TWO_BY_TWO = (2, 2) 33 | THREE_BY_THREE = (3, 3) 34 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/bevy_prototype_lyon/utils.rs: -------------------------------------------------------------------------------- 1 | //! Utility types and conversion traits. 2 | 3 | use bevy::math::Vec2; 4 | use lyon_tessellation::math::{Point, Vector}; 5 | 6 | pub trait ToPoint { 7 | fn to_point(self) -> Point; 8 | } 9 | 10 | pub trait ToVector { 11 | fn to_vector(self) -> Vector; 12 | } 13 | 14 | impl ToPoint for Vec2 { 15 | fn to_point(self) -> Point { 16 | Point::new(self.x, self.y) 17 | } 18 | } 19 | 20 | impl ToVector for Vec2 { 21 | fn to_vector(self) -> Vector { 22 | Vector::new(self.x, self.y) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/egui_json_tree/delimiters.rs: -------------------------------------------------------------------------------- 1 | pub struct Delimiters { 2 | pub collapsed: &'static str, 3 | pub collapsed_empty: &'static str, 4 | pub opening: &'static str, 5 | pub closing: &'static str, 6 | } 7 | 8 | pub const ARRAY_DELIMITERS: Delimiters = Delimiters { 9 | collapsed: "[...]", 10 | collapsed_empty: "[]", 11 | opening: "[", 12 | closing: "]", 13 | }; 14 | 15 | pub const OBJECT_DELIMITERS: Delimiters = Delimiters { 16 | collapsed: "{...}", 17 | collapsed_empty: "{}", 18 | opening: "{", 19 | closing: "}", 20 | }; 21 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/README.md: -------------------------------------------------------------------------------- 1 | This library of methods forms the core functionality provided by Chidori. 2 | The methods here are used to implement different cell types, which in turn form 3 | the interface for the user to interact with a notebook editing experience. 4 | 5 | Through code invocation it's possible for a user of Chidori to make arbitrary functions 6 | available for execution. We provide specialized interfaces to specific functionality in order 7 | to create rails for common operations and to make patterns used in agent applications immediately 8 | obvious to a reader. 9 | 10 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__complex_nested_destructuring.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { q: { r: [s, { t }] } } = { q: { r: [17, { t: 18 }] } };\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: s 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: t 12 | in_scope: false 13 | exposed: true 14 | - - AssignmentFromStatement 15 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__object_destructuring_with_rest_properties.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { u, ...others } = { u: 19, v: 20, w: 21 };\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: u 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: others 12 | in_scope: false 13 | exposed: true 14 | - - AssignmentFromStatement 15 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core8_prompt_code_generation_and_execution/core.md: -------------------------------------------------------------------------------- 1 | # Demonstrating how a prompt is capable of generating source code and immediately executing it 2 | 3 | ```codegen (gen_fib_sequence) 4 | --- 5 | model: gpt-3.5-turbo 6 | language: python 7 | --- 8 | Generate a function that returns the Fibonacci sequence up to the nth number. 9 | The function should be named `gen_fib_sequence` and should accept a single 10 | argument `n` which is the amount of the Fibonacci sequence to generate. 11 | ``` 12 | 13 | 14 | ```python (entry) 15 | out = await gen_fib_sequence(10) 16 | ``` 17 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core11_hono/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core1_simple_math/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | let mut env = InteractiveChidoriWrapper::new(); 10 | env.load_md_directory(&relative_path); 11 | let mut s = env.get_instance().unwrap(); 12 | s.run(PlaybackState::Paused); 13 | } -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_in_function_parameters-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function printPerson({ name, age = 30 }) {\n console.log(`${name} is ${age} years old`);\n}\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: {} 8 | triggerable_functions: 9 | printPerson: 10 | arguments: 11 | - name 12 | - age 13 | emit_event: [] 14 | trigger_on: [] 15 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_returned_arrays-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function returnArray() {\n return [1, 2, 3];\n}\nconst [first, ...restArray] = returnArray();\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | first: {} 8 | restArray: {} 9 | cell_depended_values: {} 10 | triggerable_functions: 11 | returnArray: 12 | arguments: [] 13 | emit_event: [] 14 | trigger_on: [] 15 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core2_marshalling/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo10_cpt_codes/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo2_gpt_migrate/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo5_todomvc/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo6_open_devin/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo7_comfyui/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo9_arc_agi/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core10_concurrency/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core13_state_machine/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo1_business_analyst/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo4_story_generator/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core3_function_invocations/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo3_self_healing_scaper/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo6_code_docs_updater/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo8_hacker_news_scraper/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core12_dependency_management/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core4_async_function_invocations/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core7_rag_stateful_memory_cells/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core9_multi_agent_simulation/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/experiment1_explicit_imports/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/std/scheduling/README.md: -------------------------------------------------------------------------------- 1 | # Services to schedule tasks 2 | 3 | ## Local 4 | 5 | Local scheduler events are managed by the `chidori-core` library and are executed in-process. 6 | 7 | ### Tokio Cron Scheduler 8 | 9 | This runs a cron scheduler on a background thread, triggering execution when it is time to do so. 10 | 11 | 12 | ## Remote 13 | 14 | Remote scheduler events leverage remote services in order to facilitate the management of scheduled events. 15 | 16 | ### Redis Cron Scheduler 17 | 18 | This uses redis as the source for cron events, triggered on push events from the redis instance. 19 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core5_prompts_invoked_as_functions/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__object_destructuring_with_renaming_and_default.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { c: renamed, d = 'default' } = { c: 3 };\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: renamed 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: d 12 | in_scope: false 13 | exposed: true 14 | - Constant: default 15 | - - AssignmentFromStatement 16 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/sdk/snapshots/chidori_core__sdk__md__test__core1.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-core/src/sdk/md.rs 3 | expression: v 4 | --- 5 | - Code: 6 | - name: ~ 7 | language: PyO3 8 | source_code: x = 20 9 | function_invocation: ~ 10 | - start: 3 11 | end: 17 12 | - Code: 13 | - name: ~ 14 | language: PyO3 15 | source_code: y = x * 20 16 | function_invocation: ~ 17 | - start: 25 18 | end: 43 19 | - Code: 20 | - name: ~ 21 | language: Deno 22 | source_code: const zj = y + 20; 23 | function_invocation: ~ 24 | - start: 51 25 | end: 81 26 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core6_prompts_leveraging_function_calling/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core8_prompt_code_generation_and_execution/main.rs: -------------------------------------------------------------------------------- 1 | use std::path::Path; 2 | use chidori_core::sdk::interactive_chidori_wrapper::InteractiveChidoriWrapper; 3 | use chidori_core::sdk::chidori_runtime_instance::PlaybackState; 4 | 5 | fn main() { 6 | let current_file = env!("CARGO_MANIFEST_DIR"); 7 | let current_file_path = Path::new(current_file); 8 | let relative_path = current_file_path.join("./"); 9 | 10 | let mut env = InteractiveChidoriWrapper::new(); 11 | env.load_md_directory(&relative_path); 12 | let mut s = env.get_instance().unwrap(); 13 | s.run(PlaybackState::Paused); 14 | } -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__report_generation-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function testing() {\n ch.onEvent(\"new_file\");\n ch.emitAs(\"file_created\");\n const x = 2 + y;\n return x\n}\n " 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: 8 | ch: {} 9 | y: {} 10 | triggerable_functions: 11 | testing: 12 | arguments: [] 13 | emit_event: 14 | - file_created 15 | trigger_on: 16 | - new_file 17 | -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "build": "wasm-pack build --target bundler --out-dir pkg --scope 1kbirds", 4 | "build-local": "wasm-pack build --target nodejs --out-dir pkg_node --scope 1kbirds", 5 | "test-rust": "cargo test", 6 | "test-js": "jest tests/nodejs" 7 | }, 8 | "dependencies": { 9 | "@babel/preset-env": "^7.23.7", 10 | "@types/jest": "^29.5.11", 11 | "chidori_prompt_format": "file:./pkg", 12 | "ts-node": "^10.9.2", 13 | "typescript": "^5.3.3" 14 | }, 15 | "devDependencies": { 16 | "@babel/preset-typescript": "^7.23.3", 17 | "jest": "^29.6.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /toolchain/book_src/FUTURE_WORK.md: -------------------------------------------------------------------------------- 1 | # Future Work 2 | 3 | ## Sandboxing 4 | * Use libkrun in order to sandbox code execution for safe iteration (https://github.com/containers/libkrun/tree/main) (https://github.com/containers/crun) 5 | 6 | ## Evaluation 7 | * Include an easy way to run WebArena and evaluate agents against realistic websites in a sandboxed way (https://github.com/web-arena-x/webarena/tree/main/environment_docker) 8 | 9 | ## Dependency management 10 | * Deno makes dependencies cleaner, but in order to have a story for Python and to simplify installation we can consider depending on Rye (https://github.com/astral-sh/rye/blob/main/rye/src/pyproject.rs) -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "build": "wasm-pack build --target bundler --out-dir pkg --scope 1kbirds", 4 | "build-local": "wasm-pack build --target nodejs --out-dir pkg_node --scope 1kbirds", 5 | "test-rust": "cargo test", 6 | "test-js": "jest tests/nodejs" 7 | }, 8 | "dependencies": { 9 | "@babel/preset-env": "^7.23.7", 10 | "@types/jest": "^29.5.11", 11 | "chidori_prompt_format": "file:./pkg", 12 | "ts-node": "^10.9.2", 13 | "typescript": "^5.3.3" 14 | }, 15 | "devDependencies": { 16 | "@babel/preset-typescript": "^7.23.3", 17 | "jest": "^29.6.1" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__mixed_destructuring.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { l, m: [n, o] } = { l: 13, m: [14, 15] };\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: l 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: n 12 | in_scope: false 13 | exposed: true 14 | - IdentifierReferredTo: 15 | name: o 16 | in_scope: false 17 | exposed: true 18 | - - AssignmentFromStatement 19 | -------------------------------------------------------------------------------- /toolchain/chidori-core/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | All notable changes to this project will be documented in this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 6 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 7 | 8 | ## 0.1.24 (2023-07-28) 9 | 10 | ### Fixed 11 | 12 | - Fixing releases 13 | 14 | ## 0.1.23 (2023-07-28) 15 | 16 | ### Fixed 17 | 18 | - Fixing releases 19 | 20 | ## 0.1.22 (2023-07-28) 21 | 22 | ### Added 23 | 24 | 25 | ### Fixed 26 | 27 | ### Changed 28 | 29 | - Moved to SQL queries as triggers to nodes rather than graphql 30 | 31 | ### Changed 32 | 33 | 34 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/tidy_tree/layout.rs: -------------------------------------------------------------------------------- 1 | use crate::tidy_tree::{geometry::Coord, node::Node}; 2 | use std::ptr::NonNull; 3 | use petgraph::graph::NodeIndex; 4 | 5 | mod basic_layout; 6 | mod linked_y_list; 7 | pub(crate) mod tidy_layout; 8 | 9 | pub use basic_layout::{BasicLayout, BoundingBox}; 10 | pub use tidy_layout::TidyLayout; 11 | pub use tidy_layout::Orientation; 12 | use crate::tidy_tree::node::TreeGraph; 13 | 14 | pub trait Layout { 15 | fn layout(&mut self, tree: &mut TreeGraph); 16 | fn partial_layout(&mut self, tree: &mut TreeGraph, changed: &[NodeIndex]); 17 | fn parent_child_margin(&self) -> Coord; 18 | fn peer_margin(&self) -> Coord; 19 | } 20 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_with_computed_property_names.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const key = 'p';\nconst { [key]: value } = { p: 16 };\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: key 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | - Constant: p 12 | - - AssignmentToStatement 13 | - IdentifierReferredTo: 14 | name: value 15 | in_scope: false 16 | exposed: true 17 | - - AssignmentFromStatement 18 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__report_for_simple_function.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function testing(x) {\n return x\n}\n " 4 | --- 5 | - - InFunction: 6 | - testing 7 | - start: 1 8 | end: 37 9 | - FunctionArguments 10 | - IdentifierReferredTo: 11 | name: x 12 | in_scope: false 13 | exposed: true 14 | - - InFunction: 15 | - testing 16 | - start: 1 17 | end: 37 18 | - IdentifierReferredTo: 19 | name: x 20 | in_scope: true 21 | exposed: true 22 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/sdk/snapshots/chidori_core__sdk__md__test__extract_markdown.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-core/src/sdk/md.rs 3 | expression: extracted 4 | --- 5 | - tag: python 6 | name: ~ 7 | body: "y = 20\ndef add(a, b):\n return a + b" 8 | range: 9 | start: 15 10 | end: 61 11 | - tag: javascript 12 | name: ~ 13 | body: "---\na: 2\n---\nconst x = add(2,2);" 14 | range: 15 | start: 69 16 | end: 113 17 | - tag: prompt 18 | name: multi_prompt 19 | body: "Multiply {y} times {x}" 20 | range: 21 | start: 121 22 | end: 166 23 | - tag: html 24 | name: named_html 25 | body: "
Example
" 26 | range: 27 | start: 174 28 | end: 211 29 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__reference_to_undeclared_function.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "out = await read_file_and_load_to_memory(\"./\")\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: out 8 | in_scope: false 9 | exposed: false 10 | - - AssignmentFromStatement 11 | - InCallExpression 12 | - Constant: "./" 13 | - - AssignmentFromStatement 14 | - InCallExpression 15 | - Constant: "./" 16 | - IdentifierReferredTo: 17 | name: read_file_and_load_to_memory 18 | in_scope: false 19 | exposed: false 20 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__report_generation_for_loop_variable_assignment-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "async def run_prompt(number_of_states):\n out = \"\"\n for state in (await get_states_first_letters(num=number_of_states)).split('\\n'):\n out += await first_letter(state)\n return \"demo\" + out\n " 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: {} 7 | cell_depended_values: 8 | first_letter: {} 9 | get_states_first_letters: {} 10 | triggerable_functions: 11 | run_prompt: 12 | arguments: 13 | - number_of_states 14 | emit_event: [] 15 | trigger_on: [] 16 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo9_arc_agi/arc_types.py: -------------------------------------------------------------------------------- 1 | from typing import ( 2 | List, 3 | Union, 4 | Tuple, 5 | Any, 6 | Container, 7 | Callable, 8 | FrozenSet, 9 | Iterable 10 | ) 11 | 12 | Boolean = bool 13 | Integer = int 14 | IntegerTuple = Tuple[Integer, Integer] 15 | Numerical = Union[Integer, IntegerTuple] 16 | IntegerSet = FrozenSet[Integer] 17 | Grid = Tuple[Tuple[Integer]] 18 | Cell = Tuple[Integer, IntegerTuple] 19 | Object = FrozenSet[Cell] 20 | Objects = FrozenSet[Object] 21 | Indices = FrozenSet[IntegerTuple] 22 | IndicesSet = FrozenSet[Indices] 23 | Patch = Union[Object, Indices] 24 | Element = Union[Object, Grid] 25 | Piece = Union[Grid, Patch] 26 | TupleTuple = Tuple[Tuple] 27 | ContainerContainer = Container[Container] 28 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__report_generation_with_object_destructuring-2.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { a, b } = someObject;\nconst { c: renamed } = anotherObject;\n\nfunction processValues({ x, y }) {\n return x + y;\n}\n\nconst result = processValues({ x: a, y: b });\n" 4 | --- 5 | internal_call_graph: {} 6 | cell_exposed_values: 7 | a: {} 8 | b: {} 9 | renamed: {} 10 | result: {} 11 | cell_depended_values: 12 | anotherObject: {} 13 | someObject: {} 14 | triggerable_functions: 15 | processValues: 16 | arguments: 17 | - x 18 | - y 19 | emit_event: [] 20 | trigger_on: [] 21 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core6_prompts_leveraging_function_calling/core.md: -------------------------------------------------------------------------------- 1 | # Demonstrating how to leverage function calling in prompts 2 | 3 | ```python (math_fn) 4 | def add_two_numbers(a, b): 5 | return a + b 6 | ``` 7 | 8 | 9 | ```prompt (declare_add_population) 10 | --- 11 | model: gpt-3.5-turbo 12 | fn: add_population 13 | import: 14 | - add_two_numbers 15 | --- 16 | Add the population of {{state}} to the population of California 17 | ``` 18 | 19 | 20 | ```python (entry) 21 | import unittest 22 | 23 | class TestMarshalledValues(unittest.IsolatedAsyncioTestCase): 24 | async def test_run_prompt(self): 25 | self.assertEqual(await add_population(state="Arizona"), 4) 26 | 27 | unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues)) 28 | ``` 29 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__nothing_extracted_with_no_ch_references.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function createDockerfile() {\n return prompt(\"prompts/create_dockerfile\")\n}\n" 4 | --- 5 | - - InFunction: 6 | - createDockerfile 7 | - start: 1 8 | end: 79 9 | - FunctionArguments 10 | - - InFunction: 11 | - createDockerfile 12 | - start: 1 13 | end: 79 14 | - InCallExpression 15 | - IdentifierReferredTo: 16 | name: prompt 17 | in_scope: false 18 | exposed: true 19 | - Constant: prompts/create_dockerfile 20 | - - InFunction: 21 | - createDockerfile 22 | - start: 1 23 | end: 79 24 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__extraction_of_ch_statements.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | expression: context_stack_references 4 | --- 5 | - - InCallExpression 6 | - Attribute: configure 7 | - Attribute: prompt 8 | - IdentifierReferredTo: 9 | name: ch 10 | in_scope: true 11 | exposed: true 12 | - Constant: default 13 | - InCallExpression 14 | - Attribute: llm 15 | - IdentifierReferredTo: 16 | name: ch 17 | in_scope: true 18 | exposed: true 19 | - - InCallExpression 20 | - Attribute: configure 21 | - Attribute: prompt 22 | - IdentifierReferredTo: 23 | name: ch 24 | in_scope: true 25 | exposed: true 26 | - Constant: default 27 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__nothing_extracted_with_no_ch_references.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "def create_dockerfile():\n return prompt(\"prompts/create_dockerfile\")\n" 4 | --- 5 | - - InFunction: 6 | - create_dockerfile 7 | - start: 0 8 | end: 71 9 | - - InFunction: 10 | - create_dockerfile 11 | - start: 0 12 | end: 71 13 | - InCallExpression 14 | - Constant: prompts/create_dockerfile 15 | - - InFunction: 16 | - create_dockerfile 17 | - start: 0 18 | end: 71 19 | - InCallExpression 20 | - Constant: prompts/create_dockerfile 21 | - IdentifierReferredTo: 22 | name: prompt 23 | in_scope: false 24 | exposed: false 25 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__traditional_for_loop.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 5; i++) {\n console.log(i);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: i 8 | in_scope: false 9 | exposed: false 10 | - - IdentifierReferredTo: 11 | name: i 12 | in_scope: true 13 | exposed: false 14 | - IdentifierReferredTo: 15 | name: i 16 | in_scope: true 17 | exposed: false 18 | - InCallExpression 19 | - Attribute: log 20 | - IdentifierReferredTo: 21 | name: console 22 | in_scope: false 23 | exposed: false 24 | - IdentifierReferredTo: 25 | name: i 26 | in_scope: true 27 | exposed: false 28 | -------------------------------------------------------------------------------- /.github/workflows/push.yml: -------------------------------------------------------------------------------- 1 | name: Run tests 2 | 3 | on: 4 | [push] 5 | 6 | concurrency: 7 | group: ${{ github.workflow }}-${{ github.ref }} 8 | cancel-in-progress: true 9 | 10 | env: 11 | PACKAGE_NAME: chidori 12 | 13 | jobs: 14 | tests: 15 | runs-on: ubuntu-latest 16 | strategy: 17 | matrix: 18 | target: [x86_64] 19 | steps: 20 | - uses: actions/checkout@v3 21 | - uses: actions-rust-lang/setup-rust-toolchain@v1 22 | with: 23 | rustflags: "" 24 | - name: Test Chidori Prompt Format 25 | run: cargo test 26 | working-directory: toolchain/chidori-prompt-format 27 | - name: Test Chidori Static Analysis 28 | run: cargo test 29 | working-directory: toolchain/chidori-static-analysis 30 | - name: Test Chidori Core 31 | run: cargo test 32 | working-directory: toolchain/chidori-core 33 | 34 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__extraction_of_ch_statements.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "from chidori.core import ch\n\nch.prompt.configure(\"default\", ch.llm(model=\"openai\"))\n" 4 | --- 5 | - - InCallExpression 6 | - Constant: default 7 | - - InCallExpression 8 | - Constant: default 9 | - InCallExpression 10 | - Constant: openai 11 | - - InCallExpression 12 | - Constant: default 13 | - InCallExpression 14 | - Constant: openai 15 | - Attribute: llm 16 | - IdentifierReferredTo: 17 | name: ch 18 | in_scope: false 19 | exposed: false 20 | - - InCallExpression 21 | - Constant: default 22 | - Attribute: configure 23 | - Attribute: prompt 24 | - IdentifierReferredTo: 25 | name: ch 26 | in_scope: false 27 | exposed: false 28 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo1_business_analyst/demo.md: -------------------------------------------------------------------------------- 1 | # This agent demonstrates how to traverse multiple parts of a website, extract data, and produce a structured report. 2 | 3 | We use Astral rather than Playwright for Deno support 4 | https://astral.deno.dev/guides/navigation/ 5 | 6 | ```javascript 7 | // Import Astral 8 | import { launch } from "https://deno.land/x/astral/mod.ts"; 9 | 10 | // Launch the browser 11 | const browser = await launch(); 12 | 13 | // Open a new page 14 | const page = await browser.newPage("https://deno.land"); 15 | 16 | // Take a screenshot of the page and save that to disk 17 | // TODO: doing this in a closure so we don't attempt to serialize the output, we don't support binary arrays yet 18 | (async () => { 19 | const screenshot = await page.screenshot(); 20 | Deno.writeFileSync("screenshot.png", screenshot); 21 | })() 22 | 23 | // Close the browser 24 | await browser.close(); 25 | ``` 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__variable_swapping_with_destructuring.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "let aa = 'first', bb = 'second';\n[aa, bb] = [bb, aa];\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: aa 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | - Constant: first 12 | - - AssignmentToStatement 13 | - IdentifierReferredTo: 14 | name: bb 15 | in_scope: false 16 | exposed: true 17 | - - AssignmentFromStatement 18 | - Constant: second 19 | - - AssignmentToStatement 20 | - IdentifierReferredTo: 21 | name: aa 22 | in_scope: true 23 | exposed: true 24 | - IdentifierReferredTo: 25 | name: bb 26 | in_scope: true 27 | exposed: true 28 | - - AssignmentFromStatement 29 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__report_generation.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "def testing():\n x = 2 + y\n return x\n " 4 | --- 5 | - - InFunction: 6 | - testing 7 | - start: 0 8 | end: 41 9 | - - InFunction: 10 | - testing 11 | - start: 0 12 | end: 41 13 | - AssignmentToStatement 14 | - IdentifierReferredTo: 15 | name: x 16 | in_scope: false 17 | exposed: false 18 | - - InFunction: 19 | - testing 20 | - start: 0 21 | end: 41 22 | - AssignmentFromStatement 23 | - IdentifierReferredTo: 24 | name: y 25 | in_scope: false 26 | exposed: false 27 | - - InFunction: 28 | - testing 29 | - start: 0 30 | end: 41 31 | - IdentifierReferredTo: 32 | name: x 33 | in_scope: true 34 | exposed: false 35 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__pipe_function_composition.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "def main():\n bar() | foo() | baz()\n" 4 | --- 5 | - - InFunction: 6 | - main 7 | - start: 0 8 | end: 37 9 | - - InFunction: 10 | - main 11 | - start: 0 12 | end: 37 13 | - InCallExpression 14 | - IdentifierReferredTo: 15 | name: bar 16 | in_scope: false 17 | exposed: false 18 | - - InFunction: 19 | - main 20 | - start: 0 21 | end: 37 22 | - InCallExpression 23 | - IdentifierReferredTo: 24 | name: foo 25 | in_scope: false 26 | exposed: false 27 | - - InFunction: 28 | - main 29 | - start: 0 30 | end: 37 31 | - InCallExpression 32 | - IdentifierReferredTo: 33 | name: baz 34 | in_scope: false 35 | exposed: false 36 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/egui_json_tree/default_expand.rs: -------------------------------------------------------------------------------- 1 | #[derive(Default, Debug, Clone)] 2 | /// Configuration for how a [`JsonTree`](crate::JsonTree) should expand arrays and objects by default. 3 | pub enum DefaultExpand<'a> { 4 | /// Expand all arrays and objects. 5 | All, 6 | /// Collapse all arrays and objects. 7 | #[default] 8 | None, 9 | /// Expand arrays and objects according to how many levels deep they are nested: 10 | /// - `0` would expand a top-level array/object only, 11 | /// - `1` would expand a top-level array/object and any array/object that is a direct child, 12 | /// - `2` ... 13 | /// 14 | /// And so on. 15 | ToLevel(u8), 16 | /// Expand arrays and objects to display object keys and values, 17 | /// and array elements, that match the search term. Letter case is ignored. The matches are highlighted. 18 | /// If the search term is empty, nothing will be expanded by default. 19 | SearchResults(&'a str), 20 | } 21 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_returned_arrays.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function returnArray() {\n return [1, 2, 3];\n}\nconst [first, ...restArray] = returnArray();\n" 4 | --- 5 | - - InFunction: 6 | - returnArray 7 | - start: 1 8 | end: 49 9 | - FunctionArguments 10 | - - InFunction: 11 | - returnArray 12 | - start: 1 13 | end: 49 14 | - - AssignmentToStatement 15 | - IdentifierReferredTo: 16 | name: first 17 | in_scope: false 18 | exposed: true 19 | - IdentifierReferredTo: 20 | name: restArray 21 | in_scope: false 22 | exposed: true 23 | - - AssignmentFromStatement 24 | - InCallExpression 25 | - IdentifierReferredTo: 26 | name: returnArray 27 | in_scope: true 28 | exposed: true 29 | - - AssignmentFromStatement 30 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_array.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const array = [1, 2, 3, 4, 5];\nfor (const item of array) {\n console.log(item);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: array 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | - - AssignmentToStatement 12 | - IdentifierReferredTo: 13 | name: item 14 | in_scope: false 15 | exposed: false 16 | - - IdentifierReferredTo: 17 | name: array 18 | in_scope: true 19 | exposed: false 20 | - InCallExpression 21 | - Attribute: log 22 | - IdentifierReferredTo: 23 | name: console 24 | in_scope: false 25 | exposed: false 26 | - IdentifierReferredTo: 27 | name: item 28 | in_scope: true 29 | exposed: false 30 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/egui_json_tree/response.rs: -------------------------------------------------------------------------------- 1 | use std::collections::HashSet; 2 | 3 | use egui::{collapsing_header::CollapsingState, Id, Ui}; 4 | 5 | /// The response from showing a [`JsonTree`](crate::JsonTree). 6 | pub struct JsonTreeResponse { 7 | pub(crate) collapsing_state_ids: HashSet, 8 | } 9 | 10 | impl JsonTreeResponse { 11 | /// For the [`JsonTree`](crate::JsonTree) that provided this response, 12 | /// resets the expanded state for all of its arrays/objects to respect the `default_expand` setting. 13 | /// 14 | /// Call this whenever the `default_expand` setting changes, 15 | /// and/or you when wish to reset any manually collapsed/expanded arrays and objects to respect this setting. 16 | pub fn reset_expanded(&self, ui: &mut Ui) { 17 | for id in self.collapsing_state_ids.iter() { 18 | if let Some(state) = CollapsingState::load(ui.ctx(), *id) { 19 | state.remove(ui.ctx()); 20 | } 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /deployment/docker-single-container/Dockerfile: -------------------------------------------------------------------------------- 1 | # Initalling chidori 2 | FROM ghcr.io/rust-lang/rust:nightly-bookworm 3 | 4 | RUN apt update 5 | RUN apt install -y cmake curl 6 | RUN apt install -y python3-dev 7 | 8 | RUN curl -LsSf https://astral.sh/uv/install.sh | sh 9 | RUN cargo +nightly install chidori-core@0.2.13 --locked 10 | RUN uv venv 11 | RUN uv pip install "litellm[proxy]" 12 | 13 | WORKDIR /usr/src 14 | RUN mkdir logs 15 | COPY example_agent /usr/src/example_agent 16 | COPY init.sh ./init.sh 17 | COPY litellm_config.yaml litellm_config.yaml 18 | RUN chmod +x ./init.sh 19 | 20 | ENV OPENAI_API_KEY=OPENAI_API_KEY 21 | ENV ANTHROPIC_API_KEY=ANTHROPIC_API_KEY 22 | ENV CHIDORI_HOME_DIRECTORY=/usr/src 23 | 24 | EXPOSE 8000 25 | 26 | CMD ["./init.sh"] 27 | 28 | 29 | 30 | # Bundle Stage 31 | #FROM scratch 32 | #COPY --from=builder /usr/local/cargo/bin/chidori-core . 33 | #COPY agent ./example_agent 34 | #COPY init.sh ./init.sh 35 | #RUN ["./init.sh"] 36 | #USER 1000 37 | #CMD ["./deciduously-com", "-a", "0.0.0.0", "-p", "8080"] -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_break_statement.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 10; i++) {\n if (i === 5) break;\n console.log(i);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: i 8 | in_scope: false 9 | exposed: false 10 | - - IdentifierReferredTo: 11 | name: i 12 | in_scope: true 13 | exposed: false 14 | - IdentifierReferredTo: 15 | name: i 16 | in_scope: true 17 | exposed: false 18 | - IdentifierReferredTo: 19 | name: i 20 | in_scope: true 21 | exposed: false 22 | - InCallExpression 23 | - Attribute: log 24 | - IdentifierReferredTo: 25 | name: console 26 | in_scope: false 27 | exposed: false 28 | - IdentifierReferredTo: 29 | name: i 30 | in_scope: true 31 | exposed: false 32 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_continue_statement.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 10; i++) {\n if (i % 2 === 0) continue;\n console.log(i);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: i 8 | in_scope: false 9 | exposed: false 10 | - - IdentifierReferredTo: 11 | name: i 12 | in_scope: true 13 | exposed: false 14 | - IdentifierReferredTo: 15 | name: i 16 | in_scope: true 17 | exposed: false 18 | - IdentifierReferredTo: 19 | name: i 20 | in_scope: true 21 | exposed: false 22 | - InCallExpression 23 | - Attribute: log 24 | - IdentifierReferredTo: 25 | name: console 26 | in_scope: false 27 | exposed: false 28 | - IdentifierReferredTo: 29 | name: i 30 | in_scope: true 31 | exposed: false 32 | -------------------------------------------------------------------------------- /toolchain/scripts/tracing/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | services: 3 | quickwit: 4 | image: quickwit/quickwit:latest 5 | command: run 6 | restart: always 7 | environment: 8 | QW_ENABLE_OTLP_ENDPOINT: true 9 | QW_ENABLE_JAEGER_ENDPOINT: true 10 | ports: 11 | - '7280:7280' 12 | - '7281:7281' 13 | volumes: 14 | - ./qwdata:/quickwit/qwdata 15 | 16 | jaeger: 17 | image: jaegertracing/jaeger-query:latest 18 | restart: always 19 | depends_on: 20 | - quickwit 21 | environment: 22 | SPAN_STORAGE_TYPE: 'grpc-plugin' 23 | GRPC_STORAGE_SERVER: 'quickwit:7281' 24 | ports: 25 | - '16686:16686' 26 | 27 | grafana: 28 | image: grafana/grafana-enterprise:latest 29 | restart: always 30 | user: root 31 | depends_on: 32 | - quickwit 33 | environment: 34 | GF_PLUGINS_ALLOW_LOADING_UNSIGNED_PLUGINS: 'quickwit-quickwit-datasource' 35 | ports: 36 | - '3000:3000' 37 | volumes: 38 | - ./grafana-storage:/var/lib/grafana -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__function_decorator_ch_annotation.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function migrationAgent() {\n ch.register();\n ch.set(\"bar\", 1);\n}\n" 4 | --- 5 | - - InFunction: 6 | - migrationAgent 7 | - start: 1 8 | end: 71 9 | - FunctionArguments 10 | - - InFunction: 11 | - migrationAgent 12 | - start: 1 13 | end: 71 14 | - InCallExpression 15 | - Attribute: register 16 | - IdentifierReferredTo: 17 | name: ch 18 | in_scope: false 19 | exposed: true 20 | - - InFunction: 21 | - migrationAgent 22 | - start: 1 23 | end: 71 24 | - InCallExpression 25 | - Attribute: set 26 | - IdentifierReferredTo: 27 | name: ch 28 | in_scope: false 29 | exposed: true 30 | - Constant: bar 31 | - - InFunction: 32 | - migrationAgent 33 | - start: 1 34 | end: 71 35 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__function_decorator_ch_annotation.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "@ch.register()\ndef migration_agent():\n ch.set(\"bar\", 1)\n" 4 | --- 5 | - - InFunction: 6 | - migration_agent 7 | - start: 15 8 | end: 58 9 | - - InFunction: 10 | - migration_agent 11 | - start: 15 12 | end: 58 13 | - InFunctionDecorator: 0 14 | - InCallExpression 15 | - Attribute: register 16 | - IdentifierReferredTo: 17 | name: ch 18 | in_scope: false 19 | exposed: false 20 | - - InFunction: 21 | - migration_agent 22 | - start: 15 23 | end: 58 24 | - InCallExpression 25 | - Constant: bar 26 | - - InFunction: 27 | - migration_agent 28 | - start: 15 29 | end: 58 30 | - InCallExpression 31 | - Constant: bar 32 | - Attribute: set 33 | - IdentifierReferredTo: 34 | name: ch 35 | in_scope: false 36 | exposed: false 37 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__ch_function_decoration_referring_to_another_function.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function setupPipeline(x) {\n ch.p(create_dockerfile)\n return x\n}\n" 4 | --- 5 | - - InFunction: 6 | - setupPipeline 7 | - start: 1 8 | end: 71 9 | - FunctionArguments 10 | - IdentifierReferredTo: 11 | name: x 12 | in_scope: false 13 | exposed: true 14 | - - InFunction: 15 | - setupPipeline 16 | - start: 1 17 | end: 71 18 | - InCallExpression 19 | - Attribute: p 20 | - IdentifierReferredTo: 21 | name: ch 22 | in_scope: false 23 | exposed: true 24 | - IdentifierReferredTo: 25 | name: create_dockerfile 26 | in_scope: false 27 | exposed: true 28 | - - InFunction: 29 | - setupPipeline 30 | - start: 1 31 | end: 71 32 | - IdentifierReferredTo: 33 | name: x 34 | in_scope: true 35 | exposed: true 36 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_in_loop_with_object.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const obj = { a: 1, b: 2, c: 3 };\nfor (const key in obj) {\n console.log(key, obj[key]);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: obj 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | - - AssignmentToStatement 12 | - IdentifierReferredTo: 13 | name: key 14 | in_scope: false 15 | exposed: false 16 | - - IdentifierReferredTo: 17 | name: obj 18 | in_scope: true 19 | exposed: false 20 | - InCallExpression 21 | - Attribute: log 22 | - IdentifierReferredTo: 23 | name: console 24 | in_scope: false 25 | exposed: false 26 | - IdentifierReferredTo: 27 | name: key 28 | in_scope: true 29 | exposed: false 30 | - IdentifierReferredTo: 31 | name: obj 32 | in_scope: true 33 | exposed: false 34 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__pipe_function_composition.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function main() {\n bar() | foo() | baz()\n}\n" 4 | --- 5 | - - InFunction: 6 | - main 7 | - start: 1 8 | end: 46 9 | - FunctionArguments 10 | - - InFunction: 11 | - main 12 | - start: 1 13 | end: 46 14 | - InCallExpression 15 | - IdentifierReferredTo: 16 | name: bar 17 | in_scope: false 18 | exposed: true 19 | - - InFunction: 20 | - main 21 | - start: 1 22 | end: 46 23 | - InCallExpression 24 | - IdentifierReferredTo: 25 | name: foo 26 | in_scope: false 27 | exposed: true 28 | - - InFunction: 29 | - main 30 | - start: 1 31 | end: 46 32 | - InCallExpression 33 | - IdentifierReferredTo: 34 | name: baz 35 | in_scope: false 36 | exposed: true 37 | - - InFunction: 38 | - main 39 | - start: 1 40 | end: 46 41 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core4_async_function_invocations/core.md: -------------------------------------------------------------------------------- 1 | # This should demonstrate a variety of function calling interactions between different cell types and configurations 2 | 3 | ## Simple function calling across cells 4 | ### Demonstrates defining a function in python and calling it in javascript 5 | ```python 6 | async def add_two(x): 7 | return x + 2 8 | ``` 9 | 10 | ```javascript 11 | import { assertEquals } from "https://deno.land/std@0.221.0/assert/mod.ts"; 12 | 13 | Deno.test("async addition test", async () => { 14 | assertEquals(await add_two(2), 4); 15 | }); 16 | 17 | const resultJs = await add_two(2) 18 | ``` 19 | 20 | ### Demonstrates defining a function in javascript and calling it in python 21 | ```javascript 22 | async function addTwo(x) { 23 | return x + 2; 24 | } 25 | ``` 26 | 27 | ```python 28 | import unittest 29 | 30 | class TestMarshalledValues(unittest.TestCase): 31 | async def test_asyncAddTwo(self): 32 | self.assertEqual(await addTwo(2), 4) 33 | 34 | unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues)) 35 | ``` 36 | 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Thousand Birds Inc 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /toolchain/chidori-core/src/sdk/snapshots/chidori_core__sdk__md__test__core7.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-core/src/sdk/md.rs 3 | expression: v 4 | --- 5 | - Memory: 6 | - name: stateful_memory 7 | provider: InMemory 8 | embedding_function: "---\nembedding_fn: rag\n---" 9 | - start: 468 10 | end: 519 11 | - Embedding: 12 | - function_invocation: false 13 | configuration: 14 | model: facebook/rag-token-nq 15 | name: rag 16 | req: "{{message}}" 17 | - start: 911 18 | end: 976 19 | - Code: 20 | - name: ~ 21 | language: PyO3 22 | source_code: "def read_file_and_load_to_memory(file_path):\n with open(file_path, 'r') as file:\n content = file.read().split('\\n') # Splits the content into lines\n for line in content:\n insert(message=line)\n return content" 23 | function_invocation: ~ 24 | - start: 1249 25 | end: 1496 26 | - Code: 27 | - name: entry 28 | language: PyO3 29 | source_code: "out = await read_file_and_load_to_memory(\"./\")" 30 | function_invocation: ~ 31 | - start: 1604 32 | end: 1666 33 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core3_function_invocations/core.md: -------------------------------------------------------------------------------- 1 | # This should demonstrate a variety of function calling interactions between different cell types and configurations 2 | 3 | ## Simple function calling across cells 4 | ### Demonstrates defining a function in python and calling it in javascript 5 | ```python (python_add_two) 6 | def add_two(x): 7 | return x + 2 8 | ``` 9 | 10 | ```javascript 11 | import { assertEquals } from "https://deno.land/std@0.221.0/assert/mod.ts"; 12 | 13 | Deno.test("addition test", async () => { 14 | const result = await add_two(2); 15 | console.log(result); 16 | assertEquals(result, 4); 17 | }); 18 | ``` 19 | 20 | ### Demonstrates defining a function in javascript and calling it in python 21 | ```javascript (js_add_two) 22 | function addTwo(x) { 23 | return x + 2; 24 | } 25 | ``` 26 | 27 | ```python 28 | import unittest 29 | 30 | class TestMarshalledValues(unittest.TestCase): 31 | async def test_addTwo(self): 32 | self.assertEqual(await addTwo(2), 4) 33 | 34 | unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues)) 35 | ``` 36 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo3_self_healing_scaper/demo.md: -------------------------------------------------------------------------------- 1 | # This agent demonstrate scraping a website, when the website changes, the agent will automatically update itself to reflect the changes. 2 | 3 | 4 | # This is a simple function that initially will scrape a website, extract some information, and take a screenshot 5 | ```javascript 6 | 7 | const puppeteer = require('puppeteer'); 8 | 9 | async function scrapeWebsite() { 10 | const browser = await puppeteer.launch(); // Launch the browser 11 | const page = await browser.newPage(); // Open a new page 12 | 13 | await page.goto('https://example.com'); // Navigate to the website 14 | 15 | // Take a screenshot and save it to 'example.png' 16 | await page.screenshot({ path: 'example.png' }); 17 | 18 | // Extract the text of the h1 element 19 | const headingText = await page.evaluate(() => document.querySelector('h1').innerText); 20 | 21 | console.log('Heading text:', headingText); // Log the heading text 22 | 23 | await browser.close(); // Close the browser 24 | } 25 | 26 | scrapeWebsite().catch(console.error); 27 | 28 | // modified text 29 | ``` 30 | 31 | 32 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/bevy_prototype_lyon/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any 2 | person obtaining a copy of this software and associated 3 | documentation files (the "Software"), to deal in the 4 | Software without restriction, including without 5 | limitation the rights to use, copy, modify, merge, 6 | publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software 8 | is furnished to do so, subject to the following 9 | conditions: 10 | 11 | The above copyright notice and this permission notice 12 | shall be included in all copies or substantial portions 13 | of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 16 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 17 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 18 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 19 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 22 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /deployment/docker-single-container/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Create log files for LiteLLM 4 | mkdir -p logs 5 | 6 | # Start LiteLLM and redirect both stdout and stderr to log files 7 | uv run litellm --config ./litellm_config.yaml > logs/litellm.out 2> logs/litellm.err & 8 | LITELLM_PID=$! 9 | 10 | # Start Chidori and stream its output to console while still maintaining the background process 11 | chidori-core run --load /usr/src/example_agent 2>&1 & 12 | CHIDORI_PID=$! 13 | 14 | # Optional: Print PIDs for debugging 15 | echo "LiteLLM PID: $LITELLM_PID" 16 | echo "Chidori PID: $CHIDORI_PID" 17 | 18 | # Wait for any process to exit 19 | wait -n 20 | 21 | # Capture the exit status 22 | EXIT_STATUS=$? 23 | 24 | # Optional: Print which process exited 25 | if ! kill -0 $LITELLM_PID 2>/dev/null; then 26 | echo "LiteLLM process exited first with status $EXIT_STATUS" 27 | elif ! kill -0 $CHIDORI_PID 2>/dev/null; then 28 | echo "Chidori process exited first with status $EXIT_STATUS" 29 | fi 30 | 31 | # Clean up any remaining processes 32 | kill $LITELLM_PID $CHIDORI_PID 2>/dev/null 33 | 34 | # Exit with status of process that exited first 35 | exit $EXIT_STATUS -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | node_modules 3 | toolchain/chidori-old/package_node/native/chidori.node 4 | toolcahin/chidori/build 5 | __pycache__ 6 | 7 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 8 | 9 | /.venv 10 | 11 | # dependencies 12 | /global_node_modules 13 | node_modules 14 | /.pnp 15 | .pnp.js 16 | 17 | # testing 18 | /coverage 19 | 20 | # next.js 21 | /.next/ 22 | /out/ 23 | 24 | # production 25 | /build 26 | 27 | # misc 28 | .DS_Store 29 | *.pem 30 | 31 | # debug 32 | npm-debug.log* 33 | yarn-debug.log* 34 | yarn-error.log* 35 | .pnpm-debug.log* 36 | 37 | # local env files 38 | .env*.local 39 | 40 | # vercel 41 | .vercel 42 | 43 | # typescript 44 | *.tsbuildinfo 45 | next-env.d.ts 46 | 47 | # Sentry Auth Token 48 | .sentryclirc 49 | 50 | /dist 51 | 52 | monorepo-diff-buildkite-plugin 53 | 54 | # Devenv 55 | .devenv* 56 | devenv.local.nix 57 | 58 | index.node 59 | databases/simulation_host_db/report.json 60 | databases/simulation_host_db/report.html 61 | 62 | .next 63 | dist 64 | .idea 65 | .venv 66 | 67 | toolchain/chidori-old/package_python/chidori/_chidori.abi3.so 68 | 69 | .pre-commit-config.yaml 70 | 71 | .env 72 | .envrc 73 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/bevy_egui/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Vladyslav Batyrenko 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/tidy_tree/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [2022] [Zixuan Chen] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/egui_json_tree/LICENSE-MIT: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Duncan MacKinnon 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/sdk/snapshots/chidori_core__sdk__md__test__core6.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-core/src/sdk/md.rs 3 | expression: v 4 | --- 5 | - Code: 6 | - name: math_fn 7 | language: PyO3 8 | source_code: "def add_two_numbers(a, b):\n return a + b" 9 | function_invocation: ~ 10 | - start: 64 11 | end: 127 12 | - Prompt: 13 | - Chat: 14 | function_invocation: false 15 | configuration: 16 | import: 17 | - add_two_numbers 18 | fn: add_population 19 | model: gpt-3.5-turbo 20 | name: add_population 21 | provider: OpenAI 22 | req: "Add the population of {{state}} to the population of California" 23 | - start: 136 24 | end: 300 25 | - Code: 26 | - name: entry 27 | language: PyO3 28 | source_code: "import unittest\n\nclass TestMarshalledValues(unittest.IsolatedAsyncioTestCase):\n async def test_run_prompt(self):\n self.assertEqual(await add_population(state=\"Arizona\"), 4)\n\nunittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues))" 29 | function_invocation: ~ 30 | - start: 309 31 | end: 605 32 | -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/LICENSE_MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 coltonpierson 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/LICENSE_MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2018 coltonpierson 2 | 3 | Permission is hereby granted, free of charge, to any 4 | person obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without 7 | limitation the rights to use, copy, modify, merge, 8 | publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software 10 | is furnished to do so, subject to the following 11 | conditions: 12 | 13 | The above copyright notice and this permission notice 14 | shall be included in all copies or substantial portions 15 | of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 18 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 19 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 20 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 21 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 22 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 23 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 24 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 25 | DEALINGS IN THE SOFTWARE. 26 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_in_function_parameters.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function printPerson({ name, age = 30 }) {\n console.log(`${name} is ${age} years old`);\n}\n" 4 | --- 5 | - - InFunction: 6 | - printPerson 7 | - start: 1 8 | end: 93 9 | - FunctionArguments 10 | - IdentifierReferredTo: 11 | name: name 12 | in_scope: false 13 | exposed: true 14 | - IdentifierReferredTo: 15 | name: age 16 | in_scope: false 17 | exposed: true 18 | - - InFunction: 19 | - printPerson 20 | - start: 1 21 | end: 93 22 | - InCallExpression 23 | - Attribute: log 24 | - IdentifierReferredTo: 25 | name: console 26 | in_scope: false 27 | exposed: true 28 | - IdentifierReferredTo: 29 | name: name 30 | in_scope: true 31 | exposed: true 32 | - IdentifierReferredTo: 33 | name: age 34 | in_scope: true 35 | exposed: true 36 | - - InFunction: 37 | - printPerson 38 | - start: 1 39 | end: 93 40 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_object_destructuring.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const pairs = [{a: 1, b:2}];\nfor (const {a, b} of pairs) {\n console.log(a, b);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: pairs 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | - - AssignmentToStatement 12 | - IdentifierReferredTo: 13 | name: a 14 | in_scope: false 15 | exposed: false 16 | - IdentifierReferredTo: 17 | name: b 18 | in_scope: false 19 | exposed: false 20 | - - IdentifierReferredTo: 21 | name: pairs 22 | in_scope: true 23 | exposed: false 24 | - InCallExpression 25 | - Attribute: log 26 | - IdentifierReferredTo: 27 | name: console 28 | in_scope: false 29 | exposed: false 30 | - IdentifierReferredTo: 31 | name: a 32 | in_scope: true 33 | exposed: false 34 | - IdentifierReferredTo: 35 | name: b 36 | in_scope: true 37 | exposed: false 38 | -------------------------------------------------------------------------------- /toolchain/book_src/ARCHITECTURE.md: -------------------------------------------------------------------------------- 1 | # Architecture 2 | 3 | ## Overview 4 | 5 | Chidori consists of the following crates: 6 | 7 | - `chidori-core` contains our orchestrator and runtime. 8 | - `chidori-debugger` contains a UI for visualizing and debugging Chidori executed programs. 9 | - `chidori-prompt-format` implements handlebars-like templating with support for tracing composition 10 | - `chidori-static-analysis` implements our parsing and extraction of control-flow from Python and TypeScript source code 11 | 12 | 13 | ### Chidori Core 14 | 15 | Chidori Core is constructed mainly around our *execution graph*. The execution graph is a graph of all 16 | state transitions that take place between function invocations in the code we run. Each state is represented by 17 | an *execution state*. 18 | 19 | When code is loaded by Chidori it can go through two modes of operation: notebooks or complete files. 20 | Notebooks are broken down into their component cells. These cells are treated as operations in a dependency graph, 21 | there is no explicit entrypoint to the notebook. Cells execute in their topologically sorted and declared order. 22 | Complete files are handled equivalently to single-cell notebooks. 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/tidy_tree/layout/linked_y_list.rs: -------------------------------------------------------------------------------- 1 | use std::collections::LinkedList; 2 | 3 | use crate::tidy_tree::geometry::Coord; 4 | 5 | pub struct LinkedYList { 6 | pub index: usize, 7 | y: Coord, 8 | next: Option>, 9 | } 10 | 11 | impl LinkedYList { 12 | pub fn new(index: usize, y: Coord) -> Self { 13 | LinkedYList { 14 | index, 15 | y, 16 | next: None, 17 | } 18 | } 19 | 20 | pub fn bottom(&self) -> Coord { 21 | self.y 22 | } 23 | 24 | pub fn update(self, index: usize, y: Coord) -> Self { 25 | let mut node = self; 26 | while node.y <= y { 27 | if let Some(next) = node.next.take() { 28 | node = *next; 29 | } else { 30 | return LinkedYList { 31 | index, 32 | y, 33 | next: None, 34 | }; 35 | } 36 | } 37 | 38 | LinkedYList { 39 | index, 40 | y, 41 | next: Some(Box::new(node)), 42 | } 43 | } 44 | 45 | pub fn pop(mut self) -> Option { 46 | self.next.take().map(|next| *next) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_of_loop_with_destructuring.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const pairs = [[1, 'one'], [2, 'two'], [3, 'three']];\nfor (const [num, word] of pairs) {\n console.log(num, word);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: pairs 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | - - AssignmentToStatement 12 | - IdentifierReferredTo: 13 | name: num 14 | in_scope: false 15 | exposed: false 16 | - IdentifierReferredTo: 17 | name: word 18 | in_scope: false 19 | exposed: false 20 | - - IdentifierReferredTo: 21 | name: pairs 22 | in_scope: true 23 | exposed: false 24 | - InCallExpression 25 | - Attribute: log 26 | - IdentifierReferredTo: 27 | name: console 28 | in_scope: false 29 | exposed: false 30 | - IdentifierReferredTo: 31 | name: num 32 | in_scope: true 33 | exposed: false 34 | - IdentifierReferredTo: 35 | name: word 36 | in_scope: true 37 | exposed: false 38 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/sdk/snapshots/chidori_core__sdk__md__test__core4.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-core/src/sdk/md.rs 3 | expression: v 4 | --- 5 | - Code: 6 | - name: ~ 7 | language: PyO3 8 | source_code: "async def add_two(x):\n return x + 2" 9 | function_invocation: ~ 10 | - start: 237 11 | end: 283 12 | - Code: 13 | - name: ~ 14 | language: Deno 15 | source_code: "import { assertEquals } from \"https://deno.land/std@0.221.0/assert/mod.ts\";\n\nDeno.test(\"async addition test\", async () => {\n assertEquals(await add_two(2), 4);\n});" 16 | function_invocation: ~ 17 | - start: 291 18 | end: 469 19 | - Code: 20 | - name: ~ 21 | language: Deno 22 | source_code: "async function addTwo(x) {\n return x + 2;\n}" 23 | function_invocation: ~ 24 | - start: 553 25 | end: 611 26 | - Code: 27 | - name: ~ 28 | language: PyO3 29 | source_code: "import unittest\n\nclass TestMarshalledValues(unittest.TestCase):\n async def test_asyncAddTwo(self):\n self.assertEqual(await addTwo(2), 4)\n\nunittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues))" 30 | function_invocation: ~ 31 | - start: 619 32 | end: 871 33 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core5_prompts_invoked_as_functions/core.md: -------------------------------------------------------------------------------- 1 | # Demonstrating how a prompt is capable of being invoked by code 2 | 3 | This is a python function that is invoking a prompt by name, kwargs to this 4 | invocation are passed to the prompt. Prompts are async and return strings. 5 | ```python (run_prompt_cell) 6 | async def first_letter(s): 7 | return s.replace("-", "").strip()[0] 8 | 9 | async def run_prompt(number_of_states): 10 | out = "" 11 | for state in (await get_states_first_letters(num=number_of_states)).split('\n'): 12 | out += await first_letter(state) 13 | return "demo" + out 14 | ``` 15 | 16 | This is the prompt itself. The cell name is used to refer to the prompt output when it is satisfied 17 | by globally available values. The fn key is used to name the prompt in the context of a function invocation. 18 | ```prompt (states) 19 | --- 20 | model: gpt-3.5-turbo 21 | fn: get_states_first_letters 22 | --- 23 | List the first {{num}} US states to be added to the union. 24 | Return this as a `-` bulleted list with the name of the state on each line. 25 | ``` 26 | 27 | A unit test demonstrates the invocation of the prompt by the function. 28 | ```python (entry) 29 | result = await run_prompt(5) 30 | ``` 31 | 32 | 33 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__destructuring_tests__destructuring_in_for_of_loops.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const items = [{ id: 1, name: 'Item 1' }, { id: 2, name: 'Item 2' }];\nfor (const { id, name } of items) {\n console.log(`${id}: ${name}`);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: items 8 | in_scope: false 9 | exposed: true 10 | - - AssignmentFromStatement 11 | - - AssignmentToStatement 12 | - IdentifierReferredTo: 13 | name: id 14 | in_scope: false 15 | exposed: false 16 | - IdentifierReferredTo: 17 | name: name 18 | in_scope: false 19 | exposed: false 20 | - - IdentifierReferredTo: 21 | name: items 22 | in_scope: true 23 | exposed: false 24 | - InCallExpression 25 | - Attribute: log 26 | - IdentifierReferredTo: 27 | name: console 28 | in_scope: false 29 | exposed: false 30 | - IdentifierReferredTo: 31 | name: id 32 | in_scope: true 33 | exposed: false 34 | - IdentifierReferredTo: 35 | name: name 36 | in_scope: true 37 | exposed: false 38 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__ch_reference_internal_to_function.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function evaluate_agent(ev) {\n ch.set(\"file_path\", ev.file_path)\n migration_agent()\n}\n" 4 | --- 5 | - - InFunction: 6 | - evaluate_agent 7 | - start: 1 8 | end: 92 9 | - FunctionArguments 10 | - IdentifierReferredTo: 11 | name: ev 12 | in_scope: false 13 | exposed: true 14 | - - InFunction: 15 | - evaluate_agent 16 | - start: 1 17 | end: 92 18 | - InCallExpression 19 | - Attribute: set 20 | - IdentifierReferredTo: 21 | name: ch 22 | in_scope: false 23 | exposed: true 24 | - Constant: file_path 25 | - Attribute: file_path 26 | - IdentifierReferredTo: 27 | name: ev 28 | in_scope: true 29 | exposed: true 30 | - - InFunction: 31 | - evaluate_agent 32 | - start: 1 33 | end: 92 34 | - InCallExpression 35 | - IdentifierReferredTo: 36 | name: migration_agent 37 | in_scope: false 38 | exposed: true 39 | - - InFunction: 40 | - evaluate_agent 41 | - start: 1 42 | end: 92 43 | -------------------------------------------------------------------------------- /toolchain/.run/Test execution__database__tests__test_traverse_single_node.run.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 21 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/std/ai/llm/snapshots/chidori_core__library__std__ai__llm__test__tool_usage_inference.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-core/src/library/std/ai/llm/mod.rs 3 | --- 4 | - function: 5 | name: demo 6 | description: ~ 7 | parameters: 8 | schema_type: object 9 | properties: {} 10 | required: ~ 11 | tool_type: function 12 | - function: 13 | name: complex_args 14 | description: ~ 15 | parameters: 16 | schema_type: object 17 | properties: 18 | a: 19 | schema_type: string 20 | description: ~ 21 | enum_values: ~ 22 | properties: ~ 23 | required: ~ 24 | items: ~ 25 | b: 26 | schema_type: string 27 | description: ~ 28 | enum_values: ~ 29 | properties: ~ 30 | required: ~ 31 | items: ~ 32 | c: 33 | schema_type: string 34 | description: ~ 35 | enum_values: ~ 36 | properties: ~ 37 | required: ~ 38 | items: ~ 39 | d: 40 | schema_type: string 41 | description: ~ 42 | enum_values: ~ 43 | properties: ~ 44 | required: ~ 45 | items: ~ 46 | required: ~ 47 | tool_type: function 48 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__ch_function_decoration_referring_to_another_function.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | expression: context_stack_references 4 | --- 5 | - - InFunction: 6 | - setup_pipeline 7 | - start: 25 8 | end: 60 9 | - - InFunction: 10 | - setup_pipeline 11 | - start: 25 12 | end: 60 13 | - InFunctionDecorator: 0 14 | - InCallExpression 15 | - IdentifierReferredTo: 16 | name: create_dockerfile 17 | in_scope: false 18 | exposed: false 19 | - - InFunction: 20 | - setup_pipeline 21 | - start: 25 22 | end: 60 23 | - InFunctionDecorator: 0 24 | - InCallExpression 25 | - Attribute: p 26 | - IdentifierReferredTo: 27 | name: ch 28 | in_scope: false 29 | exposed: false 30 | - - InFunction: 31 | - setup_pipeline 32 | - start: 25 33 | end: 60 34 | - FunctionArguments 35 | - IdentifierReferredTo: 36 | name: x 37 | in_scope: false 38 | exposed: false 39 | - - InFunction: 40 | - setup_pipeline 41 | - start: 25 42 | end: 60 43 | - IdentifierReferredTo: 44 | name: x 45 | in_scope: true 46 | exposed: false 47 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub mod language; 2 | mod flow; 3 | use lazy_static::lazy_static; 4 | use serde::{Deserialize, Serialize}; 5 | use std::collections::HashMap; 6 | use std::sync::Mutex; 7 | use wasm_bindgen::prelude::*; 8 | 9 | use rustpython_parser::{ast, Parse}; 10 | 11 | use crate::language::python::parse::build_report; 12 | use crate::language::python::parse::extract_dependencies_python as extract_dependencies_python_impl; 13 | 14 | #[macro_use] 15 | extern crate swc_common; 16 | 17 | #[wasm_bindgen] 18 | extern "C" { 19 | // #[wasm_bindgen(js_namespace = console)] 20 | // fn log(s: &str); 21 | } 22 | 23 | #[wasm_bindgen] 24 | pub fn extract_dependencies_python(source_code: &str) -> Result { 25 | let result = extract_dependencies_python_impl(source_code).map_err(|e| e.to_string())?; 26 | serde_wasm_bindgen::to_value(&result).map_err(|e| JsValue::from_str(&e.to_string())) 27 | } 28 | 29 | #[wasm_bindgen] 30 | pub fn extract_cell_info(source_code: &str) -> Result { 31 | let context_stack_references = extract_dependencies_python_impl(source_code).map_err(|e| e.to_string())?; 32 | let result = build_report(&context_stack_references); 33 | serde_wasm_bindgen::to_value(&result).map_err(|e| JsValue::from_str(&e.to_string())) 34 | } 35 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/sdk/snapshots/chidori_core__sdk__md__test__core3.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-core/src/sdk/md.rs 3 | expression: v 4 | --- 5 | - Code: 6 | - name: python_add_two 7 | language: PyO3 8 | source_code: "def add_two(x):\n return x + 2" 9 | function_invocation: ~ 10 | - start: 237 11 | end: 294 12 | - Code: 13 | - name: ~ 14 | language: Deno 15 | source_code: "import { assertEquals } from \"https://deno.land/std@0.221.0/assert/mod.ts\";\n\nDeno.test(\"addition test\", async () => {\n const result = await add_two(2);\n console.log(result);\n assertEquals(result, 4);\n});" 16 | function_invocation: ~ 17 | - start: 302 18 | end: 526 19 | - Code: 20 | - name: js_add_two 21 | language: Deno 22 | source_code: "function addTwo(x) {\n return x + 2;\n}" 23 | function_invocation: ~ 24 | - start: 610 25 | end: 675 26 | - Code: 27 | - name: ~ 28 | language: PyO3 29 | source_code: "import unittest\n\nclass TestMarshalledValues(unittest.TestCase):\n async def test_addTwo(self):\n self.assertEqual(await addTwo(2), 4)\n\nunittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues))" 30 | function_invocation: ~ 31 | - start: 683 32 | end: 930 33 | -------------------------------------------------------------------------------- /litellm_config.yaml: -------------------------------------------------------------------------------- 1 | model_list: 2 | - model_name: o1-preview 3 | litellm_params: 4 | model: openai/o1-preview 5 | api_key: os.environ/OPENAI_API_KEY 6 | - model_name: o1-mini 7 | litellm_params: 8 | model: openai/o1-mini 9 | api_key: os.environ/OPENAI_API_KEY 10 | - model_name: gpt-4o 11 | litellm_params: 12 | model: openai/gpt-4o 13 | api_key: os.environ/OPENAI_API_KEY 14 | - model_name: gpt-4o-mini 15 | litellm_params: 16 | model: openai/gpt-4o-mini 17 | api_key: os.environ/OPENAI_API_KEY 18 | - model_name: gpt-4-turbo 19 | litellm_params: 20 | model: openai/gpt-4-turbo 21 | api_key: os.environ/OPENAI_API_KEY 22 | - model_name: gpt-3.5-turbo 23 | litellm_params: 24 | model: openai/gpt-3.5-turbo 25 | api_key: os.environ/OPENAI_API_KEY 26 | - model_name: gpt-3.5-turbo-instruct 27 | litellm_params: 28 | model: text-completion-openai/gpt-3.5-turbo-instruct 29 | api_key: os.environ/OPENAI_API_KEY 30 | - model_name: text-embedding-3-small 31 | litellm_params: 32 | model: openai/text-embedding-3-small 33 | api_key: os.environ/OPENAI_API_KEY 34 | - model_name: claude-3.5 35 | litellm_params: 36 | model: anthropic/claude-3-5-sonnet-20240620 37 | api_key: os.environ/ANTHROPIC_API_KEY 38 | 39 | -------------------------------------------------------------------------------- /toolchain/scripts/update_version_numbers.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | GIT_ROOT=$(git rev-parse --show-toplevel) 4 | 5 | 6 | # Check for the correct number of arguments 7 | if [ "$#" -ne 1 ]; then 8 | echo "Usage: $0 " 9 | exit 1 10 | fi 11 | 12 | # New version number from the command line arguments 13 | NEW_VERSION="$1" 14 | 15 | # Hardcoded paths 16 | CARGO_TOML_PATHS=( 17 | "${GIT_ROOT}/chidori-core/Cargo.toml" 18 | "${GIT_ROOT}/chidori-im-hashmap/Cargo.toml" 19 | "${GIT_ROOT}/chidori-static-analysis/Cargo.toml" 20 | "${GIT_ROOT}/chidori-prompt-format/Cargo.toml" 21 | ) 22 | 23 | # Loop through the paths and update the version numbers 24 | for CARGO_TOML_PATH in "${CARGO_TOML_PATHS[@]}"; do 25 | # Update all version strings that match the pattern 26 | sed -i "s/\(chidori-core.*version = \"\)\(\^\?[0-9]*\.[0-9]*\.[0-9]*\"\)/\1^$NEW_VERSION\"/g" "$CARGO_TOML_PATH" 27 | sed -i "s/\(chidori-im-hashmap.*version = \"\)\(\^\?[0-9]*\.[0-9]*\.[0-9]*\"\)/\1^$NEW_VERSION\"/g" "$CARGO_TOML_PATH" 28 | sed -i "s/\(chidori-static-analysis.*version = \"\)\(\^\?[0-9]*\.[0-9]*\.[0-9]*\"\)/\1^$NEW_VERSION\"/g" "$CARGO_TOML_PATH" 29 | sed -i "s/\(chidori-prompt-format.*version = \"\)\(\^\?[0-9]*\.[0-9]*\.[0-9]*\"\)/\1^$NEW_VERSION\"/g" "$CARGO_TOML_PATH" 30 | echo "Versions updated to ^$NEW_VERSION in $CARGO_TOML_PATH" 31 | done 32 | -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/tests/nodejs/chidoriPromptFormat.test.ts: -------------------------------------------------------------------------------- 1 | import * as c from 'chidori_prompt_format' 2 | // @ts-ignore 3 | import * as j from '@types/jest'; 4 | 5 | describe('chidoriPromptFormat', () => { 6 | it('should return a string', () => { 7 | // @ts-ignore 8 | expect(c.extract_roles_from_template(` 9 | {{#system}}You are a helpful assistant.{{value}}{{/system}} 10 | {{#user}}test{{/user}} 11 | {{#assistant}}test{{/assistant}} 12 | `)).toStrictEqual([{role: "System", source: 'You are a helpful assistant.{{value}}'}, {role: "User", source: 'test'}, {role: "Assistant", source: 'test'}]) 13 | }) 14 | }); 15 | 16 | 17 | describe('chidoriPromptFormatRendering', () => { 18 | it('should return a string', () => { 19 | // @ts-ignore 20 | expect(c.render_template_prompt(`Basic template {{user.name}}`, {user: {name: "example"}}, {})) 21 | .toBe('Basic template example') 22 | }); 23 | 24 | it('should return a string', () => { 25 | // @ts-ignore 26 | const roles = c.extract_roles_from_template(` 27 | {{#system}}You are a helpful assistant.{{value}}{{/system}} 28 | {{#user}}test{{/user}} 29 | {{#assistant}}test{{/assistant}}`) 30 | // @ts-ignore 31 | expect(c.render_template_prompt(roles[0].source, {value: "testing"}, {})).toBe('You are a helpful assistant.testing') 32 | }); 33 | }); 34 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | 2 | name: Create GitHub Release 3 | 4 | on: 5 | workflow_dispatch: 6 | jobs: 7 | create-release: 8 | name: create-release 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@v3 12 | 13 | - name: Create artifacts directory 14 | run: mkdir artifacts 15 | 16 | - name: Set release version 17 | if: env.ARTIFACT_VERSION == '' 18 | working-directory: toolchain 19 | run: python3 ./scripts/get_target_version.py 20 | 21 | - name: Create GitHub release 22 | id: release 23 | uses: ncipollo/release-action@v1 24 | with: 25 | tag: ${{ env.ARTIFACT_VERSION }} 26 | name: ${{ env.ARTIFACT_VERSION }} 27 | allowUpdates: true 28 | omitBody: true 29 | omitPrereleaseDuringUpdate: true 30 | token: ${{ secrets.GITHUB_TOKEN }} 31 | 32 | - name: Save release upload URL to artifact 33 | run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url 34 | 35 | - name: Save version number to artifact 36 | run: echo "${{ env.ARTIFACT_VERSION }}" > artifacts/release-version 37 | 38 | - name: Upload artifacts 39 | uses: actions/upload-artifact@v3 40 | with: 41 | name: artifacts 42 | path: artifacts 43 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_multiple_declarations.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0, j = 10; i < j; i++, j--) {\n console.log(i, j);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: i 8 | in_scope: false 9 | exposed: false 10 | - - AssignmentToStatement 11 | - IdentifierReferredTo: 12 | name: j 13 | in_scope: false 14 | exposed: false 15 | - - IdentifierReferredTo: 16 | name: i 17 | in_scope: true 18 | exposed: false 19 | - IdentifierReferredTo: 20 | name: j 21 | in_scope: true 22 | exposed: false 23 | - IdentifierReferredTo: 24 | name: i 25 | in_scope: true 26 | exposed: false 27 | - IdentifierReferredTo: 28 | name: j 29 | in_scope: true 30 | exposed: false 31 | - InCallExpression 32 | - Attribute: log 33 | - IdentifierReferredTo: 34 | name: console 35 | in_scope: false 36 | exposed: false 37 | - IdentifierReferredTo: 38 | name: i 39 | in_scope: true 40 | exposed: false 41 | - IdentifierReferredTo: 42 | name: j 43 | in_scope: true 44 | exposed: false 45 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__ch_function_with_arguments.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function subtract(a, b) {\n return a - b;\n}\n\n// Example usage\nconst v = subtract(x, 5);\n" 4 | --- 5 | - - InFunction: 6 | - subtract 7 | - start: 1 8 | end: 46 9 | - FunctionArguments 10 | - IdentifierReferredTo: 11 | name: a 12 | in_scope: false 13 | exposed: true 14 | - IdentifierReferredTo: 15 | name: b 16 | in_scope: false 17 | exposed: true 18 | - - InFunction: 19 | - subtract 20 | - start: 1 21 | end: 46 22 | - IdentifierReferredTo: 23 | name: a 24 | in_scope: true 25 | exposed: true 26 | - IdentifierReferredTo: 27 | name: b 28 | in_scope: true 29 | exposed: true 30 | - - AssignmentToStatement 31 | - IdentifierReferredTo: 32 | name: v 33 | in_scope: false 34 | exposed: true 35 | - - AssignmentFromStatement 36 | - InCallExpression 37 | - IdentifierReferredTo: 38 | name: subtract 39 | in_scope: true 40 | exposed: true 41 | - IdentifierReferredTo: 42 | name: x 43 | in_scope: false 44 | exposed: true 45 | - - AssignmentFromStatement 46 | -------------------------------------------------------------------------------- /deployment/docker-single-container/litellm_config.yaml: -------------------------------------------------------------------------------- 1 | model_list: 2 | - model_name: o1-preview 3 | litellm_params: 4 | model: openai/o1-preview 5 | api_key: os.environ/OPENAI_API_KEY 6 | - model_name: o1-mini 7 | litellm_params: 8 | model: openai/o1-mini 9 | api_key: os.environ/OPENAI_API_KEY 10 | - model_name: gpt-4o 11 | litellm_params: 12 | model: openai/gpt-4o 13 | api_key: os.environ/OPENAI_API_KEY 14 | - model_name: gpt-4o-mini 15 | litellm_params: 16 | model: openai/gpt-4o-mini 17 | api_key: os.environ/OPENAI_API_KEY 18 | - model_name: gpt-4-turbo 19 | litellm_params: 20 | model: openai/gpt-4-turbo 21 | api_key: os.environ/OPENAI_API_KEY 22 | - model_name: gpt-3.5-turbo 23 | litellm_params: 24 | model: openai/gpt-3.5-turbo 25 | api_key: os.environ/OPENAI_API_KEY 26 | - model_name: gpt-3.5-turbo-instruct 27 | litellm_params: 28 | model: text-completion-openai/gpt-3.5-turbo-instruct 29 | api_key: os.environ/OPENAI_API_KEY 30 | - model_name: text-embedding-3-small 31 | litellm_params: 32 | model: openai/text-embedding-3-small 33 | api_key: os.environ/OPENAI_API_KEY 34 | - model_name: claude-3.5 35 | litellm_params: 36 | model: anthropic/claude-3-5-sonnet-20240620 37 | api_key: os.environ/ANTHROPIC_API_KEY 38 | 39 | -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "chidori-prompt-format" 3 | version = "0.1.36" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Chidori Prompt Format is a package for creating traceable handlebars based LLM prompts" 10 | 11 | [lib] 12 | crate-type = ["cdylib", "rlib"] 13 | 14 | [features] 15 | default = ["console_error_panic_hook"] 16 | 17 | [dependencies] 18 | wasm-bindgen = { version = "0.2.89", features = [] } 19 | serde-wasm-bindgen = "0.4" 20 | indoc.workspace = true 21 | anyhow.workspace = true 22 | serde.workspace = true 23 | serde_json = "=1.0.128" 24 | serde_yaml = "0.9" 25 | thousand_birds_handlebars = "5.0.0" 26 | 27 | 28 | # The `console_error_panic_hook` crate provides better debugging of panics by 29 | # logging them with `console.error`. This is great for development, but requires 30 | # all the `std::fmt` and `std::panicking` infrastructure, so isn't great for 31 | # code size when deploying. 32 | console_error_panic_hook = { version = "0.1.7", optional = true } 33 | lazy_static = "1.4.0" 34 | 35 | #[dependencies.handlebars] 36 | #git = "https://github.com/ThousandBirdsInc/handlebars-rust" 37 | #rev = "fc73bb228665d27e476c5ea8c270fea79b2290cf" 38 | 39 | [dev-dependencies] 40 | wasm-bindgen-test = "0.3.34" 41 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/sdk/snapshots/chidori_core__sdk__md__test__core5.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-core/src/sdk/md.rs 3 | expression: v 4 | --- 5 | - Code: 6 | - name: run_prompt_cell 7 | language: PyO3 8 | source_code: "def first_letter(s):\n return s.replace(\"-\", \"\").strip()[0]\n\nasync def run_prompt(number_of_states):\n out = \"\"\n for state in (await get_states_first_letters(num=number_of_states)).split('\\n'):\n out += first_letter(state)\n return \"demo\" + out" 9 | function_invocation: ~ 10 | - start: 220 11 | end: 505 12 | - Prompt: 13 | - Chat: 14 | function_invocation: false 15 | configuration: 16 | fn: get_states_first_letters 17 | model: gpt-3.5-turbo 18 | name: states 19 | provider: OpenAI 20 | req: "List the first {{num}} US states to be added to the union.\nReturn this as a `-` bulleted list with the name of the state on each line." 21 | - start: 722 22 | end: 931 23 | - Code: 24 | - name: entry 25 | language: PyO3 26 | source_code: "import unittest\n\nclass TestMarshalledValues(unittest.IsolatedAsyncioTestCase):\n async def test_run_prompt(self):\n self.assertEqual(await run_prompt(5), \"demoDPNGC\")\n\nunittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues))" 27 | function_invocation: ~ 28 | - start: 1010 29 | end: 1298 30 | -------------------------------------------------------------------------------- /toolchain/chidori-prompt-format/tests/web.rs: -------------------------------------------------------------------------------- 1 | //! Test suite for the Web and headless browsers. 2 | 3 | #![cfg(target_arch = "wasm32")] 4 | 5 | extern crate wasm_bindgen_test; 6 | 7 | use chidori_prompt_format::analyze_referenced_partials; 8 | use chidori_prompt_format::templating::templates::{SchemaItem, SchemaItemType}; 9 | use std::collections::HashMap; 10 | use wasm_bindgen_test::*; 11 | 12 | wasm_bindgen_test_configure!(run_in_browser); 13 | 14 | #[wasm_bindgen_test] 15 | fn analyzing_referenced_partials() { 16 | let template = "Basic template {{var}} {{dot.notation}}"; 17 | let result = analyze_referenced_partials(&template); 18 | let val: SchemaItem = serde_wasm_bindgen::from_value(result).unwrap(); 19 | assert_eq!( 20 | val, 21 | SchemaItem { 22 | ty: SchemaItemType::Object, 23 | items: HashMap::from([ 24 | ( 25 | "dot.notation".to_string(), 26 | Box::new(SchemaItem { 27 | ty: SchemaItemType::String, 28 | items: HashMap::new(), 29 | }) 30 | ), 31 | ( 32 | "var".to_string(), 33 | Box::new(SchemaItem { 34 | ty: SchemaItemType::String, 35 | items: HashMap::new(), 36 | }) 37 | ), 38 | ]), 39 | } 40 | ); 41 | } 42 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/sdk/snapshots/chidori_core__sdk__md__test__core5.snap.new: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-core/src/sdk/md.rs 3 | assertion_line: 264 4 | expression: v 5 | --- 6 | - Code: 7 | - name: run_prompt_cell 8 | language: PyO3 9 | source_code: "async def first_letter(s):\n return s.replace(\"-\", \"\").strip()[0]\n\nasync def run_prompt(number_of_states):\n out = \"\"\n for state in (await get_states_first_letters(num=number_of_states)).split('\\n'):\n out += await first_letter(state)\n return \"demo\" + out" 10 | function_invocation: ~ 11 | - start: 220 12 | end: 517 13 | - Prompt: 14 | - Chat: 15 | function_invocation: false 16 | configuration: 17 | fn: get_states_first_letters 18 | model: gpt-3.5-turbo 19 | name: states 20 | provider: OpenAI 21 | req: "List the first {{num}} US states to be added to the union.\nReturn this as a `-` bulleted list with the name of the state on each line." 22 | - start: 734 23 | end: 943 24 | - Code: 25 | - name: entry 26 | language: PyO3 27 | source_code: "import unittest\n\nclass TestMarshalledValues(unittest.IsolatedAsyncioTestCase):\n async def test_run_prompt(self):\n self.assertEqual(await run_prompt(5), \"demoDPNGC\")\n\nunittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues))" 28 | function_invocation: ~ 29 | - start: 1022 30 | end: 1310 31 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core10_concurrency/core.md: -------------------------------------------------------------------------------- 1 | # Explaining and demonstrating our concurrency support 2 | 3 | This is a python function that is invoking a prompt by name, kwargs to this 4 | invocation are passed to the prompt. Prompts are async and return strings. 5 | ```python (run_prompt_cell) 6 | async def first_letter(s): 7 | return s.replace("-", "").strip()[0] 8 | 9 | async def run_prompt(number_of_states): 10 | out = "" 11 | for state in (await get_states_first_letters(num=number_of_states)).split('\n'): 12 | out += await first_letter(state) 13 | return "demo" + out 14 | ``` 15 | 16 | This is the prompt itself. The cell name is used to refer to the prompt output when it is satisfied 17 | by globally available values. The fn key is used to name the prompt in the context of a function invocation. 18 | ```prompt (states) 19 | --- 20 | model: gpt-3.5-turbo 21 | fn: get_states_first_letters 22 | --- 23 | List the first {{num}} US states to be added to the union. 24 | Return this as a `-` bulleted list with the name of the state on each line. 25 | ``` 26 | 27 | A unit test demonstrates the invocation of the prompt by the function. 28 | ```python (entry) 29 | import unittest 30 | 31 | class TestMarshalledValues(unittest.IsolatedAsyncioTestCase): 32 | async def test_run_prompt(self): 33 | self.assertEqual(await run_prompt(5), "demoDPNGC") 34 | 35 | unittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues)) 36 | ``` 37 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/fonts/CommitMono-1.143/installation.txt: -------------------------------------------------------------------------------- 1 | A short guide for how to install and enable your shiny new version of Commit Mono. 2 | This is taken from section 08 Install from https://commitmono.com/ 3 | 4 | #1 (Download the fonts) 5 | #2 Unzip the fonts. You'll see 4 font files. These 4 fonts make up a 'Style Group': 6 | * CommitMono-Regular: Base version with settings and weight of your choice. 7 | * CommitMono-Italic: An italic version, same weight as regular. 8 | * CommitMono-Bold: A bold version, weight 700. 9 | * CommitMono-BoldItalic: A bold version, weight 700, that is also italic. 10 | #3 Install all 4 fonts on your system: 11 | * Windows: Right click the font in the folder and click "Install". 12 | * Mac: Open fonts with Font Book from the folder and click "Install". 13 | * Linux: Unpack fonts to ~/.local/share/fonts (or /usr/share/fonts to install 14 | fonts system-wide) then fc-cache -f -v 15 | #4 Restart your editor/IDE. 16 | #5 Activate Commit Mono in your editor. 17 | Settings/Preferences → Editor → Font: Pick ‘CommitMono’ from the list (notice: 18 | there is no space). If you’re using VS Code, simply add these two lines to the 19 | settings.json file: 20 | "editor.fontFamily": "CommitMono", 21 | "editor.fontLigatures": true, 22 | 23 | For a comprehensive guide on how to enable features/ligatures in your specific 24 | editor/IDE, refer to Fira Code wiki: 25 | https://github.com/tonsky/FiraCode/wiki#enabling-ligatures -------------------------------------------------------------------------------- /toolchain/chidori-core/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@1kbirds/chidori-core", 3 | "version": "v0.1.27", 4 | "description": "Chidori is a library for building and running reactive AI agents.", 5 | "main": "package_node/index.js", 6 | "scripts": { 7 | "build": "RUSTFLAGS=\"-C link-arg=-Wl,-rpath,/Users/coltonpierson/.rustup/toolchains/nightly-aarch64-apple-darwin/lib\" cargo-cp-artifact -a cdylib _chidori_core ./package_node/native/chidori-core.node -- cargo build --message-format=json-render-diagnostics", 8 | "build-nix": "cargo-cp-artifact -a cdylib _chidori_core ./package_node/native/chidori-core.node -- cargo build --message-format=json-render-diagnostics", 9 | "build-debug": "npm run build --", 10 | "build-release": "npm run build -- --release", 11 | "test-rust": "cargo test", 12 | "test-js": "jest tests/nodejs" 13 | }, 14 | "os": [ 15 | "darwin", 16 | "linux", 17 | "win32" 18 | ], 19 | "cpu": [ 20 | "x64", 21 | "ia32", 22 | "arm64" 23 | ], 24 | "binary": { 25 | "module_name": "chidori-core", 26 | "module_path": "./package_node/native", 27 | "host": "https://github.com/thousandbirdsinc/chidori-core/releases/download/", 28 | "package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}-{libc}.tar.gz", 29 | "remote_path": "v{version}" 30 | }, 31 | "license": "MIT", 32 | "dependencies": { 33 | "@mapbox/node-pre-gyp": "^1.0.8" 34 | }, 35 | "devDependencies": { 36 | "cargo-cp-artifact": "^0.1.8", 37 | "jest": "^29.6.1" 38 | } 39 | } -------------------------------------------------------------------------------- /toolchain/chidori-debugger/assets/shaders/egui.wgsl: -------------------------------------------------------------------------------- 1 | struct Transform { 2 | scale: vec2, 3 | translation: vec2, 4 | } 5 | 6 | struct VertexInput { 7 | @location(0) position: vec2, 8 | @location(1) uv: vec2, 9 | @location(2) color: vec4, 10 | } 11 | 12 | struct VertexOutput { 13 | @builtin(position) position: vec4, 14 | @location(0) color: vec4, 15 | @location(1) uv: vec2, 16 | } 17 | 18 | @group(0) @binding(0) var transform: Transform; 19 | @group(1) @binding(0) var image_texture: texture_2d; 20 | @group(1) @binding(1) var image_sampler: sampler; 21 | 22 | fn linear_from_srgb(srgb: vec3) -> vec3 { 23 | let cutoff = srgb < vec3(0.04045); 24 | let lower = srgb / 12.92; 25 | let higher = pow((srgb + 0.055) / 1.055, vec3(2.4)); 26 | return select(higher, lower, cutoff); 27 | } 28 | 29 | @vertex 30 | fn vs_main(in: VertexInput) -> VertexOutput { 31 | let position = in.position * transform.scale + transform.translation; 32 | let color = vec4(linear_from_srgb(in.color.rgb), in.color.a); 33 | return VertexOutput(vec4(position, 0.0, 1.0), color, in.uv); 34 | } 35 | 36 | @fragment 37 | fn fs_main(in: VertexOutput) -> @location(0) vec4 { 38 | let texture_color = textureSample(image_texture, image_sampler, in.uv); 39 | // This assumes that texture images are not premultiplied. 40 | let color = in.color * vec4(texture_color.rgb * texture_color.a, texture_color.a); 41 | 42 | return color; 43 | } -------------------------------------------------------------------------------- /devenv.nix: -------------------------------------------------------------------------------- 1 | { pkgs, lib, ... }: 2 | 3 | { 4 | # https://devenv.sh/packages/ 5 | packages = [ 6 | pkgs.curl 7 | pkgs.git 8 | pkgs.jq 9 | pkgs.protobuf 10 | pkgs.protobuf3_21 11 | pkgs.nodejs_20 12 | pkgs.xdot 13 | pkgs.rustup 14 | pkgs.wasm-pack 15 | ] ++ lib.optionals pkgs.stdenv.isDarwin (with pkgs.darwin.apple_sdk; [ 16 | frameworks.SystemConfiguration 17 | frameworks.Security 18 | frameworks.CoreFoundation 19 | ]); 20 | 21 | # https://devenv.sh/scripts/ 22 | scripts.hello.exec = "echo Welcome to the Chidori dev enviroment"; 23 | scripts.run-ui.exec = "(cd toolchain/prompt-graph-ui && yarn run tauri dev)"; 24 | 25 | enterShell = '' 26 | REPO_ROOT=`git rev-parse --show-toplevel` 27 | hello 28 | ''; 29 | 30 | # https://devenv.sh/languages/ 31 | languages.nix.enable = true; 32 | 33 | languages.python = { 34 | version = "3.12.0"; 35 | enable = true; 36 | poetry.enable = true; 37 | venv.enable = true; 38 | }; 39 | 40 | languages.rust = { 41 | enable = true; 42 | channel = "nightly"; 43 | components = [ "rustc" "cargo" "clippy" "rustfmt" "rust-analyzer"]; 44 | }; 45 | 46 | # https://devenv.sh/pre-commit-hooks/ 47 | pre-commit.hooks.shellcheck.enable = true; 48 | 49 | services.clickhouse = { 50 | enable = true; 51 | config = '' 52 | http_port: 9000 53 | listen_host: 127.0.0.1 54 | ''; 55 | }; 56 | 57 | # See full reference at https://devenv.sh/reference/options/ 58 | } 59 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__ch_reference_internal_to_function.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "def evaluate_agent(ev):\n ch.set(\"file_path\", ev.file_path)\n migration_agent()\n" 4 | --- 5 | - - InFunction: 6 | - evaluate_agent 7 | - start: 0 8 | end: 83 9 | - - InFunction: 10 | - evaluate_agent 11 | - start: 0 12 | end: 83 13 | - FunctionArguments 14 | - IdentifierReferredTo: 15 | name: ev 16 | in_scope: false 17 | exposed: false 18 | - - InFunction: 19 | - evaluate_agent 20 | - start: 0 21 | end: 83 22 | - InCallExpression 23 | - Constant: file_path 24 | - - InFunction: 25 | - evaluate_agent 26 | - start: 0 27 | end: 83 28 | - InCallExpression 29 | - Constant: file_path 30 | - Attribute: file_path 31 | - IdentifierReferredTo: 32 | name: ev 33 | in_scope: true 34 | exposed: false 35 | - - InFunction: 36 | - evaluate_agent 37 | - start: 0 38 | end: 83 39 | - InCallExpression 40 | - Constant: file_path 41 | - Attribute: set 42 | - IdentifierReferredTo: 43 | name: ch 44 | in_scope: false 45 | exposed: false 46 | - - InFunction: 47 | - evaluate_agent 48 | - start: 0 49 | end: 83 50 | - InCallExpression 51 | - IdentifierReferredTo: 52 | name: migration_agent 53 | in_scope: false 54 | exposed: false 55 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/execution/execution/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod execution_graph; 2 | pub mod execution_state; 3 | 4 | 5 | use crate::execution::primitives::identifiers::{OperationId}; 6 | 7 | 8 | 9 | use crossbeam_utils::sync::Unparker; 10 | pub use execution_state::{DependencyGraphMutation, ExecutionState}; 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | use std::cell::RefCell; 23 | use std::collections::HashMap; 24 | use std::collections::HashSet; 25 | 26 | use std::rc::Rc; 27 | use std::sync::{Arc, Mutex}; 28 | 29 | type OperationValue = Vec; 30 | type OperationEventHandler = Box; 31 | type OperationEventHandlers = Rc>>; 32 | 33 | /// The set of async nodes for which the scheduler has received ready 34 | /// notifications. 35 | #[derive(Clone)] 36 | struct Notifications { 37 | /// Nodes that received notifications. 38 | nodes: Arc>>, 39 | 40 | /// Handle to wake up the scheduler thread when a notification arrives. 41 | unparker: Unparker, 42 | } 43 | 44 | impl Notifications { 45 | fn new(size: usize, unparker: Unparker) -> Self { 46 | Self { 47 | nodes: Arc::new(Mutex::new(HashSet::with_capacity(size))), 48 | unparker, 49 | } 50 | } 51 | 52 | /// Add a new notification. 53 | fn notify(&self, node_id: OperationId) { 54 | self.nodes.lock().unwrap().insert(node_id); 55 | self.unparker.unpark(); 56 | } 57 | } 58 | 59 | trait ExecutionStateInstance {} 60 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__nested_for_loops.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 3; i++) {\n for (let j = 0; j < 3; j++) {\n console.log(i, j);\n }\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: i 8 | in_scope: false 9 | exposed: false 10 | - - IdentifierReferredTo: 11 | name: i 12 | in_scope: true 13 | exposed: false 14 | - IdentifierReferredTo: 15 | name: i 16 | in_scope: true 17 | exposed: false 18 | - AssignmentToStatement 19 | - IdentifierReferredTo: 20 | name: j 21 | in_scope: false 22 | exposed: false 23 | - - IdentifierReferredTo: 24 | name: i 25 | in_scope: true 26 | exposed: false 27 | - IdentifierReferredTo: 28 | name: i 29 | in_scope: true 30 | exposed: false 31 | - IdentifierReferredTo: 32 | name: j 33 | in_scope: true 34 | exposed: false 35 | - IdentifierReferredTo: 36 | name: j 37 | in_scope: true 38 | exposed: false 39 | - InCallExpression 40 | - Attribute: log 41 | - IdentifierReferredTo: 42 | name: console 43 | in_scope: false 44 | exposed: false 45 | - IdentifierReferredTo: 46 | name: i 47 | in_scope: true 48 | exposed: false 49 | - IdentifierReferredTo: 50 | name: j 51 | in_scope: true 52 | exposed: false 53 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_let_declaration.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 5; i++) {\n let x = i * 2;\n console.log(x);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: i 8 | in_scope: false 9 | exposed: false 10 | - - IdentifierReferredTo: 11 | name: i 12 | in_scope: true 13 | exposed: false 14 | - IdentifierReferredTo: 15 | name: i 16 | in_scope: true 17 | exposed: false 18 | - AssignmentToStatement 19 | - IdentifierReferredTo: 20 | name: x 21 | in_scope: false 22 | exposed: false 23 | - - IdentifierReferredTo: 24 | name: i 25 | in_scope: true 26 | exposed: false 27 | - IdentifierReferredTo: 28 | name: i 29 | in_scope: true 30 | exposed: false 31 | - AssignmentFromStatement 32 | - IdentifierReferredTo: 33 | name: i 34 | in_scope: true 35 | exposed: false 36 | - - IdentifierReferredTo: 37 | name: i 38 | in_scope: true 39 | exposed: false 40 | - IdentifierReferredTo: 41 | name: i 42 | in_scope: true 43 | exposed: false 44 | - InCallExpression 45 | - Attribute: log 46 | - IdentifierReferredTo: 47 | name: console 48 | in_scope: false 49 | exposed: false 50 | - IdentifierReferredTo: 51 | name: x 52 | in_scope: true 53 | exposed: false 54 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_var_declaration.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (var i = 0; i < 5; i++) {\n var z = i * 2;\n console.log(z);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: i 8 | in_scope: false 9 | exposed: false 10 | - - IdentifierReferredTo: 11 | name: i 12 | in_scope: true 13 | exposed: false 14 | - IdentifierReferredTo: 15 | name: i 16 | in_scope: true 17 | exposed: false 18 | - AssignmentToStatement 19 | - IdentifierReferredTo: 20 | name: z 21 | in_scope: false 22 | exposed: false 23 | - - IdentifierReferredTo: 24 | name: i 25 | in_scope: true 26 | exposed: false 27 | - IdentifierReferredTo: 28 | name: i 29 | in_scope: true 30 | exposed: false 31 | - AssignmentFromStatement 32 | - IdentifierReferredTo: 33 | name: i 34 | in_scope: true 35 | exposed: false 36 | - - IdentifierReferredTo: 37 | name: i 38 | in_scope: true 39 | exposed: false 40 | - IdentifierReferredTo: 41 | name: i 42 | in_scope: true 43 | exposed: false 44 | - InCallExpression 45 | - Attribute: log 46 | - IdentifierReferredTo: 47 | name: console 48 | in_scope: false 49 | exposed: false 50 | - IdentifierReferredTo: 51 | name: z 52 | in_scope: true 53 | exposed: false 54 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__for_loop_tests__for_loop_with_const_declaration.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "for (let i = 0; i < 5; i++) {\n const y = i * 2;\n console.log(y);\n}\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: i 8 | in_scope: false 9 | exposed: false 10 | - - IdentifierReferredTo: 11 | name: i 12 | in_scope: true 13 | exposed: false 14 | - IdentifierReferredTo: 15 | name: i 16 | in_scope: true 17 | exposed: false 18 | - AssignmentToStatement 19 | - IdentifierReferredTo: 20 | name: y 21 | in_scope: false 22 | exposed: false 23 | - - IdentifierReferredTo: 24 | name: i 25 | in_scope: true 26 | exposed: false 27 | - IdentifierReferredTo: 28 | name: i 29 | in_scope: true 30 | exposed: false 31 | - AssignmentFromStatement 32 | - IdentifierReferredTo: 33 | name: i 34 | in_scope: true 35 | exposed: false 36 | - - IdentifierReferredTo: 37 | name: i 38 | in_scope: true 39 | exposed: false 40 | - IdentifierReferredTo: 41 | name: i 42 | in_scope: true 43 | exposed: false 44 | - InCallExpression 45 | - Attribute: log 46 | - IdentifierReferredTo: 47 | name: console 48 | in_scope: false 49 | exposed: false 50 | - IdentifierReferredTo: 51 | name: y 52 | in_scope: true 53 | exposed: false 54 | -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Rust - Test & Publish Package 2 | 3 | on: 4 | workflow_dispatch: 5 | push: 6 | tags: 7 | - 'v*' 8 | 9 | env: 10 | CARGO_TERM_COLOR: always 11 | 12 | jobs: 13 | publish: 14 | runs-on: ubuntu-latest 15 | # if: ${{ github.ref == 'refs/heads/main' }} 16 | steps: 17 | - name: Checkout code 18 | uses: actions/checkout@v2 19 | 20 | - name: Install Rust 21 | uses: actions-rs/toolchain@v1 22 | with: 23 | toolchain: stable 24 | override: true 25 | - name: Build and Test 26 | working-directory: toolchain 27 | run: | 28 | cargo build --package chidori-core --package chidori-im-hashmap --package chidori-prompt-format --package chidori-static-analysis 29 | cargo test --package chidori-core --package chidori-im-hashmap --package chidori-prompt-format --package chidori-static-analysis 30 | - name: Publish chidori-prompt-format 31 | working-directory: toolchain/chidori-prompt-format 32 | run: cargo publish 33 | env: 34 | CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} 35 | 36 | - name: Publish chidori-static-analysis 37 | working-directory: toolchain/chidori-static-analysis 38 | run: cargo publish 39 | env: 40 | CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} 41 | 42 | - name: Publish chidori-core 43 | working-directory: toolchain/chidori-core 44 | run: cargo publish 45 | env: 46 | CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} 47 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__report_generation.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function testing() {\n ch.onEvent(\"new_file\");\n ch.emitAs(\"file_created\");\n const x = 2 + y;\n return x\n}\n " 4 | --- 5 | - - InFunction: 6 | - testing 7 | - start: 1 8 | end: 116 9 | - FunctionArguments 10 | - - InFunction: 11 | - testing 12 | - start: 1 13 | end: 116 14 | - InCallExpression 15 | - Attribute: onEvent 16 | - IdentifierReferredTo: 17 | name: ch 18 | in_scope: false 19 | exposed: true 20 | - Constant: new_file 21 | - - InFunction: 22 | - testing 23 | - start: 1 24 | end: 116 25 | - InCallExpression 26 | - Attribute: emitAs 27 | - IdentifierReferredTo: 28 | name: ch 29 | in_scope: false 30 | exposed: true 31 | - Constant: file_created 32 | - - InFunction: 33 | - testing 34 | - start: 1 35 | end: 116 36 | - AssignmentToStatement 37 | - IdentifierReferredTo: 38 | name: x 39 | in_scope: false 40 | exposed: true 41 | - - InFunction: 42 | - testing 43 | - start: 1 44 | end: 116 45 | - AssignmentFromStatement 46 | - IdentifierReferredTo: 47 | name: y 48 | in_scope: false 49 | exposed: true 50 | - - InFunction: 51 | - testing 52 | - start: 1 53 | end: 116 54 | - IdentifierReferredTo: 55 | name: x 56 | in_scope: true 57 | exposed: true 58 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__report_generation_with_import.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "import random\n\ndef fun_name():\n w = function_that_doesnt_exist()\n v = 5\n return v\n\nx = random.randint(0, 10) " 4 | --- 5 | - - InFunction: 6 | - fun_name 7 | - start: 15 8 | end: 90 9 | - - InFunction: 10 | - fun_name 11 | - start: 15 12 | end: 90 13 | - AssignmentToStatement 14 | - IdentifierReferredTo: 15 | name: w 16 | in_scope: false 17 | exposed: false 18 | - - InFunction: 19 | - fun_name 20 | - start: 15 21 | end: 90 22 | - AssignmentFromStatement 23 | - InCallExpression 24 | - IdentifierReferredTo: 25 | name: function_that_doesnt_exist 26 | in_scope: false 27 | exposed: false 28 | - - InFunction: 29 | - fun_name 30 | - start: 15 31 | end: 90 32 | - AssignmentToStatement 33 | - IdentifierReferredTo: 34 | name: v 35 | in_scope: false 36 | exposed: false 37 | - - InFunction: 38 | - fun_name 39 | - start: 15 40 | end: 90 41 | - IdentifierReferredTo: 42 | name: v 43 | in_scope: true 44 | exposed: false 45 | - - AssignmentToStatement 46 | - IdentifierReferredTo: 47 | name: x 48 | in_scope: false 49 | exposed: false 50 | - - AssignmentFromStatement 51 | - InCallExpression 52 | - Attribute: randint 53 | - IdentifierReferredTo: 54 | name: random 55 | in_scope: true 56 | exposed: false 57 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/bevy_prototype_lyon/vertex.rs: -------------------------------------------------------------------------------- 1 | use bevy::prelude::Color; 2 | use lyon_tessellation::{ 3 | self as tess, FillVertex, FillVertexConstructor, StrokeVertex, StrokeVertexConstructor, 4 | }; 5 | 6 | /// The index type of a Bevy [`Mesh`](bevy::render::mesh::Mesh). 7 | type IndexType = u32; 8 | /// Lyon's [`VertexBuffers`] generic data type defined for [`Vertex`]. 9 | pub type VertexBuffers = tess::VertexBuffers; 10 | 11 | /// A vertex with all the necessary attributes to be inserted into a Bevy 12 | /// [`Mesh`](bevy::render::mesh::Mesh). 13 | #[derive(Debug, Clone, Copy, PartialEq)] 14 | pub struct Vertex { 15 | pub position: [f32; 3], 16 | pub color: [f32; 4], 17 | } 18 | 19 | /// Zero-sized type used to implement various vertex construction traits from 20 | /// Lyon. 21 | pub struct VertexConstructor { 22 | pub color: Color, 23 | } 24 | 25 | /// Enables the construction of a [`Vertex`] when using a `FillTessellator`. 26 | impl FillVertexConstructor for VertexConstructor { 27 | fn new_vertex(&mut self, vertex: FillVertex) -> Vertex { 28 | Vertex { 29 | position: [vertex.position().x, vertex.position().y, 0.0], 30 | color: self.color.rgba_to_vec4().to_array(), 31 | } 32 | } 33 | } 34 | 35 | /// Enables the construction of a [`Vertex`] when using a `StrokeTessellator`. 36 | impl StrokeVertexConstructor for VertexConstructor { 37 | fn new_vertex(&mut self, vertex: StrokeVertex) -> Vertex { 38 | Vertex { 39 | position: [vertex.position().x, vertex.position().y, -0.001], 40 | color: self.color.rgba_to_vec4().to_array(), 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/core11_hono/core.md: -------------------------------------------------------------------------------- 1 | # Demonstrating running a hono web service to produce a user facing interface 2 | 3 | 4 | ```python 5 | def testingFunC(x): 6 | return x + "Hello" 7 | ``` 8 | 9 | ```javascript 10 | import { Hono } from 'https://deno.land/x/hono/mod.ts'; 11 | import { serve } from 'https://deno.land/std@0.145.0/http/server.ts'; 12 | 13 | const app = new Hono(); 14 | 15 | app.get('/', (c) => { 16 | const form = ` 17 |

Welcome to Trip Planner Crew

18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 | `; 30 | return c.html(form); 31 | }); 32 | 33 | app.post('/submit', async (c) => { 34 | const body = await c.req.parseBody(); 35 | const { origin, cities, date_range, interests } = body; 36 | const xx = await testingFunC(origin); 37 | const response = ` 38 |

Trip Details

39 |

Origin: ${xx}

40 |

Cities: ${cities}

41 |

Date Range: ${date_range}

42 |

Interests: ${interests}

43 | `; 44 | return c.html(response); 45 | }); 46 | 47 | serve(app.fetch); 48 | ``` -------------------------------------------------------------------------------- /toolchain/chidori-debugger/examples/demo8_hacker_news_scraper/demo.md: -------------------------------------------------------------------------------- 1 | # This agent demonstrate using axios to fetch hacker news articles, filter and rank them 2 | 3 | 4 | ```javascript (load_hacker_news) 5 | const axios = require('https://deno.land/x/axiod/mod.ts'); 6 | 7 | const HN_URL_TOP_STORIES = "https://hacker-news.firebaseio.com/v0/topstories.json"; 8 | 9 | function fetchStory(id) { 10 | return axios.get(`https://hacker-news.firebaseio.com/v0/item/${id}.json?print=pretty`) 11 | .then(response => response.data); 12 | } 13 | 14 | async function fetchHN() { 15 | const stories = await axios.get(HN_URL_TOP_STORIES); 16 | const storyIds = stories.data; 17 | // only the first 30 18 | const tasks = storyIds.slice(0, 30).map(id => fetchStory(id)); 19 | return Promise.all(tasks) 20 | .then(stories => { 21 | return stories.map(story => { 22 | const { title, url, score } = story; 23 | return {title, url, score}; 24 | }); 25 | }); 26 | } 27 | ``` 28 | 29 | Prompt "interpret_the_group" 30 | ```prompt (interpret_the_group) 31 | Based on the following list of HackerNews threads, 32 | filter this list to only launches of 33 | new AI projects: {{fetched_articles}} 34 | ``` 35 | 36 | Prompt "format_and_rank" 37 | ```prompt (format_and_rank) 38 | Format this list of new AI projects in markdown, ranking the most 39 | interesting projects from most interesting to least. 40 | {{interpret_the_group}} 41 | ``` 42 | 43 | Using a python cell as our entrypoint, demonstrating inter-language execution: 44 | ```python 45 | articles = await fetchHN() 46 | format_and_rank(articles=articles) 47 | ``` 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/bevy_prototype_lyon/draw.rs: -------------------------------------------------------------------------------- 1 | //! Types for defining shape color and options. 2 | 3 | use bevy::{ecs::component::Component}; 4 | use bevy::prelude::Color; 5 | use lyon_tessellation::{FillOptions, StrokeOptions}; 6 | 7 | /// Defines the fill options for the lyon tessellator and color of the generated 8 | /// vertices. 9 | #[allow(missing_docs)] 10 | #[derive(Component, Debug, Clone, Copy, PartialEq)] 11 | pub struct Fill { 12 | pub options: FillOptions, 13 | pub color: Color, 14 | } 15 | 16 | impl Fill { 17 | /// Convenience constructor requiring only the `Color`. 18 | #[must_use] 19 | pub fn color(color: impl Into) -> Self { 20 | Self { 21 | options: FillOptions::default(), 22 | color: color.into(), 23 | } 24 | } 25 | } 26 | 27 | /// Defines the stroke options for the lyon tessellator and color of the 28 | /// generated vertices. 29 | #[allow(missing_docs)] 30 | #[derive(Component, Debug, Clone, Copy, PartialEq)] 31 | pub struct Stroke { 32 | pub options: StrokeOptions, 33 | pub color: Color, 34 | } 35 | 36 | impl Stroke { 37 | /// Constructor that requires a `Color` and a line width. 38 | #[must_use] 39 | pub fn new(color: impl Into, line_width: f32) -> Self { 40 | Self { 41 | options: StrokeOptions::default().with_line_width(line_width), 42 | color: color.into(), 43 | } 44 | } 45 | 46 | /// Convenience constructor requiring only the `Color`. 47 | #[must_use] 48 | pub fn color(color: impl Into) -> Self { 49 | Self { 50 | options: StrokeOptions::default(), 51 | color: color.into(), 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /toolchain/chidori-core/src/library/std/ai/memory/mod.rs: -------------------------------------------------------------------------------- 1 | use anyhow; 2 | use async_trait::async_trait; 3 | 4 | 5 | pub mod in_memory; 6 | pub mod qdrant; 7 | 8 | // Define a custom error type for our vector database interactions 9 | 10 | #[derive(Debug)] 11 | pub enum VectorDbError { 12 | ConnectionError(String), 13 | QueryError(String), 14 | InsertionError(String), 15 | CollectionCreationError(String), 16 | // other error types... 17 | } 18 | 19 | struct CoreValueEmbedding {} 20 | 21 | trait TraitValueEmbedding { 22 | fn embed(&self) -> anyhow::Result>; 23 | } 24 | 25 | struct CoreVectorDatabase { 26 | name: String, 27 | table: String, 28 | schema: String, 29 | } 30 | 31 | // The trait for vector database interaction 32 | #[async_trait] 33 | pub trait VectorDatabase { 34 | // Connects to the vector database 35 | fn attach_client(client: C) -> Result 36 | where 37 | Self: Sized; 38 | 39 | async fn create_collection( 40 | &mut self, 41 | collection_name: String, 42 | embedding_length: u64, 43 | ) -> Result<(), VectorDbError>; 44 | 45 | // Inserts a vector into the database 46 | async fn insert_vector( 47 | &mut self, 48 | collection_name: String, 49 | id: u64, 50 | vector: Vec, 51 | payload: Option, 52 | ) -> Result<(), VectorDbError>; 53 | 54 | // Queries the database by vector 55 | async fn query_by_vector( 56 | &mut self, 57 | collection_name: String, 58 | vector: Vec, 59 | top_k: usize, 60 | ) -> Result, VectorDbError>; 61 | 62 | // Additional methods like update, delete, etc. can be added here 63 | } 64 | -------------------------------------------------------------------------------- /toolchain/chidori-core/README.md: -------------------------------------------------------------------------------- 1 | # Chidori Core 2 | 3 | This implements an interface for constructing prompt graphs. 4 | This can be used to annotate existing implementations with graph definitions as well. 5 | 6 | ## Features 7 | 8 | - [ ] A graph definition language for reactive programs, wrapping other execution runtimes 9 | - [ ] A pattern for annotating existing code to expose it to the graph definition language 10 | - [ ] A scheduler for executing reactive programs 11 | - [ ] Support for branching and merging reactive programs 12 | - [ ] A wrapper around handlebars for rendering templates that supports tracing 13 | - [ ] A standard library of core agent functionality 14 | - [ ] Support for long running durable execution of agents 15 | 16 | ## Why 17 | 18 | ### Q: Why extract the execution of code or LLMs from the source itself? 19 | In order to go beyond tracing alone, we want to have control over where and when prompts are executed. 20 | 21 | ### Q: Why choose to break apart the source code provided into a graph? 22 | Breaking apart the source code into it's own graph allows us to take more ownership over how units of code are executed. 23 | We want to be able to pause execution of a graph, and resume it later. 24 | 25 | ### Q: Why operate over source code rather than provide an SDK? 26 | Constructing the execution graph is something that can be done at runtime, and we want to be able to do this without requiring a build step. 27 | We also want to be able to annotate existing code with graph definitions, and this is easier to do if we can operate over the source code directly. 28 | 29 | 30 | ## Functionality 31 | 32 | ### Reactive graphs 33 | 34 | 35 | 36 | # Testing 37 | * Our LLM calls default to localhost:4000, our expectation is that users will leverage a tool such as LiteLLM's Proxy to manage their interaction with LLMs. -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/bevy_prototype_lyon/entity.rs: -------------------------------------------------------------------------------- 1 | //! Custom Bevy ECS bundle for 3D shapes. 2 | 3 | use bevy::utils::Uuid; 4 | use bevy::prelude::*; 5 | use bevy::render::mesh::Mesh; 6 | use lyon_tessellation::{self as tess}; 7 | 8 | use crate::bevy_prototype_lyon::{geometry::Geometry}; 9 | use crate::bevy_prototype_lyon::plugin::STANDARD_MATERIAL_HANDLE; 10 | 11 | /// A Bevy `Bundle` to represent a 3D shape. 12 | #[allow(missing_docs)] 13 | #[derive(Bundle, Clone)] 14 | pub struct ShapeBundle { 15 | pub path: Path, 16 | pub mesh: Handle, 17 | pub material: Handle, 18 | pub transform: Transform, 19 | pub global_transform: GlobalTransform, 20 | /// User indication of whether an entity is visible 21 | pub visibility: Visibility, 22 | /// Inherited visibility of an entity. 23 | pub inherited_visibility: InheritedVisibility, 24 | /// Algorithmically-computed indication of whether an entity is visible and should be extracted for rendering 25 | pub view_visibility: ViewVisibility, 26 | } 27 | 28 | impl Default for ShapeBundle { 29 | fn default() -> Self { 30 | Self { 31 | path: default(), 32 | mesh: Handle::::weak_from_u128(Uuid::new_v4().as_u128()), 33 | material: STANDARD_MATERIAL_HANDLE, 34 | transform: default(), 35 | global_transform: default(), 36 | visibility: default(), 37 | inherited_visibility: default(), 38 | view_visibility: default(), 39 | } 40 | } 41 | } 42 | 43 | #[allow(missing_docs)] 44 | #[derive(Component, Default, Clone)] 45 | pub struct Path(pub tess::path::Path); 46 | 47 | impl Geometry for Path { 48 | fn add_geometry(&self, b: &mut tess::path::path::Builder) { 49 | b.extend_from_paths(&[self.0.as_slice()]); 50 | } 51 | } -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "chidori-static-analysis" 3 | version = "0.1.3" 4 | authors.workspace = true 5 | edition.workspace = true 6 | license.workspace = true 7 | homepage.workspace = true 8 | repository.workspace = true 9 | description = "Chidori Static Analysis is part of the Chidori framework, this identifies the exposure of values in JavaScript, TypeScript and Python code in order to support wiring dependent code together" 10 | 11 | [lib] 12 | crate-type = ["cdylib", "rlib"] 13 | 14 | [features] 15 | default = ["console_error_panic_hook"] 16 | 17 | [dependencies] 18 | serde_yaml = "0.9.25" 19 | wasm-bindgen = { version = "0.2.89", features = [] } 20 | serde-wasm-bindgen = "0.4" 21 | indoc.workspace = true 22 | anyhow.workspace = true 23 | serde.workspace = true 24 | insta.workspace = true 25 | thiserror.workspace = true 26 | petgraph.workspace = true 27 | 28 | # Support for parsing typescript/javascript 29 | swc_common = { version = "0.40.1", features = ["tty-emitter"]} 30 | swc_ecma_parser = { version = "0.152.1", features = ["typescript"]} 31 | swc_ecma_ast = { version = "0.121.1", features = []} 32 | 33 | # Support for parsing python 34 | rustpython-parser = "0.3.0" 35 | 36 | # The `console_error_panic_hook` crate provides better debugging of panics by 37 | # logging them with `console.error`. This is great for development, but requires 38 | # all the `std::fmt` and `std::panicking` infrastructure, so isn't great for 39 | # code size when deploying. 40 | console_error_panic_hook = { version = "0.1.7", optional = true } 41 | lazy_static = "1.4.0" 42 | 43 | [dev-dependencies] 44 | wasm-bindgen-test = "0.3.34" 45 | 46 | #[dependencies.ruff_python_ast] 47 | #git = "https://github.com/astral-sh/ruff" 48 | #rev = "907322088720aec94ee57979baca7157778c5f76" 49 | # 50 | #[dependencies.ruff_python_codegen] 51 | #git = "https://github.com/astral-sh/ruff" 52 | #rev = "907322088720aec94ee57979baca7157778c5f76" 53 | -------------------------------------------------------------------------------- /toolchain/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "chidori-core", 4 | "chidori-prompt-format", 5 | "chidori-static-analysis", 6 | "chidori-debugger", 7 | ] 8 | resolver = "2" 9 | 10 | [workspace.package] 11 | version = "0.2.14" 12 | authors = ["Colton Pierson "] 13 | edition = "2021" 14 | license = "MIT" 15 | homepage = "https://docs.thousandbirds.ai" 16 | repository = "https://github.com/ThousandBirdsInc/chidori" 17 | 18 | #[profile.release] 19 | #lto = false 20 | # Tell `rustc` to optimize for small code size. 21 | #opt-level = "s" 22 | 23 | [workspace.dependencies] 24 | rkyv = {version = "0.7.42", features = ["validation"]} 25 | protobuf = "3.2.0" 26 | anyhow = { version = "1.0", default-features = false } 27 | indoc = "1.0.3" 28 | serde = { version = "1.0", features = ["derive"] } 29 | serde_derive = "1" 30 | serde_json = "=1.0.128" 31 | tonic = "0.9" 32 | prost = "0.11" 33 | tokio = { version = "1", features = ["full", "tracing"] } 34 | env_logger = "0.10.0" 35 | log = "0.4.16" 36 | futures = "0.3.15" 37 | bytes = "1.0.1" 38 | reqwest = { version = "0.12.8", features = ["json", "stream"]} 39 | futures-core = "0.3" 40 | tokio-stream = "0.1" 41 | ulid = "1.0.0" 42 | dashmap = "5.4.0" 43 | tracing = "0.1" 44 | tracing-subscriber = { version = "0.3.17", features = ["env-filter"] } 45 | tracing-log = "0.1.3" 46 | tracing-chrome = "0.7.1" 47 | tracing-flame = "0.2.0" 48 | bincode = "2.0.0-rc.3" 49 | petgraph = "0.6.3" 50 | insta = { version = "1.38.0", features = ["yaml", "redactions"] } 51 | thiserror = "1.0.58" 52 | rusqlite = { version = "0.32.1", features = ["bundled"] } 53 | 54 | [workspace.dependencies.uuid] 55 | version = "=1.8.0" 56 | features = [ 57 | "v4", # Lets you generate random UUIDs 58 | "v7", # Lets you generate timestamp UUIDs 59 | "fast-rng", # Use a faster (but still sufficiently random) RNG 60 | "macro-diagnostics", # Enable better diagnostics for compile-time UUIDs 61 | ] 62 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__report_generation_with_import.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "import { random } from \"random\"\n\nfunction fun_name() {\n const w = function_that_doesnt_exist()\n const v = 5\n return v\n}\n\nx = random.randint(0, 10)" 4 | --- 5 | - - InFunction: 6 | - fun_name 7 | - start: 34 8 | end: 129 9 | - FunctionArguments 10 | - - InFunction: 11 | - fun_name 12 | - start: 34 13 | end: 129 14 | - AssignmentToStatement 15 | - IdentifierReferredTo: 16 | name: w 17 | in_scope: false 18 | exposed: true 19 | - - InFunction: 20 | - fun_name 21 | - start: 34 22 | end: 129 23 | - AssignmentFromStatement 24 | - InCallExpression 25 | - IdentifierReferredTo: 26 | name: function_that_doesnt_exist 27 | in_scope: false 28 | exposed: true 29 | - - InFunction: 30 | - fun_name 31 | - start: 34 32 | end: 129 33 | - AssignmentFromStatement 34 | - - InFunction: 35 | - fun_name 36 | - start: 34 37 | end: 129 38 | - AssignmentToStatement 39 | - IdentifierReferredTo: 40 | name: v 41 | in_scope: false 42 | exposed: true 43 | - - InFunction: 44 | - fun_name 45 | - start: 34 46 | end: 129 47 | - AssignmentFromStatement 48 | - - InFunction: 49 | - fun_name 50 | - start: 34 51 | end: 129 52 | - IdentifierReferredTo: 53 | name: v 54 | in_scope: true 55 | exposed: true 56 | - - AssignmentToStatement 57 | - IdentifierReferredTo: 58 | name: x 59 | in_scope: false 60 | exposed: true 61 | - - AssignmentFromStatement 62 | - InCallExpression 63 | - Attribute: randint 64 | - IdentifierReferredTo: 65 | name: random 66 | in_scope: true 67 | exposed: true 68 | - - AssignmentFromStatement 69 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/bevy_prototype_lyon/mod.rs: -------------------------------------------------------------------------------- 1 | //! Draw 2D shapes in Bevy. 2 | //! 3 | //! This crate provides a Bevy [plugin] to easily draw shapes. 4 | //! Some shapes are provided for convenience, however you can extend the 5 | //! functionality of this crate by implementing the 6 | //! [`Geometry`](geometry::Geometry) trait by your own. 7 | //! 8 | //! ## Usage 9 | //! Check out the `README.md` on the [**GitHub repository**](https://github.com/Nilirad/bevy_prototype_lyon) 10 | //! or run the [examples](https://github.com/Nilirad/bevy_prototype_lyon/tree/master/examples). 11 | 12 | // rustc 13 | #![deny(future_incompatible, nonstandard_style)] 14 | #![warn(missing_docs, rust_2018_idioms, unused)] 15 | #![allow(elided_lifetimes_in_paths)] 16 | // clippy 17 | #![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)] 18 | #![allow(clippy::cast_precision_loss)] 19 | #![allow(clippy::cast_possible_truncation)] 20 | #![allow(clippy::multiple_crate_versions)] // this is a dependency problem 21 | #![allow(clippy::module_name_repetitions)] 22 | #![allow(clippy::needless_pass_by_value)] // False positives with `SystemParam`s. 23 | #![allow(clippy::forget_non_drop)] 24 | #![allow(clippy::missing_const_for_fn)] 25 | 26 | pub mod draw; 27 | pub mod entity; 28 | pub mod geometry; 29 | pub mod path; 30 | pub mod plugin; 31 | pub mod shapes; 32 | 33 | mod utils; 34 | mod vertex; 35 | 36 | /// Import this module as `use bevy_prototype_lyon::prelude::*` to get 37 | /// convenient imports. 38 | pub mod prelude { 39 | pub use lyon_tessellation::{ 40 | self as tess, FillOptions, FillRule, LineCap, LineJoin, Orientation, StrokeOptions, 41 | }; 42 | 43 | pub use crate::bevy_prototype_lyon::{ 44 | draw::{Fill, Stroke}, 45 | entity::{Path, ShapeBundle}, 46 | geometry::{Geometry, GeometryBuilder}, 47 | path::{PathBuilder, ShapePath}, 48 | plugin::ShapePlugin, 49 | shapes::{self, RectangleOrigin, RegularPolygon, RegularPolygonFeature}, 50 | }; 51 | } 52 | -------------------------------------------------------------------------------- /toolchain/chidori-debugger/src/egui_json_tree/mod.rs: -------------------------------------------------------------------------------- 1 | //! An interactive JSON tree visualiser for `egui`, with search and highlight functionality. 2 | //! 3 | //! ``` 4 | //! use egui::{Color32}; 5 | //! use egui_json_tree::{DefaultExpand, JsonTree, JsonTreeStyle}; 6 | //! 7 | //! # egui::__run_test_ui(|ui| { 8 | //! let value = serde_json::json!({ "foo": "bar", "fizz": [1, 2, 3]}); 9 | //! 10 | //! // Simple: 11 | //! JsonTree::new("simple-tree", &value).show(ui); 12 | //! 13 | //! // Customised: 14 | //! let response = JsonTree::new("customised-tree", &value) 15 | //! .style(JsonTreeStyle { 16 | //! bool_color: Color32::YELLOW, 17 | //! ..Default::default() 18 | //! }) 19 | //! .default_expand(DefaultExpand::All) 20 | //! .response_callback(|response, json_pointer_string| { 21 | //! // Handle interactions within the JsonTree. 22 | //! }) 23 | //! .abbreviate_root(true) // Show {...} when the root object is collapsed. 24 | //! .show(ui); 25 | //! 26 | //! // Reset the expanded state of all arrays/objects to respect the `default_expand` setting. 27 | //! response.reset_expanded(ui); 28 | //! # }); 29 | //! ``` 30 | //! [`JsonTree`] can visualise any type that implements [`ToJsonTreeValue`](trait@value::ToJsonTreeValue). 31 | //! Implementations to support [`serde_json::Value`](serde_json::Value) (enabled by default by the crate feature `serde_json`) 32 | //! and `simd_json::owned::Value` (optionally enabled by the crate feature `simd_json`) 33 | //! are provided with this crate. 34 | //! If you wish to use a different JSON type, see the [`value`](mod@value) module, 35 | //! and disable default features in your `Cargo.toml` if you do not need the [`serde_json`](serde_json) dependency. 36 | mod default_expand; 37 | mod delimiters; 38 | mod node; 39 | mod response; 40 | mod search; 41 | mod style; 42 | mod tree; 43 | 44 | pub use response::JsonTreeResponse; 45 | pub use style::JsonTreeStyle; 46 | pub mod value; 47 | pub use default_expand::DefaultExpand; 48 | pub use tree::JsonTree; 49 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__report_generation_with_object_destructuring.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "const { a, b } = someObject;\nconst { c: renamed } = anotherObject;\n\nfunction processValues({ x, y }) {\n return x + y;\n}\n\nconst result = processValues({ x: a, y: b });\n" 4 | --- 5 | - - AssignmentToStatement 6 | - IdentifierReferredTo: 7 | name: a 8 | in_scope: false 9 | exposed: true 10 | - IdentifierReferredTo: 11 | name: b 12 | in_scope: false 13 | exposed: true 14 | - - AssignmentFromStatement 15 | - IdentifierReferredTo: 16 | name: someObject 17 | in_scope: false 18 | exposed: true 19 | - - AssignmentToStatement 20 | - IdentifierReferredTo: 21 | name: renamed 22 | in_scope: false 23 | exposed: true 24 | - - AssignmentFromStatement 25 | - IdentifierReferredTo: 26 | name: anotherObject 27 | in_scope: false 28 | exposed: true 29 | - - InFunction: 30 | - processValues 31 | - start: 69 32 | end: 123 33 | - FunctionArguments 34 | - IdentifierReferredTo: 35 | name: x 36 | in_scope: false 37 | exposed: true 38 | - IdentifierReferredTo: 39 | name: y 40 | in_scope: false 41 | exposed: true 42 | - - InFunction: 43 | - processValues 44 | - start: 69 45 | end: 123 46 | - IdentifierReferredTo: 47 | name: x 48 | in_scope: true 49 | exposed: true 50 | - IdentifierReferredTo: 51 | name: y 52 | in_scope: true 53 | exposed: true 54 | - - AssignmentToStatement 55 | - IdentifierReferredTo: 56 | name: result 57 | in_scope: false 58 | exposed: true 59 | - - AssignmentFromStatement 60 | - InCallExpression 61 | - IdentifierReferredTo: 62 | name: processValues 63 | in_scope: true 64 | exposed: true 65 | - - AssignmentFromStatement 66 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__function_decorator_ch_annotation_with_internal_ch_and_emit.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function dispatch_agent(ev) {\n ch.onEvent(\"new_file\")\n ch.emitAs(\"file_created\")\n ch.emitAs(\"file_created\", \"multiple\", \"args\")\n ch.set(\"file_path\", ev.file_path)\n}\n" 4 | --- 5 | - - InFunction: 6 | - dispatch_agent 7 | - start: 1 8 | end: 177 9 | - FunctionArguments 10 | - IdentifierReferredTo: 11 | name: ev 12 | in_scope: false 13 | exposed: true 14 | - - InFunction: 15 | - dispatch_agent 16 | - start: 1 17 | end: 177 18 | - InCallExpression 19 | - Attribute: onEvent 20 | - IdentifierReferredTo: 21 | name: ch 22 | in_scope: false 23 | exposed: true 24 | - Constant: new_file 25 | - - InFunction: 26 | - dispatch_agent 27 | - start: 1 28 | end: 177 29 | - InCallExpression 30 | - Attribute: emitAs 31 | - IdentifierReferredTo: 32 | name: ch 33 | in_scope: false 34 | exposed: true 35 | - Constant: file_created 36 | - - InFunction: 37 | - dispatch_agent 38 | - start: 1 39 | end: 177 40 | - InCallExpression 41 | - Attribute: emitAs 42 | - IdentifierReferredTo: 43 | name: ch 44 | in_scope: false 45 | exposed: true 46 | - Constant: file_created 47 | - Constant: multiple 48 | - Constant: args 49 | - - InFunction: 50 | - dispatch_agent 51 | - start: 1 52 | end: 177 53 | - InCallExpression 54 | - Attribute: set 55 | - IdentifierReferredTo: 56 | name: ch 57 | in_scope: false 58 | exposed: true 59 | - Constant: file_path 60 | - Attribute: file_path 61 | - IdentifierReferredTo: 62 | name: ev 63 | in_scope: true 64 | exposed: true 65 | - - InFunction: 66 | - dispatch_agent 67 | - start: 1 68 | end: 177 69 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/javascript/snapshots/chidori_static_analysis__language__javascript__parse__tests__handling_react_hook_style_refrence.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/javascript/parse.rs 3 | description: "function createDockerfile() {\n useHook(() => {\n ch.prompt(\"demo\");\n }, [otherFunction]);\n return prompt(\"prompts/create_dockerfile\")\n}\n" 4 | --- 5 | - - InFunction: 6 | - createDockerfile 7 | - start: 1 8 | end: 150 9 | - FunctionArguments 10 | - - InFunction: 11 | - createDockerfile 12 | - start: 1 13 | end: 150 14 | - InCallExpression 15 | - IdentifierReferredTo: 16 | name: useHook 17 | in_scope: false 18 | exposed: true 19 | - InAnonFunction 20 | - FunctionArguments 21 | - - InFunction: 22 | - createDockerfile 23 | - start: 1 24 | end: 150 25 | - InCallExpression 26 | - IdentifierReferredTo: 27 | name: useHook 28 | in_scope: false 29 | exposed: true 30 | - InAnonFunction 31 | - InCallExpression 32 | - Attribute: prompt 33 | - IdentifierReferredTo: 34 | name: ch 35 | in_scope: false 36 | exposed: false 37 | - Constant: demo 38 | - - InFunction: 39 | - createDockerfile 40 | - start: 1 41 | end: 150 42 | - InCallExpression 43 | - IdentifierReferredTo: 44 | name: useHook 45 | in_scope: false 46 | exposed: true 47 | - InAnonFunction 48 | - - InFunction: 49 | - createDockerfile 50 | - start: 1 51 | end: 150 52 | - InCallExpression 53 | - IdentifierReferredTo: 54 | name: useHook 55 | in_scope: false 56 | exposed: true 57 | - - InFunction: 58 | - createDockerfile 59 | - start: 1 60 | end: 150 61 | - InCallExpression 62 | - IdentifierReferredTo: 63 | name: prompt 64 | in_scope: false 65 | exposed: true 66 | - Constant: prompts/create_dockerfile 67 | - - InFunction: 68 | - createDockerfile 69 | - start: 1 70 | end: 150 71 | -------------------------------------------------------------------------------- /toolchain/chidori-static-analysis/src/language/python/snapshots/chidori_static_analysis__language__python__parse__tests__classes_are_identified.snap: -------------------------------------------------------------------------------- 1 | --- 2 | source: chidori-static-analysis/src/language/python/parse.rs 3 | description: "import unittest\n\nclass TestMarshalledValues(unittest.TestCase):\n def test_addTwo(self):\n self.assertEqual(addTwo(2), 4)\n\nunittest.TextTestRunner().run(unittest.TestLoader().loadTestsFromTestCase(TestMarshalledValues))\n\n" 4 | --- 5 | - - InClass: TestMarshalledValues 6 | - - InClass: TestMarshalledValues 7 | - InFunction: 8 | - test_addTwo 9 | - start: 68 10 | end: 129 11 | - - InClass: TestMarshalledValues 12 | - InFunction: 13 | - test_addTwo 14 | - start: 68 15 | end: 129 16 | - FunctionArguments 17 | - IdentifierReferredTo: 18 | name: self 19 | in_scope: false 20 | exposed: false 21 | - - InClass: TestMarshalledValues 22 | - InFunction: 23 | - test_addTwo 24 | - start: 68 25 | end: 129 26 | - InCallExpression 27 | - InCallExpression 28 | - IdentifierReferredTo: 29 | name: addTwo 30 | in_scope: false 31 | exposed: false 32 | - - InClass: TestMarshalledValues 33 | - InFunction: 34 | - test_addTwo 35 | - start: 68 36 | end: 129 37 | - InCallExpression 38 | - Attribute: assertEqual 39 | - IdentifierReferredTo: 40 | name: self 41 | in_scope: true 42 | exposed: false 43 | - - InCallExpression 44 | - InCallExpression 45 | - IdentifierReferredTo: 46 | name: TestMarshalledValues 47 | in_scope: true 48 | exposed: false 49 | - - InCallExpression 50 | - InCallExpression 51 | - Attribute: loadTestsFromTestCase 52 | - InCallExpression 53 | - Attribute: TestLoader 54 | - IdentifierReferredTo: 55 | name: unittest 56 | in_scope: true 57 | exposed: false 58 | - - InCallExpression 59 | - Attribute: run 60 | - InCallExpression 61 | - Attribute: TextTestRunner 62 | - IdentifierReferredTo: 63 | name: unittest 64 | in_scope: true 65 | exposed: false 66 | --------------------------------------------------------------------------------