@anchrd/intel-contract 0.28.0 → 0.29.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.
@@ -5,10 +5,26 @@ export declare const FeedAction: z.ZodEnum<{
5
5
  "node.update": "node.update";
6
6
  "node.append": "node.append";
7
7
  "node.archive": "node.archive";
8
+ "node.purge": "node.purge";
8
9
  "node.share": "node.share";
9
10
  "node.revoke": "node.revoke";
11
+ "flows.create": "flows.create";
12
+ "flows.save": "flows.save";
13
+ "flows.update": "flows.update";
14
+ "flows.publish": "flows.publish";
15
+ "flows.unpublish": "flows.unpublish";
16
+ "flows.archive": "flows.archive";
17
+ "flows.share": "flows.share";
18
+ "flows.revoke": "flows.revoke";
19
+ "flows.purge": "flows.purge";
10
20
  }>;
11
21
  export type FeedAction = z.infer<typeof FeedAction>;
22
+ /**
23
+ * What an entry is about. Derived from the action rather than carried separately: the two can then
24
+ * never disagree, and a reader that has to draw a flow differently from a document does not depend
25
+ * on a second field being filled in correctly.
26
+ */
27
+ export declare function feedKindOf(action: FeedAction): "node" | "flow";
12
28
  export declare const FeedPathSegment: z.ZodObject<{
13
29
  id: z.ZodString;
14
30
  title: z.ZodString;
@@ -23,11 +39,21 @@ export declare const FeedEvent: z.ZodObject<{
23
39
  "node.update": "node.update";
24
40
  "node.append": "node.append";
25
41
  "node.archive": "node.archive";
42
+ "node.purge": "node.purge";
26
43
  "node.share": "node.share";
27
44
  "node.revoke": "node.revoke";
45
+ "flows.create": "flows.create";
46
+ "flows.save": "flows.save";
47
+ "flows.update": "flows.update";
48
+ "flows.publish": "flows.publish";
49
+ "flows.unpublish": "flows.unpublish";
50
+ "flows.archive": "flows.archive";
51
+ "flows.share": "flows.share";
52
+ "flows.revoke": "flows.revoke";
53
+ "flows.purge": "flows.purge";
28
54
  }>;
29
- nodeId: z.ZodString;
30
- nodeTitle: z.ZodString;
55
+ resourceId: z.ZodString;
56
+ resourceTitle: z.ZodString;
31
57
  path: z.ZodArray<z.ZodObject<{
32
58
  id: z.ZodString;
33
59
  title: z.ZodString;
@@ -53,11 +79,21 @@ export declare const FeedListResponse: z.ZodObject<{
53
79
  "node.update": "node.update";
54
80
  "node.append": "node.append";
55
81
  "node.archive": "node.archive";
82
+ "node.purge": "node.purge";
56
83
  "node.share": "node.share";
57
84
  "node.revoke": "node.revoke";
85
+ "flows.create": "flows.create";
86
+ "flows.save": "flows.save";
87
+ "flows.update": "flows.update";
88
+ "flows.publish": "flows.publish";
89
+ "flows.unpublish": "flows.unpublish";
90
+ "flows.archive": "flows.archive";
91
+ "flows.share": "flows.share";
92
+ "flows.revoke": "flows.revoke";
93
+ "flows.purge": "flows.purge";
58
94
  }>;
59
- nodeId: z.ZodString;
60
- nodeTitle: z.ZodString;
95
+ resourceId: z.ZodString;
96
+ resourceTitle: z.ZodString;
61
97
  path: z.ZodArray<z.ZodObject<{
62
98
  id: z.ZodString;
63
99
  title: z.ZodString;
@@ -16,9 +16,45 @@ export const FeedAction = z.enum([
16
16
  "node.update",
17
17
  "node.append",
18
18
  "node.archive",
19
+ // ⚠️ The one event whose node no longer exists when it is read. Its visibility runs over the
20
+ // surviving folder, from `parentId` in the metadata, and its title comes from there too — the row
21
+ // it would have been read from is gone (#645).
22
+ "node.purge",
19
23
  "node.share",
20
24
  "node.revoke",
25
+ // The flow half (#763). Twelve kinds are written; these are the ones a person did rather than a
26
+ // machine bookkeeping step.
27
+ //
28
+ // ⚠️ The three run kinds — `flows.run`, `flows.complete`, `flows.cancel` — are NOT here, and the
29
+ // reason is not that the list refuses them: they are written against `resource_type = 'flow-run'`
30
+ // with the RUN's id, which is a third kind this query does not read at all. Admitting them here
31
+ // would change nothing on the surface and quietly suggest they had been considered.
32
+ //
33
+ // They need their own everything — a third visibility walk (run → flow → folder), a title read
34
+ // from the flow rather than the run, a third link target — and one decision first: an agent
35
+ // writes three of them per run, so without any summarising a busy morning buries every human
36
+ // entry under identical cards. That is #767, and it is a real question rather than a leftover.
37
+ "flows.create",
38
+ "flows.save",
39
+ "flows.update",
40
+ "flows.publish",
41
+ "flows.unpublish",
42
+ "flows.archive",
43
+ "flows.share",
44
+ "flows.revoke",
45
+ // ⚠️ The flow-side twin of `node.purge`, and it carries the same two consequences: its row is
46
+ // gone when the card is read, so both its visibility and its title come from the metadata of the
47
+ // event itself (#763, D73).
48
+ "flows.purge",
21
49
  ]);
50
+ /**
51
+ * What an entry is about. Derived from the action rather than carried separately: the two can then
52
+ * never disagree, and a reader that has to draw a flow differently from a document does not depend
53
+ * on a second field being filled in correctly.
54
+ */
55
+ export function feedKindOf(action) {
56
+ return action.startsWith("flows.") ? "flow" : "node";
57
+ }
22
58
  // One step on the way down to the node, from the root. It carries the id as well as the title
23
59
  // because the surface links each step, and two folders may share a name.
24
60
  export const FeedPathSegment = z.strictObject({
@@ -27,10 +63,14 @@ export const FeedPathSegment = z.strictObject({
27
63
  });
28
64
  // One card's worth of journal.
29
65
  //
30
- // ⚠️ `nodeTitle` and `path` are read from `nodes` at query time, so they are TODAY's title and
31
- // today's place — not the ones the node had when the event happened. That is the right answer for a
32
- // feed (the reader wants to find the thing now) and the wrong one for an audit trail, which is one
33
- // more reason these are two doors and not one.
66
+ // ⚠️ `resourceTitle` and `path` are read from `nodes` or `flows` at query time, so they are TODAY's
67
+ // title and today's place — not the ones the thing had when the event happened. That is the right
68
+ // answer for a feed (the reader wants to find it now) and the wrong one for an audit trail, which is
69
+ // one more reason these are two doors and not one.
70
+ //
71
+ // ⚠️ The fields say `resource` and not `node` because half of them are not nodes (#763). Which half
72
+ // is answered by `feedKindOf(action)` and by nothing on the card — a second field saying "flow"
73
+ // beside an action that already says `flows.publish` is a second truth, and two truths disagree.
34
74
  //
35
75
  // `metadata` is whatever the write site recorded, untyped on purpose: a schema per action would
36
76
  // have to be kept in step with eleven write sites and would go stale in silence. What the surface
@@ -40,8 +80,8 @@ export const FeedEvent = z.strictObject({
40
80
  id: IntelId,
41
81
  actorId: z.string().min(1),
42
82
  action: FeedAction,
43
- nodeId: IntelId,
44
- nodeTitle: z.string().min(1),
83
+ resourceId: IntelId,
84
+ resourceTitle: z.string().min(1),
45
85
  path: z.array(FeedPathSegment),
46
86
  metadata: z.record(z.string(), z.unknown()),
47
87
  occurredAt: IsoDateTime,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anchrd/intel-contract",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "type": "module",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {