execweave 1.0.0__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.
- execweave/__init__.py +3 -0
- execweave/__main__.py +5 -0
- execweave/_conversation_records_core.py +902 -0
- execweave/_dashboard_shell_base.py +148 -0
- execweave/_http_proxy_base.py +565 -0
- execweave/_http_proxy_bounded.py +560 -0
- execweave/_http_proxy_stage.py +509 -0
- execweave/acceptance_output.py +19 -0
- execweave/agent_bootstrap.py +395 -0
- execweave/agent_topology.py +313 -0
- execweave/agent_trace.py +1162 -0
- execweave/agy_preview_sanitize.py +102 -0
- execweave/analysis.py +427 -0
- execweave/anthropic.py +228 -0
- execweave/anthropic_cli.py +171 -0
- execweave/anthropic_full_fidelity.py +385 -0
- execweave/antigravity_adapter.py +112 -0
- execweave/antigravity_adapter_base.py +479 -0
- execweave/antigravity_full_fidelity.py +656 -0
- execweave/antigravity_full_fidelity_base.py +172 -0
- execweave/antigravity_full_fidelity_collaboration_base.py +451 -0
- execweave/antigravity_hook_cli.py +209 -0
- execweave/antigravity_record.py +96 -0
- execweave/antigravity_subagent_linkage.py +449 -0
- execweave/antigravity_trace_capability.py +39 -0
- execweave/auto_specialized.py +547 -0
- execweave/backends.py +102 -0
- execweave/benchmark.py +80 -0
- execweave/claude_adapter.py +517 -0
- execweave/claude_child_transcript.py +314 -0
- execweave/claude_delegation.py +136 -0
- execweave/claude_full_fidelity.py +396 -0
- execweave/claude_hook_cli.py +209 -0
- execweave/claude_hook_contract.py +943 -0
- execweave/claude_model_observer.py +353 -0
- execweave/claude_record.py +106 -0
- execweave/cli.py +629 -0
- execweave/codex_adapter.py +455 -0
- execweave/codex_conversation.py +621 -0
- execweave/codex_full_fidelity.py +287 -0
- execweave/codex_hook_cli.py +301 -0
- execweave/codex_hook_entry.py +207 -0
- execweave/codex_hook_lifecycle.py +363 -0
- execweave/codex_message_diagnostics.py +322 -0
- execweave/codex_message_transport_diagnostics.py +399 -0
- execweave/codex_record.py +199 -0
- execweave/codex_rollout_structures.py +402 -0
- execweave/codex_rollout_trace.py +56 -0
- execweave/codex_rollout_trace_base.py +1509 -0
- execweave/collector.py +768 -0
- execweave/command.py +157 -0
- execweave/command_privacy.py +20 -0
- execweave/content_evidence.py +101 -0
- execweave/content_integrity.py +289 -0
- execweave/content_store.py +273 -0
- execweave/controlled_checks.py +561 -0
- execweave/conversation_archive.py +338 -0
- execweave/conversation_message_identity.py +264 -0
- execweave/conversation_preview.py +66 -0
- execweave/conversation_preview_antigravity.py +32 -0
- execweave/conversation_preview_claude.py +31 -0
- execweave/conversation_preview_codex.py +107 -0
- execweave/conversation_preview_common.py +180 -0
- execweave/conversation_preview_generic.py +188 -0
- execweave/conversation_preview_lines.py +133 -0
- execweave/conversation_preview_transcript.py +121 -0
- execweave/conversation_records.py +349 -0
- execweave/conversation_records_antigravity.py +370 -0
- execweave/conversation_records_codex.py +83 -0
- execweave/conversation_records_common.py +17 -0
- execweave/conversation_records_ollama.py +39 -0
- execweave/correlation.py +818 -0
- execweave/cursor_adapter.py +349 -0
- execweave/cursor_delegation.py +87 -0
- execweave/cursor_delegation_base.py +220 -0
- execweave/cursor_full_fidelity.py +489 -0
- execweave/cursor_hook_cli.py +195 -0
- execweave/cursor_hook_contract.py +439 -0
- execweave/cursor_lifecycle.py +159 -0
- execweave/cursor_record.py +96 -0
- execweave/dashboard_shell.py +283 -0
- execweave/delivery_status.py +94 -0
- execweave/entry.py +98 -0
- execweave/evidence_availability.py +113 -0
- execweave/evidence_grade.py +166 -0
- execweave/fidelity.py +304 -0
- execweave/filesystem.py +327 -0
- execweave/finalization.py +92 -0
- execweave/focus.py +118 -0
- execweave/framework_adapters/__init__.py +34 -0
- execweave/framework_adapters/autogen.py +398 -0
- execweave/framework_adapters/base.py +580 -0
- execweave/framework_adapters/camel.py +270 -0
- execweave/framework_adapters/camel_channel.py +71 -0
- execweave/framework_adapters/metagpt.py +315 -0
- execweave/framework_adapters/metagpt_ollama_compat.py +54 -0
- execweave/framework_adapters/metagpt_recording.py +342 -0
- execweave/framework_adapters/registry.py +90 -0
- execweave/graph.py +590 -0
- execweave/graph_ops.py +472 -0
- execweave/hook_command.py +32 -0
- execweave/hook_delivery.py +32 -0
- execweave/hook_input.py +16 -0
- execweave/http_proxy.py +187 -0
- execweave/http_proxy_cli.py +84 -0
- execweave/inference_gateway.py +476 -0
- execweave/inference_gateway_cli.py +211 -0
- execweave/inference_gateway_full_fidelity.py +613 -0
- execweave/inference_identity.py +76 -0
- execweave/inference_identity_cli.py +60 -0
- execweave/integrity.py +235 -0
- execweave/integrity_cli.py +55 -0
- execweave/investigation_index.py +445 -0
- execweave/litellm_callback.py +211 -0
- execweave/litellm_callback_cli.py +42 -0
- execweave/live.py +445 -0
- execweave/live_core.py +972 -0
- execweave/live_view.py +109 -0
- execweave/live_view_extra_style.py +11 -0
- execweave/live_view_markup.py +29 -0
- execweave/live_view_process_layout.py +650 -0
- execweave/live_view_readability.py +502 -0
- execweave/live_view_script_a.py +59 -0
- execweave/live_view_script_b.py +97 -0
- execweave/live_view_script_c.py +59 -0
- execweave/live_view_script_d.py +40 -0
- execweave/live_view_style.py +34 -0
- execweave/model_runtime.py +560 -0
- execweave/model_runtime_cli.py +265 -0
- execweave/model_runtime_full_fidelity.py +519 -0
- execweave/observation.py +53 -0
- execweave/observation_demo.py +69 -0
- execweave/openai_agents.py +267 -0
- execweave/openai_agents_sdk.py +453 -0
- execweave/openai_compatible.py +239 -0
- execweave/openai_compatible_cli.py +189 -0
- execweave/openai_compatible_full_fidelity.py +438 -0
- execweave/opencode_adapter.py +325 -0
- execweave/opencode_event_contract.py +734 -0
- execweave/opencode_full_fidelity.py +198 -0
- execweave/opencode_hook_cli.py +119 -0
- execweave/opencode_plugin_cli.py +150 -0
- execweave/opencode_record.py +96 -0
- execweave/opencode_task_linkage.py +225 -0
- execweave/overhead_benchmark.py +440 -0
- execweave/privacy.py +84 -0
- execweave/private_io.py +465 -0
- execweave/provider_capability.py +578 -0
- execweave/provider_lifecycle.py +282 -0
- execweave/provider_record.py +290 -0
- execweave/reader_identity.py +13 -0
- execweave/redacted_archive.py +906 -0
- execweave/risk.py +106 -0
- execweave/rule_pack.py +359 -0
- execweave/rule_pack_cli.py +57 -0
- execweave/run_assessment.py +200 -0
- execweave/runtime_endpoint_availability.py +44 -0
- execweave/scalability_benchmark.py +195 -0
- execweave/schema.py +62 -0
- execweave/scope.py +85 -0
- execweave/semantic.py +453 -0
- execweave/session_summary.py +159 -0
- execweave/sink.py +71 -0
- execweave/strace_backend.py +927 -0
- execweave/stream_assembly.py +363 -0
- execweave/task_artifacts.py +192 -0
- execweave/task_validation.py +317 -0
- execweave/theme.py +40 -0
- execweave/top.py +599 -0
- execweave/top_cli.py +150 -0
- execweave/validate.py +196 -0
- execweave/vendor/dagre.min.js +815 -0
- execweave/view_cli.py +49 -0
- execweave/viewer.py +474 -0
- execweave/viewer_agent_panel.py +630 -0
- execweave/viewer_agent_panel_antigravity.py +31 -0
- execweave/viewer_agent_panel_claude.py +9 -0
- execweave/viewer_agent_panel_codex.py +50 -0
- execweave/viewer_agent_panel_cursor.py +9 -0
- execweave/viewer_agent_panel_default.py +79 -0
- execweave/viewer_agent_panel_ollama.py +20 -0
- execweave/viewer_agent_panel_opencode.py +9 -0
- execweave/viewer_agent_panel_registry.py +20 -0
- execweave/viewer_archive_verifier.py +178 -0
- execweave/viewer_background_files.py +86 -0
- execweave/viewer_content_browser.py +307 -0
- execweave/viewer_content_health.py +208 -0
- execweave/viewer_content_inspector.py +309 -0
- execweave/viewer_controlled_checks.py +258 -0
- execweave/viewer_conversation_sync.py +115 -0
- execweave/viewer_dashboard_clean.py +405 -0
- execweave/viewer_dashboard_focus.py +127 -0
- execweave/viewer_dashboard_hardening.py +264 -0
- execweave/viewer_dashboard_hardening_v2.py +62 -0
- execweave/viewer_dashboard_projection.py +261 -0
- execweave/viewer_delivery_status.py +155 -0
- execweave/viewer_edge_decross.py +117 -0
- execweave/viewer_execution_flow.py +611 -0
- execweave/viewer_execution_flow_provider_normalization.py +107 -0
- execweave/viewer_execution_flow_safety.py +349 -0
- execweave/viewer_external_endpoints.py +307 -0
- execweave/viewer_flow_canvas.py +1140 -0
- execweave/viewer_flow_layout.py +922 -0
- execweave/viewer_fold_state.py +31 -0
- execweave/viewer_framework_flow.py +68 -0
- execweave/viewer_framework_model_output.py +133 -0
- execweave/viewer_gif.py +278 -0
- execweave/viewer_history_browser.py +225 -0
- execweave/viewer_investigation.py +268 -0
- execweave/viewer_layout_geometry.py +192 -0
- execweave/viewer_layout_v2.py +429 -0
- execweave/viewer_layout_v2_detached.py +25 -0
- execweave/viewer_limits.py +93 -0
- execweave/viewer_live_layout.py +61 -0
- execweave/viewer_message_handoffs.py +114 -0
- execweave/viewer_projection.py +488 -0
- execweave/viewer_projection_base.py +522 -0
- execweave/viewer_projection_bridges.py +214 -0
- execweave/viewer_recorded_sources.py +146 -0
- execweave/viewer_run_assessment.py +274 -0
- execweave/viewer_run_guide.py +175 -0
- execweave/viewer_runtime_evidence.py +258 -0
- execweave/viewer_semantic_projection.py +641 -0
- execweave/viewer_session_flow.py +491 -0
- execweave/viewer_structure_share.py +132 -0
- execweave/viewer_task_validation.py +241 -0
- execweave/viewer_tool_mirror_identity.py +75 -0
- execweave/viewer_workflow_mode.py +127 -0
- execweave/workflow.py +183 -0
- execweave-1.0.0.dist-info/METADATA +462 -0
- execweave-1.0.0.dist-info/RECORD +234 -0
- execweave-1.0.0.dist-info/WHEEL +4 -0
- execweave-1.0.0.dist-info/entry_points.txt +30 -0
- execweave-1.0.0.dist-info/licenses/LICENSE +16 -0
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from dataclasses import asdict, dataclass
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
from typing import Any, Iterable
|
|
7
|
+
|
|
8
|
+
from .evidence_availability import (
|
|
9
|
+
AVAILABLE,
|
|
10
|
+
COMPLETE_FROM_SURFACE,
|
|
11
|
+
DECRYPTABILITY_UNKNOWN,
|
|
12
|
+
EVIDENCE_DIRECT_OBSERVATION,
|
|
13
|
+
EVIDENCE_NO_DATA,
|
|
14
|
+
NO_LOCAL_DECRYPTOR_OBSERVED,
|
|
15
|
+
NOT_OBSERVED,
|
|
16
|
+
OPAQUE_ENCRYPTED,
|
|
17
|
+
OPAQUE_SIGNED,
|
|
18
|
+
REDACTED,
|
|
19
|
+
SUMMARY,
|
|
20
|
+
UNKNOWN,
|
|
21
|
+
FieldEvidence,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
REQUIRED_FIELDS = (
|
|
25
|
+
"system",
|
|
26
|
+
"prompt",
|
|
27
|
+
"messages",
|
|
28
|
+
"tool_definitions",
|
|
29
|
+
"tool_arguments",
|
|
30
|
+
"tool_results",
|
|
31
|
+
"assistant_output",
|
|
32
|
+
"reasoning",
|
|
33
|
+
"usage",
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
TIER_REQUIRED = "A"
|
|
37
|
+
TIER_OPTIONAL = "B"
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class CapabilityInventoryEntry:
|
|
42
|
+
client: str
|
|
43
|
+
provider: str
|
|
44
|
+
auth_modes: tuple[str, ...]
|
|
45
|
+
surfaces: tuple[str, ...]
|
|
46
|
+
transport_mode: str
|
|
47
|
+
tier: str
|
|
48
|
+
required_fields: tuple[str, ...] = REQUIRED_FIELDS
|
|
49
|
+
|
|
50
|
+
def to_dict(self) -> dict[str, object]:
|
|
51
|
+
return asdict(self)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
REQUIRED_CAPABILITY_INVENTORY = (
|
|
55
|
+
CapabilityInventoryEntry(
|
|
56
|
+
client="codex-cli",
|
|
57
|
+
provider="openai",
|
|
58
|
+
auth_modes=("api_key", "subscription"),
|
|
59
|
+
surfaces=("agent",),
|
|
60
|
+
transport_mode="direct",
|
|
61
|
+
tier=TIER_REQUIRED,
|
|
62
|
+
),
|
|
63
|
+
CapabilityInventoryEntry(
|
|
64
|
+
client="claude-code",
|
|
65
|
+
provider="anthropic",
|
|
66
|
+
auth_modes=("api_key", "subscription"),
|
|
67
|
+
surfaces=("agent",),
|
|
68
|
+
transport_mode="direct",
|
|
69
|
+
tier=TIER_REQUIRED,
|
|
70
|
+
),
|
|
71
|
+
CapabilityInventoryEntry(
|
|
72
|
+
client="cursor-agent",
|
|
73
|
+
provider="cursor_or_upstream",
|
|
74
|
+
auth_modes=("subscription",),
|
|
75
|
+
surfaces=("agent",),
|
|
76
|
+
transport_mode="direct",
|
|
77
|
+
tier=TIER_REQUIRED,
|
|
78
|
+
),
|
|
79
|
+
CapabilityInventoryEntry(
|
|
80
|
+
client="opencode",
|
|
81
|
+
provider="configured_upstream",
|
|
82
|
+
auth_modes=("api_key",),
|
|
83
|
+
surfaces=("agent",),
|
|
84
|
+
transport_mode="direct",
|
|
85
|
+
tier=TIER_REQUIRED,
|
|
86
|
+
),
|
|
87
|
+
CapabilityInventoryEntry(
|
|
88
|
+
client="ollama",
|
|
89
|
+
provider="local",
|
|
90
|
+
auth_modes=("local",),
|
|
91
|
+
surfaces=("chat", "generate"),
|
|
92
|
+
transport_mode="local_runtime",
|
|
93
|
+
tier=TIER_REQUIRED,
|
|
94
|
+
),
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
OPTIONAL_CAPABILITY_INVENTORY = (
|
|
98
|
+
CapabilityInventoryEntry(
|
|
99
|
+
client="cursor",
|
|
100
|
+
provider="cursor_or_upstream",
|
|
101
|
+
auth_modes=("subscription",),
|
|
102
|
+
surfaces=("autocomplete", "tab"),
|
|
103
|
+
transport_mode="direct",
|
|
104
|
+
tier=TIER_OPTIONAL,
|
|
105
|
+
),
|
|
106
|
+
CapabilityInventoryEntry(
|
|
107
|
+
client="lmstudio",
|
|
108
|
+
provider="local",
|
|
109
|
+
auth_modes=("local",),
|
|
110
|
+
surfaces=("chat",),
|
|
111
|
+
transport_mode="local_runtime",
|
|
112
|
+
tier=TIER_OPTIONAL,
|
|
113
|
+
),
|
|
114
|
+
CapabilityInventoryEntry(
|
|
115
|
+
client="llamacpp",
|
|
116
|
+
provider="local",
|
|
117
|
+
auth_modes=("local",),
|
|
118
|
+
surfaces=("chat", "completion"),
|
|
119
|
+
transport_mode="local_runtime",
|
|
120
|
+
tier=TIER_OPTIONAL,
|
|
121
|
+
),
|
|
122
|
+
CapabilityInventoryEntry(
|
|
123
|
+
client="vllm",
|
|
124
|
+
provider="local",
|
|
125
|
+
auth_modes=("local",),
|
|
126
|
+
surfaces=("chat", "completion"),
|
|
127
|
+
transport_mode="local_runtime",
|
|
128
|
+
tier=TIER_OPTIONAL,
|
|
129
|
+
),
|
|
130
|
+
)
|
|
131
|
+
|
|
132
|
+
CAPABILITY_INVENTORY = REQUIRED_CAPABILITY_INVENTORY + OPTIONAL_CAPABILITY_INVENTORY
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@dataclass(frozen=True)
|
|
136
|
+
class CapabilityObservation:
|
|
137
|
+
client: str
|
|
138
|
+
client_version: str | None
|
|
139
|
+
provider: str
|
|
140
|
+
auth_mode: str
|
|
141
|
+
surface: str
|
|
142
|
+
transport_mode: str
|
|
143
|
+
field: str
|
|
144
|
+
availability: str
|
|
145
|
+
decryptability: str
|
|
146
|
+
evidence_source: str
|
|
147
|
+
evidence_strength: str
|
|
148
|
+
tier: str
|
|
149
|
+
notes: str | None = None
|
|
150
|
+
|
|
151
|
+
def __post_init__(self) -> None:
|
|
152
|
+
FieldEvidence(
|
|
153
|
+
field=self.field,
|
|
154
|
+
availability=self.availability,
|
|
155
|
+
decryptability=self.decryptability,
|
|
156
|
+
evidence_source=self.evidence_source,
|
|
157
|
+
evidence_strength=self.evidence_strength,
|
|
158
|
+
notes=self.notes,
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
def to_dict(self) -> dict[str, object]:
|
|
162
|
+
return asdict(self)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@dataclass(frozen=True)
|
|
166
|
+
class _Match:
|
|
167
|
+
field: str
|
|
168
|
+
availability: str
|
|
169
|
+
decryptability: str
|
|
170
|
+
path: str
|
|
171
|
+
notes: str | None = None
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
_AVAILABILITY_PRIORITY = {
|
|
175
|
+
COMPLETE_FROM_SURFACE: 100,
|
|
176
|
+
AVAILABLE: 90,
|
|
177
|
+
SUMMARY: 80,
|
|
178
|
+
REDACTED: 70,
|
|
179
|
+
OPAQUE_ENCRYPTED: 60,
|
|
180
|
+
OPAQUE_SIGNED: 50,
|
|
181
|
+
UNKNOWN: 0,
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
_TOOL_CALL_TYPES = frozenset(
|
|
185
|
+
{"function_call", "tool_call", "tool_use", "function", "custom_tool_call"}
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
def inventory_as_dict() -> dict[str, object]:
|
|
190
|
+
return {
|
|
191
|
+
"schema_version": 1,
|
|
192
|
+
"required_fields": list(REQUIRED_FIELDS),
|
|
193
|
+
"entries": [entry.to_dict() for entry in CAPABILITY_INVENTORY],
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
def inventory_entry(client: str) -> CapabilityInventoryEntry:
|
|
198
|
+
normalized = client.strip().lower()
|
|
199
|
+
matches = [entry for entry in CAPABILITY_INVENTORY if entry.client == normalized]
|
|
200
|
+
if len(matches) != 1:
|
|
201
|
+
raise ValueError(f"unknown or ambiguous capability client: {client}")
|
|
202
|
+
return matches[0]
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
def _records(path: Path) -> tuple[list[Any], list[str]]:
|
|
206
|
+
errors: list[str] = []
|
|
207
|
+
if path.suffix.lower() == ".jsonl":
|
|
208
|
+
values: list[Any] = []
|
|
209
|
+
try:
|
|
210
|
+
lines = path.read_text(encoding="utf-8").splitlines()
|
|
211
|
+
except OSError as exc:
|
|
212
|
+
return [], [f"{type(exc).__name__}: unable to read artifact"]
|
|
213
|
+
except UnicodeDecodeError:
|
|
214
|
+
return [], ["UnicodeDecodeError: artifact is not UTF-8"]
|
|
215
|
+
for number, line in enumerate(lines, start=1):
|
|
216
|
+
if not line.strip():
|
|
217
|
+
continue
|
|
218
|
+
try:
|
|
219
|
+
values.append(json.loads(line))
|
|
220
|
+
except json.JSONDecodeError as exc:
|
|
221
|
+
errors.append(f"line {number}: {exc.msg}")
|
|
222
|
+
return values, errors
|
|
223
|
+
try:
|
|
224
|
+
text = path.read_text(encoding="utf-8")
|
|
225
|
+
except OSError as exc:
|
|
226
|
+
return [], [f"{type(exc).__name__}: unable to read artifact"]
|
|
227
|
+
except UnicodeDecodeError:
|
|
228
|
+
return [], ["UnicodeDecodeError: artifact is not UTF-8"]
|
|
229
|
+
try:
|
|
230
|
+
value = json.loads(text)
|
|
231
|
+
except json.JSONDecodeError as exc:
|
|
232
|
+
return [], [f"JSONDecodeError: {exc.msg}"]
|
|
233
|
+
return [value], errors
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
def _walk(value: Any, path: str = "$") -> Iterable[tuple[str, Any]]:
|
|
237
|
+
yield path, value
|
|
238
|
+
if isinstance(value, dict):
|
|
239
|
+
for key, child in value.items():
|
|
240
|
+
yield from _walk(child, f"{path}.{key}")
|
|
241
|
+
elif isinstance(value, list):
|
|
242
|
+
for index, child in enumerate(value):
|
|
243
|
+
yield from _walk(child, f"{path}[{index}]")
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
def _nonempty(value: Any) -> bool:
|
|
247
|
+
if value is None:
|
|
248
|
+
return False
|
|
249
|
+
if isinstance(value, (str, list, dict, tuple)):
|
|
250
|
+
return bool(value)
|
|
251
|
+
return True
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
def _redacted(value: Any) -> bool:
|
|
255
|
+
if not isinstance(value, str):
|
|
256
|
+
return False
|
|
257
|
+
normalized = value.strip().lower()
|
|
258
|
+
return normalized in {"[redacted]", "<redacted>", "redacted"}
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
def _match(field: str, path: str, value: Any) -> _Match:
|
|
262
|
+
availability = REDACTED if _redacted(value) else AVAILABLE
|
|
263
|
+
return _Match(field, availability, DECRYPTABILITY_UNKNOWN, path)
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
def _reasoning_matches(path: str, payload: Any) -> list[_Match]:
|
|
267
|
+
if not _nonempty(payload):
|
|
268
|
+
return []
|
|
269
|
+
if not isinstance(payload, dict):
|
|
270
|
+
return [_match("reasoning", path, payload)]
|
|
271
|
+
|
|
272
|
+
matches: list[_Match] = []
|
|
273
|
+
encrypted = payload.get("encrypted_content")
|
|
274
|
+
if isinstance(encrypted, str) and encrypted:
|
|
275
|
+
matches.append(
|
|
276
|
+
_Match(
|
|
277
|
+
"reasoning",
|
|
278
|
+
OPAQUE_ENCRYPTED,
|
|
279
|
+
DECRYPTABILITY_UNKNOWN,
|
|
280
|
+
f"{path}.encrypted_content",
|
|
281
|
+
notes="encrypted reasoning payload observed",
|
|
282
|
+
)
|
|
283
|
+
)
|
|
284
|
+
summary = payload.get("summary")
|
|
285
|
+
if _nonempty(summary):
|
|
286
|
+
matches.append(
|
|
287
|
+
_Match(
|
|
288
|
+
"reasoning",
|
|
289
|
+
SUMMARY,
|
|
290
|
+
DECRYPTABILITY_UNKNOWN,
|
|
291
|
+
f"{path}.summary",
|
|
292
|
+
notes="provider-exposed reasoning summary observed",
|
|
293
|
+
)
|
|
294
|
+
)
|
|
295
|
+
signature = payload.get("signature")
|
|
296
|
+
if _nonempty(signature):
|
|
297
|
+
matches.append(
|
|
298
|
+
_Match(
|
|
299
|
+
"reasoning",
|
|
300
|
+
OPAQUE_SIGNED,
|
|
301
|
+
DECRYPTABILITY_UNKNOWN,
|
|
302
|
+
f"{path}.signature",
|
|
303
|
+
notes="reasoning signature observed",
|
|
304
|
+
)
|
|
305
|
+
)
|
|
306
|
+
for key in ("content", "text", "thinking"):
|
|
307
|
+
if key in payload and _nonempty(payload[key]):
|
|
308
|
+
matches.append(_match("reasoning", f"{path}.{key}", payload[key]))
|
|
309
|
+
|
|
310
|
+
# A readable container with an unknown provider-specific shape is still directly
|
|
311
|
+
# observable, but only use the weak ``available`` state when no more precise form
|
|
312
|
+
# (encrypted, summary, signature, or plaintext field) was identified.
|
|
313
|
+
return matches or [_match("reasoning", path, payload)]
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
def _has_tool_call_context(value: dict[str, Any], item_type: object) -> bool:
|
|
317
|
+
return (
|
|
318
|
+
item_type in _TOOL_CALL_TYPES
|
|
319
|
+
or ("name" in value and "arguments" in value)
|
|
320
|
+
or ("call_id" in value and "arguments" in value)
|
|
321
|
+
or ("tool_call_id" in value and "arguments" in value)
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def _matches_for_object(path: str, value: dict[str, Any]) -> list[_Match]:
|
|
326
|
+
matches: list[_Match] = []
|
|
327
|
+
role = value.get("role")
|
|
328
|
+
item_type = value.get("type")
|
|
329
|
+
|
|
330
|
+
# Preserve provider role semantics. A provider-declared developer message is a
|
|
331
|
+
# message, not evidence that a system-role field existed.
|
|
332
|
+
if role == "system" and _nonempty(value.get("content")):
|
|
333
|
+
matches.append(_match("system", f"{path}.content", value["content"]))
|
|
334
|
+
if role in {"user", "assistant", "system", "developer", "tool", "function"}:
|
|
335
|
+
if "content" in value:
|
|
336
|
+
matches.append(_match("messages", f"{path}.content", value.get("content")))
|
|
337
|
+
if role == "assistant" and _nonempty(value.get("content")):
|
|
338
|
+
matches.append(_match("assistant_output", f"{path}.content", value["content"]))
|
|
339
|
+
if role in {"tool", "function"} and _nonempty(value.get("content")):
|
|
340
|
+
matches.append(_match("tool_results", f"{path}.content", value["content"]))
|
|
341
|
+
|
|
342
|
+
for key in ("system", "system_prompt", "system_instruction", "systemInstruction"):
|
|
343
|
+
if key in value and _nonempty(value[key]):
|
|
344
|
+
matches.append(_match("system", f"{path}.{key}", value[key]))
|
|
345
|
+
for key in ("prompt", "user_prompt"):
|
|
346
|
+
if key in value and _nonempty(value[key]):
|
|
347
|
+
matches.append(_match("prompt", f"{path}.{key}", value[key]))
|
|
348
|
+
for key in ("messages", "contents"):
|
|
349
|
+
if key in value and _nonempty(value[key]):
|
|
350
|
+
matches.append(_match("messages", f"{path}.{key}", value[key]))
|
|
351
|
+
for key in ("tools", "functions", "tool_definitions", "toolDeclarations"):
|
|
352
|
+
if key in value and _nonempty(value[key]):
|
|
353
|
+
matches.append(_match("tool_definitions", f"{path}.{key}", value[key]))
|
|
354
|
+
|
|
355
|
+
for key in ("tool_input", "function_args", "functionArguments"):
|
|
356
|
+
if key in value and _nonempty(value[key]):
|
|
357
|
+
matches.append(_match("tool_arguments", f"{path}.{key}", value[key]))
|
|
358
|
+
if (
|
|
359
|
+
"arguments" in value
|
|
360
|
+
and _nonempty(value["arguments"])
|
|
361
|
+
and _has_tool_call_context(value, item_type)
|
|
362
|
+
):
|
|
363
|
+
matches.append(_match("tool_arguments", f"{path}.arguments", value["arguments"]))
|
|
364
|
+
|
|
365
|
+
for key in ("tool_response", "tool_result", "function_response", "functionResponse"):
|
|
366
|
+
if key in value and _nonempty(value[key]):
|
|
367
|
+
matches.append(_match("tool_results", f"{path}.{key}", value[key]))
|
|
368
|
+
for key in ("output_text", "completion", "response_text"):
|
|
369
|
+
if key in value and _nonempty(value[key]):
|
|
370
|
+
matches.append(_match("assistant_output", f"{path}.{key}", value[key]))
|
|
371
|
+
|
|
372
|
+
if item_type in {"reasoning", "thinking"}:
|
|
373
|
+
matches.extend(_reasoning_matches(path, value))
|
|
374
|
+
for key in ("reasoning", "thinking"):
|
|
375
|
+
if key in value:
|
|
376
|
+
matches.extend(_reasoning_matches(f"{path}.{key}", value[key]))
|
|
377
|
+
|
|
378
|
+
if "usage" in value and _nonempty(value["usage"]):
|
|
379
|
+
matches.append(_match("usage", f"{path}.usage", value["usage"]))
|
|
380
|
+
token_keys = {
|
|
381
|
+
"input_tokens",
|
|
382
|
+
"output_tokens",
|
|
383
|
+
"total_tokens",
|
|
384
|
+
"prompt_tokens",
|
|
385
|
+
"completion_tokens",
|
|
386
|
+
"reasoning_tokens",
|
|
387
|
+
}
|
|
388
|
+
if token_keys.intersection(value):
|
|
389
|
+
matches.append(_match("usage", path, value))
|
|
390
|
+
return matches
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
def _collect_matches(records: Iterable[Any]) -> tuple[dict[str, list[_Match]], str | None]:
|
|
394
|
+
by_field: dict[str, list[_Match]] = {field: [] for field in REQUIRED_FIELDS}
|
|
395
|
+
version: str | None = None
|
|
396
|
+
for record_index, record in enumerate(records):
|
|
397
|
+
for path, value in _walk(record, path=f"$[{record_index}]"):
|
|
398
|
+
if not isinstance(value, dict):
|
|
399
|
+
continue
|
|
400
|
+
if version is None:
|
|
401
|
+
for key in ("cli_version", "client_version"):
|
|
402
|
+
candidate = value.get(key)
|
|
403
|
+
if isinstance(candidate, str) and candidate.strip():
|
|
404
|
+
version = candidate.strip()
|
|
405
|
+
break
|
|
406
|
+
for match in _matches_for_object(path, value):
|
|
407
|
+
by_field[match.field].append(match)
|
|
408
|
+
return by_field, version
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
def _best_match(matches: list[_Match]) -> _Match | None:
|
|
412
|
+
if not matches:
|
|
413
|
+
return None
|
|
414
|
+
return max(matches, key=lambda match: _AVAILABILITY_PRIORITY.get(match.availability, 0))
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
def _artifact_label(path: Path | None) -> str:
|
|
418
|
+
if path is None:
|
|
419
|
+
return "no_data"
|
|
420
|
+
return path.name or "artifact"
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
def _append_note(existing: str | None, extra: str | None) -> str | None:
|
|
424
|
+
if not extra:
|
|
425
|
+
return existing
|
|
426
|
+
return f"{existing}; {extra}" if existing else extra
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
def _observation(
|
|
430
|
+
entry: CapabilityInventoryEntry,
|
|
431
|
+
*,
|
|
432
|
+
auth_mode: str,
|
|
433
|
+
surface: str,
|
|
434
|
+
field: str,
|
|
435
|
+
client_version: str | None,
|
|
436
|
+
match: _Match | None,
|
|
437
|
+
artifact: Path | None,
|
|
438
|
+
reason: str | None,
|
|
439
|
+
parse_warning: str | None,
|
|
440
|
+
codex_no_local_decryptor_observed: bool,
|
|
441
|
+
) -> CapabilityObservation:
|
|
442
|
+
label = _artifact_label(artifact)
|
|
443
|
+
if match is None:
|
|
444
|
+
source = "probe:no_data" if artifact is None else f"artifact:{label}"
|
|
445
|
+
return CapabilityObservation(
|
|
446
|
+
client=entry.client,
|
|
447
|
+
client_version=client_version,
|
|
448
|
+
provider=entry.provider,
|
|
449
|
+
auth_mode=auth_mode,
|
|
450
|
+
surface=surface,
|
|
451
|
+
transport_mode=entry.transport_mode,
|
|
452
|
+
field=field,
|
|
453
|
+
availability=NOT_OBSERVED,
|
|
454
|
+
decryptability=DECRYPTABILITY_UNKNOWN,
|
|
455
|
+
evidence_source=source,
|
|
456
|
+
evidence_strength=EVIDENCE_NO_DATA,
|
|
457
|
+
tier=entry.tier,
|
|
458
|
+
notes=_append_note(reason or "field not observed in supplied artifact", parse_warning),
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
decryptability = match.decryptability
|
|
462
|
+
notes = _append_note(match.notes, parse_warning)
|
|
463
|
+
if (
|
|
464
|
+
entry.client == "codex-cli"
|
|
465
|
+
and field == "reasoning"
|
|
466
|
+
and match.availability == OPAQUE_ENCRYPTED
|
|
467
|
+
and codex_no_local_decryptor_observed
|
|
468
|
+
):
|
|
469
|
+
decryptability = NO_LOCAL_DECRYPTOR_OBSERVED
|
|
470
|
+
notes = _append_note(
|
|
471
|
+
notes,
|
|
472
|
+
"no ExecWeave Codex decryptor marker observed by repository source audit",
|
|
473
|
+
)
|
|
474
|
+
return CapabilityObservation(
|
|
475
|
+
client=entry.client,
|
|
476
|
+
client_version=client_version,
|
|
477
|
+
provider=entry.provider,
|
|
478
|
+
auth_mode=auth_mode,
|
|
479
|
+
surface=surface,
|
|
480
|
+
transport_mode=entry.transport_mode,
|
|
481
|
+
field=field,
|
|
482
|
+
availability=match.availability,
|
|
483
|
+
decryptability=decryptability,
|
|
484
|
+
evidence_source=f"artifact:{label}#{match.path}",
|
|
485
|
+
evidence_strength=EVIDENCE_DIRECT_OBSERVATION,
|
|
486
|
+
tier=entry.tier,
|
|
487
|
+
notes=notes,
|
|
488
|
+
)
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
def probe_artifact(
|
|
492
|
+
entry: CapabilityInventoryEntry,
|
|
493
|
+
artifact: str | Path | None,
|
|
494
|
+
*,
|
|
495
|
+
auth_mode: str,
|
|
496
|
+
surface: str,
|
|
497
|
+
codex_no_local_decryptor_observed: bool = False,
|
|
498
|
+
) -> list[CapabilityObservation]:
|
|
499
|
+
if auth_mode not in entry.auth_modes:
|
|
500
|
+
raise ValueError(f"unsupported auth mode for {entry.client}: {auth_mode}")
|
|
501
|
+
if surface not in entry.surfaces:
|
|
502
|
+
raise ValueError(f"unsupported surface for {entry.client}: {surface}")
|
|
503
|
+
|
|
504
|
+
path = Path(artifact).expanduser() if artifact is not None else None
|
|
505
|
+
if path is None or not path.is_file():
|
|
506
|
+
reason = "artifact not supplied" if path is None else "artifact not found"
|
|
507
|
+
return [
|
|
508
|
+
_observation(
|
|
509
|
+
entry,
|
|
510
|
+
auth_mode=auth_mode,
|
|
511
|
+
surface=surface,
|
|
512
|
+
field=field,
|
|
513
|
+
client_version=None,
|
|
514
|
+
match=None,
|
|
515
|
+
artifact=path,
|
|
516
|
+
reason=reason,
|
|
517
|
+
parse_warning=None,
|
|
518
|
+
codex_no_local_decryptor_observed=codex_no_local_decryptor_observed,
|
|
519
|
+
)
|
|
520
|
+
for field in entry.required_fields
|
|
521
|
+
]
|
|
522
|
+
|
|
523
|
+
records, errors = _records(path)
|
|
524
|
+
matches, version = _collect_matches(records)
|
|
525
|
+
parse_warning = f"artifact parse warning: {'; '.join(errors)}" if errors else None
|
|
526
|
+
observations: list[CapabilityObservation] = []
|
|
527
|
+
for field in entry.required_fields:
|
|
528
|
+
match = _best_match(matches[field])
|
|
529
|
+
observations.append(
|
|
530
|
+
_observation(
|
|
531
|
+
entry,
|
|
532
|
+
auth_mode=auth_mode,
|
|
533
|
+
surface=surface,
|
|
534
|
+
field=field,
|
|
535
|
+
client_version=version,
|
|
536
|
+
match=match,
|
|
537
|
+
artifact=path,
|
|
538
|
+
reason=None,
|
|
539
|
+
parse_warning=parse_warning,
|
|
540
|
+
codex_no_local_decryptor_observed=codex_no_local_decryptor_observed,
|
|
541
|
+
)
|
|
542
|
+
)
|
|
543
|
+
return observations
|
|
544
|
+
|
|
545
|
+
|
|
546
|
+
def not_observed_matrix(reason: str = "artifact not supplied") -> list[CapabilityObservation]:
|
|
547
|
+
observations: list[CapabilityObservation] = []
|
|
548
|
+
for entry in CAPABILITY_INVENTORY:
|
|
549
|
+
for auth_mode in entry.auth_modes:
|
|
550
|
+
for surface in entry.surfaces:
|
|
551
|
+
for field in entry.required_fields:
|
|
552
|
+
observations.append(
|
|
553
|
+
CapabilityObservation(
|
|
554
|
+
client=entry.client,
|
|
555
|
+
client_version=None,
|
|
556
|
+
provider=entry.provider,
|
|
557
|
+
auth_mode=auth_mode,
|
|
558
|
+
surface=surface,
|
|
559
|
+
transport_mode=entry.transport_mode,
|
|
560
|
+
field=field,
|
|
561
|
+
availability=NOT_OBSERVED,
|
|
562
|
+
decryptability=DECRYPTABILITY_UNKNOWN,
|
|
563
|
+
evidence_source="probe:no_data",
|
|
564
|
+
evidence_strength=EVIDENCE_NO_DATA,
|
|
565
|
+
tier=entry.tier,
|
|
566
|
+
notes=reason,
|
|
567
|
+
)
|
|
568
|
+
)
|
|
569
|
+
return observations
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
def matrix_as_dict(observations: Iterable[CapabilityObservation]) -> dict[str, object]:
|
|
573
|
+
rows = [observation.to_dict() for observation in observations]
|
|
574
|
+
return {
|
|
575
|
+
"schema_version": 1,
|
|
576
|
+
"required_fields": list(REQUIRED_FIELDS),
|
|
577
|
+
"rows": rows,
|
|
578
|
+
}
|