@framers/agentos-ext-github 0.3.0 → 0.4.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 +11 -5
- package/dist/__tests__/app.test.js +74 -0
- package/dist/__tests__/app.test.js.map +1 -1
- package/dist/__tests__/documents.test.d.ts +2 -1
- package/dist/__tests__/documents.test.d.ts.map +1 -1
- package/dist/__tests__/documents.test.js +154 -3
- package/dist/__tests__/documents.test.js.map +1 -1
- package/dist/__tests__/entry.test.d.ts +2 -1
- package/dist/__tests__/entry.test.d.ts.map +1 -1
- package/dist/__tests__/entry.test.js +19 -2
- package/dist/__tests__/entry.test.js.map +1 -1
- package/dist/app/credential.d.ts +11 -2
- package/dist/app/credential.d.ts.map +1 -1
- package/dist/app/credential.js +6 -2
- package/dist/app/credential.js.map +1 -1
- package/dist/app/http.d.ts +2 -1
- package/dist/app/http.d.ts.map +1 -1
- package/dist/app/http.js +27 -9
- package/dist/app/http.js.map +1 -1
- package/dist/app/reconcile.d.ts +2 -1
- package/dist/app/reconcile.d.ts.map +1 -1
- package/dist/app/reconcile.js +3 -2
- package/dist/app/reconcile.js.map +1 -1
- package/dist/app/userFlow.d.ts +28 -10
- package/dist/app/userFlow.d.ts.map +1 -1
- package/dist/app/userFlow.js +42 -10
- package/dist/app/userFlow.js.map +1 -1
- package/dist/documents/GitHubDocumentsConnector.d.ts +33 -15
- package/dist/documents/GitHubDocumentsConnector.d.ts.map +1 -1
- package/dist/documents/GitHubDocumentsConnector.js +98 -26
- 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/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/manifest.json +27 -27
- package/package.json +1 -1
package/dist/app/userFlow.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A GitHub App's user authorization on a web server: GitHub's authorize address with `state` and PKCE,
|
|
3
3
|
* and the code exchanged for a user access token, on the auth module's `RedirectOAuthFlow`. The token proves who the
|
|
4
|
-
* person is and which installations and repositories they can reach; it is used once
|
|
5
|
-
* store. The exchange
|
|
4
|
+
* person is and which installations and repositories they can reach; it is used once, then revoked at GitHub and
|
|
5
|
+
* dropped, so the flow has no store. The exchange and the revocation run under a deadline, and each answer is read
|
|
6
|
+
* whole under a cap before it is read.
|
|
6
7
|
* @module agentos-ext-github/app/userFlow
|
|
7
8
|
*/
|
|
8
9
|
import { readCapped, ReadCapExceeded } from '@framers/agentos-ext-account-sources';
|
|
9
|
-
import { RedirectOAuthFlow } from '@framers/agentos/auth';
|
|
10
|
-
import { callDeadline } from './http.js';
|
|
10
|
+
import { OAuthGrantRefused, RedirectOAuthFlow } from '@framers/agentos/auth';
|
|
11
|
+
import { callDeadline, GITHUB_API_BASE, GITHUB_API_VERSION } from './http.js';
|
|
11
12
|
/** github.com's own authorize and token addresses. */
|
|
12
13
|
export const GITHUB_OAUTH_ENDPOINTS = {
|
|
13
14
|
authorize: 'https://github.com/login/oauth/authorize',
|
|
@@ -50,26 +51,30 @@ function boundedFetch(fetchImpl, timeoutMs) {
|
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
52
53
|
* The user's web flow for a GitHub App: `begin` answers the authorize address with the state and the PKCE verifier
|
|
53
|
-
* for the caller to keep,
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
54
|
+
* for the caller to keep, `complete` checks the state and exchanges the code (with `code_verifier`, asking for a JSON
|
|
55
|
+
* answer) for the user's token, and `revoke` deletes that token at GitHub once the caller is done with it. A GitHub
|
|
56
|
+
* App's permissions are the app's, not the token's, so the address carries no `scope`. The exchange and a revocation
|
|
57
|
+
* end at their deadline with `GitHubNoAnswer`, and a redirect from either address is refused with `OAuthGrantRefused`
|
|
58
|
+
* (reason `exchange` or `revoke`, the redirect's status), never followed.
|
|
57
59
|
*/
|
|
58
60
|
export class GitHubAppUserFlow extends RedirectOAuthFlow {
|
|
59
61
|
client;
|
|
60
62
|
endpoints;
|
|
61
63
|
/** The provider's id. */
|
|
62
64
|
providerId = 'github';
|
|
65
|
+
/** GitHub's REST API, where `revoke` deletes a token. */
|
|
66
|
+
apiBase;
|
|
63
67
|
/**
|
|
64
68
|
* @param client The app's client id and client secret.
|
|
65
|
-
* @param fetchImpl The fetch the code is exchanged with.
|
|
69
|
+
* @param fetchImpl The fetch the code is exchanged and a token revoked with.
|
|
66
70
|
* @param endpoints GitHub's authorize and token addresses.
|
|
67
|
-
* @param options The exchange's
|
|
71
|
+
* @param options The deadline of the exchange and of a revocation, and GitHub's REST API.
|
|
68
72
|
*/
|
|
69
73
|
constructor(client, fetchImpl = fetch, endpoints = GITHUB_OAUTH_ENDPOINTS, options = {}) {
|
|
70
74
|
super(null, boundedFetch(fetchImpl, options.timeoutMs));
|
|
71
75
|
this.client = client;
|
|
72
76
|
this.endpoints = endpoints;
|
|
77
|
+
this.apiBase = options.apiBase ?? GITHUB_API_BASE;
|
|
73
78
|
}
|
|
74
79
|
/** GitHub's addresses and the app's client, with no scopes. */
|
|
75
80
|
getConfig() {
|
|
@@ -89,5 +94,32 @@ export class GitHubAppUserFlow extends RedirectOAuthFlow {
|
|
|
89
94
|
address.searchParams.delete('scope');
|
|
90
95
|
return { ...begun, url: address.toString() };
|
|
91
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Deletes a user access token at GitHub, so a token the caller is done with stops working at once instead of at its
|
|
99
|
+
* expiry: GitHub's "Delete an app token" (`DELETE /applications/{client_id}/token` with the token in a JSON body),
|
|
100
|
+
* authenticated as the app with Basic authentication, its client id and client secret
|
|
101
|
+
* (https://docs.github.com/en/rest/apps/oauth-applications#delete-an-app-token). GitHub answers 204. Any other answer
|
|
102
|
+
* throws `OAuthGrantRefused` (reason `revoke`, its status) without its body, a redirect is refused rather than
|
|
103
|
+
* followed so the client secret reaches GitHub's API alone, and a call that gets no answer by the flow's deadline
|
|
104
|
+
* throws `GitHubNoAnswer`.
|
|
105
|
+
*
|
|
106
|
+
* @param token The user access token to delete.
|
|
107
|
+
*/
|
|
108
|
+
async revoke(token) {
|
|
109
|
+
const credentials = Buffer.from(`${this.client.clientId}:${this.client.clientSecret}`).toString('base64');
|
|
110
|
+
const response = await this.fetchImpl(`${this.apiBase}/applications/${encodeURIComponent(this.client.clientId)}/token`, {
|
|
111
|
+
method: 'DELETE',
|
|
112
|
+
headers: {
|
|
113
|
+
authorization: `Basic ${credentials}`,
|
|
114
|
+
accept: 'application/vnd.github+json',
|
|
115
|
+
'content-type': 'application/json',
|
|
116
|
+
'x-github-api-version': GITHUB_API_VERSION,
|
|
117
|
+
'user-agent': 'agentos-ext-github',
|
|
118
|
+
},
|
|
119
|
+
body: JSON.stringify({ access_token: token }),
|
|
120
|
+
});
|
|
121
|
+
if (!response.ok)
|
|
122
|
+
throw new OAuthGrantRefused('revoke', response.status);
|
|
123
|
+
}
|
|
92
124
|
}
|
|
93
125
|
//# sourceMappingURL=userFlow.js.map
|
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;;;;;;;GAOG;AAEH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACnF,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAgD,MAAM,uBAAuB,CAAC;AAC3H,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAqB,MAAM,WAAW,CAAC;AAsBjG,sDAAsD;AACtD,MAAM,CAAC,MAAM,sBAAsB,GAAyB;IAC1D,SAAS,EAAE,0CAA0C;IACrD,KAAK,EAAE,6CAA6C;CACrD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AC,QAAQ,IAAI,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC1G,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,OAAO,iBAAiB,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE;YACtH,MAAM,EAAE,QAAQ;YAChB,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS,WAAW,EAAE;gBACrC,MAAM,EAAE,6BAA6B;gBACrC,cAAc,EAAE,kBAAkB;gBAClC,sBAAsB,EAAE,kBAAkB;gBAC1C,YAAY,EAAE,oBAAoB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC;SAC9C,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE;YAAE,MAAM,IAAI,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3E,CAAC;CACF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A repository's documentation as account sources, read through a GitHub App's installation: each
|
|
3
3
|
* repository's tree read once a commit within a request budget, the documentation kept by a filter, each file read as
|
|
4
|
-
* raw bytes under a cap, and a push compared by the tree at its `after` commit.
|
|
4
|
+
* raw bytes under a cap, and a push compared by the tree at its `after` commit. A selection, an item or a call it
|
|
5
|
+
* cannot answer whole is refused before any request.
|
|
5
6
|
* @module agentos-ext-github/documents/GitHubDocumentsConnector
|
|
6
7
|
*/
|
|
7
8
|
import { type AccountSourceConnector, type SourceChanges, type SourceGone, type SourceItem, type SourceRead, type SourceSelection } from '@framers/agentos-ext-account-sources';
|
|
@@ -14,7 +15,7 @@ export interface LinkedRepository {
|
|
|
14
15
|
defaultBranch: string;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
|
-
* What `changesSince` compares:
|
|
18
|
+
* What `changesSince` compares: one repository (`ids` holds its id alone), and from a push its `after` commit and its
|
|
18
19
|
* `ref`, with the listing at `after` when the caller holds it.
|
|
19
20
|
*/
|
|
20
21
|
export interface GitHubChangesSelection extends SourceSelection {
|
|
@@ -22,13 +23,17 @@ export interface GitHubChangesSelection extends SourceSelection {
|
|
|
22
23
|
after?: string;
|
|
23
24
|
/** The push's ref, such as `refs/heads/main`; a push to another branch than the default changes nothing. */
|
|
24
25
|
ref?: string;
|
|
25
|
-
/** The documentation's listing at `after`, which spares the tree's read. */
|
|
26
|
+
/** The documentation's listing at `after`, which spares the tree's read; taken only with the `after` it was read at. */
|
|
26
27
|
listing?: readonly TreeBlob[];
|
|
27
28
|
}
|
|
28
29
|
/**
|
|
29
30
|
* A repository's documentation as account sources: an item's id is `<repositoryId>:<path>`, its version
|
|
30
31
|
* `<blob>@<commit>`, and the cursor of `changesSince` the JSON of each documentation path's blob at the commit last
|
|
31
|
-
* read.
|
|
32
|
+
* read. A repository id is a positive integer in decimal. A call whose signal is already aborted throws
|
|
33
|
+
* `GitHubNoAnswer` (`cancelled`) before it checks anything else. What a call cannot answer whole then throws before any
|
|
34
|
+
* request: a `TypeError` for an id that is not a repository id, a repository named twice, an item id that names no
|
|
35
|
+
* file or a change set of other than one repository, and an `Error` for a repository outside the link. An
|
|
36
|
+
* installation is removed by the app's own call (`uninstallInstallation`), never by a link's connector.
|
|
32
37
|
*/
|
|
33
38
|
export declare class GitHubDocumentsConnector implements AccountSourceConnector {
|
|
34
39
|
private readonly credential;
|
|
@@ -47,34 +52,47 @@ export declare class GitHubDocumentsConnector implements AccountSourceConnector
|
|
|
47
52
|
* @param apiBase GitHub's REST API, or a stand-in's address in tests.
|
|
48
53
|
*/
|
|
49
54
|
constructor(credential: GitHubAppCredential, installationId: number, repositories: readonly LinkedRepository[], filter?: TreeFilter, fetchImpl?: typeof fetch, apiBase?: string);
|
|
55
|
+
/** The linked repository of an id; one outside the link throws. */
|
|
50
56
|
private repository;
|
|
57
|
+
/** An installation token narrowed to one repository, its request ended by the caller's signal. */
|
|
51
58
|
private token;
|
|
52
59
|
/** The head commit of a repository's default branch. */
|
|
53
60
|
head(repositoryId: number, signal?: AbortSignal): Promise<string>;
|
|
54
61
|
/**
|
|
55
62
|
* The documentation files of a repository at a commit: its tree read once within the request budget, never walking
|
|
56
|
-
* a skipped folder, then filtered. A caller keeps it for that commit and hands it to `changesSince
|
|
63
|
+
* a skipped folder, then filtered. A caller keeps it for that commit and hands it to `changesSince` with that commit
|
|
64
|
+
* as `after`.
|
|
57
65
|
*/
|
|
58
66
|
listing(repositoryId: number, commit: string, signal?: AbortSignal): Promise<TreeBlob[]>;
|
|
59
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* The documentation of each selected repository (its id in `ids`) at its default branch's head. Every id is checked
|
|
69
|
+
* before any repository is read, so a selection is listed whole or not at all: an id that is not a repository id, or
|
|
70
|
+
* a repository named twice, throws a `TypeError`, and a repository outside the link an `Error`.
|
|
71
|
+
*/
|
|
60
72
|
list(selection: SourceSelection, signal?: AbortSignal): Promise<{
|
|
61
73
|
items: SourceItem[];
|
|
62
74
|
gone: SourceGone[];
|
|
63
75
|
}>;
|
|
64
76
|
/**
|
|
65
|
-
* A file's raw bytes at the commit of its version
|
|
77
|
+
* A file's raw bytes at the commit of its version (the default branch when the version names no commit, and then
|
|
78
|
+
* the reference names the branch), read as a stream under the call's deadline and cut at
|
|
66
79
|
* `maxFileBytes`: PDF, Word and HTML as bytes with their media type, the rest as UTF-8 text, each with a `github`
|
|
67
|
-
* attribution linking the file at that commit. A file GitHub no longer has (404), or one
|
|
68
|
-
* gone with reason `removed`; any other refusal throws `GitHubApiError`, a rate limit with
|
|
69
|
-
* GitHub held back is never taken for a file gone.
|
|
80
|
+
* attribution linking the file at that commit. A file GitHub no longer has (the contents read answers 404), or one
|
|
81
|
+
* past the cap, is answered gone with reason `removed`; any other refusal throws `GitHubApiError`, a rate limit with
|
|
82
|
+
* its `retryAt`, so a read GitHub held back is never taken for a file gone. So does a refusal of the installation
|
|
83
|
+
* token (404 for an installation GitHub no longer has): a lost installation never reads as every file gone. An item
|
|
84
|
+
* id that names no file (no path, or a path with an empty, `.` or `..` segment) throws a `TypeError` before any
|
|
85
|
+
* request.
|
|
70
86
|
*/
|
|
71
87
|
read(item: SourceItem, signal?: AbortSignal): Promise<SourceRead | SourceGone>;
|
|
72
88
|
/**
|
|
73
|
-
* What a push to `after` changed, from the listing at `after` (read here when the caller holds
|
|
74
|
-
* blobs read before (`cursor`: the JSON of each path's blob). A push's own commit lists are never
|
|
75
|
-
* push, or a push of more commits than its event lists, is read like any other. A
|
|
76
|
-
*
|
|
77
|
-
* `
|
|
89
|
+
* What a push to `after` changed in one repository, from the listing at `after` (read here when the caller holds
|
|
90
|
+
* none) against the blobs read before (`cursor`: the JSON of each path's blob). A push's own commit lists are never
|
|
91
|
+
* read, so a force push, or a push of more commits than its event lists, is read like any other. A cursor this
|
|
92
|
+
* connector did not answer throws a `TypeError` before any request, whatever the push's branch, and so does a
|
|
93
|
+
* selection of other than one repository, or a `listing` without the `after` commit it was read at: call it once
|
|
94
|
+
* per repository, each with that repository's cursor. A push to another branch than the default answers no change
|
|
95
|
+
* and the cursor it was given.
|
|
78
96
|
*/
|
|
79
97
|
changesSince(cursor: string | null, selection: GitHubChangesSelection, signal?: AbortSignal): Promise<SourceChanges>;
|
|
80
98
|
/** Nothing to end here: an installation is removed by the app's own call (`uninstallInstallation`). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubDocumentsConnector.d.ts","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA
|
|
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,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MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC;IAQvE;;;;OAIG;IACG,OAAO,CAAC,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAW9F;;;;OAIG;IACG,IAAI,CAAC,SAAS,EAAE,eAAe,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QAAC,IAAI,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAelH;;;;;;;;;;OAUG;IACG,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;IAmCpF;;;;;;;;OAQG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAuB1H,uGAAuG;IACjG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview A repository's documentation as account sources, read through a GitHub App's installation: each
|
|
3
3
|
* repository's tree read once a commit within a request budget, the documentation kept by a filter, each file read as
|
|
4
|
-
* raw bytes under a cap, and a push compared by the tree at its `after` commit.
|
|
4
|
+
* raw bytes under a cap, and a push compared by the tree at its `after` commit. A selection, an item or a call it
|
|
5
|
+
* cannot answer whole is refused before any request.
|
|
5
6
|
* @module agentos-ext-github/documents/GitHubDocumentsConnector
|
|
6
7
|
*/
|
|
7
8
|
import { ReadCapExceeded, } from '@framers/agentos-ext-account-sources';
|
|
8
|
-
import { GITHUB_API_BASE, GitHubApiError, githubFetch, githubSend, objectOf, stringIn } from '../app/http.js';
|
|
9
|
+
import { GITHUB_API_BASE, GitHubApiError, githubFetch, GitHubNoAnswer, githubSend, objectOf, stringIn } from '../app/http.js';
|
|
9
10
|
import { DEFAULT_MAX_FILE_BYTES, extensionOf, pathFilter, readTree, SKIPPED_FOLDERS } from './tree.js';
|
|
10
11
|
/** The files answered as bytes with their media type; every other kept file is answered as text. */
|
|
11
12
|
const MEDIA_TYPES = {
|
|
@@ -38,10 +39,48 @@ function blobsOf(cursor) {
|
|
|
38
39
|
}
|
|
39
40
|
return new Map(Object.entries(parsed));
|
|
40
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* A repository id as a selection or an item id carries it: a positive integer in decimal with no sign, space or
|
|
44
|
+
* leading zero, so each repository has one spelling. Anything else throws a `TypeError` that quotes none of it.
|
|
45
|
+
*/
|
|
46
|
+
function repositoryIdOf(text) {
|
|
47
|
+
const id = /^[1-9]\d*$/.test(text) ? Number(text) : Number.NaN;
|
|
48
|
+
if (!Number.isSafeInteger(id))
|
|
49
|
+
throw new TypeError('a repository id is a positive integer in decimal');
|
|
50
|
+
return id;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The repository and the path an item id names: `<repositoryId>:<path>`, split at its first colon. An id without a
|
|
54
|
+
* path, or whose path has an empty, `.` or `..` segment, throws a `TypeError` that quotes none of it: its contents
|
|
55
|
+
* address would name the repository's root listing or, once the dot segment is resolved, another endpoint.
|
|
56
|
+
*/
|
|
57
|
+
function itemPathOf(id) {
|
|
58
|
+
const colon = id.indexOf(':');
|
|
59
|
+
if (colon < 0)
|
|
60
|
+
throw new TypeError('an item id is <repositoryId>:<path>');
|
|
61
|
+
const path = id.slice(colon + 1);
|
|
62
|
+
if (path.split('/').some((segment) => segment === '' || segment === '.' || segment === '..')) {
|
|
63
|
+
throw new TypeError('an item id names no file: its path is empty or has an empty, . or .. segment');
|
|
64
|
+
}
|
|
65
|
+
return { repositoryId: repositoryIdOf(id.slice(0, colon)), path };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Throws `GitHubNoAnswer` (`cancelled`) for a call whose signal is already aborted. Each call runs it first, before it
|
|
69
|
+
* checks its inputs or makes any request, so an aborted call answers alike whatever its inputs, as the DOM standard
|
|
70
|
+
* asks of an API that takes a signal ("Reject immediately if the AbortSignal is already aborted").
|
|
71
|
+
*/
|
|
72
|
+
function notCancelled(signal) {
|
|
73
|
+
if (signal?.aborted === true)
|
|
74
|
+
throw new GitHubNoAnswer('cancelled');
|
|
75
|
+
}
|
|
41
76
|
/**
|
|
42
77
|
* A repository's documentation as account sources: an item's id is `<repositoryId>:<path>`, its version
|
|
43
78
|
* `<blob>@<commit>`, and the cursor of `changesSince` the JSON of each documentation path's blob at the commit last
|
|
44
|
-
* read.
|
|
79
|
+
* read. A repository id is a positive integer in decimal. A call whose signal is already aborted throws
|
|
80
|
+
* `GitHubNoAnswer` (`cancelled`) before it checks anything else. What a call cannot answer whole then throws before any
|
|
81
|
+
* request: a `TypeError` for an id that is not a repository id, a repository named twice, an item id that names no
|
|
82
|
+
* file or a change set of other than one repository, and an `Error` for a repository outside the link. An
|
|
83
|
+
* installation is removed by the app's own call (`uninstallInstallation`), never by a link's connector.
|
|
45
84
|
*/
|
|
46
85
|
export class GitHubDocumentsConnector {
|
|
47
86
|
credential;
|
|
@@ -67,38 +106,54 @@ export class GitHubDocumentsConnector {
|
|
|
67
106
|
this.fetchImpl = fetchImpl;
|
|
68
107
|
this.apiBase = apiBase;
|
|
69
108
|
}
|
|
109
|
+
/** The linked repository of an id; one outside the link throws. */
|
|
70
110
|
repository(id) {
|
|
71
111
|
const found = this.repositories.find((repository) => repository.id === id);
|
|
72
112
|
if (found === undefined)
|
|
73
113
|
throw new Error(`repository ${id} is not part of this link`);
|
|
74
114
|
return found;
|
|
75
115
|
}
|
|
76
|
-
token
|
|
77
|
-
|
|
116
|
+
/** An installation token narrowed to one repository, its request ended by the caller's signal. */
|
|
117
|
+
token(id, signal) {
|
|
118
|
+
return this.credential.installationToken(this.installationId, [id], { signal });
|
|
78
119
|
}
|
|
79
120
|
/** The head commit of a repository's default branch. */
|
|
80
121
|
async head(repositoryId, signal) {
|
|
122
|
+
notCancelled(signal);
|
|
81
123
|
const repository = this.repository(repositoryId);
|
|
82
124
|
const url = `${this.apiBase}/repos/${repository.fullName}/branches/${encodeURIComponent(repository.defaultBranch)}`;
|
|
83
|
-
const branch = objectOf(await githubFetch(this.fetchImpl, url, { token: await this.token(repositoryId), signal }), 'a branch');
|
|
125
|
+
const branch = objectOf(await githubFetch(this.fetchImpl, url, { token: await this.token(repositoryId, signal), signal }), 'a branch');
|
|
84
126
|
return stringIn(objectOf(branch.commit, "a branch's commit"), 'sha', "a branch's commit");
|
|
85
127
|
}
|
|
86
128
|
/**
|
|
87
129
|
* The documentation files of a repository at a commit: its tree read once within the request budget, never walking
|
|
88
|
-
* a skipped folder, then filtered. A caller keeps it for that commit and hands it to `changesSince
|
|
130
|
+
* a skipped folder, then filtered. A caller keeps it for that commit and hands it to `changesSince` with that commit
|
|
131
|
+
* as `after`.
|
|
89
132
|
*/
|
|
90
133
|
async listing(repositoryId, commit, signal) {
|
|
91
|
-
|
|
134
|
+
notCancelled(signal);
|
|
135
|
+
const repository = this.repository(repositoryId);
|
|
136
|
+
const tree = await readTree(this.fetchImpl, await this.token(repositoryId, signal), repository.fullName, commit, this.apiBase, {
|
|
92
137
|
maxRequests: this.filter.maxTreeRequests,
|
|
93
138
|
skipFolders: this.filter.skipFolders ?? SKIPPED_FOLDERS,
|
|
94
139
|
signal,
|
|
95
140
|
});
|
|
96
141
|
return pathFilter(this.filter)(tree);
|
|
97
142
|
}
|
|
98
|
-
/**
|
|
143
|
+
/**
|
|
144
|
+
* The documentation of each selected repository (its id in `ids`) at its default branch's head. Every id is checked
|
|
145
|
+
* before any repository is read, so a selection is listed whole or not at all: an id that is not a repository id, or
|
|
146
|
+
* a repository named twice, throws a `TypeError`, and a repository outside the link an `Error`.
|
|
147
|
+
*/
|
|
99
148
|
async list(selection, signal) {
|
|
149
|
+
notCancelled(signal);
|
|
150
|
+
const ids = selection.ids.map((id) => repositoryIdOf(id));
|
|
151
|
+
if (new Set(ids).size < ids.length)
|
|
152
|
+
throw new TypeError('a selection names a repository more than once');
|
|
153
|
+
for (const id of ids)
|
|
154
|
+
this.repository(id);
|
|
100
155
|
const items = [];
|
|
101
|
-
for (const id of
|
|
156
|
+
for (const id of ids) {
|
|
102
157
|
const commit = await this.head(id, signal);
|
|
103
158
|
for (const blob of await this.listing(id, commit, signal)) {
|
|
104
159
|
items.push({ id: `${id}:${blob.path}`, title: blob.path, size: blob.size, version: `${blob.sha}@${commit}` });
|
|
@@ -107,21 +162,28 @@ export class GitHubDocumentsConnector {
|
|
|
107
162
|
return { items, gone: [] };
|
|
108
163
|
}
|
|
109
164
|
/**
|
|
110
|
-
* A file's raw bytes at the commit of its version
|
|
165
|
+
* A file's raw bytes at the commit of its version (the default branch when the version names no commit, and then
|
|
166
|
+
* the reference names the branch), read as a stream under the call's deadline and cut at
|
|
111
167
|
* `maxFileBytes`: PDF, Word and HTML as bytes with their media type, the rest as UTF-8 text, each with a `github`
|
|
112
|
-
* attribution linking the file at that commit. A file GitHub no longer has (404), or one
|
|
113
|
-
* gone with reason `removed`; any other refusal throws `GitHubApiError`, a rate limit with
|
|
114
|
-
* GitHub held back is never taken for a file gone.
|
|
168
|
+
* attribution linking the file at that commit. A file GitHub no longer has (the contents read answers 404), or one
|
|
169
|
+
* past the cap, is answered gone with reason `removed`; any other refusal throws `GitHubApiError`, a rate limit with
|
|
170
|
+
* its `retryAt`, so a read GitHub held back is never taken for a file gone. So does a refusal of the installation
|
|
171
|
+
* token (404 for an installation GitHub no longer has): a lost installation never reads as every file gone. An item
|
|
172
|
+
* id that names no file (no path, or a path with an empty, `.` or `..` segment) throws a `TypeError` before any
|
|
173
|
+
* request.
|
|
115
174
|
*/
|
|
116
175
|
async read(item, signal) {
|
|
117
|
-
|
|
118
|
-
const path =
|
|
119
|
-
const repository = this.repository(
|
|
120
|
-
|
|
176
|
+
notCancelled(signal);
|
|
177
|
+
const { repositoryId, path } = itemPathOf(item.id);
|
|
178
|
+
const repository = this.repository(repositoryId);
|
|
179
|
+
// A version that names no commit (none, no `@`, or nothing after it) reads the default branch.
|
|
180
|
+
const commit = (item.version ?? '').split('@')[1] || repository.defaultBranch;
|
|
121
181
|
const url = `${this.apiBase}/repos/${repository.fullName}/contents/${encodedPath(path)}?ref=${encodeURIComponent(commit)}`;
|
|
182
|
+
// Minted outside the try below: a 404 there is the file's, and the token's own refusal must reach the caller.
|
|
183
|
+
const token = await this.token(repository.id, signal);
|
|
122
184
|
let answer;
|
|
123
185
|
try {
|
|
124
|
-
answer = await githubSend(this.fetchImpl, url, { token
|
|
186
|
+
answer = await githubSend(this.fetchImpl, url, { token, accept: 'application/vnd.github.raw+json', signal });
|
|
125
187
|
}
|
|
126
188
|
catch (error) {
|
|
127
189
|
if (error instanceof GitHubApiError && error.status === 404)
|
|
@@ -149,19 +211,29 @@ export class GitHubDocumentsConnector {
|
|
|
149
211
|
return { item, content: mediaType === undefined ? { text: new TextDecoder().decode(bytes) } : { bytes, mediaType }, ref };
|
|
150
212
|
}
|
|
151
213
|
/**
|
|
152
|
-
* What a push to `after` changed, from the listing at `after` (read here when the caller holds
|
|
153
|
-
* blobs read before (`cursor`: the JSON of each path's blob). A push's own commit lists are never
|
|
154
|
-
* push, or a push of more commits than its event lists, is read like any other. A
|
|
155
|
-
*
|
|
156
|
-
* `
|
|
214
|
+
* What a push to `after` changed in one repository, from the listing at `after` (read here when the caller holds
|
|
215
|
+
* none) against the blobs read before (`cursor`: the JSON of each path's blob). A push's own commit lists are never
|
|
216
|
+
* read, so a force push, or a push of more commits than its event lists, is read like any other. A cursor this
|
|
217
|
+
* connector did not answer throws a `TypeError` before any request, whatever the push's branch, and so does a
|
|
218
|
+
* selection of other than one repository, or a `listing` without the `after` commit it was read at: call it once
|
|
219
|
+
* per repository, each with that repository's cursor. A push to another branch than the default answers no change
|
|
220
|
+
* and the cursor it was given.
|
|
157
221
|
*/
|
|
158
222
|
async changesSince(cursor, selection, signal) {
|
|
159
|
-
|
|
223
|
+
notCancelled(signal);
|
|
224
|
+
const before = blobsOf(cursor);
|
|
225
|
+
if (selection.ids.length !== 1)
|
|
226
|
+
throw new TypeError('changesSince compares one repository a call');
|
|
227
|
+
const id = repositoryIdOf(selection.ids[0]);
|
|
228
|
+
if (selection.after === '')
|
|
229
|
+
throw new TypeError('after names no commit');
|
|
230
|
+
if (selection.listing !== undefined && selection.after === undefined) {
|
|
231
|
+
throw new TypeError('a listing is compared only with the after commit it was read at');
|
|
232
|
+
}
|
|
160
233
|
const repository = this.repository(id);
|
|
161
234
|
if (selection.ref !== undefined && selection.ref !== `refs/heads/${repository.defaultBranch}`) {
|
|
162
235
|
return { changed: [], gone: [], cursor: cursor ?? '{}' };
|
|
163
236
|
}
|
|
164
|
-
const before = blobsOf(cursor);
|
|
165
237
|
const after = selection.after ?? (await this.head(id, signal));
|
|
166
238
|
const blobs = selection.listing ?? (await this.listing(id, after, signal));
|
|
167
239
|
const now = new Map(blobs.map((blob) => [blob.path, blob.sha]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GitHubDocumentsConnector.js","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA
|
|
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;AACjJ,OAAO,EAAE,sBAAsB,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,eAAe,EAAkC,MAAM,WAAW,CAAC;AAsBvI,oGAAoG;AACpG,MAAM,WAAW,GA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IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAChE,MAAM,OAAO,GAAG,KAAK;aAClB,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,GAAG,CAAC;aACpD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;QACrH,MAAM,IAAI,GAAG,CAAC,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,IAAI,EAAE,EAAE,MAAM,EAAE,SAAkB,EAAE,CAAC,CAAC,CAAC;QACtI,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IAC5E,CAAC;IAED,uGAAuG;IACvG,KAAK,CAAC,MAAM;QACV,8FAA8F;IAChG,CAAC;CACF"}
|
|
@@ -10,7 +10,7 @@ export { GitHubDocumentsConnector, type GitHubChangesSelection, type LinkedRepos
|
|
|
10
10
|
/** A repository's tree within a request budget, and the filter that keeps its documentation. */
|
|
11
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';
|
|
12
12
|
/** The app's JWT and installation tokens. */
|
|
13
|
-
export { appJwt, GitHubAppCredential, type GitHubAppIdentity } from '../app/credential.js';
|
|
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
16
|
/** What a user token reaches, and the app's own installations. */
|
|
@@ -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,MAAM,sBAAsB,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,gGAAgG;AAChG,OAAO,EACL,QAAQ,EACR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B,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,EACZ,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAI1B,MAAM,WAAW,CAAC;AACnB,6CAA6C;AAC7C,OAAO,EAAE,MAAM,EAAE,mBAAmB,
|
|
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,EACZ,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/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAKH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA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,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,oGAAoG;AACpG,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,KAAK,wBAAwB,EAAE,KAAK,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACnI,eAAe,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* @module @framers/agentos-ext-github
|
|
9
9
|
*/
|
|
10
10
|
import { execSync } from 'node:child_process';
|
|
11
|
+
import { createRequire } from 'node:module';
|
|
11
12
|
import { GitHubService } from './GitHubService.js';
|
|
12
13
|
import { GitHubSearchTool } from './tools/search.js';
|
|
13
14
|
import { GitHubIssueListTool } from './tools/issueList.js';
|
|
@@ -35,6 +36,11 @@ import { GitHubFileWriteTool } from './tools/fileWrite.js';
|
|
|
35
36
|
import { GitHubBranchListTool } from './tools/branchList.js';
|
|
36
37
|
import { GitHubBranchCreateTool } from './tools/branchCreate.js';
|
|
37
38
|
import { GitHubCommitListTool } from './tools/commitList.js';
|
|
39
|
+
/**
|
|
40
|
+
* The package's own version, which the pack reports to its host: read from the package.json one folder above this
|
|
41
|
+
* file, the package's root both from `dist/` and from `src/`.
|
|
42
|
+
*/
|
|
43
|
+
const PACKAGE_VERSION = createRequire(import.meta.url)('../package.json').version;
|
|
38
44
|
function resolveToken(options, secrets) {
|
|
39
45
|
if (options.token)
|
|
40
46
|
return options.token;
|
|
@@ -95,7 +101,8 @@ export function createExtensionPack(context) {
|
|
|
95
101
|
];
|
|
96
102
|
return {
|
|
97
103
|
name: '@framers/agentos-ext-github',
|
|
98
|
-
version:
|
|
104
|
+
version: PACKAGE_VERSION,
|
|
105
|
+
// Each id is the tool's own name, the id manifest.json lists it under.
|
|
99
106
|
descriptors: tools.map((tool) => ({
|
|
100
107
|
id: tool.name,
|
|
101
108
|
kind: 'tool',
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CA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