@sixb/server 0.2.6 → 0.2.7

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.
Files changed (68) hide show
  1. package/dist/auth/run-token.d.ts.map +1 -1
  2. package/dist/index.js +75 -35
  3. package/dist/index.js.map +22 -22
  4. package/dist/routes/actions.d.ts +2 -0
  5. package/dist/routes/actions.d.ts.map +1 -1
  6. package/dist/routes/agent-approvals.d.ts +1 -1
  7. package/dist/routes/agents.d.ts +14 -14
  8. package/dist/routes/connectors.d.ts +2 -0
  9. package/dist/routes/connectors.d.ts.map +1 -1
  10. package/dist/routes/datasets.d.ts +2 -0
  11. package/dist/routes/datasets.d.ts.map +1 -1
  12. package/dist/routes/observed-agent-threads.d.ts +2 -2
  13. package/dist/routes/ontology.d.ts +2 -0
  14. package/dist/routes/ontology.d.ts.map +1 -1
  15. package/dist/routes/pipelines.d.ts +2 -0
  16. package/dist/routes/pipelines.d.ts.map +1 -1
  17. package/dist/routes/projections.d.ts +6 -0
  18. package/dist/routes/projections.d.ts.map +1 -1
  19. package/dist/routes/rules.d.ts +2 -0
  20. package/dist/routes/rules.d.ts.map +1 -1
  21. package/dist/routes/status.d.ts +1 -1
  22. package/dist/routes/syncs.d.ts +2 -0
  23. package/dist/routes/syncs.d.ts.map +1 -1
  24. package/dist/routes/workflows.d.ts +2 -0
  25. package/dist/routes/workflows.d.ts.map +1 -1
  26. package/dist/schemas/actions.d.ts +6 -0
  27. package/dist/schemas/actions.d.ts.map +1 -1
  28. package/dist/schemas/agents.d.ts +62 -62
  29. package/dist/schemas/common.d.ts +5 -0
  30. package/dist/schemas/common.d.ts.map +1 -1
  31. package/dist/schemas/connectors.d.ts +3 -0
  32. package/dist/schemas/connectors.d.ts.map +1 -1
  33. package/dist/schemas/datasets.d.ts +3 -0
  34. package/dist/schemas/datasets.d.ts.map +1 -1
  35. package/dist/schemas/ontology.d.ts +3 -0
  36. package/dist/schemas/ontology.d.ts.map +1 -1
  37. package/dist/schemas/pipelines.d.ts +3 -0
  38. package/dist/schemas/pipelines.d.ts.map +1 -1
  39. package/dist/schemas/projections.d.ts +33 -0
  40. package/dist/schemas/projections.d.ts.map +1 -1
  41. package/dist/schemas/rules.d.ts +3 -0
  42. package/dist/schemas/rules.d.ts.map +1 -1
  43. package/dist/schemas/status.d.ts +2 -2
  44. package/dist/schemas/syncs.d.ts +3 -0
  45. package/dist/schemas/syncs.d.ts.map +1 -1
  46. package/dist/schemas/workflows.d.ts +3 -0
  47. package/dist/schemas/workflows.d.ts.map +1 -1
  48. package/package.json +5 -5
  49. package/src/auth/run-token.ts +59 -9
  50. package/src/routes/actions.ts +7 -3
  51. package/src/routes/connectors.ts +1 -0
  52. package/src/routes/datasets.ts +11 -3
  53. package/src/routes/ontology.ts +17 -3
  54. package/src/routes/pipelines.ts +13 -3
  55. package/src/routes/projections.ts +14 -9
  56. package/src/routes/rules.ts +9 -3
  57. package/src/routes/syncs.ts +4 -0
  58. package/src/routes/workflows.ts +13 -3
  59. package/src/schemas/actions.ts +7 -1
  60. package/src/schemas/common.ts +9 -0
  61. package/src/schemas/connectors.ts +2 -1
  62. package/src/schemas/datasets.ts +2 -1
  63. package/src/schemas/ontology.ts +2 -0
  64. package/src/schemas/pipelines.ts +2 -1
  65. package/src/schemas/projections.ts +4 -1
  66. package/src/schemas/rules.ts +2 -0
  67. package/src/schemas/syncs.ts +2 -1
  68. package/src/schemas/workflows.ts +7 -1
