@supaku/agentfactory-nextjs 0.7.11 → 0.7.13
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/README.md
CHANGED
|
@@ -94,11 +94,31 @@ const routes = createAllRoutes({
|
|
|
94
94
|
autoAcceptanceExcludeLabels: [],
|
|
95
95
|
},
|
|
96
96
|
|
|
97
|
+
// Optional: governor integration
|
|
98
|
+
// 'direct' (default) — webhooks dispatch work directly
|
|
99
|
+
// 'event-bridge' — dispatch AND publish governor events (dual-write)
|
|
100
|
+
// 'governor-only' — only publish events, governor handles all dispatch
|
|
101
|
+
governorMode: 'event-bridge',
|
|
102
|
+
|
|
97
103
|
// Optional: OAuth
|
|
98
104
|
oauth: { clientId: '...', clientSecret: '...' },
|
|
99
105
|
})
|
|
100
106
|
```
|
|
101
107
|
|
|
108
|
+
### Governor Event Bridge
|
|
109
|
+
|
|
110
|
+
When `governorMode` is `event-bridge` or `governor-only`, webhook handlers publish events to a `GovernorEventBus`. Wire the bus at server startup:
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { RedisEventBus } from '@supaku/agentfactory-server'
|
|
114
|
+
import { setGovernorEventBus } from '@supaku/agentfactory-nextjs'
|
|
115
|
+
|
|
116
|
+
const eventBus = new RedisEventBus()
|
|
117
|
+
setGovernorEventBus(eventBus)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The governor process (running `af-governor`) consumes from the same Redis Stream and dispatches work through the shared Redis queue.
|
|
121
|
+
|
|
102
122
|
## Middleware
|
|
103
123
|
|
|
104
124
|
Handles API key auth, rate limiting, and webhook signature verification:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/handlers/sessions/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../../../src/handlers/sessions/status.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAoBvD,UAAU,WAAW;IACnB,MAAM,EAAE,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAChC;AAYD,wBAAgB,8BAA8B,KACjB,SAAS,WAAW,EAAE,YAAY,WAAW,oCA6JzE;AAED,wBAAgB,6BAA6B,KACjB,SAAS,WAAW,EAAE,YAAY,WAAW;;;4EAsBxE"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NextResponse } from 'next/server';
|
|
7
7
|
import { requireWorkerAuth } from '../../middleware/worker-auth.js';
|
|
8
|
-
import { getSessionState, updateSessionStatus, updateSessionCostData, updateClaudeSessionId, startSession, removeWorkerSession, releaseClaim, markAgentWorked, releaseIssueLock, promoteNextPendingWork, createLogger, } from '@supaku/agentfactory-server';
|
|
8
|
+
import { getSessionState, updateSessionStatus, updateSessionCostData, updateClaudeSessionId, startSession, removeWorkerSession, releaseClaim, markAgentWorked, releaseIssueLock, promoteNextPendingWork, RedisProcessingStateStorage, createLogger, } from '@supaku/agentfactory-server';
|
|
9
9
|
const log = createLogger('api:sessions:status');
|
|
10
10
|
const VALID_STATUSES = [
|
|
11
11
|
'running',
|
|
@@ -73,6 +73,30 @@ export function createSessionStatusPostHandler() {
|
|
|
73
73
|
catch (err) {
|
|
74
74
|
log.error('Failed to mark agent-worked', { sessionId, error: err });
|
|
75
75
|
}
|
|
76
|
+
// Mark research/backlog-creation phases as completed so the
|
|
77
|
+
// governor does not re-dispatch the same top-of-funnel work.
|
|
78
|
+
const phase = session.workType === 'research' ? 'research'
|
|
79
|
+
: session.workType === 'backlog-creation' ? 'backlog-creation'
|
|
80
|
+
: null;
|
|
81
|
+
if (phase) {
|
|
82
|
+
try {
|
|
83
|
+
const processingState = new RedisProcessingStateStorage();
|
|
84
|
+
await processingState.markPhaseCompleted(session.issueId, phase, sessionId);
|
|
85
|
+
log.info('Processing phase marked complete', {
|
|
86
|
+
issueId: session.issueId,
|
|
87
|
+
phase,
|
|
88
|
+
sessionId,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
log.error('Failed to mark processing phase complete', {
|
|
93
|
+
sessionId,
|
|
94
|
+
issueId: session.issueId,
|
|
95
|
+
phase,
|
|
96
|
+
error: err,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
76
100
|
}
|
|
77
101
|
await releaseClaim(sessionId);
|
|
78
102
|
await removeWorkerSession(workerId, sessionId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@supaku/agentfactory-nextjs",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Next.js API route handlers for AgentFactory — webhook processor, worker/session management, public stats",
|
|
6
6
|
"author": "Supaku (https://supaku.com)",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"LICENSE"
|
|
49
49
|
],
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@supaku/agentfactory": "0.7.
|
|
52
|
-
"@supaku/agentfactory-
|
|
53
|
-
"@supaku/agentfactory-
|
|
51
|
+
"@supaku/agentfactory": "0.7.13",
|
|
52
|
+
"@supaku/agentfactory-server": "0.7.13",
|
|
53
|
+
"@supaku/agentfactory-linear": "0.7.13"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"next": ">=14.0.0"
|