@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.
@@ -1,4 +1,4 @@
1
- const tool = require('./tools')
1
+ const tool = require('./dist/tools')
2
2
 
3
3
  const handler = async (event) => {
4
4
  const { args = {} } = event;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surph_ai/sdk",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "publishConfig": {
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.js`), 'tools/index.js')
83
+ shell.cp('-R', path.join(__dirname, `tool/tools/index.ts`), 'tools/index.ts')
84
84
 
85
- utils.write('tools/manifest-example.json', JSON.stringify({
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('tools/manifest.json', JSON.stringify(manifest, null, 2) + '\n')
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
- "deploy": "surph deploy",
8
- "build": "",
9
- "test": ""
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": "latest",
16
- "nodemon": "^2.0.2"
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 manifest = require('../../../../../tools/manifest.json')
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