@anchrd/intel-contract 0.2.0 → 0.2.1

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.
@@ -10,6 +10,12 @@ export declare const ProblemDetails: z.ZodObject<{
10
10
  code: z.ZodOptional<z.ZodString>;
11
11
  }, z.core.$strict>;
12
12
  export type ProblemDetails = z.infer<typeof ProblemDetails>;
13
+ export declare const SessionUser: z.ZodObject<{
14
+ id: z.ZodString;
15
+ email: z.ZodEmail;
16
+ name: z.ZodNullable<z.ZodString>;
17
+ }, z.core.$strict>;
18
+ export type SessionUser = z.infer<typeof SessionUser>;
13
19
  export declare const KnowledgeNodeKind: z.ZodEnum<{
14
20
  folder: "folder";
15
21
  document: "document";
@@ -769,6 +775,7 @@ export declare const FlowGraph: z.ZodObject<{
769
775
  export type FlowGraph = z.infer<typeof FlowGraph>;
770
776
  export declare const Flow: z.ZodObject<{
771
777
  id: z.ZodString;
778
+ parentId: z.ZodNullable<z.ZodString>;
772
779
  title: z.ZodString;
773
780
  description: z.ZodNullable<z.ZodString>;
774
781
  ownerId: z.ZodString;
@@ -899,6 +906,7 @@ export type FlowVersion = z.infer<typeof FlowVersion>;
899
906
  export declare const FlowDocument: z.ZodObject<{
900
907
  flow: z.ZodObject<{
901
908
  id: z.ZodString;
909
+ parentId: z.ZodNullable<z.ZodString>;
902
910
  title: z.ZodString;
903
911
  description: z.ZodNullable<z.ZodString>;
904
912
  ownerId: z.ZodString;
@@ -1029,6 +1037,7 @@ export type FlowDocument = z.infer<typeof FlowDocument>;
1029
1037
  export declare const FlowList: z.ZodObject<{
1030
1038
  items: z.ZodArray<z.ZodObject<{
1031
1039
  id: z.ZodString;
1040
+ parentId: z.ZodNullable<z.ZodString>;
1032
1041
  title: z.ZodString;
1033
1042
  description: z.ZodNullable<z.ZodString>;
1034
1043
  ownerId: z.ZodString;
@@ -1041,11 +1050,25 @@ export declare const FlowList: z.ZodObject<{
1041
1050
  }, z.core.$strict>;
1042
1051
  export type FlowList = z.infer<typeof FlowList>;
1043
1052
  export declare const CreateFlowInput: z.ZodObject<{
1053
+ parentId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1044
1054
  title: z.ZodString;
1045
1055
  description: z.ZodDefault<z.ZodNullable<z.ZodString>>;
1046
1056
  idempotencyKey: z.ZodString;
1047
1057
  }, z.core.$strict>;
1048
1058
  export type CreateFlowInput = z.infer<typeof CreateFlowInput>;
1059
+ export declare const UpdateFlowInput: z.ZodObject<{
1060
+ flowId: z.ZodString;
1061
+ baseUpdatedAt: z.ZodISODateTime;
1062
+ title: z.ZodOptional<z.ZodString>;
1063
+ description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1064
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1065
+ idempotencyKey: z.ZodString;
1066
+ }, z.core.$strict>;
1067
+ export type UpdateFlowInput = z.infer<typeof UpdateFlowInput>;
1068
+ export declare const ListFlowsInput: z.ZodObject<{
1069
+ parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1070
+ }, z.core.$strict>;
1071
+ export type ListFlowsInput = z.infer<typeof ListFlowsInput>;
1049
1072
  export declare const GetFlowInput: z.ZodObject<{
1050
1073
  flowId: z.ZodString;
1051
1074
  }, z.core.$strict>;
@@ -9,6 +9,13 @@ export const ProblemDetails = z.strictObject({
9
9
  instance: z.string().optional(),
10
10
  code: z.string().optional(),
11
11
  });
12
+ // Who the caller is, as Gate resolved it from the bearer. Deliberately identity only: no
13
+ // capabilities, no token, nothing a surface could mistake for a permission.
14
+ export const SessionUser = z.strictObject({
15
+ id: IntelId,
16
+ email: z.email(),
17
+ name: z.string().min(1).max(240).nullable(),
18
+ });
12
19
  export const KnowledgeNodeKind = z.enum(["folder", "document", "attachment"]);
13
20
  export const ContextPolicy = z.enum(["pinned", "relevant", "explicit"]);
14
21
  export const ResourceRole = z.enum(["viewer", "commenter", "editor", "manager"]);
@@ -343,6 +350,10 @@ export const FlowGraph = z.strictObject({
343
350
  });
344
351
  export const Flow = z.strictObject({
345
352
  id: IntelId,
353
+ // The one thing a Flow shares with a document: its place in the Knowledge folder tree (ADR-0004).
354
+ // Everything else stays apart — versions, R2 body and Vectorize belong to the document, the graph,
355
+ // runs and approvals to the flow. `null` is the root of that same tree.
356
+ parentId: IntelId.nullable(),
346
357
  title: z.string().min(1).max(240),
347
358
  description: z.string().max(2_000).nullable(),
348
359
  ownerId: IntelId,
@@ -366,10 +377,30 @@ export const FlowDocument = z.strictObject({
366
377
  });
367
378
  export const FlowList = z.strictObject({ items: z.array(Flow) });
368
379
  export const CreateFlowInput = z.strictObject({
380
+ parentId: IntelId.nullable().default(null),
369
381
  title: z.string().trim().min(1).max(240),
370
382
  description: z.string().trim().max(2_000).nullable().default(null),
371
383
  idempotencyKey: z.string().min(8).max(200),
372
384
  });
385
+ // Renaming and moving a flow. Both are organization and nothing else: they touch no version, no
386
+ // published graph and no run, because organization has to stay free of consequence or nobody dares
387
+ // to reorganize (ADR-0004).
388
+ export const UpdateFlowInput = z
389
+ .strictObject({
390
+ flowId: IntelId,
391
+ baseUpdatedAt: IsoDateTime,
392
+ title: z.string().trim().min(1).max(240).optional(),
393
+ description: z.string().trim().max(2_000).nullable().optional(),
394
+ parentId: IntelId.nullable().optional(),
395
+ idempotencyKey: z.string().min(8).max(200),
396
+ })
397
+ .refine((input) => input.title !== undefined || input.description !== undefined || input.parentId !== undefined, { error: "At least one change is required" });
398
+ // Three answers, not two: an absent `parentId` lists every visible flow (the search dialog asks
399
+ // that), `null` lists the root of the shared tree and an ID lists one folder (the sidebar tree asks
400
+ // per level, which is what keeps the tree off the N+1 it used to load with).
401
+ export const ListFlowsInput = z.strictObject({
402
+ parentId: IntelId.nullable().optional(),
403
+ });
373
404
  export const GetFlowInput = z.strictObject({ flowId: IntelId });
374
405
  export const SaveFlowVersionInput = z.strictObject({
375
406
  flowId: IntelId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anchrd/intel-contract",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {