@surph_ai/sdk 0.0.13 → 0.0.14
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/deploy/{tool-main.js → tool-handler.js} +1 -1
- package/package.json +1 -1
- package/scaffold/index.js +21 -3
- package/scaffold/tool/package.json +10 -6
- package/scaffold/tool/tools/index.ts +9 -0
- package/toolserver/routes/tool.js +3 -2
- package/scaffold/tool/package-lock.json +0 -2459
- package/scaffold/tool/tools/index.js +0 -8
package/package.json
CHANGED
package/scaffold/index.js
CHANGED
|
@@ -80,9 +80,9 @@ module.exports = (name, type = 'app') => {
|
|
|
80
80
|
utils.write('package.json', JSON.stringify(pkgJson, null, 2) + '\n')
|
|
81
81
|
|
|
82
82
|
shell.mkdir('-p', 'tools')
|
|
83
|
-
shell.cp('-R', path.join(__dirname, `tool/tools/index.
|
|
83
|
+
shell.cp('-R', path.join(__dirname, `tool/tools/index.ts`), 'tools/index.ts')
|
|
84
84
|
|
|
85
|
-
utils.write('
|
|
85
|
+
utils.write('manifest-example.json', JSON.stringify({
|
|
86
86
|
name: 'youtube-transcript',
|
|
87
87
|
slug: 'y2script',
|
|
88
88
|
type: 'custom',
|
|
@@ -114,11 +114,29 @@ module.exports = (name, type = 'app') => {
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
utils.write('
|
|
117
|
+
utils.write('manifest.json', JSON.stringify(manifest, null, 2) + '\n')
|
|
118
118
|
|
|
119
119
|
const envStr = utils.readFile(path.join(__dirname, 'tool/env.txt'))
|
|
120
120
|
utils.write('.env', envStr.replace('<SURPH_TOOL>', slug))
|
|
121
121
|
|
|
122
|
+
utils.write('tsconfig.json', JSON.stringify({
|
|
123
|
+
"compilerOptions": {
|
|
124
|
+
"target": "ES2022",
|
|
125
|
+
"module": "commonjs",
|
|
126
|
+
"lib": ["ES2022"],
|
|
127
|
+
"types": ["node"],
|
|
128
|
+
"outDir": "./dist",
|
|
129
|
+
"rootDir": ".",
|
|
130
|
+
"strict": true,
|
|
131
|
+
"esModuleInterop": true,
|
|
132
|
+
"skipLibCheck": true,
|
|
133
|
+
"forceConsistentCasingInFileNames": true,
|
|
134
|
+
"resolveJsonModule": true
|
|
135
|
+
},
|
|
136
|
+
"include": ["tools/**/*.ts"],
|
|
137
|
+
"exclude": ["node_modules", "dist"]
|
|
138
|
+
}, null, 2) + '\n')
|
|
139
|
+
|
|
122
140
|
console.log('\n- - - - - Next Steps - - - - - ')
|
|
123
141
|
console.log('1. $ cd ' + name)
|
|
124
142
|
console.log('2. $ npm install or $ yarn install')
|
|
@@ -3,16 +3,20 @@
|
|
|
3
3
|
"version": "0.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"scripts": {
|
|
6
|
-
"dev": "surph toolserver & surph chatserver",
|
|
7
|
-
"
|
|
8
|
-
"build": "",
|
|
9
|
-
"
|
|
6
|
+
"dev": "npm run build && surph toolserver & surph chatserver",
|
|
7
|
+
"test": "",
|
|
8
|
+
"build": "rm -rf dist && tsc",
|
|
9
|
+
"watch": "tsc -w",
|
|
10
|
+
"publish": "npm run build && surph publish",
|
|
11
|
+
"deploy": "npm run build && surph deploy"
|
|
10
12
|
},
|
|
11
13
|
"dependencies": {
|
|
12
14
|
"@vinely-ai/sdk": "^0.0.6"
|
|
13
15
|
},
|
|
14
16
|
"devDependencies": {
|
|
15
|
-
"@surph_ai/sdk": "
|
|
16
|
-
"
|
|
17
|
+
"@surph_ai/sdk": "^0.0.13",
|
|
18
|
+
"@types/node": "^20.11.0",
|
|
19
|
+
"nodemon": "^2.0.2",
|
|
20
|
+
"typescript": "^5.3.3"
|
|
17
21
|
}
|
|
18
22
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Your tools code goes here. When ready, export
|
|
2
|
+
// the tool name in exports at bottom of this file
|
|
3
|
+
// as shown in this demo code:
|
|
4
|
+
|
|
5
|
+
const demoTool = (args: Record<string, any>) => {
|
|
6
|
+
return `This is a sample tool: ${JSON.stringify(args)}. Remove this tool and replace it with your own.`
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default demoTool
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const { Router, response } = require('express')
|
|
2
|
-
const tools = require('../../../../../tools')
|
|
3
|
-
const
|
|
2
|
+
// const tools = require('../../../../../tools')
|
|
3
|
+
const tools = require('../../../../../dist/tools')
|
|
4
|
+
const manifest = require('../../../../../manifest.json')
|
|
4
5
|
|
|
5
6
|
const router = Router()
|
|
6
7
|
|