@proteos/sdk 0.84.0 → 0.85.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/dist/index.cjs +17 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +96 -6
- package/dist/index.d.ts +96 -6
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/discovery/index.ts +35 -3
- package/src/discovery/types.ts +84 -2
- package/src/index.ts +8 -0
package/package.json
CHANGED
package/src/discovery/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ProteosClient } from '../client.js'
|
|
2
2
|
import type {
|
|
3
|
+
CreateDiscoveryEvidenceNarrationRequest,
|
|
3
4
|
CreateDiscoveryEvidenceRequest,
|
|
4
5
|
DiscoveryEvidence,
|
|
5
6
|
DiscoveryEvidenceDownloadUrl,
|
|
7
|
+
DiscoveryEvidenceNarration,
|
|
6
8
|
DiscoveryEvidenceOrgSummary,
|
|
7
9
|
ListDiscoveryEvidenceQuery,
|
|
8
10
|
ListPlatformDiscoveryEvidenceQuery,
|
|
@@ -22,22 +24,25 @@ const encode = encodeURIComponent
|
|
|
22
24
|
* screen recordings with ink-annotated frames, written feedback).
|
|
23
25
|
*
|
|
24
26
|
* `evidence` acts in the caller's org — own rows under a scoped grant, every
|
|
25
|
-
* row under the unscoped read. `
|
|
26
|
-
*
|
|
27
|
+
* row under the unscoped read. `narrations` are the jobs that draft feedback
|
|
28
|
+
* from what was said in a recording. `platform` is the Proteos-side view
|
|
29
|
+
* across every org; it answers only to platform admins.
|
|
27
30
|
*
|
|
28
31
|
* ```ts
|
|
29
32
|
* const discovery = new DiscoveryClient(client)
|
|
30
|
-
* const sent = await discovery.evidence.create({ kind: 'feedback',
|
|
33
|
+
* const sent = await discovery.evidence.create({ kind: 'feedback', source: 'web', notes, context })
|
|
31
34
|
* const { data: mine } = await discovery.evidence.list()
|
|
32
35
|
* const { url } = await discovery.evidence.createDownloadUrl(sent.id, fileId)
|
|
33
36
|
* ```
|
|
34
37
|
*/
|
|
35
38
|
export class DiscoveryClient {
|
|
36
39
|
readonly evidence: DiscoveryEvidenceService
|
|
40
|
+
readonly narrations: DiscoveryEvidenceNarrationService
|
|
37
41
|
readonly platform: PlatformDiscoveryEvidenceService
|
|
38
42
|
|
|
39
43
|
constructor(client: ProteosClient) {
|
|
40
44
|
this.evidence = new DiscoveryEvidenceServiceImpl(client)
|
|
45
|
+
this.narrations = new DiscoveryEvidenceNarrationServiceImpl(client)
|
|
41
46
|
this.platform = new PlatformDiscoveryEvidenceServiceImpl(client)
|
|
42
47
|
}
|
|
43
48
|
}
|
|
@@ -55,6 +60,17 @@ export interface DiscoveryEvidenceService {
|
|
|
55
60
|
createDownloadUrl(id: string, fileId: string): Promise<DiscoveryEvidenceDownloadUrl>
|
|
56
61
|
}
|
|
57
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Narration jobs of the capture UI: started when a recording with sound stops,
|
|
65
|
+
* polled until `completed` or `failed`, named on the create request.
|
|
66
|
+
*/
|
|
67
|
+
export interface DiscoveryEvidenceNarrationService {
|
|
68
|
+
create(request: CreateDiscoveryEvidenceNarrationRequest): Promise<DiscoveryEvidenceNarration>
|
|
69
|
+
get(id: string): Promise<DiscoveryEvidenceNarration>
|
|
70
|
+
/** Discards a job that was not sent with evidence, along with its audio file. */
|
|
71
|
+
delete(id: string): Promise<void>
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
/** The Proteos-side view across orgs. Platform admins only. */
|
|
59
75
|
export interface PlatformDiscoveryEvidenceService {
|
|
60
76
|
list(query?: ListPlatformDiscoveryEvidenceQuery): Promise<ListResponse<DiscoveryEvidence>>
|
|
@@ -99,6 +115,22 @@ class DiscoveryEvidenceServiceImpl implements DiscoveryEvidenceService {
|
|
|
99
115
|
}
|
|
100
116
|
}
|
|
101
117
|
|
|
118
|
+
class DiscoveryEvidenceNarrationServiceImpl implements DiscoveryEvidenceNarrationService {
|
|
119
|
+
constructor(private readonly client: ProteosClient) {}
|
|
120
|
+
|
|
121
|
+
create(request: CreateDiscoveryEvidenceNarrationRequest): Promise<DiscoveryEvidenceNarration> {
|
|
122
|
+
return this.client.request('POST', `${DISCOVERY_BASE_PATH}/evidence-narrations`, request)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
get(id: string): Promise<DiscoveryEvidenceNarration> {
|
|
126
|
+
return this.client.request('GET', `${DISCOVERY_BASE_PATH}/evidence-narrations/${encode(id)}`)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
async delete(id: string): Promise<void> {
|
|
130
|
+
await this.client.request('DELETE', `${DISCOVERY_BASE_PATH}/evidence-narrations/${encode(id)}`)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
102
134
|
class PlatformDiscoveryEvidenceServiceImpl implements PlatformDiscoveryEvidenceService {
|
|
103
135
|
constructor(private readonly client: ProteosClient) {}
|
|
104
136
|
|
package/src/discovery/types.ts
CHANGED
|
@@ -11,6 +11,20 @@ export type DiscoveryEvidenceKind = 'screenshot' | 'recording' | 'feedback'
|
|
|
11
11
|
export type DiscoveryEvidenceCategory = 'bug' | 'idea' | 'question' | 'praise' | 'other'
|
|
12
12
|
export type DiscoveryEvidenceStatus = 'new' | 'reviewed' | 'archived'
|
|
13
13
|
export type DiscoveryEvidenceSource = 'web' | 'extension'
|
|
14
|
+
/**
|
|
15
|
+
* The background call that writes the title and category the sender no longer
|
|
16
|
+
* types: `pending` until it ran, then `completed` or `failed` (the fallbacks
|
|
17
|
+
* stay).
|
|
18
|
+
*/
|
|
19
|
+
export type DiscoveryEvidenceEnrichmentStatus = 'pending' | 'completed' | 'failed'
|
|
20
|
+
/**
|
|
21
|
+
* Who wrote a field: `''` when it is empty or was never set, `generated` for a
|
|
22
|
+
* title or category the model wrote, `narration` for notes and frame comments
|
|
23
|
+
* drafted from what the sender said, `user` for anything a person typed or
|
|
24
|
+
* edited. A `user` value is never overwritten by a model.
|
|
25
|
+
*/
|
|
26
|
+
export type DiscoveryEvidenceFieldSource = '' | 'generated' | 'narration' | 'user'
|
|
27
|
+
export type DiscoveryEvidenceNarrationStatus = 'transcribing' | 'drafting' | 'completed' | 'failed'
|
|
14
28
|
|
|
15
29
|
/** What the client knew when it captured: where the user was and on what. */
|
|
16
30
|
export interface DiscoveryEvidenceContext {
|
|
@@ -64,6 +78,7 @@ export interface DiscoveryEvidenceFrame {
|
|
|
64
78
|
/** The composite with the ink burned in; empty when the client did not render one. */
|
|
65
79
|
annotated_image_file_id: string
|
|
66
80
|
comment: string
|
|
81
|
+
comment_source: DiscoveryEvidenceFieldSource
|
|
67
82
|
strokes: InkStroke[]
|
|
68
83
|
}
|
|
69
84
|
|
|
@@ -74,6 +89,12 @@ export interface DiscoveryEvidence {
|
|
|
74
89
|
category: DiscoveryEvidenceCategory
|
|
75
90
|
title: string
|
|
76
91
|
notes: string
|
|
92
|
+
enrichment_status: DiscoveryEvidenceEnrichmentStatus
|
|
93
|
+
title_source: DiscoveryEvidenceFieldSource
|
|
94
|
+
category_source: DiscoveryEvidenceFieldSource
|
|
95
|
+
notes_source: DiscoveryEvidenceFieldSource
|
|
96
|
+
/** The transcription of the narration; empty unless a recording with audio was transcribed. */
|
|
97
|
+
transcription_id: string
|
|
77
98
|
status: DiscoveryEvidenceStatus
|
|
78
99
|
source: DiscoveryEvidenceSource
|
|
79
100
|
context: DiscoveryEvidenceContext
|
|
@@ -116,6 +137,14 @@ export interface CreateDiscoveryEvidenceFrameRequest {
|
|
|
116
137
|
image_file_id: string
|
|
117
138
|
annotated_image_file_id?: string
|
|
118
139
|
comment?: string
|
|
140
|
+
/** `narration` when the comment is a draft the sender left as drafted. */
|
|
141
|
+
comment_source?: 'narration' | 'user'
|
|
142
|
+
/**
|
|
143
|
+
* The key this frame had in the narration job the evidence is sent with.
|
|
144
|
+
* A draft that lands after sending goes to the frame with its key; a frame
|
|
145
|
+
* without one gets none.
|
|
146
|
+
*/
|
|
147
|
+
narration_key?: string
|
|
119
148
|
strokes: CreateDiscoveryEvidenceStrokeRequest[]
|
|
120
149
|
}
|
|
121
150
|
|
|
@@ -125,12 +154,22 @@ export interface CreateDiscoveryEvidenceFrameRequest {
|
|
|
125
154
|
* Shape rules per kind: a screenshot has exactly one frame at 0 and no
|
|
126
155
|
* recording; a recording has a recording file and frames within its duration;
|
|
127
156
|
* feedback has neither and non-blank notes.
|
|
157
|
+
*
|
|
158
|
+
* The sender types only the notes: leave `category` and `title` out and a
|
|
159
|
+
* model call writes both after the create. A value that is sent is kept.
|
|
128
160
|
*/
|
|
129
161
|
export interface CreateDiscoveryEvidenceRequest {
|
|
130
162
|
kind: DiscoveryEvidenceKind
|
|
131
|
-
category
|
|
163
|
+
category?: DiscoveryEvidenceCategory
|
|
132
164
|
title?: string
|
|
133
165
|
notes?: string
|
|
166
|
+
/** `narration` when the notes are a draft the sender left as drafted. */
|
|
167
|
+
notes_source?: 'narration' | 'user'
|
|
168
|
+
/**
|
|
169
|
+
* The narration job of a recording. Drafts that are not ready at send time
|
|
170
|
+
* are added to the notes and frame comments that are still empty.
|
|
171
|
+
*/
|
|
172
|
+
narration_id?: string
|
|
134
173
|
source: DiscoveryEvidenceSource
|
|
135
174
|
context: DiscoveryEvidenceContext
|
|
136
175
|
recording_file_id?: string
|
|
@@ -147,8 +186,12 @@ export interface UpdateDiscoveryEvidenceFrameRequest {
|
|
|
147
186
|
comment: string
|
|
148
187
|
}
|
|
149
188
|
|
|
150
|
-
/**
|
|
189
|
+
/**
|
|
190
|
+
* The submitter's partial edit: the words, never the capture. Every field sent
|
|
191
|
+
* is marked as written by a person and is never replaced by a model afterwards.
|
|
192
|
+
*/
|
|
151
193
|
export interface UpdateDiscoveryEvidenceRequest {
|
|
194
|
+
/** 1 to 120 characters. */
|
|
152
195
|
title?: string
|
|
153
196
|
notes?: string
|
|
154
197
|
category?: DiscoveryEvidenceCategory
|
|
@@ -161,6 +204,45 @@ export interface UpdateDiscoveryEvidenceStatusRequest {
|
|
|
161
204
|
status: DiscoveryEvidenceStatus
|
|
162
205
|
}
|
|
163
206
|
|
|
207
|
+
/** A frame as the client knows it when the recording stops. */
|
|
208
|
+
export interface CreateDiscoveryEvidenceNarrationFrameRequest {
|
|
209
|
+
/** The client's own key; the drafts come back by it. */
|
|
210
|
+
key: string
|
|
211
|
+
at_ms: number
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Starts a narration job from the audio-only file uploaded when the recording
|
|
216
|
+
* stopped: it is transcribed, then one model call drafts the feedback text and
|
|
217
|
+
* a comment per frame.
|
|
218
|
+
*/
|
|
219
|
+
export interface CreateDiscoveryEvidenceNarrationRequest {
|
|
220
|
+
audio_file_id: string
|
|
221
|
+
frames: CreateDiscoveryEvidenceNarrationFrameRequest[]
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/** The draft for one frame, with the stretch of narration it was taken from. */
|
|
225
|
+
export interface DiscoveryEvidenceNarrationFrameComment {
|
|
226
|
+
key: string
|
|
227
|
+
/** Empty when nothing was said about the frame. */
|
|
228
|
+
comment: string
|
|
229
|
+
from_ms: number
|
|
230
|
+
to_ms: number
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/** A narration job. Only the person who started it can read it. */
|
|
234
|
+
export interface DiscoveryEvidenceNarration {
|
|
235
|
+
id: string
|
|
236
|
+
org_id: string
|
|
237
|
+
status: DiscoveryEvidenceNarrationStatus
|
|
238
|
+
/** The draft for the feedback text; empty until completed, or when nothing was said. */
|
|
239
|
+
summary: string
|
|
240
|
+
frame_comments: DiscoveryEvidenceNarrationFrameComment[]
|
|
241
|
+
created_at: string
|
|
242
|
+
created_by: UserRef
|
|
243
|
+
updated_at: string
|
|
244
|
+
}
|
|
245
|
+
|
|
164
246
|
export interface ListDiscoveryEvidenceQuery {
|
|
165
247
|
kind?: DiscoveryEvidenceKind
|
|
166
248
|
category?: DiscoveryEvidenceCategory
|
package/src/index.ts
CHANGED
|
@@ -613,15 +613,23 @@ export {
|
|
|
613
613
|
export type {
|
|
614
614
|
CreateDiscoveryEvidenceFrameRequest,
|
|
615
615
|
CreateDiscoveryEvidenceLinkRequest,
|
|
616
|
+
CreateDiscoveryEvidenceNarrationFrameRequest,
|
|
617
|
+
CreateDiscoveryEvidenceNarrationRequest,
|
|
616
618
|
CreateDiscoveryEvidenceRequest,
|
|
617
619
|
CreateDiscoveryEvidenceStrokeRequest,
|
|
618
620
|
DiscoveryEvidence,
|
|
619
621
|
DiscoveryEvidenceCategory,
|
|
620
622
|
DiscoveryEvidenceContext,
|
|
621
623
|
DiscoveryEvidenceDownloadUrl,
|
|
624
|
+
DiscoveryEvidenceEnrichmentStatus,
|
|
625
|
+
DiscoveryEvidenceFieldSource,
|
|
622
626
|
DiscoveryEvidenceFrame,
|
|
623
627
|
DiscoveryEvidenceKind,
|
|
624
628
|
DiscoveryEvidenceLink,
|
|
629
|
+
DiscoveryEvidenceNarration,
|
|
630
|
+
DiscoveryEvidenceNarrationFrameComment,
|
|
631
|
+
DiscoveryEvidenceNarrationService,
|
|
632
|
+
DiscoveryEvidenceNarrationStatus,
|
|
625
633
|
DiscoveryEvidenceOrgSummary,
|
|
626
634
|
DiscoveryEvidenceService,
|
|
627
635
|
DiscoveryEvidenceSource,
|