@framers/agentos-ext-github 0.4.1 → 0.5.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.
- package/README.md +10 -6
- package/dist/__tests__/app.test.js +230 -8
- package/dist/__tests__/app.test.js.map +1 -1
- package/dist/__tests__/documents.test.d.ts +3 -2
- package/dist/__tests__/documents.test.d.ts.map +1 -1
- package/dist/__tests__/documents.test.js +201 -17
- package/dist/__tests__/documents.test.js.map +1 -1
- package/dist/__tests__/events.test.js +17 -0
- package/dist/__tests__/events.test.js.map +1 -1
- package/dist/app/events.d.ts +14 -10
- package/dist/app/events.d.ts.map +1 -1
- package/dist/app/events.js +17 -11
- package/dist/app/events.js.map +1 -1
- package/dist/app/http.d.ts +38 -8
- package/dist/app/http.d.ts.map +1 -1
- package/dist/app/http.js +112 -27
- package/dist/app/http.js.map +1 -1
- package/dist/app/installations.d.ts +3 -3
- package/dist/app/installations.js +4 -4
- package/dist/app/installations.js.map +1 -1
- package/dist/app/reconcile.d.ts +28 -6
- package/dist/app/reconcile.d.ts.map +1 -1
- package/dist/app/reconcile.js +34 -15
- package/dist/app/reconcile.js.map +1 -1
- package/dist/app/userFlow.d.ts +2 -1
- package/dist/app/userFlow.d.ts.map +1 -1
- package/dist/app/userFlow.js +12 -11
- package/dist/app/userFlow.js.map +1 -1
- package/dist/app/webhook.d.ts +7 -0
- package/dist/app/webhook.d.ts.map +1 -1
- package/dist/app/webhook.js +11 -2
- package/dist/app/webhook.js.map +1 -1
- package/dist/documents/GitHubDocumentsConnector.d.ts +14 -3
- package/dist/documents/GitHubDocumentsConnector.d.ts.map +1 -1
- package/dist/documents/GitHubDocumentsConnector.js +20 -8
- package/dist/documents/GitHubDocumentsConnector.js.map +1 -1
- package/dist/documents/index.d.ts +1 -1
- package/dist/documents/index.d.ts.map +1 -1
- package/dist/documents/index.js.map +1 -1
- package/dist/documents/tree.d.ts +27 -7
- package/dist/documents/tree.d.ts.map +1 -1
- package/dist/documents/tree.js +30 -10
- package/dist/documents/tree.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +2 -2
package/dist/app/userFlow.js
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
* and the code exchanged for a user access token, on the auth module's `RedirectOAuthFlow`. The token proves who the
|
|
4
4
|
* person is and which installations and repositories they can reach; it is used once, then revoked at GitHub and
|
|
5
5
|
* dropped, so the flow has no store. The exchange and the revocation end at their deadline; the token answer is read
|
|
6
|
-
* whole under a cap before it is parsed, and a revocation's answer is
|
|
6
|
+
* whole under a cap before it is parsed, its stream cancelled where the exchange ends, and a revocation's answer is
|
|
7
|
+
* told by its status alone.
|
|
7
8
|
* @module agentos-ext-github/app/userFlow
|
|
8
9
|
*/
|
|
9
|
-
import {
|
|
10
|
+
import { ReadCapExceeded } from '@framers/agentos-ext-account-sources';
|
|
10
11
|
import { OAuthGrantRefused, RedirectOAuthFlow } from '@framers/agentos/auth';
|
|
11
|
-
import { callDeadline, discardBody, GITHUB_API_BASE, GITHUB_API_VERSION, untilDeadline } from './http.js';
|
|
12
|
+
import { callDeadline, discardBody, GITHUB_API_BASE, GITHUB_API_VERSION, readBody, untilDeadline } from './http.js';
|
|
12
13
|
/** github.com's own authorize and token addresses. */
|
|
13
14
|
export const GITHUB_OAUTH_ENDPOINTS = {
|
|
14
15
|
authorize: 'https://github.com/login/oauth/authorize',
|
|
@@ -19,24 +20,24 @@ const TOKEN_ANSWER_BYTES = 65_536;
|
|
|
19
20
|
/**
|
|
20
21
|
* A fetch that ends each call at its deadline and hands on the answer only once its whole body is read under
|
|
21
22
|
* {@link TOKEN_ANSWER_BYTES}, so the auth module never waits on GitHub past the deadline, even through a fetch that
|
|
22
|
-
* leaves the request or the body open past its signal
|
|
23
|
-
* 308 would send the code and the client secret on to its
|
|
24
|
-
* call that gets no answer, or whose body stops before its
|
|
25
|
-
* error that names the cap.
|
|
23
|
+
* leaves the request or the body open past its signal; a body still being read at the deadline is cancelled there. A
|
|
24
|
+
* redirect is answered as it came and never followed: a 307 or 308 would send the code and the client secret on to its
|
|
25
|
+
* target, and the auth module refuses the redirect's status. A call that gets no answer, or whose body stops before its
|
|
26
|
+
* end, throws `GitHubNoAnswer`; a body past the cap throws an error that names the cap.
|
|
26
27
|
*/
|
|
27
28
|
function boundedFetch(fetchImpl, timeoutMs) {
|
|
28
29
|
return async (input, init) => {
|
|
29
30
|
const deadline = callDeadline(init?.signal ?? undefined, timeoutMs);
|
|
30
31
|
let response;
|
|
31
32
|
try {
|
|
32
|
-
response = await untilDeadline(fetchImpl(input, { ...init, redirect: 'manual', signal: deadline.signal }), deadline, (late) =>
|
|
33
|
+
response = await untilDeadline(fetchImpl(input, { ...init, redirect: 'manual', signal: deadline.signal }), deadline, (late) => discardBody(late));
|
|
33
34
|
}
|
|
34
35
|
catch {
|
|
35
36
|
throw deadline.noAnswer();
|
|
36
37
|
}
|
|
37
38
|
let bytes;
|
|
38
39
|
try {
|
|
39
|
-
bytes = await
|
|
40
|
+
bytes = await readBody(response, TOKEN_ANSWER_BYTES, deadline);
|
|
40
41
|
}
|
|
41
42
|
catch (error) {
|
|
42
43
|
if (error instanceof ReadCapExceeded)
|
|
@@ -132,13 +133,13 @@ export class GitHubAppUserFlow extends RedirectOAuthFlow {
|
|
|
132
133
|
body: JSON.stringify({ access_token: token }),
|
|
133
134
|
redirect: 'manual',
|
|
134
135
|
signal: deadline.signal,
|
|
135
|
-
}), deadline, (late) =>
|
|
136
|
+
}), deadline, (late) => discardBody(late));
|
|
136
137
|
}
|
|
137
138
|
catch {
|
|
138
139
|
throw deadline.noAnswer();
|
|
139
140
|
}
|
|
140
141
|
// The status is the whole answer: the body is let go unread, and the revocation never waits on it.
|
|
141
|
-
|
|
142
|
+
discardBody(response);
|
|
142
143
|
if (response.status !== 204)
|
|
143
144
|
throw new OAuthGrantRefused('revoke', response.status);
|
|
144
145
|
}
|
package/dist/app/userFlow.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userFlow.js","sourceRoot":"","sources":["../../src/app/userFlow.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"userFlow.js","sourceRoot":"","sources":["../../src/app/userFlow.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAgD,MAAM,uBAAuB,CAAC;AAC3H,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,kBAAkB,EAAqB,QAAQ,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAsBvI,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAyB;IAC1D,SAAS,EAAE,0CAA0C;IACrD,KAAK,EAAE,6CAA6C;CACrD,CAAC;AAEF,mFAAmF;AACnF,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,SAAuB,EAAE,SAA6B;IAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QAC3B,MAAM,QAAQ,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,IAAI,SAAS,EAAE,SAAS,CAAC,CAAC;QACpE,IAAI,QAAkB,CAAC;QACvB,IAAI,CAAC;YACH,QAAQ,GAAG,MAAM,aAAa,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,GAAG,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;QACpJ,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC5B,CAAC;QACD,IAAI,KAAiB,CAAC;QACtB,IAAI,CAAC;YACH,KAAK,GAAG,MAAM,QAAQ,CAAC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BACrF,MAAM,EAAE,QAAQ;gBAChB,OAAO,EAAE;oBACP,aAAa,EAAE,SAAS,WAAW,EAAE;oBACrC,MAAM,EAAE,6BAA6B;oBACrC,cAAc,EAAE,kBAAkB;oBAClC,sBAAsB,EAAE,kBAAkB;oBAC1C,YAAY,EAAE,oBAAoB;iBACnC;gBACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;gBAC7C,QAAQ,EAAE,QAAQ;gBAClB,MAAM,EAAE,QAAQ,CAAC,MAAM;aACxB,CAAC,EACF,QAAQ,EACR,CAAC,IAAI,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,CAC5B,CAAC;QACJ,CAAC;QAAC,MAAM,CAAC;YACP,MAAM,QAAQ,CAAC,QAAQ,EAAE,CAAC;QAC5B,CAAC;QACD,mGAAmG;QACnG,WAAW,CAAC,QAAQ,CAAC,CAAC;QACtB,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG;YAAE,MAAM,IAAI,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IACtF,CAAC;CACF"}
|
package/dist/app/webhook.d.ts
CHANGED
|
@@ -3,6 +3,13 @@
|
|
|
3
3
|
* body under the webhook's secret.
|
|
4
4
|
* @module agentos-ext-github/app/webhook
|
|
5
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* Throws a `TypeError` for an empty or missing webhook secret: anyone can sign a delivery under an empty key, so the
|
|
8
|
+
* fault is the host's configuration (such as a secret read from a setting that is not set), never the delivery's.
|
|
9
|
+
*
|
|
10
|
+
* @param secret The webhook's secret.
|
|
11
|
+
*/
|
|
12
|
+
export declare function requireWebhookSecret(secret: string): void;
|
|
6
13
|
/**
|
|
7
14
|
* True when `header` is `sha256=` and 64 hex digits that equal the HMAC SHA-256 of the raw body under the secret,
|
|
8
15
|
* compared in constant time. A missing header, another algorithm or another length is false.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/app/webhook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAOvG"}
|
|
1
|
+
{"version":3,"file":"webhook.d.ts","sourceRoot":"","sources":["../../src/app/webhook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAEzD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAOvG"}
|
package/dist/app/webhook.js
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
* @module agentos-ext-github/app/webhook
|
|
5
5
|
*/
|
|
6
6
|
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
7
|
+
/**
|
|
8
|
+
* Throws a `TypeError` for an empty or missing webhook secret: anyone can sign a delivery under an empty key, so the
|
|
9
|
+
* fault is the host's configuration (such as a secret read from a setting that is not set), never the delivery's.
|
|
10
|
+
*
|
|
11
|
+
* @param secret The webhook's secret.
|
|
12
|
+
*/
|
|
13
|
+
export function requireWebhookSecret(secret) {
|
|
14
|
+
if (!secret)
|
|
15
|
+
throw new TypeError('A webhook signature needs the webhook secret: anyone can sign a delivery under an empty one');
|
|
16
|
+
}
|
|
7
17
|
/**
|
|
8
18
|
* True when `header` is `sha256=` and 64 hex digits that equal the HMAC SHA-256 of the raw body under the secret,
|
|
9
19
|
* compared in constant time. A missing header, another algorithm or another length is false.
|
|
@@ -16,8 +26,7 @@ import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
|
16
26
|
* delivery's.
|
|
17
27
|
*/
|
|
18
28
|
export function verifyWebhookSignature(body, header, secret) {
|
|
19
|
-
|
|
20
|
-
throw new TypeError('A webhook signature needs the webhook secret: anyone can sign a delivery under an empty one');
|
|
29
|
+
requireWebhookSecret(secret);
|
|
21
30
|
const match = header === null ? null : /^sha256=([0-9a-f]{64})$/i.exec(header);
|
|
22
31
|
if (match === null)
|
|
23
32
|
return false;
|
package/dist/app/webhook.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/app/webhook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1D
|
|
1
|
+
{"version":3,"file":"webhook.js","sourceRoot":"","sources":["../../src/app/webhook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1D;;;;;GAKG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAc;IACjD,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,SAAS,CAAC,6FAA6F,CAAC,CAAC;AAClI,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAgB,EAAE,MAAqB,EAAE,MAAc;IAC5F,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC7B,MAAM,KAAK,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,0BAA0B,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/E,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IACjC,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;IACpE,OAAO,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC,MAAM,IAAI,eAAe,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A repository's documentation as account sources, read through a GitHub App's installation: each
|
|
3
|
-
* repository
|
|
4
|
-
* raw bytes under a cap, and a push compared by the tree at its `after` commit. A selection, an item
|
|
5
|
-
* cannot answer whole is refused before any request.
|
|
3
|
+
* repository read by its id, its tree read once a commit within a request budget, the documentation kept by a filter,
|
|
4
|
+
* each file read as raw bytes under a cap, and a push compared by the tree at its `after` commit. A selection, an item
|
|
5
|
+
* or a call it cannot answer whole is refused before any request.
|
|
6
6
|
* @module agentos-ext-github/documents/GitHubDocumentsConnector
|
|
7
7
|
*/
|
|
8
8
|
import { type AccountSourceConnector, type SourceChanges, type SourceGone, type SourceItem, type SourceRead, type SourceSelection } from '@framers/agentos-ext-account-sources';
|
|
@@ -10,7 +10,9 @@ import type { GitHubAppCredential } from '../app/credential.js';
|
|
|
10
10
|
import { type TreeBlob, type TreeFilter } from './tree.js';
|
|
11
11
|
/** One repository of a link. */
|
|
12
12
|
export interface LinkedRepository {
|
|
13
|
+
/** The repository's id: every read addresses the repository by it. */
|
|
13
14
|
id: number;
|
|
15
|
+
/** `owner/name`, which names the repository in a read's attribution link alone. */
|
|
14
16
|
fullName: string;
|
|
15
17
|
defaultBranch: string;
|
|
16
18
|
}
|
|
@@ -34,6 +36,13 @@ export interface GitHubChangesSelection extends SourceSelection {
|
|
|
34
36
|
* request: a `TypeError` for an id that is not a repository id, a repository named twice, an item id that names no
|
|
35
37
|
* file or a change set of other than one repository, and an `Error` for a repository outside the link. An
|
|
36
38
|
* installation is removed by the app's own call (`uninstallInstallation`), never by a link's connector.
|
|
39
|
+
*
|
|
40
|
+
* Every read addresses a linked repository by its id (`/repositories/<id>/...`, where GitHub's own redirects for a
|
|
41
|
+
* renamed or moved repository lead), never by its name. A name can come to mean another repository (a renamed
|
|
42
|
+
* repository's old name taken again, or an account's old login claimed by another account, which ends GitHub's
|
|
43
|
+
* redirects), and GitHub answers a public repository's branch, tree and files to any token, the installation token
|
|
44
|
+
* narrowed to the linked repository included, so a read by name could take in another account's repository. The full
|
|
45
|
+
* name builds the attribution link alone.
|
|
37
46
|
*/
|
|
38
47
|
export declare class GitHubDocumentsConnector implements AccountSourceConnector {
|
|
39
48
|
private readonly credential;
|
|
@@ -56,6 +65,8 @@ export declare class GitHubDocumentsConnector implements AccountSourceConnector
|
|
|
56
65
|
private repository;
|
|
57
66
|
/** An installation token narrowed to one repository, its request ended by the caller's signal. */
|
|
58
67
|
private token;
|
|
68
|
+
/** A linked repository's address under the API, by its id. */
|
|
69
|
+
private address;
|
|
59
70
|
/** The head commit of a repository's default branch. */
|
|
60
71
|
head(repositoryId: number, signal?: AbortSignal): Promise<string>;
|
|
61
72
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubDocumentsConnector.d.ts","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,UAAU,EAEf,KAAK,eAAe,EACrB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEhE,OAAO,EAA8E,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvI,gCAAgC;AAChC,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAu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
2
2
|
* @fileoverview A repository's documentation as account sources, read through a GitHub App's installation: each
|
|
3
|
-
* repository
|
|
4
|
-
* raw bytes under a cap, and a push compared by the tree at its `after` commit. A selection, an item
|
|
5
|
-
* cannot answer whole is refused before any request.
|
|
3
|
+
* repository read by its id, its tree read once a commit within a request budget, the documentation kept by a filter,
|
|
4
|
+
* each file read as raw bytes under a cap, and a push compared by the tree at its `after` commit. A selection, an item
|
|
5
|
+
* or a call it cannot answer whole is refused before any request.
|
|
6
6
|
* @module agentos-ext-github/documents/GitHubDocumentsConnector
|
|
7
7
|
*/
|
|
8
8
|
import { ReadCapExceeded, } from '@framers/agentos-ext-account-sources';
|
|
9
|
-
import { GITHUB_API_BASE, GitHubApiError, githubFetch, GitHubNoAnswer, githubSend, objectOf, stringIn } from '../app/http.js';
|
|
9
|
+
import { GITHUB_API_BASE, GitHubApiError, githubFetch, GitHubNoAnswer, githubSend, objectOf, repositoryPath, stringIn } from '../app/http.js';
|
|
10
10
|
import { DEFAULT_MAX_FILE_BYTES, extensionOf, pathFilter, readTree, SKIPPED_FOLDERS } from './tree.js';
|
|
11
11
|
/** The files answered as bytes with their media type; every other kept file is answered as text. */
|
|
12
12
|
const MEDIA_TYPES = {
|
|
@@ -81,6 +81,13 @@ function notCancelled(signal) {
|
|
|
81
81
|
* request: a `TypeError` for an id that is not a repository id, a repository named twice, an item id that names no
|
|
82
82
|
* file or a change set of other than one repository, and an `Error` for a repository outside the link. An
|
|
83
83
|
* installation is removed by the app's own call (`uninstallInstallation`), never by a link's connector.
|
|
84
|
+
*
|
|
85
|
+
* Every read addresses a linked repository by its id (`/repositories/<id>/...`, where GitHub's own redirects for a
|
|
86
|
+
* renamed or moved repository lead), never by its name. A name can come to mean another repository (a renamed
|
|
87
|
+
* repository's old name taken again, or an account's old login claimed by another account, which ends GitHub's
|
|
88
|
+
* redirects), and GitHub answers a public repository's branch, tree and files to any token, the installation token
|
|
89
|
+
* narrowed to the linked repository included, so a read by name could take in another account's repository. The full
|
|
90
|
+
* name builds the attribution link alone.
|
|
84
91
|
*/
|
|
85
92
|
export class GitHubDocumentsConnector {
|
|
86
93
|
credential;
|
|
@@ -117,11 +124,15 @@ export class GitHubDocumentsConnector {
|
|
|
117
124
|
token(id, signal) {
|
|
118
125
|
return this.credential.installationToken(this.installationId, [id], { signal });
|
|
119
126
|
}
|
|
127
|
+
/** A linked repository's address under the API, by its id. */
|
|
128
|
+
address(repository) {
|
|
129
|
+
return `${this.apiBase}/${repositoryPath(repository.id)}`;
|
|
130
|
+
}
|
|
120
131
|
/** The head commit of a repository's default branch. */
|
|
121
132
|
async head(repositoryId, signal) {
|
|
122
133
|
notCancelled(signal);
|
|
123
134
|
const repository = this.repository(repositoryId);
|
|
124
|
-
const url = `${this.
|
|
135
|
+
const url = `${this.address(repository)}/branches/${encodeURIComponent(repository.defaultBranch)}`;
|
|
125
136
|
const branch = objectOf(await githubFetch(this.fetchImpl, url, { token: await this.token(repositoryId, signal), signal }), 'a branch');
|
|
126
137
|
return stringIn(objectOf(branch.commit, "a branch's commit"), 'sha', "a branch's commit");
|
|
127
138
|
}
|
|
@@ -133,7 +144,7 @@ export class GitHubDocumentsConnector {
|
|
|
133
144
|
async listing(repositoryId, commit, signal) {
|
|
134
145
|
notCancelled(signal);
|
|
135
146
|
const repository = this.repository(repositoryId);
|
|
136
|
-
const tree = await readTree(this.fetchImpl, await this.token(repositoryId, signal), repository.
|
|
147
|
+
const tree = await readTree(this.fetchImpl, await this.token(repositoryId, signal), repository.id, commit, this.apiBase, {
|
|
137
148
|
maxRequests: this.filter.maxTreeRequests,
|
|
138
149
|
skipFolders: this.filter.skipFolders ?? SKIPPED_FOLDERS,
|
|
139
150
|
signal,
|
|
@@ -178,7 +189,7 @@ export class GitHubDocumentsConnector {
|
|
|
178
189
|
const repository = this.repository(repositoryId);
|
|
179
190
|
// A version that names no commit (none, no `@`, or nothing after it) reads the default branch.
|
|
180
191
|
const commit = (item.version ?? '').split('@')[1] || repository.defaultBranch;
|
|
181
|
-
const url = `${this.
|
|
192
|
+
const url = `${this.address(repository)}/contents/${encodedPath(path)}?ref=${encodeURIComponent(commit)}`;
|
|
182
193
|
// Minted outside the try below: a 404 there is the file's, and the token's own refusal must reach the caller.
|
|
183
194
|
const token = await this.token(repository.id, signal);
|
|
184
195
|
let answer;
|
|
@@ -203,7 +214,8 @@ export class GitHubDocumentsConnector {
|
|
|
203
214
|
kind: 'github',
|
|
204
215
|
title: path,
|
|
205
216
|
path,
|
|
206
|
-
|
|
217
|
+
// The ref's segments encoded as the path's are: Git allows a "#" in a branch name, which would end the address.
|
|
218
|
+
url: `https://github.com/${repository.fullName}/blob/${encodedPath(commit)}/${encodedPath(path)}`,
|
|
207
219
|
version: commit,
|
|
208
220
|
readAt: new Date().toISOString(),
|
|
209
221
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubDocumentsConnector.js","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,GAQhB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,EAAqB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"GitHubDocumentsConnector.js","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,eAAe,GAQhB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAqB,MAAM,gBAAgB,CAAC;AACjK,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAkC,MAAM,WAAW,CAAC;AAwBvI,oG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** The documentation connector and the shape of a push it compares. */
|
|
9
9
|
export { GitHubDocumentsConnector, type GitHubChangesSelection, type LinkedRepository } from './GitHubDocumentsConnector.js';
|
|
10
10
|
/** A repository's tree within a request budget, and the filter that keeps its documentation. */
|
|
11
|
-
export { readTree, pathFilter, extensionOf, TreeTooLarge, DOCUMENT_EXTENSIONS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, type ReadTreeOptions, type TreeBlob, type TreeFilter, } from './tree.js';
|
|
11
|
+
export { readTree, pathFilter, extensionOf, TreeTooLarge, type TreeTooLargeReason, DOCUMENT_EXTENSIONS, SKIPPED_FOLDERS, DEFAULT_MAX_FILES, DEFAULT_MAX_FILE_BYTES, DEFAULT_MAX_TREE_REQUESTS, type ReadTreeOptions, type TreeBlob, type TreeFilter, } from './tree.js';
|
|
12
12
|
/** The app's JWT and installation tokens. */
|
|
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. */
|
|
@@ -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,gGAAgG;AAChG,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,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,wBAAw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
|
+
{"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,gGAAgG;AAChG,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,YAAY,EACZ,KAAK,kBAAkB,EACvB,mBAAmB,EACnB,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,kEAAkE;AAClE,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,UAAU,EACf,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"}
|
|
@@ -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,gGAAgG;AAChG,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,YAAY,
|
|
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,gGAAgG;AAChG,OAAO,EACL,QAAQ,EACR,UAAU,EACV,WAAW,EACX,YAAY,EAEZ,mBAAmB,EACnB,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,kEAAkE;AAClE,OAAO,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,GAKtB,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/dist/documents/tree.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A repository's tree at a commit, read within a request budget, and the filter that keeps its
|
|
3
3
|
* documentation. GitHub cuts a recursive tree past 100,000 entries or 7 MB and marks it `truncated`; such a tree is
|
|
4
|
-
* read again one subtree at a time.
|
|
4
|
+
* read again one subtree at a time, and a level GitHub cuts short even when asked for alone is refused whole.
|
|
5
5
|
* @module agentos-ext-github/documents/tree
|
|
6
6
|
*/
|
|
7
7
|
/** One file of a tree: its path from the repository's root, its blob and its size in bytes. */
|
|
@@ -33,11 +33,23 @@ export declare const DEFAULT_MAX_FILES = 2000;
|
|
|
33
33
|
export declare const DEFAULT_MAX_FILE_BYTES = 10485760;
|
|
34
34
|
/** The tree requests one listing makes by default. */
|
|
35
35
|
export declare const DEFAULT_MAX_TREE_REQUESTS = 50;
|
|
36
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Why a tree cannot be read whole: `budget` when it needs more requests than its budget, `truncated` when GitHub cut
|
|
38
|
+
* short a level asked for without recursion, which no budget reads whole.
|
|
39
|
+
*/
|
|
40
|
+
export type TreeTooLargeReason = 'budget' | 'truncated';
|
|
41
|
+
/**
|
|
42
|
+
* A tree that cannot be read whole: past its request budget, or holding a folder GitHub cuts short even when asked for
|
|
43
|
+
* alone. Neither answers a part of the tree, since a file left out would read as removed.
|
|
44
|
+
*/
|
|
37
45
|
export declare class TreeTooLarge extends Error {
|
|
38
46
|
readonly maxRequests: number;
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
readonly reason: TreeTooLargeReason;
|
|
48
|
+
/**
|
|
49
|
+
* @param maxRequests The request budget of the read.
|
|
50
|
+
* @param reason Why the tree cannot be read whole; `budget` when absent.
|
|
51
|
+
*/
|
|
52
|
+
constructor(maxRequests: number, reason?: TreeTooLargeReason);
|
|
41
53
|
}
|
|
42
54
|
/** The budget of a tree read, the folders it never walks into, and its abort signal. */
|
|
43
55
|
export interface ReadTreeOptions {
|
|
@@ -53,16 +65,24 @@ export declare function extensionOf(path: string): string;
|
|
|
53
65
|
* Every file of a repository's tree at a commit (symbolic links aside). The tree is asked for recursively; when GitHub
|
|
54
66
|
* answers it truncated, its top level is read and each subtree is asked for the same way, so only the parts too large
|
|
55
67
|
* for one answer cost a request per folder. Each request counts against `maxRequests`, and the read throws
|
|
56
|
-
* {@link TreeTooLarge} rather than make one more.
|
|
68
|
+
* {@link TreeTooLarge} (`budget`) rather than make one more. A level GitHub answers truncated without recursion as well
|
|
69
|
+
* throws {@link TreeTooLarge} (`truncated`) at that answer, before any folder under it is asked for: the tree answer's
|
|
70
|
+
* `truncated` field can be set on any answer, and a part of the tree would leave out files that then read as removed.
|
|
71
|
+
*
|
|
72
|
+
* Name the repository by its id. A full name reads whatever repository holds that name when the tree is asked for: a
|
|
73
|
+
* renamed repository's old name can be taken again, and an account's old login claimed by another account, which ends
|
|
74
|
+
* GitHub's redirects to the repository; and GitHub answers a public repository's tree to any token, an installation
|
|
75
|
+
* token narrowed to other repositories included.
|
|
57
76
|
*
|
|
58
77
|
* @param fetchImpl The fetch the tree is read with.
|
|
59
78
|
* @param token An installation token that reads the repository.
|
|
60
|
-
* @param
|
|
79
|
+
* @param repository The repository's id, read at `/repositories/<id>`, or its full name, `owner/name`.
|
|
61
80
|
* @param commit The commit whose tree is read.
|
|
62
81
|
* @param apiBase GitHub's REST API, or a stand-in's address in tests.
|
|
63
82
|
* @param options The request budget, the folders skipped and an abort signal.
|
|
83
|
+
* @throws TypeError before any request when `repository` is a number that is not a positive integer.
|
|
64
84
|
*/
|
|
65
|
-
export declare function readTree(fetchImpl: typeof fetch, token: string,
|
|
85
|
+
export declare function readTree(fetchImpl: typeof fetch, token: string, repository: number | string, commit: string, apiBase?: string, options?: ReadTreeOptions): Promise<TreeBlob[]>;
|
|
66
86
|
/**
|
|
67
87
|
* The filter that keeps a tree's documentation: the extensions kept, nothing under a skipped folder, nothing past the
|
|
68
88
|
* size cap, in path order, at most `maxFiles`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/documents/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,+FAA+F;AAC/F,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,+GAA+G;AAC/G,MAAM,WAAW,UAAU;IACzB,0FAA0F;IAC1F,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,uFAAuF;IACvF,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,sFAAsF;IACtF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0IAA0I;IAC1I,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0GAA0G;IAC1G,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,qGAAqG;AACrG,eAAO,MAAM,mBAAmB,EAAE,SAAS,MAAM,EAA2E,CAAC;AAE7H,oFAAoF;AACpF,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E,MAAM;IAC5B,QAAQ,CAAC,MAAM,EAAE,kBAAkB;IANrC;;;OAGG;gBAEQ,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,kBAA6B;CAKjD;AAED,wFAAwF;AACxF,MAAM,WAAW,eAAe;IAC9B,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6FAA6F;IAC7F,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAsBD,sFAAsF;AACtF,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIhD;AAMD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,QAAQ,CAC5B,SAAS,EAAE,OAAO,KAAK,EACvB,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GAAG,MAAM,EAC3B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,MAAwB,EACjC,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,QAAQ,EAAE,CAAC,CAyCrB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,GAAE,UAAe,GAAG,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,KAAK,QAAQ,EAAE,CAU9F"}
|
package/dist/documents/tree.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A repository's tree at a commit, read within a request budget, and the filter that keeps its
|
|
3
3
|
* documentation. GitHub cuts a recursive tree past 100,000 entries or 7 MB and marks it `truncated`; such a tree is
|
|
4
|
-
* read again one subtree at a time.
|
|
4
|
+
* read again one subtree at a time, and a level GitHub cuts short even when asked for alone is refused whole.
|
|
5
5
|
* @module agentos-ext-github/documents/tree
|
|
6
6
|
*/
|
|
7
|
-
import { arrayOf, GITHUB_API_BASE, githubFetch, objectOf, stringIn } from '../app/http.js';
|
|
7
|
+
import { arrayOf, GITHUB_API_BASE, githubFetch, objectOf, repositoryPath, stringIn } from '../app/http.js';
|
|
8
8
|
/** The documentation kept by default: Markdown, text, reStructuredText, HTML, PDF and Word files. */
|
|
9
9
|
export const DOCUMENT_EXTENSIONS = ['.md', '.markdown', '.txt', '.rst', '.html', '.htm', '.pdf', '.docx'];
|
|
10
10
|
/** The folders skipped by default: dependencies, build output and vendored code. */
|
|
@@ -17,13 +17,21 @@ export const DEFAULT_MAX_FILE_BYTES = 10_485_760;
|
|
|
17
17
|
export const DEFAULT_MAX_TREE_REQUESTS = 50;
|
|
18
18
|
/** A symbolic link's mode in a tree; its blob holds the link's target, not a document. */
|
|
19
19
|
const SYMLINK_MODE = '120000';
|
|
20
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* A tree that cannot be read whole: past its request budget, or holding a folder GitHub cuts short even when asked for
|
|
22
|
+
* alone. Neither answers a part of the tree, since a file left out would read as removed.
|
|
23
|
+
*/
|
|
21
24
|
export class TreeTooLarge extends Error {
|
|
22
25
|
maxRequests;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
reason;
|
|
27
|
+
/**
|
|
28
|
+
* @param maxRequests The request budget of the read.
|
|
29
|
+
* @param reason Why the tree cannot be read whole; `budget` when absent.
|
|
30
|
+
*/
|
|
31
|
+
constructor(maxRequests, reason = 'budget') {
|
|
32
|
+
super(reason === 'budget' ? `the tree needs more than ${maxRequests} requests to read` : 'GitHub cut a folder of the tree short even when asked for alone');
|
|
26
33
|
this.maxRequests = maxRequests;
|
|
34
|
+
this.reason = reason;
|
|
27
35
|
this.name = 'TreeTooLarge';
|
|
28
36
|
}
|
|
29
37
|
}
|
|
@@ -50,16 +58,25 @@ function inSkippedFolder(path, skip) {
|
|
|
50
58
|
* Every file of a repository's tree at a commit (symbolic links aside). The tree is asked for recursively; when GitHub
|
|
51
59
|
* answers it truncated, its top level is read and each subtree is asked for the same way, so only the parts too large
|
|
52
60
|
* for one answer cost a request per folder. Each request counts against `maxRequests`, and the read throws
|
|
53
|
-
* {@link TreeTooLarge} rather than make one more.
|
|
61
|
+
* {@link TreeTooLarge} (`budget`) rather than make one more. A level GitHub answers truncated without recursion as well
|
|
62
|
+
* throws {@link TreeTooLarge} (`truncated`) at that answer, before any folder under it is asked for: the tree answer's
|
|
63
|
+
* `truncated` field can be set on any answer, and a part of the tree would leave out files that then read as removed.
|
|
64
|
+
*
|
|
65
|
+
* Name the repository by its id. A full name reads whatever repository holds that name when the tree is asked for: a
|
|
66
|
+
* renamed repository's old name can be taken again, and an account's old login claimed by another account, which ends
|
|
67
|
+
* GitHub's redirects to the repository; and GitHub answers a public repository's tree to any token, an installation
|
|
68
|
+
* token narrowed to other repositories included.
|
|
54
69
|
*
|
|
55
70
|
* @param fetchImpl The fetch the tree is read with.
|
|
56
71
|
* @param token An installation token that reads the repository.
|
|
57
|
-
* @param
|
|
72
|
+
* @param repository The repository's id, read at `/repositories/<id>`, or its full name, `owner/name`.
|
|
58
73
|
* @param commit The commit whose tree is read.
|
|
59
74
|
* @param apiBase GitHub's REST API, or a stand-in's address in tests.
|
|
60
75
|
* @param options The request budget, the folders skipped and an abort signal.
|
|
76
|
+
* @throws TypeError before any request when `repository` is a number that is not a positive integer.
|
|
61
77
|
*/
|
|
62
|
-
export async function readTree(fetchImpl, token,
|
|
78
|
+
export async function readTree(fetchImpl, token, repository, commit, apiBase = GITHUB_API_BASE, options = {}) {
|
|
79
|
+
const address = `${apiBase}/${repositoryPath(repository)}`;
|
|
63
80
|
const maxRequests = options.maxRequests ?? DEFAULT_MAX_TREE_REQUESTS;
|
|
64
81
|
const skip = new Set(options.skipFolders ?? []);
|
|
65
82
|
const blobs = [];
|
|
@@ -68,7 +85,7 @@ export async function readTree(fetchImpl, token, repo, commit, apiBase = GITHUB_
|
|
|
68
85
|
if (requests >= maxRequests)
|
|
69
86
|
throw new TreeTooLarge(maxRequests);
|
|
70
87
|
requests += 1;
|
|
71
|
-
const url = `${
|
|
88
|
+
const url = `${address}/git/trees/${encodeURIComponent(sha)}${recursive ? '?recursive=1' : ''}`;
|
|
72
89
|
const answer = objectOf(await githubFetch(fetchImpl, url, { token, signal: options.signal }), 'a tree');
|
|
73
90
|
return { truncated: answer.truncated === true, entries: arrayOf(answer.tree, 'a tree').map(entryOf) };
|
|
74
91
|
};
|
|
@@ -85,6 +102,9 @@ export async function readTree(fetchImpl, token, repo, commit, apiBase = GITHUB_
|
|
|
85
102
|
return;
|
|
86
103
|
}
|
|
87
104
|
const top = await read(sha, false);
|
|
105
|
+
// A level cut short read on would leave out the files past the cut, which would then read as removed.
|
|
106
|
+
if (top.truncated)
|
|
107
|
+
throw new TreeTooLarge(maxRequests, 'truncated');
|
|
88
108
|
for (const entry of top.entries) {
|
|
89
109
|
if (entry.type === 'tree') {
|
|
90
110
|
if (!skip.has(entry.path))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/documents/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../src/documents/tree.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAuB3G,qGAAqG;AACrG,MAAM,CAAC,MAAM,mBAAmB,GAAsB,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAE7H,oFAAoF;AACpF,MAAM,CAAC,MAAM,eAAe,GAAsB,CAAC,cAAc,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,CAAC;AAErH,iCAAiC;AACjC,MAA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CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,IAAI,YAAY,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SAC1H,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SAChE,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;AAC1B,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.
|
|
5
|
+
"version": "0.5.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.
|
|
3
|
+
"version": "0.5.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",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"typescript": "^5.0.0",
|
|
46
46
|
"vitest": "^3.2.7",
|
|
47
47
|
"@framers/agentos": "^0.13.134",
|
|
48
|
-
"@framers/agentos-ext-account-sources": "^0.7.
|
|
48
|
+
"@framers/agentos-ext-account-sources": "^0.7.3"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=22"
|