@adhisang/minecraft-modding-mcp 3.2.0 → 4.1.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/CHANGELOG.md +72 -0
- package/README.md +52 -32
- package/dist/build-suggested-call.d.ts +29 -0
- package/dist/build-suggested-call.js +58 -0
- package/dist/cache-registry.d.ts +3 -1
- package/dist/cache-registry.js +59 -7
- package/dist/config.d.ts +10 -1
- package/dist/config.js +52 -1
- package/dist/entry-tools/analyze-symbol-service.d.ts +18 -18
- package/dist/entry-tools/analyze-symbol-service.js +13 -2
- package/dist/entry-tools/batch-class-members-service.d.ts +34 -0
- package/dist/entry-tools/batch-class-members-service.js +97 -0
- package/dist/entry-tools/batch-class-source-service.d.ts +37 -0
- package/dist/entry-tools/batch-class-source-service.js +100 -0
- package/dist/entry-tools/batch-mappings-service.d.ts +36 -0
- package/dist/entry-tools/batch-mappings-service.js +66 -0
- package/dist/entry-tools/batch-runner.d.ts +72 -0
- package/dist/entry-tools/batch-runner.js +90 -0
- package/dist/entry-tools/batch-symbol-exists-service.d.ts +46 -0
- package/dist/entry-tools/batch-symbol-exists-service.js +113 -0
- package/dist/entry-tools/compare-minecraft-service.d.ts +6 -6
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/artifact.js +83 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-members.js +80 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-overview.js +248 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/class-source.js +60 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/file.js +54 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/list-files.js +100 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.d.ts +5 -0
- package/dist/entry-tools/inspect-minecraft/handlers/search.js +155 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.d.ts +6 -0
- package/dist/entry-tools/inspect-minecraft/handlers/versions.js +49 -0
- package/dist/entry-tools/inspect-minecraft/internal.d.ts +1042 -0
- package/dist/entry-tools/inspect-minecraft/internal.js +448 -0
- package/dist/entry-tools/inspect-minecraft-service.d.ts +213 -328
- package/dist/entry-tools/inspect-minecraft-service.js +20 -1238
- package/dist/entry-tools/manage-cache-service.d.ts +16 -16
- package/dist/entry-tools/validate-project/cases/access-transformer.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-transformer.js +106 -0
- package/dist/entry-tools/validate-project/cases/access-widener.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/access-widener.js +86 -0
- package/dist/entry-tools/validate-project/cases/mixin.d.ts +6 -0
- package/dist/entry-tools/validate-project/cases/mixin.js +90 -0
- package/dist/entry-tools/validate-project/cases/project-summary.d.ts +97 -0
- package/dist/entry-tools/validate-project/cases/project-summary.js +346 -0
- package/dist/entry-tools/validate-project/internal.d.ts +135 -0
- package/dist/entry-tools/validate-project/internal.js +287 -0
- package/dist/entry-tools/validate-project-service.d.ts +63 -47
- package/dist/entry-tools/validate-project-service.js +12 -482
- package/dist/entry-tools/verify-mixin-target-service.d.ts +133 -0
- package/dist/entry-tools/verify-mixin-target-service.js +323 -0
- package/dist/error-mapping.d.ts +40 -0
- package/dist/error-mapping.js +139 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +170 -1314
- package/dist/lru-list.d.ts +31 -0
- package/dist/lru-list.js +102 -0
- package/dist/mapping/internal-types.d.ts +54 -0
- package/dist/mapping/internal-types.js +14 -0
- package/dist/mapping/loaders/mojang.d.ts +2 -0
- package/dist/mapping/loaders/mojang.js +64 -0
- package/dist/mapping/loaders/tiny-loom.d.ts +2 -0
- package/dist/mapping/loaders/tiny-loom.js +73 -0
- package/dist/mapping/loaders/tiny-maven.d.ts +2 -0
- package/dist/mapping/loaders/tiny-maven.js +104 -0
- package/dist/mapping/loaders/types.d.ts +14 -0
- package/dist/mapping/loaders/types.js +2 -0
- package/dist/mapping/lookup.d.ts +52 -0
- package/dist/mapping/lookup.js +496 -0
- package/dist/mapping/parsers/normalize.d.ts +10 -0
- package/dist/mapping/parsers/normalize.js +52 -0
- package/dist/mapping/parsers/proguard.d.ts +20 -0
- package/dist/mapping/parsers/proguard.js +138 -0
- package/dist/mapping/parsers/symbol-records.d.ts +27 -0
- package/dist/mapping/parsers/symbol-records.js +216 -0
- package/dist/mapping/parsers/tiny.d.ts +9 -0
- package/dist/mapping/parsers/tiny.js +96 -0
- package/dist/mapping/types.d.ts +147 -0
- package/dist/mapping/types.js +2 -0
- package/dist/mapping-pipeline-service.d.ts +10 -1
- package/dist/mapping-pipeline-service.js +16 -3
- package/dist/mapping-service.d.ts +15 -144
- package/dist/mapping-service.js +179 -1119
- package/dist/mixin/access-validators.d.ts +9 -0
- package/dist/mixin/access-validators.js +257 -0
- package/dist/mixin/annotation-validators.d.ts +5 -0
- package/dist/mixin/annotation-validators.js +162 -0
- package/dist/mixin/helpers.d.ts +28 -0
- package/dist/mixin/helpers.js +315 -0
- package/dist/mixin/parsed-validator.d.ts +8 -0
- package/dist/mixin/parsed-validator.js +337 -0
- package/dist/mixin/types.d.ts +208 -0
- package/dist/mixin/types.js +28 -0
- package/dist/mixin-validator.d.ts +9 -201
- package/dist/mixin-validator.js +8 -1005
- package/dist/observability.d.ts +18 -1
- package/dist/observability.js +44 -1
- package/dist/response-utils.d.ts +44 -10
- package/dist/response-utils.js +131 -17
- package/dist/source/access-validate.d.ts +4 -0
- package/dist/source/access-validate.js +254 -0
- package/dist/source/artifact-resolver.d.ts +110 -0
- package/dist/source/artifact-resolver.js +1174 -0
- package/dist/source/cache-metrics.d.ts +26 -0
- package/dist/source/cache-metrics.js +172 -0
- package/dist/source/class-source/members-builder.d.ts +34 -0
- package/dist/source/class-source/members-builder.js +46 -0
- package/dist/source/class-source/snippet-builder.d.ts +19 -0
- package/dist/source/class-source/snippet-builder.js +46 -0
- package/dist/source/class-source-helpers.d.ts +34 -0
- package/dist/source/class-source-helpers.js +140 -0
- package/dist/source/class-source.d.ts +42 -0
- package/dist/source/class-source.js +883 -0
- package/dist/source/descriptor-utils.d.ts +6 -0
- package/dist/source/descriptor-utils.js +37 -0
- package/dist/source/file-access.d.ts +4 -0
- package/dist/source/file-access.js +102 -0
- package/dist/source/indexer.d.ts +82 -0
- package/dist/source/indexer.js +505 -0
- package/dist/source/lifecycle/diff-utils.d.ts +9 -0
- package/dist/source/lifecycle/diff-utils.js +107 -0
- package/dist/source/lifecycle/diff.d.ts +2 -0
- package/dist/source/lifecycle/diff.js +265 -0
- package/dist/source/lifecycle/mapping-helpers.d.ts +22 -0
- package/dist/source/lifecycle/mapping-helpers.js +327 -0
- package/dist/source/lifecycle/runtime-check.d.ts +2 -0
- package/dist/source/lifecycle/runtime-check.js +142 -0
- package/dist/source/lifecycle/trace.d.ts +2 -0
- package/dist/source/lifecycle/trace.js +231 -0
- package/dist/source/lifecycle.d.ts +4 -0
- package/dist/source/lifecycle.js +5 -0
- package/dist/source/search.d.ts +51 -0
- package/dist/source/search.js +676 -0
- package/dist/source/shared-utils.d.ts +6 -0
- package/dist/source/shared-utils.js +55 -0
- package/dist/source/state.d.ts +21 -0
- package/dist/source/state.js +19 -0
- package/dist/source/symbol-resolver.d.ts +3 -0
- package/dist/source/symbol-resolver.js +212 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/mapping-health.js +41 -0
- package/dist/source/validate-mixin/pipeline/parse.d.ts +2 -0
- package/dist/source/validate-mixin/pipeline/parse.js +10 -0
- package/dist/source/validate-mixin/pipeline/resolve.d.ts +3 -0
- package/dist/source/validate-mixin/pipeline/resolve.js +78 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.d.ts +6 -0
- package/dist/source/validate-mixin/pipeline/target-lookup.js +260 -0
- package/dist/source/validate-mixin/pipeline-context.d.ts +72 -0
- package/dist/source/validate-mixin/pipeline-context.js +93 -0
- package/dist/source/validate-mixin.d.ts +22 -0
- package/dist/source/validate-mixin.js +799 -0
- package/dist/source/workspace-target.d.ts +18 -0
- package/dist/source/workspace-target.js +305 -0
- package/dist/source-resolver.d.ts +9 -1
- package/dist/source-resolver.js +14 -6
- package/dist/source-service.d.ts +178 -105
- package/dist/source-service.js +72 -5312
- package/dist/stage-emitter.d.ts +13 -0
- package/dist/stage-emitter.js +30 -0
- package/dist/stdio-supervisor.d.ts +61 -0
- package/dist/stdio-supervisor.js +326 -9
- package/dist/storage/artifacts-repo.d.ts +4 -1
- package/dist/storage/artifacts-repo.js +33 -5
- package/dist/storage/files-repo.d.ts +0 -2
- package/dist/storage/files-repo.js +0 -11
- package/dist/storage/migrations.d.ts +1 -1
- package/dist/storage/migrations.js +10 -2
- package/dist/storage/schema.d.ts +2 -0
- package/dist/storage/schema.js +25 -0
- package/dist/tool-contract-manifest.d.ts +1 -1
- package/dist/tool-contract-manifest.js +23 -6
- package/dist/tool-guidance.d.ts +82 -0
- package/dist/tool-guidance.js +734 -0
- package/dist/tool-schema-registry.d.ts +16 -0
- package/dist/tool-schema-registry.js +37 -0
- package/dist/tool-schemas.d.ts +3518 -0
- package/dist/tool-schemas.js +813 -0
- package/dist/types.d.ts +39 -0
- package/dist/version-service.js +7 -6
- package/dist/workspace-context-cache.d.ts +32 -0
- package/dist/workspace-context-cache.js +66 -0
- package/dist/workspace-mapping-service.d.ts +16 -0
- package/dist/workspace-mapping-service.js +173 -1
- package/docs/README-ja.md +414 -0
- package/docs/examples.md +483 -0
- package/docs/tool-reference.md +459 -0
- package/package.json +5 -2
|
@@ -6,7 +6,7 @@ export declare const analyzeSymbolShape: {
|
|
|
6
6
|
kind: z.ZodEnum<["class", "method", "field", "symbol"]>;
|
|
7
7
|
name: z.ZodString;
|
|
8
8
|
owner: z.ZodOptional<z.ZodString>;
|
|
9
|
-
descriptor: z.ZodOptional<z.ZodString>;
|
|
9
|
+
descriptor: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
10
10
|
}, "strip", z.ZodTypeAny, {
|
|
11
11
|
name: string;
|
|
12
12
|
kind: "symbol" | "class" | "field" | "method";
|
|
@@ -37,7 +37,7 @@ export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
|
37
37
|
kind: z.ZodEnum<["class", "method", "field", "symbol"]>;
|
|
38
38
|
name: z.ZodString;
|
|
39
39
|
owner: z.ZodOptional<z.ZodString>;
|
|
40
|
-
descriptor: z.ZodOptional<z.ZodString>;
|
|
40
|
+
descriptor: z.ZodEffects<z.ZodOptional<z.ZodString>, string | undefined, string | undefined>;
|
|
41
41
|
}, "strip", z.ZodTypeAny, {
|
|
42
42
|
name: string;
|
|
43
43
|
kind: "symbol" | "class" | "field" | "method";
|
|
@@ -72,11 +72,11 @@ export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
|
72
72
|
};
|
|
73
73
|
signatureMode: "exact" | "name-only";
|
|
74
74
|
maxCandidates: number;
|
|
75
|
-
projectPath?: string | undefined;
|
|
76
75
|
version?: string | undefined;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
projectPath?: string | undefined;
|
|
77
|
+
sourceMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
78
|
+
targetMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
79
|
+
classNameMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
80
80
|
detail?: "full" | "summary" | "standard" | undefined;
|
|
81
81
|
include?: string[] | undefined;
|
|
82
82
|
includeKinds?: ("class" | "field" | "method")[] | undefined;
|
|
@@ -89,11 +89,11 @@ export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
|
89
89
|
descriptor?: string | undefined;
|
|
90
90
|
owner?: string | undefined;
|
|
91
91
|
};
|
|
92
|
-
projectPath?: string | undefined;
|
|
93
92
|
version?: string | undefined;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
projectPath?: string | undefined;
|
|
94
|
+
sourceMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
95
|
+
targetMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
96
|
+
classNameMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
97
97
|
nameMode?: "auto" | "fqcn" | undefined;
|
|
98
98
|
detail?: "full" | "summary" | "standard" | undefined;
|
|
99
99
|
include?: string[] | undefined;
|
|
@@ -112,11 +112,11 @@ export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
|
112
112
|
};
|
|
113
113
|
signatureMode: "exact" | "name-only";
|
|
114
114
|
maxCandidates: number;
|
|
115
|
-
projectPath?: string | undefined;
|
|
116
115
|
version?: string | undefined;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
projectPath?: string | undefined;
|
|
117
|
+
sourceMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
118
|
+
targetMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
119
|
+
classNameMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
120
120
|
detail?: "full" | "summary" | "standard" | undefined;
|
|
121
121
|
include?: string[] | undefined;
|
|
122
122
|
includeKinds?: ("class" | "field" | "method")[] | undefined;
|
|
@@ -129,11 +129,11 @@ export declare const analyzeSymbolSchema: z.ZodEffects<z.ZodObject<{
|
|
|
129
129
|
descriptor?: string | undefined;
|
|
130
130
|
owner?: string | undefined;
|
|
131
131
|
};
|
|
132
|
-
projectPath?: string | undefined;
|
|
133
132
|
version?: string | undefined;
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
133
|
+
projectPath?: string | undefined;
|
|
134
|
+
sourceMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
135
|
+
targetMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
136
|
+
classNameMapping?: "obfuscated" | "mojang" | "intermediary" | "yarn" | undefined;
|
|
137
137
|
nameMode?: "auto" | "fqcn" | undefined;
|
|
138
138
|
detail?: "full" | "summary" | "standard" | undefined;
|
|
139
139
|
include?: string[] | undefined;
|
|
@@ -4,6 +4,17 @@ import { buildIncludeSchema, detailSchema, positiveIntSchema } from "./entry-too
|
|
|
4
4
|
import { buildEntryToolResult, createSummarySubject } from "./response-contract.js";
|
|
5
5
|
import { resolveDetail, resolveInclude } from "./request-normalizers.js";
|
|
6
6
|
const nonEmptyString = z.string().trim().min(1);
|
|
7
|
+
// Descriptor field that treats empty/whitespace strings as omitted so callers can pass
|
|
8
|
+
// `descriptor: ""` interchangeably with omitting the field when signatureMode="name-only".
|
|
9
|
+
const optionalDescriptorString = z
|
|
10
|
+
.string()
|
|
11
|
+
.optional()
|
|
12
|
+
.transform((value) => {
|
|
13
|
+
if (value === undefined)
|
|
14
|
+
return undefined;
|
|
15
|
+
const trimmed = value.trim();
|
|
16
|
+
return trimmed.length === 0 ? undefined : trimmed;
|
|
17
|
+
});
|
|
7
18
|
const INCLUDE_GROUPS = ["warnings", "candidates", "matrix", "workspace", "timings"];
|
|
8
19
|
const TASKS = ["exists", "map", "exact-map", "lifecycle", "workspace", "api-overview"];
|
|
9
20
|
export const analyzeSymbolShape = {
|
|
@@ -12,7 +23,7 @@ export const analyzeSymbolShape = {
|
|
|
12
23
|
kind: z.enum(["class", "method", "field", "symbol"]),
|
|
13
24
|
name: nonEmptyString,
|
|
14
25
|
owner: nonEmptyString.optional(),
|
|
15
|
-
descriptor:
|
|
26
|
+
descriptor: optionalDescriptorString
|
|
16
27
|
}),
|
|
17
28
|
version: nonEmptyString.optional(),
|
|
18
29
|
sourceMapping: z.enum(["obfuscated", "mojang", "intermediary", "yarn"]).optional(),
|
|
@@ -23,7 +34,7 @@ export const analyzeSymbolShape = {
|
|
|
23
34
|
nameMode: z.enum(["fqcn", "auto"]).default("fqcn"),
|
|
24
35
|
includeKinds: z.array(z.enum(["class", "field", "method"])).optional(),
|
|
25
36
|
maxRows: positiveIntSchema.optional(),
|
|
26
|
-
maxCandidates: positiveIntSchema.default(
|
|
37
|
+
maxCandidates: positiveIntSchema.default(5),
|
|
27
38
|
detail: detailSchema.optional(),
|
|
28
39
|
include: buildIncludeSchema(INCLUDE_GROUPS)
|
|
29
40
|
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { GetClassMembersInput, GetClassMembersOutput, ResolveArtifactInput, ResolveArtifactOutput } from "../source-service.js";
|
|
2
|
+
import type { ArtifactScope, MappingSourcePriority, ResolveArtifactTargetInput, SourceMapping } from "../types.js";
|
|
3
|
+
import { type BatchOutput } from "./batch-runner.js";
|
|
4
|
+
export type BatchClassMembersDeps = {
|
|
5
|
+
resolveArtifact: (input: ResolveArtifactInput) => Promise<ResolveArtifactOutput>;
|
|
6
|
+
getClassMembers: (input: GetClassMembersInput) => Promise<GetClassMembersOutput>;
|
|
7
|
+
};
|
|
8
|
+
export type BatchClassMembersEntry = {
|
|
9
|
+
className: string;
|
|
10
|
+
access?: "public" | "all";
|
|
11
|
+
includeSynthetic?: boolean;
|
|
12
|
+
includeInherited?: boolean;
|
|
13
|
+
memberPattern?: string;
|
|
14
|
+
maxMembers?: number;
|
|
15
|
+
};
|
|
16
|
+
export type BatchClassMembersInput = {
|
|
17
|
+
target: ResolveArtifactTargetInput;
|
|
18
|
+
mapping?: SourceMapping;
|
|
19
|
+
sourcePriority?: MappingSourcePriority;
|
|
20
|
+
allowDecompile?: boolean;
|
|
21
|
+
projectPath?: string;
|
|
22
|
+
scope?: ArtifactScope;
|
|
23
|
+
preferProjectVersion?: boolean;
|
|
24
|
+
strictVersion?: boolean;
|
|
25
|
+
concurrency?: number;
|
|
26
|
+
failFast?: boolean;
|
|
27
|
+
compact?: boolean;
|
|
28
|
+
entries: readonly BatchClassMembersEntry[];
|
|
29
|
+
};
|
|
30
|
+
export declare class BatchClassMembersService {
|
|
31
|
+
private readonly deps;
|
|
32
|
+
constructor(deps: BatchClassMembersDeps);
|
|
33
|
+
execute(input: BatchClassMembersInput): Promise<BatchOutput<Record<string, unknown>>>;
|
|
34
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { buildSuggestedCall } from "../build-suggested-call.js";
|
|
2
|
+
import { compactResponse, compactMembersResponse, TOOL_PRESERVE_PAYLOAD_KEYS } from "../response-utils.js";
|
|
3
|
+
import { runBatch, splitEntryWarnings } from "./batch-runner.js";
|
|
4
|
+
export class BatchClassMembersService {
|
|
5
|
+
deps;
|
|
6
|
+
constructor(deps) {
|
|
7
|
+
this.deps = deps;
|
|
8
|
+
}
|
|
9
|
+
async execute(input) {
|
|
10
|
+
const concurrency = input.concurrency ?? 4;
|
|
11
|
+
const failFast = input.failFast ?? false;
|
|
12
|
+
const compact = input.compact ?? true;
|
|
13
|
+
return runBatch({
|
|
14
|
+
entries: input.entries,
|
|
15
|
+
concurrency,
|
|
16
|
+
failFast,
|
|
17
|
+
resolveSharedArtifact: async () => {
|
|
18
|
+
const resolved = await this.deps.resolveArtifact({
|
|
19
|
+
target: input.target,
|
|
20
|
+
mapping: input.mapping,
|
|
21
|
+
sourcePriority: input.sourcePriority,
|
|
22
|
+
allowDecompile: input.allowDecompile,
|
|
23
|
+
projectPath: input.projectPath,
|
|
24
|
+
scope: input.scope,
|
|
25
|
+
preferProjectVersion: input.preferProjectVersion,
|
|
26
|
+
strictVersion: input.strictVersion
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
artifactId: resolved.artifactId,
|
|
30
|
+
provenance: resolved.provenance,
|
|
31
|
+
...(Array.isArray(resolved.warnings) && resolved.warnings.length > 0
|
|
32
|
+
? { warnings: [...resolved.warnings] }
|
|
33
|
+
: {})
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
artifactSummary: (artifact) => ({
|
|
37
|
+
sharedArtifactId: artifact.artifactId,
|
|
38
|
+
...(artifact.provenance ? { sharedArtifactProvenance: artifact.provenance } : {}),
|
|
39
|
+
...(artifact.warnings && artifact.warnings.length > 0
|
|
40
|
+
? { sharedArtifactWarnings: artifact.warnings }
|
|
41
|
+
: {})
|
|
42
|
+
}),
|
|
43
|
+
perEntry: async (entry, _index, sharedArtifact) => {
|
|
44
|
+
if (!sharedArtifact) {
|
|
45
|
+
throw new Error("shared artifact not resolved");
|
|
46
|
+
}
|
|
47
|
+
const raw = (await this.deps.getClassMembers({
|
|
48
|
+
artifactId: sharedArtifact.artifactId,
|
|
49
|
+
className: entry.className,
|
|
50
|
+
access: entry.access,
|
|
51
|
+
includeSynthetic: entry.includeSynthetic,
|
|
52
|
+
includeInherited: entry.includeInherited,
|
|
53
|
+
memberPattern: entry.memberPattern,
|
|
54
|
+
maxMembers: entry.maxMembers,
|
|
55
|
+
mapping: input.mapping,
|
|
56
|
+
sourcePriority: input.sourcePriority,
|
|
57
|
+
allowDecompile: input.allowDecompile,
|
|
58
|
+
projectPath: input.projectPath,
|
|
59
|
+
scope: input.scope,
|
|
60
|
+
preferProjectVersion: input.preferProjectVersion,
|
|
61
|
+
strictVersion: input.strictVersion
|
|
62
|
+
}));
|
|
63
|
+
const { result, warnings } = splitEntryWarnings(raw);
|
|
64
|
+
const projected = compact
|
|
65
|
+
? compactResponse(compactMembersResponse(result), TOOL_PRESERVE_PAYLOAD_KEYS["get-class-members"])
|
|
66
|
+
: result;
|
|
67
|
+
return { result: projected, warnings };
|
|
68
|
+
},
|
|
69
|
+
buildErrorSuggestedCall: (entry, sharedArtifact) => {
|
|
70
|
+
if (!sharedArtifact)
|
|
71
|
+
return undefined;
|
|
72
|
+
const params = {
|
|
73
|
+
target: { type: "artifact", artifactId: sharedArtifact.artifactId },
|
|
74
|
+
className: entry.className
|
|
75
|
+
};
|
|
76
|
+
if (entry.access !== undefined)
|
|
77
|
+
params.access = entry.access;
|
|
78
|
+
if (entry.includeSynthetic !== undefined)
|
|
79
|
+
params.includeSynthetic = entry.includeSynthetic;
|
|
80
|
+
if (entry.includeInherited !== undefined)
|
|
81
|
+
params.includeInherited = entry.includeInherited;
|
|
82
|
+
if (entry.memberPattern !== undefined)
|
|
83
|
+
params.memberPattern = entry.memberPattern;
|
|
84
|
+
if (entry.maxMembers !== undefined)
|
|
85
|
+
params.maxMembers = entry.maxMembers;
|
|
86
|
+
if (input.mapping !== undefined)
|
|
87
|
+
params.mapping = input.mapping;
|
|
88
|
+
const { suggestedCall } = buildSuggestedCall({
|
|
89
|
+
tool: "get-class-members",
|
|
90
|
+
params
|
|
91
|
+
});
|
|
92
|
+
return suggestedCall;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=batch-class-members-service.js.map
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { GetClassSourceInput, GetClassSourceOutput, ResolveArtifactInput, ResolveArtifactOutput } from "../source-service.js";
|
|
2
|
+
import type { ArtifactScope, MappingSourcePriority, ResolveArtifactTargetInput, SourceMapping } from "../types.js";
|
|
3
|
+
import { type BatchOutput } from "./batch-runner.js";
|
|
4
|
+
type SourceMode = "metadata" | "snippet" | "full";
|
|
5
|
+
export type BatchClassSourceEntry = {
|
|
6
|
+
className: string;
|
|
7
|
+
mode?: SourceMode;
|
|
8
|
+
startLine?: number;
|
|
9
|
+
endLine?: number;
|
|
10
|
+
maxLines?: number;
|
|
11
|
+
maxChars?: number;
|
|
12
|
+
outputFile?: string;
|
|
13
|
+
};
|
|
14
|
+
export type BatchClassSourceInput = {
|
|
15
|
+
target: ResolveArtifactTargetInput;
|
|
16
|
+
mapping?: SourceMapping;
|
|
17
|
+
sourcePriority?: MappingSourcePriority;
|
|
18
|
+
allowDecompile?: boolean;
|
|
19
|
+
projectPath?: string;
|
|
20
|
+
scope?: ArtifactScope;
|
|
21
|
+
preferProjectVersion?: boolean;
|
|
22
|
+
strictVersion?: boolean;
|
|
23
|
+
concurrency?: number;
|
|
24
|
+
failFast?: boolean;
|
|
25
|
+
compact?: boolean;
|
|
26
|
+
entries: readonly BatchClassSourceEntry[];
|
|
27
|
+
};
|
|
28
|
+
export type BatchClassSourceDeps = {
|
|
29
|
+
resolveArtifact: (input: ResolveArtifactInput) => Promise<ResolveArtifactOutput>;
|
|
30
|
+
getClassSource: (input: GetClassSourceInput) => Promise<GetClassSourceOutput>;
|
|
31
|
+
};
|
|
32
|
+
export declare class BatchClassSourceService {
|
|
33
|
+
private readonly deps;
|
|
34
|
+
constructor(deps: BatchClassSourceDeps);
|
|
35
|
+
execute(input: BatchClassSourceInput): Promise<BatchOutput<Record<string, unknown>>>;
|
|
36
|
+
}
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { buildSuggestedCall } from "../build-suggested-call.js";
|
|
2
|
+
import { compactResponse, compactSourceResponse, TOOL_PRESERVE_PAYLOAD_KEYS } from "../response-utils.js";
|
|
3
|
+
import { runBatch, splitEntryWarnings } from "./batch-runner.js";
|
|
4
|
+
export class BatchClassSourceService {
|
|
5
|
+
deps;
|
|
6
|
+
constructor(deps) {
|
|
7
|
+
this.deps = deps;
|
|
8
|
+
}
|
|
9
|
+
async execute(input) {
|
|
10
|
+
const concurrency = input.concurrency ?? 4;
|
|
11
|
+
const failFast = input.failFast ?? false;
|
|
12
|
+
const compact = input.compact ?? true;
|
|
13
|
+
return runBatch({
|
|
14
|
+
entries: input.entries,
|
|
15
|
+
concurrency,
|
|
16
|
+
failFast,
|
|
17
|
+
resolveSharedArtifact: async () => {
|
|
18
|
+
const resolved = await this.deps.resolveArtifact({
|
|
19
|
+
target: input.target,
|
|
20
|
+
mapping: input.mapping,
|
|
21
|
+
sourcePriority: input.sourcePriority,
|
|
22
|
+
allowDecompile: input.allowDecompile,
|
|
23
|
+
projectPath: input.projectPath,
|
|
24
|
+
scope: input.scope,
|
|
25
|
+
preferProjectVersion: input.preferProjectVersion,
|
|
26
|
+
strictVersion: input.strictVersion
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
artifactId: resolved.artifactId,
|
|
30
|
+
provenance: resolved.provenance,
|
|
31
|
+
...(Array.isArray(resolved.warnings) && resolved.warnings.length > 0
|
|
32
|
+
? { warnings: [...resolved.warnings] }
|
|
33
|
+
: {})
|
|
34
|
+
};
|
|
35
|
+
},
|
|
36
|
+
artifactSummary: (artifact) => ({
|
|
37
|
+
sharedArtifactId: artifact.artifactId,
|
|
38
|
+
...(artifact.provenance ? { sharedArtifactProvenance: artifact.provenance } : {}),
|
|
39
|
+
...(artifact.warnings && artifact.warnings.length > 0
|
|
40
|
+
? { sharedArtifactWarnings: artifact.warnings }
|
|
41
|
+
: {})
|
|
42
|
+
}),
|
|
43
|
+
perEntry: async (entry, _index, sharedArtifact) => {
|
|
44
|
+
if (!sharedArtifact) {
|
|
45
|
+
throw new Error("shared artifact not resolved");
|
|
46
|
+
}
|
|
47
|
+
const raw = (await this.deps.getClassSource({
|
|
48
|
+
artifactId: sharedArtifact.artifactId,
|
|
49
|
+
className: entry.className,
|
|
50
|
+
mode: entry.mode,
|
|
51
|
+
startLine: entry.startLine,
|
|
52
|
+
endLine: entry.endLine,
|
|
53
|
+
maxLines: entry.maxLines,
|
|
54
|
+
maxChars: entry.maxChars,
|
|
55
|
+
outputFile: entry.outputFile,
|
|
56
|
+
mapping: input.mapping,
|
|
57
|
+
sourcePriority: input.sourcePriority,
|
|
58
|
+
allowDecompile: input.allowDecompile,
|
|
59
|
+
projectPath: input.projectPath,
|
|
60
|
+
scope: input.scope,
|
|
61
|
+
preferProjectVersion: input.preferProjectVersion,
|
|
62
|
+
strictVersion: input.strictVersion
|
|
63
|
+
}));
|
|
64
|
+
const { result, warnings } = splitEntryWarnings(raw);
|
|
65
|
+
const projected = compact
|
|
66
|
+
? compactResponse(compactSourceResponse(result), TOOL_PRESERVE_PAYLOAD_KEYS["get-class-source"])
|
|
67
|
+
: result;
|
|
68
|
+
return { result: projected, warnings };
|
|
69
|
+
},
|
|
70
|
+
buildErrorSuggestedCall: (entry, sharedArtifact) => {
|
|
71
|
+
if (!sharedArtifact)
|
|
72
|
+
return undefined;
|
|
73
|
+
const params = {
|
|
74
|
+
target: { type: "artifact", artifactId: sharedArtifact.artifactId },
|
|
75
|
+
className: entry.className
|
|
76
|
+
};
|
|
77
|
+
if (entry.mode !== undefined)
|
|
78
|
+
params.mode = entry.mode;
|
|
79
|
+
if (entry.startLine !== undefined)
|
|
80
|
+
params.startLine = entry.startLine;
|
|
81
|
+
if (entry.endLine !== undefined)
|
|
82
|
+
params.endLine = entry.endLine;
|
|
83
|
+
if (entry.maxLines !== undefined)
|
|
84
|
+
params.maxLines = entry.maxLines;
|
|
85
|
+
if (entry.maxChars !== undefined)
|
|
86
|
+
params.maxChars = entry.maxChars;
|
|
87
|
+
if (entry.outputFile !== undefined)
|
|
88
|
+
params.outputFile = entry.outputFile;
|
|
89
|
+
if (input.mapping !== undefined)
|
|
90
|
+
params.mapping = input.mapping;
|
|
91
|
+
const { suggestedCall } = buildSuggestedCall({
|
|
92
|
+
tool: "get-class-source",
|
|
93
|
+
params
|
|
94
|
+
});
|
|
95
|
+
return suggestedCall;
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=batch-class-source-service.js.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { FindMappingInput, FindMappingOutput } from "../source-service.js";
|
|
2
|
+
import type { MappingSourcePriority, SourceMapping } from "../types.js";
|
|
3
|
+
export type BatchMappingsDeps = {
|
|
4
|
+
findMapping: (input: FindMappingInput) => Promise<FindMappingOutput>;
|
|
5
|
+
};
|
|
6
|
+
import { type BatchOutput } from "./batch-runner.js";
|
|
7
|
+
type SymbolKind = "class" | "field" | "method";
|
|
8
|
+
export type BatchMappingsEntry = {
|
|
9
|
+
kind: SymbolKind;
|
|
10
|
+
name: string;
|
|
11
|
+
owner?: string;
|
|
12
|
+
descriptor?: string;
|
|
13
|
+
sourceMapping: SourceMapping;
|
|
14
|
+
targetMapping: SourceMapping;
|
|
15
|
+
signatureMode?: "exact" | "name-only";
|
|
16
|
+
disambiguation?: {
|
|
17
|
+
ownerHint?: string;
|
|
18
|
+
descriptorHint?: string;
|
|
19
|
+
};
|
|
20
|
+
maxCandidates?: number;
|
|
21
|
+
};
|
|
22
|
+
export type BatchMappingsInput = {
|
|
23
|
+
version: string;
|
|
24
|
+
sourcePriority?: MappingSourcePriority;
|
|
25
|
+
projectPath?: string;
|
|
26
|
+
concurrency?: number;
|
|
27
|
+
failFast?: boolean;
|
|
28
|
+
compact?: boolean;
|
|
29
|
+
entries: readonly BatchMappingsEntry[];
|
|
30
|
+
};
|
|
31
|
+
export declare class BatchMappingsService {
|
|
32
|
+
private readonly deps;
|
|
33
|
+
constructor(deps: BatchMappingsDeps);
|
|
34
|
+
execute(input: BatchMappingsInput): Promise<BatchOutput<Record<string, unknown>>>;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { buildSuggestedCall } from "../build-suggested-call.js";
|
|
2
|
+
import { compactResponse, compactMappingResponse } from "../response-utils.js";
|
|
3
|
+
import { runBatch, splitEntryWarnings } from "./batch-runner.js";
|
|
4
|
+
export class BatchMappingsService {
|
|
5
|
+
deps;
|
|
6
|
+
constructor(deps) {
|
|
7
|
+
this.deps = deps;
|
|
8
|
+
}
|
|
9
|
+
async execute(input) {
|
|
10
|
+
const concurrency = input.concurrency ?? 4;
|
|
11
|
+
const failFast = input.failFast ?? false;
|
|
12
|
+
const compact = input.compact ?? true;
|
|
13
|
+
return runBatch({
|
|
14
|
+
entries: input.entries,
|
|
15
|
+
concurrency,
|
|
16
|
+
failFast,
|
|
17
|
+
resolveSharedArtifact: async () => undefined,
|
|
18
|
+
perEntry: async (entry, _index) => {
|
|
19
|
+
const raw = (await this.deps.findMapping({
|
|
20
|
+
version: input.version,
|
|
21
|
+
kind: entry.kind,
|
|
22
|
+
name: entry.name,
|
|
23
|
+
owner: entry.owner,
|
|
24
|
+
descriptor: entry.descriptor,
|
|
25
|
+
sourceMapping: entry.sourceMapping,
|
|
26
|
+
targetMapping: entry.targetMapping,
|
|
27
|
+
sourcePriority: input.sourcePriority,
|
|
28
|
+
projectPath: input.projectPath,
|
|
29
|
+
signatureMode: entry.signatureMode,
|
|
30
|
+
disambiguation: entry.disambiguation,
|
|
31
|
+
maxCandidates: entry.maxCandidates
|
|
32
|
+
}));
|
|
33
|
+
const { result, warnings } = splitEntryWarnings(raw);
|
|
34
|
+
const projected = compact
|
|
35
|
+
? compactResponse(compactMappingResponse(result))
|
|
36
|
+
: result;
|
|
37
|
+
return { result: projected, warnings };
|
|
38
|
+
},
|
|
39
|
+
buildErrorSuggestedCall: (entry) => {
|
|
40
|
+
const params = {
|
|
41
|
+
version: input.version,
|
|
42
|
+
kind: entry.kind,
|
|
43
|
+
name: entry.name,
|
|
44
|
+
sourceMapping: entry.sourceMapping,
|
|
45
|
+
targetMapping: entry.targetMapping
|
|
46
|
+
};
|
|
47
|
+
if (entry.owner !== undefined)
|
|
48
|
+
params.owner = entry.owner;
|
|
49
|
+
if (entry.descriptor !== undefined)
|
|
50
|
+
params.descriptor = entry.descriptor;
|
|
51
|
+
if (entry.signatureMode !== undefined)
|
|
52
|
+
params.signatureMode = entry.signatureMode;
|
|
53
|
+
if (entry.disambiguation !== undefined)
|
|
54
|
+
params.disambiguation = entry.disambiguation;
|
|
55
|
+
if (entry.maxCandidates !== undefined)
|
|
56
|
+
params.maxCandidates = entry.maxCandidates;
|
|
57
|
+
const { suggestedCall } = buildSuggestedCall({
|
|
58
|
+
tool: "find-mapping",
|
|
59
|
+
params
|
|
60
|
+
});
|
|
61
|
+
return suggestedCall;
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=batch-mappings-service.js.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { type ProblemDetails, type SuggestedCall } from "../error-mapping.js";
|
|
2
|
+
export declare const BATCH_TOOLS_OFF: boolean;
|
|
3
|
+
export type BatchEntryOk<TResult> = {
|
|
4
|
+
index: number;
|
|
5
|
+
status: "ok";
|
|
6
|
+
result: TResult;
|
|
7
|
+
warnings: string[];
|
|
8
|
+
durationMs: number;
|
|
9
|
+
};
|
|
10
|
+
export type BatchEntryError = {
|
|
11
|
+
index: number;
|
|
12
|
+
status: "error";
|
|
13
|
+
error: ProblemDetails;
|
|
14
|
+
warnings: string[];
|
|
15
|
+
durationMs: number;
|
|
16
|
+
};
|
|
17
|
+
export type BatchEntryResult<TResult> = BatchEntryOk<TResult> | BatchEntryError;
|
|
18
|
+
export type BatchSummary = {
|
|
19
|
+
total: number;
|
|
20
|
+
ok: number;
|
|
21
|
+
error: number;
|
|
22
|
+
sharedArtifactId?: string;
|
|
23
|
+
sharedArtifactProvenance?: Record<string, unknown>;
|
|
24
|
+
/** Warnings from the one-shot shared `resolveArtifact` call (version
|
|
25
|
+
* approximation, mapping fallback, source coverage gaps, workspace /
|
|
26
|
+
* dependency resolution caveats). Per-entry dispatch is by `artifactId`
|
|
27
|
+
* and never re-runs resolution, so these warnings reach the caller only
|
|
28
|
+
* via this field. Omitted when the resolution emitted none. */
|
|
29
|
+
sharedArtifactWarnings?: string[];
|
|
30
|
+
};
|
|
31
|
+
export type BatchOutput<TResult> = {
|
|
32
|
+
results: BatchEntryResult<TResult>[];
|
|
33
|
+
summary: BatchSummary;
|
|
34
|
+
};
|
|
35
|
+
export type BatchRunOptions<TEntry, TResult, TArtifact> = {
|
|
36
|
+
entries: readonly TEntry[];
|
|
37
|
+
concurrency: number;
|
|
38
|
+
failFast: boolean;
|
|
39
|
+
/** Resolve the shared artifact once. May return undefined for batch tools that
|
|
40
|
+
* do not need a shared artifact (e.g. `batch-mappings`, where each entry is
|
|
41
|
+
* mapping-graph-only and does not depend on the artifact). Throws to abort the
|
|
42
|
+
* batch entirely with a top-level error envelope (handled by `runTool`). */
|
|
43
|
+
resolveSharedArtifact: () => Promise<TArtifact | undefined>;
|
|
44
|
+
/** Summary metadata derived from the resolved shared artifact. */
|
|
45
|
+
artifactSummary?: (artifact: TArtifact) => {
|
|
46
|
+
sharedArtifactId?: string;
|
|
47
|
+
sharedArtifactProvenance?: Record<string, unknown>;
|
|
48
|
+
sharedArtifactWarnings?: string[];
|
|
49
|
+
};
|
|
50
|
+
/** Per-entry handler. Returns `{ result, warnings }` on success. Errors thrown
|
|
51
|
+
* here are caught and converted to a per-entry ProblemDetails — the mapper
|
|
52
|
+
* itself never throws into `mapWithConcurrencyLimit`. */
|
|
53
|
+
perEntry: (entry: TEntry, index: number, sharedArtifact: TArtifact | undefined) => Promise<{
|
|
54
|
+
result: TResult;
|
|
55
|
+
warnings?: string[];
|
|
56
|
+
}>;
|
|
57
|
+
/** Synthesize the per-entry retry suggestedCall (proposing the matching single
|
|
58
|
+
* tool). Already validated through `buildSuggestedCall` by the caller; pass
|
|
59
|
+
* `undefined` when the suggestedCall could not be synthesized for this entry. */
|
|
60
|
+
buildErrorSuggestedCall: (entry: TEntry, sharedArtifact: TArtifact | undefined, error: unknown) => SuggestedCall | undefined;
|
|
61
|
+
/** Generate a fresh request-instance id per entry — defaults to the same
|
|
62
|
+
* scheme `runTool` uses (`<base36-time>-<base36-rand>`). Per-entry uniqueness
|
|
63
|
+
* is required so callers can correlate failed entries individually. */
|
|
64
|
+
buildEntryInstance?: (index: number) => string;
|
|
65
|
+
};
|
|
66
|
+
export declare function runBatch<TEntry, TResult, TArtifact>(opts: BatchRunOptions<TEntry, TResult, TArtifact>): Promise<BatchOutput<TResult>>;
|
|
67
|
+
/** Lift `warnings: string[]` off a service result onto the per-entry batch
|
|
68
|
+
* envelope, mirroring `runTool`'s `splitWarnings` for single-tool calls. */
|
|
69
|
+
export declare function splitEntryWarnings<T extends Record<string, unknown>>(raw: T): {
|
|
70
|
+
result: Omit<T, "warnings">;
|
|
71
|
+
warnings: string[];
|
|
72
|
+
};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { mapWithConcurrencyLimit } from "../concurrency.js";
|
|
2
|
+
import { buildBatchAbortedProblem, errorToBatchEntryProblem } from "../error-mapping.js";
|
|
3
|
+
export const BATCH_TOOLS_OFF = process.env.BATCH_TOOLS_OFF === "1";
|
|
4
|
+
function defaultEntryInstance(index) {
|
|
5
|
+
return `${Date.now().toString(36)}-${index}-${Math.random().toString(36).slice(2, 10)}`;
|
|
6
|
+
}
|
|
7
|
+
export async function runBatch(opts) {
|
|
8
|
+
const sharedArtifact = await opts.resolveSharedArtifact();
|
|
9
|
+
const artifactSummary = sharedArtifact !== undefined && opts.artifactSummary
|
|
10
|
+
? opts.artifactSummary(sharedArtifact)
|
|
11
|
+
: {};
|
|
12
|
+
let abort = false;
|
|
13
|
+
const buildInstance = opts.buildEntryInstance ?? defaultEntryInstance;
|
|
14
|
+
const results = await mapWithConcurrencyLimit(opts.entries, opts.concurrency, async (entry, index) => {
|
|
15
|
+
const startedAt = Date.now();
|
|
16
|
+
if (abort) {
|
|
17
|
+
return {
|
|
18
|
+
index,
|
|
19
|
+
status: "error",
|
|
20
|
+
error: buildBatchAbortedProblem(buildInstance(index)),
|
|
21
|
+
warnings: [],
|
|
22
|
+
durationMs: Date.now() - startedAt
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const { result, warnings } = await opts.perEntry(entry, index, sharedArtifact);
|
|
27
|
+
return {
|
|
28
|
+
index,
|
|
29
|
+
status: "ok",
|
|
30
|
+
result,
|
|
31
|
+
warnings: warnings ?? [],
|
|
32
|
+
durationMs: Date.now() - startedAt
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
catch (caught) {
|
|
36
|
+
const suggestedCall = opts.buildErrorSuggestedCall(entry, sharedArtifact, caught);
|
|
37
|
+
const problem = errorToBatchEntryProblem(caught, buildInstance(index), suggestedCall ? { suggestedCall } : undefined);
|
|
38
|
+
if (opts.failFast) {
|
|
39
|
+
abort = true;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
index,
|
|
43
|
+
status: "error",
|
|
44
|
+
error: problem,
|
|
45
|
+
warnings: [],
|
|
46
|
+
durationMs: Date.now() - startedAt
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
let okCount = 0;
|
|
51
|
+
let errorCount = 0;
|
|
52
|
+
for (const entry of results) {
|
|
53
|
+
if (entry.status === "ok")
|
|
54
|
+
okCount += 1;
|
|
55
|
+
else
|
|
56
|
+
errorCount += 1;
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
results,
|
|
60
|
+
summary: {
|
|
61
|
+
total: results.length,
|
|
62
|
+
ok: okCount,
|
|
63
|
+
error: errorCount,
|
|
64
|
+
...(artifactSummary.sharedArtifactId !== undefined
|
|
65
|
+
? { sharedArtifactId: artifactSummary.sharedArtifactId }
|
|
66
|
+
: {}),
|
|
67
|
+
...(artifactSummary.sharedArtifactProvenance !== undefined
|
|
68
|
+
? { sharedArtifactProvenance: artifactSummary.sharedArtifactProvenance }
|
|
69
|
+
: {}),
|
|
70
|
+
...(artifactSummary.sharedArtifactWarnings !== undefined &&
|
|
71
|
+
artifactSummary.sharedArtifactWarnings.length > 0
|
|
72
|
+
? { sharedArtifactWarnings: artifactSummary.sharedArtifactWarnings }
|
|
73
|
+
: {})
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/** Lift `warnings: string[]` off a service result onto the per-entry batch
|
|
78
|
+
* envelope, mirroring `runTool`'s `splitWarnings` for single-tool calls. */
|
|
79
|
+
export function splitEntryWarnings(raw) {
|
|
80
|
+
const { warnings, ...rest } = raw;
|
|
81
|
+
const list = [];
|
|
82
|
+
if (Array.isArray(warnings)) {
|
|
83
|
+
for (const w of warnings) {
|
|
84
|
+
if (typeof w === "string")
|
|
85
|
+
list.push(w);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { result: rest, warnings: list };
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=batch-runner.js.map
|