@mindot/will 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +777 -0
- package/dist/index.d.ts +8144 -0
- package/dist/index.js +26231 -0
- package/dist/index.js.map +1 -0
- package/package.json +73 -0
- package/src/cognition/agency/access.grants.ts +59 -0
- package/src/cognition/agency/competence.codec.ts +89 -0
- package/src/cognition/agency/engines/action.selector.ts +462 -0
- package/src/cognition/agency/engines/affordance.synthesizer.ts +384 -0
- package/src/cognition/agency/engines/deliberation.engine.ts +241 -0
- package/src/cognition/agency/engines/instruction.intake.ts +54 -0
- package/src/cognition/agency/engines/motor.schema.executor.ts +532 -0
- package/src/cognition/agency/engines/reafference.engine.ts +241 -0
- package/src/cognition/agency/execution.primitives.ts +118 -0
- package/src/cognition/agency/index.ts +58 -0
- package/src/cognition/agency/proactive.communicator.ts +274 -0
- package/src/cognition/agency/reconcile.learning.ts +82 -0
- package/src/cognition/agency/schemas/external.ts +59 -0
- package/src/cognition/agency/schemas/innate.ts +111 -0
- package/src/cognition/agency/schemas/repertoire.ts +246 -0
- package/src/cognition/agency/selection.scoring.ts +191 -0
- package/src/cognition/agency/types.ts +165 -0
- package/src/cognition/bus.ts +391 -0
- package/src/cognition/completion.inbox.ts +86 -0
- package/src/cognition/config.mirror.entities.ts +475 -0
- package/src/cognition/conversation.memory.ts +81 -0
- package/src/cognition/event.log.ts +116 -0
- package/src/cognition/event.schemas.ts +568 -0
- package/src/cognition/faculties/aesthetic.evaluator.ts +313 -0
- package/src/cognition/faculties/affective.blender.ts +562 -0
- package/src/cognition/faculties/attachment.evaluator.ts +432 -0
- package/src/cognition/faculties/attention.allocator.ts +422 -0
- package/src/cognition/faculties/autobiographical.narrator.ts +300 -0
- package/src/cognition/faculties/bias.detector.ts +363 -0
- package/src/cognition/faculties/circadian.oscillator.ts +294 -0
- package/src/cognition/faculties/confidence.calibrator.ts +324 -0
- package/src/cognition/faculties/dream.simulator.ts +251 -0
- package/src/cognition/faculties/empathy.simulator.ts +253 -0
- package/src/cognition/faculties/energy.regulator.ts +320 -0
- package/src/cognition/faculties/episodic.consolidator.ts +728 -0
- package/src/cognition/faculties/executive.engine/commands.ts +459 -0
- package/src/cognition/faculties/executive.engine/config.ts +46 -0
- package/src/cognition/faculties/executive.engine/context.ts +605 -0
- package/src/cognition/faculties/executive.engine/deferred.effects.ts +104 -0
- package/src/cognition/faculties/executive.engine/deliberate.reasoning.ts +60 -0
- package/src/cognition/faculties/executive.engine/effort.gate.ts +114 -0
- package/src/cognition/faculties/executive.engine/engine.ts +1028 -0
- package/src/cognition/faculties/executive.engine/escalation.buffer.ts +90 -0
- package/src/cognition/faculties/executive.engine/facet.supervisor.ts +271 -0
- package/src/cognition/faculties/executive.engine/facet.ts +628 -0
- package/src/cognition/faculties/executive.engine/gating.ts +222 -0
- package/src/cognition/faculties/executive.engine/index.ts +6 -0
- package/src/cognition/faculties/executive.engine/messages.ts +102 -0
- package/src/cognition/faculties/executive.engine/parser.ts +380 -0
- package/src/cognition/faculties/executive.engine/prompt.factory.ts +1053 -0
- package/src/cognition/faculties/executive.engine/types.ts +323 -0
- package/src/cognition/faculties/exteroception.ts +338 -0
- package/src/cognition/faculties/forgetting.curve.ts +202 -0
- package/src/cognition/faculties/frustration.evaluator.ts +280 -0
- package/src/cognition/faculties/goal.manager.ts +1008 -0
- package/src/cognition/faculties/inhibition.controller.ts +351 -0
- package/src/cognition/faculties/interoception.ts +417 -0
- package/src/cognition/faculties/introspection.engine.ts +246 -0
- package/src/cognition/faculties/known.entity.tracker.ts +439 -0
- package/src/cognition/faculties/loss.evaluator.ts +224 -0
- package/src/cognition/faculties/moral.evaluator.ts +437 -0
- package/src/cognition/faculties/novelty.detector.ts +254 -0
- package/src/cognition/faculties/persona.consolidator.ts +845 -0
- package/src/cognition/faculties/planning.engine/engine.ts +859 -0
- package/src/cognition/faculties/planning.engine/plan.frontier.ts +83 -0
- package/src/cognition/faculties/planning.engine/plan.store.ts +174 -0
- package/src/cognition/faculties/planning.engine/plan.supervision.ts +494 -0
- package/src/cognition/faculties/planning.engine/types.ts +143 -0
- package/src/cognition/faculties/reputation.tracker.ts +294 -0
- package/src/cognition/faculties/reward.evaluator.ts +304 -0
- package/src/cognition/faculties/self.model.updater.ts +677 -0
- package/src/cognition/faculties/semantic.engine/clustering.ts +673 -0
- package/src/cognition/faculties/semantic.engine/index.ts +6 -0
- package/src/cognition/faculties/semantic.engine/integrator.ts +750 -0
- package/src/cognition/faculties/semantic.engine/types.ts +53 -0
- package/src/cognition/faculties/sleep.pressure.regulator.ts +262 -0
- package/src/cognition/faculties/social.perception.ts +333 -0
- package/src/cognition/faculties/spaced.repetition.ts +605 -0
- package/src/cognition/faculties/stress.regulator.ts +375 -0
- package/src/cognition/faculties/task.switcher.ts +239 -0
- package/src/cognition/faculties/theory.of.mind.ts +333 -0
- package/src/cognition/faculties/threat.evaluator.ts +312 -0
- package/src/cognition/faculties/working.memory.ts +406 -0
- package/src/cognition/generative.model.ts +344 -0
- package/src/cognition/heartbeat.ts +70 -0
- package/src/cognition/index.ts +291 -0
- package/src/cognition/instruction.handler.ts +146 -0
- package/src/cognition/memory/index.ts +35 -0
- package/src/cognition/memory/vector.adapter.ts +316 -0
- package/src/cognition/memory/vector.content.ts +47 -0
- package/src/cognition/memory/vector.embedder.ts +212 -0
- package/src/cognition/memory/vector.index.ts +459 -0
- package/src/cognition/memory/vector.types.ts +65 -0
- package/src/cognition/orchestrator.ts +142 -0
- package/src/cognition/persona.prior.ts +265 -0
- package/src/cognition/schema.registry.ts +145 -0
- package/src/cognition/senses/audition.engine/engine.ts +976 -0
- package/src/cognition/senses/audition.engine/salience.ts +59 -0
- package/src/cognition/senses/base.sense.engine.ts +117 -0
- package/src/cognition/senses/gustation.engine.ts +24 -0
- package/src/cognition/senses/index.ts +172 -0
- package/src/cognition/senses/olfaction.engine.ts +24 -0
- package/src/cognition/senses/somatosensation.engine.ts +23 -0
- package/src/cognition/senses/vision.engine.ts +23 -0
- package/src/cognition/types.ts +63 -0
- package/src/cognition/utilities/token.tracker.ts +492 -0
- package/src/core/abstracts.ts +60 -0
- package/src/core/async.engine.ts +539 -0
- package/src/core/clock.ts +196 -0
- package/src/core/completion.recorder.ts +122 -0
- package/src/core/conflict.detector.ts +140 -0
- package/src/core/distributed.ts +626 -0
- package/src/core/event.bus.ts +292 -0
- package/src/core/inbound.recorder.ts +100 -0
- package/src/core/index.ts +167 -0
- package/src/core/logger.ts +85 -0
- package/src/core/metrics.ts +107 -0
- package/src/core/orchestrator.ts +625 -0
- package/src/core/replay.ts +589 -0
- package/src/core/scenario.ts +120 -0
- package/src/core/serialization.ts +448 -0
- package/src/core/simulation.ts +197 -0
- package/src/core/snapshot.manager.ts +293 -0
- package/src/core/state.manager.ts +283 -0
- package/src/core/types.ts +274 -0
- package/src/core/utils.ts +82 -0
- package/src/core/wall.clock.ts +23 -0
- package/src/extensions/livestream.ext.ts +570 -0
- package/src/extensions/time.ext.ts +339 -0
- package/src/index.ts +91 -0
- package/src/llm/gate.ts +140 -0
- package/src/llm/index.ts +716 -0
- package/src/llm/summarizer.ts +170 -0
- package/src/llm/wire.contracts.ts +67 -0
- package/src/pma/eval.ts +651 -0
- package/src/pma/index.ts +1082 -0
- package/src/profiles/built-in.ts +7 -0
- package/src/profiles/companion.ts +28 -0
- package/src/profiles/company-brain.ts +54 -0
- package/src/profiles/customer-service.ts +30 -0
- package/src/profiles/game-npc.ts +20 -0
- package/src/profiles/index.ts +42 -0
- package/src/profiles/smart-home.ts +34 -0
- package/src/runners/coherence.runner.ts +49 -0
- package/src/runners/outreach.runner.ts +158 -0
- package/src/runners/social.runner.ts +182 -0
- package/src/runners/thin-shim.runner.ts +195 -0
- package/src/sdk/will.ts +334 -0
- package/src/stem/assembly.audit.ts +88 -0
- package/src/stem/distribution.ts +203 -0
- package/src/stem/guards/identity.coherence.ts +152 -0
- package/src/stem/guards/identity.guard.ts +227 -0
- package/src/stem/index.ts +1145 -0
- package/src/stem/mind.ts +1090 -0
- package/src/stem/tracts/ack.reconciler.ts +55 -0
- package/src/stem/tracts/biography.writer.ts +190 -0
- package/src/stem/tracts/effector.controller.ts +143 -0
- package/src/stem/tracts/health.reporter.ts +113 -0
- package/src/stem/tracts/inbound.queue.ts +54 -0
- package/src/stem/tracts/outbox.controller.ts +167 -0
- package/src/stem/tracts/outbox.writer.ts +133 -0
- package/src/stem/tracts/pma.controller.ts +109 -0
- package/src/stem/tracts/replay.controller.ts +177 -0
- package/src/stem/tracts/sensory.controller.ts +168 -0
- package/src/stem/tracts/session.logger.ts +157 -0
- package/src/stem/tracts/transport/index.ts +38 -0
- package/src/stem/tracts/transport/loopback.transport.ts +86 -0
- package/src/stem/tracts/transport/socketio.transport.ts +200 -0
- package/src/stem/tracts/transport/stream.transport.ts +152 -0
- package/src/stem/tracts/transport/types.ts +193 -0
- package/src/stem/tracts/transport.controller.ts +380 -0
- package/src/types.ts +116 -0
package/package.json
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mindot/will",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Will β an engine for persistent machine minds. A Will is a continuously-ticking synthetic mind built from 38 cognitive faculties, a learning agency pipeline, and a dual-process executive β deterministic, persistent, and portable (PMA).",
|
|
5
|
+
"author": "Fabrice <fabrice8@github.com>",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"packageManager": "bun@1.3.9",
|
|
8
|
+
"engines": {
|
|
9
|
+
"bun": ">=1.0.0"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/mindot-ai/will#readme",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/mindot-ai/will.git"
|
|
15
|
+
},
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/mindot-ai/will/issues"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"ai",
|
|
21
|
+
"agent",
|
|
22
|
+
"ai-agents",
|
|
23
|
+
"cognitive-architecture",
|
|
24
|
+
"generative-agents",
|
|
25
|
+
"persistent-memory",
|
|
26
|
+
"simulation",
|
|
27
|
+
"autonomous-agent",
|
|
28
|
+
"llm",
|
|
29
|
+
"npc",
|
|
30
|
+
"mind",
|
|
31
|
+
"deterministic"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"type": "module",
|
|
37
|
+
"main": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"import": "./dist/index.js",
|
|
42
|
+
"types": "./dist/index.d.ts"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"files": ["dist", "src"],
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup",
|
|
48
|
+
"build:types": "tsc --project tsconfig.build.json",
|
|
49
|
+
"dev": "bun --env-file=.env run src/runners/thin-shim.runner.ts",
|
|
50
|
+
"dev:build": "tsup --watch",
|
|
51
|
+
"run:social": "bun --env-file=.env run src/runners/social.runner.ts",
|
|
52
|
+
"run:outreach": "bun --env-file=.env run src/runners/outreach.runner.ts",
|
|
53
|
+
"start": "bun --env-file=.env run src/runners/thin-shim.runner.ts",
|
|
54
|
+
"typecheck": "tsc --noEmit",
|
|
55
|
+
"lint": "tsc --noEmit",
|
|
56
|
+
"prepublishOnly": "bun run typecheck && bun test && bun run build",
|
|
57
|
+
"test": "vitest run",
|
|
58
|
+
"test:watch": "vitest watch",
|
|
59
|
+
"test:integration": "vitest run src/tests/integration"
|
|
60
|
+
},
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@aws-sdk/client-s3": "^3.1048.0"
|
|
63
|
+
},
|
|
64
|
+
"optionalDependencies": {
|
|
65
|
+
"socket.io-client": "^4.8.1"
|
|
66
|
+
},
|
|
67
|
+
"devDependencies": {
|
|
68
|
+
"@types/bun": "latest",
|
|
69
|
+
"tsup": "^8.5.1",
|
|
70
|
+
"typescript": "^5.9.0",
|
|
71
|
+
"vitest": "^4.1.5"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
2
|
+
// src/agency/access.grants.ts β the access-grant layer
|
|
3
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
4
|
+
//
|
|
5
|
+
// The agency-native permission primitive. It replaces the permission/sense-gate
|
|
6
|
+
// role the legacy effectorRegistry used to carry (the catalog/discovery/created-
|
|
7
|
+
// effector machinery is retired separately). A Will's communication surface is
|
|
8
|
+
// closed by default: `listen`, `talk`, `text`, `gesture`, `broadcast` each
|
|
9
|
+
// require an explicit grant; everything else is freely available.
|
|
10
|
+
//
|
|
11
|
+
// Semantics are preserved verbatim from effectorRegistry's permission methods so
|
|
12
|
+
// the migration is behaviour-identical:
|
|
13
|
+
// β’ non-explicit name β always allowed
|
|
14
|
+
// β’ explicit name granted β allowed
|
|
15
|
+
// β’ explicit name ungrantedβ denied
|
|
16
|
+
//
|
|
17
|
+
// The backend's `PATCH /v1/wills/:id/effectors` reaches this via the unchanged
|
|
18
|
+
// `WillStem.setAllowedEffectors` β effectorController β `setAllowed`.
|
|
19
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
20
|
+
|
|
21
|
+
/** The communication surface β these names are denied unless explicitly granted. */
|
|
22
|
+
export const EXPLICIT_EFFECTORS: ReadonlySet<string> = new Set( [
|
|
23
|
+
'listen', 'talk', 'text', 'gesture', 'broadcast',
|
|
24
|
+
] )
|
|
25
|
+
|
|
26
|
+
export class AccessGrants {
|
|
27
|
+
private _granted: Set<string>
|
|
28
|
+
|
|
29
|
+
/** Seed from the resolved allow-list (e.g. profile effectors). null/[] β none granted. */
|
|
30
|
+
constructor( initial?: string[] | null ){
|
|
31
|
+
this._granted = new Set( ( initial ?? [] ).filter( n => EXPLICIT_EFFECTORS.has( n ) ) )
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Is the Will permitted to use this effector/schema right now? */
|
|
35
|
+
isAllowed( name: string ): boolean {
|
|
36
|
+
if( !EXPLICIT_EFFECTORS.has( name ) ) return true
|
|
37
|
+
return this._granted.has( name )
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/** Grant one explicit effector (no-op for non-explicit names). */
|
|
41
|
+
allow( name: string ): void {
|
|
42
|
+
if( EXPLICIT_EFFECTORS.has( name ) ) this._granted.add( name )
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Revoke one effector. */
|
|
46
|
+
revoke( name: string ): void {
|
|
47
|
+
this._granted.delete( name )
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** Replace the entire grant set (runtime reconfiguration). */
|
|
51
|
+
setAllowed( names: string[] | null ): void {
|
|
52
|
+
this._granted = new Set( ( names ?? [] ).filter( n => EXPLICIT_EFFECTORS.has( n ) ) )
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** The currently granted explicit effectors. */
|
|
56
|
+
granted(): string[] {
|
|
57
|
+
return [ ...this._granted ]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
2
|
+
// src/agency/competence.codec.ts β portable competence
|
|
3
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
4
|
+
//
|
|
5
|
+
// The original PMA carried who a Will *is*, *believes*, and *cares about* β but
|
|
6
|
+
// not what it had *learned to do*. A person who keeps their opinions and bonds
|
|
7
|
+
// but forgets every skill each morning is not continuity. This codec closes that
|
|
8
|
+
// gap: it distills the competence layer (learned composite schemas + their
|
|
9
|
+
// LearnedSkill stats) into a portable fragment, and reloads it so a re-embodied
|
|
10
|
+
// Will *acts like itself* β its habits, its proceduralized skills, its learned
|
|
11
|
+
// parameter defaults β not just feels and believes like itself.
|
|
12
|
+
//
|
|
13
|
+
// Soul doctrine (mirrors the existing PMA relationship distiller): what
|
|
14
|
+
// crystallizes across a restart is what *mattered*. Fleeting, barely-practiced
|
|
15
|
+
// skills fall below the carry floor and fade β the forgetting curve, made
|
|
16
|
+
// portable. Strong habits carry.
|
|
17
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
18
|
+
|
|
19
|
+
import type { MotorSchema, LearnedSkill } from '#agency/types'
|
|
20
|
+
import type { SchemaRepertoire } from '#agency/schemas/repertoire'
|
|
21
|
+
|
|
22
|
+
export const COMPETENCE_SCHEMA_VERSION = 1
|
|
23
|
+
|
|
24
|
+
export interface CompetenceSnapshot {
|
|
25
|
+
schemaVersion: number
|
|
26
|
+
/** Learned composite schema DEFINITIONS (the innate floor is intrinsic β not carried). */
|
|
27
|
+
composites: MotorSchema[]
|
|
28
|
+
/** Per-schema learned skills above the carry floor, ranked by consolidation. */
|
|
29
|
+
skills: LearnedSkill[]
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface DistillOptions {
|
|
33
|
+
/** Skills below this habit strength are not carried (the forgetting floor). */
|
|
34
|
+
minHabit?: number
|
|
35
|
+
/** Cap on carried skills, ranked by consolidation. */
|
|
36
|
+
maxSkills?: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const DEFAULT_MIN_HABIT = 0.2
|
|
40
|
+
const DEFAULT_MAX_SKILLS = 50
|
|
41
|
+
|
|
42
|
+
/** Consolidation score β how much a skill has "set" β used for ranking the carry. */
|
|
43
|
+
function consolidation( s: LearnedSkill ): number {
|
|
44
|
+
return s.habitStrength * 0.6
|
|
45
|
+
+ s.valueEstimate * 0.2
|
|
46
|
+
+ Math.min( 1, s.enactments * 0.02 ) * 0.2
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Distill the repertoire's competence into a portable snapshot. Carries the
|
|
51
|
+
* strongest skills (above the floor) and only the learned composite templates
|
|
52
|
+
* that still have a carried skill β so no orphan templates ride along.
|
|
53
|
+
*/
|
|
54
|
+
export function distillCompetence(
|
|
55
|
+
repertoire: SchemaRepertoire,
|
|
56
|
+
opts: DistillOptions = {},
|
|
57
|
+
): CompetenceSnapshot {
|
|
58
|
+
const minHabit = opts.minHabit ?? DEFAULT_MIN_HABIT
|
|
59
|
+
const maxSkills = opts.maxSkills ?? DEFAULT_MAX_SKILLS
|
|
60
|
+
|
|
61
|
+
const { composites, skills } = repertoire.export( minHabit )
|
|
62
|
+
|
|
63
|
+
const carriedSkills = [ ...skills ]
|
|
64
|
+
.sort( ( a, b ) => consolidation( b ) - consolidation( a ) )
|
|
65
|
+
.slice( 0, maxSkills )
|
|
66
|
+
|
|
67
|
+
const carriedIds = new Set( carriedSkills.map( s => s.schema ) )
|
|
68
|
+
const carriedComposites = composites.filter( c => carriedIds.has( c.id ) )
|
|
69
|
+
|
|
70
|
+
return {
|
|
71
|
+
schemaVersion: COMPETENCE_SCHEMA_VERSION,
|
|
72
|
+
composites: carriedComposites,
|
|
73
|
+
skills: carriedSkills,
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Reload a competence snapshot into a (typically fresh) repertoire, so the Will
|
|
79
|
+
* resumes with its learned skills and composites intact. Composites are
|
|
80
|
+
* registered first (re-creating their templates), then skills overwrite the
|
|
81
|
+
* fresh stubs with the carried, consolidated values.
|
|
82
|
+
*/
|
|
83
|
+
export function loadCompetence(
|
|
84
|
+
snapshot: CompetenceSnapshot | null | undefined,
|
|
85
|
+
repertoire: SchemaRepertoire,
|
|
86
|
+
): void {
|
|
87
|
+
if( !snapshot || snapshot.schemaVersion !== COMPETENCE_SCHEMA_VERSION ) return
|
|
88
|
+
repertoire.import({ composites: snapshot.composites, skills: snapshot.skills })
|
|
89
|
+
}
|