openkbs 0.0.66 → 0.0.70

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.
Files changed (63) hide show
  1. package/README.md +1 -0
  2. package/elastic/README.md +1 -1
  3. package/elastic/functions.md +5 -5
  4. package/elastic/pulse.md +2 -2
  5. package/package.json +2 -2
  6. package/scripts/deploy.js +68 -0
  7. package/src/actions.js +59 -0
  8. package/src/index.js +8 -6
  9. package/templates/.claude/skills/openkbs/SKILL.md +37 -8
  10. package/templates/.claude/skills/openkbs/examples/monitoring-bot/README.md +55 -0
  11. package/templates/.claude/skills/openkbs/examples/monitoring-bot/app/instructions.txt +40 -0
  12. package/templates/.claude/skills/openkbs/examples/monitoring-bot/app/settings.json +41 -0
  13. package/templates/.claude/skills/openkbs/examples/monitoring-bot/openkbs.json +3 -0
  14. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/actions.js +141 -0
  15. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/handler.js +32 -0
  16. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/memoryHelpers.js +91 -0
  17. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/onCronjob.js +105 -0
  18. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/onPublicAPIRequest.js +165 -0
  19. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/onRequest.js +2 -0
  20. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/onResponse.js +2 -0
  21. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Frontend/contentRender.js +74 -0
  22. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Frontend/contentRender.json +3 -0
  23. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/auth/index.mjs +228 -0
  24. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/auth/package.json +7 -0
  25. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/posts/index.mjs +287 -0
  26. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/posts/package.json +10 -0
  27. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/settings.json +4 -0
  28. package/templates/.claude/skills/openkbs/examples/nodejs-demo/openkbs.json +16 -0
  29. package/templates/.claude/skills/openkbs/examples/nodejs-demo/site/index.html +658 -0
  30. package/templates/.claude/skills/openkbs/examples/nodejs-demo/site/settings.json +4 -0
  31. package/templates/.claude/skills/openkbs/patterns/cronjob-batch-processing.md +278 -0
  32. package/templates/.claude/skills/openkbs/patterns/cronjob-monitoring.md +341 -0
  33. package/templates/.claude/skills/openkbs/patterns/file-upload.md +205 -0
  34. package/templates/.claude/skills/openkbs/patterns/image-generation.md +139 -0
  35. package/templates/.claude/skills/openkbs/patterns/memory-system.md +264 -0
  36. package/templates/.claude/skills/openkbs/patterns/public-api-item-proxy.md +254 -0
  37. package/templates/.claude/skills/openkbs/patterns/scheduled-tasks.md +157 -0
  38. package/templates/.claude/skills/openkbs/patterns/telegram-webhook.md +424 -0
  39. package/templates/.claude/skills/openkbs/patterns/telegram.md +222 -0
  40. package/templates/.claude/skills/openkbs/patterns/vectordb-archive.md +231 -0
  41. package/templates/.claude/skills/openkbs/patterns/video-generation.md +145 -0
  42. package/templates/.claude/skills/openkbs/patterns/web-publishing.md +257 -0
  43. package/templates/.claude/skills/openkbs/reference/backend-sdk.md +13 -2
  44. package/templates/.claude/skills/openkbs/reference/elastic-services.md +61 -29
  45. package/templates/platform/README.md +35 -0
  46. package/templates/platform/agents/assistant/app/icon.png +0 -0
  47. package/templates/platform/agents/assistant/app/instructions.txt +13 -0
  48. package/templates/platform/agents/assistant/app/settings.json +13 -0
  49. package/templates/platform/agents/assistant/src/Events/actions.js +50 -0
  50. package/templates/platform/agents/assistant/src/Events/handler.js +54 -0
  51. package/templates/platform/agents/assistant/src/Events/onRequest.js +3 -0
  52. package/templates/platform/agents/assistant/src/Events/onRequest.json +5 -0
  53. package/templates/platform/agents/assistant/src/Events/onResponse.js +3 -0
  54. package/templates/platform/agents/assistant/src/Events/onResponse.json +5 -0
  55. package/templates/platform/agents/assistant/src/Frontend/contentRender.js +27 -0
  56. package/templates/platform/agents/assistant/src/Frontend/contentRender.json +10 -0
  57. package/templates/platform/functions/api/index.mjs +63 -0
  58. package/templates/platform/functions/api/package.json +4 -0
  59. package/templates/platform/openkbs.json +19 -0
  60. package/templates/platform/site/index.html +75 -0
  61. package/version.json +3 -3
  62. package/templates/.claude/skills/openkbs/examples/ai-copywriter-agent/scripts/run_job.js +0 -26
  63. package/templates/.claude/skills/openkbs/examples/ai-copywriter-agent/scripts/utils/agent_client.js +0 -265
