@framers/agentos-ext-github 0.1.4 → 0.2.1
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 +87 -1
- package/dist/GitHubRepoIndexer.d.ts +20 -8
- package/dist/GitHubRepoIndexer.d.ts.map +1 -1
- package/dist/GitHubRepoIndexer.js +11 -6
- package/dist/GitHubRepoIndexer.js.map +1 -1
- package/dist/__tests__/app.test.d.ts +7 -0
- package/dist/__tests__/app.test.d.ts.map +1 -0
- package/dist/__tests__/app.test.js +248 -0
- package/dist/__tests__/app.test.js.map +1 -0
- package/dist/__tests__/documents.test.d.ts +7 -0
- package/dist/__tests__/documents.test.d.ts.map +1 -0
- package/dist/__tests__/documents.test.js +235 -0
- package/dist/__tests__/documents.test.js.map +1 -0
- package/dist/__tests__/indexer.test.js +14 -0
- package/dist/__tests__/indexer.test.js.map +1 -1
- package/dist/app/credential.d.ts +43 -0
- package/dist/app/credential.d.ts.map +1 -0
- package/dist/app/credential.js +74 -0
- package/dist/app/credential.js.map +1 -0
- package/dist/app/http.d.ts +61 -0
- package/dist/app/http.d.ts.map +1 -0
- package/dist/app/http.js +128 -0
- package/dist/app/http.js.map +1 -0
- package/dist/app/installations.d.ts +48 -0
- package/dist/app/installations.d.ts.map +1 -0
- package/dist/app/installations.js +61 -0
- package/dist/app/installations.js.map +1 -0
- package/dist/app/reconcile.d.ts +61 -0
- package/dist/app/reconcile.d.ts.map +1 -0
- package/dist/app/reconcile.js +89 -0
- package/dist/app/reconcile.js.map +1 -0
- package/dist/app/userFlow.d.ts +43 -0
- package/dist/app/userFlow.d.ts.map +1 -0
- package/dist/app/userFlow.js +54 -0
- package/dist/app/userFlow.js.map +1 -0
- package/dist/app/webhook.d.ts +15 -0
- package/dist/app/webhook.d.ts.map +1 -0
- package/dist/app/webhook.js +23 -0
- package/dist/app/webhook.js.map +1 -0
- package/dist/documents/GitHubDocumentsConnector.d.ts +80 -0
- package/dist/documents/GitHubDocumentsConnector.d.ts.map +1 -0
- package/dist/documents/GitHubDocumentsConnector.js +158 -0
- package/dist/documents/GitHubDocumentsConnector.js.map +1 -0
- package/dist/documents/index.d.ts +24 -0
- package/dist/documents/index.d.ts.map +1 -0
- package/dist/documents/index.js +24 -0
- package/dist/documents/index.js.map +1 -0
- package/dist/documents/tree.d.ts +71 -0
- package/dist/documents/tree.d.ts.map +1 -0
- package/dist/documents/tree.js +115 -0
- package/dist/documents/tree.js.map +1 -0
- package/manifest.json +5 -3
- package/package.json +17 -4
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview A repository's documentation as account sources, read through a GitHub App's installation: each
|
|
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.
|
|
5
|
+
* @module agentos-ext-github/documents/GitHubDocumentsConnector
|
|
6
|
+
*/
|
|
7
|
+
import { type AccountSourceConnector, type SourceChanges, type SourceGone, type SourceItem, type SourceRead, type SourceSelection } from '@framers/agentos-ext-account-sources';
|
|
8
|
+
import type { GitHubAppCredential } from '../app/credential.js';
|
|
9
|
+
import { type TreeBlob, type TreeFilter } from './tree.js';
|
|
10
|
+
/** One repository of a link. */
|
|
11
|
+
export interface LinkedRepository {
|
|
12
|
+
id: number;
|
|
13
|
+
fullName: string;
|
|
14
|
+
defaultBranch: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* What `changesSince` compares: the repository (its id, first of `ids`), and from a push its `after` commit and its
|
|
18
|
+
* `ref`, with the listing at `after` when the caller holds it.
|
|
19
|
+
*/
|
|
20
|
+
export interface GitHubChangesSelection extends SourceSelection {
|
|
21
|
+
/** The commit to compare at; the default branch's head when absent. */
|
|
22
|
+
after?: string;
|
|
23
|
+
/** The push's ref, such as `refs/heads/main`; a push to another branch than the default changes nothing. */
|
|
24
|
+
ref?: string;
|
|
25
|
+
/** The documentation's listing at `after`, which spares the tree's read. */
|
|
26
|
+
listing?: readonly TreeBlob[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A repository's documentation as account sources: an item's id is `<repositoryId>:<path>`, its version
|
|
30
|
+
* `<blob>@<commit>`, and the cursor of `changesSince` the JSON of each documentation path's blob at the commit last
|
|
31
|
+
* read. An installation is removed by the app's own call (`uninstallInstallation`), never by a link's connector.
|
|
32
|
+
*/
|
|
33
|
+
export declare class GitHubDocumentsConnector implements AccountSourceConnector {
|
|
34
|
+
private readonly credential;
|
|
35
|
+
private readonly installationId;
|
|
36
|
+
private readonly repositories;
|
|
37
|
+
private readonly filter;
|
|
38
|
+
private readonly fetchImpl;
|
|
39
|
+
private readonly apiBase;
|
|
40
|
+
readonly kind = "github";
|
|
41
|
+
/**
|
|
42
|
+
* @param credential The app's credential; each repository is read with an installation token narrowed to it.
|
|
43
|
+
* @param installationId The installation the repositories are read through.
|
|
44
|
+
* @param repositories The repositories of the link.
|
|
45
|
+
* @param filter What is kept as documentation, and the bounds on reading it.
|
|
46
|
+
* @param fetchImpl The fetch the repositories are read with.
|
|
47
|
+
* @param apiBase GitHub's REST API, or a stand-in's address in tests.
|
|
48
|
+
*/
|
|
49
|
+
constructor(credential: GitHubAppCredential, installationId: number, repositories: readonly LinkedRepository[], filter?: TreeFilter, fetchImpl?: typeof fetch, apiBase?: string);
|
|
50
|
+
private repository;
|
|
51
|
+
private token;
|
|
52
|
+
/** The head commit of a repository's default branch. */
|
|
53
|
+
head(repositoryId: number, signal?: AbortSignal): Promise<string>;
|
|
54
|
+
/**
|
|
55
|
+
* 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`.
|
|
57
|
+
*/
|
|
58
|
+
listing(repositoryId: number, commit: string, signal?: AbortSignal): Promise<TreeBlob[]>;
|
|
59
|
+
/** The documentation of each selected repository (its id in `ids`) at its default branch's head. */
|
|
60
|
+
list(selection: SourceSelection, signal?: AbortSignal): Promise<{
|
|
61
|
+
items: SourceItem[];
|
|
62
|
+
gone: SourceGone[];
|
|
63
|
+
}>;
|
|
64
|
+
/**
|
|
65
|
+
* A file's raw bytes at the commit of its version, read as a stream and cut at `maxFileBytes`: PDF, Word and HTML
|
|
66
|
+
* as bytes with their media type, the rest as UTF-8 text, each with a `github` attribution linking the file at that
|
|
67
|
+
* commit. A file GitHub no longer has, or one past the cap, is answered gone with reason `removed`.
|
|
68
|
+
*/
|
|
69
|
+
read(item: SourceItem, signal?: AbortSignal): Promise<SourceRead | SourceGone>;
|
|
70
|
+
/**
|
|
71
|
+
* What a push to `after` changed, from the listing at `after` (read here when the caller holds none) against the
|
|
72
|
+
* blobs read before (`cursor`: the JSON of each path's blob). A push's own commit lists are never read, so a force
|
|
73
|
+
* push, or a push of more commits than its event lists, is read like any other. A push to another branch than the
|
|
74
|
+
* default answers no change and the cursor it was given.
|
|
75
|
+
*/
|
|
76
|
+
changesSince(cursor: string | null, selection: GitHubChangesSelection, signal?: AbortSignal): Promise<SourceChanges>;
|
|
77
|
+
/** Nothing to end here: an installation is removed by the app's own call (`uninstallInstallation`). */
|
|
78
|
+
revoke(): Promise<void>;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=GitHubDocumentsConnector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubDocumentsConnector.d.ts","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAGL,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,gCAA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E,WAAW,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QAAC,IAAI,EAAE,UAAU,EAAE,CAAA;KAAE,CAAC;IAWlH;;;;OAIG;IACG,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,GAAG,UAAU,CAAC;IAoCpF;;;;;OAKG;IACG,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,SAAS,EAAE,sBAAsB,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC;IAiB1H,uGAAuG;IACjG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAG9B"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview A repository's documentation as account sources, read through a GitHub App's installation: each
|
|
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.
|
|
5
|
+
* @module agentos-ext-github/documents/GitHubDocumentsConnector
|
|
6
|
+
*/
|
|
7
|
+
import { readCapped, ReadCapExceeded, } from '@framers/agentos-ext-account-sources';
|
|
8
|
+
import { discardBody, GITHUB_API_BASE, GitHubApiError, githubFetch, githubHeaders, objectOf, stringIn } from '../app/http.js';
|
|
9
|
+
import { DEFAULT_MAX_FILE_BYTES, extensionOf, pathFilter, readTree, SKIPPED_FOLDERS } from './tree.js';
|
|
10
|
+
/** The files answered as bytes with their media type; every other kept file is answered as text. */
|
|
11
|
+
const MEDIA_TYPES = {
|
|
12
|
+
'.pdf': 'application/pdf',
|
|
13
|
+
'.docx': 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
14
|
+
'.html': 'text/html',
|
|
15
|
+
'.htm': 'text/html',
|
|
16
|
+
};
|
|
17
|
+
/** A path with each of its segments encoded for an address. */
|
|
18
|
+
function encodedPath(path) {
|
|
19
|
+
return path.split('/').map(encodeURIComponent).join('/');
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* A repository's documentation as account sources: an item's id is `<repositoryId>:<path>`, its version
|
|
23
|
+
* `<blob>@<commit>`, and the cursor of `changesSince` the JSON of each documentation path's blob at the commit last
|
|
24
|
+
* read. An installation is removed by the app's own call (`uninstallInstallation`), never by a link's connector.
|
|
25
|
+
*/
|
|
26
|
+
export class GitHubDocumentsConnector {
|
|
27
|
+
credential;
|
|
28
|
+
installationId;
|
|
29
|
+
repositories;
|
|
30
|
+
filter;
|
|
31
|
+
fetchImpl;
|
|
32
|
+
apiBase;
|
|
33
|
+
kind = 'github';
|
|
34
|
+
/**
|
|
35
|
+
* @param credential The app's credential; each repository is read with an installation token narrowed to it.
|
|
36
|
+
* @param installationId The installation the repositories are read through.
|
|
37
|
+
* @param repositories The repositories of the link.
|
|
38
|
+
* @param filter What is kept as documentation, and the bounds on reading it.
|
|
39
|
+
* @param fetchImpl The fetch the repositories are read with.
|
|
40
|
+
* @param apiBase GitHub's REST API, or a stand-in's address in tests.
|
|
41
|
+
*/
|
|
42
|
+
constructor(credential, installationId, repositories, filter = {}, fetchImpl = fetch, apiBase = GITHUB_API_BASE) {
|
|
43
|
+
this.credential = credential;
|
|
44
|
+
this.installationId = installationId;
|
|
45
|
+
this.repositories = repositories;
|
|
46
|
+
this.filter = filter;
|
|
47
|
+
this.fetchImpl = fetchImpl;
|
|
48
|
+
this.apiBase = apiBase;
|
|
49
|
+
}
|
|
50
|
+
repository(id) {
|
|
51
|
+
const found = this.repositories.find((repository) => repository.id === id);
|
|
52
|
+
if (found === undefined)
|
|
53
|
+
throw new Error(`repository ${id} is not part of this link`);
|
|
54
|
+
return found;
|
|
55
|
+
}
|
|
56
|
+
token(id) {
|
|
57
|
+
return this.credential.installationToken(this.installationId, [id]);
|
|
58
|
+
}
|
|
59
|
+
/** The head commit of a repository's default branch. */
|
|
60
|
+
async head(repositoryId, signal) {
|
|
61
|
+
const repository = this.repository(repositoryId);
|
|
62
|
+
const url = `${this.apiBase}/repos/${repository.fullName}/branches/${encodeURIComponent(repository.defaultBranch)}`;
|
|
63
|
+
const branch = objectOf(await githubFetch(this.fetchImpl, url, { token: await this.token(repositoryId), signal }), 'a branch');
|
|
64
|
+
return stringIn(objectOf(branch.commit, "a branch's commit"), 'sha', "a branch's commit");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The documentation files of a repository at a commit: its tree read once within the request budget, never walking
|
|
68
|
+
* a skipped folder, then filtered. A caller keeps it for that commit and hands it to `changesSince`.
|
|
69
|
+
*/
|
|
70
|
+
async listing(repositoryId, commit, signal) {
|
|
71
|
+
const tree = await readTree(this.fetchImpl, await this.token(repositoryId), this.repository(repositoryId).fullName, commit, this.apiBase, {
|
|
72
|
+
maxRequests: this.filter.maxTreeRequests,
|
|
73
|
+
skipFolders: this.filter.skipFolders ?? SKIPPED_FOLDERS,
|
|
74
|
+
signal,
|
|
75
|
+
});
|
|
76
|
+
return pathFilter(this.filter)(tree);
|
|
77
|
+
}
|
|
78
|
+
/** The documentation of each selected repository (its id in `ids`) at its default branch's head. */
|
|
79
|
+
async list(selection, signal) {
|
|
80
|
+
const items = [];
|
|
81
|
+
for (const id of selection.ids.map(Number)) {
|
|
82
|
+
const commit = await this.head(id, signal);
|
|
83
|
+
for (const blob of await this.listing(id, commit, signal)) {
|
|
84
|
+
items.push({ id: `${id}:${blob.path}`, title: blob.path, size: blob.size, version: `${blob.sha}@${commit}` });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return { items, gone: [] };
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* A file's raw bytes at the commit of its version, read as a stream and cut at `maxFileBytes`: PDF, Word and HTML
|
|
91
|
+
* as bytes with their media type, the rest as UTF-8 text, each with a `github` attribution linking the file at that
|
|
92
|
+
* commit. A file GitHub no longer has, or one past the cap, is answered gone with reason `removed`.
|
|
93
|
+
*/
|
|
94
|
+
async read(item, signal) {
|
|
95
|
+
const [repositoryId, ...rest] = item.id.split(':');
|
|
96
|
+
const path = rest.join(':');
|
|
97
|
+
const repository = this.repository(Number(repositoryId));
|
|
98
|
+
const commit = (item.version ?? '').split('@')[1] ?? repository.defaultBranch;
|
|
99
|
+
const response = await this.fetchImpl(`${this.apiBase}/repos/${repository.fullName}/contents/${encodedPath(path)}?ref=${encodeURIComponent(commit)}`, {
|
|
100
|
+
headers: githubHeaders(await this.token(repository.id), 'application/vnd.github.raw+json'),
|
|
101
|
+
signal,
|
|
102
|
+
});
|
|
103
|
+
if (response.status === 404) {
|
|
104
|
+
await discardBody(response);
|
|
105
|
+
return { id: item.id, reason: 'removed' };
|
|
106
|
+
}
|
|
107
|
+
if (!response.ok) {
|
|
108
|
+
await discardBody(response);
|
|
109
|
+
throw new GitHubApiError(response.status);
|
|
110
|
+
}
|
|
111
|
+
let bytes;
|
|
112
|
+
try {
|
|
113
|
+
bytes = await readCapped(response, this.filter.maxFileBytes ?? DEFAULT_MAX_FILE_BYTES);
|
|
114
|
+
}
|
|
115
|
+
catch (error) {
|
|
116
|
+
if (error instanceof ReadCapExceeded)
|
|
117
|
+
return { id: item.id, reason: 'removed' };
|
|
118
|
+
throw error;
|
|
119
|
+
}
|
|
120
|
+
const ref = {
|
|
121
|
+
kind: 'github',
|
|
122
|
+
title: path,
|
|
123
|
+
path,
|
|
124
|
+
url: `https://github.com/${repository.fullName}/blob/${commit}/${encodedPath(path)}`,
|
|
125
|
+
version: commit,
|
|
126
|
+
readAt: new Date().toISOString(),
|
|
127
|
+
};
|
|
128
|
+
const mediaType = MEDIA_TYPES[extensionOf(path)];
|
|
129
|
+
return { item, content: mediaType === undefined ? { text: new TextDecoder().decode(bytes) } : { bytes, mediaType }, ref };
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* What a push to `after` changed, from the listing at `after` (read here when the caller holds none) against the
|
|
133
|
+
* blobs read before (`cursor`: the JSON of each path's blob). A push's own commit lists are never read, so a force
|
|
134
|
+
* push, or a push of more commits than its event lists, is read like any other. A push to another branch than the
|
|
135
|
+
* default answers no change and the cursor it was given.
|
|
136
|
+
*/
|
|
137
|
+
async changesSince(cursor, selection, signal) {
|
|
138
|
+
const id = Number(selection.ids[0]);
|
|
139
|
+
const repository = this.repository(id);
|
|
140
|
+
if (selection.ref !== undefined && selection.ref !== `refs/heads/${repository.defaultBranch}`) {
|
|
141
|
+
return { changed: [], gone: [], cursor: cursor ?? '{}' };
|
|
142
|
+
}
|
|
143
|
+
const before = new Map(Object.entries(cursor === null ? {} : JSON.parse(cursor)));
|
|
144
|
+
const after = selection.after ?? (await this.head(id, signal));
|
|
145
|
+
const blobs = selection.listing ?? (await this.listing(id, after, signal));
|
|
146
|
+
const now = new Map(blobs.map((blob) => [blob.path, blob.sha]));
|
|
147
|
+
const changed = blobs
|
|
148
|
+
.filter((blob) => before.get(blob.path) !== blob.sha)
|
|
149
|
+
.map((blob) => ({ id: `${id}:${blob.path}`, title: blob.path, size: blob.size, version: `${blob.sha}@${after}` }));
|
|
150
|
+
const gone = [...before.keys()].filter((path) => !now.has(path)).map((path) => ({ id: `${id}:${path}`, reason: 'removed' }));
|
|
151
|
+
return { changed, gone, cursor: JSON.stringify(Object.fromEntries(now)) };
|
|
152
|
+
}
|
|
153
|
+
/** Nothing to end here: an installation is removed by the app's own call (`uninstallInstallation`). */
|
|
154
|
+
async revoke() {
|
|
155
|
+
// A link's connector holds no grant of its own; the app's installation outlives any one link.
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
//# sourceMappingURL=GitHubDocumentsConnector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHubDocumentsConnector.js","sourceRoot":"","sources":["../../src/documents/GitHubDocumentsConnector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,UAAU,EACV,eAAe,GAQhB,MAAM,sCAAsC,CAAC;AAE9C,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,E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
+
* web flow, what a user token reaches, the webhook signature, the daily reconcile, the uninstall) and
|
|
4
|
+
* `GitHubDocumentsConnector`, a repository's documentation as an account source. Every call goes to GitHub's REST API
|
|
5
|
+
* over an injected `fetch`.
|
|
6
|
+
* @module agentos-ext-github/documents
|
|
7
|
+
*/
|
|
8
|
+
/** The documentation connector and the shape of a push it compares. */
|
|
9
|
+
export { GitHubDocumentsConnector, type GitHubChangesSelection, type LinkedRepository } from './GitHubDocumentsConnector.js';
|
|
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';
|
|
12
|
+
/** The app's JWT and installation tokens. */
|
|
13
|
+
export { appJwt, GitHubAppCredential, type GitHubAppIdentity } from '../app/credential.js';
|
|
14
|
+
/** The user's web flow on the auth module's redirect flow. */
|
|
15
|
+
export { GitHubAppUserFlow, GITHUB_OAUTH_ENDPOINTS, type GitHubAppClient, type GitHubOAuthEndpoints } from '../app/userFlow.js';
|
|
16
|
+
/** What a user token reaches, and the app's own installations. */
|
|
17
|
+
export { userOfToken, installationsOfUser, repositoriesOfUser, listInstallations, uninstallInstallation, type GitHubAccount, type GitHubInstallation, type GitHubUser, type UserRepository, } from '../app/installations.js';
|
|
18
|
+
/** A webhook delivery's signature. */
|
|
19
|
+
export { verifyWebhookSignature } from '../app/webhook.js';
|
|
20
|
+
/** The daily reconcile. */
|
|
21
|
+
export { reconcileInstallations, type MovedRepository, type ReconcileLink, type ReconcileOptions, type ReconcileOutcome, type ReconcileRepository, type UnreadableRepository, } from '../app/reconcile.js';
|
|
22
|
+
/** The API version every call pins, GitHub's address, and the error of an answer outside 2xx. */
|
|
23
|
+
export { GITHUB_API_BASE, GITHUB_API_VERSION, GitHubApiError, type GitHubApiOptions } from '../app/http.js';
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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;AAC3F,8DAA8D;AAC9D,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,KAAK,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAChI,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,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,EACtB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,qBAAqB,CAAC;AAC7B,iGAAiG;AACjG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview The `./documents` entry: a GitHub App's installation mode (its JWT and installation tokens, the user's
|
|
3
|
+
* web flow, what a user token reaches, the webhook signature, the daily reconcile, the uninstall) and
|
|
4
|
+
* `GitHubDocumentsConnector`, a repository's documentation as an account source. Every call goes to GitHub's REST API
|
|
5
|
+
* over an injected `fetch`.
|
|
6
|
+
* @module agentos-ext-github/documents
|
|
7
|
+
*/
|
|
8
|
+
/** The documentation connector and the shape of a push it compares. */
|
|
9
|
+
export { GitHubDocumentsConnector } from './GitHubDocumentsConnector.js';
|
|
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, } from './tree.js';
|
|
12
|
+
/** The app's JWT and installation tokens. */
|
|
13
|
+
export { appJwt, GitHubAppCredential } from '../app/credential.js';
|
|
14
|
+
/** The user's web flow on the auth module's redirect flow. */
|
|
15
|
+
export { GitHubAppUserFlow, GITHUB_OAUTH_ENDPOINTS } from '../app/userFlow.js';
|
|
16
|
+
/** What a user token reaches, and the app's own installations. */
|
|
17
|
+
export { userOfToken, installationsOfUser, repositoriesOfUser, listInstallations, uninstallInstallation, } from '../app/installations.js';
|
|
18
|
+
/** A webhook delivery's signature. */
|
|
19
|
+
export { verifyWebhookSignature } from '../app/webhook.js';
|
|
20
|
+
/** The daily reconcile. */
|
|
21
|
+
export { reconcileInstallations, } from '../app/reconcile.js';
|
|
22
|
+
/** The API version every call pins, GitHub's address, and the error of an answer outside 2xx. */
|
|
23
|
+
export { GITHUB_API_BASE, GITHUB_API_VERSION, GitHubApiError } from '../app/http.js';
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,EAA0B,MAAM,sBAAsB,CAAC;AAC3F,8DAA8D;AAC9D,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAmD,MAAM,oBAAoB,CAAC;AAChI,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,2BAA2B;AAC3B,OAAO,EACL,sBAAsB,GAOvB,MAAM,qBAAqB,CAAC;AAC7B,iGAAiG;AACjG,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAyB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview A repository's tree at a commit, read within a request budget, and the filter that keeps its
|
|
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.
|
|
5
|
+
* @module agentos-ext-github/documents/tree
|
|
6
|
+
*/
|
|
7
|
+
/** One file of a tree: its path from the repository's root, its blob and its size in bytes. */
|
|
8
|
+
export interface TreeBlob {
|
|
9
|
+
path: string;
|
|
10
|
+
sha: string;
|
|
11
|
+
size: number;
|
|
12
|
+
}
|
|
13
|
+
/** What a repository's documentation is: the files kept and the bounds on reading them. Each has a default. */
|
|
14
|
+
export interface TreeFilter {
|
|
15
|
+
/** The file extensions kept, with their dot ({@link DOCUMENT_EXTENSIONS} when absent). */
|
|
16
|
+
extensions?: readonly string[];
|
|
17
|
+
/** The folders skipped at any depth, by name ({@link SKIPPED_FOLDERS} when absent). */
|
|
18
|
+
skipFolders?: readonly string[];
|
|
19
|
+
/** At most this many files, in path order ({@link DEFAULT_MAX_FILES} when absent). */
|
|
20
|
+
maxFiles?: number;
|
|
21
|
+
/** A file larger than this is left out of a listing, and a read past it is answered gone ({@link DEFAULT_MAX_FILE_BYTES} when absent). */
|
|
22
|
+
maxFileBytes?: number;
|
|
23
|
+
/** At most this many tree requests to list one commit ({@link DEFAULT_MAX_TREE_REQUESTS} when absent). */
|
|
24
|
+
maxTreeRequests?: number;
|
|
25
|
+
}
|
|
26
|
+
/** The documentation kept by default: Markdown, text, reStructuredText, HTML, PDF and Word files. */
|
|
27
|
+
export declare const DOCUMENT_EXTENSIONS: readonly string[];
|
|
28
|
+
/** The folders skipped by default: dependencies, build output and vendored code. */
|
|
29
|
+
export declare const SKIPPED_FOLDERS: readonly string[];
|
|
30
|
+
/** The files kept by default. */
|
|
31
|
+
export declare const DEFAULT_MAX_FILES = 2000;
|
|
32
|
+
/** The largest file kept by default: 10 MiB. */
|
|
33
|
+
export declare const DEFAULT_MAX_FILE_BYTES = 10485760;
|
|
34
|
+
/** The tree requests one listing makes by default. */
|
|
35
|
+
export declare const DEFAULT_MAX_TREE_REQUESTS = 50;
|
|
36
|
+
/** A tree that cannot be read within its request budget. */
|
|
37
|
+
export declare class TreeTooLarge extends Error {
|
|
38
|
+
readonly maxRequests: number;
|
|
39
|
+
/** @param maxRequests The budget the tree needed more than. */
|
|
40
|
+
constructor(maxRequests: number);
|
|
41
|
+
}
|
|
42
|
+
/** The budget of a tree read, the folders it never walks into, and its abort signal. */
|
|
43
|
+
export interface ReadTreeOptions {
|
|
44
|
+
/** At most this many requests ({@link DEFAULT_MAX_TREE_REQUESTS} when absent). */
|
|
45
|
+
maxRequests?: number;
|
|
46
|
+
/** Folders, by name, whose files are left out and which a read by subtree never requests. */
|
|
47
|
+
skipFolders?: readonly string[];
|
|
48
|
+
signal?: AbortSignal;
|
|
49
|
+
}
|
|
50
|
+
/** A file's extension with its dot, in lower case, or `''` when its name has none. */
|
|
51
|
+
export declare function extensionOf(path: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Every file of a repository's tree at a commit (symbolic links aside). The tree is asked for recursively; when GitHub
|
|
54
|
+
* answers it truncated, its top level is read and each subtree is asked for the same way, so only the parts too large
|
|
55
|
+
* 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.
|
|
57
|
+
*
|
|
58
|
+
* @param fetchImpl The fetch the tree is read with.
|
|
59
|
+
* @param token An installation token that reads the repository.
|
|
60
|
+
* @param repo The repository's full name, `owner/name`.
|
|
61
|
+
* @param commit The commit whose tree is read.
|
|
62
|
+
* @param apiBase GitHub's REST API, or a stand-in's address in tests.
|
|
63
|
+
* @param options The request budget, the folders skipped and an abort signal.
|
|
64
|
+
*/
|
|
65
|
+
export declare function readTree(fetchImpl: typeof fetch, token: string, repo: string, commit: string, apiBase?: string, options?: ReadTreeOptions): Promise<TreeBlob[]>;
|
|
66
|
+
/**
|
|
67
|
+
* The filter that keeps a tree's documentation: the extensions kept, nothing under a skipped folder, nothing past the
|
|
68
|
+
* size cap, in path order, at most `maxFiles`.
|
|
69
|
+
*/
|
|
70
|
+
export declare function pathFilter(filter?: TreeFilter): (blobs: readonly TreeBlob[]) => TreeBlob[];
|
|
71
|
+
//# sourceMappingURL=tree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tree.d.ts","sourceRoot":"","sources":["../../src/documents/tree.ts"],"names":[],"mappings":"AAAA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Q,CAC5B,SAAS,EAAE,OAAO,KAAK,EACvB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,MAAwB,EACjC,OAAO,GAAE,eAAoB,GAC5B,OAAO,CAAC,QAAQ,EAAE,CAAC,CAsCrB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,GAAE,UAAe,GAAG,CAAC,KAAK,EAAE,SAAS,QAAQ,EAAE,KAAK,QAAQ,EAAE,CAU9F"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview A repository's tree at a commit, read within a request budget, and the filter that keeps its
|
|
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.
|
|
5
|
+
* @module agentos-ext-github/documents/tree
|
|
6
|
+
*/
|
|
7
|
+
import { arrayOf, GITHUB_API_BASE, githubFetch, objectOf, stringIn } from '../app/http.js';
|
|
8
|
+
/** The documentation kept by default: Markdown, text, reStructuredText, HTML, PDF and Word files. */
|
|
9
|
+
export const DOCUMENT_EXTENSIONS = ['.md', '.markdown', '.txt', '.rst', '.html', '.htm', '.pdf', '.docx'];
|
|
10
|
+
/** The folders skipped by default: dependencies, build output and vendored code. */
|
|
11
|
+
export const SKIPPED_FOLDERS = ['node_modules', 'vendor', 'dist', 'build', '.git', 'third_party'];
|
|
12
|
+
/** The files kept by default. */
|
|
13
|
+
export const DEFAULT_MAX_FILES = 2_000;
|
|
14
|
+
/** The largest file kept by default: 10 MiB. */
|
|
15
|
+
export const DEFAULT_MAX_FILE_BYTES = 10_485_760;
|
|
16
|
+
/** The tree requests one listing makes by default. */
|
|
17
|
+
export const DEFAULT_MAX_TREE_REQUESTS = 50;
|
|
18
|
+
/** A symbolic link's mode in a tree; its blob holds the link's target, not a document. */
|
|
19
|
+
const SYMLINK_MODE = '120000';
|
|
20
|
+
/** A tree that cannot be read within its request budget. */
|
|
21
|
+
export class TreeTooLarge extends Error {
|
|
22
|
+
maxRequests;
|
|
23
|
+
/** @param maxRequests The budget the tree needed more than. */
|
|
24
|
+
constructor(maxRequests) {
|
|
25
|
+
super(`the tree needs more than ${maxRequests} requests to read`);
|
|
26
|
+
this.maxRequests = maxRequests;
|
|
27
|
+
this.name = 'TreeTooLarge';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function entryOf(value) {
|
|
31
|
+
const fields = objectOf(value, 'a tree entry');
|
|
32
|
+
return {
|
|
33
|
+
path: stringIn(fields, 'path', 'a tree entry'),
|
|
34
|
+
type: stringIn(fields, 'type', 'a tree entry'),
|
|
35
|
+
sha: stringIn(fields, 'sha', 'a tree entry'),
|
|
36
|
+
mode: typeof fields.mode === 'string' ? fields.mode : '',
|
|
37
|
+
size: typeof fields.size === 'number' ? fields.size : null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/** A file's extension with its dot, in lower case, or `''` when its name has none. */
|
|
41
|
+
export function extensionOf(path) {
|
|
42
|
+
const name = path.slice(path.lastIndexOf('/') + 1);
|
|
43
|
+
const dot = name.lastIndexOf('.');
|
|
44
|
+
return dot <= 0 ? '' : name.slice(dot).toLowerCase();
|
|
45
|
+
}
|
|
46
|
+
function inSkippedFolder(path, skip) {
|
|
47
|
+
return path.split('/').slice(0, -1).some((folder) => skip.has(folder));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Every file of a repository's tree at a commit (symbolic links aside). The tree is asked for recursively; when GitHub
|
|
51
|
+
* answers it truncated, its top level is read and each subtree is asked for the same way, so only the parts too large
|
|
52
|
+
* 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.
|
|
54
|
+
*
|
|
55
|
+
* @param fetchImpl The fetch the tree is read with.
|
|
56
|
+
* @param token An installation token that reads the repository.
|
|
57
|
+
* @param repo The repository's full name, `owner/name`.
|
|
58
|
+
* @param commit The commit whose tree is read.
|
|
59
|
+
* @param apiBase GitHub's REST API, or a stand-in's address in tests.
|
|
60
|
+
* @param options The request budget, the folders skipped and an abort signal.
|
|
61
|
+
*/
|
|
62
|
+
export async function readTree(fetchImpl, token, repo, commit, apiBase = GITHUB_API_BASE, options = {}) {
|
|
63
|
+
const maxRequests = options.maxRequests ?? DEFAULT_MAX_TREE_REQUESTS;
|
|
64
|
+
const skip = new Set(options.skipFolders ?? []);
|
|
65
|
+
const blobs = [];
|
|
66
|
+
let requests = 0;
|
|
67
|
+
const read = async (sha, recursive) => {
|
|
68
|
+
if (requests >= maxRequests)
|
|
69
|
+
throw new TreeTooLarge(maxRequests);
|
|
70
|
+
requests += 1;
|
|
71
|
+
const url = `${apiBase}/repos/${repo}/git/trees/${encodeURIComponent(sha)}${recursive ? '?recursive=1' : ''}`;
|
|
72
|
+
const answer = objectOf(await githubFetch(fetchImpl, url, { token, signal: options.signal }), 'a tree');
|
|
73
|
+
return { truncated: answer.truncated === true, entries: arrayOf(answer.tree, 'a tree').map(entryOf) };
|
|
74
|
+
};
|
|
75
|
+
const keep = (entry, path) => {
|
|
76
|
+
if (entry.type === 'blob' && entry.mode !== SYMLINK_MODE && !inSkippedFolder(path, skip)) {
|
|
77
|
+
blobs.push({ path, sha: entry.sha, size: entry.size ?? 0 });
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
const walk = async (sha, prefix) => {
|
|
81
|
+
const whole = await read(sha, true);
|
|
82
|
+
if (!whole.truncated) {
|
|
83
|
+
for (const entry of whole.entries)
|
|
84
|
+
keep(entry, `${prefix}${entry.path}`);
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const top = await read(sha, false);
|
|
88
|
+
for (const entry of top.entries) {
|
|
89
|
+
if (entry.type === 'tree') {
|
|
90
|
+
if (!skip.has(entry.path))
|
|
91
|
+
await walk(entry.sha, `${prefix}${entry.path}/`);
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
keep(entry, `${prefix}${entry.path}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
await walk(commit, '');
|
|
99
|
+
return blobs;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The filter that keeps a tree's documentation: the extensions kept, nothing under a skipped folder, nothing past the
|
|
103
|
+
* size cap, in path order, at most `maxFiles`.
|
|
104
|
+
*/
|
|
105
|
+
export function pathFilter(filter = {}) {
|
|
106
|
+
const extensions = new Set((filter.extensions ?? DOCUMENT_EXTENSIONS).map((extension) => extension.toLowerCase()));
|
|
107
|
+
const skip = new Set(filter.skipFolders ?? SKIPPED_FOLDERS);
|
|
108
|
+
const maxFiles = filter.maxFiles ?? DEFAULT_MAX_FILES;
|
|
109
|
+
const maxFileBytes = filter.maxFileBytes ?? DEFAULT_MAX_FILE_BYTES;
|
|
110
|
+
return (blobs) => blobs
|
|
111
|
+
.filter((blob) => extensions.has(extensionOf(blob.path)) && blob.size <= maxFileBytes && !inSkippedFolder(blob.path, skip))
|
|
112
|
+
.sort((a, b) => (a.path < b.path ? -1 : a.path > b.path ? 1 : 0))
|
|
113
|
+
.slice(0, maxFiles);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=tree.js.map
|
|
@@ -0,0 +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;AAuB3F,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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AC,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,8 +2,8 @@
|
|
|
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.1
|
|
6
|
-
"description": "GitHub API tools
|
|
5
|
+
"version": "0.2.1",
|
|
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 signatures, a daily reconcile) and a connector that reads a repository's documentation as account sources.",
|
|
7
7
|
"categories": ["tool", "developer"],
|
|
8
8
|
"extensions": [
|
|
9
9
|
{ "kind": "tool", "id": "githubSearch", "displayName": "GitHub Search" },
|
|
@@ -44,6 +44,8 @@
|
|
|
44
44
|
"File reading and writing",
|
|
45
45
|
"Release listing and creation",
|
|
46
46
|
"GitHub Actions workflow listing and triggering",
|
|
47
|
-
"Gist creation"
|
|
47
|
+
"Gist creation",
|
|
48
|
+
"GitHub App installation mode: app JWT, installation tokens, the user's web flow, installations and repositories a user can reach, webhook signatures, daily reconcile",
|
|
49
|
+
"Repository documentation as account sources, read by tree with raw file reads and compared by tree on a push"
|
|
48
50
|
]
|
|
49
51
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@framers/agentos-ext-github",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts"
|
|
12
|
+
},
|
|
13
|
+
"./documents": {
|
|
14
|
+
"import": "./dist/documents/index.js",
|
|
15
|
+
"types": "./dist/documents/index.d.ts"
|
|
16
|
+
},
|
|
17
|
+
"./manifest.json": "./manifest.json",
|
|
18
|
+
"./package.json": "./package.json"
|
|
19
|
+
},
|
|
8
20
|
"keywords": [
|
|
9
21
|
"agentos",
|
|
10
22
|
"extension",
|
|
@@ -22,16 +34,17 @@
|
|
|
22
34
|
"manifest.json"
|
|
23
35
|
],
|
|
24
36
|
"dependencies": {
|
|
25
|
-
"@
|
|
37
|
+
"@framers/agentos-ext-account-sources": "^0.1.0",
|
|
38
|
+
"@octokit/rest": "^22.0.1"
|
|
26
39
|
},
|
|
27
40
|
"peerDependencies": {
|
|
28
|
-
"@framers/agentos": ">=0.
|
|
41
|
+
"@framers/agentos": ">=0.13.40"
|
|
29
42
|
},
|
|
30
43
|
"devDependencies": {
|
|
31
44
|
"@types/node": "^20.0.0",
|
|
32
45
|
"typescript": "^5.0.0",
|
|
33
46
|
"vitest": "^3.2.7",
|
|
34
|
-
"@framers/agentos": "^0.13.
|
|
47
|
+
"@framers/agentos": "^0.13.89"
|
|
35
48
|
},
|
|
36
49
|
"engines": {
|
|
37
50
|
"node": ">=22"
|