@irogane/kaji 0.2.0-beta.11
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/LICENSE +105 -0
- package/README.md +598 -0
- package/contracts/README.md +14 -0
- package/contracts/beta-core-v1.json +52 -0
- package/contracts/cli/init-cases-v1.json +27 -0
- package/contracts/errors/error-codes.json +48 -0
- package/contracts/errors/integration-recovery-v1.json +127 -0
- package/contracts/errors/provider-normalization.json +111 -0
- package/contracts/events/conformance-invalid.json +20 -0
- package/contracts/events/conformance.json +511 -0
- package/contracts/events/new-kaji-event-v1.schema.json +1021 -0
- package/contracts/events/stored-kaji-event-v1.schema.json +1025 -0
- package/contracts/feature-tiers-v1.json +488 -0
- package/contracts/integrations/abi-index-v1.json +8 -0
- package/contracts/integrations/conformance-invalid.json +443 -0
- package/contracts/integrations/conformance-valid.json +121 -0
- package/contracts/integrations/copy-provenance-v1.schema.json +61 -0
- package/contracts/integrations/echo-tool-abi-v1.json +37 -0
- package/contracts/integrations/github-api-conformance-v1.json +644 -0
- package/contracts/integrations/github-tool-abi-typescript-v1.json +369 -0
- package/contracts/integrations/github-tool-abi-v1.json +146 -0
- package/contracts/integrations/gmail-api-conformance-v1.json +750 -0
- package/contracts/integrations/gmail-tool-abi-v1.json +62 -0
- package/contracts/integrations/index.schema.json +37 -0
- package/contracts/integrations/manifest.schema.json +119 -0
- package/contracts/parity/expected-normalized.json +4906 -0
- package/contracts/parity/scenarios.json +100 -0
- package/contracts/parity/scenarios.schema.json +214 -0
- package/contracts/providers/cost-conformance.json +112 -0
- package/contracts/release/github-proof-v1.schema.json +138 -0
- package/contracts/release/gmail-proof-v1.schema.json +138 -0
- package/contracts/release/kaji-ts-consumer-handoff-v1.schema.json +1289 -0
- package/contracts/release/publisher-identity-receipt-v1.schema.json +319 -0
- package/contracts/release/typescript-onboarding-evidence-v1.schema.json +740 -0
- package/contracts/tools/conformance-invalid.json +271 -0
- package/contracts/tools/conformance-valid.json +78 -0
- package/contracts/tools/tool-schema-v1.schema.json +18 -0
- package/dist/anthropic.cjs +1231 -0
- package/dist/anthropic.cjs.map +1 -0
- package/dist/anthropic.d.cts +26 -0
- package/dist/anthropic.d.ts +26 -0
- package/dist/anthropic.js +270 -0
- package/dist/anthropic.js.map +1 -0
- package/dist/auth.cjs +1507 -0
- package/dist/auth.cjs.map +1 -0
- package/dist/auth.d.cts +129 -0
- package/dist/auth.d.ts +129 -0
- package/dist/auth.js +1039 -0
- package/dist/auth.js.map +1 -0
- package/dist/base-B9FRMcP8.d.cts +140 -0
- package/dist/base-nHQd1VtS.d.ts +140 -0
- package/dist/chunk-AAM33KAO.js +4367 -0
- package/dist/chunk-AAM33KAO.js.map +1 -0
- package/dist/chunk-KAJ6BM64.js +153 -0
- package/dist/chunk-KAJ6BM64.js.map +1 -0
- package/dist/chunk-KCAXIOZS.js +308 -0
- package/dist/chunk-KCAXIOZS.js.map +1 -0
- package/dist/chunk-LSJ4AVO2.js +243 -0
- package/dist/chunk-LSJ4AVO2.js.map +1 -0
- package/dist/chunk-TM7ZGOJX.js +716 -0
- package/dist/chunk-TM7ZGOJX.js.map +1 -0
- package/dist/cli/bin.d.ts +2 -0
- package/dist/cli/bin.js +13 -0
- package/dist/cli/bin.js.map +1 -0
- package/dist/cli/chunk-2RCWPRVY.js +6277 -0
- package/dist/cli/chunk-2RCWPRVY.js.map +1 -0
- package/dist/cli/chunk-SEBX54TR.js +681 -0
- package/dist/cli/chunk-SEBX54TR.js.map +1 -0
- package/dist/cli/index.d.ts +232 -0
- package/dist/cli/index.js +11 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/init-worker.d.ts +2 -0
- package/dist/cli/init-worker.js +18 -0
- package/dist/cli/init-worker.js.map +1 -0
- package/dist/cli/integration-copy-worker.js +48 -0
- package/dist/cli/integration-copy-worker.js.map +1 -0
- package/dist/cli/package-entry-cjs.cjs +21 -0
- package/dist/cli/package-entry-cjs.cjs.map +1 -0
- package/dist/cli/package-entry-cjs.d.cts +2 -0
- package/dist/cli/package-entry.d.ts +2 -0
- package/dist/cli/package-entry.js +13 -0
- package/dist/cli/package-entry.js.map +1 -0
- package/dist/context-BaFHrQHv.d.cts +21 -0
- package/dist/context-BaFHrQHv.d.ts +21 -0
- package/dist/context-C-YPY-GS.d.cts +1538 -0
- package/dist/context-C-YPY-GS.d.ts +1538 -0
- package/dist/index.cjs +12346 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1560 -0
- package/dist/index.d.ts +1560 -0
- package/dist/index.js +7852 -0
- package/dist/index.js.map +1 -0
- package/dist/integrations/github.cjs +2092 -0
- package/dist/integrations/github.cjs.map +1 -0
- package/dist/integrations/github.d.cts +21 -0
- package/dist/integrations/github.d.ts +21 -0
- package/dist/integrations/github.js +2088 -0
- package/dist/integrations/github.js.map +1 -0
- package/dist/integrations.cjs +3370 -0
- package/dist/integrations.cjs.map +1 -0
- package/dist/integrations.d.cts +202 -0
- package/dist/integrations.d.ts +202 -0
- package/dist/integrations.js +2650 -0
- package/dist/integrations.js.map +1 -0
- package/dist/observability-Cj--OkME.d.cts +96 -0
- package/dist/observability-Cj--OkME.d.ts +96 -0
- package/dist/openai.cjs +1235 -0
- package/dist/openai.cjs.map +1 -0
- package/dist/openai.d.cts +32 -0
- package/dist/openai.d.ts +32 -0
- package/dist/openai.js +272 -0
- package/dist/openai.js.map +1 -0
- package/dist/testing.cjs +554 -0
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.d.cts +43 -0
- package/dist/testing.d.ts +43 -0
- package/dist/testing.js +118 -0
- package/dist/testing.js.map +1 -0
- package/package.json +188 -0
- package/registry/echo/index.ts +53 -0
- package/registry/echo/manifest.json +53 -0
- package/registry/github/LICENSE +105 -0
- package/registry/github/client.ts +1727 -0
- package/registry/github/index.ts +263 -0
- package/registry/github/manifest.json +227 -0
- package/registry/github/owner-fixtures.json +10 -0
- package/registry/github/tests/github.test.ts +32 -0
- package/registry/gmail/LICENSE +105 -0
- package/registry/gmail/client.ts +548 -0
- package/registry/gmail/index.ts +165 -0
- package/registry/gmail/manifest.json +102 -0
- package/registry/gmail/owner-fixtures.json +10 -0
- package/registry/gmail/tests/gmail.test.ts +32 -0
- package/registry/index.json +21 -0
- package/registry/index.schema.json +37 -0
- package/registry/schema.json +119 -0
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
// This is YOUR GitHub integration. Edit it.
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Integration,
|
|
5
|
+
type MetricsSink,
|
|
6
|
+
type ToolExecutionContext,
|
|
7
|
+
type ToolHandler,
|
|
8
|
+
type ToolSpec,
|
|
9
|
+
type TraceSink,
|
|
10
|
+
} from "@irogane/kaji";
|
|
11
|
+
import { createGitHubRequester } from "@irogane/kaji/integrations";
|
|
12
|
+
|
|
13
|
+
import { GitHubClient } from "./client";
|
|
14
|
+
|
|
15
|
+
export type SharedGitHubClient = Pick<
|
|
16
|
+
GitHubClient,
|
|
17
|
+
"addComment" | "createIssue" | "getFile" | "getIssue" | "listIssues" | "searchCode"
|
|
18
|
+
>;
|
|
19
|
+
|
|
20
|
+
const repository = {
|
|
21
|
+
type: "string",
|
|
22
|
+
pattern: "^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}$",
|
|
23
|
+
} as const;
|
|
24
|
+
const issueNumber = { type: "integer", minimum: 1, maximum: Number.MAX_SAFE_INTEGER } as const;
|
|
25
|
+
|
|
26
|
+
function parameters(
|
|
27
|
+
properties: Readonly<Record<string, unknown>>,
|
|
28
|
+
required: readonly string[],
|
|
29
|
+
): Record<string, unknown> {
|
|
30
|
+
return {
|
|
31
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
32
|
+
type: "object",
|
|
33
|
+
properties,
|
|
34
|
+
required: [...required],
|
|
35
|
+
additionalProperties: false,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function specs(): readonly ToolSpec[] {
|
|
40
|
+
return [
|
|
41
|
+
{
|
|
42
|
+
name: "add_comment",
|
|
43
|
+
description: "Add a comment to a GitHub issue.",
|
|
44
|
+
parameters: parameters(
|
|
45
|
+
{
|
|
46
|
+
repository,
|
|
47
|
+
issue_number: issueNumber,
|
|
48
|
+
body: { type: "string", minLength: 1, maxLength: 16_384 },
|
|
49
|
+
},
|
|
50
|
+
["repository", "issue_number", "body"],
|
|
51
|
+
),
|
|
52
|
+
risk: "external_effect",
|
|
53
|
+
parallel_safe: false,
|
|
54
|
+
timeout_ms: 15_000,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "create_issue",
|
|
58
|
+
description: "Create a GitHub issue.",
|
|
59
|
+
parameters: parameters(
|
|
60
|
+
{
|
|
61
|
+
repository,
|
|
62
|
+
title: { type: "string", minLength: 1, maxLength: 256 },
|
|
63
|
+
body: { type: "string", minLength: 0, maxLength: 16_384 },
|
|
64
|
+
},
|
|
65
|
+
["repository", "title", "body"],
|
|
66
|
+
),
|
|
67
|
+
risk: "external_effect",
|
|
68
|
+
parallel_safe: false,
|
|
69
|
+
timeout_ms: 15_000,
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "get_file",
|
|
73
|
+
description: "Get a file from a GitHub repository.",
|
|
74
|
+
parameters: parameters(
|
|
75
|
+
{
|
|
76
|
+
repository,
|
|
77
|
+
path: { type: "string", minLength: 1, maxLength: 512 },
|
|
78
|
+
ref: { type: "string", minLength: 1, maxLength: 100 },
|
|
79
|
+
},
|
|
80
|
+
["repository", "path"],
|
|
81
|
+
),
|
|
82
|
+
risk: "read",
|
|
83
|
+
parallel_safe: true,
|
|
84
|
+
timeout_ms: 10_000,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "get_issue",
|
|
88
|
+
description: "Get a GitHub issue.",
|
|
89
|
+
parameters: parameters({ repository, issue_number: issueNumber }, [
|
|
90
|
+
"repository",
|
|
91
|
+
"issue_number",
|
|
92
|
+
]),
|
|
93
|
+
risk: "read",
|
|
94
|
+
parallel_safe: true,
|
|
95
|
+
timeout_ms: 10_000,
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
name: "list_issues",
|
|
99
|
+
description: "List GitHub issues.",
|
|
100
|
+
parameters: parameters(
|
|
101
|
+
{
|
|
102
|
+
repository,
|
|
103
|
+
state: { type: "string", enum: ["open", "closed", "all"], default: "open" },
|
|
104
|
+
page: { type: "integer", minimum: 1, maximum: 1_000, default: 1 },
|
|
105
|
+
per_page: { type: "integer", minimum: 1, maximum: 20, default: 10 },
|
|
106
|
+
},
|
|
107
|
+
["repository"],
|
|
108
|
+
),
|
|
109
|
+
risk: "read",
|
|
110
|
+
parallel_safe: true,
|
|
111
|
+
timeout_ms: 10_000,
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
name: "search_code",
|
|
115
|
+
description: "Search code in a GitHub repository.",
|
|
116
|
+
parameters: parameters(
|
|
117
|
+
{
|
|
118
|
+
repository,
|
|
119
|
+
query: { type: "string", minLength: 1, maxLength: 256 },
|
|
120
|
+
page: { type: "integer", minimum: 1, maximum: 50, default: 1 },
|
|
121
|
+
per_page: { type: "integer", minimum: 1, maximum: 20, default: 10 },
|
|
122
|
+
},
|
|
123
|
+
["repository", "query"],
|
|
124
|
+
),
|
|
125
|
+
risk: "read",
|
|
126
|
+
parallel_safe: true,
|
|
127
|
+
timeout_ms: 10_000,
|
|
128
|
+
},
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function objectResult(value: unknown): Record<string, unknown> {
|
|
133
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
134
|
+
throw new Error("GitHub client returned an invalid tool result");
|
|
135
|
+
}
|
|
136
|
+
return value as Record<string, unknown>;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function handler(client: SharedGitHubClient, name: string): ToolHandler {
|
|
140
|
+
return async (args, context) => {
|
|
141
|
+
switch (name) {
|
|
142
|
+
case "add_comment":
|
|
143
|
+
return objectResult(
|
|
144
|
+
await client.addComment(context, {
|
|
145
|
+
repository: args.repository as string,
|
|
146
|
+
issueNumber: args.issue_number as number,
|
|
147
|
+
body: args.body as string,
|
|
148
|
+
}),
|
|
149
|
+
);
|
|
150
|
+
case "create_issue":
|
|
151
|
+
return objectResult(
|
|
152
|
+
await client.createIssue(context, {
|
|
153
|
+
repository: args.repository as string,
|
|
154
|
+
title: args.title as string,
|
|
155
|
+
body: args.body as string,
|
|
156
|
+
}),
|
|
157
|
+
);
|
|
158
|
+
case "get_file":
|
|
159
|
+
return objectResult(
|
|
160
|
+
await client.getFile(context, {
|
|
161
|
+
repository: args.repository as string,
|
|
162
|
+
path: args.path as string,
|
|
163
|
+
...(args.ref === undefined ? {} : { ref: args.ref as string }),
|
|
164
|
+
}),
|
|
165
|
+
);
|
|
166
|
+
case "get_issue":
|
|
167
|
+
return objectResult(
|
|
168
|
+
await client.getIssue(context, {
|
|
169
|
+
repository: args.repository as string,
|
|
170
|
+
issueNumber: args.issue_number as number,
|
|
171
|
+
}),
|
|
172
|
+
);
|
|
173
|
+
case "list_issues":
|
|
174
|
+
return objectResult(
|
|
175
|
+
await client.listIssues(context, {
|
|
176
|
+
repository: args.repository as string,
|
|
177
|
+
...(args.state === undefined ? {} : { state: args.state as "open" | "closed" | "all" }),
|
|
178
|
+
...(args.page === undefined ? {} : { page: args.page as number }),
|
|
179
|
+
...(args.per_page === undefined ? {} : { perPage: args.per_page as number }),
|
|
180
|
+
}),
|
|
181
|
+
);
|
|
182
|
+
case "search_code":
|
|
183
|
+
return objectResult(
|
|
184
|
+
await client.searchCode(context, {
|
|
185
|
+
repository: args.repository as string,
|
|
186
|
+
query: args.query as string,
|
|
187
|
+
...(args.page === undefined ? {} : { page: args.page as number }),
|
|
188
|
+
...(args.per_page === undefined ? {} : { perPage: args.per_page as number }),
|
|
189
|
+
}),
|
|
190
|
+
);
|
|
191
|
+
default:
|
|
192
|
+
throw new Error("Unknown GitHub tool");
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export function createSharedGitHubToolBindings(
|
|
198
|
+
client: SharedGitHubClient,
|
|
199
|
+
): [ToolSpec, ToolHandler][] {
|
|
200
|
+
return specs().map((spec) => [spec, handler(client, spec.name)]);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export class GitHubIntegration extends Integration {
|
|
204
|
+
readonly namespace = "github";
|
|
205
|
+
private closeOwnedRequester: (() => void) | undefined;
|
|
206
|
+
|
|
207
|
+
constructor(
|
|
208
|
+
private readonly client: SharedGitHubClient,
|
|
209
|
+
closeOwnedRequester?: () => void,
|
|
210
|
+
) {
|
|
211
|
+
super();
|
|
212
|
+
this.closeOwnedRequester = closeOwnedRequester;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
override tools(): [ToolSpec, ToolHandler][] {
|
|
216
|
+
return createSharedGitHubToolBindings(this.client);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
close(): void {
|
|
220
|
+
const close = this.closeOwnedRequester;
|
|
221
|
+
if (close === undefined) return;
|
|
222
|
+
close();
|
|
223
|
+
this.closeOwnedRequester = undefined;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export interface CreateGitHubIntegrationOptions {
|
|
228
|
+
readonly tokenFor: (context: ToolExecutionContext) => Promise<string>;
|
|
229
|
+
readonly repositories: readonly string[];
|
|
230
|
+
readonly metricsSink?: MetricsSink;
|
|
231
|
+
readonly traceSink?: TraceSink;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
export function createGithubIntegration(
|
|
235
|
+
options: CreateGitHubIntegrationOptions,
|
|
236
|
+
): GitHubIntegration {
|
|
237
|
+
const { metricsSink, traceSink, ...clientOptions } = options;
|
|
238
|
+
const http = createGitHubRequester({ metricsSink, traceSink });
|
|
239
|
+
return new GitHubIntegration(
|
|
240
|
+
new GitHubClient({
|
|
241
|
+
...clientOptions,
|
|
242
|
+
http,
|
|
243
|
+
}),
|
|
244
|
+
() => http.close(),
|
|
245
|
+
);
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
function createGithubIntegrationForTest(client: SharedGitHubClient): GitHubIntegration {
|
|
249
|
+
return new GitHubIntegration(client);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const inspectionClient = new Proxy(
|
|
253
|
+
{},
|
|
254
|
+
{
|
|
255
|
+
get: () => async () => {
|
|
256
|
+
throw new Error("inspection dependencies must not execute");
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
) as SharedGitHubClient;
|
|
260
|
+
|
|
261
|
+
export function inspectIntegration(): GitHubIntegration {
|
|
262
|
+
return createGithubIntegrationForTest(inspectionClient);
|
|
263
|
+
}
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "github",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"namespace": "github",
|
|
5
|
+
"description": "Repository-scoped GitHub code, issue, and comment tools.",
|
|
6
|
+
"auth": {
|
|
7
|
+
"kind": "env",
|
|
8
|
+
"env": "GITHUB_TOKEN",
|
|
9
|
+
"docs": "https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"index.ts",
|
|
13
|
+
"client.ts",
|
|
14
|
+
"tests/github.test.ts",
|
|
15
|
+
"owner-fixtures.json",
|
|
16
|
+
"LICENSE"
|
|
17
|
+
],
|
|
18
|
+
"tools": [
|
|
19
|
+
{
|
|
20
|
+
"name": "add_comment",
|
|
21
|
+
"description": "Add a comment to a GitHub issue.",
|
|
22
|
+
"parameters": {
|
|
23
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"pattern": "^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}$"
|
|
29
|
+
},
|
|
30
|
+
"issue_number": {
|
|
31
|
+
"type": "integer",
|
|
32
|
+
"minimum": 1,
|
|
33
|
+
"maximum": 9007199254740991
|
|
34
|
+
},
|
|
35
|
+
"body": {
|
|
36
|
+
"type": "string",
|
|
37
|
+
"minLength": 1,
|
|
38
|
+
"maxLength": 16384
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"required": [
|
|
42
|
+
"repository",
|
|
43
|
+
"issue_number",
|
|
44
|
+
"body"
|
|
45
|
+
],
|
|
46
|
+
"additionalProperties": false
|
|
47
|
+
},
|
|
48
|
+
"risk": "external_effect",
|
|
49
|
+
"parallel_safe": false,
|
|
50
|
+
"timeout_ms": 15000
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"name": "create_issue",
|
|
54
|
+
"description": "Create a GitHub issue.",
|
|
55
|
+
"parameters": {
|
|
56
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
57
|
+
"type": "object",
|
|
58
|
+
"properties": {
|
|
59
|
+
"repository": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"pattern": "^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}$"
|
|
62
|
+
},
|
|
63
|
+
"title": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"minLength": 1,
|
|
66
|
+
"maxLength": 256
|
|
67
|
+
},
|
|
68
|
+
"body": {
|
|
69
|
+
"type": "string",
|
|
70
|
+
"minLength": 0,
|
|
71
|
+
"maxLength": 16384
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
"required": [
|
|
75
|
+
"repository",
|
|
76
|
+
"title",
|
|
77
|
+
"body"
|
|
78
|
+
],
|
|
79
|
+
"additionalProperties": false
|
|
80
|
+
},
|
|
81
|
+
"risk": "external_effect",
|
|
82
|
+
"parallel_safe": false,
|
|
83
|
+
"timeout_ms": 15000
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "get_file",
|
|
87
|
+
"description": "Get a file from a GitHub repository.",
|
|
88
|
+
"parameters": {
|
|
89
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
90
|
+
"type": "object",
|
|
91
|
+
"properties": {
|
|
92
|
+
"repository": {
|
|
93
|
+
"type": "string",
|
|
94
|
+
"pattern": "^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}$"
|
|
95
|
+
},
|
|
96
|
+
"path": {
|
|
97
|
+
"type": "string",
|
|
98
|
+
"minLength": 1,
|
|
99
|
+
"maxLength": 512
|
|
100
|
+
},
|
|
101
|
+
"ref": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"minLength": 1,
|
|
104
|
+
"maxLength": 100
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"required": [
|
|
108
|
+
"repository",
|
|
109
|
+
"path"
|
|
110
|
+
],
|
|
111
|
+
"additionalProperties": false
|
|
112
|
+
},
|
|
113
|
+
"risk": "read",
|
|
114
|
+
"parallel_safe": true,
|
|
115
|
+
"timeout_ms": 10000
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"name": "get_issue",
|
|
119
|
+
"description": "Get a GitHub issue.",
|
|
120
|
+
"parameters": {
|
|
121
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
122
|
+
"type": "object",
|
|
123
|
+
"properties": {
|
|
124
|
+
"repository": {
|
|
125
|
+
"type": "string",
|
|
126
|
+
"pattern": "^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}$"
|
|
127
|
+
},
|
|
128
|
+
"issue_number": {
|
|
129
|
+
"type": "integer",
|
|
130
|
+
"minimum": 1,
|
|
131
|
+
"maximum": 9007199254740991
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"required": [
|
|
135
|
+
"repository",
|
|
136
|
+
"issue_number"
|
|
137
|
+
],
|
|
138
|
+
"additionalProperties": false
|
|
139
|
+
},
|
|
140
|
+
"risk": "read",
|
|
141
|
+
"parallel_safe": true,
|
|
142
|
+
"timeout_ms": 10000
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"name": "list_issues",
|
|
146
|
+
"description": "List GitHub issues.",
|
|
147
|
+
"parameters": {
|
|
148
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
149
|
+
"type": "object",
|
|
150
|
+
"properties": {
|
|
151
|
+
"repository": {
|
|
152
|
+
"type": "string",
|
|
153
|
+
"pattern": "^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}$"
|
|
154
|
+
},
|
|
155
|
+
"state": {
|
|
156
|
+
"type": "string",
|
|
157
|
+
"enum": [
|
|
158
|
+
"open",
|
|
159
|
+
"closed",
|
|
160
|
+
"all"
|
|
161
|
+
],
|
|
162
|
+
"default": "open"
|
|
163
|
+
},
|
|
164
|
+
"page": {
|
|
165
|
+
"type": "integer",
|
|
166
|
+
"minimum": 1,
|
|
167
|
+
"maximum": 1000,
|
|
168
|
+
"default": 1
|
|
169
|
+
},
|
|
170
|
+
"per_page": {
|
|
171
|
+
"type": "integer",
|
|
172
|
+
"minimum": 1,
|
|
173
|
+
"maximum": 20,
|
|
174
|
+
"default": 10
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"required": [
|
|
178
|
+
"repository"
|
|
179
|
+
],
|
|
180
|
+
"additionalProperties": false
|
|
181
|
+
},
|
|
182
|
+
"risk": "read",
|
|
183
|
+
"parallel_safe": true,
|
|
184
|
+
"timeout_ms": 10000
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "search_code",
|
|
188
|
+
"description": "Search code in a GitHub repository.",
|
|
189
|
+
"parameters": {
|
|
190
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
191
|
+
"type": "object",
|
|
192
|
+
"properties": {
|
|
193
|
+
"repository": {
|
|
194
|
+
"type": "string",
|
|
195
|
+
"pattern": "^[A-Za-z0-9_.-]{1,100}/[A-Za-z0-9_.-]{1,100}$"
|
|
196
|
+
},
|
|
197
|
+
"query": {
|
|
198
|
+
"type": "string",
|
|
199
|
+
"minLength": 1,
|
|
200
|
+
"maxLength": 256
|
|
201
|
+
},
|
|
202
|
+
"page": {
|
|
203
|
+
"type": "integer",
|
|
204
|
+
"minimum": 1,
|
|
205
|
+
"maximum": 50,
|
|
206
|
+
"default": 1
|
|
207
|
+
},
|
|
208
|
+
"per_page": {
|
|
209
|
+
"type": "integer",
|
|
210
|
+
"minimum": 1,
|
|
211
|
+
"maximum": 20,
|
|
212
|
+
"default": 10
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
"required": [
|
|
216
|
+
"repository",
|
|
217
|
+
"query"
|
|
218
|
+
],
|
|
219
|
+
"additionalProperties": false
|
|
220
|
+
},
|
|
221
|
+
"risk": "read",
|
|
222
|
+
"parallel_safe": true,
|
|
223
|
+
"timeout_ms": 10000
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
"peerDeps": {}
|
|
227
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": "1.0.0",
|
|
3
|
+
"outcomes": [
|
|
4
|
+
{ "name": "success", "expected": "success" },
|
|
5
|
+
{ "name": "missing_auth", "expected": "INTEGRATION_AUTH_REQUIRED" },
|
|
6
|
+
{ "name": "rate_limit", "expected": "INTEGRATION_RATE_LIMITED" },
|
|
7
|
+
{ "name": "approval_rejected", "expected": "APPROVAL_REJECTED" },
|
|
8
|
+
{ "name": "connection_lost_after_dispatch", "expected": "unknown" }
|
|
9
|
+
]
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// This is YOUR no-network GitHub owner fixture test. Edit it.
|
|
2
|
+
|
|
3
|
+
import { readFileSync } from "node:fs";
|
|
4
|
+
import { describe, expect, it } from "vitest";
|
|
5
|
+
|
|
6
|
+
const closedOutcomes = new Set([
|
|
7
|
+
"success",
|
|
8
|
+
"missing_auth",
|
|
9
|
+
"rate_limit",
|
|
10
|
+
"approval_rejected",
|
|
11
|
+
"connection_lost_after_dispatch",
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
export function scriptedOutcome(name: string): string {
|
|
15
|
+
if (!closedOutcomes.has(name)) throw new Error("unknown scripted GitHub outcome");
|
|
16
|
+
const fixture = JSON.parse(
|
|
17
|
+
readFileSync(new URL("../owner-fixtures.json", import.meta.url), "utf8"),
|
|
18
|
+
) as { outcomes: Array<{ name: string; expected: string }> };
|
|
19
|
+
return fixture.outcomes.find((row) => row.name === name)!.expected;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
describe("GitHub owner fixtures", () => {
|
|
23
|
+
it("keeps scripted outcomes closed and network-free", () => {
|
|
24
|
+
expect([...closedOutcomes].map((name) => [name, scriptedOutcome(name)])).toEqual([
|
|
25
|
+
["success", "success"],
|
|
26
|
+
["missing_auth", "INTEGRATION_AUTH_REQUIRED"],
|
|
27
|
+
["rate_limit", "INTEGRATION_RATE_LIMITED"],
|
|
28
|
+
["approval_rejected", "APPROVAL_REJECTED"],
|
|
29
|
+
["connection_lost_after_dispatch", "unknown"],
|
|
30
|
+
]);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-ALv2
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 Enkang Yuan
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|