@surph_ai/cli 0.0.1 → 0.0.2
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/cli.js +2 -2
- package/deploy/index.js +1 -1
- package/package.json +1 -1
- package/toolserver/app.js +1 -1
- package/types.d.ts +0 -73
package/cli.js
CHANGED
|
@@ -151,7 +151,7 @@ program.command('toolserver')
|
|
|
151
151
|
.description('run tool server')
|
|
152
152
|
.action(async (cmd, options) => {
|
|
153
153
|
try {
|
|
154
|
-
shell.exec('nodemon --quiet ./node_modules/@surph_ai/
|
|
154
|
+
shell.exec('nodemon --quiet ./node_modules/@surph_ai/cli/toolserver/app')
|
|
155
155
|
} catch (error) {
|
|
156
156
|
utils.printError(error)
|
|
157
157
|
}
|
|
@@ -161,7 +161,7 @@ program.command('chatserver')
|
|
|
161
161
|
.description('run chat server')
|
|
162
162
|
.action(async (cmd, options) => {
|
|
163
163
|
try {
|
|
164
|
-
shell.exec('nodemon --quiet ./node_modules/@surph_ai/
|
|
164
|
+
shell.exec('nodemon --quiet ./node_modules/@surph_ai/cli/toolserver/chat')
|
|
165
165
|
} catch (error) {
|
|
166
166
|
utils.printError(error)
|
|
167
167
|
}
|
package/deploy/index.js
CHANGED
|
@@ -86,7 +86,7 @@ const zipDirectory = (name = 'package.zip') => {
|
|
|
86
86
|
|
|
87
87
|
const compile = async (deployDir, name = 'package.zip', dir = null) => {
|
|
88
88
|
shell.mkdir('-p', `${deployDir}/`)
|
|
89
|
-
shell.cp('-R', `node_modules/@surph_ai/
|
|
89
|
+
shell.cp('-R', `node_modules/@surph_ai/cli/deploy/tool-handler.js`, `${deployDir}/main.js`)
|
|
90
90
|
|
|
91
91
|
if (dir === null) {
|
|
92
92
|
shell.cp('-R', '!(node_modules|deploy)', `${deployDir}/`) // copy everything but node_modules and deploy
|
package/package.json
CHANGED
package/toolserver/app.js
CHANGED
package/types.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
// Type definitions for @surph_ai/sdk
|
|
2
|
-
// These describe the runtime contract the tool server hands to each tool's default export.
|
|
3
|
-
|
|
4
|
-
export type OAuthProvider = 'google' | 'github' | (string & {});
|
|
5
|
-
|
|
6
|
-
export interface GoogleOAuth {
|
|
7
|
-
accessToken: string;
|
|
8
|
-
refreshToken?: string;
|
|
9
|
-
/** ISO-8601 timestamp for when accessToken expires. */
|
|
10
|
-
expiresAt: string;
|
|
11
|
-
/** OAuth scopes granted by the user. */
|
|
12
|
-
scopes: string[];
|
|
13
|
-
/** ISO-8601 timestamp for when the user first connected the provider. */
|
|
14
|
-
connectedAt: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface UserOAuth {
|
|
18
|
-
google?: GoogleOAuth;
|
|
19
|
-
[provider: string]: unknown;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface UserAuth {
|
|
23
|
-
type: OAuthProvider;
|
|
24
|
-
/** Provider-issued stable identifier for the user (e.g. Google 'sub'). */
|
|
25
|
-
id: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface User {
|
|
29
|
-
_id: string;
|
|
30
|
-
firstName?: string;
|
|
31
|
-
lastName?: string;
|
|
32
|
-
email: string;
|
|
33
|
-
username: string;
|
|
34
|
-
avatar?: string;
|
|
35
|
-
tags?: string[];
|
|
36
|
-
following?: string[];
|
|
37
|
-
notifications?: unknown[];
|
|
38
|
-
type?: 'claimed' | 'anonymous' | (string & {});
|
|
39
|
-
auth?: UserAuth;
|
|
40
|
-
timestamp?: string;
|
|
41
|
-
lastVisit?: string;
|
|
42
|
-
identifiers?: string[];
|
|
43
|
-
tools?: string[];
|
|
44
|
-
oauth?: UserOAuth;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Per-invocation context. Currently opaque — populated by the caller (chat
|
|
49
|
-
* server, deployed harness, etc.). Cast to a more specific shape inside the
|
|
50
|
-
* tool if you know what your caller sends.
|
|
51
|
-
*/
|
|
52
|
-
export type ToolContext = Record<string, unknown> | null;
|
|
53
|
-
|
|
54
|
-
export interface ToolHandlerInput<TArgs = Record<string, unknown>> {
|
|
55
|
-
args: TArgs;
|
|
56
|
-
context: ToolContext;
|
|
57
|
-
user: User;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export type ToolHandler<
|
|
61
|
-
TArgs = Record<string, unknown>,
|
|
62
|
-
TResult = unknown,
|
|
63
|
-
> = (input: ToolHandlerInput<TArgs>) => Promise<TResult> | TResult;
|
|
64
|
-
|
|
65
|
-
export interface Surph {
|
|
66
|
-
fetchUser(username: string): Promise<User>;
|
|
67
|
-
fetchContext(slug: string | ToolContext): Promise<unknown>;
|
|
68
|
-
searchContext(ctxSlug: string, query: string): Promise<unknown>;
|
|
69
|
-
search(query: string, ctxSlug?: string | null): Promise<unknown>;
|
|
70
|
-
toolHandler(tool: string, args?: Record<string, unknown>): Promise<unknown>;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export declare const surph: Surph;
|