@shipfox/api-integration-github 12.3.0 → 12.6.0

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 (53) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +19 -0
  3. package/dist/api/client.d.ts.map +1 -1
  4. package/dist/api/client.js +15 -9
  5. package/dist/api/client.js.map +1 -1
  6. package/dist/api/github-octokit.d.ts +7 -0
  7. package/dist/api/github-octokit.d.ts.map +1 -0
  8. package/dist/api/github-octokit.js +32 -0
  9. package/dist/api/github-octokit.js.map +1 -0
  10. package/dist/api/installation-token-envelope.d.ts +5 -1
  11. package/dist/api/installation-token-envelope.d.ts.map +1 -1
  12. package/dist/api/installation-token-envelope.js +16 -5
  13. package/dist/api/installation-token-envelope.js.map +1 -1
  14. package/dist/api/installation-token-provider.d.ts.map +1 -1
  15. package/dist/api/installation-token-provider.js +4 -2
  16. package/dist/api/installation-token-provider.js.map +1 -1
  17. package/dist/api/shared-installation-token-cache.d.ts.map +1 -1
  18. package/dist/api/shared-installation-token-cache.js +10 -4
  19. package/dist/api/shared-installation-token-cache.js.map +1 -1
  20. package/dist/config.d.ts +1 -0
  21. package/dist/config.d.ts.map +1 -1
  22. package/dist/config.js +8 -0
  23. package/dist/config.js.map +1 -1
  24. package/dist/core/agent-tools.d.ts +11 -4
  25. package/dist/core/agent-tools.d.ts.map +1 -1
  26. package/dist/core/agent-tools.js +235 -24
  27. package/dist/core/agent-tools.js.map +1 -1
  28. package/dist/core/github-agent-tool-catalog.js +1 -1
  29. package/dist/core/github-agent-tool-catalog.js.map +1 -1
  30. package/dist/metrics/instance.d.ts +1 -0
  31. package/dist/metrics/instance.d.ts.map +1 -1
  32. package/dist/metrics/instance.js +19 -0
  33. package/dist/metrics/instance.js.map +1 -1
  34. package/dist/tsconfig.test.tsbuildinfo +1 -1
  35. package/package.json +2 -2
  36. package/src/api/client.test.ts +66 -10
  37. package/src/api/client.ts +44 -7
  38. package/src/api/github-octokit.test.ts +115 -0
  39. package/src/api/github-octokit.ts +49 -0
  40. package/src/api/installation-token-envelope.ts +24 -2
  41. package/src/api/installation-token-provider.test.ts +44 -5
  42. package/src/api/installation-token-provider.ts +5 -2
  43. package/src/api/shared-installation-token-cache.test.ts +28 -0
  44. package/src/api/shared-installation-token-cache.ts +7 -0
  45. package/src/config.ts +5 -0
  46. package/src/core/agent-tools.test.ts +1049 -8
  47. package/src/core/agent-tools.ts +388 -25
  48. package/src/core/github-agent-tool-catalog.ts +1 -1
  49. package/src/metrics/instance.ts +25 -0
  50. package/test/env.ts +1 -0
  51. package/test/fixtures/github-installation-token.ts +8 -0
  52. package/test/index.ts +4 -0
  53. package/tsconfig.build.tsbuildinfo +1 -1
@@ -113,6 +113,7 @@ export class SharedInstallationTokenCache implements InstallationTokenCache {
113
113
  throw providerErrorFromBackoff(
114
114
  envelope?.backoffReason ?? 'provider-unavailable',
115
115
  (envelope?.backoffUntil?.getTime() ?? now.getTime()) - now.getTime(),
116
+ envelope?.backoffError,
116
117
  );
117
118
  }
118
119
 
@@ -131,6 +132,10 @@ export class SharedInstallationTokenCache implements InstallationTokenCache {
131
132
  permissions: envelope?.permissions,
132
133
  backoffUntil: until,
133
134
  backoffReason: classified.reason,
135
+ backoffError: {
136
+ message: providerError.message,
137
+ ...(providerError.status === undefined ? {} : {status: providerError.status}),
138
+ },
134
139
  }).catch((writeError) => {
135
140
  logger().warn(
136
141
  {installationId: params.installationId, reason: classified.reason, error: writeError},
@@ -215,6 +220,7 @@ export class SharedInstallationTokenCache implements InstallationTokenCache {
215
220
  throw providerErrorFromBackoff(
216
221
  params.envelope.backoffReason,
217
222
  params.envelope.backoffUntil.getTime() - initialNow.getTime(),
223
+ params.envelope.backoffError,
218
224
  );
219
225
  }
220
226
 
@@ -231,6 +237,7 @@ export class SharedInstallationTokenCache implements InstallationTokenCache {
231
237
  throw providerErrorFromBackoff(
232
238
  envelope?.backoffReason ?? 'provider-unavailable',
233
239
  (envelope?.backoffUntil?.getTime() ?? now.getTime()) - now.getTime(),
240
+ envelope?.backoffError,
234
241
  );
235
242
  }
236
243
  }
package/src/config.ts CHANGED
@@ -29,6 +29,11 @@ export const config = createConfig({
29
29
  desc: 'Base URL used for GitHub REST API requests. Set this only for GitHub Enterprise Server or a compatible test server.',
30
30
  default: 'https://api.github.com',
31
31
  }),
32
+ GITHUB_INSTALLATION_TOKEN_FORMAT_OVERRIDE: str({
33
+ desc: 'Temporary GitHub installation token format override. Set this to enabled to request stateless tokens, disabled to request stateful tokens, or leave it unset to follow the GitHub rollout.',
34
+ choices: ['enabled', 'disabled'] as const,
35
+ default: undefined,
36
+ }),
32
37
  GITHUB_INSTALL_STATE_SECRET: str({
33
38
  desc: 'Secret used to sign the state token that protects the GitHub App install flow. Required.',
34
39
  }),