@team-agent/installer 0.5.128 → 0.6.1
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.
- package/README.md +4 -4
- package/README.zh.md +1 -1
- package/package.json +4 -8
- package/skills/team-agent/SKILL.md +37 -20
- package/skills/team-agent/command-coverage.json +169 -183
- package/skills/team-agent/docs/reference/team-agent-operator.md +64 -30
- package/skills/team-agent/references/recovery-runbook.md +1 -1
- package/skills/team-agent/references/team-agent-operator.md +64 -30
- package/templates/team_state.md +1 -1
- package/Cargo.lock +0 -1063
- package/Cargo.toml +0 -36
- package/crates/team-agent/Cargo.toml +0 -69
- package/crates/team-agent/src/app_server_test_support.rs +0 -258
- package/crates/team-agent/src/cli/adapters.rs +0 -1288
- package/crates/team-agent/src/cli/arguments.rs +0 -405
- package/crates/team-agent/src/cli/attach_app_server_leader.rs +0 -98
- package/crates/team-agent/src/cli/diagnose.rs +0 -1721
- package/crates/team-agent/src/cli/emit.rs +0 -2930
- package/crates/team-agent/src/cli/grok_slot.rs +0 -384
- package/crates/team-agent/src/cli/helpers.rs +0 -91
- package/crates/team-agent/src/cli/intent/runtime.rs +0 -1216
- package/crates/team-agent/src/cli/intent/runtime_tests.rs +0 -912
- package/crates/team-agent/src/cli/intent/tests.rs +0 -689
- package/crates/team-agent/src/cli/intent.rs +0 -664
- package/crates/team-agent/src/cli/leader.rs +0 -300
- package/crates/team-agent/src/cli/leader_prompt.rs +0 -261
- package/crates/team-agent/src/cli/leaders.rs +0 -418
- package/crates/team-agent/src/cli/mod.rs +0 -6545
- package/crates/team-agent/src/cli/models.rs +0 -1206
- package/crates/team-agent/src/cli/named_address.rs +0 -1651
- package/crates/team-agent/src/cli/profile.rs +0 -342
- package/crates/team-agent/src/cli/route.rs +0 -212
- package/crates/team-agent/src/cli/schedule.rs +0 -175
- package/crates/team-agent/src/cli/send/coordinator.rs +0 -164
- package/crates/team-agent/src/cli/send/mailbox.rs +0 -145
- package/crates/team-agent/src/cli/send/persist.rs +0 -156
- package/crates/team-agent/src/cli/send/presentation.rs +0 -370
- package/crates/team-agent/src/cli/send/resolve.rs +0 -573
- package/crates/team-agent/src/cli/send.rs +0 -199
- package/crates/team-agent/src/cli/shutdown_socket.rs +0 -288
- package/crates/team-agent/src/cli/spec.rs +0 -165
- package/crates/team-agent/src/cli/status.rs +0 -280
- package/crates/team-agent/src/cli/status_port/agents.rs +0 -358
- package/crates/team-agent/src/cli/status_port/approvals.rs +0 -79
- package/crates/team-agent/src/cli/status_port/brief.rs +0 -1981
- package/crates/team-agent/src/cli/status_port/compact.rs +0 -240
- package/crates/team-agent/src/cli/status_port/format.rs +0 -146
- package/crates/team-agent/src/cli/status_port/inbox.rs +0 -62
- package/crates/team-agent/src/cli/status_port/runtime.rs +0 -197
- package/crates/team-agent/src/cli/status_port/snapshot.rs +0 -208
- package/crates/team-agent/src/cli/status_port/store.rs +0 -416
- package/crates/team-agent/src/cli/status_port/tests.rs +0 -90
- package/crates/team-agent/src/cli/status_port.rs +0 -92
- package/crates/team-agent/src/cli/tests/base.rs +0 -885
- package/crates/team-agent/src/cli/tests/divergence.rs +0 -518
- package/crates/team-agent/src/cli/tests/lane_c.rs +0 -453
- package/crates/team-agent/src/cli/tests/leader_watch.rs +0 -322
- package/crates/team-agent/src/cli/tests/main_preserved.rs +0 -430
- package/crates/team-agent/src/cli/tests/missing_subcommands.rs +0 -336
- package/crates/team-agent/src/cli/tests/mod.rs +0 -137
- package/crates/team-agent/src/cli/tests/named_address.rs +0 -761
- package/crates/team-agent/src/cli/tests/parser_safety.rs +0 -383
- package/crates/team-agent/src/cli/tests/run_delegation.rs +0 -484
- package/crates/team-agent/src/cli/tests/shutdown_kill_plan.rs +0 -2179
- package/crates/team-agent/src/cli/tests/status_brief.rs +0 -1514
- package/crates/team-agent/src/cli/tests/status_send.rs +0 -888
- package/crates/team-agent/src/cli/tests/verb_install_skill.rs +0 -93
- package/crates/team-agent/src/cli/tests/verb_profile.rs +0 -392
- package/crates/team-agent/src/cli/triage.rs +0 -234
- package/crates/team-agent/src/cli/types.rs +0 -591
- package/crates/team-agent/src/codex_app_server.rs +0 -546
- package/crates/team-agent/src/communication_mode/mod.rs +0 -56
- package/crates/team-agent/src/compiler/tests.rs +0 -827
- package/crates/team-agent/src/compiler.rs +0 -890
- package/crates/team-agent/src/conpty/backend.rs +0 -829
- package/crates/team-agent/src/conpty/mod.rs +0 -33
- package/crates/team-agent/src/contract_runtime/backend.rs +0 -1744
- package/crates/team-agent/src/contract_runtime/commands.rs +0 -671
- package/crates/team-agent/src/contract_runtime/config.rs +0 -364
- package/crates/team-agent/src/contract_runtime/config_tests.rs +0 -76
- package/crates/team-agent/src/contract_runtime/discovery.rs +0 -449
- package/crates/team-agent/src/contract_runtime/fork.rs +0 -361
- package/crates/team-agent/src/contract_runtime/forward.rs +0 -288
- package/crates/team-agent/src/contract_runtime/framework.rs +0 -367
- package/crates/team-agent/src/contract_runtime/mcp.rs +0 -394
- package/crates/team-agent/src/contract_runtime/mod.rs +0 -17
- package/crates/team-agent/src/contract_runtime/prompt.rs +0 -216
- package/crates/team-agent/src/contract_runtime/pump.rs +0 -271
- package/crates/team-agent/src/contract_runtime/registry.rs +0 -553
- package/crates/team-agent/src/contract_runtime/workspace.rs +0 -228
- package/crates/team-agent/src/coordinator/backoff.rs +0 -741
- package/crates/team-agent/src/coordinator/conpty_shim.rs +0 -805
- package/crates/team-agent/src/coordinator/health.rs +0 -1185
- package/crates/team-agent/src/coordinator/mod.rs +0 -119
- package/crates/team-agent/src/coordinator/orphan.rs +0 -110
- package/crates/team-agent/src/coordinator/runtime_detectors.rs +0 -798
- package/crates/team-agent/src/coordinator/runtime_observation.rs +0 -84
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +0 -2309
- package/crates/team-agent/src/coordinator/steps/delivery.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/health_sync.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/mod.rs +0 -126
- package/crates/team-agent/src/coordinator/steps/persist.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/runtime_prompts.rs +0 -15
- package/crates/team-agent/src/coordinator/steps/session_gate.rs +0 -16
- package/crates/team-agent/src/coordinator/tests/a0_lostupdate.rs +0 -158
- package/crates/team-agent/src/coordinator/tests/abnormal.rs +0 -312
- package/crates/team-agent/src/coordinator/tests/api_error_recovery.rs +0 -300
- package/crates/team-agent/src/coordinator/tests/basics.rs +0 -211
- package/crates/team-agent/src/coordinator/tests/daemon.rs +0 -514
- package/crates/team-agent/src/coordinator/tests/energy.rs +0 -549
- package/crates/team-agent/src/coordinator/tests/health_sync.rs +0 -503
- package/crates/team-agent/src/coordinator/tests/main_preserved.rs +0 -186
- package/crates/team-agent/src/coordinator/tests/mod.rs +0 -295
- package/crates/team-agent/src/coordinator/tests/s3_bounded.rs +0 -207
- package/crates/team-agent/src/coordinator/tests/spine.rs +0 -308
- package/crates/team-agent/src/coordinator/tests/takeover.rs +0 -286
- package/crates/team-agent/src/coordinator/tests/tick_core.rs +0 -237
- package/crates/team-agent/src/coordinator/tick.rs +0 -3024
- package/crates/team-agent/src/coordinator/types.rs +0 -540
- package/crates/team-agent/src/db/agent_health_capture.rs +0 -126
- package/crates/team-agent/src/db/message_store.rs +0 -1527
- package/crates/team-agent/src/db/migration.rs +0 -984
- package/crates/team-agent/src/db/mod.rs +0 -26
- package/crates/team-agent/src/db/schema.rs +0 -663
- package/crates/team-agent/src/diagnose/comms.rs +0 -242
- package/crates/team-agent/src/diagnose/mod.rs +0 -44
- package/crates/team-agent/src/diagnose/orphans.rs +0 -889
- package/crates/team-agent/src/direct_delivery.rs +0 -368
- package/crates/team-agent/src/event_log.rs +0 -502
- package/crates/team-agent/src/fake_worker.rs +0 -303
- package/crates/team-agent/src/inbox_store.rs +0 -169
- package/crates/team-agent/src/kill_audit.rs +0 -106
- package/crates/team-agent/src/layout/manager.rs +0 -248
- package/crates/team-agent/src/layout/mod.rs +0 -36
- package/crates/team-agent/src/layout/overlay.rs +0 -134
- package/crates/team-agent/src/layout/placement.rs +0 -52
- package/crates/team-agent/src/layout/recovery.rs +0 -106
- package/crates/team-agent/src/layout/runtime_sessions.rs +0 -317
- package/crates/team-agent/src/layout/sessions.rs +0 -294
- package/crates/team-agent/src/layout/tmux_endpoint.rs +0 -165
- package/crates/team-agent/src/layout/worker_env.rs +0 -721
- package/crates/team-agent/src/layout/worker_window_helpers.rs +0 -37
- package/crates/team-agent/src/leader/helpers.rs +0 -178
- package/crates/team-agent/src/leader/incident.rs +0 -6
- package/crates/team-agent/src/leader/lease.rs +0 -3356
- package/crates/team-agent/src/leader/mod.rs +0 -104
- package/crates/team-agent/src/leader/owner_bind.rs +0 -400
- package/crates/team-agent/src/leader/prompt.rs +0 -905
- package/crates/team-agent/src/leader/provider_attribution.rs +0 -247
- package/crates/team-agent/src/leader/rediscover/tests.rs +0 -689
- package/crates/team-agent/src/leader/rediscover.rs +0 -1192
- package/crates/team-agent/src/leader/registry.rs +0 -888
- package/crates/team-agent/src/leader/start.rs +0 -4501
- package/crates/team-agent/src/leader/takeover.rs +0 -65
- package/crates/team-agent/src/leader/tests/basics.rs +0 -337
- package/crates/team-agent/src/leader/tests/byte_findings.rs +0 -355
- package/crates/team-agent/src/leader/tests/claim_leader_mailbox_flush_contract.rs +0 -544
- package/crates/team-agent/src/leader/tests/historical_inventory_upgrade_gate_red.rs +0 -624
- package/crates/team-agent/src/leader/tests/identity.rs +0 -465
- package/crates/team-agent/src/leader/tests/identity_session_names.rs +0 -42
- package/crates/team-agent/src/leader/tests/idle.rs +0 -113
- package/crates/team-agent/src/leader/tests/lease_api.rs +0 -520
- package/crates/team-agent/src/leader/tests/lease_claim.rs +0 -629
- package/crates/team-agent/src/leader/tests/mod.rs +0 -106
- package/crates/team-agent/src/leader/tests/prompt_contract.rs +0 -268
- package/crates/team-agent/src/leader/tests/rediscover.rs +0 -403
- package/crates/team-agent/src/leader/tests/rehomed_env.rs +0 -83
- package/crates/team-agent/src/leader/tests/team_in_team_state_scope_red.rs +0 -1273
- package/crates/team-agent/src/leader/tests/terminal_and_replay_vs_rerender_invariants_red.rs +0 -417
- package/crates/team-agent/src/leader/tests/wake_start_owner.rs +0 -168
- package/crates/team-agent/src/leader/types.rs +0 -534
- package/crates/team-agent/src/lib.rs +0 -147
- package/crates/team-agent/src/lifecycle/helpers.rs +0 -212
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +0 -881
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +0 -598
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +0 -332
- package/crates/team-agent/src/lifecycle/launch/clone_agent.rs +0 -204
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +0 -107
- package/crates/team-agent/src/lifecycle/launch/fork_entry.rs +0 -144
- package/crates/team-agent/src/lifecycle/launch/identity.rs +0 -674
- package/crates/team-agent/src/lifecycle/launch/layout.rs +0 -350
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +0 -589
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +0 -160
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +0 -105
- package/crates/team-agent/src/lifecycle/launch/pi_mcp.rs +0 -899
- package/crates/team-agent/src/lifecycle/launch/pi_mcp_extension.js +0 -225
- package/crates/team-agent/src/lifecycle/launch/plan.rs +0 -269
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +0 -5200
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +0 -368
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +0 -519
- package/crates/team-agent/src/lifecycle/launch/role_source.rs +0 -287
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +0 -473
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +0 -801
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +0 -624
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +0 -558
- package/crates/team-agent/src/lifecycle/launch.rs +0 -557
- package/crates/team-agent/src/lifecycle/lock.rs +0 -350
- package/crates/team-agent/src/lifecycle/mod.rs +0 -79
- package/crates/team-agent/src/lifecycle/pane_input_lock.rs +0 -239
- package/crates/team-agent/src/lifecycle/profile_launch.rs +0 -1067
- package/crates/team-agent/src/lifecycle/profile_smoke.rs +0 -557
- package/crates/team-agent/src/lifecycle/restart/agent.rs +0 -2199
- package/crates/team-agent/src/lifecycle/restart/avatar.rs +0 -1798
- package/crates/team-agent/src/lifecycle/restart/claude_fork.rs +0 -163
- package/crates/team-agent/src/lifecycle/restart/common.rs +0 -2362
- package/crates/team-agent/src/lifecycle/restart/orchestrator.rs +0 -65
- package/crates/team-agent/src/lifecycle/restart/preflight.rs +0 -113
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +0 -5135
- package/crates/team-agent/src/lifecycle/restart/remove.rs +0 -1504
- package/crates/team-agent/src/lifecycle/restart/selection.rs +0 -559
- package/crates/team-agent/src/lifecycle/restart/team_state.rs +0 -329
- package/crates/team-agent/src/lifecycle/restart.rs +0 -227
- package/crates/team-agent/src/lifecycle/role_config.rs +0 -1230
- package/crates/team-agent/src/lifecycle/tests/acceptance_b_batch_red.rs +0 -1021
- package/crates/team-agent/src/lifecycle/tests/agent_ops.rs +0 -1205
- package/crates/team-agent/src/lifecycle/tests/b0_legacy_snapshot_nonauthority_contract.rs +0 -265
- package/crates/team-agent/src/lifecycle/tests/b0_reader_hideone_audit_contract.rs +0 -490
- package/crates/team-agent/src/lifecycle/tests/behavioral_diff_264_red.rs +0 -656
- package/crates/team-agent/src/lifecycle/tests/claude_compatible_config_red.rs +0 -325
- package/crates/team-agent/src/lifecycle/tests/claude_profile_launch_red.rs +0 -447
- package/crates/team-agent/src/lifecycle/tests/cli_argv_routing_red.rs +0 -1638
- package/crates/team-agent/src/lifecycle/tests/clone_agent_preserves_source_tools.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/clone_fork_copilot_perms_red.rs +0 -770
- package/crates/team-agent/src/lifecycle/tests/communication_mode_runtime_contract_red.rs +0 -419
- package/crates/team-agent/src/lifecycle/tests/copilot_provider_red.rs +0 -2035
- package/crates/team-agent/src/lifecycle/tests/core.rs +0 -1327
- package/crates/team-agent/src/lifecycle/tests/f032_startup_prompt_best_effort_red.rs +0 -315
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_g0.stdout.txt +0 -222
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_list_models_spaced_ids.stdout.txt +0 -9
- package/crates/team-agent/src/lifecycle/tests/fixtures/pi_native_mcp_host.mjs +0 -72
- package/crates/team-agent/src/lifecycle/tests/gate_fixtures.rs +0 -562
- package/crates/team-agent/src/lifecycle/tests/grok_require_explicit_model_red.rs +0 -110
- package/crates/team-agent/src/lifecycle/tests/harvest2_a_batch_red.rs +0 -512
- package/crates/team-agent/src/lifecycle/tests/host_cotenant_death_p0_contract.rs +0 -921
- package/crates/team-agent/src/lifecycle/tests/issue238_codex_effort_contract.rs +0 -68
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +0 -1851
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +0 -3983
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +0 -339
- package/crates/team-agent/src/lifecycle/tests/lifecycle_rollback_red.rs +0 -596
- package/crates/team-agent/src/lifecycle/tests/main_preserved.rs +0 -513
- package/crates/team-agent/src/lifecycle/tests/mcp_tool_name_format_red.rs +0 -69
- package/crates/team-agent/src/lifecycle/tests/phase_b_contracts.rs +0 -824
- package/crates/team-agent/src/lifecycle/tests/phase_golden.rs +0 -723
- package/crates/team-agent/src/lifecycle/tests/pi_catalog_red.rs +0 -164
- package/crates/team-agent/src/lifecycle/tests/pi_command_red.rs +0 -200
- package/crates/team-agent/src/lifecycle/tests/pi_compiler_red.rs +0 -210
- package/crates/team-agent/src/lifecycle/tests/pi_dual_entry_red.rs +0 -527
- package/crates/team-agent/src/lifecycle/tests/pi_executable_mcp_red.rs +0 -1062
- package/crates/team-agent/src/lifecycle/tests/pi_fork_session_inheritance_red.rs +0 -1419
- package/crates/team-agent/src/lifecycle/tests/pi_lifecycle_doctor_red.rs +0 -98
- package/crates/team-agent/src/lifecycle/tests/pi_native_mcp_capability_red.rs +0 -550
- package/crates/team-agent/src/lifecycle/tests/pi_session_delivery_red.rs +0 -226
- package/crates/team-agent/src/lifecycle/tests/quick_start_worker_readiness_red.rs +0 -332
- package/crates/team-agent/src/lifecycle/tests/realmachine_clusters_1_6_red.rs +0 -786
- package/crates/team-agent/src/lifecycle/tests/realmachine_residual_g1_g4_red.rs +0 -648
- package/crates/team-agent/src/lifecycle/tests/restart.rs +0 -185
- package/crates/team-agent/src/lifecycle/tests/restart_build_before_destroy_0540_contract.rs +0 -1053
- package/crates/team-agent/src/lifecycle/tests/restart_liveness_red.rs +0 -679
- package/crates/team-agent/src/lifecycle/tests/restart_rebind_hotfix_252_red.rs +0 -1126
- package/crates/team-agent/src/lifecycle/tests/restart_session_capture_red.rs +0 -153
- package/crates/team-agent/src/lifecycle/tests/resume_recover_red.rs +0 -427
- package/crates/team-agent/src/lifecycle/tests/stale_team_saveconflict_contract.rs +0 -431
- package/crates/team-agent/src/lifecycle/tests/startup_latency_contract.rs +0 -1066
- package/crates/team-agent/src/lifecycle/tests/status_credential_redaction_contract.rs +0 -876
- package/crates/team-agent/src/lifecycle/tests/subprep_codex_trust_roundtrip_red.rs +0 -1026
- package/crates/team-agent/src/lifecycle/tests/swallow_batch4_semantics_red.rs +0 -342
- package/crates/team-agent/src/lifecycle/tests/team_in_team_identity_scope_red.rs +0 -543
- package/crates/team-agent/src/lifecycle/tests/team_in_team_sibling_quick_start_red.rs +0 -1103
- package/crates/team-agent/src/lifecycle/tests/team_in_team_state_scope_red.rs +0 -1276
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_roster_red.rs +0 -145
- package/crates/team-agent/src/lifecycle/tests/team_key_retirement_txn_red.rs +0 -603
- package/crates/team-agent/src/lifecycle/tests/test_isolation_escape_contract.rs +0 -936
- package/crates/team-agent/src/lifecycle/tests/upgrade_compat_0211_red.rs +0 -970
- package/crates/team-agent/src/lifecycle/tests/verify_rs031_window_consistency_red.rs +0 -995
- package/crates/team-agent/src/lifecycle/tests/worker_spawn_env_red.rs +0 -836
- package/crates/team-agent/src/lifecycle/tests.rs +0 -105
- package/crates/team-agent/src/lifecycle/types.rs +0 -877
- package/crates/team-agent/src/lifecycle/worker_command_context.rs +0 -363
- package/crates/team-agent/src/main.rs +0 -52
- package/crates/team-agent/src/mcp_server/helpers.rs +0 -510
- package/crates/team-agent/src/mcp_server/lifecycle_tools/mod.rs +0 -6
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +0 -43
- package/crates/team-agent/src/mcp_server/mod.rs +0 -119
- package/crates/team-agent/src/mcp_server/normalize.rs +0 -485
- package/crates/team-agent/src/mcp_server/readiness.rs +0 -527
- package/crates/team-agent/src/mcp_server/readiness_tests.rs +0 -348
- package/crates/team-agent/src/mcp_server/tests/golden.rs +0 -285
- package/crates/team-agent/src/mcp_server/tests/normalize.rs +0 -247
- package/crates/team-agent/src/mcp_server/tests/scoped.rs +0 -158
- package/crates/team-agent/src/mcp_server/tests/send.rs +0 -353
- package/crates/team-agent/src/mcp_server/tests/tools.rs +0 -341
- package/crates/team-agent/src/mcp_server/tests/wire.rs +0 -254
- package/crates/team-agent/src/mcp_server/tests.rs +0 -43
- package/crates/team-agent/src/mcp_server/tools.rs +0 -889
- package/crates/team-agent/src/mcp_server/types.rs +0 -396
- package/crates/team-agent/src/mcp_server/wire.rs +0 -867
- package/crates/team-agent/src/messaging/activity.rs +0 -461
- package/crates/team-agent/src/messaging/address.rs +0 -87
- package/crates/team-agent/src/messaging/delivery.rs +0 -3727
- package/crates/team-agent/src/messaging/delivery_consumption_tests.rs +0 -234
- package/crates/team-agent/src/messaging/enter_rescue.rs +0 -362
- package/crates/team-agent/src/messaging/enter_rescue_tests.rs +0 -633
- package/crates/team-agent/src/messaging/helpers.rs +0 -336
- package/crates/team-agent/src/messaging/leader_channel.rs +0 -287
- package/crates/team-agent/src/messaging/leader_receiver.rs +0 -786
- package/crates/team-agent/src/messaging/mod.rs +0 -167
- package/crates/team-agent/src/messaging/persist.rs +0 -377
- package/crates/team-agent/src/messaging/presentation.rs +0 -417
- package/crates/team-agent/src/messaging/reminders.rs +0 -316
- package/crates/team-agent/src/messaging/results/collection_tests.rs +0 -719
- package/crates/team-agent/src/messaging/results.rs +0 -1415
- package/crates/team-agent/src/messaging/scheduler.rs +0 -223
- package/crates/team-agent/src/messaging/selftest.rs +0 -315
- package/crates/team-agent/src/messaging/send.rs +0 -981
- package/crates/team-agent/src/messaging/tests/basic.rs +0 -346
- package/crates/team-agent/src/messaging/tests/dup_inject.rs +0 -657
- package/crates/team-agent/src/messaging/tests/e23.rs +0 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +0 -169
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +0 -817
- package/crates/team-agent/src/messaging/tests/main_preserved.rs +0 -85
- package/crates/team-agent/src/messaging/tests/mod.rs +0 -306
- package/crates/team-agent/src/messaging/tests/runtime.rs +0 -3549
- package/crates/team-agent/src/messaging/tests/spine.rs +0 -853
- package/crates/team-agent/src/messaging/tests/wave2.rs +0 -381
- package/crates/team-agent/src/messaging/trust.rs +0 -215
- package/crates/team-agent/src/messaging/types.rs +0 -472
- package/crates/team-agent/src/messaging/wait.rs +0 -366
- package/crates/team-agent/src/messaging/watchers.rs +0 -916
- package/crates/team-agent/src/model/enums.rs +0 -356
- package/crates/team-agent/src/model/errors.rs +0 -18
- package/crates/team-agent/src/model/ids.rs +0 -165
- package/crates/team-agent/src/model/mod.rs +0 -29
- package/crates/team-agent/src/model/name_similarity.rs +0 -252
- package/crates/team-agent/src/model/pane_authority_refusal.rs +0 -359
- package/crates/team-agent/src/model/paths.rs +0 -257
- package/crates/team-agent/src/model/routing.rs +0 -387
- package/crates/team-agent/src/model/spec.rs +0 -1184
- package/crates/team-agent/src/model/task_graph.rs +0 -321
- package/crates/team-agent/src/model/testdata/fuzz.golden.yaml +0 -43
- package/crates/team-agent/src/model/testdata/fuzz.yaml +0 -43
- package/crates/team-agent/src/model/testdata/spec_invalid_a.yaml +0 -209
- package/crates/team-agent/src/model/testdata/team.spec.golden.yaml +0 -208
- package/crates/team-agent/src/model/testdata/team.spec.yaml +0 -208
- package/crates/team-agent/src/model/yaml/tests.rs +0 -188
- package/crates/team-agent/src/model/yaml.rs +0 -802
- package/crates/team-agent/src/os_probe.rs +0 -280
- package/crates/team-agent/src/packaging/install.rs +0 -219
- package/crates/team-agent/src/packaging/migrate.rs +0 -38
- package/crates/team-agent/src/packaging/mod.rs +0 -91
- package/crates/team-agent/src/packaging/repair.rs +0 -33
- package/crates/team-agent/src/packaging/tests.rs +0 -822
- package/crates/team-agent/src/packaging/types.rs +0 -417
- package/crates/team-agent/src/platform/argv.rs +0 -331
- package/crates/team-agent/src/platform/errors.rs +0 -104
- package/crates/team-agent/src/platform/file_lock.rs +0 -279
- package/crates/team-agent/src/platform/mod.rs +0 -5
- package/crates/team-agent/src/platform/process.rs +0 -545
- package/crates/team-agent/src/provider/adapter.rs +0 -1150
- package/crates/team-agent/src/provider/adapters/claude.rs +0 -78
- package/crates/team-agent/src/provider/adapters/claude_fork.rs +0 -131
- package/crates/team-agent/src/provider/adapters/copilot.rs +0 -75
- package/crates/team-agent/src/provider/adapters/copilot_fork.rs +0 -307
- package/crates/team-agent/src/provider/adapters/fake.rs +0 -18
- package/crates/team-agent/src/provider/adapters/mod.rs +0 -30
- package/crates/team-agent/src/provider/adapters/pi.rs +0 -106
- package/crates/team-agent/src/provider/approvals/mod.rs +0 -3
- package/crates/team-agent/src/provider/approvals/parsing.rs +0 -586
- package/crates/team-agent/src/provider/approvals/runtime_prompts.rs +0 -205
- package/crates/team-agent/src/provider/argv_route.rs +0 -405
- package/crates/team-agent/src/provider/bypass_flags.rs +0 -116
- package/crates/team-agent/src/provider/classify.rs +0 -708
- package/crates/team-agent/src/provider/command_helpers.rs +0 -45
- package/crates/team-agent/src/provider/faults.rs +0 -165
- package/crates/team-agent/src/provider/helpers.rs +0 -52
- package/crates/team-agent/src/provider/mod.rs +0 -78
- package/crates/team-agent/src/provider/model_catalog.rs +0 -910
- package/crates/team-agent/src/provider/session/capture.rs +0 -2731
- package/crates/team-agent/src/provider/session/context_fork/claude.rs +0 -123
- package/crates/team-agent/src/provider/session/context_fork/outcome.rs +0 -172
- package/crates/team-agent/src/provider/session/context_fork.rs +0 -396
- package/crates/team-agent/src/provider/session/mod.rs +0 -36
- package/crates/team-agent/src/provider/session/resume.rs +0 -269
- package/crates/team-agent/src/provider/session_scan/claude.rs +0 -523
- package/crates/team-agent/src/provider/session_scan/common/tests.rs +0 -316
- package/crates/team-agent/src/provider/session_scan/common.rs +0 -654
- package/crates/team-agent/src/provider/session_scan/copilot.rs +0 -280
- package/crates/team-agent/src/provider/session_scan/pi.rs +0 -185
- package/crates/team-agent/src/provider/session_scan.rs +0 -71
- package/crates/team-agent/src/provider/startup_prompt.rs +0 -757
- package/crates/team-agent/src/provider/submit_now.rs +0 -71
- package/crates/team-agent/src/provider/testdata/copilot-ready-marker.txt +0 -5
- package/crates/team-agent/src/provider/testdata/copilot-trust-prompt.txt +0 -19
- package/crates/team-agent/src/provider/testdata/grok-models-authenticated.stdout +0 -9
- package/crates/team-agent/src/provider/testdata/grok-models-unauthenticated.stdout +0 -7
- package/crates/team-agent/src/provider/tests/adapter.rs +0 -441
- package/crates/team-agent/src/provider/tests/classify.rs +0 -148
- package/crates/team-agent/src/provider/tests/command_helpers.rs +0 -35
- package/crates/team-agent/src/provider/tests/copilot_fork.rs +0 -191
- package/crates/team-agent/src/provider/tests/faults.rs +0 -200
- package/crates/team-agent/src/provider/tests/idle.rs +0 -177
- package/crates/team-agent/src/provider/tests/wire.rs +0 -213
- package/crates/team-agent/src/provider/tests.rs +0 -32
- package/crates/team-agent/src/provider/types.rs +0 -529
- package/crates/team-agent/src/provider/wire.rs +0 -394
- package/crates/team-agent/src/redaction.rs +0 -259
- package/crates/team-agent/src/state/abnormal_watch/tests/mod.rs +0 -248
- package/crates/team-agent/src/state/abnormal_watch.rs +0 -144
- package/crates/team-agent/src/state/identity.rs +0 -914
- package/crates/team-agent/src/state/identity_keys.rs +0 -132
- package/crates/team-agent/src/state/mod.rs +0 -74
- package/crates/team-agent/src/state/owner_gate.rs +0 -482
- package/crates/team-agent/src/state/ownership.rs +0 -563
- package/crates/team-agent/src/state/paths.rs +0 -395
- package/crates/team-agent/src/state/persist.rs +0 -3811
- package/crates/team-agent/src/state/projection.rs +0 -1508
- package/crates/team-agent/src/state/repository/intent.rs +0 -14
- package/crates/team-agent/src/state/repository/tests.rs +0 -184
- package/crates/team-agent/src/state/repository.rs +0 -866
- package/crates/team-agent/src/state/selector.rs +0 -160
- package/crates/team-agent/src/state/testdata/state-rich.canonical.json +0 -133
- package/crates/team-agent/src/test_support/models_timeout_fixture.rs +0 -144
- package/crates/team-agent/src/tmux_backend/enter_rescue.rs +0 -325
- package/crates/team-agent/src/tmux_backend/enter_rescue_tests.rs +0 -432
- package/crates/team-agent/src/tmux_backend/native_input.rs +0 -513
- package/crates/team-agent/src/tmux_backend/native_input_tests.rs +0 -742
- package/crates/team-agent/src/tmux_backend/tests.rs +0 -4103
- package/crates/team-agent/src/tmux_backend.rs +0 -4492
- package/crates/team-agent/src/topology.rs +0 -537
- package/crates/team-agent/src/transport/enter_rescue.rs +0 -166
- package/crates/team-agent/src/transport/native_input.rs +0 -491
- package/crates/team-agent/src/transport/test_support.rs +0 -743
- package/crates/team-agent/src/transport/tests/behavior.rs +0 -326
- package/crates/team-agent/src/transport/tests/mod.rs +0 -194
- package/crates/team-agent/src/transport/tests/wire.rs +0 -574
- package/crates/team-agent/src/transport.rs +0 -1655
- package/crates/team-agent/src/transport_factory.rs +0 -819
|
@@ -1,491 +0,0 @@
|
|
|
1
|
-
//! Owned legacy-tmux composer evidence. No keys, persistence, or provider admission.
|
|
2
|
-
|
|
3
|
-
use std::cell::RefCell;
|
|
4
|
-
|
|
5
|
-
use serde::{Deserialize, Serialize};
|
|
6
|
-
|
|
7
|
-
use crate::model::enums::Provider;
|
|
8
|
-
|
|
9
|
-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
10
|
-
pub struct NativeInputRequest {
|
|
11
|
-
pub message_id: String,
|
|
12
|
-
pub owner_team_id: String,
|
|
13
|
-
pub recipient: String,
|
|
14
|
-
pub provider: Provider,
|
|
15
|
-
pub pane_id: String,
|
|
16
|
-
pub pane_pid: u32,
|
|
17
|
-
pub session: String,
|
|
18
|
-
pub window: String,
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
impl NativeInputRequest {
|
|
22
|
-
pub fn marker(&self) -> String {
|
|
23
|
-
format!("[team-agent-token:{}]", self.message_id)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
pub fn supported(&self) -> bool {
|
|
27
|
-
self.provider == Provider::Pi
|
|
28
|
-
&& self.message_id.starts_with("msg_")
|
|
29
|
-
&& self
|
|
30
|
-
.message_id
|
|
31
|
-
.bytes()
|
|
32
|
-
.all(|byte| byte.is_ascii_alphanumeric() || byte == b'_')
|
|
33
|
-
&& !self.owner_team_id.is_empty()
|
|
34
|
-
&& !self.recipient.is_empty()
|
|
35
|
-
&& self.recipient != "leader"
|
|
36
|
-
&& self.pane_id.starts_with('%')
|
|
37
|
-
&& self.pane_pid > 1
|
|
38
|
-
&& !self.session.is_empty()
|
|
39
|
-
&& !self.window.is_empty()
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/// Carrier birth and framework pane nonce, not a claim of native executable admission.
|
|
44
|
-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
45
|
-
pub struct NativeInputBinding {
|
|
46
|
-
pub endpoint: String,
|
|
47
|
-
pub pane_id: String,
|
|
48
|
-
pub pane_pid: u32,
|
|
49
|
-
pub pane_height: u32,
|
|
50
|
-
pub carrier_birth: String,
|
|
51
|
-
pub binding_nonce: String,
|
|
52
|
-
pub session: String,
|
|
53
|
-
pub window: String,
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
|
57
|
-
#[serde(rename_all = "snake_case")]
|
|
58
|
-
pub enum NativeInputPhase {
|
|
59
|
-
Ready,
|
|
60
|
-
MayHavePasted,
|
|
61
|
-
Pasted,
|
|
62
|
-
Seen,
|
|
63
|
-
MayHaveSubmitted,
|
|
64
|
-
Submitted,
|
|
65
|
-
Accepted,
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
|
69
|
-
pub struct NativeInputEvidence {
|
|
70
|
-
pub request: NativeInputRequest,
|
|
71
|
-
pub binding: NativeInputBinding,
|
|
72
|
-
pub payload_sha256: String,
|
|
73
|
-
pub ui_identity: String,
|
|
74
|
-
pub footer_sha256: String,
|
|
75
|
-
pub baseline_sha256: String,
|
|
76
|
-
pub baseline_capsules: Vec<String>,
|
|
77
|
-
pub phase: NativeInputPhase,
|
|
78
|
-
pub capsule: Option<String>,
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
82
|
-
pub enum EnterRescueOutcome {
|
|
83
|
-
Consumed,
|
|
84
|
-
NoEffect {
|
|
85
|
-
reason: &'static str,
|
|
86
|
-
reobserve: bool,
|
|
87
|
-
},
|
|
88
|
-
Entered {
|
|
89
|
-
accepted: bool,
|
|
90
|
-
},
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
type Scope = (Option<NativeInputRequest>, Option<NativeInputEvidence>);
|
|
94
|
-
thread_local! {
|
|
95
|
-
static INPUT_SCOPE: RefCell<Scope> = const { RefCell::new((None, None)) };
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
struct Restore(Option<Scope>);
|
|
99
|
-
impl Drop for Restore {
|
|
100
|
-
fn drop(&mut self) {
|
|
101
|
-
if let Some(previous) = self.0.take() {
|
|
102
|
-
INPUT_SCOPE.with(|slot| *slot.borrow_mut() = previous);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
/// Existing synchronous delivery owns this scope; no borrowed observer escapes a thread.
|
|
108
|
-
pub fn with_native_input<R>(
|
|
109
|
-
request: Option<NativeInputRequest>,
|
|
110
|
-
f: impl FnOnce() -> R,
|
|
111
|
-
) -> (R, Option<NativeInputEvidence>) {
|
|
112
|
-
let previous = INPUT_SCOPE.with(|slot| slot.replace((request, None)));
|
|
113
|
-
let restore = Restore(Some(previous));
|
|
114
|
-
let result = f();
|
|
115
|
-
let evidence = INPUT_SCOPE.with(|slot| slot.borrow_mut().1.take());
|
|
116
|
-
drop(restore);
|
|
117
|
-
(result, evidence)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
pub(crate) fn current_request() -> Option<NativeInputRequest> {
|
|
121
|
-
INPUT_SCOPE.with(|slot| slot.borrow().0.clone())
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
pub(crate) fn record_evidence(evidence: &NativeInputEvidence) {
|
|
125
|
-
INPUT_SCOPE.with(|slot| {
|
|
126
|
-
let mut scope = slot.borrow_mut();
|
|
127
|
-
if scope.0.as_ref() == Some(&evidence.request) {
|
|
128
|
-
scope.1 = Some(evidence.clone());
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
#[derive(Debug, Clone, PartialEq, Eq)]
|
|
134
|
-
pub struct InputFrame {
|
|
135
|
-
pub composer: String,
|
|
136
|
-
pub transcript: String,
|
|
137
|
-
pub identity: String,
|
|
138
|
-
pub footer: String,
|
|
139
|
-
pub busy: bool,
|
|
140
|
-
pub capsule: Option<String>,
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
impl InputFrame {
|
|
144
|
-
pub fn empty(&self) -> bool {
|
|
145
|
-
self.composer.trim().is_empty()
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
pub fn has_marker(&self, marker: &str) -> bool {
|
|
149
|
-
self.composer
|
|
150
|
-
.lines()
|
|
151
|
-
.map(str::trim)
|
|
152
|
-
.collect::<String>()
|
|
153
|
-
.matches(marker)
|
|
154
|
-
.count()
|
|
155
|
-
== 1
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
pub fn pending(&self, evidence: &NativeInputEvidence) -> bool {
|
|
159
|
-
!self.busy
|
|
160
|
-
&& self.identity == evidence.ui_identity
|
|
161
|
-
&& input_digest(&self.footer) == evidence.footer_sha256
|
|
162
|
-
&& (self.has_marker(&evidence.request.marker())
|
|
163
|
-
|| evidence.capsule.as_ref().is_some_and(|capsule| {
|
|
164
|
-
self.capsule.as_ref() == Some(capsule)
|
|
165
|
-
&& !evidence.baseline_capsules.contains(capsule)
|
|
166
|
-
}))
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
pub fn accepted(&self, evidence: &NativeInputEvidence) -> bool {
|
|
170
|
-
if !self.empty() || self.identity != evidence.ui_identity {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
if evidence.phase < NativeInputPhase::Seen {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
let marker = evidence.request.marker();
|
|
177
|
-
let joined: String = self.transcript.lines().map(str::trim).collect();
|
|
178
|
-
if joined.matches(&marker).count() == 1 {
|
|
179
|
-
return true;
|
|
180
|
-
}
|
|
181
|
-
evidence.capsule.as_ref().is_some_and(|capsule| {
|
|
182
|
-
!evidence.baseline_capsules.contains(capsule)
|
|
183
|
-
&& self
|
|
184
|
-
.transcript
|
|
185
|
-
.lines()
|
|
186
|
-
.filter(|line| line.trim() == capsule)
|
|
187
|
-
.count()
|
|
188
|
-
== 1
|
|
189
|
-
})
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
fn input_digest(text: &str) -> String {
|
|
194
|
-
use sha2::{Digest, Sha256};
|
|
195
|
-
format!("{:x}", Sha256::digest(text.as_bytes()))
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
pub(crate) fn supports_input_observation(provider: Provider) -> bool {
|
|
199
|
-
provider == Provider::Pi
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
pub(crate) fn inspect_input(
|
|
203
|
-
provider: Provider,
|
|
204
|
-
text: &str,
|
|
205
|
-
pane_height: u32,
|
|
206
|
-
) -> Option<InputFrame> {
|
|
207
|
-
match provider {
|
|
208
|
-
Provider::Pi => pi_input(text, pane_height),
|
|
209
|
-
_ => None,
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
fn border(line: &str) -> bool {
|
|
214
|
-
line.chars().filter(|character| *character == '─').count() >= 8
|
|
215
|
-
&& line.trim_start().starts_with('─')
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
// A complete native update notice can end inside the editor search window,
|
|
219
|
-
// but its opening must precede every possible editor row. Never discard a
|
|
220
|
-
// ruler belonging to the editable region or an incomplete/unknown notice.
|
|
221
|
-
fn pi_closed_update_notice(rows: &[&str], closing: usize, editor_start: usize, top: usize) -> bool {
|
|
222
|
-
let rule = rows[closing].trim();
|
|
223
|
-
if !rule.chars().all(|character| character == '─')
|
|
224
|
-
|| !rows[closing + 1..top]
|
|
225
|
-
.iter()
|
|
226
|
-
.all(|row| row.trim().is_empty())
|
|
227
|
-
{
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
let Some(opening) = rows[..editor_start]
|
|
231
|
-
.iter()
|
|
232
|
-
.rposition(|row| row.trim() == rule)
|
|
233
|
-
else {
|
|
234
|
-
return false;
|
|
235
|
-
};
|
|
236
|
-
let body = &rows[opening + 1..closing];
|
|
237
|
-
body.len() >= 4
|
|
238
|
-
&& body[0].trim() == "Package Updates Available"
|
|
239
|
-
&& body[1].trim() == "Package updates are available. Run pi update --extensions"
|
|
240
|
-
&& body[2].trim() == "Packages:"
|
|
241
|
-
&& body[3..].iter().all(|row| {
|
|
242
|
-
row.trim()
|
|
243
|
-
.strip_prefix("- ")
|
|
244
|
-
.is_some_and(|package| !package.trim().is_empty())
|
|
245
|
-
})
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
pub(crate) fn pi_paste_capsule(text: &str) -> Option<&str> {
|
|
249
|
-
fn positive(value: &str) -> bool {
|
|
250
|
-
!value.starts_with('0')
|
|
251
|
-
&& value.bytes().all(|byte| byte.is_ascii_digit())
|
|
252
|
-
&& value.parse::<u64>().is_ok()
|
|
253
|
-
}
|
|
254
|
-
let label = text.trim();
|
|
255
|
-
let body = label.strip_prefix("[paste #")?.strip_suffix(']')?;
|
|
256
|
-
let (id, size) = body.split_once(' ')?;
|
|
257
|
-
let count = if let Some(lines) = size.strip_prefix('+') {
|
|
258
|
-
lines.strip_suffix(" lines")?
|
|
259
|
-
} else {
|
|
260
|
-
size.strip_suffix(" chars")?
|
|
261
|
-
};
|
|
262
|
-
(positive(id) && positive(count)).then_some(label)
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
fn pi_input(text: &str, pane_height: u32) -> Option<InputFrame> {
|
|
266
|
-
if pane_height < 10 {
|
|
267
|
-
return None;
|
|
268
|
-
}
|
|
269
|
-
let rows: Vec<_> = text.lines().collect();
|
|
270
|
-
let footer = rows
|
|
271
|
-
.iter()
|
|
272
|
-
.rposition(|row| row.contains(" · ") && row.contains("%/"))?;
|
|
273
|
-
if rows[footer + 1..].iter().any(|row| !row.trim().is_empty()) {
|
|
274
|
-
return None;
|
|
275
|
-
}
|
|
276
|
-
let bottom = (0..footer)
|
|
277
|
-
.rev()
|
|
278
|
-
.find(|index| !rows[*index].trim().is_empty())?;
|
|
279
|
-
if !border(rows[bottom]) {
|
|
280
|
-
return None;
|
|
281
|
-
}
|
|
282
|
-
// Current Pi renderer shows at most max(5, floor(pane_rows * .3))
|
|
283
|
-
// editor lines. A task's Unicode ruler is not a native top boundary:
|
|
284
|
-
// ambiguous borders inside that whole possible editor extent refuse.
|
|
285
|
-
let extent = (pane_height as usize * 3 / 10).max(5) + 1;
|
|
286
|
-
let editor_start = bottom.saturating_sub(extent);
|
|
287
|
-
let candidates: Vec<_> = (editor_start..bottom)
|
|
288
|
-
.filter(|index| border(rows[*index]))
|
|
289
|
-
.collect();
|
|
290
|
-
let top = *candidates.last()?;
|
|
291
|
-
if candidates[..candidates.len() - 1]
|
|
292
|
-
.iter()
|
|
293
|
-
.any(|index| !pi_closed_update_notice(&rows, *index, editor_start, top))
|
|
294
|
-
{
|
|
295
|
-
return None;
|
|
296
|
-
}
|
|
297
|
-
let composer = rows[top + 1..bottom].join("\n");
|
|
298
|
-
let transcript = rows[..top].join("\n");
|
|
299
|
-
// Inspect native status adjacent to the editor, never the task body.
|
|
300
|
-
let status = rows[..top]
|
|
301
|
-
.iter()
|
|
302
|
-
.rev()
|
|
303
|
-
.filter(|row| !row.trim().is_empty())
|
|
304
|
-
.take(3)
|
|
305
|
-
.copied()
|
|
306
|
-
.collect::<Vec<_>>()
|
|
307
|
-
.join("\n");
|
|
308
|
-
// Pi embeds its live status/spinner after a 1–3-cell border prefix. Idle
|
|
309
|
-
// (including the observed overflow/title border) has a solid leading run.
|
|
310
|
-
let busy = rows[top]
|
|
311
|
-
.trim_start()
|
|
312
|
-
.chars()
|
|
313
|
-
.take_while(|character| *character == '─')
|
|
314
|
-
.count()
|
|
315
|
-
< 8
|
|
316
|
-
|| status.to_ascii_lowercase().contains("esc to interrupt")
|
|
317
|
-
|| status.to_ascii_lowercase().contains("ctrl+c to stop");
|
|
318
|
-
let capsule = pi_paste_capsule(&composer).map(str::to_owned);
|
|
319
|
-
Some(InputFrame {
|
|
320
|
-
composer,
|
|
321
|
-
transcript,
|
|
322
|
-
identity: rows[footer].split(" · ").next()?.trim().to_string(),
|
|
323
|
-
footer: String::new(),
|
|
324
|
-
busy,
|
|
325
|
-
capsule,
|
|
326
|
-
})
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
#[cfg(test)]
|
|
330
|
-
mod tests {
|
|
331
|
-
#![allow(clippy::unwrap_used, clippy::panic)]
|
|
332
|
-
use super::*;
|
|
333
|
-
|
|
334
|
-
fn pi(composer: &str, transcript: &str) -> String {
|
|
335
|
-
format!("{transcript}\n──────────────── ↑ 20 more ─ runner-luna ─\n{composer}\n────────────────────────\ngpt-6-luna · max · 0%/272k · 0% · $0.00\n")
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
fn inspect_input(provider: Provider, text: &str) -> Option<InputFrame> {
|
|
339
|
-
super::inspect_input(provider, text, 120)
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
#[test]
|
|
343
|
-
fn native_input_scope_restores_nested_and_panicking_calls() {
|
|
344
|
-
let request = NativeInputRequest {
|
|
345
|
-
message_id: "msg_one".into(),
|
|
346
|
-
owner_team_id: "team".into(),
|
|
347
|
-
recipient: "worker".into(),
|
|
348
|
-
provider: Provider::Pi,
|
|
349
|
-
pane_id: "%1".into(),
|
|
350
|
-
pane_pid: 2,
|
|
351
|
-
session: "team".into(),
|
|
352
|
-
window: "worker".into(),
|
|
353
|
-
};
|
|
354
|
-
with_native_input(Some(request.clone()), || {
|
|
355
|
-
assert_eq!(current_request(), Some(request.clone()));
|
|
356
|
-
with_native_input(None, || assert!(current_request().is_none()));
|
|
357
|
-
assert_eq!(current_request(), Some(request));
|
|
358
|
-
let _ = std::panic::catch_unwind(|| with_native_input(None, || panic!("fixture")));
|
|
359
|
-
assert!(current_request().is_some());
|
|
360
|
-
});
|
|
361
|
-
assert!(current_request().is_none());
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
#[test]
|
|
365
|
-
fn native_input_pi_requires_editor_and_footer_not_startup_echo() {
|
|
366
|
-
let marker = "[team-agent-token:msg_one]";
|
|
367
|
-
let draft = pi(
|
|
368
|
-
&format!("{}\n{marker}", "line\n".repeat(26)),
|
|
369
|
-
"Warning: startup",
|
|
370
|
-
);
|
|
371
|
-
let frame = inspect_input(Provider::Pi, &draft).unwrap();
|
|
372
|
-
assert!(!frame.empty());
|
|
373
|
-
assert!(frame.has_marker(marker));
|
|
374
|
-
assert!(!frame.busy);
|
|
375
|
-
assert!(inspect_input(Provider::Pi, &format!("Warning: startup\n{marker}")).is_none());
|
|
376
|
-
assert!(inspect_input(Provider::Pi, &pi("", "old history"))
|
|
377
|
-
.unwrap()
|
|
378
|
-
.empty());
|
|
379
|
-
let busy = pi("draft", "history").replace(
|
|
380
|
-
"──────────────── ↑ 20 more ─ runner-luna ─",
|
|
381
|
-
"── ⠋ Working ─────────────────────",
|
|
382
|
-
);
|
|
383
|
-
assert!(inspect_input(Provider::Pi, &busy).unwrap().busy);
|
|
384
|
-
assert!(inspect_input(
|
|
385
|
-
Provider::Pi,
|
|
386
|
-
&pi("foreign draft\n────────\n", "old history")
|
|
387
|
-
)
|
|
388
|
-
.is_none());
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
const PI_R6_IDLE: &str = include_str!("../../tests/fixtures/pi-r6-idle-24.txt");
|
|
392
|
-
|
|
393
|
-
#[test]
|
|
394
|
-
fn native_input_pi_r6_idle_update_notice_preserves_empty_editor() {
|
|
395
|
-
assert_eq!(
|
|
396
|
-
input_digest(PI_R6_IDLE),
|
|
397
|
-
"40f31e7476f628a471113c89b76a1ace0246e69f53fb7238999205f62b5d20fa"
|
|
398
|
-
);
|
|
399
|
-
let frame = super::inspect_input(Provider::Pi, PI_R6_IDLE, 24).unwrap();
|
|
400
|
-
assert!(frame.empty());
|
|
401
|
-
assert!(!frame.busy);
|
|
402
|
-
assert_eq!(frame.identity, "gpt-6-luna");
|
|
403
|
-
assert!(frame.transcript.contains("Package Updates Available"));
|
|
404
|
-
assert!(!frame.composer.contains("Package Updates Available"));
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
#[test]
|
|
408
|
-
fn native_input_pi_r6_notice_does_not_hide_drafts_or_busy_state() {
|
|
409
|
-
let top = " pi-target ─\n\n";
|
|
410
|
-
let marker = "[team-agent-token:msg_one]";
|
|
411
|
-
let draft = PI_R6_IDLE.replace(top, &format!(" pi-target ─\nforeign draft\n{marker}\n"));
|
|
412
|
-
let frame = super::inspect_input(Provider::Pi, &draft, 24).unwrap();
|
|
413
|
-
assert!(!frame.empty());
|
|
414
|
-
assert!(frame.has_marker(marker));
|
|
415
|
-
let busy = PI_R6_IDLE.replace(
|
|
416
|
-
"──────────────────────────────────────────────────────────────────── pi-target ─",
|
|
417
|
-
"── ⠋ Working ──────────────────────────────────────────────────────────────────",
|
|
418
|
-
);
|
|
419
|
-
let frame = super::inspect_input(Provider::Pi, &busy, 24).unwrap();
|
|
420
|
-
assert!(frame.empty());
|
|
421
|
-
assert!(frame.busy);
|
|
422
|
-
for composer in ["foreign draft\n────────\n", "\n────────\n"]
|
|
423
|
-
{
|
|
424
|
-
let foreign = PI_R6_IDLE.replace(top, &format!(" pi-target ─\n{composer}\n"));
|
|
425
|
-
assert!(super::inspect_input(Provider::Pi, &foreign, 24).is_none());
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
#[test]
|
|
430
|
-
fn native_input_pi_r6_incomplete_or_ambiguous_notice_refuses() {
|
|
431
|
-
for frame in [
|
|
432
|
-
PI_R6_IDLE.replace("Package Updates Available", "Unknown notification"),
|
|
433
|
-
PI_R6_IDLE.replace(" - pi-mcp-adapter", "not a native package row"),
|
|
434
|
-
PI_R6_IDLE.replace("\n\n──────────────────────────────────────────────────────────────────── pi-target", "\nforeign draft\n──────────────────────────────────────────────────────────────────── pi-target"),
|
|
435
|
-
] {
|
|
436
|
-
assert!(super::inspect_input(Provider::Pi, &frame, 24).is_none());
|
|
437
|
-
}
|
|
438
|
-
// If the complete box itself could be editor content, geometry cannot
|
|
439
|
-
// distinguish it from a pasted imitation: keep the old refusal.
|
|
440
|
-
assert!(super::inspect_input(Provider::Pi, PI_R6_IDLE, 120).is_none());
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
const PI_R7_FOLDED: &str = include_str!("../../tests/fixtures/pi-r7-folded-24.txt");
|
|
444
|
-
|
|
445
|
-
#[test]
|
|
446
|
-
fn native_input_pi_r7_capsule_is_current_composer_not_history() {
|
|
447
|
-
assert_eq!(
|
|
448
|
-
input_digest(PI_R7_FOLDED),
|
|
449
|
-
"b7ea6992c3303743b50714fb55ffc8b91ac5ad168e0acd015428ca5af538ed0e"
|
|
450
|
-
);
|
|
451
|
-
let frame = super::inspect_input(Provider::Pi, PI_R7_FOLDED, 24).unwrap();
|
|
452
|
-
assert!(!frame.empty());
|
|
453
|
-
assert!(!frame.busy);
|
|
454
|
-
assert_eq!(frame.capsule.as_deref(), Some("[paste #1 +30 lines]"));
|
|
455
|
-
assert!(!frame.has_marker("[team-agent-token:msg_one]"));
|
|
456
|
-
let history = format!("[paste #1 +30 lines]\n{PI_R6_IDLE}");
|
|
457
|
-
let frame = super::inspect_input(Provider::Pi, &history, 24).unwrap();
|
|
458
|
-
assert!(frame.empty());
|
|
459
|
-
assert!(frame.capsule.is_none());
|
|
460
|
-
let extra = PI_R7_FOLDED.replace(
|
|
461
|
-
"[paste #1 +30 lines]",
|
|
462
|
-
"[paste #1 +30 lines]\nforeign draft",
|
|
463
|
-
);
|
|
464
|
-
let frame = super::inspect_input(Provider::Pi, &extra, 24).unwrap();
|
|
465
|
-
assert!(!frame.empty());
|
|
466
|
-
assert!(frame.capsule.is_none());
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
#[test]
|
|
470
|
-
fn native_input_pi_capsule_grammar_is_canonical_and_provider_specific() {
|
|
471
|
-
for label in ["[paste #1 +30 lines]", "[paste #2 1234 chars]"] {
|
|
472
|
-
assert_eq!(pi_paste_capsule(label), Some(label));
|
|
473
|
-
}
|
|
474
|
-
for label in [
|
|
475
|
-
"[paste #0 +30 lines]",
|
|
476
|
-
"[paste #01 +30 lines]",
|
|
477
|
-
"[paste #1 +0 lines]",
|
|
478
|
-
"[paste #1 +030 lines]",
|
|
479
|
-
"[paste #18446744073709551616 +30 lines]",
|
|
480
|
-
"[paste #1 +18446744073709551616 lines]",
|
|
481
|
-
"[paste #1 -30 lines]",
|
|
482
|
-
"[paste #1 +30 line]",
|
|
483
|
-
"[paste #1 +30 lines]suffix",
|
|
484
|
-
"prefix[paste #1 +30 lines]",
|
|
485
|
-
"[paste #1 +30 lines]\n[paste #2 +40 lines]",
|
|
486
|
-
"[Pasted text #1 +30 lines]",
|
|
487
|
-
] {
|
|
488
|
-
assert_eq!(pi_paste_capsule(label), None, "{label}");
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
}
|