@ghx-dev/core 0.1.1 → 0.1.2
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 +5 -5
- package/dist/agent.js +3 -5
- package/dist/agent.js.map +1 -1
- package/dist/cards/project_v2.fields.list.yaml +2 -2
- package/dist/cards/project_v2.item.add_issue.yaml +2 -2
- package/dist/cards/project_v2.item.field.update.yaml +2 -2
- package/dist/cards/project_v2.items.list.yaml +2 -2
- package/dist/cards/project_v2.org.get.yaml +2 -2
- package/dist/cards/project_v2.user.get.yaml +2 -2
- package/dist/cards/repo.issue_types.list.yaml +2 -2
- package/dist/{chunk-SCIJMW5P.js → chunk-2FCPR3XZ.js} +2 -2
- package/dist/{chunk-PJ2JKKQE.js → chunk-RDUPMVHG.js} +18 -27
- package/dist/chunk-RDUPMVHG.js.map +1 -0
- package/dist/{chunk-OL4ARD3R.js → chunk-UN5YHUNK.js} +6 -3
- package/dist/chunk-UN5YHUNK.js.map +1 -0
- package/dist/cli/index.js +3 -3
- package/dist/core/registry/cards/project_v2.fields.list.yaml +2 -2
- package/dist/core/registry/cards/project_v2.item.add_issue.yaml +2 -2
- package/dist/core/registry/cards/project_v2.item.field.update.yaml +2 -2
- package/dist/core/registry/cards/project_v2.items.list.yaml +2 -2
- package/dist/core/registry/cards/project_v2.org.get.yaml +2 -2
- package/dist/core/registry/cards/project_v2.user.get.yaml +2 -2
- package/dist/core/registry/cards/repo.issue_types.list.yaml +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/package.json +3 -6
- package/dist/chunk-OL4ARD3R.js.map +0 -1
- package/dist/chunk-PJ2JKKQE.js.map +0 -1
- /package/dist/{chunk-SCIJMW5P.js.map → chunk-2FCPR3XZ.js.map} +0 -0
package/README.md
CHANGED
|
@@ -268,11 +268,11 @@ const result = await executeTask(
|
|
|
268
268
|
|
|
269
269
|
## Documentation
|
|
270
270
|
|
|
271
|
-
- [
|
|
272
|
-
- [
|
|
273
|
-
- [
|
|
274
|
-
- [Operation
|
|
275
|
-
- [Publishing
|
|
271
|
+
- [Documentation Hub](https://github.com/aryeko/ghx/blob/main/docs/README.md)
|
|
272
|
+
- [Architecture](https://github.com/aryeko/ghx/blob/main/docs/architecture/README.md)
|
|
273
|
+
- [Capabilities Reference](https://github.com/aryeko/ghx/blob/main/docs/capabilities/README.md)
|
|
274
|
+
- [Operation Cards](https://github.com/aryeko/ghx/blob/main/docs/architecture/operation-cards.md)
|
|
275
|
+
- [Publishing Guide](https://github.com/aryeko/ghx/blob/main/docs/contributing/publishing.md)
|
|
276
276
|
|
|
277
277
|
## License
|
|
278
278
|
|
package/dist/agent.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
explainCapability,
|
|
3
3
|
listCapabilities
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-2FCPR3XZ.js";
|
|
5
|
+
import "./chunk-UN5YHUNK.js";
|
|
6
6
|
|
|
7
7
|
// src/agent-interface/prompt/main-skill.ts
|
|
8
8
|
var MAIN_SKILL_TEXT = `
|
|
@@ -23,9 +23,7 @@ function createExecuteTool(deps) {
|
|
|
23
23
|
input: params,
|
|
24
24
|
...options ? { options } : {}
|
|
25
25
|
};
|
|
26
|
-
return deps.executeTask(
|
|
27
|
-
...request
|
|
28
|
-
});
|
|
26
|
+
return deps.executeTask(request);
|
|
29
27
|
}
|
|
30
28
|
};
|
|
31
29
|
}
|
package/dist/agent.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/agent-interface/prompt/main-skill.ts","../src/agent-interface/tools/execute-tool.ts"],"sourcesContent":["export const MAIN_SKILL_TEXT = `\nUse execute(capability_id, params) for all GitHub actions.\nNever call gh help and never fetch GraphQL schema/introspection.\nIf required params are unknown, call explain(capability_id) or ask the user.\nTreat ResultEnvelope.ok=false as a failure.\nIf error.retryable=true, retry once unless user requested otherwise.\nOnly reason about ResultEnvelope.data and ResultEnvelope.error.\n`.trim()\n","import type { ResultEnvelope } from \"../../core/contracts/envelope.js\"\n\ntype ExecuteTaskFn = (request: {\n task: string\n input: Record<string, unknown>\n options?: Record<string, unknown>\n}) => Promise<ResultEnvelope>\n\nexport function createExecuteTool(deps: { executeTask: ExecuteTaskFn }) {\n return {\n execute(\n capabilityId: string,\n params: Record<string, unknown>,\n options?: Record<string, unknown>,\n ): Promise<ResultEnvelope> {\n const request = {\n task: capabilityId,\n input: params,\n ...(options ? { options } : {}),\n }\n\n return deps.executeTask(
|
|
1
|
+
{"version":3,"sources":["../src/agent-interface/prompt/main-skill.ts","../src/agent-interface/tools/execute-tool.ts"],"sourcesContent":["export const MAIN_SKILL_TEXT = `\nUse execute(capability_id, params) for all GitHub actions.\nNever call gh help and never fetch GraphQL schema/introspection.\nIf required params are unknown, call explain(capability_id) or ask the user.\nTreat ResultEnvelope.ok=false as a failure.\nIf error.retryable=true, retry once unless user requested otherwise.\nOnly reason about ResultEnvelope.data and ResultEnvelope.error.\n`.trim()\n","import type { ResultEnvelope } from \"../../core/contracts/envelope.js\"\n\ntype ExecuteTaskFn = (request: {\n task: string\n input: Record<string, unknown>\n options?: Record<string, unknown>\n}) => Promise<ResultEnvelope>\n\nexport function createExecuteTool(deps: { executeTask: ExecuteTaskFn }) {\n return {\n execute(\n capabilityId: string,\n params: Record<string, unknown>,\n options?: Record<string, unknown>,\n ): Promise<ResultEnvelope> {\n const request = {\n task: capabilityId,\n input: params,\n ...(options ? { options } : {}),\n }\n\n return deps.executeTask(request)\n },\n }\n}\n"],"mappings":";;;;;;;AAAO,IAAM,kBAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAO7B,KAAK;;;ACCA,SAAS,kBAAkB,MAAsC;AACtE,SAAO;AAAA,IACL,QACE,cACA,QACA,SACyB;AACzB,YAAM,UAAU;AAAA,QACd,MAAM;AAAA,QACN,OAAO;AAAA,QACP,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;AAAA,MAC/B;AAEA,aAAO,KAAK,YAAY,OAAO;AAAA,IACjC;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getOperationCard,
|
|
3
3
|
listOperationCards
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UN5YHUNK.js";
|
|
5
5
|
|
|
6
6
|
// src/agent-interface/tools/explain-tool.ts
|
|
7
7
|
function extractRequiredInputs(inputSchema) {
|
|
@@ -51,4 +51,4 @@ export {
|
|
|
51
51
|
explainCapability,
|
|
52
52
|
listCapabilities
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-2FCPR3XZ.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ajv,
|
|
2
3
|
getOperationCard
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UN5YHUNK.js";
|
|
4
5
|
|
|
5
6
|
// src/core/execution/cli/safe-runner.ts
|
|
6
7
|
import { spawn } from "child_process";
|
|
@@ -146,11 +147,6 @@ function normalizeError(error, route, options) {
|
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
// src/core/registry/schema-validator.ts
|
|
149
|
-
import { Ajv } from "ajv";
|
|
150
|
-
var ajv = new Ajv({
|
|
151
|
-
allErrors: true,
|
|
152
|
-
strict: false
|
|
153
|
-
});
|
|
154
150
|
var validatorCache = /* @__PURE__ */ new WeakMap();
|
|
155
151
|
function mapAjvErrors(errors) {
|
|
156
152
|
if (!errors) {
|
|
@@ -422,17 +418,20 @@ function toMessage(error) {
|
|
|
422
418
|
}
|
|
423
419
|
function mapErrorToCode(error) {
|
|
424
420
|
const message = toMessage(error).toLowerCase();
|
|
425
|
-
if (message.includes("rate limit") || message
|
|
421
|
+
if (message.includes("rate limit") || /\b429\b/.test(message) || message.includes("too many requests")) {
|
|
426
422
|
return errorCodes.RateLimit;
|
|
427
423
|
}
|
|
424
|
+
if (/\b(500|502|503|504)\b/.test(message)) {
|
|
425
|
+
return errorCodes.Server;
|
|
426
|
+
}
|
|
428
427
|
if (message.includes("timeout")) {
|
|
429
428
|
return errorCodes.Network;
|
|
430
429
|
}
|
|
431
430
|
if (message.includes("econn") || message.includes("enotfound") || message.includes("eai_again") || message.includes("network") || message.includes("connection reset")) {
|
|
432
431
|
return errorCodes.Network;
|
|
433
432
|
}
|
|
434
|
-
if (message.includes("
|
|
435
|
-
return errorCodes.
|
|
433
|
+
if (message.includes("not found") || /\b404\b/.test(message)) {
|
|
434
|
+
return errorCodes.NotFound;
|
|
436
435
|
}
|
|
437
436
|
if (message.includes("auth") || message.includes("forbidden") || message.includes("unauthorized")) {
|
|
438
437
|
return errorCodes.Auth;
|
|
@@ -440,9 +439,6 @@ function mapErrorToCode(error) {
|
|
|
440
439
|
if (message.includes("validation") || message.includes("invalid") || message.includes("required") || message.includes("positive integer")) {
|
|
441
440
|
return errorCodes.Validation;
|
|
442
441
|
}
|
|
443
|
-
if (message.includes("not found") || message.includes(" 404")) {
|
|
444
|
-
return errorCodes.NotFound;
|
|
445
|
-
}
|
|
446
442
|
return errorCodes.Unknown;
|
|
447
443
|
}
|
|
448
444
|
|
|
@@ -1362,7 +1358,7 @@ function isCheckPassBucket(bucket) {
|
|
|
1362
1358
|
}
|
|
1363
1359
|
return normalized === "pass";
|
|
1364
1360
|
}
|
|
1365
|
-
function normalizeCliData(capabilityId, data, params) {
|
|
1361
|
+
function normalizeCliData(capabilityId, data, params, context) {
|
|
1366
1362
|
const normalizeRelease = (input) => {
|
|
1367
1363
|
if (typeof input !== "object" || input === null || Array.isArray(input)) {
|
|
1368
1364
|
return {
|
|
@@ -1567,7 +1563,7 @@ function normalizeCliData(capabilityId, data, params) {
|
|
|
1567
1563
|
};
|
|
1568
1564
|
}
|
|
1569
1565
|
if (capabilityId === "pr.checks.rerun_failed" || capabilityId === "pr.checks.rerun_all") {
|
|
1570
|
-
const effectiveMode =
|
|
1566
|
+
const effectiveMode = context?.effectiveRerunMode === "all" ? "all" : capabilityId === "pr.checks.rerun_failed" ? "failed" : "all";
|
|
1571
1567
|
return {
|
|
1572
1568
|
prNumber: Number(params.prNumber),
|
|
1573
1569
|
runId: Number(params.runId),
|
|
@@ -1880,7 +1876,7 @@ function normalizeCliData(capabilityId, data, params) {
|
|
|
1880
1876
|
const release = normalizeRelease(data);
|
|
1881
1877
|
return {
|
|
1882
1878
|
...release,
|
|
1883
|
-
wasDraft: Boolean(
|
|
1879
|
+
wasDraft: Boolean(context?.wasDraft)
|
|
1884
1880
|
};
|
|
1885
1881
|
}
|
|
1886
1882
|
if (capabilityId === "workflow_dispatch.run") {
|
|
@@ -1956,9 +1952,8 @@ async function runCliCapability(runner, capabilityId, params, card) {
|
|
|
1956
1952
|
{ capabilityId, reason: "CARD_FALLBACK" }
|
|
1957
1953
|
);
|
|
1958
1954
|
}
|
|
1959
|
-
const normalized2 = normalizeCliData(capabilityId, parseCliData(result2.stdout), {
|
|
1960
|
-
|
|
1961
|
-
__wasDraft: true
|
|
1955
|
+
const normalized2 = normalizeCliData(capabilityId, parseCliData(result2.stdout), params, {
|
|
1956
|
+
wasDraft: true
|
|
1962
1957
|
});
|
|
1963
1958
|
return normalizeResult(normalized2, "cli", { capabilityId, reason: "CARD_FALLBACK" });
|
|
1964
1959
|
}
|
|
@@ -1971,9 +1966,8 @@ async function runCliCapability(runner, capabilityId, params, card) {
|
|
|
1971
1966
|
const rerunAllResult = await runner.run("gh", rerunAllArgs, DEFAULT_TIMEOUT_MS);
|
|
1972
1967
|
if (rerunAllResult.exitCode === 0) {
|
|
1973
1968
|
const rerunData = NON_JSON_STDOUT_CAPABILITIES.has(capabilityId) ? {} : parseCliData(rerunAllResult.stdout);
|
|
1974
|
-
const fallbackData = normalizeCliData(capabilityId, rerunData, {
|
|
1975
|
-
|
|
1976
|
-
__effectiveRerunMode: "all"
|
|
1969
|
+
const fallbackData = normalizeCliData(capabilityId, rerunData, params, {
|
|
1970
|
+
effectiveRerunMode: "all"
|
|
1977
1971
|
});
|
|
1978
1972
|
return normalizeResult(fallbackData, "cli", { capabilityId, reason: "CARD_FALLBACK" });
|
|
1979
1973
|
}
|
|
@@ -2271,7 +2265,7 @@ function preflightCheck(input) {
|
|
|
2271
2265
|
if (input.route === "cli" && input.ghCliAvailable === false) {
|
|
2272
2266
|
return {
|
|
2273
2267
|
ok: false,
|
|
2274
|
-
code: errorCodes.
|
|
2268
|
+
code: errorCodes.AdapterUnsupported,
|
|
2275
2269
|
message: "GitHub CLI is required for cli route",
|
|
2276
2270
|
retryable: false,
|
|
2277
2271
|
details: { route: input.route }
|
|
@@ -2305,9 +2299,6 @@ function preflightCheck(input) {
|
|
|
2305
2299
|
var routePreferenceOrder = ["cli", "graphql"];
|
|
2306
2300
|
|
|
2307
2301
|
// src/core/routing/engine.ts
|
|
2308
|
-
function chooseRoute() {
|
|
2309
|
-
return routePreferenceOrder[0];
|
|
2310
|
-
}
|
|
2311
2302
|
var DEFAULT_REASON = "DEFAULT_POLICY";
|
|
2312
2303
|
var CLI_ENV_CACHE_TTL_MS = 3e4;
|
|
2313
2304
|
var cliEnvironmentCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -2368,7 +2359,7 @@ async function executeTask(request, deps) {
|
|
|
2368
2359
|
message: `Unsupported task: ${request.task}`,
|
|
2369
2360
|
retryable: false
|
|
2370
2361
|
},
|
|
2371
|
-
|
|
2362
|
+
routePreferenceOrder[0],
|
|
2372
2363
|
{ capabilityId: request.task, reason }
|
|
2373
2364
|
);
|
|
2374
2365
|
}
|
|
@@ -4145,4 +4136,4 @@ export {
|
|
|
4145
4136
|
createGithubClientFromToken,
|
|
4146
4137
|
createGithubClient
|
|
4147
4138
|
};
|
|
4148
|
-
//# sourceMappingURL=chunk-
|
|
4139
|
+
//# sourceMappingURL=chunk-RDUPMVHG.js.map
|