@game_ryo/lsji 0.1.0 → 0.3.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/package.json +15 -7
- package/src/cli.js +395 -62
- package/src/execution/budget/circuit-breaker.js +245 -0
- package/src/execution/budget/cost-tracker.js +387 -0
- package/src/execution/budget/index.js +63 -0
- package/src/execution/budget/token-counter.js +159 -0
- package/src/execution/engine.js +428 -0
- package/src/execution/hitl/approval-gate.js +210 -0
- package/src/execution/hitl/index.js +12 -0
- package/src/execution/hitl/notifier.js +151 -0
- package/src/execution/hitl/store.js +311 -0
- package/src/execution/idempotency.js +312 -0
- package/src/execution/index.js +14 -0
- package/src/index.js +80 -4
- package/src/llm/index.js +21 -0
- package/src/llm/llm-agent.js +357 -0
- package/src/llm/memory/conversation.js +271 -0
- package/src/llm/memory/episodic.js +312 -0
- package/src/llm/memory/index.js +12 -0
- package/src/llm/memory/semantic.js +324 -0
- package/src/llm/plugins/index.js +202 -0
- package/src/llm/prompt-manager.js +332 -0
- package/src/llm/providers/anthropic.js +250 -0
- package/src/llm/providers/base.js +116 -0
- package/src/llm/providers/local.js +163 -0
- package/src/llm/providers/openai.js +212 -0
- package/src/llm/tools/registry.js +342 -0
- package/src/server/index.js +416 -0
- package/src/server/ui/index.html +16 -0
- package/src/server/ui/package.json +19 -0
- package/src/server/ui/src/main.jsx +10 -0
- package/src/server/ui/src/styles.css +260 -0
- package/src/server/ui/vite.config.js +27 -0
- package/docs/README.md +0 -43
- package/docs/blog/2019-05-28-first-blog-post.mdx +0 -12
- package/docs/blog/2019-05-29-long-blog-post.mdx +0 -44
- package/docs/blog/2021-08-01-mdx-blog-post.mdx +0 -24
- package/docs/blog/2021-08-26-welcome/docusaurus-plushie-banner.jpeg +0 -0
- package/docs/blog/2021-08-26-welcome/index.mdx +0 -29
- package/docs/blog/authors.yml +0 -25
- package/docs/blog/tags.yml +0 -19
- package/docs/docs/api/agent.md +0 -151
- package/docs/docs/api/env.md +0 -133
- package/docs/docs/api/environments.md +0 -102
- package/docs/docs/api/qlearning.md +0 -138
- package/docs/docs/api/storage.md +0 -168
- package/docs/docs/architecture.md +0 -155
- package/docs/docs/cli.md +0 -210
- package/docs/docs/contributing.md +0 -162
- package/docs/docs/core-concepts.md +0 -152
- package/docs/docs/examples/advanced-training.md +0 -244
- package/docs/docs/examples/custom-environment.md +0 -198
- package/docs/docs/examples/custom-storage.md +0 -251
- package/docs/docs/getting-started.md +0 -91
- package/docs/docusaurus.config.ts +0 -149
- package/docs/package-lock.json +0 -19522
- package/docs/package.json +0 -49
- package/docs/sidebars.ts +0 -33
- package/docs/src/components/HomepageFeatures/index.tsx +0 -71
- package/docs/src/components/HomepageFeatures/styles.module.css +0 -11
- package/docs/src/css/custom.css +0 -79
- package/docs/src/pages/index.module.css +0 -23
- package/docs/src/pages/index.tsx +0 -44
- package/docs/src/pages/markdown-page.mdx +0 -7
- package/docs/static/.nojekyll +0 -0
- package/docs/static/img/docusaurus-social-card.jpg +0 -0
- package/docs/static/img/docusaurus.png +0 -0
- package/docs/static/img/favicon.ico +0 -0
- package/docs/static/img/logo.png +0 -0
- package/docs/static/img/undraw_docusaurus_mountain.svg +0 -171
- package/docs/static/img/undraw_docusaurus_react.svg +0 -170
- package/docs/static/img/undraw_docusaurus_tree.svg +0 -40
- package/docs/tsconfig.json +0 -12
- package/legacy/worker.js +0 -166
- package/legacy/wrangler.toml +0 -11
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Getting Started
|
|
3
|
-
description: Install LSJI and run your first RL agent
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Getting Started
|
|
7
|
-
|
|
8
|
-
## Prerequisites
|
|
9
|
-
|
|
10
|
-
- **Node.js 22+** (required for built-in `node:sqlite`)
|
|
11
|
-
- npm, yarn, or pnpm
|
|
12
|
-
|
|
13
|
-
## Installation
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
# Install as a library
|
|
17
|
-
npm install lsji
|
|
18
|
-
|
|
19
|
-
# Or use CLI directly with npx
|
|
20
|
-
npx lsji --help
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Quick Start
|
|
24
|
-
|
|
25
|
-
### 1. Train an Agent
|
|
26
|
-
|
|
27
|
-
```bash
|
|
28
|
-
# Train with default settings (200 episodes, random pattern)
|
|
29
|
-
npx lsji train --episodes 500
|
|
30
|
-
|
|
31
|
-
# Train against specific opponent
|
|
32
|
-
npx lsji train --episodes 1000 --opponent counter
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
### 2. Play Against the Agent
|
|
36
|
-
|
|
37
|
-
```bash
|
|
38
|
-
# Play Rock (0)
|
|
39
|
-
npx lsji play --hand 0
|
|
40
|
-
|
|
41
|
-
# Play Paper (2)
|
|
42
|
-
npx lsji play --hand 2
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
### 3. Check Status
|
|
46
|
-
|
|
47
|
-
```bash
|
|
48
|
-
npx lsji status --json
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
## Using as a Library
|
|
52
|
-
|
|
53
|
-
```javascript
|
|
54
|
-
import { Agent, QLearning, createStorage, RockPaperScissorsEnv } from 'lsji';
|
|
55
|
-
|
|
56
|
-
async function main() {
|
|
57
|
-
// Create storage (SQLite recommended for persistence)
|
|
58
|
-
const storage = await createStorage('sqlite', { path: './my-agent.db' });
|
|
59
|
-
|
|
60
|
-
// Create Q-Learning engine
|
|
61
|
-
const qlearning = new QLearning({
|
|
62
|
-
alpha: 0.1, // learning rate
|
|
63
|
-
gamma: 0.9, // discount factor
|
|
64
|
-
epsilon: 0.1, // exploration rate
|
|
65
|
-
storage
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// Create environment
|
|
69
|
-
const env = new RockPaperScissorsEnv({ opponent: 'random' });
|
|
70
|
-
|
|
71
|
-
// Create agent
|
|
72
|
-
const agent = new Agent({ qlearning, storage, env });
|
|
73
|
-
|
|
74
|
-
// Train
|
|
75
|
-
await agent.train({ episodes: 1000 });
|
|
76
|
-
|
|
77
|
-
// Play
|
|
78
|
-
const result = await agent.play(0); // 0 = Rock
|
|
79
|
-
console.log(result);
|
|
80
|
-
|
|
81
|
-
await storage.close();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
main().catch(console.error);
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Next Steps
|
|
88
|
-
|
|
89
|
-
- Read [Core Concepts](/docs/core-concepts) to understand the architecture
|
|
90
|
-
- Explore [API Reference](/docs/api/agent) for detailed class documentation
|
|
91
|
-
- Try [Examples](/docs/examples/custom-environment) for custom environments
|
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import {themes as prismThemes} from 'prism-react-renderer';
|
|
2
|
-
import type {Config} from '@docusaurus/types';
|
|
3
|
-
import type * as Preset from '@docusaurus/preset-classic';
|
|
4
|
-
|
|
5
|
-
const config: Config = {
|
|
6
|
-
title: 'LSJI',
|
|
7
|
-
tagline: 'Learning System for JavaScript Intelligence',
|
|
8
|
-
favicon: 'img/favicon.ico',
|
|
9
|
-
|
|
10
|
-
future: {
|
|
11
|
-
v4: true,
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
url: 'https://lsji.ryopc.org',
|
|
15
|
-
baseUrl: '/',
|
|
16
|
-
|
|
17
|
-
organizationName: 'ryotagtagtag-wq',
|
|
18
|
-
projectName: 'LSJI',
|
|
19
|
-
|
|
20
|
-
onBrokenLinks: 'throw',
|
|
21
|
-
onBrokenMarkdownLinks: 'warn',
|
|
22
|
-
|
|
23
|
-
i18n: {
|
|
24
|
-
defaultLocale: 'en',
|
|
25
|
-
locales: ['en'],
|
|
26
|
-
},
|
|
27
|
-
|
|
28
|
-
presets: [
|
|
29
|
-
[
|
|
30
|
-
'classic',
|
|
31
|
-
{
|
|
32
|
-
docs: {
|
|
33
|
-
sidebarPath: './sidebars.ts',
|
|
34
|
-
editUrl: 'https://github.com/ryotagtagtag-wq/LSJI/tree/main/docs/',
|
|
35
|
-
},
|
|
36
|
-
blog: {
|
|
37
|
-
showReadingTime: true,
|
|
38
|
-
feedOptions: {
|
|
39
|
-
type: ['rss', 'atom'],
|
|
40
|
-
xslt: true,
|
|
41
|
-
},
|
|
42
|
-
editUrl: 'https://github.com/ryotagtagtag-wq/LSJI/tree/main/docs/',
|
|
43
|
-
onInlineTags: 'warn',
|
|
44
|
-
onInlineAuthors: 'warn',
|
|
45
|
-
onUntruncatedBlogPosts: 'warn',
|
|
46
|
-
},
|
|
47
|
-
theme: {
|
|
48
|
-
customCss: './src/css/custom.css',
|
|
49
|
-
},
|
|
50
|
-
} satisfies Preset.Options,
|
|
51
|
-
],
|
|
52
|
-
],
|
|
53
|
-
|
|
54
|
-
themeConfig: {
|
|
55
|
-
image: 'img/lsji-social-card.jpg',
|
|
56
|
-
colorMode: {
|
|
57
|
-
respectPrefersColorScheme: true,
|
|
58
|
-
},
|
|
59
|
-
navbar: {
|
|
60
|
-
title: 'LSJI',
|
|
61
|
-
logo: {
|
|
62
|
-
alt: 'LSJI Logo',
|
|
63
|
-
src: 'img/logo.png',
|
|
64
|
-
},
|
|
65
|
-
items: [
|
|
66
|
-
{
|
|
67
|
-
type: 'docSidebar',
|
|
68
|
-
sidebarId: 'tutorialSidebar',
|
|
69
|
-
position: 'left',
|
|
70
|
-
label: 'Docs',
|
|
71
|
-
},
|
|
72
|
-
{to: '/blog', label: 'Blog', position: 'left'},
|
|
73
|
-
{
|
|
74
|
-
href: 'https://github.com/ryotagtagtag-wq/LSJI',
|
|
75
|
-
label: 'GitHub',
|
|
76
|
-
position: 'right',
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
href: 'https://www.npmjs.com/package/lsji',
|
|
80
|
-
label: 'npm',
|
|
81
|
-
position: 'right',
|
|
82
|
-
},
|
|
83
|
-
],
|
|
84
|
-
},
|
|
85
|
-
footer: {
|
|
86
|
-
style: 'dark',
|
|
87
|
-
links: [
|
|
88
|
-
{
|
|
89
|
-
title: 'Documentation',
|
|
90
|
-
items: [
|
|
91
|
-
{
|
|
92
|
-
label: 'Getting Started',
|
|
93
|
-
to: '/docs/getting-started',
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
label: 'Core Concepts',
|
|
97
|
-
to: '/docs/core-concepts',
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
label: 'API Reference',
|
|
101
|
-
to: '/docs/api/agent',
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
label: 'CLI Reference',
|
|
105
|
-
to: '/docs/cli',
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
{
|
|
110
|
-
title: 'Community',
|
|
111
|
-
items: [
|
|
112
|
-
{
|
|
113
|
-
label: 'GitHub Issues',
|
|
114
|
-
href: 'https://github.com/ryotagtagtag-wq/LSJI/issues',
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
label: 'GitHub Discussions',
|
|
118
|
-
href: 'https://github.com/ryotagtagtag-wq/LSJI/discussions',
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
title: 'More',
|
|
124
|
-
items: [
|
|
125
|
-
{
|
|
126
|
-
label: 'Blog',
|
|
127
|
-
to: '/blog',
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
label: 'GitHub',
|
|
131
|
-
href: 'https://github.com/ryotagtagtag-wq/LSJI',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
label: 'npm',
|
|
135
|
-
href: 'https://www.npmjs.com/package/lsji',
|
|
136
|
-
},
|
|
137
|
-
],
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
copyright: `Copyright © ${new Date().getFullYear()} LSJI Contributors. Built with Docusaurus.`,
|
|
141
|
-
},
|
|
142
|
-
prism: {
|
|
143
|
-
theme: prismThemes.github,
|
|
144
|
-
darkTheme: prismThemes.dracula,
|
|
145
|
-
},
|
|
146
|
-
} satisfies Preset.ThemeConfig,
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
export default config;
|