@goodandready/dsh-moa 0.2.60 → 0.2.62
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/file-workspace.js +33 -593
- package/lib/index.js +39 -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/routes/history.js +81 -0
- package/lib/routes/pipeline.js +91 -0
- package/lib/routes/presets.js +241 -0
- package/lib/routes/workbench.js +197 -0
- package/lib/routes.js +17 -582
- package/lib/services.js +40 -0
- package/lib/workspace/checkpoint.js +51 -0
- package/lib/workspace/diff.js +94 -0
- package/lib/workspace/fs.js +284 -0
- package/lib/workspace/scanner.js +100 -0
- package/lib/workspace/security.js +80 -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,42 @@ 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 = (targetCtx) => {
|
|
137
|
+
if (!targetCtx) return
|
|
138
|
+
const ws = service(targetCtx, 'webServer') || service(ctx, 'webServer')
|
|
139
|
+
if (!ws || typeof ws.register !== 'function') return
|
|
140
|
+
|
|
141
|
+
const eff = typeof targetCtx.effect === 'function' ? targetCtx.effect : (typeof ctx.effect === 'function' ? ctx.effect : (fn) => fn())
|
|
142
|
+
eff(() => {
|
|
143
|
+
return registerPluginUpdater(targetCtx, {
|
|
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(targetCtx, {
|
|
151
|
+
live,
|
|
152
|
+
callLlm,
|
|
153
|
+
liveCanvas,
|
|
154
|
+
saveConfig,
|
|
155
|
+
Config,
|
|
156
|
+
plainConfig,
|
|
157
|
+
webServerPort: getWebServerPort(targetCtx) || getWebServerPort(ctx),
|
|
158
|
+
timeMachineEngine: service(targetCtx, 'timeMachineEngine') || service(ctx, 'timeMachineEngine') || ctx.reflect?.get?.('timeMachineEngine', false),
|
|
141
159
|
})
|
|
142
|
-
}
|
|
160
|
+
}
|
|
143
161
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
plainConfig,
|
|
152
|
-
webServerPort: ctx.webServer?.port,
|
|
153
|
-
timeMachineEngine: ctx.reflect?.get?.('timeMachineEngine', false),
|
|
154
|
-
})
|
|
162
|
+
if (service(ctx, 'webServer')) {
|
|
163
|
+
registerWebSurfaces(ctx)
|
|
164
|
+
} else if (typeof ctx.inject === 'function') {
|
|
165
|
+
ctx.inject(['webServer'], (webCtx) => {
|
|
166
|
+
registerWebSurfaces(webCtx)
|
|
167
|
+
})
|
|
168
|
+
}
|
|
155
169
|
|
|
156
170
|
// Session turn interceptor: route turn to real aggregator model & stream MoA synthesis
|
|
157
171
|
ctx.effect(() => {
|
|
@@ -221,8 +235,8 @@ export function apply(ctx, config) {
|
|
|
221
235
|
runId: promoteRunId,
|
|
222
236
|
candidateIndex: parsed.candidateIndex,
|
|
223
237
|
cwd: sessCwd,
|
|
224
|
-
webServerPort: ctx
|
|
225
|
-
timeMachineEngine: ctx.reflect?.get?.('timeMachineEngine', false),
|
|
238
|
+
webServerPort: getWebServerPort(ctx),
|
|
239
|
+
timeMachineEngine: service(ctx, 'timeMachineEngine') || ctx.reflect?.get?.('timeMachineEngine', false),
|
|
226
240
|
}
|
|
227
241
|
if (event.signal) moaPendingTurns.set(event.signal, turnContext)
|
|
228
242
|
if (event.session?.id) setSessionTurn(event.session.id, turnContext)
|
|
@@ -270,8 +284,8 @@ export function apply(ctx, config) {
|
|
|
270
284
|
callLlm,
|
|
271
285
|
prices: cfg.prices || {},
|
|
272
286
|
liveCanvas,
|
|
273
|
-
webServerPort: ctx
|
|
274
|
-
timeMachineEngine: ctx.reflect?.get?.('timeMachineEngine', false),
|
|
287
|
+
webServerPort: getWebServerPort(ctx),
|
|
288
|
+
timeMachineEngine: service(ctx, 'timeMachineEngine') || ctx.reflect?.get?.('timeMachineEngine', false),
|
|
275
289
|
}
|
|
276
290
|
|
|
277
291
|
if (event.signal) {
|