feat: Add Be and tbd skill, also added Roadmap file

This commit is contained in:
2026-05-10 16:32:12 -04:00
parent 3500ade13f
commit 0bb8885802
29587 changed files with 10611695 additions and 0 deletions

33
Skills/@be/node_modules/jibo-cai-persistence/README.md generated vendored Normal file
View File

@@ -0,0 +1,33 @@
# CharacterAI Persistence
## Description
A library for persisting character related state. It currently and temporarily uses a json datastore backend but will eventually connect to a character state persistence service.
## Example usage
```js
import Persistence from '../main/index';
let pers = Persistence.getInstance();
// We could store the persistence keys in an enum object
// for easier access
const Keys = {
DATA1: 'DATA1',
};
// Here we retrieve the data for Keys.DATA1
// Any `get` for a given key within the same application
// will return the same Node object instance
pers.get(Keys.DATA1)
.then( (node) => {
// Node has key:string, data:any, and save();
// Here we can read/modify the data
node.data.name = 'George';
node.data.age = 34;
// This synchronizes the data with the datastore
node.save();
});
```

View File

View File

@@ -0,0 +1,30 @@
export interface StorageOptions {
storageFolder: string;
dotsToFolders: boolean;
fileExtension: string;
}
export declare class Node {
key: string;
data: any;
private _storage;
constructor(key: string, data: any, _storage: any);
save(): Promise<{}>;
}
export declare class _Persistence {
private _storage;
private _map;
constructor(options?: StorageOptions);
get(key: string): Promise<Node>;
private _createNode(key, data);
}
export default class Persistence {
constructor();
static getInstance(options?: StorageOptions): _Persistence;
/**
* Should only be called for testing purposes
* @param options
* @returns {_Persistence}
* @private
*/
static _resetInstance(options?: StorageOptions): _Persistence;
}

View File

@@ -0,0 +1,3 @@
module.exports = require("./main");
//# sourceMappingURL=map/index.js.map

View File

@@ -0,0 +1,90 @@
/**
* @fileOverview
*
* Created on 4/18/16.
* @author Siggi Orn <siggi@jibo.com>
*/
"use strict";
var SuperSimpleStorage = require('supersimplestorage');
var DEFAULT_OPTIONS = {
storageFolder: 'tmp_storage_folder',
dotsToFolders: true,
fileExtension: 'txt'
};
var Node = (function () {
function Node(key, data, _storage) {
this.key = key;
this.data = data;
this._storage = _storage;
}
Node.prototype.save = function () {
var _this = this;
return new Promise(function (res, rej) {
_this._storage.save(_this.key, _this.data, function (content) { return res(); }, function (error) { return rej(error); });
});
};
return Node;
}());
exports.Node = Node;
var _Persistence = (function () {
function _Persistence(options) {
this._map = new Map();
var selectedOptions = options || DEFAULT_OPTIONS;
this._storage = new SuperSimpleStorage(selectedOptions);
}
_Persistence.prototype.get = function (key) {
var _this = this;
var node = this._map.get(key);
if (node) {
return Promise.resolve(node);
}
else {
return new Promise(function (res, rej) {
_this._storage.open(key, function (content) {
res(_this._createNode(key, content));
}, function (error) {
if (error.toString() === 'Storage item not found.') {
res(_this._createNode(key, {}));
}
else {
rej(error);
}
});
});
}
};
_Persistence.prototype._createNode = function (key, data) {
var node = new Node(key, data, this._storage);
this._map.set(key, node);
return node;
};
return _Persistence;
}());
exports._Persistence = _Persistence;
var persistence;
var Persistence = (function () {
function Persistence() {
throw new Error("This class shouldn't be instantiated, use 'getInstance'");
}
Persistence.getInstance = function (options) {
if (!persistence) {
persistence = new _Persistence(options);
}
return persistence;
};
/**
* Should only be called for testing purposes
* @param options
* @returns {_Persistence}
* @private
*/
Persistence._resetInstance = function (options) {
persistence = new _Persistence(options);
return persistence;
};
return Persistence;
}());
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = Persistence;
//# sourceMappingURL=../map/main/Persistence.js.map

View File

