@proteos/sdk 0.89.0 → 0.91.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 +160 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +470 -24
- package/dist/index.d.ts +470 -24
- package/dist/index.js +160 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/agent/index.ts +3 -0
- package/src/agent/model-types.ts +2 -0
- package/src/agent/session-types.ts +88 -8
- package/src/agent/sessions.ts +51 -0
- package/src/agent/types.ts +14 -0
- package/src/auth/platform-entities.ts +6 -0
- package/src/connector/index.ts +2 -0
- package/src/connector/types.ts +2 -0
- package/src/discovery/index.ts +183 -0
- package/src/discovery/types.ts +264 -0
- package/src/functions/actions.ts +5 -1
- package/src/index.ts +40 -0
- package/src/knowledge/index.ts +13 -1
- package/src/knowledge/types.ts +47 -3
- package/src/knowledge/whiteboard-templates.ts +85 -0
- package/src/types/options.ts +11 -0
package/src/discovery/types.ts
CHANGED
|
@@ -280,3 +280,267 @@ export interface ListResponse<T> {
|
|
|
280
280
|
meta: ResponseMeta
|
|
281
281
|
data: T[]
|
|
282
282
|
}
|
|
283
|
+
|
|
284
|
+
/* -------------------------------------------------------------------------
|
|
285
|
+
Discovery interviews: an interview definition is the guide an admin writes
|
|
286
|
+
(what to find out, the questions, who conducts it); a discovery interview
|
|
287
|
+
is one person's interview against it, from invitation to result.
|
|
288
|
+
Mirror of packages/go/model/discovery.
|
|
289
|
+
------------------------------------------------------------------------- */
|
|
290
|
+
|
|
291
|
+
export type DiscoveryInterviewDefinitionStatus = 'draft' | 'published' | 'closed'
|
|
292
|
+
/** `invited`: only the people assigned; `organization`: anyone signed in to the org. */
|
|
293
|
+
export type DiscoveryInterviewAccess = 'invited' | 'organization'
|
|
294
|
+
/** How far the agent follows up on a question: not at all, once, up to three times. */
|
|
295
|
+
export type DiscoveryInterviewProbing = 'none' | 'light' | 'deep'
|
|
296
|
+
export type DiscoveryInterviewStatus = 'invited' | 'in_progress' | 'completed' | 'cancelled'
|
|
297
|
+
/** `''` until the participant chose one at start. */
|
|
298
|
+
export type DiscoveryInterviewMode = '' | 'voice' | 'chat'
|
|
299
|
+
/** `''` until the interview is completed. */
|
|
300
|
+
export type DiscoveryInterviewSynthesisStatus = '' | 'pending' | 'completed' | 'failed'
|
|
301
|
+
export type DiscoveryInterviewCoverage = 'covered' | 'partial' | 'not_covered'
|
|
302
|
+
export type DiscoveryInterviewSpeaker = 'interviewer' | 'participant'
|
|
303
|
+
export type DiscoveryInterviewGuideRule =
|
|
304
|
+
| 'double_barreled'
|
|
305
|
+
| 'leading'
|
|
306
|
+
| 'hypothetical'
|
|
307
|
+
| 'closed'
|
|
308
|
+
| 'too_long'
|
|
309
|
+
| 'too_many_questions'
|
|
310
|
+
| 'long_interview'
|
|
311
|
+
export type DiscoveryInterviewBlockedReason =
|
|
312
|
+
| ''
|
|
313
|
+
| 'not_invited'
|
|
314
|
+
| 'not_published'
|
|
315
|
+
| 'closed'
|
|
316
|
+
| 'completed'
|
|
317
|
+
|
|
318
|
+
export interface DiscoveryInterviewQuestion {
|
|
319
|
+
id: string
|
|
320
|
+
position: number
|
|
321
|
+
text: string
|
|
322
|
+
/** What the answer should tell us. For the agent only. */
|
|
323
|
+
intent: string
|
|
324
|
+
/** What to dig into when following up. For the agent only. */
|
|
325
|
+
follow_up_guidance: string
|
|
326
|
+
probing: DiscoveryInterviewProbing
|
|
327
|
+
/** The agent may skip a question that is not required when time runs out. */
|
|
328
|
+
is_required: boolean
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/** A hint on the guide, derived on read. `question_id` is `''` for the guide as a whole. */
|
|
332
|
+
export interface DiscoveryInterviewGuideFinding {
|
|
333
|
+
question_id: string
|
|
334
|
+
rule: DiscoveryInterviewGuideRule
|
|
335
|
+
message: string
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
export interface DiscoveryInterviewCounts {
|
|
339
|
+
invited: number
|
|
340
|
+
in_progress: number
|
|
341
|
+
completed: number
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export interface DiscoveryInterviewDefinition {
|
|
345
|
+
id: string
|
|
346
|
+
org_id: string
|
|
347
|
+
title: string
|
|
348
|
+
/** For the participant: what to expect. */
|
|
349
|
+
description: string
|
|
350
|
+
expected_duration_minutes: number
|
|
351
|
+
/** For the agent: what we want to find out. */
|
|
352
|
+
objective: string
|
|
353
|
+
/** For the agent: context, terms, who the participants are. */
|
|
354
|
+
background: string
|
|
355
|
+
questions: DiscoveryInterviewQuestion[]
|
|
356
|
+
agent_key: string
|
|
357
|
+
agent_name: string
|
|
358
|
+
agent_runtime: string
|
|
359
|
+
/** `''` follows the participant's language. */
|
|
360
|
+
language: string
|
|
361
|
+
access: DiscoveryInterviewAccess
|
|
362
|
+
/** Knowledge space the result nodes go to; `''` writes no node. */
|
|
363
|
+
space_slug: string
|
|
364
|
+
status: DiscoveryInterviewDefinitionStatus
|
|
365
|
+
published_at?: string | null
|
|
366
|
+
closed_at?: string | null
|
|
367
|
+
interview_counts: DiscoveryInterviewCounts
|
|
368
|
+
/** Detail read only. */
|
|
369
|
+
guide_findings?: DiscoveryInterviewGuideFinding[]
|
|
370
|
+
created_at: string
|
|
371
|
+
created_by: UserRef
|
|
372
|
+
updated_at: string
|
|
373
|
+
updated_by: UserRef
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/** A question as it is sent: without an id it is new, the array order is the position. */
|
|
377
|
+
export interface DiscoveryInterviewQuestionRequest {
|
|
378
|
+
id?: string
|
|
379
|
+
text: string
|
|
380
|
+
intent?: string
|
|
381
|
+
follow_up_guidance?: string
|
|
382
|
+
probing?: DiscoveryInterviewProbing
|
|
383
|
+
is_required?: boolean
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export interface CreateDiscoveryInterviewDefinitionRequest {
|
|
387
|
+
title: string
|
|
388
|
+
description?: string
|
|
389
|
+
expected_duration_minutes?: number
|
|
390
|
+
objective?: string
|
|
391
|
+
background?: string
|
|
392
|
+
questions?: DiscoveryInterviewQuestionRequest[]
|
|
393
|
+
agent_key?: string
|
|
394
|
+
language?: string
|
|
395
|
+
access?: DiscoveryInterviewAccess
|
|
396
|
+
space_slug?: string
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
/**
|
|
400
|
+
* Partial edit. `questions` replaces the list. Questions, objective,
|
|
401
|
+
* background, agent and language can only change while the definition is a
|
|
402
|
+
* draft.
|
|
403
|
+
*/
|
|
404
|
+
export type UpdateDiscoveryInterviewDefinitionRequest =
|
|
405
|
+
Partial<CreateDiscoveryInterviewDefinitionRequest>
|
|
406
|
+
|
|
407
|
+
export interface ListDiscoveryInterviewDefinitionsQuery {
|
|
408
|
+
status?: DiscoveryInterviewDefinitionStatus
|
|
409
|
+
page?: number
|
|
410
|
+
page_size?: number
|
|
411
|
+
sort_by?: string
|
|
412
|
+
sort_direction?: 'asc' | 'desc'
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export interface DiscoveryInterviewAnswer {
|
|
416
|
+
question_id: string
|
|
417
|
+
coverage: DiscoveryInterviewCoverage
|
|
418
|
+
answer: string
|
|
419
|
+
/** The participant's own words. */
|
|
420
|
+
quotes: string[]
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
export interface DiscoveryInterviewRecording {
|
|
424
|
+
voice_session_id: string
|
|
425
|
+
file_id: string
|
|
426
|
+
mime_type: string
|
|
427
|
+
duration_ms: number
|
|
428
|
+
size_bytes: number
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
export interface DiscoveryInterviewTranscriptTurn {
|
|
432
|
+
speaker: DiscoveryInterviewSpeaker
|
|
433
|
+
text: string
|
|
434
|
+
at: string
|
|
435
|
+
/** Voice only; 0 in a chat interview. */
|
|
436
|
+
start_ms: number
|
|
437
|
+
end_ms: number
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/** The guide as it was when the interview started. */
|
|
441
|
+
export interface DiscoveryInterviewGuide {
|
|
442
|
+
title: string
|
|
443
|
+
objective: string
|
|
444
|
+
background: string
|
|
445
|
+
expected_duration_minutes: number
|
|
446
|
+
language: string
|
|
447
|
+
questions: DiscoveryInterviewQuestion[]
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
export interface DiscoveryInterview {
|
|
451
|
+
id: string
|
|
452
|
+
org_id: string
|
|
453
|
+
definition_id: string
|
|
454
|
+
participant: UserRef
|
|
455
|
+
participant_name: string
|
|
456
|
+
status: DiscoveryInterviewStatus
|
|
457
|
+
mode: DiscoveryInterviewMode
|
|
458
|
+
/** The author's own trial run; kept out of results. */
|
|
459
|
+
is_preview: boolean
|
|
460
|
+
session_id: string
|
|
461
|
+
agent_key: string
|
|
462
|
+
consented_at?: string | null
|
|
463
|
+
started_at?: string | null
|
|
464
|
+
completed_at?: string | null
|
|
465
|
+
duration_seconds: number
|
|
466
|
+
synthesis_status: DiscoveryInterviewSynthesisStatus
|
|
467
|
+
summary: string
|
|
468
|
+
learnings: string[]
|
|
469
|
+
open_questions: string[]
|
|
470
|
+
answers: DiscoveryInterviewAnswer[]
|
|
471
|
+
knowledge_node_id: string
|
|
472
|
+
recordings: DiscoveryInterviewRecording[]
|
|
473
|
+
invited_at?: string | null
|
|
474
|
+
invited_by?: UserRef | null
|
|
475
|
+
created_at: string
|
|
476
|
+
updated_at: string
|
|
477
|
+
/** Detail read only. */
|
|
478
|
+
guide?: DiscoveryInterviewGuide
|
|
479
|
+
/** Detail read only. */
|
|
480
|
+
transcript?: DiscoveryInterviewTranscriptTurn[]
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export interface InviteDiscoveryInterviewParticipantsRequest {
|
|
484
|
+
user_ids: string[]
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
export interface ListDiscoveryInterviewsQuery {
|
|
488
|
+
definition_id: string
|
|
489
|
+
status?: DiscoveryInterviewStatus
|
|
490
|
+
is_preview?: boolean
|
|
491
|
+
page?: number
|
|
492
|
+
page_size?: number
|
|
493
|
+
sort_by?: string
|
|
494
|
+
sort_direction?: 'asc' | 'desc'
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
/** What the participant's page may know of the definition: never the guide. */
|
|
498
|
+
export interface DiscoveryInterviewParticipationDefinition {
|
|
499
|
+
id: string
|
|
500
|
+
title: string
|
|
501
|
+
description: string
|
|
502
|
+
expected_duration_minutes: number
|
|
503
|
+
status: DiscoveryInterviewDefinitionStatus
|
|
504
|
+
access: DiscoveryInterviewAccess
|
|
505
|
+
agent_key: string
|
|
506
|
+
agent_name: string
|
|
507
|
+
agent_runtime: string
|
|
508
|
+
question_count: number
|
|
509
|
+
requested_by: UserRef
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
/** The caller's own interview, as their page sees it. */
|
|
513
|
+
export interface DiscoveryInterviewParticipationInterview {
|
|
514
|
+
id: string
|
|
515
|
+
status: DiscoveryInterviewStatus
|
|
516
|
+
mode: DiscoveryInterviewMode
|
|
517
|
+
is_preview: boolean
|
|
518
|
+
session_id: string
|
|
519
|
+
agent_key: string
|
|
520
|
+
started_at?: string | null
|
|
521
|
+
completed_at?: string | null
|
|
522
|
+
synthesis_status: DiscoveryInterviewSynthesisStatus
|
|
523
|
+
summary: string
|
|
524
|
+
learnings: string[]
|
|
525
|
+
/**
|
|
526
|
+
* The interview guide as the session's agent is given it: the model-only
|
|
527
|
+
* context of the first message the agent reads. Only the answer of a start
|
|
528
|
+
* carries it. The page sends it with the first spoken request or typed
|
|
529
|
+
* message when the session's log does not hold it yet (an interview that
|
|
530
|
+
* started by voice).
|
|
531
|
+
*/
|
|
532
|
+
guide_context?: string
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
export interface DiscoveryInterviewParticipation {
|
|
536
|
+
definition: DiscoveryInterviewParticipationDefinition
|
|
537
|
+
can_participate: boolean
|
|
538
|
+
blocked_reason: DiscoveryInterviewBlockedReason
|
|
539
|
+
interview: DiscoveryInterviewParticipationInterview | null
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
export interface StartDiscoveryInterviewParticipationRequest {
|
|
543
|
+
mode: 'voice' | 'chat'
|
|
544
|
+
has_consented: boolean
|
|
545
|
+
is_preview?: boolean
|
|
546
|
+
}
|
package/src/functions/actions.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ProteosClient } from '../client.js'
|
|
2
2
|
import { PageIterator } from '../iterator.js'
|
|
3
3
|
import type { ListResult } from '../types/common.js'
|
|
4
|
+
import { BATCH_INVOKE_TIMEOUT_MS, INVOKE_TIMEOUT_MS } from '../types/options.js'
|
|
4
5
|
import type { Action, InvokeActionResponse, ListActionsOptions } from './types.js'
|
|
5
6
|
|
|
6
7
|
const ACTIONS_BASE_PATH = '/functions/v1/actions'
|
|
@@ -99,6 +100,7 @@ export class ActionServiceImpl implements ActionService {
|
|
|
99
100
|
'POST',
|
|
100
101
|
`${ACTIONS_BASE_PATH}/${slug}/invoke`,
|
|
101
102
|
params,
|
|
103
|
+
{ timeout: INVOKE_TIMEOUT_MS },
|
|
102
104
|
)
|
|
103
105
|
return response.result
|
|
104
106
|
}
|
|
@@ -112,7 +114,7 @@ export class ActionServiceImpl implements ActionService {
|
|
|
112
114
|
'POST',
|
|
113
115
|
`/functions/v1/public/orgs/${encodeURIComponent(orgId)}/actions/${encodeURIComponent(slug)}/invoke`,
|
|
114
116
|
params,
|
|
115
|
-
{ skipAuth: true },
|
|
117
|
+
{ skipAuth: true, timeout: INVOKE_TIMEOUT_MS },
|
|
116
118
|
)
|
|
117
119
|
return response.result
|
|
118
120
|
}
|
|
@@ -127,6 +129,7 @@ export class ActionServiceImpl implements ActionService {
|
|
|
127
129
|
'POST',
|
|
128
130
|
`/functions/v1/entities/${entitySlug}/records/${recordId}/actions/${slug}/invoke`,
|
|
129
131
|
params,
|
|
132
|
+
{ timeout: INVOKE_TIMEOUT_MS },
|
|
130
133
|
)
|
|
131
134
|
return response.result
|
|
132
135
|
}
|
|
@@ -143,6 +146,7 @@ export class ActionServiceImpl implements ActionService {
|
|
|
143
146
|
'POST',
|
|
144
147
|
`/functions/v1/entities/${entitySlug}/actions/${slug}/invoke`,
|
|
145
148
|
{ record_ids: recordIds, params },
|
|
149
|
+
{ timeout: BATCH_INVOKE_TIMEOUT_MS },
|
|
146
150
|
)
|
|
147
151
|
return response.result
|
|
148
152
|
}
|
package/src/index.ts
CHANGED
|
@@ -43,6 +43,7 @@ export type {
|
|
|
43
43
|
AgentResourceListOptions,
|
|
44
44
|
AgentRuntime,
|
|
45
45
|
AgentService,
|
|
46
|
+
AgentVoiceStyle,
|
|
46
47
|
AppendEventRequest,
|
|
47
48
|
AppendSpeechRequest,
|
|
48
49
|
AwaitingToolUse,
|
|
@@ -155,6 +156,8 @@ export type {
|
|
|
155
156
|
ToolUseDeltaPayload,
|
|
156
157
|
ToolUsePayload,
|
|
157
158
|
ToolUseStartPayload,
|
|
159
|
+
TransferVoiceRequest,
|
|
160
|
+
TransferVoiceResponse,
|
|
158
161
|
Turn,
|
|
159
162
|
UpdateAgentRequest,
|
|
160
163
|
UpdateMcpServerRequest,
|
|
@@ -662,6 +665,7 @@ export type {
|
|
|
662
665
|
CreateDiscoveryEvidenceNarrationRequest,
|
|
663
666
|
CreateDiscoveryEvidenceRequest,
|
|
664
667
|
CreateDiscoveryEvidenceStrokeRequest,
|
|
668
|
+
CreateDiscoveryInterviewDefinitionRequest,
|
|
665
669
|
DiscoveryEvidence,
|
|
666
670
|
DiscoveryEvidenceCategory,
|
|
667
671
|
DiscoveryEvidenceContext,
|
|
@@ -679,14 +683,44 @@ export type {
|
|
|
679
683
|
DiscoveryEvidenceService,
|
|
680
684
|
DiscoveryEvidenceSource,
|
|
681
685
|
DiscoveryEvidenceStatus,
|
|
686
|
+
DiscoveryInterview,
|
|
687
|
+
DiscoveryInterviewAccess,
|
|
688
|
+
DiscoveryInterviewAnswer,
|
|
689
|
+
DiscoveryInterviewBlockedReason,
|
|
690
|
+
DiscoveryInterviewCounts,
|
|
691
|
+
DiscoveryInterviewCoverage,
|
|
692
|
+
DiscoveryInterviewDefinition,
|
|
693
|
+
DiscoveryInterviewDefinitionService,
|
|
694
|
+
DiscoveryInterviewDefinitionStatus,
|
|
695
|
+
DiscoveryInterviewGuide,
|
|
696
|
+
DiscoveryInterviewGuideFinding,
|
|
697
|
+
DiscoveryInterviewGuideRule,
|
|
698
|
+
DiscoveryInterviewMode,
|
|
699
|
+
DiscoveryInterviewParticipation,
|
|
700
|
+
DiscoveryInterviewParticipationDefinition,
|
|
701
|
+
DiscoveryInterviewParticipationInterview,
|
|
702
|
+
DiscoveryInterviewProbing,
|
|
703
|
+
DiscoveryInterviewQuestion,
|
|
704
|
+
DiscoveryInterviewQuestionRequest,
|
|
705
|
+
DiscoveryInterviewRecording,
|
|
706
|
+
DiscoveryInterviewService,
|
|
707
|
+
DiscoveryInterviewSpeaker,
|
|
708
|
+
DiscoveryInterviewStatus,
|
|
709
|
+
DiscoveryInterviewSynthesisStatus,
|
|
710
|
+
DiscoveryInterviewTranscriptTurn,
|
|
682
711
|
InkPoint,
|
|
683
712
|
InkStroke,
|
|
713
|
+
InviteDiscoveryInterviewParticipantsRequest,
|
|
684
714
|
ListDiscoveryEvidenceQuery,
|
|
715
|
+
ListDiscoveryInterviewDefinitionsQuery,
|
|
716
|
+
ListDiscoveryInterviewsQuery,
|
|
685
717
|
ListPlatformDiscoveryEvidenceQuery,
|
|
686
718
|
PlatformDiscoveryEvidenceService,
|
|
719
|
+
StartDiscoveryInterviewParticipationRequest,
|
|
687
720
|
UpdateDiscoveryEvidenceFrameRequest,
|
|
688
721
|
UpdateDiscoveryEvidenceRequest,
|
|
689
722
|
UpdateDiscoveryEvidenceStatusRequest,
|
|
723
|
+
UpdateDiscoveryInterviewDefinitionRequest,
|
|
690
724
|
} from './discovery/index.js'
|
|
691
725
|
export { DiscoveryClient } from './discovery/index.js'
|
|
692
726
|
export type { ApiErrorResponse, ErrorCodeType } from './errors.js'
|
|
@@ -740,6 +774,7 @@ export type {
|
|
|
740
774
|
CreateNodeRequest,
|
|
741
775
|
CreateRecordLinkRequest,
|
|
742
776
|
CreateSpaceRequest,
|
|
777
|
+
CreateWhiteboardTemplateRequest,
|
|
743
778
|
EditContentRequest,
|
|
744
779
|
EditContentResponse,
|
|
745
780
|
GetGraphOptions,
|
|
@@ -764,6 +799,7 @@ export type {
|
|
|
764
799
|
ListNodesOptions,
|
|
765
800
|
ListRecordLinksOptions,
|
|
766
801
|
ListSpacesOptions,
|
|
802
|
+
ListWhiteboardTemplatesOptions,
|
|
767
803
|
MatchMode,
|
|
768
804
|
NeighborDirection,
|
|
769
805
|
NeighborEdge,
|
|
@@ -788,6 +824,10 @@ export type {
|
|
|
788
824
|
UpdateLinkRequest,
|
|
789
825
|
UpdateNodeRequest,
|
|
790
826
|
UpdateSpaceRequest,
|
|
827
|
+
UpdateWhiteboardTemplateRequest,
|
|
828
|
+
WhiteboardTemplate,
|
|
829
|
+
WhiteboardTemplateMetadata,
|
|
830
|
+
WhiteboardTemplateService,
|
|
791
831
|
WriteContentOptions,
|
|
792
832
|
WriteContentResponse,
|
|
793
833
|
} from './knowledge/index.js'
|
package/src/knowledge/index.ts
CHANGED
|
@@ -5,6 +5,10 @@ import { type LinkService, LinkServiceImpl } from './links.js'
|
|
|
5
5
|
import { type NodeService, NodeServiceImpl } from './nodes.js'
|
|
6
6
|
import { type RecordLinkService, RecordLinkServiceImpl } from './record-links.js'
|
|
7
7
|
import { type SpaceService, SpaceServiceImpl } from './spaces.js'
|
|
8
|
+
import {
|
|
9
|
+
type WhiteboardTemplateService,
|
|
10
|
+
WhiteboardTemplateServiceImpl,
|
|
11
|
+
} from './whiteboard-templates.js'
|
|
8
12
|
|
|
9
13
|
/**
|
|
10
14
|
* Facade for the knowledge-service (graph-native knowledge base: nodes, typed
|
|
@@ -31,6 +35,8 @@ export class KnowledgeClient {
|
|
|
31
35
|
readonly spaces: SpaceService
|
|
32
36
|
/** Whole-org graph bulk read (radiant graph view): `knowledge.graph.get()`. */
|
|
33
37
|
readonly graph: GraphService
|
|
38
|
+
/** Org-wide whiteboard templates: `knowledge.whiteboardTemplates`. */
|
|
39
|
+
readonly whiteboardTemplates: WhiteboardTemplateService
|
|
34
40
|
|
|
35
41
|
constructor(client: ProteosClient) {
|
|
36
42
|
this.nodes = new NodeServiceImpl(client)
|
|
@@ -39,6 +45,7 @@ export class KnowledgeClient {
|
|
|
39
45
|
this.labels = new LabelServiceImpl(client)
|
|
40
46
|
this.spaces = new SpaceServiceImpl(client)
|
|
41
47
|
this.graph = new GraphServiceImpl(client)
|
|
48
|
+
this.whiteboardTemplates = new WhiteboardTemplateServiceImpl(client)
|
|
42
49
|
}
|
|
43
50
|
}
|
|
44
51
|
|
|
@@ -49,7 +56,6 @@ export type { LinkService } from './links.js'
|
|
|
49
56
|
export type { NodeService } from './nodes.js'
|
|
50
57
|
export type { RecordLinkService } from './record-links.js'
|
|
51
58
|
export type { SpaceService } from './spaces.js'
|
|
52
|
-
|
|
53
59
|
// Re-export types
|
|
54
60
|
export type {
|
|
55
61
|
ContentMatch,
|
|
@@ -59,6 +65,7 @@ export type {
|
|
|
59
65
|
CreateNodeRequest,
|
|
60
66
|
CreateRecordLinkRequest,
|
|
61
67
|
CreateSpaceRequest,
|
|
68
|
+
CreateWhiteboardTemplateRequest,
|
|
62
69
|
EditContentRequest,
|
|
63
70
|
EditContentResponse,
|
|
64
71
|
GetGraphOptions,
|
|
@@ -80,6 +87,7 @@ export type {
|
|
|
80
87
|
ListNodesOptions,
|
|
81
88
|
ListRecordLinksOptions,
|
|
82
89
|
ListSpacesOptions,
|
|
90
|
+
ListWhiteboardTemplatesOptions,
|
|
83
91
|
MatchMode,
|
|
84
92
|
NeighborDirection,
|
|
85
93
|
NeighborEdge,
|
|
@@ -101,6 +109,9 @@ export type {
|
|
|
101
109
|
UpdateLinkRequest,
|
|
102
110
|
UpdateNodeRequest,
|
|
103
111
|
UpdateSpaceRequest,
|
|
112
|
+
UpdateWhiteboardTemplateRequest,
|
|
113
|
+
WhiteboardTemplate,
|
|
114
|
+
WhiteboardTemplateMetadata,
|
|
104
115
|
WriteContentOptions,
|
|
105
116
|
WriteContentResponse,
|
|
106
117
|
} from './types.js'
|
|
@@ -117,3 +128,4 @@ export {
|
|
|
117
128
|
NodeNeighborhoodSchema,
|
|
118
129
|
UNASSIGNED_SPACE_SLUG,
|
|
119
130
|
} from './types.js'
|
|
131
|
+
export type { WhiteboardTemplateService } from './whiteboard-templates.js'
|
package/src/knowledge/types.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
// ============================================================================
|
|
13
13
|
|
|
14
14
|
/** A node's kind. `markdown` is authored; `file`/`url` bodies are derived. */
|
|
15
|
-
export type NodeType = 'markdown' | 'file' | 'url'
|
|
15
|
+
export type NodeType = 'markdown' | 'file' | 'url' | 'whiteboard'
|
|
16
16
|
|
|
17
17
|
/** Lifecycle state of a node. */
|
|
18
18
|
export type NodeStatus = 'draft' | 'published' | 'archived'
|
|
@@ -584,6 +584,50 @@ export interface ListLabelsOptions extends ListOptions {
|
|
|
584
584
|
'name[contains]'?: string
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
+
// ============================================================================
|
|
588
|
+
// Whiteboard templates
|
|
589
|
+
// ============================================================================
|
|
590
|
+
|
|
591
|
+
/**
|
|
592
|
+
* A reusable piece of a whiteboard (a layout, a card, a notation shape),
|
|
593
|
+
* shared with the whole org. Lists return this; `get` adds the elements.
|
|
594
|
+
*/
|
|
595
|
+
export interface WhiteboardTemplateMetadata extends AuditFields {
|
|
596
|
+
id: string
|
|
597
|
+
org_id: string
|
|
598
|
+
name: string
|
|
599
|
+
description?: string | null
|
|
600
|
+
/** Groups templates in the Library sidebar, e.g. "BPMN". */
|
|
601
|
+
category?: string | null
|
|
602
|
+
element_count: number
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
/** A whiteboard template with its Excalidraw elements (unchecked JSON). */
|
|
606
|
+
export interface WhiteboardTemplate extends WhiteboardTemplateMetadata {
|
|
607
|
+
elements: unknown[]
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
export interface CreateWhiteboardTemplateRequest {
|
|
611
|
+
name: string
|
|
612
|
+
description?: string
|
|
613
|
+
category?: string
|
|
614
|
+
/** Excalidraw elements: at most 1,000, 2 MB, board element types only. */
|
|
615
|
+
elements: unknown[]
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
/** Only the fields present change; `elements` replaces the elements whole. */
|
|
619
|
+
export interface UpdateWhiteboardTemplateRequest {
|
|
620
|
+
name?: string
|
|
621
|
+
description?: string
|
|
622
|
+
category?: string
|
|
623
|
+
elements?: unknown[]
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
export interface ListWhiteboardTemplatesOptions extends ListOptions {
|
|
627
|
+
category?: string
|
|
628
|
+
'name[contains]'?: string
|
|
629
|
+
}
|
|
630
|
+
|
|
587
631
|
// ============================================================================
|
|
588
632
|
// Zod schemas (optional runtime validation for consumers who want it)
|
|
589
633
|
// ============================================================================
|
|
@@ -593,7 +637,7 @@ export const KnowledgeNodeMetadataSchema = z
|
|
|
593
637
|
id: z.string(),
|
|
594
638
|
org_id: z.string(),
|
|
595
639
|
title: z.string(),
|
|
596
|
-
type: z.enum(['markdown', 'file', 'url']),
|
|
640
|
+
type: z.enum(['markdown', 'file', 'url', 'whiteboard']),
|
|
597
641
|
status: z.enum(['draft', 'published', 'archived']),
|
|
598
642
|
embedding_model: z.string().nullish(),
|
|
599
643
|
embedded_at: z.string().nullish(),
|
|
@@ -669,7 +713,7 @@ export const NodeNeighborhoodSchema = z.object({
|
|
|
669
713
|
z.object({
|
|
670
714
|
id: z.string(),
|
|
671
715
|
title: z.string(),
|
|
672
|
-
type: z.enum(['markdown', 'file', 'url']),
|
|
716
|
+
type: z.enum(['markdown', 'file', 'url', 'whiteboard']),
|
|
673
717
|
status: z.enum(['draft', 'published', 'archived']),
|
|
674
718
|
distance: z.number(),
|
|
675
719
|
}),
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { ProteosClient } from '../client.js'
|
|
2
|
+
import { PageIterator } from '../iterator.js'
|
|
3
|
+
import type { ListResult } from '../types/common.js'
|
|
4
|
+
import type {
|
|
5
|
+
CreateWhiteboardTemplateRequest,
|
|
6
|
+
ListWhiteboardTemplatesOptions,
|
|
7
|
+
UpdateWhiteboardTemplateRequest,
|
|
8
|
+
WhiteboardTemplate,
|
|
9
|
+
WhiteboardTemplateMetadata,
|
|
10
|
+
} from './types.js'
|
|
11
|
+
|
|
12
|
+
const WHITEBOARD_TEMPLATES_BASE_PATH = '/knowledge/v1/whiteboard-templates'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Service for whiteboard templates: reusable pieces of a whiteboard, shared
|
|
16
|
+
* with the whole org. Everyone who may write knowledge adds templates; only a
|
|
17
|
+
* template's creator or an admin changes or deletes it. No versions: an
|
|
18
|
+
* update overwrites.
|
|
19
|
+
*/
|
|
20
|
+
export interface WhiteboardTemplateService {
|
|
21
|
+
/** Lists templates (metadata only) as an async iterator. */
|
|
22
|
+
list(
|
|
23
|
+
options?: ListWhiteboardTemplatesOptions,
|
|
24
|
+
): PageIterator<WhiteboardTemplateMetadata, ListWhiteboardTemplatesOptions>
|
|
25
|
+
|
|
26
|
+
/** Fetches a single page of templates (metadata only). */
|
|
27
|
+
listPage(
|
|
28
|
+
options?: ListWhiteboardTemplatesOptions,
|
|
29
|
+
): Promise<ListResult<WhiteboardTemplateMetadata>>
|
|
30
|
+
|
|
31
|
+
/** Gets a template with its elements. */
|
|
32
|
+
get(id: string): Promise<WhiteboardTemplate>
|
|
33
|
+
|
|
34
|
+
/** Adds a template. */
|
|
35
|
+
create(request: CreateWhiteboardTemplateRequest): Promise<WhiteboardTemplate>
|
|
36
|
+
|
|
37
|
+
/** Updates a template (its creator or an admin). */
|
|
38
|
+
update(id: string, request: UpdateWhiteboardTemplateRequest): Promise<WhiteboardTemplate>
|
|
39
|
+
|
|
40
|
+
/** Deletes a template (its creator or an admin). */
|
|
41
|
+
delete(id: string): Promise<void>
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Implementation of WhiteboardTemplateService.
|
|
46
|
+
*/
|
|
47
|
+
export class WhiteboardTemplateServiceImpl implements WhiteboardTemplateService {
|
|
48
|
+
constructor(private readonly client: ProteosClient) {}
|
|
49
|
+
|
|
50
|
+
list(
|
|
51
|
+
options: ListWhiteboardTemplatesOptions = {},
|
|
52
|
+
): PageIterator<WhiteboardTemplateMetadata, ListWhiteboardTemplatesOptions> {
|
|
53
|
+
return new PageIterator((opts) => this.listPage(opts), options)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async listPage(
|
|
57
|
+
options: ListWhiteboardTemplatesOptions = {},
|
|
58
|
+
): Promise<ListResult<WhiteboardTemplateMetadata>> {
|
|
59
|
+
return this.client.requestWithQuery<ListResult<WhiteboardTemplateMetadata>>(
|
|
60
|
+
'GET',
|
|
61
|
+
WHITEBOARD_TEMPLATES_BASE_PATH,
|
|
62
|
+
options,
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
async get(id: string): Promise<WhiteboardTemplate> {
|
|
67
|
+
return this.client.request<WhiteboardTemplate>('GET', `${WHITEBOARD_TEMPLATES_BASE_PATH}/${id}`)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
async create(request: CreateWhiteboardTemplateRequest): Promise<WhiteboardTemplate> {
|
|
71
|
+
return this.client.request<WhiteboardTemplate>('POST', WHITEBOARD_TEMPLATES_BASE_PATH, request)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
async update(id: string, request: UpdateWhiteboardTemplateRequest): Promise<WhiteboardTemplate> {
|
|
75
|
+
return this.client.request<WhiteboardTemplate>(
|
|
76
|
+
'PATCH',
|
|
77
|
+
`${WHITEBOARD_TEMPLATES_BASE_PATH}/${id}`,
|
|
78
|
+
request,
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async delete(id: string): Promise<void> {
|
|
83
|
+
await this.client.request<void>('DELETE', `${WHITEBOARD_TEMPLATES_BASE_PATH}/${id}`)
|
|
84
|
+
}
|
|
85
|
+
}
|
package/src/types/options.ts
CHANGED
|
@@ -68,6 +68,17 @@ export const DEFAULT_OPTIONS = {
|
|
|
68
68
|
headers: {},
|
|
69
69
|
} as const
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Request timeout for invoking an action or connector method. Function-service
|
|
73
|
+
* lets one invocation run for 60s and connector-service waits 70s for it, so
|
|
74
|
+
* the caller waits longer than both: the invocation's result, or its own
|
|
75
|
+
* timeout error, reaches the caller instead of a client-side abort.
|
|
76
|
+
*/
|
|
77
|
+
export const INVOKE_TIMEOUT_MS = 75_000
|
|
78
|
+
|
|
79
|
+
/** Request timeout for a batch action invocation (5 min server budget). */
|
|
80
|
+
export const BATCH_INVOKE_TIMEOUT_MS = 315_000
|
|
81
|
+
|
|
71
82
|
/**
|
|
72
83
|
* Resolves client options by applying defaults.
|
|
73
84
|
*/
|