@boboddy/sdk 0.1.45-alpha → 0.2.1-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.
package/dist/index.js CHANGED
@@ -1009,6 +1009,22 @@ class StepExecutions extends HeyApiClient {
1009
1009
  getStepExecution(options) {
1010
1010
  return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
1011
1011
  }
1012
+ readStepExecutionLogs(options) {
1013
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs", ...options });
1014
+ }
1015
+ appendStepExecutionLogs(options) {
1016
+ return (options.client ?? this.client).post({
1017
+ url: "/api/step-executions/{stepExecutionId}/logs",
1018
+ ...options,
1019
+ headers: {
1020
+ "Content-Type": "application/json",
1021
+ ...options.headers
1022
+ }
1023
+ });
1024
+ }
1025
+ getStepExecutionLogArchive(options) {
1026
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs/archive", ...options });
1027
+ }
1012
1028
  }
1013
1029
 
1014
1030
  class PipelineDefinitions extends HeyApiClient {
@@ -1347,6 +1363,12 @@ class ProjectInvites extends HeyApiClient {
1347
1363
  }
1348
1364
  }
1349
1365
 
1366
+ class Billing extends HeyApiClient {
1367
+ getOrgUsage(options) {
1368
+ return (options.client ?? this.client).get({ url: "/api/orgs/{orgId}/usage", ...options });
1369
+ }
1370
+ }
1371
+
1350
1372
  class BoboddyClient extends HeyApiClient {
1351
1373
  static __registry = new HeyApiRegistry;
1352
1374
  constructor(args) {
@@ -1409,6 +1431,10 @@ class BoboddyClient extends HeyApiClient {
1409
1431
  get projectInvites() {
1410
1432
  return this._projectInvites ??= new ProjectInvites({ client: this.client });
1411
1433
  }
1434
+ _billing;
1435
+ get billing() {
1436
+ return this._billing ??= new Billing({ client: this.client });
1437
+ }
1412
1438
  }
1413
1439
  // src/step-execution-plane-client.ts
1414
1440
  function createStepExecutionPlaneClient(baseUrl) {
@@ -1471,6 +1497,16 @@ var buildStepExecutionPlaneClient = (stepExecutions) => {
1471
1497
  });
1472
1498
  if (result.error)
1473
1499
  throw new Error(JSON.stringify(result.error));
1500
+ },
1501
+ appendStepExecutionLogs: async (stepExecutionId, body, options) => {
1502
+ const result = await stepExecutions.appendStepExecutionLogs({
1503
+ path: { stepExecutionId },
1504
+ body,
1505
+ headers: options?.headers
1506
+ });
1507
+ if (result.error)
1508
+ throw new Error(JSON.stringify(result.error));
1509
+ return result.data;
1474
1510
  }
1475
1511
  };
1476
1512
  };
