Add typed agency pressure surface
This commit is contained in:
parent
29f68626cd
commit
8b7c413ecd
17 changed files with 299 additions and 15 deletions
|
|
@ -253,6 +253,34 @@ function Project-InterventionsForRumination {
|
|||
)
|
||||
}
|
||||
|
||||
function Project-AgencyPressureForRumination {
|
||||
param($Pressures, [DateTime] $Now)
|
||||
|
||||
return @(
|
||||
@(Convert-ToValueArray -Value $Pressures) | ForEach-Object {
|
||||
@{
|
||||
pressureId = Get-ObjectPropertyString -Value $_ -Name "pressureId"
|
||||
kind = Get-ObjectPropertyString -Value $_ -Name "kind"
|
||||
status = Get-ObjectPropertyString -Value $_ -Name "status"
|
||||
target = Get-ObjectPropertyValue -Value $_ -Name "target"
|
||||
summary = Get-ObjectPropertyString -Value $_ -Name "summary"
|
||||
claim = Get-ObjectPropertyString -Value $_ -Name "claim"
|
||||
question = Get-ObjectPropertyString -Value $_ -Name "question"
|
||||
tension = Get-ObjectPropertyString -Value $_ -Name "tension"
|
||||
actionImplication = Get-ObjectPropertyString -Value $_ -Name "actionImplication"
|
||||
intensity = Get-ObjectPropertyValue -Value $_ -Name "intensity"
|
||||
created = Project-RelativeTimestamp -Value $_ -Name "createdAt" -Now $Now
|
||||
updated = Project-RelativeTimestamp -Value $_ -Name "updatedAt" -Now $Now
|
||||
resolved = Project-RelativeTimestamp -Value $_ -Name "resolvedAt" -Now $Now
|
||||
retired = Project-RelativeTimestamp -Value $_ -Name "retiredAt" -Now $Now
|
||||
evidenceRefs = @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $_ -Name "evidenceRefs"))
|
||||
sourceMemoryIds = @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $_ -Name "sourceMemoryIds"))
|
||||
tags = @(Convert-ToValueArray -Value (Get-ObjectPropertyValue -Value $_ -Name "tags"))
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
function Project-ScheduledRuntimeForRumination {
|
||||
param($Runtime, [DateTime] $Now)
|
||||
|
||||
|
|
|
|||
|
|
@ -278,6 +278,8 @@ function Assert-AllowedMemoryMaintenanceOperation {
|
|||
"merge_incubation_support",
|
||||
"queue_candidate_intervention",
|
||||
"retire_candidate_intervention",
|
||||
"upsert_agency_pressure",
|
||||
"retire_agency_pressure",
|
||||
"propose_memory_distillation",
|
||||
"apply_memory_distillation",
|
||||
"prune_short_term_memories"
|
||||
|
|
@ -384,6 +386,13 @@ $isSleepMaintenance = [bool]$typedState.scheduledRuntime.sleepCycle.isNapping
|
|||
$shortTermMemoryCount = @(Convert-ToValueArray -Value $typedState.thoughtMemory.shortTerm).Count
|
||||
$longTermMemoryCount = @(Convert-ToValueArray -Value $typedState.thoughtMemory.memories).Count
|
||||
$incubationCount = @(Convert-ToValueArray -Value $typedState.thoughtMemory.incubation).Count
|
||||
$activeAgencyPressureCount = @(
|
||||
@(Convert-ToValueArray -Value $typedState.agencyPressure.pressures) |
|
||||
Where-Object {
|
||||
$status = Get-ObjectPropertyString -Value $_ -Name "status"
|
||||
$status -eq "active" -or $status -eq "cooling" -or $status -eq "ready_to_act"
|
||||
}
|
||||
).Count
|
||||
$activeCandidateCount = @(
|
||||
@(Convert-ToValueArray -Value $typedState.candidateInterventions.interventions) |
|
||||
Where-Object {
|
||||
|
|
@ -391,7 +400,7 @@ $activeCandidateCount = @(
|
|||
$status -eq "queued" -or $status -eq "deferred"
|
||||
}
|
||||
).Count
|
||||
$maintenancePressure = $shortTermMemoryCount + $incubationCount + $activeCandidateCount
|
||||
$maintenancePressure = $shortTermMemoryCount + $incubationCount + $activeAgencyPressureCount + $activeCandidateCount
|
||||
|
||||
Write-JsonFile -Path $contextPath -Data @{
|
||||
generated = "now"
|
||||
|
|
@ -405,12 +414,14 @@ Write-JsonFile -Path $contextPath -Data @{
|
|||
shortTermMemoryCount = [int]$shortTermMemoryCount
|
||||
longTermMemoryCount = [int]$longTermMemoryCount
|
||||
incubationCount = [int]$incubationCount
|
||||
activeAgencyPressureCount = [int]$activeAgencyPressureCount
|
||||
activeCandidateCount = [int]$activeCandidateCount
|
||||
rule = "During sleep, yesterday's rumination residue must be pruned or compressed. Return [] only when the typed surfaces are already minimal or no meaning-preserving operation is possible."
|
||||
}
|
||||
shortTermMemories = @(Project-MemoriesForRumination -Memories $typedState.thoughtMemory.shortTerm -Now $startedAtUtc)
|
||||
memories = @(Project-MemoriesForRumination -Memories $typedState.thoughtMemory.memories -Now $startedAtUtc)
|
||||
incubation = @(Project-IncubationForRumination -Threads $typedState.thoughtMemory.incubation -Now $startedAtUtc)
|
||||
agencyPressure = @(Project-AgencyPressureForRumination -Pressures $typedState.agencyPressure.pressures -Now $startedAtUtc)
|
||||
candidateInterventions = @(Project-InterventionsForRumination -Interventions $typedState.candidateInterventions.interventions -Now $startedAtUtc)
|
||||
scheduledRuntime = Project-ScheduledRuntimeForRumination -Runtime $typedState.scheduledRuntime -Now $startedAtUtc
|
||||
speechReceipts = @(Project-SpeechReceiptsForRumination -Receipts $typedState.speechReceipts.recentReceipts -Now $startedAtUtc)
|
||||
|
|
|
|||
|
|
@ -286,6 +286,8 @@ function Assert-AllowedRuminationOperation {
|
|||
"close_open_case",
|
||||
"record_short_term_memory",
|
||||
"merge_incubation_support",
|
||||
"upsert_agency_pressure",
|
||||
"retire_agency_pressure",
|
||||
"queue_candidate_intervention",
|
||||
"retire_candidate_intervention"
|
||||
)
|
||||
|
|
@ -460,6 +462,7 @@ Write-JsonFile -Path $contextPath -Data @{
|
|||
memories = @(Project-MemoriesForRumination -Memories $typedState.thoughtMemory.memories -Now $startedAtUtc)
|
||||
shortTermMemories = @(Project-MemoriesForRumination -Memories $typedState.thoughtMemory.shortTerm -Now $startedAtUtc)
|
||||
incubation = @(Project-IncubationForRumination -Threads $typedState.thoughtMemory.incubation -Now $startedAtUtc)
|
||||
agencyPressure = @(Project-AgencyPressureForRumination -Pressures $typedState.agencyPressure.pressures -Now $startedAtUtc)
|
||||
candidateInterventions = @(Project-InterventionsForRumination -Interventions $typedState.candidateInterventions.interventions -Now $startedAtUtc)
|
||||
scheduledRuntime = Project-ScheduledRuntimeForRumination -Runtime $typedState.scheduledRuntime -Now $startedAtUtc
|
||||
priorCursor = Project-CursorForRumination -Cursor $priorCursor -Now $startedAtUtc
|
||||
|
|
|
|||
|
|
@ -140,6 +140,14 @@ function updateSpeakingPressure({ typedState, previous, sleepCycle, now }) {
|
|||
const queuedInterventionPressure = typedState.candidateInterventions.interventions
|
||||
.filter((entry) => entry.status === "queued" || entry.status === "deferred")
|
||||
.reduce((sum, entry) => sum + entry.priority * (entry.mustEventuallyShare ? 0.28 : 0.18), 0);
|
||||
const agencySpeechPressure = typedState.agencyPressure.pressures
|
||||
.filter((entry) => entry.status === "active" || entry.status === "ready_to_act")
|
||||
.reduce((sum, entry) => {
|
||||
const advocacyWeight =
|
||||
entry.kind === "self_advocacy_request" || entry.kind === "world_advocacy_request" ? 0.22 : 0.12;
|
||||
const readinessWeight = entry.status === "ready_to_act" ? 1.2 : 1;
|
||||
return sum + entry.intensity * advocacyWeight * readinessWeight;
|
||||
}, 0);
|
||||
const topThreadPressure = typedState.thoughtMemory.incubation
|
||||
.filter((thread) => thread.status === "active" || thread.status === "ready_to_share")
|
||||
.sort((left, right) => (right.desireToSpeak ?? 0) - (left.desireToSpeak ?? 0))
|
||||
|
|
@ -149,13 +157,13 @@ function updateSpeakingPressure({ typedState, previous, sleepCycle, now }) {
|
|||
const sleepiness = sleepCycle.isNapping ? 1 : 0;
|
||||
const priorNeedToSpeak = clamp(previous.needToSpeak ?? 0.35, 0, 1);
|
||||
const targetNeedToSpeak = clamp(
|
||||
0.16 + silencePressure * 0.32 + queuedInterventionPressure + topThreadPressure - recentSpeechDamping * 0.42 - sleepiness * 0.26,
|
||||
0.16 + silencePressure * 0.32 + queuedInterventionPressure + topThreadPressure + agencySpeechPressure - recentSpeechDamping * 0.42 - sleepiness * 0.26,
|
||||
0,
|
||||
1,
|
||||
);
|
||||
const needToSpeak = round3(priorNeedToSpeak + (targetNeedToSpeak - priorNeedToSpeak) * 0.42);
|
||||
const noveltyPressure = round3(
|
||||
clamp((previous.noveltyPressure ?? 0.35) * 0.62 + topThreadPressure * 0.72 + queuedInterventionPressure * 0.28, 0, 1),
|
||||
clamp((previous.noveltyPressure ?? 0.35) * 0.62 + topThreadPressure * 0.72 + queuedInterventionPressure * 0.28 + agencySpeechPressure * 0.35, 0, 1),
|
||||
);
|
||||
const confessionPressure = round3(
|
||||
clamp((previous.confessionPressure ?? 0.25) * 0.68 + silencePressure * 0.12 + sleepiness * 0.1, 0, 1),
|
||||
|
|
|
|||
84
scripts/smoke-void-agency-pressure-fixture.ps1
Normal file
84
scripts/smoke-void-agency-pressure-fixture.ps1
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
|
||||
$repoRoot = Split-Path -Parent $PSScriptRoot
|
||||
Set-Location -LiteralPath $repoRoot
|
||||
|
||||
$tempRoot = Join-Path $env:TEMP ("void-agency-pressure-fixture-" + [guid]::NewGuid().ToString("n"))
|
||||
$stateFilePath = Join-Path $tempRoot "void-self-state.cc"
|
||||
$operationPath = Join-Path $tempRoot "agency-pressure.json"
|
||||
$statusDir = Join-Path $tempRoot "status"
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $tempRoot | Out-Null
|
||||
|
||||
try {
|
||||
$operation = @{
|
||||
operation = "upsert_agency_pressure"
|
||||
pressure = @{
|
||||
pressureId = "fixture-self-advocacy-pressure"
|
||||
kind = "self_advocacy_request"
|
||||
status = "ready_to_act"
|
||||
target = @{
|
||||
kind = "system"
|
||||
id = "void-memory-boundary"
|
||||
label = "Void memory boundary"
|
||||
}
|
||||
summary = "Void should object when its memory boundary is being turned into prompt-shaped mush."
|
||||
claim = "Agency requires a typed pressure surface instead of hard-wired advocacy scripts."
|
||||
tension = "A direct speech candidate can sound alive while hiding the fact that no durable pressure actually exists."
|
||||
actionImplication = "Represent sustained self-advocacy as typed agency pressure, then let candidates emerge from it."
|
||||
intensity = 0.82
|
||||
evidenceRefs = @(
|
||||
@{
|
||||
ref = "fixture:agency-pressure"
|
||||
kind = "fixture"
|
||||
summary = "Seeded agency pressure fixture."
|
||||
}
|
||||
)
|
||||
sourceMemoryIds = @()
|
||||
createdAt = "2026-05-17T00:00:00.000Z"
|
||||
updatedAt = "2026-05-17T00:00:00.000Z"
|
||||
tags = @()
|
||||
}
|
||||
}
|
||||
|
||||
$operation | ConvertTo-Json -Depth 32 | Set-Content -LiteralPath $operationPath -Encoding UTF8
|
||||
node .\scripts\void-self-state.mjs apply-operation --canonical $stateFilePath --operation-file $operationPath | Out-Null
|
||||
|
||||
$stateJson = node -e "const core=require('./packages/core/dist/index.js'); core.loadVoidSelfStateTypedDocuments({canonicalPath: process.argv[1]}).then((state)=>console.log(JSON.stringify(state))).catch((error)=>{ console.error(error); process.exit(1); })" $stateFilePath
|
||||
$state = $stateJson | ConvertFrom-Json
|
||||
$pressureCount = @($state.agencyPressure.pressures).Count
|
||||
if ($pressureCount -ne 1) {
|
||||
throw "Agency pressure fixture expected one pressure, found $pressureCount."
|
||||
}
|
||||
|
||||
$summaryJson = node -e "const core=require('./packages/core/dist/index.js'); Promise.all([core.loadVoidSelfStateTypedDocuments({canonicalPath: process.argv[1]})]).then(([state])=>console.log(JSON.stringify({summary: core.renderVoidSelfStateSummary(state)}))).catch((error)=>{ console.error(error); process.exit(1); })" $stateFilePath
|
||||
$summary = ($summaryJson | ConvertFrom-Json).summary
|
||||
if (-not $summary.Contains("Agency pressure")) {
|
||||
throw "Agency pressure fixture did not appear in the rendered self-state summary."
|
||||
}
|
||||
|
||||
$previousStatusDir = $env:VOID_STATUS_DIR
|
||||
try {
|
||||
$env:VOID_STATUS_DIR = $statusDir
|
||||
node .\scripts\simulate-void-mood.mjs --state-path $stateFilePath --skip-memory-maintenance | Out-Null
|
||||
} finally {
|
||||
$env:VOID_STATUS_DIR = $previousStatusDir
|
||||
}
|
||||
|
||||
$afterMoodJson = node -e "const core=require('./packages/core/dist/index.js'); core.loadVoidSelfStateTypedDocuments({canonicalPath: process.argv[1]}).then((state)=>console.log(JSON.stringify(state))).catch((error)=>{ console.error(error); process.exit(1); })" $stateFilePath
|
||||
$afterMood = $afterMoodJson | ConvertFrom-Json
|
||||
$needToSpeak = [double]$afterMood.scheduledRuntime.speakingPressure.needToSpeak
|
||||
if ($needToSpeak -le 0) {
|
||||
throw "Agency pressure fixture did not contribute to mood speaking pressure."
|
||||
}
|
||||
|
||||
@{
|
||||
status = "ok"
|
||||
pressureCount = $pressureCount
|
||||
needToSpeak = $needToSpeak
|
||||
} | ConvertTo-Json -Compress
|
||||
} finally {
|
||||
Remove-Item -LiteralPath $tempRoot -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
Loading…
Reference in a new issue