talkops-opscloud 0.3.0b1__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.
- opscloud/__init__.py +5 -0
- opscloud/__main__.py +6 -0
- opscloud/_constants.py +53 -0
- opscloud/_debug.py +145 -0
- opscloud/_debug_buffer.py +250 -0
- opscloud/_textual_patches.py +367 -0
- opscloud/_version.py +15 -0
- opscloud/agent/__init__.py +27 -0
- opscloud/agent/config.py +168 -0
- opscloud/agent/factory.py +1103 -0
- opscloud/approval_mode.py +44 -0
- opscloud/backend/__init__.py +49 -0
- opscloud/backend/composite.py +89 -0
- opscloud/backend/local.py +183 -0
- opscloud/backend/registry.py +79 -0
- opscloud/backend/sandbox_config.py +107 -0
- opscloud/backend/sandbox_factory.py +432 -0
- opscloud/built_in_skills/remember/SKILL.md +124 -0
- opscloud/built_in_skills/skill-creator/SKILL.md +348 -0
- opscloud/built_in_skills/skill-creator/scripts/init_skill.py +371 -0
- opscloud/built_in_skills/skill-creator/scripts/quick_validate.py +165 -0
- opscloud/cli/__init__.py +1 -0
- opscloud/cli/commands/__init__.py +15 -0
- opscloud/cli/commands/auth.py +45 -0
- opscloud/cli/commands/doctor.py +100 -0
- opscloud/cli/commands/mcp.py +137 -0
- opscloud/cli/commands/threads.py +51 -0
- opscloud/cli/interactive.py +154 -0
- opscloud/cli/main.py +903 -0
- opscloud/cli/non_interactive.py +425 -0
- opscloud/cli/server_manager.py +58 -0
- opscloud/commands/__init__.py +19 -0
- opscloud/commands/_base.py +110 -0
- opscloud/commands/_guards.py +52 -0
- opscloud/commands/_router.py +146 -0
- opscloud/commands/_types.py +36 -0
- opscloud/commands/core/__init__.py +47 -0
- opscloud/commands/core/auth.py +94 -0
- opscloud/commands/core/bug.py +46 -0
- opscloud/commands/core/clear.py +106 -0
- opscloud/commands/core/cloud.py +185 -0
- opscloud/commands/core/compact.py +128 -0
- opscloud/commands/core/config_cmd.py +120 -0
- opscloud/commands/core/context.py +220 -0
- opscloud/commands/core/cost.py +44 -0
- opscloud/commands/core/doctor.py +535 -0
- opscloud/commands/core/effort.py +108 -0
- opscloud/commands/core/exit_cmd.py +41 -0
- opscloud/commands/core/fast.py +148 -0
- opscloud/commands/core/help_cmd.py +94 -0
- opscloud/commands/core/mcp.py +134 -0
- opscloud/commands/core/model.py +109 -0
- opscloud/commands/core/permissions.py +196 -0
- opscloud/commands/core/plugins.py +92 -0
- opscloud/commands/core/pool.py +108 -0
- opscloud/commands/core/resume.py +97 -0
- opscloud/commands/core/skills.py +178 -0
- opscloud/commands/power/__init__.py +51 -0
- opscloud/commands/power/agents.py +98 -0
- opscloud/commands/power/btw.py +85 -0
- opscloud/commands/power/copy.py +97 -0
- opscloud/commands/power/goal.py +548 -0
- opscloud/commands/power/loop.py +295 -0
- opscloud/commands/power/memory.py +287 -0
- opscloud/commands/power/review.py +152 -0
- opscloud/commands/power/rubric.py +287 -0
- opscloud/commands/power/runtime.py +321 -0
- opscloud/commands/power/skill_creator.py +70 -0
- opscloud/commands/power/skill_invoke.py +165 -0
- opscloud/commands/power/tasks.py +209 -0
- opscloud/commands/power/trace.py +117 -0
- opscloud/commands/power/ui_toggles.py +135 -0
- opscloud/commands/power/version.py +52 -0
- opscloud/commands/registry.py +176 -0
- opscloud/config/__init__.py +114 -0
- opscloud/config/adapters/__init__.py +5 -0
- opscloud/config/adapters/postgres.py +776 -0
- opscloud/config/adapters/sqlite.py +769 -0
- opscloud/config/aws.py +248 -0
- opscloud/config/cloud_profiles.py +437 -0
- opscloud/config/env_vars.py +81 -0
- opscloud/config/langsmith.py +319 -0
- opscloud/config/manifest.py +817 -0
- opscloud/config/metadata.py +205 -0
- opscloud/config/paths.py +604 -0
- opscloud/config/plugins.py +130 -0
- opscloud/config/settings.py +834 -0
- opscloud/config/store.py +453 -0
- opscloud/config/store_factory.py +97 -0
- opscloud/config/toml_config.py +562 -0
- opscloud/editor.py +173 -0
- opscloud/exceptions.py +65 -0
- opscloud/file_ops.py +217 -0
- opscloud/hooks/__init__.py +139 -0
- opscloud/hooks/env.py +44 -0
- opscloud/hooks/interrupt.py +121 -0
- opscloud/hooks/models/__init__.py +109 -0
- opscloud/hooks/models/adapters.py +19 -0
- opscloud/hooks/models/config.py +79 -0
- opscloud/hooks/models/domain.py +434 -0
- opscloud/hooks/models/transport.py +37 -0
- opscloud/hooks/tools.py +231 -0
- opscloud/input.py +48 -0
- opscloud/integrations/__init__.py +80 -0
- opscloud/integrations/base.py +153 -0
- opscloud/integrations/content_filter.py +119 -0
- opscloud/integrations/event_bus.py +480 -0
- opscloud/integrations/hooks.py +238 -0
- opscloud/integrations/identity.py +181 -0
- opscloud/integrations/notifications.py +134 -0
- opscloud/integrations/stream_bridge.py +397 -0
- opscloud/integrations/thread_store.py +81 -0
- opscloud/json_types.py +20 -0
- opscloud/mcp/__init__.py +57 -0
- opscloud/mcp/config.py +203 -0
- opscloud/mcp/discovery.py +229 -0
- opscloud/mcp/mcp_info.py +109 -0
- opscloud/mcp/middleware.py +102 -0
- opscloud/mcp/preload.py +505 -0
- opscloud/mcp/raw_config.py +149 -0
- opscloud/mcp/semantic_profiler.py +305 -0
- opscloud/mcp/session_manager.py +727 -0
- opscloud/mcp/trust.py +105 -0
- opscloud/memory/__init__.py +27 -0
- opscloud/memory/branch.py +61 -0
- opscloud/memory/guard.py +19 -0
- opscloud/memory/onboarding.py +120 -0
- opscloud/memory/registry.py +134 -0
- opscloud/memory/store.py +223 -0
- opscloud/middleware/__init__.py +106 -0
- opscloud/middleware/_repository_bounds.py +459 -0
- opscloud/middleware/ask_user.py +152 -0
- opscloud/middleware/auto_mode.py +60 -0
- opscloud/middleware/auto_mode_hitl.py +2434 -0
- opscloud/middleware/compaction.py +566 -0
- opscloud/middleware/configurable_model.py +233 -0
- opscloud/middleware/cost_tracking.py +1021 -0
- opscloud/middleware/glm_stall_recovery.py +109 -0
- opscloud/middleware/goal_criteria.py +1234 -0
- opscloud/middleware/goal_state_notice.py +712 -0
- opscloud/middleware/goal_tools.py +407 -0
- opscloud/middleware/headless_mcp_guard.py +88 -0
- opscloud/middleware/jev_model_router.py +1018 -0
- opscloud/middleware/local_context.py +460 -0
- opscloud/middleware/mcp_context.py +151 -0
- opscloud/middleware/mcp_middleware.py +146 -0
- opscloud/middleware/memory_guard.py +393 -0
- opscloud/middleware/model_retry.py +205 -0
- opscloud/middleware/registry.py +137 -0
- opscloud/middleware/reliable_rubric.py +709 -0
- opscloud/middleware/resume_state.py +91 -0
- opscloud/middleware/server_hooks.py +1189 -0
- opscloud/middleware/shell_allow_list.py +90 -0
- opscloud/middleware/skills.py +382 -0
- opscloud/middleware/subagent_artifacts.py +84 -0
- opscloud/middleware/subagent_telemetry.py +261 -0
- opscloud/middleware/subagents.py +243 -0
- opscloud/middleware/tool_filter.py +384 -0
- opscloud/middleware/unified_system_message.py +62 -0
- opscloud/model/__init__.py +37 -0
- opscloud/model/config.py +2992 -0
- opscloud/model/factory.py +477 -0
- opscloud/model/pool.py +459 -0
- opscloud/model/reasoning.py +282 -0
- opscloud/offload.py +173 -0
- opscloud/output.py +64 -0
- opscloud/plugins/__init__.py +189 -0
- opscloud/plugins/_json.py +22 -0
- opscloud/plugins/adapters/__init__.py +13 -0
- opscloud/plugins/adapters/agents.py +112 -0
- opscloud/plugins/adapters/commands.py +190 -0
- opscloud/plugins/adapters/mcp.py +363 -0
- opscloud/plugins/adapters/skills.py +132 -0
- opscloud/plugins/commands_cli.py +541 -0
- opscloud/plugins/discovery.py +512 -0
- opscloud/plugins/manifest.py +335 -0
- opscloud/plugins/marketplace.py +893 -0
- opscloud/plugins/models.py +334 -0
- opscloud/plugins/project_plugins.py +317 -0
- opscloud/plugins/protocol.py +31 -0
- opscloud/plugins/store.py +905 -0
- opscloud/plugins/substitution.py +122 -0
- opscloud/project_utils.py +145 -0
- opscloud/prompts/__init__.py +37 -0
- opscloud/prompts/system.py +483 -0
- opscloud/prompts/templates/system_prompt.md +166 -0
- opscloud/prompts/types.py +54 -0
- opscloud/rubrics/__init__.py +42 -0
- opscloud/rubrics/evaluator.py +404 -0
- opscloud/rubrics/evidence_extractor.py +229 -0
- opscloud/rubrics/generator.py +239 -0
- opscloud/rubrics/jev_compiler.py +175 -0
- opscloud/rubrics/jev_grader.py +297 -0
- opscloud/rubrics/middleware.py +8 -0
- opscloud/schema/__init__.py +107 -0
- opscloud/schema/interrupts.py +981 -0
- opscloud/security/__init__.py +91 -0
- opscloud/security/approval_mode.py +528 -0
- opscloud/security/approval_mode_source.py +230 -0
- opscloud/security/cli_ast_evaluator.py +552 -0
- opscloud/security/jev_classifier.py +651 -0
- opscloud/security/shell_safety.py +340 -0
- opscloud/security/unicode_security.py +439 -0
- opscloud/security/url_validation.py +160 -0
- opscloud/server/__init__.py +13 -0
- opscloud/server/_server_config.py +158 -0
- opscloud/server/server.py +242 -0
- opscloud/server/server_graph.py +93 -0
- opscloud/skills/__init__.py +91 -0
- opscloud/skills/commands.py +1099 -0
- opscloud/skills/invocation.py +200 -0
- opscloud/skills/load.py +388 -0
- opscloud/skills/loader.py +23 -0
- opscloud/skills/merge.py +65 -0
- opscloud/skills/registry.py +263 -0
- opscloud/skills/sources.py +174 -0
- opscloud/skills/trust.py +417 -0
- opscloud/state/__init__.py +142 -0
- opscloud/state/base.py +154 -0
- opscloud/state/cloud_context.py +262 -0
- opscloud/state/goal_channels.py +124 -0
- opscloud/state/goal_state_limits.py +175 -0
- opscloud/state/resume_state.py +58 -0
- opscloud/state/service_context.py +281 -0
- opscloud/state/session.py +957 -0
- opscloud/state/state_migration.py +86 -0
- opscloud/subagents/__init__.py +30 -0
- opscloud/subagents/loader.py +331 -0
- opscloud/subagents/subagents_parser.py +117 -0
- opscloud/subagents/types.py +25 -0
- opscloud/tools/__init__.py +36 -0
- opscloud/tools/catalog.py +37 -0
- opscloud/tools/display.py +24 -0
- opscloud/tools/fetch_url.py +176 -0
- opscloud/tools/goal_tools.py +423 -0
- opscloud/tools/registry.py +105 -0
- opscloud/tools/thread.py +32 -0
- opscloud/tools/web_search.py +215 -0
- opscloud/ui/__init__.py +119 -0
- opscloud/ui/app.py +5400 -0
- opscloud/ui/app.tcss +479 -0
- opscloud/ui/clipboard.py +147 -0
- opscloud/ui/command_registry.py +482 -0
- opscloud/ui/message_store.py +152 -0
- opscloud/ui/permission_store.py +360 -0
- opscloud/ui/preferences.py +113 -0
- opscloud/ui/prompt_manager.py +96 -0
- opscloud/ui/remote_client.py +505 -0
- opscloud/ui/textual_adapter.py +1269 -0
- opscloud/ui/theme.py +728 -0
- opscloud/ui/ui_help.py +415 -0
- opscloud/ui/widgets/__init__.py +383 -0
- opscloud/ui/widgets/_ask_user_types.py +81 -0
- opscloud/ui/widgets/_copy_spans.py +52 -0
- opscloud/ui/widgets/_inline_prompt.py +290 -0
- opscloud/ui/widgets/_js_eval_display.py +139 -0
- opscloud/ui/widgets/_links.py +175 -0
- opscloud/ui/widgets/_tool_stream.py +308 -0
- opscloud/ui/widgets/agent_selector.py +297 -0
- opscloud/ui/widgets/approval.py +741 -0
- opscloud/ui/widgets/ask_user.py +539 -0
- opscloud/ui/widgets/auth.py +695 -0
- opscloud/ui/widgets/auth_manager.py +214 -0
- opscloud/ui/widgets/auto_mode_notice.py +146 -0
- opscloud/ui/widgets/autocomplete.py +709 -0
- opscloud/ui/widgets/chat_input.py +805 -0
- opscloud/ui/widgets/cloud_selector.py +528 -0
- opscloud/ui/widgets/config_manager.py +652 -0
- opscloud/ui/widgets/debug_console.py +1269 -0
- opscloud/ui/widgets/devops_renderers.py +184 -0
- opscloud/ui/widgets/diff.py +237 -0
- opscloud/ui/widgets/effort_selector.py +166 -0
- opscloud/ui/widgets/goal_review.py +612 -0
- opscloud/ui/widgets/goal_status.py +57 -0
- opscloud/ui/widgets/infra_panel.py +141 -0
- opscloud/ui/widgets/install_confirm.py +114 -0
- opscloud/ui/widgets/loading.py +170 -0
- opscloud/ui/widgets/mcp_viewer.py +1204 -0
- opscloud/ui/widgets/messages.py +4461 -0
- opscloud/ui/widgets/model_selector.py +863 -0
- opscloud/ui/widgets/notification_center.py +108 -0
- opscloud/ui/widgets/notification_settings.py +119 -0
- opscloud/ui/widgets/operation_card.py +106 -0
- opscloud/ui/widgets/permissions_manager.py +667 -0
- opscloud/ui/widgets/plugin_manager.py +1212 -0
- opscloud/ui/widgets/pool_selector.py +376 -0
- opscloud/ui/widgets/preamble.py +53 -0
- opscloud/ui/widgets/skills_viewer.py +432 -0
- opscloud/ui/widgets/status.py +1037 -0
- opscloud/ui/widgets/subagent_panel.py +927 -0
- opscloud/ui/widgets/theme_selector.py +232 -0
- opscloud/ui/widgets/thread_selector.py +358 -0
- opscloud/ui/widgets/toast.py +31 -0
- opscloud/ui/widgets/tool_display.py +325 -0
- opscloud/ui/widgets/tool_renderers.py +234 -0
- opscloud/ui/widgets/tool_widgets.py +278 -0
- opscloud/ui/widgets/welcome.py +421 -0
- opscloud/ui/widgets/welcome_popup.py +102 -0
- opscloud/utils/__init__.py +24 -0
- opscloud/utils/cost_estimation.py +169 -0
- opscloud/utils/git.py +390 -0
- opscloud/utils/logger.py +571 -0
- opscloud/utils/session_stats.py +115 -0
- opscloud/utils/startup_error.py +37 -0
- talkops_opscloud-0.3.0b1.dist-info/METADATA +449 -0
- talkops_opscloud-0.3.0b1.dist-info/RECORD +309 -0
- talkops_opscloud-0.3.0b1.dist-info/WHEEL +4 -0
- talkops_opscloud-0.3.0b1.dist-info/entry_points.txt +2 -0
- talkops_opscloud-0.3.0b1.dist-info/licenses/LICENSE +175 -0
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
"""Cloud context, environment, and resource tracking state channels for OpsCloud.
|
|
2
|
+
|
|
3
|
+
Provides strongly typed cloud provider context (AWS, Azure, GCP, Kubernetes,
|
|
4
|
+
Terraform/IaC), safety execution flags (dry-run, production environment), and
|
|
5
|
+
an accumulating audit of cloud resources touched during an operational session.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from datetime import datetime, timezone
|
|
11
|
+
from typing import (
|
|
12
|
+
Annotated,
|
|
13
|
+
Any,
|
|
14
|
+
Literal,
|
|
15
|
+
NotRequired,
|
|
16
|
+
TypedDict,
|
|
17
|
+
cast,
|
|
18
|
+
get_args,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
from langchain.agents.middleware.types import (
|
|
22
|
+
AgentState,
|
|
23
|
+
PrivateStateAttr,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
CloudProvider = Literal[
|
|
27
|
+
"aws",
|
|
28
|
+
"azure",
|
|
29
|
+
"gcp",
|
|
30
|
+
"kubernetes",
|
|
31
|
+
"terraform",
|
|
32
|
+
"multi",
|
|
33
|
+
"local",
|
|
34
|
+
]
|
|
35
|
+
"""Supported cloud platforms and operational domains."""
|
|
36
|
+
|
|
37
|
+
_CLOUD_PROVIDERS: frozenset[str] = frozenset(get_args(CloudProvider))
|
|
38
|
+
|
|
39
|
+
CloudResourceAction = Literal["inspected", "created", "modified", "deleted"]
|
|
40
|
+
"""Action taken on a cloud resource."""
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class AWSContext(TypedDict, total=False):
|
|
44
|
+
"""Active AWS session identity and region."""
|
|
45
|
+
|
|
46
|
+
profile: str | None
|
|
47
|
+
region: str | None
|
|
48
|
+
account_id: str | None
|
|
49
|
+
role_arn: str | None
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class AzureContext(TypedDict, total=False):
|
|
53
|
+
"""Active Azure subscription and resource group context."""
|
|
54
|
+
|
|
55
|
+
subscription_id: str | None
|
|
56
|
+
tenant_id: str | None
|
|
57
|
+
resource_group: str | None
|
|
58
|
+
location: str | None
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class GCPContext(TypedDict, total=False):
|
|
62
|
+
"""Active Google Cloud project and zone context."""
|
|
63
|
+
|
|
64
|
+
project_id: str | None
|
|
65
|
+
region: str | None
|
|
66
|
+
zone: str | None
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class K8sContext(TypedDict, total=False):
|
|
70
|
+
"""Active Kubernetes cluster and namespace context."""
|
|
71
|
+
|
|
72
|
+
current_context: str | None
|
|
73
|
+
cluster_name: str | None
|
|
74
|
+
namespace: str | None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
class IaCContext(TypedDict, total=False):
|
|
78
|
+
"""Active Infrastructure-as-Code workspace context."""
|
|
79
|
+
|
|
80
|
+
tool: Literal["terraform", "opentofu", "pulumi", "terragrunt"]
|
|
81
|
+
workspace: str | None
|
|
82
|
+
working_dir: str | None
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class CloudEnvironmentContext(TypedDict, total=False):
|
|
86
|
+
"""Composite container holding active cloud provider details."""
|
|
87
|
+
|
|
88
|
+
active_provider: CloudProvider
|
|
89
|
+
aws: AWSContext
|
|
90
|
+
azure: AzureContext
|
|
91
|
+
gcp: GCPContext
|
|
92
|
+
k8s: K8sContext
|
|
93
|
+
iac: IaCContext
|
|
94
|
+
is_production: bool
|
|
95
|
+
notes: str | None
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
class CloudResourceRef(TypedDict):
|
|
99
|
+
"""Audit record for a cloud resource inspected or modified during the session."""
|
|
100
|
+
|
|
101
|
+
provider: str
|
|
102
|
+
resource_type: str
|
|
103
|
+
resource_id: str
|
|
104
|
+
action: CloudResourceAction
|
|
105
|
+
timestamp: str
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def _merge_cloud_context(
|
|
109
|
+
existing: CloudEnvironmentContext | None,
|
|
110
|
+
new: CloudEnvironmentContext | None,
|
|
111
|
+
) -> CloudEnvironmentContext | None:
|
|
112
|
+
"""Reducer merging two cloud context snapshots."""
|
|
113
|
+
if not existing:
|
|
114
|
+
return new
|
|
115
|
+
if not new:
|
|
116
|
+
return existing
|
|
117
|
+
merged: dict[str, Any] = dict(existing)
|
|
118
|
+
for key, value in new.items():
|
|
119
|
+
existing_val = merged.get(key)
|
|
120
|
+
if isinstance(value, dict) and isinstance(existing_val, dict):
|
|
121
|
+
merged[key] = {**existing_val, **value}
|
|
122
|
+
else:
|
|
123
|
+
merged[key] = value
|
|
124
|
+
return cast(CloudEnvironmentContext, merged)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _merge_cloud_resources(
|
|
128
|
+
existing: list[CloudResourceRef] | None,
|
|
129
|
+
new: list[CloudResourceRef] | None,
|
|
130
|
+
) -> list[CloudResourceRef]:
|
|
131
|
+
"""Accumulating reducer for touched cloud resources preserving order and unique entries."""
|
|
132
|
+
if not existing:
|
|
133
|
+
return list(new or [])
|
|
134
|
+
if not new:
|
|
135
|
+
return list(existing)
|
|
136
|
+
|
|
137
|
+
seen: set[tuple[str, str, str, str]] = {
|
|
138
|
+
(r["provider"], r["resource_type"], r["resource_id"], r["action"])
|
|
139
|
+
for r in existing
|
|
140
|
+
}
|
|
141
|
+
result = list(existing)
|
|
142
|
+
for ref in new:
|
|
143
|
+
key = (ref["provider"], ref["resource_type"], ref["resource_id"], ref["action"])
|
|
144
|
+
if key not in seen:
|
|
145
|
+
seen.add(key)
|
|
146
|
+
result.append(ref)
|
|
147
|
+
return result
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def coerce_cloud_provider(value: object) -> CloudProvider | None:
|
|
151
|
+
"""Narrow an untrusted value to a valid CloudProvider."""
|
|
152
|
+
if isinstance(value, str) and value in _CLOUD_PROVIDERS:
|
|
153
|
+
return cast(CloudProvider, value)
|
|
154
|
+
return None
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def make_resource_ref(
|
|
158
|
+
provider: str,
|
|
159
|
+
resource_type: str,
|
|
160
|
+
resource_id: str,
|
|
161
|
+
action: CloudResourceAction,
|
|
162
|
+
) -> CloudResourceRef:
|
|
163
|
+
"""Convenience factory for constructing a CloudResourceRef."""
|
|
164
|
+
return {
|
|
165
|
+
"provider": provider,
|
|
166
|
+
"resource_type": resource_type,
|
|
167
|
+
"resource_id": resource_id,
|
|
168
|
+
"action": action,
|
|
169
|
+
"timestamp": datetime.now(timezone.utc).isoformat(),
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def format_cloud_badge(cloud_ctx: CloudEnvironmentContext | None) -> str:
|
|
174
|
+
"""Format a compact string badge representing active cloud context (for TUI/CLI)."""
|
|
175
|
+
if not cloud_ctx:
|
|
176
|
+
return ""
|
|
177
|
+
provider = cloud_ctx.get("active_provider")
|
|
178
|
+
if not provider:
|
|
179
|
+
return ""
|
|
180
|
+
|
|
181
|
+
if provider == "aws":
|
|
182
|
+
aws = cloud_ctx.get("aws", {})
|
|
183
|
+
region = aws.get("region") or ""
|
|
184
|
+
profile = aws.get("profile") or ""
|
|
185
|
+
return f"[AWS {profile or region or 'default'}]"
|
|
186
|
+
if provider == "kubernetes":
|
|
187
|
+
k8s = cloud_ctx.get("k8s", {})
|
|
188
|
+
ctx = k8s.get("current_context") or "default"
|
|
189
|
+
ns = k8s.get("namespace")
|
|
190
|
+
return f"[K8s {ctx}/{ns}]" if ns else f"[K8s {ctx}]"
|
|
191
|
+
if provider == "azure":
|
|
192
|
+
az = cloud_ctx.get("azure", {})
|
|
193
|
+
rg = az.get("resource_group") or ""
|
|
194
|
+
return f"[Azure {rg}]" if rg else "[Azure]"
|
|
195
|
+
if provider == "gcp":
|
|
196
|
+
gcp = cloud_ctx.get("gcp", {})
|
|
197
|
+
proj = gcp.get("project_id") or ""
|
|
198
|
+
return f"[GCP {proj}]" if proj else "[GCP]"
|
|
199
|
+
if provider == "terraform":
|
|
200
|
+
iac = cloud_ctx.get("iac", {})
|
|
201
|
+
ws = iac.get("workspace") or "default"
|
|
202
|
+
return f"[TF {ws}]"
|
|
203
|
+
return f"[{provider.upper()}]"
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class CloudContextState(AgentState):
|
|
207
|
+
"""State channels for cloud operations context and execution boundaries."""
|
|
208
|
+
|
|
209
|
+
_active_cloud_provider: Annotated[
|
|
210
|
+
NotRequired[CloudProvider | None],
|
|
211
|
+
PrivateStateAttr,
|
|
212
|
+
]
|
|
213
|
+
"""Current primary cloud provider (aws, azure, gcp, kubernetes, terraform, etc.)."""
|
|
214
|
+
|
|
215
|
+
_cloud_context: Annotated[
|
|
216
|
+
NotRequired[CloudEnvironmentContext | None],
|
|
217
|
+
PrivateStateAttr,
|
|
218
|
+
_merge_cloud_context,
|
|
219
|
+
]
|
|
220
|
+
"""Structured environment details (profiles, accounts, subscriptions, regions, clusters)."""
|
|
221
|
+
|
|
222
|
+
_cloud_resources_touched: Annotated[
|
|
223
|
+
NotRequired[list[CloudResourceRef]],
|
|
224
|
+
PrivateStateAttr,
|
|
225
|
+
_merge_cloud_resources,
|
|
226
|
+
]
|
|
227
|
+
"""Accumulating audit trail of all cloud resources inspected, created, modified, or deleted."""
|
|
228
|
+
|
|
229
|
+
_dry_run: Annotated[
|
|
230
|
+
NotRequired[bool],
|
|
231
|
+
PrivateStateAttr,
|
|
232
|
+
]
|
|
233
|
+
"""Whether cloud operations should run in simulation / plan / dry-run mode."""
|
|
234
|
+
|
|
235
|
+
_is_production_environment: Annotated[
|
|
236
|
+
NotRequired[bool],
|
|
237
|
+
PrivateStateAttr,
|
|
238
|
+
]
|
|
239
|
+
"""Whether the active target environment is production or mission-critical."""
|
|
240
|
+
|
|
241
|
+
_environment_fingerprint: Annotated[
|
|
242
|
+
NotRequired[str | None],
|
|
243
|
+
PrivateStateAttr,
|
|
244
|
+
]
|
|
245
|
+
"""Fingerprint of available CLI binaries (aws, az, gcloud, kubectl, terraform) and credentials."""
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
__all__ = [
|
|
249
|
+
"AWSContext",
|
|
250
|
+
"AzureContext",
|
|
251
|
+
"CloudContextState",
|
|
252
|
+
"CloudEnvironmentContext",
|
|
253
|
+
"CloudProvider",
|
|
254
|
+
"CloudResourceAction",
|
|
255
|
+
"CloudResourceRef",
|
|
256
|
+
"GCPContext",
|
|
257
|
+
"IaCContext",
|
|
258
|
+
"K8sContext",
|
|
259
|
+
"coerce_cloud_provider",
|
|
260
|
+
"format_cloud_badge",
|
|
261
|
+
"make_resource_ref",
|
|
262
|
+
]
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"""Canonical goal and rubric state channels for OpsCloud.
|
|
2
|
+
|
|
3
|
+
``GoalRubricChannels`` declares the single source of truth for checkpointed,
|
|
4
|
+
schema-private channels used by both ``ResumeStateMiddleware`` and
|
|
5
|
+
``goal_tools.GoalToolState``.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import (
|
|
11
|
+
Annotated,
|
|
12
|
+
Literal,
|
|
13
|
+
NotRequired,
|
|
14
|
+
cast,
|
|
15
|
+
get_args,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
from langchain.agents.middleware.types import (
|
|
19
|
+
AgentState,
|
|
20
|
+
PrivateStateAttr,
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
GoalStatus = Literal["active", "paused", "blocked", "complete"]
|
|
24
|
+
"""Lifecycle status of a goal."""
|
|
25
|
+
|
|
26
|
+
GoalProposalKind = Literal["create", "amend"]
|
|
27
|
+
"""Whether a pending review creates a goal or amends the current one."""
|
|
28
|
+
|
|
29
|
+
_GOAL_STATUS_VALUES: frozenset[str] = frozenset(get_args(GoalStatus))
|
|
30
|
+
_GOAL_PROPOSAL_KIND_VALUES: frozenset[str] = frozenset(get_args(GoalProposalKind))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _flatten_literal_values(tp: object) -> frozenset[str]:
|
|
34
|
+
"""Collect every string value from a (possibly unioned) ``Literal`` type."""
|
|
35
|
+
values: set[str] = set()
|
|
36
|
+
for arg in get_args(tp):
|
|
37
|
+
if isinstance(arg, str):
|
|
38
|
+
values.add(arg)
|
|
39
|
+
else:
|
|
40
|
+
values |= _flatten_literal_values(arg)
|
|
41
|
+
return frozenset(values)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
from deepagents.middleware.rubric import RubricResult
|
|
46
|
+
|
|
47
|
+
RUBRIC_RESULT_VALUES: frozenset[str] = _flatten_literal_values(RubricResult)
|
|
48
|
+
except ImportError:
|
|
49
|
+
RUBRIC_RESULT_VALUES = frozenset({"satisfied", "not_satisfied"})
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def coerce_goal_proposal_kind(value: object) -> GoalProposalKind | None:
|
|
53
|
+
"""Narrow a persisted proposal kind to a known value."""
|
|
54
|
+
if isinstance(value, str) and value in _GOAL_PROPOSAL_KIND_VALUES:
|
|
55
|
+
return cast("GoalProposalKind", value)
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def coerce_goal_status(value: object) -> GoalStatus | None:
|
|
60
|
+
"""Narrow a persisted goal-status value to a known ``GoalStatus``."""
|
|
61
|
+
if isinstance(value, str) and value in _GOAL_STATUS_VALUES:
|
|
62
|
+
return cast("GoalStatus", value)
|
|
63
|
+
return None
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class GoalRubricChannels(AgentState):
|
|
67
|
+
"""Canonical goal/rubric state channels shared by schemas touching them."""
|
|
68
|
+
|
|
69
|
+
_goal_objective: Annotated[NotRequired[str | None], PrivateStateAttr]
|
|
70
|
+
"""Accepted goal objective restored on resume."""
|
|
71
|
+
|
|
72
|
+
_goal_status: Annotated[NotRequired[GoalStatus | None], PrivateStateAttr]
|
|
73
|
+
"""Goal status (``active``, ``paused``, ``blocked``, ``complete``)."""
|
|
74
|
+
|
|
75
|
+
_goal_rubric: Annotated[NotRequired[str | None], PrivateStateAttr]
|
|
76
|
+
"""Accepted rubric criteria associated with ``_goal_objective``."""
|
|
77
|
+
|
|
78
|
+
_goal_status_note: Annotated[NotRequired[str | None], PrivateStateAttr]
|
|
79
|
+
"""Persisted completion evidence or blocker note for the goal."""
|
|
80
|
+
|
|
81
|
+
_pending_goal_completion_note: Annotated[NotRequired[str | None], PrivateStateAttr]
|
|
82
|
+
"""Optional agent-provided completion evidence awaiting rubric grading."""
|
|
83
|
+
|
|
84
|
+
_sticky_rubric: Annotated[NotRequired[str | None], PrivateStateAttr]
|
|
85
|
+
"""Persistent rubric criteria owned by the session/TUI."""
|
|
86
|
+
|
|
87
|
+
_pending_goal_objective: Annotated[NotRequired[str | None], PrivateStateAttr]
|
|
88
|
+
"""Goal objective awaiting acceptance of proposed criteria."""
|
|
89
|
+
|
|
90
|
+
_pending_goal_rubric: Annotated[NotRequired[str | None], PrivateStateAttr]
|
|
91
|
+
"""Proposed criteria awaiting user acceptance."""
|
|
92
|
+
|
|
93
|
+
_pending_goal_kind: Annotated[
|
|
94
|
+
NotRequired[GoalProposalKind | None],
|
|
95
|
+
PrivateStateAttr,
|
|
96
|
+
]
|
|
97
|
+
"""Whether the pending review creates or amends a goal."""
|
|
98
|
+
|
|
99
|
+
_pending_goal_request_id: Annotated[NotRequired[str | None], PrivateStateAttr]
|
|
100
|
+
"""Request ID that produced the pending proposal."""
|
|
101
|
+
|
|
102
|
+
_rubric_model_spec: Annotated[NotRequired[str | None], PrivateStateAttr]
|
|
103
|
+
"""Thread-scoped rubric model selection."""
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
INHERIT_RUBRIC_MODEL = "__opscloud_inherit_rubric__"
|
|
107
|
+
"""Checkpoint sentinel indicating rubric grading follows the active main model."""
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def coerce_model_spec(value: object) -> str | None:
|
|
111
|
+
"""Narrow a persisted model-spec channel to a usable value."""
|
|
112
|
+
return value.strip() if isinstance(value, str) and value.strip() else None
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
__all__ = [
|
|
116
|
+
"INHERIT_RUBRIC_MODEL",
|
|
117
|
+
"RUBRIC_RESULT_VALUES",
|
|
118
|
+
"GoalProposalKind",
|
|
119
|
+
"GoalRubricChannels",
|
|
120
|
+
"GoalStatus",
|
|
121
|
+
"coerce_goal_proposal_kind",
|
|
122
|
+
"coerce_goal_status",
|
|
123
|
+
"coerce_model_spec",
|
|
124
|
+
]
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"""Shared size limits and validation for OpsCloud goal and rubric state.
|
|
2
|
+
|
|
3
|
+
Defines model-visible character budgets and validation routines to protect
|
|
4
|
+
conversation context windows from oversized prompts, criteria, or status notes.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import html
|
|
10
|
+
from typing import Final, Literal, get_args
|
|
11
|
+
|
|
12
|
+
GoalStatus = Literal["active", "paused", "blocked", "complete"]
|
|
13
|
+
"""Lifecycle status of an OpsCloud goal."""
|
|
14
|
+
|
|
15
|
+
GOAL_STATUS_VALUES: Final[frozenset[str]] = frozenset(get_args(GoalStatus))
|
|
16
|
+
"""All recognized goal status literals."""
|
|
17
|
+
|
|
18
|
+
GOAL_OBJECTIVE_CHAR_LIMIT: Final = 8_000
|
|
19
|
+
"""Maximum character length for a single goal objective."""
|
|
20
|
+
|
|
21
|
+
RUBRIC_CHAR_LIMIT: Final = 12_000
|
|
22
|
+
"""Maximum character length for rubric / acceptance criteria text."""
|
|
23
|
+
|
|
24
|
+
GOAL_APPLICATION_CHAR_LIMIT: Final = 12_000
|
|
25
|
+
"""Maximum combined character length for an accepted objective and its criteria."""
|
|
26
|
+
|
|
27
|
+
GOAL_STATUS_NOTE_CHAR_LIMIT: Final = 4_000
|
|
28
|
+
"""Maximum character length for completion evidence or blocker notes."""
|
|
29
|
+
|
|
30
|
+
GOAL_NOTICE_TEXT_CHAR_LIMIT: Final = (
|
|
31
|
+
GOAL_APPLICATION_CHAR_LIMIT + GOAL_STATUS_NOTE_CHAR_LIMIT
|
|
32
|
+
)
|
|
33
|
+
"""Maximum combined rendered characters allowed in a single goal-state notice."""
|
|
34
|
+
|
|
35
|
+
GoalStateSizeLabel = Literal[
|
|
36
|
+
"Goal objective",
|
|
37
|
+
"Rubric",
|
|
38
|
+
"Goal status note",
|
|
39
|
+
"Prior blocker",
|
|
40
|
+
"Goal objective and criteria combined",
|
|
41
|
+
"Goal-state notice text",
|
|
42
|
+
]
|
|
43
|
+
"""Allowed labels for GoalStateSizeError."""
|
|
44
|
+
|
|
45
|
+
GoalStatusNoteLabel = Literal["Goal status note", "Prior blocker"]
|
|
46
|
+
"""Allowed labels for status note size validation."""
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class GoalStateSizeError(ValueError):
|
|
50
|
+
"""Raised when goal or rubric content exceeds configured context limits."""
|
|
51
|
+
|
|
52
|
+
def __init__(
|
|
53
|
+
self,
|
|
54
|
+
label: GoalStateSizeLabel,
|
|
55
|
+
actual: int,
|
|
56
|
+
limit: int,
|
|
57
|
+
) -> None:
|
|
58
|
+
if actual <= limit:
|
|
59
|
+
msg = (
|
|
60
|
+
f"GoalStateSizeError needs actual > limit; got "
|
|
61
|
+
f"actual={actual}, limit={limit} for {label!r}."
|
|
62
|
+
)
|
|
63
|
+
raise ValueError(msg)
|
|
64
|
+
self.label = label
|
|
65
|
+
self.actual = actual
|
|
66
|
+
self.limit = limit
|
|
67
|
+
self.excess = actual - limit
|
|
68
|
+
super().__init__(
|
|
69
|
+
f"{label} is {actual:,} characters; maximum is {limit:,}. "
|
|
70
|
+
f"Remove at least {self.excess:,} characters."
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def validate_goal_objective(text: str) -> None:
|
|
75
|
+
"""Validate that the goal objective does not exceed its character limit."""
|
|
76
|
+
if not text.strip():
|
|
77
|
+
msg = "must contain non-whitespace text"
|
|
78
|
+
raise ValueError(msg)
|
|
79
|
+
if len(text) > GOAL_OBJECTIVE_CHAR_LIMIT:
|
|
80
|
+
raise GoalStateSizeError("Goal objective", len(text), GOAL_OBJECTIVE_CHAR_LIMIT)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def validate_rubric(text: str) -> None:
|
|
84
|
+
"""Validate that the rubric criteria text does not exceed its character limit."""
|
|
85
|
+
if not text.strip():
|
|
86
|
+
msg = "must contain non-whitespace text"
|
|
87
|
+
raise ValueError(msg)
|
|
88
|
+
if len(text) > RUBRIC_CHAR_LIMIT:
|
|
89
|
+
raise GoalStateSizeError("Rubric", len(text), RUBRIC_CHAR_LIMIT)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def validate_goal_status_note(
|
|
93
|
+
text: str,
|
|
94
|
+
label: GoalStatusNoteLabel = "Goal status note",
|
|
95
|
+
) -> None:
|
|
96
|
+
"""Validate that a completion note or blocker note does not exceed limits."""
|
|
97
|
+
if not text.strip():
|
|
98
|
+
msg = "must contain non-whitespace text"
|
|
99
|
+
raise ValueError(msg)
|
|
100
|
+
if len(text) > GOAL_STATUS_NOTE_CHAR_LIMIT:
|
|
101
|
+
raise GoalStateSizeError(label, len(text), GOAL_STATUS_NOTE_CHAR_LIMIT)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def validate_goal_application_total(objective: str, criteria: str) -> None:
|
|
105
|
+
"""Validate the aggregate length of objective and criteria combined."""
|
|
106
|
+
total = len(objective) + len(criteria)
|
|
107
|
+
if total > GOAL_APPLICATION_CHAR_LIMIT:
|
|
108
|
+
raise GoalStateSizeError(
|
|
109
|
+
"Goal objective and criteria combined",
|
|
110
|
+
total,
|
|
111
|
+
GOAL_APPLICATION_CHAR_LIMIT,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def validate_goal_application_rendered_total(objective: str, criteria: str) -> None:
|
|
116
|
+
"""Validate the escaped size an accepted pair will occupy in the notice."""
|
|
117
|
+
total = len(html.escape(objective, quote=False)) + len(
|
|
118
|
+
html.escape(criteria, quote=False)
|
|
119
|
+
)
|
|
120
|
+
if total > GOAL_NOTICE_TEXT_CHAR_LIMIT:
|
|
121
|
+
raise GoalStateSizeError(
|
|
122
|
+
"Goal objective and criteria combined",
|
|
123
|
+
total,
|
|
124
|
+
GOAL_NOTICE_TEXT_CHAR_LIMIT,
|
|
125
|
+
)
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def validate_goal_objective_rendered(objective: str) -> None:
|
|
129
|
+
"""Reject an objective whose escaped text alone cannot fit a notice."""
|
|
130
|
+
rendered = len(html.escape(objective, quote=False))
|
|
131
|
+
if rendered >= GOAL_NOTICE_TEXT_CHAR_LIMIT:
|
|
132
|
+
raise GoalStateSizeError(
|
|
133
|
+
"Goal objective",
|
|
134
|
+
rendered,
|
|
135
|
+
GOAL_NOTICE_TEXT_CHAR_LIMIT - 1,
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def validate_goal_application(objective: str, criteria: str) -> None:
|
|
140
|
+
"""Validate individual and aggregate sizes for an objective-criteria pair."""
|
|
141
|
+
validate_goal_objective(objective)
|
|
142
|
+
validate_rubric(criteria)
|
|
143
|
+
validate_goal_application_total(objective, criteria)
|
|
144
|
+
validate_goal_application_rendered_total(objective, criteria)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
def validate_goal_notice_text(
|
|
148
|
+
*,
|
|
149
|
+
objective: str | None,
|
|
150
|
+
criteria: str | None,
|
|
151
|
+
status_note: str | None,
|
|
152
|
+
prior_blocker: str | None = None,
|
|
153
|
+
) -> None:
|
|
154
|
+
"""Validate every user-controlled section of a goal-state notice."""
|
|
155
|
+
if objective is not None and criteria is not None:
|
|
156
|
+
validate_goal_application(objective, criteria)
|
|
157
|
+
elif objective is not None:
|
|
158
|
+
validate_goal_objective(objective)
|
|
159
|
+
elif criteria is not None:
|
|
160
|
+
validate_rubric(criteria)
|
|
161
|
+
if status_note is not None:
|
|
162
|
+
validate_goal_status_note(status_note)
|
|
163
|
+
if prior_blocker is not None:
|
|
164
|
+
validate_goal_status_note(prior_blocker, label="Prior blocker")
|
|
165
|
+
total = sum(
|
|
166
|
+
len(html.escape(value, quote=False))
|
|
167
|
+
for value in (objective, criteria, status_note, prior_blocker)
|
|
168
|
+
if value is not None
|
|
169
|
+
)
|
|
170
|
+
if total > GOAL_NOTICE_TEXT_CHAR_LIMIT:
|
|
171
|
+
raise GoalStateSizeError(
|
|
172
|
+
"Goal-state notice text",
|
|
173
|
+
total,
|
|
174
|
+
GOAL_NOTICE_TEXT_CHAR_LIMIT,
|
|
175
|
+
)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""State channels for per-checkpoint facts restored on resume.
|
|
2
|
+
|
|
3
|
+
Tracks model selections, token counts, cold cache timestamps, and pending goal
|
|
4
|
+
reviews that survive process boundaries and thread restores.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Annotated, Any, NotRequired
|
|
10
|
+
|
|
11
|
+
from langchain.agents.middleware.types import PrivateStateAttr
|
|
12
|
+
|
|
13
|
+
from opscloud.state.goal_channels import (
|
|
14
|
+
GoalRubricChannels,
|
|
15
|
+
INHERIT_RUBRIC_MODEL,
|
|
16
|
+
coerce_model_spec,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class ResumeState(GoalRubricChannels):
|
|
21
|
+
"""Extends agent state with per-checkpoint operational facts restored on resume."""
|
|
22
|
+
|
|
23
|
+
_context_tokens: Annotated[
|
|
24
|
+
NotRequired[int | None],
|
|
25
|
+
PrivateStateAttr,
|
|
26
|
+
]
|
|
27
|
+
"""Total context tokens reported by the model's last usage_metadata."""
|
|
28
|
+
|
|
29
|
+
_model_spec: Annotated[
|
|
30
|
+
NotRequired[str | None],
|
|
31
|
+
PrivateStateAttr,
|
|
32
|
+
]
|
|
33
|
+
"""Model spec (provider:model) effectively in use for the latest turn."""
|
|
34
|
+
|
|
35
|
+
_model_params: Annotated[
|
|
36
|
+
NotRequired[dict[str, Any] | None],
|
|
37
|
+
PrivateStateAttr,
|
|
38
|
+
]
|
|
39
|
+
"""Model configuration parameters effectively in use for the latest turn."""
|
|
40
|
+
|
|
41
|
+
_last_model_request_at: Annotated[
|
|
42
|
+
NotRequired[str | None],
|
|
43
|
+
PrivateStateAttr,
|
|
44
|
+
]
|
|
45
|
+
"""UTC request timestamp for the latest successful main model call."""
|
|
46
|
+
|
|
47
|
+
_last_cache_model_spec: Annotated[
|
|
48
|
+
NotRequired[str | None],
|
|
49
|
+
PrivateStateAttr,
|
|
50
|
+
]
|
|
51
|
+
"""Requested model spec associated with _last_model_request_at."""
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
__all__ = [
|
|
55
|
+
"INHERIT_RUBRIC_MODEL",
|
|
56
|
+
"ResumeState",
|
|
57
|
+
"coerce_model_spec",
|
|
58
|
+
]
|