@framers/agentos-ext-github 0.6.0 → 0.7.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.
@@ -1,11 +1,12 @@
1
1
  /**
2
2
  * @fileoverview What a user token reaches (the person, the app's installations they can access, and the repositories
3
- * of an installation they can read), the app's own installations, listed and removed with its JWT, and the repositories
4
- * an installation reaches, listed with an installation token. Each function takes `{ fetchImpl, apiBase, timeoutMs }`
5
- * last: `fetch`, GitHub's API and a 30-second deadline a call when absent.
3
+ * of an installation they can read), the app's own installations, listed, read one at a time and removed with its JWT,
4
+ * each with when it was suspended, and the repositories an installation reaches, listed with an installation token, and
5
+ * those of them a caller holds that it no longer reaches. Each function takes `{ fetchImpl, apiBase, timeoutMs }` last:
6
+ * `fetch`, GitHub's API and a 30-second deadline a call when absent.
6
7
  * @module agentos-ext-github/app/installations
7
8
  */
8
- import { arrayOf, discardBody, GITHUB_API_BASE, GitHubApiError, githubFetch, githubSend, numberIn, objectOf, pages, stringIn, } from './http.js';
9
+ import { arrayOf, discardBody, GITHUB_API_BASE, GitHubApiError, githubFetch, githubPages, githubSend, numberIn, objectOf, pages, stringIn, } from './http.js';
9
10
  /** An installation's account, as GitHub answers it and as a webhook event names it: a login, or an enterprise's slug, and an id. */
10
11
  export function accountOf(value) {
11
12
  const account = objectOf(value, "an installation's account");
@@ -21,6 +22,11 @@ function installationOf(value) {
21
22
  account: fields.account === null || fields.account === undefined ? null : accountOf(fields.account),
22
23
  };
23
24
  }
25
+ /** An installation as the app's own calls answer it: `suspended_at` a time, or null when GitHub sends none. */
26
+ function appInstallationOf(value) {
27
+ const fields = objectOf(value, 'an installation');
28
+ return { ...installationOf(fields), suspendedAt: typeof fields.suspended_at === 'string' ? fields.suspended_at : null };
29
+ }
24
30
  /** The repositories of a page of a repository listing: each one's id, full name and default branch. */
