@qwen-code/qwen-harness 0.1.1 → 0.1.3

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.
@@ -4813,6 +4813,20 @@ async function runToolComparisonHarness(name, args) {
4813
4813
  );
4814
4814
  }
4815
4815
 
4816
+ // src/runtime/pi-management.ts
4817
+ var PI_MANAGEMENT_COMMANDS = /* @__PURE__ */ new Set([
4818
+ "auth",
4819
+ "config",
4820
+ "install",
4821
+ "list",
4822
+ "remove",
4823
+ "uninstall",
4824
+ "update"
4825
+ ]);
4826
+ function isPiManagementCommand(args) {
4827
+ return args[0] !== void 0 && PI_MANAGEMENT_COMMANDS.has(args[0]);
4828
+ }
4829
+
4816
4830
  // src/harness_cli.ts
4817
4831
  var harnessNames = [
4818
4832
  "pi",
@@ -4825,6 +4839,21 @@ var harnessNames = [
4825
4839
  "long-horizon-mea",
4826
4840
  ...toolComparisonHarnessNames
4827
4841
  ];
4842
+ function resolveHarnessInvocation(invocation) {
4843
+ if (isPiManagementCommand(invocation.args)) {
4844
+ return { kind: "pi-management", args: invocation.args };
4845
+ }
4846
+ return { kind: "harness", ...invocation };
4847
+ }
4848
+ function preserveLegacyLeadingDashPrompt(args) {
4849
+ const preserved = [...args];
4850
+ const promptIndex = preserved.length - 1;
4851
+ const prompt = preserved[promptIndex];
4852
+ if (prompt?.startsWith("-") && /\s/u.test(prompt)) {
4853
+ preserved[promptIndex] = ` ${prompt}`;
4854
+ }
4855
+ return preserved;
4856
+ }
4828
4857
  function parseHarnessName(value) {
4829
4858
  const name = value?.trim().toLowerCase();
4830
4859
  if (name && harnessNames.includes(name)) {
@@ -4840,7 +4869,7 @@ function harnessUsage() {
4840
4869
  "",
4841
4870
  "The harness defaults to pi, which keeps Pi's default prompt and built-in tools",
4842
4871
  "while disabling user and project resource discovery.",
4843
- "All remaining arguments are passed to Pi unchanged."
4872
+ "All remaining arguments are passed to Pi."
4844
4873
  ].join("\n");
4845
4874
  }
4846
4875
  function parseHarnessInvocation(args) {
@@ -4861,7 +4890,10 @@ function parseHarnessInvocation(args) {
4861
4890
  }
4862
4891
  if (argument !== void 0) piArgs.push(argument);
4863
4892
  }
4864
- return { name: name ?? "pi", args: piArgs };
4893
+ return {
4894
+ name: name ?? "pi",
4895
+ args: preserveLegacyLeadingDashPrompt(piArgs)
4896
+ };
4865
4897
  }
4866
4898
 
4867
4899
  // src/runtime/subagent-runtime.ts
@@ -4922,12 +4954,16 @@ async function runEntrypoint(args) {
4922
4954
  `);
4923
4955
  return;
4924
4956
  }
4925
- const { name, args: harnessArgs } = parseHarnessInvocation(args);
4926
- process.title = `pi-${name}`;
4957
+ const invocation = resolveHarnessInvocation(parseHarnessInvocation(args));
4958
+ process.title = invocation.kind === "pi-management" ? "pi-management" : `pi-${invocation.name}`;
4927
4959
  process.env.PI_CODING_AGENT = "true";
4928
4960
  process.env.AI_AGENT = "pi";
4929
4961
  exposePackagedHarnessAsSubagentBinary();
4930
- await harnessRunners[name](harnessArgs);
4962
+ if (invocation.kind === "pi-management") {
4963
+ await runHarnessMain(invocation.args);
4964
+ } else {
4965
+ await harnessRunners[invocation.name](invocation.args);
4966
+ }
4931
4967
  } catch (error) {
4932
4968
  process.stderr.write(
4933
4969
  `${error instanceof Error ? error.message : String(error)}