Class: ContextFirewall
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:56
ContextFirewall manages the isolation between Private (Assistant) and Public (Citizen) modes.
Example
const firewall = new ContextFirewall('seed-123', {
mode: 'public',
privateTools: ['calendar', 'file_search'],
publicTools: ['social_post'],
sharedMemory: false,
});
firewall.isToolAllowed('social_post'); // true
firewall.isToolAllowed('calendar'); // false
firewall.isUserPromptAllowed(); // false
Constructors
Constructor
new ContextFirewall(
seedId,config?):ContextFirewall
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:60
Parameters
seedId
string
config?
Partial<ContextFirewallConfig>
Returns
ContextFirewall
Methods
canPost()
canPost():
boolean
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:128
Checks if the social_post tool is available. Only available in 'public' mode.
Returns
boolean
getAllowedTools()
getAllowedTools():
string[]
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:135
Gets the list of allowed tools for the current mode.
Returns
string[]
getBridgedMemoryCategories()
getBridgedMemoryCategories():
string[]
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:150
Gets the memory categories that are bridged between modes. Only relevant when sharedMemory is true.
Returns
string[]
getMode()
getMode():
AgentMode
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:74
Gets the current operating mode.
Returns
getState()
getState():
object
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:219
Returns a serializable representation of the firewall state.
Returns
object
allowedTools
allowedTools:
string[]
canPost
canPost:
boolean
mode
mode:
AgentMode
seedId
seedId:
string
sharedMemory
sharedMemory:
boolean
toolAccessProfile?
optionaltoolAccessProfile?:string
userPromptsAllowed
userPromptsAllowed:
boolean
isMemoryShared()
isMemoryShared():
boolean
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:142
Checks if memory should be shared between modes.
Returns
boolean
isToolAllowed()
isToolAllowed(
toolId):boolean
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:111
Checks if a tool is allowed in the current mode.
Parameters
toolId
string
Returns
boolean
isUserPromptAllowed()
isUserPromptAllowed():
boolean
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:120
Checks if user prompts are allowed in the current mode. Returns false in 'public' mode — this is the core "no prompting" enforcement.
Returns
boolean
setMode()
setMode(
mode):void
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:82
Switches operating mode. In production, mode transitions should be logged for audit.
Parameters
mode
Returns
void
validateRequest()
validateRequest(
request):object
Defined in: .source/wunderland/src/autonomy/social/ContextFirewall.ts:160
Validates that a request is allowed in the current context.
Parameters
request
memoryCategory?
string
toolId?
string
type
"user_prompt" | "stimulus" | "tool_call" | "memory_access"
Returns
object
Object with allowed boolean and reason if blocked
allowed
allowed:
boolean
reason?
optionalreason?:string