open_comses_model
Download or load a COMSES model from cache, resolve version, and open it in NetLogo workspace if compatible, or return structured metadata for other models.
Instructions
Download (or reuse cache), then open a COMSES model ready to use.
This is the single entry point most AI flows should call.
Behavior:
Resolves
"latest"to a concrete version BEFORE any cache path is computed. The returnedresolved_versionis what every follow-upread_comses_filescall MUST pass — never re-pass"latest"in the same flow, or you risk inspecting a different cache slot than the model you just loaded.If the cache for
(identifier, resolved_version)is already complete (has.comses_complete), skips download.Otherwise, downloads + extracts safely (same logic as
download_comses_model).If the model is NetLogo, picks one
.nlogo/.nlogoxper Section 4.4 rules (exactly one → use it; else prefercode/; else prefer.nlogox; else lex-largest relative path — a deterministic tie-breaker, NOT semver-aware).If NetLogo, loads it into the workspace.
If not NetLogo, returns structured info for manual follow-up.
Returns JSON with:
status: "loaded_netlogo", "not_runnable_in_netlogo", or "no_netlogo_file".resolved_version: concrete version string (never "latest").identifier,title,language,license,cached.extracted_path: absolute path to cached model directory.all_netlogo_files: list of every NetLogo file found.loaded_netlogo_file: the one selected (if any).code_files: source files by extension.odd_doc: ODD / README path, if any.message: short text for the AI to show the user.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| max_mb | No | Max download size in MB. Pass 0 or omit to use the env default. | |
| version | No | Version string or "latest". | latest |
| identifier | Yes | Full model UUID. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |