paracosm 0.7.459 → 0.7.460
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/dist/runtime/hexaco-cues/trajectory.d.ts +5 -15
- package/dist/runtime/hexaco-cues/trajectory.d.ts.map +1 -1
- package/dist/runtime/hexaco-cues/trajectory.js +14 -28
- package/dist/runtime/hexaco-cues/trajectory.js.map +1 -1
- package/dist/runtime/hexaco-cues/translation.d.ts +4 -23
- package/dist/runtime/hexaco-cues/translation.d.ts.map +1 -1
- package/dist/runtime/hexaco-cues/translation.js +18 -33
- package/dist/runtime/hexaco-cues/translation.js.map +1 -1
- package/dist/runtime/trait-cues/index.d.ts +15 -0
- package/dist/runtime/trait-cues/index.d.ts.map +1 -0
- package/dist/runtime/trait-cues/index.js +15 -0
- package/dist/runtime/trait-cues/index.js.map +1 -0
- package/dist/runtime/trait-cues/reaction.d.ts +29 -0
- package/dist/runtime/trait-cues/reaction.d.ts.map +1 -0
- package/dist/runtime/trait-cues/reaction.js +36 -0
- package/dist/runtime/trait-cues/reaction.js.map +1 -0
- package/dist/runtime/trait-cues/trajectory.d.ts +37 -0
- package/dist/runtime/trait-cues/trajectory.d.ts.map +1 -0
- package/dist/runtime/trait-cues/trajectory.js +75 -0
- package/dist/runtime/trait-cues/trajectory.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,19 +1,9 @@
|
|
|
1
|
+
import type { HexacoProfile, HexacoSnapshot } from '../../engine/core/state.js';
|
|
1
2
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* Thresholds match the kernel's drift rate cap from progression.ts
|
|
7
|
-
* (±0.05/turn): 0.05 is the minimum meaningful drift, 0.15 is three
|
|
8
|
-
* full-cap turns' worth and qualifies as "substantially."
|
|
9
|
-
*
|
|
10
|
-
* @module paracosm/runtime/hexaco-cues/trajectory
|
|
11
|
-
*/
|
|
12
|
-
import { type HexacoProfile, type HexacoSnapshot } from '../../engine/core/state.js';
|
|
13
|
-
/**
|
|
14
|
-
* Build a prose cue describing personality drift since the first
|
|
15
|
-
* snapshot in `history`. Returns an empty string when drift is too
|
|
16
|
-
* small to be meaningful, or when history has no baseline.
|
|
3
|
+
* @deprecated since 0.8.0: use `buildTrajectoryCue(history, current)`
|
|
4
|
+
* from `runtime/trait-cues` with TraitProfile-shaped inputs. This
|
|
5
|
+
* shim continues to work for HEXACO callers and produces byte-
|
|
6
|
+
* identical output. Removal scheduled for 0.9.0.
|
|
17
7
|
*/
|
|
18
8
|
export declare function buildTrajectoryCue(history: HexacoSnapshot[], current: HexacoProfile): string;
|
|
19
9
|
//# sourceMappingURL=trajectory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trajectory.d.ts","sourceRoot":"","sources":["../../../src/runtime/hexaco-cues/trajectory.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trajectory.d.ts","sourceRoot":"","sources":["../../../src/runtime/hexaco-cues/trajectory.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAEhF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,cAAc,EAAE,EACzB,OAAO,EAAE,aAAa,GACrB,MAAM,CAER"}
|
|
@@ -1,38 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Back-compat shim for the legacy `buildTrajectoryCue(history, current)`
|
|
3
|
+
* entry point. Delegates to
|
|
4
|
+
* `runtime/trait-cues/trajectory::buildTrajectoryCueFromHexaco`, which
|
|
5
|
+
* routes through the trait-model registry.
|
|
5
6
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Output is byte-identical for HEXACO inputs because the hexaco model's
|
|
8
|
+
* axis labels lower-case + dasherize to "honesty-humility" etc. New
|
|
9
|
+
* code should import `buildTrajectoryCue(history, current)` from
|
|
10
|
+
* `runtime/trait-cues` and supply TraitProfile-shaped inputs.
|
|
9
11
|
*
|
|
10
12
|
* @module paracosm/runtime/hexaco-cues/trajectory
|
|
11
13
|
*/
|
|
12
|
-
import {
|
|
13
|
-
const MIN_DRIFT = 0.05; // floor: one full-cap turn of pull
|
|
14
|
-
const SUBSTANTIAL_DRIFT = 0.15; // three turns' worth
|
|
14
|
+
import { buildTrajectoryCueFromHexaco } from '../trait-cues/trajectory.js';
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* @deprecated since 0.8.0: use `buildTrajectoryCue(history, current)`
|
|
17
|
+
* from `runtime/trait-cues` with TraitProfile-shaped inputs. This
|
|
18
|
+
* shim continues to work for HEXACO callers and produces byte-
|
|
19
|
+
* identical output. Removal scheduled for 0.9.0.
|
|
19
20
|
*/
|
|
20
21
|
export function buildTrajectoryCue(history, current) {
|
|
21
|
-
|
|
22
|
-
return '';
|
|
23
|
-
const baseline = history[0].hexaco;
|
|
24
|
-
const lines = [];
|
|
25
|
-
for (const trait of HEXACO_TRAITS) {
|
|
26
|
-
const delta = current[trait] - baseline[trait];
|
|
27
|
-
if (Math.abs(delta) < MIN_DRIFT)
|
|
28
|
-
continue;
|
|
29
|
-
const direction = delta > 0 ? 'toward' : 'away from';
|
|
30
|
-
const displayTrait = trait === 'honestyHumility' ? 'honesty-humility' : trait;
|
|
31
|
-
const magnitude = Math.abs(delta) >= SUBSTANTIAL_DRIFT ? 'substantially' : 'measurably';
|
|
32
|
-
lines.push(`${magnitude} ${direction} higher ${displayTrait}`);
|
|
33
|
-
}
|
|
34
|
-
if (!lines.length)
|
|
35
|
-
return '';
|
|
36
|
-
return `Since you took command, your personality has drifted ${lines.join(' and ')}. Notice how recent decisions have shaped your judgment.`;
|
|
22
|
+
return buildTrajectoryCueFromHexaco(history, current);
|
|
37
23
|
}
|
|
38
24
|
//# sourceMappingURL=trajectory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trajectory.js","sourceRoot":"","sources":["../../../src/runtime/hexaco-cues/trajectory.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"trajectory.js","sourceRoot":"","sources":["../../../src/runtime/hexaco-cues/trajectory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAC;AAG3E;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAAyB,EACzB,OAAsB;IAEtB,OAAO,4BAA4B,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACxD,CAAC"}
|
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reaction cue translation — turns raw HEXACO numbers into 1-3 short
|
|
3
|
-
* behavioral cue strings the reacting agent's LLM prompt can use directly.
|
|
4
|
-
*
|
|
5
|
-
* Thresholds 0.7 / 0.3 match the poles used in commander and dept-head
|
|
6
|
-
* prompts so all trait-driven voice is uniform across the system.
|
|
7
|
-
*
|
|
8
|
-
* Output covers up to all six axes' polarized poles (max 6 cues, matching
|
|
9
|
-
* the number of HEXACO traits). Previously capped at 3, which dropped
|
|
10
|
-
* half of a heavily-polarized agent's trait voice. The per-batch cost
|
|
11
|
-
* delta at 6 vs 3 is ~180 tokens/call × ~60 calls per run on haiku ≈
|
|
12
|
-
* $0.02 per run — negligible against the quality win of preserving full
|
|
13
|
-
* trait expression on reactions.
|
|
14
|
-
*
|
|
15
|
-
* Selection order matches the axis iteration below, so recurring trait
|
|
16
|
-
* combinations produce consistent phrasing order across agents.
|
|
17
|
-
*
|
|
18
|
-
* @module paracosm/runtime/hexaco-cues/translation
|
|
19
|
-
*/
|
|
20
1
|
import type { HexacoProfile } from '../../engine/core/state.js';
|
|
21
2
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
3
|
+
* @deprecated since 0.8.0: use `buildReactionCues(profile)` from
|
|
4
|
+
* `runtime/trait-cues` and supply a TraitProfile. This shim
|
|
5
|
+
* continues to work for HEXACO callers and produces byte-identical
|
|
6
|
+
* output. Removal scheduled for 0.9.0.
|
|
26
7
|
*/
|
|
27
8
|
export declare function buildReactionCues(h: HexacoProfile): string;
|
|
28
9
|
//# sourceMappingURL=translation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../src/runtime/hexaco-cues/translation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translation.d.ts","sourceRoot":"","sources":["../../../src/runtime/hexaco-cues/translation.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAE1D"}
|
|
@@ -1,38 +1,23 @@
|
|
|
1
|
-
const MAX_CUES = 6;
|
|
2
1
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
2
|
+
* Back-compat shim for the legacy `buildReactionCues(hexaco)` entry
|
|
3
|
+
* point. Delegates to `runtime/trait-cues/reaction::buildReactionCuesFromHexaco`,
|
|
4
|
+
* which routes through the trait-model registry.
|
|
5
|
+
*
|
|
6
|
+
* Output is byte-identical for HEXACO inputs because the hexaco model's
|
|
7
|
+
* cue dictionary preserves the original strings verbatim. New code
|
|
8
|
+
* should import `buildReactionCues(profile: TraitProfile)` from
|
|
9
|
+
* `runtime/trait-cues` directly.
|
|
10
|
+
*
|
|
11
|
+
* @module paracosm/runtime/hexaco-cues/translation
|
|
12
|
+
*/
|
|
13
|
+
import { buildReactionCuesFromHexaco } from '../trait-cues/reaction.js';
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated since 0.8.0: use `buildReactionCues(profile)` from
|
|
16
|
+
* `runtime/trait-cues` and supply a TraitProfile. This shim
|
|
17
|
+
* continues to work for HEXACO callers and produces byte-identical
|
|
18
|
+
* output. Removal scheduled for 0.9.0.
|
|
7
19
|
*/
|
|
8
20
|
export function buildReactionCues(h) {
|
|
9
|
-
|
|
10
|
-
if (h.emotionality > 0.7)
|
|
11
|
-
cues.push('you feel events in your body before words');
|
|
12
|
-
if (h.emotionality < 0.3)
|
|
13
|
-
cues.push('you stay flat when others panic');
|
|
14
|
-
if (h.openness > 0.7)
|
|
15
|
-
cues.push('you look for what this moment makes possible');
|
|
16
|
-
if (h.openness < 0.3)
|
|
17
|
-
cues.push('you stick to what has worked');
|
|
18
|
-
if (h.honestyHumility > 0.7)
|
|
19
|
-
cues.push('you say what you really think');
|
|
20
|
-
if (h.honestyHumility < 0.3)
|
|
21
|
-
cues.push('you speak strategically, not confessionally');
|
|
22
|
-
if (h.conscientiousness > 0.7)
|
|
23
|
-
cues.push('you want a plan before you move');
|
|
24
|
-
if (h.conscientiousness < 0.3)
|
|
25
|
-
cues.push('you move first and adjust mid-stride');
|
|
26
|
-
if (h.extraversion > 0.7)
|
|
27
|
-
cues.push('you say it out loud rather than sit with it');
|
|
28
|
-
if (h.extraversion < 0.3)
|
|
29
|
-
cues.push('you process inward and speak only after');
|
|
30
|
-
if (h.agreeableness > 0.7)
|
|
31
|
-
cues.push('you want to hold the group together through this');
|
|
32
|
-
if (h.agreeableness < 0.3)
|
|
33
|
-
cues.push("you don't owe anyone smoothness right now");
|
|
34
|
-
if (cues.length === 0)
|
|
35
|
-
return '';
|
|
36
|
-
return `Your inner voice: ${cues.slice(0, MAX_CUES).join('; ')}.`;
|
|
21
|
+
return buildReactionCuesFromHexaco(h);
|
|
37
22
|
}
|
|
38
23
|
//# sourceMappingURL=translation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"translation.js","sourceRoot":"","sources":["../../../src/runtime/hexaco-cues/translation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"translation.js","sourceRoot":"","sources":["../../../src/runtime/hexaco-cues/translation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAGxE;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,CAAgB;IAChD,OAAO,2BAA2B,CAAC,CAAC,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trait cue runtime helpers. Dispatches through the trait-model
|
|
3
|
+
* registry so commander, department, director, and agent-reaction
|
|
4
|
+
* prompts pick up the right cue dictionary for any registered model
|
|
5
|
+
* (hexaco, ai-agent, ...) without hardcoding HEXACO axis names.
|
|
6
|
+
*
|
|
7
|
+
* Replaces the per-axis HEXACO calls in `runtime/hexaco-cues/`. The
|
|
8
|
+
* legacy module is preserved as a back-compat re-export shim so any
|
|
9
|
+
* external imports continue to work.
|
|
10
|
+
*
|
|
11
|
+
* @module paracosm/runtime/trait-cues
|
|
12
|
+
*/
|
|
13
|
+
export { buildReactionCues, buildReactionCuesFromHexaco, } from './reaction.js';
|
|
14
|
+
export { buildTrajectoryCue, buildTrajectoryCueFromHexaco } from './trajectory.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/trait-cues/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trait cue runtime helpers. Dispatches through the trait-model
|
|
3
|
+
* registry so commander, department, director, and agent-reaction
|
|
4
|
+
* prompts pick up the right cue dictionary for any registered model
|
|
5
|
+
* (hexaco, ai-agent, ...) without hardcoding HEXACO axis names.
|
|
6
|
+
*
|
|
7
|
+
* Replaces the per-axis HEXACO calls in `runtime/hexaco-cues/`. The
|
|
8
|
+
* legacy module is preserved as a back-compat re-export shim so any
|
|
9
|
+
* external imports continue to work.
|
|
10
|
+
*
|
|
11
|
+
* @module paracosm/runtime/trait-cues
|
|
12
|
+
*/
|
|
13
|
+
export { buildReactionCues, buildReactionCuesFromHexaco, } from './reaction.js';
|
|
14
|
+
export { buildTrajectoryCue, buildTrajectoryCueFromHexaco } from './trajectory.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/runtime/trait-cues/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EACL,iBAAiB,EACjB,2BAA2B,GAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reaction cue translator. Generic over trait models: the runtime
|
|
3
|
+
* looks up the leader's TraitProfile.modelId in the registry and
|
|
4
|
+
* builds a cue line from the model's cue dictionary.
|
|
5
|
+
*
|
|
6
|
+
* For HEXACO scenarios, the output string is byte-identical to the
|
|
7
|
+
* legacy `runtime/hexaco-cues/translation.ts::buildReactionCues`
|
|
8
|
+
* because hexacoModel's cues dictionary lifts those strings verbatim.
|
|
9
|
+
*
|
|
10
|
+
* @module paracosm/runtime/trait-cues/reaction
|
|
11
|
+
*/
|
|
12
|
+
import type { HexacoProfile } from '../../engine/core/state.js';
|
|
13
|
+
import type { TraitProfile } from '../../engine/trait-models/index.js';
|
|
14
|
+
/**
|
|
15
|
+
* Generic reaction cue line. Reads the leader's trait model from the
|
|
16
|
+
* registry, picks polarized-axis cues, and emits a single-line string
|
|
17
|
+
* the agent's LLM prompt can splice in.
|
|
18
|
+
*
|
|
19
|
+
* Returns an empty string when no axis is polarized into low/high.
|
|
20
|
+
*/
|
|
21
|
+
export declare function buildReactionCues(profile: TraitProfile): string;
|
|
22
|
+
/**
|
|
23
|
+
* Back-compat HEXACO-only wrapper. Existing callers that hold a raw
|
|
24
|
+
* HexacoProfile (no model id) call this; it synthesizes a hexaco
|
|
25
|
+
* traitProfile and delegates. Equivalent in output to the legacy
|
|
26
|
+
* `runtime/hexaco-cues/translation.ts::buildReactionCues`.
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildReactionCuesFromHexaco(hexaco: HexacoProfile): string;
|
|
29
|
+
//# sourceMappingURL=reaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reaction.d.ts","sourceRoot":"","sources":["../../../src/runtime/trait-cues/reaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAKvE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,CAG/D;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAMzE"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reaction cue translator. Generic over trait models: the runtime
|
|
3
|
+
* looks up the leader's TraitProfile.modelId in the registry and
|
|
4
|
+
* builds a cue line from the model's cue dictionary.
|
|
5
|
+
*
|
|
6
|
+
* For HEXACO scenarios, the output string is byte-identical to the
|
|
7
|
+
* legacy `runtime/hexaco-cues/translation.ts::buildReactionCues`
|
|
8
|
+
* because hexacoModel's cues dictionary lifts those strings verbatim.
|
|
9
|
+
*
|
|
10
|
+
* @module paracosm/runtime/trait-cues/reaction
|
|
11
|
+
*/
|
|
12
|
+
import { traitModelRegistry } from '../../engine/trait-models/index.js';
|
|
13
|
+
import { buildCueLine } from '../../engine/trait-models/cue-translator.js';
|
|
14
|
+
import { hexacoToTraits } from '../../engine/trait-models/normalize-leader.js';
|
|
15
|
+
/**
|
|
16
|
+
* Generic reaction cue line. Reads the leader's trait model from the
|
|
17
|
+
* registry, picks polarized-axis cues, and emits a single-line string
|
|
18
|
+
* the agent's LLM prompt can splice in.
|
|
19
|
+
*
|
|
20
|
+
* Returns an empty string when no axis is polarized into low/high.
|
|
21
|
+
*/
|
|
22
|
+
export function buildReactionCues(profile) {
|
|
23
|
+
const model = traitModelRegistry.require(profile.modelId);
|
|
24
|
+
return buildCueLine(profile, model);
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Back-compat HEXACO-only wrapper. Existing callers that hold a raw
|
|
28
|
+
* HexacoProfile (no model id) call this; it synthesizes a hexaco
|
|
29
|
+
* traitProfile and delegates. Equivalent in output to the legacy
|
|
30
|
+
* `runtime/hexaco-cues/translation.ts::buildReactionCues`.
|
|
31
|
+
*/
|
|
32
|
+
export function buildReactionCuesFromHexaco(hexaco) {
|
|
33
|
+
const model = traitModelRegistry.require('hexaco');
|
|
34
|
+
return buildCueLine({ modelId: 'hexaco', traits: hexacoToTraits(hexaco, model) }, model);
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=reaction.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reaction.js","sourceRoot":"","sources":["../../../src/runtime/trait-cues/reaction.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAqB;IACrD,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1D,OAAO,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAqB;IAC/D,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,OAAO,YAAY,CACjB,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAC5D,KAAK,CACN,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trajectory cue translator. Generic over trait models: emits a
|
|
3
|
+
* prose line describing how the leader's profile has drifted since
|
|
4
|
+
* a baseline snapshot. Reads axis ids and human-readable labels
|
|
5
|
+
* from the registered TraitModel rather than hardcoded HEXACO names.
|
|
6
|
+
*
|
|
7
|
+
* Thresholds match the kernel's drift cap (+/- 0.05/turn): 0.05 is
|
|
8
|
+
* the minimum meaningful drift; 0.15 (three full-cap turns) qualifies
|
|
9
|
+
* as "substantially."
|
|
10
|
+
*
|
|
11
|
+
* @module paracosm/runtime/trait-cues/trajectory
|
|
12
|
+
*/
|
|
13
|
+
import type { HexacoProfile, HexacoSnapshot } from '../../engine/core/state.js';
|
|
14
|
+
import type { TraitProfile } from '../../engine/trait-models/index.js';
|
|
15
|
+
/**
|
|
16
|
+
* One snapshot of a TraitProfile along the leader's command history.
|
|
17
|
+
* The runtime stores these per-turn so the trajectory cue can
|
|
18
|
+
* compare current vs first.
|
|
19
|
+
*/
|
|
20
|
+
export interface TraitProfileSnapshot {
|
|
21
|
+
turn: number;
|
|
22
|
+
profile: TraitProfile;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Build a generic trajectory cue from a history of TraitProfile
|
|
26
|
+
* snapshots and the current profile. Returns empty string when no
|
|
27
|
+
* axis has drifted past MIN_DRIFT or when history is empty.
|
|
28
|
+
*/
|
|
29
|
+
export declare function buildTrajectoryCue(history: TraitProfileSnapshot[], current: TraitProfile): string;
|
|
30
|
+
/**
|
|
31
|
+
* Back-compat HEXACO-only wrapper. Existing callers that pass
|
|
32
|
+
* HexacoSnapshot[] call this; it converts to TraitProfileSnapshot[]
|
|
33
|
+
* and delegates. Equivalent in output to the legacy
|
|
34
|
+
* `runtime/hexaco-cues/trajectory.ts::buildTrajectoryCue`.
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildTrajectoryCueFromHexaco(history: HexacoSnapshot[], current: HexacoProfile): string;
|
|
37
|
+
//# sourceMappingURL=trajectory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trajectory.d.ts","sourceRoot":"","sources":["../../../src/runtime/trait-cues/trajectory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,KAAK,EAEV,YAAY,EACb,MAAM,oCAAoC,CAAC;AAO5C;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,YAAY,CAAC;CACvB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,oBAAoB,EAAE,EAC/B,OAAO,EAAE,YAAY,GACpB,MAAM,CAwBR;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,cAAc,EAAE,EACzB,OAAO,EAAE,aAAa,GACrB,MAAM,CAWR"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trajectory cue translator. Generic over trait models: emits a
|
|
3
|
+
* prose line describing how the leader's profile has drifted since
|
|
4
|
+
* a baseline snapshot. Reads axis ids and human-readable labels
|
|
5
|
+
* from the registered TraitModel rather than hardcoded HEXACO names.
|
|
6
|
+
*
|
|
7
|
+
* Thresholds match the kernel's drift cap (+/- 0.05/turn): 0.05 is
|
|
8
|
+
* the minimum meaningful drift; 0.15 (three full-cap turns) qualifies
|
|
9
|
+
* as "substantially."
|
|
10
|
+
*
|
|
11
|
+
* @module paracosm/runtime/trait-cues/trajectory
|
|
12
|
+
*/
|
|
13
|
+
import { traitModelRegistry, withDefaults } from '../../engine/trait-models/index.js';
|
|
14
|
+
import { hexacoToTraits } from '../../engine/trait-models/normalize-leader.js';
|
|
15
|
+
const MIN_DRIFT = 0.05;
|
|
16
|
+
const SUBSTANTIAL_DRIFT = 0.15;
|
|
17
|
+
/**
|
|
18
|
+
* Build a generic trajectory cue from a history of TraitProfile
|
|
19
|
+
* snapshots and the current profile. Returns empty string when no
|
|
20
|
+
* axis has drifted past MIN_DRIFT or when history is empty.
|
|
21
|
+
*/
|
|
22
|
+
export function buildTrajectoryCue(history, current) {
|
|
23
|
+
if (history.length < 1)
|
|
24
|
+
return '';
|
|
25
|
+
const baseline = history[0].profile;
|
|
26
|
+
if (baseline.modelId !== current.modelId)
|
|
27
|
+
return '';
|
|
28
|
+
const model = traitModelRegistry.require(current.modelId);
|
|
29
|
+
const baselineTraits = withDefaults(baseline.traits, model);
|
|
30
|
+
const currentTraits = withDefaults(current.traits, model);
|
|
31
|
+
const lines = [];
|
|
32
|
+
for (const axis of model.axes) {
|
|
33
|
+
const delta = currentTraits[axis.id] - baselineTraits[axis.id];
|
|
34
|
+
if (Math.abs(delta) < MIN_DRIFT)
|
|
35
|
+
continue;
|
|
36
|
+
const direction = delta > 0 ? 'toward' : 'away from';
|
|
37
|
+
const magnitude = Math.abs(delta) >= SUBSTANTIAL_DRIFT ? 'substantially' : 'measurably';
|
|
38
|
+
// Use the model's display label rather than the raw axis id, then
|
|
39
|
+
// lowercase + dasherize to match the legacy "honesty-humility"
|
|
40
|
+
// formatting for HEXACO.
|
|
41
|
+
const displayName = humanizeAxisLabel(axis.label);
|
|
42
|
+
lines.push(`${magnitude} ${direction} higher ${displayName}`);
|
|
43
|
+
}
|
|
44
|
+
if (!lines.length)
|
|
45
|
+
return '';
|
|
46
|
+
return `Since you took command, your personality has drifted ${lines.join(' and ')}. Notice how recent decisions have shaped your judgment.`;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Back-compat HEXACO-only wrapper. Existing callers that pass
|
|
50
|
+
* HexacoSnapshot[] call this; it converts to TraitProfileSnapshot[]
|
|
51
|
+
* and delegates. Equivalent in output to the legacy
|
|
52
|
+
* `runtime/hexaco-cues/trajectory.ts::buildTrajectoryCue`.
|
|
53
|
+
*/
|
|
54
|
+
export function buildTrajectoryCueFromHexaco(history, current) {
|
|
55
|
+
const model = traitModelRegistry.require('hexaco');
|
|
56
|
+
const profileHistory = history.map(snap => ({
|
|
57
|
+
turn: snap.turn,
|
|
58
|
+
profile: { modelId: 'hexaco', traits: hexacoToTraits(snap.hexaco, model) },
|
|
59
|
+
}));
|
|
60
|
+
const currentProfile = {
|
|
61
|
+
modelId: 'hexaco',
|
|
62
|
+
traits: hexacoToTraits(current, model),
|
|
63
|
+
};
|
|
64
|
+
return buildTrajectoryCue(profileHistory, currentProfile);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Lowercase the axis label and replace whitespace with hyphens so
|
|
68
|
+
* "Honesty-Humility" stays "honesty-humility" and "Verification rigor"
|
|
69
|
+
* becomes "verification-rigor". Matches the legacy HEXACO cue
|
|
70
|
+
* formatting.
|
|
71
|
+
*/
|
|
72
|
+
function humanizeAxisLabel(label) {
|
|
73
|
+
return label.toLowerCase().replace(/\s+/g, '-');
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=trajectory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trajectory.js","sourceRoot":"","sources":["../../../src/runtime/trait-cues/trajectory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAOH,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,+CAA+C,CAAC;AAE/E,MAAM,SAAS,GAAG,IAAI,CAAC;AACvB,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAY/B;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,OAA+B,EAC/B,OAAqB;IAErB,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;IACpC,IAAI,QAAQ,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACpD,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAE1D,MAAM,cAAc,GAAG,YAAY,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5D,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAE1D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC;QAC9B,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC/D,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,SAAS;YAAE,SAAS;QAC1C,MAAM,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC;QACrD,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,YAAY,CAAC;QACxF,kEAAkE;QAClE,+DAA+D;QAC/D,yBAAyB;QACzB,MAAM,WAAW,GAAG,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAClD,KAAK,CAAC,IAAI,CAAC,GAAG,SAAS,IAAI,SAAS,WAAW,WAAW,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IAC7B,OAAO,wDAAwD,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,0DAA0D,CAAC;AAC/I,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,4BAA4B,CAC1C,OAAyB,EACzB,OAAsB;IAEtB,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnD,MAAM,cAAc,GAA2B,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAClE,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE;KAC3E,CAAC,CAAC,CAAC;IACJ,MAAM,cAAc,GAAiB;QACnC,OAAO,EAAE,QAAQ;QACjB,MAAM,EAAE,cAAc,CAAC,OAAO,EAAE,KAAK,CAAC;KACvC,CAAC;IACF,OAAO,kBAAkB,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,KAAa;IACtC,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAClD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "paracosm",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.460",
|
|
4
4
|
"description": "Prompt/document/URL-grounded structured world model for AI agents: typed ScenarioPackages, deterministic kernels, HEXACO leaders, LLM events, runtime tool forging, and reproducible counterfactual RunArtifacts. Built on AgentOS.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/engine/index.js",
|