buddy-agent-harness 0.8.0 → 0.9.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.
@@ -0,0 +1,87 @@
1
+ //#region ../../node_modules/.pnpm/search-packages@2.2.1/node_modules/search-packages/esm/hasAllKeywords.js
2
+ function hasAllKeywords(actual, expected) {
3
+ const set = new Set(actual);
4
+ return !expected.find((key) => !set.has(key));
5
+ }
6
+ //#endregion
7
+ //#region ../../node_modules/.pnpm/search-packages@2.2.1/node_modules/search-packages/esm/pickPackagesWithKeywords.js
8
+ function pickPackagesWithKeywords(packageInfos, keywords, fields) {
9
+ const pkgs = packageInfos.filter((pkg) => hasAllKeywords(pkg.keywords, keywords));
10
+ if (fields) return pkgs.map((pkg) => fields.reduce((p, v) => {
11
+ p[v] = pkg[v];
12
+ return p;
13
+ }, { name: pkg.name }));
14
+ return pkgs.map((pkg) => pkg.name);
15
+ }
16
+ //#endregion
17
+ //#region ../../node_modules/.pnpm/search-packages@2.2.1/node_modules/search-packages/esm/registry.js
18
+ /**
19
+ * The public npm registry search endpoint.
20
+ */
21
+ const DEFAULT_REGISTRY = "https://registry.npmjs.org";
22
+ /**
23
+ * Upper bound on how many results `searchByKeywords` will page through.
24
+ *
25
+ * The registry reports a `total` that can run into the thousands for a broad keyword.
26
+ * Paging all of it would mean dozens of sequential requests, which defeats the point of
27
+ * replacing the `npm search` shell-out. 1000 is 4 requests at {@link MAX_PAGE_SIZE} and
28
+ * covers every realistic plugin-discovery search.
29
+ *
30
+ * When the registry has more matches than this, the extra results are dropped and
31
+ * `truncated` is set on the result so the caller can tell.
32
+ */
33
+ const DEFAULT_MAX_RESULTS = 1e3;
34
+ var RegistrySearchError = class extends Error {
35
+ status;
36
+ constructor(message, status) {
37
+ super(message);
38
+ this.status = status;
39
+ this.name = "RegistrySearchError";
40
+ }
41
+ };
42
+ /**
43
+ * Queries the npm registry search endpoint for packages carrying `keywords`,
44
+ * paging until `total` is reached or `maxResults` is hit.
45
+ *
46
+ * The registry's `keywords:` qualifier is not a strict conjunction, so the returned
47
+ * packages still need filtering by {@link hasAllKeywords} on the caller's side.
48
+ */
49
+ async function fetchPackagesByKeywords(keywords, options = {}) {
50
+ const { registry = DEFAULT_REGISTRY, maxResults = DEFAULT_MAX_RESULTS, signal, fetch: fetchImpl = globalThis.fetch } = options;
51
+ if (keywords.length === 0) return {
52
+ packages: [],
53
+ truncated: false
54
+ };
55
+ if (typeof fetchImpl !== "function") throw new RegistrySearchError("global fetch is not available; Node 18 or later is required");
56
+ const text = `keywords:${keywords.join(",")}`;
57
+ const packages = [];
58
+ let total = Number.POSITIVE_INFINITY;
59
+ while (packages.length < maxResults && packages.length < total) {
60
+ const size = Math.min(250, maxResults - packages.length);
61
+ const response = await fetchImpl(`${trimTrailingSlash(registry)}/-/v1/search?text=${encodeURIComponent(text)}&size=${size}&from=${packages.length}`, { signal });
62
+ if (!response.ok) throw new RegistrySearchError(`npm registry search failed: ${response.status} ${response.statusText}`, response.status);
63
+ const body = await response.json();
64
+ const objects = body?.objects ?? [];
65
+ total = typeof body?.total === "number" ? body.total : packages.length + objects.length;
66
+ if (objects.length === 0) return {
67
+ packages,
68
+ truncated: false
69
+ };
70
+ for (const object of objects) if (object?.package) packages.push(object.package);
71
+ }
72
+ return {
73
+ packages,
74
+ truncated: total > packages.length
75
+ };
76
+ }
77
+ function trimTrailingSlash(url) {
78
+ return url.endsWith("/") ? url.slice(0, -1) : url;
79
+ }
80
+ //#endregion
81
+ //#region ../../node_modules/.pnpm/search-packages@2.2.1/node_modules/search-packages/esm/searchByKeywords.js
82
+ async function searchByKeywords(keywords, fields, options) {
83
+ const { packages } = await fetchPackagesByKeywords(keywords, options);
84
+ return pickPackagesWithKeywords(packages, keywords, fields);
85
+ }
86
+ //#endregion
87
+ export { searchByKeywords };
@@ -0,0 +1,64 @@
1
+ import { createRequire } from "node:module";
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
21
+ value: mod,
22
+ enumerable: true
23
+ }) : target, mod));
24
+ var __require = /* #__PURE__ */ (() => createRequire(import.meta.url))();
25
+ //#endregion
26
+ //#region ../../node_modules/.pnpm/unpartial@1.0.5/node_modules/unpartial/esm/index.js
27
+ function required(source1, source2, source3) {
28
+ return merge([
29
+ source1,
30
+ source2,
31
+ source3
32
+ ], (p, e) => {
33
+ return {
34
+ ...p,
35
+ ...e
36
+ };
37
+ });
38
+ }
39
+ function merge(entries, reducer) {
40
+ if (entries[0] === void 0 || entries[0] === null) return entries[0];
41
+ return entries.filter((x) => !!x).reduce(reducer, {});
42
+ }
43
+ function unpartial(s1, s2, s3) {
44
+ if (s1 === void 0 || s1 === null) return s1;
45
+ return [
46
+ s1,
47
+ s2,
48
+ s3
49
+ ].filter(notNil).reduce((p, s) => ({
50
+ ...p,
51
+ ...trimNilProps(s)
52
+ }), {});
53
+ }
54
+ function trimNilProps(value) {
55
+ return Object.keys(value).reduce((p, k) => {
56
+ if (notNil(value[k])) p[k] = value[k];
57
+ return p;
58
+ }, {});
59
+ }
60
+ function notNil(value) {
61
+ return value !== null && value !== void 0;
62
+ }
63
+ //#endregion
64
+ export { __toESM as a, __require as i, unpartial as n, __commonJSMin as r, required as t };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,18 @@
1
- import { run } from "./cli.mjs";
2
1
  import { cli as cli$1 } from "clibuilder";
