![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
@cogment/cogment-js-sdk
Advanced tools
Install the package:
npm install @cogment/cogment-js-sdk
The test suite embeds a working Cogment application. Parts of the example application pertinent to the js-sdk test suite:
The ActorSession.test.ts is the most feature complete example of a working cogment application and is documented to be read as such.
Examples follow.
import {createService} from 'cogment';
import cogSettings from './CogSettings';
const cogmentService = createService({
cogSettings,
});
import {createService} from 'cogment';
import cogSettings from './CogSettings';
const cogmentService = createService({
cogSettings,
});
const trialController = cogmentService.createTrialController();
const {trialId} = await trialController.startTrial('unique-id');
return trialController.terminateTrial(trialId);
import {createService, TrialActor} from 'cogment';
import cogSettings from './CogSettings';
import {ClientAction, Observation} from './data_pb';
const cogmentService = createService({
cogSettings,
});
const trialActor: TrialActor = {
name: 'client_actor',
actorClass: 'client',
};
cogmentService.registerActor<ClientAction, Observation, never>(
trialActor,
async (actorSession) => {
// Actor implementation here.
},
);
const trialController = cogmentService.createTrialController();
const {trialId} = await trialController.startTrial(trialActor.name);
await trialController.joinTrial(trialId, trialActor);
return trialController.terminateTrial(trialId);
import {createService} from 'cogment';
import cogSettings from './CogSettings';
const cogmentService = createService({
cogSettings,
});
const trialController = cogmentService.createTrialController();
for await (const trialListEntry of trialController.watchTrials([
0,
1,
2,
3,
4,
5,
])) {
// Do stuff!
}
git clone https://github.com/cogment/cogment-js-sdk.git
docker-compose build cogment-js-sdk
docker-compose run cogment-js-sdk npm run init
bin/up.bash
docker-compose run cogment-js-sdk npm run test
git clone https://github.com/cogment/cogment-js-sdk.git
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
source ~/.nvm/nvm.sh
cd /path/to/cogment-js-sdk
nvm install
npm run init
module.exports = {
connection: {
http: 'http://grpcwebproxy:8080',
},
logger: {
level: 'debug',
},
};
To
module.exports = {
connection: {
http: 'http://localhost:8080',
},
logger: {
level: 'debug',
},
};
bin/up.bash
npm run test
npm run test:watch
npm run test:ui
FAQs
Javascript SDK for the Cogment Framework
The npm package @cogment/cogment-js-sdk receives a total of 33 weekly downloads. As such, @cogment/cogment-js-sdk popularity was classified as not popular.
We found that @cogment/cogment-js-sdk 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
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.