@surph_ai/sdk 0.0.7 → 0.0.8
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/index.js +1 -0
- package/package.json +2 -1
- package/scaffold/index.js +11 -42
- package/scaffold/tool/env.txt +1 -1
- package/scaffold/tool/package.json +4 -1
- package/toolserver/chat.js +95147 -0
- package/scaffold/tool/tools/manifest.json +0 -1
package/index.js
CHANGED
|
@@ -125,6 +125,7 @@ program.command('toolserver')
|
|
|
125
125
|
.action(async (cmd, options) => {
|
|
126
126
|
try {
|
|
127
127
|
shell.exec('nodemon --quiet ./node_modules/@surph_ai/sdk/toolserver/app')
|
|
128
|
+
shell.exec('nodemon --quiet ./node_modules/@surph_ai/sdk/toolserver/chat')
|
|
128
129
|
} catch (error) {
|
|
129
130
|
utils.printError(error)
|
|
130
131
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@surph_ai/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"author": "SurphAI",
|
|
17
17
|
"license": "ISC",
|
|
18
18
|
"dependencies": {
|
|
19
|
+
"@aws-sdk/client-bedrock-runtime": "^3.1096.0",
|
|
19
20
|
"adm-zip": "^0.5.10",
|
|
20
21
|
"axios": "^1.12.2",
|
|
21
22
|
"bestzip": "^2.2.1",
|
package/scaffold/index.js
CHANGED
|
@@ -55,42 +55,6 @@ module.exports = (name, type = 'app') => {
|
|
|
55
55
|
|
|
56
56
|
const { platform } = process
|
|
57
57
|
|
|
58
|
-
/*
|
|
59
|
-
if (type === 'project') {
|
|
60
|
-
console.log('create project: ' + name)
|
|
61
|
-
shell.mkdir('-p', name)
|
|
62
|
-
shell.cd(name)
|
|
63
|
-
|
|
64
|
-
shell.cp('-R', path.join(__dirname, 'project/app.js'), 'app.js')
|
|
65
|
-
shell.cp('-R', path.join(__dirname, 'project/package.json'), 'package.json')
|
|
66
|
-
|
|
67
|
-
// www:
|
|
68
|
-
// shell.mkdir('-p', 'www')
|
|
69
|
-
// shell.cp('-R', path.join(__dirname, `project/www/*`), 'www/')
|
|
70
|
-
|
|
71
|
-
shell.mkdir('-p', 'apps')
|
|
72
|
-
shell.cp('-R', path.join(__dirname, `project/apps/*`), 'apps/')
|
|
73
|
-
|
|
74
|
-
// routes:
|
|
75
|
-
shell.mkdir('-p', 'routes')
|
|
76
|
-
shell.cp('-R', path.join(__dirname, `project/routes/*`), 'routes/')
|
|
77
|
-
|
|
78
|
-
// views:
|
|
79
|
-
shell.mkdir('-p', 'templates')
|
|
80
|
-
shell.cp('-R', path.join(__dirname, `project/templates/*`), 'templates/')
|
|
81
|
-
shell.cd('templates')
|
|
82
|
-
|
|
83
|
-
shell.cd('..')
|
|
84
|
-
shell.mkdir('-p', 'public')
|
|
85
|
-
shell.cp('-R', path.join(__dirname, `project/public/*`), 'public/')
|
|
86
|
-
|
|
87
|
-
const pkgJsonStr = utils.readFile(path.join(__dirname, 'project/package.json'))
|
|
88
|
-
const pkgJson = JSON.parse(pkgJsonStr)
|
|
89
|
-
pkgJson.name = name
|
|
90
|
-
utils.write('package.json', JSON.stringify(pkgJson, null, 2) + '\n')
|
|
91
|
-
}
|
|
92
|
-
*/
|
|
93
|
-
|
|
94
58
|
if (type === 'tool') {
|
|
95
59
|
console.log('create tool: ' + name)
|
|
96
60
|
shell.mkdir('-p', name)
|
|
@@ -118,12 +82,9 @@ module.exports = (name, type = 'app') => {
|
|
|
118
82
|
shell.mkdir('-p', 'tools')
|
|
119
83
|
shell.cp('-R', path.join(__dirname, `tool/tools/index.js`), 'tools/index.js')
|
|
120
84
|
|
|
121
|
-
const
|
|
122
|
-
const manifest = JSON.parse(manifestStr)
|
|
123
|
-
const slug = slugify(name, 8)
|
|
124
|
-
manifest[slug] = {
|
|
85
|
+
const manifest = {
|
|
125
86
|
name,
|
|
126
|
-
slug,
|
|
87
|
+
slug: slugify(name, 8),
|
|
127
88
|
type: 'custom',
|
|
128
89
|
description: '',
|
|
129
90
|
parameters: {
|
|
@@ -136,6 +97,14 @@ module.exports = (name, type = 'app') => {
|
|
|
136
97
|
utils.write('tools/manifest.json', JSON.stringify(manifest, null, 2) + '\n')
|
|
137
98
|
|
|
138
99
|
const envStr = utils.readFile(path.join(__dirname, 'tool/env.txt'))
|
|
139
|
-
utils.write('.env', envStr.replace('<SURPH_TOOL>', slug))
|
|
100
|
+
utils.write('.env', envStr.replace('<SURPH_TOOL>', manifest.slug))
|
|
101
|
+
|
|
102
|
+
console.log('\n- - - - - Next Steps - - - - - ')
|
|
103
|
+
console.log('1. $ cd ' + name)
|
|
104
|
+
console.log('2. $ npm install or $ yarn install')
|
|
105
|
+
console.log('3. $ npm run dev')
|
|
106
|
+
console.log('4. Open http://localhost:3000 in a browser')
|
|
107
|
+
console.log('\nFor full documentation, visit https://docs.surph.ai\n')
|
|
108
|
+
|
|
140
109
|
}
|
|
141
110
|
}
|
package/scaffold/tool/env.txt
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
SURPH_TOOL=<SURPH_TOOL>
|
|
2
|
-
PORT=
|
|
2
|
+
PORT=5000
|
|
@@ -11,8 +11,11 @@
|
|
|
11
11
|
"@surph_ai/sdk": "latest",
|
|
12
12
|
"@vinely-ai/sdk": "^0.0.6",
|
|
13
13
|
"cookie": "^0.5.0",
|
|
14
|
+
"cors": "^2.8.6",
|
|
14
15
|
"express": "^4.18.1",
|
|
15
|
-
"mustache": "^4.2.0"
|
|
16
|
+
"mustache": "^4.2.0",
|
|
17
|
+
"cheerio": "^1.2.0",
|
|
18
|
+
"impit": "^0.14.0"
|
|
16
19
|
},
|
|
17
20
|
"devDependencies": {
|
|
18
21
|
"nodemon": "^2.0.2"
|