@proteos/sdk 0.90.0 → 0.92.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.
@@ -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
+ }
@@ -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,
@@ -418,6 +421,7 @@ export type {
418
421
  CreateConversationTypeRequest,
419
422
  CreateEmailSignatureRequest,
420
423
  CreateGlossaryTermRequest,
424
+ CreateMessageTemplateRequest,
421
425
  CreateSendingRuleRequest,
422
426
  CreateToneProfileSetupRequest,
423
427
  CreateTranscriptionFromTextRequest,
@@ -476,6 +480,7 @@ export type {
476
480
  ListGlossaryTermsQuery,
477
481
  ListMeetingBotsQuery,
478
482
  ListMessagesQuery,
483
+ ListMessageTemplatesQuery,
479
484
  ListMistranscribedTermsQuery,
480
485
  // Conversation-local page envelope ({meta, data}) — distinct from the
481
486
  // PageIterator-based ListResult used by the other modules.
@@ -500,11 +505,15 @@ export type {
500
505
  MessageDraftVersion,
501
506
  MessageDraftVersionKind,
502
507
  MessageDraftVersions,
508
+ MessageLayout,
503
509
  MessagePreview,
504
510
  MessageRecipient,
505
511
  MessageService,
506
512
  MessageSignature,
507
513
  MessageStatus,
514
+ MessageTemplate,
515
+ MessageTemplateKind,
516
+ MessageTemplateService,
508
517
  MintCallTokenRequest,
509
518
  MistranscribedTerm,
510
519
  MistranscribedTermService,
@@ -524,6 +533,8 @@ export type {
524
533
  RecipientKind,
525
534
  RecipientRole,
526
535
  RecordPermissionEventRequest,
536
+ RenderedMessageTemplate,
537
+ RenderMessageTemplateRequest,
527
538
  ResolveEmailSignatureQuery,
528
539
  ResolveToneProfileQuery,
529
540
  RespondChannelActionRequest,
@@ -560,6 +571,7 @@ export type {
560
571
  TwilioPhoneVoicemailSettings,
561
572
  UnreadCounts,
562
573
  UnreadCountsQuery,
574
+ UnsubscribeChoice,
563
575
  UpdateAgentListenerRequest,
564
576
  UpdateConnectionRequest,
565
577
  UpdateContactGroupRequest,
@@ -576,6 +588,7 @@ export type {
576
588
  UpdateDraftRequest,
577
589
  UpdateEmailSignatureRequest,
578
590
  UpdateGlossaryTermRequest,
591
+ UpdateMessageTemplateRequest,
579
592
  UpdatePhoneNumberRequest,
580
593
  UpdateSendingRuleRequest,
581
594
  UpsertToneProfileRequest,
@@ -587,7 +600,7 @@ export type {
587
600
  WindowRuleConfig,
588
601
  } from './conversation/index.js'
589
602
  // Conversation client (conversation-service)
590
- export { ConversationClient } from './conversation/index.js'
603
+ export { ConversationClient, UNSUBSCRIBE_URL_PLACEHOLDER } from './conversation/index.js'
591
604
  export type {
592
605
  ApproveRecordDraftRequest,
593
606
  BatchTransactionError,
@@ -662,6 +675,7 @@ export type {
662
675
  CreateDiscoveryEvidenceNarrationRequest,
663
676
  CreateDiscoveryEvidenceRequest,
664
677
  CreateDiscoveryEvidenceStrokeRequest,
678
+ CreateDiscoveryInterviewDefinitionRequest,
665
679
  DiscoveryEvidence,
666
680
  DiscoveryEvidenceCategory,
667
681
  DiscoveryEvidenceContext,
@@ -679,14 +693,44 @@ export type {
679
693
  DiscoveryEvidenceService,
680
694
  DiscoveryEvidenceSource,
681
695
  DiscoveryEvidenceStatus,
696
+ DiscoveryInterview,
697
+ DiscoveryInterviewAccess,
698
+ DiscoveryInterviewAnswer,
699
+ DiscoveryInterviewBlockedReason,
700
+ DiscoveryInterviewCounts,
701
+ DiscoveryInterviewCoverage,
702
+ DiscoveryInterviewDefinition,
703
+ DiscoveryInterviewDefinitionService,
704
+ DiscoveryInterviewDefinitionStatus,
705
+ DiscoveryInterviewGuide,
706
+ DiscoveryInterviewGuideFinding,
707
+ DiscoveryInterviewGuideRule,
708
+ DiscoveryInterviewMode,
709
+ DiscoveryInterviewParticipation,
710
+ DiscoveryInterviewParticipationDefinition,
711
+ DiscoveryInterviewParticipationInterview,
712
+ DiscoveryInterviewProbing,
713
+ DiscoveryInterviewQuestion,
714
+ DiscoveryInterviewQuestionRequest,
715
+ DiscoveryInterviewRecording,
716
+ DiscoveryInterviewService,
717
+ DiscoveryInterviewSpeaker,
718
+ DiscoveryInterviewStatus,
719
+ DiscoveryInterviewSynthesisStatus,
720
+ DiscoveryInterviewTranscriptTurn,
682
721
  InkPoint,
683
722
  InkStroke,
723
+ InviteDiscoveryInterviewParticipantsRequest,
684
724
  ListDiscoveryEvidenceQuery,
725
+ ListDiscoveryInterviewDefinitionsQuery,
726
+ ListDiscoveryInterviewsQuery,
685
727
  ListPlatformDiscoveryEvidenceQuery,
686
728
  PlatformDiscoveryEvidenceService,
729
+ StartDiscoveryInterviewParticipationRequest,
687
730
  UpdateDiscoveryEvidenceFrameRequest,
688
731
  UpdateDiscoveryEvidenceRequest,
689
732
  UpdateDiscoveryEvidenceStatusRequest,
733
+ UpdateDiscoveryInterviewDefinitionRequest,
690
734
  } from './discovery/index.js'
691
735
  export { DiscoveryClient } from './discovery/index.js'
692
736
  export type { ApiErrorResponse, ErrorCodeType } from './errors.js'
@@ -740,6 +784,7 @@ export type {
740
784
  CreateNodeRequest,
741
785
  CreateRecordLinkRequest,
742
786
  CreateSpaceRequest,
787
+ CreateWhiteboardTemplateRequest,
743
788
  EditContentRequest,
744
789
  EditContentResponse,
745
790
  GetGraphOptions,
@@ -764,6 +809,7 @@ export type {
764
809
  ListNodesOptions,
765
810
  ListRecordLinksOptions,
766
811
  ListSpacesOptions,
812
+ ListWhiteboardTemplatesOptions,
767
813
  MatchMode,
768
814
  NeighborDirection,
769
815
  NeighborEdge,
@@ -788,6 +834,10 @@ export type {
788
834
  UpdateLinkRequest,
789
835
  UpdateNodeRequest,
790
836
  UpdateSpaceRequest,
837
+ UpdateWhiteboardTemplateRequest,
838
+ WhiteboardTemplate,
839
+ WhiteboardTemplateMetadata,
840
+ WhiteboardTemplateService,
791
841
  WriteContentOptions,
792
842
  WriteContentResponse,
793
843
  } from './knowledge/index.js'
@@ -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'
@@ -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
+ }