
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Smallville is a javascript library to create custom generative agent simulations in web browsers. Generative Agents use LLM's to create realistic NPC charcters and are most useful for research and video games.
Start a new javascript project
npm init
npm i smallville
Download the compiled jar from releases
const sim = new Smallville({
host: "http://localhost:8080", // host of the server
stateHandler: function(state) {
//in here you would update the location of the agent using your own pathfinding algorithm
const currentLocation = state.agents[0].getCurrentLocation()
const newLocation = state.agents[0].getNextLocation()
const emoji = state.agents[0].getEmoji()
const activity = state.agents[0].getCurrentActivity()
const updatedLocations = state.locations;
const conversations = state.conversations;
console.log('[State Change]: The simulation has been updated')
},
});
Create new location trees
sim.createLocation({
name: 'Barn',
})
sim.createObject({
name: 'Hay Pile',
state: 'Full',
parent: 'Barn'
})
Add new agents and initialize their memory stream with starting memories
sim.createAgent({
name: 'John',
location: 'Barn',
memories: [
"John is a farmer at the Barn",
"John is a nice and outgoing person"
]
})
Increment the time clock. The simulation will get the current time and update the agents state
sim.updateState();
Keep calling sim.updateState whenever you want to update the simulation step
To add new observations to the agent which they will prompt a reaction to use the following method
sim.addObservation({name: "Full Agent Name", observation: "memory description", reactable: true})
Such observations such as encountering another agent or discovering a location should make use of this
For observatonal purposes, you can also ask an agent a question which will use their relevant memories to answer the question
sim.askQuestion("John", "What do you do in your free time")
This will not store the question in the agents memory unless you call sim.addObservation()
Furthermore, locations should be given as a full tree. ex)
location: "Island: Red House: desk"
And the leaf node (in this example desk), should have a state, although it is not necessary. Adding states to leaf locations enables the agents to interact with the world. To get the leaf location and move the agent to the location you can use our utility function getLeafLocation(location) or make your own method.
FAQs
Create custom generative agent simulations
The npm package smallville receives a total of 6 weekly downloads. As such, smallville popularity was classified as not popular.
We found that smallville demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.