dsh-rest-api 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +135 -2
- package/README.zh.md +150 -0
- package/cordis.patch.yml +103 -0
- package/icon.svg +9 -0
- package/lib/client.js +803 -0
- package/lib/http.js +381 -0
- package/lib/index.js +182 -0
- package/lib/runtime.js +1384 -0
- package/openapi.yaml +303 -0
- package/package.json +101 -4
package/openapi.yaml
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
openapi: 3.1.0
|
|
2
|
+
info:
|
|
3
|
+
title: dsh-rest-api
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
description: >
|
|
6
|
+
Standard REST API plugin for DeepSeek Harness Web. Provides synchronous
|
|
7
|
+
execution, asynchronous submit + long-polling, Server-Sent Events (SSE)
|
|
8
|
+
progress streaming, optional webhook callbacks, real cancellation, and live
|
|
9
|
+
observability inside the dsh Web UI.
|
|
10
|
+
license:
|
|
11
|
+
name: MIT
|
|
12
|
+
servers:
|
|
13
|
+
- url: http://127.0.0.1:3080
|
|
14
|
+
paths:
|
|
15
|
+
/v1/health:
|
|
16
|
+
get:
|
|
17
|
+
operationId: getHealth
|
|
18
|
+
summary: Inspect plugin runtime status and active run counts
|
|
19
|
+
responses:
|
|
20
|
+
'200':
|
|
21
|
+
description: Plugin is healthy
|
|
22
|
+
content:
|
|
23
|
+
application/json:
|
|
24
|
+
schema:
|
|
25
|
+
type: object
|
|
26
|
+
properties:
|
|
27
|
+
status: { type: string, const: ok }
|
|
28
|
+
plugin: { type: string, const: dsh-rest-api }
|
|
29
|
+
preset: { type: [string, 'null'] }
|
|
30
|
+
provider: { type: [string, 'null'] }
|
|
31
|
+
model: { type: [string, 'null'] }
|
|
32
|
+
workspace_title: { type: string }
|
|
33
|
+
workspace_dir: { type: string }
|
|
34
|
+
auth_mode: { type: string, enum: [loopback, bearer, none] }
|
|
35
|
+
request_timeout_ms: { type: integer }
|
|
36
|
+
observe_url: { type: [string, 'null'] }
|
|
37
|
+
running: { type: integer }
|
|
38
|
+
queued: { type: integer }
|
|
39
|
+
total_retained: { type: integer }
|
|
40
|
+
|
|
41
|
+
/v1/runs:
|
|
42
|
+
get:
|
|
43
|
+
operationId: listRuns
|
|
44
|
+
summary: List active and recently retained runs
|
|
45
|
+
parameters:
|
|
46
|
+
- in: query
|
|
47
|
+
name: session_id
|
|
48
|
+
schema: { type: string }
|
|
49
|
+
- in: query
|
|
50
|
+
name: status
|
|
51
|
+
schema:
|
|
52
|
+
type: string
|
|
53
|
+
enum: [queued, running, completed, cancelled, failed]
|
|
54
|
+
- in: query
|
|
55
|
+
name: limit
|
|
56
|
+
schema: { type: integer, minimum: 1, maximum: 200, default: 50 }
|
|
57
|
+
responses:
|
|
58
|
+
'200':
|
|
59
|
+
description: Run list ordered newest first
|
|
60
|
+
content:
|
|
61
|
+
application/json:
|
|
62
|
+
schema:
|
|
63
|
+
type: object
|
|
64
|
+
properties:
|
|
65
|
+
items:
|
|
66
|
+
type: array
|
|
67
|
+
items: { $ref: '#/components/schemas/Run' }
|
|
68
|
+
|
|
69
|
+
/v1/sessions/{session_id}/messages:
|
|
70
|
+
post:
|
|
71
|
+
operationId: sendMessageSync
|
|
72
|
+
summary: Execute one turn synchronously and return the final response
|
|
73
|
+
parameters:
|
|
74
|
+
- in: path
|
|
75
|
+
name: session_id
|
|
76
|
+
required: true
|
|
77
|
+
schema: { type: string }
|
|
78
|
+
requestBody:
|
|
79
|
+
required: true
|
|
80
|
+
content:
|
|
81
|
+
application/json:
|
|
82
|
+
schema: { $ref: '#/components/schemas/PromptRequest' }
|
|
83
|
+
responses:
|
|
84
|
+
'200':
|
|
85
|
+
description: Turn completed
|
|
86
|
+
content:
|
|
87
|
+
application/json:
|
|
88
|
+
schema:
|
|
89
|
+
type: object
|
|
90
|
+
required: [request_id, text]
|
|
91
|
+
properties:
|
|
92
|
+
request_id: { type: string }
|
|
93
|
+
text: { type: string, minLength: 1 }
|
|
94
|
+
artifacts:
|
|
95
|
+
type: array
|
|
96
|
+
items: { type: string }
|
|
97
|
+
'409':
|
|
98
|
+
description: Turn was cancelled via API or Web UI
|
|
99
|
+
content:
|
|
100
|
+
application/json:
|
|
101
|
+
schema: { $ref: '#/components/schemas/ErrorResponse' }
|
|
102
|
+
'502':
|
|
103
|
+
description: Agent turn failed or returned empty output
|
|
104
|
+
content:
|
|
105
|
+
application/json:
|
|
106
|
+
schema: { $ref: '#/components/schemas/ErrorResponse' }
|
|
107
|
+
|
|
108
|
+
/v1/sessions/{session_id}/runs:
|
|
109
|
+
post:
|
|
110
|
+
operationId: createRun
|
|
111
|
+
summary: Enqueue an asynchronous run (idempotent on session_id + request_id)
|
|
112
|
+
parameters:
|
|
113
|
+
- in: path
|
|
114
|
+
name: session_id
|
|
115
|
+
required: true
|
|
116
|
+
schema: { type: string }
|
|
117
|
+
requestBody:
|
|
118
|
+
required: true
|
|
119
|
+
content:
|
|
120
|
+
application/json:
|
|
121
|
+
schema: { $ref: '#/components/schemas/PromptRequest' }
|
|
122
|
+
responses:
|
|
123
|
+
'202':
|
|
124
|
+
description: Run accepted and enqueued
|
|
125
|
+
content:
|
|
126
|
+
application/json:
|
|
127
|
+
schema: { $ref: '#/components/schemas/Run' }
|
|
128
|
+
'200':
|
|
129
|
+
description: Existing run returned for idempotent retry
|
|
130
|
+
content:
|
|
131
|
+
application/json:
|
|
132
|
+
schema: { $ref: '#/components/schemas/Run' }
|
|
133
|
+
'409':
|
|
134
|
+
description: request_id already belongs to a different session
|
|
135
|
+
content:
|
|
136
|
+
application/json:
|
|
137
|
+
schema: { $ref: '#/components/schemas/ErrorResponse' }
|
|
138
|
+
|
|
139
|
+
/v1/runs/{run_id}:
|
|
140
|
+
get:
|
|
141
|
+
operationId: getRun
|
|
142
|
+
summary: Fetch run status or long-poll until terminal state
|
|
143
|
+
parameters:
|
|
144
|
+
- in: path
|
|
145
|
+
name: run_id
|
|
146
|
+
required: true
|
|
147
|
+
description: Accepts either `run_id` or `request_id`.
|
|
148
|
+
schema: { type: string }
|
|
149
|
+
- in: query
|
|
150
|
+
name: wait
|
|
151
|
+
description: Long-poll wait duration in seconds (0..60).
|
|
152
|
+
schema: { type: number, minimum: 0, maximum: 60, default: 0 }
|
|
153
|
+
responses:
|
|
154
|
+
'200':
|
|
155
|
+
description: Current or terminal run snapshot
|
|
156
|
+
content:
|
|
157
|
+
application/json:
|
|
158
|
+
schema: { $ref: '#/components/schemas/Run' }
|
|
159
|
+
'404':
|
|
160
|
+
description: Run not found
|
|
161
|
+
content:
|
|
162
|
+
application/json:
|
|
163
|
+
schema: { $ref: '#/components/schemas/ErrorResponse' }
|
|
164
|
+
|
|
165
|
+
/v1/runs/{run_id}/events:
|
|
166
|
+
get:
|
|
167
|
+
operationId: streamRunEvents
|
|
168
|
+
summary: Stream live run progress over Server-Sent Events (SSE)
|
|
169
|
+
parameters:
|
|
170
|
+
- in: path
|
|
171
|
+
name: run_id
|
|
172
|
+
required: true
|
|
173
|
+
description: Accepts either `run_id` or `request_id`.
|
|
174
|
+
schema: { type: string }
|
|
175
|
+
responses:
|
|
176
|
+
'200':
|
|
177
|
+
description: >
|
|
178
|
+
`text/event-stream` emitting `run.snapshot`, `run.status`,
|
|
179
|
+
`assistant.message`, `tool.call`, `tool.result`,
|
|
180
|
+
`deliverables.presented`, and terminal `run.completed` /
|
|
181
|
+
`run.cancelled` / `run.failed`.
|
|
182
|
+
content:
|
|
183
|
+
text/event-stream:
|
|
184
|
+
schema: { type: string }
|
|
185
|
+
'404':
|
|
186
|
+
description: Run not found
|
|
187
|
+
|
|
188
|
+
/v1/runs/{run_id}/cancel:
|
|
189
|
+
post:
|
|
190
|
+
operationId: cancelRun
|
|
191
|
+
summary: Cancel a queued or actively running run
|
|
192
|
+
parameters:
|
|
193
|
+
- in: path
|
|
194
|
+
name: run_id
|
|
195
|
+
required: true
|
|
196
|
+
description: Accepts either `run_id` or `request_id`.
|
|
197
|
+
schema: { type: string }
|
|
198
|
+
- in: query
|
|
199
|
+
name: wait
|
|
200
|
+
description: Seconds to wait for cancellation settlement (0..60, default 5).
|
|
201
|
+
schema: { type: number, minimum: 0, maximum: 60, default: 5 }
|
|
202
|
+
responses:
|
|
203
|
+
'200':
|
|
204
|
+
description: Cancellation applied
|
|
205
|
+
content:
|
|
206
|
+
application/json:
|
|
207
|
+
schema:
|
|
208
|
+
allOf:
|
|
209
|
+
- $ref: '#/components/schemas/Run'
|
|
210
|
+
- type: object
|
|
211
|
+
properties:
|
|
212
|
+
stopped: { type: boolean }
|
|
213
|
+
'404':
|
|
214
|
+
description: Run not found
|
|
215
|
+
|
|
216
|
+
/v1/sessions/{session_id}/cancel:
|
|
217
|
+
post:
|
|
218
|
+
operationId: cancelSession
|
|
219
|
+
summary: Cancel the active turn on a session and optionally clear queued runs
|
|
220
|
+
parameters:
|
|
221
|
+
- in: path
|
|
222
|
+
name: session_id
|
|
223
|
+
required: true
|
|
224
|
+
schema: { type: string }
|
|
225
|
+
- in: query
|
|
226
|
+
name: wait
|
|
227
|
+
schema: { type: number, minimum: 0, maximum: 60, default: 5 }
|
|
228
|
+
requestBody:
|
|
229
|
+
required: false
|
|
230
|
+
content:
|
|
231
|
+
application/json:
|
|
232
|
+
schema:
|
|
233
|
+
type: object
|
|
234
|
+
properties:
|
|
235
|
+
clear_queue:
|
|
236
|
+
type: boolean
|
|
237
|
+
default: true
|
|
238
|
+
responses:
|
|
239
|
+
'200':
|
|
240
|
+
description: Session cancellation result
|
|
241
|
+
content:
|
|
242
|
+
application/json:
|
|
243
|
+
schema:
|
|
244
|
+
type: object
|
|
245
|
+
properties:
|
|
246
|
+
session_id: { type: string }
|
|
247
|
+
stopped: { type: boolean }
|
|
248
|
+
agent_was_running: { type: boolean }
|
|
249
|
+
status: { type: string, enum: [cancelled, cancelling, idle] }
|
|
250
|
+
cancelled_run_ids:
|
|
251
|
+
type: array
|
|
252
|
+
items: { type: string }
|
|
253
|
+
observe_url: { type: string }
|
|
254
|
+
|
|
255
|
+
components:
|
|
256
|
+
securitySchemes:
|
|
257
|
+
bearerAuth:
|
|
258
|
+
type: http
|
|
259
|
+
scheme: bearer
|
|
260
|
+
schemas:
|
|
261
|
+
PromptRequest:
|
|
262
|
+
type: object
|
|
263
|
+
additionalProperties: false
|
|
264
|
+
required: [request_id, prompt]
|
|
265
|
+
properties:
|
|
266
|
+
request_id: { type: string, minLength: 1, maxLength: 256 }
|
|
267
|
+
prompt: { type: string, minLength: 1 }
|
|
268
|
+
preset: { type: string, description: Optional Agent Preset ID override for new sessions }
|
|
269
|
+
workspace_title: { type: string, description: Optional sidebar workspace group title }
|
|
270
|
+
workspace_dir: { type: string, description: Optional workspace directory (requires allowCustomWorkspaceDir=true) }
|
|
271
|
+
provider: { type: string, description: Optional LLM provider override }
|
|
272
|
+
model: { type: string, description: Optional LLM model override }
|
|
273
|
+
webhook_url: { type: string, format: uri, description: Optional http/https callback URL on terminal state }
|
|
274
|
+
webhook_headers:
|
|
275
|
+
type: object
|
|
276
|
+
additionalProperties: { type: string }
|
|
277
|
+
Run:
|
|
278
|
+
type: object
|
|
279
|
+
required: [run_id, request_id, session_id, status, created_at]
|
|
280
|
+
properties:
|
|
281
|
+
run_id: { type: string }
|
|
282
|
+
request_id: { type: string }
|
|
283
|
+
session_id: { type: string }
|
|
284
|
+
status:
|
|
285
|
+
type: string
|
|
286
|
+
enum: [queued, running, completed, cancelled, failed]
|
|
287
|
+
created_at: { type: string, format: date-time }
|
|
288
|
+
started_at: { type: string, format: date-time }
|
|
289
|
+
finished_at: { type: string, format: date-time }
|
|
290
|
+
text: { type: string }
|
|
291
|
+
artifacts:
|
|
292
|
+
type: array
|
|
293
|
+
items: { type: string }
|
|
294
|
+
error: { type: string }
|
|
295
|
+
observe_url: { type: string, format: uri }
|
|
296
|
+
ErrorResponse:
|
|
297
|
+
type: object
|
|
298
|
+
required: [error]
|
|
299
|
+
properties:
|
|
300
|
+
error: { type: string }
|
|
301
|
+
run_id: { type: string }
|
|
302
|
+
request_id: { type: string }
|
|
303
|
+
session_id: { type: string }
|
package/package.json
CHANGED
|
@@ -1,6 +1,103 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-rest-api",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Standard REST API plugin for DeepSeek Harness Web: synchronous messages, async long-polling runs, SSE progress streaming, webhook callbacks, real cancellation, live Web UI observability, and native Web settings UI.",
|
|
5
|
+
"author": "Luawig <luawig@gmail.com>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://github.com/Luawig/dsh-rest-api#readme",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Luawig/dsh-rest-api.git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/Luawig/dsh-rest-api/issues"
|
|
14
|
+
},
|
|
15
|
+
"type": "module",
|
|
16
|
+
"icon": "./icon.svg",
|
|
17
|
+
"main": "./lib/index.js",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./lib/index.js",
|
|
20
|
+
"./client": "./lib/client.js",
|
|
21
|
+
"./runtime": "./lib/runtime.js",
|
|
22
|
+
"./http": "./lib/http.js",
|
|
23
|
+
"./cordis.patch.yml": "./cordis.patch.yml",
|
|
24
|
+
"./openapi.yaml": "./openapi.yaml",
|
|
25
|
+
"./package.json": "./package.json"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"lib/",
|
|
29
|
+
"cordis.patch.yml",
|
|
30
|
+
"openapi.yaml",
|
|
31
|
+
"icon.svg",
|
|
32
|
+
"LICENSE",
|
|
33
|
+
"README.md",
|
|
34
|
+
"README.zh.md"
|
|
35
|
+
],
|
|
36
|
+
"keywords": [
|
|
37
|
+
"deepseek-harness",
|
|
38
|
+
"dsh",
|
|
39
|
+
"dsh-plugin",
|
|
40
|
+
"rest-api",
|
|
41
|
+
"http-api",
|
|
42
|
+
"sse",
|
|
43
|
+
"webhook",
|
|
44
|
+
"agent",
|
|
45
|
+
"cordis"
|
|
46
|
+
],
|
|
47
|
+
"scripts": {
|
|
48
|
+
"check": "node --check lib/index.js && node --check lib/runtime.js && node --check lib/http.js && node --check lib/client.js",
|
|
49
|
+
"test": "node --test test/unit.test.mjs",
|
|
50
|
+
"test:e2e": "node test/e2e.mjs"
|
|
51
|
+
},
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=22.19.0",
|
|
54
|
+
"dsh": ">=0.2.0-rc.1 <0.4.0-0"
|
|
55
|
+
},
|
|
56
|
+
"dsh": {
|
|
57
|
+
"engines": {
|
|
58
|
+
"dsh": ">=0.2.0-rc.1 <0.4.0-0"
|
|
59
|
+
},
|
|
60
|
+
"bundle": {
|
|
61
|
+
"patch": "./cordis.patch.yml"
|
|
62
|
+
},
|
|
63
|
+
"client": {
|
|
64
|
+
"inject": [
|
|
65
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
66
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager",
|
|
67
|
+
"@deepseek-ai/dsh-client-ui-renderer"
|
|
68
|
+
],
|
|
69
|
+
"platform": "web"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"@deepseek-ai/cordis": "*",
|
|
74
|
+
"@deepseek-ai/schemastery": "*",
|
|
75
|
+
"@deepseek-ai/dsh-client-ui-settings": "*",
|
|
76
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": "*",
|
|
77
|
+
"@deepseek-ai/dsh-client-ui-renderer": "*",
|
|
78
|
+
"react": "^18.2.0"
|
|
79
|
+
},
|
|
80
|
+
"peerDependenciesMeta": {
|
|
81
|
+
"@deepseek-ai/cordis": {
|
|
82
|
+
"optional": true
|
|
83
|
+
},
|
|
84
|
+
"@deepseek-ai/schemastery": {
|
|
85
|
+
"optional": true
|
|
86
|
+
},
|
|
87
|
+
"@deepseek-ai/dsh-client-ui-settings": {
|
|
88
|
+
"optional": true
|
|
89
|
+
},
|
|
90
|
+
"@deepseek-ai/dsh-client-ui-plugin-manager": {
|
|
91
|
+
"optional": true
|
|
92
|
+
},
|
|
93
|
+
"@deepseek-ai/dsh-client-ui-renderer": {
|
|
94
|
+
"optional": true
|
|
95
|
+
},
|
|
96
|
+
"react": {
|
|
97
|
+
"optional": true
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
"publishConfig": {
|
|
101
|
+
"access": "public"
|
|
102
|
+
}
|
|
103
|
+
}
|