ework-aio 0.5.21 → 0.5.23

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ework-aio",
3
- "version": "0.5.21",
3
+ "version": "0.5.23",
4
4
  "description": "All-in-one installer for ework (issue tracker) + ework-daemon (AI bridge) + opencode-ework (plugin). One command: npm i -g ework-aio && ework-aio install.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "ework-daemon": "^0.4.1",
50
- "ework-router": "^0.1.0",
50
+ "ework-router": "^0.1.1",
51
51
  "ework-web": "^0.10.1",
52
52
  "opencode-ework": "^0.1.0",
53
53
  "zod": "^3.23.0"
@@ -709,6 +709,54 @@ case "$DELIVERIES_CODE" in
709
709
  ;;
710
710
  esac
711
711
 
712
+ # Phase 5.8: router integration (webhook routing layer)
713
+ echo
714
+ echo "====================================================="
715
+ echo "Phase 5.8: router integration"
716
+ echo "====================================================="
717
+
718
+ ROUTER_PORT=3104
719
+ info "router health: GET http://127.0.0.1:$ROUTER_PORT/api/health"
720
+ ROUTIER_HEALTH_CODE=$(curl -sS -o /dev/null -w "%{http_code}" \
721
+ --max-time 5 "http://127.0.0.1:$ROUTER_PORT/api/health" 2>/dev/null || echo "000")
722
+ case "$ROUTIER_HEALTH_CODE" in
723
+ 200)
724
+ pass "router /api/health responds (200)"
725
+ ;;
726
+ 000)
727
+ info "router not running (binary not installed in this env) — skipping router tests"
728
+ ;;
729
+ *)
730
+ info "router health returned HTTP $ROUTIER_HEALTH_CODE"
731
+ ;;
732
+ esac
733
+
734
+ if [[ "$ROUTIER_HEALTH_CODE" == "200" ]]; then
735
+ info "router strategy: GET /api/strategy"
736
+ STRATEGY_RESP=$(curl -sS --max-time 5 "http://127.0.0.1:$ROUTER_PORT/api/strategy" 2>/dev/null || echo "")
737
+ if echo "$STRATEGY_RESP" | grep -q "strategy"; then
738
+ pass "router strategy endpoint responds"
739
+ else
740
+ info "router strategy response: $STRATEGY_RESP"
741
+ fi
742
+
743
+ info "router forwards webhook to daemon (POST /webhook/gitea)"
744
+ ROUTER_FORWARD_CODE=$(curl -sS -o /dev/null -w "%{http_code}" \
745
+ --max-time 10 \
746
+ -X POST \
747
+ -H "Content-Type: application/json" \
748
+ -d '{"action":"opened","issue":{"number":99999,"title":"router-test","body":"e2e router forward test","state":"open","user":{"login":"e2e"}},"repository":{"owner":{"login":"e2e"},"name":"test"}}' \
749
+ "http://127.0.0.1:$ROUTER_PORT/webhook/gitea" 2>/dev/null || echo "000")
750
+ case "$ROUTER_FORWARD_CODE" in
751
+ 200|204)
752
+ pass "router accepted webhook (HTTP $ROUTER_FORWARD_CODE)"
753
+ ;;
754
+ *)
755
+ info "router forward returned HTTP $ROUTER_FORWARD_CODE (daemon may not be reachable from router)"
756
+ ;;
757
+ esac
758
+ fi
759
+
712
760
  # Phase 7: multi-daemon coordination (requires MySQL shared DB)
713
761
  # -----------------------------------------------------------------------------
714
762
  if grep -q 'WORK_DB_DRIVER=mysql' "$DATA_DIR/ework-daemon/.env" 2>/dev/null; then
package/src/config.ts CHANGED
@@ -100,6 +100,7 @@ export const ROUTER_ENV_KEYS: readonly EnvKeySpec[] = [
100
100
  { envVar: "ROUTER_PORT", file: "router", generate: (c) => String(c.routerPort) },
101
101
  { envVar: "ROUTER_HOST", file: "router", generate: () => "127.0.0.1" },
102
102
  { envVar: "ROUTER_STRATEGY", file: "router", generate: () => "least-loaded" },
103
+ { envVar: "ROUTER_FALLBACK_ENDPOINT", file: "router", generate: (c) => `http://127.0.0.1:${c.daemonPort}` },
103
104
  { envVar: "WORK_DB_DRIVER", file: "router", generate: () => "sqlite" },
104
105
  { envVar: "WORK_DB_PATH", file: "router", generate: (c) => c.paths.webDbPath },
105
106
  { envVar: "WORK_DB_PREFIX", file: "router", generate: () => "" },