@goodandready/dsh-moa 0.2.61 → 0.2.63
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/lib/index.js +37 -25
- package/lib/moa-runner.js +1 -586
- package/lib/pipeline/candidates.js +99 -0
- package/lib/pipeline/context.js +107 -0
- package/lib/pipeline/fast-mode.js +100 -0
- package/lib/pipeline/multi-judge.js +37 -0
- package/lib/pipeline/peer-critique.js +113 -0
- package/lib/pipeline/promotion.js +114 -0
- package/lib/pipeline/questions.js +79 -0
- package/lib/pipeline/runner.js +163 -0
- package/lib/pipeline/synthesis.js +150 -0
- package/lib/services.js +35 -0
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { service, getWebServerPort } from './services.js'
|
|
1
2
|
import crypto from 'node:crypto'
|
|
2
3
|
import path from 'node:path'
|
|
3
4
|
import { setLogger, logger } from './logger.js'
|
|
@@ -24,7 +25,7 @@ import { getMoaHistory } from './history.js'
|
|
|
24
25
|
|
|
25
26
|
export const name = '@goodandready/dsh-moa'
|
|
26
27
|
export { collectProjectContext, formatProjectContext } from './file-workspace.js'
|
|
27
|
-
export const inject = ['
|
|
28
|
+
export const inject = ['llm']
|
|
28
29
|
export const NS = 'dsh-moa'
|
|
29
30
|
|
|
30
31
|
export {
|
|
@@ -129,29 +130,40 @@ export function apply(ctx, config) {
|
|
|
129
130
|
// Optional Live Canvas preview client: the harness port is resolved per
|
|
130
131
|
// call and any failure degrades to "no preview link" (live-canvas is not
|
|
131
132
|
// required to be installed).
|
|
132
|
-
const liveCanvas = createLiveCanvasClient({ getPort: () => ctx
|
|
133
|
+
const liveCanvas = createLiveCanvasClient({ getPort: () => getWebServerPort(ctx) })
|
|
133
134
|
|
|
134
|
-
// Route: /dsh-moa/status
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
135
|
+
// Route: /dsh-moa/status & one-click updater
|
|
136
|
+
const registerWebSurfaces = (webCtx) => {
|
|
137
|
+
if (!webCtx) return
|
|
138
|
+
const ws = service(webCtx, 'webServer')
|
|
139
|
+
if (!ws || typeof ws.register !== 'function') return
|
|
140
|
+
|
|
141
|
+
const eff = typeof webCtx.effect === 'function' ? webCtx.effect : (typeof ctx.effect === 'function' ? ctx.effect : (fn) => fn())
|
|
142
|
+
eff(() => {
|
|
143
|
+
return registerPluginUpdater(webCtx, {
|
|
144
|
+
endpoint: '/api/dsh-moa/update',
|
|
145
|
+
packageName: '@goodandready/dsh-moa',
|
|
146
|
+
manifestUrl: new URL('../package.json', import.meta.url),
|
|
147
|
+
})
|
|
148
|
+
}, 'dsh-moa: plugin updater route')
|
|
149
|
+
|
|
150
|
+
registerMoaRoutes(webCtx, {
|
|
151
|
+
live,
|
|
152
|
+
callLlm,
|
|
153
|
+
liveCanvas,
|
|
154
|
+
saveConfig,
|
|
155
|
+
Config,
|
|
156
|
+
plainConfig,
|
|
157
|
+
webServerPort: getWebServerPort(webCtx) || getWebServerPort(ctx),
|
|
158
|
+
timeMachineEngine: service(webCtx, 'timeMachineEngine') || service(ctx, 'timeMachineEngine') || ctx.reflect?.get?.('timeMachineEngine', false),
|
|
141
159
|
})
|
|
142
|
-
}
|
|
160
|
+
}
|
|
143
161
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
saveConfig,
|
|
150
|
-
Config,
|
|
151
|
-
plainConfig,
|
|
152
|
-
webServerPort: ctx.webServer?.port,
|
|
153
|
-
timeMachineEngine: ctx.reflect?.get?.('timeMachineEngine', false),
|
|
154
|
-
})
|
|
162
|
+
if (service(ctx, 'webServer')?.register) {
|
|
163
|
+
registerWebSurfaces(ctx)
|
|
164
|
+
} else if (typeof ctx.inject === 'function') {
|
|
165
|
+
ctx.inject(['webServer'], registerWebSurfaces)
|
|
166
|
+
}
|
|
155
167
|
|
|
156
168
|
// Session turn interceptor: route turn to real aggregator model & stream MoA synthesis
|
|
157
169
|
ctx.effect(() => {
|
|
@@ -221,8 +233,8 @@ export function apply(ctx, config) {
|
|
|
221
233
|
runId: promoteRunId,
|
|
222
234
|
candidateIndex: parsed.candidateIndex,
|
|
223
235
|
cwd: sessCwd,
|
|
224
|
-
webServerPort: ctx
|
|
225
|
-
timeMachineEngine: ctx.reflect?.get?.('timeMachineEngine', false),
|
|
236
|
+
webServerPort: getWebServerPort(ctx),
|
|
237
|
+
timeMachineEngine: service(ctx, 'timeMachineEngine') || ctx.reflect?.get?.('timeMachineEngine', false),
|
|
226
238
|
}
|
|
227
239
|
if (event.signal) moaPendingTurns.set(event.signal, turnContext)
|
|
228
240
|
if (event.session?.id) setSessionTurn(event.session.id, turnContext)
|
|
@@ -270,8 +282,8 @@ export function apply(ctx, config) {
|
|
|
270
282
|
callLlm,
|
|
271
283
|
prices: cfg.prices || {},
|
|
272
284
|
liveCanvas,
|
|
273
|
-
webServerPort: ctx
|
|
274
|
-
timeMachineEngine: ctx.reflect?.get?.('timeMachineEngine', false),
|
|
285
|
+
webServerPort: getWebServerPort(ctx),
|
|
286
|
+
timeMachineEngine: service(ctx, 'timeMachineEngine') || ctx.reflect?.get?.('timeMachineEngine', false),
|
|
275
287
|
}
|
|
276
288
|
|
|
277
289
|
if (event.signal) {
|