2
+ //#region src/cli.d.ts
3
+ /**
4
+ * The application boundary: argv in, exit code out, nothing read from or written to the process.
5
+ *
6
+ * The exit code is returned rather than written so that a caller which is not the process — a skill
7
+ * launcher, a test — can run a command and learn how it went. `bin/buddy-agent-harness.mjs` is the
8
+ * only place that turns the returned code back into a process outcome.
9
+ *
10
+ * One exit path this return cannot carry: `clibuilder` answers an unknown option or an unknown
11
+ * command by printing help and writing `process.exitCode` itself, returning nothing. `run` reports
12
+ * `0` there, which is why `bin` and the launchers apply the returned code only when it is non-zero.
13
+ */
14
+ export declare function run(argv: string[]): Promise<number>;
15
+ //#endregion
3
16
  //#region src/harness-registry/instruction-bridge.d.ts
4
17
  /**
5
18
  * What a harness needs in order to read the repository's `AGENTS.md`.
@@ -585,5 +598,5 @@ type InitializeResult = {
585
598
  };
586
599
  export declare function initializeHarnesses({ root, harnesses: preferred, copy, force }: InitializeOptions): InitializeResult;
587
600
  //#endregion
588
- export { type BridgeFinding, type BridgeKind, type BridgeProblem, type BridgeReport, type BridgeStatus, type ConfigurationFault, type ConfigurationProblem, type DiagnoseMcpOptions, type DiagnoseOptions, type DiagnoseResult, type DivergenceDirection, type DivergenceReport, type DoctorProblem, type DoctorReport, type Harness, type HarnessName, type HarnessScope, type HarnessScopeName, type InitializeOptions, type InitializeResult, type InstructionBridge, type InstructionKind, type InstructionProblem, type InstructionReport, type InstructionStatus, type McpConfig, type McpDirection, type McpField, type McpProblem, type McpServer, type McpTransport, type Repair, run };
601
+ export type { BridgeFinding, BridgeKind, BridgeProblem, BridgeReport, BridgeStatus, ConfigurationFault, ConfigurationProblem, DiagnoseMcpOptions, DiagnoseOptions, DiagnoseResult, DivergenceDirection, DivergenceReport, DoctorProblem, DoctorReport, Harness, HarnessName, HarnessScope, HarnessScopeName, InitializeOptions, InitializeResult, InstructionBridge, InstructionKind, InstructionProblem, InstructionReport, InstructionStatus, McpConfig, McpDirection, McpField, McpProblem, McpServer, McpTransport, Repair };
589
602
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/harness-registry/instruction-bridge.ts","../src/harness-registry/mcp-config.ts","../src/harness-registry/nonstandard-artifact.ts","../src/harness-registry/harness-registry.ts","../src/diagnose-bridges/diagnose-instructions.ts","../src/diagnose-bridges/locator.ts","../src/diagnose-bridges/doctor-guidance.ts","../src/diagnose-bridges/git-bridge-state.ts","../src/diagnose-bridges/diagnose-bridges.ts","../src/diagnose-configuration/diagnose-configuration.ts","../src/diagnose-bridges/doctor.command.ts","../src/diagnose-mcp/diagnose-mcp.ts","../src/diagnose-mcp/mcp-model.ts","../src/diagnose-mcp/mcp-baseline.ts","../src/diagnose-mcp/mcp-sources.ts","../src/initialize-harnesses/init.command.ts","../src/skill-projection/skill-projection.ts","../src/initialize-harnesses/initialize-harnesses.ts"],"mappings":";;;;;;;;;;;;;;;KAYY;;;;;;EAOT;;EAEA;;;EAIA;;EAEA;;EAEA;;;;;;;;;;;;;;;;;;;;KCbS;;EAEX;;;;;;EAMA;;;;;EAKA;;;;;;EAMA;;;;;;;;;;;;;;;;;KCtBW;KAgBA;;;;;EAKX;;EAEA;EACA,MAAM;;;;KC/BK;;KAUA;;;;;;;;;;;;;;;;;;;;;;;;;KA0BA;EACX;EACA;EACA,oBAAoB;EACpB,YAAY;EACZ,uBAAuB;;KAGZ;EACX,MAAM;;EAEN,SAAS;;;;;EAKT,OAAO;;EAEP,aAAa;;;;;;;;;;;;;;;;;;;;;;qBAuBD,0BAA0B;;;;KCzE3B;;;;;;KAMA;KAEA;EACX,SA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BACf,aACA,QAAQ,gBACR,gBAAe,yBACb;qBAgCU,eAAe,MAAI;;;;;;;;;;;;;;;;;;KC7CpB;EACX;EACA,KAAK;;EAEL;;wBAgCe,cAAc,MAAM,KAAK,OAAO,qBAAqB;;;;;;;;;;;;;;;;KClDzD;KAEA;EACX,YAAY;EACZ;EACA;EACA,MAAM,SAAS;EACf;EACA,UAAU,SAAS;EACnB;EACA;EACA;EACA;;;cAIY;KAaD,mBAAmB;;;;KCnCnB;;;;qBCAC;;;qBCAA,aAAa,MAAI;qBAoDjB,gBAAgB,MAAI;wBAMjB,WAAW;EAAgB,WAAW,gBAAgB;;;;;;;;;KCV1D;;;KCpDA;EACX;EACA,YAAY;EACZ;EACA,QAAQ;;KAEG;EACX;EACA,WAAW;EACX,QAAQ;EACR,QAAQ;;EAER,SAAS;;EAET;IAAc,MAAM;IAAa,YAAY;;EAC7C;EACA;;wBAGe,sBACf,MACA,WAAW,WACX,MACA,SACE,oBAAoB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/cli.ts","../src/harness-registry/instruction-bridge.ts","../src/harness-registry/mcp-config.ts","../src/harness-registry/nonstandard-artifact.ts","../src/harness-registry/harness-registry.ts","../src/diagnose-bridges/diagnose-instructions.ts","../src/diagnose-bridges/locator.ts","../src/diagnose-bridges/doctor-guidance.ts","../src/diagnose-bridges/git-bridge-state.ts","../src/diagnose-bridges/diagnose-bridges.ts","../src/diagnose-configuration/diagnose-configuration.ts","../src/diagnose-bridges/doctor.command.ts","../src/diagnose-mcp/diagnose-mcp.ts","../src/diagnose-mcp/mcp-model.ts","../src/diagnose-mcp/mcp-baseline.ts","../src/diagnose-mcp/mcp-sources.ts","../src/initialize-harnesses/init.command.ts","../src/skill-projection/skill-projection.ts","../src/initialize-harnesses/initialize-harnesses.ts"],"mappings":";;;;;;;;;;;;;wBAiDsB,IAAI,iBAAiB;;;;;;;;;;;;;;;KCrC/B;;;;;;EAOT;;EAEA;;;EAIA;;EAEA;;EAEA;;;;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