@boboddy/sdk 0.5.0 → 0.5.2

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.
@@ -1,3 +1,4 @@
1
+ import { z } from "zod";
1
2
  import type { ZodObject, ZodRawShape } from "zod";
2
3
  type FeatureSignalSpec = {
3
4
  key: string;
@@ -17,24 +18,69 @@ export type AnyStepFeature = StepFeature;
17
18
  type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
18
19
  export type FeatureResultExtensions<TFeatures extends readonly AnyStepFeature[]> = [TFeatures[number]] extends [never] ? Record<never, never> : UnionToIntersection<TFeatures[number] extends StepFeature<infer R> ? R : never>;
19
20
  export type FeatureSignalKeys<TFeatures extends readonly AnyStepFeature[]> = NonNullable<TFeatures[number]["__signalKeys"]>;
20
- export type NotificationKind = "feedback_request" | "status_update" | "blocked" | "result_ready" | "warning";
21
- export type NotificationPriority = "low" | "normal" | "high" | "urgent";
22
- export type NotificationChannel = "in_app" | "work_item_platform_comment" | "email" | "slack";
21
+ declare const notificationKindSchema: z.ZodEnum<{
22
+ blocked: "blocked";
23
+ feedback_request: "feedback_request";
24
+ status_update: "status_update";
25
+ result_ready: "result_ready";
26
+ warning: "warning";
27
+ }>;
28
+ export type NotificationKind = z.infer<typeof notificationKindSchema>;
29
+ declare const notificationPrioritySchema: z.ZodEnum<{
30
+ high: "high";
31
+ low: "low";
32
+ normal: "normal";
33
+ urgent: "urgent";
34
+ }>;
35
+ export type NotificationPriority = z.infer<typeof notificationPrioritySchema>;
36
+ declare const notificationChannelSchema: z.ZodEnum<{
37
+ in_app: "in_app";
38
+ work_item_platform_comment: "work_item_platform_comment";
39
+ email: "email";
40
+ slack: "slack";
41
+ }>;
42
+ export type NotificationChannel = z.infer<typeof notificationChannelSchema>;
23
43
  export type FeedbackRequestUrgency = "blocking" | "clarification" | "assumption" | "informational";
24
- export type NotificationItem = {
25
- kind: NotificationKind;
26
- title: string;
27
- body: string;
28
- priority: NotificationPriority;
29
- suggestedChannels?: NotificationChannel[];
30
- /**
31
- * Kind-specific structured payload. For `feedback_request`:
32
- * `{ category, urgency, suggestedKey? }`.
33
- */
34
- payload?: Record<string, unknown>;
35
- };
36
44
  declare const NOTIFICATION_SIGNAL_KEY: "$boboddy_notifications_v1";
37
45
  declare const NOTIFICATION_RESULT_KEY: "$boboddy_notifications_v1";
46
+ declare const notificationItemSchema: z.ZodObject<{
47
+ kind: z.ZodEnum<{
48
+ blocked: "blocked";
49
+ feedback_request: "feedback_request";
50
+ status_update: "status_update";
51
+ result_ready: "result_ready";
52
+ warning: "warning";
53
+ }>;
54
+ title: z.ZodString;
55
+ body: z.ZodString;
56
+ priority: z.ZodEnum<{
57
+ high: "high";
58
+ low: "low";
59
+ normal: "normal";
60
+ urgent: "urgent";
61
+ }>;
62
+ suggestedChannels: z.ZodOptional<z.ZodArray<z.ZodEnum<{
63
+ in_app: "in_app";
64
+ work_item_platform_comment: "work_item_platform_comment";
65
+ email: "email";
66
+ slack: "slack";
67
+ }>>>;
68
+ payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
69
+ }, z.core.$strip>;
70
+ /** A single notification. Inferred from `notificationItemSchema` — the
71
+ * schema is the source of truth; this type can never drift from what's
72
+ * actually validated and pushed as JSON Schema. */
73
+ export type NotificationItem = z.infer<typeof notificationItemSchema>;
74
+ /**
75
+ * The shape `Notify.*` returns: a step result fragment carrying one or more
76
+ * notifications. Spread it into a larger result object, or return it
77
+ * directly if the notification *is* the step's whole result — either way it
78
+ * slots into the same `$boboddy_notifications_v1` field `Features.notifications()`
79
+ * wires a signal extractor for.
80
+ */
81
+ export type NotificationResultFragment = {
82
+ readonly [NOTIFICATION_RESULT_KEY]: NotificationItem[];
83
+ };
38
84
  type NotificationsFeature = StepFeature<{
39
85
  [NOTIFICATION_RESULT_KEY]?: NotificationItem[];
40
86
  }, typeof NOTIFICATION_SIGNAL_KEY>;
@@ -45,23 +91,38 @@ export type FeedbackRequestItem = {
45
91
  suggestedKey?: string;
46
92
  };
47
93
  export declare const Features: {
48
- readonly notifications: (() => NotificationsFeature) & {
49
- signal: {
50
- key: "$boboddy_notifications_v1";
51
- find(signals: Array<{
52
- key: string;
53
- valueJson: unknown;
54
- }>): NotificationItem[] | undefined;
55
- };
56
- };
94
+ readonly notifications: () => NotificationsFeature;
57
95
  /**
58
- * Convenience wrapper that emits `feedback_request` notifications.
59
- * Backed by the same `$boboddy_notifications_v1` signal.
96
+ * A real specialization of `notifications()`, not an alias: narrows every
97
+ * emitted item to `kind: "feedback_request"` and swaps in a
98
+ * feedback-request-specific prompt section. Backed by the same
99
+ * `$boboddy_notifications_v1` signal.
60
100
  */
61
- readonly feedbackRequests: (() => NotificationsFeature) & {
62
- signal: {
63
- key: "$boboddy_notifications_v1";
64
- };
65
- };
101
+ readonly feedbackRequests: () => NotificationsFeature;
102
+ };
103
+ export declare const NotificationSignal: {
104
+ readonly key: "$boboddy_notifications_v1";
105
+ readonly find: (signals: Array<{
106
+ key: string;
107
+ valueJson: unknown;
108
+ }>) => NotificationItem[] | undefined;
109
+ };
110
+ export declare const Notify: {
111
+ /** The one generic constructor. Field names match `NotificationItem`
112
+ * exactly, so a new optional field never forces a call-site rewrite. */
113
+ readonly create: (item: NotificationItem) => NotificationResultFragment;
114
+ /** Build a notification for the in-app inbox — the one channel the
115
+ * platform always delivers, so it's the safest default when the caller
116
+ * doesn't need a specific channel. */
117
+ readonly inApp: (title: string, body: string, priority: NotificationPriority, options?: {
118
+ kind?: NotificationKind;
119
+ payload?: Record<string, unknown>;
120
+ }) => NotificationResultFragment;
121
+ /** Build a `kind: "feedback_request"` notification — the value-builder
122
+ * counterpart to `Features.feedbackRequests()`. */
123
+ readonly feedbackRequest: (question: string, category: string, urgency: FeedbackRequestUrgency, suggestedKey?: string) => NotificationResultFragment;
124
+ /** Combine several notification result fragments (e.g. more than one
125
+ * `Notify.*` call) into a single result value. */
126
+ readonly merge: (...fragments: NotificationResultFragment[]) => NotificationResultFragment;
66
127
  };
67
128
  export {};
@@ -1,2 +1,4 @@
1
1
  export * from "./json-schema-paths";
2
2
  export * from "./validate-definition-specs";
3
+ export * from "./validate-input-bindings";
4
+ export * from "./validation-issue";