@shuttle-ai/type 0.0.1

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/README.md ADDED
@@ -0,0 +1,5 @@
1
+ ## `@shuttle-ai/type`
2
+
3
+ #### 说明
4
+
5
+ 该部分是shuttle-ai的类型定义包,提供类型定义
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+
@@ -0,0 +1 @@
1
+ export * from './type';
@@ -0,0 +1,146 @@
1
+ import { ZodAny } from 'zod';
2
+ import { JSONSchema } from 'zod/v4/core/json-schema';
3
+ export declare namespace ShuttleAi {
4
+ namespace Tool {
5
+ type Scope = 'autoRun' | 'read' | 'write';
6
+ interface Extras {
7
+ scope?: Scope;
8
+ /**
9
+ * 是否跳过上报,设置为true时将不会向外抛出该工具是否被调用
10
+ */
11
+ skipReport?: boolean;
12
+ remote?: boolean;
13
+ }
14
+ interface ConfirmResult {
15
+ type: 'confirm' | 'reject' | 'confirmWithResult';
16
+ reason?: string;
17
+ result?: any;
18
+ /**
19
+ * 仅confirm时生效,可修改调用参数
20
+ */
21
+ newArgs?: Record<string, any>;
22
+ }
23
+ interface Call {
24
+ id: string;
25
+ name: string;
26
+ args: Record<string, any>;
27
+ }
28
+ interface Define {
29
+ name: string;
30
+ description: string;
31
+ schema?: ZodAny | JSONSchema;
32
+ extras?: Extras;
33
+ }
34
+ interface Path {
35
+ agentId: string;
36
+ messageId: string;
37
+ toolId: string;
38
+ }
39
+ }
40
+ namespace SubAgent {
41
+ interface Define {
42
+ name: string;
43
+ description: string;
44
+ remote?: boolean;
45
+ tools?: Tool.Define[];
46
+ subAgents?: Define[];
47
+ }
48
+ }
49
+ namespace Message {
50
+ interface Base<R extends string> {
51
+ role: R;
52
+ id: string;
53
+ agentId: string;
54
+ workId: string;
55
+ }
56
+ interface AIChunk extends Base<'assistant_chunk'> {
57
+ content: string;
58
+ }
59
+ interface AITool extends Base<'assistant_tool'> {
60
+ toolCall: Tool.Call;
61
+ needConfirm: boolean;
62
+ }
63
+ interface User extends Base<'user'> {
64
+ content: string;
65
+ }
66
+ interface AI extends Base<'assistant'> {
67
+ content: string;
68
+ toolCalls?: Tool.Call[];
69
+ subAgents?: {
70
+ id: string;
71
+ name: string;
72
+ }[];
73
+ }
74
+ interface Tool extends Base<'tool'> {
75
+ aiMessageId: string;
76
+ name: string;
77
+ content?: string;
78
+ confirm?: Tool.ConfirmResult;
79
+ }
80
+ type Define = User | AI | Tool;
81
+ }
82
+ namespace Ask {
83
+ interface Base<T extends string, D> {
84
+ type: T;
85
+ data: D;
86
+ }
87
+ interface Ping extends Base<'ping', undefined> {
88
+ }
89
+ interface Chunk extends Base<'chunk', {
90
+ chunk: Message.AIChunk;
91
+ }> {
92
+ }
93
+ interface AgentStart extends Base<'agentStart', {
94
+ agentId: string;
95
+ agentName: string;
96
+ beloneMessageId?: string;
97
+ parentAgentId?: string;
98
+ content: string;
99
+ }> {
100
+ }
101
+ interface AgentEnd extends Base<'agentEnd', {
102
+ agentId: string;
103
+ }> {
104
+ }
105
+ interface ToolStart extends Base<'toolStart', {
106
+ tool: Message.AITool;
107
+ }> {
108
+ }
109
+ interface ToolEnd extends Base<'toolEnd', {
110
+ toolPath: Tool.Path;
111
+ toolResult: any;
112
+ }> {
113
+ }
114
+ interface StartWork extends Base<'startWork', {
115
+ workId: string;
116
+ }> {
117
+ }
118
+ interface EndWork extends Base<'endWork', {
119
+ workId: string;
120
+ }> {
121
+ }
122
+ type Define = StartWork | EndWork | Ping | Chunk | AgentStart | AgentEnd | ToolStart | ToolEnd;
123
+ }
124
+ namespace Report {
125
+ interface Base<T extends string, D> {
126
+ type: T;
127
+ workId: string;
128
+ data: D;
129
+ }
130
+ interface ConfirmTool extends Base<'toolConfirm', {
131
+ toolId: string;
132
+ result: ShuttleAi.Tool.ConfirmResult;
133
+ }> {
134
+ }
135
+ interface AgentStart extends Base<'agentStart', {
136
+ agentId: string;
137
+ params: {
138
+ systemPrompt?: string;
139
+ tools?: Tool.Define[];
140
+ subAgents?: SubAgent.Define[];
141
+ };
142
+ }> {
143
+ }
144
+ type Define = ConfirmTool | AgentStart;
145
+ }
146
+ }
package/package.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "@shuttle-ai/type",
3
+ "version": "0.0.1",
4
+ "author": "Mingbing-get <1508850533@qq.com>",
5
+ "license": "MIT",
6
+ "description": "Shuttle AI 类型定义",
7
+ "main": "dist/cjs/index.cjs",
8
+ "module": "dist/es/index.mjs",
9
+ "types": "dist/types/index.d.ts",
10
+ "type": "module",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/types/index.d.ts",
14
+ "import": "./dist/es/index.mjs",
15
+ "require": "./dist/cjs/index.cjs"
16
+ }
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "README.md"
21
+ ],
22
+ "access": "public",
23
+ "dependencies": {
24
+ "zod": "^4.3.5"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "scripts": {
30
+ "build": "vite build",
31
+ "clean": "rm -rf dist",
32
+ "type-check": "tsc --noEmit",
33
+ "test": "echo \"Error: no test specified\" && exit 1"
34
+ }
35
+ }