Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/aaronjmars/MiroShark
/ functions
Functions
3,647 in github.com/aaronjmars/MiroShark
⨍
Functions
3,647
◇
Types & classes
172
↳
Endpoints
175
↓ 11 callers
Function
_payload
(client)
backend/tests/test_unit_notifications_config.py:47
↓ 11 callers
Function
_write_trajectory
(sim_dir: Path, snapshots: list[dict])
backend/tests/test_unit_agent_sparklines.py:40
↓ 11 callers
Function
apply_i18n
Recursively merge embedded ``i18n[locale]`` blocks into a JSON payload. Looks for an ``i18n`` mapping on each dict node — when present and the
backend/app/utils/i18n.py:170
↓ 11 callers
Function
compute_platform_stats
Return platform-level aggregate statistics for every public, completed simulation under ``sim_root``. Result shape:: { "sc
backend/app/services/platform_stats.py:214
↓ 11 callers
Function
compute_signature
Return ``sha256=<hex>`` for ``payload_bytes`` under ``secret``. ``secret`` defaults to the ``WEBHOOK_SECRET`` env var. A blank / missing secr
backend/app/services/webhook_service.py:646
↓ 11 callers
Function
fail
(msg)
backend/scripts/test_e2e_api.py:86
↓ 11 callers
Method
get_project
Get project Args: project_id: Project ID Returns: Project object, or None if not found
backend/app/models/project.py:195
↓ 11 callers
Function
repair_json
Parse malformed/truncated LLM JSON, recovering as much as possible. Two tiers, each best-effort: 1. Re-close anything a ``max_tokens`` cut-o
backend/app/utils/json_repair.py:89
↓ 11 callers
Method
search
Hybrid search — returns results matching the scope. Args: as_of: ISO-8601 timestamp. If set, returns only edges that wer
backend/app/storage/neo4j_storage.py:594
↓ 11 callers
Function
t
Pick a translation for ``locale``, falling back to the English source. ``en`` is the canonical source string. ``zh`` (kept positional for the
backend/app/utils/i18n.py:123
↓ 10 callers
Method
_get_simulation_dir
Get simulation data directory
backend/app/services/simulation_manager.py:182
↓ 10 callers
Function
_md_yaml_value
Quote-safe, single-line YAML scalar for the front-matter block. Wraps strings in double quotes (escaping internal double quotes + backslashes
backend/app/services/transcript.py:312
↓ 10 callers
Function
_render
(summary, simulation_id="sim_test")
backend/tests/test_unit_watch.py:102
↓ 10 callers
Method
_save_run_state
Save run state to file
backend/app/services/simulation_runner.py:189
↓ 10 callers
Method
chat
Chat with Report Agent In conversation, Agent can autonomously call retrieval tools to answer questions Args: m
backend/app/services/report_agent.py:2871
↓ 10 callers
Function
create_app
Flask application factory function
backend/app/__init__.py:37
↓ 10 callers
Method
get_agents
( self, agent_ids: list[int] = None)
backend/wonderwall/social_agent/agent_graph.py:229
↓ 10 callers
Function
render_atom
Render the public-gallery cards as an Atom 1.0 XML feed. ``feed_path`` is the request path that produced this feed (e.g. ``/api/feed.atom?ver
backend/app/services/feed.py:226
↓ 10 callers
Function
save_json
(name, data)
backend/scripts/test_e2e_api.py:91
↓ 10 callers
Function
summary_cache_key
Stable hash of the inputs that affect the rendered GIF. Two summaries with the same hash produce byte-identical GIFs (as long as the renderer
backend/app/services/replay_gif.py:491
↓ 10 callers
Function
validate_url
Return ``None`` if the URL is acceptable, else an error message. Empty string is valid (treated as "disable webhook").
backend/app/services/webhook_service.py:693
↓ 9 callers
Function
_build_gallery_card_payload
Assemble the minimal card-friendly payload for the public gallery. Cheap reads only — no DB joins, no LLM calls. Walks the on-disk artifacts
backend/app/api/simulation.py:7938
↓ 9 callers
Function
_clear_dkg
Reset the four DKG_* config attributes back to the unset shape. The notifications probe reads DKG state via ``dkg_publisher.is_configured()``
backend/tests/test_unit_notifications_config.py:55
↓ 9 callers
Function
_env
(name: str)
backend/app/services/email_notify.py:134
↓ 9 callers
Function
_escape_literal
Escape a Turtle string literal. Turtle backslash + quote escaping per https://www.w3.org/TR/turtle/#sec-escapes. We use the triple-double
backend/app/services/dkg_publisher.py:270
↓ 9 callers
Method
_get_post_type
(self, post_id: int)
backend/wonderwall/social_platform/platform_utils.py:242
↓ 9 callers
Function
_get_simulation_id_or_400
Extract and validate simulation_id from POST body. Returns (simulation_id, None) on success or (None, error_response) on failure.
backend/app/api/simulation.py:155
↓ 9 callers
Function
_payload
(**overrides)
backend/tests/test_unit_slack_notify.py:98
↓ 9 callers
Function
_read_outcome_file
Read ``<sim_dir>/outcome.json`` if it exists. Returns the parsed dict (with the public fields the gallery + embed surfaces care about) or ``N
backend/app/api/simulation.py:7898
↓ 9 callers
Function
_safe_int
Coerce ``value`` to a non-negative int with a default fallback. Belief: every numeric field in the export is non-negative — agent count, roun
backend/app/services/repro_export.py:105
↓ 9 callers
Function
_safe_str
Coerce ``value`` to a stripped string.
backend/app/services/repro_export.py:120
↓ 9 callers
Function
_text_width
Measure pixel width — uses textbbox (Pillow 10+) which is accurate for both TTF and the bitmap fallback.
backend/app/services/share_card.py:97
↓ 9 callers
Function
build_platform_badge_svg
Render the flat platform-stats badge as an SVG string. Returns a complete SVG 1.1 document with the same dimensions, rounded clip path, font
backend/app/services/badge_service.py:375
↓ 9 callers
Function
build_rows
Read sim_dir on-disk artifacts and return the analyst row list. Reads ``trajectory.json`` (required — empty list when missing) and ``quality.
backend/app/services/trajectory_export.py:186
↓ 9 callers
Function
build_status_payload
Assemble the GET /api/mcp/status response body. Splitting this from the request handler keeps the unit tests Flask-free.
backend/app/api/mcp.py:267
↓ 9 callers
Method
close
(self)
backend/app/services/oracle_seed.py:111
↓ 9 callers
Method
close
(self)
backend/wonderwall/social_agent/agent_graph.py:260
↓ 9 callers
Method
get_all_actions
Get complete action history for all platforms (no pagination limit) Args: simulation_id: Simulation ID platf
backend/app/services/simulation_runner.py:980
↓ 9 callers
Method
log_action
Log a single action
backend/scripts/action_logger.py:44
↓ 9 callers
Method
log_round_start
Log round start
backend/scripts/action_logger.py:69
↓ 9 callers
Method
record
Record actions from one platform for a round. Call this after each platform steps, BEFORE the next platform steps, so that subsequent
backend/scripts/round_memory.py:201
↓ 9 callers
Method
run
(self)
backend/wonderwall/social_platform/platform.py:196
↓ 9 callers
Method
send_response
Send response
backend/scripts/run_parallel_simulation.py:353
↓ 9 callers
Method
update_progress
Update report generation progress Frontend can get real-time progress by reading progress.json
backend/app/services/report_agent.py:3301
↓ 9 callers
Function
verify_signature
Constant-time verification helper for recipients. Returns ``True`` iff ``header_value`` is the signature this MiroShark instance would emit f
backend/app/services/webhook_service.py:669
↓ 8 callers
Function
_bucket_with_pcts
Convert a counts dict into a ``{key, key_pct}``-flavoured dict. Percentages are rounded to one decimal and ``0.0`` when ``total == 0``. Same
backend/app/services/outcome_distribution.py:237
↓ 8 callers
Function
_cell_text
(cell: dict)
backend/tests/test_unit_notebook_export.py:180
↓ 8 callers
Function
_classify_stance
Bucket a continuous belief position into bullish/neutral/bearish. Mirrors the ±0.2 threshold used elsewhere — keeps the transcript's per-agen
backend/app/services/transcript.py:51
↓ 8 callers
Function
_clear_email
Reset SMTP_* env vars so the email channel reads as unconfigured.
backend/tests/test_unit_notifications_config.py:70
↓ 8 callers
Function
_clear_telegram
Reset TELEGRAM_* env vars so the channel reads as unconfigured.
backend/tests/test_unit_notifications_config.py:81
↓ 8 callers
Function
_clear_waybackclaw
Reset ``WAYBACKCLAW_AGENT_TOKEN`` so the channel reads as unconfigured. ``is_configured()`` returns True iff the agent token is set, so this
backend/tests/test_unit_notifications_config.py:87
↓ 8 callers
Function
_demo_bucket_accumulator
()
backend/app/api/simulation.py:11002
↓ 8 callers
Function
_html_escape
(value: str)
backend/app/services/email_notify.py:388
↓ 8 callers
Function
_load_font
(size: int, bold: bool = False)
backend/app/services/share_card.py:84
↓ 8 callers
Function
_resolve_share_base_url
Same proxy-aware base URL the share / watch routes use. Honours ``X-Forwarded-Proto`` + ``X-Forwarded-Host`` for deployments behind a TLS-ter
backend/app/api/simulation.py:6731
↓ 8 callers
Function
_response
(json_data=None, status=200, text="")
backend/tests/test_unit_searxng_client.py:18
↓ 8 callers
Function
_suggested_market_title
Synthesise a Polymarket-shaped market title from the sim scenario. Polymarket titles start with ``"Will "`` and end with a single ``"?"``. We
backend/app/services/polymarket_service.py:130
↓ 8 callers
Function
_text_width
(draw: ImageDraw.ImageDraw, text: str, font)
backend/app/services/replay_gif.py:104
↓ 8 callers
Function
_write_trajectory
(sim_dir: Path, snapshots: list[dict])
backend/tests/test_unit_agent_export.py:62
↓ 8 callers
Function
build_thread
Assemble the full tweet-thread payload for a finished simulation. Returns ``{"tweets": [...], "total": N, "inflections_recorded": M, "truncat
backend/app/services/thread_formatter.py:352
↓ 8 callers
Method
chat
Send a chat request Args: messages: List of messages temperature: Temperature parameter max_toke
backend/app/utils/llm_client.py:264
↓ 8 callers
Function
distribution_etag
Build a short ETag from the cheap inputs. ``total_analyzed`` + the year-month prefix of ``newest_completed_at`` detects material change witho
backend/app/services/outcome_distribution.py:368
↓ 8 callers
Function
fetch_url_text
Fetch a URL and return its readable content. Uses Firecrawl (MIROSHARK_FIRECRAWL_BASE_URL) when configured, falling back to the web-sear
backend/app/utils/url_fetcher.py:166
↓ 8 callers
Method
filter_defined_entities
Filter and extract nodes with meaningful entity types. Filtering logic: - If a node's labels only include "Entity", it has n
backend/app/services/entity_reader.py:170
↓ 8 callers
Function
inject_belief_context
Inject belief state into an agent's system message. Follows the same pattern as ``inject_cross_platform_context``: appends (or replaces) a ma
backend/wonderwall/social_agent/belief_state.py:261
↓ 8 callers
Function
load_counterfactual
Read ``<sim_dir>/counterfactual_injection.json`` or return None.
backend/scripts/counterfactual_loader.py:29
↓ 8 callers
Method
perform_action
Send an action through the channel to the platform.
backend/wonderwall/simulations/base.py:286
↓ 8 callers
Function
render_feed
Render the feed in the requested format. Returns ``(body_bytes, mime_type)``. ``fmt`` accepts ``"atom"`` (the default) or ``"rss"`` — anythin
backend/app/services/feed.py:565
↓ 8 callers
Method
save
Save trajectory to JSON for the report agent.
backend/wonderwall/social_agent/round_analyzer.py:69
↓ 8 callers
Function
summary_cache_key
Stable hash of the inputs that affect the rendered card. Two cards with the same hash are guaranteed byte-identical (as long as the renderer c
backend/app/services/share_card.py:472
↓ 8 callers
Method
to_prompt_text
Convert belief state to natural language for LLM prompt injection.
backend/wonderwall/social_agent/belief_state.py:190
↓ 7 callers
Function
_is_gif
GIF signature is GIF87a or GIF89a in the first 6 bytes.
backend/tests/test_unit_replay_gif.py:33
↓ 7 callers
Function
_iso
Format ``epoch_seconds`` (UTC) as the naive-local shape ``simulation_runner`` writes into ``state.json``.
backend/tests/test_unit_platform_status.py:55
↓ 7 callers
Function
_load_font
(size: int, bold: bool = False)
backend/app/services/replay_gif.py:91
↓ 7 callers
Function
_report_prompt
Locale-aware lookup that falls back to module-level English constants. Lets us add Chinese variants in the registry without moving the sizabl
backend/app/services/report_agent.py:36
↓ 7 callers
Function
_scale_y
Map a percentage (0–100) into a pixel y-coordinate. SVG y-axis is inverted — 0 is at the top. We invert the percentage so 100% maps to ``PAD_
backend/app/services/chart_svg.py:104
↓ 7 callers
Function
_strip_embeddings
Drop raw embedding vectors from a result payload — they're noise for LLMs.
backend/mcp_server.py:233
↓ 7 callers
Function
_surfaces_fixture
Three realistic surfaces with distinct, easy-to-verify content.
backend/tests/test_unit_archive_service.py:64
↓ 7 callers
Method
add_agent
(self, agent: SocialAgent)
backend/wonderwall/social_agent/agent_graph.py:199
↓ 7 callers
Function
banner
(phase_num, title)
backend/scripts/test_e2e_api.py:68
↓ 7 callers
Function
compute_stance_split
Bucket per-agent belief positions into bullish/neutral/bearish %. ``belief_positions`` is the snapshot field: ``{agent_id: {topic: float}}``.
backend/app/services/trajectory_export.py:65
↓ 7 callers
Function
create_smart_llm_client
Factory for intelligence-sensitive workflows (reports, ontology, graph reasoning). Uses SMART_* config when set, otherwise falls back to the
backend/app/utils/llm_client.py:92
↓ 7 callers
Function
extract_frames_from_summary
Pull per-round belief percentages out of the embed-summary payload. Returns a list of ``{round, bullish, neutral, bearish}`` dicts in round o
backend/app/services/replay_gif.py:154
↓ 7 callers
Function
render_markdown
Render the transcript payload as Markdown. Layout: - YAML front-matter so Notion / Obsidian / Bear pick up the scenario, sim_id, a
backend/app/services/transcript.py:430
↓ 7 callers
Method
send_response
Send response
backend/scripts/run_twitter_simulation.py:201
↓ 7 callers
Method
send_response
Send response
backend/scripts/run_reddit_simulation.py:211
↓ 6 callers
Function
_check_simulation_prepared
Check if the simulation has been prepared Conditions checked: 1. state.json exists and status is "ready" 2. Required files exist: re
backend/app/api/simulation.py:1626
↓ 6 callers
Function
_compact_post_for_agent
Strip per-post fields that don't carry signal for agent decisions. CAMEL's ChatAgent accumulates env dumps across rounds, so each post's wire
backend/lib/env_compact.py:33
↓ 6 callers
Function
_compute_influence_ranked
Compute agent influence scores from simulation action JSONL logs. Reads twitter/actions.jsonl, reddit/actions.jsonl, and polymarket/actions.
backend/app/api/simulation.py:3701
↓ 6 callers
Function
_fail
Shape a daemon failure into the structured response. ``payload`` is whatever the daemon (or transport) returned. Trim long bodies so the resp
backend/app/services/dkg_publisher.py:650
↓ 6 callers
Function
_gif_frame_count
Count frames by reading the GIF with Pillow. Avoids hand-parsing the GCT / image descriptor blocks — Pillow's iterator already knows how to w
backend/tests/test_unit_replay_gif.py:45
↓ 6 callers
Function
_is_png
The PNG signature is fixed at 8 bytes: 89 50 4e 47 0d 0a 1a 0a.
backend/tests/test_unit_share_card.py:32
↓ 6 callers
Method
_load_simulation_state
Load simulation state from file
backend/app/services/simulation_manager.py:201
↓ 6 callers
Function
_load_spec
Load openapi.yaml as a dict — pyyaml is in the unit-test workflow.
backend/tests/test_unit_openapi.py:45
↓ 6 callers
Function
_make_app
Tiny Flask app with one view gated by ``require_admin_token``. We can't import the full ``create_app`` factory here because it boots Neo4j an
backend/tests/test_unit_admin_auth.py:52
↓ 6 callers
Function
_mask_key
Return only the last 4 characters of an API key.
backend/app/api/settings.py:25
↓ 6 callers
Method
_maybe_cache_wrap_messages
Attach cache_control to the first system message (Anthropic-style). Leaves the input list untouched; returns a shallow copy with the system
backend/app/utils/llm_client.py:184
↓ 6 callers
Function
_now_epoch
Integer Unix timestamp — single source for current-time arithmetic. Pulled into a helper so the test suite can monkey-patch one symbol rather
backend/app/services/share_link_service.py:143
↓ 6 callers
Function
_open_zip
Open a ZIP from in-memory bytes for inspection.
backend/tests/test_unit_archive_service.py:59
↓ 6 callers
Method
_read_action_log
Read action log file Args: log_path: Log file path position: Last read position state: Run state
backend/app/services/simulation_runner.py:614
← previous
next →
101–200 of 3,647, ranked by callers