oh-my-opencode-cohub 1.2.0 → 1.2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAyClD,wBAAwB;AACxB,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAalD,CAAC;AAwEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,wrBAA+B,CAAC;AAEhE,QAAA,MAAM,WAAW,EAAE,MAgXlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAyClD,wBAAwB;AACxB,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAalD,CAAC;AAwEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,wrBAA+B,CAAC;AAEhE,QAAA,MAAM,WAAW,EAAE,MA0YlB,CAAC;AAEF,eAAe,WAAW,CAAC"}
package/dist/index.js CHANGED
@@ -1351,6 +1351,11 @@ var CoHubPlugin = async (input, options) => {
1351
1351
  }
1352
1352
  const promptOverrides = { ...configOverrides, ...fileOverrides };
1353
1353
  const tracker = new TaskTracker;
1354
+ const DEBUG_DIR = path2.join(projectDir, ".superpowers");
1355
+ const DEBUG_LOG = path2.join(DEBUG_DIR, "context-debug.log");
1356
+ if (!fs2.existsSync(DEBUG_DIR)) {
1357
+ fs2.mkdirSync(DEBUG_DIR, { recursive: true });
1358
+ }
1354
1359
  const STATE_DIR = path2.join(os2.homedir(), ".local", "share", "opencode", "storage", "oh-my-opencode-cohub");
1355
1360
  const STATE_FILE = path2.join(STATE_DIR, "tracker-state.json");
1356
1361
  function syncTrackerState(sessionId) {
@@ -1556,6 +1561,8 @@ var CoHubPlugin = async (input, options) => {
1556
1561
  },
1557
1562
  "tool.execute.before": async (input2, output) => {
1558
1563
  try {
1564
+ fs2.appendFileSync(DEBUG_LOG, `[${new Date().toISOString()}] HOOK_FIRED tool=${input2.tool} sessionId=${input2.sessionID}
1565
+ `);
1559
1566
  if (input2.tool === "task") {
1560
1567
  const args = output.args ?? {};
1561
1568
  const subagentType = typeof args.subagent_type === "string" ? args.subagent_type : undefined;
@@ -1570,13 +1577,23 @@ var CoHubPlugin = async (input, options) => {
1570
1577
  if (subagentType) {
1571
1578
  const strategy = resolveStrategy(subagentType, contextEngine.getStrategy(subagentType) !== undefined ? { [subagentType]: contextEngine.getStrategy(subagentType) } : contextConfig.strategy ?? {}, typeof args.context_override === "string" ? args.context_override : undefined);
1572
1579
  if (strategy !== "none") {
1580
+ console.error("[CONTEXT-DEBUG] before hook: strategy=", strategy, "agent=", subagentType);
1581
+ console.error("[CONTEXT-DEBUG] before hook: output.args type=", typeof output.args, "isNull=", output.args === null);
1573
1582
  const contextId = contextEngine.registerContext({
1574
1583
  description
1575
1584
  });
1585
+ output.args ??= {};
1576
1586
  output.args.description = description + contextEngine.formatMarker(contextId);
1587
+ console.error("[CONTEXT-DEBUG] before hook: marker appended, contextId=", contextId);
1588
+ console.error("[CONTEXT-DEBUG] before hook: description preview=", output.args.description.slice(-80));
1589
+ fs2.appendFileSync(DEBUG_LOG, `[${new Date().toISOString()}] MARKER_APPENDED contextId=${contextId} descEnd=${output.args.description.slice(-60)}
1590
+ `);
1577
1591
  contextEngine.fillContextAsync(contextId, input2.sessionID, {
1578
1592
  strategy
1579
1593
  }).catch(() => {});
1594
+ } else {
1595
+ fs2.appendFileSync(DEBUG_LOG, `[${new Date().toISOString()}] STRATEGY_NONE agent=${subagentType}
1596
+ `);
1580
1597
  }
1581
1598
  }
1582
1599
  }
@@ -1620,15 +1637,21 @@ var CoHubPlugin = async (input, options) => {
1620
1637
  "experimental.chat.messages.transform": async (_input, output) => {
1621
1638
  try {
1622
1639
  if (output.messages && Array.isArray(output.messages)) {
1640
+ const userMsgs = output.messages.filter((m) => m.info?.role === "user");
1641
+ console.error("[CONTEXT-DEBUG] transform: total messages=", output.messages.length, "user messages=", userMsgs.length);
1623
1642
  for (const msg of output.messages) {
1624
1643
  if (msg.info.role !== "user")
1625
1644
  continue;
1626
1645
  for (const part of msg.parts ?? []) {
1627
1646
  if (part.type !== "text" || !part.text)
1628
1647
  continue;
1648
+ const hasMarker = /CONTEXT:ID=/.test(part.text);
1649
+ if (hasMarker) {
1650
+ console.error("[CONTEXT-DEBUG] transform: FOUND marker in user msg, text preview=", part.text.slice(0, 200));
1651
+ }
1629
1652
  const replaced = contextEngine.consumeMarkedContext(part.text);
1630
1653
  if (replaced !== null) {
1631
- part.text = replaced;
1654
+ console.error("[CONTEXT-DEBUG] transform: marker REPLACED, new text preview=", part.text.slice(0, 200));
1632
1655
  }
1633
1656
  }
1634
1657
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-opencode-cohub",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "OpenCode 中文智能体编排插件 CoHub - 纯调度模式 / 全中文提示词 / 规范分析代理 / 方案制定代理 / 独立运行",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",