@pitcher/cli-scripts 3.1.1 → 3.2.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/README.md +39 -2
- package/dist/index.js +2 -0
- package/dist/src/commands/analytics.d.ts +77 -0
- package/dist/src/commands/analytics.js +309 -1
- package/dist/src/commands/roleplay.d.ts +85 -0
- package/dist/src/commands/roleplay.js +449 -0
- package/dist/src/core/dsr-visits.d.ts +50 -0
- package/dist/src/core/dsr-visits.js +191 -0
- package/dist/src/core/roleplay-stats.d.ts +79 -0
- package/dist/src/core/roleplay-stats.js +114 -0
- package/dist/src/mcp/registry.js +2 -0
- package/dist/src/mcp/renderPolicy.d.ts +1 -1
- package/dist/src/mcp/renderPolicy.js +2 -1
- package/dist/src/mcp/resources/analyticsCatalog.d.ts +1 -1
- package/dist/src/mcp/resources/analyticsCatalog.js +23 -5
- package/dist/src/mcp/tools/analytics.js +88 -3
- package/dist/src/mcp/tools/roleplay.d.ts +2 -0
- package/dist/src/mcp/tools/roleplay.js +106 -0
- package/package.json +6 -1
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { ROLEPLAY_DIFFICULTIES, ROLEPLAY_GROUP_BY, ROLEPLAY_SESSION_SORT, runRoleplayKpis, runRoleplayRepSummary, runRoleplayScenariosList, runRoleplaySessionGet, runRoleplaySessions, runRoleplayTeam, } from '../../commands/roleplay.js';
|
|
3
|
+
const instanceId = z.string().describe('Instance ID (required)');
|
|
4
|
+
/** The shared roleplay_statements filters. Dates have NO default window: omitted means all time. */
|
|
5
|
+
const filters = {
|
|
6
|
+
instanceId,
|
|
7
|
+
startDate: z.string().optional().describe('Window start, ISO date. Omitted = all time (no default window)'),
|
|
8
|
+
endDate: z.string().optional().describe('Window end, ISO date. Omitted = all time (no default window)'),
|
|
9
|
+
rep: z.string().optional().describe('Rep name or email contains (case-insensitive)'),
|
|
10
|
+
scenario: z.string().optional().describe('Scenario or persona name contains (case-insensitive)'),
|
|
11
|
+
difficulty: z.enum(ROLEPLAY_DIFFICULTIES).optional().describe('Scenario difficulty'),
|
|
12
|
+
};
|
|
13
|
+
const UNSCORED = 'A session without a score (score null: the AI evaluation failed or is pending) is UNSCORED, never 0: ' +
|
|
14
|
+
'never count it in an average or as a fail.';
|
|
15
|
+
const CH_SOURCE = 'Reads the AI Roleplay analytics replica (ClickHouse roleplay_statements, the Admin Analytics tab). ' +
|
|
16
|
+
'Dates are optional and there is no default window: omitted means all time.';
|
|
17
|
+
const ADMIN_ONLY = 'Instance or org admins only; anyone else gets an AUTH error, and a coaching manager should use pitcher_roleplay_team.';
|
|
18
|
+
export const roleplayTools = [
|
|
19
|
+
{
|
|
20
|
+
name: 'pitcher_roleplay_kpis',
|
|
21
|
+
title: 'AI Roleplay KPIs',
|
|
22
|
+
description: 'AI Roleplay totals for an instance: total, scored and unscored sessions, the mean score of SCORED sessions, ' +
|
|
23
|
+
`mean duration and active reps, with optional rep/scenario/difficulty filters. ${UNSCORED} ${CH_SOURCE} ${ADMIN_ONLY}`,
|
|
24
|
+
inputShape: filters,
|
|
25
|
+
run: runRoleplayKpis,
|
|
26
|
+
readOnly: true,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'pitcher_roleplay_sessions',
|
|
30
|
+
title: 'AI Roleplay sessions',
|
|
31
|
+
description: 'AI Roleplay session list for an instance, newest first: entry_id, session_at, rep_name, who (rep email), ' +
|
|
32
|
+
'scenario_name, persona_name, difficulty, score, evaluated, rating, duration_ms. Default 20 rows, max 100 per ' +
|
|
33
|
+
`page; total_count/has_more say when there are more. ${UNSCORED} ${CH_SOURCE} ${ADMIN_ONLY} ` +
|
|
34
|
+
'Open one session with pitcher_roleplay_session_get (its entry_id).',
|
|
35
|
+
inputShape: {
|
|
36
|
+
...filters,
|
|
37
|
+
sortBy: z.enum(ROLEPLAY_SESSION_SORT).optional().describe('Sort field (default session_at)'),
|
|
38
|
+
sortOrder: z.enum(['asc', 'desc']).optional().describe('Sort direction (default desc); unscored sessions sort last'),
|
|
39
|
+
page: z.number().int().optional().describe('Page number (default 1)'),
|
|
40
|
+
limit: z.number().int().optional().describe('Rows per page (default 20, max 100)'),
|
|
41
|
+
},
|
|
42
|
+
run: runRoleplaySessions,
|
|
43
|
+
readOnly: true,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'pitcher_roleplay_rep_summary',
|
|
47
|
+
title: 'AI Roleplay per-rep or per-scenario summary',
|
|
48
|
+
description: 'Per-rep (groupBy rep, keyed on the rep email) or per-scenario (groupBy scenario) session counts, scored ' +
|
|
49
|
+
'counts, mean score of scored sessions and last session, up to 50 groups with the most sessions. Exact up to ' +
|
|
50
|
+
'5000 sessions in the window (read newest first); `complete: false` means the figures cover only the newest ' +
|
|
51
|
+
`5000, so narrow the dates. ${UNSCORED} ${CH_SOURCE} ${ADMIN_ONLY}`,
|
|
52
|
+
inputShape: {
|
|
53
|
+
...filters,
|
|
54
|
+
groupBy: z.enum(ROLEPLAY_GROUP_BY).optional().describe('Group by rep (default) or scenario'),
|
|
55
|
+
},
|
|
56
|
+
run: runRoleplayRepSummary,
|
|
57
|
+
readOnly: true,
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'pitcher_roleplay_team',
|
|
61
|
+
title: 'AI Roleplay assignment completion',
|
|
62
|
+
description: 'Roleplay assignment completion per rep, as the AI Roleplay manager app shows it: per assignment its passing ' +
|
|
63
|
+
'score and due date, each rep\'s status (passed, in_progress, not_started, overdue, needs_coaching), sessions, ' +
|
|
64
|
+
'scored sessions, best and mean score, trend, last session, plus per-skill mean scores. Instance or org admins ' +
|
|
65
|
+
'get every roleplay assignment on the instance (scope "instance"); a coaching manager gets the assignments ' +
|
|
66
|
+
'they coach (scope "coach"). Works for any member (an empty list when they coach nobody). ' +
|
|
67
|
+
`${UNSCORED} Reads Postgres appsDB through next-core (cch-assignment, cch-session-result), not ClickHouse. ` +
|
|
68
|
+
'The server returns at most the newest 1000 sessions; `complete: false` says the cap was hit. ' +
|
|
69
|
+
'Up to 50 assignments and 100 reps each; filter with assignmentId or status.',
|
|
70
|
+
inputShape: {
|
|
71
|
+
instanceId,
|
|
72
|
+
assignmentId: z.string().optional().describe('Only this assignment (its id from an earlier call)'),
|
|
73
|
+
status: z
|
|
74
|
+
.enum(['passed', 'in_progress', 'not_started', 'overdue', 'needs_coaching'])
|
|
75
|
+
.optional()
|
|
76
|
+
.describe('Only reps with this status'),
|
|
77
|
+
},
|
|
78
|
+
run: runRoleplayTeam,
|
|
79
|
+
readOnly: true,
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: 'pitcher_roleplay_session_get',
|
|
83
|
+
title: 'AI Roleplay session detail',
|
|
84
|
+
description: 'One AI Roleplay session: scenario, difficulty, time, duration, overall score (null = unscored, never 0), ' +
|
|
85
|
+
'evaluation status, and the evaluation summary, strengths, improvements and per-skill scores with feedback. ' +
|
|
86
|
+
'Never the transcript, messages or recordings. Opens to the rep, a coach of that rep, or an instance or org ' +
|
|
87
|
+
'admin; anyone else gets an AUTH error. Reads Postgres appsDB (cch-session-result) through next-core. ' +
|
|
88
|
+
'Takes entryId = entry_id from pitcher_roleplay_sessions.',
|
|
89
|
+
inputShape: {
|
|
90
|
+
instanceId,
|
|
91
|
+
entryId: z.string().describe('Session entry ID (entry_id from pitcher_roleplay_sessions)'),
|
|
92
|
+
},
|
|
93
|
+
run: runRoleplaySessionGet,
|
|
94
|
+
readOnly: true,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'pitcher_roleplay_scenarios_list',
|
|
98
|
+
title: 'AI Roleplay scenarios',
|
|
99
|
+
description: 'The AI Roleplay scenario catalog of an instance: id, kind, name, persona title, description, difficulty, ' +
|
|
100
|
+
'active, time limit and the skills it is graded on (title and weight). Never a prompt. Any member. ' +
|
|
101
|
+
'Reads the instance config (appsDB cch-config) through next-core.',
|
|
102
|
+
inputShape: { instanceId },
|
|
103
|
+
run: runRoleplayScenariosList,
|
|
104
|
+
readOnly: true,
|
|
105
|
+
},
|
|
106
|
+
];
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pitcher/cli-scripts",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
4
4
|
"description": "The Pitcher CLI for various tasks in its ecosystem.",
|
|
5
5
|
"author": "Pitcher AG",
|
|
6
6
|
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/PitcherAG/web.git",
|
|
10
|
+
"directory": "packages/libs/cli-scripts"
|
|
11
|
+
},
|
|
7
12
|
"keywords": [
|
|
8
13
|
"pitcher",
|
|
9
14
|
"cli",
|