@boboddy/sdk 0.1.45-alpha → 0.2.3-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
@@ -937,6 +937,32 @@ class StepDefinitions extends HeyApiClient {
937
937
  }
938
938
 
939
939
  class StepExecutions extends HeyApiClient {
940
+ createArtifactUploadUrl(options) {
941
+ return (options.client ?? this.client).post({
942
+ url: "/api/step-executions/{stepExecutionId}/artifact-upload-url",
943
+ ...options,
944
+ headers: {
945
+ "Content-Type": "application/json",
946
+ ...options.headers
947
+ }
948
+ });
949
+ }
950
+ listStepExecutionArtifacts(options) {
951
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/artifacts", ...options });
952
+ }
953
+ recordStepExecutionArtifact(options) {
954
+ return (options.client ?? this.client).post({
955
+ url: "/api/step-executions/{stepExecutionId}/artifacts",
956
+ ...options,
957
+ headers: {
958
+ "Content-Type": "application/json",
959
+ ...options.headers
960
+ }
961
+ });
962
+ }
963
+ getArtifactDownloadUrl(options) {
964
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/artifacts/{artifactId}/download-url", ...options });
965
+ }
940
966
  claimStepExecutions(options) {
941
967
  return (options.client ?? this.client).post({
942
968
  url: "/api/step-executions/claims",
@@ -1009,6 +1035,22 @@ class StepExecutions extends HeyApiClient {
1009
1035
  getStepExecution(options) {
1010
1036
  return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}", ...options });
1011
1037
  }
1038
+ readStepExecutionLogs(options) {
1039
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs", ...options });
1040
+ }
1041
+ appendStepExecutionLogs(options) {
1042
+ return (options.client ?? this.client).post({
1043
+ url: "/api/step-executions/{stepExecutionId}/logs",
1044
+ ...options,
1045
+ headers: {
1046
+ "Content-Type": "application/json",
1047
+ ...options.headers
1048
+ }
1049
+ });
1050
+ }
1051
+ getStepExecutionLogArchive(options) {
1052
+ return (options.client ?? this.client).get({ url: "/api/step-executions/{stepExecutionId}/logs/archive", ...options });
1053
+ }
1012
1054
  }
1013
1055
 
1014
1056
  class PipelineDefinitions extends HeyApiClient {
@@ -1347,6 +1389,12 @@ class ProjectInvites extends HeyApiClient {
1347
1389
  }
1348
1390
  }
1349
1391
 
1392
+ class Billing extends HeyApiClient {
1393
+ getOrgUsage(options) {
1394
+ return (options.client ?? this.client).get({ url: "/api/orgs/{orgId}/usage", ...options });
1395
+ }
1396
+ }
1397
+
1350
1398
  class BoboddyClient extends HeyApiClient {
1351
1399
  static __registry = new HeyApiRegistry;
1352
1400
  constructor(args) {
@@ -1409,6 +1457,10 @@ class BoboddyClient extends HeyApiClient {
1409
1457
  get projectInvites() {
1410
1458
  return this._projectInvites ??= new ProjectInvites({ client: this.client });
1411
1459
  }
1460
+ _billing;
1461
+ get billing() {
1462
+ return this._billing ??= new Billing({ client: this.client });
1463
+ }
1412
1464
  }
1413
1465
  // src/step-execution-plane-client.ts
1414
1466
  function createStepExecutionPlaneClient(baseUrl) {
@@ -1471,6 +1523,54 @@ var buildStepExecutionPlaneClient = (stepExecutions) => {
1471
1523
  });
1472
1524
  if (result.error)
1473
1525
  throw new Error(JSON.stringify(result.error));
1526
+ },
1527
+ createArtifactUploadUrl: async (stepExecutionId, body, options) => {
1528
+ const result = await stepExecutions.createArtifactUploadUrl({
1529
+ path: { stepExecutionId },
1530
+ body,
1531
+ headers: options?.headers
1532
+ });
1533
+ if (result.error)
1534
+ throw new Error(JSON.stringify(result.error));
1535
+ return result.data;
1536
+ },
1537
+ recordStepExecutionArtifact: async (stepExecutionId, body, options) => {
1538
+ const result = await stepExecutions.recordStepExecutionArtifact({
1539
+ path: { stepExecutionId },
1540
+ body,
1541
+ headers: options?.headers
1542
+ });
1543
+ if (result.error)
1544
+ throw new Error(JSON.stringify(result.error));
1545
+ return result.data;
1546
+ },
1547
+ listStepExecutionArtifacts: async (stepExecutionId, options) => {
1548
+ const result = await stepExecutions.listStepExecutionArtifacts({
1549
+ path: { stepExecutionId },
1550
+ headers: options?.headers
1551
+ });
1552
+ if (result.error)
1553
+ throw new Error(JSON.stringify(result.error));
1554
+ return result.data;
1555
+ },
1556
+ getArtifactDownloadUrl: async (stepExecutionId, artifactId, options) => {
1557
+ const result = await stepExecutions.getArtifactDownloadUrl({
1558
+ path: { stepExecutionId, artifactId },
1559
+ headers: options?.headers
1560
+ });
1561
+ if (result.error)
1562
+ throw new Error(JSON.stringify(result.error));
1563
+ return result.data;
1564
+ },
1565
+ appendStepExecutionLogs: async (stepExecutionId, body, options) => {
1566
+ const result = await stepExecutions.appendStepExecutionLogs({
1567
+ path: { stepExecutionId },
1568
+ body,
1569
+ headers: options?.headers
1570
+ });
1571
+ if (result.error)
1572
+ throw new Error(JSON.stringify(result.error));
1573
+ return result.data;
1474
1574
  }
1475
1575
  };
1476
1576
  };
@@ -12702,7 +12802,7 @@ function finalize(ctx, schema) {
12702
12802
  result.$schema = "http://json-schema.org/draft-07/schema#";
12703
12803
  } else if (ctx.target === "draft-04") {
12704
12804
  result.$schema = "http://json-schema.org/draft-04/schema#";
12705
- } else if (ctx.target === "openapi-3.0") {} else {}
12805
+ } else if (ctx.target === "openapi-3.0") {}
12706
12806
  if (ctx.external?.uri) {
12707
12807
  const id = ctx.external.registry.get(schema)?.id;
12708
12808
  if (!id)
@@ -12946,7 +13046,7 @@ var literalProcessor = (schema, ctx, json, _params) => {
12946
13046
  if (val === undefined) {
12947
13047
  if (ctx.unrepresentable === "throw") {
12948
13048
  throw new Error("Literal `undefined` cannot be represented in JSON Schema");
12949
- } else {}
13049
+ }
12950
13050
  } else if (typeof val === "bigint") {
12951
13051
  if (ctx.unrepresentable === "throw") {
12952
13052
  throw new Error("BigInt literals cannot be represented in JSON Schema");
@@ -13451,29 +13551,29 @@ function renderPromptTemplate(template, contextJson) {
13451
13551
  }
13452
13552
 
13453
13553
  // 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;
13554
+ function resolveZodSchemaAtPath(schema, path) {
13555
+ if (!schema)
13556
+ return;
13557
+ const segments = path.split(".");
13558
+ let current = schema;
13559
+ for (const segment of segments) {
13560
+ if (!current)
13561
+ return;
13562
+ current = unwrapZodWrappers(current);
13563
+ const def = current.def;
13564
+ if (!def || def.type !== "object" || !def.shape)
13565
+ return;
13566
+ current = def.shape[segment];
13461
13567
  }
13462
- return schema;
13568
+ return current;
13463
13569
  }
13464
- function deriveSignalType(schema, path) {
13570
+ function zodTypeToSignalType(schema) {
13465
13571
  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) {
13572
+ return;
13573
+ const unwrapped = unwrapZodWrappers(schema);
13574
+ const def = unwrapped.def;
13575
+ const typeName = def?.type;
13576
+ switch (typeName) {
13477
13577
  case "string":
13478
13578
  return "string";
13479
13579
  case "number":
@@ -13483,12 +13583,21 @@ function deriveSignalType(schema, path) {
13483
13583
  case "array":
13484
13584
  return "array";
13485
13585
  case "object":
13486
- case "record":
13487
13586
  return "object";
13488
13587
  default:
13489
- return "string";
13588
+ return;
13490
13589
  }
13491
13590
  }
13591
+ function unwrapZodWrappers(schema) {
13592
+ const def = schema.def;
13593
+ if (!def)
13594
+ return schema;
13595
+ if (def.type === "optional" || def.type === "nullable" || def.type === "default" || def.type === "catch") {
13596
+ if (def.innerType)
13597
+ return unwrapZodWrappers(def.innerType);
13598
+ }
13599
+ return schema;
13600
+ }
13492
13601
  function defineStep(config2) {
13493
13602
  const features = config2.features ?? [];
13494
13603
  let effectiveResult = config2.result;
@@ -13519,7 +13628,7 @@ ${feature._promptAddition}` : feature._promptAddition;
13519
13628
  ...(config2.signals ?? []).map((s) => ({
13520
13629
  key: s.key ?? s.sourcePath,
13521
13630
  sourcePath: s.sourcePath,
13522
- type: s.type ?? deriveSignalType(config2.result, s.sourcePath),
13631
+ type: s.type ?? zodTypeToSignalType(resolveZodSchemaAtPath(effectiveResult, s.sourcePath)) ?? "string",
13523
13632
  required: s.required ?? true,
13524
13633
  availableWhenResultStatusIn: s.availableWhenResultStatusIn ?? null
13525
13634
  })),
@@ -15934,7 +16043,7 @@ var notificationItemSchema = exports_external.object({
15934
16043
  title: exports_external.string().describe("Short, human-readable notification title."),
15935
16044
  body: exports_external.string().describe("The notification body / details."),
15936
16045
  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."),
16046
+ 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
16047
  payload: exports_external.record(exports_external.string(), exports_external.unknown()).optional().describe('Kind-specific structured data. For "feedback_request": { category, urgency, suggestedKey? }.')
15939
16048
  }).describe("A single user notification emitted by the agent.");
15940
16049
  var notificationsFeature = {
@@ -15950,7 +16059,7 @@ var notificationsFeature = {
15950
16059
  "- **title**: A short, human-readable title.",
15951
16060
  "- **body**: The details of the notification.",
15952
16061
  "- **priority**: One of `low`, `normal`, `high`, `urgent`.",
15953
- '- **suggestedChannels** *(optional)*: Channels you think are worth using (e.g. `["in_app", "jira_comment"]`).',
16062
+ '- **suggestedChannels** *(optional)*: Channels you think are worth using (e.g. `["in_app", "work_item_platform_comment"]`).',
15954
16063
  " You only *suggest* channels \u2014 the platform policy decides the final delivery channels.",
15955
16064
  '- **payload** *(optional)*: Kind-specific data. For `feedback_request`, include `{ "category": string, "urgency": "blocking"|"clarification"|"assumption"|"informational", "suggestedKey"?: string }`.'
15956
16065
  ].join(`
@@ -16336,6 +16445,82 @@ function materializeAccessor(accessor) {
16336
16445
  };
16337
16446
  }
16338
16447
 
16448
+ // src/definitions/pipelines/builder-helpers.ts
16449
+ var WORK_ITEM_ACCESSOR = Object.freeze({
16450
+ title: Object.freeze({ source: "work_item", field: "title" }),
16451
+ description: Object.freeze({
16452
+ source: "work_item",
16453
+ field: "description"
16454
+ }),
16455
+ field: (fieldName) => Object.freeze({ source: "work_item", field: `fields.${fieldName}` })
16456
+ });
16457
+ var WORK_ITEM_FIELD_BINDINGS = {
16458
+ workItemTitle: { source: "work_item", field: "title" },
16459
+ workItemDescription: { source: "work_item", field: "description" }
16460
+ };
16461
+ function makeStepInputCtx(inputSchema) {
16462
+ const baseAccessor = createInputAccessor(inputSchema);
16463
+ const input = new Proxy(baseAccessor, {
16464
+ get(target, prop) {
16465
+ if (typeof prop === "string" && prop in WORK_ITEM_FIELD_BINDINGS) {
16466
+ return WORK_ITEM_FIELD_BINDINGS[prop];
16467
+ }
16468
+ return target[prop];
16469
+ }
16470
+ });
16471
+ return {
16472
+ input,
16473
+ signal(step, key) {
16474
+ return { source: "step_signal", step, signalKey: key };
16475
+ },
16476
+ output(step) {
16477
+ return { source: "step_output", step };
16478
+ },
16479
+ literal: literal2
16480
+ };
16481
+ }
16482
+ function literal2(value) {
16483
+ return { source: "literal", value };
16484
+ }
16485
+ function normalizeInputMapping(mapping) {
16486
+ if (!mapping)
16487
+ return;
16488
+ const out = {};
16489
+ for (const [key, value] of Object.entries(mapping)) {
16490
+ if (value === undefined)
16491
+ continue;
16492
+ out[key] = isInputAccessor(value) ? materializeAccessor(value) : value;
16493
+ }
16494
+ return out;
16495
+ }
16496
+ function resolveAdditionalStepInputBindings(label, definition) {
16497
+ if (!definition) {
16498
+ return {};
16499
+ }
16500
+ const raw = definition.bindings({
16501
+ workItemField: (fieldName) => ({
16502
+ source: "work_item",
16503
+ field: `fields.${fieldName}`
16504
+ }),
16505
+ literal: literal2
16506
+ });
16507
+ if (definition.schema instanceof exports_external.ZodObject) {
16508
+ const validKeys = new Set(Object.keys(definition.schema.shape));
16509
+ const unknown2 = Object.keys(raw).filter((key) => !validKeys.has(key));
16510
+ if (unknown2.length > 0) {
16511
+ throw new Error(`${label}.bindings returned key${unknown2.length > 1 ? "s" : ""} not in schema: ${unknown2.map((key) => `"${key}"`).join(", ")}`);
16512
+ }
16513
+ }
16514
+ return normalizeInputMapping(raw) ?? {};
16515
+ }
16516
+ function mergeStepBindings(pipelineBindings, explicitBindings) {
16517
+ const merged = {
16518
+ ...pipelineBindings,
16519
+ ...explicitBindings ?? {}
16520
+ };
16521
+ return Object.keys(merged).length > 0 ? merged : undefined;
16522
+ }
16523
+
16339
16524
  // src/definitions/pipelines/builder.ts
16340
16525
  class PipelineStepAdvancementBuilder {
16341
16526
  inputSchema;
@@ -16352,6 +16537,8 @@ class PipelineStepAdvancementBuilder {
16352
16537
  }
16353
16538
  advance(callback) {
16354
16539
  const last = this.steps.at(-1);
16540
+ if (!last)
16541
+ throw new Error("Internal error: no steps available");
16355
16542
  const ctx = makeAdvanceCtx();
16356
16543
  const result = callback(ctx);
16357
16544
  const policy = {
@@ -16448,80 +16635,6 @@ class PipelineBuilder {
16448
16635
  return new PipelineStepAdvancementBuilder(this.inputSchema, this.meta, this.steps, this.pipelineInputBindings, this.pipelineStepInputBindings);
16449
16636
  }
16450
16637
  }
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
16638
  function pipeline(meta3) {
16526
16639
  return new PipelineBuilder(meta3);
16527
16640
  }
@@ -16539,7 +16652,7 @@ var buildPipelineDefinitionsClient = (pipelineDefinitions) => {
16539
16652
  });
16540
16653
  if (result.error)
16541
16654
  throw new Error(JSON.stringify(result.error));
16542
- return result.data ?? [];
16655
+ return result.data;
16543
16656
  },
16544
16657
  upsertFromSpec: async (projectId, spec, stepDefs, options) => {
16545
16658
  const stepDefMap = new Map;
@@ -16619,7 +16732,7 @@ function makeFieldRef(fact, path) {
16619
16732
  };
16620
16733
  }
16621
16734
  function makeAssign(pipeline2) {
16622
- if (typeof pipeline2 !== "object" || pipeline2 === null || typeof pipeline2["key"] !== "string" || !Array.isArray(pipeline2["steps"])) {
16735
+ if (typeof pipeline2 !== "object" || typeof pipeline2["key"] !== "string" || !Array.isArray(pipeline2["steps"])) {
16623
16736
  throw new Error("assign() requires a pipeline spec produced by pipeline().build(). " + "Pass the default-exported value from a pipeline definition file.");
16624
16737
  }
16625
16738
  return { _tag: "assign", pipeline: pipeline2 };
@@ -16668,13 +16781,10 @@ function serializeConditionNode(condition) {
16668
16781
  value: condition.value
16669
16782
  };
16670
16783
  }
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) };
16784
+ if (condition.mode === "all") {
16785
+ return { all: condition.conditions.map(serializeConditionNode) };
16676
16786
  }
16677
- throw new Error(`Unknown condition tag: ${JSON.stringify(condition["_tag"])}`);
16787
+ return { any: condition.conditions.map(serializeConditionNode) };
16678
16788
  }
16679
16789
  function serializeOutcome(outcome) {
16680
16790
  if (outcome._tag === "skip")
@@ -17088,6 +17198,7 @@ export {
17088
17198
  DEFAULT_PIPELINE_ASSIGNMENT_FILENAME,
17089
17199
  Computed,
17090
17200
  BoboddyClient,
17201
+ Billing,
17091
17202
  BOBODDY_CONFIG_RELATIVE_PATH,
17092
17203
  Api
17093
17204
  };
@@ -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");