@exaudeus/workrail 3.25.0 → 3.26.0
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/dist/cli/commands/index.d.ts +5 -0
- package/dist/cli/commands/index.js +12 -1
- package/dist/cli/commands/worktrain-await.d.ts +35 -0
- package/dist/cli/commands/worktrain-await.js +207 -0
- package/dist/cli/commands/worktrain-inbox.d.ts +23 -0
- package/dist/cli/commands/worktrain-inbox.js +82 -0
- package/dist/cli/commands/worktrain-init.d.ts +23 -0
- package/dist/cli/commands/worktrain-init.js +338 -0
- package/dist/cli/commands/worktrain-spawn.d.ts +28 -0
- package/dist/cli/commands/worktrain-spawn.js +106 -0
- package/dist/cli/commands/worktrain-tell.d.ts +25 -0
- package/dist/cli/commands/worktrain-tell.js +32 -0
- package/dist/cli-worktrain.d.ts +2 -0
- package/dist/cli-worktrain.js +169 -0
- package/dist/cli.js +13 -3
- package/dist/config/config-file.d.ts +2 -0
- package/dist/config/config-file.js +55 -0
- package/dist/daemon/agent-loop.d.ts +90 -0
- package/dist/daemon/agent-loop.js +214 -0
- package/dist/daemon/pi-mono-loader.d.ts +0 -5
- package/dist/daemon/pi-mono-loader.js +0 -64
- package/dist/daemon/soul-template.d.ts +2 -0
- package/dist/daemon/soul-template.js +22 -0
- package/dist/daemon/workflow-runner.d.ts +24 -2
- package/dist/daemon/workflow-runner.js +235 -119
- package/dist/manifest.json +147 -51
- package/dist/mcp/output-schemas.d.ts +154 -154
- package/dist/mcp/transports/bridge-entry.js +20 -2
- package/dist/mcp/transports/bridge-events.d.ts +34 -0
- package/dist/mcp/transports/bridge-events.js +24 -0
- package/dist/mcp/transports/fatal-exit.d.ts +5 -0
- package/dist/mcp/transports/fatal-exit.js +82 -0
- package/dist/mcp/transports/http-entry.js +3 -0
- package/dist/mcp/transports/stdio-entry.js +3 -7
- package/dist/mcp/v2/tools.d.ts +7 -7
- package/dist/trigger/delivery-action.d.ts +37 -0
- package/dist/trigger/delivery-action.js +204 -0
- package/dist/trigger/delivery-client.d.ts +11 -0
- package/dist/trigger/delivery-client.js +27 -0
- package/dist/trigger/trigger-listener.d.ts +2 -0
- package/dist/trigger/trigger-listener.js +12 -2
- package/dist/trigger/trigger-router.d.ts +8 -2
- package/dist/trigger/trigger-router.js +164 -6
- package/dist/trigger/trigger-store.d.ts +11 -3
- package/dist/trigger/trigger-store.js +254 -13
- package/dist/trigger/types.d.ts +24 -0
- package/dist/trigger/types.js +4 -0
- package/dist/v2/durable-core/schemas/execution-snapshot/blocked-snapshot.d.ts +22 -22
- package/dist/v2/durable-core/schemas/execution-snapshot/execution-snapshot.v1.d.ts +114 -114
- package/dist/v2/durable-core/schemas/export-bundle/index.d.ts +454 -454
- package/dist/v2/durable-core/schemas/session/blockers.d.ts +14 -14
- package/dist/v2/durable-core/schemas/session/events.d.ts +93 -93
- package/dist/v2/durable-core/schemas/session/gaps.d.ts +2 -2
- package/dist/v2/durable-core/schemas/session/validation-event.d.ts +4 -4
- package/dist/v2/usecases/console-routes.js +33 -3
- package/package.json +6 -4
- package/spec/workflow-tags.json +1 -0
- package/workflows/classify-task-workflow.json +68 -0
- package/workflows/coding-task-workflow-agentic.lean.v2.json +43 -13
|
@@ -36,11 +36,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.loadTriggerConfig = loadTriggerConfig;
|
|
37
37
|
exports.loadTriggerConfigFromFile = loadTriggerConfigFromFile;
|
|
38
38
|
exports.buildTriggerIndex = buildTriggerIndex;
|
|
39
|
+
const os = __importStar(require("node:os"));
|
|
39
40
|
const path = __importStar(require("node:path"));
|
|
40
41
|
const fs = __importStar(require("node:fs/promises"));
|
|
41
42
|
const result_js_1 = require("../runtime/result.js");
|
|
42
43
|
const types_js_1 = require("./types.js");
|
|
43
|
-
const SUPPORTED_PROVIDERS = new Set(['generic']);
|
|
44
|
+
const SUPPORTED_PROVIDERS = new Set(['generic', 'gitlab_poll']);
|
|
44
45
|
function unquoteYamlScalar(raw) {
|
|
45
46
|
const s = raw.trim();
|
|
46
47
|
if ((s.startsWith('"') && s.endsWith('"')) ||
|
|
@@ -210,6 +211,10 @@ function parseTriggersYaml(content) {
|
|
|
210
211
|
return acValueResult;
|
|
211
212
|
if (acKey === 'model')
|
|
212
213
|
agentConfig.model = acValueResult.value;
|
|
214
|
+
else if (acKey === 'maxSessionMinutes')
|
|
215
|
+
agentConfig.maxSessionMinutes = acValueResult.value;
|
|
216
|
+
else if (acKey === 'maxTurns')
|
|
217
|
+
agentConfig.maxTurns = acValueResult.value;
|
|
213
218
|
}
|
|
214
219
|
lineIndex++;
|
|
215
220
|
}
|
|
@@ -263,6 +268,59 @@ function parseTriggersYaml(content) {
|
|
|
263
268
|
trigger.onComplete = onComplete;
|
|
264
269
|
continue;
|
|
265
270
|
}
|
|
271
|
+
if (key === 'source') {
|
|
272
|
+
lineIndex++;
|
|
273
|
+
const source = {};
|
|
274
|
+
while (lineIndex < lines.length) {
|
|
275
|
+
const srcLine = lines[lineIndex];
|
|
276
|
+
if (srcLine === undefined)
|
|
277
|
+
break;
|
|
278
|
+
const srcTrimmed = srcLine.trim();
|
|
279
|
+
if (srcTrimmed === '' || srcTrimmed.startsWith('#')) {
|
|
280
|
+
lineIndex++;
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
const srcIndent = srcLine.search(/\S/);
|
|
284
|
+
if (srcIndent <= lineIndent)
|
|
285
|
+
break;
|
|
286
|
+
const srcColonIdx = srcTrimmed.indexOf(':');
|
|
287
|
+
if (srcColonIdx === -1) {
|
|
288
|
+
return (0, result_js_1.err)({
|
|
289
|
+
kind: 'parse_error',
|
|
290
|
+
message: `Missing colon in source entry at line ${lineIndex + 1}: "${srcTrimmed}"`,
|
|
291
|
+
lineNumber: lineIndex + 1,
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
const srcKey = srcTrimmed.slice(0, srcColonIdx).trim();
|
|
295
|
+
const srcRawValue = srcTrimmed.slice(srcColonIdx + 1).trim();
|
|
296
|
+
if (srcRawValue !== '') {
|
|
297
|
+
const srcValueResult = parseScalar(srcRawValue, lineIndex + 1);
|
|
298
|
+
if (srcValueResult.kind === 'err')
|
|
299
|
+
return srcValueResult;
|
|
300
|
+
switch (srcKey) {
|
|
301
|
+
case 'baseUrl':
|
|
302
|
+
source.baseUrl = srcValueResult.value;
|
|
303
|
+
break;
|
|
304
|
+
case 'projectId':
|
|
305
|
+
source.projectId = srcValueResult.value;
|
|
306
|
+
break;
|
|
307
|
+
case 'token':
|
|
308
|
+
source.token = srcValueResult.value;
|
|
309
|
+
break;
|
|
310
|
+
case 'events':
|
|
311
|
+
source.events = srcValueResult.value;
|
|
312
|
+
break;
|
|
313
|
+
case 'pollIntervalSeconds':
|
|
314
|
+
source.pollIntervalSeconds = srcValueResult.value;
|
|
315
|
+
break;
|
|
316
|
+
default: break;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
lineIndex++;
|
|
320
|
+
}
|
|
321
|
+
trigger.source = source;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
266
324
|
if (rawValue === '') {
|
|
267
325
|
lineIndex++;
|
|
268
326
|
continue;
|
|
@@ -303,10 +361,31 @@ function setTriggerField(trigger, key, value) {
|
|
|
303
361
|
case 'referenceUrls':
|
|
304
362
|
trigger.referenceUrls = value;
|
|
305
363
|
break;
|
|
364
|
+
case 'concurrencyMode':
|
|
365
|
+
trigger.concurrencyMode = value;
|
|
366
|
+
break;
|
|
367
|
+
case 'callbackUrl':
|
|
368
|
+
trigger.callbackUrl = value;
|
|
369
|
+
break;
|
|
370
|
+
case 'autoCommit':
|
|
371
|
+
trigger.autoCommit = value;
|
|
372
|
+
break;
|
|
373
|
+
case 'autoOpenPR':
|
|
374
|
+
trigger.autoOpenPR = value;
|
|
375
|
+
break;
|
|
376
|
+
case 'workspaceName':
|
|
377
|
+
trigger.workspaceName = value;
|
|
378
|
+
break;
|
|
379
|
+
case 'soulFile':
|
|
380
|
+
trigger.soulFile = value;
|
|
381
|
+
break;
|
|
306
382
|
default:
|
|
307
383
|
break;
|
|
308
384
|
}
|
|
309
385
|
}
|
|
386
|
+
function expandTildePath(p) {
|
|
387
|
+
return p.startsWith('~/') ? path.join(os.homedir(), p.slice(2)) : p;
|
|
388
|
+
}
|
|
310
389
|
function resolveSecret(value, triggerId, env) {
|
|
311
390
|
if (!value.startsWith('$')) {
|
|
312
391
|
return (0, result_js_1.ok)(value);
|
|
@@ -327,7 +406,7 @@ function assembleContextMapping(raw) {
|
|
|
327
406
|
}));
|
|
328
407
|
return { mappings };
|
|
329
408
|
}
|
|
330
|
-
function validateAndResolveTrigger(raw, env) {
|
|
409
|
+
function validateAndResolveTrigger(raw, env, workspaces = {}) {
|
|
331
410
|
const rawId = raw.id?.trim() ?? '';
|
|
332
411
|
if (!rawId) {
|
|
333
412
|
return (0, result_js_1.err)({ kind: 'missing_field', field: 'id', triggerId: '(unknown)' });
|
|
@@ -335,7 +414,6 @@ function validateAndResolveTrigger(raw, env) {
|
|
|
335
414
|
const requiredStringFields = [
|
|
336
415
|
'provider',
|
|
337
416
|
'workflowId',
|
|
338
|
-
'workspacePath',
|
|
339
417
|
'goal',
|
|
340
418
|
];
|
|
341
419
|
for (const field of requiredStringFields) {
|
|
@@ -348,6 +426,52 @@ function validateAndResolveTrigger(raw, env) {
|
|
|
348
426
|
if (!SUPPORTED_PROVIDERS.has(provider)) {
|
|
349
427
|
return (0, result_js_1.err)({ kind: 'unknown_provider', provider, triggerId: rawId });
|
|
350
428
|
}
|
|
429
|
+
let resolvedWorkspacePath;
|
|
430
|
+
let resolvedWorkspaceName;
|
|
431
|
+
let resolvedSoulFile;
|
|
432
|
+
const rawWorkspaceName = raw.workspaceName?.trim();
|
|
433
|
+
const rawWorkspacePath = raw.workspacePath?.trim();
|
|
434
|
+
const rawSoulFile = raw.soulFile?.trim();
|
|
435
|
+
if (rawWorkspaceName) {
|
|
436
|
+
if (!/^[a-zA-Z0-9_-]+$/.test(rawWorkspaceName)) {
|
|
437
|
+
return (0, result_js_1.err)({
|
|
438
|
+
kind: 'invalid_field_value',
|
|
439
|
+
field: `workspaceName (must match ^[a-zA-Z0-9_-]+$, got: "${rawWorkspaceName}")`,
|
|
440
|
+
triggerId: rawId,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
443
|
+
const workspaceConfig = workspaces[rawWorkspaceName];
|
|
444
|
+
if (!workspaceConfig) {
|
|
445
|
+
return (0, result_js_1.err)({ kind: 'unknown_workspace', workspaceName: rawWorkspaceName, triggerId: rawId });
|
|
446
|
+
}
|
|
447
|
+
if (!path.isAbsolute(workspaceConfig.path)) {
|
|
448
|
+
return (0, result_js_1.err)({
|
|
449
|
+
kind: 'invalid_field_value',
|
|
450
|
+
field: `workspace "${rawWorkspaceName}".path (must be absolute, got: "${workspaceConfig.path}")`,
|
|
451
|
+
triggerId: rawId,
|
|
452
|
+
});
|
|
453
|
+
}
|
|
454
|
+
if (rawWorkspacePath) {
|
|
455
|
+
console.warn(`[TriggerStore] WARNING: trigger "${rawId}" has both workspaceName and workspacePath. ` +
|
|
456
|
+
`workspaceName takes precedence; workspacePath "${rawWorkspacePath}" is ignored.`);
|
|
457
|
+
}
|
|
458
|
+
resolvedWorkspacePath = workspaceConfig.path;
|
|
459
|
+
resolvedWorkspaceName = (0, types_js_1.asWorkspaceName)(rawWorkspaceName);
|
|
460
|
+
resolvedSoulFile = rawSoulFile ?? workspaceConfig.soulFile;
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
if (!rawWorkspacePath) {
|
|
464
|
+
return (0, result_js_1.err)({ kind: 'missing_field', field: 'workspacePath', triggerId: rawId });
|
|
465
|
+
}
|
|
466
|
+
resolvedWorkspacePath = rawWorkspacePath;
|
|
467
|
+
resolvedSoulFile = rawSoulFile;
|
|
468
|
+
}
|
|
469
|
+
if (resolvedSoulFile) {
|
|
470
|
+
resolvedSoulFile = expandTildePath(resolvedSoulFile);
|
|
471
|
+
}
|
|
472
|
+
if (resolvedSoulFile && !path.isAbsolute(resolvedSoulFile)) {
|
|
473
|
+
return (0, result_js_1.err)({ kind: 'invalid_field_value', field: 'soulFile', triggerId: rawId });
|
|
474
|
+
}
|
|
351
475
|
let hmacSecret;
|
|
352
476
|
if (raw.hmacSecret?.trim()) {
|
|
353
477
|
const secretResult = resolveSecret(raw.hmacSecret.trim(), rawId, env);
|
|
@@ -365,17 +489,72 @@ function validateAndResolveTrigger(raw, env) {
|
|
|
365
489
|
try {
|
|
366
490
|
const parsed = new URL(url);
|
|
367
491
|
if (parsed.protocol !== 'https:' && parsed.protocol !== 'http:') {
|
|
368
|
-
return (0, result_js_1.err)({ kind: '
|
|
492
|
+
return (0, result_js_1.err)({ kind: 'invalid_field_value', field: `referenceUrls (non-HTTP URL rejected: ${url})`, triggerId: raw.id ?? '?' });
|
|
369
493
|
}
|
|
370
494
|
}
|
|
371
495
|
catch {
|
|
372
|
-
return (0, result_js_1.err)({ kind: '
|
|
496
|
+
return (0, result_js_1.err)({ kind: 'invalid_field_value', field: `referenceUrls (invalid URL: ${url})`, triggerId: raw.id ?? '?' });
|
|
373
497
|
}
|
|
374
498
|
}
|
|
375
499
|
}
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
500
|
+
let callbackUrl;
|
|
501
|
+
if (raw.callbackUrl?.trim()) {
|
|
502
|
+
const rawCb = raw.callbackUrl.trim();
|
|
503
|
+
try {
|
|
504
|
+
const parsedCb = new URL(rawCb);
|
|
505
|
+
if (parsedCb.protocol !== 'https:' && parsedCb.protocol !== 'http:') {
|
|
506
|
+
return (0, result_js_1.err)({ kind: 'invalid_field_value', field: `callbackUrl (non-HTTP URL rejected: ${rawCb})`, triggerId: rawId });
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
catch {
|
|
510
|
+
return (0, result_js_1.err)({ kind: 'invalid_field_value', field: `callbackUrl (invalid URL: ${rawCb})`, triggerId: rawId });
|
|
511
|
+
}
|
|
512
|
+
callbackUrl = rawCb;
|
|
513
|
+
}
|
|
514
|
+
let agentConfig;
|
|
515
|
+
if (raw.agentConfig) {
|
|
516
|
+
const model = raw.agentConfig.model?.trim() || undefined;
|
|
517
|
+
let maxSessionMinutes;
|
|
518
|
+
if (raw.agentConfig.maxSessionMinutes !== undefined) {
|
|
519
|
+
const asNumber = Number(raw.agentConfig.maxSessionMinutes);
|
|
520
|
+
if (!Number.isInteger(asNumber) || asNumber <= 0) {
|
|
521
|
+
return (0, result_js_1.err)({
|
|
522
|
+
kind: 'invalid_field_value',
|
|
523
|
+
field: 'agentConfig.maxSessionMinutes (must be a positive integer)',
|
|
524
|
+
triggerId: rawId,
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
maxSessionMinutes = asNumber;
|
|
528
|
+
}
|
|
529
|
+
let maxTurns;
|
|
530
|
+
if (raw.agentConfig.maxTurns !== undefined) {
|
|
531
|
+
const asNumber = Number(raw.agentConfig.maxTurns);
|
|
532
|
+
if (!Number.isInteger(asNumber) || asNumber <= 0) {
|
|
533
|
+
return (0, result_js_1.err)({
|
|
534
|
+
kind: 'invalid_field_value',
|
|
535
|
+
field: 'agentConfig.maxTurns (must be a positive integer)',
|
|
536
|
+
triggerId: rawId,
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
maxTurns = asNumber;
|
|
540
|
+
}
|
|
541
|
+
if (model !== undefined || maxSessionMinutes !== undefined || maxTurns !== undefined) {
|
|
542
|
+
agentConfig = {
|
|
543
|
+
...(model !== undefined ? { model } : {}),
|
|
544
|
+
...(maxSessionMinutes !== undefined ? { maxSessionMinutes } : {}),
|
|
545
|
+
...(maxTurns !== undefined ? { maxTurns } : {}),
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
const rawConcurrencyMode = raw.concurrencyMode?.trim();
|
|
550
|
+
if (rawConcurrencyMode !== undefined && rawConcurrencyMode !== 'serial' && rawConcurrencyMode !== 'parallel') {
|
|
551
|
+
return (0, result_js_1.err)({
|
|
552
|
+
kind: 'invalid_field_value',
|
|
553
|
+
field: `concurrencyMode (invalid value: "${rawConcurrencyMode}"; must be "serial" or "parallel")`,
|
|
554
|
+
triggerId: rawId,
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
const concurrencyMode = rawConcurrencyMode === 'parallel' ? 'parallel' : 'serial';
|
|
379
558
|
let onComplete;
|
|
380
559
|
if (raw.onComplete) {
|
|
381
560
|
const rawRunOn = raw.onComplete.runOn?.trim();
|
|
@@ -392,12 +571,68 @@ function validateAndResolveTrigger(raw, env) {
|
|
|
392
571
|
};
|
|
393
572
|
}
|
|
394
573
|
}
|
|
574
|
+
const autoCommit = raw.autoCommit?.trim().toLowerCase() === 'true';
|
|
575
|
+
const autoOpenPR = raw.autoOpenPR?.trim().toLowerCase() === 'true';
|
|
576
|
+
if (autoOpenPR && !autoCommit) {
|
|
577
|
+
console.warn(`[TriggerStore] Warning: trigger "${rawId}" has autoOpenPR: true but autoCommit is not true. ` +
|
|
578
|
+
`A PR requires a commit -- delivery will be skipped unless autoCommit is also set to true.`);
|
|
579
|
+
}
|
|
580
|
+
let pollingSource;
|
|
581
|
+
if (provider === 'gitlab_poll') {
|
|
582
|
+
if (!raw.source) {
|
|
583
|
+
return (0, result_js_1.err)({ kind: 'missing_field', field: 'source', triggerId: rawId });
|
|
584
|
+
}
|
|
585
|
+
const src = raw.source;
|
|
586
|
+
const requiredSourceFields = [
|
|
587
|
+
'baseUrl', 'projectId', 'token', 'events',
|
|
588
|
+
];
|
|
589
|
+
for (const field of requiredSourceFields) {
|
|
590
|
+
if (!src[field]?.trim()) {
|
|
591
|
+
return (0, result_js_1.err)({ kind: 'missing_field', field: `source.${field}`, triggerId: rawId });
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
const tokenRaw = src.token.trim();
|
|
595
|
+
const tokenResult = resolveSecret(tokenRaw, rawId, env);
|
|
596
|
+
if (tokenResult.kind === 'err')
|
|
597
|
+
return tokenResult;
|
|
598
|
+
const eventsRaw = src.events.trim();
|
|
599
|
+
const events = eventsRaw.split(/\s+/).filter(Boolean);
|
|
600
|
+
if (events.length === 0) {
|
|
601
|
+
return (0, result_js_1.err)({ kind: 'missing_field', field: 'source.events (empty)', triggerId: rawId });
|
|
602
|
+
}
|
|
603
|
+
const intervalRaw = src.pollIntervalSeconds?.trim();
|
|
604
|
+
let pollIntervalSeconds = 60;
|
|
605
|
+
if (intervalRaw) {
|
|
606
|
+
const asNumber = Number(intervalRaw);
|
|
607
|
+
if (!Number.isInteger(asNumber) || asNumber <= 0) {
|
|
608
|
+
return (0, result_js_1.err)({
|
|
609
|
+
kind: 'invalid_field_value',
|
|
610
|
+
field: `source.pollIntervalSeconds (must be a positive integer, got: ${intervalRaw})`,
|
|
611
|
+
triggerId: rawId,
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
pollIntervalSeconds = asNumber;
|
|
615
|
+
}
|
|
616
|
+
pollingSource = {
|
|
617
|
+
baseUrl: src.baseUrl.trim(),
|
|
618
|
+
projectId: src.projectId.trim(),
|
|
619
|
+
token: tokenResult.value,
|
|
620
|
+
events,
|
|
621
|
+
pollIntervalSeconds,
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
else if (raw.source) {
|
|
625
|
+
console.warn(`[TriggerStore] WARNING: trigger '${rawId}' has provider='${provider}' but also ` +
|
|
626
|
+
`defines a source: block. The source: block is only used for provider='gitlab_poll'. ` +
|
|
627
|
+
`It will be ignored for this trigger.`);
|
|
628
|
+
}
|
|
395
629
|
const trigger = {
|
|
396
630
|
id: (0, types_js_1.asTriggerId)(rawId),
|
|
397
631
|
provider,
|
|
398
632
|
workflowId: raw.workflowId.trim(),
|
|
399
|
-
workspacePath:
|
|
633
|
+
workspacePath: resolvedWorkspacePath,
|
|
400
634
|
goal: raw.goal.trim(),
|
|
635
|
+
concurrencyMode,
|
|
401
636
|
...(hmacSecret !== undefined ? { hmacSecret } : {}),
|
|
402
637
|
...(raw.contextMapping !== undefined
|
|
403
638
|
? { contextMapping: assembleContextMapping(raw.contextMapping) }
|
|
@@ -405,18 +640,24 @@ function validateAndResolveTrigger(raw, env) {
|
|
|
405
640
|
...(goalTemplate ? { goalTemplate } : {}),
|
|
406
641
|
...(referenceUrls !== undefined && referenceUrls.length > 0 ? { referenceUrls } : {}),
|
|
407
642
|
...(agentConfig !== undefined ? { agentConfig } : {}),
|
|
643
|
+
...(callbackUrl !== undefined ? { callbackUrl } : {}),
|
|
408
644
|
...(onComplete !== undefined ? { onComplete } : {}),
|
|
645
|
+
...(autoCommit ? { autoCommit } : {}),
|
|
646
|
+
...(autoOpenPR ? { autoOpenPR } : {}),
|
|
647
|
+
...(pollingSource !== undefined ? { pollingSource } : {}),
|
|
648
|
+
...(resolvedWorkspaceName !== undefined ? { workspaceName: resolvedWorkspaceName } : {}),
|
|
649
|
+
...(resolvedSoulFile ? { soulFile: resolvedSoulFile } : {}),
|
|
409
650
|
};
|
|
410
651
|
return (0, result_js_1.ok)(trigger);
|
|
411
652
|
}
|
|
412
|
-
function loadTriggerConfig(yamlContent, env = process.env) {
|
|
653
|
+
function loadTriggerConfig(yamlContent, env = process.env, workspaces = {}) {
|
|
413
654
|
const parsedResult = parseTriggersYaml(yamlContent);
|
|
414
655
|
if (parsedResult.kind === 'err')
|
|
415
656
|
return parsedResult;
|
|
416
657
|
const validTriggers = [];
|
|
417
658
|
const validationErrors = [];
|
|
418
659
|
for (const rawTrigger of parsedResult.value) {
|
|
419
|
-
const triggerResult = validateAndResolveTrigger(rawTrigger, env);
|
|
660
|
+
const triggerResult = validateAndResolveTrigger(rawTrigger, env, workspaces);
|
|
420
661
|
if (triggerResult.kind === 'err') {
|
|
421
662
|
console.warn(`[TriggerStore] Skipping invalid trigger: ${JSON.stringify(triggerResult.error)}`);
|
|
422
663
|
validationErrors.push(triggerResult.error);
|
|
@@ -430,7 +671,7 @@ function loadTriggerConfig(yamlContent, env = process.env) {
|
|
|
430
671
|
}
|
|
431
672
|
return (0, result_js_1.ok)({ triggers: validTriggers });
|
|
432
673
|
}
|
|
433
|
-
async function loadTriggerConfigFromFile(workspacePath, env = process.env) {
|
|
674
|
+
async function loadTriggerConfigFromFile(workspacePath, env = process.env, workspaces = {}) {
|
|
434
675
|
const filePath = path.join(workspacePath, 'triggers.yml');
|
|
435
676
|
let content;
|
|
436
677
|
try {
|
|
@@ -443,7 +684,7 @@ async function loadTriggerConfigFromFile(workspacePath, env = process.env) {
|
|
|
443
684
|
}
|
|
444
685
|
return (0, result_js_1.err)({ kind: 'io_error', message: error.message ?? String(e) });
|
|
445
686
|
}
|
|
446
|
-
return loadTriggerConfig(content, env);
|
|
687
|
+
return loadTriggerConfig(content, env, workspaces);
|
|
447
688
|
}
|
|
448
689
|
function buildTriggerIndex(config) {
|
|
449
690
|
const index = new Map();
|
package/dist/trigger/types.d.ts
CHANGED
|
@@ -2,6 +2,14 @@ export type TriggerId = string & {
|
|
|
2
2
|
readonly _brand: 'TriggerId';
|
|
3
3
|
};
|
|
4
4
|
export declare function asTriggerId(value: string): TriggerId;
|
|
5
|
+
export type WorkspaceName = string & {
|
|
6
|
+
readonly _brand: 'WorkspaceName';
|
|
7
|
+
};
|
|
8
|
+
export declare function asWorkspaceName(value: string): WorkspaceName;
|
|
9
|
+
export interface WorkspaceConfig {
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly soulFile?: string;
|
|
12
|
+
}
|
|
5
13
|
export interface ContextMappingEntry {
|
|
6
14
|
readonly workflowContextKey: string;
|
|
7
15
|
readonly payloadPath: string;
|
|
@@ -10,6 +18,13 @@ export interface ContextMappingEntry {
|
|
|
10
18
|
export interface ContextMapping {
|
|
11
19
|
readonly mappings: readonly ContextMappingEntry[];
|
|
12
20
|
}
|
|
21
|
+
export interface GitLabPollingSource {
|
|
22
|
+
readonly baseUrl: string;
|
|
23
|
+
readonly projectId: string;
|
|
24
|
+
readonly token: string;
|
|
25
|
+
readonly events: readonly string[];
|
|
26
|
+
readonly pollIntervalSeconds: number;
|
|
27
|
+
}
|
|
13
28
|
export interface TriggerDefinition {
|
|
14
29
|
readonly id: TriggerId;
|
|
15
30
|
readonly provider: string;
|
|
@@ -22,12 +37,21 @@ export interface TriggerDefinition {
|
|
|
22
37
|
readonly referenceUrls?: readonly string[];
|
|
23
38
|
readonly agentConfig?: {
|
|
24
39
|
readonly model?: string;
|
|
40
|
+
readonly maxSessionMinutes?: number;
|
|
41
|
+
readonly maxTurns?: number;
|
|
25
42
|
};
|
|
43
|
+
readonly concurrencyMode: 'serial' | 'parallel';
|
|
44
|
+
readonly callbackUrl?: string;
|
|
45
|
+
readonly autoCommit?: boolean;
|
|
46
|
+
readonly autoOpenPR?: boolean;
|
|
26
47
|
readonly onComplete?: {
|
|
27
48
|
readonly runOn: 'success' | 'failure' | 'always';
|
|
28
49
|
readonly workflowId?: string;
|
|
29
50
|
readonly goal?: string;
|
|
30
51
|
};
|
|
52
|
+
readonly pollingSource?: GitLabPollingSource;
|
|
53
|
+
readonly workspaceName?: WorkspaceName;
|
|
54
|
+
readonly soulFile?: string;
|
|
31
55
|
}
|
|
32
56
|
export interface TriggerConfig {
|
|
33
57
|
readonly triggers: readonly TriggerDefinition[];
|
package/dist/trigger/types.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.asTriggerId = asTriggerId;
|
|
4
|
+
exports.asWorkspaceName = asWorkspaceName;
|
|
4
5
|
function asTriggerId(value) {
|
|
5
6
|
return value;
|
|
6
7
|
}
|
|
8
|
+
function asWorkspaceName(value) {
|
|
9
|
+
return value;
|
|
10
|
+
}
|
|
@@ -39,11 +39,11 @@ export declare const ContractViolationReasonV1Schema: z.ZodDiscriminatedUnion<"k
|
|
|
39
39
|
kind: z.ZodLiteral<"missing_context_key">;
|
|
40
40
|
key: z.ZodString;
|
|
41
41
|
}, "strict", z.ZodTypeAny, {
|
|
42
|
-
key: string;
|
|
43
42
|
kind: "missing_context_key";
|
|
44
|
-
}, {
|
|
45
43
|
key: string;
|
|
44
|
+
}, {
|
|
46
45
|
kind: "missing_context_key";
|
|
46
|
+
key: string;
|
|
47
47
|
}>, z.ZodObject<{
|
|
48
48
|
kind: z.ZodLiteral<"context_budget_exceeded">;
|
|
49
49
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -151,11 +151,11 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
151
151
|
kind: z.ZodLiteral<"missing_context_key">;
|
|
152
152
|
key: z.ZodString;
|
|
153
153
|
}, "strict", z.ZodTypeAny, {
|
|
154
|
-
key: string;
|
|
155
154
|
kind: "missing_context_key";
|
|
156
|
-
}, {
|
|
157
155
|
key: string;
|
|
156
|
+
}, {
|
|
158
157
|
kind: "missing_context_key";
|
|
158
|
+
key: string;
|
|
159
159
|
}>, z.ZodObject<{
|
|
160
160
|
kind: z.ZodLiteral<"context_budget_exceeded">;
|
|
161
161
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -181,11 +181,11 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
181
181
|
kind: z.ZodLiteral<"context_key">;
|
|
182
182
|
key: z.ZodString;
|
|
183
183
|
}, "strict", z.ZodTypeAny, {
|
|
184
|
-
key: string;
|
|
185
184
|
kind: "context_key";
|
|
186
|
-
}, {
|
|
187
185
|
key: string;
|
|
186
|
+
}, {
|
|
188
187
|
kind: "context_key";
|
|
188
|
+
key: string;
|
|
189
189
|
}>, z.ZodObject<{
|
|
190
190
|
kind: z.ZodLiteral<"context_budget">;
|
|
191
191
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -238,8 +238,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
238
238
|
message: string;
|
|
239
239
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
240
240
|
pointer: {
|
|
241
|
-
key: string;
|
|
242
241
|
kind: "context_key";
|
|
242
|
+
key: string;
|
|
243
243
|
} | {
|
|
244
244
|
kind: "context_budget";
|
|
245
245
|
} | {
|
|
@@ -261,8 +261,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
261
261
|
message: string;
|
|
262
262
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
263
263
|
pointer: {
|
|
264
|
-
key: string;
|
|
265
264
|
kind: "context_key";
|
|
265
|
+
key: string;
|
|
266
266
|
} | {
|
|
267
267
|
kind: "context_budget";
|
|
268
268
|
} | {
|
|
@@ -286,8 +286,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
286
286
|
message: string;
|
|
287
287
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
288
288
|
pointer: {
|
|
289
|
-
key: string;
|
|
290
289
|
kind: "context_key";
|
|
290
|
+
key: string;
|
|
291
291
|
} | {
|
|
292
292
|
kind: "context_budget";
|
|
293
293
|
} | {
|
|
@@ -311,8 +311,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
311
311
|
message: string;
|
|
312
312
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
313
313
|
pointer: {
|
|
314
|
-
key: string;
|
|
315
314
|
kind: "context_key";
|
|
315
|
+
key: string;
|
|
316
316
|
} | {
|
|
317
317
|
kind: "context_budget";
|
|
318
318
|
} | {
|
|
@@ -347,8 +347,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
347
347
|
guidance: string;
|
|
348
348
|
dimensionId: string;
|
|
349
349
|
} | {
|
|
350
|
-
key: string;
|
|
351
350
|
kind: "missing_context_key";
|
|
351
|
+
key: string;
|
|
352
352
|
} | {
|
|
353
353
|
kind: "context_budget_exceeded";
|
|
354
354
|
} | {
|
|
@@ -360,8 +360,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
360
360
|
message: string;
|
|
361
361
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
362
362
|
pointer: {
|
|
363
|
-
key: string;
|
|
364
363
|
kind: "context_key";
|
|
364
|
+
key: string;
|
|
365
365
|
} | {
|
|
366
366
|
kind: "context_budget";
|
|
367
367
|
} | {
|
|
@@ -398,8 +398,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
398
398
|
guidance: string;
|
|
399
399
|
dimensionId: string;
|
|
400
400
|
} | {
|
|
401
|
-
key: string;
|
|
402
401
|
kind: "missing_context_key";
|
|
402
|
+
key: string;
|
|
403
403
|
} | {
|
|
404
404
|
kind: "context_budget_exceeded";
|
|
405
405
|
} | {
|
|
@@ -411,8 +411,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
411
411
|
message: string;
|
|
412
412
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
413
413
|
pointer: {
|
|
414
|
-
key: string;
|
|
415
414
|
kind: "context_key";
|
|
415
|
+
key: string;
|
|
416
416
|
} | {
|
|
417
417
|
kind: "context_budget";
|
|
418
418
|
} | {
|
|
@@ -493,11 +493,11 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
493
493
|
kind: z.ZodLiteral<"context_key">;
|
|
494
494
|
key: z.ZodString;
|
|
495
495
|
}, "strict", z.ZodTypeAny, {
|
|
496
|
-
key: string;
|
|
497
496
|
kind: "context_key";
|
|
498
|
-
}, {
|
|
499
497
|
key: string;
|
|
498
|
+
}, {
|
|
500
499
|
kind: "context_key";
|
|
500
|
+
key: string;
|
|
501
501
|
}>, z.ZodObject<{
|
|
502
502
|
kind: z.ZodLiteral<"context_budget">;
|
|
503
503
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -550,8 +550,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
550
550
|
message: string;
|
|
551
551
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
552
552
|
pointer: {
|
|
553
|
-
key: string;
|
|
554
553
|
kind: "context_key";
|
|
554
|
+
key: string;
|
|
555
555
|
} | {
|
|
556
556
|
kind: "context_budget";
|
|
557
557
|
} | {
|
|
@@ -573,8 +573,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
573
573
|
message: string;
|
|
574
574
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
575
575
|
pointer: {
|
|
576
|
-
key: string;
|
|
577
576
|
kind: "context_key";
|
|
577
|
+
key: string;
|
|
578
578
|
} | {
|
|
579
579
|
kind: "context_budget";
|
|
580
580
|
} | {
|
|
@@ -598,8 +598,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
598
598
|
message: string;
|
|
599
599
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
600
600
|
pointer: {
|
|
601
|
-
key: string;
|
|
602
601
|
kind: "context_key";
|
|
602
|
+
key: string;
|
|
603
603
|
} | {
|
|
604
604
|
kind: "context_budget";
|
|
605
605
|
} | {
|
|
@@ -623,8 +623,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
623
623
|
message: string;
|
|
624
624
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
625
625
|
pointer: {
|
|
626
|
-
key: string;
|
|
627
626
|
kind: "context_key";
|
|
627
|
+
key: string;
|
|
628
628
|
} | {
|
|
629
629
|
kind: "context_budget";
|
|
630
630
|
} | {
|
|
@@ -668,8 +668,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
668
668
|
message: string;
|
|
669
669
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
670
670
|
pointer: {
|
|
671
|
-
key: string;
|
|
672
671
|
kind: "context_key";
|
|
672
|
+
key: string;
|
|
673
673
|
} | {
|
|
674
674
|
kind: "context_budget";
|
|
675
675
|
} | {
|
|
@@ -714,8 +714,8 @@ export declare const BlockedSnapshotV1Schema: z.ZodDiscriminatedUnion<"kind", [z
|
|
|
714
714
|
message: string;
|
|
715
715
|
code: "USER_ONLY_DEPENDENCY" | "MISSING_REQUIRED_OUTPUT" | "INVALID_REQUIRED_OUTPUT" | "ASSESSMENT_FOLLOWUP_REQUIRED" | "MISSING_REQUIRED_NOTES" | "MISSING_CONTEXT_KEY" | "CONTEXT_BUDGET_EXCEEDED" | "REQUIRED_CAPABILITY_UNKNOWN" | "REQUIRED_CAPABILITY_UNAVAILABLE" | "INVARIANT_VIOLATION" | "STORAGE_CORRUPTION_DETECTED";
|
|
716
716
|
pointer: {
|
|
717
|
-
key: string;
|
|
718
717
|
kind: "context_key";
|
|
718
|
+
key: string;
|
|
719
719
|
} | {
|
|
720
720
|
kind: "context_budget";
|
|
721
721
|
} | {
|