deepline 0.3.140 → 0.3.142

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.
Files changed (26) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +18 -0
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/sdk/src/types.ts +65 -2
  4. package/dist/bundling-sources/shared_libs/observability/dlq.ts +11 -0
  5. package/dist/bundling-sources/shared_libs/observability/queue-health.ts +111 -0
  6. package/dist/bundling-sources/shared_libs/play-runtime/bettercontact-batching.ts +34 -8
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +271 -44
  8. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +25 -6
  9. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +132 -8
  10. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +3 -1
  11. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +49 -54
  12. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +14 -7
  13. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +118 -29
  14. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-queue-health.ts +183 -36
  15. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +4 -1
  16. package/dist/cli/index.js +247 -12
  17. package/dist/cli/index.mjs +247 -12
  18. package/dist/index.d.mts +69 -2
  19. package/dist/index.d.ts +69 -2
  20. package/dist/index.js +2 -1
  21. package/dist/index.mjs +2 -1
  22. package/dist/release.d.mts +1 -1
  23. package/dist/release.d.ts +1 -1
  24. package/dist/release.js +1 -1
  25. package/dist/release.mjs +1 -1
  26. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -3068,7 +3068,7 @@ var SDK_RELEASE = {
3068
3068
  // getters keep their established compatibility behavior.
3069
3069
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
3070
3070
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
3071
- version: "0.3.140",
3071
+ version: "0.3.142",
3072
3072
  updateSummary: "Play grep now returns concise results with the matched fields and terms. Automatic CLI updates are enabled by default; use `deepline settings autoupdate off` to opt out, `deepline settings autoupdate on` to re-enable updates, or `deepline settings autoupdate pin <version>` to hold an exact release.",
3073
3073
  packageCapabilities: {
3074
3074
  updatePreferences: 1
@@ -9630,6 +9630,7 @@ var DeeplineClient = class _DeeplineClient {
9630
9630
  "/api/v2/billing/plan-transitions",
9631
9631
  {
9632
9632
  action: options.action,
9633
+ ...options.action === "start_or_change" && options.billingEmail ? { billing_email: options.billingEmail } : {},
9633
9634
  ...options.targetPlanSku ? { target_plan_sku: options.targetPlanSku } : {}
9634
9635
  },
9635
9636
  { "Idempotency-Key": idempotencyKey },
@@ -11090,6 +11091,10 @@ function errorToJsonPayload(error) {
11090
11091
  if (maybeRecord?.details && typeof maybeRecord.details === "object" && !Array.isArray(maybeRecord.details)) {
11091
11092
  details.details = maybeRecord.details;
11092
11093
  }
11094
+ const providerConcurrency = providerConcurrencyDiagnostic(maybeRecord);
11095
+ if (providerConcurrency) {
11096
+ details.providerConcurrency = providerConcurrency;
11097
+ }
11093
11098
  if (typeof maybeRecord?.cause === "string") {
11094
11099
  details.cause = maybeRecord.cause;
11095
11100
  }
@@ -11103,6 +11108,33 @@ function errorToJsonPayload(error) {
11103
11108
  }
11104
11109
  };
11105
11110
  }
11111
+ function formatProviderConcurrencyDiagnostic(error) {
11112
+ const value = error && typeof error === "object" ? error : null;
11113
+ const diagnostic = providerConcurrencyDiagnostic(value);
11114
+ if (!diagnostic) return null;
11115
+ const count = diagnostic.inFlightProviderRequestsAt429;
11116
+ const concurrency = count > 1 ? `${count - 1} other same-provider request${count === 2 ? "" : "s"} overlapped the failed request` : "no other same-provider request was active";
11117
+ return `Provider concurrency at the 429: ${count} active request${count === 1 ? "" : "s"} in this Play execution, including the failed request; ${concurrency}. Other Play executions and direct CLI/API calls are not included.`;
11118
+ }
11119
+ function providerConcurrencyDiagnostic(value) {
11120
+ if (!value || value.origin !== "provider" || value.statusCode !== 429 && value.status !== 429) {
11121
+ return null;
11122
+ }
11123
+ const publicDetails = value.publicDetails;
11124
+ if (!publicDetails || typeof publicDetails !== "object" || Array.isArray(publicDetails)) {
11125
+ return null;
11126
+ }
11127
+ const details = publicDetails;
11128
+ const count = details.inFlightProviderRequestsAt429;
11129
+ if (details.providerConcurrencyScope !== "same_provider_in_play_execution" || details.includesFailedRequest !== true || typeof count !== "number" || !Number.isInteger(count) || count < 1) {
11130
+ return null;
11131
+ }
11132
+ return {
11133
+ scope: "same_provider_in_play_execution",
11134
+ inFlightProviderRequestsAt429: count,
11135
+ includesFailedRequest: true
11136
+ };
11137
+ }
11106
11138
  function printJsonError(error) {
11107
11139
  printJson(errorToJsonPayload(error));
11108
11140
  }
@@ -13141,6 +13173,7 @@ async function handleTargetPlan(planSku, options) {
13141
13173
  const payload = await new DeeplineClient().billing.transitionPlan({
13142
13174
  action: "start_or_change",
13143
13175
  targetPlanSku: planSku,
13176
+ ...options.billingEmail ? { billingEmail: options.billingEmail } : {},
13144
13177
  idempotencyKey
13145
13178
  });
13146
13179
  printCommandEnvelope(
@@ -13425,6 +13458,9 @@ Examples:
13425
13458
  billing.command("change-plan").description("Start or change the target billing plan.").argument(
13426
13459
  "<plan_sku>",
13427
13460
  "payg-v1, builder-v1, growth-v1, growth-canary-v1, or team-v1"
13461
+ ).option(
13462
+ "--billing-email <email>",
13463
+ "Invoice recipient when the account has no billing email"
13428
13464
  ).option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleTargetPlan);
13429
13465
  billing.command("cancel-plan").description("Cancel a target subscription at period end, or undo it.").option("--undo", "Undo a pending period-end cancellation").option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleTargetPlanCancellation);
13430
13466
  billing.command("portal").description("Open the Stripe-hosted billing recovery portal.").option("--no-open", "Print the URL without opening a browser").option("--json", "Emit JSON output").action(handleTargetPortal);
@@ -25377,6 +25413,14 @@ function buildRunPackageTextLines(packaged) {
25377
25413
  const lines = isRuntimeLimitCheckpoint ? runtimeLimitCheckpointLines(packaged, runId, checkpointFailure) : [
25378
25414
  `${status === "completed" ? "\u2713" : status === "failed" ? "\u2717" : "\u2022"} ${status} ${runId}`
25379
25415
  ];
25416
+ const outcome = typeof run.outcome === "string" ? run.outcome : null;
25417
+ if (outcome) lines.push(` outcome: ${outcome}`);
25418
+ const recovery = readRecord(run.recovery);
25419
+ if (recovery) {
25420
+ const mode = typeof recovery.mode === "string" ? recovery.mode : "recovered";
25421
+ const sourceRunId = typeof recovery.sourceRunId === "string" ? ` from ${recovery.sourceRunId}` : "";
25422
+ lines.push(` recovery: ${mode}${sourceRunId}`);
25423
+ }
25380
25424
  const runError = typeof run.error === "string" && run.error.trim() ? run.error.trim() : null;
25381
25425
  const structuredRuntimeLimitMessage = typeof runtimeLimitFailure?.message === "string" && runtimeLimitFailure.message.trim() ? `${typeof runtimeLimitFailure.code === "string" ? runtimeLimitFailure.code : "RUNTIME_LIMIT_EXCEEDED"}: ${runtimeLimitFailure.message.trim()}` : null;
25382
25426
  const displayRunError = structuredRuntimeLimitMessage ?? runError;
@@ -48089,6 +48133,8 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
48089
48133
  const inputSchema = publicToolInputSchemaForDescribe(
48090
48134
  recordField2(tool, "inputSchema", "input_schema")
48091
48135
  );
48136
+ const outputSchemaRecord = recordField2(tool, "outputSchema", "output_schema");
48137
+ const outputFields = toolOutputFieldsForDisplay(outputSchemaRecord);
48092
48138
  const usageGuidance = recordField2(tool, "usageGuidance", "usage_guidance");
48093
48139
  const toolExecutionResult = recordField2(
48094
48140
  usageGuidance,
@@ -48102,6 +48148,18 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
48102
48148
  arrayField2(toolExecutionResult, "extractedValues", "extracted_values")
48103
48149
  );
48104
48150
  const pricing = Capability.fromCatalogEntry(tool).describe().customerCost();
48151
+ const executionMetadataRecord = recordField2(
48152
+ tool,
48153
+ "executionMetadata",
48154
+ "execution_metadata"
48155
+ );
48156
+ const executionMetadata = Object.keys(executionMetadataRecord).length > 0 ? executionMetadataRecord : null;
48157
+ const batchCapabilityRecord = recordField2(
48158
+ tool,
48159
+ "batchCapability",
48160
+ "batch_capability"
48161
+ );
48162
+ const batchCapability = Object.keys(batchCapabilityRecord).length > 0 ? batchCapabilityRecord : null;
48105
48163
  const deprecation = recordField2(tool, "deprecation");
48106
48164
  const replacementToolId = stringField2(
48107
48165
  deprecation,
@@ -48135,14 +48193,14 @@ function toolContractJsonForDescribe(tool, requestedToolId) {
48135
48193
  ...deprecationExecution ? { execution: deprecationExecution } : {}
48136
48194
  }
48137
48195
  } : {},
48138
- inputFields: inputFields.map((field) => ({
48139
- name: field.name,
48140
- type: field.type ?? "unknown",
48141
- required: Boolean(field.required),
48142
- ...field.description ? { description: field.description } : {},
48143
- ...Object.prototype.hasOwnProperty.call(field, "default") ? { default: field.default } : {}
48144
- })),
48196
+ inputFields: inputFields.map(inputFieldJsonForDescribe),
48145
48197
  inputSchema,
48198
+ ...Object.keys(outputSchemaRecord).length > 0 ? {
48199
+ outputSchema: publicToolInputSchemaForDescribe(outputSchemaRecord),
48200
+ outputFields: outputFields.map(inputFieldJsonForDescribe)
48201
+ } : {},
48202
+ ...executionMetadata ? { executionMetadata } : {},
48203
+ ...batchCapability ? { batchCapability } : {},
48146
48204
  cost: pricing,
48147
48205
  getters: {
48148
48206
  extractedLists,
@@ -48294,6 +48352,8 @@ function printCompactToolContract(tool, requestedToolId) {
48294
48352
  if (Array.isArray(contract.categories) && contract.categories.length) {
48295
48353
  console.log(`Tags: ${contract.categories.join(", ")}`);
48296
48354
  }
48355
+ printToolOutputArrayShape(contract);
48356
+ printToolExecutionHints(contract);
48297
48357
  if (contract.deprecated === true) {
48298
48358
  const deprecation = isRecord12(contract.deprecation) ? contract.deprecation : {};
48299
48359
  const message = stringField2(deprecation, "message");
@@ -48330,12 +48390,13 @@ function printCompactToolContract(tool, requestedToolId) {
48330
48390
  const description = stringField2(field, "description");
48331
48391
  const enumValues = Array.isArray(field.enum) ? field.enum : [];
48332
48392
  const enumSuffix = enumValues.length ? ` enum=${enumValues.map(String).join("|")}` : "";
48393
+ const itemBoundsSuffix = arrayItemBoundsSuffix(field);
48333
48394
  const defaultSuffix = Object.prototype.hasOwnProperty.call(
48334
48395
  field,
48335
48396
  "default"
48336
48397
  ) ? ` default=${JSON.stringify(field.default)}` : "";
48337
48398
  console.log(
48338
- `- ${name}${required}: ${type}${enumSuffix}${defaultSuffix}${description ? ` - ${description}` : ""}`
48399
+ `- ${name}${required}: ${type}${enumSuffix}${itemBoundsSuffix}${defaultSuffix}${description ? ` - ${description}` : ""}`
48339
48400
  );
48340
48401
  }
48341
48402
  }
@@ -48415,15 +48476,17 @@ function printToolSchemaOnly(tool, requestedToolId) {
48415
48476
  const description = typeof field.description === "string" ? field.description : "";
48416
48477
  const enumValues = Array.isArray(field.enum) ? field.enum : [];
48417
48478
  const enumSuffix = enumValues.length ? ` enum=${enumValues.map(String).join("|")}` : "";
48479
+ const itemBoundsSuffix = arrayItemBoundsSuffix(field);
48418
48480
  const defaultSuffix = Object.prototype.hasOwnProperty.call(
48419
48481
  field,
48420
48482
  "default"
48421
48483
  ) ? ` default=${JSON.stringify(field.default)}` : "";
48422
48484
  console.log(
48423
- `- ${name}${required}: ${type}${enumSuffix}${defaultSuffix}${description ? ` - ${description}` : ""}`
48485
+ `- ${name}${required}: ${type}${enumSuffix}${itemBoundsSuffix}${defaultSuffix}${description ? ` - ${description}` : ""}`
48424
48486
  );
48425
48487
  }
48426
48488
  }
48489
+ printToolOutputArrayShape(contract);
48427
48490
  const declaredSchema = declaredToolJsonSchema(
48428
48491
  recordField2(contract, "inputSchema")
48429
48492
  );
@@ -48599,11 +48662,19 @@ function toolMetadataJsonForDescribe(tool, requestedToolId) {
48599
48662
  deepline_pricing_details: _snakeDeeplinePricingDetails,
48600
48663
  ...publicTool
48601
48664
  } = tool;
48665
+ const outputSchemaRecord = recordField2(tool, "outputSchema", "output_schema");
48602
48666
  return {
48603
48667
  ...publicTool,
48604
48668
  toolId,
48605
48669
  provider: tool.provider,
48606
48670
  displayName: tool.displayName,
48671
+ ...Object.keys(outputSchemaRecord).length > 0 ? {
48672
+ outputSchema: publicToolInputSchemaForDescribe(outputSchemaRecord),
48673
+ outputFields: toolOutputFieldsForDisplay(outputSchemaRecord).map(
48674
+ inputFieldJsonForDescribe
48675
+ )
48676
+ } : {},
48677
+ inputFields: inputFields.map(inputFieldJsonForDescribe),
48607
48678
  cost: Capability.fromCatalogEntry(tool).describe().customerCost(),
48608
48679
  usageGuidance,
48609
48680
  runtimeOutputHelp: {
@@ -48662,8 +48733,27 @@ function formatListedToolCost(tool) {
48662
48733
  return displayText ? `Cost: ${displayText}` : "";
48663
48734
  }
48664
48735
  function toolInputFieldsForDisplay(inputSchema) {
48665
- if (Array.isArray(inputSchema.fields))
48666
- return inputSchema.fields.filter(isRecord12);
48736
+ if (Array.isArray(inputSchema.fields)) {
48737
+ const fields = inputSchema.fields.filter(isRecord12);
48738
+ if (!isRecord12(inputSchema.jsonSchema)) return fields;
48739
+ const jsonSchemaFields = new Map(
48740
+ recursiveToolInputFieldsForDisplay({
48741
+ jsonSchema: inputSchema.jsonSchema
48742
+ }).flatMap(
48743
+ (field) => typeof field.name === "string" ? [[field.name, field]] : []
48744
+ )
48745
+ );
48746
+ return fields.map((field) => {
48747
+ const jsonSchemaField = typeof field.name === "string" ? jsonSchemaFields.get(field.name) : void 0;
48748
+ const minItems = typeof field.minItems === "number" ? field.minItems : jsonSchemaField?.minItems;
48749
+ const maxItems = typeof field.maxItems === "number" ? field.maxItems : jsonSchemaField?.maxItems;
48750
+ return {
48751
+ ...field,
48752
+ ...typeof minItems === "number" ? { minItems } : {},
48753
+ ...typeof maxItems === "number" ? { maxItems } : {}
48754
+ };
48755
+ });
48756
+ }
48667
48757
  const jsonSchema = isRecord12(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
48668
48758
  const properties = isRecord12(jsonSchema.properties) ? jsonSchema.properties : {};
48669
48759
  const required = Array.isArray(jsonSchema.required) ? new Set(jsonSchema.required.map(String)) : /* @__PURE__ */ new Set();
@@ -48674,10 +48764,36 @@ function toolInputFieldsForDisplay(inputSchema) {
48674
48764
  type: typeof property.type === "string" ? property.type : "unknown",
48675
48765
  required: required.has(name),
48676
48766
  description: property.description,
48767
+ ...typeof property.minItems === "number" ? { minItems: property.minItems } : {},
48768
+ ...typeof property.maxItems === "number" ? { maxItems: property.maxItems } : {},
48677
48769
  ...Object.prototype.hasOwnProperty.call(property, "default") ? { default: property.default } : {}
48678
48770
  };
48679
48771
  });
48680
48772
  }
48773
+ function toolOutputFieldsForDisplay(outputSchema) {
48774
+ if (Object.keys(outputSchema).length === 0) return [];
48775
+ return recursiveToolInputFieldsForDisplay({
48776
+ jsonSchema: outputSchema
48777
+ }).filter(
48778
+ (field) => typeof field.name === "string" && field.name.includes("[]")
48779
+ );
48780
+ }
48781
+ function printToolOutputArrayShape(tool) {
48782
+ const outputFields = toolOutputFieldsForDisplay(
48783
+ recordField2(isRecord12(tool) ? tool : {}, "outputSchema", "output_schema")
48784
+ );
48785
+ if (outputFields.length === 0) return;
48786
+ console.log(" Output array shape (declared schema):");
48787
+ for (const field of outputFields.slice(0, 60)) {
48788
+ const name = String(field.name);
48789
+ const type = stringField2(field, "type") || "unknown";
48790
+ const itemBounds = arrayItemBoundsSuffix(field);
48791
+ console.log(` - ${name}: ${type}${itemBounds}`);
48792
+ }
48793
+ if (outputFields.length > 60) {
48794
+ console.log(` - \u2026 ${outputFields.length - 60} more schema fields`);
48795
+ }
48796
+ }
48681
48797
  function canonicalToolJsonSchema(inputSchema) {
48682
48798
  return isRecord12(inputSchema.jsonSchema) ? inputSchema.jsonSchema : inputSchema;
48683
48799
  }
@@ -48767,6 +48883,8 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
48767
48883
  required,
48768
48884
  description: schema.description,
48769
48885
  ...Array.isArray(schema.enum) ? { enum: schema.enum } : {},
48886
+ ...typeof schema.minItems === "number" ? { minItems: schema.minItems } : {},
48887
+ ...typeof schema.maxItems === "number" ? { maxItems: schema.maxItems } : {},
48770
48888
  ...Object.prototype.hasOwnProperty.call(schema, "default") ? { default: schema.default } : {}
48771
48889
  });
48772
48890
  }
@@ -48798,6 +48916,121 @@ function recursiveToolInputFieldsForDisplay(inputSchema) {
48798
48916
  visit(root, "", false);
48799
48917
  return fields.size ? [...fields.values()] : toolInputFieldsForDisplay(inputSchema);
48800
48918
  }
48919
+ function inputFieldJsonForDescribe(field) {
48920
+ return {
48921
+ name: field.name,
48922
+ type: field.type ?? "unknown",
48923
+ required: Boolean(field.required),
48924
+ ...field.description ? { description: field.description } : {},
48925
+ ...typeof field.minItems === "number" ? { minItems: field.minItems } : {},
48926
+ ...typeof field.maxItems === "number" ? { maxItems: field.maxItems } : {},
48927
+ ...Object.prototype.hasOwnProperty.call(field, "default") ? { default: field.default } : {}
48928
+ };
48929
+ }
48930
+ function arrayItemBoundsSuffix(field) {
48931
+ const minItems = typeof field.minItems === "number" && Number.isFinite(field.minItems) ? field.minItems : null;
48932
+ const maxItems = typeof field.maxItems === "number" && Number.isFinite(field.maxItems) ? field.maxItems : null;
48933
+ if (minItems !== null && maxItems !== null) {
48934
+ return ` items=${minItems}..${maxItems}`;
48935
+ }
48936
+ if (minItems !== null) return ` minItems=${minItems}`;
48937
+ if (maxItems !== null) return ` maxItems=${maxItems}`;
48938
+ return "";
48939
+ }
48940
+ function printToolExecutionHints(value) {
48941
+ const batchCapabilityRecord = recordField2(
48942
+ isRecord12(value) ? value : {},
48943
+ "batchCapability",
48944
+ "batch_capability"
48945
+ );
48946
+ const batchCapability = Object.keys(batchCapabilityRecord).length > 0 ? batchCapabilityRecord : null;
48947
+ const executionMetadata = recordField2(
48948
+ isRecord12(value) ? value : {},
48949
+ "executionMetadata",
48950
+ "execution_metadata"
48951
+ );
48952
+ if (batchCapability) {
48953
+ const status = stringField2(batchCapability, "status") || "unknown";
48954
+ const surface = stringField2(batchCapability, "surface");
48955
+ const operation = stringField2(
48956
+ batchCapability,
48957
+ "batchOperation",
48958
+ "batch_operation"
48959
+ );
48960
+ const maxBatchSize = numberField2(
48961
+ batchCapability,
48962
+ "maxBatchSize",
48963
+ "max_batch_size"
48964
+ );
48965
+ const notes = stringField2(batchCapability, "notes");
48966
+ console.log("");
48967
+ console.log("Batching:");
48968
+ console.log(`- Catalog status: ${status}${surface ? ` (${surface})` : ""}`);
48969
+ if (operation) console.log(`- Batch operation: ${operation}`);
48970
+ if (maxBatchSize !== null) {
48971
+ console.log(`- Maximum batch size: ${maxBatchSize} items`);
48972
+ }
48973
+ if (status === "compiled") {
48974
+ console.log(
48975
+ "- Compatible per-row Play calls can coalesce; separate tools execute requests do not coalesce."
48976
+ );
48977
+ } else if (surface !== "docs") {
48978
+ console.log(
48979
+ "- Play does not automatically coalesce per-row calls for this operation; send a native batch as one request when its input schema supports one."
48980
+ );
48981
+ }
48982
+ if (notes) console.log(`- Details: ${notes}`);
48983
+ }
48984
+ const configuredRateLimits = arrayField2(
48985
+ executionMetadata,
48986
+ "configuredRateLimits",
48987
+ "configured_rate_limits"
48988
+ ).filter(isRecord12);
48989
+ if (configuredRateLimits.length > 0) {
48990
+ console.log("");
48991
+ console.log(
48992
+ "Configured Deepline pacing (guidance, not a guaranteed provider quota):"
48993
+ );
48994
+ for (const limit of configuredRateLimits) {
48995
+ const requests = numberField2(limit, "requestsPerWindow");
48996
+ const windowMs = numberField2(limit, "windowMs");
48997
+ if (requests === null || windowMs === null) continue;
48998
+ const usage = stringField2(limit, "usage") || "unknown";
48999
+ const usageText = usage === "queue_hint" ? "queue hint" : usage === "enforced" ? "Deepline enforced" : usage === "queue_hint_and_enforced" ? "queue hint and Deepline enforced" : usage === "disabled" ? "disabled" : usage;
49000
+ const explicitMaxConcurrency = numberField2(
49001
+ limit,
49002
+ "explicitMaxConcurrency",
49003
+ "explicit_max_concurrency"
49004
+ );
49005
+ const concurrencyText = explicitMaxConcurrency === null ? "no explicit concurrency limit" : `explicit concurrency limit ${explicitMaxConcurrency}`;
49006
+ console.log(
49007
+ `- ${requests} requests per ${formatRateWindow(windowMs)} (${usageText}; ${concurrencyText})`
49008
+ );
49009
+ }
49010
+ }
49011
+ const queueHint = recordField2(executionMetadata, "queueHint", "queue_hint");
49012
+ const requestsPerSecondHint = numberField2(
49013
+ queueHint,
49014
+ "requestsPerSecondHint",
49015
+ "requests_per_second_hint"
49016
+ );
49017
+ const derivedConcurrency = numberField2(
49018
+ queueHint,
49019
+ "derivedConcurrency",
49020
+ "derived_concurrency"
49021
+ );
49022
+ if (requestsPerSecondHint !== null && requestsPerSecondHint > 0 && derivedConcurrency !== null) {
49023
+ console.log(
49024
+ `Derived runtime queue hint: ${requestsPerSecondHint} requests/second; ${derivedConcurrency} derived concurrency. This is not an observed provider concurrency limit.`
49025
+ );
49026
+ }
49027
+ }
49028
+ function formatRateWindow(windowMs) {
49029
+ if (windowMs === 1e3) return "second";
49030
+ if (windowMs === 6e4) return "minute";
49031
+ if (windowMs === 36e5) return "hour";
49032
+ return `${windowMs}ms`;
49033
+ }
48801
49034
  function printSamples(samples) {
48802
49035
  const requestPayload = samplePayload(samples, "request");
48803
49036
  const responsePayload = samplePayload(samples, "response");
@@ -50784,6 +51017,8 @@ Examples:
50784
51017
  printJsonError(error);
50785
51018
  } else if (error instanceof Error) {
50786
51019
  console.error(`Error: ${error.message}`);
51020
+ const providerConcurrency = formatProviderConcurrencyDiagnostic(error);
51021
+ if (providerConcurrency) console.error(providerConcurrency);
50787
51022
  } else {
50788
51023
  console.error(`Error: ${String(error)}`);
50789
51024
  }