owenloop 0.5.7 → 0.5.8
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/CHANGELOG.md +16 -0
- package/README.md +3 -6
- package/dist/packages/work/src/agent/capability-model.d.ts +64 -82
- package/dist/packages/work/src/agent/capability-model.js +94 -91
- package/dist/packages/work/src/agent/loop.d.ts +39 -25
- package/dist/packages/work/src/agent/loop.js +102 -50
- package/dist/packages/work/src/bundle/types.d.ts +3 -3
- package/dist/packages/work/src/exec/loop.js +37 -15
- package/dist/packages/work/src/harness/child-env.js +4 -5
- package/dist/packages/work/src/harness/codex.js +3 -4
- package/dist/packages/work/src/harness/session-store.d.ts +63 -3
- package/dist/packages/work/src/harness/session-store.js +104 -9
- package/dist/packages/work/src/hub/types.d.ts +3 -3
- package/dist/packages/work/src/roles/agent-run.js +48 -42
- package/dist/packages/work/src/roles/sessions.d.ts +3 -2
- package/dist/packages/work/src/roles/sessions.js +9 -2
- package/dist/packages/work/src/roles/settings.js +1 -1
- package/dist/packages/work/src/settings/roster.d.ts +21 -0
- package/dist/packages/work/src/settings/roster.js +80 -0
- package/dist/packages/work/src/settings/settings.d.ts +12 -24
- package/dist/packages/work/src/settings/settings.js +17 -35
- package/dist/packages/work/src/shift/runtime.js +2 -10
- package/dist/packages/work/src/shift/spawn.d.ts +6 -53
- package/dist/packages/work/src/shift/spawn.js +28 -66
- package/dist/packages/work/src/usage.d.ts +1 -1
- package/dist/packages/work/src/usage.js +3 -4
- package/dist/src/capabilities.d.ts +44 -0
- package/dist/src/capabilities.js +38 -0
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/cli.js +460 -5
- package/dist/src/config-dir.d.ts +13 -18
- package/dist/src/config-dir.js +15 -23
- package/dist/src/credentials.d.ts +1 -1
- package/dist/src/credentials.js +1 -1
- package/dist/src/crypto/records.d.ts +1 -0
- package/dist/src/crypto/records.js +6 -0
- package/dist/src/crypto/trust-roots.d.ts +2 -2
- package/dist/src/crypto/trust-roots.js +2 -2
- package/dist/src/engine.d.ts +14 -0
- package/dist/src/engine.js +21 -13
- package/dist/src/global-config.d.ts +4 -7
- package/dist/src/global-config.js +4 -7
- package/dist/src/hub.d.ts +207 -5
- package/dist/src/hub.js +263 -3
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +1 -1
- package/dist/src/schemas/index.d.ts +8 -0
- package/dist/src/schemas/order.v1.schema.json +6 -1
- package/dist/src/store/pre-commit-verifier.js +1 -1
- package/dist/src/types.d.ts +24 -4
- package/dist/src/work-settings.d.ts +2 -4
- package/dist/src/work-settings.js +2 -4
- package/docs/agent-runner.md +2 -2
- package/docs/bundles.md +3 -1
- package/docs/cli.md +295 -101
- package/docs/crypto.md +14 -14
- package/docs/routing.md +607 -0
- package/docs/shift-logs.md +22 -6
- package/package.json +1 -1
- package/plugins/claude-code/plugin/.claude-plugin/plugin.json +1 -1
- package/plugins/claude-code/plugin/.mcp.json +1 -1
- package/plugins/claude-code/plugin/skills/author/SKILL.md +1 -2
- package/plugins/codex/plugins/owenloop/.codex-plugin/plugin.json +1 -1
- package/plugins/codex/plugins/owenloop/.mcp.json +1 -1
- package/plugins/codex/plugins/owenloop/skills/author/SKILL.md +1 -2
package/dist/src/hub.js
CHANGED
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
* Secret hygiene is a hard rule here: credentials never land in the repo or a
|
|
49
49
|
* plaintext `.env`. The 0600 file backend below (dir 0700) lives under the
|
|
50
50
|
* user's config dir, never the project; all paths derive from the
|
|
51
|
-
* caller-supplied `env` (HOME
|
|
51
|
+
* caller-supplied `env` (HOME), never `process.env` directly,
|
|
52
52
|
* so tests fixture `$HOME` and never touch ambient machine state. Both this
|
|
53
53
|
* file and `.owenloop/hub.json` are written via `writeFileAtomic` — temp file
|
|
54
54
|
* in the same dir + rename, refusing a symlinked destination (SEC-3). The
|
|
@@ -281,7 +281,7 @@ export function parseCredential(raw) {
|
|
|
281
281
|
/**
|
|
282
282
|
* The user-level config dir (never the project dir). Derives from the caller's
|
|
283
283
|
* env via the one shared ladder in `config-dir.ts`:
|
|
284
|
-
* `OWENLOOP_CONFIG_DIR` > `$
|
|
284
|
+
* `OWENLOOP_CONFIG_DIR` > `$HOME/.owenloop`.
|
|
285
285
|
*/
|
|
286
286
|
export function configDir(env) {
|
|
287
287
|
return owenloopConfigDir(env);
|
|
@@ -629,7 +629,7 @@ export function credentialBackend(env, injected) {
|
|
|
629
629
|
* keychain → file. A keychain-backed read NEVER falls through to the file (that
|
|
630
630
|
* fallback was the REL-6 shadowing bug), and a corrupt entry reads as absent
|
|
631
631
|
* (`null`) on either store — never as a reason to consult the other. The file
|
|
632
|
-
* backend derives its path from the supplied `env` (HOME
|
|
632
|
+
* backend derives its path from the supplied `env` (HOME),
|
|
633
633
|
* never `process.env` directly, so a caller passing `opts.env` stays hermetic;
|
|
634
634
|
* only the top-level default falls back to `process.env`.
|
|
635
635
|
*
|
|
@@ -1124,6 +1124,266 @@ export function asCapabilityRoutes(body) {
|
|
|
1124
1124
|
const list = body.bindings;
|
|
1125
1125
|
return list.map((entry, i) => asCapabilityRouteRow(entry, 'capability_routes: malformed response', `bindings[${i}]`));
|
|
1126
1126
|
}
|
|
1127
|
+
/**
|
|
1128
|
+
* Validate the eight `RoutingAlertWire` fields on one row. `prefix` is the
|
|
1129
|
+
* endpoint-qualified lead-in the caller wants (e.g.
|
|
1130
|
+
* `routing_alerts: malformed response`) and `where` names the offending
|
|
1131
|
+
* position (`alerts[2]`) — a FIELD/INDEX name only, never a value.
|
|
1132
|
+
*
|
|
1133
|
+
* Shared by BOTH endpoints that carry alert rows (`GET /api/routing_alerts` and
|
|
1134
|
+
* `GET /api/run_routing/:wf`), so the two can never drift apart in what they
|
|
1135
|
+
* accept — the same reason `asCapabilityRouteRow` is shared by its three
|
|
1136
|
+
* callers.
|
|
1137
|
+
*/
|
|
1138
|
+
function asRoutingAlertRow(entry, prefix, where) {
|
|
1139
|
+
if (typeof entry !== 'object' || entry === null) {
|
|
1140
|
+
throw new Error(`${prefix} — ${where} is not an object`);
|
|
1141
|
+
}
|
|
1142
|
+
const e = entry;
|
|
1143
|
+
for (const field of ['id', 'workflow', 'kind', 'capability']) {
|
|
1144
|
+
if (typeof e[field] !== 'string' || e[field] === '') {
|
|
1145
|
+
throw new Error(`${prefix} — ${where} missing non-empty string ${field}`);
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
if (typeof e.at !== 'number') {
|
|
1149
|
+
throw new Error(`${prefix} — ${where} missing number at`);
|
|
1150
|
+
}
|
|
1151
|
+
// Lenient exactly like `asCapabilityRouteRow`'s `crewName`: absent or `null`
|
|
1152
|
+
// both mean "the hub has nothing to report here", which is a normal answer for
|
|
1153
|
+
// all three of these fields.
|
|
1154
|
+
const nullableString = (field) => {
|
|
1155
|
+
const value = e[field];
|
|
1156
|
+
if (value === undefined || value === null)
|
|
1157
|
+
return null;
|
|
1158
|
+
if (typeof value !== 'string' || value === '') {
|
|
1159
|
+
throw new Error(`${prefix} — ${where} ${field} must be a non-empty string or null`);
|
|
1160
|
+
}
|
|
1161
|
+
return value;
|
|
1162
|
+
};
|
|
1163
|
+
return {
|
|
1164
|
+
id: e.id,
|
|
1165
|
+
at: e.at,
|
|
1166
|
+
workflow: e.workflow,
|
|
1167
|
+
kind: e.kind,
|
|
1168
|
+
capability: e.capability,
|
|
1169
|
+
modifier: nullableString('modifier'),
|
|
1170
|
+
step: nullableString('step'),
|
|
1171
|
+
detail: nullableString('detail'),
|
|
1172
|
+
};
|
|
1173
|
+
}
|
|
1174
|
+
/**
|
|
1175
|
+
* Narrow `GET /api/routing_alerts`' 200 body (`{ text, alerts: [...] }`) to a
|
|
1176
|
+
* typed array. An EMPTY array is valid — "this org has recorded no routing
|
|
1177
|
+
* alerts" is a normal, and in fact the desirable, answer.
|
|
1178
|
+
*
|
|
1179
|
+
* **The array is forwarded IN WIRE ORDER and must never be re-sorted.** The
|
|
1180
|
+
* order is meaningful and it is not the same order in both modes: unscoped the
|
|
1181
|
+
* hub returns the org's alerts NEWEST-FIRST (an inbox), while `?workflow=`
|
|
1182
|
+
* scopes to one run AND flips to OLDEST-FIRST (a timeline). A client-side sort
|
|
1183
|
+
* would destroy whichever of the two the operator asked for.
|
|
1184
|
+
*/
|
|
1185
|
+
export function asRoutingAlerts(body) {
|
|
1186
|
+
if (typeof body !== 'object' || body === null || !Array.isArray(body.alerts)) {
|
|
1187
|
+
throw new Error('routing_alerts: malformed response — expected an `alerts` array');
|
|
1188
|
+
}
|
|
1189
|
+
const list = body.alerts;
|
|
1190
|
+
return list.map((entry, i) => asRoutingAlertRow(entry, 'routing_alerts: malformed response', `alerts[${i}]`));
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Narrow `GET /api/run_routing/:wf`'s 200 body. Throws on anything malformed,
|
|
1194
|
+
* naming the offending FIELD or INDEX only — no body value is ever echoed.
|
|
1195
|
+
*
|
|
1196
|
+
* Uses the `malformed success response` wording rather than `malformed
|
|
1197
|
+
* response`, matching `get_status`, the other single-resource GET: a body that
|
|
1198
|
+
* fails here arrived with a 2xx, and saying so distinguishes it from the hub
|
|
1199
|
+
* having refused the request outright.
|
|
1200
|
+
*/
|
|
1201
|
+
export function asRunRouting(body) {
|
|
1202
|
+
const prefix = 'run_routing: malformed success response';
|
|
1203
|
+
if (typeof body !== 'object' || body === null || Array.isArray(body)) {
|
|
1204
|
+
throw new Error(`${prefix} — not an object`);
|
|
1205
|
+
}
|
|
1206
|
+
const b = body;
|
|
1207
|
+
for (const field of ['workflow', 'defName']) {
|
|
1208
|
+
if (typeof b[field] !== 'string' || b[field] === '') {
|
|
1209
|
+
throw new Error(`${prefix} — missing non-empty string ${field}`);
|
|
1210
|
+
}
|
|
1211
|
+
}
|
|
1212
|
+
// ABSENT is legitimate (an unmodified run) and is preserved as absent. `''` is
|
|
1213
|
+
// NOT legitimate — the hub omits the key instead — so it is malformed here
|
|
1214
|
+
// rather than silently normalized to "no modifier".
|
|
1215
|
+
let modifier;
|
|
1216
|
+
if (b.modifier !== undefined) {
|
|
1217
|
+
if (typeof b.modifier !== 'string' || b.modifier === '') {
|
|
1218
|
+
throw new Error(`${prefix} — modifier must be a non-empty string when present`);
|
|
1219
|
+
}
|
|
1220
|
+
modifier = b.modifier;
|
|
1221
|
+
}
|
|
1222
|
+
if (typeof b.waitPolicy !== 'object' || b.waitPolicy === null || Array.isArray(b.waitPolicy)) {
|
|
1223
|
+
throw new Error(`${prefix} — waitPolicy is not an object`);
|
|
1224
|
+
}
|
|
1225
|
+
const waitPolicyWire = b.waitPolicy;
|
|
1226
|
+
if (typeof waitPolicyWire.wait !== 'string' || waitPolicyWire.wait === '') {
|
|
1227
|
+
throw new Error(`${prefix} — waitPolicy missing non-empty string wait`);
|
|
1228
|
+
}
|
|
1229
|
+
const waitPolicy = { wait: waitPolicyWire.wait };
|
|
1230
|
+
if (waitPolicyWire.then !== undefined)
|
|
1231
|
+
waitPolicy.then = waitPolicyWire.then;
|
|
1232
|
+
if (!Array.isArray(b.alerts)) {
|
|
1233
|
+
throw new Error(`${prefix} — missing array alerts`);
|
|
1234
|
+
}
|
|
1235
|
+
const alerts = b.alerts.map((entry, i) => asRoutingAlertRow(entry, prefix, `alerts[${i}]`));
|
|
1236
|
+
// Object-checked and forwarded verbatim — see the interface's doc comment for
|
|
1237
|
+
// why these two are not deep-validated and why their PRESENCE is still required.
|
|
1238
|
+
const joined = (field) => {
|
|
1239
|
+
const value = b[field];
|
|
1240
|
+
if (!Array.isArray(value)) {
|
|
1241
|
+
throw new Error(`${prefix} — missing array ${field}`);
|
|
1242
|
+
}
|
|
1243
|
+
return value.map((entry, i) => {
|
|
1244
|
+
if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {
|
|
1245
|
+
throw new Error(`${prefix} — ${field}[${i}] is not an object`);
|
|
1246
|
+
}
|
|
1247
|
+
return entry;
|
|
1248
|
+
});
|
|
1249
|
+
};
|
|
1250
|
+
return {
|
|
1251
|
+
workflow: b.workflow,
|
|
1252
|
+
defName: b.defName,
|
|
1253
|
+
...(modifier === undefined ? {} : { modifier }),
|
|
1254
|
+
waitPolicy,
|
|
1255
|
+
alerts,
|
|
1256
|
+
resolutionReports: joined('resolutionReports'),
|
|
1257
|
+
escalations: joined('escalations'),
|
|
1258
|
+
};
|
|
1259
|
+
}
|
|
1260
|
+
/**
|
|
1261
|
+
* Validate the four common `CapabilityRerouteWire` fields on one row. `prefix`
|
|
1262
|
+
* is the endpoint-qualified lead-in and `where` names the offending position
|
|
1263
|
+
* (`reroute`, or `reroutes[2]`) — a FIELD/INDEX name only, never a value.
|
|
1264
|
+
*
|
|
1265
|
+
* No field here is nullable: unlike a capability route, a reroute rule names no
|
|
1266
|
+
* crew, so it has no dangling case to represent.
|
|
1267
|
+
*/
|
|
1268
|
+
function asCapabilityRerouteRow(entry, prefix, where) {
|
|
1269
|
+
if (typeof entry !== 'object' || entry === null) {
|
|
1270
|
+
throw new Error(`${prefix} — ${where} is not an object`);
|
|
1271
|
+
}
|
|
1272
|
+
const e = entry;
|
|
1273
|
+
for (const field of ['capability', 'target']) {
|
|
1274
|
+
if (typeof e[field] !== 'string' || e[field] === '') {
|
|
1275
|
+
throw new Error(`${prefix} — ${where} missing non-empty string ${field}`);
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
for (const field of ['position', 'createdAt']) {
|
|
1279
|
+
if (typeof e[field] !== 'number') {
|
|
1280
|
+
throw new Error(`${prefix} — ${where} missing number ${field}`);
|
|
1281
|
+
}
|
|
1282
|
+
}
|
|
1283
|
+
return {
|
|
1284
|
+
capability: e.capability,
|
|
1285
|
+
target: e.target,
|
|
1286
|
+
position: e.position,
|
|
1287
|
+
createdAt: e.createdAt,
|
|
1288
|
+
};
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* Narrow `GET /api/capability_reroutes`' 200 body (`{ text, reroutes: [...] }`)
|
|
1292
|
+
* to a typed array. An EMPTY array is valid — "this org has configured no
|
|
1293
|
+
* reroute rules", which is the default and correct state for most orgs.
|
|
1294
|
+
*
|
|
1295
|
+
* THE ARRAY KEY IS `reroutes`. It is neither `bindings` (what the sibling
|
|
1296
|
+
* `capability_routes` endpoint uses) nor `rules` (what the feature is called in
|
|
1297
|
+
* prose). Guessing that key is precisely how `capability list` shipped broken
|
|
1298
|
+
* TWICE — see `asCapabilityRoutes` — so it is copied from
|
|
1299
|
+
* `hub-core/src/verbs/list-capability-reroutes.ts` rather than inferred.
|
|
1300
|
+
*
|
|
1301
|
+
* **Rows arrive in the order the hub TRIES them** (`capability`, then
|
|
1302
|
+
* `position`, then `target`) and are forwarded exactly as received. The order is
|
|
1303
|
+
* SEMANTIC: it is the sequence in which a source's targets are attempted.
|
|
1304
|
+
* Re-sorting it — in this function, in a caller, or in a test fixture — would
|
|
1305
|
+
* silently misreport which substitution happens first.
|
|
1306
|
+
*/
|
|
1307
|
+
export function asCapabilityReroutes(body) {
|
|
1308
|
+
if (typeof body !== 'object' || body === null || !Array.isArray(body.reroutes)) {
|
|
1309
|
+
throw new Error('capability_reroutes: malformed response — expected a `reroutes` array');
|
|
1310
|
+
}
|
|
1311
|
+
const list = body.reroutes;
|
|
1312
|
+
return list.map((entry, i) => asCapabilityRerouteRow(entry, 'capability_reroutes: malformed response', `reroutes[${i}]`));
|
|
1313
|
+
}
|
|
1314
|
+
/**
|
|
1315
|
+
* Narrow `POST /api/add_capability_reroute`'s 200 body
|
|
1316
|
+
* (`{ text, reroute, alreadyPresent, ruleCount }`), naming the offending field
|
|
1317
|
+
* only — the same discipline as `asCapabilityRouteAdded`.
|
|
1318
|
+
*
|
|
1319
|
+
* There is no layered non-null check here of the kind `asCapabilityRouteAdded`
|
|
1320
|
+
* applies to `binding.crewName`: a reroute row has no nullable field, because it
|
|
1321
|
+
* resolves no crew.
|
|
1322
|
+
*/
|
|
1323
|
+
export function asCapabilityRerouteAdded(body) {
|
|
1324
|
+
const prefix = 'add_capability_reroute: malformed success response';
|
|
1325
|
+
if (typeof body !== 'object' || body === null) {
|
|
1326
|
+
throw new Error(`${prefix} — not an object`);
|
|
1327
|
+
}
|
|
1328
|
+
const b = body;
|
|
1329
|
+
if (b.reroute === undefined) {
|
|
1330
|
+
throw new Error(`${prefix} — missing reroute`);
|
|
1331
|
+
}
|
|
1332
|
+
const reroute = asCapabilityRerouteRow(b.reroute, prefix, 'reroute');
|
|
1333
|
+
if (typeof b.alreadyPresent !== 'boolean') {
|
|
1334
|
+
throw new Error(`${prefix} — missing boolean alreadyPresent`);
|
|
1335
|
+
}
|
|
1336
|
+
if (typeof b.ruleCount !== 'number') {
|
|
1337
|
+
throw new Error(`${prefix} — missing number ruleCount`);
|
|
1338
|
+
}
|
|
1339
|
+
return { reroute, alreadyPresent: b.alreadyPresent, ruleCount: b.ruleCount };
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1342
|
+
* Narrow `POST /api/remove_capability_reroute`'s 200 body
|
|
1343
|
+
* (`{ text, capability, target, removed, remainingTargets }`).
|
|
1344
|
+
*
|
|
1345
|
+
* `removed` must be a BOOLEAN — this guard is how the CLI proves the 2xx really
|
|
1346
|
+
* was the remove verb's answer. BOTH values are deliberate hub responses:
|
|
1347
|
+
* - `true` — the `(capability, target)` rule existed and is now gone;
|
|
1348
|
+
* - `false` — there was no such rule, so there was nothing to do. The hub
|
|
1349
|
+
* answers 200, never a 404 (the same tolerance `remove_capability_route`
|
|
1350
|
+
* has), and that is what makes `routing rule rm` idempotent.
|
|
1351
|
+
*
|
|
1352
|
+
* `remainingTargets` is deliberately STRICT — PRESENT, an array, and every
|
|
1353
|
+
* element a non-empty string. This is the identical asymmetry argued at
|
|
1354
|
+
* `asCapabilityRouteRemoved`: defaulting an absent array to `[]` would assert
|
|
1355
|
+
* "this capability now HOLDS whenever it is unbound" — the alarming reading, and
|
|
1356
|
+
* exactly the signal an operator acts on — off a malformed body. Unlike the
|
|
1357
|
+
* capability-route family there is no nullable field to balance it against, so
|
|
1358
|
+
* every field here is strict.
|
|
1359
|
+
*
|
|
1360
|
+
* The stdout shape built from this is documented in `docs/cli.md` under Routing.
|
|
1361
|
+
*/
|
|
1362
|
+
export function asCapabilityRerouteRemoved(body) {
|
|
1363
|
+
const prefix = 'remove_capability_reroute: malformed success response';
|
|
1364
|
+
if (typeof body !== 'object' || body === null) {
|
|
1365
|
+
throw new Error(`${prefix} — not an object`);
|
|
1366
|
+
}
|
|
1367
|
+
const b = body;
|
|
1368
|
+
if (typeof b.removed !== 'boolean') {
|
|
1369
|
+
throw new Error(`${prefix} — missing boolean removed`);
|
|
1370
|
+
}
|
|
1371
|
+
for (const field of ['capability', 'target']) {
|
|
1372
|
+
if (typeof b[field] !== 'string' || b[field] === '') {
|
|
1373
|
+
throw new Error(`${prefix} — missing non-empty string ${field}`);
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
if (!Array.isArray(b.remainingTargets)) {
|
|
1377
|
+
throw new Error(`${prefix} — missing array remainingTargets`);
|
|
1378
|
+
}
|
|
1379
|
+
const remainingTargets = b.remainingTargets.map((entry, i) => {
|
|
1380
|
+
if (typeof entry !== 'string' || entry === '') {
|
|
1381
|
+
throw new Error(`${prefix} — remainingTargets[${i}] is not a non-empty string`);
|
|
1382
|
+
}
|
|
1383
|
+
return entry;
|
|
1384
|
+
});
|
|
1385
|
+
return { capability: b.capability, target: b.target, removed: b.removed, remainingTargets };
|
|
1386
|
+
}
|
|
1127
1387
|
/**
|
|
1128
1388
|
* The `orphan:` prefix the hub uses to name its reserved orphan crew
|
|
1129
1389
|
* (`packages/hub-core/src/crews-table.ts` / `verbs/manage-crews.ts`). Mirrored
|
package/dist/src/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export { CallsPinError, Engine, ModifierRefusalError } from './engine.ts';
|
|
15
15
|
export type { CommitResult, CreateOpts, DefResolver, DeferredFiring, DeferredReason, EmitResult, EngineEvent, EngineListener, EngineWorkflowStatus, Order, ReapDetail, ReapReason, TickResult, } from './engine.ts';
|
|
16
|
-
export { capabilityName, claimMatches, composeCapabilities, DEFAULT_MATCH_MODE, MODIFIER_SEPARATOR, } from './capabilities.ts';
|
|
17
|
-
export type { MatchMode } from './capabilities.ts';
|
|
16
|
+
export { applyCapabilityRewrites, capabilityName, claimMatches, composeCapabilities, DEFAULT_MATCH_MODE, MODIFIER_SEPARATOR, } from './capabilities.ts';
|
|
17
|
+
export type { CapabilityRewrites, MatchMode } from './capabilities.ts';
|
|
18
18
|
export { createEngine } from './factory.ts';
|
|
19
19
|
export type { CreateEngineOpts, CreatedEngine } from './factory.ts';
|
|
20
20
|
export { createDefInstructionSource, defInstructionDigest, OrderResolver, substituteOrderVars, UnknownDefDigestError, UnknownInstructionError, } from './order-resolver.ts';
|
package/dist/src/index.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
export { CallsPinError, Engine, ModifierRefusalError } from "./engine.js";
|
|
15
15
|
// Routing capabilities: offer-time composition and the claim-side match. The
|
|
16
16
|
// hub imports these to reason about the same compounds the engine composes.
|
|
17
|
-
export { capabilityName, claimMatches, composeCapabilities, DEFAULT_MATCH_MODE, MODIFIER_SEPARATOR, } from "./capabilities.js";
|
|
17
|
+
export { applyCapabilityRewrites, capabilityName, claimMatches, composeCapabilities, DEFAULT_MATCH_MODE, MODIFIER_SEPARATOR, } from "./capabilities.js";
|
|
18
18
|
export { createEngine } from "./factory.js";
|
|
19
19
|
export { createDefInstructionSource, defInstructionDigest, OrderResolver, substituteOrderVars, UnknownDefDigestError, UnknownInstructionError, } from "./order-resolver.js";
|
|
20
20
|
export { Store, openStore, StoreVersionError } from "./store.js";
|
|
@@ -590,6 +590,14 @@ export declare const WIRE_SCHEMAS: {
|
|
|
590
590
|
minLength: number;
|
|
591
591
|
};
|
|
592
592
|
};
|
|
593
|
+
reroutedFrom: {
|
|
594
|
+
type: string;
|
|
595
|
+
description: string;
|
|
596
|
+
items: {
|
|
597
|
+
type: string;
|
|
598
|
+
minLength: number;
|
|
599
|
+
};
|
|
600
|
+
};
|
|
593
601
|
modifier: {
|
|
594
602
|
type: string;
|
|
595
603
|
minLength: number;
|
|
@@ -113,7 +113,12 @@
|
|
|
113
113
|
"cause": { "type": "string", "enum": ["inputsGreen", "allGreen", "idle"] },
|
|
114
114
|
"capabilities": {
|
|
115
115
|
"type": "array",
|
|
116
|
-
"description": "The composed routing capabilities this order was offered under: each authored step capability, suffixed ':<modifier>' where a modifier applied. A snapshot of the offer — a claimed order is never recomposed.",
|
|
116
|
+
"description": "The composed routing capabilities this order was offered under: each authored step capability, suffixed ':<modifier>' where a modifier applied. A snapshot of the offer — a claimed order is never recomposed. When 'reroutedFrom' is present this holds the reroute target instead, because this is the capability actually being served.",
|
|
117
|
+
"items": { "type": "string", "minLength": 1 }
|
|
118
|
+
},
|
|
119
|
+
"reroutedFrom": {
|
|
120
|
+
"type": "array",
|
|
121
|
+
"description": "The composed capabilities this order WOULD have been offered under, present only when a reroute rule substituted something else into 'capabilities'. Absent on every ordinary offer, so its presence is itself the signal that the order is not running on the capability its definition asked for.",
|
|
117
122
|
"items": { "type": "string", "minLength": 1 }
|
|
118
123
|
},
|
|
119
124
|
"modifier": {
|
|
@@ -30,7 +30,7 @@ function resolvePolicyValue(env, explicit, envKey, settingsKey, label) {
|
|
|
30
30
|
}
|
|
31
31
|
return envValue;
|
|
32
32
|
}
|
|
33
|
-
// A missing HOME
|
|
33
|
+
// A missing HOME means there is no settings file to read;
|
|
34
34
|
// the built-in default remains usable. Any other settings read/parse error is
|
|
35
35
|
// surfaced rather than weakened into the least restrictive policy.
|
|
36
36
|
let path;
|
package/dist/src/types.d.ts
CHANGED
|
@@ -172,8 +172,25 @@ export interface Order {
|
|
|
172
172
|
* value the shift's settings map is keyed by. It is a snapshot of the offer:
|
|
173
173
|
* an already-claimed order is never recomposed, so re-reading it later
|
|
174
174
|
* always shows what the claim was actually judged on.
|
|
175
|
+
*
|
|
176
|
+
* When `reroutedFrom` is present this field holds the REROUTE TARGET, not
|
|
177
|
+
* what the def composed. That is deliberate: this is the capability being
|
|
178
|
+
* served, so it is the one a shift must resolve its model against.
|
|
175
179
|
*/
|
|
176
180
|
capabilities?: string[];
|
|
181
|
+
/**
|
|
182
|
+
* The composed capabilities this order WOULD have been offered under, present
|
|
183
|
+
* only when a caller-supplied reroute rule substituted something else into
|
|
184
|
+
* `capabilities` above.
|
|
185
|
+
*
|
|
186
|
+
* Absent on every ordinary offer, so its presence is itself the signal that
|
|
187
|
+
* the order is not running on the capability its def asked for. Kept separate
|
|
188
|
+
* from `capabilities` rather than replacing it because both facts are true at
|
|
189
|
+
* once and an operator needs each for a different question: `capabilities`
|
|
190
|
+
* answers "what is serving this", `reroutedFrom` answers "what did we ask
|
|
191
|
+
* for". A single field could only ever answer one.
|
|
192
|
+
*/
|
|
193
|
+
reroutedFrom?: string[];
|
|
177
194
|
/**
|
|
178
195
|
* The modifier this order was composed with. Normally the run's modifier;
|
|
179
196
|
* on an escalated re-offer, the step's escalation target instead (the run's
|
|
@@ -189,10 +206,13 @@ export interface Order {
|
|
|
189
206
|
*
|
|
190
207
|
* The engine decides the transition; this flag is how the decision reaches
|
|
191
208
|
* the layer that acts on it, instead of that layer re-deriving it by
|
|
192
|
-
* diffing `modifier` against the run record.
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
209
|
+
* diffing `modifier` against the run record. A brief reads it to tell the
|
|
210
|
+
* worker it is on the recovery path.
|
|
211
|
+
*
|
|
212
|
+
* An escalated offer gets NO special wait or fallback treatment. It routes by
|
|
213
|
+
* exactly the same rules as any other offer, because "this run is recovering"
|
|
214
|
+
* is not evidence that its operator wants a lower grade of service — see
|
|
215
|
+
* `wait-policy.ts` in the hub.
|
|
196
216
|
*/
|
|
197
217
|
escalated?: true;
|
|
198
218
|
/** Opaque config object for a non-agent/non-command worker type (or
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* into the execution-side settings file.
|
|
4
4
|
*
|
|
5
5
|
* `owenloop work` reads its settings from `$OWENLOOP_CONFIG_DIR/settings.json`
|
|
6
|
-
* (else `$
|
|
7
|
-
* `$HOME/.config/owenloop/settings.json`) and, by design,
|
|
6
|
+
* (else `$HOME/.owenloop/settings.json`) and, by design,
|
|
8
7
|
* NEVER writes them — the root CLI's `setup` command is the writer, so a fresh
|
|
9
8
|
* `owenloop setup` can point `owenloop work` at the hub it just authenticated
|
|
10
9
|
* against.
|
|
@@ -26,8 +25,7 @@
|
|
|
26
25
|
/**
|
|
27
26
|
* The execution settings file path for this environment, through the one shared
|
|
28
27
|
* ladder in `config-dir.ts`: `OWENLOOP_CONFIG_DIR` (absolute, used verbatim)
|
|
29
|
-
* wins over `$
|
|
30
|
-
* `$HOME/.config/owenloop`. Throws as a `CliError` when no rung yields a value,
|
|
28
|
+
* wins over `$HOME/.owenloop`. Throws as a `CliError` when no rung yields a value,
|
|
31
29
|
* so the CLI reports it as an operator error rather than a crash.
|
|
32
30
|
*/
|
|
33
31
|
export declare function owenloopSettingsPath(env: Record<string, string | undefined>): string;
|
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
* into the execution-side settings file.
|
|
4
4
|
*
|
|
5
5
|
* `owenloop work` reads its settings from `$OWENLOOP_CONFIG_DIR/settings.json`
|
|
6
|
-
* (else `$
|
|
7
|
-
* `$HOME/.config/owenloop/settings.json`) and, by design,
|
|
6
|
+
* (else `$HOME/.owenloop/settings.json`) and, by design,
|
|
8
7
|
* NEVER writes them — the root CLI's `setup` command is the writer, so a fresh
|
|
9
8
|
* `owenloop setup` can point `owenloop work` at the hub it just authenticated
|
|
10
9
|
* against.
|
|
@@ -31,8 +30,7 @@ import { CliError } from "./util.js";
|
|
|
31
30
|
/**
|
|
32
31
|
* The execution settings file path for this environment, through the one shared
|
|
33
32
|
* ladder in `config-dir.ts`: `OWENLOOP_CONFIG_DIR` (absolute, used verbatim)
|
|
34
|
-
* wins over `$
|
|
35
|
-
* `$HOME/.config/owenloop`. Throws as a `CliError` when no rung yields a value,
|
|
33
|
+
* wins over `$HOME/.owenloop`. Throws as a `CliError` when no rung yields a value,
|
|
36
34
|
* so the CLI reports it as an operator error rather than a crash.
|
|
37
35
|
*/
|
|
38
36
|
export function owenloopSettingsPath(env) {
|
package/docs/agent-runner.md
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
`owenloop work agent-run` is the only supported dispatcher for workflow Step Agents. The Shift daemon starts `agent-run` children for agent orders. Plugins and skills supervise the Shift daemon; plugins do not package or dispatch a static workflow-worker agent.
|
|
4
4
|
|
|
5
|
-
The runtime worker resolves the verified workflow definition from the local workflow store, selects the final harness after
|
|
5
|
+
The runtime worker resolves the verified workflow definition from the local workflow store, selects the final harness after crew-roster selection and any CLI debug override, and runs permission preflight before either a cold start or a resume. A policy refusal starts no model SDK, CLI, or app-server process. The worker prints every refusal reason, releases the held claim, and exits non-zero.
|
|
6
6
|
|
|
7
|
-
Runtime preflight is authoritative. `owenloop work lint` runs the same common and adapter checks for author feedback, but lint cannot account for a later `--harness` or
|
|
7
|
+
Runtime preflight is authoritative. `owenloop work lint` runs the same common and adapter checks for author feedback, but lint cannot account for a later `--harness` override or a selected crew-roster candidate.
|
|
8
8
|
|
|
9
9
|
Native judge entries do not carry a separately authored `x` map. The definition
|
|
10
10
|
compiler deep-clones the producer step's complete parsed `x` map onto every
|
package/docs/bundles.md
CHANGED
|
@@ -292,7 +292,9 @@ shift. See [`docs/shift-logs.md`](shift-logs.md) for the directory layout,
|
|
|
292
292
|
|
|
293
293
|
The receipt still does not carry the warning, and that is by design rather than
|
|
294
294
|
a gap: the receipt captures the **command's** streams, and this warning is the
|
|
295
|
-
**exec worker's** own.
|
|
295
|
+
**exec worker's** own. The reverse is not symmetric: the worker also relays the
|
|
296
|
+
command's captured tail into its own output, so a command's last 4 KiB appears
|
|
297
|
+
in both the receipt and `<run>.log`. See [docs/shift-logs.md](shift-logs.md).
|
|
296
298
|
|
|
297
299
|
Two consequences worth stating separately:
|
|
298
300
|
|