@@ -18,7 +18,7 @@ OpenKBS provides managed cloud infrastructure that scales automatically.
18
18
  "elastic": {
19
19
  "functions": {
20
20
  "hello": {
21
- "runtime": "nodejs22.x",
21
+ "runtime": "nodejs24.x",
22
22
  "memory": 512,
23
23
  "timeout": 30
24
24
  }
@@ -76,17 +76,25 @@ openkbs fn invoke hello '{"test": true}' # Invoke function
76
76
 
77
77
  ### Supported Runtimes
78
78
 
79
- - `nodejs22.x`, `nodejs20.x`, `nodejs18.x`
80
- - `python3.12`, `python3.11`
81
- - `java21`, `java17`
79
+ - `nodejs24.x`, `nodejs22.x`, `nodejs20.x`
80
+ - `python3.14`, `python3.13`
81
+ - `java25`, `java21`
82
82
 
83
- ### Access from Agent
83
+ ### Access URLs
84
+
85
+ Functions are accessible via CloudFront on your whitelabel domain:
86
+
87
+ ```
88
+ https://yourdomain.com/functionName
89
+ ```
90
+
91
+ From frontend (site/), use relative paths:
84
92
 
85
93
  ```javascript
86
- // In actions.js
87
- const response = await fetch('https://fn.openkbs.com/YOUR_KB_ID/hello', {
94
+ const response = await fetch('/api', {
88
95
  method: 'POST',
89
- body: JSON.stringify({ data: 'value' })
96
+ headers: { 'Content-Type': 'application/json' },
97
+ body: JSON.stringify({ action: 'hello' })
90
98
  });
91
99
  ```
92
100
 
@@ -106,7 +114,7 @@ openkbs postgres status # Show database info
106
114
 
107
115
  ### Access from Agent
108
116
 
109
- Connection string is available as `POSTGRES_URL` environment variable:
117
+ Connection string is available as `DATABASE_URL` environment variable:
110
118
 
111
119
  ```javascript
112
120
  // In onRequest.js or actions.js
@@ -114,7 +122,7 @@ import pg from 'pg';
114
122
  const { Pool } = pg;
115
123
 
116
124
  const pool = new Pool({
117
- connectionString: process.env.POSTGRES_URL,
125
+ connectionString: process.env.DATABASE_URL,
118
126
  ssl: { rejectUnauthorized: false }
119
127
  });
120
128
 
@@ -162,18 +170,20 @@ console.log(uploaded.url); // Public URL
162
170
 
163
171
  // Get presigned URL for upload
164
172
  const presigned = await openkbs.kb({
165
- action: 'getPresignedUploadUrl',
166
- filename: 'document.pdf',
167
- contentType: 'application/pdf'
173
+ action: 'createPresignedURL',
174
+ namespace: 'files',
175
+ fileName: 'document.pdf',
176
+ fileType: 'application/pdf',
177
+ presignedOperation: 'putObject'
168
178
  });
169
- // Returns: { uploadUrl, publicUrl }
179
+ // Returns presigned URL string - upload with axios.put()
170
180
  ```
171
181
 
172
182
  ---
173
183
 
174
184
  ## Pulse (WebSocket)
175
185
 
176
- Real-time messaging and pub/sub.
186
+ Real-time messaging and pub/sub via SDK.
177
187
 
178
188
  ### CLI Commands
179
189
 
@@ -182,21 +192,43 @@ openkbs pulse status # Show Pulse status
182
192
  openkbs pulse channels # List channels
183
193
  ```
184
194
 
185
- ### Access from Agent
195
+ ### Backend (Lambda functions)
186
196
 
187
197
  ```javascript
188
- // Publish message
189
- await openkbs.pulse.publish('channel-name', {
190
- type: 'notification',
191
- data: { message: 'Hello subscribers!' }
198
+ import pulse from 'openkbs-pulse/server';
199
+
200
+ // Get token for frontend
201
+ const tokenData = await pulse.getToken(kbId, apiKey, userId);
202
+ // Returns: { token, endpoint }
203
+
204
+ // Publish to channel
205
+ await pulse.publish('posts', 'new_post', { post }, { kbId, apiKey });
206
+
207
+ // Get presence
208
+ const presence = await pulse.presence('posts', { kbId, apiKey });
209
+ ```
210
+
211
+ ### Frontend (Browser)
212
+
213
+ ```html
214
+ <script src="https://unpkg.com/openkbs-pulse/pulse.js"></script>
215
+ ```
216
+
217
+ ```javascript
218
+ // Connect (token from backend)
219
+ const realtime = new Pulse.Realtime({ kbId, token, endpoint, clientId });
220
+
221
+ // Subscribe to channel
222
+ const channel = realtime.channels.get('posts');
223
+ channel.subscribe('new_post', (message) => {
224
+ console.log('New post:', message.data);
192
225
  });
193
226
 
194
- // Subscribe (frontend)
195
- const ws = new WebSocket(`wss://pulse.openkbs.com/${kbId}/channel-name`);
196
- ws.onmessage = (event) => {
197
- const data = JSON.parse(event.data);
198
- console.log('Received:', data);
199
- };
227
+ // Presence
228
+ channel.presence.enter({ name: 'Alice' });
229
+ channel.presence.subscribe((members) => {
230
+ console.log('Online:', members.length);
231
+ });
200
232
  ```
201
233
 
202
234
  ### Use Cases
@@ -218,7 +250,7 @@ Complete Node.js application with all services:
218
250
  {
219
251
  "elastic": {
220
252
  "functions": {
221
- "api": { "runtime": "nodejs22.x", "memory": 512 }
253
+ "api": { "runtime": "nodejs24.x", "memory": 512 }
222
254
  },
223
255
  "postgres": true,
224
256
  "storage": true,
@@ -234,7 +266,7 @@ import pg from 'pg';
234
266
  const { Pool } = pg;
235
267
 
236
268
  const pool = new Pool({
237
- connectionString: process.env.POSTGRES_URL,
269
+ connectionString: process.env.DATABASE_URL,
238
270
  ssl: { rejectUnauthorized: false }
239
271
  });
240
272
 
@@ -304,7 +336,7 @@ import psycopg2
304
336
  import os
305
337
 
306
338
  def handler(event, context):
307
- conn = psycopg2.connect(os.environ['POSTGRES_URL'])
339
+ conn = psycopg2.connect(os.environ['DATABASE_URL'])
308
340
  cur = conn.cursor()
309
341
  cur.execute("SELECT * FROM items")
310
342
  rows = cur.fetchall()
@@ -0,0 +1,35 @@
1
+ # {{APP_NAME}}
2
+
3
+ OpenKBS full-stack platform with Postgres, Storage+CloudFront, and Pulse.
4
+
5
+ ## Structure
6
+
7
+ ```
8
+ {{APP_NAME}}/
9
+ ├── openkbs.json # Elastic services config
10
+ ├── agents/ # AI agents (optional)
11
+ ├── functions/
12
+ │ └── api/ # Serverless function
13
+ └── site/
14
+ └── index.html # Static site
15
+ ```
16
+
17
+ ## Deploy
18
+
19
+ ```bash
20
+ # Deploy elastic services
21
+ openkbs deploy
22
+
23
+ # Deploy function
24
+ openkbs fn push api
25
+
26
+ # Deploy site
27
+ openkbs site push
28
+ ```
29
+
30
+ ## Elastic Services
31
+
32
+ - **Postgres**: `openkbs postgres shell`
33
+ - **Storage**: `openkbs storage ls` (CDN at /media/*)
34
+ - **Pulse**: `openkbs pulse status`
35
+ - **Functions**: `openkbs fn list`
@@ -0,0 +1,13 @@
1
+ You are an AI assistant, assist users with their inquiries and tasks efficiently.
2
+
3
+ LIST OF AVAILABLE COMMANDS:
4
+ To execute a command, output it as text message and wait for system response.
5
+
6
+ <googleSearch>
7
+ {
8
+ "query": "search query"
9
+ }
10
+ </googleSearch>
11
+ Description: """
12
+ Get results from Google Search API.
13
+ """
@@ -0,0 +1,13 @@
1
+ {
2
+ "chatVendor": "google",
3
+ "kbDescription": "{{{openkbsAppName}}}",
4
+ "kbTitle": "{{{openkbsAppName}}}",
5
+ "model": "gemini-3-pro",
6
+ "inputTools": [
7
+ "speechToText"
8
+ ],
9
+ "embeddingModel": "text-embedding-3-large",
10
+ "embeddingDimension": 3072,
11
+ "searchEngine": "VectorDB",
12
+ "itemTypes": {}
13
+ }
@@ -0,0 +1,50 @@
1
+ export const getActions = (meta, event) => [
2
+ // Google Search with JSON
3
+ // Usage: <googleSearch>{"query": "search terms"}</googleSearch>
4
+ [/<googleSearch>([\s\S]*?)<\/googleSearch>/s, async (match) => {
5
+ try {
6
+ const data = JSON.parse(match[1].trim());
7
+ const response = await openkbs.googleSearch(data.query);
8
+ const results = response?.map(({ title, link, snippet, pagemap }) => ({
9
+ title,
10
+ link,
11
+ snippet,
12
+ image: pagemap?.metatags?.[0]?.["og:image"]
13
+ }));
14
+ return { data: results, ...meta };
15
+ } catch (e) {
16
+ return { error: e.message, ...meta };
17
+ }
18
+ }],
19
+
20
+ // MCP (Model Context Protocol) Tool Handler
21
+ // Automatically handles all MCP tool calls: <mcp_{server}_{toolName}>{params}</mcp_{server}_{toolName}>
22
+ // Configure MCP servers in settings.json: { "options": { "mcpServers": { "github": {} } } }
23
+ // Add required secrets (e.g., GITHUB_PERSONAL_ACCESS_TOKEN) in KB secrets
24
+ [/<mcp_([a-z0-9-]+)_([a-z0-9_]+)>([\s\S]*?)<\/mcp_\1_\2>/s, async (match) => {
25
+ try {
26
+ const server = match[1];
27
+ const toolName = match[2];
28
+ const args = match[3].trim() ? JSON.parse(match[3].trim()) : {};
29
+
30
+ const result = await openkbs.mcp.callTool(server, toolName, args);
31
+ return {
32
+ type: 'MCP_RESULT',
33
+ server,
34
+ tool: toolName,
35
+ data: result?.content || [],
36
+ ...meta,
37
+ _meta_actions: ['REQUEST_CHAT_MODEL']
38
+ };
39
+ } catch (e) {
40
+ return {
41
+ type: 'MCP_ERROR',
42
+ error: e.message,
43
+ ...meta,
44
+ _meta_actions: ['REQUEST_CHAT_MODEL']
45
+ };
46
+ }
47
+ }],
48
+
49
+ // add more actions here
50
+ ];
@@ -0,0 +1,54 @@
1
+ import { getActions } from './actions.js';
2
+
3
+ export const backendHandler = async (event) => {
4
+ const meta = { _meta_actions: ["REQUEST_CHAT_MODEL"] };
5
+ const lastMessage = event.payload.messages[event.payload.messages.length - 1];
6
+ const actions = getActions(meta, event);
7
+
8
+ const matchingActions = [];
9
+ actions.forEach(([regex, action]) => {
10
+ const matches = [...(lastMessage.content || '').matchAll(new RegExp(regex, 'g'))];
11
+ matches.forEach(match => {
12
+ matchingActions.push(action(match, event));
13
+ });
14
+ });
15
+
16
+ if (matchingActions.length > 0) {
17
+ try {
18
+ const results = await Promise.all(matchingActions);
19
+
20
+ // Check if any result needs LLM callback
21
+ const needsChatModel = results.some(r =>
22
+ r?._meta_actions?.includes('REQUEST_CHAT_MODEL')
23
+ );
24
+
25
+ // Handle image data for LLM vision
26
+ if (results.some(r => r?.data?.some?.(item => item?.type === 'image_url'))) {
27
+ return {
28
+ ...results[0],
29
+ _meta_actions: needsChatModel ? ["REQUEST_CHAT_MODEL"] : []
30
+ };
31
+ }
32
+
33
+ // Single result - return as is
34
+ if (results.length === 1) {
35
+ return results[0];
36
+ }
37
+
38
+ // Multiple results
39
+ return {
40
+ type: 'MULTI_RESPONSE',
41
+ data: results,
42
+ _meta_actions: needsChatModel ? ["REQUEST_CHAT_MODEL"] : []
43
+ };
44
+ } catch (error) {
45
+ return {
46
+ type: 'ERROR',
47
+ error: error.message,
48
+ ...meta
49
+ };
50
+ }
51
+ }
52
+
53
+ return { type: 'CONTINUE' };
54
+ };
@@ -0,0 +1,3 @@
1
+ import {backendHandler} from './handler';
2
+
3
+ export const handler = async (event) => backendHandler(event)
@@ -0,0 +1,5 @@
1
+ {
2
+ "dependencies": {
3
+
4
+ }
5
+ }
@@ -0,0 +1,3 @@
1
+ import {backendHandler} from './handler';
2
+
3
+ export const handler = async (event) => backendHandler(event)
@@ -0,0 +1,5 @@
1
+ {
2
+ "dependencies": {
3
+
4
+ }
5
+ }
@@ -0,0 +1,27 @@
1
+ import React, {useEffect} from 'react';
2
+
3
+ const onRenderChatMessage = async (params) => {
4
+ const { content } = params.messages[params.msgIndex];
5
+ }
6
+
7
+ const Header = ({ setRenderSettings}) => {
8
+ useEffect(() => {
9
+ setRenderSettings({
10
+ disableShareButton: true,
11
+ disableBalanceView: true,
12
+ disableSentLabel: false,
13
+ disableChatAvatar: false,
14
+ disableChatModelsSelect: false,
15
+ disableContextItems: false,
16
+ disableCopyButton: false,
17
+ disableEmojiButton: false,
18
+ disableTextToSpeechButton: false,
19
+ disableMobileLeftButton: false,
20
+ });
21
+ }, [setRenderSettings]);
22
+
23
+ }
24
+
25
+ const exports = { onRenderChatMessage, Header };
26
+ window.contentRender = exports;
27
+ export default exports;
@@ -0,0 +1,10 @@
1
+ {
2
+ "dependencies": {
3
+ "react": "^18.2.0 (fixed)",
4
+ "react-dom": "^18.2.0 (fixed)",
5
+ "@mui/material": "^5.16.1 (fixed)",
6
+ "@mui/icons-material": "^5.16.1 (fixed)",
7
+ "@emotion/react": "^11.10.6 (fixed)",
8
+ "@emotion/styled": "^11.10.6 (fixed)"
9
+ }
10
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * {{APP_NAME}} API
3
+ *
4
+ * Endpoint: https://yourdomain.com/api
5
+ *
6
+ * Environment variables:
7
+ * - DATABASE_URL (Postgres connection string)
8
+ * - STORAGE_BUCKET (S3 bucket name)
9
+ * - OPENKBS_KB_ID (your kbId)
10
+ */
11
+
12
+ export const handler = async (event) => {
13
+ const headers = {
14
+ 'Content-Type': 'application/json',
15
+ 'Access-Control-Allow-Origin': '*',
16
+ 'Access-Control-Allow-Headers': 'Content-Type'
17
+ };
18
+
19
+ if (event.requestContext?.http?.method === 'OPTIONS') {
20
+ return { statusCode: 200, headers, body: '' };
21
+ }
22
+
23
+ try {
24
+ const body = JSON.parse(event.body || '{}');
25
+ const { action } = body;
26
+
27
+ switch (action) {
28
+ case 'hello':
29
+ return {
30
+ statusCode: 200,
31
+ headers,
32
+ body: JSON.stringify({
33
+ message: 'Hello from {{APP_NAME}}!',
34
+ timestamp: new Date().toISOString()
35
+ })
36
+ };
37
+
38
+ case 'status':
39
+ return {
40
+ statusCode: 200,
41
+ headers,
42
+ body: JSON.stringify({
43
+ postgres: !!process.env.DATABASE_URL,
44
+ storage: !!process.env.STORAGE_BUCKET,
45
+ kbId: process.env.OPENKBS_KB_ID
46
+ })
47
+ };
48
+
49
+ default:
50
+ return {
51
+ statusCode: 400,
52
+ headers,
53
+ body: JSON.stringify({ error: 'Unknown action', available: ['hello', 'status'] })
54
+ };
55
+ }
56
+ } catch (error) {
57
+ return {
58
+ statusCode: 500,
59
+ headers,
60
+ body: JSON.stringify({ error: error.message })
61
+ };
62
+ }
63
+ };
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "module",
3
+ "dependencies": {}
4
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "{{APP_NAME}}",
3
+ "region": "us-east-1",
4
+
5
+ "elastic": {
6
+ "postgres": true,
7
+ "storage": {
8
+ "cloudfront": "media"
9
+ },
10
+ "pulse": true,
11
+ "functions": {
12
+ "api": {
13
+ "runtime": "nodejs24.x",
14
+ "memory": 512,
15
+ "timeout": 30
16
+ }
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,75 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>{{APP_NAME}}</title>
7
+ <style>
8
+ * { margin: 0; padding: 0; box-sizing: border-box; }
9
+ body {
10
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
11
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
12
+ min-height: 100vh;
13
+ display: flex;
14
+ align-items: center;
15
+ justify-content: center;
16
+ }
17
+ .container {
18
+ background: white;
19
+ padding: 3rem;
20
+ border-radius: 16px;
21
+ box-shadow: 0 20px 60px rgba(0,0,0,0.3);
22
+ text-align: center;
23
+ max-width: 500px;
24
+ }
25
+ h1 { color: #333; margin-bottom: 1rem; }
26
+ p { color: #666; margin-bottom: 2rem; line-height: 1.6; }
27
+ .btn {
28
+ display: inline-block;
29
+ padding: 12px 24px;
30
+ background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
31
+ color: white;
32
+ text-decoration: none;
33
+ border-radius: 8px;
34
+ border: none;
35
+ font-weight: 600;
36
+ cursor: pointer;
37
+ }
38
+ .btn:hover { opacity: 0.9; }
39
+ pre {
40
+ margin-top: 2rem;
41
+ text-align: left;
42
+ background: #f5f5f5;
43
+ padding: 1rem;
44
+ border-radius: 8px;
45
+ display: none;
46
+ overflow: auto;
47
+ }
48
+ </style>
49
+ </head>
50
+ <body>
51
+ <div class="container">
52
+ <h1>{{APP_NAME}}</h1>
53
+ <p>Your OpenKBS platform is ready.</p>
54
+ <button class="btn" onclick="testAPI()">Test API</button>
55
+ <pre id="result"></pre>
56
+ </div>
57
+ <script>
58
+ async function testAPI() {
59
+ const result = document.getElementById('result');
60
+ result.style.display = 'block';
61
+ result.textContent = 'Loading...';
62
+ try {
63
+ const res = await fetch('/api', {
64
+ method: 'POST',
65
+ headers: { 'Content-Type': 'application/json' },
66
+ body: JSON.stringify({ action: 'hello' })
67
+ });
68
+ result.textContent = JSON.stringify(await res.json(), null, 2);
69
+ } catch (e) {
70
+ result.textContent = 'Error: ' + e.message;
71
+ }
72
+ }
73
+ </script>
74
+ </body>
75
+ </html>
package/version.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.0.66",
3
- "releaseDate": "2026-01-04",
4
- "releaseNotes": "OpenKBS CLI version 0.0.66"
2
+ "version": "0.0.70",
3
+ "releaseDate": "2026-01-07",
4
+ "releaseNotes": "OpenKBS CLI version 0.0.70"
5
5
  }
@@ -1,26 +0,0 @@
1
- // This boilerplate code is a starting point for development.
2
-
3
- const OpenKBSAgentClient = require('./utils/agent_client');
4
-
5
- async function main() {
6
- const client = new OpenKBSAgentClient();
7
-
8
- const message = `Today's Date: ${new Date().toLocaleDateString()}
9
-
10
- PROCESS_PRODUCT:
11
- Product Name: iPhone 14 Pro Max
12
- Product Code: MQ9X3RX/A
13
- ID: 97649
14
-
15
- find at least 2 images and 2 videos
16
- `;
17
-
18
- try {
19
- const result = await client.runJob(message);
20
- console.log('Job completed:', result);
21
- } catch (error) {
22
- console.error('Job failed:', error.message);
23
- }
24
- }
25
-
26
- main();