@volter/supercode-orchestrator 0.5.211 → 0.5.213
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 +33 -7
- package/bin/orchestrator.mjs +5 -0
- package/board/attachment-write.mjs +68 -0
- package/board/ci.mjs +105 -78
- package/board/cli.mjs +38 -2
- package/board/dispatch.mjs +171 -51
- package/board/engine.mjs +20 -11
- package/board/github-rest.mjs +84 -2
- package/board/incidents.mjs +1 -0
- package/board/machine-fleet.mjs +3 -1
- package/board/session-work.mjs +7 -0
- package/board/store.mjs +2 -2
- package/board/workflow.mjs +39 -13
- package/board/workspace.mjs +21 -10
- package/board-input.d.ts +2 -0
- package/board-input.mjs +33 -1
- package/connection.mjs +5 -1
- package/hermes-cli.mjs +7 -19
- package/index.d.ts +1 -1
- package/loop.mjs +11 -1
- package/mcp/mount.mjs +22 -14
- package/orchestration.mjs +29 -2
- package/package.json +3 -3
package/orchestration.mjs
CHANGED
|
@@ -28,6 +28,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
28
28
|
import { SupercodeHarnessClient } from '@volter/supercode-harness-sdk';
|
|
29
29
|
import { emptyRuntime, persistedView } from './ir.mjs';
|
|
30
30
|
import { lockedNative } from './source-lock.mjs';
|
|
31
|
+
import { SESSION_READ_REQUEST_UNITS, stringifySessionWire } from '@volter/supercode-teams/session-read-client';
|
|
31
32
|
|
|
32
33
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
33
34
|
|
|
@@ -150,7 +151,7 @@ export async function load(root) {
|
|
|
150
151
|
const { orchestration, vault_keys } = await through((d) => d.orchestrationLoad({ root }));
|
|
151
152
|
let vault = readVault(orchestration);
|
|
152
153
|
if (vault_keys.some((k) => !vault.has(k))) {
|
|
153
|
-
await
|
|
154
|
+
await save(stateOf(orchestration), root);
|
|
154
155
|
vault = readVault(orchestration);
|
|
155
156
|
const missing = vault_keys.filter((k) => !vault.has(k));
|
|
156
157
|
if (missing.length) throw new Error(`${root}: ${missing.join(', ')} referenced but not in .env after normalization`);
|
|
@@ -172,10 +173,36 @@ export async function read(root) {
|
|
|
172
173
|
* written as the home last held it, or left out when it held none, and none refuses the rest of the save.
|
|
173
174
|
*/
|
|
174
175
|
export async function save(state, root = state.root) {
|
|
175
|
-
const
|
|
176
|
+
const params = boundedRuntimeSave(state, root);
|
|
177
|
+
const saved = await through((d) => d.orchestrationSave(params));
|
|
178
|
+
// Apply retention in memory only after the owning door accepted it.
|
|
179
|
+
for (const [name, profile] of Object.entries(params.orchestration.profiles)) state.profiles[name].fires = profile.fires;
|
|
176
180
|
return { rejected: Array.isArray(saved?.rejected) ? saved.rejected : [] };
|
|
177
181
|
}
|
|
178
182
|
|
|
183
|
+
// A per-profile row count cannot bound the whole home's request. Keep active fires and all configuration, and
|
|
184
|
+
// remove the oldest terminal history across profiles until the actual native wire value fits, with envelope room.
|
|
185
|
+
export function boundedRuntimeSave(state, root = state.root) {
|
|
186
|
+
const orchestration = { ...persistedView(state), profiles: Object.fromEntries(Object.entries(state.profiles).map(([name, profile]) => [name, { ...profile, fires: [...profile.fires] }])) };
|
|
187
|
+
const params = { root, orchestration, preserve_workflow: true };
|
|
188
|
+
const budget = SESSION_READ_REQUEST_UNITS - 16 * 1024;
|
|
189
|
+
let units = Buffer.byteLength(stringifySessionWire(params));
|
|
190
|
+
if (units <= budget) return params;
|
|
191
|
+
const terminal = Object.entries(orchestration.profiles).flatMap(([name, profile]) => profile.fires
|
|
192
|
+
.filter(fire => !['claimed', 'running'].includes(fire.status)).map(fire => ({ name, fire })));
|
|
193
|
+
terminal.sort((a, b) => String(a.fire.claimed_at ?? '').localeCompare(String(b.fire.claimed_at ?? '')) || String(a.fire.id).localeCompare(String(b.fire.id)));
|
|
194
|
+
const drop = new Set();
|
|
195
|
+
for (const { fire } of terminal) {
|
|
196
|
+
if (units <= budget) break;
|
|
197
|
+
drop.add(fire);
|
|
198
|
+
units -= Buffer.byteLength(stringifySessionWire(fire)) + 1;
|
|
199
|
+
}
|
|
200
|
+
for (const profile of Object.values(orchestration.profiles)) profile.fires = profile.fires.filter(fire => !drop.has(fire));
|
|
201
|
+
const actual = Buffer.byteLength(stringifySessionWire(params));
|
|
202
|
+
if (actual > budget) throw new Error(`orchestrator runtime save needs ${actual} bytes after terminal-history retention (limit ${budget}); configuration and active jobs were preserved; no execution was started`);
|
|
203
|
+
return params;
|
|
204
|
+
}
|
|
205
|
+
|
|
179
206
|
/** Another harness's home as a state value (no secret value; `vault_keys` names the `.env` keys it would need). */
|
|
180
207
|
export async function compile(from, home) {
|
|
181
208
|
const { orchestration, vault_keys } = await through((d) => d.orchestrationCompile({ from, home }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/supercode-orchestrator",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.213",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "The orchestrator runtime over the Volter Harness ontology: one typed operational model whose folder is its serialization, read and written through the harness orchestration doors (docs/ORCHESTRATOR-IR.md)",
|
|
6
6
|
"exports": {
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"check-types": "node scripts/generate-types.mjs --check"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@volter/supercode-teams": "^0.3.
|
|
35
|
+
"@volter/supercode-teams": "^0.3.344",
|
|
36
36
|
"@volter/supercode-terminal": "^0.3.10",
|
|
37
37
|
"@volter/supercode-harness-sdk": "^0.3.104",
|
|
38
38
|
"@volter/teams": "0.2.99",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"apply",
|
|
63
63
|
"README.md"
|
|
64
64
|
],
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "d017029f1b1d9293e295839a496be94a641b1ac0"
|
|
66
66
|
}
|