@@ -0,0 +1,12 @@
/**
* @fileOverview
*
* Created on 4/11/16.
* @author Siggi Orn <siggi@jibo.com>
*/
"use strict";
var jibo_cai_singleton_1 = require('jibo-cai-singleton');
var P = require('./Persistence');
module.exports = jibo_cai_singleton_1.default.getOrCreateSingleton(module, function () { return P; });
//# sourceMappingURL=../map/main/index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"sources":["index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC","file":"index.js","sourcesContent":["module.exports = require(\"./main\");"],"sourceRoot":"/source/"}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["main/Persistence.ts"],"names":[],"mappings":"AAAA;;;;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IAAI,YAAY,CAAC,OAAO,CAAC,CAAC;QAExC,MAAM,CAAC,WAAW,CAAC;IACrB,CAAC;IACH,kBAAC;AAAD,CAzBA,AAyBC,IAAA;AAzBD;6BAyBC,CAAA","file":"main/Persistence.js","sourcesContent":["/**\n * @fileOverview\n *\n * Created on 4/18/16.\n * @author Siggi Orn <siggi@jibo.com>\n */\n\nlet SuperSimpleStorage = require('supersimplestorage');\n\n\nexport interface StorageOptions {\n storageFolder: string;\n dotsToFolders: boolean;\n fileExtension: string;\n}\n\n\nconst DEFAULT_OPTIONS = {\n storageFolder: 'tmp_storage_folder',\n dotsToFolders: true,\n fileExtension: 'txt'\n};\n\n\n\nexport class Node {\n\n constructor(public key: string, public data: any, private _storage) {\n\n }\n\n save() {\n return new Promise( (res, rej) => {\n this._storage.save(this.key, this.data,\n (content) => res(),\n (error) => rej(error));\n });\n }\n}\n\n\nexport class _Persistence {\n\n private _storage: any;\n private _map = new Map<string, Node>();\n\n constructor(options?: StorageOptions) {\n\n let selectedOptions = options || DEFAULT_OPTIONS;\n\n this._storage = new SuperSimpleStorage(selectedOptions);\n }\n\n get(key: string): Promise<Node> {\n let node = this._map.get(key);\n if (node) {\n return Promise.resolve(node);\n }\n else {\n return new Promise((res, rej) => {\n this._storage.open(key,\n (content) => {\n res(this._createNode(key, content));\n },\n (error) => {\n if (error.toString() === 'Storage item not found.') {\n res(this._createNode(key, {}));\n }\n else {\n rej(error);\n }\n });\n });\n }\n }\n\n private _createNode(key, data) {\n let node = new Node(key, data, this._storage);\n this._map.set(key, node);\n return node;\n }\n\n}\n\n\nlet persistence: _Persistence;\n\n\n\nexport default class Persistence {\n\n constructor() {\n throw new Error(`This class shouldn't be instantiated, use 'getInstance'`);\n }\n\n static getInstance(options?: StorageOptions): _Persistence {\n if (!persistence) {\n persistence = new _Persistence(options);\n }\n\n return persistence;\n }\n\n /**\n * Should only be called for testing purposes\n * @param options\n * @returns {_Persistence}\n * @private\n */\n static _resetInstance(options?: StorageOptions): _Persistence {\n persistence = new _Persistence(options);\n\n return persistence;\n }\n}"],"sourceRoot":"/source/"}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["main/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;;AAEH,mCAAsB,oBAAoB,CAAC,CAAA;AAE3C,IAAY,CAAC,WAAM,eAAe,CAAC,CAAA;AAEnC,MAAM,CAAC,OAAO,GAAG,4BAAS,CAAC,oBAAoB,CAAC,MAAM,EAAE,cAAM,OAAA,CAAC,EAAD,CAAC,CAAC,CAAC","file":"main/index.js","sourcesContent":["/**\n * @fileOverview\n *\n * Created on 4/11/16.\n * @author Siggi Orn <siggi@jibo.com>\n */\n\nimport Singleton from 'jibo-cai-singleton';\n\nimport * as P from './Persistence';\n\nmodule.exports = Singleton.getOrCreateSingleton(module, () => P);"],"sourceRoot":"/source/"}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["test/MainTest.ts"],"names":[],"mappings":";AAAA,IAAY,IAAI,WAAM,MAAM,CAAC,CAAA;AAC7B,IAAY,IAAI,WAAM,MAAM,CAAC,CAAA;AACvB,wBAAM,CAAU;AACtB,IAAI,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;AAEpC,4BAAwB,qBAAqB,CAAC,CAAA;AAG9C,IAAI,IAAI,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAGrC;IACE,MAAM,CAAC,qBAAW,CAAC,cAAc,EAAE,CAAC;AACtC,CAAC;AAED,QAAQ,CAAC,iBAAiB,EAAE;IAE1B,EAAE,CAAC,qCAAqC,EAAE;QACxC,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC;QACpD,IAAI,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAE/C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAGH,EAAE,CAAC,cAAc,EAAE,UAAC,IAAI;QACtB,IAAI,CAAC,GAAG,KAAK,EAAE,CAAC;QAEhB,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC;aAChB,IAAI,CAAC,UAAA,IAAI;YACR,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACtC,IAAI,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;QACrB,CAAC,CAAC,CAAC,IAAI,CAAC;YACN,4DAA4D;YAC5D,CAAC,GAAG,KAAK,EAAE,CAAC;YACZ,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,IAAI,CAAC,UAAA,IAAI;YACV,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;YACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACvC,IAAI,EAAE,CAAC;QACT,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC,CAAC,CAAC;AAEL,CAAC,CAAC,CAAC","file":"test/MainTest.js","sourcesContent":["import * as chai from 'chai';\nimport * as path from 'path';\nlet { expect } = chai;\nlet findRoot = require('find-root');\n\nimport Persistence from '../main/Persistence';\n\n\nlet ROOT = findRoot(module.filename);\n\n\nfunction reset() {\n return Persistence._resetInstance();\n}\n\ndescribe('Main Test suite', () => {\n\n it('Loading library through main export', () => {\n let pack = require(path.join(ROOT, 'package.json'));\n let main = require(path.join(ROOT, pack.main));\n\n expect(main.default.prototype.constructor.name).to.equal('Persistence');\n });\n\n\n it('Getting data', (done) => {\n let p = reset();\n\n p.get('some-key')\n .then(node => {\n expect(node.key).to.equal('some-key');\n node.data.name = 'Bla';\n return node.save();\n }).then(() => {\n // Here we reset the storage (enforcing reloading from disk)\n p = reset();\n return p.get('some-key');\n }).then(node => {\n expect(node.key).to.equal('some-key');\n expect(node.data.name).to.equal('Bla');\n done();\n }).catch(done);\n });\n\n});\n"],"sourceRoot":"/source/"}

