open-azdo 0.2.2 → 0.2.4

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/open-azdo.js CHANGED
@@ -46662,22 +46662,25 @@ var ExistingThreadStatusSchema = exports_Schema.Union([
46662
46662
  var NullableIntSchema = exports_Schema.Union([exports_Schema.Int, exports_Schema.Null]);
46663
46663
  var ExistingThreadSchema = exports_Schema.Struct({
46664
46664
  id: exports_Schema.Int,
46665
- status: ExistingThreadStatusSchema,
46665
+ status: exports_Schema.optionalKey(exports_Schema.Union([ExistingThreadStatusSchema, exports_Schema.Null])),
46666
46666
  comments: exports_Schema.Array(exports_Schema.Struct({
46667
46667
  id: exports_Schema.Int,
46668
46668
  content: exports_Schema.optionalKey(exports_Schema.Union([exports_Schema.String, exports_Schema.Null]))
46669
46669
  })),
46670
- threadContext: exports_Schema.optionalKey(exports_Schema.Struct({
46671
- filePath: exports_Schema.optionalKey(exports_Schema.String),
46672
- rightFileStart: exports_Schema.optionalKey(exports_Schema.Struct({
46673
- line: exports_Schema.optionalKey(NullableIntSchema),
46674
- offset: exports_Schema.optionalKey(NullableIntSchema)
46675
- })),
46676
- rightFileEnd: exports_Schema.optionalKey(exports_Schema.Struct({
46677
- line: exports_Schema.optionalKey(NullableIntSchema),
46678
- offset: exports_Schema.optionalKey(NullableIntSchema)
46679
- }))
46680
- }))
46670
+ threadContext: exports_Schema.optionalKey(exports_Schema.Union([
46671
+ exports_Schema.Struct({
46672
+ filePath: exports_Schema.optionalKey(exports_Schema.String),
46673
+ rightFileStart: exports_Schema.optionalKey(exports_Schema.Struct({
46674
+ line: exports_Schema.optionalKey(NullableIntSchema),
46675
+ offset: exports_Schema.optionalKey(NullableIntSchema)
46676
+ })),
46677
+ rightFileEnd: exports_Schema.optionalKey(exports_Schema.Struct({
46678
+ line: exports_Schema.optionalKey(NullableIntSchema),
46679
+ offset: exports_Schema.optionalKey(NullableIntSchema)
46680
+ }))
46681
+ }),
46682
+ exports_Schema.Null
46683
+ ]))
46681
46684
  });
46682
46685
  var ExistingThreadsResponseSchema = exports_Schema.Struct({
46683
46686
  value: exports_Schema.optionalKey(exports_Schema.Array(ExistingThreadSchema))
@@ -47233,6 +47236,26 @@ var buildOpenCodeArgs = (request3) => [
47233
47236
  var extractFinalResponse = (output) => {
47234
47237
  const texts = [];
47235
47238
  const structuredCandidates = [];
47239
+ const reportedErrors = [];
47240
+ const describeError = (value3) => {
47241
+ if (value3 === null || value3 === undefined) {
47242
+ return;
47243
+ }
47244
+ if (typeof value3 === "string") {
47245
+ const trimmed = value3.trim();
47246
+ return trimmed.length > 0 ? trimmed : undefined;
47247
+ }
47248
+ if (typeof value3 !== "object" || Array.isArray(value3)) {
47249
+ return String(value3);
47250
+ }
47251
+ const record3 = value3;
47252
+ const message = describeError(record3.message) ?? describeError(record3.detail) ?? describeError(record3.data) ?? describeError(record3.error) ?? describeError(record3.cause);
47253
+ if (!message) {
47254
+ return stringifyJson2(record3);
47255
+ }
47256
+ const name = typeof record3.name === "string" ? record3.name.trim() : "";
47257
+ return name.length > 0 && !message.startsWith(`${name}:`) ? `${name}: ${message}` : message;
47258
+ };
47236
47259
  const maybeCollectStructuredCandidate = (value3) => {
47237
47260
  if (!value3 || typeof value3 !== "object" || Array.isArray(value3)) {
47238
47261
  return;
@@ -47287,6 +47310,12 @@ var extractFinalResponse = (output) => {
47287
47310
  texts.push(event);
47288
47311
  continue;
47289
47312
  }
47313
+ if (event && typeof event === "object" && !Array.isArray(event) && event.type === "error" && "error" in event) {
47314
+ const message = describeError(event.error);
47315
+ if (message) {
47316
+ reportedErrors.push(message);
47317
+ }
47318
+ }
47290
47319
  collectTextCandidates(event);
47291
47320
  } catch {
47292
47321
  texts.push(trimmed);
@@ -47300,7 +47329,7 @@ var extractFinalResponse = (output) => {
47300
47329
  `).trim();
47301
47330
  if (!response) {
47302
47331
  throw new OpenCodeOutputError({
47303
- message: "OpenCode did not return a final response.",
47332
+ message: reportedErrors.at(-1) ?? "OpenCode did not return a final response.",
47304
47333
  output
47305
47334
  });
47306
47335
  }
@@ -48442,7 +48471,7 @@ var reviewCommandConfig = {
48442
48471
  var reviewCommand = make33("review", reviewCommandConfig).pipe(withDescription3("Review an Azure DevOps pull request with OpenCode."), withHandler((input) => runReviewCommand(input)));
48443
48472
  var openAzdoCli = make33("open-azdo").pipe(withDescription3("Secure Azure DevOps pull-request review CLI powered by OpenCode."), withSubcommands([reviewCommand]));
48444
48473
  // package.json
48445
- var version2 = "0.2.2";
48474
+ var version2 = "0.2.4";
48446
48475
 
48447
48476
  // src/Main.ts
48448
48477
  var cliProgram = run3(openAzdoCli, { version: version2 }).pipe(exports_Effect.scoped, exports_Effect.provide(BaseRuntimeLayer));
@@ -48451,4 +48480,4 @@ var main = () => runMain2(cliProgram, { disableErrorReporting: true });
48451
48480
  // bin/open-azdo.ts
48452
48481
  main();
48453
48482
 
48454
- //# debugId=B6C049DBA5403ADC64756E2164756E21
48483
+ //# debugId=7528100F803103A764756E2164756E21