@vertesia/common 1.0.0-dev.20260128.144200 → 1.0.0-dev.20260225.024852Z
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/lib/cjs/apikey.js +1 -0
- package/lib/cjs/apikey.js.map +1 -1
- package/lib/cjs/apps.js.map +1 -1
- package/lib/cjs/audit-trail.js +3 -0
- package/lib/cjs/audit-trail.js.map +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/cjs/integrations.js +2 -0
- package/lib/cjs/integrations.js.map +1 -1
- package/lib/cjs/interaction.js.map +1 -1
- package/lib/cjs/project.js +37 -1
- package/lib/cjs/project.js.map +1 -1
- package/lib/cjs/prompt.js.map +1 -1
- package/lib/cjs/store/dsl-workflow.js.map +1 -1
- package/lib/cjs/store/hive-memory.js +3 -0
- package/lib/cjs/store/hive-memory.js.map +1 -0
- package/lib/cjs/store/index.js +2 -0
- package/lib/cjs/store/index.js.map +1 -1
- package/lib/cjs/store/rendering.js +22 -0
- package/lib/cjs/store/rendering.js.map +1 -0
- package/lib/cjs/store/schedule.js.map +1 -1
- package/lib/cjs/store/store.js +15 -2
- package/lib/cjs/store/store.js.map +1 -1
- package/lib/cjs/store/workflow.js +44 -1
- package/lib/cjs/store/workflow.js.map +1 -1
- package/lib/cjs/user.js.map +1 -1
- package/lib/cjs/utils/schemas.js +26 -2
- package/lib/cjs/utils/schemas.js.map +1 -1
- package/lib/cjs/versions.js +1 -0
- package/lib/cjs/versions.js.map +1 -1
- package/lib/esm/apikey.js +1 -0
- package/lib/esm/apikey.js.map +1 -1
- package/lib/esm/apps.js.map +1 -1
- package/lib/esm/audit-trail.js +2 -0
- package/lib/esm/audit-trail.js.map +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/integrations.js +2 -0
- package/lib/esm/integrations.js.map +1 -1
- package/lib/esm/interaction.js.map +1 -1
- package/lib/esm/project.js +36 -0
- package/lib/esm/project.js.map +1 -1
- package/lib/esm/prompt.js.map +1 -1
- package/lib/esm/store/dsl-workflow.js.map +1 -1
- package/lib/esm/store/hive-memory.js +2 -0
- package/lib/esm/store/hive-memory.js.map +1 -0
- package/lib/esm/store/index.js +2 -0
- package/lib/esm/store/index.js.map +1 -1
- package/lib/esm/store/rendering.js +18 -0
- package/lib/esm/store/rendering.js.map +1 -0
- package/lib/esm/store/schedule.js.map +1 -1
- package/lib/esm/store/store.js +13 -2
- package/lib/esm/store/store.js.map +1 -1
- package/lib/esm/store/workflow.js +39 -1
- package/lib/esm/store/workflow.js.map +1 -1
- package/lib/esm/user.js.map +1 -1
- package/lib/esm/utils/schemas.js +24 -2
- package/lib/esm/utils/schemas.js.map +1 -1
- package/lib/esm/versions.js +1 -0
- package/lib/esm/versions.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib/types/apikey.d.ts +2 -1
- package/lib/types/apikey.d.ts.map +1 -1
- package/lib/types/apps.d.ts +220 -1
- package/lib/types/apps.d.ts.map +1 -1
- package/lib/types/audit-trail.d.ts +49 -0
- package/lib/types/audit-trail.d.ts.map +1 -0
- package/lib/types/index.d.ts +1 -0
- package/lib/types/index.d.ts.map +1 -1
- package/lib/types/integrations.d.ts +8 -0
- package/lib/types/integrations.d.ts.map +1 -1
- package/lib/types/interaction.d.ts +10 -11
- package/lib/types/interaction.d.ts.map +1 -1
- package/lib/types/project.d.ts +256 -1
- package/lib/types/project.d.ts.map +1 -1
- package/lib/types/prompt.d.ts +3 -4
- package/lib/types/prompt.d.ts.map +1 -1
- package/lib/types/skill.d.ts.map +1 -1
- package/lib/types/store/conversation-state.d.ts +7 -0
- package/lib/types/store/conversation-state.d.ts.map +1 -1
- package/lib/types/store/doc-analyzer.d.ts +1 -1
- package/lib/types/store/doc-analyzer.d.ts.map +1 -1
- package/lib/types/store/dsl-workflow.d.ts +28 -0
- package/lib/types/store/dsl-workflow.d.ts.map +1 -1
- package/lib/types/store/hive-memory.d.ts +116 -0
- package/lib/types/store/hive-memory.d.ts.map +1 -0
- package/lib/types/store/index.d.ts +2 -0
- package/lib/types/store/index.d.ts.map +1 -1
- package/lib/types/store/rendering.d.ts +193 -0
- package/lib/types/store/rendering.d.ts.map +1 -0
- package/lib/types/store/schedule.d.ts +2 -0
- package/lib/types/store/schedule.d.ts.map +1 -1
- package/lib/types/store/store.d.ts +31 -2
- package/lib/types/store/store.d.ts.map +1 -1
- package/lib/types/store/workflow.d.ts +145 -7
- package/lib/types/store/workflow.d.ts.map +1 -1
- package/lib/types/user.d.ts +9 -0
- package/lib/types/user.d.ts.map +1 -1
- package/lib/types/utils/schemas.d.ts +13 -4
- package/lib/types/utils/schemas.d.ts.map +1 -1
- package/lib/types/versions.d.ts +2 -1
- package/lib/types/versions.d.ts.map +1 -1
- package/lib/vertesia-common.js +1 -1
- package/lib/vertesia-common.js.map +1 -1
- package/package.json +2 -4
- package/src/apikey.ts +1 -0
- package/src/apps.ts +249 -1
- package/src/audit-trail.ts +61 -0
- package/src/index.ts +1 -0
- package/src/integrations.ts +10 -0
- package/src/interaction.ts +11 -12
- package/src/project.ts +309 -1
- package/src/prompt.ts +3 -4
- package/src/skill.ts +1 -0
- package/src/store/conversation-state.ts +9 -0
- package/src/store/doc-analyzer.ts +1 -1
- package/src/store/dsl-workflow.ts +26 -0
- package/src/store/hive-memory.ts +167 -0
- package/src/store/index.ts +2 -0
- package/src/store/rendering.ts +233 -0
- package/src/store/schedule.ts +3 -0
- package/src/store/store.ts +40 -4
- package/src/store/workflow.ts +191 -7
- package/src/user.ts +11 -0
- package/src/utils/schemas.ts +33 -11
- package/src/versions.ts +1 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rendering API types
|
|
3
|
+
*
|
|
4
|
+
* Types for rendering content to various formats (PDF, DOCX, images)
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ImageRenditionFormat, MarkdownRenditionFormat } from "./store.js";
|
|
8
|
+
import { WorkflowExecutionStatus, WorkflowRunStatus } from "./workflow.js";
|
|
9
|
+
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Workflow Vars Types (Discriminated Union)
|
|
12
|
+
// ============================================================================
|
|
13
|
+
|
|
14
|
+
/** Base vars shared by all rendition types */
|
|
15
|
+
interface BaseRenditionVars {
|
|
16
|
+
mime_type?: string;
|
|
17
|
+
/** Custom upload path — overrides the default renditions/{etag}/{name} path */
|
|
18
|
+
outputPath?: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Workflow vars for image renditions (jpeg, png, webp) */
|
|
22
|
+
export interface ImageRenditionVars extends BaseRenditionVars {
|
|
23
|
+
format?: ImageRenditionFormat;
|
|
24
|
+
max_hw?: number;
|
|
25
|
+
max_pages?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** Metadata for PDF rendering (displayed in header/footer) */
|
|
29
|
+
export interface PdfRenderingMetadata {
|
|
30
|
+
/** Document ID to display in footer */
|
|
31
|
+
document_id?: string;
|
|
32
|
+
/** Agent name that generated the document */
|
|
33
|
+
agent_name?: string;
|
|
34
|
+
/** Agent run ID to display in footer */
|
|
35
|
+
agent_run_id?: string;
|
|
36
|
+
/** Document subtitle */
|
|
37
|
+
subtitle?: string;
|
|
38
|
+
/** Document author(s) */
|
|
39
|
+
author?: string | string[];
|
|
40
|
+
/** Document date (displayed in header and title page; defaults to today if omitted) */
|
|
41
|
+
date?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Workflow vars for markdown renditions (pdf, docx) */
|
|
45
|
+
export interface MarkdownRenditionVars extends BaseRenditionVars {
|
|
46
|
+
format: MarkdownRenditionFormat;
|
|
47
|
+
/** Inline markdown content (mutually exclusive with objectId) */
|
|
48
|
+
content?: string;
|
|
49
|
+
/** Blob store path to fetch markdown from (mutually exclusive with content/objectId) */
|
|
50
|
+
artifactPath?: string;
|
|
51
|
+
/** Document title for inline content */
|
|
52
|
+
title?: string;
|
|
53
|
+
/** URL to template file (LaTeX for PDF, reference doc for DOCX) */
|
|
54
|
+
templateUrl?: string;
|
|
55
|
+
/** Optional logo URL for template variable `logo-path` (studio-hosted URL) */
|
|
56
|
+
templateLogoUrl?: string;
|
|
57
|
+
/** Template file via artifact:/store: protocol (takes precedence over templateUrl) */
|
|
58
|
+
templatePath?: string;
|
|
59
|
+
/** Logo file via artifact:/store: protocol (takes precedence over templateLogoUrl) */
|
|
60
|
+
logoPath?: string;
|
|
61
|
+
/** Use Vertesia default template if no templateUrl provided (default: true for pdf) */
|
|
62
|
+
useDefaultTemplate?: boolean;
|
|
63
|
+
/** Additional pandoc command-line options */
|
|
64
|
+
pandocOptions?: string[];
|
|
65
|
+
/** Run ID for resolving artifact: URLs in markdown */
|
|
66
|
+
artifactRunId?: string;
|
|
67
|
+
/** Document metadata for PDF footer/header */
|
|
68
|
+
metadata?: PdfRenderingMetadata;
|
|
69
|
+
/** Source reference for auto-wired template data: `store:<objectId>` or `artifact:<path-to-json>` */
|
|
70
|
+
templateDataSource?: string;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Discriminated union of all rendition workflow vars */
|
|
74
|
+
export type GenerateRenditionVars = ImageRenditionVars | MarkdownRenditionVars;
|
|
75
|
+
|
|
76
|
+
/** Type guard for markdown rendition vars */
|
|
77
|
+
export function isMarkdownRenditionVars(
|
|
78
|
+
vars: GenerateRenditionVars
|
|
79
|
+
): vars is MarkdownRenditionVars {
|
|
80
|
+
return vars.format === 'pdf' || vars.format === 'docx';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// ============================================================================
|
|
84
|
+
// API Payload Types
|
|
85
|
+
// ============================================================================
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Payload for rendering markdown to PDF or DOCX.
|
|
89
|
+
* Either object_id OR content must be provided.
|
|
90
|
+
*/
|
|
91
|
+
export interface RenderMarkdownPayload {
|
|
92
|
+
/** Output format */
|
|
93
|
+
format: MarkdownRenditionFormat;
|
|
94
|
+
/** Object ID to render (mutually exclusive with content) */
|
|
95
|
+
object_id?: string;
|
|
96
|
+
/** Inline markdown content to render (mutually exclusive with object_id) */
|
|
97
|
+
content?: string;
|
|
98
|
+
/** Document title (used for filename when using inline content) */
|
|
99
|
+
title?: string;
|
|
100
|
+
/** URL to a template file for pandoc (DOCX reference doc or LaTeX template) */
|
|
101
|
+
template_url?: string;
|
|
102
|
+
/** Optional logo URL for template variable `logo-path` (studio-hosted URL) */
|
|
103
|
+
template_logo_url?: string;
|
|
104
|
+
/** Template file via artifact:/store: protocol (takes precedence over template_url) */
|
|
105
|
+
template_path?: string;
|
|
106
|
+
/** Logo file via artifact:/store: protocol (takes precedence over template_logo_url) */
|
|
107
|
+
logo_path?: string;
|
|
108
|
+
/** Use Vertesia default template if no template_url provided (default: true for pdf) */
|
|
109
|
+
use_default_template?: boolean;
|
|
110
|
+
/** Additional pandoc command-line options */
|
|
111
|
+
pandoc_options?: string[];
|
|
112
|
+
/** Run ID for resolving artifact: and image: URLs */
|
|
113
|
+
artifact_run_id?: string;
|
|
114
|
+
/** Document metadata for PDF footer/header */
|
|
115
|
+
metadata?: PdfRenderingMetadata;
|
|
116
|
+
/** Source reference for auto-wired template data: `store:<objectId>` or `artifact:<path-to-json>` */
|
|
117
|
+
template_data_source?: string;
|
|
118
|
+
/** Custom upload path for the rendered output */
|
|
119
|
+
output_path?: string;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Initial response when starting a markdown rendering workflow.
|
|
124
|
+
* Clients should poll status using workflow_id/workflow_run_id.
|
|
125
|
+
*/
|
|
126
|
+
export interface RenderMarkdownStartResponse extends WorkflowRunStatus {
|
|
127
|
+
/** Requested output format */
|
|
128
|
+
format: MarkdownRenditionFormat;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Polled status response for markdown rendering workflow.
|
|
133
|
+
*/
|
|
134
|
+
export interface RenderMarkdownStatusResponse extends WorkflowRunStatus {
|
|
135
|
+
/** Requested output format (if known) */
|
|
136
|
+
format?: MarkdownRenditionFormat;
|
|
137
|
+
/** Download URL for completed output */
|
|
138
|
+
download_url?: string;
|
|
139
|
+
/** File URI in storage for completed output */
|
|
140
|
+
file_uri?: string;
|
|
141
|
+
/** Error details for failed/terminated runs */
|
|
142
|
+
error?: string;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Client-side polling options for markdown rendering.
|
|
147
|
+
*/
|
|
148
|
+
export interface RenderMarkdownPollOptions {
|
|
149
|
+
/** Maximum time to wait in milliseconds (default: 10 minutes) */
|
|
150
|
+
timeoutMs?: number;
|
|
151
|
+
/** Polling interval in milliseconds (default: 1500ms) */
|
|
152
|
+
pollIntervalMs?: number;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Result from the GenerateRenditions workflow.
|
|
157
|
+
* Shared between zeno-server (consumer) and workflows (producer).
|
|
158
|
+
*/
|
|
159
|
+
export interface GenerateRenditionsResult {
|
|
160
|
+
uploads: string[];
|
|
161
|
+
format: string;
|
|
162
|
+
status: string;
|
|
163
|
+
fileUri?: string;
|
|
164
|
+
/** Warnings about rich content blocks that failed to render (document was still produced) */
|
|
165
|
+
warnings?: string[];
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Response from the rendering API.
|
|
170
|
+
*/
|
|
171
|
+
export interface RenderMarkdownResponse {
|
|
172
|
+
/** Rendering status */
|
|
173
|
+
status: "success";
|
|
174
|
+
/** Output format */
|
|
175
|
+
format: MarkdownRenditionFormat;
|
|
176
|
+
/** Download URL for the rendered document */
|
|
177
|
+
download_url?: string;
|
|
178
|
+
/** File URI in storage */
|
|
179
|
+
file_uri?: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// ============================================================================
|
|
183
|
+
// Slide Deck Types
|
|
184
|
+
// ============================================================================
|
|
185
|
+
|
|
186
|
+
/** A slide rendered from a named SVG template with structured content */
|
|
187
|
+
export interface TemplateSlide {
|
|
188
|
+
type: 'template';
|
|
189
|
+
/** Template name: 'title' | 'section' | 'bullets' | 'two-column' | 'image-text' */
|
|
190
|
+
template: string;
|
|
191
|
+
/** Key-value content for the template (values can be strings or string arrays) */
|
|
192
|
+
content: Record<string, string | string[]>;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/** A slide with raw SVG markup */
|
|
196
|
+
export interface RawSvgSlide {
|
|
197
|
+
type: 'svg';
|
|
198
|
+
/** Complete SVG markup (should use 1920x1080 viewBox) */
|
|
199
|
+
svg: string;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/** A single slide specification — either template-based or raw SVG */
|
|
203
|
+
export type SlideSpec = TemplateSlide | RawSvgSlide;
|
|
204
|
+
|
|
205
|
+
/** Options for rendering a slide deck to PDF */
|
|
206
|
+
export interface RenderSlidesDeckOptions {
|
|
207
|
+
/** Canvas scale factor for higher resolution (default: 2) */
|
|
208
|
+
scale?: number;
|
|
209
|
+
/** Background color for each slide (default: '#ffffff') */
|
|
210
|
+
backgroundColor?: string;
|
|
211
|
+
/** Slide theme — replaces default colors in SVG templates */
|
|
212
|
+
theme?: Record<string, string>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Result of rendering a slide deck to PDF */
|
|
216
|
+
export interface RenderSlidesDeckResult {
|
|
217
|
+
/** PDF file as a Uint8Array (use Buffer.from() in Node.js) */
|
|
218
|
+
buffer: Uint8Array;
|
|
219
|
+
/** Number of slides rendered */
|
|
220
|
+
slideCount: number;
|
|
221
|
+
/** PDF page width in points (720 = 10") */
|
|
222
|
+
pageWidth: number;
|
|
223
|
+
/** PDF page height in points (540 = 7.5") */
|
|
224
|
+
pageHeight: number;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export function isWorkflowTerminalStatus(status: WorkflowExecutionStatus): boolean {
|
|
228
|
+
return status === WorkflowExecutionStatus.COMPLETED
|
|
229
|
+
|| status === WorkflowExecutionStatus.FAILED
|
|
230
|
+
|| status === WorkflowExecutionStatus.CANCELED
|
|
231
|
+
|| status === WorkflowExecutionStatus.TERMINATED
|
|
232
|
+
|| status === WorkflowExecutionStatus.TIMED_OUT;
|
|
233
|
+
}
|
package/src/store/schedule.ts
CHANGED
|
@@ -107,6 +107,9 @@ export interface CreateSchedulePayload {
|
|
|
107
107
|
|
|
108
108
|
/** Whether the schedule should be enabled immediately (defaults to true) */
|
|
109
109
|
enabled?: boolean;
|
|
110
|
+
|
|
111
|
+
/** Visibility of the conversation (defaults to "project") */
|
|
112
|
+
visibility?: 'project' | 'private';
|
|
110
113
|
}
|
|
111
114
|
|
|
112
115
|
/**
|
package/src/store/store.ts
CHANGED
|
@@ -302,8 +302,30 @@ export interface CreateContentObjectPayload<T = any>
|
|
|
302
302
|
generation_run_info?: GenerationRunMetadata;
|
|
303
303
|
}
|
|
304
304
|
|
|
305
|
-
export
|
|
305
|
+
export function getContentTypeRefId(type: ContentObjectTypeRef) {
|
|
306
|
+
return (type as StoredTypeRef).id || (type as InCodeTypeRef).code;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Reference to a content object type. Either `id` (stored type) or `code` (in-code type) must be set.
|
|
311
|
+
*/
|
|
312
|
+
export type ContentObjectTypeRef = StoredTypeRef | InCodeTypeRef;
|
|
313
|
+
|
|
314
|
+
interface StoredTypeRef {
|
|
315
|
+
/**
|
|
316
|
+
* MongoDB ObjectId string for stored types
|
|
317
|
+
*/
|
|
306
318
|
id: string;
|
|
319
|
+
code?: never;
|
|
320
|
+
name: string;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
interface InCodeTypeRef {
|
|
324
|
+
id?: never;
|
|
325
|
+
/**
|
|
326
|
+
* Namespaced identifier for in-code types (e.g. "sys:Invoice", "app:myapp:Contract")
|
|
327
|
+
*/
|
|
328
|
+
code: string;
|
|
307
329
|
name: string;
|
|
308
330
|
}
|
|
309
331
|
|
|
@@ -353,6 +375,20 @@ export interface ContentObjectTypeItem extends BaseObject {
|
|
|
353
375
|
*/
|
|
354
376
|
strict_mode?: boolean;
|
|
355
377
|
}
|
|
378
|
+
export type InCodeTypeDefinition = Pick<ContentObjectTypeItem, 'id' | 'name' | 'description' | 'tags' | 'object_schema' | 'table_layout' | 'is_chunkable' | 'strict_mode'>;
|
|
379
|
+
/**
|
|
380
|
+
* The itnerface to be used whend efining types in a plugin app.
|
|
381
|
+
*/
|
|
382
|
+
export type InCodeTypeSpec = Omit<InCodeTypeDefinition, 'id'>;
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Returns true if the type id represents an in-code type (system or app-contributed).
|
|
386
|
+
* In-code types use colon-separated ids like "sys:Invoice" or "app:myapp:Article".
|
|
387
|
+
* These types are read-only and cannot be edited through the UI.
|
|
388
|
+
*/
|
|
389
|
+
export function isInCodeType(typeId: string): boolean {
|
|
390
|
+
return typeId.includes(':');
|
|
391
|
+
}
|
|
356
392
|
|
|
357
393
|
export interface CreateContentObjectTypePayload
|
|
358
394
|
extends Omit<
|
|
@@ -455,8 +491,8 @@ const RENDITION_COMPATIBILITY: Record<string, RenditionFormat[]> = {
|
|
|
455
491
|
'application/pdf': [ImageRenditionFormat.jpeg, ImageRenditionFormat.png, ImageRenditionFormat.webp],
|
|
456
492
|
// Markdown can generate: pdf, docx (NOT jpeg/png)
|
|
457
493
|
'text/markdown': [MarkdownRenditionFormat.pdf, MarkdownRenditionFormat.docx],
|
|
458
|
-
//
|
|
459
|
-
'text
|
|
494
|
+
// Any text/* can generate: docx (editable export)
|
|
495
|
+
'text/*': [MarkdownRenditionFormat.docx],
|
|
460
496
|
// Office documents can generate: pdf
|
|
461
497
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': [MarkdownRenditionFormat.pdf],
|
|
462
498
|
'application/msword': [MarkdownRenditionFormat.pdf],
|
|
@@ -562,7 +598,7 @@ export interface GetFileUrlPayload {
|
|
|
562
598
|
export interface GetFileUrlResponse {
|
|
563
599
|
url: string;
|
|
564
600
|
id: string;
|
|
565
|
-
mime_type
|
|
601
|
+
mime_type?: string;
|
|
566
602
|
path: string;
|
|
567
603
|
}
|
|
568
604
|
|
package/src/store/workflow.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { JSONSchema4 } from "json-schema";
|
|
2
1
|
import { ConversationVisibility, InteractionRef, UserChannel } from "../interaction.js";
|
|
2
|
+
import { JSONSchema } from "../json-schema.js";
|
|
3
|
+
import type { WorkflowInput } from "./dsl-workflow.js";
|
|
3
4
|
|
|
4
5
|
export enum ContentEventName {
|
|
5
6
|
create = "create",
|
|
@@ -151,9 +152,16 @@ export interface WorkflowExecutionPayload<T = Record<string, any>> extends Workf
|
|
|
151
152
|
wf_rule_name?: string;
|
|
152
153
|
|
|
153
154
|
/**
|
|
154
|
-
* The ID of the target objects processed by the workflow.
|
|
155
|
+
* The ID of the target objects processed by the workflow (legacy format).
|
|
156
|
+
* For backward compatibility. New workflows should use the `input` field.
|
|
155
157
|
*/
|
|
156
|
-
objectIds
|
|
158
|
+
objectIds?: string[];
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* New format: Workflow input (either objectIds or files).
|
|
162
|
+
* Takes precedence over the legacy `objectIds` field.
|
|
163
|
+
*/
|
|
164
|
+
input?: WorkflowInput;
|
|
157
165
|
|
|
158
166
|
/**
|
|
159
167
|
* Auth Token to access Zeno and Composable from the workers
|
|
@@ -162,7 +170,12 @@ export interface WorkflowExecutionPayload<T = Record<string, any>> extends Workf
|
|
|
162
170
|
}
|
|
163
171
|
|
|
164
172
|
export function getDocumentIds(payload: WorkflowExecutionPayload): string[] {
|
|
165
|
-
|
|
173
|
+
// Check new input format first
|
|
174
|
+
if (payload.input?.inputType === 'objectIds') {
|
|
175
|
+
return payload.input.objectIds;
|
|
176
|
+
}
|
|
177
|
+
// Fall back to legacy objectIds field
|
|
178
|
+
if (payload.objectIds) {
|
|
166
179
|
return payload.objectIds;
|
|
167
180
|
}
|
|
168
181
|
return [];
|
|
@@ -181,6 +194,12 @@ export interface ExecuteWorkflowPayload {
|
|
|
181
194
|
//@deprecated
|
|
182
195
|
objectIds?: string[];
|
|
183
196
|
|
|
197
|
+
/**
|
|
198
|
+
* New format: Workflow input (either objectIds or files).
|
|
199
|
+
* Takes precedence over the deprecated `objectIds` field.
|
|
200
|
+
*/
|
|
201
|
+
input?: WorkflowInput;
|
|
202
|
+
|
|
184
203
|
/**
|
|
185
204
|
* Parameters to pass to the workflow
|
|
186
205
|
*/
|
|
@@ -200,6 +219,13 @@ export interface ExecuteWorkflowPayload {
|
|
|
200
219
|
* Timeout for the workflow execution to complete, in seconds.
|
|
201
220
|
*/
|
|
202
221
|
timeout?: number; //timeout in seconds
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Schedule the workflow to run at a specific time (ISO 8601 datetime).
|
|
225
|
+
* Example: "2024-02-15T16:00:00Z"
|
|
226
|
+
* If in the past or not provided, workflow runs immediately.
|
|
227
|
+
*/
|
|
228
|
+
run_at?: string;
|
|
203
229
|
}
|
|
204
230
|
|
|
205
231
|
export interface ListWorkflowRunsPayload {
|
|
@@ -328,6 +354,12 @@ export interface WorkflowRunEvent {
|
|
|
328
354
|
|
|
329
355
|
signal?: SignalEventProperties;
|
|
330
356
|
|
|
357
|
+
timer?: {
|
|
358
|
+
timerId?: string;
|
|
359
|
+
duration?: string;
|
|
360
|
+
summary?: string;
|
|
361
|
+
};
|
|
362
|
+
|
|
331
363
|
error?: EventError;
|
|
332
364
|
|
|
333
365
|
result?: any;
|
|
@@ -351,6 +383,7 @@ export enum TaskType {
|
|
|
351
383
|
ACTIVITY = 'activity',
|
|
352
384
|
CHILD_WORKFLOW = 'childWorkflow',
|
|
353
385
|
SIGNAL = 'signal',
|
|
386
|
+
TIMER = 'timer',
|
|
354
387
|
}
|
|
355
388
|
|
|
356
389
|
// Base task interface
|
|
@@ -395,21 +428,75 @@ export interface SignalTask extends TaskBase {
|
|
|
395
428
|
};
|
|
396
429
|
}
|
|
397
430
|
|
|
431
|
+
// Timer-specific task
|
|
432
|
+
export interface TimerTask extends TaskBase {
|
|
433
|
+
type: TaskType.TIMER;
|
|
434
|
+
timerId?: string;
|
|
435
|
+
duration?: string;
|
|
436
|
+
}
|
|
437
|
+
|
|
398
438
|
// Union type for all processed tasks
|
|
399
439
|
export type WorkflowTask =
|
|
400
440
|
| ActivityTask
|
|
401
441
|
| ChildWorkflowTask
|
|
402
|
-
| SignalTask
|
|
442
|
+
| SignalTask
|
|
443
|
+
| TimerTask;
|
|
403
444
|
|
|
404
445
|
// History format discriminated union
|
|
405
446
|
export type WorkflowHistory =
|
|
406
447
|
| { type: 'events'; events: WorkflowRunEvent[] }
|
|
407
448
|
| { type: 'tasks'; tasks: WorkflowTask[] }
|
|
408
|
-
| { type: 'agent';
|
|
449
|
+
| { type: 'agent'; agentTasks: AgentTask[] };
|
|
409
450
|
|
|
410
451
|
// History format query parameter type
|
|
411
452
|
export type HistoryFormat = 'events' | 'tasks' | 'agent';
|
|
412
453
|
|
|
454
|
+
/**
|
|
455
|
+
* Agent task information for workflow history UI representation.
|
|
456
|
+
* This is separate from the analytics AgentEvent types.
|
|
457
|
+
* Consistent with WorkflowTask naming convention.
|
|
458
|
+
*
|
|
459
|
+
* Currently represents tool calls, but designed to be extensible
|
|
460
|
+
* for other task types (LLM calls, checkpoints, etc.)
|
|
461
|
+
*/
|
|
462
|
+
export interface AgentTask {
|
|
463
|
+
/** Type discriminator for future task types */
|
|
464
|
+
taskType: 'tool_call' | 'llm_call' | 'input' | 'timer' | 'subagent' | 'processing';
|
|
465
|
+
|
|
466
|
+
/** Tool-specific fields */
|
|
467
|
+
toolName: string;
|
|
468
|
+
toolUseId?: string;
|
|
469
|
+
toolRunId?: string;
|
|
470
|
+
toolType?: 'builtin' | 'interaction' | 'remote' | 'skill';
|
|
471
|
+
iteration?: number;
|
|
472
|
+
|
|
473
|
+
/** Execution details */
|
|
474
|
+
scheduled_at: string | null;
|
|
475
|
+
started_at: string | null;
|
|
476
|
+
completed_at: string | null;
|
|
477
|
+
status: 'running' | 'completed' | 'error' | 'warning';
|
|
478
|
+
|
|
479
|
+
/** Tool data */
|
|
480
|
+
parameters?: Record<string, unknown>;
|
|
481
|
+
result?: string;
|
|
482
|
+
error?: { type: string; message: string };
|
|
483
|
+
|
|
484
|
+
/** Number of activity retries */
|
|
485
|
+
retries?: number;
|
|
486
|
+
|
|
487
|
+
/** Active tools for this LLM call */
|
|
488
|
+
activeTools?: string[];
|
|
489
|
+
|
|
490
|
+
/** Available skills for this LLM call */
|
|
491
|
+
availableSkills?: string[];
|
|
492
|
+
|
|
493
|
+
/** Workstream tracking */
|
|
494
|
+
workstreamId?: string;
|
|
495
|
+
|
|
496
|
+
/** LLM stop reason for llm_call tasks (e.g., "stop", "length", "tool_use") */
|
|
497
|
+
finish_reason?: string;
|
|
498
|
+
}
|
|
499
|
+
|
|
413
500
|
export interface WorkflowRun {
|
|
414
501
|
status?: WorkflowExecutionStatus | string;
|
|
415
502
|
/**
|
|
@@ -497,8 +584,14 @@ export interface WorkflowInteractionVars {
|
|
|
497
584
|
environment: string,
|
|
498
585
|
model: string
|
|
499
586
|
},
|
|
500
|
-
interactionParamsSchema?:
|
|
587
|
+
interactionParamsSchema?: JSONSchema,
|
|
501
588
|
collection_id?: string;
|
|
589
|
+
/**
|
|
590
|
+
* The token threshold in thousands (K) for creating checkpoints.
|
|
591
|
+
* If total tokens exceed this value, a checkpoint will be created.
|
|
592
|
+
* If not specified, default value of 150K tokens will be used.
|
|
593
|
+
*/
|
|
594
|
+
checkpoint_tokens?: number;
|
|
502
595
|
/**
|
|
503
596
|
* Optional version of the interaction to use when restoring conversations.
|
|
504
597
|
* If not specified, the latest version will be used.
|
|
@@ -573,6 +666,97 @@ export enum AgentMessageType {
|
|
|
573
666
|
BATCH_PROGRESS = 13,
|
|
574
667
|
}
|
|
575
668
|
|
|
669
|
+
// ============================================
|
|
670
|
+
// AGENT MESSAGE DETAIL TYPES & TYPE GUARDS
|
|
671
|
+
// ============================================
|
|
672
|
+
|
|
673
|
+
/**
|
|
674
|
+
* Details for THOUGHT messages representing tool calls (event_class: 'activity').
|
|
675
|
+
*/
|
|
676
|
+
export interface ToolCallDetails {
|
|
677
|
+
event_class: 'activity';
|
|
678
|
+
tool: string;
|
|
679
|
+
tool_run_id?: string;
|
|
680
|
+
tool_status?: 'running' | 'completed' | 'error' | 'warning';
|
|
681
|
+
tool_iteration?: number;
|
|
682
|
+
activity_group_id?: string;
|
|
683
|
+
activity_id?: string;
|
|
684
|
+
files?: string[];
|
|
685
|
+
outputFiles?: string[];
|
|
686
|
+
[key: string]: unknown;
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
/**
|
|
690
|
+
* Details for UPDATE messages signaling document creation or update.
|
|
691
|
+
*/
|
|
692
|
+
export interface DocumentEventDetails {
|
|
693
|
+
event_class: 'document_created' | 'document_updated';
|
|
694
|
+
document_id: string;
|
|
695
|
+
title?: string;
|
|
696
|
+
[key: string]: unknown;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Details for REQUEST_INPUT messages with UX configuration.
|
|
701
|
+
*/
|
|
702
|
+
export interface RequestInputDetails {
|
|
703
|
+
ux?: {
|
|
704
|
+
options?: Array<{ id: string; label: string }>;
|
|
705
|
+
variant?: string;
|
|
706
|
+
multiSelect?: boolean;
|
|
707
|
+
allowFreeResponse?: boolean;
|
|
708
|
+
placeholder?: string;
|
|
709
|
+
};
|
|
710
|
+
[key: string]: unknown;
|
|
711
|
+
}
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* Details for PLAN messages containing the plan structure.
|
|
715
|
+
*/
|
|
716
|
+
export interface PlanMessageDetails {
|
|
717
|
+
plan: PlanTask[];
|
|
718
|
+
comment?: string;
|
|
719
|
+
[key: string]: unknown;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
// Type guards — check both message type and details shape for safety
|
|
723
|
+
|
|
724
|
+
export function isToolCallMessage(msg: AgentMessage): msg is AgentMessage & { details: ToolCallDetails } {
|
|
725
|
+
return msg.type === AgentMessageType.THOUGHT &&
|
|
726
|
+
!!msg.details &&
|
|
727
|
+
typeof msg.details === 'object' &&
|
|
728
|
+
typeof msg.details.tool === 'string';
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export function isDocumentEventMessage(msg: AgentMessage): msg is AgentMessage & { details: DocumentEventDetails } {
|
|
732
|
+
return msg.type === AgentMessageType.UPDATE &&
|
|
733
|
+
!!msg.details &&
|
|
734
|
+
typeof msg.details === 'object' &&
|
|
735
|
+
(msg.details.event_class === 'document_created' || msg.details.event_class === 'document_updated') &&
|
|
736
|
+
typeof msg.details.document_id === 'string';
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export function isFileProcessingMessage(msg: AgentMessage): msg is AgentMessage & { details: FileProcessingDetails } {
|
|
740
|
+
return msg.type === AgentMessageType.SYSTEM &&
|
|
741
|
+
!!msg.details &&
|
|
742
|
+
typeof msg.details === 'object' &&
|
|
743
|
+
msg.details.system_type === 'file_processing' &&
|
|
744
|
+
Array.isArray(msg.details.files);
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
export function isPlanMessage(msg: AgentMessage): msg is AgentMessage & { details: PlanMessageDetails } {
|
|
748
|
+
return msg.type === AgentMessageType.PLAN &&
|
|
749
|
+
!!msg.details &&
|
|
750
|
+
typeof msg.details === 'object' &&
|
|
751
|
+
Array.isArray(msg.details.plan);
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export function isRequestInputMessage(msg: AgentMessage): msg is AgentMessage & { details: RequestInputDetails } {
|
|
755
|
+
return msg.type === AgentMessageType.REQUEST_INPUT &&
|
|
756
|
+
!!msg.details &&
|
|
757
|
+
typeof msg.details === 'object';
|
|
758
|
+
}
|
|
759
|
+
|
|
576
760
|
/**
|
|
577
761
|
* Details for STREAMING_CHUNK messages used for real-time LLM response streaming
|
|
578
762
|
* @deprecated Use CompactMessage with f field for streaming chunks
|
package/src/user.ts
CHANGED
|
@@ -18,6 +18,17 @@ export interface User {
|
|
|
18
18
|
sign_in_provider?: string;
|
|
19
19
|
last_selected_account?: string;
|
|
20
20
|
source?: 'firebase' | 'scim';
|
|
21
|
+
updated_by?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
export interface UpdateUserPayload {
|
|
26
|
+
name?: string;
|
|
27
|
+
username?: string;
|
|
28
|
+
picture?: string;
|
|
29
|
+
language?: string;
|
|
30
|
+
phone?: string;
|
|
31
|
+
last_selected_account?: string;
|
|
21
32
|
}
|
|
22
33
|
|
|
23
34
|
|