View File

@@ -0,0 +1 @@
{"version":3,"sources":["test/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6CAA6C;AAC7C,OAAO,CAAC,YAAY,CAAC,CAAC","file":"test/index.js","sourcesContent":["/**\n * @fileOverview\n *\n * Created on 4/11/16.\n * @author Siggi Orn <siggi@jibo.com>\n */\n\n// Here we require every individual test file\nrequire('./MainTest');"],"sourceRoot":"/source/"}

View File

@@ -0,0 +1 @@
module.exports = require("./debug");

View File

@@ -0,0 +1,30 @@
{
"name": "jibo-cai-persistence",
"version": "1.0.0",
"description": "A library for persisting character related state",
"main": "lib/index.js",
"typings": "lib/debug/dts/main/Persistence.d.ts",
"scripts": {
"build-clean": "rm -rf node_modules; npm cache clear; npm install; gulp clean; gulp debug",
"test": "gulp debug; gulp test"
},
"dependencies": {
"jibo-cai-singleton": "^3.0.0",
"supersimplestorage": "0.0.2"
},
"devDependencies": {
"chai": "^3.5.0",
"find-root": "^1.0.0",
"gulp": "^3.9.1",
"jibo-gulp": "^1.7.1"
},
"repository": {
"type": "git",
"url": "git@github.jibo.com:CharacterAI/jibo-cai-persistence"
},
"author": "Siggi Orn <siggi@jibo.com>",
"license": "ISC",
"pre-commit": [
"test"
]
}