Prove high-risk outcome custody live
This commit is contained in:
parent
4e3cda2ce1
commit
b7524a9700
6 changed files with 223 additions and 5 deletions
|
|
@ -0,0 +1,193 @@
|
|||
#[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![],
|
||||
effect: 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_machine_dpapi(secret)?,
|
||||
calls: calls.clone(),
|
||||
});
|
||||
let started = Instant::now();
|
||||
let resolved = resolve_activity_outcomes(model.as_ref(), &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(())
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ pub async fn resolve_activity_outcomes(
|
|||
.into_iter()
|
||||
.collect();
|
||||
let static_contract = format!(
|
||||
"You are Ghostlight's private strategic outcome resolver. The Interpreter already established each exact constituent's selected attempt; you alone assess opposition and choose its bounded durable result. Resolve every supplied action_digest exactly once. Never add or remove an action. For each action, effect_kind must come from that action's admissible_effect_kinds; this is the runtime's exact projection of locally valid consequence handles. Use only IDs, resources, pressure resolutions, relations, facts, member owners, targets, and state references supplied for that same action. Never mutate the player. Never treat an arena as an actor or union constituents' private state. Prefer the most specific causally supported durable effect when the attempt and its band establish one. A mixed result should preserve bounded progress, cost, or a new unresolved pressure when a supplied handle supports it; do not collapse concrete partial work into no change merely because it is incomplete. Use no_material_change when none of the other supplied handles honestly represents a durable result; success or mixed success does not itself authorize inventing a response, fact, relationship, or resource. A failure may create a pressure or spend a committed resource when causally supported. Every material effect must actually change the supplied state; do not repeat an existing resource, pressure, memory, obligation, relationship description, or known fact. Choose exactly one effect_kind. Populate only its fields and omit every irrelevant optional field. no_material_change requires reason. resource_created creates one bounded branch-local resource for the source only and requires a capability reference. resource_consumed spends one exact existing source resource. resource_transferred gives one exact existing source resource to one supplied resource_recipient_id; it cannot take from a target. Every resource effect's owner_subject_id must copy that action's exact resource_owner_id, including any member: prefix. gestalt_pressure copies one exact pressure_owner_subject_ids value into owner_subject_id; resolutions must copy exact current pressure text. agency_relation_shift uses one supplied active relation and a nonzero delta from -10 through 10. Member memory, obligation, or relationship may change only the supplied member_state_owner_id; member_id omits the member: prefix. A relationship's other_subject_id must be one exact action target. knowledge_learned uses one supplied discoverable fact and teaches only the source. Every material effect needs at least one supplied supporting_state_reference. Return one JSON object and no prose outside JSON.\n\nOUTPUT CONTRACT:\n{OUTCOME_PROPOSAL_OUTPUT_CONTRACT}"
|
||||
"You are Ghostlight's private strategic outcome resolver. The Interpreter already established each exact constituent's selected attempt; you alone assess opposition and choose its bounded durable result. Resolve every supplied action_digest exactly once. Never add or remove an action. For each action, effect_kind must come from that action's admissible_effect_kinds; this is the runtime's exact projection of locally valid consequence handles. Use only IDs, resources, pressure resolutions, relations, facts, member owners, targets, and state references supplied for that same action. Never mutate the player. Never treat an arena as an actor or union constituents' private state. Prefer the most specific causally supported durable effect when the attempt and its band establish one. A mixed result should preserve bounded progress, cost, or a new unresolved pressure when a supplied handle supports it; do not collapse concrete partial work into no change merely because it is incomplete. Use no_material_change when none of the other supplied handles honestly represents a durable result; success or mixed success does not itself authorize inventing a response, fact, relationship, or resource. A failure may create a pressure or spend a committed resource when causally supported. Every material effect must actually change the supplied state; do not repeat an existing resource, pressure, memory, obligation, relationship description, or known fact. Choose exactly one effect_kind. Populate only its fields and omit every irrelevant optional field. no_material_change requires reason. resource_created creates one bounded branch-local resource for the source only and requires a capability reference. resource_consumed spends one exact existing source resource. resource_transferred gives one exact existing source resource to one recipient: copy one exact resource_recipient_ids value into the output field other_subject_id; it cannot take from a target. Every resource effect's owner_subject_id must copy that action's exact resource_owner_id, including any member: prefix. gestalt_pressure copies one exact pressure_owner_subject_ids value into owner_subject_id; resolutions must copy exact current pressure text. agency_relation_shift uses one supplied active relation and a nonzero delta from -10 through 10. Member memory, obligation, or relationship may change only the supplied member_state_owner_id; member_id omits the member: prefix. A relationship's other_subject_id must be one exact action target. knowledge_learned uses one supplied discoverable fact and teaches only the source. Every material effect needs at least one supplied supporting_state_reference. Return one JSON object and no prose outside JSON.\n\nOUTPUT CONTRACT:\n{OUTCOME_PROPOSAL_OUTPUT_CONTRACT}"
|
||||
);
|
||||
let mut request = ModelStageRequest {
|
||||
stage: "strategic_outcome_resolver".into(),
|
||||
|
|
@ -1834,6 +1834,11 @@ mod tests {
|
|||
assert!(requests[0].lived_stream.contains("Do not emit summary"));
|
||||
assert!(requests[0].lived_stream.contains("admissible_effect_kinds"));
|
||||
assert!(requests[0].lived_stream.contains("knowledge_learned"));
|
||||
assert!(
|
||||
requests[0]
|
||||
.lived_stream
|
||||
.contains("resource_recipient_ids value into the output field other_subject_id")
|
||||
);
|
||||
assert_eq!(
|
||||
requests[0].snapshot_binding,
|
||||
activity_outcome_binding(
|
||||
|
|
|
|||
|
|
@ -789,9 +789,20 @@ consequences and seven typed material activity outcomes, with three explicit
|
|||
no-material-change results, zero rejected pulses, exact member attribution,
|
||||
the player unchanged, and the same Mira returning with her persistent delta.
|
||||
It used 126,826 prompt tokens, 14,477 completion tokens, and a 58.34% prompt
|
||||
cache-hit ratio. This proves the ordinary material-outcome path live; the
|
||||
selective high-risk verifier is covered locally and still needs a forced live
|
||||
provider witness.
|
||||
cache-hit ratio. This proves the ordinary material-outcome path live. The
|
||||
selective high-risk verifier was first covered locally, then forced through the
|
||||
provider boundary below.
|
||||
|
||||
That witness now exists at
|
||||
`F:\GameCult\GhostlightDungeon\acceptance\forced-high-risk-outcome-contract-fixed-20260818`.
|
||||
Dock Labor Guild explicitly transferred its exact `west winch rerouting plan`
|
||||
to the colocated Harbor Neighbors. The Flash resolver emitted the exact custody
|
||||
transition, the independent verifier accepted it against the same snapshot,
|
||||
and the canonical input remained byte-identical. The first witness also caught
|
||||
a prompt/schema naming mismatch: prose said `resource_recipient_id` while the
|
||||
schema requires `other_subject_id`. Naming the input-to-output mapping directly
|
||||
removed the correction call; the accepted rerun used exactly two first-attempt-
|
||||
valid provider calls in 2.95 seconds.
|
||||
|
||||
The Starfire deployment smoke ran a live provider-backed wave over three
|
||||
eligible singleton cells, committed three offscreen events and three
|
||||
|
|
|
|||
|
|
@ -93,6 +93,14 @@ it checks custody transfers, relation shifts, and named-member private deltas,
|
|||
while deterministic local validation owns ordinary bounded preparations and
|
||||
pressure changes.
|
||||
|
||||
The selective verifier now has a forced live custody witness. An exact
|
||||
population-owned resource moved to one exact colocated recipient only after a
|
||||
separate Flash verdict accepted the causal match; the source campaign snapshot
|
||||
remained unchanged during resolution. The witness also removed one avoidable
|
||||
provider retry by making the `resource_recipient_ids` input to
|
||||
`other_subject_id` output mapping explicit. The remaining release gate is the
|
||||
authenticated browser journey after rebuilding and deploying this exact commit.
|
||||
|
||||
Multiplayer remains outside the current paid-alpha gate but is now an explicit
|
||||
architectural intention. Do not fork the simulation into a multiplayer room
|
||||
model. After the solo product and Gestalt agency are proven, extend campaign
|
||||
|
|
|
|||
|
|
@ -87,3 +87,4 @@
|
|||
{"ts":"2026-08-18T14:36:02Z","type":"design","status":"accepted","branch":"codex/ghostlight-dungeon-mvp","note":"Multiplayer is an intended post-solo extension of the existing one-WorldKernel, many-actor authority model. Multiple authenticated humans will control distinct actors through the same campaign mailbox, perception gates, initiative, and atomic commit path; no party prompt or room-state authority is introduced. The paid alpha remains single-player while multiresolution Gestalt proof stays the immediate forge priority."}
|
||||
{"ts":"2026-08-18T16:15:00Z","type":"verification","status":"ok","branch":"codex/ghostlight-dungeon-mvp","note":"The provider-backed strategic-outcome golden completed four waves across active-cell budgets 1, 4, 8, and 4 in 81.28 seconds in a debug build. It committed ten durable consequences including seven typed material activity outcomes, recorded three explicit no-material-change results, rejected zero pulses, preserved exact member attribution, left the player unchanged, and returned the same Mira with persistent state. Usage was 126826 prompt tokens, 73984 cache-hit prompt tokens (58.34%), and 14477 completion tokens. The harness now requires a typed material activity outcome. Selective independent semantic verification protects resource custody/transfers, agency-relation shifts, and named-member private deltas; its local regressions pass, while a forced live high-risk witness remains outstanding. Witness: F:\\GameCult\\GhostlightDungeon\\acceptance\\outcome-risk-verifier-20260818\\result.json."}
|
||||
{"ts":"2026-08-18T17:27:00Z","type":"deployment","status":"ok","branch":"codex/ghostlight-dungeon-mvp","note":"Starfire activated immutable GhostlightDungeon release 9367ad13292863ed3bf0159e4d5164b3ecb7d77d with executable SHA-256 043bc72b1e00257e5052d62fc071468ffd52945a4bb7a441a7c732313ec4ebe6. Active junction, manifest, binary hash, embedded typed-health commit, one persisted campaign, DeepSeek readiness, HTTP 401 for unauthenticated surface access, browser-rendered invite gate, and explicit stop/start recovery agree. Deployment first exposed that an Odin RUDP connection reset could terminate startup; release 9367ad1 demotes outbound rendezvous to best-effort replication while preserving the canonical local CultMesh projection, with a regression proving unavailable Odin cannot take away health or schema state."}
|
||||
{"ts":"2026-08-18T17:40:00Z","type":"verification","status":"ok","branch":"codex/ghostlight-dungeon-mvp","note":"Forced provider-backed high-risk outcome witness transferred Dock Labor Guild's exact west winch rerouting plan to the colocated Harbor Neighbors. The strategic outcome resolver and independent semantic verifier each returned first-attempt-valid typed output against digest-bound same-snapshot requests; canonical campaign input remained byte-identical. The initial witness exposed a resource_recipient_id versus other_subject_id prompt/schema mismatch and spent one correction call. After the contract named the exact input-to-output mapping, the accepted rerun completed in 2.945 seconds with exactly two provider calls. Witness: F:\\GameCult\\GhostlightDungeon\\acceptance\\forced-high-risk-outcome-contract-fixed-20260818\\result.json."}
|
||||
|
|
|
|||
|
|
@ -271,5 +271,5 @@ data_flow:
|
|||
|
||||
current_status:
|
||||
summary: Starfire now serves immutable release 9367ad13292863ed3bf0159e4d5164b3ecb7d77d. Its embedded health commit, release manifest, executable SHA-256, active junction, persisted campaign, DeepSeek startup probe, unauthenticated rejection, browser invite gate, and stop/start recovery agree. A real deployment exposed and repaired an ownership bug: unavailable Odin rendezvous no longer kills the daemon or prevents the canonical local CultMesh projection. The provider-backed material-outcome golden remains clean across budgets 1, 4, 8, and 4 with zero rejected pulses, ten durable consequences, seven typed material outcomes, exact member binding, no player mutation, and Mira continuity.
|
||||
next_action: Begin supervised human playtesting with one invite while preserving the second tester lane. Before calling the alpha broadly hardened, force one live high-risk outcome-verifier witness and complete an authenticated exact-release browser journey; continue measuring composite consequences, retries, cache hits, and dramatic yield per token.
|
||||
next_action: Commit, deploy, and authenticate through the exact release containing the forced high-risk outcome witness and recipient-field contract fix. Exercise campaign selection, surface rendering, and one harmless command through a disposable invite, then restart and prove session/campaign persistence before beginning supervised human playtesting.
|
||||
gestalt_population: Gestalt Personas own shared population baselines; persistent member deltas own named individuality; WorldKernel materialization and approval-gated fission preserve lineage and identity. Presence projection is limited to nearby active leaves and exact-location dormant members, includes reciprocal player relationship evidence, and may propose an earned cast without committing it. Simulation cells are derived covers only.
|
||||
|
|
|
|||
Loading…
Reference in a new issue