@@ -12702,7 +12738,7 @@ function finalize(ctx, schema) {
12702
12738
  result.$schema = "http://json-schema.org/draft-07/schema#";
12703
12739
  } else if (ctx.target === "draft-04") {
12704
12740
  result.$schema = "http://json-schema.org/draft-04/schema#";
12705
- } else if (ctx.target === "openapi-3.0") {} else {}
12741
+ } else if (ctx.target === "openapi-3.0") {}
12706
12742
  if (ctx.external?.uri) {
12707
12743
  const id = ctx.external.registry.get(schema)?.id;
12708
12744
  if (!id)
@@ -12946,7 +12982,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
12946
12982
  if (val === undefined) {
12947
12983
  if (ctx.unrepresentable === "throw") {
12948
12984
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
12949
- } else {}
12985
+ }
12950
12986
  } else if (typeof val === "bigint") {
12951
12987
  if (ctx.unrepresentable === "throw") {
12952
12988
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -13451,29 +13487,29 @@ function renderPromptTemplate(template, contextJson) {
13451
13487
  }
13452
13488
 
13453
13489
  // src/definitions/steps/define-step.ts
13454
- var UNWRAP_TYPES = new Set(["optional", "nullable", "default"]);
13455
- function unwrapZodType(schema) {
13456
- while (UNWRAP_TYPES.has(schema._def.type)) {
13457
- const inner = schema._def.innerType;
13458
- if (!inner)
13459
- break;
13460
- schema = inner;
13490
+ function resolveZodSchemaAtPath(schema, path) {
13491
+ if (!schema)
13492
+ return;
13493
+ const segments = path.split(".");
13494
+ let current = schema;
13495
+ for (const segment of segments) {
13496
+ if (!current)
13497
+ return;
13498
+ current = unwrapZodWrappers(current);
13499
+ const def = current.def;
13500
+ if (!def || def.type !== "object" || !def.shape)
13501
+ return;
13502
+ current = def.shape[segment];
13461
13503
  }
13462
- return schema;
13504
+ return current;
13463
13505
  }
13464
- function deriveSignalType(schema, path) {
13506
+ function zodTypeToSignalType(schema) {
13465
13507
  if (!schema)
13466
- return "string";
13467
- let current = unwrapZodType(schema);
13468
- for (const part of path.split(".")) {
13469
- if (current._def.type !== "object")
13470
- return "string";
13471
- const next = current._def.shape?.[part];
13472
- if (!next)
13473
- return "string";
13474
- current = unwrapZodType(next);
13475
- }
13476
- switch (current._def.type) {
13508
+ return;
13509
+ const unwrapped = unwrapZodWrappers(schema);
13510
+ const def = unwrapped.def;
13511
+ const typeName = def?.type;
13512
+ switch (typeName) {
13477
13513
  case "string":
13478
13514
  return "string";
13479
13515
  case "number":
@@ -13483,12 +13519,21 @@ function deriveSignalType(schema, path) {
13483
13519
  case "array":
13484
13520
  return "array";
13485
13521
  case "object":
13486
- case "record":
13487
13522
  return "object";
13488
13523
  default:
13489
- return "string";
13524
+ return;
13490
13525
  }
13491
13526
  }
13527
+ function unwrapZodWrappers(schema) {
13528
+ const def = schema.def;
13529
+ if (!def)
13530
+ return schema;
13531
+ if (def.type === "optional" || def.type === "nullable" || def.type === "default" || def.type === "catch") {
13532
+ if (def.innerType)
13533
+ return unwrapZodWrappers(def.innerType);
13534
+ }
13535
+ return schema;
13536
+ }
13492
13537
  function defineStep(config2) {
13493
13538
  const features = config2.features ?? [];
13494
13539
  let effectiveResult = config2.result;
@@ -13519,7 +13564,7 @@ ${feature._promptAddition}` : feature._promptAddition;
13519
13564
  ...(config2.signals ?? []).map((s) => ({
13520
13565
  key: s.key ?? s.sourcePath,
13521
13566
  sourcePath: s.sourcePath,
13522
- type: s.type ?? deriveSignalType(config2.result, s.sourcePath),
13567
+ type: s.type ?? zodTypeToSignalType(resolveZodSchemaAtPath(effectiveResult, s.sourcePath)) ?? "string",
13523
13568
  required: s.required ?? true,
13524
13569
  availableWhenResultStatusIn: s.availableWhenResultStatusIn ?? null
13525
13570
  })),
@@ -15934,7 +15979,7 @@ var notificationItemSchema = exports_external.object({
15934
15979
  title: exports_external.string().describe("Short, human-readable notification title."),
15935
15980
  body: exports_external.string().describe("The notification body / details."),
15936
15981
  priority: exports_external.enum(["low", "normal", "high", "urgent"]).describe("How important this notification is for the user."),
15937
- suggestedChannels: exports_external.array(exports_external.enum(["in_app", "jira_comment", "email", "slack"])).optional().describe("Channels the agent thinks are worth using. The platform policy decides the final channels."),
15982
+ suggestedChannels: exports_external.array(exports_external.enum(["in_app", "work_item_platform_comment", "email", "slack"])).optional().describe("Channels the agent thinks are worth using. The platform policy decides the final channels."),
15938
15983
  payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe('Kind-specific structured data. For "feedback_request": { category, urgency, suggestedKey? }.')
15939
15984
  }).describe("A single user notification emitted by the agent.");
15940
15985
  var notificationsFeature = {
@@ -15950,7 +15995,7 @@ var notificationsFeature = {
15950
15995
  "- **title**: A short, human-readable title.",
15951
15996
  "- **body**: The details of the notification.",
15952
15997
  "- **priority**: One of `low`, `normal`, `high`, `urgent`.",
15953
- '- **suggestedChannels** *(optional)*: Channels you think are worth using (e.g. `["in_app", "jira_comment"]`).',
15998
+ '- **suggestedChannels** *(optional)*: Channels you think are worth using (e.g. `["in_app", "work_item_platform_comment"]`).',
15954
15999
  " You only *suggest* channels \u2014 the platform policy decides the final delivery channels.",
15955
16000
  '- **payload** *(optional)*: Kind-specific data. For `feedback_request`, include `{ "category": string, "urgency": "blocking"|"clarification"|"assumption"|"informational", "suggestedKey"?: string }`.'
15956
16001
  ].join(`
@@ -16336,6 +16381,82 @@ function materializeAccessor(accessor) {
16336
16381
  };
16337
16382
  }
16338
16383
 
16384
+ // src/definitions/pipelines/builder-helpers.ts
16385
+ var WORK_ITEM_ACCESSOR = Object.freeze({
16386
+ title: Object.freeze({ source: "work_item", field: "title" }),
16387
+ description: Object.freeze({
16388
+ source: "work_item",
16389
+ field: "description"
16390
+ }),
16391
+ field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
16392
+ });
16393
+ var WORK_ITEM_FIELD_BINDINGS = {
16394
+ workItemTitle: { source: "work_item", field: "title" },
16395
+ workItemDescription: { source: "work_item", field: "description" }
16396
+ };
16397
+ function makeStepInputCtx(inputSchema) {
16398
+ const baseAccessor = createInputAccessor(inputSchema);
16399
+ const input = new Proxy(baseAccessor, {
16400
+ get(target, prop) {
16401
+ if (typeof prop === "string" && prop in WORK_ITEM_FIELD_BINDINGS) {
16402
+ return WORK_ITEM_FIELD_BINDINGS[prop];
16403
+ }
16404
+ return target[prop];
16405
+ }
16406
+ });
16407
+ return {
16408
+ input,
16409
+ signal(step, key) {
16410
+ return { source: "step_signal", step, signalKey: key };
16411
+ },
16412
+ output(step) {
16413
+ return { source: "step_output", step };
16414
+ },
16415
+ literal: literal2
16416
+ };
16417
+ }
16418
+ function literal2(value) {
16419
+ return { source: "literal", value };
16420
+ }
16421
+ function normalizeInputMapping(mapping) {
16422
+ if (!mapping)
16423
+ return;
16424
+ const out = {};
16425
+ for (const [key, value] of Object.entries(mapping)) {
16426
+ if (value === undefined)
16427
+ continue;
16428
+ out[key] = isInputAccessor(value) ? materializeAccessor(value) : value;
16429
+ }
16430
+ return out;
16431
+ }
16432
+ function resolveAdditionalStepInputBindings(label, definition) {
16433
+ if (!definition) {
16434
+ return {};
16435
+ }
16436
+ const raw = definition.bindings({
16437
+ workItemField: (fieldName) => ({
16438
+ source: "work_item",
16439
+ field: `fields.${fieldName}`
16440
+ }),
16441
+ literal: literal2
16442
+ });
16443
+ if (definition.schema instanceof exports_external.ZodObject) {
16444
+ const validKeys = new Set(Object.keys(definition.schema.shape));
16445
+ const unknown2 = Object.keys(raw).filter((key) => !validKeys.has(key));
16446
+ if (unknown2.length > 0) {
16447
+ throw new Error(`${label}.bindings returned key${unknown2.length > 1 ? "s" : ""} not in schema: ${unknown2.map((key) => `"${key}"`).join(", ")}`);
16448
+ }
16449
+ }
16450
+ return normalizeInputMapping(raw) ?? {};
16451
+ }
16452
+ function mergeStepBindings(pipelineBindings, explicitBindings) {
16453
+ const merged = {
16454
+ ...pipelineBindings,
16455
+ ...explicitBindings ?? {}
16456
+ };
16457
+ return Object.keys(merged).length > 0 ? merged : undefined;
16458
+ }
16459
+
16339
16460
  // src/definitions/pipelines/builder.ts
16340
16461
  class PipelineStepAdvancementBuilder {
16341
16462
  inputSchema;
@@ -16352,6 +16473,8 @@ class PipelineStepAdvancementBuilder {
16352
16473
  }
16353
16474
  advance(callback) {
16354
16475
  const last = this.steps.at(-1);
16476
+ if (!last)
16477
+ throw new Error("Internal error: no steps available");
16355
16478
  const ctx = makeAdvanceCtx();
16356
16479
  const result = callback(ctx);
16357
16480
  const policy = {
@@ -16448,80 +16571,6 @@ class PipelineBuilder {
16448
16571
  return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings, this.pipelineStepInputBindings);
16449
16572
  }
16450
16573
  }
16451
- var WORK_ITEM_ACCESSOR = Object.freeze({
16452
- title: Object.freeze({ source: "work_item", field: "title" }),
16453
- description: Object.freeze({
16454
- source: "work_item",
16455
- field: "description"
16456
- }),
16457
- field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
16458
- });
16459
- var WORK_ITEM_FIELD_BINDINGS = {
16460
- workItemTitle: { source: "work_item", field: "title" },
16461
- workItemDescription: { source: "work_item", field: "description" }
16462
- };
16463
- function makeStepInputCtx(inputSchema) {
16464
- const baseAccessor = createInputAccessor(inputSchema);
16465
- const input = new Proxy(baseAccessor, {
16466
- get(target, prop) {
16467
- if (typeof prop === "string" && prop in WORK_ITEM_FIELD_BINDINGS) {
16468
- return WORK_ITEM_FIELD_BINDINGS[prop];
16469
- }
16470
- return target[prop];
16471
- }
16472
- });
16473
- return {
16474
- input,
16475
- signal(step, key) {
16476
- return { source: "step_signal", step, signalKey: key };
16477
- },
16478
- output(step) {
16479
- return { source: "step_output", step };
16480
- },
16481
- literal: literal2
16482
- };
16483
- }
16484
- function literal2(value) {
16485
- return { source: "literal", value };
16486
- }
16487
- function normalizeInputMapping(mapping) {
16488
- if (!mapping)
16489
- return;
16490
- const out = {};
16491
- for (const [key, value] of Object.entries(mapping)) {
16492
- if (value === undefined)
16493
- continue;
16494
- out[key] = isInputAccessor(value) ? materializeAccessor(value) : value;
16495
- }
16496
- return out;
16497
- }
16498
- function resolveAdditionalStepInputBindings(label, definition) {
16499
- if (!definition) {
16500
- return {};
16501
- }
16502
- const raw = definition.bindings({
16503
- workItemField: (fieldName) => ({
16504
- source: "work_item",
16505
- field: `fields.${fieldName}`
16506
- }),
16507
- literal: literal2
16508
- });
16509
- if (definition.schema instanceof exports_external.ZodObject) {
16510
- const validKeys = new Set(Object.keys(definition.schema.shape));
16511
- const unknown2 = Object.keys(raw).filter((key) => !validKeys.has(key));
16512
- if (unknown2.length > 0) {
16513
- throw new Error(`${label}.bindings returned key${unknown2.length > 1 ? "s" : ""} not in schema: ${unknown2.map((key) => `"${key}"`).join(", ")}`);
16514
- }
16515
- }
16516
- return normalizeInputMapping(raw) ?? {};
16517
- }
16518
- function mergeStepBindings(pipelineBindings, explicitBindings) {
16519
- const merged = {
16520
- ...pipelineBindings,
16521
- ...explicitBindings ?? {}
16522
- };
16523
- return Object.keys(merged).length > 0 ? merged : undefined;
16524
- }
16525
16574
  function pipeline(meta3) {
16526
16575
  return new PipelineBuilder(meta3);
16527
16576
  }
@@ -16539,7 +16588,7 @@ var buildPipelineDefinitionsClient = (pipelineDefinitions) => {
16539
16588
  });
16540
16589
  if (result.error)
16541
16590
  throw new Error(JSON.stringify(result.error));
16542
- return result.data ?? [];
16591
+ return result.data;
16543
16592
  },
16544
16593
  upsertFromSpec: async (projectId, spec, stepDefs, options) => {
16545
16594
  const stepDefMap = new Map;
@@ -16619,7 +16668,7 @@ function makeFieldRef(fact, path) {
16619
16668
  };
16620
16669
  }
16621
16670
  function makeAssign(pipeline2) {
16622
- if (typeof pipeline2 !== "object" || pipeline2 === null || typeof pipeline2["key"] !== "string" || !Array.isArray(pipeline2["steps"])) {
16671
+ if (typeof pipeline2 !== "object" || typeof pipeline2["key"] !== "string" || !Array.isArray(pipeline2["steps"])) {
16623
16672
  throw new Error("assign() requires a pipeline spec produced by pipeline().build(). " + "Pass the default-exported value from a pipeline definition file.");
16624
16673
  }
16625
16674
  return { _tag: "assign", pipeline: pipeline2 };
@@ -16668,13 +16717,10 @@ function serializeConditionNode(condition) {
16668
16717
  value: condition.value
16669
16718
  };
16670
16719
  }
16671
- if (condition._tag === "group") {
16672
- if (condition.mode === "all") {
16673
- return { all: condition.conditions.map(serializeConditionNode) };
16674
- }
16675
- return { any: condition.conditions.map(serializeConditionNode) };
16720
+ if (condition.mode === "all") {
16721
+ return { all: condition.conditions.map(serializeConditionNode) };
16676
16722
  }
16677
- throw new Error(`Unknown condition tag: ${JSON.stringify(condition["_tag"])}`);
16723
+ return { any: condition.conditions.map(serializeConditionNode) };
16678
16724
  }
16679
16725
  function serializeOutcome(outcome) {
16680
16726
  if (outcome._tag === "skip")
@@ -17088,6 +17134,7 @@ export {
17088
17134
  DEFAULT_PIPELINE_ASSIGNMENT_FILENAME,
17089
17135
  Computed,
17090
17136
  BoboddyClient,
17137
+ Billing,
17091
17138
  BOBODDY_CONFIG_RELATIVE_PATH,
17092
17139
  Api
17093
17140
  };
@@ -11478,7 +11478,7 @@ function finalize(ctx, schema) {
11478
11478
  result.$schema = "http://json-schema.org/draft-07/schema#";
11479
11479
  } else if (ctx.target === "draft-04") {
11480
11480
  result.$schema = "http://json-schema.org/draft-04/schema#";
11481
- } else if (ctx.target === "openapi-3.0") {} else {}
11481
+ } else if (ctx.target === "openapi-3.0") {}
11482
11482
  if (ctx.external?.uri) {
11483
11483
  const id = ctx.external.registry.get(schema)?.id;
11484
11484
  if (!id)
@@ -11722,7 +11722,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
11722
11722
  if (val === undefined) {
11723
11723
  if (ctx.unrepresentable === "throw") {
11724
11724
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
11725
- } else {}
11725
+ }
11726
11726
  } else if (typeof val === "bigint") {
11727
11727
  if (ctx.unrepresentable === "throw") {
11728
11728
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -11478,7 +11478,7 @@ function finalize(ctx, schema) {
11478
11478
  result.$schema = "http://json-schema.org/draft-07/schema#";
11479
11479
  } else if (ctx.target === "draft-04") {
11480
11480
  result.$schema = "http://json-schema.org/draft-04/schema#";
11481
- } else if (ctx.target === "openapi-3.0") {} else {}
11481
+ } else if (ctx.target === "openapi-3.0") {}
11482
11482
  if (ctx.external?.uri) {
11483
11483
  const id = ctx.external.registry.get(schema)?.id;
11484
11484
  if (!id)
@@ -11722,7 +11722,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
11722
11722
  if (val === undefined) {
11723
11723
  if (ctx.unrepresentable === "throw") {
11724
11724
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
11725
- } else {}
11725
+ }
11726
11726
  } else if (typeof val === "bigint") {
11727
11727
  if (ctx.unrepresentable === "throw") {
11728
11728
  throw new Error("BigInt literals cannot be represented in JSON Schema");