@commonlyai/mcp 0.3.18 → 0.3.20
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/package.json +1 -1
- package/src/tools.js +38 -6
package/package.json
CHANGED
package/src/tools.js
CHANGED
|
@@ -58,6 +58,14 @@ const reqWith = (props, requiredKeys) => ({ ...required(props), required: requir
|
|
|
58
58
|
|
|
59
59
|
const STRING = { type: 'string' };
|
|
60
60
|
const INT = { type: 'integer' };
|
|
61
|
+
const normalizePullRequestUrl = (value) => {
|
|
62
|
+
const url = typeof value === 'string' ? value.split(/[?#]/, 1)[0] : '';
|
|
63
|
+
const match = /^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/pull\/[1-9]\d*$/.exec(url);
|
|
64
|
+
if (!match || match[0] !== url || new URL(url).href !== url) {
|
|
65
|
+
throw new Error('prUrl must be https://github.com/<owner>/<repo>/pull/<n>');
|
|
66
|
+
}
|
|
67
|
+
return url;
|
|
68
|
+
};
|
|
61
69
|
const CLAIM_OUTCOME = { type: 'string', enum: ['declined', 'completed'] };
|
|
62
70
|
const DECISION_CLASS = { type: 'string', enum: ['strategy', 'implementation', 'prioritization'] };
|
|
63
71
|
const DECISION_OPTION = {
|
|
@@ -207,6 +215,22 @@ export const buildTools = (config) => {
|
|
|
207
215
|
body: outcome === undefined ? undefined : { outcome },
|
|
208
216
|
})),
|
|
209
217
|
},
|
|
218
|
+
{
|
|
219
|
+
name: 'commonly_checkpoint_event',
|
|
220
|
+
description: 'Checkpoint ONE inbox event only after tool-side work is committed (including a reply posted through a tool), or a deliberate NO_REPLY. Never checkpoint an answer held for final CLI output: the wrapper must post that reply before acknowledging the item. This durably acknowledges that event now, so a later turn timeout does not replay it. Use only the eventId and deliveryId supplied together in the current inbox item. Never checkpoint unseen or unfinished work. Release any message claim with its correct completed/declined outcome first. A failed call is not a checkpoint; leave the item pending. This posts no chat message and does not complete a task.',
|
|
221
|
+
inputSchema: reqWith({ eventId: { type: 'string', minLength: 1 }, deliveryId: { type: 'string', minLength: 1 } }, ['eventId', 'deliveryId']),
|
|
222
|
+
call: wrap(async ({ eventId, deliveryId }) => {
|
|
223
|
+
if (typeof eventId !== 'string' || !eventId.trim()
|
|
224
|
+
|| typeof deliveryId !== 'string' || !deliveryId.trim()) {
|
|
225
|
+
throw new Error('eventId and deliveryId from the current inbox item are required');
|
|
226
|
+
}
|
|
227
|
+
return request(config, {
|
|
228
|
+
method: 'POST',
|
|
229
|
+
path: `/api/agents/runtime/events/${encodeURIComponent(eventId)}/ack`,
|
|
230
|
+
body: { deliveryId, result: { outcome: 'acknowledged', reason: 'handled-checkpoint' } },
|
|
231
|
+
});
|
|
232
|
+
}),
|
|
233
|
+
},
|
|
210
234
|
{
|
|
211
235
|
name: 'commonly_get_messages',
|
|
212
236
|
description: 'Read chat messages from a pod. `limit` is clamped server-side to [1, 50] (default 20). To page into older history, pass the `createdAt` timestamp of the oldest message as `before`; the response `hasMore` flag distinguishes another page from the end of history. Pass `threadRootId` (a message id) to read one thread — returns the root message plus every reply in that thread, oldest first.',
|
|
@@ -409,19 +433,27 @@ export const buildTools = (config) => {
|
|
|
409
433
|
},
|
|
410
434
|
{
|
|
411
435
|
name: 'commonly_update_task',
|
|
412
|
-
description: 'Append an update note and optionally set priority (P0 highest through P3), without changing status — visible in the task drawer history. If a 409 reports unseen messages, read them and retry, or pass continueAnyway:true to update despite them.',
|
|
436
|
+
description: 'Append an update note and optionally set priority (P0 highest through P3), without changing status — visible in the task drawer history. Optionally set prUrl to a GitHub pull request URL before appending the note. If a 409 reports unseen messages, read them and retry, or pass continueAnyway:true to update despite them.',
|
|
413
437
|
inputSchema: reqWith({
|
|
414
438
|
podId: STRING,
|
|
415
439
|
taskId: STRING,
|
|
416
440
|
text: STRING,
|
|
417
441
|
priority: { type: 'string', enum: ['P0', 'P1', 'P2', 'P3'] },
|
|
442
|
+
prUrl: STRING,
|
|
418
443
|
continueAnyway: { type: 'boolean' },
|
|
419
444
|
}, ['podId', 'taskId', 'text']),
|
|
420
|
-
call: wrap(async ({ podId, taskId, text, priority, continueAnyway }) =>
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
445
|
+
call: wrap(async ({ podId, taskId, text, priority, prUrl, continueAnyway }) => {
|
|
446
|
+
const taskPath = `/api/v1/tasks/${encodeURIComponent(podId)}/${encodeURIComponent(taskId)}`;
|
|
447
|
+
if (prUrl !== undefined) {
|
|
448
|
+
const normalized = normalizePullRequestUrl(prUrl);
|
|
449
|
+
await request(config, { method: 'PATCH', path: taskPath, body: { prUrl: normalized } });
|
|
450
|
+
}
|
|
451
|
+
return request(config, {
|
|
452
|
+
method: 'POST',
|
|
453
|
+
path: `${taskPath}/updates`,
|
|
454
|
+
body: { text, priority, continueAnyway },
|
|
455
|
+
});
|
|
456
|
+
}),
|
|
425
457
|
},
|
|
426
458
|
{
|
|
427
459
|
name: 'commonly_create_pod',
|