@ferrfleet/mcp 10.17.2 → 10.19.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.
|
@@ -192,6 +192,21 @@ describe('workflow and event rule tools', () => {
|
|
|
192
192
|
expect(accepts('create_workflow', 'entries', [noStarts])).toBe(false);
|
|
193
193
|
expect(accepts('create_workflow', 'outputs', [noFrom])).toBe(false);
|
|
194
194
|
});
|
|
195
|
+
it('accepts from as a step id or a non-empty list of distinct step ids', () => {
|
|
196
|
+
expect(accepts('create_workflow', 'outputs', [{ ...issueOutput, from: 'review' }])).toBe(true);
|
|
197
|
+
expect(accepts('create_workflow', 'outputs', [{ ...issueOutput, from: ['review', 'verify'] }])).toBe(true);
|
|
198
|
+
expect(accepts('update_workflow', 'outputs', [{ ...issueOutput, from: ['review'] }])).toBe(true);
|
|
199
|
+
});
|
|
200
|
+
it('refuses an empty, duplicated or malformed from', () => {
|
|
201
|
+
for (const from of [[], ['review', 'review'], [''], ['review', 3], '', 3, null]) {
|
|
202
|
+
expect(accepts('create_workflow', 'outputs', [{ ...issueOutput, from }]), String(from)).toBe(false);
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
it('create_workflow posts a list from unchanged', async () => {
|
|
206
|
+
const output = { ...issueOutput, from: ['review', 'verify'] };
|
|
207
|
+
await handlers.get('create_workflow')({ name: 'wf', steps: [step], outputs: [output] });
|
|
208
|
+
expect(lastCall().body).toMatchObject({ outputs: [output] });
|
|
209
|
+
});
|
|
195
210
|
it('caps entries and outputs at 10', () => {
|
|
196
211
|
const entries = Array.from({ length: 11 }, (_, i) => ({ ...cronEntry, id: `e${i}` }));
|
|
197
212
|
const outputs = Array.from({ length: 11 }, (_, i) => ({ ...issueOutput, id: `o${i}` }));
|
|
@@ -327,6 +342,21 @@ describe('workflow and event rule tools', () => {
|
|
|
327
342
|
body: { name: 'R', outcome: skip },
|
|
328
343
|
});
|
|
329
344
|
});
|
|
345
|
+
it('update_event_rule forwards entry_id of a workflow outcome', async () => {
|
|
346
|
+
const outcome = { action: 'workflow', workflow_id: ID, entry_id: 'renovate-pr' };
|
|
347
|
+
await handlers.get('update_event_rule')({ rule_id: ID, name: 'R', outcome });
|
|
348
|
+
expect(lastCall().body).toEqual({ name: 'R', outcome });
|
|
349
|
+
});
|
|
350
|
+
it('create_event_rule forwards entry_id of a workflow outcome', async () => {
|
|
351
|
+
const outcome = { action: 'workflow', workflow_id: ID, entry_id: 'pr' };
|
|
352
|
+
await handlers.get('create_event_rule')({ name: 'R', outcome });
|
|
353
|
+
expect(lastCall().body).toEqual({ name: 'R', outcome });
|
|
354
|
+
});
|
|
355
|
+
it('a workflow outcome without entry_id sends none', async () => {
|
|
356
|
+
const outcome = { action: 'workflow', workflow_id: ID };
|
|
357
|
+
await handlers.get('create_event_rule')({ name: 'R', outcome });
|
|
358
|
+
expect(lastCall().body).toEqual({ name: 'R', outcome });
|
|
359
|
+
});
|
|
330
360
|
it('delete_event_rule sends DELETE and reports the id on 204', async () => {
|
|
331
361
|
mockFetch.mockResolvedValue(respond(204));
|
|
332
362
|
const result = await handlers.get('delete_event_rule')({ rule_id: ID });
|
|
@@ -365,6 +395,11 @@ describe('workflow and event rule tools', () => {
|
|
|
365
395
|
expect(ok({ action: 'run', agent_id: 'a', instructions: 'x', dedup: 'head_commit' })).toBe(true);
|
|
366
396
|
expect(ok(skip)).toBe(true);
|
|
367
397
|
expect(ok({ action: 'workflow', workflow_id: ID })).toBe(true);
|
|
398
|
+
expect(ok({ action: 'workflow', workflow_id: ID, entry_id: 'pr' })).toBe(true);
|
|
399
|
+
});
|
|
400
|
+
it('rejects an empty or non-string entry_id', () => {
|
|
401
|
+
expect(ok({ action: 'workflow', workflow_id: ID, entry_id: '' })).toBe(false);
|
|
402
|
+
expect(ok({ action: 'workflow', workflow_id: ID, entry_id: 1 })).toBe(false);
|
|
368
403
|
});
|
|
369
404
|
it('rejects an unknown action', () => {
|
|
370
405
|
expect(ok({ action: 'notify' })).toBe(false);
|
|
@@ -387,6 +422,7 @@ describe('workflow and event rule tools', () => {
|
|
|
387
422
|
it('rejects fields from another variant', () => {
|
|
388
423
|
expect(ok({ action: 'skip', reason: 'x', agent_id: 'a' })).toBe(false);
|
|
389
424
|
expect(ok({ action: 'run', workflow_id: ID })).toBe(false);
|
|
425
|
+
expect(ok({ action: 'skip', reason: 'x', entry_id: 'pr' })).toBe(false);
|
|
390
426
|
});
|
|
391
427
|
});
|
|
392
428
|
describe('conditions schema', () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event-rules.d.ts","sourceRoot":"","sources":["../../src/tools/event-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"event-rules.d.ts","sourceRoot":"","sources":["../../src/tools/event-rules.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAmF9D,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,QA2FvD"}
|
|
@@ -40,7 +40,11 @@ const conditionsSchema = z
|
|
|
40
40
|
const outcomeSchema = z.discriminatedUnion('action', [
|
|
41
41
|
z.strictObject({
|
|
42
42
|
action: z.literal('run'),
|
|
43
|
-
agent_id: z
|
|
43
|
+
agent_id: z
|
|
44
|
+
.string()
|
|
45
|
+
.min(1)
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('Agent to run instead of the repository-bound one'),
|
|
44
48
|
instructions: z.string().max(4000).optional().describe("Appended to the agent's prompt"),
|
|
45
49
|
dedup: z
|
|
46
50
|
.enum(DEDUP_MODES)
|
|
@@ -54,6 +58,11 @@ const outcomeSchema = z.discriminatedUnion('action', [
|
|
|
54
58
|
z.strictObject({
|
|
55
59
|
action: z.literal('workflow'),
|
|
56
60
|
workflow_id: z.guid().describe('Workflow from list_workflows'),
|
|
61
|
+
entry_id: z
|
|
62
|
+
.string()
|
|
63
|
+
.min(1)
|
|
64
|
+
.optional()
|
|
65
|
+
.describe('Event entry of the workflow to start; omit to start every root step'),
|
|
57
66
|
}),
|
|
58
67
|
]);
|
|
59
68
|
const ruleFields = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/tools/workflows.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"workflows.d.ts","sourceRoot":"","sources":["../../src/tools/workflows.ts"],"names":[],"mappings":"AACA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AA0H9D,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,QAqItD"}
|
package/dist/tools/workflows.js
CHANGED
|
@@ -60,7 +60,12 @@ const outputSchema = z.strictObject({
|
|
|
60
60
|
.string()
|
|
61
61
|
.min(1)
|
|
62
62
|
.describe('Output id, unique among the steps, entries and outputs of the workflow'),
|
|
63
|
-
from: z
|
|
63
|
+
from: z
|
|
64
|
+
.union([z.string().min(1), z.array(z.string().min(1)).min(1)])
|
|
65
|
+
.refine((from) => typeof from === 'string' || new Set(from).size === from.length, {
|
|
66
|
+
message: 'Step ids must be unique',
|
|
67
|
+
})
|
|
68
|
+
.describe('Id of the step whose result is delivered, or a non-empty list of distinct step ids: the output waits for all of them, ignores skipped ones and delivers the last listed step that completed with a body'),
|
|
64
69
|
kind: z.enum(OUTPUT_KINDS).describe('Where the result goes'),
|
|
65
70
|
connector_id: z
|
|
66
71
|
.string()
|