@iblai/data-layer 1.11.2 → 1.12.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.
@@ -0,0 +1,65 @@
1
+ import { SERVICES } from '@data-layer/constants';
2
+ export declare const AGENT_SKILLS_REDUCER_PATH = "agentSkillsApiSlice";
3
+ export declare const AGENT_SKILLS_TAG_TYPES: readonly ["AgentSkills", "AgentSkillResources", "MentorSkillAssignments"];
4
+ export declare const AGENT_SKILLS_ENDPOINTS: {
5
+ readonly GET_AGENT_SKILLS: {
6
+ readonly path: (org: string) => string;
7
+ readonly service: SERVICES.DM;
8
+ };
9
+ readonly GET_AGENT_SKILL: {
10
+ readonly path: (org: string, id: number) => string;
11
+ readonly service: SERVICES.DM;
12
+ };
13
+ readonly CREATE_AGENT_SKILL: {
14
+ readonly path: (org: string) => string;
15
+ readonly service: SERVICES.DM;
16
+ };
17
+ readonly UPDATE_AGENT_SKILL: {
18
+ readonly path: (org: string, id: number) => string;
19
+ readonly service: SERVICES.DM;
20
+ };
21
+ readonly DELETE_AGENT_SKILL: {
22
+ readonly path: (org: string, id: number) => string;
23
+ readonly service: SERVICES.DM;
24
+ };
25
+ readonly GET_AGENT_SKILL_RESOURCES: {
26
+ readonly path: (org: string) => string;
27
+ readonly service: SERVICES.DM;
28
+ };
29
+ readonly GET_AGENT_SKILL_RESOURCE: {
30
+ readonly path: (org: string, id: number) => string;
31
+ readonly service: SERVICES.DM;
32
+ };
33
+ readonly CREATE_AGENT_SKILL_RESOURCE: {
34
+ readonly path: (org: string) => string;
35
+ readonly service: SERVICES.DM;
36
+ };
37
+ readonly UPDATE_AGENT_SKILL_RESOURCE: {
38
+ readonly path: (org: string, id: number) => string;
39
+ readonly service: SERVICES.DM;
40
+ };
41
+ readonly DELETE_AGENT_SKILL_RESOURCE: {
42
+ readonly path: (org: string, id: number) => string;
43
+ readonly service: SERVICES.DM;
44
+ };
45
+ readonly GET_MENTOR_SKILL_ASSIGNMENTS: {
46
+ readonly path: (org: string, mentorUniqueId: string) => string;
47
+ readonly service: SERVICES.DM;
48
+ };
49
+ readonly CREATE_MENTOR_SKILL_ASSIGNMENT: {
50
+ readonly path: (org: string, mentorUniqueId: string) => string;
51
+ readonly service: SERVICES.DM;
52
+ };
53
+ readonly GET_MENTOR_SKILL_ASSIGNMENT: {
54
+ readonly path: (org: string, mentorUniqueId: string, assignmentPk: number) => string;
55
+ readonly service: SERVICES.DM;
56
+ };
57
+ readonly UPDATE_MENTOR_SKILL_ASSIGNMENT: {
58
+ readonly path: (org: string, mentorUniqueId: string, assignmentPk: number) => string;
59
+ readonly service: SERVICES.DM;
60
+ };
61
+ readonly DELETE_MENTOR_SKILL_ASSIGNMENT: {
62
+ readonly path: (org: string, mentorUniqueId: string, assignmentPk: number) => string;
63
+ readonly service: SERVICES.DM;
64
+ };
65
+ };
@@ -0,0 +1,35 @@
1
+ import type { AgentSkill, EffectiveAgentSkill, MentorSkillAssignment } from './types';
2
+ /**
3
+ * Template slugs that resolve to the "base-agent" mentor type on the backend
4
+ * (`Mentor.get_mentor_type()`). `ai-mentor` and `ai-agent` are legacy aliases.
5
+ * Agent Skills only apply to base-agent mentors.
6
+ */
7
+ export declare const BASE_AGENT_TEMPLATE_SLUGS: readonly ["base-agent", "ai-mentor", "ai-agent"];
8
+ /**
9
+ * Whether a mentor is a Base Agent — the only mentor type that supports Agent
10
+ * Skills. Mirrors the backend check: the mentor's own slug, or its template
11
+ * mentor's slug, must be one of {@link BASE_AGENT_TEMPLATE_SLUGS}.
12
+ */
13
+ export declare function isBaseAgentMentor({ mentorSlug, templateMentorSlug, }: {
14
+ mentorSlug?: string | null;
15
+ templateMentorSlug?: string | null;
16
+ }): boolean;
17
+ /**
18
+ * Resolve the effective skill set for an agent from the two admin endpoints:
19
+ * skill assignments (`GET .../agents/{uuid}/skills/`) plus the agent's own
20
+ * private skills from the catalog (`GET .../agent-skills/` where
21
+ * `skill.mentor === mentorUniqueId`), deduped by slug.
22
+ *
23
+ * Precedence per backend `resolve_effective_skills`:
24
+ * mentor-private > tenant-platform > global/featured.
25
+ *
26
+ * Mirrors the server-side resolution so admin surfaces can render the
27
+ * effective set today; the chat surface should prefer the learner-accessible
28
+ * effective-skills endpoint once confirmed.
29
+ */
30
+ export declare function resolveEffectiveAgentSkills(skills: AgentSkill[], assignments: MentorSkillAssignment[], mentorUniqueId: string): EffectiveAgentSkill[];
31
+ /**
32
+ * Filter + rank effective skills for the chat `/` picker. Matches on `name`
33
+ * and `slug` (case-insensitive substring); only enabled skills are offered.
34
+ */
35
+ export declare function filterSlashSkills(skills: EffectiveAgentSkill[], query: string): EffectiveAgentSkill[];
@@ -0,0 +1,196 @@
1
+ export interface AgentSkillsBaseParams {
2
+ org: string;
3
+ }
4
+ export type AgentSkillType = 'custom' | 'native';
5
+ export interface AgentSkill {
6
+ id: number;
7
+ /** Stable UUID — preferred identifier for write bodies (e.g. skill assignments). */
8
+ unique_id: string;
9
+ name: string;
10
+ slug: string;
11
+ description: string;
12
+ version: string;
13
+ /** `custom` (authored on the platform) or `native` (seeded). */
14
+ skill_type?: AgentSkillType | string;
15
+ /** Grouping for the catalog UI: web, code, browser, data, etc. */
16
+ category?: string;
17
+ /** Provenance for seeded/imported skills. */
18
+ source?: string;
19
+ /** Featured skills on the `main` platform are visible (read-only) to all tenants. */
20
+ is_featured?: boolean;
21
+ /** Mentor UUID when the skill is private to one agent, null for platform-wide skills. */
22
+ mentor?: string | null;
23
+ instruction: string;
24
+ metadata: Record<string, unknown>;
25
+ enabled: boolean;
26
+ platform_key: string;
27
+ created_at: string;
28
+ updated_at: string;
29
+ }
30
+ export interface PaginatedAgentSkillList {
31
+ count: number;
32
+ next: string | null;
33
+ previous: string | null;
34
+ results: AgentSkill[];
35
+ }
36
+ export interface GetAgentSkillsParams extends AgentSkillsBaseParams {
37
+ /** Filter by enabled state. */
38
+ enabled?: boolean;
39
+ /** Matches `name` and `slug`. */
40
+ search?: string;
41
+ limit?: number;
42
+ offset?: number;
43
+ }
44
+ export interface GetAgentSkillParams extends AgentSkillsBaseParams {
45
+ id: number;
46
+ }
47
+ export interface CreateAgentSkillParams extends AgentSkillsBaseParams {
48
+ name: string;
49
+ slug: string;
50
+ description?: string;
51
+ version?: string;
52
+ skill_type?: AgentSkillType | string;
53
+ category?: string;
54
+ source?: string;
55
+ /** Set to a mentor UUID to create the skill private to that agent. */
56
+ mentor?: string | null;
57
+ instruction?: string;
58
+ metadata?: Record<string, unknown>;
59
+ enabled?: boolean;
60
+ }
61
+ export interface UpdateAgentSkillParams extends AgentSkillsBaseParams {
62
+ id: number;
63
+ name?: string;
64
+ slug?: string;
65
+ description?: string;
66
+ version?: string;
67
+ skill_type?: AgentSkillType | string;
68
+ category?: string;
69
+ source?: string;
70
+ mentor?: string | null;
71
+ instruction?: string;
72
+ metadata?: Record<string, unknown>;
73
+ enabled?: boolean;
74
+ }
75
+ export interface DeleteAgentSkillParams extends AgentSkillsBaseParams {
76
+ id: number;
77
+ }
78
+ export type AgentSkillResourceFileType = 'script' | 'reference' | 'asset';
79
+ export interface AgentSkillResource {
80
+ id: number;
81
+ /** Integer PK of the owning skill. */
82
+ skill: number;
83
+ file_type: AgentSkillResourceFileType | string;
84
+ filename: string;
85
+ /** Text content for script/reference resources. */
86
+ content?: string;
87
+ /** Binary file URL for asset resources. */
88
+ file?: string | null;
89
+ created_at: string;
90
+ updated_at: string;
91
+ }
92
+ export interface PaginatedAgentSkillResourceList {
93
+ count: number;
94
+ next: string | null;
95
+ previous: string | null;
96
+ results: AgentSkillResource[];
97
+ }
98
+ export interface GetAgentSkillResourcesParams extends AgentSkillsBaseParams {
99
+ skill?: number;
100
+ file_type?: AgentSkillResourceFileType | string;
101
+ limit?: number;
102
+ offset?: number;
103
+ }
104
+ export interface GetAgentSkillResourceParams extends AgentSkillsBaseParams {
105
+ id: number;
106
+ }
107
+ export interface CreateAgentSkillResourceParams extends AgentSkillsBaseParams {
108
+ skill: number;
109
+ file_type: AgentSkillResourceFileType | string;
110
+ filename: string;
111
+ content?: string;
112
+ }
113
+ export interface UpdateAgentSkillResourceParams extends AgentSkillsBaseParams {
114
+ id: number;
115
+ skill?: number;
116
+ file_type?: AgentSkillResourceFileType | string;
117
+ filename?: string;
118
+ content?: string;
119
+ }
120
+ export interface DeleteAgentSkillResourceParams extends AgentSkillsBaseParams {
121
+ id: number;
122
+ }
123
+ /**
124
+ * Binary upload for `asset` resources — sent as multipart form data
125
+ * (text resource types use {@link CreateAgentSkillResourceParams} instead).
126
+ */
127
+ export interface UploadAgentSkillResourceAssetParams extends AgentSkillsBaseParams {
128
+ /** Integer PK of the owning skill. */
129
+ skill: number;
130
+ file: Blob;
131
+ /** Defaults to the File's own name when omitted. */
132
+ filename?: string;
133
+ }
134
+ export interface MentorSkillAssignment {
135
+ id: number;
136
+ mentor: string;
137
+ mentor_name?: string;
138
+ mentor_slug?: string;
139
+ /** Skill UUID — the new stable identifier. */
140
+ skill: string;
141
+ skill_name: string;
142
+ skill_slug?: string;
143
+ enabled: boolean;
144
+ created_at: string;
145
+ updated_at: string;
146
+ }
147
+ export interface PaginatedMentorSkillAssignmentList {
148
+ count: number;
149
+ next: string | null;
150
+ previous: string | null;
151
+ results: MentorSkillAssignment[];
152
+ }
153
+ export interface GetMentorSkillAssignmentsParams extends AgentSkillsBaseParams {
154
+ mentorUniqueId: string;
155
+ /** Filter by the assignment's own enabled flag. */
156
+ enabled?: boolean;
157
+ limit?: number;
158
+ offset?: number;
159
+ }
160
+ export interface GetMentorSkillAssignmentParams extends AgentSkillsBaseParams {
161
+ mentorUniqueId: string;
162
+ assignmentPk: number;
163
+ }
164
+ export interface CreateMentorSkillAssignmentParams extends AgentSkillsBaseParams {
165
+ mentorUniqueId: string;
166
+ /** Skill UUID — the create endpoint references skills by UUID, not integer PK. */
167
+ skill: string;
168
+ enabled?: boolean;
169
+ }
170
+ export interface UpdateMentorSkillAssignmentParams extends AgentSkillsBaseParams {
171
+ mentorUniqueId: string;
172
+ assignmentPk: number;
173
+ enabled?: boolean;
174
+ }
175
+ export interface DeleteMentorSkillAssignmentParams extends AgentSkillsBaseParams {
176
+ mentorUniqueId: string;
177
+ assignmentPk: number;
178
+ }
179
+ export interface EffectiveAgentSkill {
180
+ /** Skill UUID. */
181
+ unique_id: string;
182
+ name: string;
183
+ slug: string;
184
+ description?: string;
185
+ category?: string;
186
+ skill_type?: AgentSkillType | string;
187
+ is_featured?: boolean;
188
+ /** Effective enabled state (catalog flag AND assignment flag). */
189
+ enabled: boolean;
190
+ /** How the skill reaches this agent. */
191
+ origin?: 'private' | 'assignment';
192
+ /** Assignment row pk when origin is `assignment`. */
193
+ assignmentId?: number;
194
+ /** Full catalog record when resolved client-side. */
195
+ skill?: AgentSkill;
196
+ }
@@ -394,8 +394,10 @@ export interface TimeTrackingRequest {
394
394
  url: string;
395
395
  org: string;
396
396
  count: number;
397
- course_id?: number;
398
- block_id?: number;
397
+ /** edX course key (e.g. `course-v1:org+course+run`), when on a specific course. */
398
+ course_id?: string;
399
+ /** edX unit (vertical) block usage id, when on a specific unit. */
400
+ block_id?: string;
399
401
  session_uuid?: string;
400
402
  mentor_uuid?: string;
401
403
  }