25
31
  function repositoriesOfPage(page) {
26
32
  return arrayOf(objectOf(page, 'a page of repositories').repositories, 'a page of repositories').map((value) => {
@@ -48,6 +54,35 @@ export async function installationsOfUser(token, { fetchImpl = fetch, apiBase =
48
54
  export async function repositoriesOfUser(token, installationId, { fetchImpl = fetch, apiBase = GITHUB_API_BASE, timeoutMs } = {}) {
49
55
  return pages(fetchImpl, `${apiBase}/user/installations/${installationId}/repositories?per_page=100`, { token, timeoutMs }, repositoriesOfPage);
50
56
  }
57
+ /** The reads of an installation's repositories made before {@link GitHubListingChanged} is thrown. */
58
+ const LISTING_READS = 3;
59
+ /**
60
+ * An installation's repositories changed while each of {@link LISTING_READS} reads of its listing was read (its pages
61
+ * disagreed on GitHub's `total_count`), so no read is whole. The message names nothing of the installation.
62
+ */
63
+ export class GitHubListingChanged extends Error {
64
+ constructor() {
65
+ super("The installation's repositories changed while their listing was read");
66
+ this.name = 'GitHubListingChanged';
67
+ }
68
+ }
69
+ /**
70
+ * Reads `GET /installation/repositories` once, every page, keeping each page's `total_count`: a repository added to or
71
+ * taken off the installation between two pages changes it, and the read is not settled.
72
+ */
73
+ async function readInstallationListing(fetchImpl, url, token, timeoutMs) {
74
+ const repositories = [];
75
+ let count = null;
76
+ let settled = true;
77
+ for await (const page of githubPages(fetchImpl, url, { token, timeoutMs })) {
78
+ const total = numberIn(objectOf(page, 'a page of repositories'), 'total_count', 'a page of repositories');
79
+ if (count !== null && total !== count)
80
+ settled = false;
81
+ count = total;
82
+ repositories.push(...repositoriesOfPage(page));
83
+ }
84
+ return { repositories, settled };
85
+ }
51
86
  /**
52
87
  * Every repository an installation reaches (`GET /installation/repositories`), across every page, read with an
53
88
  * installation token that reads their metadata and nothing else (`credential.metadataToken`): the whole of what the
@@ -55,24 +90,88 @@ export async function repositoriesOfUser(token, installationId, { fetchImpl = fe
55
90
  * made is missing from it. The token is minted with the credential's own fetch; the pages are read with `fetchImpl`. A
56
91
  * held token GitHub refuses (401, as it refuses every token of an installation it no longer has) is dropped and one
57
92
  * new token asked for, once. A refused token request throws `GitHubApiError` (404 for an installation GitHub no longer
58
- * has), so a lost installation never reads as one that reaches no repository.
93
+ * has), so a lost installation never reads as one that reaches no repository. The listing is read a page at a time, and
94
+ * a repository added to or taken off the installation between two pages changes GitHub's `total_count` and can move
95
+ * another one past a page's end: a read whose pages disagree on that count is read again, up to three reads, and then
96
+ * {@link GitHubListingChanged} is thrown. An addition and a removal between the same two pages leave the count as it
97
+ * was and can still move one past a page's end, so {@link repositoriesLost} reads the listing twice before it answers a
98
+ * repository lost.
59
99
  */
60
100
  export async function repositoriesOfInstallation(credential, installationId, { fetchImpl = fetch, apiBase = GITHUB_API_BASE, timeoutMs } = {}) {
61
101
  const url = `${apiBase}/installation/repositories?per_page=100`;
102
+ const read = async () => {
103
+ try {
104
+ return await readInstallationListing(fetchImpl, url, await credential.metadataToken(installationId, { timeoutMs }), timeoutMs);
105
+ }
106
+ catch (error) {
107
+ if (!(error instanceof GitHubApiError) || error.status !== 401)
108
+ throw error;
109
+ credential.forget(installationId);
110
+ return readInstallationListing(fetchImpl, url, await credential.metadataToken(installationId, { timeoutMs }), timeoutMs);
111
+ }
112
+ };
113
+ for (let attempt = 1; attempt <= LISTING_READS; attempt += 1) {
114
+ const listing = await read();
115
+ if (listing.settled)
116
+ return listing.repositories;
117
+ }
118
+ throw new GitHubListingChanged();
119
+ }
120
+ /**
121
+ * Which of the repositories `held` an installation no longer reaches: those missing from its listing
122
+ * (`repositoriesOfInstallation`, each read one whose pages agree on GitHub's count) read twice, the second listing read
123
+ * only when the first misses one. An addition and a removal between the same two pages of a listing leave the count as
124
+ * it was and can move a repository the installation still reaches past a page's end, so a repository missing from one
125
+ * listing alone is not answered lost; one missing from both is. Answers in the order of `held`, each id once, and makes
126
+ * no request for an empty `held`. A refused listing, and one that kept changing (`GitHubListingChanged`), throws, so a
127
+ * failure never answers a repository lost.
128
+ *
129
+ * @param credential The app's credential, whose metadata token the listings are read with.
130
+ * @param installationId The installation.
131
+ * @param held The repositories the caller holds for the installation.
132
+ * @param options Where calls go.
133
+ */
134
+ export async function repositoriesLost(credential, installationId, held, options = {}) {
135
+ const missingFrom = (listed, among) => {
136
+ const reached = new Set(listed.map((repository) => repository.id));
137
+ return among.filter((id) => !reached.has(id));
138
+ };
139
+ const asked = [...new Set(held)];
140
+ if (asked.length === 0)
141
+ return [];
142
+ const first = missingFrom(await repositoriesOfInstallation(credential, installationId, options), asked);
143
+ if (first.length === 0)
144
+ return [];
145
+ return missingFrom(await repositoriesOfInstallation(credential, installationId, options), first);
146
+ }
147
+ /**
148
+ * Every installation of the app (`GET /app/installations`, with its JWT), across every page, each with when GitHub
149
+ * suspended it. The listing is read a page at a time, so an installation removed while it is read can move another one
150
+ * past a page's end, and that one is missing from the answer: `reconcileInstallations` asks for each linked
151
+ * installation it misses by its own address (`getInstallation`) before it answers one gone.
152
+ */
153
+ export async function listInstallations(credential, { fetchImpl = fetch, apiBase = GITHUB_API_BASE, timeoutMs } = {}) {
154
+ return pages(fetchImpl, `${apiBase}/app/installations?per_page=100`, { token: credential.jwt(), timeoutMs }, (page) => arrayOf(page, 'a page of installations').map(appInstallationOf));
155
+ }
156
+ /**
157
+ * One installation of the app (`GET /app/installations/{installation_id}`, with its JWT), with when GitHub suspended
158
+ * it, or null when GitHub no longer has it (404). Any other refusal throws {@link GitHubApiError}, and a call that gets
159
+ * no answer throws `GitHubNoAnswer`, so an installation is never answered gone on a failure.
160
+ *
161
+ * @param credential The app's credential.
162
+ * @param installationId The installation.
163
+ * @param options Where calls go.
164
+ */
165
+ export async function getInstallation(credential, installationId, { fetchImpl = fetch, apiBase = GITHUB_API_BASE, timeoutMs } = {}) {
62
166
  try {
63
- return await pages(fetchImpl, url, { token: await credential.metadataToken(installationId, { timeoutMs }), timeoutMs }, repositoriesOfPage);
167
+ return appInstallationOf(await githubFetch(fetchImpl, `${apiBase}/app/installations/${installationId}`, { token: credential.jwt(), timeoutMs }));
64
168
  }
65
169
  catch (error) {
66
- if (!(error instanceof GitHubApiError) || error.status !== 401)
67
- throw error;
68
- credential.forget(installationId);
69
- return pages(fetchImpl, url, { token: await credential.metadataToken(installationId, { timeoutMs }), timeoutMs }, repositoriesOfPage);
170
+ if (error instanceof GitHubApiError && error.status === 404)
171
+ return null;
172
+ throw error;
70
173
  }
71
174
  }
72
- /** Every installation of the app (`GET /app/installations`, with its JWT), across every page. */
73
- export async function listInstallations(credential, { fetchImpl = fetch, apiBase = GITHUB_API_BASE, timeoutMs } = {}) {
74
- return pages(fetchImpl, `${apiBase}/app/installations?per_page=100`, { token: credential.jwt(), timeoutMs }, (page) => arrayOf(page, 'a page of installations').map(installationOf));
75
- }
76
175
  /**
77
176
  * Uninstalls the app from an account (`DELETE /app/installations/{installation_id}`, with its JWT). Answers without an
78
177
  * error on a 2xx (202 at the pinned API version, where GitHub has taken the removal and does it in the background; 204
@@ -1 +1 @@
1
- {"version":3,"file":"installations.js","sourceRoot":"","sources":["../../src/app/installations.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACL,OAAO,EACP,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EACX,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,KAAK,EACL,QAAQ,GAET,MAAM,WAAW,CAAC;AAkCnB,oIAAoI;AACpI,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,EAAE,2BAA2B,CAAC,CAAC;IAC7D,OAAO;QACL,KAAK,EAAE,QAAQ,CAAC,OAAO,EAAE,OAAO,OAAO,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,2BAA2B,CAAC;QAC3G,EAAE,EAAE,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,2BAA2B,CAAC;KACzD,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC,CAAC;IAClD,OAAO;QACL,EAAE,EAAE,QAAQ,CAAC,MAAM,EAA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AC;AACH,CAAC"}
@@ -60,8 +60,17 @@ export interface DeliveriesOutcome {
60
60
  }
61
61
  /** What the reconcile found and did. */
62
62
  export interface ReconcileOutcome {
63
- /** Installations the app no longer has: their links and documents go. */
63
+ /**
64
+ * Installations the app no longer has: their links and documents go. Each one missing from the installations listing
65
+ * is asked for by its own address, and answered gone only when GitHub answers that 404.
66
+ */
64
67
  gone: number[];
68
+ /**
69
+ * The linked installations GitHub has suspended, each once, in the order of the links: none of their repositories is
70
+ * read, since GitHub blocks a suspended installation's access to the API, and a linked installation not here nor in
71
+ * `gone` is not suspended, whatever a missed `suspend` or `unsuspend` delivery would have said.
72
+ */
73
+ suspended: number[];
65
74
  /** Repositories to compare by tree, as a push to their default branch is. */
66
75
  moved: MovedRepository[];
67
76
  /** Deliveries asked for again. */
@@ -78,8 +87,11 @@ export interface ReconcileOutcome {
78
87
  retryAt: number | null;
79
88
  }
80
89
  /**
81
- * Reconciles a GitHub App's links with GitHub: an installation that `GET /app/installations` no longer lists is
82
- * answered gone; each repository of the other links has its default branch's head read by the repository's id
90
+ * Reconciles a GitHub App's links with GitHub: an installation that `GET /app/installations` no longer lists is asked
91
+ * for by its own address (`GET /app/installations/{installation_id}`, since the listing is read a page at a time and an
92
+ * installation removed meanwhile can move another past a page's end) and answered gone when GitHub answers that 404; an
93
+ * installation GitHub has suspended is answered suspended, its repositories not read; each repository of the other
94
+ * links has its default branch's head read by the repository's id
83
95
  * (`/repositories/<id>/branches/<branch>`, never by its name, which can come to mean another repository) with an
84
96
  * installation token narrowed to it, and is answered moved when the head differs from the one last read, or unreadable
85
97
  * with GitHub's status; and the app's failed deliveries since `since` are asked for again
@@ -95,10 +107,11 @@ export interface ReconcileOutcome {
95
107
  *
96
108
  * A call GitHub refuses for a rate limit ends the reconcile: no call follows it (GitHub may ban an integration that
97
109
  * keeps calling while it is rate limited), `retryAt` says when to run it again, and the outcome holds what was found
98
- * before the refusal. The gone installations are always whole, since they need no call past the listing; a repository
99
- * whose head read was refused for a rate limit is not unreadable, and the repositories after it and the deliveries
100
- * step wait for the next run. A rate limit on `GET /app/installations` itself throws `GitHubApiError` with its
101
- * `retryAt`, as any refusal of that listing does, before anything is found.
110
+ * before the refusal. The gone and the suspended installations are always whole, since they are settled before any
111
+ * head is read; a repository whose head read was refused for a rate limit is not unreadable, and the repositories after
112
+ * it and the deliveries step wait for the next run. A rate limit on `GET /app/installations` itself, or on an
113
+ * installation's own address, throws `GitHubApiError` with its `retryAt`, as any other refusal of those calls does
114
+ * (an installation's own address answering 404 apart), before anything is found.
102
115
  *
103
116
  * @param credential The app's credential.
104
117
  * @param links The links to check.
@@ -1 +1 @@
1
- {"version":3,"file":"reconcile.d.ts","sourceRoot":"","sources":["../../src/app/reconcile.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAYL,KAAK,gBAAgB,EACtB,MAAM,WAAW,CAAC;AAGnB,2GAA2G;AAC3G,MAAM,WAAW,mBAAmB;IAClC,mDAAmD;IACnD,EAAE,EAAE,MAAM,CAAC;IACX,mGAAmG;IACnG,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,oEAAoE;AACpE,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAC9C;AAED,+DAA+D;AAC/D,MAAM,WAAW,gBAAiB,SAAQ,gBAAgB;IACxD,iFAAiF;IACjF,KAAK,EAAE,IAAI,CAAC;CACb;AAED,uEAAuE;AACvE,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB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F;IAClF,UAAU,EAAE,iBAAiB,CAAC;IAC9B;;;;OAIG;IACH,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAyFD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,sBAAsB,CAC1C,UAAU,EAAE,mBAAmB,EAC/B,KAAK,EAAE,SAAS,aAAa,EAAE,EAC/B,EAAE,KAAK,EAAE,SAAiB,EAAE,OAAyB,EAAE,SAAS,EAAE,EAAE,gBAAgB,GACnF,OAAO,CAAC,gBAAgB,CAAC,CA8C3B"}
@@ -4,7 +4,7 @@
4
4
  * @module agentos-ext-github/app/reconcile
5
5
  */
6
6
  import { arrayOf, discardBody, GITHUB_API_BASE, GitHubApiError, githubFetch, githubPages, githubSend, numberIn, objectOf, repositoryPath, stringIn, } from './http.js';
7
- import { listInstallations } from './installations.js';
7
+ import { getInstallation, listInstallations } from './installations.js';
8
8
  /** Epoch milliseconds before which a call is not made again after GitHub refused it for a rate limit. */
9
9
  function rateLimitEnd(error) {
10
10
  // A rate limit always carries its time; a minute on, GitHub's own floor, should one ever come without it.
@@ -84,8 +84,11 @@ async function redeliverFailures(credential, since, fetchImpl, apiBase, timeoutM
84
84
  return { redelivered, deliveries: { listingStatus: null, refused }, retryAt: null };
85
85
  }
86
86
  /**
87
- * Reconciles a GitHub App's links with GitHub: an installation that `GET /app/installations` no longer lists is
88
- * answered gone; each repository of the other links has its default branch's head read by the repository's id
87
+ * Reconciles a GitHub App's links with GitHub: an installation that `GET /app/installations` no longer lists is asked
88
+ * for by its own address (`GET /app/installations/{installation_id}`, since the listing is read a page at a time and an
89
+ * installation removed meanwhile can move another past a page's end) and answered gone when GitHub answers that 404; an
90
+ * installation GitHub has suspended is answered suspended, its repositories not read; each repository of the other
91
+ * links has its default branch's head read by the repository's id
89
92
  * (`/repositories/<id>/branches/<branch>`, never by its name, which can come to mean another repository) with an
90
93
  * installation token narrowed to it, and is answered moved when the head differs from the one last read, or unreadable
91
94
  * with GitHub's status; and the app's failed deliveries since `since` are asked for again
@@ -101,25 +104,44 @@ async function redeliverFailures(credential, since, fetchImpl, apiBase, timeoutM
101
104
  *
102
105
  * A call GitHub refuses for a rate limit ends the reconcile: no call follows it (GitHub may ban an integration that
103
106
  * keeps calling while it is rate limited), `retryAt` says when to run it again, and the outcome holds what was found
104
- * before the refusal. The gone installations are always whole, since they need no call past the listing; a repository
105
- * whose head read was refused for a rate limit is not unreadable, and the repositories after it and the deliveries
106
- * step wait for the next run. A rate limit on `GET /app/installations` itself throws `GitHubApiError` with its
107
- * `retryAt`, as any refusal of that listing does, before anything is found.
107
+ * before the refusal. The gone and the suspended installations are always whole, since they are settled before any
108
+ * head is read; a repository whose head read was refused for a rate limit is not unreadable, and the repositories after
109
+ * it and the deliveries step wait for the next run. A rate limit on `GET /app/installations` itself, or on an
110
+ * installation's own address, throws `GitHubApiError` with its `retryAt`, as any other refusal of those calls does
111
+ * (an installation's own address answering 404 apart), before anything is found.
108
112
  *
109
113
  * @param credential The app's credential.
110
114
  * @param links The links to check.
111
115
  * @param options The window's start, and where calls go.
112
116
  */
113
117
  export async function reconcileInstallations(credential, links, { since, fetchImpl = fetch, apiBase = GITHUB_API_BASE, timeoutMs }) {
114
- const listed = new Set((await listInstallations(credential, { fetchImpl, apiBase, timeoutMs })).map((installation) => installation.id));
118
+ const listed = new Map((await listInstallations(credential, { fetchImpl, apiBase, timeoutMs })).map((installation) => [installation.id, installation]));
115
119
  const gone = [];
116
- for (const link of links)
117
- if (!listed.has(link.installationId) && !gone.includes(link.installationId))
118
- gone.push(link.installationId);
120
+ const suspended = [];
121
+ const settled = new Set();
122
+ for (const link of links) {
123
+ const installationId = link.installationId;
124
+ if (settled.has(installationId))
125
+ continue;
126
+ settled.add(installationId);
127
+ let installation = listed.get(installationId);
128
+ if (installation === undefined) {
129
+ // Missing from a listing read a page at a time is not gone: an installation removed meanwhile moves another past
130
+ // a page's end. GitHub's 404 at the installation's own address is.
131
+ const found = await getInstallation(credential, installationId, { fetchImpl, apiBase, timeoutMs });
132
+ if (found === null) {
133
+ gone.push(installationId);
134
+ continue;
135
+ }
136
+ installation = found;
137
+ }
138
+ if (installation.suspendedAt !== null)
139
+ suspended.push(installationId);
140
+ }
119
141
  const moved = [];
120
142
  const unreadable = [];
121
143
  for (const link of links) {
122
- if (!listed.has(link.installationId))
144
+ if (gone.includes(link.installationId) || suspended.includes(link.installationId))
123
145
  continue;
124
146
  for (const repository of link.repositories) {
125
147
  try {
@@ -134,13 +156,13 @@ export async function reconcileInstallations(credential, links, { since, fetchIm
134
156
  if (!(error instanceof GitHubApiError))
135
157
  throw error;
136
158
  if (error.rateLimited) {
137
- return { gone, moved, redelivered: [], unreadable, deliveries: { listingStatus: null, refused: [] }, retryAt: rateLimitEnd(error) };
159
+ return { gone, suspended, moved, redelivered: [], unreadable, deliveries: { listingStatus: null, refused: [] }, retryAt: rateLimitEnd(error) };
138
160
  }
139
161
  unreadable.push({ installationId: link.installationId, repositoryId: repository.id, status: error.status });
140
162
  }
141
163
  }
142
164
  }
143
165
  const { redelivered, deliveries, retryAt } = await redeliverFailures(credential, since.getTime(), fetchImpl, apiBase, timeoutMs);
144
- return { gone, moved, redelivered, unreadable, deliveries, retryAt };
166
+ return { gone, suspended, moved, redelivered, unreadable, deliveries, retryAt };
145
167
  }
146
168
  //# sourceMappingURL=reconcile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"reconcile.js","sourceRoot":"","sources":["../../src/app/reconcile.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,OAAO,EACP,WAAW,EACX,eAAe,EACf,cAAc,EACd,WAAW,EACX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,QAAQ,EACR,cAAc,EACd,QAAQ,GAET,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAkFvD,yGAAyG;AACzG,SAAS,YAAY,CAAC,KAAqB;IACzC,0GAA0G;IAC1G,OAAO,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ionOf, isGeneratedCode, TreeTooLarge, type
13
13
  export { appJwt, GitHubAppCredential, type GitHubAppIdentity, type InstallationTokenOptions } from '../app/credential.js';
14
14
  /** The user's web flow on the auth module's redirect flow. */
15
15
  export { GitHubAppUserFlow, GITHUB_OAUTH_ENDPOINTS, type GitHubAppClient, type GitHubAppUserFlowOptions, type GitHubOAuthEndpoints, } from '../app/userFlow.js';
16
- /** What a user token reaches, the app's own installations, and the repositories an installation reaches. */
17
- export { userOfToken, installationsOfUser, repositoriesOfUser, repositoriesOfInstallation, listInstallations, uninstallInstallation, type GitHubAccount, type GitHubInstallation, type GitHubUser, type InstallationRepository, type UserRepository, } from '../app/installations.js';
16
+ /**
17
+ * What a user token reaches, the app's own installations (each with when it was suspended), the repositories an
18
+ * installation reaches, and those of them a caller holds that it no longer reaches.
19
+ */
20
+ export { userOfToken, installationsOfUser, repositoriesOfUser, repositoriesOfInstallation, repositoriesLost, listInstallations, getInstallation, uninstallInstallation, GitHubListingChanged, type AppInstallation, type GitHubAccount, type GitHubInstallation, type GitHubUser, type InstallationRepository, type UserRepository, } from '../app/installations.js';
18
21
  /** A webhook delivery's signature. */
19
22
  export { verifyWebhookSignature } from '../app/webhook.js';
20
23
  /** A webhook delivery read as a typed event once its signature holds. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAE,KAAK,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC7H,yHAAyH;AACzH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KA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AAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAE,KAAK,sBAAsB,EAAE,KAAK,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAC7H,yHAAyH;AACzH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EACZ,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,EACzB,KAAK,eAAe,EACpB,KAAK,QAAQ,EACb,KAAK,UAAU,GAChB,MAAM,WAAW,CAAC;AACnB,6CAA6C;AAC7C,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAC1H,8DAA8D;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,GAC1B,MAAM,oBAAoB,CAAC;AAC5B;;;GAGG;AACH,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,EACpB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,KAAK,sBAAsB,EAC3B,KAAK,cAAc,GACpB,MAAM,yBAAyB,CAAC;AACjC,sCAAsC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,yEAAyE;AACzE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,EAC1B,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,qBAAqB,EAC1B,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,EACxC,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,gBAAgB,CAAC"}
@@ -13,8 +13,11 @@ export { readTree, pathFilter, extensionOf, isGeneratedCode, TreeTooLarge, DOCUM
13
13
  export { appJwt, GitHubAppCredential } from '../app/credential.js';
14
14
  /** The user's web flow on the auth module's redirect flow. */
15
15
  export { GitHubAppUserFlow, GITHUB_OAUTH_ENDPOINTS, } from '../app/userFlow.js';
16
- /** What a user token reaches, the app's own installations, and the repositories an installation reaches. */
17
- export { userOfToken, installationsOfUser, repositoriesOfUser, repositoriesOfInstallation, listInstallations, uninstallInstallation, } from '../app/installations.js';
16
+ /**
17
+ * What a user token reaches, the app's own installations (each with when it was suspended), the repositories an
18
+ * installation reaches, and those of them a caller holds that it no longer reaches.
19
+ */
20
+ export { userOfToken, installationsOfUser, repositoriesOfUser, repositoriesOfInstallation, repositoriesLost, listInstallations, getInstallation, uninstallInstallation, GitHubListingChanged, } from '../app/installations.js';
18
21
  /** A webhook delivery's signature. */
19
22
  export { verifyWebhookSignature } from '../app/webhook.js';
20
23
  /** A webhook delivery read as a typed event once its signature holds. */
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAsD,MAAM,+BAA+B,CAAC;AAC7H,yHAAyH;AACzH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EAEZ,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAI1B,MAAM,WAAW,CAAC;AACnB,6CAA6C;AAC7C,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAyD,MAAM,sBAAsB,CAAC;AAC1H,8DAA8D;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GAIvB,MAAM,oBAAoB,CAAC;AAC5B,4GAA4G;AAC5G,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,iBAAiB,EACjB,qBAAqB,GAMtB,MAAM,yBAAyB,CAAC;AACjC,sCAAsC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,yEAAyE;AACzE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,GAc3B,MAAM,kBAAkB,CAAC;AAC1B,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,GASvB,MAAM,qBAAqB,CAAC;AAC7B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,GAIf,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/documents/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,uEAAuE;AACvE,OAAO,EAAE,wBAAwB,EAAsD,MAAM,+BAA+B,CAAC;AAC7H,yHAAyH;AACzH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,eAAe,EACf,YAAY,EAEZ,mBAAmB,EACnB,eAAe,EACf,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAI1B,MAAM,WAAW,CAAC;AACnB,6CAA6C;AAC7C,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAyD,MAAM,sBAAsB,CAAC;AAC1H,8DAA8D;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GAIvB,MAAM,oBAAoB,CAAC;AAC5B;;;GAGG;AACH,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,0BAA0B,EAC1B,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,oBAAoB,GAOrB,MAAM,yBAAyB,CAAC;AACjC,sCAAsC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,yEAAyE;AACzE,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,0BAA0B,GAc3B,MAAM,kBAAkB,CAAC;AAC1B,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,GASvB,MAAM,qBAAqB,CAAC;AAC7B;;;GAGG;AACH,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,EACjB,cAAc,EACd,cAAc,GAIf,MAAM,gBAAgB,CAAC"}
package/manifest.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://agentos.sh/schemas/extension-manifest-v1.json",
3
3
  "id": "com.framers.integrations.github",
4
4
  "name": "GitHub Extension",
5
- "version": "0.6.0",
5
+ "version": "0.7.0",
6
6
  "description": "GitHub API tools: 26 tools for repos, issues, PRs, branches, commits, releases, Actions, files, gists, and codebase indexing. Its ./documents entry adds a GitHub App's installation mode (the app's JWT, installation tokens, the user's web flow, webhook deliveries checked and read as typed events, a daily reconcile, every call under a deadline with rate limit timing) and a connector that reads a repository's documentation as account sources.",
7
7
  "categories": ["tool", "developer"],
8
8
  "extensions": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@framers/agentos-ext-github",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "type": "module",
5
5
  "description": "GitHub API tools for AgentOS — search repos/code, manage issues/PRs, read files, create gists",
6
6
  "main": "dist/index.js",