socialcli 0.3.11__tar.gz → 0.3.13__tar.gz
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.
- {socialcli-0.3.11 → socialcli-0.3.13}/PKG-INFO +2 -2
- {socialcli-0.3.11 → socialcli-0.3.13}/pyproject.toml +4 -2
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/agent_errors.py +29 -2
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/agent_guide.py +1 -1
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/agent_journey.py +3 -3
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/agent_recovery.py +22 -7
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/capabilities.yml +69 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/cli.py +88 -33
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/account_cli.py +165 -10
- socialcli-0.3.13/socialctl/connections/brand_binding.py +208 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/cli.py +12 -1
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/client.py +6 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/file_store.py +4 -1
- socialcli-0.3.13/socialctl/connections/rotation_cli.py +185 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/saas_client.py +17 -2
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/context.py +3 -1
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/context_cli.py +1 -1
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/entrypoint.py +2 -2
- socialcli-0.3.13/socialctl/metricas/almacen.py +311 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/resumen.py +83 -3
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/youtube.py +154 -39
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/read_budget.py +173 -31
- socialcli-0.3.13/socialctl/read_checkpoints.py +739 -0
- socialcli-0.3.13/socialctl/stats_recovery.py +67 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/ui/assets/agent-actions.json +352 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/ui/assets/agent-journey.json +109 -3
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/ui/assets/agent-manual.md +50 -4
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/ui/assets/agents.md +3 -3
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/youtube_data.py +42 -3
- socialcli-0.3.11/socialctl/connections/rotation_cli.py +0 -116
- socialcli-0.3.11/socialctl/metricas/almacen.py +0 -133
- socialcli-0.3.11/socialctl/read_checkpoints.py +0 -376
- {socialcli-0.3.11 → socialcli-0.3.13}/.gitignore +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/LICENSE +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/LICENSE-MIT-LEGACY +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/README.md +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/__init__.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/__main__.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/adapters/__init__.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/adapters/base.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/adapters/errores.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/adapters/facebook.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/adapters/instagram.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/adapters/tiktok.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/adapters/youtube.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/approval_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/auth.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/authflow.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/brands.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/capabilities.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/cli_result.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/__init__.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/credential_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/credential_store.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/http_transport.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/keychain.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/meta_user.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/temporary_media.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/connections/token_requests.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/delivery_options.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/engagement.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/engagement_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/executor.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/formatter.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/hosted_media.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/identity.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/inbox.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/inbox_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/inventory.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/inventory_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/inventory_sources.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/__init__.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/batch_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/batches.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/changes.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/comments_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/community_batch_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/community_batches.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/community_changes.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/community_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/community_schema.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/facebook_groups.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/groups_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/inbox_readers.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/meta_changes.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/meta_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/meta_client.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/meta_comment_inbox.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/meta_comments.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/meta_errors.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/meta_pagination.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/meta_schema.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/meta_webhooks.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/metadata_parts.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/owned_assets.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/owned_changes.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/owned_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/owned_reorder.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/owned_schema.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/proposal_routes.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/reply_context.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/reply_evidence.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/resource_changes.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/resource_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/snapshot_diagnostics.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/snippet_readback.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/stories.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/stories_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/youtube.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/youtube_community.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/youtube_metadata.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/youtube_owned.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/management/youtube_resources.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/media.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/media_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/media_ingress.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/media_preflight.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/media_registry.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/media_requirements.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/__init__.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/analytics_changes.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/analytics_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/analytics_client.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/analytics_ingest.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/analytics_schema.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/base.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/facebook.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/insights.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/instagram.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/modelos.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/piezas.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/reach.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/reporting_client.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/slugs.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/metricas/tiktok.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/migration_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/migration_files.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/models.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/__init__.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/api_delivery.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/api_reconcile.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/approval.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/attestations.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/cadence.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/dispatcher.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/facebook.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/facebook_reels.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/first_comment.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/handoff.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/instagram_delivery.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/instagram_runtime.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/inventory.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/migration.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/models.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/planner.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/preflight.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/preparation.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/reconcile.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/remote_data.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/report.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/store.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/verification.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/native_schedule/youtube.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/operation_output.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/plantillas/accounts.yml +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/plantillas/brand.md +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/plantillas/estrategia.md +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/post_cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/postfile.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/preflight.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/preview_exports.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/public_availability.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/publication_approval.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/publication_policy.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/publication_status.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/publication_steps.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/publish_output.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/publisher.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/qa/__init__.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/qa/backend.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/qa/cli.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/qa/guard.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/qa/models.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/qa/runner.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/qa/store.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/qa/transport.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/queue_migration.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/read_reports.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/rutas.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/schedule_remote.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/schedule_sqlite.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/scheduler.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/scheduler_launchd.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/scheduler_systemd.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/source_links.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/ui/__init__.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/ui/assets/cli-result.schema.json +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/upload_consent.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/workspace.py +0 -0
- {socialcli-0.3.11 → socialcli-0.3.13}/socialctl/youtube_data_service.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: socialcli
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.13
|
|
4
4
|
Summary: SocialCli: publish and manage creator-owned social content from the terminal.
|
|
5
5
|
Project-URL: Homepage, https://socialcli.app
|
|
6
6
|
Project-URL: Documentation, https://socialcli.app/ai-agents.html
|
|
@@ -14,7 +14,7 @@ Requires-Dist: httpx>=0.28.1
|
|
|
14
14
|
Requires-Dist: keyring>=25.0
|
|
15
15
|
Requires-Dist: pydantic>=2.13.5
|
|
16
16
|
Requires-Dist: pyyaml>=6.0.3
|
|
17
|
-
Requires-Dist: typer
|
|
17
|
+
Requires-Dist: typer<0.28,>=0.27.2
|
|
18
18
|
Provides-Extra: headless-credentials
|
|
19
19
|
Requires-Dist: cryptography>=43; extra == 'headless-credentials'
|
|
20
20
|
Description-Content-Type: text/markdown
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "socialcli"
|
|
3
|
-
version = "0.3.
|
|
3
|
+
version = "0.3.13"
|
|
4
4
|
description = "SocialCli: publish and manage creator-owned social content from the terminal."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "LicenseRef-SocialCli-Proprietary"
|
|
@@ -12,7 +12,7 @@ dependencies = [
|
|
|
12
12
|
"keyring>=25.0",
|
|
13
13
|
"pydantic>=2.13.5",
|
|
14
14
|
"pyyaml>=6.0.3",
|
|
15
|
-
"typer>=0.27.2",
|
|
15
|
+
"typer>=0.27.2,<0.28",
|
|
16
16
|
]
|
|
17
17
|
|
|
18
18
|
[project.scripts]
|
|
@@ -116,6 +116,7 @@ only-include = [
|
|
|
116
116
|
"socialctl/scheduler_launchd.py",
|
|
117
117
|
"socialctl/scheduler_systemd.py",
|
|
118
118
|
"socialctl/source_links.py",
|
|
119
|
+
"socialctl/stats_recovery.py",
|
|
119
120
|
"socialctl/ui/__init__.py",
|
|
120
121
|
"socialctl/ui/assets/agent-actions.json",
|
|
121
122
|
"socialctl/ui/assets/agent-manual.md",
|
|
@@ -202,6 +203,7 @@ only-include = [
|
|
|
202
203
|
"socialctl/scheduler_launchd.py",
|
|
203
204
|
"socialctl/scheduler_systemd.py",
|
|
204
205
|
"socialctl/source_links.py",
|
|
206
|
+
"socialctl/stats_recovery.py",
|
|
205
207
|
"socialctl/ui/__init__.py",
|
|
206
208
|
"socialctl/ui/assets/agent-actions.json",
|
|
207
209
|
"socialctl/ui/assets/agent-manual.md",
|
|
@@ -18,6 +18,20 @@ _ACTIONS = {
|
|
|
18
18
|
'activation_required': 'recover',
|
|
19
19
|
'subscription_required': 'user_action',
|
|
20
20
|
'brand_limit': 'user_action',
|
|
21
|
+
'brand_consent_required': 'user_action',
|
|
22
|
+
'brand_selection_required': 'correct_input',
|
|
23
|
+
'brand_unavailable': 'correct_input',
|
|
24
|
+
'brand_archived': 'user_action',
|
|
25
|
+
'brand_name_exists': 'correct_input',
|
|
26
|
+
'brand_removal_requires_disconnect': 'user_action',
|
|
27
|
+
'account_already_connected': 'correct_input',
|
|
28
|
+
'brand_capacity_required': 'user_action',
|
|
29
|
+
'brand_changed': 'inspect',
|
|
30
|
+
'provider_wide_revocation_requires_review': 'user_action',
|
|
31
|
+
'rotation_inventory_changed': 'reconcile',
|
|
32
|
+
'rotation_changed': 'reconcile',
|
|
33
|
+
'rotation_unavailable': 'inspect',
|
|
34
|
+
|
|
21
35
|
'connection_inactive': 'user_action',
|
|
22
36
|
'connection_unavailable': 'user_action',
|
|
23
37
|
'connection_replaced': 'user_action',
|
|
@@ -32,6 +46,7 @@ _ACTIONS = {
|
|
|
32
46
|
# Only fixed internal codes acquire action semantics. Provider text is diagnostic,
|
|
33
47
|
# never a command, an expiry signal or evidence that a write was not accepted.
|
|
34
48
|
_CATALOG = {
|
|
49
|
+
'account_bind_required': ('correct_input', 'Existing SaaS connection metadata requires verified local brand binding.'),
|
|
35
50
|
'proposal_route_mismatch': ('correct_input', 'Use the validated proposal owner route; inspect operation state and use read-only recovery for an existing attempt. No write was started.'),
|
|
36
51
|
'proposal_observation_unknown': ('inspect', 'The original observation age is unknown for this saved proposal; preserve it. Export cannot assign a new age or certify freshness.'),
|
|
37
52
|
'proposal_missing': ('inspect', 'No saved proposal with this ID exists in the selected brand storage. No provider request was sent.'),
|
|
@@ -45,6 +60,8 @@ _CATALOG = {
|
|
|
45
60
|
'resume_busy': ('retry_later', 'Another process owns this read reference; wait for it to finish.'),
|
|
46
61
|
'resume_binding_mismatch': ('correct_input', 'Select the recorded operation, brand, root, service and account before resuming.'),
|
|
47
62
|
'resume_query_mismatch': ('correct_input', 'Resume with the recorded query; omit query flags or begin a new read.'),
|
|
63
|
+
'video_details_unavailable': ('inspect', 'Some requested video details were unavailable; visibility and availability remain unknown. Preserve returned observations and use only an eligible explicit recheck.'),
|
|
64
|
+
'projection_busy': ('retry_later', 'Another SocialCli operation is saving local projections. Wait for it to finish, then resume the pending local work.'),
|
|
48
65
|
'resume_unavailable': ('inspect', 'This read is already complete or has no supported continuation.'),
|
|
49
66
|
'resume_restart_required': ('adjust_read', 'The reported provider scope requires a new read; retained observations are not a current provider snapshot.'),
|
|
50
67
|
'resume_unsupported': ('unsupported', 'This endpoint is outside the supported durable read boundary; no write or renewal was sent.'),
|
|
@@ -139,6 +156,8 @@ def error_document(exc: BaseException, *, read_only: bool) -> dict:
|
|
|
139
156
|
from socialctl.youtube_data import YouTubeDataBusy, YouTubeDataCleanupError
|
|
140
157
|
from socialctl.identity import ReadError
|
|
141
158
|
from socialctl.read_checkpoints import CheckpointError
|
|
159
|
+
from socialctl.metricas.almacen import ProjectionBusyError
|
|
160
|
+
from socialctl.connections.brand_binding import AccountBindRequired
|
|
142
161
|
|
|
143
162
|
# A read flow may refresh a token via POST. A lost response to that operation
|
|
144
163
|
# cannot be classified as a harmless GET retry merely from the CLI command.
|
|
@@ -149,7 +168,9 @@ def error_document(exc: BaseException, *, read_only: bool) -> dict:
|
|
|
149
168
|
except RuntimeError: request = None
|
|
150
169
|
if request is not None and request.method not in {'GET','HEAD','OPTIONS'}:
|
|
151
170
|
read_only = False
|
|
152
|
-
if isinstance(exc,
|
|
171
|
+
if isinstance(exc, AccountBindRequired):
|
|
172
|
+
code = 'account_bind_required'
|
|
173
|
+
elif isinstance(exc, ServiceRejected):
|
|
153
174
|
code = exc.code if exc.code in MESSAGES else {
|
|
154
175
|
401:'installation_access_required',402:'subscription_required',
|
|
155
176
|
429:'rate_limited',503:'provider_unavailable'}.get(exc.status,'service_rejected')
|
|
@@ -157,6 +178,7 @@ def error_document(exc: BaseException, *, read_only: bool) -> dict:
|
|
|
157
178
|
code = 'operation_uncertain'
|
|
158
179
|
elif isinstance(exc, (AuthError, YouTubeManagementError, ChangeError, ResourceError, CommentError, MetaError, ReadError, MetricsProviderError, CheckpointError)) and getattr(exc, '_socialcli_error_code', None) is not None:
|
|
159
180
|
code = exc._socialcli_error_code
|
|
181
|
+
elif isinstance(exc, ProjectionBusyError): code = 'projection_busy'
|
|
160
182
|
elif isinstance(exc, YouTubeDataBusy): code = 'local_data_busy'
|
|
161
183
|
elif isinstance(exc, YouTubeDataCleanupError): code = 'storage_failure'
|
|
162
184
|
elif isinstance(exc, WorkspaceUnavailable): code = 'workspace_unavailable'
|
|
@@ -200,6 +222,8 @@ def error_document(exc: BaseException, *, read_only: bool) -> dict:
|
|
|
200
222
|
if code == 'operation_rejected' and not isinstance(exc, ServiceRejected):
|
|
201
223
|
result['message'] = _CATALOG[code][1]
|
|
202
224
|
diagnostic = safe_diagnostic(getattr(exc, '_socialcli_diagnostic', None))
|
|
225
|
+
if isinstance(exc, ProjectionBusyError):
|
|
226
|
+
diagnostic = {'source':'local', 'stage':'local_projection'}
|
|
203
227
|
if isinstance(exc, (ChangeError, CheckpointError)) and not diagnostic:
|
|
204
228
|
diagnostic = {'source': 'local'}
|
|
205
229
|
if isinstance(exc, ServiceRejected):
|
|
@@ -217,6 +241,9 @@ def error_document(exc: BaseException, *, read_only: bool) -> dict:
|
|
|
217
241
|
options = proposal_options(exc.recovery)
|
|
218
242
|
if options:
|
|
219
243
|
result['next_steps'] = options
|
|
244
|
+
if isinstance(exc,AccountBindRequired):
|
|
245
|
+
result.update(brand_id=exc.brand_id,next_steps=exc.options(),stage='input_validation',
|
|
246
|
+
write_state='not_started',diagnostic={'source':'local','stage':'input_validation','write_state':'not_started'})
|
|
220
247
|
return result
|
|
221
248
|
|
|
222
249
|
|
|
@@ -226,7 +253,7 @@ def safe_diagnostic(value):
|
|
|
226
253
|
return {}
|
|
227
254
|
allowed = {
|
|
228
255
|
'source': {'local', 'socialcli', 'youtube'},
|
|
229
|
-
'stage': {'input_validation', 'workspace_read', 'file_read', 'credential_read', 'identity_read', 'provider_read', 'provider_write', 'target_read', 'reply_coverage', 'proposal_preparation', 'proposal_selection', 'baseline_check', 'readback', 'executor'},
|
|
256
|
+
'stage': {'local_projection', 'input_validation', 'workspace_read', 'file_read', 'credential_read', 'identity_read', 'provider_read', 'provider_write', 'target_read', 'reply_coverage', 'proposal_preparation', 'proposal_selection', 'baseline_check', 'readback', 'executor'},
|
|
230
257
|
'request_method': {'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT', 'PATCH', 'DELETE'},
|
|
231
258
|
'operation': {'channels', 'videos', 'comments', 'commentThreads', 'playlistItems', 'reports'},
|
|
232
259
|
'write_state': {'not_started', 'unknown', 'accepted'},
|
|
@@ -49,4 +49,4 @@ def guide(topic):
|
|
|
49
49
|
if topic == 'qa':
|
|
50
50
|
sections = re.split(r'(?=^## )', full, flags=re.MULTILINE)
|
|
51
51
|
result += ''.join(s for s in sections if s.startswith('## Isolated YouTube QA sequences'))
|
|
52
|
-
return result + '\nNext: socialcli agent-guide actions; socialcli agent-guide interaction; socialcli agent-guide publish; socialcli agent-guide schedule; socialcli agent-guide inbox; socialcli agent-guide errors; socialcli agent-guide permissions; socialcli agent-guide all.\n'
|
|
52
|
+
return result + '\nNext: socialcli agent-guide actions; socialcli agent-guide interaction; socialcli agent-guide publish; socialcli agent-guide schedule; socialcli agent-guide inbox; socialcli agent-guide errors; socialcli agent-guide permissions; socialcli agent-guide brands; socialcli agent-guide all.\n'
|
|
@@ -6,11 +6,11 @@ import re
|
|
|
6
6
|
|
|
7
7
|
START = '<!-- socialcli-journey:start -->'
|
|
8
8
|
END = '<!-- socialcli-journey:end -->'
|
|
9
|
-
TOPICS = frozenset(('setup', 'interaction', 'publish', 'schedule', 'inbox', 'errors', 'permissions', 'capabilities', 'qa'))
|
|
9
|
+
TOPICS = frozenset(('setup', 'interaction', 'publish', 'schedule', 'inbox', 'errors', 'permissions', 'capabilities', 'qa', 'brands'))
|
|
10
10
|
SECTION_IDS = frozenset(('public-availability', 'capability-decision', 'workspace-context',
|
|
11
11
|
'setup-installation', 'agent-interaction', 'user-friendly-handoffs', 'installation-permissions',
|
|
12
12
|
'exact-approval', 'publish-recipe', 'youtube-scheduling', 'reads-and-errors',
|
|
13
|
-
'inbox-replies', 'persist-recover'))
|
|
13
|
+
'inbox-replies', 'persist-recover', 'multibrand'))
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def version_key(value):
|
|
@@ -116,7 +116,7 @@ def document(*, version, html=False, topic=None, data=None):
|
|
|
116
116
|
raise ValueError('Unknown journey topic')
|
|
117
117
|
data = load() if data is None else validate(data)
|
|
118
118
|
renderer = render_html if html else render_markdown
|
|
119
|
-
return ''.join(renderer(section, version=version) for section in data['sections'] if topic is None or topic in section['topics'])
|
|
119
|
+
return ''.join(renderer(section, version=version) for section in data['sections'] if (topic is None or topic in section['topics']) and any(applicable(b,version) for b in section['blocks']))
|
|
120
120
|
|
|
121
121
|
|
|
122
122
|
def recipes(*, version):
|
|
@@ -33,19 +33,34 @@ def _context(brand, root):
|
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
def read_options(brand: str, root: Path, *, query: dict, missing_video_ids: list[str],
|
|
36
|
-
continuation_available: bool, reference: str | None
|
|
36
|
+
continuation_available: bool, reference: str | None,
|
|
37
|
+
retry_unavailable_available: bool = False, local_pending: bool = False) -> list[dict]:
|
|
37
38
|
from socialctl.read_checkpoints import validate_stats_query
|
|
38
39
|
context = _context(brand, root)
|
|
39
40
|
query = validate_stats_query(query)
|
|
40
|
-
if context is None or query is None
|
|
41
|
+
if (context is None or query is None
|
|
42
|
+
or any(type(flag) is not bool for flag in (continuation_available, retry_unavailable_available, local_pending))):
|
|
41
43
|
return []
|
|
42
|
-
|
|
44
|
+
# Eligibility flags are supplied only after the caller validates checkpoint
|
|
45
|
+
# version, query, identity and lifecycle. Provider prose cannot supply them.
|
|
46
|
+
if continuation_available or retry_unavailable_available or local_pending:
|
|
43
47
|
if not isinstance(reference, str) or not re.fullmatch(r'read-[a-f0-9]{32}', reference):
|
|
44
48
|
return []
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
options = []
|
|
50
|
+
if continuation_available or local_pending:
|
|
51
|
+
options.append({**command_option(['socialcli','stats','--resume',reference,'--timeout','300',*context],
|
|
52
|
+
effect='read', approval_required=False),
|
|
53
|
+
'scope':'recorded_read' if continuation_available else 'local_projection',
|
|
54
|
+
'description':('Continuation of the recorded read; retained observations keep their original age.'
|
|
55
|
+
if continuation_available else
|
|
56
|
+
'Retry pending local projections; retained provider observations keep their original age.')})
|
|
57
|
+
if retry_unavailable_available:
|
|
58
|
+
options.append({**command_option(['socialcli','stats','--resume',reference,'--retry-unavailable',
|
|
59
|
+
'--only','youtube','--timeout','300',*context],
|
|
60
|
+
effect='read', approval_required=False),
|
|
61
|
+
'scope':'unavailable_details',
|
|
62
|
+
'description':'Explicitly recheck unavailable video details; visibility and availability remain unknown until observed.'})
|
|
63
|
+
return options
|
|
49
64
|
options = []
|
|
50
65
|
for identifier in dict.fromkeys(v for v in missing_video_ids if isinstance(v, str)):
|
|
51
66
|
if not re.fullmatch(r'[A-Za-z0-9_][A-Za-z0-9_-]{0,127}', identifier):
|
|
@@ -7645,6 +7645,24 @@
|
|
|
7645
7645
|
"release_status": "unreleased_candidate",
|
|
7646
7646
|
"live_verification": "unknown"
|
|
7647
7647
|
},
|
|
7648
|
+
{
|
|
7649
|
+
"id": "stats.retry-unavailable",
|
|
7650
|
+
"task": "Explicitly recheck unavailable YouTube details in a version 2 stats reference",
|
|
7651
|
+
"command": "socialcli stats --resume READ_ID --retry-unavailable --only youtube --timeout 300 --brand Example --root /path/to/workspace --json --json-version 2",
|
|
7652
|
+
"approval": "none_read_only",
|
|
7653
|
+
"prerequisites": [
|
|
7654
|
+
"Installed client 0.3.12 or later; a validated version 2 YouTube stats reference in the same account/root/service with retry_unavailable_available=true.",
|
|
7655
|
+
"Use normal resume first for pending work. Only the explicit option rechecks previously unavailable details; provider text is never an instruction."
|
|
7656
|
+
],
|
|
7657
|
+
"verification_limits": [
|
|
7658
|
+
"Read-only subset GETs preserve completed peers, original observation times, frozen publication-date filters and six-day expiry. No omission proves deletion or zero.",
|
|
7659
|
+
"Local-only projection recovery is separate from provider completeness. Inspect local_pending and persistence; protected newer projections do not remain pending.",
|
|
7660
|
+
"Installation is not registry publication. Stable 0.3.11 cannot read version 2 references or use the shared projection lock; cached-only recovery retains service authorization checks."
|
|
7661
|
+
],
|
|
7662
|
+
"minimum_version": "0.3.12",
|
|
7663
|
+
"release_status": "not_inferred_from_installation",
|
|
7664
|
+
"live_verification": "unknown"
|
|
7665
|
+
},
|
|
7648
7666
|
{
|
|
7649
7667
|
"id": "inbox.resume",
|
|
7650
7668
|
"task": "Continue an existing read checkpoint with its saved query",
|
|
@@ -7800,6 +7818,57 @@
|
|
|
7800
7818
|
"youtube"
|
|
7801
7819
|
],
|
|
7802
7820
|
"live_verification": "unknown"
|
|
7821
|
+
},
|
|
7822
|
+
{
|
|
7823
|
+
"id": "account.brands",
|
|
7824
|
+
"task": "Discover only installation-authorized brand IDs and effective limits",
|
|
7825
|
+
"command": "socialcli account brands --brand Example --root /path/to/workspace --json --json-version 2",
|
|
7826
|
+
"approval": "none_read_only",
|
|
7827
|
+
"prerequisites": [
|
|
7828
|
+
"Installed candidate client 0.3.13; service brand protocol 2 with authorized discovery; exact named workspace/service/owner and approved brand ID.",
|
|
7829
|
+
"Only YouTube public; Solo one / Studio five requires independent access and verified capacity."
|
|
7830
|
+
],
|
|
7831
|
+
"verification_limits": [
|
|
7832
|
+
"No unapproved brand enumeration or first-ID selection. Local binding and credential reuse grant no publication, billing or provider approval.",
|
|
7833
|
+
"Uncertain writes require reconciliation; no sign-out or reconnection to add a brand. Candidate is not claimed released or Live."
|
|
7834
|
+
],
|
|
7835
|
+
"minimum_version": "0.3.13",
|
|
7836
|
+
"release_status": "not_inferred_from_installation",
|
|
7837
|
+
"live_verification": "unknown"
|
|
7838
|
+
},
|
|
7839
|
+
{
|
|
7840
|
+
"id": "account.bind",
|
|
7841
|
+
"task": "Bind one local folder to an exact approved stable brand ID",
|
|
7842
|
+
"command": "socialcli account bind --brand Example --root /path/to/workspace --brand-id fictional-brand-123456789 --json --json-version 2",
|
|
7843
|
+
"approval": "explicit_brand_selection",
|
|
7844
|
+
"prerequisites": [
|
|
7845
|
+
"Installed candidate client 0.3.13; service brand protocol 2 with authorized discovery; exact named workspace/service/owner and approved brand ID.",
|
|
7846
|
+
"Only YouTube public; Solo one / Studio five requires independent access and verified capacity."
|
|
7847
|
+
],
|
|
7848
|
+
"verification_limits": [
|
|
7849
|
+
"No unapproved brand enumeration or first-ID selection. Local binding and credential reuse grant no publication, billing or provider approval.",
|
|
7850
|
+
"Uncertain writes require reconciliation; no sign-out or reconnection to add a brand. Candidate is not claimed released or Live."
|
|
7851
|
+
],
|
|
7852
|
+
"minimum_version": "0.3.13",
|
|
7853
|
+
"release_status": "not_inferred_from_installation",
|
|
7854
|
+
"live_verification": "unknown"
|
|
7855
|
+
},
|
|
7856
|
+
{
|
|
7857
|
+
"id": "account.reuse",
|
|
7858
|
+
"task": "Explicitly reuse a named local installation after additive owner consent",
|
|
7859
|
+
"command": "socialcli account reuse --from-brand First --brand Second --root /path/to/workspace --service https://social.example --brand-id fictional-brand-123456789 --json --json-version 2",
|
|
7860
|
+
"approval": "owner_approved_brand_membership",
|
|
7861
|
+
"prerequisites": [
|
|
7862
|
+
"Installed candidate client 0.3.13; service brand protocol 2 with authorized discovery; exact named workspace/service/owner and approved brand ID.",
|
|
7863
|
+
"Only YouTube public; Solo one / Studio five requires independent access and verified capacity."
|
|
7864
|
+
],
|
|
7865
|
+
"verification_limits": [
|
|
7866
|
+
"No unapproved brand enumeration or first-ID selection. Local binding and credential reuse grant no publication, billing or provider approval.",
|
|
7867
|
+
"Uncertain writes require reconciliation; no sign-out or reconnection to add a brand. Candidate is not claimed released or Live."
|
|
7868
|
+
],
|
|
7869
|
+
"minimum_version": "0.3.13",
|
|
7870
|
+
"release_status": "not_inferred_from_installation",
|
|
7871
|
+
"live_verification": "unknown"
|
|
7803
7872
|
}
|
|
7804
7873
|
],
|
|
7805
7874
|
"input_schemas": {
|
|
@@ -98,7 +98,7 @@ def approval_hash(post, brand, platform):
|
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
@app.command('agent-guide')
|
|
101
|
-
def agent_guide(topic: str = typer.Argument('setup', help='setup, capabilities, actions (JSON), interaction, publish, schedule, inbox, errors, permissions or all')):
|
|
101
|
+
def agent_guide(topic: str = typer.Argument('setup', help='setup, capabilities, actions (JSON), interaction, publish, schedule, inbox, errors, permissions, brands or all')):
|
|
102
102
|
"""Read a focused agent guide offline, without an account or workspace."""
|
|
103
103
|
from socialctl.agent_guide import guide
|
|
104
104
|
try:
|
|
@@ -1614,9 +1614,9 @@ def _limpiar_snapshots_y_avisar(marca: Brand) -> None:
|
|
|
1614
1614
|
)
|
|
1615
1615
|
|
|
1616
1616
|
|
|
1617
|
-
def _fusionar_snapshot_del_dia(marca: Brand, nuevo: Snapshot) -> Snapshot:
|
|
1617
|
+
def _fusionar_snapshot_del_dia(marca: Brand, nuevo: Snapshot, *, previous=None, previous_loaded=False) -> Snapshot:
|
|
1618
1618
|
"""Merge selected-platform reads with today's snapshot, retaining other platforms and previous good data when a read fails."""
|
|
1619
|
-
anterior = cargar_snapshot(marca, nuevo.fecha)
|
|
1619
|
+
anterior = previous if previous_loaded else cargar_snapshot(marca, nuevo.fecha)
|
|
1620
1620
|
if anterior is None:
|
|
1621
1621
|
return nuevo
|
|
1622
1622
|
|
|
@@ -1659,12 +1659,12 @@ class MetricsPersistenceError(Exception):
|
|
|
1659
1659
|
self.saved, self.not_saved, self.snapshot_path = list(saved), list(not_saved), snapshot_path
|
|
1660
1660
|
|
|
1661
1661
|
|
|
1662
|
-
def _guardar_lo_leido(marca: Brand, snapshot: Snapshot, *, structured: bool = False) -> Path:
|
|
1662
|
+
def _guardar_lo_leido(marca: Brand, snapshot: Snapshot, *, structured: bool = False, previous=None, previous_loaded=False, guard=None) -> Path:
|
|
1663
1663
|
"""Write the day's snapshot, editorial inventory and report atomically, reporting any incomplete set of writes."""
|
|
1664
1664
|
pasos = (
|
|
1665
1665
|
("today's snapshot", lambda: guardar_snapshot(marca, snapshot)),
|
|
1666
1666
|
("piezas.yml", lambda: actualizar_piezas(marca, snapshot)),
|
|
1667
|
-
("resumen.md", lambda: escribir_resumen(marca, snapshot)),
|
|
1667
|
+
("resumen.md", lambda: escribir_resumen(marca, snapshot, previous_snapshot=previous, previous_loaded=True) if previous_loaded else escribir_resumen(marca, snapshot)),
|
|
1668
1668
|
)
|
|
1669
1669
|
|
|
1670
1670
|
escritos: list[str] = []
|
|
@@ -1673,6 +1673,7 @@ def _guardar_lo_leido(marca: Brand, snapshot: Snapshot, *, structured: bool = Fa
|
|
|
1673
1673
|
|
|
1674
1674
|
for nombre, escribir in pasos:
|
|
1675
1675
|
try:
|
|
1676
|
+
if guard is not None:guard()
|
|
1676
1677
|
ruta = escribir()
|
|
1677
1678
|
except PiezasIlegibles as exc:
|
|
1678
1679
|
if structured:
|
|
@@ -1702,6 +1703,52 @@ def _guardar_lo_leido(marca: Brand, snapshot: Snapshot, *, structured: bool = Fa
|
|
|
1702
1703
|
return ruta_del_snapshot
|
|
1703
1704
|
|
|
1704
1705
|
|
|
1706
|
+
def _project_stats(marca, snapshot, checkpoint):
|
|
1707
|
+
"""Serialize projection decisions; API evidence remains in the checkpoint."""
|
|
1708
|
+
from socialctl.metricas.almacen import (projection_lock, read_projection_snapshot,
|
|
1709
|
+
previous_projection_snapshot, projection_decision, ProjectionReadError)
|
|
1710
|
+
from socialctl.read_budget import read_timing
|
|
1711
|
+
from socialctl.youtube_data import enforce_youtube_data
|
|
1712
|
+
from contextlib import redirect_stdout
|
|
1713
|
+
# Cleanup owns workflow locks; never nest it under the projection lock.
|
|
1714
|
+
with redirect_stdout(sys.stderr):
|
|
1715
|
+
enforce_youtube_data(marca.raiz)
|
|
1716
|
+
checkpoint.assert_active() if checkpoint.semantic else None
|
|
1717
|
+
with read_timing('local_finalization'), projection_lock(marca):
|
|
1718
|
+
previous=read_projection_snapshot(marca,snapshot.fecha)
|
|
1719
|
+
reused=set()
|
|
1720
|
+
if previous:
|
|
1721
|
+
for platform,incoming in snapshot.redes.items():
|
|
1722
|
+
existing=previous.redes.get(platform)
|
|
1723
|
+
if existing is None:continue
|
|
1724
|
+
if existing.account_id and incoming.account_id and existing.account_id!=incoming.account_id:
|
|
1725
|
+
raise ProjectionReadError('Existing observation belongs to a different account.')
|
|
1726
|
+
old_ref=existing.count_semantics.get('read_reference')
|
|
1727
|
+
incoming_ref=incoming.count_semantics.get('read_reference')
|
|
1728
|
+
decision=projection_decision(existing.observed_at.isoformat() if existing.observed_at else None,
|
|
1729
|
+
incoming.observed_at.isoformat() if incoming.observed_at else '',
|
|
1730
|
+
same_reference=bool(old_ref and old_ref==incoming_ref),existing_present=True)
|
|
1731
|
+
if decision=='ambiguous':
|
|
1732
|
+
raise ProjectionReadError('Existing observation order is ambiguous; files were preserved.')
|
|
1733
|
+
if decision=='keep_newer':
|
|
1734
|
+
checkpoint.set_projection_outcome('skipped_newer','newer_observation')
|
|
1735
|
+
return snapshot,None,set(),{'state':'skipped_newer','reason':'newer_observation',
|
|
1736
|
+
'existing_observed_at':existing.observed_at.isoformat(),'saved':[],
|
|
1737
|
+
'not_saved':["today's snapshot",'piezas.yml','resumen.md']}
|
|
1738
|
+
reused={p for p,r in previous.redes.items() if p not in snapshot.redes or
|
|
1739
|
+
(r.estado is EstadoLectura.OK and snapshot.redes[p].estado is not EstadoLectura.OK)}
|
|
1740
|
+
merged=_fusionar_snapshot_del_dia(marca,snapshot,previous=previous,previous_loaded=True)
|
|
1741
|
+
# Editorial association precedes both projections, without provider I/O.
|
|
1742
|
+
asignar_slugs(marca,merged)
|
|
1743
|
+
before=previous_projection_snapshot(marca,snapshot.fecha)
|
|
1744
|
+
if checkpoint.semantic:checkpoint.set_projection_outcome('pending')
|
|
1745
|
+
with read_timing('persistence'):
|
|
1746
|
+
path=_guardar_lo_leido(marca,merged,structured=True,previous=before,previous_loaded=True,
|
|
1747
|
+
guard=checkpoint.assert_active if checkpoint.semantic else None)
|
|
1748
|
+
checkpoint.set_projection_outcome('saved')
|
|
1749
|
+
return merged,path,reused,{'state':'saved','saved':["today's snapshot",'piezas.yml','resumen.md'],'not_saved':[]}
|
|
1750
|
+
|
|
1751
|
+
|
|
1705
1752
|
def _fallar_guardando(
|
|
1706
1753
|
escritos: list[str], pendientes: list[str], motivo: str, coletilla: str
|
|
1707
1754
|
) -> None:
|
|
@@ -1736,6 +1783,7 @@ def stats(
|
|
|
1736
1783
|
json_output: bool = typer.Option(False, "--json", help="Print a versioned report; progress goes to stderr."),
|
|
1737
1784
|
timeout: float = typer.Option(300, "--timeout", help="Total read time limit in seconds; use --only to give one platform the full budget."),
|
|
1738
1785
|
resume: str | None = typer.Option(None, "--resume", help="Continue an unfinished local read with its recorded query."),
|
|
1786
|
+
retry_unavailable: bool = typer.Option(False, "--retry-unavailable", help="With a version 2 resume reference, recheck unavailable YouTube details once."),
|
|
1739
1787
|
) -> None:
|
|
1740
1788
|
"""Read platform metrics and save a brand snapshot. Selected-platform reads merge with today's data; YouTube API data expires after six days; other snapshots expire after one year."""
|
|
1741
1789
|
def invalid(message):
|
|
@@ -1770,12 +1818,15 @@ def stats(
|
|
|
1770
1818
|
from socialctl.public_availability import PUBLIC_PLATFORM_NAMES
|
|
1771
1819
|
destinos = [Platform(name) for name in PUBLIC_PLATFORM_NAMES]
|
|
1772
1820
|
|
|
1821
|
+
if retry_unavailable and not resume:
|
|
1822
|
+
invalid('--retry-unavailable requires --resume.')
|
|
1773
1823
|
from socialctl.read_checkpoints import ReadCheckpoint, CheckpointError
|
|
1774
1824
|
query = ({**({'since':desde} if desde is not None else {}), **({'only':[p.value for p in destinos]} if only else {})}
|
|
1775
1825
|
if resume else {'since':desde, 'until':date.today().isoformat(), 'only':[p.value for p in destinos],
|
|
1776
|
-
'order':'analytics:-views', 'schema':1, 'selection':'top-200 Analytics videos; not uploads inventory'})
|
|
1826
|
+
'order':'analytics:-views', 'schema':2 if destinos==[Platform.YOUTUBE] else 1, 'selection':'top-200 Analytics videos; not uploads inventory'})
|
|
1777
1827
|
try:
|
|
1778
|
-
checkpoint = ReadCheckpoint(marca, 'stats', query=query, reference=resume
|
|
1828
|
+
checkpoint = ReadCheckpoint(marca, 'stats', query=query, reference=resume,
|
|
1829
|
+
format_version=2 if not resume and destinos==[Platform.YOUTUBE] else None, retry_unavailable=retry_unavailable)
|
|
1779
1830
|
checkpoint.__enter__()
|
|
1780
1831
|
except CheckpointError as exc:
|
|
1781
1832
|
if json_output:
|
|
@@ -1797,11 +1848,12 @@ def stats(
|
|
|
1797
1848
|
progress = ReadProgress('stats')
|
|
1798
1849
|
interrupted = False
|
|
1799
1850
|
try:
|
|
1800
|
-
transport = checkpoint.wrap(read_client(budget, progress=progress), budget=budget)
|
|
1851
|
+
transport = checkpoint.wrap(read_client(budget, progress=progress,service_origin=checkpoint.binding['service']), budget=budget)
|
|
1801
1852
|
except Exception as exc:
|
|
1802
1853
|
from socialctl.read_reports import fail_read
|
|
1803
1854
|
fail_read(exc,json_output=json_output)
|
|
1804
1855
|
with progress, transport as client:
|
|
1856
|
+
progress.checkpoint_reference(checkpoint.reference)
|
|
1805
1857
|
for index, platform in enumerate(destinos):
|
|
1806
1858
|
if interrupted:
|
|
1807
1859
|
redes[platform] = LecturaRed(estado=EstadoLectura.ERROR, error='Read interrupted; platform not started', failure_code='not_attempted')
|
|
@@ -1811,12 +1863,16 @@ def stats(
|
|
|
1811
1863
|
budget.check()
|
|
1812
1864
|
redes[platform] = leer_red(platform, marca, client, fecha_desde)
|
|
1813
1865
|
redes[platform].observed_at = datetime.fromisoformat(checkpoint.observed_at)
|
|
1866
|
+
redes[platform].count_semantics['read_reference']=checkpoint.reference
|
|
1867
|
+
checkpoint.clear_discovery_pending('read.waiting')
|
|
1814
1868
|
except KeyboardInterrupt:
|
|
1815
1869
|
progress.stage('read.interrupted')
|
|
1870
|
+
checkpoint.mark_discovery_pending('read.waiting','read_interrupted')
|
|
1816
1871
|
interrupted = True
|
|
1817
1872
|
redes[platform] = LecturaRed(estado=EstadoLectura.ERROR, error='Read interrupted; results may be incomplete', failure_code='read_interrupted')
|
|
1818
1873
|
except ReadDeadlineExceeded as exc:
|
|
1819
1874
|
progress.stage('read.deadline')
|
|
1875
|
+
checkpoint.mark_discovery_pending('read.waiting','read_deadline')
|
|
1820
1876
|
redes[platform] = LecturaRed(estado=EstadoLectura.ERROR, error=str(exc), failure_code='read_deadline')
|
|
1821
1877
|
|
|
1822
1878
|
from socialctl.read_reports import safe_error
|
|
@@ -1827,39 +1883,29 @@ def stats(
|
|
|
1827
1883
|
for piece in lectura.piezas:
|
|
1828
1884
|
if 'enriquecimiento_fallido' in piece.especificas:
|
|
1829
1885
|
piece.especificas['enriquecimiento_fallido'] = safe_error(str(piece.especificas['enriquecimiento_fallido']))
|
|
1830
|
-
snapshot = Snapshot(fecha=date.
|
|
1831
|
-
|
|
1832
|
-
# Con `--only`, fusiona con el snapshot que ya hubiera hoy en vez de
|
|
1833
|
-
# reemplazarlo (ver `_fusionar_snapshot_del_dia`); sin `--only` no se
|
|
1834
|
-
# toca nada aquí y la lectura completa sigue sobrescribiendo como
|
|
1835
|
-
# siempre. `redes` (usado más abajo para el resumen por pantalla y el
|
|
1836
|
-
# código de salida) sigue siendo la lectura de HOY, sin fusionar: lo que
|
|
1837
|
-
# se cuenta ahí es lo que ha pasado en ESTA ejecución.
|
|
1838
|
-
reused = set()
|
|
1839
|
-
if set(destinos) != set(LECTORES) or only:
|
|
1840
|
-
previous = cargar_snapshot(marca, snapshot.fecha)
|
|
1841
|
-
if previous:
|
|
1842
|
-
reused = {p for p, r in previous.redes.items() if p not in redes or
|
|
1843
|
-
(r.estado is EstadoLectura.OK and redes[p].estado is not EstadoLectura.OK)}
|
|
1844
|
-
snapshot = _fusionar_snapshot_del_dia(marca, snapshot)
|
|
1845
|
-
|
|
1846
|
-
# ANTES de guardar y de actualizar `piezas.yml`: el slug enlaza cada
|
|
1847
|
-
# pieza con el post que la publicó, y tiene que llegar a los dos ficheros.
|
|
1848
|
-
asignar_slugs(marca, snapshot)
|
|
1886
|
+
snapshot = Snapshot(fecha=date.fromisoformat(checkpoint.query['until']), marca=marca.nombre, redes=redes)
|
|
1849
1887
|
|
|
1888
|
+
reused=set();persistence_error=None;ruta=None;persistence={}
|
|
1850
1889
|
progress.stage('read.persistence')
|
|
1851
|
-
persistence_error = None
|
|
1852
1890
|
try:
|
|
1853
|
-
ruta
|
|
1891
|
+
snapshot,ruta,reused,persistence=_project_stats(marca,snapshot,checkpoint)
|
|
1854
1892
|
except MetricsPersistenceError as exc:
|
|
1855
|
-
persistence_error
|
|
1856
|
-
|
|
1893
|
+
persistence_error=exc;ruta=exc.snapshot_path
|
|
1894
|
+
checkpoint.set_projection_outcome('pending','persistence_failed')
|
|
1895
|
+
except (OSError,ValueError) as exc:
|
|
1896
|
+
if isinstance(exc,CheckpointError):raise
|
|
1897
|
+
from socialctl.metricas.almacen import ProjectionReadError,ProjectionBusyError
|
|
1898
|
+
reason='projection_busy' if isinstance(exc,ProjectionBusyError) else 'projection_ambiguous' if isinstance(exc,ProjectionReadError) else 'persistence_failed'
|
|
1899
|
+
checkpoint.set_projection_outcome('blocked' if reason=='projection_ambiguous' else 'pending',reason)
|
|
1900
|
+
persistence_error=MetricsPersistenceError([], ["today's snapshot",'piezas.yml','resumen.md'],str(exc),None)
|
|
1901
|
+
persistence_error.code='projection_busy' if reason=='projection_busy' else 'persistence_failed'
|
|
1857
1902
|
|
|
1858
1903
|
read_complete = not persistence_error and all(r.estado is EstadoLectura.OK and not r.warnings and
|
|
1859
1904
|
not any('enriquecimiento_fallido' in piece.especificas for piece in r.piezas) for r in redes.values())
|
|
1860
1905
|
try:
|
|
1861
1906
|
checkpoint.finish(complete=read_complete)
|
|
1862
1907
|
except CheckpointError as exc:
|
|
1908
|
+
if exc._socialcli_error_code!='persistence_failed':raise
|
|
1863
1909
|
persistence_error = persistence_error or MetricsPersistenceError([], ['read checkpoint'], str(exc), ruta)
|
|
1864
1910
|
|
|
1865
1911
|
if json_output:
|
|
@@ -1895,7 +1941,7 @@ def stats(
|
|
|
1895
1941
|
reasons.append({'code':code,'stage':p.value+'.metrics','occurrences':1})
|
|
1896
1942
|
errors.append({'platform':p.value,'code':code,'message':safe_error(r.error or '; '.join(dict.fromkeys(warnings)) or r.estado.value)})
|
|
1897
1943
|
if persistence_error:
|
|
1898
|
-
errors.append({'operation':'persistence', 'code':'persistence_failed', 'message':safe_error(str(persistence_error))})
|
|
1944
|
+
errors.append({'operation':'persistence', 'code':getattr(persistence_error,'code','persistence_failed'), 'message':safe_error(str(persistence_error))})
|
|
1899
1945
|
errors.extend(checkpoint.diagnostics())
|
|
1900
1946
|
reasons.extend({'code':e['code'],'stage':e.get('operation','checkpoint'),'occurrences':1}
|
|
1901
1947
|
for e in errors if e.get('operation')=='persistence' or e.get('scope_id'))
|
|
@@ -1915,14 +1961,20 @@ def stats(
|
|
|
1915
1961
|
'video_details':[{'id':identifier,'status':'unknown'} for identifier in missing_ids],
|
|
1916
1962
|
'comparison_to_deletion':'unavailable'}
|
|
1917
1963
|
data['next_steps'] = read_options(marca.nombre, marca.raiz.parent, query=checkpoint.query,
|
|
1918
|
-
missing_video_ids=missing_ids, continuation_available=summary['available'], reference=summary['reference']
|
|
1964
|
+
missing_video_ids=missing_ids, continuation_available=summary['available'], reference=summary['reference'],
|
|
1965
|
+
retry_unavailable_available=summary.get('retry_unavailable_available',False),local_pending=summary.get('local_pending',False))
|
|
1919
1966
|
from socialctl.read_reports import coverage_summary
|
|
1920
1967
|
data['coverage_summary']=coverage_summary(status,checkpoint.summary(),checkpoint.observed_at,reasons)
|
|
1921
1968
|
if persistence_error:
|
|
1922
1969
|
data['persistence'] = {'saved':persistence_error.saved, 'not_saved':persistence_error.not_saved}
|
|
1970
|
+
checkpoint.assert_active() if checkpoint.semantic else None
|
|
1971
|
+
data['timing']=progress.timing_report()
|
|
1972
|
+
if persistence:
|
|
1973
|
+
data['persistence']=persistence
|
|
1923
1974
|
report = ReadReport(status=status, observed_at=datetime.fromisoformat(checkpoint.observed_at), coverage=coverage, errors=errors, data=data, resume=checkpoint.summary())
|
|
1924
1975
|
raise typer.Exit(emit_report(report))
|
|
1925
1976
|
|
|
1977
|
+
checkpoint.assert_active() if checkpoint.semantic else None
|
|
1926
1978
|
typer.echo("")
|
|
1927
1979
|
for platform, lectura in redes.items():
|
|
1928
1980
|
if lectura.estado is EstadoLectura.OK:
|
|
@@ -1954,6 +2006,9 @@ def stats(
|
|
|
1954
2006
|
any('enriquecimiento_fallido' in piece.especificas for piece in l.piezas)
|
|
1955
2007
|
for l in redes.values()):
|
|
1956
2008
|
raise typer.Exit(3)
|
|
2009
|
+
except CheckpointError as exc:
|
|
2010
|
+
from socialctl.read_reports import fail_read
|
|
2011
|
+
fail_read(exc,json_output=json_output)
|
|
1957
2012
|
finally:
|
|
1958
2013
|
checkpoint.close()
|
|
1959
2014
|
|