@s-berdia/opencode-router 1.0.0 → 1.0.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.
package/dist/index.js CHANGED
@@ -1818,6 +1818,10 @@ var SLASH_COMMANDS = [
1818
1818
  { name: "routing-plan", description: "Switch the routing plan (go | go-plus | free) and rebuild", args: "plan $1" },
1819
1819
  { name: "routing-eval", description: "Run the router scoring stress test", args: "eval" }
1820
1820
  ];
1821
+ var OUTPUT_BEGIN = "---BEGIN ROUTER OUTPUT---";
1822
+ function isRouterCommandPrompt(parts) {
1823
+ return parts.some((part) => part.type === "text" && part.text?.includes(OUTPUT_BEGIN) === true);
1824
+ }
1821
1825
  function cliScriptPath() {
1822
1826
  return fileURLToPath(new URL("./bin.js", import.meta.url)).replace(/\\/g, "/");
1823
1827
  }
@@ -1830,7 +1834,7 @@ function commandTemplate(args) {
1830
1834
  "2. Present the text between the markers to the user exactly as written.",
1831
1835
  "3. Do not summarize, reformat, shorten, or reorganize it.",
1832
1836
  "",
1833
- "---BEGIN ROUTER OUTPUT---",
1837
+ OUTPUT_BEGIN,
1834
1838
  `!\`node "${cliScriptPath()}" ${args} --scope global\``,
1835
1839
  "---END ROUTER OUTPUT---"
1836
1840
  ].join("\n");
@@ -1959,6 +1963,7 @@ var OpencodeRouter = async (input) => {
1959
1963
  try {
1960
1964
  const agent = msgInput.agent ?? output.message.agent;
1961
1965
  if (!isAgentRole(agent)) return;
1966
+ if (isRouterCommandPrompt(output.parts)) return;
1962
1967
  const result = await ensure();
1963
1968
  const entry = pickForRole(result.table, agent, healthCheck(result, ledger));
1964
1969
  if (!entry) return;