@proteos/sdk 0.83.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 +42 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +210 -23
- package/dist/index.d.ts +210 -23
- package/dist/index.js +42 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agent/session-types.ts +19 -3
- package/src/agent/sessions.ts +16 -1
- package/src/data/index.ts +5 -0
- package/src/data/record-drafts.ts +28 -2
- package/src/data/types.ts +78 -8
- package/src/discovery/index.ts +35 -3
- package/src/discovery/types.ts +84 -2
- package/src/index.ts +13 -0
package/package.json
CHANGED
|
@@ -25,9 +25,10 @@ export type { ToolKind } from './types.js'
|
|
|
25
25
|
/**
|
|
26
26
|
* The latest lifecycle state of a session, projected from the `session.status_*`
|
|
27
27
|
* events. `idle` = ready for the next user message; `running` = a turn is in
|
|
28
|
-
* flight; `terminated` =
|
|
28
|
+
* flight; `terminated` = the provider session is gone; `error` = the last turn
|
|
29
|
+
* failed; `ended` = a person ended it — the next `user.message` reopens it.
|
|
29
30
|
*/
|
|
30
|
-
export type SessionStatus = 'idle' | 'running' | 'terminated' | 'error'
|
|
31
|
+
export type SessionStatus = 'idle' | 'running' | 'terminated' | 'error' | 'ended'
|
|
31
32
|
|
|
32
33
|
/**
|
|
33
34
|
* The rolled-up token accounting for a session — the sum of every model request's
|
|
@@ -62,6 +63,10 @@ export interface Session extends AuditFields {
|
|
|
62
63
|
title: string
|
|
63
64
|
status: SessionStatus
|
|
64
65
|
usage: SessionUsage
|
|
66
|
+
/** When the session was ended; null unless `status` is `ended`. */
|
|
67
|
+
ended_at: string | null
|
|
68
|
+
/** Who ended it; null unless `status` is `ended` (and on sessions ended by the platform). */
|
|
69
|
+
ended_by: UserRef | null
|
|
65
70
|
}
|
|
66
71
|
|
|
67
72
|
// ---------------------------------------------------------------------------
|
|
@@ -90,6 +95,7 @@ export type EventType =
|
|
|
90
95
|
| 'session.status_running'
|
|
91
96
|
| 'session.status_idle'
|
|
92
97
|
| 'session.status_terminated'
|
|
98
|
+
| 'session.status_ended'
|
|
93
99
|
| 'session.error'
|
|
94
100
|
| 'session.updated'
|
|
95
101
|
// Span (observability).
|
|
@@ -274,7 +280,7 @@ export interface ModelRequestEndPayload {
|
|
|
274
280
|
|
|
275
281
|
/**
|
|
276
282
|
* The body of events that carry no fields (`user.interrupt`,
|
|
277
|
-
* `session.status_running`, `session.status_terminated`).
|
|
283
|
+
* `session.status_running`, `session.status_terminated`, `session.status_ended`).
|
|
278
284
|
*/
|
|
279
285
|
export type EmptyPayload = Record<string, never>
|
|
280
286
|
|
|
@@ -318,6 +324,7 @@ export type SessionEvent = SessionEventEnvelope &
|
|
|
318
324
|
| { type: 'session.status_running'; payload: EmptyPayload }
|
|
319
325
|
| { type: 'session.status_idle'; payload: SessionIdlePayload }
|
|
320
326
|
| { type: 'session.status_terminated'; payload: EmptyPayload }
|
|
327
|
+
| { type: 'session.status_ended'; payload: EmptyPayload }
|
|
321
328
|
| { type: 'session.error'; payload: ErrorPayload }
|
|
322
329
|
| { type: 'session.updated'; payload: SessionUpdatedPayload }
|
|
323
330
|
| { type: 'span.model_request_start'; payload: ModelRequestStartPayload }
|
|
@@ -394,6 +401,15 @@ export interface AppendEventRequest {
|
|
|
394
401
|
export interface ListSessionsOptions extends ListOptions {
|
|
395
402
|
/** Filter by the agent the session runs. */
|
|
396
403
|
agent_key?: string
|
|
404
|
+
/** Keep sessions in this status, or in any of several. */
|
|
405
|
+
status?: SessionStatus | SessionStatus[]
|
|
406
|
+
/** Keep sessions whose title contains this text, ignoring case. */
|
|
407
|
+
title?: string
|
|
408
|
+
/**
|
|
409
|
+
* Keep the sessions one user started: a user id, or `'me'` for the caller.
|
|
410
|
+
* It narrows what the caller may see and never widens it.
|
|
411
|
+
*/
|
|
412
|
+
created_by?: string
|
|
397
413
|
}
|
|
398
414
|
|
|
399
415
|
/**
|
package/src/agent/sessions.ts
CHANGED
|
@@ -79,6 +79,12 @@ export interface SessionService {
|
|
|
79
79
|
): Promise<SessionEvent>
|
|
80
80
|
/** Convenience: appends a `user.interrupt` to halt the running turn. */
|
|
81
81
|
interrupt(id: string): Promise<SessionEvent>
|
|
82
|
+
/**
|
|
83
|
+
* Ends the session (`status: 'ended'`). A running turn is interrupted first and
|
|
84
|
+
* the session ends once it has closed, so the returned session can still read
|
|
85
|
+
* `running`. The next `user.message` reopens an ended session.
|
|
86
|
+
*/
|
|
87
|
+
end(id: string): Promise<Session>
|
|
82
88
|
/**
|
|
83
89
|
* Convenience: appends a `user.tool_result` answering a client tool the agent
|
|
84
90
|
* called (an `agent.tool_use` with `tool_kind: 'client'`). `toolUseId` is that
|
|
@@ -100,7 +106,12 @@ export class SessionServiceImpl implements SessionService {
|
|
|
100
106
|
}
|
|
101
107
|
|
|
102
108
|
async listPage(options: ListSessionsOptions = {}): Promise<ListResult<Session>> {
|
|
103
|
-
|
|
109
|
+
// The API takes several statuses as one comma-separated value, not as a
|
|
110
|
+
// repeated parameter.
|
|
111
|
+
const query = Array.isArray(options.status)
|
|
112
|
+
? { ...options, status: options.status.join(',') }
|
|
113
|
+
: options
|
|
114
|
+
return this.client.requestWithQuery<ListResult<Session>>('GET', SESSIONS_BASE_PATH, query)
|
|
104
115
|
}
|
|
105
116
|
|
|
106
117
|
async get(id: string): Promise<Session> {
|
|
@@ -186,6 +197,10 @@ export class SessionServiceImpl implements SessionService {
|
|
|
186
197
|
return this.appendEvent(id, { type: 'user.interrupt' })
|
|
187
198
|
}
|
|
188
199
|
|
|
200
|
+
async end(id: string): Promise<Session> {
|
|
201
|
+
return this.client.request<Session>('POST', `${SESSIONS_BASE_PATH}/${id}/end`)
|
|
202
|
+
}
|
|
203
|
+
|
|
189
204
|
async submitToolResult(
|
|
190
205
|
id: string,
|
|
191
206
|
input: { toolUseId: string; result: ResultBlock[]; outcome?: 'success' | 'error' },
|
package/src/data/index.ts
CHANGED
|
@@ -78,13 +78,18 @@ export type {
|
|
|
78
78
|
RecordDraftIntent,
|
|
79
79
|
RecordDraftItem,
|
|
80
80
|
RecordDraftItemError,
|
|
81
|
+
RecordDraftItemInput,
|
|
81
82
|
RecordDraftItemResult,
|
|
82
83
|
RecordDraftItemResultStatus,
|
|
83
84
|
RecordDraftStatus,
|
|
85
|
+
RecordDraftVersion,
|
|
86
|
+
RecordDraftVersionKind,
|
|
87
|
+
RecordDraftVersions,
|
|
84
88
|
RecordDuplicate,
|
|
85
89
|
RecordDuplicateSource,
|
|
86
90
|
RecordDuplicateStatus,
|
|
87
91
|
RejectRecordDraftRequest,
|
|
92
|
+
UpdateRecordDraftRequest,
|
|
88
93
|
} from './types.js'
|
|
89
94
|
|
|
90
95
|
// Re-export Zod schemas
|
|
@@ -5,7 +5,9 @@ import type {
|
|
|
5
5
|
CreateRecordDraftRequest,
|
|
6
6
|
ListRecordDraftsQuery,
|
|
7
7
|
RecordDraft,
|
|
8
|
+
RecordDraftVersions,
|
|
8
9
|
RejectRecordDraftRequest,
|
|
10
|
+
UpdateRecordDraftRequest,
|
|
9
11
|
} from './types.js'
|
|
10
12
|
|
|
11
13
|
const RECORD_DRAFTS_BASE_PATH = '/data/v1/record-drafts'
|
|
@@ -22,8 +24,17 @@ export interface RecordDraftService {
|
|
|
22
24
|
get(id: string): Promise<RecordDraft>
|
|
23
25
|
create(request: CreateRecordDraftRequest): Promise<RecordDraft>
|
|
24
26
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
+
* Saves a proposed draft's items (a proposer's revision or a reviewer's
|
|
28
|
+
* edit) — nothing is written to the records. 409 `record_draft_conflict`
|
|
29
|
+
* when `expected_updated_at` is stale, `record_draft_not_proposed` once
|
|
30
|
+
* resolved.
|
|
31
|
+
*/
|
|
32
|
+
update(id: string, request: UpdateRecordDraftRequest): Promise<RecordDraft>
|
|
33
|
+
/** The draft's history and what reviewers changed so far. */
|
|
34
|
+
listVersions(id: string): Promise<RecordDraftVersions>
|
|
35
|
+
/**
|
|
36
|
+
* Applies the draft as the caller. No `items` = its items as they stand;
|
|
37
|
+
* `items` = the reviewer's edit, saved first. Always 200 with the draft: `status` is
|
|
27
38
|
* `approved` / `approved_with_changes` when every item succeeded, else still
|
|
28
39
|
* `proposed` with per-item `results` to fix and re-approve. 409
|
|
29
40
|
* `record_draft_not_proposed` once resolved.
|
|
@@ -55,6 +66,21 @@ export class RecordDraftServiceImpl implements RecordDraftService {
|
|
|
55
66
|
return this.client.request<RecordDraft>('POST', RECORD_DRAFTS_BASE_PATH, request)
|
|
56
67
|
}
|
|
57
68
|
|
|
69
|
+
async update(id: string, request: UpdateRecordDraftRequest): Promise<RecordDraft> {
|
|
70
|
+
return this.client.request<RecordDraft>(
|
|
71
|
+
'PUT',
|
|
72
|
+
`${RECORD_DRAFTS_BASE_PATH}/${encodeURIComponent(id)}`,
|
|
73
|
+
request,
|
|
74
|
+
)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async listVersions(id: string): Promise<RecordDraftVersions> {
|
|
78
|
+
return this.client.request<RecordDraftVersions>(
|
|
79
|
+
'GET',
|
|
80
|
+
`${RECORD_DRAFTS_BASE_PATH}/${encodeURIComponent(id)}/versions`,
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
58
84
|
async approve(id: string, request: ApproveRecordDraftRequest = {}): Promise<RecordDraft> {
|
|
59
85
|
return this.client.request<RecordDraft>(
|
|
60
86
|
'POST',
|
package/src/data/types.ts
CHANGED
|
@@ -192,9 +192,12 @@ export type RecordDraftChangeKind =
|
|
|
192
192
|
| 'attribute_changed'
|
|
193
193
|
| 'attribute_removed'
|
|
194
194
|
| 'attribute_added'
|
|
195
|
+
/** The reviewer added a whole item (a row); `applied` carries its data. */
|
|
196
|
+
| 'item_added'
|
|
195
197
|
|
|
196
198
|
/**
|
|
197
|
-
* One entry of the reviewer's delta, diffed against the
|
|
199
|
+
* One entry of the reviewer's delta, diffed against the proposer's LATEST
|
|
200
|
+
* version (the proposal, or the proposer's last revision of it).
|
|
198
201
|
* `proposed` and `applied` are always present — `null` means "cleared".
|
|
199
202
|
* `current` is the record's value BEFORE the write, captured for existing
|
|
200
203
|
* targets (`has_current` says whether it was); it is STORED for the proposer
|
|
@@ -214,8 +217,10 @@ export interface RecordDraftChange {
|
|
|
214
217
|
|
|
215
218
|
/**
|
|
216
219
|
* A PROPOSED record write awaiting a verdict — the record sibling of a draft
|
|
217
|
-
* message. `items` is the
|
|
218
|
-
*
|
|
220
|
+
* message. `items` is the draft as it stands now: the proposal, as revised by
|
|
221
|
+
* its proposer and edited by reviewers while proposed (each save is a
|
|
222
|
+
* {@link RecordDraftVersion}; `version` is the newest one's number);
|
|
223
|
+
* `applied_items` what the last approve attempt sent; `results` the latest outcome per transaction_id (a
|
|
219
224
|
* re-approve after a partial failure re-sends only the items that have not
|
|
220
225
|
* succeeded); `changes` the reviewer's delta. `source` is caller-supplied
|
|
221
226
|
* provenance (`agent_key`, `session_id`, …); `created_by` is the acting user.
|
|
@@ -228,6 +233,7 @@ export interface RecordDraft {
|
|
|
228
233
|
status: RecordDraftStatus
|
|
229
234
|
summary: string
|
|
230
235
|
items: RecordDraftItem[]
|
|
236
|
+
version: number
|
|
231
237
|
applied_items?: RecordDraftItem[]
|
|
232
238
|
results?: RecordDraftItemResult[]
|
|
233
239
|
changes?: RecordDraftChange[]
|
|
@@ -239,6 +245,9 @@ export interface RecordDraft {
|
|
|
239
245
|
created_by: { type: string; id: string }
|
|
240
246
|
updated_at: string
|
|
241
247
|
updated_by: { type: string; id: string }
|
|
248
|
+
/** Set while an approve is writing the draft's records: saves, rejects and
|
|
249
|
+
* other approves get 409 `record_draft_applying` until it is done. */
|
|
250
|
+
applying_since?: string
|
|
242
251
|
}
|
|
243
252
|
|
|
244
253
|
export interface CreateRecordDraftRequest {
|
|
@@ -251,11 +260,66 @@ export interface CreateRecordDraftRequest {
|
|
|
251
260
|
source?: Record<string, unknown>
|
|
252
261
|
}
|
|
253
262
|
|
|
254
|
-
/**
|
|
255
|
-
*
|
|
256
|
-
|
|
263
|
+
/** An item as a save or an approve sends it: an existing item keeps its
|
|
264
|
+
* `transaction_id`; an added one leaves it out and the server assigns one. */
|
|
265
|
+
export type RecordDraftItemInput = Omit<RecordDraftItem, 'transaction_id'> & {
|
|
266
|
+
transaction_id?: string
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** `items` absent = apply the draft's items as they stand; present = save them
|
|
270
|
+
* first as the reviewer's edit, then apply them. */
|
|
257
271
|
export interface ApproveRecordDraftRequest {
|
|
258
|
-
items?:
|
|
272
|
+
items?: RecordDraftItemInput[]
|
|
273
|
+
/** The `updated_at` the reviewer last saw: a draft that moved on since fails
|
|
274
|
+
* with 409 `record_draft_conflict` instead of applying what they never saw. */
|
|
275
|
+
expected_updated_at?: string
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* How a version of a draft came to be: `proposed` (version 1), `revised` (the
|
|
280
|
+
* proposer changed its proposal — it becomes the baseline reviewer changes
|
|
281
|
+
* are measured against) or `edited` (a reviewer's edit; one reviewer's
|
|
282
|
+
* consecutive saves update one version).
|
|
283
|
+
*/
|
|
284
|
+
export type RecordDraftVersionKind = 'proposed' | 'revised' | 'edited'
|
|
285
|
+
|
|
286
|
+
/** One step of a draft's history: its complete items as they stood after it. */
|
|
287
|
+
export interface RecordDraftVersion {
|
|
288
|
+
id: string
|
|
289
|
+
org_id: string
|
|
290
|
+
record_draft_id: string
|
|
291
|
+
version: number
|
|
292
|
+
kind: RecordDraftVersionKind
|
|
293
|
+
summary: string
|
|
294
|
+
items: RecordDraftItem[]
|
|
295
|
+
created_at: string
|
|
296
|
+
created_by: { type: string; id: string }
|
|
297
|
+
updated_at: string
|
|
298
|
+
updated_by: { type: string; id: string }
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Saves a PROPOSED draft's items — the complete set: an item left out is
|
|
303
|
+
* dropped, an item without `transaction_id` is added (the server gives it a
|
|
304
|
+
* fresh one). An existing item keeps its record `id`; an item an earlier
|
|
305
|
+
* approve already wrote must stay exactly as applied. Nothing is written to
|
|
306
|
+
* the records.
|
|
307
|
+
*/
|
|
308
|
+
export interface UpdateRecordDraftRequest {
|
|
309
|
+
items: RecordDraftItemInput[]
|
|
310
|
+
/** Absent keeps the summary. */
|
|
311
|
+
summary?: string
|
|
312
|
+
/** `revised` = the proposer; `edited` = a reviewer. */
|
|
313
|
+
kind: Exclude<RecordDraftVersionKind, 'proposed'>
|
|
314
|
+
/** The `updated_at` the editor last saw: a draft that moved on since fails
|
|
315
|
+
* with 409 `record_draft_conflict`. Omit for last write wins. */
|
|
316
|
+
expected_updated_at?: string
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/** A draft's history (oldest first) and what reviewers changed so far. */
|
|
320
|
+
export interface RecordDraftVersions {
|
|
321
|
+
data: RecordDraftVersion[]
|
|
322
|
+
changes: RecordDraftChange[]
|
|
259
323
|
}
|
|
260
324
|
|
|
261
325
|
export interface RejectRecordDraftRequest {
|
|
@@ -295,7 +359,13 @@ export const RecordDraftItemResultSchema = z.object({
|
|
|
295
359
|
|
|
296
360
|
export const RecordDraftChangeSchema = z.object({
|
|
297
361
|
transaction_id: z.string(),
|
|
298
|
-
kind: z.enum([
|
|
362
|
+
kind: z.enum([
|
|
363
|
+
'item_dropped',
|
|
364
|
+
'attribute_changed',
|
|
365
|
+
'attribute_removed',
|
|
366
|
+
'attribute_added',
|
|
367
|
+
'item_added',
|
|
368
|
+
]),
|
|
299
369
|
attribute: z.string().optional(),
|
|
300
370
|
has_current: z.boolean(),
|
|
301
371
|
current: z.unknown(),
|
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
|
@@ -581,16 +581,21 @@ export type {
|
|
|
581
581
|
RecordDraftIntent,
|
|
582
582
|
RecordDraftItem,
|
|
583
583
|
RecordDraftItemError,
|
|
584
|
+
RecordDraftItemInput,
|
|
584
585
|
RecordDraftItemResult,
|
|
585
586
|
RecordDraftItemResultStatus,
|
|
586
587
|
RecordDraftService,
|
|
587
588
|
RecordDraftStatus,
|
|
589
|
+
RecordDraftVersion,
|
|
590
|
+
RecordDraftVersionKind,
|
|
591
|
+
RecordDraftVersions,
|
|
588
592
|
RecordDuplicate,
|
|
589
593
|
RecordDuplicateService,
|
|
590
594
|
RecordDuplicateSource,
|
|
591
595
|
RecordDuplicateStatus,
|
|
592
596
|
RecordService,
|
|
593
597
|
RejectRecordDraftRequest,
|
|
598
|
+
UpdateRecordDraftRequest,
|
|
594
599
|
} from './data/index.js'
|
|
595
600
|
// Data client (data-service)
|
|
596
601
|
export {
|
|
@@ -608,15 +613,23 @@ export {
|
|
|
608
613
|
export type {
|
|
609
614
|
CreateDiscoveryEvidenceFrameRequest,
|
|
610
615
|
CreateDiscoveryEvidenceLinkRequest,
|
|
616
|
+
CreateDiscoveryEvidenceNarrationFrameRequest,
|
|
617
|
+
CreateDiscoveryEvidenceNarrationRequest,
|
|
611
618
|
CreateDiscoveryEvidenceRequest,
|
|
612
619
|
CreateDiscoveryEvidenceStrokeRequest,
|
|
613
620
|
DiscoveryEvidence,
|
|
614
621
|
DiscoveryEvidenceCategory,
|
|
615
622
|
DiscoveryEvidenceContext,
|
|
616
623
|
DiscoveryEvidenceDownloadUrl,
|
|
624
|
+
DiscoveryEvidenceEnrichmentStatus,
|
|
625
|
+
DiscoveryEvidenceFieldSource,
|
|
617
626
|
DiscoveryEvidenceFrame,
|
|
618
627
|
DiscoveryEvidenceKind,
|
|
619
628
|
DiscoveryEvidenceLink,
|
|
629
|
+
DiscoveryEvidenceNarration,
|
|
630
|
+
DiscoveryEvidenceNarrationFrameComment,
|
|
631
|
+
DiscoveryEvidenceNarrationService,
|
|
632
|
+
DiscoveryEvidenceNarrationStatus,
|
|
620
633
|
DiscoveryEvidenceOrgSummary,
|
|
621
634
|
DiscoveryEvidenceService,
|
|
622
635
|
DiscoveryEvidenceSource,
|