@@ -70,10 +70,12 @@ function serializeSearch(
70
70
  function serializeObjectType(
71
71
  execution: Sixb,
72
72
  valueTypesById: ReadonlyMap<string, ValueType>,
73
- objectType: ReturnType<SixbHostView["definitions"]["ontology"]["listObjectTypes"]>[number]
73
+ objectType: ReturnType<SixbHostView["definitions"]["ontology"]["listObjectTypes"]>[number],
74
+ folder: string | undefined
74
75
  ) {
75
76
  return {
76
77
  id: objectType.id,
78
+ folder,
77
79
  name: objectType.name,
78
80
  description: objectType.description,
79
81
  extends: objectType.extends,
@@ -118,7 +120,14 @@ export function registerOntologyRoutes(app: Elysia, host: SixbHostView) {
118
120
  const valueTypesById = host.definitions.ontology.getValueTypesById()
119
121
  return sixb.objects
120
122
  .listTypes()
121
- .map((objectType) => serializeObjectType(sixb, valueTypesById, objectType))
123
+ .map((objectType) =>
124
+ serializeObjectType(
125
+ sixb,
126
+ valueTypesById,
127
+ objectType,
128
+ host.definitions.folders.objectTypes?.get(objectType.id)
129
+ )
130
+ )
122
131
  },
123
132
  {
124
133
  response: { 200: ObjectTypeSchema.array() },
@@ -141,7 +150,12 @@ export function registerOntologyRoutes(app: Elysia, host: SixbHostView) {
141
150
  return { error: "Object type not found" }
142
151
  }
143
152
 
144
- return serializeObjectType(sixb, host.definitions.ontology.getValueTypesById(), objectType)
153
+ return serializeObjectType(
154
+ sixb,
155
+ host.definitions.ontology.getValueTypesById(),
156
+ objectType,
157
+ host.definitions.folders.objectTypes?.get(objectType.id)
158
+ )
145
159
  },
146
160
  {
147
161
  params: ObjectTypeParamsSchema,
@@ -98,10 +98,12 @@ async function getLatestPipelineRuns(
98
98
 
99
99
  function serializePipeline(
100
100
  pipeline: PipelineDefinition,
101
- latestRun: SerializedPipelineRun | null
101
+ latestRun: SerializedPipelineRun | null,
102
+ folder: string | undefined
102
103
  ): ReturnType<typeof PipelineSchema.parse> {
103
104
  return PipelineSchema.parse({
104
105
  id: pipeline.id,
106
+ folder,
105
107
  triggers: pipeline.triggers,
106
108
  graph: {
107
109
  kind: pipeline.graph.kind,
@@ -136,7 +138,11 @@ export function registerPipelineRoutes(app: Elysia, host: SixbHostView) {
136
138
  )
137
139
 
138
140
  return pipelines.map((pipeline) =>
139
- serializePipeline(pipeline, latestRuns.get(pipeline.id) ?? null)
141
+ serializePipeline(
142
+ pipeline,
143
+ latestRuns.get(pipeline.id) ?? null,
144
+ host.definitions.folders.pipelines?.get(pipeline.id)
145
+ )
140
146
  )
141
147
  },
142
148
  {
@@ -160,7 +166,11 @@ export function registerPipelineRoutes(app: Elysia, host: SixbHostView) {
160
166
  return { error: "Pipeline not found" }
161
167
  }
162
168
 
163
- return serializePipeline(pipeline, await getLatestPipelineRun(sixb, pipeline.id))
169
+ return serializePipeline(
170
+ pipeline,
171
+ await getLatestPipelineRun(sixb, pipeline.id),
172
+ host.definitions.folders.pipelines?.get(pipeline.id)
173
+ )
164
174
  },
165
175
  {
166
176
  params: PipelineParamsSchema,
@@ -85,39 +85,44 @@ function projectionCatalogIds(catalog: ViewableProjectionCatalog): string[] {
85
85
  type SerializedProjection<TProjection extends ProjectionDefinition> =
86
86
  TProjection extends ObjectProjectionDefinition
87
87
  ? Omit<TProjection, "conflictResolution"> & {
88
+ folder: string | undefined
88
89
  conflictResolution: SourceEditConflictResolution
89
90
  latestRun: SerializedProjectionRun | null
90
91
  }
91
- : TProjection & { latestRun: SerializedProjectionRun | null }
92
+ : TProjection & { folder: string | undefined; latestRun: SerializedProjectionRun | null }
92
93
 
93
94
  function serializeProjection<TProjection extends ProjectionDefinition>(
94
95
  projection: TProjection,
95
- latestRuns: ReadonlyMap<string, SerializedProjectionRun>
96
+ latestRuns: ReadonlyMap<string, SerializedProjectionRun>,
97
+ folders: ReadonlyMap<string, string> | undefined
96
98
  ): SerializedProjection<TProjection> {
97
99
  const latestRun = latestRuns.get(projection.id) ?? null
100
+ const folder = folders?.get(projection.id)
98
101
  if (projection._tag === "ObjectProjectionDefinition") {
99
102
  return {
100
103
  ...projection,
104
+ folder,
101
105
  conflictResolution: projection.conflictResolution ?? { strategy: "editsWin" },
102
106
  latestRun,
103
107
  } as SerializedProjection<TProjection>
104
108
  }
105
- return { ...projection, latestRun } as SerializedProjection<TProjection>
109
+ return { ...projection, folder, latestRun } as SerializedProjection<TProjection>
106
110
  }
107
111
 
108
112
  function serializeProjectionCatalog(
109
113
  catalog: ViewableProjectionCatalog,
110
- latestRuns: ReadonlyMap<string, SerializedProjectionRun>
114
+ latestRuns: ReadonlyMap<string, SerializedProjectionRun>,
115
+ folders: ReadonlyMap<string, string> | undefined
111
116
  ) {
112
117
  return {
113
118
  objectProjections: catalog.objectProjections.map((projection) =>
114
- serializeProjection(projection, latestRuns)
119
+ serializeProjection(projection, latestRuns, folders)
115
120
  ),
116
121
  linkProjections: catalog.linkProjections.map((projection) =>
117
- serializeProjection(projection, latestRuns)
122
+ serializeProjection(projection, latestRuns, folders)
118
123
  ),
119
124
  telemetryProjections: catalog.telemetryProjections.map((projection) =>
120
- serializeProjection(projection, latestRuns)
125
+ serializeProjection(projection, latestRuns, folders)
121
126
  ),
122
127
  }
123
128
  }
@@ -130,7 +135,7 @@ export function registerProjectionRoutes(app: Elysia, host: SixbHostView) {
130
135
  const sixb = requireRequestSixb(context)
131
136
  const catalog = listViewableProjections(sixb)
132
137
  const latestRuns = await getLatestProjectionRuns(sixb, projectionCatalogIds(catalog))
133
- return serializeProjectionCatalog(catalog, latestRuns)
138
+ return serializeProjectionCatalog(catalog, latestRuns, host.definitions.folders.projections)
134
139
  },
135
140
  {
136
141
  response: { 200: ProjectionListResponseSchema },
@@ -153,7 +158,7 @@ export function registerProjectionRoutes(app: Elysia, host: SixbHostView) {
153
158
  }
154
159
 
155
160
  const latestRuns = await getLatestProjectionRuns(sixb, [found.id])
156
- return serializeProjection(found, latestRuns)
161
+ return serializeProjection(found, latestRuns, host.definitions.folders.projections)
157
162
  },
158
163
  {
159
164
  params: ProjectionParamsSchema,
@@ -14,9 +14,13 @@ import {
14
14
  } from "../schemas/rules"
15
15
  import { handleRouteError, parseOptionalInt, unconfiguredStorageResponse } from "../utils/http"
16
16
 
17
- function serializeRule(rule: RuleDefinition): ReturnType<typeof RuleSchema.parse> {
17
+ function serializeRule(
18
+ rule: RuleDefinition,
19
+ folder: string | undefined
20
+ ): ReturnType<typeof RuleSchema.parse> {
18
21
  return RuleSchema.parse({
19
22
  ...rule,
23
+ folder,
20
24
  dependencies: deriveRuleEventDependencies(rule),
21
25
  })
22
26
  }
@@ -30,7 +34,9 @@ export function registerRuleRoutes(app: Elysia, host: SixbHostView) {
30
34
  .get(
31
35
  "/api/rules",
32
36
  (context) => {
33
- return requireRequestSixb(context).rules.list().map(serializeRule)
37
+ return requireRequestSixb(context)
38
+ .rules.list()
39
+ .map((rule) => serializeRule(rule, host.definitions.folders.rules?.get(rule.id)))
34
40
  },
35
41
  {
36
42
  response: { 200: RuleSchema.array() },
@@ -51,7 +57,7 @@ export function registerRuleRoutes(app: Elysia, host: SixbHostView) {
51
57
  return { error: "Rule not found" }
52
58
  }
53
59
 
54
- return serializeRule(rule)
60
+ return serializeRule(rule, host.definitions.folders.rules?.get(rule.id))
55
61
  },
56
62
  {
57
63
  params: RuleParamsSchema,
@@ -137,10 +137,12 @@ export function summarizeSyncAccounts(syncId: string, accounts: readonly SyncAcc
137
137
  function serializeSync(
138
138
  sync: SyncDefinition,
139
139
  latestRun: SerializedSyncRun | null,
140
+ folder: string | undefined,
140
141
  accounts?: Awaited<ReturnType<typeof summarizeAccounts>>
141
142
  ): ReturnType<typeof SyncSchema.parse> {
142
143
  return SyncSchema.parse({
143
144
  id: sync.id,
145
+ folder,
144
146
  mode: sync.config.mode,
145
147
  connector: {
146
148
  id: sync.connector.id,
@@ -174,6 +176,7 @@ export function registerSyncRoutes(app: Elysia, host: SixbHostView) {
174
176
  serializeSync(
175
177
  sync,
176
178
  latestRuns.get(sync.id) ?? null,
179
+ host.definitions.folders.syncs?.get(sync.id),
177
180
  await summarizeAccounts(sync, accountsOf)
178
181
  )
179
182
  )
@@ -203,6 +206,7 @@ export function registerSyncRoutes(app: Elysia, host: SixbHostView) {
203
206
  return serializeSync(
204
207
  sync,
205
208
  await getLatestSyncRun(sixb, sync.id),
209
+ host.definitions.folders.syncs?.get(sync.id),
206
210
  await summarizeAccounts(sync, connectorAccounts(sixb))
207
211
  )
208
212
  },
@@ -346,10 +346,12 @@ async function getLatestWorkflowRuns(
346
346
 
347
347
  function serializeWorkflow(
348
348
  workflow: WorkflowDefinition,
349
- latestRun: SerializedWorkflowRun | null
349
+ latestRun: SerializedWorkflowRun | null,
350
+ folder: string | undefined
350
351
  ): ReturnType<typeof WorkflowSchema.parse> {
351
352
  return WorkflowSchema.parse({
352
353
  id: workflow.id,
354
+ folder,
353
355
  input: workflow.input,
354
356
  triggers: workflow.triggers,
355
357
  nodes: workflow.nodes.map((node) => {
@@ -568,7 +570,11 @@ export function registerWorkflowRoutes(app: Elysia, host: SixbHostView) {
568
570
  )
569
571
 
570
572
  return workflows.map((workflow) =>
571
- serializeWorkflow(workflow, latestRuns.get(workflow.id) ?? null)
573
+ serializeWorkflow(
574
+ workflow,
575
+ latestRuns.get(workflow.id) ?? null,
576
+ host.definitions.folders.workflows?.get(workflow.id)
577
+ )
572
578
  )
573
579
  },
574
580
  {
@@ -594,7 +600,11 @@ export function registerWorkflowRoutes(app: Elysia, host: SixbHostView) {
594
600
  return { error: "Workflow not found" }
595
601
  }
596
602
 
597
- return serializeWorkflow(workflow, await getLatestWorkflowRun(sixb, workflow.id))
603
+ return serializeWorkflow(
604
+ workflow,
605
+ await getLatestWorkflowRun(sixb, workflow.id),
606
+ host.definitions.folders.workflows?.get(workflow.id)
607
+ )
598
608
  },
599
609
  {
600
610
  params: WorkflowParamsSchema,
@@ -5,7 +5,12 @@ import {
5
5
  type ActionRunFailure,
6
6
  } from "@sixb/core/storage"
7
7
  import { z } from "zod"
8
- import { codedErrorResponseSchema, JsonValueSchema, sixbFailureSchema } from "./common"
8
+ import {
9
+ codedErrorResponseSchema,
10
+ DefinitionFolderSchema,
11
+ JsonValueSchema,
12
+ sixbFailureSchema,
13
+ } from "./common"
9
14
  import { ActionParamSchema } from "./ontology"
10
15
 
11
16
  export const ActionIdParamsSchema = z.object({
@@ -49,6 +54,7 @@ export const RuntimeStoppingResponseSchema = codedErrorResponseSchema(["runtime.
49
54
 
50
55
  export const ActionCatalogItemSchema = z.object({
51
56
  id: z.string(),
57
+ folder: DefinitionFolderSchema,
52
58
  name: z.string(),
53
59
  description: z.string().optional(),
54
60
  objectTypeId: z.string().optional(),
@@ -16,6 +16,15 @@ export function codedErrorResponseSchema<
16
16
  /** Values omitted because the caller lacks a clearance for their markings. */
17
17
  export const RedactionsSchema = z.record(z.object({ reason: z.literal("missing_clearance") }))
18
18
 
19
+ /**
20
+ * The folder a definition sits in below its directory, such as `raw/erp` for
21
+ * `datasets/raw/erp/orders.ts`. Absent at the top of the directory.
22
+ */
23
+ export const DefinitionFolderSchema = z
24
+ .string()
25
+ .optional()
26
+ .describe("Folder below the definition's directory, such as `raw/erp`; absent at its top.")
27
+
19
28
  export const SuccessResponseSchema = z.object({ success: z.boolean() })
20
29
 
21
30
  /** The canonical `Principal` shape from `@sixb/core`. */
@@ -3,7 +3,7 @@ import {
3
3
  type ConnectorConnectionRunFailure,
4
4
  } from "@sixb/core/storage"
5
5
  import { z } from "zod"
6
- import { ErrorResponseSchema, sixbFailureSchema } from "./common"
6
+ import { DefinitionFolderSchema, ErrorResponseSchema, sixbFailureSchema } from "./common"
7
7
 
8
8
  export const CONNECTOR_HTTP_ERROR_CODES = [
9
9
  "internal.unexpected",
@@ -71,6 +71,7 @@ export const ConnectorWebhookSchema = z.object({
71
71
 
72
72
  export const ConnectorSchema = z.object({
73
73
  id: z.string(),
74
+ folder: DefinitionFolderSchema,
74
75
  type: z.string(),
75
76
  connection: z.object({ authentication: z.literal("oauth2") }).nullable(),
76
77
  syncIds: z.array(z.string()),
@@ -1,5 +1,5 @@
1
1
  import { z } from "zod"
2
- import { RedactionsSchema } from "./common"
2
+ import { DefinitionFolderSchema, RedactionsSchema } from "./common"
3
3
 
4
4
  export const DatasetParamsSchema = z.object({
5
5
  datasetId: z.string().min(1),
@@ -111,6 +111,7 @@ export const DatasetLatestVersionSummarySchema = z.object({
111
111
 
112
112
  export const DatasetCatalogItemSchema = DatasetDefinitionSchema.extend({
113
113
  kind: z.literal("dataset"),
114
+ folder: DefinitionFolderSchema,
114
115
  materialized: z.boolean(),
115
116
  latestVersion: DatasetLatestVersionSummarySchema.nullable(),
116
117
  syncIds: z.array(z.string()),
@@ -1,4 +1,5 @@
1
1
  import { z } from "zod"
2
+ import { DefinitionFolderSchema } from "./common"
2
3
 
3
4
  export const ObjectTypeParamsSchema = z.object({ objectTypeId: z.string().min(1) })
4
5
 
@@ -69,6 +70,7 @@ export const ActionSchema = z.object({
69
70
 
70
71
  export const ObjectTypeSchema = z.object({
71
72
  id: z.string(),
73
+ folder: DefinitionFolderSchema,
72
74
  name: z.string(),
73
75
  description: z.string().optional(),
74
76
  extends: z.string().optional(),
@@ -4,7 +4,7 @@ import {
4
4
  type SixbFailure,
5
5
  } from "@sixb/core/storage"
6
6
  import { z } from "zod"
7
- import { sixbFailureSchema } from "./common"
7
+ import { DefinitionFolderSchema, sixbFailureSchema } from "./common"
8
8
  import { DatasetDefinitionSchema } from "./datasets"
9
9
 
10
10
  const PipelineRunFailureSchema: z.ZodType<SixbFailure<PipelineRunFailureCode>> = sixbFailureSchema(
@@ -104,6 +104,7 @@ export const PipelineStepSchema = z.object({
104
104
 
105
105
  export const PipelineSchema = z.object({
106
106
  id: z.string(),
107
+ folder: DefinitionFolderSchema,
107
108
  triggers: z.array(PipelineTriggerSchema),
108
109
  graph: z.object({
109
110
  kind: z.literal("sequence"),
@@ -1,7 +1,7 @@
1
1
  import type { SixbFailure } from "@sixb/core"
2
2
  import { PROJECTION_RUN_FAILURE_CODES, type ProjectionRunFailureCode } from "@sixb/core/storage"
3
3
  import { z } from "zod"
4
- import { sixbFailureSchema } from "./common"
4
+ import { DefinitionFolderSchema, sixbFailureSchema } from "./common"
5
5
 
6
6
  const ProjectionRunFailureSchema: z.ZodType<SixbFailure<ProjectionRunFailureCode>> =
7
7
  sixbFailureSchema(PROJECTION_RUN_FAILURE_CODES)
@@ -93,6 +93,7 @@ export const SourceEditConflictResolutionSchema = z.union([
93
93
  export const ObjectProjectionSchema = z.object({
94
94
  _tag: z.literal("ObjectProjectionDefinition"),
95
95
  id: z.string(),
96
+ folder: DefinitionFolderSchema,
96
97
  objectTypeId: z.string(),
97
98
  datasetId: z.string(),
98
99
  properties: z.record(z.string()),
@@ -107,6 +108,7 @@ export const ObjectProjectionSchema = z.object({
107
108
  export const LinkProjectionSchema = z.object({
108
109
  _tag: z.literal("LinkProjectionDefinition"),
109
110
  id: z.string(),
111
+ folder: DefinitionFolderSchema,
110
112
  linkId: z.string(),
111
113
  sourceObjectTypeId: z.string(),
112
114
  targetObjectTypeId: z.string(),
@@ -119,6 +121,7 @@ export const LinkProjectionSchema = z.object({
119
121
  export const TelemetryProjectionSchema = z.object({
120
122
  _tag: z.literal("TelemetryProjectionDefinition"),
121
123
  id: z.string(),
124
+ folder: DefinitionFolderSchema,
122
125
  objectTypeId: z.string(),
123
126
  datasetId: z.string(),
124
127
  objectIdField: z.string(),
@@ -1,5 +1,6 @@
1
1
  import type { RulePredicate } from "@sixb/core"
2
2
  import { z } from "zod"
3
+ import { DefinitionFolderSchema } from "./common"
3
4
 
4
5
  export const RuleParamsSchema = z.object({
5
6
  ruleId: z.string().min(1),
@@ -79,6 +80,7 @@ const RuleEventDependencySchema = z.union([
79
80
  export const RuleSchema = z.object({
80
81
  kind: z.literal("rule"),
81
82
  id: z.string(),
83
+ folder: DefinitionFolderSchema,
82
84
  subject: RuleSubjectSchema,
83
85
  predicate: RulePredicateSchema,
84
86
  dependencies: z.array(RuleEventDependencySchema),
@@ -4,7 +4,7 @@ import {
4
4
  type SyncRunFailureCode,
5
5
  } from "@sixb/core/storage"
6
6
  import { z } from "zod"
7
- import { sixbFailureSchema } from "./common"
7
+ import { DefinitionFolderSchema, sixbFailureSchema } from "./common"
8
8
  import { DatasetDefinitionSchema } from "./datasets"
9
9
 
10
10
  const SyncRunFailureSchema: z.ZodType<SixbFailure<SyncRunFailureCode>> =
@@ -108,6 +108,7 @@ const SyncAccountSummarySchema = z.object({
108
108
 
109
109
  export const SyncSchema = z.object({
110
110
  id: z.string(),
111
+ folder: DefinitionFolderSchema,
111
112
  mode: SyncModeSchema,
112
113
  connector: z.object({
113
114
  id: z.string(),
@@ -7,7 +7,12 @@ import { z } from "zod"
7
7
  import { AgentMessagePartSchema, AgentRunFailureSchema } from "./agents"
8
8
  import { AiCostSummarySchema } from "./ai-accounting"
9
9
  import { AiUsageSummarySchema } from "./ai-usage"
10
- import { JsonValueSchema, PrincipalSchema, sixbFailureSchema } from "./common"
10
+ import {
11
+ DefinitionFolderSchema,
12
+ JsonValueSchema,
13
+ PrincipalSchema,
14
+ sixbFailureSchema,
15
+ } from "./common"
11
16
 
12
17
  export const WorkflowIOSnapshotSchema = z.record(JsonValueSchema)
13
18
 
@@ -204,6 +209,7 @@ export const WorkflowInterventionSchema = z.object({
204
209
 
205
210
  export const WorkflowSchema = z.object({
206
211
  id: z.string(),
212
+ folder: DefinitionFolderSchema,
207
213
  input: WorkflowIOSnapshotSchema,
208
214
  triggers: z.array(WorkflowTriggerSchema),
209
215
  nodes: z.array(WorkflowNodeSchema),