@team-agent/installer 0.5.50 → 0.5.52
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/Cargo.lock +1 -1
- package/Cargo.toml +1 -1
- package/crates/team-agent/src/cli/adapters.rs +5 -3
- package/crates/team-agent/src/cli/emit.rs +2 -1
- package/crates/team-agent/src/cli/mod.rs +32 -14
- package/crates/team-agent/src/cli/named_address.rs +46 -115
- package/crates/team-agent/src/cli/send/coordinator.rs +163 -0
- package/crates/team-agent/src/cli/send/mailbox.rs +99 -0
- package/crates/team-agent/src/cli/send/persist.rs +154 -0
- package/crates/team-agent/src/cli/send/presentation.rs +333 -0
- package/crates/team-agent/src/cli/send/resolve.rs +361 -0
- package/crates/team-agent/src/cli/send.rs +44 -1169
- package/crates/team-agent/src/cli/spec.rs +1 -1
- package/crates/team-agent/src/cli/status_port/agents.rs +358 -0
- package/crates/team-agent/src/cli/status_port/approvals.rs +79 -0
- package/crates/team-agent/src/cli/status_port/compact.rs +207 -0
- package/crates/team-agent/src/cli/status_port/format.rs +145 -0
- package/crates/team-agent/src/cli/status_port/inbox.rs +36 -0
- package/crates/team-agent/src/cli/status_port/runtime.rs +195 -0
- package/crates/team-agent/src/cli/status_port/snapshot.rs +181 -0
- package/crates/team-agent/src/cli/status_port/store.rs +412 -0
- package/crates/team-agent/src/cli/status_port/tests.rs +54 -0
- package/crates/team-agent/src/cli/status_port.rs +47 -1548
- package/crates/team-agent/src/cli/tests/main_preserved.rs +1 -0
- package/crates/team-agent/src/cli/tests/run_delegation.rs +1 -0
- package/crates/team-agent/src/cli/types.rs +1 -0
- package/crates/team-agent/src/coordinator/conpty_shim.rs +34 -30
- package/crates/team-agent/src/coordinator/steps/abnormal.rs +135 -13
- package/crates/team-agent/src/coordinator/tick.rs +37 -0
- package/crates/team-agent/src/db/agent_health_capture.rs +18 -13
- package/crates/team-agent/src/db/message_store.rs +154 -44
- package/crates/team-agent/src/event_log.rs +73 -0
- package/crates/team-agent/src/leader/lease.rs +202 -16
- package/crates/team-agent/src/leader/start.rs +28 -4
- package/crates/team-agent/src/lifecycle/launch/add_agent.rs +424 -0
- package/crates/team-agent/src/lifecycle/launch/add_agent_state.rs +303 -0
- package/crates/team-agent/src/lifecycle/launch/agent_state.rs +160 -0
- package/crates/team-agent/src/lifecycle/launch/approval.rs +134 -0
- package/crates/team-agent/src/lifecycle/launch/fork_agent.rs +492 -0
- package/crates/team-agent/src/lifecycle/launch/fork_state.rs +297 -0
- package/crates/team-agent/src/lifecycle/launch/identity.rs +372 -0
- package/crates/team-agent/src/lifecycle/launch/layout.rs +313 -0
- package/crates/team-agent/src/lifecycle/launch/leader_context.rs +478 -0
- package/crates/team-agent/src/lifecycle/launch/mcp_config.rs +201 -0
- package/crates/team-agent/src/lifecycle/launch/ownership.rs +66 -0
- package/crates/team-agent/src/lifecycle/launch/quick_start.rs +477 -0
- package/crates/team-agent/src/lifecycle/launch/quick_start_transport.rs +278 -0
- package/crates/team-agent/src/lifecycle/launch/readiness.rs +123 -0
- package/crates/team-agent/src/lifecycle/launch/spawn.rs +377 -0
- package/crates/team-agent/src/lifecycle/launch/spec_state.rs +434 -0
- package/crates/team-agent/src/lifecycle/launch/state_projection.rs +499 -0
- package/crates/team-agent/src/lifecycle/launch/worker_env.rs +438 -0
- package/crates/team-agent/src/lifecycle/launch.rs +119 -5351
- package/crates/team-agent/src/lifecycle/restart/agent.rs +63 -29
- package/crates/team-agent/src/lifecycle/restart/common.rs +53 -27
- package/crates/team-agent/src/lifecycle/restart/rebuild.rs +167 -27
- package/crates/team-agent/src/lifecycle/restart/remove.rs +503 -77
- package/crates/team-agent/src/lifecycle/restart.rs +26 -2
- package/crates/team-agent/src/lifecycle/tests/lane_ops.rs +906 -17
- package/crates/team-agent/src/lifecycle/tests/launch_spawn.rs +67 -2
- package/crates/team-agent/src/lifecycle/tests/lifecycle_lock.rs +24 -1
- package/crates/team-agent/src/mcp_server/lifecycle_tools/agent_ops.rs +30 -7
- package/crates/team-agent/src/mcp_server/lifecycle_tools/state_status.rs +8 -4
- package/crates/team-agent/src/mcp_server/mod.rs +1 -1
- package/crates/team-agent/src/mcp_server/tests/send.rs +6 -10
- package/crates/team-agent/src/mcp_server/tests/tools.rs +18 -1
- package/crates/team-agent/src/mcp_server/tests.rs +11 -4
- package/crates/team-agent/src/mcp_server/tools.rs +14 -5
- package/crates/team-agent/src/messaging/activity.rs +4 -2
- package/crates/team-agent/src/messaging/address.rs +86 -0
- package/crates/team-agent/src/messaging/delivery.rs +288 -183
- package/crates/team-agent/src/messaging/helpers.rs +17 -13
- package/crates/team-agent/src/messaging/leader_channel.rs +171 -0
- package/crates/team-agent/src/messaging/leader_receiver.rs +60 -35
- package/crates/team-agent/src/messaging/mod.rs +15 -2
- package/crates/team-agent/src/messaging/persist.rs +309 -0
- package/crates/team-agent/src/messaging/results.rs +16 -24
- package/crates/team-agent/src/messaging/scheduler.rs +4 -2
- package/crates/team-agent/src/messaging/selftest.rs +19 -12
- package/crates/team-agent/src/messaging/send.rs +101 -49
- package/crates/team-agent/src/messaging/tests/leader_channel.rs +169 -0
- package/crates/team-agent/src/messaging/tests/leader_inject_acceptance.rs +305 -0
- package/crates/team-agent/src/messaging/tests/mod.rs +2 -0
- package/crates/team-agent/src/messaging/tests/runtime.rs +38 -17
- package/crates/team-agent/src/messaging/watchers.rs +13 -3
- package/crates/team-agent/src/redaction.rs +72 -2
- package/crates/team-agent/src/state/persist.rs +284 -21
- package/crates/team-agent/src/state/projection.rs +245 -30
- package/crates/team-agent/src/state/repository/intent.rs +13 -0
- package/crates/team-agent/src/state/repository/tests.rs +47 -0
- package/crates/team-agent/src/state/repository.rs +94 -27
- package/crates/team-agent/src/state/selector.rs +9 -18
- package/package.json +4 -4
|
@@ -40,11 +40,13 @@ use super::StateError;
|
|
|
40
40
|
// `save_team_scoped_state(` tokens that the governance scanner counts.
|
|
41
41
|
#[allow(unused_imports)]
|
|
42
42
|
use super::persist::{
|
|
43
|
-
load_runtime_state as helper_load_workspace,
|
|
43
|
+
load_runtime_state as helper_load_workspace,
|
|
44
|
+
runtime_state_path as helper_workspace_path, save_runtime_state as helper_write_root,
|
|
44
45
|
save_runtime_state_reapplying_after_conflict as helper_write_root_reapply,
|
|
45
46
|
save_runtime_state_with_deleted_agents as helper_write_root_with_deleted_agents,
|
|
46
47
|
save_runtime_state_with_lifecycle_topology_authority as helper_write_root_with_lifecycle_topology_authority,
|
|
47
48
|
save_runtime_state_with_lifecycle_topology_authority_and_capture_backfill_skip as helper_write_root_with_lifecycle_topology_authority_and_capture_backfill_skip,
|
|
49
|
+
save_runtime_state_with_receiver_authority as helper_write_root_with_receiver_authority,
|
|
48
50
|
save_runtime_state_with_team_tombstone_lifecycle_topology_authority as helper_write_root_with_team_tombstone_lifecycle_topology_authority,
|
|
49
51
|
save_runtime_state_with_team_tombstoned_agents as helper_write_root_with_team_tombstoned_agents,
|
|
50
52
|
save_runtime_state_without_migrations as helper_write_root_without_migrations,
|
|
@@ -59,6 +61,8 @@ use super::projection::{
|
|
|
59
61
|
save_team_scoped_state_with_tombstone_lifecycle_topology_authority as helper_write_team_scoped_with_tombstone_lifecycle_topology_authority,
|
|
60
62
|
};
|
|
61
63
|
|
|
64
|
+
mod intent;
|
|
65
|
+
|
|
62
66
|
/// Repository facade for workspace state reads and writes.
|
|
63
67
|
///
|
|
64
68
|
/// S1a scope: hold the workspace path, expose `load_workspace`/`load_team`
|
|
@@ -79,6 +83,19 @@ impl<'a> StateRepository<'a> {
|
|
|
79
83
|
helper_load_workspace(self.workspace)
|
|
80
84
|
}
|
|
81
85
|
|
|
86
|
+
/// Load the canonical workspace document without running read-time
|
|
87
|
+
/// migrations. `None` preserves the legacy raw-reader distinction between
|
|
88
|
+
/// a missing file and a present empty/default document.
|
|
89
|
+
pub fn load_workspace_if_exists_without_migrations(
|
|
90
|
+
&self,
|
|
91
|
+
) -> Result<Option<Value>, StateError> {
|
|
92
|
+
if !helper_workspace_path(self.workspace).exists() {
|
|
93
|
+
return Ok(None);
|
|
94
|
+
}
|
|
95
|
+
let text = std::fs::read_to_string(helper_workspace_path(self.workspace))?;
|
|
96
|
+
serde_json::from_str(&text).map(Some).map_err(StateError::from)
|
|
97
|
+
}
|
|
98
|
+
|
|
82
99
|
/// Resolve a team-scoped projection using the existing projection selector.
|
|
83
100
|
/// `team_key = None` selects the ambient team the same way as pre-S1a.
|
|
84
101
|
pub fn load_team(&self, team_key: Option<&str>) -> Result<Value, StateError> {
|
|
@@ -127,6 +144,10 @@ pub enum StateWriteIntent<'a> {
|
|
|
127
144
|
LaunchTeam {
|
|
128
145
|
team_key: &'a str,
|
|
129
146
|
},
|
|
147
|
+
AddAgent {
|
|
148
|
+
team_key: &'a str,
|
|
149
|
+
agent_id: &'a str,
|
|
150
|
+
},
|
|
130
151
|
AnnotateTeamDepth {
|
|
131
152
|
team_key: &'a str,
|
|
132
153
|
},
|
|
@@ -171,6 +192,10 @@ pub enum StateWriteIntent<'a> {
|
|
|
171
192
|
team_key: Option<&'a str>,
|
|
172
193
|
agent_id: &'a str,
|
|
173
194
|
},
|
|
195
|
+
ForceRecreateRollback {
|
|
196
|
+
team_key: &'a str,
|
|
197
|
+
agent_id: &'a str,
|
|
198
|
+
},
|
|
174
199
|
ClaimLeader {
|
|
175
200
|
team_key: &'a str,
|
|
176
201
|
},
|
|
@@ -193,7 +218,7 @@ pub enum StateWriteIntent<'a> {
|
|
|
193
218
|
/// so future S1b migration can route it deliberately.
|
|
194
219
|
CoordinatorApiErrorRecovery {
|
|
195
220
|
team_key: Option<&'a str>,
|
|
196
|
-
agent_id:
|
|
221
|
+
agent_id: Option<&'a str>,
|
|
197
222
|
},
|
|
198
223
|
McpAssignTask {
|
|
199
224
|
team_key: Option<&'a str>,
|
|
@@ -227,9 +252,8 @@ pub enum StateWriteIntent<'a> {
|
|
|
227
252
|
SelfMigration,
|
|
228
253
|
}
|
|
229
254
|
|
|
230
|
-
// S1a dispatch: every intent forwards to
|
|
231
|
-
//
|
|
232
|
-
// shifted. When S1b migrates a writer cluster, only the arms below change;
|
|
255
|
+
// S1a dispatch: every intent forwards to the same pre-S1a helper family; only naming shifted.
|
|
256
|
+
// When S1b migrates a writer cluster, only the arms below change;
|
|
233
257
|
// the callsites and tests keep talking to `StateRepository`.
|
|
234
258
|
fn route_direct(
|
|
235
259
|
workspace: &Path,
|
|
@@ -240,6 +264,14 @@ fn route_direct(
|
|
|
240
264
|
// LaunchTeam -> the launch writer path uses the root helper today
|
|
241
265
|
// (`save_runtime_state` at lifecycle/launch.rs:996).
|
|
242
266
|
StateWriteIntent::LaunchTeam { .. } => helper_write_root(workspace, state),
|
|
267
|
+
StateWriteIntent::AddAgent { team_key, agent_id } => {
|
|
268
|
+
helper_write_team_scoped_with_lifecycle_topology_authority(
|
|
269
|
+
workspace,
|
|
270
|
+
state,
|
|
271
|
+
team_key,
|
|
272
|
+
&[agent_id],
|
|
273
|
+
)
|
|
274
|
+
}
|
|
243
275
|
// AnnotateTeamDepth also lives on the root save path.
|
|
244
276
|
StateWriteIntent::AnnotateTeamDepth { .. } => helper_write_root(workspace, state),
|
|
245
277
|
// ShutdownTeam: scoped clean shutdown uses `save_team_scoped_state`;
|
|
@@ -259,12 +291,13 @@ fn route_direct(
|
|
|
259
291
|
// `save_team_scoped_state_with_lifecycle_topology_authority_and_capture_backfill_skip`
|
|
260
292
|
// at lifecycle/restart/common.rs:633.
|
|
261
293
|
StateWriteIntent::RestartTeam {
|
|
294
|
+
team_key,
|
|
262
295
|
topology_authority_agent_ids,
|
|
263
296
|
skip_capture_backfill_agent_ids,
|
|
264
|
-
..
|
|
265
297
|
} => helper_write_team_scoped_with_lifecycle_topology_authority_and_capture_backfill_skip(
|
|
266
298
|
workspace,
|
|
267
299
|
state,
|
|
300
|
+
team_key,
|
|
268
301
|
skip_capture_backfill_agent_ids,
|
|
269
302
|
topology_authority_agent_ids,
|
|
270
303
|
),
|
|
@@ -274,16 +307,17 @@ fn route_direct(
|
|
|
274
307
|
StateWriteIntent::RestartSessionRepair { .. } => helper_write_team_scoped(workspace, state),
|
|
275
308
|
// StartAgent - the launch add-agent tail lands via
|
|
276
309
|
// `save_team_scoped_state_with_lifecycle_topology_authority` today.
|
|
277
|
-
StateWriteIntent::StartAgent { .. } => {
|
|
278
|
-
helper_write_team_scoped_with_lifecycle_topology_authority(workspace, state, &[])
|
|
310
|
+
StateWriteIntent::StartAgent { team_key, .. } => {
|
|
311
|
+
helper_write_team_scoped_with_lifecycle_topology_authority(workspace, state, team_key, &[])
|
|
279
312
|
}
|
|
280
313
|
// StopAgent uses the legacy helper family
|
|
281
314
|
// `save_team_scoped_state_with_lifecycle_topology_authority`,
|
|
282
315
|
// matching lifecycle/restart/agent.rs:911.
|
|
283
|
-
StateWriteIntent::StopAgent {
|
|
316
|
+
StateWriteIntent::StopAgent { team_key, agent_id } => {
|
|
284
317
|
helper_write_team_scoped_with_lifecycle_topology_authority(
|
|
285
318
|
workspace,
|
|
286
319
|
state,
|
|
320
|
+
team_key,
|
|
287
321
|
&[agent_id],
|
|
288
322
|
)
|
|
289
323
|
}
|
|
@@ -292,20 +326,22 @@ fn route_direct(
|
|
|
292
326
|
// matching lifecycle/restart/agent.rs:1355. Non-discard falls back to
|
|
293
327
|
// the same lifecycle topology-authority helper as StopAgent.
|
|
294
328
|
StateWriteIntent::ResetAgent {
|
|
329
|
+
team_key,
|
|
295
330
|
agent_id,
|
|
296
331
|
discard_session,
|
|
297
|
-
..
|
|
298
332
|
} => {
|
|
299
333
|
if discard_session {
|
|
300
334
|
helper_write_team_scoped_with_tombstone_lifecycle_topology_authority(
|
|
301
335
|
workspace,
|
|
302
336
|
state,
|
|
337
|
+
team_key,
|
|
303
338
|
&[agent_id],
|
|
304
339
|
)
|
|
305
340
|
} else {
|
|
306
341
|
helper_write_team_scoped_with_lifecycle_topology_authority(
|
|
307
342
|
workspace,
|
|
308
343
|
state,
|
|
344
|
+
team_key,
|
|
309
345
|
&[agent_id],
|
|
310
346
|
)
|
|
311
347
|
}
|
|
@@ -317,10 +353,11 @@ fn route_direct(
|
|
|
317
353
|
}
|
|
318
354
|
// ForkAgent mutates a selected team projection, so persist it back to
|
|
319
355
|
// that projection with the forked row as lifecycle topology authority.
|
|
320
|
-
StateWriteIntent::ForkAgent {
|
|
356
|
+
StateWriteIntent::ForkAgent { team_key, agent_id } => {
|
|
321
357
|
helper_write_team_scoped_with_lifecycle_topology_authority(
|
|
322
358
|
workspace,
|
|
323
359
|
state,
|
|
360
|
+
team_key,
|
|
324
361
|
&[agent_id],
|
|
325
362
|
)
|
|
326
363
|
}
|
|
@@ -331,16 +368,31 @@ fn route_direct(
|
|
|
331
368
|
Some(_) => helper_write_team_scoped_with_deleted_agents(workspace, state, &[agent_id]),
|
|
332
369
|
None => helper_write_root_with_deleted_agents(workspace, state, &[agent_id]),
|
|
333
370
|
},
|
|
371
|
+
// Force-recreate rollback restores an existing row after the
|
|
372
|
+
// replacement spawn has advanced its lifecycle tuple. The selected
|
|
373
|
+
// row is therefore the explicit topology authority.
|
|
374
|
+
StateWriteIntent::ForceRecreateRollback { team_key, agent_id } => {
|
|
375
|
+
helper_write_team_scoped_with_lifecycle_topology_authority(
|
|
376
|
+
workspace,
|
|
377
|
+
state,
|
|
378
|
+
team_key,
|
|
379
|
+
&[agent_id],
|
|
380
|
+
)
|
|
381
|
+
}
|
|
334
382
|
// ClaimLeader -> leader/lease.rs:1625 uses the root helper, and the
|
|
335
383
|
// scoped preserve-claim-fields variant at :1702 uses the team-tombstoned
|
|
336
384
|
// agents helper.
|
|
337
|
-
StateWriteIntent::ClaimLeader {
|
|
385
|
+
StateWriteIntent::ClaimLeader { team_key } => {
|
|
386
|
+
helper_write_root_with_receiver_authority(workspace, state, team_key)
|
|
387
|
+
}
|
|
338
388
|
StateWriteIntent::LeaderBindingRestoreNonTargetTeams { .. } => {
|
|
339
389
|
helper_write_root_without_migrations(workspace, state)
|
|
340
390
|
}
|
|
341
391
|
// LeaderStartBinding -> managed/exec/external all root-save at
|
|
342
392
|
// leader/start.rs:795/903/946.
|
|
343
|
-
StateWriteIntent::LeaderStartBinding { .. } =>
|
|
393
|
+
StateWriteIntent::LeaderStartBinding { team_key, .. } => {
|
|
394
|
+
helper_write_root_with_receiver_authority(workspace, state, team_key)
|
|
395
|
+
}
|
|
344
396
|
// CoordinatorTick dispatches to the existing scoped helper
|
|
345
397
|
// (`save_team_scoped_state`) preserving coordinator/tick.rs:427.
|
|
346
398
|
StateWriteIntent::CoordinatorTick { .. } => helper_write_team_scoped(workspace, state),
|
|
@@ -396,16 +448,14 @@ fn route_direct(
|
|
|
396
448
|
// Route intents that historically used the `_reapplying_after_conflict`
|
|
397
449
|
// helper family. Behavior stays identical: S1a chooses the same helper the
|
|
398
450
|
// legacy caller would have chosen for a reapply.
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
{
|
|
408
|
-
let use_team_scoped = matches!(
|
|
451
|
+
#[derive(Clone, Copy, Eq, PartialEq)]
|
|
452
|
+
enum ReapplyScope {
|
|
453
|
+
Root,
|
|
454
|
+
Team,
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
fn reapply_scope(intent: &StateWriteIntent<'_>) -> ReapplyScope {
|
|
458
|
+
if matches!(
|
|
409
459
|
intent,
|
|
410
460
|
StateWriteIntent::RestartSessionRepair { .. }
|
|
411
461
|
| StateWriteIntent::MessagingDeliveryState {
|
|
@@ -415,14 +465,31 @@ where
|
|
|
415
465
|
owner_team_id: Some(_),
|
|
416
466
|
}
|
|
417
467
|
| StateWriteIntent::CoordinatorTick { .. }
|
|
418
|
-
| StateWriteIntent::
|
|
468
|
+
| StateWriteIntent::McpUpdateStateNote {
|
|
419
469
|
team_key: Some(_),
|
|
420
|
-
..
|
|
421
470
|
}
|
|
422
|
-
)
|
|
423
|
-
|
|
471
|
+
) {
|
|
472
|
+
ReapplyScope::Team
|
|
473
|
+
} else {
|
|
474
|
+
ReapplyScope::Root
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
fn route_reapply<F>(
|
|
479
|
+
workspace: &Path,
|
|
480
|
+
intent: StateWriteIntent<'_>,
|
|
481
|
+
state: &Value,
|
|
482
|
+
reapply: F,
|
|
483
|
+
) -> Result<(), StateError>
|
|
484
|
+
where
|
|
485
|
+
F: FnOnce(&mut Value),
|
|
486
|
+
{
|
|
487
|
+
if reapply_scope(&intent) == ReapplyScope::Team {
|
|
424
488
|
helper_write_team_scoped_reapply(workspace, state, reapply)
|
|
425
489
|
} else {
|
|
426
490
|
helper_write_root_reapply(workspace, state, reapply)
|
|
427
491
|
}
|
|
428
492
|
}
|
|
493
|
+
|
|
494
|
+
#[cfg(test)]
|
|
495
|
+
mod tests;
|
|
@@ -5,8 +5,8 @@ use std::path::{Path, PathBuf};
|
|
|
5
5
|
use serde_json::Value;
|
|
6
6
|
|
|
7
7
|
use crate::model::paths::{canonical_run_workspace, runtime_spec_path, team_workspace};
|
|
8
|
-
use crate::state::persist::
|
|
9
|
-
use crate::state::projection::
|
|
8
|
+
use crate::state::persist::runtime_state_path;
|
|
9
|
+
use crate::state::projection::resolve_runtime_team_scope;
|
|
10
10
|
use crate::state::StateError;
|
|
11
11
|
|
|
12
12
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
|
@@ -36,15 +36,15 @@ pub fn resolve_active_team(
|
|
|
36
36
|
mode: SelectorMode,
|
|
37
37
|
) -> Result<SelectedTeam, StateError> {
|
|
38
38
|
let explicit_spec = input.join("team.spec.yaml");
|
|
39
|
-
let (run_workspace,
|
|
39
|
+
let (run_workspace, resolved) = if explicit_spec.exists() {
|
|
40
40
|
let team_run = team_workspace(input).map_err(|e| StateError::TeamSelect(e.to_string()))?;
|
|
41
41
|
let run = if runtime_state_path(input).exists() || !runtime_state_path(&team_run).exists() {
|
|
42
42
|
input.to_path_buf()
|
|
43
43
|
} else {
|
|
44
44
|
team_run
|
|
45
45
|
};
|
|
46
|
-
let
|
|
47
|
-
(run,
|
|
46
|
+
let resolved = resolve_runtime_team_scope(&run, team)?;
|
|
47
|
+
(run, resolved)
|
|
48
48
|
} else {
|
|
49
49
|
let run =
|
|
50
50
|
canonical_run_workspace(input).map_err(|e| StateError::TeamSelect(e.to_string()))?;
|
|
@@ -58,15 +58,16 @@ pub fn resolve_active_team(
|
|
|
58
58
|
input.display()
|
|
59
59
|
)));
|
|
60
60
|
}
|
|
61
|
-
let
|
|
62
|
-
(run,
|
|
61
|
+
let resolved = resolve_runtime_team_scope(&run, team)?;
|
|
62
|
+
(run, resolved)
|
|
63
63
|
};
|
|
64
|
+
let state = resolved.state;
|
|
64
65
|
|
|
65
66
|
// E5 spec 迁移·读序 B(architect+leader 裁定):
|
|
66
67
|
// 1) runtime spec 优先严格:<run_ws>/.team/runtime/<team_key>/team.spec.yaml 存在即必用。
|
|
67
68
|
// 2) 缺失才**只读回落**用户目录旧 spec(过渡腿;绝不在此写/迁移——迁移+清理只属启动重建)。
|
|
68
69
|
// TODO(E5 后续版本):新 team 永不写用户目录(G1),回落腿可在 legacy 清零后移除。
|
|
69
|
-
let team_key =
|
|
70
|
+
let team_key = resolved.canonical_team_key;
|
|
70
71
|
let runtime_spec = runtime_spec_path(&run_workspace, &team_key);
|
|
71
72
|
let (spec_workspace, spec_path) = if runtime_spec.exists() {
|
|
72
73
|
(
|
|
@@ -136,13 +137,3 @@ fn spec_workspace_from_state(state: &Value) -> Option<PathBuf> {
|
|
|
136
137
|
.map(PathBuf::from)
|
|
137
138
|
})
|
|
138
139
|
}
|
|
139
|
-
|
|
140
|
-
fn selected_team_key(state: &Value, team: Option<&str>) -> String {
|
|
141
|
-
state
|
|
142
|
-
.get("active_team_key")
|
|
143
|
-
.and_then(Value::as_str)
|
|
144
|
-
.filter(|s| !s.is_empty())
|
|
145
|
-
.map(ToString::to_string)
|
|
146
|
-
.or_else(|| team.filter(|s| !s.is_empty()).map(ToString::to_string))
|
|
147
|
-
.unwrap_or_else(|| team_state_key(state))
|
|
148
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@team-agent/installer",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.52",
|
|
4
4
|
"description": "npx installer for Team Agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"codex",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"team-agent-installer": "npm/install.mjs"
|
|
21
21
|
},
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@team-agent/cli-darwin-arm64": "0.5.
|
|
24
|
-
"@team-agent/cli-darwin-x64": "0.5.
|
|
25
|
-
"@team-agent/cli-linux-x64": "0.5.
|
|
23
|
+
"@team-agent/cli-darwin-arm64": "0.5.52",
|
|
24
|
+
"@team-agent/cli-darwin-x64": "0.5.52",
|
|
25
|
+
"@team-agent/cli-linux-x64": "0.5.52"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
28
|
"postinstall": "node npm/bincheck.mjs",
|