@raytio/mcp-server 3.5.0 → 4.0.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/capabilities/tool-capability.d.ts.map +1 -1
- package/dist/capabilities/tool-capability.js +27 -0
- package/dist/capabilities/tool-capability.js.map +1 -1
- package/dist/tools/_shared/side-effect.d.ts +32 -0
- package/dist/tools/_shared/side-effect.d.ts.map +1 -0
- package/dist/tools/_shared/side-effect.js +60 -0
- package/dist/tools/_shared/side-effect.js.map +1 -0
- package/dist/tools/domains.d.ts.map +1 -1
- package/dist/tools/domains.js +27 -0
- package/dist/tools/domains.js.map +1 -1
- package/dist/tools/fnd/generated-reads.d.ts +5 -0
- package/dist/tools/fnd/generated-reads.d.ts.map +1 -0
- package/dist/tools/fnd/generated-reads.js +42 -0
- package/dist/tools/fnd/generated-reads.js.map +1 -0
- package/dist/tools/fnd/index.d.ts +13 -0
- package/dist/tools/fnd/index.d.ts.map +1 -0
- package/dist/tools/fnd/index.js +13 -0
- package/dist/tools/fnd/index.js.map +1 -0
- package/dist/tools/hrm/generated-reads.d.ts +5 -0
- package/dist/tools/hrm/generated-reads.d.ts.map +1 -0
- package/dist/tools/hrm/generated-reads.js +40 -0
- package/dist/tools/hrm/generated-reads.js.map +1 -0
- package/dist/tools/hrm/hrm-user-policy-assign.d.ts +15 -0
- package/dist/tools/hrm/hrm-user-policy-assign.d.ts.map +1 -0
- package/dist/tools/hrm/hrm-user-policy-assign.js +60 -0
- package/dist/tools/hrm/hrm-user-policy-assign.js.map +1 -0
- package/dist/tools/hrm/hrm-user-policy-unassign.d.ts +8 -0
- package/dist/tools/hrm/hrm-user-policy-unassign.d.ts.map +1 -0
- package/dist/tools/hrm/hrm-user-policy-unassign.js +48 -0
- package/dist/tools/hrm/hrm-user-policy-unassign.js.map +1 -0
- package/dist/tools/hrm/hrm-user-role-assign.d.ts +17 -0
- package/dist/tools/hrm/hrm-user-role-assign.d.ts.map +1 -0
- package/dist/tools/hrm/hrm-user-role-assign.js +70 -0
- package/dist/tools/hrm/hrm-user-role-assign.js.map +1 -0
- package/dist/tools/hrm/hrm-user-role-parent-remove.d.ts +9 -0
- package/dist/tools/hrm/hrm-user-role-parent-remove.d.ts.map +1 -0
- package/dist/tools/hrm/hrm-user-role-parent-remove.js +49 -0
- package/dist/tools/hrm/hrm-user-role-parent-remove.js.map +1 -0
- package/dist/tools/hrm/hrm-user-role-parent-set.d.ts +11 -0
- package/dist/tools/hrm/hrm-user-role-parent-set.d.ts.map +1 -0
- package/dist/tools/hrm/hrm-user-role-parent-set.js +59 -0
- package/dist/tools/hrm/hrm-user-role-parent-set.js.map +1 -0
- package/dist/tools/hrm/hrm-user-role-policy-assign.d.ts +11 -0
- package/dist/tools/hrm/hrm-user-role-policy-assign.d.ts.map +1 -0
- package/dist/tools/hrm/hrm-user-role-policy-assign.js +56 -0
- package/dist/tools/hrm/hrm-user-role-policy-assign.js.map +1 -0
- package/dist/tools/hrm/hrm-user-role-policy-unassign.d.ts +9 -0
- package/dist/tools/hrm/hrm-user-role-policy-unassign.d.ts.map +1 -0
- package/dist/tools/hrm/hrm-user-role-policy-unassign.js +49 -0
- package/dist/tools/hrm/hrm-user-role-policy-unassign.js.map +1 -0
- package/dist/tools/hrm/hrm-user-role-unassign.d.ts +13 -0
- package/dist/tools/hrm/hrm-user-role-unassign.d.ts.map +1 -0
- package/dist/tools/hrm/hrm-user-role-unassign.js +57 -0
- package/dist/tools/hrm/hrm-user-role-unassign.js.map +1 -0
- package/dist/tools/hrm/index.d.ts +5 -0
- package/dist/tools/hrm/index.d.ts.map +1 -0
- package/dist/tools/hrm/index.js +23 -0
- package/dist/tools/hrm/index.js.map +1 -0
- package/dist/tools/sec/generated-reads.d.ts +5 -0
- package/dist/tools/sec/generated-reads.d.ts.map +1 -0
- package/dist/tools/sec/generated-reads.js +29 -0
- package/dist/tools/sec/generated-reads.js.map +1 -0
- package/dist/tools/sec/index.d.ts +5 -0
- package/dist/tools/sec/index.d.ts.map +1 -0
- package/dist/tools/sec/index.js +15 -0
- package/dist/tools/sec/index.js.map +1 -0
- package/dist/tools/sec/sec-qr-pairing-cancel.d.ts +11 -0
- package/dist/tools/sec/sec-qr-pairing-cancel.d.ts.map +1 -0
- package/dist/tools/sec/sec-qr-pairing-cancel.js +55 -0
- package/dist/tools/sec/sec-qr-pairing-cancel.js.map +1 -0
- package/dist/tools/sec/sec-qr-pairing-complete.d.ts +13 -0
- package/dist/tools/sec/sec-qr-pairing-complete.d.ts.map +1 -0
- package/dist/tools/sec/sec-qr-pairing-complete.js +62 -0
- package/dist/tools/sec/sec-qr-pairing-complete.js.map +1 -0
- package/dist/tools/sec/sec-qr-pairing-join.d.ts +13 -0
- package/dist/tools/sec/sec-qr-pairing-join.d.ts.map +1 -0
- package/dist/tools/sec/sec-qr-pairing-join.js +52 -0
- package/dist/tools/sec/sec-qr-pairing-join.js.map +1 -0
- package/dist/tools/sec/sec-qr-pairing-start.d.ts +19 -0
- package/dist/tools/sec/sec-qr-pairing-start.d.ts.map +1 -0
- package/dist/tools/sec/sec-qr-pairing-start.js +68 -0
- package/dist/tools/sec/sec-qr-pairing-start.js.map +1 -0
- package/dist/tools/wrm/wrm-effective-mcp-servers.js +5 -5
- package/dist/tools/wrm/wrm-effective-mcp-servers.js.map +1 -1
- package/dist/tools/wrm/wrm-effective-mcp-tools.js +6 -6
- package/dist/tools/wrm/wrm-effective-mcp-tools.js.map +1 -1
- package/dist/tools/wrm/wrm-effective-model-prefs.js +5 -5
- package/dist/tools/wrm/wrm-effective-model-prefs.js.map +1 -1
- package/dist/tools/wrm/wrm-worker-resolve-config.d.ts.map +1 -1
- package/dist/tools/wrm/wrm-worker-resolve-config.js +29 -17
- package/dist/tools/wrm/wrm-worker-resolve-config.js.map +1 -1
- package/dist/wrm/projection.js +5 -5
- package/dist/wrm/projection.js.map +1 -1
- package/dist/wrm/types.d.ts +12 -7
- package/dist/wrm/types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { confirmFlagSchema, idempotencyKeySchema, reasonSchema, writeHeadersWithIdempotency, } from '../_shared/side-effect.js';
|
|
5
|
+
/**
|
|
6
|
+
* Cancel a QR pairing session by setting `session_status=CANCELLED`
|
|
7
|
+
* and stamping `completed_at`. Cancellation is a security state
|
|
8
|
+
* transition, so the tool requires `confirm: true` AND a `reason`
|
|
9
|
+
* for the audit trail.
|
|
10
|
+
*
|
|
11
|
+
* Retry-safe: repeat calls converge on the same cancelled state.
|
|
12
|
+
*/
|
|
13
|
+
export const secQrPairingCancelTool = {
|
|
14
|
+
name: 'sec_qr_pairing_cancel',
|
|
15
|
+
description: 'Cancel a QR pairing session (session_status=CANCELLED, completed_at stamped). ' +
|
|
16
|
+
'Requires confirm=true and a reason for the audit trail. Retry-safe.',
|
|
17
|
+
inputSchema: z.object({
|
|
18
|
+
id: z
|
|
19
|
+
.string()
|
|
20
|
+
.min(1)
|
|
21
|
+
.describe('UUID of the sec_qr_pairing_sessions row to cancel'),
|
|
22
|
+
completed_at: z
|
|
23
|
+
.string()
|
|
24
|
+
.datetime()
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Optional ISO-8601 cancellation timestamp; defaults to server clock'),
|
|
27
|
+
confirm: confirmFlagSchema,
|
|
28
|
+
reason: reasonSchema.describe('Human-readable justification recorded on the audit trail'),
|
|
29
|
+
idempotency_key: idempotencyKeySchema,
|
|
30
|
+
}),
|
|
31
|
+
capabilities: [cap('sec_qr_pairing_sessions', 'UPDATE')],
|
|
32
|
+
sideEffect: 'state_change',
|
|
33
|
+
confirmation: 'caller_confirms',
|
|
34
|
+
idempotency: 'natural_key',
|
|
35
|
+
handler: async (args, ctx) => {
|
|
36
|
+
const input = args;
|
|
37
|
+
const body = {
|
|
38
|
+
session_status: 'CANCELLED',
|
|
39
|
+
metadata: { cancel_reason: input.reason },
|
|
40
|
+
};
|
|
41
|
+
if (input.completed_at !== undefined)
|
|
42
|
+
body.completed_at = input.completed_at;
|
|
43
|
+
try {
|
|
44
|
+
const rows = await ctx.apiClient.patch(`${ctx.apiClient.dbBasePath}/sec_qr_pairing_sessions?id=eq.${input.id}&select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
45
|
+
if (!rows || rows.length === 0) {
|
|
46
|
+
return errorResponse(API_ERROR, `SEC QR pairing session ${input.id} not found or not accessible`);
|
|
47
|
+
}
|
|
48
|
+
return successResponse(rows[0]);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
return errorResponse(API_ERROR, `Failed to cancel SEC QR pairing session: ${error.message}`);
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=sec-qr-pairing-cancel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sec-qr-pairing-cancel.js","sourceRoot":"","sources":["../../../src/tools/sec/sec-qr-pairing-cancel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,YAAY,EACZ,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAS;IAC1C,IAAI,EAAE,uBAAuB;IAC7B,WAAW,EACT,gFAAgF;QAChF,qEAAqE;IACvE,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ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C;YACpB,OAAO,aAAa,CAClB,SAAS,EACT,4CAA4C,KAAK,CAAC,OAAO,EAAE,CAC5D,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Mark a QR pairing session as completed
|
|
4
|
+
* (`sec_qr_pairing_sessions`). Records `session_status=PAIRED`,
|
|
5
|
+
* stamps `paired_at` and `completed_at`. Callers may override those
|
|
6
|
+
* timestamps for a deterministic close; the persist backend clock is
|
|
7
|
+
* used when omitted.
|
|
8
|
+
*
|
|
9
|
+
* Requires confirm=true — completion promotes the paired device to a
|
|
10
|
+
* trusted state within the tenant.
|
|
11
|
+
*/
|
|
12
|
+
export declare const secQrPairingCompleteTool: Tool;
|
|
13
|
+
//# sourceMappingURL=sec-qr-pairing-complete.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sec-qr-pairing-complete.d.ts","sourceRoot":"","sources":["../../../src/tools/sec/sec-qr-pairing-complete.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAStC;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,EAAE,IA2DtC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { confirmFlagSchema, idempotencyKeySchema, writeHeadersWithIdempotency, } from '../_shared/side-effect.js';
|
|
5
|
+
/**
|
|
6
|
+
* Mark a QR pairing session as completed
|
|
7
|
+
* (`sec_qr_pairing_sessions`). Records `session_status=PAIRED`,
|
|
8
|
+
* stamps `paired_at` and `completed_at`. Callers may override those
|
|
9
|
+
* timestamps for a deterministic close; the persist backend clock is
|
|
10
|
+
* used when omitted.
|
|
11
|
+
*
|
|
12
|
+
* Requires confirm=true — completion promotes the paired device to a
|
|
13
|
+
* trusted state within the tenant.
|
|
14
|
+
*/
|
|
15
|
+
export const secQrPairingCompleteTool = {
|
|
16
|
+
name: 'sec_qr_pairing_complete',
|
|
17
|
+
description: 'Complete a QR pairing session (session_status=PAIRED, paired_at/completed_at stamped). ' +
|
|
18
|
+
'Requires confirm=true. Retry-safe (converges on the same PAIRED state).',
|
|
19
|
+
inputSchema: z.object({
|
|
20
|
+
id: z
|
|
21
|
+
.string()
|
|
22
|
+
.min(1)
|
|
23
|
+
.describe('UUID of the sec_qr_pairing_sessions row to mark paired'),
|
|
24
|
+
paired_at: z
|
|
25
|
+
.string()
|
|
26
|
+
.datetime()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Optional ISO-8601 timestamp for paired_at; defaults to server clock'),
|
|
29
|
+
completed_at: z
|
|
30
|
+
.string()
|
|
31
|
+
.datetime()
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Optional ISO-8601 timestamp for completed_at; defaults to server clock'),
|
|
34
|
+
confirm: confirmFlagSchema,
|
|
35
|
+
idempotency_key: idempotencyKeySchema,
|
|
36
|
+
}),
|
|
37
|
+
capabilities: [cap('sec_qr_pairing_sessions', 'UPDATE')],
|
|
38
|
+
sideEffect: 'state_change',
|
|
39
|
+
confirmation: 'caller_confirms',
|
|
40
|
+
idempotency: 'natural_key',
|
|
41
|
+
handler: async (args, ctx) => {
|
|
42
|
+
const input = args;
|
|
43
|
+
const body = {
|
|
44
|
+
session_status: 'PAIRED',
|
|
45
|
+
};
|
|
46
|
+
if (input.paired_at !== undefined)
|
|
47
|
+
body.paired_at = input.paired_at;
|
|
48
|
+
if (input.completed_at !== undefined)
|
|
49
|
+
body.completed_at = input.completed_at;
|
|
50
|
+
try {
|
|
51
|
+
const rows = await ctx.apiClient.patch(`${ctx.apiClient.dbBasePath}/sec_qr_pairing_sessions?id=eq.${input.id}&select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
52
|
+
if (!rows || rows.length === 0) {
|
|
53
|
+
return errorResponse(API_ERROR, `SEC QR pairing session ${input.id} not found or not accessible`);
|
|
54
|
+
}
|
|
55
|
+
return successResponse(rows[0]);
|
|
56
|
+
}
|
|
57
|
+
catch (error) {
|
|
58
|
+
return errorResponse(API_ERROR, `Failed to complete SEC QR pairing session: ${error.message}`);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=sec-qr-pairing-complete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sec-qr-pairing-complete.js","sourceRoot":"","sources":["../../../src/tools/sec/sec-qr-pairing-complete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAC5D,OAAO,EACL,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,2BAA2B,CAAC;AAEnC;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAS;IAC5C,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT,yFAAyF;QACzF,yEAAyE;IAC3E,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,wDAAwD,CAAC;QACrE,SAAS,EAAE,CAAC;aACT,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,EAAE;aACV,QAAQ,CAAC,qEAAqE,CAAC;QAClF,YAAY,EAAE,CAAC;aACZ,MAAM,EAAE;aACR,QAAQ,EAAE;aACV,QAAQ,EAAE;aACV,QAAQ,CAAC,wEAAwE,CAAC;QACrF,OAAO,EAAE,iBAAiB;QAC1B,e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
|
3
|
+
* Attach a joiner device to a QR pairing session
|
|
4
|
+
* (`sec_qr_pairing_sessions`). Only `joiner_device_id` and
|
|
5
|
+
* `metadata` are writable through this path — session_status and
|
|
6
|
+
* encrypted secret material are managed server-side by the pairing
|
|
7
|
+
* flow.
|
|
8
|
+
*
|
|
9
|
+
* Requires `confirm: true` because it authorises a second device to
|
|
10
|
+
* participate in the shared-secret exchange.
|
|
11
|
+
*/
|
|
12
|
+
export declare const secQrPairingJoinTool: Tool;
|
|
13
|
+
//# sourceMappingURL=sec-qr-pairing-join.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sec-qr-pairing-join.d.ts","sourceRoot":"","sources":["../../../src/tools/sec/sec-qr-pairing-join.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAStC;;;;;;;;;GASG;AACH,eAAO,MAAM,oBAAoB,EAAE,IAkDlC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { confirmFlagSchema, idempotencyKeySchema, writeHeadersWithIdempotency, } from '../_shared/side-effect.js';
|
|
5
|
+
/**
|
|
6
|
+
* Attach a joiner device to a QR pairing session
|
|
7
|
+
* (`sec_qr_pairing_sessions`). Only `joiner_device_id` and
|
|
8
|
+
* `metadata` are writable through this path — session_status and
|
|
9
|
+
* encrypted secret material are managed server-side by the pairing
|
|
10
|
+
* flow.
|
|
11
|
+
*
|
|
12
|
+
* Requires `confirm: true` because it authorises a second device to
|
|
13
|
+
* participate in the shared-secret exchange.
|
|
14
|
+
*/
|
|
15
|
+
export const secQrPairingJoinTool = {
|
|
16
|
+
name: 'sec_qr_pairing_join',
|
|
17
|
+
description: 'Attach a joiner device to an existing QR pairing session. Requires confirm=true, ' +
|
|
18
|
+
'the session id, and joiner_device_id. Retry-safe (converges on the same joined state).',
|
|
19
|
+
inputSchema: z.object({
|
|
20
|
+
id: z
|
|
21
|
+
.string()
|
|
22
|
+
.min(1)
|
|
23
|
+
.describe('UUID of the sec_qr_pairing_sessions row to join'),
|
|
24
|
+
joiner_device_id: z
|
|
25
|
+
.string()
|
|
26
|
+
.min(1)
|
|
27
|
+
.describe('UUID of the joining device'),
|
|
28
|
+
confirm: confirmFlagSchema,
|
|
29
|
+
idempotency_key: idempotencyKeySchema,
|
|
30
|
+
}),
|
|
31
|
+
capabilities: [cap('sec_qr_pairing_sessions', 'UPDATE')],
|
|
32
|
+
sideEffect: 'state_change',
|
|
33
|
+
confirmation: 'caller_confirms',
|
|
34
|
+
idempotency: 'natural_key',
|
|
35
|
+
handler: async (args, ctx) => {
|
|
36
|
+
const input = args;
|
|
37
|
+
const body = {
|
|
38
|
+
joiner_device_id: input.joiner_device_id,
|
|
39
|
+
};
|
|
40
|
+
try {
|
|
41
|
+
const rows = await ctx.apiClient.patch(`${ctx.apiClient.dbBasePath}/sec_qr_pairing_sessions?id=eq.${input.id}&select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
42
|
+
if (!rows || rows.length === 0) {
|
|
43
|
+
return errorResponse(API_ERROR, `SEC QR pairing session ${input.id} not found, expired, or not accessible`);
|
|
44
|
+
}
|
|
45
|
+
return successResponse(rows[0]);
|
|
46
|
+
}
|
|
47
|
+
catch (error) {
|
|
48
|
+
return errorResponse(API_ERROR, `Failed to join SEC QR pairing session: ${error.message}`);
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=sec-qr-pairing-join.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sec-qr-pairing-join.js","sourceRoot":"","sources":["../../../src/tools/sec/sec-qr-pairing-join.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO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,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC/B,OAAO,aAAa,CAClB,SAAS,EACT,0BAA0B,KAAK,CAAC,EAAE,wCAAwC,CAC3E,CAAC;YACJ,CAAC;YACD,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAClB,SAAS,EACT,0CAA0C,KAAK,CAAC,OAAO,EAAE,CAC1D,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Provisioning semantic tool: start a new QR pairing session
|
|
4
|
+
* (`sec_qr_pairing_sessions`). Creating a session opens a bounded
|
|
5
|
+
* window during which a second device may join and pair with the
|
|
6
|
+
* initiator, so this is a `provisioning` action that requires
|
|
7
|
+
* `confirm: true`.
|
|
8
|
+
*
|
|
9
|
+
* `encrypted_local_secret`, `encryption_nonce`, and `session_status`
|
|
10
|
+
* are DELIBERATELY not writable through this tool — the persist
|
|
11
|
+
* layer generates them server-side. `expires_at` is required so the
|
|
12
|
+
* caller commits to a bounded lifetime.
|
|
13
|
+
*
|
|
14
|
+
* Natural key: (tenant_id, user_id, initiator_device_id, expires_at)
|
|
15
|
+
* — reusing the same tuple with the same idempotency_key converges
|
|
16
|
+
* on the original session rather than opening a duplicate window.
|
|
17
|
+
*/
|
|
18
|
+
export declare const secQrPairingStartTool: Tool;
|
|
19
|
+
//# sourceMappingURL=sec-qr-pairing-start.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sec-qr-pairing-start.d.ts","sourceRoot":"","sources":["../../../src/tools/sec/sec-qr-pairing-start.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAStC;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,EAAE,IAsDnC,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { API_ERROR, errorResponse, successResponse } from '../types.js';
|
|
3
|
+
import { cap } from '../../capabilities/tool-capability.js';
|
|
4
|
+
import { confirmFlagSchema, idempotencyKeySchema, writeHeadersWithIdempotency, } from '../_shared/side-effect.js';
|
|
5
|
+
/**
|
|
6
|
+
* Provisioning semantic tool: start a new QR pairing session
|
|
7
|
+
* (`sec_qr_pairing_sessions`). Creating a session opens a bounded
|
|
8
|
+
* window during which a second device may join and pair with the
|
|
9
|
+
* initiator, so this is a `provisioning` action that requires
|
|
10
|
+
* `confirm: true`.
|
|
11
|
+
*
|
|
12
|
+
* `encrypted_local_secret`, `encryption_nonce`, and `session_status`
|
|
13
|
+
* are DELIBERATELY not writable through this tool — the persist
|
|
14
|
+
* layer generates them server-side. `expires_at` is required so the
|
|
15
|
+
* caller commits to a bounded lifetime.
|
|
16
|
+
*
|
|
17
|
+
* Natural key: (tenant_id, user_id, initiator_device_id, expires_at)
|
|
18
|
+
* — reusing the same tuple with the same idempotency_key converges
|
|
19
|
+
* on the original session rather than opening a duplicate window.
|
|
20
|
+
*/
|
|
21
|
+
export const secQrPairingStartTool = {
|
|
22
|
+
name: 'sec_qr_pairing_start',
|
|
23
|
+
description: 'Start a QR pairing session for the initiator device (sec_qr_pairing_sessions). ' +
|
|
24
|
+
'Requires confirm=true, user_id, and expires_at. Secrets and session_status are ' +
|
|
25
|
+
'assigned server-side and never written from MCP. Retry-safe.',
|
|
26
|
+
inputSchema: z.object({
|
|
27
|
+
user_id: z
|
|
28
|
+
.string()
|
|
29
|
+
.min(1)
|
|
30
|
+
.describe('UUID of the user owning this pairing session'),
|
|
31
|
+
initiator_device_id: z
|
|
32
|
+
.string()
|
|
33
|
+
.min(1)
|
|
34
|
+
.optional()
|
|
35
|
+
.describe('UUID of the initiator device (may be pending device registration)'),
|
|
36
|
+
expires_at: z
|
|
37
|
+
.string()
|
|
38
|
+
.datetime()
|
|
39
|
+
.describe('ISO-8601 timestamp after which the session is no longer usable. Required so ' +
|
|
40
|
+
'the caller commits to a bounded pairing window.'),
|
|
41
|
+
metadata: z.record(z.unknown()).optional(),
|
|
42
|
+
confirm: confirmFlagSchema,
|
|
43
|
+
idempotency_key: idempotencyKeySchema,
|
|
44
|
+
}),
|
|
45
|
+
capabilities: [cap('sec_qr_pairing_sessions', 'INSERT')],
|
|
46
|
+
sideEffect: 'provisioning',
|
|
47
|
+
confirmation: 'caller_confirms',
|
|
48
|
+
idempotency: 'natural_key',
|
|
49
|
+
handler: async (args, ctx) => {
|
|
50
|
+
const input = args;
|
|
51
|
+
const body = {
|
|
52
|
+
user_id: input.user_id,
|
|
53
|
+
expires_at: input.expires_at,
|
|
54
|
+
};
|
|
55
|
+
for (const field of ['initiator_device_id', 'metadata']) {
|
|
56
|
+
if (input[field] !== undefined)
|
|
57
|
+
body[field] = input[field];
|
|
58
|
+
}
|
|
59
|
+
try {
|
|
60
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/sec_qr_pairing_sessions?select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
61
|
+
return successResponse(rows[0]);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return errorResponse(API_ERROR, `Failed to start SEC QR pairing session: ${error.message}`);
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
//# sourceMappingURL=sec-qr-pairing-start.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sec-qr-pairing-start.js","sourceRoot":"","sources":["../../../src/tools/sec/sec-qr-pairing-start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,GAAG,EA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,KAAK,CAAC,KAAK,CAAC,KAAK,SAAS;gBAAE,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QAC7D,CAAC;QACD,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,IAAI,CACnC,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,mCAAmC,EAC9D,IAAI,EACJ,EAAE,OAAO,EAAE,2BAA2B,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAChE,CAAC;YACF,OAAO,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAClB,SAAS,EACT,2CAA2C,KAAK,CAAC,OAAO,EAAE,CAC3D,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -4,20 +4,20 @@ import { WRM_EFFECTIVE_MCP_SERVER_SELECT } from '../../wrm/projection.js';
|
|
|
4
4
|
import { cap } from '../../capabilities/tool-capability.js';
|
|
5
5
|
export const effectiveMcpServersTool = {
|
|
6
6
|
name: 'wrm_effective_mcp_servers',
|
|
7
|
-
description: 'Return the resolved MCP server set for
|
|
7
|
+
description: 'Return the resolved MCP server set for an assignment, merging definition defaults with assignment overrides. Includes source attribution.',
|
|
8
8
|
inputSchema: z.object({
|
|
9
|
-
|
|
9
|
+
assignment_id: z.string().describe('UUID of the worker role assignment'),
|
|
10
10
|
limit: z.number().optional().describe('Max results (default 50, max 200)'),
|
|
11
11
|
offset: z.number().optional().describe('Offset for pagination'),
|
|
12
12
|
}),
|
|
13
13
|
capabilities: [
|
|
14
|
-
cap('
|
|
14
|
+
cap('wrm_effective_assignment_mcp_servers', 'SELECT'),
|
|
15
15
|
],
|
|
16
16
|
handler: async (args, ctx) => {
|
|
17
17
|
const input = args;
|
|
18
18
|
try {
|
|
19
19
|
const parts = [];
|
|
20
|
-
parts.push(`
|
|
20
|
+
parts.push(`assignment_id=eq.${input.assignment_id}`);
|
|
21
21
|
const limit = Math.min(input.limit ?? 50, 200);
|
|
22
22
|
parts.push(`limit=${limit}`);
|
|
23
23
|
if (input.offset) {
|
|
@@ -25,7 +25,7 @@ export const effectiveMcpServersTool = {
|
|
|
25
25
|
}
|
|
26
26
|
parts.push('order=mcp_server_id.asc');
|
|
27
27
|
const query = parts.join('&');
|
|
28
|
-
const items = await ctx.apiClient.get(`/db/v1/
|
|
28
|
+
const items = await ctx.apiClient.get(`/db/v1/wrm_effective_assignment_mcp_servers?select=${WRM_EFFECTIVE_MCP_SERVER_SELECT}&${query}`, { headers: { Prefer: 'count=exact' } });
|
|
29
29
|
const offset = input.offset ?? 0;
|
|
30
30
|
return successResponse({
|
|
31
31
|
items,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrm-effective-mcp-servers.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-effective-mcp-servers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAE5D,MAAM,CAAC,MAAM,uBAAuB,GAAS;IAC3C,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"wrm-effective-mcp-servers.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-effective-mcp-servers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,GAA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B,IAAI,KAAK,EAAE,EAChG,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,CACvC,CAAC;YAEF,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;YAEjC,OAAO,eAAe,CAAC;gBACrB,KAAK;gBACL,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,WAAW,EAAE,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI;aAC5D,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAAC,SAAS,EAAE,yCAAyC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -4,28 +4,28 @@ import { WRM_EFFECTIVE_MCP_TOOL_SELECT } from '../../wrm/projection.js';
|
|
|
4
4
|
import { cap } from '../../capabilities/tool-capability.js';
|
|
5
5
|
export const effectiveMcpToolsTool = {
|
|
6
6
|
name: 'wrm_effective_mcp_tools',
|
|
7
|
-
description: 'Return the resolved
|
|
7
|
+
description: 'Return the resolved MCP tool allowlist for an assignment, merging definition defaults with assignment overrides. Includes source attribution.',
|
|
8
8
|
inputSchema: z.object({
|
|
9
|
-
|
|
9
|
+
assignment_id: z.string().describe('UUID of the worker role assignment'),
|
|
10
10
|
limit: z.number().optional().describe('Max results (default 50, max 200)'),
|
|
11
11
|
offset: z.number().optional().describe('Offset for pagination'),
|
|
12
12
|
}),
|
|
13
13
|
capabilities: [
|
|
14
|
-
cap('
|
|
14
|
+
cap('wrm_effective_assignment_mcp_tools', 'SELECT'),
|
|
15
15
|
],
|
|
16
16
|
handler: async (args, ctx) => {
|
|
17
17
|
const input = args;
|
|
18
18
|
try {
|
|
19
19
|
const parts = [];
|
|
20
|
-
parts.push(`
|
|
20
|
+
parts.push(`assignment_id=eq.${input.assignment_id}`);
|
|
21
21
|
const limit = Math.min(input.limit ?? 50, 200);
|
|
22
22
|
parts.push(`limit=${limit}`);
|
|
23
23
|
if (input.offset) {
|
|
24
24
|
parts.push(`offset=${input.offset}`);
|
|
25
25
|
}
|
|
26
|
-
parts.push('order=
|
|
26
|
+
parts.push('order=mcp_tool_id.asc');
|
|
27
27
|
const query = parts.join('&');
|
|
28
|
-
const items = await ctx.apiClient.get(`/db/v1/
|
|
28
|
+
const items = await ctx.apiClient.get(`/db/v1/wrm_effective_assignment_mcp_tools?select=${WRM_EFFECTIVE_MCP_TOOL_SELECT}&${query}`, { headers: { Prefer: 'count=exact' } });
|
|
29
29
|
const offset = input.offset ?? 0;
|
|
30
30
|
return successResponse({
|
|
31
31
|
items,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrm-effective-mcp-tools.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-effective-mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAE5D,MAAM,CAAC,MAAM,qBAAqB,GAAS;IACzC,IAAI,EAAE,yBAAyB;IAC/B,WAAW,EACT
|
|
1
|
+
{"version":3,"file":"wrm-effective-mcp-tools.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-effective-mcp-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AAExE,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAE5D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AAO,EAAE,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,CACvC,CAAC;YAEF,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;YAEjC,OAAO,eAAe,CAAC;gBACrB,KAAK;gBACL,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,WAAW,EAAE,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI;aAC5D,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAAC,SAAS,EAAE,uCAAuC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC1F,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -4,20 +4,20 @@ import { WRM_EFFECTIVE_MODEL_PREF_SELECT } from '../../wrm/projection.js';
|
|
|
4
4
|
import { cap } from '../../capabilities/tool-capability.js';
|
|
5
5
|
export const effectiveModelPrefsTool = {
|
|
6
6
|
name: 'wrm_effective_model_prefs',
|
|
7
|
-
description: 'Return the resolved model preference stack for
|
|
7
|
+
description: 'Return the resolved model preference stack for an assignment, merging definition defaults with assignment overrides. Includes source attribution.',
|
|
8
8
|
inputSchema: z.object({
|
|
9
|
-
|
|
9
|
+
assignment_id: z.string().describe('UUID of the worker role assignment'),
|
|
10
10
|
limit: z.number().optional().describe('Max results (default 50, max 200)'),
|
|
11
11
|
offset: z.number().optional().describe('Offset for pagination'),
|
|
12
12
|
}),
|
|
13
13
|
capabilities: [
|
|
14
|
-
cap('
|
|
14
|
+
cap('wrm_effective_assignment_model_prefs', 'SELECT'),
|
|
15
15
|
],
|
|
16
16
|
handler: async (args, ctx) => {
|
|
17
17
|
const input = args;
|
|
18
18
|
try {
|
|
19
19
|
const parts = [];
|
|
20
|
-
parts.push(`
|
|
20
|
+
parts.push(`assignment_id=eq.${input.assignment_id}`);
|
|
21
21
|
const limit = Math.min(input.limit ?? 50, 200);
|
|
22
22
|
parts.push(`limit=${limit}`);
|
|
23
23
|
if (input.offset) {
|
|
@@ -25,7 +25,7 @@ export const effectiveModelPrefsTool = {
|
|
|
25
25
|
}
|
|
26
26
|
parts.push('order=priority.asc');
|
|
27
27
|
const query = parts.join('&');
|
|
28
|
-
const items = await ctx.apiClient.get(`/db/v1/
|
|
28
|
+
const items = await ctx.apiClient.get(`/db/v1/wrm_effective_assignment_model_prefs?select=${WRM_EFFECTIVE_MODEL_PREF_SELECT}&${query}`, { headers: { Prefer: 'count=exact' } });
|
|
29
29
|
const offset = input.offset ?? 0;
|
|
30
30
|
return successResponse({
|
|
31
31
|
items,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrm-effective-model-prefs.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-effective-model-prefs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAE5D,MAAM,CAAC,MAAM,uBAAuB,GAAS;IAC3C,IAAI,EAAE,2BAA2B;IACjC,WAAW,EACT,
|
|
1
|
+
{"version":3,"file":"wrm-effective-model-prefs.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-effective-model-prefs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,+BAA+B,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,GAAG,EAAE,MAAM,uCAAuC,CAAC;AAE5D,MAAM,CAAC,MAAM,uBAAuB,GAAS;IAC3C,IAAI,EAAE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,CAAC;YAEF,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;YAEjC,OAAO,eAAe,CAAC;gBACrB,KAAK;gBACL,KAAK,EAAE,KAAK,CAAC,MAAM;gBACnB,WAAW,EAAE,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,IAAI;aAC5D,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,aAAa,CAAC,SAAS,EAAE,yCAAyC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5F,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrm-worker-resolve-config.d.ts","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-worker-resolve-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"wrm-worker-resolve-config.d.ts","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-worker-resolve-config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AA4BtC,eAAO,MAAM,uBAAuB,EAAE,IAgLrC,CAAC"}
|
|
@@ -1,37 +1,45 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { successResponse, errorResponse, WRM_NOT_FOUND, API_ERROR } from '../types.js';
|
|
3
|
-
import { WRM_WORKER_SELECT, WRM_WORKER_DEFINITION_SELECT, WRM_ROLE_SELECT, WRM_EFFECTIVE_MODEL_PREF_SELECT, WRM_EFFECTIVE_MCP_SERVER_SELECT, WRM_EFFECTIVE_MCP_TOOL_SELECT, WRM_ROLE_MEMORY_SELECT, WRM_SANDBOX_PROVIDER_SELECT, } from '../../wrm/projection.js';
|
|
3
|
+
import { WRM_WORKER_SELECT, WRM_WORKER_DEFINITION_SELECT, WRM_WORKER_ROLE_ASSIGNMENT_SELECT, WRM_ROLE_SELECT, WRM_EFFECTIVE_MODEL_PREF_SELECT, WRM_EFFECTIVE_MCP_SERVER_SELECT, WRM_EFFECTIVE_MCP_TOOL_SELECT, WRM_ROLE_MEMORY_SELECT, WRM_SANDBOX_PROVIDER_SELECT, } from '../../wrm/projection.js';
|
|
4
4
|
import { generateEmbedding, toPgvectorLiteral, resolveEmbeddingConfig } from '../../wrm/embedding.js';
|
|
5
5
|
import { cap, rpcCap } from '../../capabilities/tool-capability.js';
|
|
6
6
|
export const workerResolveConfigTool = {
|
|
7
7
|
name: 'wrm_worker_resolve_config',
|
|
8
|
-
description: 'Return a worker\'s full resolved configuration in a single call — ' +
|
|
9
|
-
'worker instance, definition, role, effective model stack, MCP servers, ' +
|
|
8
|
+
description: 'Return a worker\'s full resolved configuration for a specific assignment in a single call — ' +
|
|
9
|
+
'assignment, worker instance, definition, role, effective model stack, MCP servers, ' +
|
|
10
10
|
'MCP tools, role memories (including semantically-relevant ones when ' +
|
|
11
11
|
'work_item_description is provided), and resolved sandbox provider. ' +
|
|
12
12
|
'Replaces the 8+ CRUD call sequence.',
|
|
13
13
|
inputSchema: z.object({
|
|
14
|
-
|
|
14
|
+
assignment_id: z.string().describe('UUID of the worker role assignment'),
|
|
15
15
|
work_item_description: z.string().optional().describe('Optional work item description for semantic memory matching. ' +
|
|
16
16
|
'When provided, generates an embedding and retrieves semantically-relevant ' +
|
|
17
17
|
'memories in addition to role-matched ones.'),
|
|
18
18
|
}),
|
|
19
19
|
capabilities: [
|
|
20
|
-
cap('
|
|
21
|
-
cap('
|
|
22
|
-
cap('
|
|
20
|
+
cap('wrm_effective_assignment_mcp_servers', 'SELECT'),
|
|
21
|
+
cap('wrm_effective_assignment_mcp_tools', 'SELECT'),
|
|
22
|
+
cap('wrm_effective_assignment_model_prefs', 'SELECT'),
|
|
23
23
|
cap('wrm_role_memories', 'SELECT'),
|
|
24
24
|
cap('wrm_roles', 'SELECT'),
|
|
25
25
|
cap('wrm_sandbox_providers', 'SELECT'),
|
|
26
26
|
cap('wrm_worker_definitions', 'SELECT'),
|
|
27
|
+
cap('wrm_worker_role_assignments', 'SELECT'),
|
|
27
28
|
cap('wrm_workers', 'SELECT'),
|
|
28
29
|
...rpcCap('wrm_semantic_memory_search'),
|
|
29
30
|
...rpcCap('wrm_update_memory_access'),
|
|
30
31
|
],
|
|
31
32
|
handler: async (args, ctx) => {
|
|
32
|
-
const {
|
|
33
|
+
const { assignment_id, work_item_description } = args;
|
|
33
34
|
try {
|
|
34
|
-
// Phase 1: fetch
|
|
35
|
+
// Phase 1: fetch assignment (must succeed before we can look up worker/definition/role)
|
|
36
|
+
const assignments = await ctx.apiClient.get(`/db/v1/wrm_worker_role_assignments?id=eq.${assignment_id}&select=${WRM_WORKER_ROLE_ASSIGNMENT_SELECT}`);
|
|
37
|
+
if (!assignments.length) {
|
|
38
|
+
return errorResponse(WRM_NOT_FOUND, `Assignment ${assignment_id} not found`);
|
|
39
|
+
}
|
|
40
|
+
const assignment = assignments[0];
|
|
41
|
+
const worker_id = assignment.worker_id;
|
|
42
|
+
// Phase 2: fetch worker (need worker_id from assignment)
|
|
35
43
|
const workers = await ctx.apiClient.get(`/db/v1/wrm_workers?id=eq.${worker_id}&select=${WRM_WORKER_SELECT}`);
|
|
36
44
|
if (!workers.length) {
|
|
37
45
|
return errorResponse(WRM_NOT_FOUND, `Worker ${worker_id} not found`);
|
|
@@ -40,25 +48,28 @@ export const workerResolveConfigTool = {
|
|
|
40
48
|
if (worker.status !== 'ACTIVE') {
|
|
41
49
|
return errorResponse(WRM_NOT_FOUND, `Worker ${worker_id} is not active (status: ${worker.status})`);
|
|
42
50
|
}
|
|
43
|
-
// Phase
|
|
44
|
-
|
|
51
|
+
// Phase 3: fetch definition (worker_definition_id lives on the assignment)
|
|
52
|
+
if (!assignment.worker_definition_id) {
|
|
53
|
+
return errorResponse(WRM_NOT_FOUND, `Assignment ${assignment_id} has no worker definition`);
|
|
54
|
+
}
|
|
55
|
+
const definitions = await ctx.apiClient.get(`/db/v1/wrm_worker_definitions?id=eq.${assignment.worker_definition_id}&select=${WRM_WORKER_DEFINITION_SELECT}`);
|
|
45
56
|
if (!definitions.length) {
|
|
46
|
-
return errorResponse(WRM_NOT_FOUND, `Worker definition ${
|
|
57
|
+
return errorResponse(WRM_NOT_FOUND, `Worker definition ${assignment.worker_definition_id} not found`);
|
|
47
58
|
}
|
|
48
59
|
const definition = definitions[0];
|
|
49
60
|
// Resolve sandbox provider code from definition metadata
|
|
50
61
|
const sandboxProviderCode = typeof definition.metadata?.sandbox_provider === 'string'
|
|
51
62
|
? definition.metadata.sandbox_provider
|
|
52
63
|
: 'LOCAL';
|
|
53
|
-
// Phase
|
|
64
|
+
// Phase 4: fetch role + all effective views + role memories in parallel
|
|
54
65
|
const roleId = definition.role_id;
|
|
55
66
|
const [roleResult, modelStack, mcpServers, mcpTools, roleMemories, sandboxProviderResult] = await Promise.all([
|
|
56
67
|
roleId
|
|
57
68
|
? ctx.apiClient.get(`/db/v1/wrm_roles?id=eq.${roleId}&select=${WRM_ROLE_SELECT}`)
|
|
58
69
|
: Promise.resolve([]),
|
|
59
|
-
ctx.apiClient.get(`/db/v1/
|
|
60
|
-
ctx.apiClient.get(`/db/v1/
|
|
61
|
-
ctx.apiClient.get(`/db/v1/
|
|
70
|
+
ctx.apiClient.get(`/db/v1/wrm_effective_assignment_model_prefs?assignment_id=eq.${assignment_id}&select=${WRM_EFFECTIVE_MODEL_PREF_SELECT}&order=priority.asc&limit=200`),
|
|
71
|
+
ctx.apiClient.get(`/db/v1/wrm_effective_assignment_mcp_servers?assignment_id=eq.${assignment_id}&select=${WRM_EFFECTIVE_MCP_SERVER_SELECT}&order=mcp_server_id.asc&limit=200`),
|
|
72
|
+
ctx.apiClient.get(`/db/v1/wrm_effective_assignment_mcp_tools?assignment_id=eq.${assignment_id}&select=${WRM_EFFECTIVE_MCP_TOOL_SELECT}&order=mcp_tool_id.asc&limit=200`),
|
|
62
73
|
roleId
|
|
63
74
|
? ctx.apiClient.get(`/db/v1/wrm_role_memories?role_id=eq.${roleId}&active=eq.true&select=${WRM_ROLE_MEMORY_SELECT}&order=title.asc&limit=200`)
|
|
64
75
|
: Promise.resolve([]),
|
|
@@ -68,7 +79,7 @@ export const workerResolveConfigTool = {
|
|
|
68
79
|
]);
|
|
69
80
|
const role = roleResult.length ? roleResult[0] : null;
|
|
70
81
|
const sandboxProvider = sandboxProviderResult.length ? sandboxProviderResult[0] : null;
|
|
71
|
-
// Phase
|
|
82
|
+
// Phase 5: semantic memory matching (when work_item_description is provided)
|
|
72
83
|
let mergedMemories = roleMemories;
|
|
73
84
|
if (work_item_description && roleId) {
|
|
74
85
|
const embeddingConfig = ctx.config.embedding ?? resolveEmbeddingConfig();
|
|
@@ -101,6 +112,7 @@ export const workerResolveConfigTool = {
|
|
|
101
112
|
}
|
|
102
113
|
}
|
|
103
114
|
return successResponse({
|
|
115
|
+
assignment,
|
|
104
116
|
worker,
|
|
105
117
|
definition,
|
|
106
118
|
role,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrm-worker-resolve-config.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-worker-resolve-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACvF,OAAO,EACL,iBAAiB,EACjB,4BAA4B,EAC5B,eAAe,EACf,+BAA+B,EAC/B,+BAA+B,EAC/B,6BAA6B,EAC7B,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"wrm-worker-resolve-config.js","sourceRoot":"","sources":["../../../src/tools/wrm/wrm-worker-resolve-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OA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