@hexabot-ai/types 3.0.2-alpha.10 → 3.0.2-alpha.12
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/README.md +27 -0
- package/dist/cjs/workflow/index.js +17 -1
- package/dist/cjs/workflow/workflow-run.js +6 -0
- package/dist/cjs/workflow/workflow-transfer.js +124 -0
- package/dist/esm/workflow/index.js +1 -0
- package/dist/esm/workflow/workflow-run.js +6 -0
- package/dist/esm/workflow/workflow-transfer.js +121 -0
- package/dist/types/workflow/index.d.ts +1 -0
- package/dist/types/workflow/index.d.ts.map +1 -1
- package/dist/types/workflow/memory-record.d.ts +2 -0
- package/dist/types/workflow/memory-record.d.ts.map +1 -1
- package/dist/types/workflow/workflow-run.d.ts +60 -0
- package/dist/types/workflow/workflow-run.d.ts.map +1 -1
- package/dist/types/workflow/workflow-transfer.d.ts +329 -0
- package/dist/types/workflow/workflow-transfer.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/index.test.ts +311 -0
- package/src/workflow/index.ts +30 -0
- package/src/workflow/workflow-run.ts +9 -0
- package/src/workflow/workflow-transfer.ts +190 -0
package/src/workflow/index.ts
CHANGED
|
@@ -68,3 +68,33 @@ export {
|
|
|
68
68
|
type McpServerFull,
|
|
69
69
|
type McpServerStub,
|
|
70
70
|
} from "./mcp-server";
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
WORKFLOW_EXPORT_BUNDLE_KIND,
|
|
74
|
+
WORKFLOW_TRANSFER_RESOURCE_KIND_PATTERN,
|
|
75
|
+
workflowExportBundleContentTypeSchema,
|
|
76
|
+
workflowExportBundleCredentialSchema,
|
|
77
|
+
workflowExportBundleLabelGroupSchema,
|
|
78
|
+
workflowExportBundleLabelSchema,
|
|
79
|
+
workflowExportBundleMcpServerSchema,
|
|
80
|
+
workflowExportBundleMemoryDefinitionSchema,
|
|
81
|
+
workflowExportBundleSchema,
|
|
82
|
+
workflowExportBundleV1Schema,
|
|
83
|
+
workflowExportBundleWorkflowDependencySchema,
|
|
84
|
+
workflowImportResourceActionSchema,
|
|
85
|
+
workflowImportResourceResultSchema,
|
|
86
|
+
workflowImportResultSchema,
|
|
87
|
+
workflowTransferResourceKindSchema,
|
|
88
|
+
type WorkflowExportBundle,
|
|
89
|
+
type WorkflowExportBundleContentType,
|
|
90
|
+
type WorkflowExportBundleCredential,
|
|
91
|
+
type WorkflowExportBundleLabel,
|
|
92
|
+
type WorkflowExportBundleLabelGroup,
|
|
93
|
+
type WorkflowExportBundleMcpServer,
|
|
94
|
+
type WorkflowExportBundleMemoryDefinition,
|
|
95
|
+
type WorkflowExportBundleV1,
|
|
96
|
+
type WorkflowExportBundleWorkflowDependency,
|
|
97
|
+
type WorkflowImportResourceAction,
|
|
98
|
+
type WorkflowImportResourceResult,
|
|
99
|
+
type WorkflowImportResult,
|
|
100
|
+
} from "./workflow-transfer";
|
|
@@ -68,6 +68,7 @@ const workflowRunAliasMap = {
|
|
|
68
68
|
workflowVersionId: "workflowVersion",
|
|
69
69
|
triggeredById: "triggeredBy",
|
|
70
70
|
threadId: "thread",
|
|
71
|
+
parentRunId: "parentRun",
|
|
71
72
|
} as const;
|
|
72
73
|
const workflowRunStubObjectSchema = baseStubSchema.extend({
|
|
73
74
|
status: workflowRunStatusSchema,
|
|
@@ -133,6 +134,10 @@ export const workflowRunSchema = preprocess(
|
|
|
133
134
|
(value) => (value == null ? null : asId(value)),
|
|
134
135
|
z.string().nullable(),
|
|
135
136
|
),
|
|
137
|
+
parentRun: preprocess(
|
|
138
|
+
(value) => (value == null ? null : asId(value)),
|
|
139
|
+
z.string().nullable(),
|
|
140
|
+
),
|
|
136
141
|
}),
|
|
137
142
|
);
|
|
138
143
|
|
|
@@ -146,6 +151,10 @@ export const workflowRunFullSchema = preprocess(
|
|
|
146
151
|
.optional(),
|
|
147
152
|
triggeredBy: nullableUserOrSubscriberSchema,
|
|
148
153
|
thread: threadSchema.nullable().optional(),
|
|
154
|
+
parentRun: z
|
|
155
|
+
.lazy(() => workflowRunSchema)
|
|
156
|
+
.nullable()
|
|
157
|
+
.optional(),
|
|
149
158
|
}),
|
|
150
159
|
);
|
|
151
160
|
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Hexabot — Fair Core License (FCL-1.0-ALv2)
|
|
3
|
+
* Copyright (c) 2026 Hexastack.
|
|
4
|
+
* Full terms: see LICENSE.md.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { z } from "zod";
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
directionTypeSchema,
|
|
11
|
+
mcpServerTransportSchema,
|
|
12
|
+
memoryScopeSchema,
|
|
13
|
+
workflowTypeSchema,
|
|
14
|
+
} from "./domain";
|
|
15
|
+
import { workflowSchema } from "./workflow";
|
|
16
|
+
|
|
17
|
+
export const WORKFLOW_EXPORT_BUNDLE_KIND = "hexabot.workflow.bundle";
|
|
18
|
+
|
|
19
|
+
export const WORKFLOW_TRANSFER_RESOURCE_KIND_PATTERN =
|
|
20
|
+
/^[a-z][A-Za-z0-9]*(?:[._-][A-Za-z0-9]+)*$/;
|
|
21
|
+
|
|
22
|
+
export const workflowTransferResourceKindSchema = z
|
|
23
|
+
.string()
|
|
24
|
+
.min(1)
|
|
25
|
+
.regex(WORKFLOW_TRANSFER_RESOURCE_KIND_PATTERN);
|
|
26
|
+
|
|
27
|
+
const workflowExportBundleLayoutSchema = z.strictObject({
|
|
28
|
+
x: z.coerce.number(),
|
|
29
|
+
y: z.coerce.number(),
|
|
30
|
+
zoom: z.coerce.number(),
|
|
31
|
+
direction: directionTypeSchema,
|
|
32
|
+
});
|
|
33
|
+
const workflowExportBundleWorkflowSchema = z.strictObject({
|
|
34
|
+
exportId: z.string().min(1).optional(),
|
|
35
|
+
name: z.string().min(1),
|
|
36
|
+
description: z.string().nullable(),
|
|
37
|
+
type: workflowTypeSchema,
|
|
38
|
+
schedule: z.string().nullable(),
|
|
39
|
+
inputSchema: z.any(),
|
|
40
|
+
layout: workflowExportBundleLayoutSchema,
|
|
41
|
+
});
|
|
42
|
+
const workflowExportBundleVersionSchema = z.strictObject({
|
|
43
|
+
number: z.coerce.number(),
|
|
44
|
+
checksum: z.string(),
|
|
45
|
+
message: z.string().nullable(),
|
|
46
|
+
exportedVersionId: z.string().min(1),
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
export const workflowExportBundleMemoryDefinitionSchema = z.strictObject({
|
|
50
|
+
exportId: z.string().min(1),
|
|
51
|
+
name: z.string().min(1),
|
|
52
|
+
slug: z.string().min(1),
|
|
53
|
+
scope: memoryScopeSchema,
|
|
54
|
+
schema: z.any(),
|
|
55
|
+
ttlSeconds: z.coerce.number().nullable().optional(),
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const workflowExportBundleCredentialSchema = z.strictObject({
|
|
59
|
+
exportId: z.string().min(1),
|
|
60
|
+
name: z.string().min(1),
|
|
61
|
+
exportedOwnerId: z.string().optional(),
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export const workflowExportBundleMcpServerSchema = z.strictObject({
|
|
65
|
+
exportId: z.string().min(1),
|
|
66
|
+
name: z.string().min(1),
|
|
67
|
+
enabled: z.coerce.boolean(),
|
|
68
|
+
transport: mcpServerTransportSchema,
|
|
69
|
+
url: z.string().nullable(),
|
|
70
|
+
command: z.string().nullable(),
|
|
71
|
+
args: z.array(z.string()).nullable(),
|
|
72
|
+
cwd: z.string().nullable(),
|
|
73
|
+
credentialExportId: z.string().nullable().optional(),
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export const workflowExportBundleContentTypeSchema = z.strictObject({
|
|
77
|
+
exportId: z.string().min(1),
|
|
78
|
+
name: z.string().min(1),
|
|
79
|
+
schema: z.any(),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
export const workflowExportBundleLabelGroupSchema = z.strictObject({
|
|
83
|
+
exportId: z.string().min(1),
|
|
84
|
+
name: z.string().min(1),
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
export const workflowExportBundleLabelSchema = z.strictObject({
|
|
88
|
+
exportId: z.string().min(1),
|
|
89
|
+
title: z.string().min(1),
|
|
90
|
+
name: z.string().min(1),
|
|
91
|
+
description: z.string().nullable(),
|
|
92
|
+
groupExportId: z.string().nullable(),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
export const workflowExportBundleWorkflowDependencySchema = z.strictObject({
|
|
96
|
+
exportId: z.string().min(1),
|
|
97
|
+
workflow: workflowExportBundleWorkflowSchema.omit({ exportId: true }),
|
|
98
|
+
version: workflowExportBundleVersionSchema,
|
|
99
|
+
definitionYml: z.string().min(1),
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
const workflowExportBundleResourcesSchema = z
|
|
103
|
+
.object({
|
|
104
|
+
memoryDefinitions: z.array(workflowExportBundleMemoryDefinitionSchema),
|
|
105
|
+
mcpServers: z.array(workflowExportBundleMcpServerSchema),
|
|
106
|
+
credentials: z.array(workflowExportBundleCredentialSchema),
|
|
107
|
+
contentTypes: z.array(workflowExportBundleContentTypeSchema).default([]),
|
|
108
|
+
labelGroups: z.array(workflowExportBundleLabelGroupSchema).default([]),
|
|
109
|
+
labels: z.array(workflowExportBundleLabelSchema).default([]),
|
|
110
|
+
workflows: z
|
|
111
|
+
.array(workflowExportBundleWorkflowDependencySchema)
|
|
112
|
+
.default([]),
|
|
113
|
+
})
|
|
114
|
+
.catchall(z.array(z.unknown()));
|
|
115
|
+
|
|
116
|
+
export const workflowExportBundleV1Schema = z.strictObject({
|
|
117
|
+
kind: z.literal(WORKFLOW_EXPORT_BUNDLE_KIND),
|
|
118
|
+
schemaVersion: z.literal(1),
|
|
119
|
+
exportedAt: z.iso.datetime(),
|
|
120
|
+
workflow: workflowExportBundleWorkflowSchema,
|
|
121
|
+
version: workflowExportBundleVersionSchema,
|
|
122
|
+
definitionYml: z.string().min(1),
|
|
123
|
+
resources: workflowExportBundleResourcesSchema,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
export const workflowExportBundleSchema = workflowExportBundleV1Schema;
|
|
127
|
+
|
|
128
|
+
export const workflowImportResourceActionSchema = z.enum([
|
|
129
|
+
"created",
|
|
130
|
+
"reused",
|
|
131
|
+
"placeholder_created",
|
|
132
|
+
]);
|
|
133
|
+
|
|
134
|
+
export const workflowImportResourceResultSchema = z.strictObject({
|
|
135
|
+
kind: workflowTransferResourceKindSchema,
|
|
136
|
+
exportId: z.string().min(1),
|
|
137
|
+
localId: z.string().min(1),
|
|
138
|
+
name: z.string().min(1),
|
|
139
|
+
action: workflowImportResourceActionSchema,
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
export const workflowImportResultSchema = z.strictObject({
|
|
143
|
+
workflow: workflowSchema,
|
|
144
|
+
resources: z.array(workflowImportResourceResultSchema),
|
|
145
|
+
warnings: z.array(z.string()),
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
export type WorkflowExportBundleMemoryDefinition = z.infer<
|
|
149
|
+
typeof workflowExportBundleMemoryDefinitionSchema
|
|
150
|
+
>;
|
|
151
|
+
|
|
152
|
+
export type WorkflowExportBundleCredential = z.infer<
|
|
153
|
+
typeof workflowExportBundleCredentialSchema
|
|
154
|
+
>;
|
|
155
|
+
|
|
156
|
+
export type WorkflowExportBundleMcpServer = z.infer<
|
|
157
|
+
typeof workflowExportBundleMcpServerSchema
|
|
158
|
+
>;
|
|
159
|
+
|
|
160
|
+
export type WorkflowExportBundleContentType = z.infer<
|
|
161
|
+
typeof workflowExportBundleContentTypeSchema
|
|
162
|
+
>;
|
|
163
|
+
|
|
164
|
+
export type WorkflowExportBundleLabelGroup = z.infer<
|
|
165
|
+
typeof workflowExportBundleLabelGroupSchema
|
|
166
|
+
>;
|
|
167
|
+
|
|
168
|
+
export type WorkflowExportBundleLabel = z.infer<
|
|
169
|
+
typeof workflowExportBundleLabelSchema
|
|
170
|
+
>;
|
|
171
|
+
|
|
172
|
+
export type WorkflowExportBundleWorkflowDependency = z.infer<
|
|
173
|
+
typeof workflowExportBundleWorkflowDependencySchema
|
|
174
|
+
>;
|
|
175
|
+
|
|
176
|
+
export type WorkflowExportBundleV1 = z.infer<
|
|
177
|
+
typeof workflowExportBundleV1Schema
|
|
178
|
+
>;
|
|
179
|
+
|
|
180
|
+
export type WorkflowExportBundle = z.infer<typeof workflowExportBundleSchema>;
|
|
181
|
+
|
|
182
|
+
export type WorkflowImportResourceAction = z.infer<
|
|
183
|
+
typeof workflowImportResourceActionSchema
|
|
184
|
+
>;
|
|
185
|
+
|
|
186
|
+
export type WorkflowImportResourceResult = z.infer<
|
|
187
|
+
typeof workflowImportResourceResultSchema
|
|
188
|
+
>;
|
|
189
|
+
|
|
190
|
+
export type WorkflowImportResult = z.infer<typeof workflowImportResultSchema>;
|