@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,70 @@
|
|
|
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
|
+
* Grant a user a role assignment (`hrm_user_role_assignments`).
|
|
7
|
+
*
|
|
8
|
+
* A role grant confers durable authority inside the tenant, so this
|
|
9
|
+
* is a `provisioning` action that requires `confirm: true` and
|
|
10
|
+
* documents its natural key: (tenant_id, user_id, user_role_id).
|
|
11
|
+
* Reusing the same natural key with the same start_date converges on
|
|
12
|
+
* the original grant rather than creating a duplicate row.
|
|
13
|
+
*
|
|
14
|
+
* `active` and lifecycle transitions are NOT settable through this
|
|
15
|
+
* path — a grant is created active by default. Revocation is a
|
|
16
|
+
* separate semantic tool (`hrm_user_role_unassign`) that carries a
|
|
17
|
+
* reason for the audit trail.
|
|
18
|
+
*/
|
|
19
|
+
export const hrmUserRoleAssignTool = {
|
|
20
|
+
name: 'hrm_user_role_assign',
|
|
21
|
+
description: 'Grant a user a role assignment (hrm_user_role_assignments). Requires confirm=true, ' +
|
|
22
|
+
'user_id, and user_role_id; tenant_id is inferred from the caller. Natural key: ' +
|
|
23
|
+
'(tenant_id, user_id, user_role_id). Retry-safe.',
|
|
24
|
+
inputSchema: z.object({
|
|
25
|
+
user_id: z
|
|
26
|
+
.string()
|
|
27
|
+
.min(1)
|
|
28
|
+
.describe('UUID of the user receiving the role assignment'),
|
|
29
|
+
user_role_id: z
|
|
30
|
+
.string()
|
|
31
|
+
.min(1)
|
|
32
|
+
.describe('UUID of the hrm_user_roles row being granted'),
|
|
33
|
+
start_date: z
|
|
34
|
+
.string()
|
|
35
|
+
.datetime()
|
|
36
|
+
.optional()
|
|
37
|
+
.describe('Optional ISO-8601 start date; defaults to the persist backend clock'),
|
|
38
|
+
end_date: z
|
|
39
|
+
.string()
|
|
40
|
+
.datetime()
|
|
41
|
+
.optional()
|
|
42
|
+
.describe('Optional ISO-8601 end date; grants without an end date are open-ended'),
|
|
43
|
+
metadata: z.record(z.unknown()).optional(),
|
|
44
|
+
confirm: confirmFlagSchema,
|
|
45
|
+
idempotency_key: idempotencyKeySchema,
|
|
46
|
+
}),
|
|
47
|
+
capabilities: [cap('hrm_user_role_assignments', 'INSERT')],
|
|
48
|
+
sideEffect: 'provisioning',
|
|
49
|
+
confirmation: 'caller_confirms',
|
|
50
|
+
idempotency: 'natural_key',
|
|
51
|
+
handler: async (args, ctx) => {
|
|
52
|
+
const input = args;
|
|
53
|
+
const body = {
|
|
54
|
+
user_id: input.user_id,
|
|
55
|
+
user_role_id: input.user_role_id,
|
|
56
|
+
};
|
|
57
|
+
for (const field of ['start_date', 'end_date', 'metadata']) {
|
|
58
|
+
if (input[field] !== undefined)
|
|
59
|
+
body[field] = input[field];
|
|
60
|
+
}
|
|
61
|
+
try {
|
|
62
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/hrm_user_role_assignments?select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
63
|
+
return successResponse(rows[0]);
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
return errorResponse(API_ERROR, `Failed to grant HRM user role assignment: ${error.message}`);
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=hrm-user-role-assign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrm-user-role-assign.js","sourceRoot":"","sources":["../../../src/tools/hrm/hrm-user-role-assign.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;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M,KAAK,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;YAC3D,IAAI,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,qCAAqC,EAChE,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,6CAA6C,KAAK,CAAC,OAAO,EAAE,CAC7D,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Remove a parent → child role inheritance by soft-closing the row:
|
|
4
|
+
* set `active=false` and stamp `end_date`. Breaks policy inheritance
|
|
5
|
+
* for every user in the child role, so this requires confirm=true and
|
|
6
|
+
* a reason.
|
|
7
|
+
*/
|
|
8
|
+
export declare const hrmUserRoleParentRemoveTool: Tool;
|
|
9
|
+
//# sourceMappingURL=hrm-user-role-parent-remove.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrm-user-role-parent-remove.d.ts","sourceRoot":"","sources":["../../../src/tools/hrm/hrm-user-role-parent-remove.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAUtC;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,EAAE,IAqDzC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
* Remove a parent → child role inheritance by soft-closing the row:
|
|
7
|
+
* set `active=false` and stamp `end_date`. Breaks policy inheritance
|
|
8
|
+
* for every user in the child role, so this requires confirm=true and
|
|
9
|
+
* a reason.
|
|
10
|
+
*/
|
|
11
|
+
export const hrmUserRoleParentRemoveTool = {
|
|
12
|
+
name: 'hrm_user_role_parent_remove',
|
|
13
|
+
description: 'Remove a role parent-child inheritance link by soft-closing the row ' +
|
|
14
|
+
'(active=false, end_date=now). Requires confirm=true and a reason. Retry-safe.',
|
|
15
|
+
inputSchema: z.object({
|
|
16
|
+
id: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(1)
|
|
19
|
+
.describe('UUID of the hrm_user_role_parents row to remove'),
|
|
20
|
+
end_date: z.string().datetime().optional(),
|
|
21
|
+
confirm: confirmFlagSchema,
|
|
22
|
+
reason: reasonSchema.describe('Human-readable justification recorded on the audit trail'),
|
|
23
|
+
idempotency_key: idempotencyKeySchema,
|
|
24
|
+
}),
|
|
25
|
+
capabilities: [cap('hrm_user_role_parents', 'UPDATE')],
|
|
26
|
+
sideEffect: 'state_change',
|
|
27
|
+
confirmation: 'caller_confirms',
|
|
28
|
+
idempotency: 'natural_key',
|
|
29
|
+
handler: async (args, ctx) => {
|
|
30
|
+
const input = args;
|
|
31
|
+
const body = {
|
|
32
|
+
active: false,
|
|
33
|
+
metadata: { remove_reason: input.reason },
|
|
34
|
+
};
|
|
35
|
+
if (input.end_date !== undefined)
|
|
36
|
+
body.end_date = input.end_date;
|
|
37
|
+
try {
|
|
38
|
+
const rows = await ctx.apiClient.patch(`${ctx.apiClient.dbBasePath}/hrm_user_role_parents?id=eq.${input.id}&select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
39
|
+
if (!rows || rows.length === 0) {
|
|
40
|
+
return errorResponse(API_ERROR, `HRM role parent link ${input.id} not found or not accessible`);
|
|
41
|
+
}
|
|
42
|
+
return successResponse(rows[0]);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return errorResponse(API_ERROR, `Failed to remove HRM role parent link: ${error.message}`);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=hrm-user-role-parent-remove.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrm-user-role-parent-remove.js","sourceRoot":"","sources":["../../../src/tools/hrm/hrm-user-role-parent-remove.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;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAS;IAC/C,IAAI,EAAE,6BAA6B;IACnC,WAAW,EACT,sEAAsE;QACtE,+EAA+E;IACjF,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,iDAAiD,CAAC;QAC9D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC1C,OAAO,EAAE,iBAAiB;QAC1B,MAAM,EAAE,YAAY,CAAC,QAAQ,CAC3B,0DAA0D,CAC3D;QACD,eAAe,EAAE,oB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
* (`hrm_user_role_parents`). The child role inherits every policy of
|
|
5
|
+
* the parent, so this is a `provisioning` action that requires
|
|
6
|
+
* `confirm: true`.
|
|
7
|
+
*
|
|
8
|
+
* Natural key: (tenant_id, parent_role_id, child_role_id).
|
|
9
|
+
*/
|
|
10
|
+
export declare const hrmUserRoleParentSetTool: Tool;
|
|
11
|
+
//# sourceMappingURL=hrm-user-role-parent-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrm-user-role-parent-set.d.ts","sourceRoot":"","sources":["../../../src/tools/hrm/hrm-user-role-parent-set.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAStC;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB,EAAE,IAsDtC,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
* Establish a parent→child inheritance link between two roles
|
|
7
|
+
* (`hrm_user_role_parents`). The child role inherits every policy of
|
|
8
|
+
* the parent, so this is a `provisioning` action that requires
|
|
9
|
+
* `confirm: true`.
|
|
10
|
+
*
|
|
11
|
+
* Natural key: (tenant_id, parent_role_id, child_role_id).
|
|
12
|
+
*/
|
|
13
|
+
export const hrmUserRoleParentSetTool = {
|
|
14
|
+
name: 'hrm_user_role_parent_set',
|
|
15
|
+
description: 'Establish a parent → child inheritance link between two roles ' +
|
|
16
|
+
'(hrm_user_role_parents). Requires confirm=true, parent_role_id, and ' +
|
|
17
|
+
'child_role_id. Natural key: (tenant_id, parent_role_id, child_role_id). Retry-safe.',
|
|
18
|
+
inputSchema: z.object({
|
|
19
|
+
parent_role_id: z
|
|
20
|
+
.string()
|
|
21
|
+
.min(1)
|
|
22
|
+
.describe('UUID of the hrm_user_roles row whose policies are inherited'),
|
|
23
|
+
child_role_id: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.describe('UUID of the hrm_user_roles row that will inherit the parent policies'),
|
|
27
|
+
start_date: z.string().datetime().optional(),
|
|
28
|
+
end_date: z.string().datetime().optional(),
|
|
29
|
+
metadata: z.record(z.unknown()).optional(),
|
|
30
|
+
confirm: confirmFlagSchema,
|
|
31
|
+
idempotency_key: idempotencyKeySchema,
|
|
32
|
+
}),
|
|
33
|
+
capabilities: [cap('hrm_user_role_parents', 'INSERT')],
|
|
34
|
+
sideEffect: 'provisioning',
|
|
35
|
+
confirmation: 'caller_confirms',
|
|
36
|
+
idempotency: 'natural_key',
|
|
37
|
+
handler: async (args, ctx) => {
|
|
38
|
+
const input = args;
|
|
39
|
+
if (input.parent_role_id === input.child_role_id) {
|
|
40
|
+
return errorResponse(API_ERROR, 'parent_role_id and child_role_id must differ — a role cannot inherit from itself.');
|
|
41
|
+
}
|
|
42
|
+
const body = {
|
|
43
|
+
parent_role_id: input.parent_role_id,
|
|
44
|
+
child_role_id: input.child_role_id,
|
|
45
|
+
};
|
|
46
|
+
for (const field of ['start_date', 'end_date', 'metadata']) {
|
|
47
|
+
if (input[field] !== undefined)
|
|
48
|
+
body[field] = input[field];
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/hrm_user_role_parents?select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
52
|
+
return successResponse(rows[0]);
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
return errorResponse(API_ERROR, `Failed to set HRM role parent: ${error.message}`);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
//# sourceMappingURL=hrm-user-role-parent-set.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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AK,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,IAA2B,CAAC;QAC1C,IAAI,KAAK,CAAC,cAAc,KAAK,KAAK,CAAC,aAAa,EAAE,CAAC;YACjD,OAAO,aAAa,CAClB,SAAS,EACT,mFAAmF,CACpF,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAwB;YAChC,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,aAAa,EAAE,KAAK,CAAC,aAAa;SACnC,CAAC;QACF,KAAK,MAAM,KAAK,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;YAC3D,IAAI,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,iCAAiC,EAC5D,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,kCAAkC,KAAK,CAAC,OAAO,EAAE,CAClD,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Attach an authorization policy to a role
|
|
4
|
+
* (`hrm_user_role_policy_assignments`). Every user holding the role
|
|
5
|
+
* transitively receives the policy, so this is a high-fanout
|
|
6
|
+
* `provisioning` action that requires `confirm: true`.
|
|
7
|
+
*
|
|
8
|
+
* Natural key: (tenant_id, user_role_id, authorization_policy_id).
|
|
9
|
+
*/
|
|
10
|
+
export declare const hrmUserRolePolicyAssignTool: Tool;
|
|
11
|
+
//# sourceMappingURL=hrm-user-role-policy-assign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrm-user-role-policy-assign.d.ts","sourceRoot":"","sources":["../../../src/tools/hrm/hrm-user-role-policy-assign.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAStC;;;;;;;GAOG;AACH,eAAO,MAAM,2BAA2B,EAAE,IAgDzC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 an authorization policy to a role
|
|
7
|
+
* (`hrm_user_role_policy_assignments`). Every user holding the role
|
|
8
|
+
* transitively receives the policy, so this is a high-fanout
|
|
9
|
+
* `provisioning` action that requires `confirm: true`.
|
|
10
|
+
*
|
|
11
|
+
* Natural key: (tenant_id, user_role_id, authorization_policy_id).
|
|
12
|
+
*/
|
|
13
|
+
export const hrmUserRolePolicyAssignTool = {
|
|
14
|
+
name: 'hrm_user_role_policy_assign',
|
|
15
|
+
description: 'Attach an authorization policy to a role (hrm_user_role_policy_assignments). ' +
|
|
16
|
+
'Requires confirm=true, user_role_id, and authorization_policy_id. ' +
|
|
17
|
+
'Natural key: (tenant_id, user_role_id, authorization_policy_id). Retry-safe.',
|
|
18
|
+
inputSchema: z.object({
|
|
19
|
+
user_role_id: z
|
|
20
|
+
.string()
|
|
21
|
+
.min(1)
|
|
22
|
+
.describe('UUID of the hrm_user_roles row receiving the policy attachment'),
|
|
23
|
+
authorization_policy_id: z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.describe('UUID of the hrm_authorization_policies row being attached'),
|
|
27
|
+
start_date: z.string().datetime().optional(),
|
|
28
|
+
end_date: z.string().datetime().optional(),
|
|
29
|
+
metadata: z.record(z.unknown()).optional(),
|
|
30
|
+
confirm: confirmFlagSchema,
|
|
31
|
+
idempotency_key: idempotencyKeySchema,
|
|
32
|
+
}),
|
|
33
|
+
capabilities: [cap('hrm_user_role_policy_assignments', 'INSERT')],
|
|
34
|
+
sideEffect: 'provisioning',
|
|
35
|
+
confirmation: 'caller_confirms',
|
|
36
|
+
idempotency: 'natural_key',
|
|
37
|
+
handler: async (args, ctx) => {
|
|
38
|
+
const input = args;
|
|
39
|
+
const body = {
|
|
40
|
+
user_role_id: input.user_role_id,
|
|
41
|
+
authorization_policy_id: input.authorization_policy_id,
|
|
42
|
+
};
|
|
43
|
+
for (const field of ['start_date', 'end_date', 'metadata']) {
|
|
44
|
+
if (input[field] !== undefined)
|
|
45
|
+
body[field] = input[field];
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const rows = await ctx.apiClient.post(`${ctx.apiClient.dbBasePath}/hrm_user_role_policy_assignments?select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
49
|
+
return successResponse(rows[0]);
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return errorResponse(API_ERROR, `Failed to attach HRM role policy assignment: ${error.message}`);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=hrm-user-role-policy-assign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrm-user-role-policy-assign.js","sourceRoot":"","sources":["../../../src/tools/hrm/hrm-user-role-policy-assign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,aA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,MAAM,KAAK,IAAI,CAAC,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,EAAE,CAAC;YAC3D,IAAI,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,4CAA4C,EACvE,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,gDAAgD,KAAK,CAAC,OAAO,EAAE,CAChE,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Detach an authorization policy from a role by soft-closing the row:
|
|
4
|
+
* set `active=false` and stamp `end_date`. Every user holding the role
|
|
5
|
+
* loses the transitive policy, so this requires confirm=true and a
|
|
6
|
+
* reason for the audit trail.
|
|
7
|
+
*/
|
|
8
|
+
export declare const hrmUserRolePolicyUnassignTool: Tool;
|
|
9
|
+
//# sourceMappingURL=hrm-user-role-policy-unassign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrm-user-role-policy-unassign.d.ts","sourceRoot":"","sources":["../../../src/tools/hrm/hrm-user-role-policy-unassign.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAUtC;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,EAAE,IAqD3C,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
* Detach an authorization policy from a role by soft-closing the row:
|
|
7
|
+
* set `active=false` and stamp `end_date`. Every user holding the role
|
|
8
|
+
* loses the transitive policy, so this requires confirm=true and a
|
|
9
|
+
* reason for the audit trail.
|
|
10
|
+
*/
|
|
11
|
+
export const hrmUserRolePolicyUnassignTool = {
|
|
12
|
+
name: 'hrm_user_role_policy_unassign',
|
|
13
|
+
description: 'Detach an authorization policy from a role by soft-closing the row ' +
|
|
14
|
+
'(active=false, end_date=now). Requires confirm=true and a reason. Retry-safe.',
|
|
15
|
+
inputSchema: z.object({
|
|
16
|
+
id: z
|
|
17
|
+
.string()
|
|
18
|
+
.min(1)
|
|
19
|
+
.describe('UUID of the hrm_user_role_policy_assignments row to detach'),
|
|
20
|
+
end_date: z.string().datetime().optional(),
|
|
21
|
+
confirm: confirmFlagSchema,
|
|
22
|
+
reason: reasonSchema.describe('Human-readable justification recorded on the audit trail'),
|
|
23
|
+
idempotency_key: idempotencyKeySchema,
|
|
24
|
+
}),
|
|
25
|
+
capabilities: [cap('hrm_user_role_policy_assignments', 'UPDATE')],
|
|
26
|
+
sideEffect: 'state_change',
|
|
27
|
+
confirmation: 'caller_confirms',
|
|
28
|
+
idempotency: 'natural_key',
|
|
29
|
+
handler: async (args, ctx) => {
|
|
30
|
+
const input = args;
|
|
31
|
+
const body = {
|
|
32
|
+
active: false,
|
|
33
|
+
metadata: { unassign_reason: input.reason },
|
|
34
|
+
};
|
|
35
|
+
if (input.end_date !== undefined)
|
|
36
|
+
body.end_date = input.end_date;
|
|
37
|
+
try {
|
|
38
|
+
const rows = await ctx.apiClient.patch(`${ctx.apiClient.dbBasePath}/hrm_user_role_policy_assignments?id=eq.${input.id}&select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
39
|
+
if (!rows || rows.length === 0) {
|
|
40
|
+
return errorResponse(API_ERROR, `HRM role policy assignment ${input.id} not found or not accessible`);
|
|
41
|
+
}
|
|
42
|
+
return successResponse(rows[0]);
|
|
43
|
+
}
|
|
44
|
+
catch (error) {
|
|
45
|
+
return errorResponse(API_ERROR, `Failed to detach HRM role policy assignment: ${error.message}`);
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=hrm-user-role-policy-unassign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrm-user-role-policy-unassign.js","sourceRoot":"","sources":["../../../src/tools/hrm/hrm-user-role-policy-unassign.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;;;;;GAKG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAS;IACjD,IAAI,EAAE,+BAA+B;IACrC,WAAW,EACT,qEAAqE;QACrE,+EAA+E;IACjF,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC;QACpB,EAAE,EAAE,CAAC;aACF,MAAM,EAAE;aACR,GAAG,CAAC,CAAC,CAAC;aACN,QAAQ,CAAC,4DAA4D,CAAC;QACzE,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;QAC1C,OAAO,EAAE,iBAAiB;QAC1B,MAAM,EAAE,YAAY,CAAC,QAAQ,CAC3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* Revoke a user role assignment by soft-closing the row: set
|
|
4
|
+
* `active=false` and stamp `end_date`. A revocation is an
|
|
5
|
+
* administrative security transition, so the tool requires both
|
|
6
|
+
* `confirm: true` AND a `reason` for the audit trail.
|
|
7
|
+
*
|
|
8
|
+
* Retry-safe: repeat calls converge on the same closed state; the
|
|
9
|
+
* `end_date` is only stamped on the first call so subsequent retries
|
|
10
|
+
* preserve the original close timestamp.
|
|
11
|
+
*/
|
|
12
|
+
export declare const hrmUserRoleUnassignTool: Tool;
|
|
13
|
+
//# sourceMappingURL=hrm-user-role-unassign.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hrm-user-role-unassign.d.ts","sourceRoot":"","sources":["../../../src/tools/hrm/hrm-user-role-unassign.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAUtC;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,EAAE,IA2DrC,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
* Revoke a user role assignment by soft-closing the row: set
|
|
7
|
+
* `active=false` and stamp `end_date`. A revocation is an
|
|
8
|
+
* administrative security transition, so the tool requires both
|
|
9
|
+
* `confirm: true` AND a `reason` for the audit trail.
|
|
10
|
+
*
|
|
11
|
+
* Retry-safe: repeat calls converge on the same closed state; the
|
|
12
|
+
* `end_date` is only stamped on the first call so subsequent retries
|
|
13
|
+
* preserve the original close timestamp.
|
|
14
|
+
*/
|
|
15
|
+
export const hrmUserRoleUnassignTool = {
|
|
16
|
+
name: 'hrm_user_role_unassign',
|
|
17
|
+
description: 'Revoke a user role assignment by soft-closing the row (active=false, end_date=now). ' +
|
|
18
|
+
'Requires confirm=true and a reason for the audit trail. Retry-safe.',
|
|
19
|
+
inputSchema: z.object({
|
|
20
|
+
id: z
|
|
21
|
+
.string()
|
|
22
|
+
.min(1)
|
|
23
|
+
.describe('UUID of the hrm_user_role_assignments row to revoke'),
|
|
24
|
+
end_date: z
|
|
25
|
+
.string()
|
|
26
|
+
.datetime()
|
|
27
|
+
.optional()
|
|
28
|
+
.describe('Optional ISO-8601 revocation timestamp; defaults to the persist backend clock'),
|
|
29
|
+
confirm: confirmFlagSchema,
|
|
30
|
+
reason: reasonSchema.describe('Human-readable justification recorded on the audit trail'),
|
|
31
|
+
idempotency_key: idempotencyKeySchema,
|
|
32
|
+
}),
|
|
33
|
+
capabilities: [cap('hrm_user_role_assignments', 'UPDATE')],
|
|
34
|
+
sideEffect: 'state_change',
|
|
35
|
+
confirmation: 'caller_confirms',
|
|
36
|
+
idempotency: 'natural_key',
|
|
37
|
+
handler: async (args, ctx) => {
|
|
38
|
+
const input = args;
|
|
39
|
+
const body = {
|
|
40
|
+
active: false,
|
|
41
|
+
metadata: { revoke_reason: input.reason },
|
|
42
|
+
};
|
|
43
|
+
if (input.end_date !== undefined)
|
|
44
|
+
body.end_date = input.end_date;
|
|
45
|
+
try {
|
|
46
|
+
const rows = await ctx.apiClient.patch(`${ctx.apiClient.dbBasePath}/hrm_user_role_assignments?id=eq.${input.id}&select=*`, body, { headers: writeHeadersWithIdempotency(input.idempotency_key) });
|
|
47
|
+
if (!rows || rows.length === 0) {
|
|
48
|
+
return errorResponse(API_ERROR, `HRM user role assignment ${input.id} not found or not accessible`);
|
|
49
|
+
}
|
|
50
|
+
return successResponse(rows[0]);
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
return errorResponse(API_ERROR, `Failed to revoke HRM user role assignment: ${error.message}`);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=hrm-user-role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,EAAE,KAAK,CAAC,MAAM,EAAE;SAC1C,CAAC;QACF,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS;YAAE,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QACjE,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,SAAS,CAAC,KAAK,CACpC,GAAG,GAAG,CAAC,SAAS,CAAC,UAAU,oCAAoC,KAAK,CAAC,EAAE,WAAW,EAClF,IAAI,EACJ,EAAE,OAAO,EAAE,2BAA2B,CAAC,KAAK,CAAC,eAAe,CAAC,EAAE,CAChE,CAAC;YACF,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC/B,OAAO,aAAa,CAClB,SAAS,EACT,4BAA4B,KAAK,CAAC,EAAE,8BAA8B,CACnE,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,8CAA8C,KAAK,CAAC,OAAO,EAAE,CAC9D,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/hrm/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAsBtC,eAAO,MAAM,QAAQ,EAAE,IAAI,EAAiD,CAAC;AAE7E,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,EAAE,IAAI,EAA0B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { hrmGeneratedReadTools } from './generated-reads.js';
|
|
2
|
+
import { hrmUserRoleAssignTool } from './hrm-user-role-assign.js';
|
|
3
|
+
import { hrmUserRoleUnassignTool } from './hrm-user-role-unassign.js';
|
|
4
|
+
import { hrmUserPolicyAssignTool } from './hrm-user-policy-assign.js';
|
|
5
|
+
import { hrmUserPolicyUnassignTool } from './hrm-user-policy-unassign.js';
|
|
6
|
+
import { hrmUserRolePolicyAssignTool } from './hrm-user-role-policy-assign.js';
|
|
7
|
+
import { hrmUserRolePolicyUnassignTool } from './hrm-user-role-policy-unassign.js';
|
|
8
|
+
import { hrmUserRoleParentSetTool } from './hrm-user-role-parent-set.js';
|
|
9
|
+
import { hrmUserRoleParentRemoveTool } from './hrm-user-role-parent-remove.js';
|
|
10
|
+
const hrmWriteTools = [
|
|
11
|
+
hrmUserRoleAssignTool,
|
|
12
|
+
hrmUserRoleUnassignTool,
|
|
13
|
+
hrmUserPolicyAssignTool,
|
|
14
|
+
hrmUserPolicyUnassignTool,
|
|
15
|
+
hrmUserRolePolicyAssignTool,
|
|
16
|
+
hrmUserRolePolicyUnassignTool,
|
|
17
|
+
hrmUserRoleParentSetTool,
|
|
18
|
+
hrmUserRoleParentRemoveTool,
|
|
19
|
+
];
|
|
20
|
+
export const hrmTools = [...hrmGeneratedReadTools, ...hrmWriteTools];
|
|
21
|
+
/** Read-only slice used by the `hrm-readonly` selectable sub-domain. */
|
|
22
|
+
export const hrmReadOnlyTools = hrmGeneratedReadTools;
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/hrm/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AACtE,OAAO,EAAE,yBAAyB,EAAE,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AACnF,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAE/E,MAAM,aAAa,GAAW;IAC5B,qBAAqB;IACrB,uBAAuB;IACvB,uBAAuB;IACvB,yBAAyB;IACzB,2BAA2B;IAC3B,6BAA6B;IAC7B,wBAAwB;IACxB,2BAA2B;CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAW,CAAC,GAAG,qBAAqB,EAAE,GAAG,aAAa,CAAC,CAAC;AAE7E,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAW,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
import { CatalogueReport } from '../../generated-reads/index.js';
|
|
3
|
+
export declare const secGeneratedReadReport: CatalogueReport;
|
|
4
|
+
export declare const secGeneratedReadTools: Tool[];
|
|
5
|
+
//# sourceMappingURL=generated-reads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-reads.d.ts","sourceRoot":"","sources":["../../../src/tools/sec/generated-reads.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAGL,eAAe,EAChB,MAAM,gCAAgC,CAAC;AA0BxC,eAAO,MAAM,sBAAsB,EAAE,eAIjC,CAAC;AAEL,eAAO,MAAM,qBAAqB,EAAE,IAAI,EAGvC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { buildGeneratedReadCatalogue, buildGeneratedReadCatalogueReport, } from '../../generated-reads/index.js';
|
|
2
|
+
import { loadPersistResourceContract } from '../../contracts/persist-resource-contract.js';
|
|
3
|
+
/**
|
|
4
|
+
* Bounded read tools for the SEC module (WI-0003503).
|
|
5
|
+
*
|
|
6
|
+
* The pinned contract carries a single SEC resource
|
|
7
|
+
* (`sec_qr_pairing_sessions`) classified `sensitive` because it
|
|
8
|
+
* carries an `encrypted_local_secret` column and an
|
|
9
|
+
* `encryption_nonce`. The catalogue is invoked with
|
|
10
|
+
* `includeSensitive: true` so status polling of a pairing session
|
|
11
|
+
* (checking `session_status`, `expires_at`, `paired_at`) is available
|
|
12
|
+
* to operators.
|
|
13
|
+
*
|
|
14
|
+
* Field-level redaction strips the secret at the guardrail layer —
|
|
15
|
+
* the returned rows carry no `*_secret` column. The
|
|
16
|
+
* `encryption_nonce` column is not credential material on its own but
|
|
17
|
+
* has no operational value outside the pairing workflow either;
|
|
18
|
+
* callers who need it must go through a dedicated Persist endpoint.
|
|
19
|
+
*
|
|
20
|
+
* Every write on a pairing session lives in a dedicated hand-written
|
|
21
|
+
* tool (`sec-qr-pairing-*`) with confirmation semantics.
|
|
22
|
+
*/
|
|
23
|
+
const contract = loadPersistResourceContract();
|
|
24
|
+
export const secGeneratedReadReport = buildGeneratedReadCatalogueReport(contract, {
|
|
25
|
+
modules: ['sec'],
|
|
26
|
+
includeSensitive: true,
|
|
27
|
+
});
|
|
28
|
+
export const secGeneratedReadTools = buildGeneratedReadCatalogue(contract, { modules: ['sec'], includeSensitive: true });
|
|
29
|
+
//# sourceMappingURL=generated-reads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generated-reads.js","sourceRoot":"","sources":["../../../src/tools/sec/generated-reads.ts"],"names":[],"mappings":"AACA,OAAO,EACL,2BAA2B,EAC3B,iCAAiC,GAElC,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAE3F;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,QAAQ,GAAG,2BAA2B,EAAE,CAAC;AAE/C,MAAM,CAAC,MAAM,sBAAsB,GACjC,iCAAiC,CAAC,QAAQ,EAAE;IAC1C,OAAO,EAAE,CAAC,KAAK,CAAC;IAChB,gBAAgB,EAAE,IAAI;CACvB,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,qBAAqB,GAAW,2BAA2B,CACtE,QAAQ,EACR,EAAE,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,gBAAgB,EAAE,IAAI,EAAE,CAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/sec/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AActC,eAAO,MAAM,QAAQ,EAAE,IAAI,EAAiD,CAAC;AAE7E,wEAAwE;AACxE,eAAO,MAAM,gBAAgB,EAAE,IAAI,EAA0B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { secGeneratedReadTools } from './generated-reads.js';
|
|
2
|
+
import { secQrPairingStartTool } from './sec-qr-pairing-start.js';
|
|
3
|
+
import { secQrPairingJoinTool } from './sec-qr-pairing-join.js';
|
|
4
|
+
import { secQrPairingCompleteTool } from './sec-qr-pairing-complete.js';
|
|
5
|
+
import { secQrPairingCancelTool } from './sec-qr-pairing-cancel.js';
|
|
6
|
+
const secWriteTools = [
|
|
7
|
+
secQrPairingStartTool,
|
|
8
|
+
secQrPairingJoinTool,
|
|
9
|
+
secQrPairingCompleteTool,
|
|
10
|
+
secQrPairingCancelTool,
|
|
11
|
+
];
|
|
12
|
+
export const secTools = [...secGeneratedReadTools, ...secWriteTools];
|
|
13
|
+
/** Read-only slice used by the `sec-readonly` selectable sub-domain. */
|
|
14
|
+
export const secReadOnlyTools = secGeneratedReadTools;
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/sec/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAC;AAEpE,MAAM,aAAa,GAAW;IAC5B,qBAAqB;IACrB,oBAAoB;IACpB,wBAAwB;IACxB,sBAAsB;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAW,CAAC,GAAG,qBAAqB,EAAE,GAAG,aAAa,CAAC,CAAC;AAE7E,wEAAwE;AACxE,MAAM,CAAC,MAAM,gBAAgB,GAAW,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Tool } from '../registry.js';
|
|
2
|
+
/**
|
|
3
|
+
* Cancel a QR pairing session by setting `session_status=CANCELLED`
|
|
4
|
+
* and stamping `completed_at`. Cancellation is a security state
|
|
5
|
+
* transition, so the tool requires `confirm: true` AND a `reason`
|
|
6
|
+
* for the audit trail.
|
|
7
|
+
*
|
|
8
|
+
* Retry-safe: repeat calls converge on the same cancelled state.
|
|
9
|
+
*/
|
|
10
|
+
export declare const secQrPairingCancelTool: Tool;
|
|
11
|
+
//# sourceMappingURL=sec-qr-pairing-cancel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sec-qr-pairing-cancel.d.ts","sourceRoot":"","sources":["../../../src/tools/sec/sec-qr-pairing-cancel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAUtC;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,EAAE,IAyDpC,CAAC"}
|