igni-core 1.0.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- igni_core/__init__.py +37 -0
- igni_core/__main__.py +19 -0
- igni_core/_torchvision_shim.py +67 -0
- igni_core/alembic.ini +52 -0
- igni_core/backend/__init__.py +5 -0
- igni_core/backend/__main__.py +134 -0
- igni_core/backend/activity.py +112 -0
- igni_core/backend/activity_nudge.py +43 -0
- igni_core/backend/agent_framing.py +82 -0
- igni_core/backend/agent_refresh.py +49 -0
- igni_core/backend/agno_decision_applier.py +69 -0
- igni_core/backend/agno_history_plan_scanner.py +114 -0
- igni_core/backend/app.py +321 -0
- igni_core/backend/backend_bootstrap.py +133 -0
- igni_core/backend/backend_notifications.py +71 -0
- igni_core/backend/browser_opener.py +35 -0
- igni_core/backend/browser_sign_in.py +115 -0
- igni_core/backend/builtin_command_registry.py +286 -0
- igni_core/backend/captured_shell_runner.py +129 -0
- igni_core/backend/chat_history_searcher.py +132 -0
- igni_core/backend/cloud_sign_out.py +41 -0
- igni_core/backend/cmd_agents.py +110 -0
- igni_core/backend/cmd_auth.py +123 -0
- igni_core/backend/cmd_config.py +34 -0
- igni_core/backend/cmd_context.py +181 -0
- igni_core/backend/cmd_eject.py +163 -0
- igni_core/backend/cmd_evals.py +41 -0
- igni_core/backend/cmd_help.py +72 -0
- igni_core/backend/cmd_hooks.py +54 -0
- igni_core/backend/cmd_loop.py +269 -0
- igni_core/backend/cmd_memory.py +115 -0
- igni_core/backend/cmd_misc.py +130 -0
- igni_core/backend/cmd_model.py +45 -0
- igni_core/backend/cmd_modes.py +334 -0
- igni_core/backend/cmd_plugin/__init__.py +15 -0
- igni_core/backend/cmd_plugin/bulk_refresh.py +59 -0
- igni_core/backend/cmd_plugin/commands.py +138 -0
- igni_core/backend/cmd_plugin/context.py +43 -0
- igni_core/backend/cmd_plugin/gateway.py +173 -0
- igni_core/backend/cmd_plugin/routers.py +122 -0
- igni_core/backend/cmd_plugin/verbs.py +364 -0
- igni_core/backend/cmd_schedule.py +208 -0
- igni_core/backend/cmd_session.py +202 -0
- igni_core/backend/cold_spawn_resume.py +349 -0
- igni_core/backend/command_handler.py +159 -0
- igni_core/backend/command_result.py +173 -0
- igni_core/backend/controller_registry.py +250 -0
- igni_core/backend/dir_scanner.py +60 -0
- igni_core/backend/extension_startup.py +137 -0
- igni_core/backend/extensions_runtime.py +153 -0
- igni_core/backend/file_completion_service.py +36 -0
- igni_core/backend/file_opener.py +76 -0
- igni_core/backend/first_window.py +56 -0
- igni_core/backend/folder_picker.py +117 -0
- igni_core/backend/group_pack_hydrator.py +127 -0
- igni_core/backend/group_policy_sync.py +185 -0
- igni_core/backend/headless_extensions.py +313 -0
- igni_core/backend/hitl_controller.py +317 -0
- igni_core/backend/hitl_permissions.py +110 -0
- igni_core/backend/hitl_stream_mux.py +368 -0
- igni_core/backend/hitl_tracer.py +88 -0
- igni_core/backend/host_backend.py +185 -0
- igni_core/backend/host_model_runtime.py +84 -0
- igni_core/backend/host_model_wiring.py +107 -0
- igni_core/backend/igni_server_access.py +40 -0
- igni_core/backend/in_flight_tasks.py +37 -0
- igni_core/backend/inline_think_splitter.py +75 -0
- igni_core/backend/keyboard_shortcuts_help.py +67 -0
- igni_core/backend/lockfile.py +326 -0
- igni_core/backend/logging_setup.py +134 -0
- igni_core/backend/login_coordinator.py +103 -0
- igni_core/backend/markdown_command_dispatcher.py +133 -0
- igni_core/backend/marketplace_controller.py +86 -0
- igni_core/backend/message_admission.py +92 -0
- igni_core/backend/message_dispatcher.py +432 -0
- igni_core/backend/model_http_client_manager.py +142 -0
- igni_core/backend/model_switcher.py +71 -0
- igni_core/backend/observed_transport.py +89 -0
- igni_core/backend/panels/__init__.py +30 -0
- igni_core/backend/panels/agents_panel.py +73 -0
- igni_core/backend/panels/hooks_panel.py +38 -0
- igni_core/backend/panels/output_styles_catalog.py +35 -0
- igni_core/backend/panels/skills_panel.py +49 -0
- igni_core/backend/panels/slash_commands_catalog.py +101 -0
- igni_core/backend/pause_handler.py +195 -0
- igni_core/backend/pending_message_journal.py +119 -0
- igni_core/backend/pending_requirements_store.py +204 -0
- igni_core/backend/plan_snapshot_builder.py +51 -0
- igni_core/backend/plugin_bundle_files.py +91 -0
- igni_core/backend/plugin_controller.py +355 -0
- igni_core/backend/plugin_directory_scanner.py +162 -0
- igni_core/backend/plugin_schemas.py +439 -0
- igni_core/backend/pool_directories.py +101 -0
- igni_core/backend/pool_replier.py +81 -0
- igni_core/backend/pool_rpcs/__init__.py +38 -0
- igni_core/backend/pool_rpcs/approver_tokens.py +60 -0
- igni_core/backend/pool_rpcs/attach_session.py +79 -0
- igni_core/backend/pool_rpcs/base.py +98 -0
- igni_core/backend/pool_rpcs/host_model.py +220 -0
- igni_core/backend/pool_rpcs/page_token.py +51 -0
- igni_core/backend/pool_rpcs/platform_calls.py +136 -0
- igni_core/backend/pool_rpcs/router.py +52 -0
- igni_core/backend/pool_wiring.py +97 -0
- igni_core/backend/process_environment.py +35 -0
- igni_core/backend/prompt_builder.py +235 -0
- igni_core/backend/push_bridge.py +421 -0
- igni_core/backend/push_payloads.py +178 -0
- igni_core/backend/restore_content.py +112 -0
- igni_core/backend/rpc_binding.py +191 -0
- igni_core/backend/rpc_errors.py +32 -0
- igni_core/backend/rpc_handlers/__init__.py +59 -0
- igni_core/backend/rpc_handlers/auth.py +139 -0
- igni_core/backend/rpc_handlers/base.py +97 -0
- igni_core/backend/rpc_handlers/extensions.py +110 -0
- igni_core/backend/rpc_handlers/hooks.py +34 -0
- igni_core/backend/rpc_handlers/loop.py +130 -0
- igni_core/backend/rpc_handlers/mcp.py +140 -0
- igni_core/backend/rpc_handlers/models.py +174 -0
- igni_core/backend/rpc_handlers/notifications.py +100 -0
- igni_core/backend/rpc_handlers/panel_args.py +134 -0
- igni_core/backend/rpc_handlers/panels.py +304 -0
- igni_core/backend/rpc_handlers/plan.py +78 -0
- igni_core/backend/rpc_handlers/plugins.py +269 -0
- igni_core/backend/rpc_handlers/pool_guard.py +62 -0
- igni_core/backend/rpc_handlers/scheduler.py +144 -0
- igni_core/backend/rpc_handlers/session.py +239 -0
- igni_core/backend/rpc_handlers/session_args.py +68 -0
- igni_core/backend/rpc_handlers/session_history.py +102 -0
- igni_core/backend/rpc_handlers/skills.py +49 -0
- igni_core/backend/rpc_handlers/workflows.py +92 -0
- igni_core/backend/rpc_handlers/workspace_trust.py +83 -0
- igni_core/backend/rpc_result.py +43 -0
- igni_core/backend/rpc_router.py +171 -0
- igni_core/backend/rpc_streams.py +58 -0
- igni_core/backend/rpc_watch.py +60 -0
- igni_core/backend/run_controller.py +585 -0
- igni_core/backend/run_hook_gate.py +100 -0
- igni_core/backend/schemas_agents.py +73 -0
- igni_core/backend/schemas_auth.py +158 -0
- igni_core/backend/schemas_config.py +126 -0
- igni_core/backend/schemas_context.py +267 -0
- igni_core/backend/schemas_evals.py +43 -0
- igni_core/backend/schemas_extensions.py +292 -0
- igni_core/backend/schemas_help.py +297 -0
- igni_core/backend/schemas_history.py +415 -0
- igni_core/backend/schemas_hitl.py +219 -0
- igni_core/backend/schemas_hooks.py +70 -0
- igni_core/backend/schemas_lifecycle.py +309 -0
- igni_core/backend/schemas_lockfile.py +225 -0
- igni_core/backend/schemas_loop.py +237 -0
- igni_core/backend/schemas_mcp.py +147 -0
- igni_core/backend/schemas_memory.py +193 -0
- igni_core/backend/schemas_model.py +56 -0
- igni_core/backend/schemas_panels.py +230 -0
- igni_core/backend/schemas_pause.py +192 -0
- igni_core/backend/schemas_plan.py +52 -0
- igni_core/backend/schemas_pool.py +197 -0
- igni_core/backend/schemas_processes.py +67 -0
- igni_core/backend/schemas_rpc.py +378 -0
- igni_core/backend/schemas_run.py +198 -0
- igni_core/backend/schemas_scheduler.py +194 -0
- igni_core/backend/schemas_search.py +77 -0
- igni_core/backend/schemas_sessions.py +214 -0
- igni_core/backend/schemas_visualization.py +55 -0
- igni_core/backend/schemas_workflow_events.py +325 -0
- igni_core/backend/schemas_workflows.py +319 -0
- igni_core/backend/search_cache.py +53 -0
- igni_core/backend/search_strategies.py +222 -0
- igni_core/backend/server.py +501 -0
- igni_core/backend/server_auth.py +175 -0
- igni_core/backend/server_context.py +285 -0
- igni_core/backend/server_files.py +264 -0
- igni_core/backend/server_history.py +248 -0
- igni_core/backend/server_history_walker.py +295 -0
- igni_core/backend/server_interrupted_run.py +191 -0
- igni_core/backend/server_lifecycle.py +141 -0
- igni_core/backend/server_loop.py +107 -0
- igni_core/backend/server_mcp.py +146 -0
- igni_core/backend/server_panels.py +143 -0
- igni_core/backend/server_processes.py +128 -0
- igni_core/backend/server_rehydrate.py +203 -0
- igni_core/backend/server_scheduler.py +309 -0
- igni_core/backend/server_search.py +103 -0
- igni_core/backend/server_sessions.py +145 -0
- igni_core/backend/server_shutdown.py +166 -0
- igni_core/backend/service_event_delivery.py +173 -0
- igni_core/backend/service_event_ingress.py +82 -0
- igni_core/backend/service_item_desk.py +175 -0
- igni_core/backend/serving_backend.py +95 -0
- igni_core/backend/session_checkpointer.py +101 -0
- igni_core/backend/session_orchestrator.py +195 -0
- igni_core/backend/session_pool.py +394 -0
- igni_core/backend/session_router.py +97 -0
- igni_core/backend/session_runtime_factory.py +114 -0
- igni_core/backend/session_stamping_transport.py +61 -0
- igni_core/backend/settings_loader.py +40 -0
- igni_core/backend/skill_command_dispatcher.py +47 -0
- igni_core/backend/slash_command.py +41 -0
- igni_core/backend/standing_policy.py +144 -0
- igni_core/backend/stream_event_dispatcher.py +81 -0
- igni_core/backend/supervisor.py +495 -0
- igni_core/backend/team_wiring.py +84 -0
- igni_core/backend/transport_builder.py +72 -0
- igni_core/backend/visualization_action_bus.py +44 -0
- igni_core/backend/workflow_agent_bridge.py +92 -0
- igni_core/backend/workflow_discovery.py +128 -0
- igni_core/backend/workflow_layers.py +120 -0
- igni_core/backend/workflow_run.py +184 -0
- igni_core/backend/workflow_run_registry.py +90 -0
- igni_core/backend/workflow_runner.py +114 -0
- igni_core/backend/workflow_runtime.mjs +491 -0
- igni_core/backend/workflow_runtime_process.py +212 -0
- igni_core/backend/workspace_signals.py +77 -0
- igni_core/backend/workspace_trust_controller.py +153 -0
- igni_core/backend/workspace_watch.py +271 -0
- igni_core/bundled_agents/architect.md +157 -0
- igni_core/bundled_agents/debugger.md +204 -0
- igni_core/bundled_agents/docs.md +336 -0
- igni_core/bundled_agents/editor.md +308 -0
- igni_core/bundled_agents/explorer.md +154 -0
- igni_core/bundled_agents/plan_researcher.md +96 -0
- igni_core/bundled_agents/qa.md +206 -0
- igni_core/bundled_agents/reviewer.md +163 -0
- igni_core/bundled_agents/security.md +183 -0
- igni_core/bundled_agents/simplifier.md +182 -0
- igni_core/bundled_agents/visualizer.md +245 -0
- igni_core/bundled_skills/commit/SKILL.md +55 -0
- igni_core/bundled_skills/explain/SKILL.md +67 -0
- igni_core/bundled_skills/migration/SKILL.md +80 -0
- igni_core/bundled_skills/pr/SKILL.md +81 -0
- igni_core/bundled_skills/test-plan/SKILL.md +119 -0
- igni_core/cli/__init__.py +219 -0
- igni_core/cli/context.py +27 -0
- igni_core/cli/ext.py +484 -0
- igni_core/cli/ext_doctor.py +242 -0
- igni_core/cli/ext_manifest_check.py +133 -0
- igni_core/cli/ext_scaffold.py +222 -0
- igni_core/cli/ext_scaffold_templates.py +488 -0
- igni_core/cli/headless_run.py +114 -0
- igni_core/cli/invocation.py +229 -0
- igni_core/cli/logging.py +101 -0
- igni_core/cli/login.py +92 -0
- igni_core/cli/migrate.py +108 -0
- igni_core/cli/options.py +60 -0
- igni_core/cli/resume.py +98 -0
- igni_core/cli/run_settings.py +97 -0
- igni_core/cli/trust.py +210 -0
- igni_core/contracts/__init__.py +11 -0
- igni_core/contracts/wire_schema.py +208 -0
- igni_core/core/__init__.py +0 -0
- igni_core/core/activity/__init__.py +14 -0
- igni_core/core/activity/background.py +222 -0
- igni_core/core/activity/http.py +154 -0
- igni_core/core/activity/http2.py +93 -0
- igni_core/core/activity/registry.py +270 -0
- igni_core/core/agents/__init__.py +43 -0
- igni_core/core/agents/builder.py +251 -0
- igni_core/core/agents/catalog.py +19 -0
- igni_core/core/agents/contributions.py +89 -0
- igni_core/core/agents/ephemeral.py +291 -0
- igni_core/core/agents/loader.py +161 -0
- igni_core/core/agents/markdown.py +167 -0
- igni_core/core/agents/plugin_policy.py +78 -0
- igni_core/core/agents/pool.py +309 -0
- igni_core/core/agents/schemas.py +335 -0
- igni_core/core/agents/tool_audience.py +70 -0
- igni_core/core/agents/tool_check.py +69 -0
- igni_core/core/agents/trained_layout.py +70 -0
- igni_core/core/agno_telemetry.py +122 -0
- igni_core/core/air_gap.py +43 -0
- igni_core/core/approvals/__init__.py +5 -0
- igni_core/core/approvals/declined.py +23 -0
- igni_core/core/approvals/events.py +78 -0
- igni_core/core/approvals/journal.py +240 -0
- igni_core/core/approvals/journal_table.py +58 -0
- igni_core/core/approvals/records.py +56 -0
- igni_core/core/approvals/spawn_links.py +108 -0
- igni_core/core/approvals/tables.py +75 -0
- igni_core/core/approvals/turn_results.py +65 -0
- igni_core/core/auth/__init__.py +52 -0
- igni_core/core/auth/_success_page.py +58 -0
- igni_core/core/auth/callback_server.py +287 -0
- igni_core/core/auth/credentials.py +414 -0
- igni_core/core/auth/discovery.py +195 -0
- igni_core/core/auth/discovery_schemas.py +98 -0
- igni_core/core/auth/http_auth.py +69 -0
- igni_core/core/auth/portal_client.py +306 -0
- igni_core/core/auth/schemas.py +206 -0
- igni_core/core/auth/server_url.py +28 -0
- igni_core/core/broadcast_schema.py +51 -0
- igni_core/core/config/__init__.py +1 -0
- igni_core/core/config/accumulator.py +91 -0
- igni_core/core/config/anthropic_auth.py +76 -0
- igni_core/core/config/caller_inspector.py +54 -0
- igni_core/core/config/checked_gemini.py +49 -0
- igni_core/core/config/cli_overrides.py +173 -0
- igni_core/core/config/cloud_model_migrator.py +106 -0
- igni_core/core/config/cloud_models.py +285 -0
- igni_core/core/config/config_io.py +89 -0
- igni_core/core/config/context_window.py +206 -0
- igni_core/core/config/endpoint.py +132 -0
- igni_core/core/config/group_policy/__init__.py +41 -0
- igni_core/core/config/group_policy/answers.py +54 -0
- igni_core/core/config/group_policy/cache.py +121 -0
- igni_core/core/config/group_policy/entry.py +164 -0
- igni_core/core/config/group_policy/environment.py +37 -0
- igni_core/core/config/group_policy/gate.py +58 -0
- igni_core/core/config/group_policy/hooks.py +119 -0
- igni_core/core/config/group_policy/issuer.py +45 -0
- igni_core/core/config/group_policy/jwks.py +82 -0
- igni_core/core/config/group_policy/jws.py +128 -0
- igni_core/core/config/group_policy/kinds.py +208 -0
- igni_core/core/config/group_policy/layout.py +137 -0
- igni_core/core/config/group_policy/materializer.py +104 -0
- igni_core/core/config/group_policy/meta.py +114 -0
- igni_core/core/config/group_policy/pack.py +134 -0
- igni_core/core/config/group_policy/plugins.py +155 -0
- igni_core/core/config/group_policy/policy_settings.py +43 -0
- igni_core/core/config/group_policy/refresher.py +143 -0
- igni_core/core/config/group_policy/response.py +52 -0
- igni_core/core/config/group_policy/revalidation.py +29 -0
- igni_core/core/config/group_policy/settings_fetcher.py +202 -0
- igni_core/core/config/group_policy/signature.py +202 -0
- igni_core/core/config/group_policy/signed_store.py +143 -0
- igni_core/core/config/group_policy/signing_key.py +87 -0
- igni_core/core/config/group_policy/transport.py +106 -0
- igni_core/core/config/group_policy/trust.py +90 -0
- igni_core/core/config/group_policy/verifier.py +75 -0
- igni_core/core/config/llm_call_logger.py +148 -0
- igni_core/core/config/logging_claude.py +137 -0
- igni_core/core/config/logging_model.py +158 -0
- igni_core/core/config/managed_policy.py +117 -0
- igni_core/core/config/merge_plan.py +195 -0
- igni_core/core/config/message_sanitizer.py +109 -0
- igni_core/core/config/model_entry.py +308 -0
- igni_core/core/config/model_stream.py +186 -0
- igni_core/core/config/models.py +249 -0
- igni_core/core/config/null_model.py +117 -0
- igni_core/core/config/organisation_tiers.py +116 -0
- igni_core/core/config/permission_eval/__init__.py +130 -0
- igni_core/core/config/permission_eval/catalog.py +234 -0
- igni_core/core/config/permission_eval/mode_policy.py +164 -0
- igni_core/core/config/permission_eval/pipe_filters.py +241 -0
- igni_core/core/config/permission_eval/pipeline.py +566 -0
- igni_core/core/config/permission_eval/read_only_shell.py +318 -0
- igni_core/core/config/permission_eval/resolver.py +104 -0
- igni_core/core/config/permission_eval/schemas.py +282 -0
- igni_core/core/config/permission_eval/strategies.py +300 -0
- igni_core/core/config/permissions/__init__.py +24 -0
- igni_core/core/config/permissions/schemas.py +21 -0
- igni_core/core/config/provider_builders.py +395 -0
- igni_core/core/config/provider_catalog.py +87 -0
- igni_core/core/config/reply_ending.py +269 -0
- igni_core/core/config/schemas/__init__.py +65 -0
- igni_core/core/config/schemas/display.py +48 -0
- igni_core/core/config/schemas/extensions.py +34 -0
- igni_core/core/config/schemas/llm_behavior.py +92 -0
- igni_core/core/config/schemas/models.py +63 -0
- igni_core/core/config/schemas/network.py +28 -0
- igni_core/core/config/schemas/orchestration.py +91 -0
- igni_core/core/config/schemas/permissions.py +234 -0
- igni_core/core/config/schemas/plugins.py +33 -0
- igni_core/core/config/schemas/safety.py +73 -0
- igni_core/core/config/schemas/storage_and_paths.py +114 -0
- igni_core/core/config/schemas/telemetry.py +110 -0
- igni_core/core/config/secret_scan.py +140 -0
- igni_core/core/config/settings.py +149 -0
- igni_core/core/config/settings_loader.py +114 -0
- igni_core/core/config/tiers/__init__.py +10 -0
- igni_core/core/config/tiers/base.py +17 -0
- igni_core/core/config/tiers/cli.py +78 -0
- igni_core/core/config/tiers/cloud_migration.py +35 -0
- igni_core/core/config/tiers/developer.py +80 -0
- igni_core/core/config/tiers/files.py +36 -0
- igni_core/core/config/tiers/group_policy.py +133 -0
- igni_core/core/config/tiers/managed.py +99 -0
- igni_core/core/config/tiers/organisation.py +76 -0
- igni_core/core/config/tiers/project.py +203 -0
- igni_core/core/config/tiers/raw_model_registry.py +64 -0
- igni_core/core/config/tool_names.py +267 -0
- igni_core/core/config/tool_permissions/__init__.py +110 -0
- igni_core/core/config/tool_permissions/schemas.py +444 -0
- igni_core/core/config/tool_permissions/settings_files.py +242 -0
- igni_core/core/config/tool_permissions/store.py +248 -0
- igni_core/core/config/tool_permissions/tool_invocation.py +131 -0
- igni_core/core/config/tool_permissions/tool_name_resolver.py +104 -0
- igni_core/core/config/user_config_store.py +110 -0
- igni_core/core/contributed_commands.py +95 -0
- igni_core/core/data_paths.py +214 -0
- igni_core/core/db/__init__.py +22 -0
- igni_core/core/db/agno_schema.py +130 -0
- igni_core/core/db/base.py +14 -0
- igni_core/core/db/database.py +68 -0
- igni_core/core/db/engine.py +21 -0
- igni_core/core/db/engine_registry.py +276 -0
- igni_core/core/db/locator.py +110 -0
- igni_core/core/db/migrations.py +147 -0
- igni_core/core/db/providers.py +120 -0
- igni_core/core/db/schema.py +92 -0
- igni_core/core/db/scope.py +185 -0
- igni_core/core/db/upsert.py +41 -0
- igni_core/core/db/urls.py +154 -0
- igni_core/core/decisions/__init__.py +27 -0
- igni_core/core/decisions/endpoints.py +158 -0
- igni_core/core/decisions/laya.py +160 -0
- igni_core/core/decisions/laya_wire.py +174 -0
- igni_core/core/decisions/schemas.py +198 -0
- igni_core/core/decisions/service_wire.py +53 -0
- igni_core/core/dir_migration.py +124 -0
- igni_core/core/evals/__init__.py +13 -0
- igni_core/core/evals/agno_adapter.py +227 -0
- igni_core/core/evals/assertion_runner.py +369 -0
- igni_core/core/evals/assertions.py +124 -0
- igni_core/core/evals/loader.py +203 -0
- igni_core/core/evals/reporter.py +94 -0
- igni_core/core/evals/runner.py +387 -0
- igni_core/core/evals/schemas.py +342 -0
- igni_core/core/evals/tool_names.py +121 -0
- igni_core/core/evals/workspace.py +170 -0
- igni_core/core/guardrails/__init__.py +28 -0
- igni_core/core/guardrails/base.py +88 -0
- igni_core/core/guardrails/injection.py +54 -0
- igni_core/core/guardrails/moderation.py +28 -0
- igni_core/core/guardrails/pii.py +60 -0
- igni_core/core/guardrails/runner.py +107 -0
- igni_core/core/hitl/__init__.py +13 -0
- igni_core/core/hitl/ledger.py +125 -0
- igni_core/core/hitl/models.py +169 -0
- igni_core/core/hitl/registry.py +167 -0
- igni_core/core/hitl/relay.py +33 -0
- igni_core/core/hitl/trace.py +63 -0
- igni_core/core/hitl/turns.py +70 -0
- igni_core/core/hooks/__init__.py +33 -0
- igni_core/core/hooks/agno_coroutine_marker.py +42 -0
- igni_core/core/hooks/bypass_explainer.py +139 -0
- igni_core/core/hooks/bypass_guard.py +276 -0
- igni_core/core/hooks/bypass_judge.py +98 -0
- igni_core/core/hooks/bypass_rules.py +257 -0
- igni_core/core/hooks/bypass_tool_kind.py +107 -0
- igni_core/core/hooks/envelope.py +133 -0
- igni_core/core/hooks/events.py +80 -0
- igni_core/core/hooks/executor.py +352 -0
- igni_core/core/hooks/extension_gate.py +120 -0
- igni_core/core/hooks/extension_spec.py +100 -0
- igni_core/core/hooks/extension_values.py +95 -0
- igni_core/core/hooks/group_hook_decisions.py +145 -0
- igni_core/core/hooks/group_hook_gate.py +205 -0
- igni_core/core/hooks/handlers/__init__.py +23 -0
- igni_core/core/hooks/handlers/base.py +57 -0
- igni_core/core/hooks/handlers/command.py +166 -0
- igni_core/core/hooks/handlers/http.py +81 -0
- igni_core/core/hooks/handlers/mcp_tool.py +137 -0
- igni_core/core/hooks/handlers/prompt.py +35 -0
- igni_core/core/hooks/handlers/registry.py +115 -0
- igni_core/core/hooks/hook_firer.py +76 -0
- igni_core/core/hooks/load_result.py +38 -0
- igni_core/core/hooks/loader.py +299 -0
- igni_core/core/hooks/matcher.py +80 -0
- igni_core/core/hooks/memory_sync.py +42 -0
- igni_core/core/hooks/merger.py +67 -0
- igni_core/core/hooks/payload_sanitizer.py +69 -0
- igni_core/core/hooks/permission/__init__.py +9 -0
- igni_core/core/hooks/permission/blocked_command_stage.py +56 -0
- igni_core/core/hooks/permission/bypass_guard_stage.py +26 -0
- igni_core/core/hooks/permission/context.py +66 -0
- igni_core/core/hooks/permission/denial.py +67 -0
- igni_core/core/hooks/permission/evaluator_stage.py +112 -0
- igni_core/core/hooks/permission/outcome.py +30 -0
- igni_core/core/hooks/permission/pipeline.py +63 -0
- igni_core/core/hooks/permission/pre_tool_use_stage.py +81 -0
- igni_core/core/hooks/permission/protected_path_stage.py +90 -0
- igni_core/core/hooks/permission/stage.py +20 -0
- igni_core/core/hooks/queue/__init__.py +71 -0
- igni_core/core/hooks/queue/agno_adapter.py +87 -0
- igni_core/core/hooks/queue/bridge.py +79 -0
- igni_core/core/hooks/queue/buffer.py +73 -0
- igni_core/core/hooks/queue/injector.py +145 -0
- igni_core/core/hooks/queue/persister.py +74 -0
- igni_core/core/hooks/queue/schemas.py +170 -0
- igni_core/core/hooks/registry.py +199 -0
- igni_core/core/hooks/rules_suffixer.py +134 -0
- igni_core/core/hooks/schemas.py +336 -0
- igni_core/core/hooks/tool_call_invoker.py +108 -0
- igni_core/core/hooks/tool_events.py +146 -0
- igni_core/core/hooks/tool_hook.py +233 -0
- igni_core/core/hooks/turn_results.py +55 -0
- igni_core/core/hooks/untrusted.py +206 -0
- igni_core/core/init/__init__.py +36 -0
- igni_core/core/init/checksum_store.py +171 -0
- igni_core/core/init/gitignore.py +118 -0
- igni_core/core/init/home_migrator.py +119 -0
- igni_core/core/init/hook_provisioner.py +95 -0
- igni_core/core/init/hooks_catalog.py +49 -0
- igni_core/core/init/json_file.py +106 -0
- igni_core/core/init/project_initializer.py +244 -0
- igni_core/core/init/schemas.py +430 -0
- igni_core/core/init_templates.py +179 -0
- igni_core/core/layer.py +230 -0
- igni_core/core/learn.py +174 -0
- igni_core/core/log_fields.py +48 -0
- igni_core/core/loop/__init__.py +36 -0
- igni_core/core/loop/db_models.py +75 -0
- igni_core/core/loop/limits.py +22 -0
- igni_core/core/loop/models.py +42 -0
- igni_core/core/loop/prompt.py +86 -0
- igni_core/core/loop/store.py +242 -0
- igni_core/core/loop/tool_results.py +279 -0
- igni_core/core/lsp/__init__.py +43 -0
- igni_core/core/lsp/client.py +366 -0
- igni_core/core/lsp/loader.py +252 -0
- igni_core/core/lsp/manager.py +122 -0
- igni_core/core/lsp/schemas.py +353 -0
- igni_core/core/mcp/__init__.py +27 -0
- igni_core/core/mcp/approval.py +190 -0
- igni_core/core/mcp/client.py +581 -0
- igni_core/core/mcp/config.py +254 -0
- igni_core/core/mcp/hints.py +158 -0
- igni_core/core/mcp/naming.py +64 -0
- igni_core/core/mcp/notification_tap.py +102 -0
- igni_core/core/mcp/request_meta.py +62 -0
- igni_core/core/mcp/schemas.py +165 -0
- igni_core/core/mcp/stdio_binding.py +291 -0
- igni_core/core/mcp/tool_errors.py +135 -0
- igni_core/core/mcp/tool_filter.py +199 -0
- igni_core/core/mcp/tool_state.py +72 -0
- igni_core/core/memory/__init__.py +5 -0
- igni_core/core/memory/manager.py +127 -0
- igni_core/core/monitors/__init__.py +38 -0
- igni_core/core/monitors/config.py +118 -0
- igni_core/core/monitors/handle.py +260 -0
- igni_core/core/monitors/loader.py +105 -0
- igni_core/core/monitors/manager.py +196 -0
- igni_core/core/monitors/models.py +116 -0
- igni_core/core/monitors/supervisor.py +149 -0
- igni_core/core/network_policy.py +158 -0
- igni_core/core/observability/__init__.py +26 -0
- igni_core/core/observability/content.py +142 -0
- igni_core/core/observability/pipeline.py +155 -0
- igni_core/core/observability/run_spans.py +121 -0
- igni_core/core/observability/runtime.py +112 -0
- igni_core/core/observability/target.py +66 -0
- igni_core/core/output_styles/__init__.py +24 -0
- igni_core/core/output_styles/loader.py +137 -0
- igni_core/core/paths.py +207 -0
- igni_core/core/plugins/__init__.py +77 -0
- igni_core/core/plugins/git.py +196 -0
- igni_core/core/plugins/installer.py +393 -0
- igni_core/core/plugins/loader.py +360 -0
- igni_core/core/plugins/marketplace_store.py +341 -0
- igni_core/core/plugins/models.py +588 -0
- igni_core/core/plugins/source_policy.py +131 -0
- igni_core/core/plugins/state.py +80 -0
- igni_core/core/prompts/__init__.py +25 -0
- igni_core/core/prompts/composition.py +168 -0
- igni_core/core/prompts/contribution_models.py +90 -0
- igni_core/core/prompts/contributions.py +245 -0
- igni_core/core/prompts/document.py +277 -0
- igni_core/core/prompts/fragments.py +163 -0
- igni_core/core/prompts/loader.py +56 -0
- igni_core/core/prompts/main_agent.md +548 -0
- igni_core/core/prompts/persisting.md +62 -0
- igni_core/core/prompts/plan_mode.base.md +31 -0
- igni_core/core/run_context.py +15 -0
- igni_core/core/scheduler/__init__.py +6 -0
- igni_core/core/scheduler/clause_parsers.py +134 -0
- igni_core/core/scheduler/db_models.py +112 -0
- igni_core/core/scheduler/models.py +133 -0
- igni_core/core/scheduler/parser.py +58 -0
- igni_core/core/scheduler/prompt.py +70 -0
- igni_core/core/scheduler/recurrence.py +265 -0
- igni_core/core/scheduler/runner.py +300 -0
- igni_core/core/scheduler/store.py +192 -0
- igni_core/core/session/__init__.py +149 -0
- igni_core/core/session/agent_builder/__init__.py +31 -0
- igni_core/core/session/agent_builder/agent_build_spec.py +152 -0
- igni_core/core/session/agent_builder/coordinator.py +256 -0
- igni_core/core/session/agent_builder/instructions_builder.py +136 -0
- igni_core/core/session/agent_builder/main_tools.py +46 -0
- igni_core/core/session/agent_builder/plan_mode_nudge.py +40 -0
- igni_core/core/session/agent_builder/prompt_builder.py +219 -0
- igni_core/core/session/agent_builder/tools_builder.py +177 -0
- igni_core/core/session/agent_builder/tools_builder_deps.py +185 -0
- igni_core/core/session/agent_factory.py +71 -0
- igni_core/core/session/broadcast.py +139 -0
- igni_core/core/session/client_state.py +198 -0
- igni_core/core/session/cloud_auth.py +126 -0
- igni_core/core/session/cloud_catalog.py +97 -0
- igni_core/core/session/commands.py +262 -0
- igni_core/core/session/compaction/__init__.py +37 -0
- igni_core/core/session/compaction/context_breakdown_reporter.py +73 -0
- igni_core/core/session/compaction/context_budget.py +40 -0
- igni_core/core/session/compaction/coordinator.py +353 -0
- igni_core/core/session/compaction/fallback_summariser.py +175 -0
- igni_core/core/session/compaction/team_session.py +44 -0
- igni_core/core/session/compression.py +59 -0
- igni_core/core/session/core.py +331 -0
- igni_core/core/session/event_log.py +111 -0
- igni_core/core/session/event_log_schema.py +250 -0
- igni_core/core/session/hooks.py +119 -0
- igni_core/core/session/identity.py +142 -0
- igni_core/core/session/interactive.py +36 -0
- igni_core/core/session/interactive_loop.py +297 -0
- igni_core/core/session/learning_ops.py +185 -0
- igni_core/core/session/loop_ops.py +473 -0
- igni_core/core/session/mcp_ops.py +187 -0
- igni_core/core/session/mcp_resolver.py +57 -0
- igni_core/core/session/memory_ops.py +176 -0
- igni_core/core/session/message_handler.py +376 -0
- igni_core/core/session/message_outcome.py +191 -0
- igni_core/core/session/message_pause_policy.py +120 -0
- igni_core/core/session/message_team.py +53 -0
- igni_core/core/session/output_style_selection.py +39 -0
- igni_core/core/session/parts/__init__.py +13 -0
- igni_core/core/session/parts/agents.py +130 -0
- igni_core/core/session/parts/composer.py +99 -0
- igni_core/core/session/parts/coordinators.py +84 -0
- igni_core/core/session/parts/foundation.py +109 -0
- igni_core/core/session/parts/mcp.py +62 -0
- igni_core/core/session/parts/persistence.py +52 -0
- igni_core/core/session/parts/plugins.py +136 -0
- igni_core/core/session/parts/project.py +74 -0
- igni_core/core/session/parts/runtime.py +115 -0
- igni_core/core/session/parts/stores.py +70 -0
- igni_core/core/session/parts/tooling.py +45 -0
- igni_core/core/session/pending_messages.py +377 -0
- igni_core/core/session/persistence/__init__.py +47 -0
- igni_core/core/session/persistence/data_service.py +166 -0
- igni_core/core/session/persistence/db_protocol.py +89 -0
- igni_core/core/session/persistence/event_log_store.py +77 -0
- igni_core/core/session/persistence/facade.py +260 -0
- igni_core/core/session/persistence/forker.py +89 -0
- igni_core/core/session/persistence/listing.py +76 -0
- igni_core/core/session/persistence/namer.py +176 -0
- igni_core/core/session/persistence/plan_decisions_store.py +52 -0
- igni_core/core/session/persistence/run_history.py +114 -0
- igni_core/core/session/persistence/title_asker.py +149 -0
- igni_core/core/session/persistence/todos_store.py +47 -0
- igni_core/core/session/plan_ops.py +196 -0
- igni_core/core/session/plugin_reload.py +183 -0
- igni_core/core/session/queued_messages.py +302 -0
- igni_core/core/session/reminders.py +60 -0
- igni_core/core/session/run_debug.py +92 -0
- igni_core/core/session/runner.py +33 -0
- igni_core/core/session/schemas.py +899 -0
- igni_core/core/session/session_directories.py +96 -0
- igni_core/core/session/session_preferences.py +107 -0
- igni_core/core/session/session_run.py +160 -0
- igni_core/core/session/single_message_run.py +136 -0
- igni_core/core/session/startup/__init__.py +38 -0
- igni_core/core/session/startup/base.py +75 -0
- igni_core/core/session/startup/coordinator.py +64 -0
- igni_core/core/session/startup/marketplace.py +160 -0
- igni_core/core/session/startup/mcp.py +203 -0
- igni_core/core/session/state_ops.py +245 -0
- igni_core/core/session/surface.py +170 -0
- igni_core/core/session/token_estimate.py +101 -0
- igni_core/core/session/tool_approval.py +127 -0
- igni_core/core/session/tool_hook_factory.py +131 -0
- igni_core/core/skills/__init__.py +14 -0
- igni_core/core/skills/executor.py +103 -0
- igni_core/core/skills/loader.py +226 -0
- igni_core/core/skills/parser.py +153 -0
- igni_core/core/sub_agent_hitl.py +310 -0
- igni_core/core/text_tags.py +254 -0
- igni_core/core/tools/__init__.py +5 -0
- igni_core/core/tools/async_fire_and_forget.py +62 -0
- igni_core/core/tools/custom_loader.py +330 -0
- igni_core/core/tools/custom_loader_schemas.py +161 -0
- igni_core/core/tools/edit.py +313 -0
- igni_core/core/tools/finished_process.py +153 -0
- igni_core/core/tools/http_fetcher.py +199 -0
- igni_core/core/tools/loop.py +184 -0
- igni_core/core/tools/loop_progress.py +120 -0
- igni_core/core/tools/lsp.py +94 -0
- igni_core/core/tools/managed_process.py +356 -0
- igni_core/core/tools/monitors.py +88 -0
- igni_core/core/tools/notebook/__init__.py +35 -0
- igni_core/core/tools/notebook/document.py +170 -0
- igni_core/core/tools/notebook/schemas.py +313 -0
- igni_core/core/tools/notebook/tools.py +266 -0
- igni_core/core/tools/orchestrate.py +350 -0
- igni_core/core/tools/orchestrate_agent_stream.py +371 -0
- igni_core/core/tools/orchestrate_budget.py +94 -0
- igni_core/core/tools/orchestrate_contracts.py +99 -0
- igni_core/core/tools/orchestrate_events.py +278 -0
- igni_core/core/tools/orchestrate_modes.py +85 -0
- igni_core/core/tools/orchestrate_preview.py +143 -0
- igni_core/core/tools/orchestrate_registry.py +60 -0
- igni_core/core/tools/orchestrate_resumed_agent_stream.py +48 -0
- igni_core/core/tools/orchestrate_resumed_team_stream.py +36 -0
- igni_core/core/tools/orchestrate_sandbox.py +251 -0
- igni_core/core/tools/orchestrate_spawn_agent.py +279 -0
- igni_core/core/tools/orchestrate_spawn_hooks.py +116 -0
- igni_core/core/tools/orchestrate_spawn_runner.py +241 -0
- igni_core/core/tools/orchestrate_spawn_team.py +199 -0
- igni_core/core/tools/orchestrate_spawn_types.py +397 -0
- igni_core/core/tools/orchestrate_stream_context.py +91 -0
- igni_core/core/tools/orchestrate_stream_finalize.py +145 -0
- igni_core/core/tools/orchestrate_stream_handler.py +224 -0
- igni_core/core/tools/orchestrate_stream_state.py +122 -0
- igni_core/core/tools/orchestrate_streaming.py +46 -0
- igni_core/core/tools/orchestrate_symbols.py +61 -0
- igni_core/core/tools/orchestrate_team_stream.py +357 -0
- igni_core/core/tools/orphan_process.py +297 -0
- igni_core/core/tools/orphan_rehydrator.py +210 -0
- igni_core/core/tools/orphan_schemas.py +97 -0
- igni_core/core/tools/output_tail.py +75 -0
- igni_core/core/tools/plan/__init__.py +71 -0
- igni_core/core/tools/plan/researcher.py +110 -0
- igni_core/core/tools/plan/schemas.py +304 -0
- igni_core/core/tools/plan/store.py +211 -0
- igni_core/core/tools/plan/submission.py +244 -0
- igni_core/core/tools/plan/submit_gate.py +96 -0
- igni_core/core/tools/plan/tool.py +178 -0
- igni_core/core/tools/process_bus.py +161 -0
- igni_core/core/tools/process_events.py +113 -0
- igni_core/core/tools/process_eviction.py +100 -0
- igni_core/core/tools/process_log.py +173 -0
- igni_core/core/tools/process_persistence.py +127 -0
- igni_core/core/tools/process_registry.py +348 -0
- igni_core/core/tools/process_registry_schemas.py +173 -0
- igni_core/core/tools/process_store.py +280 -0
- igni_core/core/tools/process_store_schemas.py +165 -0
- igni_core/core/tools/process_supervisor.py +295 -0
- igni_core/core/tools/process_supervisor_locator.py +51 -0
- igni_core/core/tools/registry.py +319 -0
- igni_core/core/tools/schedule.py +117 -0
- igni_core/core/tools/shell.py +408 -0
- igni_core/core/tools/shell_config.py +38 -0
- igni_core/core/tools/slash.py +170 -0
- igni_core/core/tools/sleep_blocker.py +122 -0
- igni_core/core/tools/spawn_args.py +80 -0
- igni_core/core/tools/spawn_context.py +227 -0
- igni_core/core/tools/subagent_stream.py +221 -0
- igni_core/core/tools/todo.py +316 -0
- igni_core/core/tools/tool_result.py +59 -0
- igni_core/core/tools/tool_spec.py +595 -0
- igni_core/core/tools/visualize.py +123 -0
- igni_core/core/tools/visualize_schemas.py +99 -0
- igni_core/core/tools/web.py +84 -0
- igni_core/core/tools/web_schemas.py +143 -0
- igni_core/core/utils/__init__.py +1 -0
- igni_core/core/utils/attachment_store.py +246 -0
- igni_core/core/utils/audit.py +124 -0
- igni_core/core/utils/audit_schemas.py +283 -0
- igni_core/core/utils/context.py +223 -0
- igni_core/core/utils/context_frontmatter.py +118 -0
- igni_core/core/utils/context_imports.py +181 -0
- igni_core/core/utils/context_loader.py +226 -0
- igni_core/core/utils/context_managed.py +93 -0
- igni_core/core/utils/context_memory.py +211 -0
- igni_core/core/utils/context_memory_paths.py +73 -0
- igni_core/core/utils/context_memory_prompt.py +144 -0
- igni_core/core/utils/context_project.py +156 -0
- igni_core/core/utils/context_readers.py +145 -0
- igni_core/core/utils/context_schemas.py +185 -0
- igni_core/core/utils/context_user.py +98 -0
- igni_core/core/utils/display.py +106 -0
- igni_core/core/utils/display_schemas.py +93 -0
- igni_core/core/utils/file_index.py +168 -0
- igni_core/core/utils/http_retry.py +144 -0
- igni_core/core/utils/markdown_command_frontmatter.py +130 -0
- igni_core/core/utils/markdown_command_renderer.py +232 -0
- igni_core/core/utils/markdown_commands.py +204 -0
- igni_core/core/utils/media.py +239 -0
- igni_core/core/utils/media_schemas.py +290 -0
- igni_core/core/utils/memory_files.py +243 -0
- igni_core/core/utils/mentions.py +48 -0
- igni_core/core/utils/response.py +140 -0
- igni_core/core/utils/rules_index.py +339 -0
- igni_core/core/utils/tips.py +282 -0
- igni_core/core/utils/update_checker.py +300 -0
- igni_core/core/utils/update_checker_schemas.py +205 -0
- igni_core/core/workspace.py +66 -0
- igni_core/core/workspace_trust/__init__.py +60 -0
- igni_core/core/workspace_trust/decision.py +57 -0
- igni_core/core/workspace_trust/exceptions.py +16 -0
- igni_core/core/workspace_trust/gate.py +33 -0
- igni_core/core/workspace_trust/identity.py +174 -0
- igni_core/core/workspace_trust/policy.py +80 -0
- igni_core/core/workspace_trust/process.py +55 -0
- igni_core/core/workspace_trust/run_trust.py +53 -0
- igni_core/core/workspace_trust/service.py +256 -0
- igni_core/core/workspace_trust/store.py +134 -0
- igni_core/core/worktree.py +453 -0
- igni_core/decisions_server/__init__.py +8 -0
- igni_core/decisions_server/__main__.py +122 -0
- igni_core/decisions_server/app.py +131 -0
- igni_core/decisions_server/model.py +246 -0
- igni_core/extensions/__init__.py +41 -0
- igni_core/extensions/assets.py +397 -0
- igni_core/extensions/bundle_signature.py +184 -0
- igni_core/extensions/bundle_source.py +133 -0
- igni_core/extensions/busy.py +68 -0
- igni_core/extensions/contributions.py +607 -0
- igni_core/extensions/distribution/__init__.py +63 -0
- igni_core/extensions/distribution/bundle.py +75 -0
- igni_core/extensions/distribution/client.py +139 -0
- igni_core/extensions/distribution/constants.py +24 -0
- igni_core/extensions/distribution/errors.py +12 -0
- igni_core/extensions/distribution/once.py +104 -0
- igni_core/extensions/distribution/schemas.py +144 -0
- igni_core/extensions/distribution/sync.py +305 -0
- igni_core/extensions/event_pull.py +160 -0
- igni_core/extensions/events.py +42 -0
- igni_core/extensions/extension_settings.py +72 -0
- igni_core/extensions/faults.py +116 -0
- igni_core/extensions/health.py +306 -0
- igni_core/extensions/host/__init__.py +29 -0
- igni_core/extensions/host/activity.py +87 -0
- igni_core/extensions/host/answers.py +75 -0
- igni_core/extensions/host/attachments.py +30 -0
- igni_core/extensions/host/backend.py +150 -0
- igni_core/extensions/host/backend_gateway.py +70 -0
- igni_core/extensions/host/broadcasts/__init__.py +29 -0
- igni_core/extensions/host/broadcasts/approval_signals.py +78 -0
- igni_core/extensions/host/broadcasts/chat_signals.py +178 -0
- igni_core/extensions/host/broadcasts/deferred_reads.py +60 -0
- igni_core/extensions/host/broadcasts/file_edits.py +52 -0
- igni_core/extensions/host/broadcasts/push_reads.py +88 -0
- igni_core/extensions/host/broadcasts/push_signals.py +282 -0
- igni_core/extensions/host/broadcasts/router.py +67 -0
- igni_core/extensions/host/broadcasts/rpc_writes.py +216 -0
- igni_core/extensions/host/broadcasts/run_signals.py +96 -0
- igni_core/extensions/host/broadcasts/session_values.py +72 -0
- igni_core/extensions/host/broadcasts/signal.py +49 -0
- igni_core/extensions/host/broadcasts/status.py +46 -0
- igni_core/extensions/host/broadcasts/task_signals.py +150 -0
- igni_core/extensions/host/broadcasts/translators.py +78 -0
- igni_core/extensions/host/broadcasts/views.py +65 -0
- igni_core/extensions/host/call_scope.py +84 -0
- igni_core/extensions/host/caller.py +36 -0
- igni_core/extensions/host/channel.py +293 -0
- igni_core/extensions/host/coverage.py +354 -0
- igni_core/extensions/host/definition.py +2399 -0
- igni_core/extensions/host/display.py +58 -0
- igni_core/extensions/host/errors.py +48 -0
- igni_core/extensions/host/extension_directory.py +88 -0
- igni_core/extensions/host/external_link.py +37 -0
- igni_core/extensions/host/grants.py +102 -0
- igni_core/extensions/host/hook_exchange.py +140 -0
- igni_core/extensions/host/hooks.py +287 -0
- igni_core/extensions/host/host_state.py +47 -0
- igni_core/extensions/host/local_notices.py +27 -0
- igni_core/extensions/host/member_table.py +65 -0
- igni_core/extensions/host/members/__init__.py +78 -0
- igni_core/extensions/host/members/account.py +33 -0
- igni_core/extensions/host/members/agents.py +60 -0
- igni_core/extensions/host/members/answers.py +43 -0
- igni_core/extensions/host/members/app.py +150 -0
- igni_core/extensions/host/members/approvals.py +89 -0
- igni_core/extensions/host/members/base.py +72 -0
- igni_core/extensions/host/members/call.py +88 -0
- igni_core/extensions/host/members/chat.py +155 -0
- igni_core/extensions/host/members/chat_views.py +79 -0
- igni_core/extensions/host/members/choice.py +28 -0
- igni_core/extensions/host/members/commands.py +70 -0
- igni_core/extensions/host/members/decide.py +53 -0
- igni_core/extensions/host/members/extension.py +63 -0
- igni_core/extensions/host/members/hooks.py +31 -0
- igni_core/extensions/host/members/loop.py +48 -0
- igni_core/extensions/host/members/mcp.py +68 -0
- igni_core/extensions/host/members/models.py +123 -0
- igni_core/extensions/host/members/notifications.py +59 -0
- igni_core/extensions/host/members/params.py +26 -0
- igni_core/extensions/host/members/permissions.py +51 -0
- igni_core/extensions/host/members/plan.py +43 -0
- igni_core/extensions/host/members/plugins.py +97 -0
- igni_core/extensions/host/members/policy.py +23 -0
- igni_core/extensions/host/members/processes.py +52 -0
- igni_core/extensions/host/members/reads.py +68 -0
- igni_core/extensions/host/members/scheduler.py +65 -0
- igni_core/extensions/host/members/sessions.py +97 -0
- igni_core/extensions/host/members/tag.py +68 -0
- igni_core/extensions/host/members/tasks.py +23 -0
- igni_core/extensions/host/members/ui.py +226 -0
- igni_core/extensions/host/members/ui_values.py +102 -0
- igni_core/extensions/host/members/workflows.py +49 -0
- igni_core/extensions/host/members/workspace.py +81 -0
- igni_core/extensions/host/model.py +118 -0
- igni_core/extensions/host/model_config.py +40 -0
- igni_core/extensions/host/observations.py +107 -0
- igni_core/extensions/host/page_channel.py +101 -0
- igni_core/extensions/host/plain.py +24 -0
- igni_core/extensions/host/processes.py +103 -0
- igni_core/extensions/host/project_paths.py +55 -0
- igni_core/extensions/host/published.py +35 -0
- igni_core/extensions/host/pushes.py +78 -0
- igni_core/extensions/host/request_binder.py +127 -0
- igni_core/extensions/host/rpc_wire/__init__.py +9 -0
- igni_core/extensions/host/rpc_wire/base.py +46 -0
- igni_core/extensions/host/rpc_wire/chat.py +74 -0
- igni_core/extensions/host/rpc_wire/notifications.py +57 -0
- igni_core/extensions/host/rpc_wire/sessions.py +12 -0
- igni_core/extensions/host/rpc_wire/settings.py +82 -0
- igni_core/extensions/host/rpc_wire/status.py +62 -0
- igni_core/extensions/host/rpc_wire/work.py +67 -0
- igni_core/extensions/host/rpc_wire/workspace.py +21 -0
- igni_core/extensions/host/rpc_write.py +35 -0
- igni_core/extensions/host/services.py +113 -0
- igni_core/extensions/host/session_target.py +123 -0
- igni_core/extensions/host/signal_values.py +83 -0
- igni_core/extensions/host/signals.py +256 -0
- igni_core/extensions/host/spec.py +525 -0
- igni_core/extensions/host/state/__init__.py +6 -0
- igni_core/extensions/host/state/approvals.py +103 -0
- igni_core/extensions/host/state/runs.py +35 -0
- igni_core/extensions/host/state/status.py +21 -0
- igni_core/extensions/host/tools.py +67 -0
- igni_core/extensions/host/types.py +113 -0
- igni_core/extensions/host/values.py +319 -0
- igni_core/extensions/host/window_changes.py +144 -0
- igni_core/extensions/host/window_dialogs.py +54 -0
- igni_core/extensions/host/window_errors.py +25 -0
- igni_core/extensions/host/window_field.py +121 -0
- igni_core/extensions/host/window_field_handlers.py +221 -0
- igni_core/extensions/host/window_fields.py +88 -0
- igni_core/extensions/host/window_registry.py +177 -0
- igni_core/extensions/host/window_rpc.py +213 -0
- igni_core/extensions/host/window_signals.py +250 -0
- igni_core/extensions/host/window_state.py +115 -0
- igni_core/extensions/host/window_values.py +306 -0
- igni_core/extensions/host/windows.py +278 -0
- igni_core/extensions/host/wire.py +237 -0
- igni_core/extensions/host/work.py +38 -0
- igni_core/extensions/host/workspace_scope.py +81 -0
- igni_core/extensions/impact.py +640 -0
- igni_core/extensions/install_context.py +40 -0
- igni_core/extensions/install_contributions.py +219 -0
- igni_core/extensions/install_environment.py +207 -0
- igni_core/extensions/install_errors.py +18 -0
- igni_core/extensions/install_preflight.py +194 -0
- igni_core/extensions/install_process.py +154 -0
- igni_core/extensions/install_runtime.py +189 -0
- igni_core/extensions/install_service.py +250 -0
- igni_core/extensions/installer.py +296 -0
- igni_core/extensions/launcher.py +84 -0
- igni_core/extensions/listing.py +141 -0
- igni_core/extensions/manifest.py +770 -0
- igni_core/extensions/manifest_errors.py +156 -0
- igni_core/extensions/mcp_manager.py +85 -0
- igni_core/extensions/origin.py +668 -0
- igni_core/extensions/permissions.py +499 -0
- igni_core/extensions/principal.py +134 -0
- igni_core/extensions/profile.py +98 -0
- igni_core/extensions/provenance.py +89 -0
- igni_core/extensions/python_env.py +352 -0
- igni_core/extensions/registry.py +345 -0
- igni_core/extensions/rpc.py +176 -0
- igni_core/extensions/sandbox/__init__.py +58 -0
- igni_core/extensions/sandbox/appcontainer.py +495 -0
- igni_core/extensions/sandbox/bridge.py +101 -0
- igni_core/extensions/sandbox/bubblewrap.py +172 -0
- igni_core/extensions/sandbox/launcher.py +422 -0
- igni_core/extensions/sandbox/mechanism.py +304 -0
- igni_core/extensions/sandbox/plan.py +279 -0
- igni_core/extensions/sandbox/proxy.py +489 -0
- igni_core/extensions/sandbox/seatbelt.py +241 -0
- igni_core/extensions/sandbox/settings.py +174 -0
- igni_core/extensions/sandbox/winapi.py +512 -0
- igni_core/extensions/sandbox/winbridge.py +802 -0
- igni_core/extensions/service.py +165 -0
- igni_core/extensions/service_attachments.py +81 -0
- igni_core/extensions/service_events.py +278 -0
- igni_core/extensions/service_items.py +78 -0
- igni_core/extensions/service_landing.py +230 -0
- igni_core/extensions/service_threads.py +205 -0
- igni_core/extensions/service_token.py +531 -0
- igni_core/extensions/settings_values.py +148 -0
- igni_core/extensions/store.py +283 -0
- igni_core/extensions/store_errors.py +40 -0
- igni_core/extensions/web_home.py +46 -0
- igni_core/migrations/env.py +78 -0
- igni_core/migrations/script.py.mako +28 -0
- igni_core/migrations/versions/4f7a1c2e9b3d_add_loop_tables.py +58 -0
- igni_core/migrations/versions/8c2e7b1a4f9d_loop_cap_explicit.py +38 -0
- igni_core/migrations/versions/9318ebdb0db5_initial_sqlite_schema.py +65 -0
- igni_core/migrations/versions/a1d6e3f9c2b7_queued_messages_taken_until_recorded.py +33 -0
- igni_core/migrations/versions/a9c4e2f7d1b6_delivered_events.py +42 -0
- igni_core/migrations/versions/b3a8c2e5d4f1_add_background_processes_table.py +62 -0
- igni_core/migrations/versions/b5d8e1c3a7f9_service_threads.py +61 -0
- igni_core/migrations/versions/b8e2f4a6d1c3_waiting_spawns.py +46 -0
- igni_core/migrations/versions/c4d7a2e9f5b1_turn_results.py +42 -0
- igni_core/migrations/versions/c7f1a9e2d8b4_background_process_history.py +47 -0
- igni_core/migrations/versions/d4e5f6a7b8c9_drop_code_index_tables.py +72 -0
- igni_core/migrations/versions/d6e1f3a8b2c4_extension_settings.py +41 -0
- igni_core/migrations/versions/e3b9d4a1c6f2_scope_every_table.py +303 -0
- igni_core/migrations/versions/f7c2a8e4b1d3_waiting_approvals_and_queued_messages.py +80 -0
- igni_core/notifications/__init__.py +8 -0
- igni_core/notifications/center.py +278 -0
- igni_core/notifications/extension_notices.py +141 -0
- igni_core/notifications/local_store.py +191 -0
- igni_core/notifications/schemas.py +277 -0
- igni_core/notifications/server_client.py +149 -0
- igni_core/notifications/stream.py +319 -0
- igni_core/prefetch_models.py +43 -0
- igni_core/protocol/__init__.py +8 -0
- igni_core/protocol/agno_compat.py +60 -0
- igni_core/protocol/agno_taxonomy.py +122 -0
- igni_core/protocol/agno_tool_formatter.py +349 -0
- igni_core/protocol/edit_diff_computer.py +314 -0
- igni_core/protocol/event_handlers.py +439 -0
- igni_core/protocol/json_value.py +30 -0
- igni_core/protocol/messages.py +36 -0
- igni_core/protocol/redaction.py +30 -0
- igni_core/protocol/registry.py +101 -0
- igni_core/protocol/rpc.py +459 -0
- igni_core/protocol/rpc_contract.py +436 -0
- igni_core/protocol/schemas/__init__.py +220 -0
- igni_core/protocol/schemas/be_events.py +570 -0
- igni_core/protocol/schemas/enums.py +337 -0
- igni_core/protocol/schemas/envelope.py +199 -0
- igni_core/protocol/schemas/fe_actions.py +218 -0
- igni_core/protocol/schemas/internal.py +95 -0
- igni_core/protocol/schemas/mirroring.py +109 -0
- igni_core/protocol/schemas/push.py +198 -0
- igni_core/protocol/schemas/push_payloads.py +139 -0
- igni_core/protocol/schemas/rpc.py +158 -0
- igni_core/protocol/schemas/wire.py +174 -0
- igni_core/protocol/serializer.py +191 -0
- igni_core/protocol/tool_error_conventions.py +162 -0
- igni_core/protocol/tool_friendly_names.py +97 -0
- igni_core/transport/__init__.py +11 -0
- igni_core/transport/_ws_client.py +88 -0
- igni_core/transport/base.py +103 -0
- igni_core/transport/chunk_trace.py +116 -0
- igni_core/transport/composite.py +181 -0
- igni_core/transport/in_process.py +69 -0
- igni_core/transport/ndjson_stream.py +118 -0
- igni_core/transport/unix_socket.py +124 -0
- igni_core/transport/websocket.py +400 -0
- igni_core/transport/ws_auth.py +295 -0
- igni_core-1.0.4.dist-info/METADATA +399 -0
- igni_core-1.0.4.dist-info/RECORD +1038 -0
- igni_core-1.0.4.dist-info/WHEEL +4 -0
- igni_core-1.0.4.dist-info/entry_points.txt +3 -0
- igni_core-1.0.4.dist-info/licenses/LICENSE +202 -0
- igni_core-1.0.4.dist-info/licenses/NOTICE +5 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"""Typed Pydantic event models for the process-lifecycle event bus.
|
|
2
|
+
|
|
3
|
+
Replaces the anonymous ``dict[str, Any]`` payloads that
|
|
4
|
+
:class:`igni_core.core.tools.process_bus.ProcessEventBus` used to
|
|
5
|
+
fire. Rule 1 (typed schemas over raw dicts) + Pattern 2
|
|
6
|
+
(discriminated unions instead of adhoc dict shapes).
|
|
7
|
+
|
|
8
|
+
Three events; the discriminator field is ``type``:
|
|
9
|
+
|
|
10
|
+
* :class:`ProcessStartEvent` — ``type="start"``. Fired once when a
|
|
11
|
+
backgrounded process is registered.
|
|
12
|
+
* :class:`ProcessLineEvent` — ``type="line"``. Fired per stdout/
|
|
13
|
+
stderr line. Hot path — construction cost matters.
|
|
14
|
+
* :class:`ProcessExitEvent` — ``type="exit"``. Fired once when the
|
|
15
|
+
process exits (cleanly or on kill).
|
|
16
|
+
|
|
17
|
+
``EventType`` moved here from ``process_bus.py`` so the bus and the
|
|
18
|
+
payload models share one source of truth.
|
|
19
|
+
|
|
20
|
+
Subscribers receive the event model itself, never a mapping:
|
|
21
|
+
:class:`~igni_core.core.tools.process_bus.ProcessEventBus` routes on
|
|
22
|
+
the ``type`` discriminator, so the callback registered for ``"line"``
|
|
23
|
+
is handed a :class:`ProcessLineEvent` and can read its fields
|
|
24
|
+
directly.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from __future__ import annotations
|
|
28
|
+
|
|
29
|
+
from collections.abc import Callable
|
|
30
|
+
from typing import Annotated, Literal
|
|
31
|
+
|
|
32
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
33
|
+
|
|
34
|
+
EventType = Literal["start", "line", "exit"]
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ProcessStartEvent(BaseModel):
|
|
38
|
+
"""A backgrounded process has been registered.
|
|
39
|
+
|
|
40
|
+
Payload matches the pre-refactor dict:
|
|
41
|
+
``{pid, cmd, started_at}`` where ``started_at`` is a wall-clock
|
|
42
|
+
epoch (``time.time()``), not a monotonic value — subscribers use
|
|
43
|
+
it for FE display so it must survive process boundaries.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
# ``.model_construct()`` allowed on hot paths; construction still
|
|
47
|
+
# needs to be cheap.
|
|
48
|
+
model_config = ConfigDict(frozen=True)
|
|
49
|
+
|
|
50
|
+
type: Literal["start"] = "start"
|
|
51
|
+
pid: int
|
|
52
|
+
cmd: str
|
|
53
|
+
started_at: float
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class ProcessLineEvent(BaseModel):
|
|
57
|
+
"""One stdout/stderr line from the reader task. Hot path — the
|
|
58
|
+
reader may fire thousands per second on a chatty log."""
|
|
59
|
+
|
|
60
|
+
model_config = ConfigDict(frozen=True)
|
|
61
|
+
|
|
62
|
+
type: Literal["line"] = "line"
|
|
63
|
+
pid: int
|
|
64
|
+
line: str
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class ProcessExitEvent(BaseModel):
|
|
68
|
+
"""A backgrounded process has exited.
|
|
69
|
+
|
|
70
|
+
``exit_code`` is ``None`` for orphans whose exit status was
|
|
71
|
+
reaped by init/launchd rather than us. ``duration_seconds`` uses
|
|
72
|
+
monotonic elapsed for live processes; for orphans the reader
|
|
73
|
+
task doesn't fire this event at all (orphans never emit ``exit``
|
|
74
|
+
because we never got the process handle to ``wait`` on).
|
|
75
|
+
"""
|
|
76
|
+
|
|
77
|
+
model_config = ConfigDict(frozen=True)
|
|
78
|
+
|
|
79
|
+
type: Literal["exit"] = "exit"
|
|
80
|
+
pid: int
|
|
81
|
+
cmd: str
|
|
82
|
+
exit_code: int | None
|
|
83
|
+
duration_seconds: float
|
|
84
|
+
output_tail: str
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
# Discriminated union — subscribers switch on ``.type`` to narrow.
|
|
88
|
+
ProcessEvent = Annotated[
|
|
89
|
+
ProcessStartEvent | ProcessLineEvent | ProcessExitEvent,
|
|
90
|
+
Field(discriminator="type"),
|
|
91
|
+
]
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
# Typed subscriber contracts. They live here (next to the payload
|
|
95
|
+
# models) rather than in ``shell.py`` per the OOP audit's
|
|
96
|
+
# data-and-behavior-together finding — the callback contract
|
|
97
|
+
# belongs alongside the discriminated union it consumes.
|
|
98
|
+
#
|
|
99
|
+
# ``ProcessEventCallback`` is the union-wide shape: every event the
|
|
100
|
+
# bus can fire. The per-event aliases are the narrow shapes —
|
|
101
|
+
# :class:`~igni_core.core.tools.process_bus.ProcessEventBus` binds
|
|
102
|
+
# them to the event names through its overloads, so a subscriber
|
|
103
|
+
# that reads ``event.pid`` and ``event.line`` is typed for exactly
|
|
104
|
+
# the event it registered against.
|
|
105
|
+
#
|
|
106
|
+
# The bus stores subscribers under the union-wide shape. That is
|
|
107
|
+
# sound because the bus routes on the payload's own ``type``
|
|
108
|
+
# discriminator: the callback registered for ``"start"`` only ever
|
|
109
|
+
# sees a ``ProcessStartEvent``.
|
|
110
|
+
ProcessEventCallback = Callable[[ProcessEvent], None]
|
|
111
|
+
StartSubscriber = Callable[[ProcessStartEvent], None]
|
|
112
|
+
LineSubscriber = Callable[[ProcessLineEvent], None]
|
|
113
|
+
ExitSubscriber = Callable[[ProcessExitEvent], None]
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"""Per-pid eviction of finished processes.
|
|
2
|
+
|
|
3
|
+
Split out of :mod:`igni_core.core.tools.process_registry` so the
|
|
4
|
+
registry holds the processes and this holds the timers that take
|
|
5
|
+
finished ones out of it. Two concerns, two classes: the registry
|
|
6
|
+
owns the pid map, this owns the TTL knob and the task handles.
|
|
7
|
+
|
|
8
|
+
The task body lives here; what "evicting" means does not — the
|
|
9
|
+
registry hands in the callback the task runs when the TTL expires,
|
|
10
|
+
so the map stays in one place and the timer stays in another.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import asyncio
|
|
16
|
+
import threading
|
|
17
|
+
from collections.abc import Callable
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
from igni_core.core.activity import background
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ProcessEviction:
|
|
24
|
+
"""Owns the finished-process TTL and the per-pid eviction tasks.
|
|
25
|
+
|
|
26
|
+
One instance per registry. The TTL is read fresh on every
|
|
27
|
+
:meth:`arm`, so a change to it takes effect on the next arm
|
|
28
|
+
rather than on the next restart.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
def __init__(self, ttl_seconds: float) -> None:
|
|
32
|
+
self._ttl_seconds = ttl_seconds
|
|
33
|
+
self._tasks: dict[int, asyncio.Task[Any]] = {}
|
|
34
|
+
self._lock = threading.Lock()
|
|
35
|
+
|
|
36
|
+
@property
|
|
37
|
+
def ttl_seconds(self) -> float:
|
|
38
|
+
"""Current finished-process eviction TTL."""
|
|
39
|
+
return self._ttl_seconds
|
|
40
|
+
|
|
41
|
+
def set_ttl_seconds(self, seconds: float) -> None:
|
|
42
|
+
"""Override the finished-process eviction TTL."""
|
|
43
|
+
self._ttl_seconds = seconds
|
|
44
|
+
|
|
45
|
+
def arm(self, pid: int, expire: Callable[[], None]) -> None:
|
|
46
|
+
"""Arm (or refresh) the eviction task for ``pid``.
|
|
47
|
+
|
|
48
|
+
Cancels the task already armed for the pid first, so the TTL
|
|
49
|
+
counts from the most recent arm rather than from the first
|
|
50
|
+
one — the point of the TTL is "ten minutes after the last
|
|
51
|
+
time anyone looked at this".
|
|
52
|
+
|
|
53
|
+
``expire`` is what the task calls when the TTL runs out. It
|
|
54
|
+
runs on the event loop, not under this class's lock. Called
|
|
55
|
+
with no running loop, it arms nothing and does not raise.
|
|
56
|
+
"""
|
|
57
|
+
self.cancel(pid)
|
|
58
|
+
try:
|
|
59
|
+
asyncio.get_running_loop()
|
|
60
|
+
except RuntimeError:
|
|
61
|
+
# No loop, no timer: there is nothing that could ever run the
|
|
62
|
+
# expiry, and the caller (a sync path) cannot do anything
|
|
63
|
+
# about it. Same rule as the persistence writes.
|
|
64
|
+
return
|
|
65
|
+
ttl = self._ttl_seconds
|
|
66
|
+
|
|
67
|
+
async def _evict() -> None:
|
|
68
|
+
try:
|
|
69
|
+
await asyncio.sleep(ttl)
|
|
70
|
+
except asyncio.CancelledError:
|
|
71
|
+
return
|
|
72
|
+
expire()
|
|
73
|
+
|
|
74
|
+
with self._lock:
|
|
75
|
+
self._tasks[pid] = background.daemon(_evict(), name=f"process-evict-{pid}")
|
|
76
|
+
|
|
77
|
+
def forget(self, pid: int) -> None:
|
|
78
|
+
"""Drop the task handle for ``pid`` without cancelling it.
|
|
79
|
+
|
|
80
|
+
The expiry path uses this: the task is done, so there is
|
|
81
|
+
nothing left to cancel.
|
|
82
|
+
"""
|
|
83
|
+
with self._lock:
|
|
84
|
+
self._tasks.pop(pid, None)
|
|
85
|
+
|
|
86
|
+
def cancel(self, pid: int) -> None:
|
|
87
|
+
"""Cancel the eviction task for ``pid`` and forget it."""
|
|
88
|
+
with self._lock:
|
|
89
|
+
task = self._tasks.pop(pid, None)
|
|
90
|
+
if task is not None and not task.done():
|
|
91
|
+
task.cancel()
|
|
92
|
+
|
|
93
|
+
def cancel_all(self) -> None:
|
|
94
|
+
"""Cancel every armed task and forget them all."""
|
|
95
|
+
with self._lock:
|
|
96
|
+
tasks = list(self._tasks.values())
|
|
97
|
+
self._tasks.clear()
|
|
98
|
+
for task in tasks:
|
|
99
|
+
if not task.done():
|
|
100
|
+
task.cancel()
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"""Per-pid log files for backgrounded shell processes.
|
|
2
|
+
|
|
3
|
+
The in-memory ``ManagedProcess.output`` buffer is the live source
|
|
4
|
+
of truth — fast, lock-protected, hot-path-friendly. But it dies
|
|
5
|
+
with the BE. The watcher's orphan-rehydrate path (BE restart →
|
|
6
|
+
process survived) can't reach it.
|
|
7
|
+
|
|
8
|
+
This module gives backgrounded processes a durable companion: a
|
|
9
|
+
single tail-able log file per pid under
|
|
10
|
+
``<project_dir>/.igni/process_logs/<pid>.log``. The reader task
|
|
11
|
+
appends each decoded line to the file alongside the in-memory
|
|
12
|
+
buffer; :meth:`~igni_core.core.tools.orphan_process.OrphanProcess.read`
|
|
13
|
+
reads from the file when the in-memory buffer is gone.
|
|
14
|
+
|
|
15
|
+
OOP anchor: this file is the OOP reference for per-pid log
|
|
16
|
+
storage. :class:`ProcessLogStore` owns a single ``project_dir``
|
|
17
|
+
field and exposes :meth:`path`, :meth:`open`, :meth:`tail`,
|
|
18
|
+
:meth:`cleanup` as instance methods — no free functions, no
|
|
19
|
+
module-level mutable state. The store is owned as
|
|
20
|
+
``ProcessSupervisor.log_store`` so every consumer reaches it via
|
|
21
|
+
the supervisor rather than a module global.
|
|
22
|
+
|
|
23
|
+
Lifecycle of a :class:`ProcessLogStore`:
|
|
24
|
+
|
|
25
|
+
* Constructor takes ``project_dir: str | Path | None``. ``None``
|
|
26
|
+
falls back to ``$TMPDIR/igni-process-logs/`` so the store is
|
|
27
|
+
functional in test / headless contexts without forcing every
|
|
28
|
+
caller to plumb a path.
|
|
29
|
+
* :meth:`path` — deterministic path for a pid. Both writer +
|
|
30
|
+
orphan reader resolve it the same way.
|
|
31
|
+
* :meth:`open` — opens the file in append mode, creating parent
|
|
32
|
+
dirs if needed. Returned object is closeable; the reader holds
|
|
33
|
+
it for the process's lifetime.
|
|
34
|
+
* :meth:`tail` — read last ``n`` lines without slurping the
|
|
35
|
+
whole file. Used by the orphan's ``read`` method.
|
|
36
|
+
* :meth:`cleanup` — delete the file. Called from the registry's
|
|
37
|
+
TTL eviction path so finished processes don't leak files
|
|
38
|
+
indefinitely.
|
|
39
|
+
* :meth:`set_project_dir` — mutation is gated to a single setter,
|
|
40
|
+
called only during rehydrate wiring by
|
|
41
|
+
:meth:`ProcessSupervisor.configure_log_store`, never in steady
|
|
42
|
+
state.
|
|
43
|
+
|
|
44
|
+
The path is stable for the pid's lifetime, but pid reuse across
|
|
45
|
+
restarts is technically possible — we accept that the new
|
|
46
|
+
spawn's log file will start with leftover content from a
|
|
47
|
+
previous incarnation, which the writer's append-only mode
|
|
48
|
+
preserves until cleanup runs.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
from __future__ import annotations
|
|
52
|
+
|
|
53
|
+
import contextlib
|
|
54
|
+
import io
|
|
55
|
+
import logging
|
|
56
|
+
import os
|
|
57
|
+
import tempfile
|
|
58
|
+
from pathlib import Path
|
|
59
|
+
|
|
60
|
+
from igni_core.core.paths import CONFIG_DIR
|
|
61
|
+
|
|
62
|
+
logger = logging.getLogger(__name__)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class ProcessLogStore:
|
|
66
|
+
"""Owns the per-pid log file layout under a single project root.
|
|
67
|
+
|
|
68
|
+
The ``project_dir`` is an instance field, not a module global —
|
|
69
|
+
every consumer that needs per-pid logging holds a reference to
|
|
70
|
+
a store (typically via ``ProcessSupervisor.log_store``) rather
|
|
71
|
+
than reaching for a module-level default.
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
def __init__(self, project_dir: str | Path | None = None) -> None:
|
|
75
|
+
self._project_dir: str | Path | None = project_dir
|
|
76
|
+
|
|
77
|
+
@property
|
|
78
|
+
def project_dir(self) -> str | Path | None:
|
|
79
|
+
"""Current project root the store writes under. ``None``
|
|
80
|
+
means "fall back to TMPDIR"."""
|
|
81
|
+
return self._project_dir
|
|
82
|
+
|
|
83
|
+
def set_project_dir(self, project_dir: str | Path | None) -> None:
|
|
84
|
+
"""Rewire the store to a new project root. Called only
|
|
85
|
+
during rehydrate wiring by
|
|
86
|
+
:meth:`ProcessSupervisor.configure_log_store`, never in
|
|
87
|
+
steady state — the ``ManagedProcess`` reader holds an open
|
|
88
|
+
file handle from :meth:`open` for the process's lifetime,
|
|
89
|
+
so changing the root mid-flight would strand its writes
|
|
90
|
+
under the old path. In practice ``configure_log_store``
|
|
91
|
+
runs once at BE startup before any process is spawned."""
|
|
92
|
+
self._project_dir = project_dir
|
|
93
|
+
|
|
94
|
+
def path(self, pid: int) -> Path:
|
|
95
|
+
"""Return ``<project_dir>/.igni/process_logs/<pid>.log``.
|
|
96
|
+
|
|
97
|
+
Falls back to ``$TMPDIR/igni-process-logs/<pid>.log`` when
|
|
98
|
+
no ``project_dir`` was supplied — keeps the writer
|
|
99
|
+
functional in test / headless contexts without forcing
|
|
100
|
+
every caller to plumb a path.
|
|
101
|
+
"""
|
|
102
|
+
if self._project_dir is None:
|
|
103
|
+
root = Path(tempfile.gettempdir()) / "igni-process-logs"
|
|
104
|
+
else:
|
|
105
|
+
root = Path(str(self._project_dir)) / CONFIG_DIR / "process_logs"
|
|
106
|
+
return root / f"{int(pid)}.log"
|
|
107
|
+
|
|
108
|
+
def open(self, pid: int) -> io.TextIOBase | None:
|
|
109
|
+
"""Open the per-pid log file in append mode. Returns
|
|
110
|
+
``None`` when the open fails (read-only filesystem,
|
|
111
|
+
permission error) — callers fall through to in-memory-only
|
|
112
|
+
behaviour, same as before the log files existed. Best-
|
|
113
|
+
effort.
|
|
114
|
+
|
|
115
|
+
Line-buffered (``buffering=1``) so each ``write("…\\n")``
|
|
116
|
+
flushes to disk immediately — without that flush an orphan
|
|
117
|
+
reading mid-stream would see stale tails up to the OS
|
|
118
|
+
buffer's flush cadence.
|
|
119
|
+
"""
|
|
120
|
+
path = self.path(pid)
|
|
121
|
+
try:
|
|
122
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
123
|
+
return open(path, "a", encoding="utf-8", buffering=1, errors="replace")
|
|
124
|
+
except OSError as exc:
|
|
125
|
+
logger.debug("process log open failed for pid=%s: %s", pid, exc)
|
|
126
|
+
return None
|
|
127
|
+
|
|
128
|
+
def lines(self, pid: int) -> list[str]:
|
|
129
|
+
"""Every line of the pid's log file, newlines stripped; empty
|
|
130
|
+
when the file is missing or unreadable. For a tail that says
|
|
131
|
+
how much came before it (:class:`OutputTail`)."""
|
|
132
|
+
path = self.path(pid)
|
|
133
|
+
try:
|
|
134
|
+
with open(path, encoding="utf-8", errors="replace") as f:
|
|
135
|
+
return f.read().rstrip("\n").split("\n") if path.stat().st_size else []
|
|
136
|
+
except FileNotFoundError:
|
|
137
|
+
return []
|
|
138
|
+
except OSError as exc:
|
|
139
|
+
logger.debug("process log read failed for %s: %s", path, exc)
|
|
140
|
+
return []
|
|
141
|
+
|
|
142
|
+
def tail(self, pid: int, n: int = 200) -> str:
|
|
143
|
+
"""Return the last ``n`` lines of the pid's log file as a
|
|
144
|
+
single ``\\n``-joined string. Returns an empty string when
|
|
145
|
+
the file is missing or unreadable — orphan reads default
|
|
146
|
+
to "no output yet" rather than crashing the watcher.
|
|
147
|
+
|
|
148
|
+
Reads the whole file then slices the tail. The file is
|
|
149
|
+
bounded by the writer's natural log volume (a chatty
|
|
150
|
+
dev server might be MBs but not GBs); a more clever
|
|
151
|
+
seek-from-end is possible if we ever hit that ceiling.
|
|
152
|
+
"""
|
|
153
|
+
if n <= 0:
|
|
154
|
+
return ""
|
|
155
|
+
path = self.path(pid)
|
|
156
|
+
try:
|
|
157
|
+
with open(path, encoding="utf-8", errors="replace") as f:
|
|
158
|
+
lines = f.readlines()
|
|
159
|
+
except FileNotFoundError:
|
|
160
|
+
return ""
|
|
161
|
+
except OSError as exc:
|
|
162
|
+
logger.debug("process log tail failed for %s: %s", path, exc)
|
|
163
|
+
return ""
|
|
164
|
+
if not lines:
|
|
165
|
+
return ""
|
|
166
|
+
return "".join(lines[-n:]).rstrip("\n")
|
|
167
|
+
|
|
168
|
+
def cleanup(self, pid: int) -> None:
|
|
169
|
+
"""Best-effort delete of a pid's log file. Idempotent —
|
|
170
|
+
no-op when the file's already gone."""
|
|
171
|
+
path = self.path(pid)
|
|
172
|
+
with contextlib.suppress(FileNotFoundError, OSError):
|
|
173
|
+
os.remove(path)
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"""Fire-and-forget persistence of the registry's background-process rows.
|
|
2
|
+
|
|
3
|
+
Split out of :mod:`igni_core.core.tools.process_registry`: writing a
|
|
4
|
+
row is its own concern, with its own collaborator (the store) and its
|
|
5
|
+
own scheduling rule (never in front of the caller). The registry
|
|
6
|
+
decides *when* a row changes; this class decides how that change
|
|
7
|
+
reaches the database.
|
|
8
|
+
|
|
9
|
+
Every write here is scheduled, not awaited. The registry's callers
|
|
10
|
+
are synchronous — the shell tool's spawn path, a reader task, a
|
|
11
|
+
shutdown hook — and a database write must not sit in front of them.
|
|
12
|
+
The store answers with a typed result rather than raising, so a
|
|
13
|
+
failed write is logged with its reason instead of surfacing as an
|
|
14
|
+
exception in a caller that cannot do anything about it.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import logging
|
|
20
|
+
|
|
21
|
+
from igni_core.core.tools.async_fire_and_forget import AsyncFireAndForget
|
|
22
|
+
from igni_core.core.tools.managed_process import process_group_of
|
|
23
|
+
from igni_core.core.tools.process_registry_schemas import (
|
|
24
|
+
BackgroundProcessPersistence,
|
|
25
|
+
TrackedProcess,
|
|
26
|
+
)
|
|
27
|
+
from igni_core.core.tools.process_store_schemas import BackgroundProcessRow
|
|
28
|
+
|
|
29
|
+
logger = logging.getLogger(__name__)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class ProcessPersistenceWriter:
|
|
33
|
+
"""Writes the registry's rows to the store without blocking.
|
|
34
|
+
|
|
35
|
+
One instance per registry. The store handle is attached at
|
|
36
|
+
construction or later (the backend attaches it once the database
|
|
37
|
+
is live); until then every write is a no-op, which is what lets
|
|
38
|
+
the registry exist before the database does.
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
def __init__(self, store: BackgroundProcessPersistence | None = None) -> None:
|
|
42
|
+
self._store = store
|
|
43
|
+
self._scheduler = AsyncFireAndForget()
|
|
44
|
+
|
|
45
|
+
@property
|
|
46
|
+
def store(self) -> BackgroundProcessPersistence | None:
|
|
47
|
+
"""The attached store, or ``None`` when persistence is off."""
|
|
48
|
+
return self._store
|
|
49
|
+
|
|
50
|
+
def attach(self, store: BackgroundProcessPersistence | None) -> None:
|
|
51
|
+
"""Point the writer at a store (``None`` unwires it)."""
|
|
52
|
+
self._store = store
|
|
53
|
+
|
|
54
|
+
def detach(self) -> None:
|
|
55
|
+
"""Unwire the store — the test-isolation path."""
|
|
56
|
+
self._store = None
|
|
57
|
+
|
|
58
|
+
def record_start(self, pid: int, cmd: str) -> None:
|
|
59
|
+
"""Write the row for a process that has just been announced.
|
|
60
|
+
|
|
61
|
+
``os.getpgid`` does not exist on Windows, so asking for the
|
|
62
|
+
name and returning ``None`` where there are no process groups
|
|
63
|
+
is the honest answer: the row then carries ``pgid=None``.
|
|
64
|
+
"""
|
|
65
|
+
store = self._store
|
|
66
|
+
if store is None:
|
|
67
|
+
return
|
|
68
|
+
row = BackgroundProcessRow.new(pid=pid, cmd=cmd, pgid=process_group_of(pid))
|
|
69
|
+
self._scheduler.schedule(self._await_upsert(store, row))
|
|
70
|
+
|
|
71
|
+
def record_end(self, mp: TrackedProcess) -> None:
|
|
72
|
+
"""Write how a process ended, keeping its row as history.
|
|
73
|
+
|
|
74
|
+
The row stays; it gains an exit code and a timestamp, which is
|
|
75
|
+
what makes the table survivable as history rather than a list
|
|
76
|
+
of what happens to be alive.
|
|
77
|
+
"""
|
|
78
|
+
store = self._store
|
|
79
|
+
if store is None:
|
|
80
|
+
return
|
|
81
|
+
self._scheduler.schedule(self._await_finish(store, mp))
|
|
82
|
+
|
|
83
|
+
def forget(self, pid: int) -> None:
|
|
84
|
+
"""Delete the row for a pid that is being torn down."""
|
|
85
|
+
store = self._store
|
|
86
|
+
if store is None:
|
|
87
|
+
return
|
|
88
|
+
self._scheduler.schedule(self._await_remove(store, pid))
|
|
89
|
+
|
|
90
|
+
async def _await_upsert(
|
|
91
|
+
self,
|
|
92
|
+
store: BackgroundProcessPersistence,
|
|
93
|
+
row: BackgroundProcessRow,
|
|
94
|
+
) -> None:
|
|
95
|
+
"""Await ``store.upsert`` and log the reason on failure."""
|
|
96
|
+
result = await store.upsert(row)
|
|
97
|
+
if not result.ok:
|
|
98
|
+
logger.debug("persist_add failed: %s", result.reason)
|
|
99
|
+
|
|
100
|
+
async def _await_finish(
|
|
101
|
+
self,
|
|
102
|
+
store: BackgroundProcessPersistence,
|
|
103
|
+
mp: TrackedProcess,
|
|
104
|
+
) -> None:
|
|
105
|
+
"""Await ``store.finish`` and log the reason on failure.
|
|
106
|
+
|
|
107
|
+
The row is built here, where the command and the start time
|
|
108
|
+
are still to hand. A process that was never announced has no
|
|
109
|
+
row yet, so the ending is written whole — command, start,
|
|
110
|
+
exit code — which is what makes a one-shot survive a restart
|
|
111
|
+
instead of existing only in memory until the backend stops.
|
|
112
|
+
"""
|
|
113
|
+
pid = mp.proc.pid
|
|
114
|
+
row = BackgroundProcessRow(pid=pid, cmd=mp.cmd, pgid=None, started_at=mp.started_epoch)
|
|
115
|
+
result = await store.finish(pid, mp.proc.returncode, row=row)
|
|
116
|
+
if not result.ok:
|
|
117
|
+
logger.debug("persist_finish pid=%s failed: %s", pid, result.reason)
|
|
118
|
+
|
|
119
|
+
async def _await_remove(
|
|
120
|
+
self,
|
|
121
|
+
store: BackgroundProcessPersistence,
|
|
122
|
+
pid: int,
|
|
123
|
+
) -> None:
|
|
124
|
+
"""Await ``store.remove`` and log the reason on failure."""
|
|
125
|
+
result = await store.remove(pid)
|
|
126
|
+
if not result.ok:
|
|
127
|
+
logger.debug("persist_remove pid=%s failed: %s", pid, result.reason)
|