@boboddy/sdk 0.1.9-alpha → 0.1.10-alpha

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.
@@ -51,7 +51,12 @@ export declare const Computed: {
51
51
  */
52
52
  export type ConditionOperator = "equal" | "notEqual" | "lessThan" | "lessThanInclusive" | "greaterThan" | "greaterThanInclusive" | "in" | "notIn" | "contains" | "doesNotContain";
53
53
  /** All possible outcomes a step can resolve to after policy evaluation. */
54
- export type AdvancementEventType = "continue" | "block" | "needs_review" | "complete";
54
+ export type AdvancementEventType = "continue" | "block" | "route" | "complete";
55
+ export type RouteOutcome = {
56
+ outcome: "route";
57
+ pipelineKey: string;
58
+ inputJson?: Record<string, unknown> | null;
59
+ };
55
60
  /**
56
61
  * The outcome emitted when a rule fires (or when no rules match and
57
62
  * `defaultOutcome` is used).
@@ -59,14 +64,10 @@ export type AdvancementEventType = "continue" | "block" | "needs_review" | "comp
59
64
  * Shorthand — use when no extra params are needed:
60
65
  * "continue"
61
66
  *
62
- * Object form use when the outcome carries additional context the runtime
63
- * or downstream steps should receive:
64
- * { outcome: "needs_review", outcomeJson: { reason: "low confidence" } }
67
+ * Route to another pipeline:
68
+ * { outcome: "route", pipelineKey: "other-pipeline" }
65
69
  */
66
- export type AdvancementOutcome = AdvancementEventType | {
67
- outcome: AdvancementEventType;
68
- outcomeJson?: Record<string, unknown> | null;
69
- };
70
+ export type AdvancementOutcome = Exclude<AdvancementEventType, "route"> | RouteOutcome;
70
71
  /**
71
72
  * A leaf condition that checks a single signal value against a given operator
72
73
  * and value. Used directly inside `Rule.all()` / `Rule.any()`, or implicitly
@@ -63,7 +63,13 @@ function resolveOutcome(outcome) {
63
63
  if (typeof outcome === "string") {
64
64
  return { type: outcome, params: null };
65
65
  }
66
- return { type: outcome.outcome, params: outcome.outcomeJson ?? null };
66
+ return {
67
+ type: "route",
68
+ params: {
69
+ pipelineKey: outcome.pipelineKey,
70
+ ...outcome.inputJson != null ? { inputJson: outcome.inputJson } : {}
71
+ }
72
+ };
67
73
  }
68
74
  function serializeCondition(condition) {
69
75
  if (condition._tag === "signal") {
@@ -63,7 +63,13 @@ function resolveOutcome(outcome) {
63
63
  if (typeof outcome === "string") {
64
64
  return { type: outcome, params: null };
65
65
  }
66
- return { type: outcome.outcome, params: outcome.outcomeJson ?? null };
66
+ return {
67
+ type: "route",
68
+ params: {
69
+ pipelineKey: outcome.pipelineKey,
70
+ ...outcome.inputJson != null ? { inputJson: outcome.inputJson } : {}
71
+ }
72
+ };
67
73
  }
68
74
  function serializeCondition(condition) {
69
75
  if (condition._tag === "signal") {
@@ -15685,28 +15685,43 @@ function date4(params) {
15685
15685
  config(en_default());
15686
15686
  // src/definitions/steps/step-features.ts
15687
15687
  var FEEDBACK_REQUEST_SIGNAL_KEY = "$boboddy_feedback_request_v1";
15688
+ var FEEDBACK_REQUEST_RESULT_KEY = "$boboddy_feedbackRequests_v1";
15688
15689
  var feedbackRequestItemSchema = exports_external.object({
15689
- question: exports_external.string(),
15690
- category: exports_external.string(),
15691
- suggestedKey: exports_external.string().optional()
15692
- });
15690
+ question: exports_external.string().describe("The specific question to pose to a human reviewer."),
15691
+ category: exports_external.string().describe('A grouping label for the feedback (e.g. "accuracy", "completeness").'),
15692
+ urgency: exports_external.enum(["blocking", "clarification", "assumption", "informational"]).describe([
15693
+ "How urgently a human response is needed:",
15694
+ '- "blocking": cannot proceed at all without an answer.',
15695
+ '- "clarification": genuinely ambiguous — unsure how to interpret, but not fully blocked.',
15696
+ '- "assumption": proceeded with a guess; please verify the assumption.',
15697
+ '- "informational": FYI only — agent proceeded fine and no reply is required.'
15698
+ ].join(`
15699
+ `)),
15700
+ suggestedKey: exports_external.string().optional().describe("An optional suggested answer key for reference.")
15701
+ }).describe("A single feedback request item for human review.");
15693
15702
  var feedbackRequestsFeature = {
15694
15703
  _resultExtension: exports_external.object({
15695
- feedbackRequests: exports_external.array(feedbackRequestItemSchema).optional()
15704
+ [FEEDBACK_REQUEST_RESULT_KEY]: exports_external.array(feedbackRequestItemSchema).optional()
15696
15705
  }),
15697
15706
  _promptAddition: [
15698
15707
  "## Feedback Requests",
15699
15708
  "",
15700
- "If you encounter anything that warrants human review, populate the `feedbackRequests` array:",
15701
- "- **question**: The specific question to pose to a human reviewer",
15702
- '- **category**: A grouping label for the feedback (e.g. `"accuracy"`, `"completeness"`)',
15703
- "- **suggestedKey** *(optional)*: A suggested answer key for reference"
15709
+ `If you encounter anything that warrants human review, populate the \`${FEEDBACK_REQUEST_RESULT_KEY}\` array.`,
15710
+ "Each item must include:",
15711
+ "- **question**: The specific question to pose to a human reviewer.",
15712
+ '- **category**: A grouping label for the feedback (e.g. `"accuracy"`, `"completeness"`).',
15713
+ "- **urgency**: How urgently a human response is needed. Must be one of:",
15714
+ ' - `"blocking"`: Cannot proceed at all without an answer.',
15715
+ ' - `"clarification"`: Genuinely ambiguous — unsure how to interpret, but not fully blocked.',
15716
+ ' - `"assumption"`: Proceeded with a guess; please verify the assumption.',
15717
+ ' - `"informational"`: FYI only — agent proceeded fine and no reply is required.',
15718
+ "- **suggestedKey** *(optional)*: A suggested answer key for reference."
15704
15719
  ].join(`
15705
15720
  `),
15706
15721
  _signals: [
15707
15722
  {
15708
15723
  key: FEEDBACK_REQUEST_SIGNAL_KEY,
15709
- sourcePath: "feedbackRequests",
15724
+ sourcePath: FEEDBACK_REQUEST_RESULT_KEY,
15710
15725
  type: "array",
15711
15726
  required: false
15712
15727
  }
@@ -15,18 +15,19 @@ export type StepFeature<TResultExtension extends Record<string, unknown> = Recor
15
15
  };
16
16
  export type AnyStepFeature = StepFeature<Record<string, unknown>, string>;
17
17
  type UnionToIntersection<U> = (U extends unknown ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
18
- export type FeatureResultExtensions<TFeatures extends readonly AnyStepFeature[]> = [
19
- TFeatures[number]
20
- ] extends [never] ? Record<never, never> : UnionToIntersection<TFeatures[number] extends StepFeature<infer R, string> ? R : never>;
18
+ export type FeatureResultExtensions<TFeatures extends readonly AnyStepFeature[]> = [TFeatures[number]] extends [never] ? Record<never, never> : UnionToIntersection<TFeatures[number] extends StepFeature<infer R, string> ? R : never>;
21
19
  export type FeatureSignalKeys<TFeatures extends readonly AnyStepFeature[]> = TFeatures[number] extends StepFeature<Record<string, unknown>, infer K> ? K : never;
20
+ export type FeedbackRequestUrgency = "blocking" | "clarification" | "assumption" | "informational";
22
21
  export type FeedbackRequestItem = {
23
22
  question: string;
24
23
  category: string;
24
+ urgency: FeedbackRequestUrgency;
25
25
  suggestedKey?: string;
26
26
  };
27
27
  declare const FEEDBACK_REQUEST_SIGNAL_KEY: "$boboddy_feedback_request_v1";
28
+ declare const FEEDBACK_REQUEST_RESULT_KEY: "$boboddy_feedbackRequests_v1";
28
29
  type FeedbackRequestsFeature = StepFeature<{
29
- feedbackRequests?: FeedbackRequestItem[];
30
+ [FEEDBACK_REQUEST_RESULT_KEY]?: FeedbackRequestItem[];
30
31
  }, typeof FEEDBACK_REQUEST_SIGNAL_KEY>;
31
32
  export declare const Features: {
32
33
  readonly feedbackRequests: (() => FeedbackRequestsFeature) & {
package/dist/index.js CHANGED
@@ -15755,28 +15755,43 @@ function date4(params) {
15755
15755
  config(en_default());
15756
15756
  // src/definitions/steps/step-features.ts
15757
15757
  var FEEDBACK_REQUEST_SIGNAL_KEY = "$boboddy_feedback_request_v1";
15758
+ var FEEDBACK_REQUEST_RESULT_KEY = "$boboddy_feedbackRequests_v1";
15758
15759
  var feedbackRequestItemSchema = exports_external.object({
15759
- question: exports_external.string(),
15760
- category: exports_external.string(),
15761
- suggestedKey: exports_external.string().optional()
15762
- });
15760
+ question: exports_external.string().describe("The specific question to pose to a human reviewer."),
15761
+ category: exports_external.string().describe('A grouping label for the feedback (e.g. "accuracy", "completeness").'),
15762
+ urgency: exports_external.enum(["blocking", "clarification", "assumption", "informational"]).describe([
15763
+ "How urgently a human response is needed:",
15764
+ '- "blocking": cannot proceed at all without an answer.',
15765
+ '- "clarification": genuinely ambiguous — unsure how to interpret, but not fully blocked.',
15766
+ '- "assumption": proceeded with a guess; please verify the assumption.',
15767
+ '- "informational": FYI only — agent proceeded fine and no reply is required.'
15768
+ ].join(`
15769
+ `)),
15770
+ suggestedKey: exports_external.string().optional().describe("An optional suggested answer key for reference.")
15771
+ }).describe("A single feedback request item for human review.");
15763
15772
  var feedbackRequestsFeature = {
15764
15773
  _resultExtension: exports_external.object({
15765
- feedbackRequests: exports_external.array(feedbackRequestItemSchema).optional()
15774
+ [FEEDBACK_REQUEST_RESULT_KEY]: exports_external.array(feedbackRequestItemSchema).optional()
15766
15775
  }),
15767
15776
  _promptAddition: [
15768
15777
  "## Feedback Requests",
15769
15778
  "",
15770
- "If you encounter anything that warrants human review, populate the `feedbackRequests` array:",
15771
- "- **question**: The specific question to pose to a human reviewer",
15772
- '- **category**: A grouping label for the feedback (e.g. `"accuracy"`, `"completeness"`)',
15773
- "- **suggestedKey** *(optional)*: A suggested answer key for reference"
15779
+ `If you encounter anything that warrants human review, populate the \`${FEEDBACK_REQUEST_RESULT_KEY}\` array.`,
15780
+ "Each item must include:",
15781
+ "- **question**: The specific question to pose to a human reviewer.",
15782
+ '- **category**: A grouping label for the feedback (e.g. `"accuracy"`, `"completeness"`).',
15783
+ "- **urgency**: How urgently a human response is needed. Must be one of:",
15784
+ ' - `"blocking"`: Cannot proceed at all without an answer.',
15785
+ ' - `"clarification"`: Genuinely ambiguous — unsure how to interpret, but not fully blocked.',
15786
+ ' - `"assumption"`: Proceeded with a guess; please verify the assumption.',
15787
+ ' - `"informational"`: FYI only — agent proceeded fine and no reply is required.',
15788
+ "- **suggestedKey** *(optional)*: A suggested answer key for reference."
15774
15789
  ].join(`
15775
15790
  `),
15776
15791
  _signals: [
15777
15792
  {
15778
15793
  key: FEEDBACK_REQUEST_SIGNAL_KEY,
15779
- sourcePath: "feedbackRequests",
15794
+ sourcePath: FEEDBACK_REQUEST_RESULT_KEY,
15780
15795
  type: "array",
15781
15796
  required: false
15782
15797
  }
@@ -15846,7 +15861,13 @@ function resolveOutcome(outcome) {
15846
15861
  if (typeof outcome === "string") {
15847
15862
  return { type: outcome, params: null };
15848
15863
  }
15849
- return { type: outcome.outcome, params: outcome.outcomeJson ?? null };
15864
+ return {
15865
+ type: "route",
15866
+ params: {
15867
+ pipelineKey: outcome.pipelineKey,
15868
+ ...outcome.inputJson != null ? { inputJson: outcome.inputJson } : {}
15869
+ }
15870
+ };
15850
15871
  }
15851
15872
  function serializeCondition(condition) {
15852
15873
  if (condition._tag === "signal") {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package.json",
3
3
  "name": "@boboddy/sdk",
4
- "version": "0.1.9-alpha",
4
+ "version": "0.1.10-alpha",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {