@owlmeans/viable-common 0.0.5 → 0.0.7
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 +1 -68
- package/build/areas/consts.d.ts +1 -1
- package/build/areas/consts.js +1 -1
- package/build/connect/consts.d.ts +6 -94
- package/build/connect/consts.d.ts.map +1 -1
- package/build/connect/consts.js +2 -91
- package/build/connect/consts.js.map +1 -1
- package/build/connect/entrypoints.d.ts +3 -3
- package/build/connect/entrypoints.d.ts.map +1 -1
- package/build/connect/entrypoints.js +54 -95
- package/build/connect/entrypoints.js.map +1 -1
- package/build/connect/ops.d.ts +2 -46
- package/build/connect/ops.d.ts.map +1 -1
- package/build/connect/references.d.ts +63 -117
- package/build/connect/references.d.ts.map +1 -1
- package/build/connect/references.js +0 -16
- package/build/connect/references.js.map +1 -1
- package/build/connect/schemas.d.ts +2 -17
- package/build/connect/schemas.d.ts.map +1 -1
- package/build/connect/schemas.js +7 -91
- package/build/connect/schemas.js.map +1 -1
- package/build/connect/types.d.ts +1 -125
- package/build/connect/types.d.ts.map +1 -1
- package/build/dev/types.d.ts +3 -2
- package/build/dev/types.d.ts.map +1 -1
- package/build/index.d.ts +0 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +0 -1
- package/build/index.js.map +1 -1
- package/build/skills/catalogue.d.ts.map +1 -1
- package/build/skills/catalogue.js +109 -103
- package/build/skills/catalogue.js.map +1 -1
- package/build/slot/consts.d.ts +2 -73
- package/build/slot/consts.d.ts.map +1 -1
- package/build/slot/consts.js +5 -105
- package/build/slot/consts.js.map +1 -1
- package/build/slot/schemas.d.ts +1 -9
- package/build/slot/schemas.d.ts.map +1 -1
- package/build/slot/schemas.js +0 -18
- package/build/slot/schemas.js.map +1 -1
- package/build/slot/types.d.ts +0 -71
- package/build/slot/types.d.ts.map +1 -1
- package/package.json +7 -15
- package/src/areas/consts.ts +1 -1
- package/src/connect/consts.ts +2 -94
- package/src/connect/entrypoints.ts +69 -139
- package/src/connect/ops.ts +2 -50
- package/src/connect/references.ts +56 -32
- package/src/connect/schemas.ts +13 -102
- package/src/connect/types.ts +2 -130
- package/src/dev/types.ts +3 -2
- package/src/index.ts +0 -1
- package/src/skills/catalogue.ts +109 -103
- package/src/slot/consts.ts +6 -112
- package/src/slot/schemas.ts +1 -20
- package/src/slot/types.ts +0 -80
- package/agent-meta/manifest.json +0 -16
- package/agent-meta/skills/viable-common/SKILL.md +0 -179
- package/build/convert/consts.d.ts +0 -539
- package/build/convert/consts.d.ts.map +0 -1
- package/build/convert/consts.js +0 -630
- package/build/convert/consts.js.map +0 -1
- package/build/convert/helpers.d.ts +0 -91
- package/build/convert/helpers.d.ts.map +0 -1
- package/build/convert/helpers.js +0 -301
- package/build/convert/helpers.js.map +0 -1
- package/build/convert/index.d.ts +0 -11
- package/build/convert/index.d.ts.map +0 -1
- package/build/convert/index.js +0 -4
- package/build/convert/index.js.map +0 -1
- package/build/convert/schemas.d.ts +0 -62
- package/build/convert/schemas.d.ts.map +0 -1
- package/build/convert/schemas.js +0 -626
- package/build/convert/schemas.js.map +0 -1
- package/build/convert/types.d.ts +0 -683
- package/build/convert/types.d.ts.map +0 -1
- package/build/convert/types.js +0 -2
- package/build/convert/types.js.map +0 -1
- package/src/convert/consts.ts +0 -672
- package/src/convert/helpers.ts +0 -340
- package/src/convert/index.ts +0 -10
- package/src/convert/schemas.ts +0 -663
- package/src/convert/types.ts +0 -741
- package/tests/connect-convert.spec.ts +0 -161
- package/tests/convert.spec.ts +0 -318
- /package/tests/{design.spec.ts → design.test.ts} +0 -0
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type {
|
|
1
|
+
import { contract, openProtocol, protocol, typed } from '@owlmeans/entrypoint'
|
|
2
|
+
import type { EntrypointProtocolDeclaration } from '@owlmeans/entrypoint'
|
|
3
3
|
import { route, RouteMethod, socket } from '@owlmeans/route'
|
|
4
|
-
import { ConverterProjectLlmBodySchema } from '../convert/schemas.js'
|
|
5
4
|
import { connect } from './consts.js'
|
|
6
5
|
import {
|
|
7
|
-
ConnectAttachBodySchema, ConnectConfirmBodySchema,
|
|
8
|
-
ConnectConvertProceedBodySchema, ConnectCreateBodySchema, ConnectInquiryParamsSchema,
|
|
6
|
+
ConnectAttachBodySchema, ConnectConfirmBodySchema, ConnectCreateBodySchema,
|
|
9
7
|
ConnectJobParamsSchema, ConnectModifyBodySchema, ConnectOpParamsSchema, ConnectOpResultSchema,
|
|
10
8
|
ConnectPipelineParamsSchema, ConnectPipelineResumeBodySchema, ConnectProjectIdSchema,
|
|
11
9
|
ConnectProjectLlmBodySchema, ConnectSessionOpenSchema, ConnectSessionParamsSchema,
|
|
12
|
-
ConnectStoryBodySchema, ConnectStoryParamsSchema, ConnectStoryQuerySchema,
|
|
13
|
-
ConnectWaitQuerySchema, InquiryAnswerSchema
|
|
10
|
+
ConnectStoryBodySchema, ConnectStoryParamsSchema, ConnectStoryQuerySchema, ConnectWaitQuerySchema
|
|
14
11
|
} from './schemas.js'
|
|
12
|
+
import type {
|
|
13
|
+
ConnectAttachBody, ConnectConfirmBody, ConnectCreateBody, ConnectJobParams, ConnectModifyBody,
|
|
14
|
+
ConnectPipelineParams, ConnectPipelineResumeBody, ConnectProjectLlmBody, ConnectSessionOpen,
|
|
15
|
+
ConnectSessionParams, ConnectStoryBody, ConnectStoryQuery, ConnectWaitQuery,
|
|
16
|
+
} from './types.js'
|
|
17
|
+
import type { ConnectOpResult } from './ops.js'
|
|
15
18
|
|
|
16
19
|
/**
|
|
17
20
|
* What the platform injects when it mounts the connector routes.
|
|
@@ -42,250 +45,177 @@ export interface ConnectEntrypointOptions {
|
|
|
42
45
|
/**
|
|
43
46
|
* Declare the connector's HTTP and socket surface.
|
|
44
47
|
*
|
|
45
|
-
* One list, spread into the platform's own entrypoints. Handlers are
|
|
48
|
+
* One list, spread into the platform's own entrypoints. Handlers are bound to these protocols
|
|
46
49
|
* server-side and onto client entrypoints in the SDK — the same declarations both times, which is
|
|
47
50
|
* what makes a path or a schema impossible to get wrong on one side only.
|
|
48
51
|
*/
|
|
49
|
-
export const connectEntrypoints = (opts: ConnectEntrypointOptions):
|
|
52
|
+
export const connectEntrypoints = (opts: ConnectEntrypointOptions): EntrypointProtocolDeclaration[] => {
|
|
50
53
|
const prefix = opts.path ?? '/connect'
|
|
51
54
|
const ownership = opts.gate != null
|
|
52
|
-
?
|
|
53
|
-
:
|
|
54
|
-
const paid
|
|
55
|
-
? gate
|
|
55
|
+
? { guards: opts.guard, gate: opts.gate }
|
|
56
|
+
: { guards: opts.guard }
|
|
57
|
+
const paid = opts.localLlm != null
|
|
58
|
+
? { gate: opts.localLlm }
|
|
56
59
|
: undefined
|
|
57
60
|
|
|
58
61
|
return [
|
|
59
|
-
|
|
62
|
+
openProtocol(route(connect.base, prefix), ownership),
|
|
60
63
|
|
|
61
|
-
|
|
64
|
+
openProtocol(route(connect.capabilities, '/capabilities', {
|
|
62
65
|
parent: connect.base, method: RouteMethod.GET
|
|
63
66
|
})),
|
|
64
67
|
|
|
65
68
|
// --- session ---------------------------------------------------------------------------
|
|
66
|
-
|
|
69
|
+
protocol(
|
|
67
70
|
route(connect.session.open, '/session', { parent: connect.base, method: RouteMethod.POST }),
|
|
68
|
-
|
|
71
|
+
contract.request({ body: typed<ConnectSessionOpen>(ConnectSessionOpenSchema) }, typed())
|
|
69
72
|
),
|
|
70
|
-
|
|
73
|
+
protocol(
|
|
71
74
|
route(connect.session.openDelegated, '/session/delegated', {
|
|
72
75
|
parent: connect.base, method: RouteMethod.POST
|
|
73
76
|
}),
|
|
74
|
-
|
|
77
|
+
contract.request({ body: typed<ConnectSessionOpen>(ConnectSessionOpenSchema) }, typed()), paid
|
|
75
78
|
),
|
|
76
|
-
|
|
79
|
+
protocol(
|
|
77
80
|
route(connect.session.get, '/session/:sessionId', {
|
|
78
81
|
parent: connect.base, method: RouteMethod.GET
|
|
79
82
|
}),
|
|
80
|
-
|
|
83
|
+
contract.request({ params: typed<ConnectSessionParams>(ConnectSessionParamsSchema) }, typed())
|
|
81
84
|
),
|
|
82
|
-
|
|
85
|
+
protocol(
|
|
83
86
|
route(connect.session.heartbeat, '/session/:sessionId/heartbeat', {
|
|
84
87
|
parent: connect.base, method: RouteMethod.POST
|
|
85
88
|
}),
|
|
86
|
-
|
|
89
|
+
contract.request({ params: typed<ConnectSessionParams>(ConnectSessionParamsSchema) }, typed())
|
|
87
90
|
),
|
|
88
|
-
|
|
91
|
+
protocol(
|
|
89
92
|
route(connect.session.close, '/session/:sessionId/close', {
|
|
90
93
|
parent: connect.base, method: RouteMethod.POST
|
|
91
94
|
}),
|
|
92
|
-
|
|
95
|
+
contract.request({ params: typed<ConnectSessionParams>(ConnectSessionParamsSchema) }, typed())
|
|
93
96
|
),
|
|
94
|
-
|
|
97
|
+
protocol(
|
|
95
98
|
route(connect.session.socket, '/connect/:sessionId', socket(opts.updateBase)),
|
|
96
|
-
|
|
99
|
+
contract.request({ params: typed<ConnectSessionParams>(ConnectSessionParamsSchema) }, typed())
|
|
97
100
|
),
|
|
98
101
|
|
|
99
102
|
// --- operations ------------------------------------------------------------------------
|
|
100
|
-
|
|
103
|
+
protocol(
|
|
101
104
|
route(connect.op.pull, '/session/:sessionId/ops', {
|
|
102
105
|
parent: connect.base, method: RouteMethod.GET
|
|
103
106
|
}),
|
|
104
|
-
|
|
107
|
+
contract.request({ params: typed<ConnectSessionParams>(ConnectSessionParamsSchema), query: typed<ConnectWaitQuery>(ConnectWaitQuerySchema) }, typed())
|
|
105
108
|
),
|
|
106
|
-
|
|
109
|
+
protocol(
|
|
107
110
|
route(connect.op.submit, '/session/:sessionId/ops/:opId', {
|
|
108
111
|
parent: connect.base, method: RouteMethod.POST
|
|
109
112
|
}),
|
|
110
|
-
|
|
113
|
+
contract.request({ params: typed<{ sessionId: string, opId: string }>(ConnectOpParamsSchema), body: typed<ConnectOpResult>(ConnectOpResultSchema) }, typed())
|
|
111
114
|
),
|
|
112
115
|
|
|
113
116
|
// --- project ---------------------------------------------------------------------------
|
|
114
|
-
|
|
117
|
+
protocol(
|
|
115
118
|
route(connect.project.create, '/project', { parent: connect.base, method: RouteMethod.POST }),
|
|
116
|
-
|
|
119
|
+
contract.request({ body: typed<ConnectCreateBody>(ConnectCreateBodySchema) }, typed())
|
|
117
120
|
),
|
|
118
|
-
|
|
121
|
+
openProtocol(route(connect.project.list, '/project', {
|
|
119
122
|
parent: connect.base, method: RouteMethod.GET
|
|
120
123
|
})),
|
|
121
|
-
|
|
124
|
+
protocol(
|
|
122
125
|
route(connect.project.attach, '/project/attach', {
|
|
123
126
|
parent: connect.base, method: RouteMethod.POST
|
|
124
127
|
}),
|
|
125
|
-
|
|
128
|
+
contract.request({ body: typed<ConnectAttachBody>(ConnectAttachBodySchema) }, typed())
|
|
126
129
|
),
|
|
127
|
-
|
|
130
|
+
protocol(
|
|
128
131
|
route(connect.project.confirm, '/project/:id/confirm', {
|
|
129
132
|
parent: connect.base, method: RouteMethod.POST
|
|
130
133
|
}),
|
|
131
|
-
|
|
134
|
+
contract.request({ params: typed<{ id: string }>(ConnectProjectIdSchema), body: typed<ConnectConfirmBody>(ConnectConfirmBodySchema) }, typed())
|
|
132
135
|
),
|
|
133
|
-
|
|
136
|
+
protocol(
|
|
134
137
|
route(connect.project.status, '/project/:id/status', {
|
|
135
138
|
parent: connect.base, method: RouteMethod.GET
|
|
136
139
|
}),
|
|
137
|
-
|
|
140
|
+
contract.request({ params: typed<{ id: string }>(ConnectProjectIdSchema) }, typed())
|
|
138
141
|
),
|
|
139
|
-
|
|
142
|
+
protocol(
|
|
140
143
|
route(connect.project.reinit, '/project/:id/reinit', {
|
|
141
144
|
parent: connect.base, method: RouteMethod.POST
|
|
142
145
|
}),
|
|
143
|
-
|
|
146
|
+
contract.request({ params: typed<{ id: string }>(ConnectProjectIdSchema) }, typed())
|
|
144
147
|
),
|
|
145
|
-
|
|
148
|
+
protocol(
|
|
146
149
|
route(connect.project.modify, '/project/:id/modify', {
|
|
147
150
|
parent: connect.base, method: RouteMethod.POST
|
|
148
151
|
}),
|
|
149
|
-
|
|
152
|
+
contract.request({ params: typed<{ id: string }>(ConnectProjectIdSchema), body: typed<ConnectModifyBody>(ConnectModifyBodySchema) }, typed())
|
|
150
153
|
),
|
|
151
|
-
|
|
154
|
+
protocol(
|
|
152
155
|
route(connect.project.settings, '/project/:id/settings', {
|
|
153
156
|
parent: connect.base, method: RouteMethod.GET
|
|
154
157
|
}),
|
|
155
|
-
|
|
158
|
+
contract.request({ params: typed<{ id: string }>(ConnectProjectIdSchema) }, typed())
|
|
156
159
|
),
|
|
157
|
-
|
|
160
|
+
protocol(
|
|
158
161
|
route(connect.project.llm, '/project/:id/llm', {
|
|
159
162
|
parent: connect.base, method: RouteMethod.POST
|
|
160
163
|
}),
|
|
161
|
-
|
|
164
|
+
contract.request({ params: typed<{ id: string }>(ConnectProjectIdSchema), body: typed<ConnectProjectLlmBody>(ConnectProjectLlmBodySchema) }, typed()), paid
|
|
162
165
|
),
|
|
163
|
-
|
|
166
|
+
protocol(
|
|
164
167
|
route(connect.project.job, '/project/:id/job/:jobId', {
|
|
165
168
|
parent: connect.base, method: RouteMethod.GET
|
|
166
169
|
}),
|
|
167
|
-
|
|
170
|
+
contract.request({ params: typed<ConnectJobParams>(ConnectJobParamsSchema), query: typed<ConnectWaitQuery>(ConnectWaitQuerySchema) }, typed())
|
|
168
171
|
),
|
|
169
172
|
|
|
170
173
|
// --- stories ---------------------------------------------------------------------------
|
|
171
|
-
|
|
174
|
+
protocol(
|
|
172
175
|
route(connect.story.list, '/story/:id', { parent: connect.base, method: RouteMethod.GET }),
|
|
173
|
-
|
|
176
|
+
contract.request({ params: typed<{ id: string }>(ConnectProjectIdSchema), query: typed<ConnectStoryQuery>(ConnectStoryQuerySchema) }, typed())
|
|
174
177
|
),
|
|
175
|
-
|
|
178
|
+
protocol(
|
|
176
179
|
route(connect.story.create, '/story/:id', { parent: connect.base, method: RouteMethod.POST }),
|
|
177
|
-
|
|
180
|
+
contract.request({ params: typed<{ id: string }>(ConnectProjectIdSchema), body: typed<ConnectStoryBody>(ConnectStoryBodySchema) }, typed())
|
|
178
181
|
),
|
|
179
|
-
|
|
182
|
+
protocol(
|
|
180
183
|
route(connect.story.get, '/story/:id/:storyId', {
|
|
181
184
|
parent: connect.base, method: RouteMethod.GET
|
|
182
185
|
}),
|
|
183
|
-
|
|
186
|
+
contract.request({ params: typed<{ id: string, storyId: string }>(ConnectStoryParamsSchema) }, typed())
|
|
184
187
|
),
|
|
185
|
-
|
|
188
|
+
protocol(
|
|
186
189
|
route(connect.story.update, '/story/:id/:storyId', {
|
|
187
190
|
parent: connect.base, method: RouteMethod.PUT
|
|
188
191
|
}),
|
|
189
|
-
|
|
192
|
+
contract.request({ params: typed<{ id: string, storyId: string }>(ConnectStoryParamsSchema), body: typed<ConnectStoryBody>(ConnectStoryBodySchema) }, typed())
|
|
190
193
|
),
|
|
191
|
-
|
|
194
|
+
protocol(
|
|
192
195
|
route(connect.story.delete, '/story/:id/:storyId', {
|
|
193
196
|
parent: connect.base, method: RouteMethod.DELETE
|
|
194
197
|
}),
|
|
195
|
-
|
|
198
|
+
contract.request({ params: typed<{ id: string, storyId: string }>(ConnectStoryParamsSchema) }, typed())
|
|
196
199
|
),
|
|
197
|
-
|
|
200
|
+
protocol(
|
|
198
201
|
route(connect.story.develop, '/story/:id/:storyId/develop', {
|
|
199
202
|
parent: connect.base, method: RouteMethod.POST
|
|
200
203
|
}),
|
|
201
|
-
|
|
202
|
-
),
|
|
203
|
-
|
|
204
|
-
// --- generated files -------------------------------------------------------------------
|
|
205
|
-
entrypoint(
|
|
206
|
-
route(connect.files.list, '/project/:id/files', {
|
|
207
|
-
parent: connect.base, method: RouteMethod.GET
|
|
208
|
-
}),
|
|
209
|
-
filter(params(ConnectProjectIdSchema))
|
|
210
|
-
),
|
|
211
|
-
|
|
212
|
-
entrypoint(
|
|
213
|
-
route(connect.project.converterLlm, '/project/:id/converter-llm', {
|
|
214
|
-
parent: connect.base, method: RouteMethod.POST
|
|
215
|
-
}),
|
|
216
|
-
// No paid gate, unlike `project.llm`: delegated inference is the DEFAULT for a conversion,
|
|
217
|
-
// not an experimental capability. A conversion reads somebody else's whole repository, and
|
|
218
|
-
// handing those calls to the parent agent is what makes it affordable at all.
|
|
219
|
-
filter(params(ConnectProjectIdSchema, body(ConverterProjectLlmBodySchema)))
|
|
220
|
-
),
|
|
221
|
-
|
|
222
|
-
// --- conversion ------------------------------------------------------------------------
|
|
223
|
-
entrypoint(
|
|
224
|
-
route(connect.convert.create, '/convert', {
|
|
225
|
-
parent: connect.base, method: RouteMethod.POST
|
|
226
|
-
}),
|
|
227
|
-
filter(body(ConnectConvertCreateBodySchema))
|
|
228
|
-
),
|
|
229
|
-
entrypoint(
|
|
230
|
-
route(connect.convert.check, '/convert/:id/check', {
|
|
231
|
-
parent: connect.base, method: RouteMethod.GET
|
|
232
|
-
}),
|
|
233
|
-
filter(params(ConnectProjectIdSchema))
|
|
234
|
-
),
|
|
235
|
-
entrypoint(
|
|
236
|
-
route(connect.convert.start, '/convert/:id/start', {
|
|
237
|
-
parent: connect.base, method: RouteMethod.POST
|
|
238
|
-
}),
|
|
239
|
-
filter(params(ConnectProjectIdSchema))
|
|
240
|
-
),
|
|
241
|
-
entrypoint(
|
|
242
|
-
route(connect.convert.proceed, '/convert/:id/proceed', {
|
|
243
|
-
parent: connect.base, method: RouteMethod.POST
|
|
244
|
-
}),
|
|
245
|
-
filter(params(ConnectProjectIdSchema, body(ConnectConvertProceedBodySchema)))
|
|
246
|
-
),
|
|
247
|
-
entrypoint(
|
|
248
|
-
route(connect.convert.cancel, '/convert/:id/cancel', {
|
|
249
|
-
parent: connect.base, method: RouteMethod.POST
|
|
250
|
-
}),
|
|
251
|
-
filter(params(ConnectProjectIdSchema))
|
|
252
|
-
),
|
|
253
|
-
entrypoint(
|
|
254
|
-
route(connect.convert.status, '/convert/:id', {
|
|
255
|
-
parent: connect.base, method: RouteMethod.GET
|
|
256
|
-
}),
|
|
257
|
-
filter(params(ConnectProjectIdSchema))
|
|
258
|
-
),
|
|
259
|
-
entrypoint(
|
|
260
|
-
route(connect.convert.purge, '/convert/:id/purge', {
|
|
261
|
-
parent: connect.base, method: RouteMethod.POST
|
|
262
|
-
}),
|
|
263
|
-
filter(params(ConnectProjectIdSchema))
|
|
264
|
-
),
|
|
265
|
-
|
|
266
|
-
// --- inquiries -------------------------------------------------------------------------
|
|
267
|
-
// The fallback answer path: a connector answers through its own op id while it holds the
|
|
268
|
-
// question, but a run that parked while nobody was attached has no op to answer, and the
|
|
269
|
-
// question is then reachable only by its own id.
|
|
270
|
-
entrypoint(
|
|
271
|
-
route(connect.inquiry.answer, '/project/:id/inquiry/:inquiryId', {
|
|
272
|
-
parent: connect.base, method: RouteMethod.POST
|
|
273
|
-
}),
|
|
274
|
-
filter(params(ConnectInquiryParamsSchema, body(InquiryAnswerSchema)))
|
|
204
|
+
contract.request({ params: typed<{ id: string, storyId: string }>(ConnectStoryParamsSchema) }, typed())
|
|
275
205
|
),
|
|
276
206
|
|
|
277
207
|
// --- pipelines -------------------------------------------------------------------------
|
|
278
|
-
|
|
208
|
+
protocol(
|
|
279
209
|
route(connect.pipeline.state, '/pipeline/:id/:runId', {
|
|
280
210
|
parent: connect.base, method: RouteMethod.GET
|
|
281
211
|
}),
|
|
282
|
-
|
|
212
|
+
contract.request({ params: typed<ConnectPipelineParams>(ConnectPipelineParamsSchema) }, typed())
|
|
283
213
|
),
|
|
284
|
-
|
|
214
|
+
protocol(
|
|
285
215
|
route(connect.pipeline.resume, '/pipeline/:id/:runId/resume', {
|
|
286
216
|
parent: connect.base, method: RouteMethod.POST
|
|
287
217
|
}),
|
|
288
|
-
|
|
218
|
+
contract.request({ params: typed<ConnectPipelineParams>(ConnectPipelineParamsSchema), body: typed<ConnectPipelineResumeBody>(ConnectPipelineResumeBodySchema) }, typed())
|
|
289
219
|
),
|
|
290
220
|
]
|
|
291
221
|
}
|
package/src/connect/ops.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { SlotCommandPayload } from '../slot/index.js'
|
|
2
2
|
import type {
|
|
3
|
-
|
|
4
|
-
ModelTaskRole, ModelTier
|
|
3
|
+
ConnectOpErrorKind, ConnectOpKind, ModelTaskMode, ModelTaskResultKind, ModelTaskRole, ModelTier
|
|
5
4
|
} from './consts.js'
|
|
6
5
|
import type { ConnectServices } from './types.js'
|
|
7
6
|
|
|
@@ -18,7 +17,7 @@ export interface ConnectOp {
|
|
|
18
17
|
projectId: string
|
|
19
18
|
sessionId: string
|
|
20
19
|
kind: ConnectOpKind
|
|
21
|
-
payload: SlotCommandPayload | ModelTask | ConfigurePayload
|
|
20
|
+
payload: SlotCommandPayload | ModelTask | ConfigurePayload
|
|
22
21
|
createdAt: string
|
|
23
22
|
/** When the asker stops waiting. A connector past this may skip the work and say so. */
|
|
24
23
|
deadlineAt: string
|
|
@@ -159,50 +158,3 @@ export interface ModelTaskUsage {
|
|
|
159
158
|
inputTokens?: number
|
|
160
159
|
outputTokens?: number
|
|
161
160
|
}
|
|
162
|
-
|
|
163
|
-
/** One option a {@link ConnectInquiryKind.Choice} question offers. */
|
|
164
|
-
export interface ConnectInquiryOption {
|
|
165
|
-
value: string
|
|
166
|
-
label: string
|
|
167
|
-
description?: string
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* One question put to the person the connector is working for.
|
|
172
|
-
*
|
|
173
|
-
* It carries where it came from — the job, the run and the step — because an answer is recorded
|
|
174
|
-
* against the run that asked and re-read when that run resumes. `expiresAt` is what makes an
|
|
175
|
-
* unanswered question fail its step instead of parking a project lock forever.
|
|
176
|
-
*/
|
|
177
|
-
export interface InquiryPayload {
|
|
178
|
-
id: string
|
|
179
|
-
projectId: string
|
|
180
|
-
jobId?: string
|
|
181
|
-
runId?: string
|
|
182
|
-
/** The pipeline step that asked, so a resumed run can match the answer to the place it belongs. */
|
|
183
|
-
step?: string
|
|
184
|
-
kind: ConnectInquiryKind
|
|
185
|
-
question: string
|
|
186
|
-
/** What the asker already knows, so the person is not asked to go and find it out. */
|
|
187
|
-
context?: string
|
|
188
|
-
options?: ConnectInquiryOption[]
|
|
189
|
-
multiple?: boolean
|
|
190
|
-
/** Whether a choice question also accepts text the options do not cover. */
|
|
191
|
-
allowText?: boolean
|
|
192
|
-
/** What the asker will assume if nobody answers. Recorded as an assumption when it is used. */
|
|
193
|
-
default?: string | string[]
|
|
194
|
-
expiresAt: string
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
/**
|
|
198
|
-
* The answer to one question.
|
|
199
|
-
*
|
|
200
|
-
* `declined` is a real answer and not an absence: it says a person saw the question and chose not
|
|
201
|
-
* to decide, which the asker records as an assumption rather than waiting out the timeout.
|
|
202
|
-
*/
|
|
203
|
-
export interface InquiryAnswerPayload {
|
|
204
|
-
inquiryId: string
|
|
205
|
-
value?: string | string[]
|
|
206
|
-
text?: string
|
|
207
|
-
declined?: boolean
|
|
208
|
-
}
|
|
@@ -1,23 +1,71 @@
|
|
|
1
1
|
import { entrypointRef } from '@owlmeans/entrypoint'
|
|
2
|
+
import type { RegisteredEntrypoint, RequestShape } from '@owlmeans/entrypoint'
|
|
3
|
+
import type { EntrypointReference } from '@owlmeans/context'
|
|
2
4
|
import { connect } from './consts.js'
|
|
3
5
|
import type { ConnectOp, ConnectOpResult } from './ops.js'
|
|
4
|
-
import type { ConverterProjectLlmBody } from '../convert/index.js'
|
|
5
6
|
import type {
|
|
6
7
|
ConnectAttachBody, ConnectCapabilitiesView, ConnectConfirmBody, ConnectCreateBody, ConnectJob,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
ConnectStoryQuery, ConnectWaitQuery, ConversionStatusView, ConvertCheck,
|
|
8
|
+
ConnectJobParams, ConnectModifyBody, ConnectOpSubmission, ConnectPipelineParams,
|
|
9
|
+
ConnectPipelineResumeBody, ConnectPipelineState, ConnectProjectLlmBody, ConnectProjectSettings,
|
|
10
|
+
ConnectProjectStatus, ConnectProjectSummary, ConnectSessionOpen, ConnectSessionParams,
|
|
11
|
+
ConnectSessionView, ConnectStoryBody, ConnectStoryDeletion, ConnectStoryItem, ConnectStoryList,
|
|
12
|
+
ConnectStoryMutation, ConnectStoryQuery, ConnectWaitQuery,
|
|
13
13
|
} from './types.js'
|
|
14
14
|
|
|
15
|
+
type ConnectReference<Request extends RequestShape, Response> =
|
|
16
|
+
EntrypointReference<RegisteredEntrypoint<Request, Response>>
|
|
17
|
+
|
|
18
|
+
export interface ConnectReferences {
|
|
19
|
+
capabilities: ConnectReference<{}, ConnectCapabilitiesView>
|
|
20
|
+
session: {
|
|
21
|
+
open: ConnectReference<{ body: ConnectSessionOpen }, ConnectSessionView>
|
|
22
|
+
openDelegated: ConnectReference<{ body: ConnectSessionOpen }, ConnectSessionView>
|
|
23
|
+
get: ConnectReference<{ params: ConnectSessionParams }, ConnectSessionView>
|
|
24
|
+
heartbeat: ConnectReference<{ params: ConnectSessionParams }, ConnectSessionView>
|
|
25
|
+
close: ConnectReference<{ params: ConnectSessionParams }, ConnectSessionView>
|
|
26
|
+
}
|
|
27
|
+
op: {
|
|
28
|
+
pull: ConnectReference<{ params: ConnectSessionParams, query: ConnectWaitQuery }, ConnectOp[]>
|
|
29
|
+
submit: ConnectReference<{
|
|
30
|
+
params: { sessionId: string, opId: string }, body: ConnectOpResult
|
|
31
|
+
}, ConnectOpSubmission>
|
|
32
|
+
}
|
|
33
|
+
project: {
|
|
34
|
+
create: ConnectReference<{ body: ConnectCreateBody }, ConnectJob>
|
|
35
|
+
confirm: ConnectReference<{ params: { id: string }, body: ConnectConfirmBody }, ConnectJob>
|
|
36
|
+
list: ConnectReference<{}, ConnectProjectSummary[]>
|
|
37
|
+
status: ConnectReference<{ params: { id: string } }, ConnectProjectStatus>
|
|
38
|
+
attach: ConnectReference<{ body: ConnectAttachBody }, ConnectProjectStatus>
|
|
39
|
+
reinit: ConnectReference<{ params: { id: string } }, ConnectJob>
|
|
40
|
+
modify: ConnectReference<{ params: { id: string }, body: ConnectModifyBody }, ConnectJob>
|
|
41
|
+
settings: ConnectReference<{ params: { id: string } }, ConnectProjectSettings>
|
|
42
|
+
llm: ConnectReference<{ params: { id: string }, body: ConnectProjectLlmBody }, ConnectProjectSettings>
|
|
43
|
+
job: ConnectReference<{ params: ConnectJobParams, query: ConnectWaitQuery }, ConnectJob>
|
|
44
|
+
}
|
|
45
|
+
story: {
|
|
46
|
+
list: ConnectReference<{ params: { id: string }, query: ConnectStoryQuery }, ConnectStoryList>
|
|
47
|
+
get: ConnectReference<{ params: { id: string, storyId: string } }, ConnectStoryItem>
|
|
48
|
+
create: ConnectReference<{ params: { id: string }, body: ConnectStoryBody }, ConnectStoryMutation>
|
|
49
|
+
update: ConnectReference<{
|
|
50
|
+
params: { id: string, storyId: string }, body: ConnectStoryBody
|
|
51
|
+
}, ConnectStoryMutation>
|
|
52
|
+
delete: ConnectReference<{ params: { id: string, storyId: string } }, ConnectStoryDeletion>
|
|
53
|
+
develop: ConnectReference<{ params: { id: string, storyId: string } }, ConnectJob>
|
|
54
|
+
}
|
|
55
|
+
pipeline: {
|
|
56
|
+
state: ConnectReference<{ params: ConnectPipelineParams }, ConnectPipelineState>
|
|
57
|
+
resume: ConnectReference<{
|
|
58
|
+
params: ConnectPipelineParams, body: ConnectPipelineResumeBody
|
|
59
|
+
}, ConnectJob>
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
15
63
|
/**
|
|
16
64
|
* Typed references for adapter packages that address the connector dynamically. Applications
|
|
17
65
|
* export protocol objects instead; an adapter may use this compact form because it never exposes
|
|
18
66
|
* aliases to UI or domain code.
|
|
19
67
|
*/
|
|
20
|
-
export const connectRef = {
|
|
68
|
+
export const connectRef: ConnectReferences = {
|
|
21
69
|
capabilities: entrypointRef<{}, ConnectCapabilitiesView>(connect.capabilities),
|
|
22
70
|
session: {
|
|
23
71
|
open: entrypointRef<{ body: ConnectSessionOpen }, ConnectSessionView>(connect.session.open),
|
|
@@ -44,29 +92,8 @@ export const connectRef = {
|
|
|
44
92
|
llm: entrypointRef<{
|
|
45
93
|
params: { id: string }, body: ConnectProjectLlmBody
|
|
46
94
|
}, ConnectProjectSettings>(connect.project.llm),
|
|
47
|
-
converterLlm: entrypointRef<{
|
|
48
|
-
params: { id: string }, body: ConverterProjectLlmBody
|
|
49
|
-
}, ConnectProjectSettings>(connect.project.converterLlm),
|
|
50
95
|
job: entrypointRef<{ params: ConnectJobParams, query: ConnectWaitQuery }, ConnectJob>(connect.project.job),
|
|
51
96
|
},
|
|
52
|
-
convert: {
|
|
53
|
-
create: entrypointRef<{ body: ConnectConvertCreateBody }, ConnectJob>(connect.convert.create),
|
|
54
|
-
check: entrypointRef<{ params: { id: string } }, ConvertCheck>(connect.convert.check),
|
|
55
|
-
start: entrypointRef<{ params: { id: string } }, ConnectJob>(connect.convert.start),
|
|
56
|
-
proceed: entrypointRef<{
|
|
57
|
-
params: { id: string }, body: ConnectConvertProceedBody
|
|
58
|
-
}, ConnectJob>(connect.convert.proceed),
|
|
59
|
-
cancel: entrypointRef<{ params: { id: string } }, ConnectJob>(connect.convert.cancel),
|
|
60
|
-
status: entrypointRef<{
|
|
61
|
-
params: { id: string }
|
|
62
|
-
}, ConversionStatusView>(connect.convert.status),
|
|
63
|
-
purge: entrypointRef<{ params: { id: string } }, ConnectJob>(connect.convert.purge),
|
|
64
|
-
},
|
|
65
|
-
inquiry: {
|
|
66
|
-
answer: entrypointRef<{
|
|
67
|
-
params: { id: string, inquiryId: string }, body: ConnectInquiryAnswerBody
|
|
68
|
-
}, unknown>(connect.inquiry.answer),
|
|
69
|
-
},
|
|
70
97
|
story: {
|
|
71
98
|
list: entrypointRef<{ params: { id: string }, query: ConnectStoryQuery }, ConnectStoryList>(connect.story.list),
|
|
72
99
|
get: entrypointRef<{ params: { id: string, storyId: string } }, ConnectStoryItem>(connect.story.get),
|
|
@@ -77,9 +104,6 @@ export const connectRef = {
|
|
|
77
104
|
delete: entrypointRef<{ params: { id: string, storyId: string } }, ConnectStoryDeletion>(connect.story.delete),
|
|
78
105
|
develop: entrypointRef<{ params: { id: string, storyId: string } }, ConnectJob>(connect.story.develop),
|
|
79
106
|
},
|
|
80
|
-
files: {
|
|
81
|
-
list: entrypointRef<{ params: { id: string } }, string[]>(connect.files.list),
|
|
82
|
-
},
|
|
83
107
|
pipeline: {
|
|
84
108
|
state: entrypointRef<{ params: ConnectPipelineParams }, ConnectPipelineState>(connect.pipeline.state),
|
|
85
109
|
resume: entrypointRef<{
|