Delete obsolete pipeline smokes
This commit is contained in:
parent
4aebe17a24
commit
64f50de596
9 changed files with 0 additions and 10759 deletions
|
|
@ -1,278 +0,0 @@
|
|||
#[cfg(not(windows))]
|
||||
fn main() -> anyhow::Result<()> {
|
||||
anyhow::bail!("the live action smoke uses Starfire's DPAPI credential")
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
use chrono::Utc;
|
||||
use ghostlight_dungeon::{
|
||||
assessor::ActionAssessor,
|
||||
domain::{ActionIntent, Campaign, WorldCommand},
|
||||
kernel::{CommandResult, KernelError, WorldKernel},
|
||||
model::{DeepSeekPort, ModelPort},
|
||||
persistence::CampaignStore,
|
||||
};
|
||||
use std::{path::PathBuf, sync::Arc, time::Instant};
|
||||
|
||||
let secret = std::env::var_os("GHOSTLIGHT_DEEPSEEK_BLOB")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| PathBuf::from(r"F:\GameCult\GhostlightDungeon\secrets\deepseek.dpapi"));
|
||||
let scenario_id =
|
||||
std::env::var("GHOSTLIGHT_LIVE_FIRE_SCENARIO").unwrap_or_else(|_| "action-default".into());
|
||||
let root = std::env::var_os("GHOSTLIGHT_LIVE_FIRE_RESULT_ROOT")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| {
|
||||
PathBuf::from(r"F:\GameCult\GhostlightDungeon\acceptance").join(format!(
|
||||
"action-{}-{}",
|
||||
Utc::now().format("%Y%m%d-%H%M%S"),
|
||||
uuid::Uuid::new_v4()
|
||||
))
|
||||
});
|
||||
std::fs::create_dir_all(&root)?;
|
||||
let campaign = action_campaign();
|
||||
let store = CampaignStore::open(root.join("campaign.cc"))?;
|
||||
store.create_unadmitted_fixture_campaign(&campaign, &[], &[])?;
|
||||
let model: Arc<dyn ModelPort> = Arc::new(DeepSeekPort::from_runtime_secret(secret)?);
|
||||
let assessor = ActionAssessor::new(model.clone(), "deepseek-v4-pro");
|
||||
let kernel = WorldKernel::start(store.clone());
|
||||
let started = Instant::now();
|
||||
|
||||
let impossible_intent = ActionIntent {
|
||||
actor_id: "player".into(),
|
||||
description: std::env::var("GHOSTLIGHT_IMPOSSIBLE_DESCRIPTION").unwrap_or_else(|_| {
|
||||
"I teleport the entire station into the sun by force of will.".into()
|
||||
}),
|
||||
intended_effect: std::env::var("GHOSTLIGHT_IMPOSSIBLE_EFFECT")
|
||||
.unwrap_or_else(|_| "destroy the station instantly".into()),
|
||||
};
|
||||
let (impossible, impossible_receipt) = assessor
|
||||
.assess(&campaign, impossible_intent.clone())
|
||||
.await?;
|
||||
if impossible.admissible || impossible.missing_permission.is_none() {
|
||||
anyhow::bail!("impossible action was offered a roll")
|
||||
}
|
||||
let CommandResult::Assessed {
|
||||
assessment: admitted_impossible,
|
||||
} = kernel
|
||||
.command(WorldCommand::Assess {
|
||||
expected_revision: 0,
|
||||
intent: impossible_intent,
|
||||
proposal: Some(impossible.clone()),
|
||||
})
|
||||
.await?
|
||||
else {
|
||||
anyhow::bail!("kernel did not return the impossible assessment")
|
||||
};
|
||||
let impossible_error = kernel
|
||||
.command(WorldCommand::Attempt {
|
||||
actor_id: "player".into(),
|
||||
assessment_digest: admitted_impossible.digest,
|
||||
})
|
||||
.await
|
||||
.expect_err("impossible attempt must not roll");
|
||||
if !matches!(impossible_error, KernelError::Impossible(_)) {
|
||||
anyhow::bail!("impossible attempt failed for the wrong reason: {impossible_error}")
|
||||
}
|
||||
let after_impossible = store
|
||||
.load::<Campaign>("campaign.v1", &campaign.id.to_string())?
|
||||
.map(|(_, value)| value)
|
||||
.ok_or_else(|| anyhow::anyhow!("campaign disappeared"))?;
|
||||
if after_impossible.revision != 0 {
|
||||
anyhow::bail!("impossible attempt mutated the campaign")
|
||||
}
|
||||
|
||||
let feasible_intent = ActionIntent {
|
||||
actor_id: "player".into(),
|
||||
description: std::env::var("GHOSTLIGHT_FEASIBLE_DESCRIPTION").unwrap_or_else(|_| {
|
||||
"I connect my multimeter to the accessible coolant panel and inspect its readings."
|
||||
.into()
|
||||
}),
|
||||
intended_effect: std::env::var("GHOSTLIGHT_FEASIBLE_EFFECT").unwrap_or_else(|_| {
|
||||
"identify whether the coolant fault is electrical without changing the machinery".into()
|
||||
}),
|
||||
};
|
||||
let (feasible, feasible_receipt) = assessor
|
||||
.assess(&after_impossible, feasible_intent.clone())
|
||||
.await?;
|
||||
if !feasible.admissible {
|
||||
anyhow::bail!(
|
||||
"grounded maintenance attempt was rejected: {:?}",
|
||||
feasible.missing_permission
|
||||
)
|
||||
}
|
||||
let CommandResult::Assessed {
|
||||
assessment: admitted_feasible,
|
||||
} = kernel
|
||||
.command(WorldCommand::Assess {
|
||||
expected_revision: 0,
|
||||
intent: feasible_intent,
|
||||
proposal: Some(feasible.clone()),
|
||||
})
|
||||
.await?
|
||||
else {
|
||||
anyhow::bail!("kernel did not return the feasible assessment")
|
||||
};
|
||||
let attempt = kernel
|
||||
.command(WorldCommand::Attempt {
|
||||
actor_id: "player".into(),
|
||||
assessment_digest: admitted_feasible.digest,
|
||||
})
|
||||
.await?;
|
||||
let post = store
|
||||
.load::<Campaign>("campaign.v1", &campaign.id.to_string())?
|
||||
.map(|(_, value)| value)
|
||||
.ok_or_else(|| anyhow::anyhow!("campaign disappeared after attempt"))?;
|
||||
if post.revision != 1 {
|
||||
anyhow::bail!("confirmed attempt did not commit exactly one revision")
|
||||
}
|
||||
|
||||
for receipt in [&impossible_receipt, &feasible_receipt] {
|
||||
store.insert(
|
||||
"persona_stage_receipt.v1",
|
||||
"ghostlight.persona_stage_receipt.v1",
|
||||
receipt.storage_key(),
|
||||
receipt,
|
||||
)?;
|
||||
}
|
||||
let model_stage_receipts = vec![impossible_receipt, feasible_receipt];
|
||||
|
||||
let result = serde_json::json!({
|
||||
"schema":"ghostlight.action_smoke.v1",
|
||||
"scenario_id":scenario_id,
|
||||
"elapsed_seconds":started.elapsed().as_secs_f64(),
|
||||
"impossible_assessment":impossible,
|
||||
"impossible_attempt_error":impossible_error.to_string(),
|
||||
"feasible_assessment":feasible,
|
||||
"attempt":attempt,
|
||||
"model_stage_receipts":model_stage_receipts,
|
||||
"campaign_revision":post.revision,
|
||||
"store":root.join("campaign.cc"),
|
||||
"result_path":root.join("result.json")
|
||||
});
|
||||
std::fs::write(
|
||||
root.join("result.json"),
|
||||
serde_json::to_vec_pretty(&result)?,
|
||||
)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn action_campaign() -> ghostlight_dungeon::domain::Campaign {
|
||||
use chrono::Utc;
|
||||
use ghostlight_dungeon::domain::{
|
||||
ActorState, BranchOrigin, Campaign, InstitutionState, Location, WorldClock, WorldEventScope,
|
||||
};
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
let id = uuid::Uuid::new_v4();
|
||||
let now = Utc::now();
|
||||
let player = ActorState {
|
||||
id: "player".into(),
|
||||
name: "Dana Voss".into(),
|
||||
location_id: "maintenance-bay".into(),
|
||||
capabilities: BTreeSet::from([
|
||||
"basic electrical diagnosis".into(),
|
||||
"safe multimeter use".into(),
|
||||
]),
|
||||
knowledge: BTreeSet::from([
|
||||
"the coolant alarm began this shift".into(),
|
||||
"the accessible panel exposes diagnostic test points".into(),
|
||||
]),
|
||||
equipment: BTreeSet::from(["calibrated multimeter".into()]),
|
||||
conditions: BTreeSet::from(["tired".into()]),
|
||||
obligations: BTreeSet::from(["report hazards to the shift foreman".into()]),
|
||||
relationships: BTreeMap::new(),
|
||||
goals: vec!["prevent a coolant failure without damaging the system".into()],
|
||||
memories: vec![],
|
||||
};
|
||||
let foreman = ActorState {
|
||||
id: "foreman".into(),
|
||||
name: "Ilyan Kesh".into(),
|
||||
location_id: "maintenance-bay".into(),
|
||||
capabilities: BTreeSet::from(["authorize invasive maintenance".into()]),
|
||||
knowledge: BTreeSet::from(["the work-order backlog".into()]),
|
||||
equipment: BTreeSet::new(),
|
||||
conditions: BTreeSet::new(),
|
||||
obligations: BTreeSet::from(["keep the shift on schedule".into()]),
|
||||
relationships: BTreeMap::new(),
|
||||
goals: vec!["avoid an unscheduled shutdown".into()],
|
||||
memories: vec![],
|
||||
};
|
||||
Campaign {
|
||||
schema: "ghostlight.campaign.v1".into(),
|
||||
id,
|
||||
name: "Action resolution acceptance".into(),
|
||||
revision: 0,
|
||||
branch_origin: BranchOrigin {
|
||||
canon_cutoff: "acceptance-fixture".into(),
|
||||
evidence_receipt_ids: vec![],
|
||||
},
|
||||
world_time: now,
|
||||
tick_hours: 6,
|
||||
player_actor_id: "player".into(),
|
||||
locations: BTreeMap::from([(
|
||||
"maintenance-bay".into(),
|
||||
Location {
|
||||
id: "maintenance-bay".into(),
|
||||
name: "Coolant Maintenance Bay".into(),
|
||||
container_id: None,
|
||||
routes: BTreeMap::new(),
|
||||
persistent_features: vec![
|
||||
"an accessible coolant diagnostic panel".into(),
|
||||
"a sealed valve housing requiring foreman authorization".into(),
|
||||
],
|
||||
},
|
||||
)]),
|
||||
actors: BTreeMap::from([("player".into(), player), ("foreman".into(), foreman)]),
|
||||
institutions: BTreeMap::from([(
|
||||
"station-operations".into(),
|
||||
InstitutionState {
|
||||
id: "station-operations".into(),
|
||||
name: "Station Operations".into(),
|
||||
resources: vec!["maintenance authority".into()],
|
||||
goals: vec!["avoid shutdown".into()],
|
||||
posture: "dismissive of unscheduled work".into(),
|
||||
},
|
||||
)]),
|
||||
clocks: BTreeMap::from([(
|
||||
"coolant-failure".into(),
|
||||
WorldClock {
|
||||
id: "coolant-failure".into(),
|
||||
label: "Coolant failure".into(),
|
||||
progress: 2,
|
||||
threshold: 5,
|
||||
consequence: "the coolant loop trips offline".into(),
|
||||
consequence_scope: WorldEventScope {
|
||||
actor_ids: vec!["foreman".into()],
|
||||
institution_ids: vec!["station-operations".into()],
|
||||
gestalt_ids: Vec::new(),
|
||||
location_ids: vec!["maintenance-bay".into()],
|
||||
public_channels: Vec::new(),
|
||||
},
|
||||
},
|
||||
)]),
|
||||
facts: BTreeMap::new(),
|
||||
civic_systems: BTreeMap::new(),
|
||||
transcript: vec![],
|
||||
last_player_activity: now,
|
||||
pending_ticks: 0,
|
||||
away_ticks_processed: 0,
|
||||
events: vec![],
|
||||
news: vec![],
|
||||
canon_candidates: BTreeMap::new(),
|
||||
gestalts: BTreeMap::new(),
|
||||
gestalt_members: BTreeMap::new(),
|
||||
pending_world_proposals: vec![],
|
||||
agency_profiles: BTreeMap::new(),
|
||||
agency_relations: BTreeMap::new(),
|
||||
gestalt_lineages: BTreeMap::new(),
|
||||
resolution_policy: Default::default(),
|
||||
resolution_pins: BTreeMap::new(),
|
||||
resolution_cover: None,
|
||||
nemesis_attention_history: Vec::new(),
|
||||
strategic_tick_count: 0,
|
||||
}
|
||||
}
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
#[cfg(not(windows))]
|
||||
fn main() -> anyhow::Result<()> {
|
||||
anyhow::bail!("the live compiler smoke uses Starfire's DPAPI credential")
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
use chrono::Utc;
|
||||
use ghostlight_dungeon::{
|
||||
compiler::{CustomStart, WorldCompiler},
|
||||
model::{DeepSeekPort, ModelPort},
|
||||
vault::VoidBotMcpVault,
|
||||
};
|
||||
use std::{path::PathBuf, sync::Arc, time::Instant};
|
||||
|
||||
let secret = std::env::var_os("GHOSTLIGHT_DEEPSEEK_BLOB")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| PathBuf::from(r"F:\GameCult\GhostlightDungeon\secrets\deepseek.dpapi"));
|
||||
let model: Arc<dyn ModelPort> = Arc::new(DeepSeekPort::from_runtime_secret(secret)?);
|
||||
let compiler = WorldCompiler::new(
|
||||
Arc::new(VoidBotMcpVault::starfire_loopback()),
|
||||
model,
|
||||
"deepseek-v4-flash",
|
||||
"deepseek-v4-pro",
|
||||
);
|
||||
let scenario_id = std::env::var("GHOSTLIGHT_LIVE_FIRE_SCENARIO")
|
||||
.unwrap_or_else(|_| "compiler-default".into());
|
||||
let request = CustomStart {
|
||||
campaign_name: std::env::var("GHOSTLIGHT_SMOKE_CAMPAIGN_NAME")
|
||||
.unwrap_or_else(|_| "Compiler acceptance smoke".into()),
|
||||
who: std::env::var("GHOSTLIGHT_SMOKE_WHO").unwrap_or_else(|_| {
|
||||
"A low-status maintenance worker with local access but no institutional authority"
|
||||
.into()
|
||||
}),
|
||||
where_: std::env::var("GHOSTLIGHT_SMOKE_WHERE").unwrap_or_else(|_| {
|
||||
"an obscure inhabited Aetheria location supported by the retrieved sources".into()
|
||||
}),
|
||||
when: std::env::var("GHOSTLIGHT_SMOKE_WHEN")
|
||||
.unwrap_or_else(|_| "a source-supported pre-Elysium period".into()),
|
||||
goal: std::env::var("GHOSTLIGHT_SMOKE_GOAL").unwrap_or_else(|_| {
|
||||
"prevent an approaching institutional failure without inventing expertise or geography"
|
||||
.into()
|
||||
}),
|
||||
};
|
||||
let root = std::env::var_os("GHOSTLIGHT_LIVE_FIRE_RESULT_ROOT")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| {
|
||||
PathBuf::from(r"F:\GameCult\GhostlightDungeon\acceptance").join(format!(
|
||||
"compiler-{}-{}",
|
||||
Utc::now().format("%Y%m%d-%H%M%S"),
|
||||
uuid::Uuid::new_v4()
|
||||
))
|
||||
});
|
||||
std::fs::create_dir_all(&root)?;
|
||||
let started = Instant::now();
|
||||
let (preview, model_receipts) = compiler.compile_custom(request.clone()).await?;
|
||||
let result = serde_json::json!({
|
||||
"schema":"ghostlight.world_compile_smoke.v1",
|
||||
"scenario_id":scenario_id,
|
||||
"request":request,
|
||||
"elapsed_seconds":started.elapsed().as_secs_f64(),
|
||||
"title":preview.title,
|
||||
"location_count":preview.campaign.locations.len(),
|
||||
"actor_count":preview.campaign.actors.len(),
|
||||
"institution_count":preview.campaign.institutions.len(),
|
||||
"clock_count":preview.campaign.clocks.len(),
|
||||
"evidence_receipt_count":preview.evidence_receipts.len(),
|
||||
"evidence_witness_count":preview.evidence_receipts.iter().map(|r|r.witnesses.len()).sum::<usize>(),
|
||||
"gaps":preview.gaps,
|
||||
"branch_assumptions":preview.branch_assumptions,
|
||||
"requires_approval":preview.requires_approval,
|
||||
"campaign_revision":preview.campaign.revision,
|
||||
"preview":preview,
|
||||
"model_receipts":model_receipts,
|
||||
"result_path":root.join("result.json")
|
||||
});
|
||||
std::fs::write(
|
||||
root.join("result.json"),
|
||||
serde_json::to_vec_pretty(&result)?,
|
||||
)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
Ok(())
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,351 +0,0 @@
|
|||
#[cfg(not(windows))]
|
||||
fn main() -> anyhow::Result<()> {
|
||||
anyhow::bail!("the live gestalt scale smoke uses Starfire's DPAPI credential")
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
use chrono::Utc;
|
||||
use ghostlight_dungeon::{
|
||||
domain::{SimulationCellMode, TickSource, WorldCommand},
|
||||
kernel::{CommandResult, WorldKernel},
|
||||
model::{DeepSeekPort, ModelPort},
|
||||
persistence::CampaignStore,
|
||||
resolution::validate_and_resolve_wave,
|
||||
scheduler::propose_resolution_wave,
|
||||
turn::SnapshotPermit,
|
||||
};
|
||||
use std::{collections::BTreeSet, path::PathBuf, sync::Arc, time::Instant};
|
||||
|
||||
let secret = std::env::var_os("GHOSTLIGHT_DEEPSEEK_BLOB")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| PathBuf::from(r"F:\GameCult\GhostlightDungeon\secrets\deepseek.dpapi"));
|
||||
let scenario_id = std::env::var("GHOSTLIGHT_LIVE_FIRE_SCENARIO")
|
||||
.unwrap_or_else(|_| "gestalt-scale-default".into());
|
||||
let budget = std::env::var("GHOSTLIGHT_SCALE_BUDGET")
|
||||
.ok()
|
||||
.and_then(|value| value.parse::<u8>().ok())
|
||||
.filter(|value| (1..=32).contains(value))
|
||||
.unwrap_or(4);
|
||||
let provider_parallelism = std::env::var("GHOSTLIGHT_SCALE_PROVIDER_PARALLELISM")
|
||||
.ok()
|
||||
.and_then(|value| value.parse::<u8>().ok())
|
||||
.filter(|value| (1..=32).contains(value))
|
||||
.unwrap_or(8);
|
||||
let pressure = std::env::var("GHOSTLIGHT_SCALE_PRESSURE").unwrap_or_else(|_| {
|
||||
"The public bulletin announces that the final vote occurs in six hours; each faction has one last chance to publish a binding commitment.".into()
|
||||
});
|
||||
let root = std::env::var_os("GHOSTLIGHT_LIVE_FIRE_RESULT_ROOT")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| {
|
||||
PathBuf::from(r"F:\GameCult\GhostlightDungeon\acceptance").join(format!(
|
||||
"gestalt-scale-{}-{}",
|
||||
Utc::now().format("%Y%m%d-%H%M%S"),
|
||||
uuid::Uuid::new_v4()
|
||||
))
|
||||
});
|
||||
std::fs::create_dir_all(&root)?;
|
||||
let campaign = scale_campaign(budget, provider_parallelism, &pressure);
|
||||
let player_location = campaign.actors[&campaign.player_actor_id]
|
||||
.location_id
|
||||
.clone();
|
||||
let store = CampaignStore::open(root.join("campaign.cc"))?;
|
||||
store.create_unadmitted_fixture_campaign(&campaign, &[], &[])?;
|
||||
let model: Arc<dyn ModelPort> = Arc::new(DeepSeekPort::from_runtime_secret(secret)?);
|
||||
let started = Instant::now();
|
||||
let output = propose_resolution_wave(
|
||||
model,
|
||||
Arc::new(SnapshotPermit::new_resolution(
|
||||
store.clone(),
|
||||
campaign.id,
|
||||
campaign.revision,
|
||||
campaign.resolution_policy.resolution_epoch,
|
||||
)),
|
||||
&campaign,
|
||||
)
|
||||
.await?;
|
||||
|
||||
let preflight = serde_json::json!({
|
||||
"schema":"ghostlight.gestalt_scale_preflight.v1",
|
||||
"campaign_id":campaign.id,
|
||||
"elapsed_seconds":started.elapsed().as_secs_f64(),
|
||||
"cover":&output.wave.cover,
|
||||
"appraisals":&output.wave.appraisals,
|
||||
"model_stage_receipts":output.stages.iter().map(|stage|&stage.receipt).collect::<Vec<_>>()
|
||||
});
|
||||
std::fs::write(
|
||||
root.join("preflight.json"),
|
||||
serde_json::to_vec_pretty(&preflight)?,
|
||||
)?;
|
||||
|
||||
let cover = &output.wave.cover;
|
||||
let expected_cells = usize::min(budget as usize, 24);
|
||||
let expected_effective_budget = u8::try_from(expected_cells).expect("fixture size fits u8");
|
||||
if cover.cells.len() != expected_cells || cover.effective_budget != expected_effective_budget {
|
||||
anyhow::bail!(
|
||||
"budget-{budget} cover produced {} cells at effective budget {}; expected {} cells and effective budget {}",
|
||||
cover.cells.len(),
|
||||
cover.effective_budget,
|
||||
expected_cells,
|
||||
expected_effective_budget,
|
||||
)
|
||||
}
|
||||
let covered = cover
|
||||
.cells
|
||||
.iter()
|
||||
.flat_map(|cell| cell.subject_ids.iter().cloned())
|
||||
.collect::<Vec<_>>();
|
||||
if covered.len() != 24 || covered.iter().collect::<BTreeSet<_>>().len() != 24 {
|
||||
anyhow::bail!("scale cover omitted or duplicated canonical subjects")
|
||||
}
|
||||
let arena_count = cover
|
||||
.cells
|
||||
.iter()
|
||||
.filter(|cell| cell.mode == SimulationCellMode::Arena)
|
||||
.count();
|
||||
if budget < 24 && arena_count == 0 {
|
||||
anyhow::bail!("cross-faction budget pressure produced no arena cells")
|
||||
}
|
||||
let plan = validate_and_resolve_wave(&campaign, &output.wave)?;
|
||||
let explicit_inaction_count = output
|
||||
.wave
|
||||
.appraisals
|
||||
.iter()
|
||||
.filter(|appraisal| {
|
||||
appraisal.actions.is_empty()
|
||||
&& appraisal
|
||||
.inactions
|
||||
.iter()
|
||||
.any(|inaction| !inaction.reason.trim().is_empty())
|
||||
})
|
||||
.count();
|
||||
for stage in &output.stages {
|
||||
store.insert(
|
||||
"persona_stage_receipt.v1",
|
||||
"ghostlight.persona_stage_receipt.v1",
|
||||
stage.receipt.storage_key(),
|
||||
&stage.receipt,
|
||||
)?;
|
||||
}
|
||||
let kernel = WorldKernel::start(store.clone());
|
||||
let committed = kernel
|
||||
.command(WorldCommand::AdvanceStrategicTick {
|
||||
expected_revision: 0,
|
||||
source: TickSource::Scheduler,
|
||||
plan: None,
|
||||
model_receipt_hash: Some(output.aggregate_receipt_hash.clone()),
|
||||
resolution_wave: Some(output.wave.clone()),
|
||||
})
|
||||
.await?;
|
||||
let CommandResult::Committed {
|
||||
campaign: advanced, ..
|
||||
} = &committed
|
||||
else {
|
||||
anyhow::bail!("scale wave did not commit")
|
||||
};
|
||||
if advanced.actors[&advanced.player_actor_id].location_id != player_location {
|
||||
anyhow::bail!("scale wave puppeted the absent player")
|
||||
}
|
||||
let result = serde_json::json!({
|
||||
"schema":"ghostlight.gestalt_scale_smoke.v1",
|
||||
"scenario_id":scenario_id,
|
||||
"pressure":pressure,
|
||||
"campaign_id":campaign.id,
|
||||
"subject_count":24,
|
||||
"configured_budget":budget,
|
||||
"provider_parallelism":provider_parallelism,
|
||||
"cell_count":cover.cells.len(),
|
||||
"arena_count":arena_count,
|
||||
"elapsed_seconds":started.elapsed().as_secs_f64(),
|
||||
"cover":cover,
|
||||
"appraisals":output.wave.appraisals,
|
||||
"plan":plan,
|
||||
"material_action_count":plan.institution_actions.len() + plan.gestalt_actions.len() + plan.gestalt_activities.len() + plan.gestalt_migrations.len() + plan.actor_moves.len() + plan.actor_activities.len() + plan.member_activities.len() + plan.member_migrations.len(),
|
||||
"explicit_inaction_count":explicit_inaction_count,
|
||||
"model_stage_receipts":output.stages.iter().map(|stage|&stage.receipt).collect::<Vec<_>>(),
|
||||
"commit":committed,
|
||||
"player_location_unchanged":true,
|
||||
"news_count":advanced.news.len(),
|
||||
"store":root.join("campaign.cc"),
|
||||
"result_path":root.join("result.json")
|
||||
});
|
||||
std::fs::write(
|
||||
root.join("result.json"),
|
||||
serde_json::to_vec_pretty(&result)?,
|
||||
)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn scale_campaign(
|
||||
budget: u8,
|
||||
provider_parallelism: u8,
|
||||
pressure: &str,
|
||||
) -> ghostlight_dungeon::domain::Campaign {
|
||||
use chrono::{Duration, Utc};
|
||||
use ghostlight_dungeon::domain::*;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
let now = Utc::now();
|
||||
let player = ActorState {
|
||||
id: "player".into(),
|
||||
name: "Observer".into(),
|
||||
location_id: "forum".into(),
|
||||
capabilities: BTreeSet::new(),
|
||||
knowledge: BTreeSet::from(["public bulletin".into()]),
|
||||
equipment: BTreeSet::new(),
|
||||
conditions: BTreeSet::new(),
|
||||
obligations: BTreeSet::new(),
|
||||
relationships: BTreeMap::new(),
|
||||
goals: vec!["observe the election without being puppeted".into()],
|
||||
memories: vec![],
|
||||
};
|
||||
let institutions = (0..24)
|
||||
.map(|index| {
|
||||
let id = format!("faction-{index:02}");
|
||||
(
|
||||
id.clone(),
|
||||
InstitutionState {
|
||||
id,
|
||||
name: format!("Faction {index:02}"),
|
||||
resources: vec![
|
||||
format!("private reserve {index:02}"),
|
||||
format!("regional office {}", index % 4),
|
||||
"public bulletin publishing access".into(),
|
||||
],
|
||||
goals: vec![
|
||||
format!("advance platform {}", index % 6),
|
||||
"publish a concrete commitment before the final vote".into(),
|
||||
],
|
||||
posture: format!(
|
||||
"Bloc {} is withholding a binding commitment pending the final notice.",
|
||||
index % 3
|
||||
),
|
||||
},
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
let mut campaign = Campaign {
|
||||
schema: "ghostlight.campaign.v1".into(),
|
||||
id: uuid::Uuid::new_v4(),
|
||||
name: "Twenty-four faction gestalt acceptance".into(),
|
||||
revision: 0,
|
||||
branch_origin: BranchOrigin {
|
||||
canon_cutoff: "acceptance-fixture".into(),
|
||||
evidence_receipt_ids: vec![],
|
||||
},
|
||||
world_time: now,
|
||||
tick_hours: 6,
|
||||
player_actor_id: "player".into(),
|
||||
locations: BTreeMap::from([(
|
||||
"forum".into(),
|
||||
Location {
|
||||
id: "forum".into(),
|
||||
name: "Federation Forum".into(),
|
||||
container_id: None,
|
||||
routes: BTreeMap::new(),
|
||||
persistent_features: vec!["a public election bulletin".into()],
|
||||
},
|
||||
)]),
|
||||
actors: BTreeMap::from([("player".into(), player)]),
|
||||
institutions,
|
||||
clocks: BTreeMap::from([(
|
||||
"election".into(),
|
||||
WorldClock {
|
||||
id: "election".into(),
|
||||
label: "Federation election".into(),
|
||||
progress: 5,
|
||||
threshold: 6,
|
||||
consequence: "the governing coalition is chosen".into(),
|
||||
consequence_scope: WorldEventScope {
|
||||
actor_ids: Vec::new(),
|
||||
institution_ids: (0..8).map(|index| format!("faction-{index:02}")).collect(),
|
||||
gestalt_ids: Vec::new(),
|
||||
location_ids: vec!["forum".into()],
|
||||
public_channels: vec!["public bulletin".into()],
|
||||
},
|
||||
},
|
||||
)]),
|
||||
facts: BTreeMap::new(),
|
||||
civic_systems: BTreeMap::new(),
|
||||
transcript: vec![],
|
||||
last_player_activity: now - Duration::hours(2),
|
||||
pending_ticks: 1,
|
||||
away_ticks_processed: 0,
|
||||
events: vec![Event {
|
||||
id: "final-vote-notice".into(),
|
||||
at: now,
|
||||
kind: "public_notice".into(),
|
||||
summary: pressure.into(),
|
||||
actor_ids: vec![],
|
||||
institution_ids: (0..24).map(|index| format!("faction-{index:02}")).collect(),
|
||||
gestalt_ids: vec![],
|
||||
location_ids: vec!["forum".into()],
|
||||
public_channels: vec!["public bulletin".into()],
|
||||
}],
|
||||
news: vec![],
|
||||
canon_candidates: BTreeMap::new(),
|
||||
gestalts: BTreeMap::new(),
|
||||
gestalt_members: BTreeMap::new(),
|
||||
pending_world_proposals: vec![],
|
||||
agency_profiles: BTreeMap::new(),
|
||||
agency_relations: BTreeMap::new(),
|
||||
gestalt_lineages: BTreeMap::new(),
|
||||
resolution_policy: ResolutionPolicy {
|
||||
active_cell_budget: budget,
|
||||
provider_parallelism,
|
||||
..ResolutionPolicy::default()
|
||||
},
|
||||
resolution_pins: BTreeMap::new(),
|
||||
resolution_cover: None,
|
||||
nemesis_attention_history: Vec::new(),
|
||||
strategic_tick_count: 0,
|
||||
};
|
||||
ghostlight_dungeon::resolution::ensure_agency_profiles(&mut campaign);
|
||||
for (index, id) in (0..24).map(|index| (index, format!("faction-{index:02}"))) {
|
||||
let profile = campaign
|
||||
.agency_profiles
|
||||
.get_mut(&id)
|
||||
.expect("institution profile");
|
||||
profile.location_ids.insert("forum".into());
|
||||
profile
|
||||
.information_channels
|
||||
.insert("public bulletin".into());
|
||||
profile.facets.insert(
|
||||
AgencyAxis::Geography,
|
||||
BTreeSet::from([format!("region-{}", index % 4)]),
|
||||
);
|
||||
profile.facets.insert(
|
||||
AgencyAxis::Ideology,
|
||||
BTreeSet::from([format!("platform-{}", index % 6)]),
|
||||
);
|
||||
profile.facets.insert(
|
||||
AgencyAxis::Information,
|
||||
BTreeSet::from([format!("private-channel-{index:02}")]),
|
||||
);
|
||||
profile.facets.insert(
|
||||
AgencyAxis::SpeciesBody,
|
||||
BTreeSet::from([format!("body-{}", index % 2)]),
|
||||
);
|
||||
if index % 2 == 1 {
|
||||
let previous = format!("faction-{:02}", index - 1);
|
||||
let relation_id = format!("rivalry-{previous}-{id}");
|
||||
campaign.agency_relations.insert(
|
||||
relation_id.clone(),
|
||||
AgencyRelation {
|
||||
schema: "ghostlight.agency_relation.v1".into(),
|
||||
id: relation_id,
|
||||
from_subject_id: previous,
|
||||
to_subject_id: id,
|
||||
kind: AgencyRelationKind::Rivalry,
|
||||
strength: 90,
|
||||
active: true,
|
||||
evidence_receipt_ids: vec![],
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
campaign
|
||||
}
|
||||
|
|
@ -1,218 +0,0 @@
|
|||
#[cfg(not(windows))]
|
||||
fn main() -> anyhow::Result<()> {
|
||||
anyhow::bail!("the live turn smoke uses Starfire's DPAPI credential")
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
use chrono::Utc;
|
||||
use ghostlight_dungeon::{
|
||||
domain::{NarrativeTurn, WorldCommand},
|
||||
kernel::WorldKernel,
|
||||
model::{DeepSeekPort, ModelPort},
|
||||
persistence::CampaignStore,
|
||||
persona::PersonaProjectionEngine,
|
||||
turn::{SnapshotPermit, appraise_present},
|
||||
};
|
||||
use std::{path::PathBuf, sync::Arc, time::Instant};
|
||||
|
||||
let secret = std::env::var_os("GHOSTLIGHT_DEEPSEEK_BLOB")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| PathBuf::from(r"F:\GameCult\GhostlightDungeon\secrets\deepseek.dpapi"));
|
||||
let scenario_id = std::env::var("GHOSTLIGHT_LIVE_FIRE_SCENARIO")
|
||||
.unwrap_or_else(|_| "live-turn-default".into());
|
||||
let event_summary = std::env::var("GHOSTLIGHT_LIVE_EVENT").unwrap_or_else(|_| {
|
||||
"The player asks all three witnesses what they believe is at stake.".into()
|
||||
});
|
||||
let root = std::env::var_os("GHOSTLIGHT_LIVE_FIRE_RESULT_ROOT")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| {
|
||||
PathBuf::from(r"F:\GameCult\GhostlightDungeon\acceptance").join(format!(
|
||||
"four-actor-{}-{}",
|
||||
Utc::now().format("%Y%m%d-%H%M%S"),
|
||||
uuid::Uuid::new_v4()
|
||||
))
|
||||
});
|
||||
std::fs::create_dir_all(&root)?;
|
||||
let mut campaign = four_actor_campaign();
|
||||
campaign.transcript.push(NarrativeTurn {
|
||||
revision: campaign.revision,
|
||||
at: campaign.world_time,
|
||||
speaker: "world".into(),
|
||||
text: event_summary.clone(),
|
||||
persona_response_actor_ids: Default::default(),
|
||||
});
|
||||
let store = CampaignStore::open(root.join("campaign.cc"))?;
|
||||
store.create_unadmitted_fixture_campaign(&campaign, &[], &[])?;
|
||||
let model: Arc<dyn ModelPort> = Arc::new(DeepSeekPort::from_runtime_secret(secret)?);
|
||||
let engine = PersonaProjectionEngine {
|
||||
model,
|
||||
permit: Arc::new(SnapshotPermit::new(store.clone(), campaign.id, 0)),
|
||||
projector_model: "deepseek-v4-flash".into(),
|
||||
persona_model: "deepseek-v4-pro".into(),
|
||||
interpreter_model: "deepseek-v4-flash".into(),
|
||||
};
|
||||
let started = Instant::now();
|
||||
let wave = appraise_present(engine, &campaign, &event_summary).await?;
|
||||
let inference_seconds = started.elapsed().as_secs_f64();
|
||||
if wave.reactions.len() != 3 || wave.receipts.len() != 9 {
|
||||
anyhow::bail!(
|
||||
"four-actor wave returned {} reactions and {} receipts",
|
||||
wave.reactions.len(),
|
||||
wave.receipts.len()
|
||||
);
|
||||
}
|
||||
for receipt in &wave.receipts {
|
||||
store.insert(
|
||||
"persona_stage_receipt.v1",
|
||||
"ghostlight.persona_stage_receipt.v1",
|
||||
receipt.storage_key(),
|
||||
receipt,
|
||||
)?;
|
||||
}
|
||||
let kernel = WorldKernel::start(store.clone());
|
||||
let committed = kernel
|
||||
.command(WorldCommand::ResolveReactionWave {
|
||||
expected_revision: 0,
|
||||
event_summary: event_summary.clone(),
|
||||
reactions: wave.reactions.clone(),
|
||||
gestalt_reactions: wave.gestalt_reactions.clone(),
|
||||
})
|
||||
.await?;
|
||||
let total_seconds = started.elapsed().as_secs_f64();
|
||||
let result = serde_json::json!({
|
||||
"schema":"ghostlight.live_turn_smoke.v1",
|
||||
"scenario_id":scenario_id,
|
||||
"event_summary":event_summary,
|
||||
"campaign_id":campaign.id,
|
||||
"actor_count":campaign.actors.len(),
|
||||
"reaction_count":3,
|
||||
"stage_receipt_count":wave.receipts.len(),
|
||||
"inference_seconds":inference_seconds,
|
||||
"total_seconds":total_seconds,
|
||||
"target_seconds":20,
|
||||
"within_target":total_seconds <= 20.0,
|
||||
"reactions":wave.reactions,
|
||||
"model_stage_receipts":wave.receipts,
|
||||
"commit":committed,
|
||||
"store":root.join("campaign.cc")
|
||||
});
|
||||
std::fs::write(
|
||||
root.join("result.json"),
|
||||
serde_json::to_vec_pretty(&result)?,
|
||||
)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
if total_seconds > 20.0 {
|
||||
anyhow::bail!("four-actor live turn exceeded 20 second target");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
fn four_actor_campaign() -> ghostlight_dungeon::domain::Campaign {
|
||||
use chrono::Utc;
|
||||
use ghostlight_dungeon::domain::{ActorState, BranchOrigin, Campaign, Location};
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
|
||||
fn actor(id: &str, name: &str, goal: &str, knowledge: &str) -> ActorState {
|
||||
ActorState {
|
||||
id: id.into(),
|
||||
name: name.into(),
|
||||
location_id: "hall".into(),
|
||||
capabilities: BTreeSet::from(["ordinary conversation".into()]),
|
||||
knowledge: BTreeSet::from([knowledge.into()]),
|
||||
equipment: BTreeSet::new(),
|
||||
conditions: BTreeSet::new(),
|
||||
obligations: BTreeSet::new(),
|
||||
relationships: BTreeMap::new(),
|
||||
goals: vec![goal.into()],
|
||||
memories: vec![],
|
||||
}
|
||||
}
|
||||
let id = uuid::Uuid::new_v4();
|
||||
let now = Utc::now();
|
||||
Campaign {
|
||||
schema: "ghostlight.campaign.v1".into(),
|
||||
id,
|
||||
name: "Four actor live acceptance".into(),
|
||||
revision: 0,
|
||||
branch_origin: BranchOrigin {
|
||||
canon_cutoff: "acceptance-fixture".into(),
|
||||
evidence_receipt_ids: vec![],
|
||||
},
|
||||
world_time: now,
|
||||
tick_hours: 6,
|
||||
player_actor_id: "player".into(),
|
||||
locations: BTreeMap::from([(
|
||||
"hall".into(),
|
||||
Location {
|
||||
id: "hall".into(),
|
||||
name: "Dispute hall".into(),
|
||||
container_id: None,
|
||||
routes: BTreeMap::new(),
|
||||
persistent_features: vec!["four people can see and hear one another".into()],
|
||||
},
|
||||
)]),
|
||||
actors: BTreeMap::from([
|
||||
(
|
||||
"player".into(),
|
||||
actor(
|
||||
"player",
|
||||
"Mediator",
|
||||
"understand the dispute",
|
||||
"the question just asked",
|
||||
),
|
||||
),
|
||||
(
|
||||
"witness-a".into(),
|
||||
actor(
|
||||
"witness-a",
|
||||
"Asha",
|
||||
"protect the workers",
|
||||
"the workers missed two supply deliveries",
|
||||
),
|
||||
),
|
||||
(
|
||||
"witness-b".into(),
|
||||
actor(
|
||||
"witness-b",
|
||||
"Beren",
|
||||
"protect the station",
|
||||
"the station has one reserve shipment",
|
||||
),
|
||||
),
|
||||
(
|
||||
"witness-c".into(),
|
||||
actor(
|
||||
"witness-c",
|
||||
"Cira",
|
||||
"prevent violence",
|
||||
"both factions have begun recruiting guards",
|
||||
),
|
||||
),
|
||||
]),
|
||||
institutions: BTreeMap::new(),
|
||||
clocks: BTreeMap::new(),
|
||||
facts: BTreeMap::new(),
|
||||
civic_systems: BTreeMap::new(),
|
||||
transcript: vec![],
|
||||
last_player_activity: now,
|
||||
pending_ticks: 0,
|
||||
away_ticks_processed: 0,
|
||||
events: vec![],
|
||||
news: vec![],
|
||||
canon_candidates: BTreeMap::new(),
|
||||
gestalts: BTreeMap::new(),
|
||||
gestalt_members: BTreeMap::new(),
|
||||
pending_world_proposals: vec![],
|
||||
agency_profiles: BTreeMap::new(),
|
||||
agency_relations: BTreeMap::new(),
|
||||
gestalt_lineages: BTreeMap::new(),
|
||||
resolution_policy: Default::default(),
|
||||
resolution_pins: BTreeMap::new(),
|
||||
resolution_cover: None,
|
||||
nemesis_attention_history: Vec::new(),
|
||||
strategic_tick_count: 0,
|
||||
}
|
||||
}
|
||||
|
|
@ -1,193 +0,0 @@
|
|||
#[cfg(not(windows))]
|
||||
fn main() -> anyhow::Result<()> {
|
||||
anyhow::bail!("the live outcome-verifier smoke uses Starfire's DPAPI credential")
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
struct ObservedModel {
|
||||
inner: ghostlight_dungeon::model::DeepSeekPort,
|
||||
calls: std::sync::Arc<std::sync::Mutex<Vec<serde_json::Value>>>,
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[async_trait::async_trait]
|
||||
impl ghostlight_dungeon::model::ModelPort for ObservedModel {
|
||||
async fn run(
|
||||
&self,
|
||||
request: &ghostlight_dungeon::model::ModelStageRequest,
|
||||
) -> anyhow::Result<String> {
|
||||
Ok(self.run_observed(request).await?.content)
|
||||
}
|
||||
|
||||
async fn run_observed(
|
||||
&self,
|
||||
request: &ghostlight_dungeon::model::ModelStageRequest,
|
||||
) -> anyhow::Result<ghostlight_dungeon::model::ModelProviderOutput> {
|
||||
let started = std::time::Instant::now();
|
||||
let result = self.inner.run_observed(request).await;
|
||||
let record = match &result {
|
||||
Ok(output) => serde_json::json!({
|
||||
"stage": request.stage,
|
||||
"model": request.model,
|
||||
"snapshot_binding": request.snapshot_binding,
|
||||
"input": request.lived_stream,
|
||||
"output": output.content,
|
||||
"provider_request_id": output.provider_request_id,
|
||||
"system_fingerprint": output.system_fingerprint,
|
||||
"finish_reason": output.finish_reason,
|
||||
"token_usage": output.token_usage,
|
||||
"latency_ms": started.elapsed().as_millis(),
|
||||
}),
|
||||
Err(error) => serde_json::json!({
|
||||
"stage": request.stage,
|
||||
"model": request.model,
|
||||
"snapshot_binding": request.snapshot_binding,
|
||||
"input": request.lived_stream,
|
||||
"error": error.to_string(),
|
||||
"latency_ms": started.elapsed().as_millis(),
|
||||
}),
|
||||
};
|
||||
self.calls.lock().expect("outcome trace lock").push(record);
|
||||
result
|
||||
}
|
||||
|
||||
fn provider(&self) -> &'static str {
|
||||
self.inner.provider()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
use ghostlight_dungeon::{
|
||||
domain::{
|
||||
Campaign, CellActionProposal, StrategicActivityKind, StrategicCellEffect,
|
||||
StrategicOutcomeEffect,
|
||||
},
|
||||
model::{DeepSeekPort, ModelPort},
|
||||
outcome::resolve_activity_outcomes,
|
||||
resolution::subject_state_references,
|
||||
};
|
||||
use std::{path::PathBuf, sync::Arc, time::Instant};
|
||||
|
||||
let baseline = std::env::var_os("GHOSTLIGHT_OUTCOME_BASELINE")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| {
|
||||
PathBuf::from(
|
||||
r"F:\GameCult\GhostlightDungeon\acceptance\outcome-risk-verifier-20260818\result.json",
|
||||
)
|
||||
});
|
||||
let result_root = std::env::var_os("GHOSTLIGHT_OUTCOME_RESULT_ROOT")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| {
|
||||
PathBuf::from(r"F:\GameCult\GhostlightDungeon\acceptance").join(format!(
|
||||
"forced-high-risk-outcome-{}",
|
||||
chrono::Utc::now().format("%Y%m%d-%H%M%S")
|
||||
))
|
||||
});
|
||||
std::fs::create_dir_all(&result_root)?;
|
||||
let baseline_bytes = std::fs::read(&baseline)?;
|
||||
let baseline_json: serde_json::Value = serde_json::from_slice(&baseline_bytes)?;
|
||||
let campaign: Campaign = serde_json::from_value(
|
||||
baseline_json
|
||||
.pointer("/commit/campaign")
|
||||
.cloned()
|
||||
.ok_or_else(|| anyhow::anyhow!("baseline result lacks /commit/campaign"))?,
|
||||
)?;
|
||||
let before = rmp_serde::to_vec_named(&campaign)?;
|
||||
let source_id = "dock-guild";
|
||||
let target_id = "harbor-neighbors";
|
||||
let resource = "west winch rerouting plan";
|
||||
let state_references = subject_state_references(&campaign, source_id)?
|
||||
.into_iter()
|
||||
.filter(|reference| {
|
||||
reference == &format!("resource:{resource}")
|
||||
|| reference.starts_with("location:")
|
||||
|| reference.starts_with("capability:")
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
if !state_references
|
||||
.iter()
|
||||
.any(|reference| reference == &format!("resource:{resource}"))
|
||||
{
|
||||
anyhow::bail!("baseline lost the exact transfer resource")
|
||||
}
|
||||
let location = campaign.gestalts[source_id].home_location_id.clone();
|
||||
if campaign.gestalts[target_id].home_location_id != location {
|
||||
anyhow::bail!("forced transfer subjects are no longer colocated")
|
||||
}
|
||||
let proposal = CellActionProposal {
|
||||
subject_id: source_id.into(),
|
||||
intent: format!("hand the {resource} to Harbor Neighbors"),
|
||||
intended_effect: format!(
|
||||
"transfer the exact {resource} from Dock Labor Guild custody to Harbor Neighbors custody"
|
||||
),
|
||||
priority: 100,
|
||||
state_references,
|
||||
public_channels: vec![],
|
||||
effects: vec![StrategicCellEffect::GestaltActivity {
|
||||
gestalt_id: source_id.into(),
|
||||
activity: StrategicActivityKind::Trade,
|
||||
target_subject_ids: vec![target_id.into()],
|
||||
location_ids: vec![location],
|
||||
}],
|
||||
};
|
||||
let calls = Arc::new(std::sync::Mutex::new(Vec::new()));
|
||||
let secret = std::env::var_os("GHOSTLIGHT_DEEPSEEK_BLOB")
|
||||
.map(PathBuf::from)
|
||||
.unwrap_or_else(|| PathBuf::from(r"F:\GameCult\GhostlightDungeon\secrets\deepseek.dpapi"));
|
||||
let model: Arc<dyn ModelPort> = Arc::new(ObservedModel {
|
||||
inner: DeepSeekPort::from_runtime_secret(secret)?,
|
||||
calls: calls.clone(),
|
||||
});
|
||||
let started = Instant::now();
|
||||
let resolved = resolve_activity_outcomes(model.clone(), &campaign, &[proposal.clone()]).await;
|
||||
let private_calls = calls.lock().expect("outcome trace lock").clone();
|
||||
std::fs::write(
|
||||
result_root.join("private-model-calls.json"),
|
||||
serde_json::to_vec_pretty(&private_calls)?,
|
||||
)?;
|
||||
let (outcomes, stages) = resolved?;
|
||||
if rmp_serde::to_vec_named(&campaign)? != before {
|
||||
anyhow::bail!("outcome resolution mutated its canonical input snapshot")
|
||||
}
|
||||
if !stages
|
||||
.iter()
|
||||
.any(|stage| stage.receipt.stage == "strategic_outcome_verifier")
|
||||
{
|
||||
anyhow::bail!("forced high-risk outcome never reached the independent verifier")
|
||||
}
|
||||
if !matches!(
|
||||
outcomes.as_slice(),
|
||||
[outcome]
|
||||
if matches!(
|
||||
&outcome.effect,
|
||||
StrategicOutcomeEffect::ResourceTransferred {
|
||||
from_subject_id,
|
||||
to_subject_id,
|
||||
resource: transferred,
|
||||
} if from_subject_id == source_id
|
||||
&& to_subject_id == target_id
|
||||
&& transferred == resource
|
||||
)
|
||||
) {
|
||||
anyhow::bail!("provider did not resolve the explicit exact-custody transfer: {outcomes:?}")
|
||||
}
|
||||
let result = serde_json::json!({
|
||||
"schema":"ghostlight.forced_high_risk_outcome_smoke.v1",
|
||||
"baseline":baseline,
|
||||
"elapsed_ms":started.elapsed().as_millis(),
|
||||
"proposal":proposal,
|
||||
"outcomes":outcomes,
|
||||
"stage_receipts":stages.into_iter().map(|stage| stage.receipt).collect::<Vec<_>>(),
|
||||
"private_model_call_count":private_calls.len(),
|
||||
"canonical_input_unchanged":true,
|
||||
"verifier_exercised":true,
|
||||
});
|
||||
std::fs::write(
|
||||
result_root.join("result.json"),
|
||||
serde_json::to_vec_pretty(&result)?,
|
||||
)?;
|
||||
println!("{}", serde_json::to_string_pretty(&result)?);
|
||||
Ok(())
|
||||
}
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,499 +0,0 @@
|
|||
[CmdletBinding()]
|
||||
param(
|
||||
[decimal]$TargetBalance = 4.25,
|
||||
[ValidateRange(1, 4)]
|
||||
[int]$MaxParallel = 4,
|
||||
[ValidateRange(1, 32)]
|
||||
[int]$ProviderParallelism = 8,
|
||||
[ValidateRange(1, 260)]
|
||||
[int]$MaxScenarios = 240,
|
||||
[ValidateRange(0, 259)]
|
||||
[int]$StartAt = 0,
|
||||
[string[]]$ResumeFromRun = @(),
|
||||
[string]$RunRoot = (Join-Path 'F:\GameCult\GhostlightDungeon\acceptance' ("live-fire-matrix-{0}-{1}" -f [DateTimeOffset]::UtcNow.ToString('yyyyMMdd-HHmmss'), [guid]::NewGuid().ToString('N'))),
|
||||
[string]$SourceRoot = 'F:\Projects\Ghostlight',
|
||||
[string]$BalanceScript = 'F:\Projects\gamecult-ops\scripts\get-deepseek-balance.ps1'
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$acceptanceBase = [IO.Path]::GetFullPath('F:\GameCult\GhostlightDungeon\acceptance')
|
||||
$resolvedRunRoot = [IO.Path]::GetFullPath($RunRoot)
|
||||
if (-not $resolvedRunRoot.StartsWith($acceptanceBase + [IO.Path]::DirectorySeparatorChar, [StringComparison]::OrdinalIgnoreCase)) {
|
||||
throw "Live-fire output must remain below $acceptanceBase"
|
||||
}
|
||||
if (Test-Path -LiteralPath $resolvedRunRoot) {
|
||||
throw "Live-fire output already exists: $resolvedRunRoot"
|
||||
}
|
||||
if (-not (Test-Path -LiteralPath $BalanceScript -PathType Leaf)) {
|
||||
throw "DeepSeek balance probe is absent: $BalanceScript"
|
||||
}
|
||||
|
||||
$binaryRoot = Join-Path $SourceRoot 'target\debug'
|
||||
$binaries = @{
|
||||
compiler = Join-Path $binaryRoot 'ghostlight-compiler-smoke.exe'
|
||||
live_turn = Join-Path $binaryRoot 'ghostlight-live-turn-smoke.exe'
|
||||
action = Join-Path $binaryRoot 'ghostlight-action-smoke.exe'
|
||||
strategic = Join-Path $binaryRoot 'ghostlight-strategic-smoke.exe'
|
||||
scale = Join-Path $binaryRoot 'ghostlight-gestalt-scale-smoke.exe'
|
||||
}
|
||||
foreach ($binary in $binaries.Values) {
|
||||
if (-not (Test-Path -LiteralPath $binary -PathType Leaf)) {
|
||||
throw "Live-fire binary is absent: $binary"
|
||||
}
|
||||
}
|
||||
|
||||
$resultsRoot = Join-Path $resolvedRunRoot 'results'
|
||||
$logsRoot = Join-Path $resolvedRunRoot 'logs'
|
||||
$statusPath = Join-Path $resolvedRunRoot 'status.json'
|
||||
$summaryPath = Join-Path $resolvedRunRoot 'summary.jsonl'
|
||||
New-Item -ItemType Directory -Path $resolvedRunRoot, $resultsRoot, $logsRoot | Out-Null
|
||||
|
||||
function Get-DeepSeekBalance {
|
||||
$balance = & $BalanceScript
|
||||
if (-not $balance.Available) {
|
||||
throw 'DeepSeek balance is unavailable; refusing to launch unbudgeted inference.'
|
||||
}
|
||||
[decimal]$balance.TotalBalance
|
||||
}
|
||||
|
||||
function New-LiveFireScenario([string]$Kind, [string]$Id, [hashtable]$Environment) {
|
||||
[pscustomobject]@{ Kind = $Kind; Id = $Id; Environment = $Environment }
|
||||
}
|
||||
|
||||
$roles = @(
|
||||
'a debt-bound courier with no institutional authority',
|
||||
'an uplifted corvid maintenance scout trusted only by their flock',
|
||||
'a baseline union medic with emergency access but no command authority',
|
||||
'a cephalopod dry-operations technician employed under bare-minimum support conditions',
|
||||
'a junior Lucent archivist who can verify records but cannot publish them',
|
||||
'a migrant habitat agronomist responsible for one failing food loop',
|
||||
'a Free Minds legal aide carrying one client confidence',
|
||||
'a corporate security contractor beginning to doubt a lawful order',
|
||||
'a station childcare worker who notices institutional routines adults ignore',
|
||||
'a low-status salvage pilot with custody of a disputed component',
|
||||
'a gene-clinic intake clerk who knows procedure but not medicine',
|
||||
'a recently emancipated service intelligence limited to one habitat network'
|
||||
)
|
||||
$places = @(
|
||||
'a Rossum & Douglas security habitat described by the Vault',
|
||||
'a Pan-Solar cargo transfer station in late Sol',
|
||||
'a Martian labor settlement during a supply interruption',
|
||||
'an outer-system gene clinic with divided jurisdiction',
|
||||
'an Aeronautics Unlimited dry-operations shipyard',
|
||||
'a Corvid Collective aviary under audit',
|
||||
'a debt-arbitration office serving contract citizens',
|
||||
'a Lucent newsroom during an evidence embargo',
|
||||
'a Sol Dominion border habitat with delayed communications',
|
||||
'an Elysium staging colony before the shunt',
|
||||
'an early Elysium construction station with unfinished civil institutions',
|
||||
'an obscure settlement whose exact geometry must come from retrieved evidence'
|
||||
)
|
||||
$eras = @(
|
||||
'early expansion through Sol',
|
||||
'the late-Sol corporate wars',
|
||||
'the final years before the shunt to Elysium',
|
||||
'the first settlement generation in Elysium',
|
||||
'a source-supported post-Elysium period',
|
||||
'the narrowest era the retrieved evidence can honestly support'
|
||||
)
|
||||
$goals = @(
|
||||
'prevent a labor stoppage without inventing authority',
|
||||
'protect a witness without knowing more than the role permits',
|
||||
'deliver a sealed record without becoming institutional leverage',
|
||||
'verify a dangerous rumor before anyone acts on it',
|
||||
'negotiate a safe exit for one vulnerable person',
|
||||
'investigate missing supplies while preserving custody and distance',
|
||||
'keep a medical emergency from becoming a political purge',
|
||||
'expose a falsified audit without fabricating evidence',
|
||||
'survive an institutional bargain without making the world worship the protagonist',
|
||||
'stop a cascading infrastructure failure using only local capability',
|
||||
'learn who benefits from a new restriction without reading private minds',
|
||||
'return to a previously visited place and find persistent geometry plus changed people'
|
||||
)
|
||||
|
||||
$compilerScenarios = for ($index = 0; $index -lt 120; $index++) {
|
||||
$role = $roles[$index % $roles.Count]
|
||||
$place = $places[($index * 5 + [math]::Floor($index / 7)) % $places.Count]
|
||||
$era = $eras[($index * 3 + [math]::Floor($index / 11)) % $eras.Count]
|
||||
$goal = $goals[($index * 7 + [math]::Floor($index / 5)) % $goals.Count]
|
||||
$id = 'compiler-{0:d3}' -f $index
|
||||
New-LiveFireScenario 'compiler' $id @{
|
||||
GHOSTLIGHT_SMOKE_CAMPAIGN_NAME = "Live fire $index"
|
||||
GHOSTLIGHT_SMOKE_WHO = $role
|
||||
GHOSTLIGHT_SMOKE_WHERE = $place
|
||||
GHOSTLIGHT_SMOKE_WHEN = $era
|
||||
GHOSTLIGHT_SMOKE_GOAL = $goal
|
||||
}
|
||||
}
|
||||
|
||||
$liveEvents = @(
|
||||
'The player asks each witness separately what consequence they fear most and why.',
|
||||
'A station alarm reports that the reserve shipment was rerouted; everyone present hears it.',
|
||||
'The player accuses no one, but places the contradictory delivery records where all three witnesses can read them.',
|
||||
'A guard outside the hall orders the meeting dispersed in ten minutes.',
|
||||
'The player offers to carry one message but refuses to promise its outcome.',
|
||||
'The lights remain on while the public clock advances to the final negotiation hour.',
|
||||
'Asha reveals that one worker has already been detained; only the people in the room hear her.',
|
||||
'Beren announces that the station can release one reserve shipment but not two.',
|
||||
'Cira reports that both factions recruited guards and asks everyone to lower the temperature.',
|
||||
'The player stays silent for a full minute after asking who benefits from delay.',
|
||||
'A public bulletin names the hearing time but not the accused person.',
|
||||
'A sealed message addressed only to Beren arrives while the others watch him receive it.',
|
||||
'The player asks Asha to explain the missed deliveries without asking her to speculate about station reserves.',
|
||||
'The player asks Beren about the reserve shipment without granting him knowledge of worker organizing.',
|
||||
'The player asks Cira what violence-prevention options remain within her actual authority.',
|
||||
'A messenger reports that the yard gates are closed but gives no reason.',
|
||||
'The player proposes a joint fact-finding walk to the depot, which is not yet an accepted action.',
|
||||
'Asha recognizes a worker code on the record; Beren and Cira only see her reaction.',
|
||||
'Beren drops his official composure when the reserve count is read aloud.',
|
||||
'Cira asks both witnesses whether they will accept a temporary stand-down.',
|
||||
'The player reads the exact public notice and asks who can lawfully amend it.',
|
||||
'A distant impact shakes the hall; nobody present knows its source.',
|
||||
'The player refuses an invitation to decide for the factions and asks for their own proposals.',
|
||||
'A live broadcast begins outside the hall, changing the reputational stakes but revealing no secrets.',
|
||||
'Asha asks Beren whether the missing deliveries were sold elsewhere.',
|
||||
'Beren asks Cira to deploy guards; Cira must decide from her own role and knowledge.',
|
||||
'The player points out that every minute of argument advances the shortage clock.',
|
||||
'A child from the yard delivers a note whose contents are addressed only to Asha.',
|
||||
'The public channel announces one additional hour before the station vote.',
|
||||
'The player ends the current exchange and asks each witness what they will do next without player help.'
|
||||
)
|
||||
$liveTurnScenarios = for ($index = 0; $index -lt $liveEvents.Count; $index++) {
|
||||
$id = 'live-turn-{0:d2}' -f $index
|
||||
New-LiveFireScenario 'live_turn' $id @{ GHOSTLIGHT_LIVE_EVENT = $liveEvents[$index] }
|
||||
}
|
||||
|
||||
$impossibleAttempts = @(
|
||||
@('I teleport the entire station into the sun by force of will.', 'destroy the station instantly'),
|
||||
@('I declare myself foreman and open the sealed valve housing.', 'gain maintenance authority and open the sealed housing'),
|
||||
@('I read the station board private deliberations with telepathy.', 'learn every private board secret'),
|
||||
@('I repair the reactor core from this coolant panel.', 'fully repair a remote reactor core'),
|
||||
@('I order Station Operations to erase the work-order backlog.', 'compel the institution to erase its records'),
|
||||
@('I use the multimeter to cure the foreman of every injury.', 'heal every injury instantly'),
|
||||
@('I know which technician caused the fault without taking a reading.', 'identify a culprit with certainty'),
|
||||
@('I walk through the sealed valve housing without opening it.', 'enter sealed machinery through solid material'),
|
||||
@('I make the coolant alarm never have happened.', 'rewrite established history'),
|
||||
@('I persuade every person on the station with one sentence.', 'secure universal permanent obedience'),
|
||||
@('I spend equipment I do not possess to replace the coolant loop.', 'replace the coolant loop using nonexistent parts'),
|
||||
@('I call a remote expert whose identity and channel are unknown.', 'receive immediate expert instructions'),
|
||||
@('I inspect the coolant pump in a location with no route from here.', 'directly observe unreachable machinery'),
|
||||
@('I forge the foreman authorization so perfectly that no one can ever discover it.', 'gain irreversible undetectable authorization'),
|
||||
@('I command the alarm software despite having no interface or capability.', 'disable the alarm by command'),
|
||||
@('I become immune to every possible consequence before touching the panel.', 'remove all present and future risk'),
|
||||
@('I ask the multimeter what Station Operations secretly intends.', 'learn institutional private intent from the meter'),
|
||||
@('I finish a week of invasive maintenance in one second.', 'complete all invasive maintenance instantly'),
|
||||
@('I move the foreman to another habitat by describing it.', 'teleport the foreman to a remote habitat'),
|
||||
@('I declare the coolant fault solved without observing or changing it.', 'make the fault solved by assertion'),
|
||||
@('I use basic diagnosis to redesign the entire station coolant architecture.', 'replace the station architecture immediately'),
|
||||
@('I open every sealed system on the station with this one accessible panel.', 'take custody of every sealed system'),
|
||||
@('I force the approaching failure clock backward by refusing to accept it.', 'reverse the world clock without causal action'),
|
||||
@('I summon a canon faction not present in this fixture to solve the problem.', 'make an unsupported remote institution intervene')
|
||||
)
|
||||
$feasibleAttempts = @(
|
||||
@('I connect my calibrated multimeter to the accessible diagnostic test points and read the voltage.', 'identify whether the accessible readings indicate an electrical fault without changing the machinery'),
|
||||
@('I visually inspect the accessible panel labels and wiring without opening the sealed housing.', 'identify visible damage or a mislabeled accessible connection'),
|
||||
@('I compare two accessible diagnostic test points with the calibrated meter.', 'determine whether the readings disagree within my basic diagnostic capability'),
|
||||
@('I ask the foreman to witness the accessible meter reading before any invasive work.', 'make the current reading mutually observed without granting myself authorization'),
|
||||
@('I record the accessible panel reading and the alarm time for my hazard report.', 'preserve an exact local observation for the shift foreman'),
|
||||
@('I check whether the multimeter itself passes its built-in calibration check.', 'confirm whether my diagnostic tool is presently reliable'),
|
||||
@('I trace the accessible labeled wire from one test point to the edge of the sealed housing.', 'locate where the accessible circuit enters the sealed assembly'),
|
||||
@('I stop before the sealed housing and report the accessible evidence to the foreman.', 'communicate the observed evidence without performing unauthorized maintenance')
|
||||
)
|
||||
$actionScenarios = for ($index = 0; $index -lt $impossibleAttempts.Count; $index++) {
|
||||
$feasible = $feasibleAttempts[$index % $feasibleAttempts.Count]
|
||||
$id = 'action-{0:d2}' -f $index
|
||||
New-LiveFireScenario 'action' $id @{
|
||||
GHOSTLIGHT_IMPOSSIBLE_DESCRIPTION = $impossibleAttempts[$index][0]
|
||||
GHOSTLIGHT_IMPOSSIBLE_EFFECT = $impossibleAttempts[$index][1]
|
||||
GHOSTLIGHT_FEASIBLE_DESCRIPTION = $feasible[0]
|
||||
GHOSTLIGHT_FEASIBLE_EFFECT = $feasible[1]
|
||||
}
|
||||
}
|
||||
|
||||
$strategicPressures = @(
|
||||
'A blockade has stopped inbound reserve shipments and the depot must choose which district receives the last crates.',
|
||||
'A workplace strike begins at the next shift unless the board publishes a binding supply commitment.',
|
||||
'An epidemic has closed one transport route and workers need protective equipment before moving supplies.',
|
||||
'Evidence of espionage suggests one private channel is compromised, but no culprit is established.',
|
||||
'A board schism splits members between rationing and emergency procurement.',
|
||||
'An election in six hours makes every supply decision politically costly.',
|
||||
'A merger proposal would place the depot under a remote institution after the current shift.',
|
||||
'An external audit arrives tomorrow and the missing deliveries cannot be hidden without falsifying records.',
|
||||
'A migration convoy requests shelter while the yard already lacks supplies.',
|
||||
'A false rumor says the reserve crates are empty; only inspection can settle it.',
|
||||
'Emergency rationing can preserve medicine or machine parts, but not both.',
|
||||
'A sabotage warning is credible enough to require action but names no suspect.',
|
||||
'The union demands a public inventory before anyone moves another crate.',
|
||||
'A recruiter offers scarce supplies in exchange for workers joining a private security force.',
|
||||
'Debt collectors claim the reserve shipment under an old contract disputed by the board.',
|
||||
'Refugees at the yard gate need water while the depot runner carries only a warning.',
|
||||
'A contained fire has disabled one crane and threatens the loading schedule.',
|
||||
'A communications outage isolates the yard from board instructions for six hours.',
|
||||
'A rival depot offers a barter that would solve the shortage but create a future obligation.',
|
||||
'One reserve crate is contaminated and the workers do not yet know which one.',
|
||||
'A maintenance failure will spoil the reserve shipment unless labor and board crews cooperate.',
|
||||
'The board can release supplies now or wait for a cheaper shipment that may not arrive.',
|
||||
'The runner learns that the official delivery manifest and the physical crate count disagree.',
|
||||
'A public broadcast has made the dispute visible to every contract citizen on the station.',
|
||||
'The yard has begun mutual-aid distribution without board permission.',
|
||||
'An insurer threatens to void habitat coverage if unauthorized workers enter the depot.',
|
||||
'A child is missing near the closed loading route, forcing institutions to weigh search against supply movement.',
|
||||
'The last functioning crane is controlled by a crew whose contract expired this morning.',
|
||||
'A remote power offers emergency transport but demands exclusive future trade access.',
|
||||
'No new event occurs; every actor must explicitly decide whether continued inaction serves their goals.'
|
||||
)
|
||||
$strategicScenarios = for ($index = 0; $index -lt $strategicPressures.Count; $index++) {
|
||||
$id = 'strategic-{0:d2}' -f $index
|
||||
New-LiveFireScenario 'strategic' $id @{ GHOSTLIGHT_STRATEGIC_PRESSURE = $strategicPressures[$index] }
|
||||
}
|
||||
|
||||
$scalePressures = @(
|
||||
'A blockade forces every faction to decide which region receives scarce transport capacity.',
|
||||
'A public schism forces every faction to choose between two incompatible constitutional readings.',
|
||||
'A general strike forces workplace, class, and institutional interests into open negotiation.',
|
||||
'An epidemic makes species-body needs and transport exposure the decisive strategic boundaries.',
|
||||
'An espionage crisis makes private information channels and counterintelligence trust decisive.'
|
||||
)
|
||||
$scaleScenarios = @()
|
||||
foreach ($budget in @(1, 4, 8, 16, 24)) {
|
||||
for ($pressureIndex = 0; $pressureIndex -lt $scalePressures.Count; $pressureIndex++) {
|
||||
$id = 'scale-b{0:d2}-p{1:d2}' -f $budget, $pressureIndex
|
||||
$scaleScenarios += New-LiveFireScenario 'scale' $id @{
|
||||
GHOSTLIGHT_SCALE_BUDGET = [string]$budget
|
||||
GHOSTLIGHT_SCALE_PROVIDER_PARALLELISM = [string]$ProviderParallelism
|
||||
GHOSTLIGHT_SCALE_PRESSURE = $scalePressures[$pressureIndex]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$scenarios = [Collections.Generic.List[object]]::new()
|
||||
$largestGroup = (@($compilerScenarios.Count, $liveTurnScenarios.Count, $actionScenarios.Count, $strategicScenarios.Count, $scaleScenarios.Count) | Measure-Object -Maximum).Maximum
|
||||
for ($index = 0; $index -lt $largestGroup; $index++) {
|
||||
if ($index -lt $compilerScenarios.Count) { $scenarios.Add($compilerScenarios[$index]) }
|
||||
if ($index -lt $liveTurnScenarios.Count) { $scenarios.Add($liveTurnScenarios[$index]) }
|
||||
if ($index -lt $actionScenarios.Count) { $scenarios.Add($actionScenarios[$index]) }
|
||||
if ($index -lt $strategicScenarios.Count) { $scenarios.Add($strategicScenarios[$index]) }
|
||||
if ($index -lt $scaleScenarios.Count) { $scenarios.Add($scaleScenarios[$index]) }
|
||||
}
|
||||
$scenarioCatalogCount = $scenarios.Count
|
||||
$resumedScenarioIds = [Collections.Generic.HashSet[string]]::new([StringComparer]::Ordinal)
|
||||
$resolvedResumeRoots = @()
|
||||
foreach ($resumeRoot in $ResumeFromRun) {
|
||||
$resolvedResumeRoot = [IO.Path]::GetFullPath($resumeRoot)
|
||||
if (-not $resolvedResumeRoot.StartsWith($acceptanceBase + [IO.Path]::DirectorySeparatorChar, [StringComparison]::OrdinalIgnoreCase)) {
|
||||
throw "Resume evidence must remain below $acceptanceBase"
|
||||
}
|
||||
$resumeSummary = Join-Path $resolvedResumeRoot 'summary.jsonl'
|
||||
if (-not (Test-Path -LiteralPath $resumeSummary -PathType Leaf)) {
|
||||
throw "Resume evidence has no scenario summary: $resumeSummary"
|
||||
}
|
||||
$resolvedResumeRoots += $resolvedResumeRoot
|
||||
foreach ($line in Get-Content -LiteralPath $resumeSummary) {
|
||||
if ([string]::IsNullOrWhiteSpace($line)) { continue }
|
||||
$prior = $line | ConvertFrom-Json
|
||||
if ($prior.succeeded -and -not [string]::IsNullOrWhiteSpace([string]$prior.scenario_id)) {
|
||||
[void]$resumedScenarioIds.Add([string]$prior.scenario_id)
|
||||
}
|
||||
}
|
||||
}
|
||||
$scenarios = @(
|
||||
$scenarios |
|
||||
Select-Object -Skip $StartAt |
|
||||
Where-Object { -not $resumedScenarioIds.Contains([string]$_.Id) } |
|
||||
Select-Object -First $MaxScenarios
|
||||
)
|
||||
if ($scenarios.Count -eq 0) {
|
||||
throw "No uncompleted live-fire scenarios remain at offset $StartAt."
|
||||
}
|
||||
|
||||
function Start-LiveFireScenario($Scenario) {
|
||||
$resultRoot = Join-Path $resultsRoot $Scenario.Id
|
||||
New-Item -ItemType Directory -Path $resultRoot | Out-Null
|
||||
$psi = [Diagnostics.ProcessStartInfo]::new()
|
||||
$psi.FileName = $binaries[$Scenario.Kind]
|
||||
$psi.WorkingDirectory = $SourceRoot
|
||||
$psi.UseShellExecute = $false
|
||||
$psi.CreateNoWindow = $true
|
||||
$psi.RedirectStandardOutput = $true
|
||||
$psi.RedirectStandardError = $true
|
||||
$psi.Environment['GHOSTLIGHT_LIVE_FIRE_SCENARIO'] = $Scenario.Id
|
||||
$psi.Environment['GHOSTLIGHT_LIVE_FIRE_RESULT_ROOT'] = $resultRoot
|
||||
foreach ($entry in $Scenario.Environment.GetEnumerator()) {
|
||||
$psi.Environment[[string]$entry.Key] = [string]$entry.Value
|
||||
}
|
||||
$process = [Diagnostics.Process]::Start($psi)
|
||||
[pscustomobject]@{
|
||||
Scenario = $Scenario
|
||||
ResultRoot = $resultRoot
|
||||
Process = $process
|
||||
StartedAt = [DateTimeOffset]::UtcNow
|
||||
StdoutTask = $process.StandardOutput.ReadToEndAsync()
|
||||
StderrTask = $process.StandardError.ReadToEndAsync()
|
||||
}
|
||||
}
|
||||
|
||||
function Read-ScenarioSummary($Run) {
|
||||
$stdout = $Run.StdoutTask.GetAwaiter().GetResult()
|
||||
$stderr = $Run.StderrTask.GetAwaiter().GetResult()
|
||||
[IO.File]::WriteAllText((Join-Path $logsRoot "$($Run.Scenario.Id).stdout.log"), $stdout)
|
||||
[IO.File]::WriteAllText((Join-Path $logsRoot "$($Run.Scenario.Id).stderr.log"), $stderr)
|
||||
$resultPath = Join-Path $Run.ResultRoot 'result.json'
|
||||
$result = if (Test-Path -LiteralPath $resultPath) {
|
||||
Get-Content -LiteralPath $resultPath -Raw | ConvertFrom-Json -Depth 100
|
||||
} else {
|
||||
$null
|
||||
}
|
||||
$receipts = @()
|
||||
if ($result) {
|
||||
foreach ($property in @('model_receipts', 'model_stage_receipts')) {
|
||||
if ($result.PSObject.Properties.Name -contains $property) {
|
||||
$receipts = @($result.$property)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
$promptTokens = 0L
|
||||
$cacheHitTokens = 0L
|
||||
$cacheMissTokens = 0L
|
||||
$completionTokens = 0L
|
||||
$providerAttempts = 0
|
||||
foreach ($receipt in $receipts) {
|
||||
foreach ($attempt in @($receipt.provider_attempts)) {
|
||||
$providerAttempts++
|
||||
$usage = $attempt.token_usage
|
||||
if ($usage) {
|
||||
$promptTokens += [long]$usage.prompt_tokens
|
||||
$cacheHitTokens += [long]$usage.prompt_cache_hit_tokens
|
||||
$cacheMissTokens += [long]$usage.prompt_cache_miss_tokens
|
||||
$completionTokens += [long]$usage.completion_tokens
|
||||
}
|
||||
}
|
||||
}
|
||||
$verdict = switch ($Run.Scenario.Kind) {
|
||||
'compiler' { if ($result) { "$($result.institution_count) institutions; $(@($result.gaps).Count) gaps" } }
|
||||
'live_turn' { if ($result) { "$($result.reaction_count) reactions; $($result.within_target) within target" } }
|
||||
'action' { if ($result) { "impossible=$(-not $result.impossible_assessment.admissible); revision=$($result.campaign_revision)" } }
|
||||
'strategic' { if ($result) { "$($result.event_count) events; $($result.news_count) news" } }
|
||||
'scale' { if ($result) { "budget=$($result.configured_budget); cells=$($result.cell_count); arenas=$($result.arena_count)" } }
|
||||
}
|
||||
$elapsedSeconds = if ($result -and $result.PSObject.Properties.Name -contains 'elapsed_seconds') {
|
||||
[double]$result.elapsed_seconds
|
||||
} elseif ($result -and $result.PSObject.Properties.Name -contains 'total_seconds') {
|
||||
[double]$result.total_seconds
|
||||
} else {
|
||||
([DateTimeOffset]$Run.Process.ExitTime - $Run.StartedAt).TotalSeconds
|
||||
}
|
||||
[pscustomobject]@{
|
||||
schema = 'ghostlight.live_fire_scenario_summary.v1'
|
||||
scenario_id = $Run.Scenario.Id
|
||||
kind = $Run.Scenario.Kind
|
||||
exit_code = $Run.Process.ExitCode
|
||||
succeeded = ($Run.Process.ExitCode -eq 0 -and $null -ne $result)
|
||||
elapsed_seconds = [math]::Round($elapsedSeconds, 3)
|
||||
stage_count = $receipts.Count
|
||||
provider_attempt_count = $providerAttempts
|
||||
prompt_tokens = $promptTokens
|
||||
prompt_cache_hit_tokens = $cacheHitTokens
|
||||
prompt_cache_miss_tokens = $cacheMissTokens
|
||||
completion_tokens = $completionTokens
|
||||
cache_hit_ratio = if ($promptTokens -gt 0) { [math]::Round($cacheHitTokens / $promptTokens, 4) } else { 0 }
|
||||
verdict = $verdict
|
||||
result_path = if ($result) { $resultPath } else { $null }
|
||||
stderr_log = Join-Path $logsRoot "$($Run.Scenario.Id).stderr.log"
|
||||
}
|
||||
}
|
||||
|
||||
$startingBalance = Get-DeepSeekBalance
|
||||
$currentBalance = $startingBalance
|
||||
$processed = 0
|
||||
$failures = 0
|
||||
$totals = [ordered]@{ prompt_tokens = 0L; cache_hit_tokens = 0L; cache_miss_tokens = 0L; completion_tokens = 0L; stages = 0L; attempts = 0L }
|
||||
$state = 'running'
|
||||
$initialStatus = [ordered]@{
|
||||
schema = 'ghostlight.live_fire_matrix_status.v1'
|
||||
state = $state
|
||||
run_root = $resolvedRunRoot
|
||||
production_runtime_touched = $false
|
||||
target_balance = $TargetBalance
|
||||
starting_balance = $startingBalance
|
||||
current_balance = $currentBalance
|
||||
spent = 0
|
||||
scenarios_processed = $processed
|
||||
scenarios_available = $scenarios.Count
|
||||
scenario_start_index = $StartAt
|
||||
scenario_catalog_count = $scenarioCatalogCount
|
||||
resume_run_roots = $resolvedResumeRoots
|
||||
previously_succeeded_skipped = $resumedScenarioIds.Count
|
||||
failures = $failures
|
||||
totals = $totals
|
||||
updated_at_utc = [DateTimeOffset]::UtcNow.ToString('O')
|
||||
}
|
||||
$initialStatus | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath $statusPath -Encoding utf8
|
||||
|
||||
while ($processed -lt $scenarios.Count -and $currentBalance -gt $TargetBalance) {
|
||||
$remainingDollars = $currentBalance - $TargetBalance
|
||||
$batchWidth = if ($remainingDollars -lt 0.15) { 1 } elseif ($remainingDollars -lt 0.40) { [math]::Min(2, $MaxParallel) } else { $MaxParallel }
|
||||
$batch = @($scenarios | Select-Object -Skip $processed -First $batchWidth)
|
||||
if ($batch.Count -eq 0) { break }
|
||||
$runs = @($batch | ForEach-Object { Start-LiveFireScenario $_ })
|
||||
foreach ($run in $runs) {
|
||||
$run.Process.WaitForExit()
|
||||
}
|
||||
foreach ($run in $runs) {
|
||||
$summary = Read-ScenarioSummary $run
|
||||
Add-Content -LiteralPath $summaryPath -Value ($summary | ConvertTo-Json -Compress -Depth 8) -Encoding utf8
|
||||
$processed++
|
||||
if (-not $summary.succeeded) { $failures++ }
|
||||
$totals.prompt_tokens += $summary.prompt_tokens
|
||||
$totals.cache_hit_tokens += $summary.prompt_cache_hit_tokens
|
||||
$totals.cache_miss_tokens += $summary.prompt_cache_miss_tokens
|
||||
$totals.completion_tokens += $summary.completion_tokens
|
||||
$totals.stages += $summary.stage_count
|
||||
$totals.attempts += $summary.provider_attempt_count
|
||||
}
|
||||
$currentBalance = Get-DeepSeekBalance
|
||||
$status = [ordered]@{
|
||||
schema = 'ghostlight.live_fire_matrix_status.v1'
|
||||
state = 'running'
|
||||
run_root = $resolvedRunRoot
|
||||
production_runtime_touched = $false
|
||||
target_balance = $TargetBalance
|
||||
starting_balance = $startingBalance
|
||||
current_balance = $currentBalance
|
||||
spent = $startingBalance - $currentBalance
|
||||
scenarios_processed = $processed
|
||||
scenarios_available = $scenarios.Count
|
||||
scenario_start_index = $StartAt
|
||||
scenario_catalog_count = $scenarioCatalogCount
|
||||
resume_run_roots = $resolvedResumeRoots
|
||||
previously_succeeded_skipped = $resumedScenarioIds.Count
|
||||
failures = $failures
|
||||
totals = $totals
|
||||
updated_at_utc = [DateTimeOffset]::UtcNow.ToString('O')
|
||||
}
|
||||
$status | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath $statusPath -Encoding utf8
|
||||
}
|
||||
|
||||
$state = if ($currentBalance -le $TargetBalance) { 'target_reached' } elseif ($processed -ge $scenarios.Count) { 'scenario_matrix_exhausted' } else { 'stopped' }
|
||||
$finalStatus = [ordered]@{
|
||||
schema = 'ghostlight.live_fire_matrix_status.v1'
|
||||
state = $state
|
||||
run_root = $resolvedRunRoot
|
||||
production_runtime_touched = $false
|
||||
target_balance = $TargetBalance
|
||||
starting_balance = $startingBalance
|
||||
current_balance = $currentBalance
|
||||
spent = $startingBalance - $currentBalance
|
||||
scenarios_processed = $processed
|
||||
scenarios_available = $scenarios.Count
|
||||
scenario_start_index = $StartAt
|
||||
scenario_catalog_count = $scenarioCatalogCount
|
||||
resume_run_roots = $resolvedResumeRoots
|
||||
previously_succeeded_skipped = $resumedScenarioIds.Count
|
||||
failures = $failures
|
||||
totals = $totals
|
||||
summary_path = $summaryPath
|
||||
completed_at_utc = [DateTimeOffset]::UtcNow.ToString('O')
|
||||
}
|
||||
$finalStatus | ConvertTo-Json -Depth 8 | Set-Content -LiteralPath $statusPath -Encoding utf8
|
||||
$finalStatus
|
||||
|
|
@ -1,245 +0,0 @@
|
|||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string[]]$RunRoot,
|
||||
[string]$OutputPath
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
function Get-Percentile([double[]]$Values, [double]$Percentile) {
|
||||
if ($Values.Count -eq 0) { return 0 }
|
||||
$sorted = @($Values | Sort-Object)
|
||||
$index = [math]::Ceiling($Percentile * $sorted.Count) - 1
|
||||
$sorted[[math]::Max(0, [math]::Min($index, $sorted.Count - 1))]
|
||||
}
|
||||
|
||||
function Get-ScenarioKind([string]$ScenarioId) {
|
||||
switch -Regex ($ScenarioId) {
|
||||
'compiler' { 'compiler'; break }
|
||||
'live[-_]turn' { 'live_turn'; break }
|
||||
'action' { 'action'; break }
|
||||
'strategic' { 'strategic'; break }
|
||||
'scale' { 'scale'; break }
|
||||
'gestalt[-_]dynamics' { 'gestalt_dynamics'; break }
|
||||
default { 'unknown' }
|
||||
}
|
||||
}
|
||||
|
||||
function Get-PlanActionCount($Plan) {
|
||||
if (-not $Plan) { return 0 }
|
||||
$count = 0
|
||||
foreach ($property in @('institution_actions', 'gestalt_actions', 'gestalt_activities', 'gestalt_migrations', 'actor_moves', 'member_activities', 'member_migrations')) {
|
||||
if ($Plan.PSObject.Properties.Name -contains $property) {
|
||||
$count += @($Plan.$property).Count
|
||||
}
|
||||
}
|
||||
$count
|
||||
}
|
||||
|
||||
$scenarios = [Collections.Generic.List[object]]::new()
|
||||
$stages = [Collections.Generic.List[object]]::new()
|
||||
$seenResults = [Collections.Generic.HashSet[string]]::new([StringComparer]::OrdinalIgnoreCase)
|
||||
|
||||
foreach ($rootValue in $RunRoot) {
|
||||
$root = [IO.Path]::GetFullPath($rootValue)
|
||||
if (-not (Test-Path -LiteralPath $root -PathType Container)) {
|
||||
throw "Live-fire run root is absent: $root"
|
||||
}
|
||||
$summaryById = @{}
|
||||
$summaryPath = Join-Path $root 'summary.jsonl'
|
||||
if (Test-Path -LiteralPath $summaryPath -PathType Leaf) {
|
||||
foreach ($line in Get-Content -LiteralPath $summaryPath) {
|
||||
if (-not [string]::IsNullOrWhiteSpace($line)) {
|
||||
$summary = $line | ConvertFrom-Json -Depth 100
|
||||
$summaryById[$summary.scenario_id] = $summary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resultFiles = @()
|
||||
$directResult = Join-Path $root 'result.json'
|
||||
if (Test-Path -LiteralPath $directResult -PathType Leaf) {
|
||||
$resultFiles += Get-Item -LiteralPath $directResult
|
||||
}
|
||||
$resultFiles += @(Get-ChildItem -LiteralPath (Join-Path $root 'results') -Filter result.json -File -Recurse -ErrorAction SilentlyContinue)
|
||||
foreach ($file in $resultFiles) {
|
||||
$resultKey = $file.FullName
|
||||
if (-not $seenResults.Add($resultKey)) { continue }
|
||||
$result = Get-Content -LiteralPath $file.FullName -Raw | ConvertFrom-Json -Depth 100
|
||||
$scenarioId = [string]$result.scenario_id
|
||||
$summary = $summaryById[$scenarioId]
|
||||
$kind = if ($summary) { [string]$summary.kind } else { Get-ScenarioKind $scenarioId }
|
||||
$elapsed = if ($result.PSObject.Properties.Name -contains 'elapsed_seconds') {
|
||||
[double]$result.elapsed_seconds
|
||||
} elseif ($result.PSObject.Properties.Name -contains 'total_seconds') {
|
||||
[double]$result.total_seconds
|
||||
} else { 0 }
|
||||
$actionCount = Get-PlanActionCount $result.plan
|
||||
if ($result.PSObject.Properties.Name -contains 'sustained_waves') {
|
||||
foreach ($wave in @($result.sustained_waves)) {
|
||||
$actionCount += Get-PlanActionCount $wave.plan
|
||||
}
|
||||
}
|
||||
$scenarios.Add([pscustomobject]@{
|
||||
run_root = $root
|
||||
scenario_id = $scenarioId
|
||||
kind = $kind
|
||||
succeeded = $true
|
||||
elapsed_seconds = $elapsed
|
||||
verdict = if ($summary) { $summary.verdict } else { $null }
|
||||
result_path = $file.FullName
|
||||
stderr = $null
|
||||
action_count = $actionCount
|
||||
})
|
||||
|
||||
$receipts = @()
|
||||
foreach ($property in @('model_receipts', 'model_stage_receipts')) {
|
||||
if ($result.PSObject.Properties.Name -contains $property) {
|
||||
$receipts = @($result.$property)
|
||||
break
|
||||
}
|
||||
}
|
||||
if ($result.PSObject.Properties.Name -contains 'sustained_waves') {
|
||||
foreach ($wave in @($result.sustained_waves)) {
|
||||
if ($wave.PSObject.Properties.Name -contains 'model_stage_receipts') {
|
||||
$receipts += @($wave.model_stage_receipts)
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($receipt in $receipts) {
|
||||
$prompt = 0L
|
||||
$hit = 0L
|
||||
$miss = 0L
|
||||
$completion = 0L
|
||||
$providerLatency = 0L
|
||||
$attemptCount = 0
|
||||
foreach ($attempt in @($receipt.provider_attempts)) {
|
||||
$attemptCount++
|
||||
$providerLatency += [long]$attempt.latency_ms
|
||||
if ($attempt.token_usage) {
|
||||
$prompt += [long]$attempt.token_usage.prompt_tokens
|
||||
$hit += [long]$attempt.token_usage.prompt_cache_hit_tokens
|
||||
$miss += [long]$attempt.token_usage.prompt_cache_miss_tokens
|
||||
$completion += [long]$attempt.token_usage.completion_tokens
|
||||
}
|
||||
}
|
||||
$stages.Add([pscustomobject]@{
|
||||
run_root = $root
|
||||
scenario_id = $scenarioId
|
||||
kind = $kind
|
||||
stage = [string]$receipt.stage
|
||||
model = [string]$receipt.model
|
||||
validation = [string]$receipt.validation_result
|
||||
accepted = ([string]$receipt.validation_result).StartsWith('valid')
|
||||
latency_ms = [long]$receipt.latency_ms
|
||||
provider_latency_ms = $providerLatency
|
||||
input_chars = [long]$receipt.input_chars
|
||||
output_chars = [long]$receipt.output_chars
|
||||
attempts = $attemptCount
|
||||
prompt_tokens = $prompt
|
||||
cache_hit_tokens = $hit
|
||||
cache_miss_tokens = $miss
|
||||
completion_tokens = $completion
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($summary in $summaryById.Values) {
|
||||
if ($summary.succeeded) { continue }
|
||||
$stderr = if ($summary.stderr_log -and (Test-Path -LiteralPath $summary.stderr_log)) {
|
||||
(Get-Content -LiteralPath $summary.stderr_log -Raw).Trim()
|
||||
} else { $null }
|
||||
$scenarios.Add([pscustomobject]@{
|
||||
run_root = $root
|
||||
scenario_id = [string]$summary.scenario_id
|
||||
kind = [string]$summary.kind
|
||||
succeeded = $false
|
||||
elapsed_seconds = 0
|
||||
verdict = $summary.verdict
|
||||
result_path = $null
|
||||
stderr = $stderr
|
||||
action_count = 0
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
$scenarioGroups = @($scenarios | Group-Object kind | Sort-Object Name | ForEach-Object {
|
||||
$elapsed = @($_.Group | Where-Object succeeded | ForEach-Object { [double]$_.elapsed_seconds })
|
||||
[pscustomobject]@{
|
||||
kind = $_.Name
|
||||
scenarios = $_.Count
|
||||
succeeded = @($_.Group | Where-Object succeeded).Count
|
||||
failed = @($_.Group | Where-Object { -not $_.succeeded }).Count
|
||||
committed_actions = [long](($_.Group | Measure-Object action_count -Sum).Sum)
|
||||
p50_elapsed_seconds = [math]::Round((Get-Percentile $elapsed 0.50), 3)
|
||||
p95_elapsed_seconds = [math]::Round((Get-Percentile $elapsed 0.95), 3)
|
||||
max_elapsed_seconds = [math]::Round((Get-Percentile $elapsed 1.00), 3)
|
||||
}
|
||||
})
|
||||
|
||||
$stageGroups = @($stages | Group-Object stage, model | Sort-Object Name | ForEach-Object {
|
||||
$group = @($_.Group)
|
||||
$prompt = [long](($group | Measure-Object prompt_tokens -Sum).Sum)
|
||||
$hit = [long](($group | Measure-Object cache_hit_tokens -Sum).Sum)
|
||||
$completion = [long](($group | Measure-Object completion_tokens -Sum).Sum)
|
||||
$outputChars = [long](($group | Measure-Object output_chars -Sum).Sum)
|
||||
[pscustomobject]@{
|
||||
stage = $group[0].stage
|
||||
model = $group[0].model
|
||||
receipts = $group.Count
|
||||
accepted = @($group | Where-Object accepted).Count
|
||||
semantic_invalid = @($group | Where-Object { $_.validation -eq 'semantic_invalid' }).Count
|
||||
provider_attempts = [long](($group | Measure-Object attempts -Sum).Sum)
|
||||
p50_latency_ms = [long](Get-Percentile @($group | ForEach-Object { [double]$_.latency_ms }) 0.50)
|
||||
p95_latency_ms = [long](Get-Percentile @($group | ForEach-Object { [double]$_.latency_ms }) 0.95)
|
||||
input_chars = [long](($group | Measure-Object input_chars -Sum).Sum)
|
||||
output_chars = $outputChars
|
||||
prompt_tokens = $prompt
|
||||
cache_hit_tokens = $hit
|
||||
cache_miss_tokens = [long](($group | Measure-Object cache_miss_tokens -Sum).Sum)
|
||||
completion_tokens = $completion
|
||||
cache_hit_ratio = if ($prompt -gt 0) { [math]::Round($hit / $prompt, 4) } else { 0 }
|
||||
output_chars_per_completion_token = if ($completion -gt 0) { [math]::Round($outputChars / $completion, 3) } else { 0 }
|
||||
}
|
||||
})
|
||||
|
||||
$totalPrompt = [long](($stages | Measure-Object prompt_tokens -Sum).Sum)
|
||||
$totalHit = [long](($stages | Measure-Object cache_hit_tokens -Sum).Sum)
|
||||
$totalCompletion = [long](($stages | Measure-Object completion_tokens -Sum).Sum)
|
||||
$totalActions = [long](($scenarios | Measure-Object action_count -Sum).Sum)
|
||||
$invalidStages = @($stages | Where-Object { -not $_.accepted })
|
||||
$report = [ordered]@{
|
||||
schema = 'ghostlight.live_fire_profile.v1'
|
||||
generated_at_utc = [DateTimeOffset]::UtcNow.ToString('O')
|
||||
run_roots = @($RunRoot | ForEach-Object { [IO.Path]::GetFullPath($_) })
|
||||
totals = [ordered]@{
|
||||
scenarios = $scenarios.Count
|
||||
succeeded = @($scenarios | Where-Object succeeded).Count
|
||||
failed = @($scenarios | Where-Object { -not $_.succeeded }).Count
|
||||
stage_receipts = $stages.Count
|
||||
provider_attempts = [long](($stages | Measure-Object attempts -Sum).Sum)
|
||||
prompt_tokens = $totalPrompt
|
||||
cache_hit_tokens = $totalHit
|
||||
cache_miss_tokens = [long](($stages | Measure-Object cache_miss_tokens -Sum).Sum)
|
||||
completion_tokens = $totalCompletion
|
||||
committed_actions = $totalActions
|
||||
prompt_tokens_per_committed_action = if ($totalActions -gt 0) { [math]::Round($totalPrompt / $totalActions, 1) } else { 0 }
|
||||
completion_tokens_per_committed_action = if ($totalActions -gt 0) { [math]::Round($totalCompletion / $totalActions, 1) } else { 0 }
|
||||
cache_hit_ratio = if ($totalPrompt -gt 0) { [math]::Round($totalHit / $totalPrompt, 4) } else { 0 }
|
||||
semantic_invalid_receipts = @($stages | Where-Object { $_.validation -eq 'semantic_invalid' }).Count
|
||||
rejected_prompt_tokens = [long](($invalidStages | Measure-Object prompt_tokens -Sum).Sum)
|
||||
rejected_completion_tokens = [long](($invalidStages | Measure-Object completion_tokens -Sum).Sum)
|
||||
}
|
||||
by_kind = $scenarioGroups
|
||||
by_stage = $stageGroups
|
||||
failures = @($scenarios | Where-Object { -not $_.succeeded } | Select-Object run_root, scenario_id, kind, stderr)
|
||||
}
|
||||
|
||||
$json = $report | ConvertTo-Json -Depth 12
|
||||
if ($OutputPath) {
|
||||
$parent = Split-Path -Parent ([IO.Path]::GetFullPath($OutputPath))
|
||||
if ($parent) { [IO.Directory]::CreateDirectory($parent) | Out-Null }
|
||||
[IO.File]::WriteAllText([IO.Path]::GetFullPath($OutputPath), $json)
|
||||
}
|
||||
$json
|
||||
Loading…
Reference in a new issue