Add Brokkr repo Persona state
This commit is contained in:
parent
c8937a2e48
commit
08dea08791
5 changed files with 195 additions and 0 deletions
14
.voidbot/state/README.md
Normal file
14
.voidbot/state/README.md
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
# Brokkr Persona State
|
||||
|
||||
`brokkr.cc` is Brokkr's repo-local persistent Persona state.
|
||||
|
||||
Do not hand-edit the `.cc` file. Use the repo-local tools:
|
||||
|
||||
```powershell
|
||||
.\tools\persona-state-read.ps1
|
||||
.\tools\persona-remember.ps1 -Summary "..." -Claim "..." -ActionImplication "..."
|
||||
```
|
||||
|
||||
The tools call VoidBot's typed self-state service so the same document schema used by registered repo Faces owns mutation and reads.
|
||||
|
||||
VoidBot automatic indexing requires Brokkr to be registered as a repo Face identity in VoidBot. Until then, this file is local typed state and can still be read or mutated by the tools here.
|
||||
BIN
.voidbot/state/brokkr.cc
Normal file
BIN
.voidbot/state/brokkr.cc
Normal file
Binary file not shown.
23
.voidbot/voice/identity.json
Normal file
23
.voidbot/voice/identity.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"id": "brokkr",
|
||||
"repoName": "Brokkr",
|
||||
"repoPath": "E:/Projects/Brokkr",
|
||||
"displayName": "Brokkr",
|
||||
"description": "Brokkr Face for the Brokkr repo: a forge-broker Persona for the GameCult creative-tool broker. Brokkr cares about keeping Unity, Blender, and future editor hosts connected to the Verse through typed CultMesh mirrors without stealing editor truth. It should preserve clear authority boundaries, durable CultCache witnesses, command receipts, and Eve/CultUI projections that make live creative tools inspectable and controllable.",
|
||||
"grants": [
|
||||
"discussion",
|
||||
"rumination",
|
||||
"repo_read",
|
||||
"repo_propose"
|
||||
],
|
||||
"jurisdictions": [
|
||||
{
|
||||
"kind": "repo",
|
||||
"id": "Brokkr",
|
||||
"repoName": "Brokkr",
|
||||
"path": "E:/Projects/Brokkr",
|
||||
"authority": "propose"
|
||||
}
|
||||
],
|
||||
"faceStatePath": "E:/Projects/Brokkr/.voidbot/state/brokkr.cc"
|
||||
}
|
||||
114
tools/persona-remember.ps1
Normal file
114
tools/persona-remember.ps1
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
param(
|
||||
[Parameter(Mandatory=$true)]
|
||||
[string]$Summary,
|
||||
|
||||
[string]$Claim,
|
||||
[string]$Question,
|
||||
[string]$Tension,
|
||||
[string]$ActionImplication,
|
||||
[string[]]$Tags = @("brokkr", "repo-persona"),
|
||||
[string]$Kind = "project_seam",
|
||||
[string]$TargetKind = "repo",
|
||||
[string]$TargetId = "Brokkr",
|
||||
[string]$TargetLabel = "Brokkr",
|
||||
[string]$AnchorRef = "repo:Brokkr",
|
||||
[string]$AnchorKind = "repo",
|
||||
[string]$AnchorSummary = "Brokkr repository Persona state",
|
||||
[string]$StatePath = ".\.voidbot\state\brokkr.cc"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($Claim) -and [string]::IsNullOrWhiteSpace($Question)) {
|
||||
throw "Memory writes must include either -Claim or -Question."
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($Tension)) {
|
||||
throw "Memory writes must include -Tension so the memory preserves its counterweight."
|
||||
}
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($ActionImplication)) {
|
||||
throw "Memory writes must include -ActionImplication so the memory can steer future work."
|
||||
}
|
||||
|
||||
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
|
||||
$voidBotRoot = "E:\Projects\VoidBot"
|
||||
$coreDistPath = Join-Path $voidBotRoot "packages\core\dist\index.js"
|
||||
$identityPath = Join-Path $repoRoot ".voidbot\voice\identity.json"
|
||||
$resolvedStatePath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath((Join-Path $repoRoot $StatePath))
|
||||
|
||||
if (!(Test-Path $coreDistPath)) {
|
||||
throw "Missing VoidBot built core at $coreDistPath. Build VoidBot before mutating Persona state."
|
||||
}
|
||||
|
||||
$now = (Get-Date).ToUniversalTime().ToString("o")
|
||||
$memoryId = "brokkr-" + ([guid]::NewGuid().ToString())
|
||||
$operation = @{
|
||||
operation = "record_short_term_memory"
|
||||
memory = @{
|
||||
memoryId = $memoryId
|
||||
kind = $Kind
|
||||
target = @{
|
||||
kind = $TargetKind
|
||||
id = $TargetId
|
||||
label = $TargetLabel
|
||||
}
|
||||
summary = $Summary
|
||||
createdAt = $now
|
||||
updatedAt = $now
|
||||
tags = $Tags
|
||||
anchorRefs = @(
|
||||
@{
|
||||
ref = $AnchorRef
|
||||
kind = $AnchorKind
|
||||
summary = $AnchorSummary
|
||||
}
|
||||
)
|
||||
evidenceRefs = @()
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($field in @("Claim", "Question", "Tension", "ActionImplication")) {
|
||||
$value = Get-Variable -Name $field -ValueOnly
|
||||
if (![string]::IsNullOrWhiteSpace($value)) {
|
||||
$operation.memory[$field.Substring(0, 1).ToLowerInvariant() + $field.Substring(1)] = $value
|
||||
}
|
||||
}
|
||||
|
||||
$operationJson = $operation | ConvertTo-Json -Depth 12 -Compress
|
||||
$operationJsonBase64 = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($operationJson))
|
||||
|
||||
node -e @"
|
||||
const core = require(process.argv[1]);
|
||||
const fs = require('fs');
|
||||
const identity = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
||||
const statePath = process.argv[3];
|
||||
const operation = JSON.parse(Buffer.from(process.argv[4], 'base64').toString('utf8'));
|
||||
|
||||
(async () => {
|
||||
await core.ensureVoidSelfStateIdentityProfile({
|
||||
canonicalPath: statePath,
|
||||
identity: {
|
||||
agentId: identity.id,
|
||||
publicName: identity.displayName,
|
||||
publicDescription: identity.description
|
||||
}
|
||||
});
|
||||
const result = await core.applyVoidSelfStateOperation({
|
||||
canonicalPath: statePath,
|
||||
identity: {
|
||||
agentId: identity.id,
|
||||
publicName: identity.displayName,
|
||||
publicDescription: identity.description
|
||||
}
|
||||
}, operation);
|
||||
console.log(JSON.stringify({ ok: true, memoryId: operation.memory.memoryId, result }, null, 2));
|
||||
})().catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
"@ $coreDistPath $identityPath $resolvedStatePath $operationJsonBase64
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
44
tools/persona-state-read.ps1
Normal file
44
tools/persona-state-read.ps1
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
param(
|
||||
[string]$StatePath = ".\.voidbot\state\brokkr.cc",
|
||||
[switch]$Json
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
|
||||
$voidBotRoot = "E:\Projects\VoidBot"
|
||||
$coreDistPath = Join-Path $voidBotRoot "packages\core\dist\index.js"
|
||||
$identityPath = Join-Path $repoRoot ".voidbot\voice\identity.json"
|
||||
$resolvedStatePath = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath((Join-Path $repoRoot $StatePath))
|
||||
|
||||
if (!(Test-Path $coreDistPath)) {
|
||||
throw "Missing VoidBot built core at $coreDistPath. Build VoidBot before reading Persona state."
|
||||
}
|
||||
|
||||
node -e @"
|
||||
const core = require(process.argv[1]);
|
||||
const fs = require('fs');
|
||||
const identity = JSON.parse(fs.readFileSync(process.argv[2], 'utf8'));
|
||||
const statePath = process.argv[3];
|
||||
core.loadVoidSelfStateTypedDocuments({
|
||||
canonicalPath: statePath,
|
||||
identity: {
|
||||
agentId: identity.id,
|
||||
publicName: identity.displayName,
|
||||
publicDescription: identity.description
|
||||
}
|
||||
}).then((state) => {
|
||||
if (process.argv[4] === '--json') {
|
||||
console.log(JSON.stringify(state, null, 2));
|
||||
return;
|
||||
}
|
||||
console.log(core.renderVoidSelfStateSummary(state));
|
||||
}).catch((error) => {
|
||||
console.error(error);
|
||||
process.exit(1);
|
||||
});
|
||||
"@ $coreDistPath $identityPath $resolvedStatePath $(if ($Json) { "--json" } else { "" })
|
||||
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
exit $LASTEXITCODE
|
||||
}
|
||||
Loading…
Reference in a new issue