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,656 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from . import antigravity_full_fidelity_collaboration_base as _base
|
|
8
|
+
from . import antigravity_adapter_base as _semantic
|
|
9
|
+
from .agent_topology import EVIDENCE_VALIDATED_CHILD_TRANSCRIPT, subagent_topology
|
|
10
|
+
from .antigravity_subagent_linkage import (
|
|
11
|
+
derived_child_agent_path,
|
|
12
|
+
read_transcript_records,
|
|
13
|
+
transcript_subagent_links,
|
|
14
|
+
validated_subagent_links,
|
|
15
|
+
validated_transcript_path,
|
|
16
|
+
)
|
|
17
|
+
from .content_evidence import content_observation_event
|
|
18
|
+
from .content_store import FullFidelityContentStore
|
|
19
|
+
from .conversation_archive import antigravity_conversation_archive_events
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _entity(
|
|
23
|
+
entity_type: str,
|
|
24
|
+
entity_id: str,
|
|
25
|
+
*,
|
|
26
|
+
name: str | None = None,
|
|
27
|
+
attributes: dict[str, Any] | None = None,
|
|
28
|
+
) -> dict[str, Any]:
|
|
29
|
+
return {
|
|
30
|
+
"type": entity_type,
|
|
31
|
+
"id": entity_id,
|
|
32
|
+
"name": name,
|
|
33
|
+
"attributes": attributes or {},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def _assignment_event(
|
|
38
|
+
*,
|
|
39
|
+
timestamp: str,
|
|
40
|
+
conversation_id: str,
|
|
41
|
+
step: int,
|
|
42
|
+
subagent_index: int,
|
|
43
|
+
child_id: str,
|
|
44
|
+
spec: dict[str, Any],
|
|
45
|
+
) -> dict[str, Any]:
|
|
46
|
+
role = spec.get("Role") if isinstance(spec.get("Role"), str) else None
|
|
47
|
+
type_name = spec.get("TypeName") if isinstance(spec.get("TypeName"), str) else None
|
|
48
|
+
workspace = spec.get("Workspace") if isinstance(spec.get("Workspace"), str) else None
|
|
49
|
+
subtask = _entity(
|
|
50
|
+
"subtask",
|
|
51
|
+
f"subtask:antigravity:{conversation_id}:{step}:{subagent_index}",
|
|
52
|
+
name=role or type_name or "Antigravity subtask",
|
|
53
|
+
attributes={
|
|
54
|
+
"provider": "antigravity",
|
|
55
|
+
"conversation_id": conversation_id,
|
|
56
|
+
"step_index": step,
|
|
57
|
+
"subagent_index": subagent_index,
|
|
58
|
+
"role": role,
|
|
59
|
+
"type_name": type_name,
|
|
60
|
+
"workspace": workspace,
|
|
61
|
+
"identity_semantics": "provider_invoke_subagent_spec_index",
|
|
62
|
+
},
|
|
63
|
+
)
|
|
64
|
+
child_label = role or type_name or "Antigravity subagent"
|
|
65
|
+
child = _entity(
|
|
66
|
+
"agent",
|
|
67
|
+
f"agent:antigravity:conversation:{child_id}",
|
|
68
|
+
name=child_label,
|
|
69
|
+
attributes={
|
|
70
|
+
"provider": "antigravity",
|
|
71
|
+
"conversation_id": child_id,
|
|
72
|
+
"agent_type": child_label,
|
|
73
|
+
"agent_nickname": role or type_name,
|
|
74
|
+
"provider_role_slot": subagent_index,
|
|
75
|
+
"provider_role_type": type_name,
|
|
76
|
+
"provider_role_workspace": workspace,
|
|
77
|
+
"provider_role_path": derived_child_agent_path(spec, child_id),
|
|
78
|
+
"identity_semantics": "provider_transcript_result_conversation_id",
|
|
79
|
+
"execution_observed": False,
|
|
80
|
+
"lifecycle_authority": "child_provider_hooks",
|
|
81
|
+
**subagent_topology(
|
|
82
|
+
evidence=EVIDENCE_VALIDATED_CHILD_TRANSCRIPT,
|
|
83
|
+
parent_scope_id=conversation_id,
|
|
84
|
+
),
|
|
85
|
+
},
|
|
86
|
+
)
|
|
87
|
+
return {
|
|
88
|
+
"timestamp": timestamp,
|
|
89
|
+
"event_type": "semantic.antigravity.subtask.assigned",
|
|
90
|
+
"relation": "ASSIGNED_AGENT_TASK",
|
|
91
|
+
"source": subtask,
|
|
92
|
+
"target": child,
|
|
93
|
+
"attributes": {
|
|
94
|
+
"backend": "semantic",
|
|
95
|
+
"provider": "antigravity",
|
|
96
|
+
"attribution": "antigravity_hook",
|
|
97
|
+
"evidence_source": "provider_hook_plus_validated_transcript",
|
|
98
|
+
"causal": False,
|
|
99
|
+
"inferred": False,
|
|
100
|
+
"identity_exact": True,
|
|
101
|
+
"identity_method": "validated_transcript_record_order_and_provider_ids",
|
|
102
|
+
"provider_collaboration_tool_exact": True,
|
|
103
|
+
"provider_post_tool_success": True,
|
|
104
|
+
"provider_child_identity_exact": True,
|
|
105
|
+
"correlation_method": "validated_transcript_record_order_and_provider_ids",
|
|
106
|
+
"transcript_wire_semantics": "live_verified_implementation_wire",
|
|
107
|
+
"transcript_record_order_validated": True,
|
|
108
|
+
"timing_inference_used": False,
|
|
109
|
+
"child_lifecycle_inferred": False,
|
|
110
|
+
"child_lifecycle_authority": "child_provider_hooks",
|
|
111
|
+
},
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def _child_session_event(*, assignment: dict[str, Any], parent_id: str) -> dict[str, Any]:
|
|
116
|
+
"""Connect the parent conversation agent to the child on the viewer graph."""
|
|
117
|
+
child = assignment.get("target")
|
|
118
|
+
child = child if isinstance(child, dict) else {}
|
|
119
|
+
parent = _entity(
|
|
120
|
+
"agent",
|
|
121
|
+
f"agent:antigravity:conversation:{parent_id}",
|
|
122
|
+
name="Antigravity conversation",
|
|
123
|
+
attributes={
|
|
124
|
+
"provider": "antigravity",
|
|
125
|
+
"conversation_id": parent_id,
|
|
126
|
+
"identity_semantics": "provider_conversation_id",
|
|
127
|
+
},
|
|
128
|
+
)
|
|
129
|
+
attributes = assignment.get("attributes")
|
|
130
|
+
return {
|
|
131
|
+
"timestamp": assignment.get("timestamp"),
|
|
132
|
+
"event_type": "semantic.antigravity.agent_session.child",
|
|
133
|
+
"relation": "HAS_CHILD_AGENT_SESSION",
|
|
134
|
+
"source": parent,
|
|
135
|
+
"target": child,
|
|
136
|
+
"attributes": dict(attributes) if isinstance(attributes, dict) else {},
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
def _subtask_request_event(*, assignment: dict[str, Any], parent_id: str) -> dict[str, Any]:
|
|
141
|
+
"""Connect the requesting agent to the subtask before its child is known."""
|
|
142
|
+
subtask = assignment.get("source")
|
|
143
|
+
subtask = subtask if isinstance(subtask, dict) else {}
|
|
144
|
+
attributes = assignment.get("attributes")
|
|
145
|
+
request_attributes = dict(attributes) if isinstance(attributes, dict) else {}
|
|
146
|
+
request_attributes.update(
|
|
147
|
+
{
|
|
148
|
+
"provider": "antigravity",
|
|
149
|
+
"attribution": "antigravity_hook",
|
|
150
|
+
"evidence_source": "provider_hook_plus_validated_transcript",
|
|
151
|
+
"causal": False,
|
|
152
|
+
"inferred": False,
|
|
153
|
+
"identity_exact": True,
|
|
154
|
+
"provider_collaboration_tool_exact": True,
|
|
155
|
+
"provider_post_tool_success": True,
|
|
156
|
+
}
|
|
157
|
+
)
|
|
158
|
+
return {
|
|
159
|
+
"timestamp": assignment.get("timestamp"),
|
|
160
|
+
"event_type": "semantic.antigravity.subtask.requested",
|
|
161
|
+
"relation": "REQUESTED_SUBTASK",
|
|
162
|
+
"source": _entity(
|
|
163
|
+
"agent",
|
|
164
|
+
f"agent:antigravity:conversation:{parent_id}",
|
|
165
|
+
name="Antigravity conversation",
|
|
166
|
+
attributes={
|
|
167
|
+
"provider": "antigravity",
|
|
168
|
+
"conversation_id": parent_id,
|
|
169
|
+
"identity_semantics": "provider_conversation_id",
|
|
170
|
+
},
|
|
171
|
+
),
|
|
172
|
+
"target": subtask,
|
|
173
|
+
"attributes": request_attributes,
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _append_missing_subtask_requests(
|
|
178
|
+
events: list[dict[str, Any]],
|
|
179
|
+
assignments: list[dict[str, Any]],
|
|
180
|
+
*,
|
|
181
|
+
parent_id: str,
|
|
182
|
+
) -> None:
|
|
183
|
+
"""Add root-to-subtask edges without duplicating request-only evidence."""
|
|
184
|
+
requested_ids = {
|
|
185
|
+
target.get("id")
|
|
186
|
+
for event in events
|
|
187
|
+
if event.get("relation") == "REQUESTED_SUBTASK"
|
|
188
|
+
and isinstance((target := event.get("target")), dict)
|
|
189
|
+
and isinstance(target.get("id"), str)
|
|
190
|
+
}
|
|
191
|
+
for assignment in assignments:
|
|
192
|
+
source = assignment.get("source")
|
|
193
|
+
if not isinstance(source, dict) or not isinstance(source.get("id"), str):
|
|
194
|
+
continue
|
|
195
|
+
if source["id"] in requested_ids:
|
|
196
|
+
continue
|
|
197
|
+
events.append(_subtask_request_event(assignment=assignment, parent_id=parent_id))
|
|
198
|
+
requested_ids.add(source["id"])
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def _child_task_content_event(
|
|
202
|
+
*,
|
|
203
|
+
assignment: dict[str, Any],
|
|
204
|
+
spec: dict[str, Any],
|
|
205
|
+
store: FullFidelityContentStore,
|
|
206
|
+
timestamp: str,
|
|
207
|
+
) -> dict[str, Any] | None:
|
|
208
|
+
prompt = spec.get("Prompt")
|
|
209
|
+
child = assignment.get("target")
|
|
210
|
+
if not isinstance(prompt, str) or not prompt or not isinstance(child, dict):
|
|
211
|
+
return None
|
|
212
|
+
reference = store.put_text(prompt, content_kind="antigravity.subtask_prompt")
|
|
213
|
+
attributes = assignment.get("attributes")
|
|
214
|
+
return content_observation_event(
|
|
215
|
+
timestamp=timestamp,
|
|
216
|
+
provider="antigravity",
|
|
217
|
+
source=child,
|
|
218
|
+
reference=reference,
|
|
219
|
+
relation="OBSERVED_SUBAGENT_TASK",
|
|
220
|
+
observed_field="toolCall.args.Subagents[].Prompt",
|
|
221
|
+
evidence_source="provider_hook_plus_validated_transcript",
|
|
222
|
+
attribution="antigravity_hook",
|
|
223
|
+
event_type="semantic.antigravity.subtask.child_content",
|
|
224
|
+
attributes={
|
|
225
|
+
**(attributes if isinstance(attributes, dict) else {}),
|
|
226
|
+
"conversation_projection_basis": "validated_child_conversation_id",
|
|
227
|
+
},
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
def _child_transcript_tool_events(
|
|
232
|
+
*,
|
|
233
|
+
link: dict[str, Any],
|
|
234
|
+
assignment: dict[str, Any],
|
|
235
|
+
parent_payload: dict[str, Any],
|
|
236
|
+
timestamp: str,
|
|
237
|
+
) -> list[dict[str, Any]]:
|
|
238
|
+
"""Project explicit tool calls recorded in a validated child transcript.
|
|
239
|
+
|
|
240
|
+
AGY does not emit a separate PostToolUse hook for every child conversation.
|
|
241
|
+
The child transcript is nevertheless a provider-owned, request/result-linked
|
|
242
|
+
record, so its explicit MODEL tool calls can be represented without guessing
|
|
243
|
+
ownership from timing or filesystem activity.
|
|
244
|
+
"""
|
|
245
|
+
child_id = link.get("conversation_id")
|
|
246
|
+
transcript = link.get("transcript_path")
|
|
247
|
+
child = assignment.get("target")
|
|
248
|
+
if (
|
|
249
|
+
not isinstance(child_id, str)
|
|
250
|
+
or not child_id
|
|
251
|
+
or not isinstance(transcript, Path)
|
|
252
|
+
or not isinstance(child, dict)
|
|
253
|
+
or child.get("type") != "agent"
|
|
254
|
+
):
|
|
255
|
+
return []
|
|
256
|
+
# ``Path`` is deliberately checked without accepting path-like strings here:
|
|
257
|
+
# only the linkage validator may authorize which child transcript is read.
|
|
258
|
+
records = read_transcript_records(transcript)
|
|
259
|
+
events: list[dict[str, Any]] = []
|
|
260
|
+
evidence = {
|
|
261
|
+
"backend": "semantic",
|
|
262
|
+
"attribution": "antigravity_child_transcript",
|
|
263
|
+
"evidence_source": "provider_validated_child_transcript",
|
|
264
|
+
"provider": "antigravity",
|
|
265
|
+
"causal": False,
|
|
266
|
+
"inferred": False,
|
|
267
|
+
"identity_exact": True,
|
|
268
|
+
"identity_method": "validated_parent_result_child_transcript_path",
|
|
269
|
+
"transcript_path": str(transcript),
|
|
270
|
+
"transcript_record_order_validated": True,
|
|
271
|
+
"child_tool_call_observed": True,
|
|
272
|
+
}
|
|
273
|
+
for ordinal, record in enumerate(records):
|
|
274
|
+
if (
|
|
275
|
+
record.get("source") != "MODEL"
|
|
276
|
+
or record.get("type") != "PLANNER_RESPONSE"
|
|
277
|
+
or record.get("status") != "DONE"
|
|
278
|
+
):
|
|
279
|
+
continue
|
|
280
|
+
calls = record.get("tool_calls")
|
|
281
|
+
if not isinstance(calls, list):
|
|
282
|
+
continue
|
|
283
|
+
raw_step = record.get("step_index")
|
|
284
|
+
step = raw_step if isinstance(raw_step, int) and not isinstance(raw_step, bool) and raw_step >= 0 else ordinal
|
|
285
|
+
for call_index, raw_call in enumerate(calls):
|
|
286
|
+
if not isinstance(raw_call, dict):
|
|
287
|
+
continue
|
|
288
|
+
name = raw_call.get("name")
|
|
289
|
+
raw_args = raw_call.get("args")
|
|
290
|
+
if not isinstance(name, str) or not name or not isinstance(raw_args, dict):
|
|
291
|
+
continue
|
|
292
|
+
args: dict[str, Any] = {}
|
|
293
|
+
for key, value in raw_args.items():
|
|
294
|
+
if isinstance(value, str):
|
|
295
|
+
try:
|
|
296
|
+
decoded = json.loads(value)
|
|
297
|
+
except json.JSONDecodeError:
|
|
298
|
+
decoded = value
|
|
299
|
+
args[key] = decoded if decoded is not None else value
|
|
300
|
+
else:
|
|
301
|
+
args[key] = value
|
|
302
|
+
child_payload = dict(parent_payload)
|
|
303
|
+
child_payload.update(
|
|
304
|
+
{
|
|
305
|
+
"conversationId": child_id,
|
|
306
|
+
"transcriptPath": str(transcript),
|
|
307
|
+
"stepIdx": step,
|
|
308
|
+
"toolCall": {"name": name, "args": args},
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
call_entity, tool_entity, canonical_args = _semantic._tool_call(child_payload)
|
|
312
|
+
call_attributes = dict(call_entity.get("attributes") or {})
|
|
313
|
+
call_attributes.update(
|
|
314
|
+
{
|
|
315
|
+
"attribution": "antigravity_child_transcript",
|
|
316
|
+
"evidence_source": "provider_validated_child_transcript",
|
|
317
|
+
"transcript_record_ordinal": ordinal,
|
|
318
|
+
"transcript_tool_call_index": call_index,
|
|
319
|
+
"transcript_path": str(transcript),
|
|
320
|
+
}
|
|
321
|
+
)
|
|
322
|
+
call_entity["attributes"] = call_attributes
|
|
323
|
+
events.append(
|
|
324
|
+
_semantic._event(
|
|
325
|
+
timestamp=timestamp,
|
|
326
|
+
event_type="semantic.antigravity.child.tool.observed",
|
|
327
|
+
relation="REQUESTED_TOOL_CALL",
|
|
328
|
+
source=child,
|
|
329
|
+
target=call_entity,
|
|
330
|
+
payload=child_payload,
|
|
331
|
+
attributes=evidence,
|
|
332
|
+
)
|
|
333
|
+
)
|
|
334
|
+
events.append(
|
|
335
|
+
_semantic._event(
|
|
336
|
+
timestamp=timestamp,
|
|
337
|
+
event_type="semantic.antigravity.child.tool.selected",
|
|
338
|
+
relation="USES_TOOL",
|
|
339
|
+
source=call_entity,
|
|
340
|
+
target=tool_entity,
|
|
341
|
+
payload=child_payload,
|
|
342
|
+
attributes=evidence,
|
|
343
|
+
)
|
|
344
|
+
)
|
|
345
|
+
command = _semantic._command_entity(canonical_args) if name != "apply_patch" else None
|
|
346
|
+
if command is not None:
|
|
347
|
+
events.append(
|
|
348
|
+
_semantic._event(
|
|
349
|
+
timestamp=timestamp,
|
|
350
|
+
event_type="semantic.antigravity.child.command.declared",
|
|
351
|
+
relation="DECLARED_COMMAND",
|
|
352
|
+
source=call_entity,
|
|
353
|
+
target=command,
|
|
354
|
+
payload=child_payload,
|
|
355
|
+
attributes=evidence,
|
|
356
|
+
)
|
|
357
|
+
)
|
|
358
|
+
file_entity = _semantic._file_entity(child_payload, canonical_args)
|
|
359
|
+
patch_targets = (
|
|
360
|
+
_semantic._apply_patch_targets(
|
|
361
|
+
canonical_args.get("patch") or canonical_args.get("command")
|
|
362
|
+
)
|
|
363
|
+
if name == "apply_patch"
|
|
364
|
+
else []
|
|
365
|
+
)
|
|
366
|
+
file_targets: list[tuple[dict[str, Any], str | None]]
|
|
367
|
+
if patch_targets:
|
|
368
|
+
file_targets = [
|
|
369
|
+
(
|
|
370
|
+
_semantic._file_entity(
|
|
371
|
+
child_payload,
|
|
372
|
+
{"TargetFile": raw_path},
|
|
373
|
+
),
|
|
374
|
+
operation,
|
|
375
|
+
)
|
|
376
|
+
for operation, raw_path in patch_targets
|
|
377
|
+
]
|
|
378
|
+
elif file_entity is not None:
|
|
379
|
+
file_targets = [(file_entity, None)]
|
|
380
|
+
else:
|
|
381
|
+
file_targets = []
|
|
382
|
+
for file_entity, patch_operation in file_targets:
|
|
383
|
+
if file_entity is None:
|
|
384
|
+
continue
|
|
385
|
+
file_attributes = dict(file_entity.get("attributes") or {})
|
|
386
|
+
file_attributes.update(
|
|
387
|
+
{
|
|
388
|
+
"declared_by_provider_transcript": True,
|
|
389
|
+
"transcript_path": str(transcript),
|
|
390
|
+
}
|
|
391
|
+
)
|
|
392
|
+
if patch_operation is not None:
|
|
393
|
+
file_attributes["patch_operation"] = patch_operation
|
|
394
|
+
file_entity["attributes"] = file_attributes
|
|
395
|
+
events.append(
|
|
396
|
+
_semantic._event(
|
|
397
|
+
timestamp=timestamp,
|
|
398
|
+
event_type="semantic.antigravity.child.file.declared",
|
|
399
|
+
relation="DECLARED_TARGET",
|
|
400
|
+
source=call_entity,
|
|
401
|
+
target=file_entity,
|
|
402
|
+
payload=child_payload,
|
|
403
|
+
attributes=evidence,
|
|
404
|
+
)
|
|
405
|
+
)
|
|
406
|
+
return events
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
def _child_transcript_archive_events(
|
|
410
|
+
*,
|
|
411
|
+
link: dict[str, Any],
|
|
412
|
+
parent_payload: dict[str, Any],
|
|
413
|
+
store: FullFidelityContentStore,
|
|
414
|
+
timestamp: str,
|
|
415
|
+
) -> list[dict[str, Any]]:
|
|
416
|
+
"""Archive a validated child transcript discovered in the parent result.
|
|
417
|
+
|
|
418
|
+
Antigravity does not reliably emit lifecycle hooks for every subagent. The
|
|
419
|
+
parent result nevertheless contains an exact child conversation id and
|
|
420
|
+
``logAbsoluteUri``. Once the linkage validator has accepted that pair, it
|
|
421
|
+
is sufficient evidence to materialize the child's conversation record; the
|
|
422
|
+
child tool projection and the conversation archive should not depend on a
|
|
423
|
+
separate child Stop hook arriving later.
|
|
424
|
+
"""
|
|
425
|
+
child_id = link.get("conversation_id")
|
|
426
|
+
transcript = link.get("transcript_path")
|
|
427
|
+
if (
|
|
428
|
+
not isinstance(child_id, str)
|
|
429
|
+
or not child_id
|
|
430
|
+
or not isinstance(transcript, Path)
|
|
431
|
+
):
|
|
432
|
+
return []
|
|
433
|
+
child_payload = dict(parent_payload)
|
|
434
|
+
child_payload.update(
|
|
435
|
+
{
|
|
436
|
+
"conversationId": child_id,
|
|
437
|
+
"transcriptPath": str(transcript),
|
|
438
|
+
}
|
|
439
|
+
)
|
|
440
|
+
return antigravity_conversation_archive_events(
|
|
441
|
+
child_payload,
|
|
442
|
+
store=store,
|
|
443
|
+
timestamp=timestamp,
|
|
444
|
+
)
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
def _subagent_assignment_events(
|
|
448
|
+
payload: dict[str, Any],
|
|
449
|
+
*,
|
|
450
|
+
timestamp: str,
|
|
451
|
+
store: FullFidelityContentStore,
|
|
452
|
+
) -> list[dict[str, Any]]:
|
|
453
|
+
tool_call = payload.get("toolCall")
|
|
454
|
+
if not isinstance(tool_call, dict) or tool_call.get("name") != "invoke_subagent":
|
|
455
|
+
return []
|
|
456
|
+
args = tool_call.get("args")
|
|
457
|
+
if not isinstance(args, dict):
|
|
458
|
+
return []
|
|
459
|
+
error = payload.get("error")
|
|
460
|
+
if isinstance(error, str) and error.strip():
|
|
461
|
+
return []
|
|
462
|
+
conversation_id = payload.get("conversationId")
|
|
463
|
+
step = payload.get("stepIdx")
|
|
464
|
+
if not isinstance(conversation_id, str) or not conversation_id:
|
|
465
|
+
return []
|
|
466
|
+
if not isinstance(step, int) or isinstance(step, bool) or step < 0:
|
|
467
|
+
return []
|
|
468
|
+
specs = args.get("Subagents")
|
|
469
|
+
if not isinstance(specs, list):
|
|
470
|
+
return []
|
|
471
|
+
|
|
472
|
+
links = validated_subagent_links(payload, args=args)
|
|
473
|
+
events: list[dict[str, Any]] = []
|
|
474
|
+
for link in links:
|
|
475
|
+
subagent_index = link["subagent_index"]
|
|
476
|
+
if not isinstance(subagent_index, int) or not 0 <= subagent_index < len(specs):
|
|
477
|
+
return []
|
|
478
|
+
spec = specs[subagent_index]
|
|
479
|
+
child_id = link["conversation_id"]
|
|
480
|
+
if not isinstance(spec, dict) or not isinstance(child_id, str):
|
|
481
|
+
return []
|
|
482
|
+
assignment = _assignment_event(
|
|
483
|
+
timestamp=timestamp,
|
|
484
|
+
conversation_id=conversation_id,
|
|
485
|
+
step=step,
|
|
486
|
+
subagent_index=subagent_index,
|
|
487
|
+
child_id=child_id,
|
|
488
|
+
spec=spec,
|
|
489
|
+
)
|
|
490
|
+
events.append(assignment)
|
|
491
|
+
events.append(_child_session_event(assignment=assignment, parent_id=conversation_id))
|
|
492
|
+
events.extend(
|
|
493
|
+
_child_transcript_archive_events(
|
|
494
|
+
link=link,
|
|
495
|
+
parent_payload=payload,
|
|
496
|
+
store=store,
|
|
497
|
+
timestamp=timestamp,
|
|
498
|
+
)
|
|
499
|
+
)
|
|
500
|
+
events.extend(
|
|
501
|
+
_child_transcript_tool_events(
|
|
502
|
+
link=link,
|
|
503
|
+
assignment=assignment,
|
|
504
|
+
parent_payload=payload,
|
|
505
|
+
timestamp=timestamp,
|
|
506
|
+
)
|
|
507
|
+
)
|
|
508
|
+
task_content = _child_task_content_event(
|
|
509
|
+
assignment=assignment,
|
|
510
|
+
spec=spec,
|
|
511
|
+
store=store,
|
|
512
|
+
timestamp=timestamp,
|
|
513
|
+
)
|
|
514
|
+
if task_content is not None:
|
|
515
|
+
events.append(task_content)
|
|
516
|
+
return events
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
def _transcript_assignment_events(
|
|
520
|
+
payload: dict[str, Any],
|
|
521
|
+
*,
|
|
522
|
+
timestamp: str,
|
|
523
|
+
store: FullFidelityContentStore,
|
|
524
|
+
) -> list[dict[str, Any]]:
|
|
525
|
+
"""Assign children from a parent transcript even when PostToolUse was not invoke_subagent.
|
|
526
|
+
|
|
527
|
+
Field Agy runs have been observed to archive four conversation transcripts while
|
|
528
|
+
the only PostToolUse name on the wire is ``schedule``. The spawn request/result
|
|
529
|
+
still sits in the parent transcript. Scanning that validated file is the same
|
|
530
|
+
provider join as the hook-time path; it does not invent children.
|
|
531
|
+
"""
|
|
532
|
+
conversation_id = payload.get("conversationId")
|
|
533
|
+
if not isinstance(conversation_id, str) or not conversation_id:
|
|
534
|
+
return []
|
|
535
|
+
transcript = validated_transcript_path(payload)
|
|
536
|
+
if transcript is None:
|
|
537
|
+
return []
|
|
538
|
+
links = transcript_subagent_links(
|
|
539
|
+
read_transcript_records(transcript),
|
|
540
|
+
parent_id=conversation_id,
|
|
541
|
+
)
|
|
542
|
+
events: list[dict[str, Any]] = []
|
|
543
|
+
assignments: list[dict[str, Any]] = []
|
|
544
|
+
for link in links:
|
|
545
|
+
spec = link["spec"]
|
|
546
|
+
child_id = link["conversation_id"]
|
|
547
|
+
if not isinstance(spec, dict) or not isinstance(child_id, str):
|
|
548
|
+
return []
|
|
549
|
+
assignment = _assignment_event(
|
|
550
|
+
timestamp=timestamp,
|
|
551
|
+
conversation_id=conversation_id,
|
|
552
|
+
step=link["step_index"],
|
|
553
|
+
subagent_index=link["subagent_index"],
|
|
554
|
+
child_id=child_id,
|
|
555
|
+
spec=spec,
|
|
556
|
+
)
|
|
557
|
+
assignments.append(assignment)
|
|
558
|
+
events.append(assignment)
|
|
559
|
+
events.append(_child_session_event(assignment=assignment, parent_id=conversation_id))
|
|
560
|
+
events.extend(
|
|
561
|
+
_child_transcript_archive_events(
|
|
562
|
+
link=link,
|
|
563
|
+
parent_payload=payload,
|
|
564
|
+
store=store,
|
|
565
|
+
timestamp=timestamp,
|
|
566
|
+
)
|
|
567
|
+
)
|
|
568
|
+
events.extend(
|
|
569
|
+
_child_transcript_tool_events(
|
|
570
|
+
link=link,
|
|
571
|
+
assignment=assignment,
|
|
572
|
+
parent_payload=payload,
|
|
573
|
+
timestamp=timestamp,
|
|
574
|
+
)
|
|
575
|
+
)
|
|
576
|
+
task_content = _child_task_content_event(
|
|
577
|
+
assignment=assignment,
|
|
578
|
+
spec=spec,
|
|
579
|
+
store=store,
|
|
580
|
+
timestamp=timestamp,
|
|
581
|
+
)
|
|
582
|
+
if task_content is not None:
|
|
583
|
+
events.append(task_content)
|
|
584
|
+
_append_missing_subtask_requests(events, assignments, parent_id=conversation_id)
|
|
585
|
+
return events
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
def antigravity_hook_to_content_events(
|
|
589
|
+
payload: dict[str, Any],
|
|
590
|
+
*,
|
|
591
|
+
hook_event: str,
|
|
592
|
+
store: FullFidelityContentStore,
|
|
593
|
+
timestamp: str | None = None,
|
|
594
|
+
) -> list[dict[str, Any]]:
|
|
595
|
+
events = _base.antigravity_hook_to_content_events(
|
|
596
|
+
payload,
|
|
597
|
+
hook_event=hook_event,
|
|
598
|
+
store=store,
|
|
599
|
+
timestamp=timestamp,
|
|
600
|
+
)
|
|
601
|
+
if timestamp is None:
|
|
602
|
+
from datetime import datetime, timezone
|
|
603
|
+
|
|
604
|
+
timestamp = datetime.now(timezone.utc).isoformat().replace("+00:00", "Z")
|
|
605
|
+
if hook_event == "PostToolUse":
|
|
606
|
+
assigned = _subagent_assignment_events(
|
|
607
|
+
payload,
|
|
608
|
+
timestamp=timestamp,
|
|
609
|
+
store=store,
|
|
610
|
+
)
|
|
611
|
+
assignments = [
|
|
612
|
+
event
|
|
613
|
+
for event in assigned
|
|
614
|
+
if event.get("relation") == "ASSIGNED_AGENT_TASK"
|
|
615
|
+
]
|
|
616
|
+
_append_missing_subtask_requests(
|
|
617
|
+
events,
|
|
618
|
+
assignments,
|
|
619
|
+
parent_id=str(payload.get("conversationId") or ""),
|
|
620
|
+
)
|
|
621
|
+
events.extend(assigned)
|
|
622
|
+
tool_call = payload.get("toolCall")
|
|
623
|
+
tool_name = tool_call.get("name") if isinstance(tool_call, dict) else None
|
|
624
|
+
if not assigned and tool_name != "invoke_subagent":
|
|
625
|
+
# ``schedule`` still leaves the spawn pair in the parent transcript.
|
|
626
|
+
# Do not use this relaxed join to override an invoke_subagent hook
|
|
627
|
+
# that already abstained (mismatched URI, torn write, workspace).
|
|
628
|
+
events.extend(
|
|
629
|
+
_transcript_assignment_events(
|
|
630
|
+
payload,
|
|
631
|
+
timestamp=timestamp,
|
|
632
|
+
store=store,
|
|
633
|
+
)
|
|
634
|
+
)
|
|
635
|
+
# Codex snapshots provider transcripts on lifecycle events that already
|
|
636
|
+
# name the rollout path, not only on a terminal Stop. Antigravity exposes
|
|
637
|
+
# the same validated brain path on PreInvocation / PostInvocation; waiting
|
|
638
|
+
# for Stop leaves live and finished dashboards with conversation identity
|
|
639
|
+
# and no prompt/response text when Stop never arrives.
|
|
640
|
+
if hook_event in {"PostToolUse", "PreInvocation", "PostInvocation", "Stop"}:
|
|
641
|
+
events.extend(
|
|
642
|
+
antigravity_conversation_archive_events(
|
|
643
|
+
payload,
|
|
644
|
+
store=store,
|
|
645
|
+
timestamp=timestamp,
|
|
646
|
+
)
|
|
647
|
+
)
|
|
648
|
+
if hook_event != "PostToolUse":
|
|
649
|
+
events.extend(
|
|
650
|
+
_transcript_assignment_events(
|
|
651
|
+
payload,
|
|
652
|
+
timestamp=timestamp,
|
|
653
|
+
store=store,
|
|
654
|
+
)
|
|
655
|
+
)
|
|
656
|
+
return events
|