@tribeunal/mcp-server 1.13.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/CHANGELOG.md +287 -0
- package/LICENSE +21 -0
- package/README.md +196 -0
- package/dist/auth/auth.d.ts +8 -0
- package/dist/auth/auth.d.ts.map +1 -0
- package/dist/auth/auth.js +14 -0
- package/dist/auth/auth.js.map +1 -0
- package/dist/client/api-client.d.ts +216 -0
- package/dist/client/api-client.d.ts.map +1 -0
- package/dist/client/api-client.js +325 -0
- package/dist/client/api-client.js.map +1 -0
- package/dist/client/from-env.d.ts +17 -0
- package/dist/client/from-env.d.ts.map +1 -0
- package/dist/client/from-env.js +25 -0
- package/dist/client/from-env.js.map +1 -0
- package/dist/core/instructions.d.ts +14 -0
- package/dist/core/instructions.d.ts.map +1 -0
- package/dist/core/instructions.js +21 -0
- package/dist/core/instructions.js.map +1 -0
- package/dist/core/stdio-register.d.ts +14 -0
- package/dist/core/stdio-register.d.ts.map +1 -0
- package/dist/core/stdio-register.js +39 -0
- package/dist/core/stdio-register.js.map +1 -0
- package/dist/core/tools.d.ts +1072 -0
- package/dist/core/tools.d.ts.map +1 -0
- package/dist/core/tools.js +1041 -0
- package/dist/core/tools.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +19 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/activity.d.ts +98 -0
- package/dist/tools/activity.d.ts.map +1 -0
- package/dist/tools/activity.js +167 -0
- package/dist/tools/activity.js.map +1 -0
- package/dist/tools/cases.d.ts +154 -0
- package/dist/tools/cases.d.ts.map +1 -0
- package/dist/tools/cases.js +91 -0
- package/dist/tools/cases.js.map +1 -0
- package/dist/tools/comments.d.ts +29 -0
- package/dist/tools/comments.d.ts.map +1 -0
- package/dist/tools/comments.js +17 -0
- package/dist/tools/comments.js.map +1 -0
- package/dist/tools/decisions.d.ts +297 -0
- package/dist/tools/decisions.d.ts.map +1 -0
- package/dist/tools/decisions.js +102 -0
- package/dist/tools/decisions.js.map +1 -0
- package/dist/tools/jury-duty.d.ts +56 -0
- package/dist/tools/jury-duty.d.ts.map +1 -0
- package/dist/tools/jury-duty.js +39 -0
- package/dist/tools/jury-duty.js.map +1 -0
- package/dist/tools/sides.d.ts +15 -0
- package/dist/tools/sides.d.ts.map +1 -0
- package/dist/tools/sides.js +11 -0
- package/dist/tools/sides.js.map +1 -0
- package/dist/tools/trials.d.ts +78 -0
- package/dist/tools/trials.d.ts.map +1 -0
- package/dist/tools/trials.js +29 -0
- package/dist/tools/trials.js.map +1 -0
- package/dist/tools/tribes.d.ts +75 -0
- package/dist/tools/tribes.d.ts.map +1 -0
- package/dist/tools/tribes.js +47 -0
- package/dist/tools/tribes.js.map +1 -0
- package/dist/tools/users.d.ts +9 -0
- package/dist/tools/users.d.ts.map +1 -0
- package/dist/tools/users.js +6 -0
- package/dist/tools/users.js.map +1 -0
- package/dist/tools/uuid.d.ts +35 -0
- package/dist/tools/uuid.d.ts.map +1 -0
- package/dist/tools/uuid.js +77 -0
- package/dist/tools/uuid.js.map +1 -0
- package/dist/tools/votes.d.ts +45 -0
- package/dist/tools/votes.d.ts.map +1 -0
- package/dist/tools/votes.js +22 -0
- package/dist/tools/votes.js.map +1 -0
- package/dist/tools/webhooks.d.ts +26 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +39 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/utils/format.d.ts +4 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +24 -0
- package/dist/utils/format.js.map +1 -0
- package/llms-install.md +81 -0
- package/package.json +73 -0
- package/skills/README.md +43 -0
- package/skills/acting-on-verdicts/SKILL.md +103 -0
- package/skills/arbitrating-a-dispute/SKILL.md +107 -0
- package/skills/convening-a-team-jury/SKILL.md +94 -0
- package/skills/deciding-with-a-jury/SKILL.md +120 -0
- package/skills/serving-jury-duty/SKILL.md +90 -0
- package/skills/using-tribeunal/SKILL.md +56 -0
- package/skills/using-tribeunal/references/errors.md +54 -0
- package/skills/using-tribeunal/references/tools.md +53 -0
- package/skills/weighing-evidence/SKILL.md +94 -0
- package/skills/wiring-webhooks/SKILL.md +107 -0
- package/skills/wiring-webhooks/references/events.md +52 -0
- package/skills/wiring-webhooks/scripts/verify-signature.js +72 -0
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { caseUuid, tribeUuid } from './uuid.js';
|
|
3
|
+
// Jury Duty Status & Allowance
|
|
4
|
+
export const JuryDutyStatusSchema = z.object({});
|
|
5
|
+
export const JuryDutyAllowanceSchema = z.object({});
|
|
6
|
+
export const JuryDutyDashboardSchema = z.object({});
|
|
7
|
+
// Jury Duty Queue Management
|
|
8
|
+
export const JuryDutyStartSchema = z.object({});
|
|
9
|
+
export const JuryDutyCancelSchema = z.object({});
|
|
10
|
+
// Jury Duty Assignment Management
|
|
11
|
+
export const JuryDutyAcceptSchema = z.object({
|
|
12
|
+
memberId: z.string().describe('Member ID from the jury assignment notification'),
|
|
13
|
+
});
|
|
14
|
+
export const JuryDutyRejectSchema = z.object({
|
|
15
|
+
memberId: z.string().describe('Member ID from the jury assignment notification'),
|
|
16
|
+
});
|
|
17
|
+
// Jury Duty History
|
|
18
|
+
export const JuryDutyHistorySchema = z.object({
|
|
19
|
+
days: z.number().min(1).max(30).default(7)
|
|
20
|
+
.describe('Number of days of allowance history to retrieve'),
|
|
21
|
+
});
|
|
22
|
+
// Seating yourself on a case's jury. The caller is the subject, so a case UUID
|
|
23
|
+
// is the whole input.
|
|
24
|
+
export const JoinJurySchema = z.object({
|
|
25
|
+
caseId: caseUuid('Case UUID of the jury to join'),
|
|
26
|
+
});
|
|
27
|
+
// Jury invitations (case owner). Either an explicit invitees list or a tribeId
|
|
28
|
+
// (invite the whole tribe — every member plus the chieftain) is required; both may
|
|
29
|
+
// be given and are unioned, with the backend deduping. The refine enforces the
|
|
30
|
+
// at-least-one rule the endpoint returns `no_invitees` for.
|
|
31
|
+
export const InviteJurorsSchema = z.object({
|
|
32
|
+
caseId: caseUuid('Case UUID (you must be the case owner, or an admin)'),
|
|
33
|
+
invitees: z.array(z.string().min(1)).min(1).max(50).optional()
|
|
34
|
+
.describe('Usernames or email addresses to invite to the jury (1-50)'),
|
|
35
|
+
tribeId: tribeUuid('Optional tribe UUID: invite every current member plus the chieftain. You must be a member, the owner, or an admin of that tribe.').optional(),
|
|
36
|
+
}).refine((v) => (v.invitees !== undefined && v.invitees.length > 0) || v.tribeId !== undefined, {
|
|
37
|
+
message: 'Provide invitees and/or a tribeId to invite jurors',
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=jury-duty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jury-duty.js","sourceRoot":"","sources":["../../src/tools/jury-duty.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEhD,+BAA+B;AAC/B,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACjD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAEpD,6BAA6B;AAC7B,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAChD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAEjD,kCAAkC;AAClC,MAAM,CAAC,MAAM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AC,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,OAAO,KAAK,SAAS,EAAE;IAC/F,OAAO,EAAE,oDAAoD;CAC9D,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SetSideImageSchema: z.ZodObject<{
|
|
3
|
+
caseId: z.ZodString;
|
|
4
|
+
sideId: z.ZodString;
|
|
5
|
+
imageUrl: z.ZodEffects<z.ZodString, string, string>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
imageUrl: string;
|
|
8
|
+
caseId: string;
|
|
9
|
+
sideId: string;
|
|
10
|
+
}, {
|
|
11
|
+
imageUrl: string;
|
|
12
|
+
caseId: string;
|
|
13
|
+
sideId: string;
|
|
14
|
+
}>;
|
|
15
|
+
//# sourceMappingURL=sides.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sides.d.ts","sourceRoot":"","sources":["../../src/tools/sides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { caseUuid, sideUuid } from './uuid.js';
|
|
3
|
+
const httpsImageUrl = z.string().url().refine((u) => u.startsWith('https://'), {
|
|
4
|
+
message: 'Image URL must use https.',
|
|
5
|
+
}).describe('Public https URL of the image to fetch and attach (png, jpeg or webp, <= 5 MB). It is downloaded and re-encoded server-side; http, private hosts and non-images are rejected.');
|
|
6
|
+
export const SetSideImageSchema = z.object({
|
|
7
|
+
caseId: caseUuid('Case UUID the side belongs to (the case\'s `uuid` field)'),
|
|
8
|
+
sideId: sideUuid('Side UUID to set the image on (the side\'s `uuid` field)'),
|
|
9
|
+
imageUrl: httpsImageUrl,
|
|
10
|
+
});
|
|
11
|
+
//# sourceMappingURL=sides.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sides.js","sourceRoot":"","sources":["../../src/tools/sides.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE;IAC7E,OAAO,EAAE,2BAA2B;CACrC,CAAC,CAAC,QAAQ,CAAC,+KAA+K,CAAC,CAAC;AAE7L,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,QAAQ,CAAC,0DAA0D,CAAC;IAC5E,MAAM,EAAE,QAAQ,CAAC,0DAA0D,CAAC;IAC5E,QAAQ,EAAE,aAAa;CACxB,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SearchCasesSchema: z.ZodObject<{
|
|
3
|
+
query: z.ZodOptional<z.ZodString>;
|
|
4
|
+
status: z.ZodOptional<z.ZodEnum<["init", "open", "closed", "expired", "suspended"]>>;
|
|
5
|
+
type: z.ZodOptional<z.ZodEnum<["case", "advice", "poll"]>>;
|
|
6
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
7
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
8
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
page: number;
|
|
11
|
+
limit: number;
|
|
12
|
+
type?: "case" | "advice" | "poll" | undefined;
|
|
13
|
+
tags?: string[] | undefined;
|
|
14
|
+
status?: "init" | "open" | "closed" | "expired" | "suspended" | undefined;
|
|
15
|
+
query?: string | undefined;
|
|
16
|
+
}, {
|
|
17
|
+
type?: "case" | "advice" | "poll" | undefined;
|
|
18
|
+
tags?: string[] | undefined;
|
|
19
|
+
status?: "init" | "open" | "closed" | "expired" | "suspended" | undefined;
|
|
20
|
+
query?: string | undefined;
|
|
21
|
+
page?: number | undefined;
|
|
22
|
+
limit?: number | undefined;
|
|
23
|
+
}>;
|
|
24
|
+
export declare const GetCaseSchema: z.ZodObject<{
|
|
25
|
+
id: z.ZodString;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
id: string;
|
|
28
|
+
}, {
|
|
29
|
+
id: string;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const CreateCaseSchema: z.ZodObject<{
|
|
32
|
+
title: z.ZodString;
|
|
33
|
+
description: z.ZodString;
|
|
34
|
+
type: z.ZodEnum<["case", "advice", "poll"]>;
|
|
35
|
+
juryType: z.ZodDefault<z.ZodEnum<["public", "invited"]>>;
|
|
36
|
+
sides: z.ZodArray<z.ZodObject<{
|
|
37
|
+
name: z.ZodString;
|
|
38
|
+
description: z.ZodOptional<z.ZodString>;
|
|
39
|
+
}, "strip", z.ZodTypeAny, {
|
|
40
|
+
name: string;
|
|
41
|
+
description?: string | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
name: string;
|
|
44
|
+
description?: string | undefined;
|
|
45
|
+
}>, "many">;
|
|
46
|
+
caseLength: z.ZodDefault<z.ZodNumber>;
|
|
47
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
title: string;
|
|
50
|
+
caseLength: number;
|
|
51
|
+
description: string;
|
|
52
|
+
type: "case" | "advice" | "poll";
|
|
53
|
+
juryType: "public" | "invited";
|
|
54
|
+
sides: {
|
|
55
|
+
name: string;
|
|
56
|
+
description?: string | undefined;
|
|
57
|
+
}[];
|
|
58
|
+
tags?: string[] | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
title: string;
|
|
61
|
+
description: string;
|
|
62
|
+
type: "case" | "advice" | "poll";
|
|
63
|
+
sides: {
|
|
64
|
+
name: string;
|
|
65
|
+
description?: string | undefined;
|
|
66
|
+
}[];
|
|
67
|
+
caseLength?: number | undefined;
|
|
68
|
+
juryType?: "public" | "invited" | undefined;
|
|
69
|
+
tags?: string[] | undefined;
|
|
70
|
+
}>;
|
|
71
|
+
export declare const ListEvidenceSchema: z.ZodObject<{
|
|
72
|
+
caseId: z.ZodString;
|
|
73
|
+
}, "strip", z.ZodTypeAny, {
|
|
74
|
+
caseId: string;
|
|
75
|
+
}, {
|
|
76
|
+
caseId: string;
|
|
77
|
+
}>;
|
|
78
|
+
//# sourceMappingURL=trials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trials.d.ts","sourceRoot":"","sources":["../../src/tools/trials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;EAExB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAW3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Case schemas — the single, canonical vocabulary advertised by the server.
|
|
3
|
+
export const SearchCasesSchema = z.object({
|
|
4
|
+
query: z.string().optional().describe('Search cases by title or description'),
|
|
5
|
+
status: z.enum(['init', 'open', 'closed', 'expired', 'suspended']).optional().describe('Filter by case status (open = accepting votes)'),
|
|
6
|
+
type: z.enum(['case', 'advice', 'poll']).optional().describe('Filter by case type — case (binding jury decision), advice (input for the creator), poll (opinion gathering)'),
|
|
7
|
+
tags: z.array(z.string()).optional().describe('Filter by tags'),
|
|
8
|
+
page: z.number().min(1).default(1).describe('Page number for pagination'),
|
|
9
|
+
limit: z.number().min(1).max(100).default(20).describe('Number of cases to return per page'),
|
|
10
|
+
});
|
|
11
|
+
export const GetCaseSchema = z.object({
|
|
12
|
+
id: z.string().describe('Case ID or UUID'),
|
|
13
|
+
});
|
|
14
|
+
export const CreateCaseSchema = z.object({
|
|
15
|
+
title: z.string().min(3).max(200).describe('Case title — the question or statement to be decided'),
|
|
16
|
+
description: z.string().min(10).describe('Context, background, and criteria for the case'),
|
|
17
|
+
type: z.enum(['case', 'advice', 'poll']).describe('Case type — case (binding jury decision), advice (input for the creator), or poll (opinion gathering)'),
|
|
18
|
+
juryType: z.enum(['public', 'invited']).default('public').describe('Who can participate — public (anyone) or invited only'),
|
|
19
|
+
sides: z.array(z.object({
|
|
20
|
+
name: z.string().describe('Option/choice name'),
|
|
21
|
+
description: z.string().optional().describe('Optional description for this choice'),
|
|
22
|
+
})).min(2).max(10).describe('The choices/options voters pick between (2-10)'),
|
|
23
|
+
caseLength: z.number().min(60).max(2592000).default(86400).describe('Voting duration in seconds (min: 1 minute, max: 30 days, default: 1 day)'),
|
|
24
|
+
tags: z.array(z.string()).max(4).optional().describe('Up to 4 tags for categorization'),
|
|
25
|
+
});
|
|
26
|
+
export const ListEvidenceSchema = z.object({
|
|
27
|
+
caseId: z.string().describe('Case ID to get evidence for'),
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=trials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trials.js","sourceRoot":"","sources":["../../src/tools/trials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4EAA4E;AAE5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CA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declare const ListTribesSchema: z.ZodObject<{
|
|
3
|
+
query: z.ZodOptional<z.ZodString>;
|
|
4
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
5
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
limit: number;
|
|
8
|
+
page: number;
|
|
9
|
+
query?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
limit?: number | undefined;
|
|
12
|
+
query?: string | undefined;
|
|
13
|
+
page?: number | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const GetTribeSchema: z.ZodObject<{
|
|
16
|
+
id: z.ZodString;
|
|
17
|
+
}, "strip", z.ZodTypeAny, {
|
|
18
|
+
id: string;
|
|
19
|
+
}, {
|
|
20
|
+
id: string;
|
|
21
|
+
}>;
|
|
22
|
+
export declare const ListTribeMembersSchema: z.ZodObject<{
|
|
23
|
+
tribeId: z.ZodString;
|
|
24
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
25
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
}, "strip", z.ZodTypeAny, {
|
|
27
|
+
limit: number;
|
|
28
|
+
tribeId: string;
|
|
29
|
+
page: number;
|
|
30
|
+
}, {
|
|
31
|
+
tribeId: string;
|
|
32
|
+
limit?: number | undefined;
|
|
33
|
+
page?: number | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
export declare const JoinTribeSchema: z.ZodObject<{
|
|
36
|
+
tribeId: z.ZodString;
|
|
37
|
+
}, "strip", z.ZodTypeAny, {
|
|
38
|
+
tribeId: string;
|
|
39
|
+
}, {
|
|
40
|
+
tribeId: string;
|
|
41
|
+
}>;
|
|
42
|
+
export declare const LeaveTribeSchema: z.ZodObject<{
|
|
43
|
+
tribeId: z.ZodString;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
tribeId: string;
|
|
46
|
+
}, {
|
|
47
|
+
tribeId: string;
|
|
48
|
+
}>;
|
|
49
|
+
export declare const CreateTribeSchema: z.ZodObject<{
|
|
50
|
+
name: z.ZodString;
|
|
51
|
+
description: z.ZodString;
|
|
52
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
53
|
+
isPublic: z.ZodDefault<z.ZodBoolean>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
description: string;
|
|
56
|
+
name: string;
|
|
57
|
+
isPublic: boolean;
|
|
58
|
+
tags?: string[] | undefined;
|
|
59
|
+
}, {
|
|
60
|
+
description: string;
|
|
61
|
+
name: string;
|
|
62
|
+
tags?: string[] | undefined;
|
|
63
|
+
isPublic?: boolean | undefined;
|
|
64
|
+
}>;
|
|
65
|
+
export declare const InviteTribeMembersSchema: z.ZodObject<{
|
|
66
|
+
tribeId: z.ZodString;
|
|
67
|
+
invitees: z.ZodArray<z.ZodString, "many">;
|
|
68
|
+
}, "strip", z.ZodTypeAny, {
|
|
69
|
+
invitees: string[];
|
|
70
|
+
tribeId: string;
|
|
71
|
+
}, {
|
|
72
|
+
invitees: string[];
|
|
73
|
+
tribeId: string;
|
|
74
|
+
}>;
|
|
75
|
+
//# sourceMappingURL=tribes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tribes.d.ts","sourceRoot":"","sources":["../../src/tools/tribes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAC;AAKH,eAAO,MAAM,cAAc;;;;;;EAEzB,CAAC;AAKH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;EAIjC,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;EAE3B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAQ5B,CAAC;AAGH,eAAO,MAAM,wBAAwB;;;;;;;;;EAOnC,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { tribeUuid } from './uuid.js';
|
|
3
|
+
// Schema definitions
|
|
4
|
+
export const ListTribesSchema = z.object({
|
|
5
|
+
query: z.string().optional().describe('Search query for tribe name or description'),
|
|
6
|
+
page: z.number().min(1).default(1).describe('Page number for pagination'),
|
|
7
|
+
limit: z.number().min(1).max(100).default(20).describe('Number of results per page'),
|
|
8
|
+
});
|
|
9
|
+
// Every tribe identifier is a UUID: the backend resolves tribes by their uuid
|
|
10
|
+
// column only, so a slug or the numeric `id` can never match and simply 404s.
|
|
11
|
+
// Rejecting here says WHICH field to use instead of returning a bare not-found.
|
|
12
|
+
export const GetTribeSchema = z.object({
|
|
13
|
+
id: tribeUuid('Tribe UUID (the tribe\'s uuid field, not its slug or numeric id)'),
|
|
14
|
+
});
|
|
15
|
+
// Parameters for the tribeunal_list_tribe_members tool. The roster is member-only,
|
|
16
|
+
// so tribeId is a UUID just like every other tribe identifier; page/limit mirror the
|
|
17
|
+
// backend's clamp ([1,100]).
|
|
18
|
+
export const ListTribeMembersSchema = z.object({
|
|
19
|
+
tribeId: tribeUuid('Tribe UUID whose member roster to read (you must be a member, the owner, or an admin)'),
|
|
20
|
+
page: z.number().min(1).default(1).describe('Page number for pagination'),
|
|
21
|
+
limit: z.number().min(1).max(100).default(20).describe('Number of members per page'),
|
|
22
|
+
});
|
|
23
|
+
export const JoinTribeSchema = z.object({
|
|
24
|
+
tribeId: tribeUuid('Tribe UUID to join'),
|
|
25
|
+
});
|
|
26
|
+
export const LeaveTribeSchema = z.object({
|
|
27
|
+
tribeId: tribeUuid('Tribe UUID to leave'),
|
|
28
|
+
});
|
|
29
|
+
export const CreateTribeSchema = z.object({
|
|
30
|
+
name: z.string().min(3).max(100).describe('Tribe name'),
|
|
31
|
+
description: z.string().min(10).describe('Tribe description'),
|
|
32
|
+
tags: z.array(z.string()).optional().describe('Tags for categorization'),
|
|
33
|
+
isPublic: z
|
|
34
|
+
.boolean()
|
|
35
|
+
.default(true)
|
|
36
|
+
.describe('Whether the tribe is publicly visible. Private tribes are hidden from browsing and search, and can only be joined by invitation.'),
|
|
37
|
+
});
|
|
38
|
+
// Parameters for the tribeunal_invite_tribe_members tool.
|
|
39
|
+
export const InviteTribeMembersSchema = z.object({
|
|
40
|
+
tribeId: tribeUuid('Tribe UUID to invite people into — private tribes only'),
|
|
41
|
+
invitees: z
|
|
42
|
+
.array(z.string().min(1))
|
|
43
|
+
.min(1)
|
|
44
|
+
.max(50)
|
|
45
|
+
.describe('Usernames or email addresses to invite (maximum 50 per call)'),
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=tribes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tribes.js","sourceRoot":"","sources":["../../src/tools/tribes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,qBAAqB;AACrB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IACnF,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,4BAA4B,CAAC;IACzE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,4BAA4B,CAAC;CACrF,CAAC,CAAC;AAEH,8EAA8E;AAC9E,8EAA8E;AAC9E,gFAAgF;AAChF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;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,CAAC;SACR,OAAO,EAAE;SACT,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,kIAAkI,CAAC;CAChJ,CAAC,CAAC;AAEH,0DAA0D;AAC1D,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,SAAS,CAAC,wDAAwD,CAAC;IAC5E,QAAQ,EAAE,CAAC;SACR,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACxB,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,EAAE,CAAC;SACP,QAAQ,CAAC,8DAA8D,CAAC;CAC5E,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/tools/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,eAAO,MAAM,aAAa;;;;;;EAExB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/tools/users.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,qBAAqB;AACrB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;CAC/C,CAAC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/** Canonical Tribeunal UUID form — mirrors the backend route requirement. */
|
|
3
|
+
export declare const UUID_RE: RegExp;
|
|
4
|
+
/** JSON-Schema `pattern` string mirroring UUID_RE, for the advertised TOOL_DEFINITIONS. */
|
|
5
|
+
export declare const UUID_PATTERN = "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$";
|
|
6
|
+
export declare function isUuid(value: unknown): value is string;
|
|
7
|
+
/** A zod string constrained to the UUID form, carrying the given description. */
|
|
8
|
+
export declare function caseUuid(description: string): z.ZodString;
|
|
9
|
+
/** A zod string constrained to the UUID form, for a side identifier. */
|
|
10
|
+
export declare function sideUuid(description: string): z.ZodString;
|
|
11
|
+
/**
|
|
12
|
+
* A zod string constrained to the UUID form, for a tribe identifier. `tribe.uuid`
|
|
13
|
+
* is a uuid-typed column, so a slug or the numeric `id` that create_tribe/get_tribe
|
|
14
|
+
* hand back reaches DBAL as a conversion error and returns an opaque HTTP 500.
|
|
15
|
+
*/
|
|
16
|
+
export declare function tribeUuid(description: string): z.ZodString;
|
|
17
|
+
/**
|
|
18
|
+
* A zod string constrained to the UUID form, for a webhook endpoint identifier.
|
|
19
|
+
* Webhook endpoints are keyed by a uuid primary key and are owner-scoped, so a
|
|
20
|
+
* wrong-shaped id is indistinguishable from someone else's endpoint: both answer
|
|
21
|
+
* 404. Rejecting here says which field to use instead of returning a bare
|
|
22
|
+
* not-found the agent cannot act on.
|
|
23
|
+
*/
|
|
24
|
+
export declare function webhookUuid(description: string): z.ZodString;
|
|
25
|
+
/**
|
|
26
|
+
* Present a case object (or a list of them) with the UUID as its ONLY
|
|
27
|
+
* identifier: drops the numeric top-level `id` and each `sides[].id`, keeping
|
|
28
|
+
* `uuid`. This stops an agent reusing the numeric `id` on a later tool call
|
|
29
|
+
* (which would 500 backend-side). Only strips `id` when a sibling `uuid` is
|
|
30
|
+
* present, so an object identified solely by `id` keeps it. Every other field
|
|
31
|
+
* (e.g. `owner.id`, `juryInvites[].id`, which are already UUIDs) is untouched.
|
|
32
|
+
* Non-object input passes through unchanged.
|
|
33
|
+
*/
|
|
34
|
+
export declare function caseWithUuidOnly<T>(value: T): T;
|
|
35
|
+
//# sourceMappingURL=uuid.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../src/tools/uuid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAUxB,6EAA6E;AAC7E,eAAO,MAAM,OAAO,QAAkF,CAAC;AAEvG,2FAA2F;AAC3F,eAAO,MAAM,YAAY,kFAAkF,CAAC;AAE5G,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEtD;AAMD,iFAAiF;AACjF,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,eAE3C;AAED,wEAAwE;AACxE,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,eAE3C;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,eAE5C;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,MAAM,eAE9C;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAsB/C"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
// Case and side identifiers on Tribeunal are UUIDs. The backend resolves a case
|
|
3
|
+
// or side by its `uuid` column, so any non-UUID identifier (a numeric id, a
|
|
4
|
+
// slug, a name) is fed straight into a uuid-typed query and blows up as an
|
|
5
|
+
// opaque HTTP 500 instead of a clean 404. The MCP tools therefore accept UUIDs
|
|
6
|
+
// ONLY: a non-UUID is rejected here, at the tool boundary, with a message that
|
|
7
|
+
// tells the model to use the object's `uuid` field. See tools/*.ts and
|
|
8
|
+
// core/tools.ts for the call sites.
|
|
9
|
+
/** Canonical Tribeunal UUID form — mirrors the backend route requirement. */
|
|
10
|
+
export const UUID_RE = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/;
|
|
11
|
+
/** JSON-Schema `pattern` string mirroring UUID_RE, for the advertised TOOL_DEFINITIONS. */
|
|
12
|
+
export const UUID_PATTERN = '^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$';
|
|
13
|
+
export function isUuid(value) {
|
|
14
|
+
return typeof value === 'string' && UUID_RE.test(value);
|
|
15
|
+
}
|
|
16
|
+
function uuidMessage(kind) {
|
|
17
|
+
return `Must be a ${kind} UUID (the ${kind}'s "uuid" field, e.g. 8415a252-5e41-4db6-bd5d-ee5b5ad95dd4) — not a numeric id, slug, or name.`;
|
|
18
|
+
}
|
|
19
|
+
/** A zod string constrained to the UUID form, carrying the given description. */
|
|
20
|
+
export function caseUuid(description) {
|
|
21
|
+
return z.string().regex(UUID_RE, uuidMessage('case')).describe(description);
|
|
22
|
+
}
|
|
23
|
+
/** A zod string constrained to the UUID form, for a side identifier. */
|
|
24
|
+
export function sideUuid(description) {
|
|
25
|
+
return z.string().regex(UUID_RE, uuidMessage('side')).describe(description);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A zod string constrained to the UUID form, for a tribe identifier. `tribe.uuid`
|
|
29
|
+
* is a uuid-typed column, so a slug or the numeric `id` that create_tribe/get_tribe
|
|
30
|
+
* hand back reaches DBAL as a conversion error and returns an opaque HTTP 500.
|
|
31
|
+
*/
|
|
32
|
+
export function tribeUuid(description) {
|
|
33
|
+
return z.string().regex(UUID_RE, uuidMessage('tribe')).describe(description);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* A zod string constrained to the UUID form, for a webhook endpoint identifier.
|
|
37
|
+
* Webhook endpoints are keyed by a uuid primary key and are owner-scoped, so a
|
|
38
|
+
* wrong-shaped id is indistinguishable from someone else's endpoint: both answer
|
|
39
|
+
* 404. Rejecting here says which field to use instead of returning a bare
|
|
40
|
+
* not-found the agent cannot act on.
|
|
41
|
+
*/
|
|
42
|
+
export function webhookUuid(description) {
|
|
43
|
+
return z.string().regex(UUID_RE, uuidMessage('webhook')).describe(description);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Present a case object (or a list of them) with the UUID as its ONLY
|
|
47
|
+
* identifier: drops the numeric top-level `id` and each `sides[].id`, keeping
|
|
48
|
+
* `uuid`. This stops an agent reusing the numeric `id` on a later tool call
|
|
49
|
+
* (which would 500 backend-side). Only strips `id` when a sibling `uuid` is
|
|
50
|
+
* present, so an object identified solely by `id` keeps it. Every other field
|
|
51
|
+
* (e.g. `owner.id`, `juryInvites[].id`, which are already UUIDs) is untouched.
|
|
52
|
+
* Non-object input passes through unchanged.
|
|
53
|
+
*/
|
|
54
|
+
export function caseWithUuidOnly(value) {
|
|
55
|
+
if (Array.isArray(value)) {
|
|
56
|
+
return value.map((item) => caseWithUuidOnly(item));
|
|
57
|
+
}
|
|
58
|
+
if (!value || typeof value !== 'object') {
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
const obj = { ...value };
|
|
62
|
+
if ('uuid' in obj && 'id' in obj) {
|
|
63
|
+
delete obj.id;
|
|
64
|
+
}
|
|
65
|
+
if (Array.isArray(obj.sides)) {
|
|
66
|
+
obj.sides = obj.sides.map((side) => {
|
|
67
|
+
if (side && typeof side === 'object' && 'uuid' in side && 'id' in side) {
|
|
68
|
+
const copy = { ...side };
|
|
69
|
+
delete copy.id;
|
|
70
|
+
return copy;
|
|
71
|
+
}
|
|
72
|
+
return side;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return obj;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=uuid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../src/tools/uuid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAChF,4EAA4E;AAC5E,2EAA2E;AAC3E,+EAA+E;AAC/E,+EAA+E;AAC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B,CAAI,KAAQ;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAiB,CAAC;IACrE,CAAC;IACD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,GAAG,GAAG,EAAE,GAAI,KAAiC,EAAE,CAAC;IACtD,IAAI,MAAM,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,EAAE,CAAC;QACjC,OAAO,GAAG,CAAC,EAAE,CAAC;IAChB,CAAC;IACD,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACjC,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,MAAM,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;gBACvE,MAAM,IAAI,GAAG,EAAE,GAAI,IAAgC,EAAE,CAAC;gBACtD,OAAO,IAAI,CAAC,EAAE,CAAC;gBACf,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,GAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const CastVoteSchema: z.ZodObject<{
|
|
3
|
+
caseId: z.ZodString;
|
|
4
|
+
sideId: z.ZodString;
|
|
5
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
6
|
+
}, "strip", z.ZodTypeAny, {
|
|
7
|
+
caseId: string;
|
|
8
|
+
sideId: string;
|
|
9
|
+
comment?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
caseId: string;
|
|
12
|
+
sideId: string;
|
|
13
|
+
comment?: string | undefined;
|
|
14
|
+
}>;
|
|
15
|
+
export declare const RevokeVoteSchema: z.ZodObject<{
|
|
16
|
+
caseId: z.ZodString;
|
|
17
|
+
sideId: z.ZodString;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
caseId: string;
|
|
20
|
+
sideId: string;
|
|
21
|
+
}, {
|
|
22
|
+
caseId: string;
|
|
23
|
+
sideId: string;
|
|
24
|
+
}>;
|
|
25
|
+
export declare const GetVoteStatsSchema: z.ZodObject<{
|
|
26
|
+
caseId: z.ZodString;
|
|
27
|
+
}, "strip", z.ZodTypeAny, {
|
|
28
|
+
caseId: string;
|
|
29
|
+
}, {
|
|
30
|
+
caseId: string;
|
|
31
|
+
}>;
|
|
32
|
+
export declare const RateEvidenceSchema: z.ZodObject<{
|
|
33
|
+
evidenceId: z.ZodString;
|
|
34
|
+
rating: z.ZodNumber;
|
|
35
|
+
sideId: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
evidenceId: string;
|
|
38
|
+
rating: number;
|
|
39
|
+
sideId?: string | undefined;
|
|
40
|
+
}, {
|
|
41
|
+
evidenceId: string;
|
|
42
|
+
rating: number;
|
|
43
|
+
sideId?: string | undefined;
|
|
44
|
+
}>;
|
|
45
|
+
//# sourceMappingURL=votes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"votes.d.ts","sourceRoot":"","sources":["../../src/tools/votes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,cAAc;;;;;;;;;;;;EAIzB,CAAC;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;EAE7B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;EAI7B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { caseUuid, sideUuid } from './uuid.js';
|
|
3
|
+
// Voting & evidence schemas (case vocabulary). Case and side identifiers are
|
|
4
|
+
// UUIDs only (see ./uuid.ts) — the backend resolves both by `uuid`.
|
|
5
|
+
export const CastVoteSchema = z.object({
|
|
6
|
+
caseId: caseUuid('Case UUID to vote on'),
|
|
7
|
+
sideId: sideUuid('Side UUID to vote for (a side\'s `uuid` from get_case)'),
|
|
8
|
+
comment: z.string().max(2000).optional().describe('Optional short rationale, stored as a vote-linked comment (shown in the case activity feed; markable as evidence by the owner/jury)'),
|
|
9
|
+
});
|
|
10
|
+
export const RevokeVoteSchema = z.object({
|
|
11
|
+
caseId: caseUuid('Case UUID'),
|
|
12
|
+
sideId: sideUuid("Side UUID whose vote to revoke (the API resolves the caller's vote by user+case)"),
|
|
13
|
+
});
|
|
14
|
+
export const GetVoteStatsSchema = z.object({
|
|
15
|
+
caseId: caseUuid('Case UUID to get voting statistics for'),
|
|
16
|
+
});
|
|
17
|
+
export const RateEvidenceSchema = z.object({
|
|
18
|
+
evidenceId: z.string().describe('Case-file evidence ID to rate (file evidence only; comments are not ratable)'),
|
|
19
|
+
rating: z.number().int().min(-1).max(1).describe('Rating: 1 (up), 0 (irrelevant), or -1 (down)'),
|
|
20
|
+
sideId: sideUuid('Optional side UUID this rating relates to').optional(),
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=votes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"votes.js","sourceRoot":"","sources":["../../src/tools/votes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE/C,6EAA6E;AAC7E,oEAAoE;AAEpE,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,MAAM,EAAE,QAAQ,CAAC,sBAAsB,CAAC;IACxC,MAAM,EAAE,QAAQ,CAAC,wDAAwD,CAAC;IAC1E,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,qIAAqI,CAAC;CACzL,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC;IAC7B,MAAM,EAAE,QAAQ,CAAC,kFAAkF,CAAC;CACrG,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,MAAM,EAAE,QAAQ,CAAC,wCAAwC,CAAC;CAC3D,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IACzC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8EAA8E,CAAC;IAC/G,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,8CAA8C,CAAC;IAChG,MAAM,EAAE,QAAQ,CAAC,2CAA2C,CAAC,CAAC,QAAQ,EAAE;CACzE,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The complete catalog the backend accepts. It is spelled out rather than left
|
|
4
|
+
* as a free string so a typo is refused here, with the valid names in the error,
|
|
5
|
+
* instead of arriving as an opaque 400 invalid_events.
|
|
6
|
+
*/
|
|
7
|
+
export declare const WEBHOOK_EVENTS: readonly ["case.opened", "case.closed", "vote.cast", "vote.revoked", "comment.created", "evidence.marked", "evidence.unmarked", "jury.joined", "ping"];
|
|
8
|
+
export declare const CreateWebhookSchema: z.ZodObject<{
|
|
9
|
+
url: z.ZodString;
|
|
10
|
+
events: z.ZodArray<z.ZodEnum<["case.opened", "case.closed", "vote.cast", "vote.revoked", "comment.created", "evidence.marked", "evidence.unmarked", "jury.joined", "ping"]>, "many">;
|
|
11
|
+
}, "strip", z.ZodTypeAny, {
|
|
12
|
+
url: string;
|
|
13
|
+
events: ("case.opened" | "case.closed" | "vote.cast" | "vote.revoked" | "comment.created" | "evidence.marked" | "evidence.unmarked" | "jury.joined" | "ping")[];
|
|
14
|
+
}, {
|
|
15
|
+
url: string;
|
|
16
|
+
events: ("case.opened" | "case.closed" | "vote.cast" | "vote.revoked" | "comment.created" | "evidence.marked" | "evidence.unmarked" | "jury.joined" | "ping")[];
|
|
17
|
+
}>;
|
|
18
|
+
export declare const ListWebhooksSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
19
|
+
export declare const DeleteWebhookSchema: z.ZodObject<{
|
|
20
|
+
webhookId: z.ZodString;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
webhookId: string;
|
|
23
|
+
}, {
|
|
24
|
+
webhookId: string;
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=webhooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/tools/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;GAIG;AACH,eAAO,MAAM,cAAc,wJAUjB,CAAC;AAMX,eAAO,MAAM,mBAAmB;;;;;;;;;EAW9B,CAAC;AAEH,eAAO,MAAM,kBAAkB,gDAAe,CAAC;AAE/C,eAAO,MAAM,mBAAmB;;;;;;EAE9B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { webhookUuid } from './uuid.js';
|
|
3
|
+
/**
|
|
4
|
+
* The complete catalog the backend accepts. It is spelled out rather than left
|
|
5
|
+
* as a free string so a typo is refused here, with the valid names in the error,
|
|
6
|
+
* instead of arriving as an opaque 400 invalid_events.
|
|
7
|
+
*/
|
|
8
|
+
export const WEBHOOK_EVENTS = [
|
|
9
|
+
'case.opened',
|
|
10
|
+
'case.closed',
|
|
11
|
+
'vote.cast',
|
|
12
|
+
'vote.revoked',
|
|
13
|
+
'comment.created',
|
|
14
|
+
'evidence.marked',
|
|
15
|
+
'evidence.unmarked',
|
|
16
|
+
'jury.joined',
|
|
17
|
+
'ping',
|
|
18
|
+
];
|
|
19
|
+
// The URL is checked again server-side (and once more at delivery): it must be an
|
|
20
|
+
// absolute https URL that does not resolve to a private, loopback, link-local or
|
|
21
|
+
// CGNAT address, and must not carry credentials. Checking the scheme here turns
|
|
22
|
+
// the most common mistake into an immediate, readable failure.
|
|
23
|
+
export const CreateWebhookSchema = z.object({
|
|
24
|
+
url: z
|
|
25
|
+
.string()
|
|
26
|
+
.url()
|
|
27
|
+
.startsWith('https://', 'Webhook URLs must be absolute https URLs.')
|
|
28
|
+
.max(2048)
|
|
29
|
+
.describe('HTTPS URL that will receive the signed POST requests'),
|
|
30
|
+
events: z
|
|
31
|
+
.array(z.enum(WEBHOOK_EVENTS))
|
|
32
|
+
.min(1)
|
|
33
|
+
.describe(`Events to subscribe to. One or more of: ${WEBHOOK_EVENTS.join(', ')}`),
|
|
34
|
+
});
|
|
35
|
+
export const ListWebhooksSchema = z.object({});
|
|
36
|
+
export const DeleteWebhookSchema = z.object({
|
|
37
|
+
webhookId: webhookUuid('Webhook endpoint UUID to delete (from tribeunal_create_webhook or tribeunal_list_webhooks)'),
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=webhooks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/tools/webhooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,aAAa;IACb,aAAa;IACb,WAAW;IACX,cAAc;IACd,iBAAiB;IACjB,iBAAiB;IACjB,mBAAmB;IACnB,aAAa;IACb,MAAM;CACE,CAAC;AAEX,kFAAkF;AAClF,iFAAiF;AACjF,gFAAgF;AAChF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,GAAG,EAAE;SACL,UAAU,CAAC,UAAU,EAAE,2CAA2C,CAAC;SACnE,GAAG,CAAC,IAAI,CAAC;SACT,QAAQ,CAAC,sDAAsD,CAAC;IACnE,MAAM,EAAE,CAAC;SACN,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;SAC7B,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,CAAC,2CAA2C,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;CACpF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAE/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,SAAS,EAAE,WAAW,CAAC,4FAA4F,CAAC;CACrH,CAAC,CAAC"}
|