@pie-players/pie-assessment-toolkit 0.2.2 → 0.2.4
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 +159 -1
- package/dist/index.d.ts +16 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/player/AssessmentPlayer.d.ts +9 -0
- package/dist/player/AssessmentPlayer.d.ts.map +1 -1
- package/dist/player/AssessmentPlayer.js +13 -4
- package/dist/player/AssessmentPlayer.js.map +1 -1
- package/dist/services/AnnotationToolbarConfig.d.ts +134 -0
- package/dist/services/AnnotationToolbarConfig.d.ts.map +1 -0
- package/dist/services/AnnotationToolbarConfig.js +100 -0
- package/dist/services/AnnotationToolbarConfig.js.map +1 -0
- package/dist/services/HighlightCoordinator.d.ts +23 -10
- package/dist/services/HighlightCoordinator.d.ts.map +1 -1
- package/dist/services/HighlightCoordinator.js +87 -40
- package/dist/services/HighlightCoordinator.js.map +1 -1
- package/dist/services/PNPToolResolver.d.ts +171 -15
- package/dist/services/PNPToolResolver.d.ts.map +1 -1
- package/dist/services/PNPToolResolver.js +324 -32
- package/dist/services/PNPToolResolver.js.map +1 -1
- package/dist/services/RangeSerializer.d.ts +119 -0
- package/dist/services/RangeSerializer.d.ts.map +1 -0
- package/dist/services/RangeSerializer.js +199 -0
- package/dist/services/RangeSerializer.js.map +1 -0
- package/dist/services/TTSService.d.ts +4 -1
- package/dist/services/TTSService.d.ts.map +1 -1
- package/dist/services/TTSService.js +58 -3
- package/dist/services/TTSService.js.map +1 -1
- package/dist/services/ToolRegistry.d.ts +225 -0
- package/dist/services/ToolRegistry.d.ts.map +1 -0
- package/dist/services/ToolRegistry.js +248 -0
- package/dist/services/ToolRegistry.js.map +1 -0
- package/dist/services/ToolkitCoordinator.d.ts +22 -0
- package/dist/services/ToolkitCoordinator.d.ts.map +1 -1
- package/dist/services/ToolkitCoordinator.js +44 -0
- package/dist/services/ToolkitCoordinator.js.map +1 -1
- package/dist/services/createDefaultToolRegistry.d.ts +72 -0
- package/dist/services/createDefaultToolRegistry.d.ts.map +1 -0
- package/dist/services/createDefaultToolRegistry.js +147 -0
- package/dist/services/createDefaultToolRegistry.js.map +1 -0
- package/dist/services/interfaces.d.ts +8 -0
- package/dist/services/interfaces.d.ts.map +1 -1
- package/dist/services/interfaces.js.map +1 -1
- package/dist/services/pnp-provenance.d.ts +167 -0
- package/dist/services/pnp-provenance.d.ts.map +1 -0
- package/dist/services/pnp-provenance.js +230 -0
- package/dist/services/pnp-provenance.js.map +1 -0
- package/dist/services/pnp-standard-features.d.ts +240 -0
- package/dist/services/pnp-standard-features.d.ts.map +1 -0
- package/dist/services/pnp-standard-features.js +342 -0
- package/dist/services/pnp-standard-features.js.map +1 -0
- package/dist/services/tool-context.d.ts +150 -0
- package/dist/services/tool-context.d.ts.map +1 -0
- package/dist/services/tool-context.js +157 -0
- package/dist/services/tool-context.js.map +1 -0
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts.map +1 -1
- package/dist/services/tool-providers/ToolProviderRegistry.js +7 -7
- package/dist/services/tool-providers/ToolProviderRegistry.js.map +1 -1
- package/dist/tools/registrations/accessibility-tools.d.ts +43 -0
- package/dist/tools/registrations/accessibility-tools.d.ts.map +1 -0
- package/dist/tools/registrations/accessibility-tools.js +230 -0
- package/dist/tools/registrations/accessibility-tools.js.map +1 -0
- package/dist/tools/registrations/calculator.d.ts +21 -0
- package/dist/tools/registrations/calculator.d.ts.map +1 -0
- package/dist/tools/registrations/calculator.js +98 -0
- package/dist/tools/registrations/calculator.js.map +1 -0
- package/dist/tools/registrations/interaction-tools.d.ts +28 -0
- package/dist/tools/registrations/interaction-tools.d.ts.map +1 -0
- package/dist/tools/registrations/interaction-tools.js +124 -0
- package/dist/tools/registrations/interaction-tools.js.map +1 -0
- package/dist/tools/registrations/measurement-tools.d.ts +25 -0
- package/dist/tools/registrations/measurement-tools.d.ts.map +1 -0
- package/dist/tools/registrations/measurement-tools.js +112 -0
- package/dist/tools/registrations/measurement-tools.js.map +1 -0
- package/dist/tools/registrations/subject-specific-tools.d.ts +28 -0
- package/dist/tools/registrations/subject-specific-tools.d.ts.map +1 -0
- package/dist/tools/registrations/subject-specific-tools.js +118 -0
- package/dist/tools/registrations/subject-specific-tools.js.map +1 -0
- package/dist/tools/registrations/tts.d.ts +20 -0
- package/dist/tools/registrations/tts.d.ts.map +1 -0
- package/dist/tools/registrations/tts.js +86 -0
- package/dist/tools/registrations/tts.js.map +1 -0
- package/dist/tools/tool-tag-map.d.ts +24 -0
- package/dist/tools/tool-tag-map.d.ts.map +1 -0
- package/dist/tools/tool-tag-map.js +38 -0
- package/dist/tools/tool-tag-map.js.map +1 -0
- package/package.json +15 -7
- package/src/README.md +25 -11
- package/src/components/PNPProfileTester.example.svelte +188 -0
- package/src/components/PNPProfileTester.svelte +397 -0
- package/src/components/PNPProvenanceViewer.svelte +260 -0
- package/src/components/QuestionToolBar.svelte +160 -83
- package/src/components/ToolButton.svelte +146 -0
- package/src/components/ToolButtonGroup.svelte +109 -0
- package/src/reference-layout/ReferenceLayout.svelte +5 -13
- package/dist/services/PNPMapper.d.ts +0 -71
- package/dist/services/PNPMapper.d.ts.map +0 -1
- package/dist/services/PNPMapper.js +0 -98
- package/dist/services/PNPMapper.js.map +0 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Measurement Tools Registrations
|
|
3
|
+
*
|
|
4
|
+
* Registers ruler and protractor tools for on-screen measurements.
|
|
5
|
+
*
|
|
6
|
+
* Maps to QTI 3.0 standard access features:
|
|
7
|
+
* - ruler (assessment tool)
|
|
8
|
+
* - protractor (assessment tool)
|
|
9
|
+
*/
|
|
10
|
+
import { hasMathContent } from "../../services/tool-context";
|
|
11
|
+
import { createToolElement, } from "../tool-tag-map";
|
|
12
|
+
/**
|
|
13
|
+
* Ruler tool registration
|
|
14
|
+
*
|
|
15
|
+
* Provides an on-screen ruler for measuring lengths.
|
|
16
|
+
* Typically appears on geometry or measurement problems.
|
|
17
|
+
*/
|
|
18
|
+
export const rulerToolRegistration = {
|
|
19
|
+
toolId: "ruler",
|
|
20
|
+
name: "Ruler",
|
|
21
|
+
description: "On-screen ruler for measurements",
|
|
22
|
+
icon: "ruler",
|
|
23
|
+
// Ruler typically appears at item/element level
|
|
24
|
+
supportedLevels: ["item", "element"],
|
|
25
|
+
// PNP support IDs
|
|
26
|
+
// Maps to QTI 3.0 standard feature: ruler
|
|
27
|
+
pnpSupportIds: [
|
|
28
|
+
"ruler", // QTI 3.0 standard (assessment.ruler)
|
|
29
|
+
"measurement", // Common variant
|
|
30
|
+
],
|
|
31
|
+
/**
|
|
32
|
+
* Pass 2: Ruler is relevant when math content is present
|
|
33
|
+
*/
|
|
34
|
+
isVisibleInContext(context) {
|
|
35
|
+
return hasMathContent(context);
|
|
36
|
+
},
|
|
37
|
+
createButton(context, options) {
|
|
38
|
+
return {
|
|
39
|
+
toolId: this.toolId,
|
|
40
|
+
label: this.name,
|
|
41
|
+
icon: typeof this.icon === "function" ? this.icon(context) : this.icon,
|
|
42
|
+
disabled: options.disabled || false,
|
|
43
|
+
ariaLabel: options.ariaLabel || "Open ruler tool",
|
|
44
|
+
tooltip: options.tooltip || "Ruler",
|
|
45
|
+
onClick: options.onClick || (() => { }),
|
|
46
|
+
className: options.className,
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
createToolInstance(context, options) {
|
|
50
|
+
const componentOverrides = options.config ?? {};
|
|
51
|
+
const ruler = createToolElement(this.toolId, context, options, componentOverrides);
|
|
52
|
+
ruler.visible = true;
|
|
53
|
+
if (options.config?.toolkitCoordinator) {
|
|
54
|
+
ruler.toolkitCoordinator = options.config.toolkitCoordinator;
|
|
55
|
+
}
|
|
56
|
+
if (options.onClose) {
|
|
57
|
+
ruler.addEventListener("close", options.onClose);
|
|
58
|
+
}
|
|
59
|
+
return ruler;
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Protractor tool registration
|
|
64
|
+
*
|
|
65
|
+
* Provides an on-screen protractor for measuring angles.
|
|
66
|
+
* Typically appears on geometry problems.
|
|
67
|
+
*/
|
|
68
|
+
export const protractorToolRegistration = {
|
|
69
|
+
toolId: "protractor",
|
|
70
|
+
name: "Protractor",
|
|
71
|
+
description: "On-screen protractor for angle measurements",
|
|
72
|
+
icon: "protractor",
|
|
73
|
+
// Protractor typically appears at item/element level
|
|
74
|
+
supportedLevels: ["item", "element"],
|
|
75
|
+
// PNP support IDs
|
|
76
|
+
// Maps to QTI 3.0 standard feature: protractor
|
|
77
|
+
pnpSupportIds: [
|
|
78
|
+
"protractor", // QTI 3.0 standard (assessment.protractor)
|
|
79
|
+
"angleMeasurement", // Common variant
|
|
80
|
+
],
|
|
81
|
+
/**
|
|
82
|
+
* Pass 2: Protractor is relevant when math content is present
|
|
83
|
+
*/
|
|
84
|
+
isVisibleInContext(context) {
|
|
85
|
+
return hasMathContent(context);
|
|
86
|
+
},
|
|
87
|
+
createButton(context, options) {
|
|
88
|
+
return {
|
|
89
|
+
toolId: this.toolId,
|
|
90
|
+
label: this.name,
|
|
91
|
+
icon: typeof this.icon === "function" ? this.icon(context) : this.icon,
|
|
92
|
+
disabled: options.disabled || false,
|
|
93
|
+
ariaLabel: options.ariaLabel || "Open protractor tool",
|
|
94
|
+
tooltip: options.tooltip || "Protractor",
|
|
95
|
+
onClick: options.onClick || (() => { }),
|
|
96
|
+
className: options.className,
|
|
97
|
+
};
|
|
98
|
+
},
|
|
99
|
+
createToolInstance(context, options) {
|
|
100
|
+
const componentOverrides = options.config ?? {};
|
|
101
|
+
const protractor = createToolElement(this.toolId, context, options, componentOverrides);
|
|
102
|
+
protractor.visible = true;
|
|
103
|
+
if (options.config?.toolkitCoordinator) {
|
|
104
|
+
protractor.toolkitCoordinator = options.config.toolkitCoordinator;
|
|
105
|
+
}
|
|
106
|
+
if (options.onClose) {
|
|
107
|
+
protractor.addEventListener("close", options.onClose);
|
|
108
|
+
}
|
|
109
|
+
return protractor;
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=measurement-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measurement-tools.js","sourceRoot":"","sources":["../../../src/tools/registrations/measurement-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EACN,iBAAiB,GAEjB,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACtD,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,kCAAkC;IAC/C,IAAI,EAAE,OAAO;IAEb,gDAAgD;IAChD,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;IAEpC,kBAAkB;IAClB,0CAA0C;IAC1C,aAAa,EAAE;QACd,OAAO,EAAE,sCAAsC;QAC/C,aAAa,EAAE,iBAAiB;KAChC;IAED;;OAEG;IACH,kBAAkB,CAAC,OAAoB;QACtC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,YAAY,CACX,OAAoB,EACpB,OAA0B;QAE1B,OAAO;YACN,MAAM,EAAE,IAAI,CAAC,MAAM;YACnB,KAAK,EAAE,IAAI,CAAC,IAAI;YAChB,IAAI,EAAE,OAAO,IAAI,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;YACtE,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK;YACnC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,iBAAiB;YACjD,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO;YACnC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,GA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UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI;YACtE,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,KAAK;YACnC,SAAS,EAAE,OAAO,CAAC,SAAS,IAAI,sBAAsB;YACtD,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,YAAY;YACxC,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;YACtC,SAAS,EAAE,OAAO,CAAC,SAAS;SAC5B,CAAC;IACH,CAAC;IAED,kBAAkB,CACjB,OAAoB,EACpB,OAA4B;QAE5B,MAAM,kBAAkB,GACtB,OAAO,CAAC,MAA6C,IAAI,EAAE,CAAC;QAC9D,MAAM,UAAU,GAAG,iBAAiB,CACnC,IAAI,CAAC,MAAM,EACX,OAAO,EACP,OAAO,EACP,kBAAkB,CAIlB,CAAC;QAEF,UAAU,CAAC,OAAO,GAAG,IAAI,CAAC;QAE1B,IAAI,OAAO,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC;YACxC,UAAU,CAAC,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;QACnE,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,UAAU,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QACvD,CAAC;QAED,OAAO,UAAU,CAAC;IACnB,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subject-Specific Tools Registrations
|
|
3
|
+
*
|
|
4
|
+
* Registers tools for specific subject areas:
|
|
5
|
+
* - Graph (graphing calculator/coordinate plane)
|
|
6
|
+
* - Periodic Table (chemistry reference)
|
|
7
|
+
*
|
|
8
|
+
* Maps to QTI 3.0 standard access features:
|
|
9
|
+
* - graphingCalculator (assessment tool)
|
|
10
|
+
* - graph (assessment tool)
|
|
11
|
+
* - periodicTable (assessment tool)
|
|
12
|
+
*/
|
|
13
|
+
import type { ToolRegistration } from "../../services/ToolRegistry";
|
|
14
|
+
/**
|
|
15
|
+
* Graph tool registration
|
|
16
|
+
*
|
|
17
|
+
* Provides graphing calculator and coordinate plane functionality.
|
|
18
|
+
* Context-smart: appears automatically for math content or when explicitly enabled.
|
|
19
|
+
*/
|
|
20
|
+
export declare const graphToolRegistration: ToolRegistration;
|
|
21
|
+
/**
|
|
22
|
+
* Periodic Table tool registration
|
|
23
|
+
*
|
|
24
|
+
* Provides chemistry periodic table reference.
|
|
25
|
+
* Context-smart: appears automatically for science content or when explicitly enabled.
|
|
26
|
+
*/
|
|
27
|
+
export declare const periodicTableToolRegistration: ToolRegistration;
|
|
28
|
+
//# sourceMappingURL=subject-specific-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subject-specific-tools.d.ts","sourceRoot":"","sources":["../../../src/tools/registrations/subject-specific-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAIhB,MAAM,6BAA6B,CAAC;AAQrC;;;;;GAKG;AACH,eAAO,MAAM,qBAAqB,EAAE,gBAqEnC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,EAAE,gBAoE3C,CAAC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Subject-Specific Tools Registrations
|
|
3
|
+
*
|
|
4
|
+
* Registers tools for specific subject areas:
|
|
5
|
+
* - Graph (graphing calculator/coordinate plane)
|
|
6
|
+
* - Periodic Table (chemistry reference)
|
|
7
|
+
*
|
|
8
|
+
* Maps to QTI 3.0 standard access features:
|
|
9
|
+
* - graphingCalculator (assessment tool)
|
|
10
|
+
* - graph (assessment tool)
|
|
11
|
+
* - periodicTable (assessment tool)
|
|
12
|
+
*/
|
|
13
|
+
import { hasMathContent, hasScienceContent } from "../../services/tool-context";
|
|
14
|
+
import { createToolElement, } from "../tool-tag-map";
|
|
15
|
+
/**
|
|
16
|
+
* Graph tool registration
|
|
17
|
+
*
|
|
18
|
+
* Provides graphing calculator and coordinate plane functionality.
|
|
19
|
+
* Context-smart: appears automatically for math content or when explicitly enabled.
|
|
20
|
+
*/
|
|
21
|
+
export const graphToolRegistration = {
|
|
22
|
+
toolId: "graph",
|
|
23
|
+
name: "Graph",
|
|
24
|
+
description: "Graphing calculator and coordinate plane",
|
|
25
|
+
icon: "chart-bar",
|
|
26
|
+
// Graph appears at item and element level where graphing might be needed
|
|
27
|
+
supportedLevels: ["item", "element"],
|
|
28
|
+
// PNP support IDs
|
|
29
|
+
// Maps to QTI 3.0 standard features: graph, graphingCalculator
|
|
30
|
+
pnpSupportIds: [
|
|
31
|
+
"graph", // QTI 3.0 standard (assessment.graph)
|
|
32
|
+
"graphingCalculator", // QTI 3.0 standard (assessment.graphingCalculator)
|
|
33
|
+
"coordinatePlane", // Common variant
|
|
34
|
+
"graphingTool", // Common variant
|
|
35
|
+
],
|
|
36
|
+
/**
|
|
37
|
+
* Pass 2: Graph is relevant when math content is present
|
|
38
|
+
*/
|
|
39
|
+
isVisibleInContext(context) {
|
|
40
|
+
return hasMathContent(context);
|
|
41
|
+
},
|
|
42
|
+
createButton(context, options) {
|
|
43
|
+
return {
|
|
44
|
+
toolId: this.toolId,
|
|
45
|
+
label: this.name,
|
|
46
|
+
icon: typeof this.icon === "function" ? this.icon(context) : this.icon,
|
|
47
|
+
disabled: options.disabled || false,
|
|
48
|
+
ariaLabel: options.ariaLabel || "Graph - Graphing calculator",
|
|
49
|
+
tooltip: options.tooltip || "Graph",
|
|
50
|
+
onClick: options.onClick || (() => { }),
|
|
51
|
+
className: options.className,
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
createToolInstance(context, options) {
|
|
55
|
+
const componentOverrides = options.config ?? {};
|
|
56
|
+
const graph = createToolElement(this.toolId, context, options, componentOverrides);
|
|
57
|
+
graph.visible = true;
|
|
58
|
+
if (options.config?.toolkitCoordinator) {
|
|
59
|
+
graph.toolkitCoordinator = options.config.toolkitCoordinator;
|
|
60
|
+
}
|
|
61
|
+
if (options.onClose) {
|
|
62
|
+
graph.addEventListener("close", options.onClose);
|
|
63
|
+
}
|
|
64
|
+
return graph;
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Periodic Table tool registration
|
|
69
|
+
*
|
|
70
|
+
* Provides chemistry periodic table reference.
|
|
71
|
+
* Context-smart: appears automatically for science content or when explicitly enabled.
|
|
72
|
+
*/
|
|
73
|
+
export const periodicTableToolRegistration = {
|
|
74
|
+
toolId: "periodicTable",
|
|
75
|
+
name: "Periodic Table",
|
|
76
|
+
description: "Chemistry periodic table reference",
|
|
77
|
+
icon: "beaker",
|
|
78
|
+
// Periodic table appears at item and element level
|
|
79
|
+
supportedLevels: ["item", "element"],
|
|
80
|
+
// PNP support IDs
|
|
81
|
+
// Maps to QTI 3.0 standard feature: periodicTable
|
|
82
|
+
pnpSupportIds: [
|
|
83
|
+
"periodicTable", // QTI 3.0 standard (assessment.periodicTable)
|
|
84
|
+
"chemistryReference", // Common variant
|
|
85
|
+
"elementReference", // Common variant
|
|
86
|
+
],
|
|
87
|
+
/**
|
|
88
|
+
* Pass 2: Periodic table is relevant when science content is present
|
|
89
|
+
*/
|
|
90
|
+
isVisibleInContext(context) {
|
|
91
|
+
return hasScienceContent(context);
|
|
92
|
+
},
|
|
93
|
+
createButton(context, options) {
|
|
94
|
+
return {
|
|
95
|
+
toolId: this.toolId,
|
|
96
|
+
label: this.name,
|
|
97
|
+
icon: typeof this.icon === "function" ? this.icon(context) : this.icon,
|
|
98
|
+
disabled: options.disabled || false,
|
|
99
|
+
ariaLabel: options.ariaLabel || "Periodic table - Chemistry reference",
|
|
100
|
+
tooltip: options.tooltip || "Periodic Table",
|
|
101
|
+
onClick: options.onClick || (() => { }),
|
|
102
|
+
className: options.className,
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
createToolInstance(context, options) {
|
|
106
|
+
const componentOverrides = options.config ?? {};
|
|
107
|
+
const periodicTable = createToolElement(this.toolId, context, options, componentOverrides);
|
|
108
|
+
periodicTable.visible = true;
|
|
109
|
+
if (options.config?.toolkitCoordinator) {
|
|
110
|
+
periodicTable.toolkitCoordinator = options.config.toolkitCoordinator;
|
|
111
|
+
}
|
|
112
|
+
if (options.onClose) {
|
|
113
|
+
periodicTable.addEventListener("close", options.onClose);
|
|
114
|
+
}
|
|
115
|
+
return periodicTable;
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
//# sourceMappingURL=subject-specific-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subject-specific-tools.js","sourceRoot":"","sources":["../../../src/tools/registrations/subject-specific-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AASH,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChF,OAAO,EACN,iBAAiB,GAEjB,MAAM,iBAAiB,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAqB;IACtD,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,OAAO;IACb,WAAW,EAAE,0CAA0C;IACvD,IAAI,EAAE,WAAW;IAEjB,yEAAyE;IACzE,eAAe,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;IAEpC,kBAAkB;IAClB,+DAA+D;IAC/D,aAAa,EAAE;QACd,OAAO,EAAE,sCAAsC;QAC/C,oBAAoB,EAAE,mDAAmD;QACzE,iBAAiB,EAAE,iBAAiB;QACpC,cAAc,EAAE,iBAAiB;KACjC;IAED;;OAEG;IACH,kBAAkB,CAAC,OAAoB;QACtC,OAAO,cAAc,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,YAAY,CACX,OAAoB,EACpB,OAA0B;QAE1B,OAAO;YACN,MAAM,EAAE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IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,aAAa,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,aAAa,CAAC;IACtB,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-to-Speech (TTS) Tool Registration
|
|
3
|
+
*
|
|
4
|
+
* Registers the TTS tool for reading content aloud.
|
|
5
|
+
*
|
|
6
|
+
* Maps to QTI 3.0 standard access features:
|
|
7
|
+
* - textToSpeech (auditory support)
|
|
8
|
+
* - readAloud (auditory support)
|
|
9
|
+
*/
|
|
10
|
+
import type { ToolRegistration } from "../../services/ToolRegistry";
|
|
11
|
+
/**
|
|
12
|
+
* Text-to-Speech tool registration
|
|
13
|
+
*
|
|
14
|
+
* Supports:
|
|
15
|
+
* - Reading content aloud using browser TTS or external providers
|
|
16
|
+
* - Context-aware visibility (shows when readable text is available)
|
|
17
|
+
* - All levels except assessment (section, item, passage, rubric, element)
|
|
18
|
+
*/
|
|
19
|
+
export declare const ttsToolRegistration: ToolRegistration;
|
|
20
|
+
//# sourceMappingURL=tts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tts.d.ts","sourceRoot":"","sources":["../../../src/tools/registrations/tts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACX,gBAAgB,EAIhB,MAAM,6BAA6B,CAAC;AAQrC;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,gBA+FjC,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-to-Speech (TTS) Tool Registration
|
|
3
|
+
*
|
|
4
|
+
* Registers the TTS tool for reading content aloud.
|
|
5
|
+
*
|
|
6
|
+
* Maps to QTI 3.0 standard access features:
|
|
7
|
+
* - textToSpeech (auditory support)
|
|
8
|
+
* - readAloud (auditory support)
|
|
9
|
+
*/
|
|
10
|
+
import { hasReadableText } from "../../services/tool-context";
|
|
11
|
+
import { createToolElement, } from "../tool-tag-map";
|
|
12
|
+
/**
|
|
13
|
+
* Text-to-Speech tool registration
|
|
14
|
+
*
|
|
15
|
+
* Supports:
|
|
16
|
+
* - Reading content aloud using browser TTS or external providers
|
|
17
|
+
* - Context-aware visibility (shows when readable text is available)
|
|
18
|
+
* - All levels except assessment (section, item, passage, rubric, element)
|
|
19
|
+
*/
|
|
20
|
+
export const ttsToolRegistration = {
|
|
21
|
+
toolId: "textToSpeech",
|
|
22
|
+
name: "Text to Speech",
|
|
23
|
+
description: "Read content aloud",
|
|
24
|
+
icon: "volume-up",
|
|
25
|
+
// TTS can appear at all levels except assessment
|
|
26
|
+
supportedLevels: ["section", "item", "passage", "rubric", "element"],
|
|
27
|
+
// PNP support IDs that enable this tool
|
|
28
|
+
// Maps to QTI 3.0 standard features: textToSpeech, readAloud
|
|
29
|
+
pnpSupportIds: [
|
|
30
|
+
"textToSpeech", // QTI 3.0 standard (auditory.textToSpeech)
|
|
31
|
+
"readAloud", // QTI 3.0 standard (auditory.readAloud)
|
|
32
|
+
"tts", // Common abbreviation
|
|
33
|
+
"speechOutput", // Common variant
|
|
34
|
+
],
|
|
35
|
+
/**
|
|
36
|
+
* Pass 2: Determine if TTS is relevant in this context
|
|
37
|
+
*
|
|
38
|
+
* TTS is relevant when:
|
|
39
|
+
* - Context contains readable text (at least 10 characters)
|
|
40
|
+
*/
|
|
41
|
+
isVisibleInContext(context) {
|
|
42
|
+
return hasReadableText(context);
|
|
43
|
+
},
|
|
44
|
+
/**
|
|
45
|
+
* Create TTS button for toolbar
|
|
46
|
+
*/
|
|
47
|
+
createButton(context, options) {
|
|
48
|
+
const icon = typeof this.icon === "function" ? this.icon(context) : this.icon;
|
|
49
|
+
return {
|
|
50
|
+
toolId: this.toolId,
|
|
51
|
+
label: this.name,
|
|
52
|
+
icon: icon,
|
|
53
|
+
disabled: options.disabled || false,
|
|
54
|
+
ariaLabel: options.ariaLabel || "Read aloud - Press to activate text-to-speech",
|
|
55
|
+
tooltip: options.tooltip || "Read Aloud",
|
|
56
|
+
onClick: options.onClick || (() => { }),
|
|
57
|
+
className: options.className,
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* Create TTS tool instance
|
|
62
|
+
*
|
|
63
|
+
* Creates a <pie-tool-tts> web component or activates TTS service.
|
|
64
|
+
* Note: TTS often works as a service rather than a visible component.
|
|
65
|
+
*/
|
|
66
|
+
createToolInstance(context, options) {
|
|
67
|
+
const componentOverrides = options.config ?? {};
|
|
68
|
+
const tts = createToolElement(this.toolId, context, options, componentOverrides);
|
|
69
|
+
tts.visible = true;
|
|
70
|
+
tts.toolId = this.toolId;
|
|
71
|
+
if (options.config?.toolkitCoordinator) {
|
|
72
|
+
tts.coordinator = options.config.toolkitCoordinator;
|
|
73
|
+
}
|
|
74
|
+
if (options.config?.ttsService) {
|
|
75
|
+
tts.ttsService = options.config.ttsService;
|
|
76
|
+
}
|
|
77
|
+
if (options.config?.contentElement) {
|
|
78
|
+
tts.contentElement = options.config.contentElement;
|
|
79
|
+
}
|
|
80
|
+
if (options.onClose) {
|
|
81
|
+
tts.addEventListener("close", options.onClose);
|
|
82
|
+
}
|
|
83
|
+
return tts;
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
//# sourceMappingURL=tts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tts.js","sourceRoot":"","sources":["../../../src/tools/registrations/tts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AASH,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EACN,iBAAiB,GAEjB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAqB;IACpD,MAAM,EAAE,cAAc;IACtB,IAAI,EAAE,gBAAgB;IAC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QAEF,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;QACnB,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;QAEzB,IAAI,OAAO,CAAC,MAAM,EAAE,kBAAkB,EAAE,CAAC;YACxC,GAAG,CAAC,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;QACrD,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC;YAChC,GAAG,CAAC,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC;QAC5C,CAAC;QACD,IAAI,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;YACpC,GAAG,CAAC,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,cAA6B,CAAC;QACnE,CAAC;QAED,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;YACrB,GAAG,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,GAAG,CAAC;IACZ,CAAC;CACD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ToolContext } from "../services/tool-context";
|
|
2
|
+
import type { ToolInstanceOptions } from "../services/ToolRegistry";
|
|
3
|
+
export type ToolTagMap = Record<string, string>;
|
|
4
|
+
export type ToolComponentFactory = (args: {
|
|
5
|
+
toolId: string;
|
|
6
|
+
tagName: string;
|
|
7
|
+
context: ToolContext;
|
|
8
|
+
options: ToolInstanceOptions;
|
|
9
|
+
}) => HTMLElement;
|
|
10
|
+
export type ToolComponentFactoryMap = Record<string, ToolComponentFactory>;
|
|
11
|
+
export interface ToolComponentOverrides {
|
|
12
|
+
toolTagMap?: Partial<ToolTagMap>;
|
|
13
|
+
toolComponentFactory?: ToolComponentFactory;
|
|
14
|
+
toolComponentFactories?: Partial<ToolComponentFactoryMap>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Canonical default web component tag mapping for toolkit tools.
|
|
18
|
+
* Integrators can override any entry via ToolComponentOverrides.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEFAULT_TOOL_TAG_MAP: ToolTagMap;
|
|
21
|
+
export declare const resolveToolTag: (toolId: string, overrides?: ToolComponentOverrides) => string;
|
|
22
|
+
export declare const createToolElement: (toolId: string, context: ToolContext, options: ToolInstanceOptions, overrides?: ToolComponentOverrides) => HTMLElement;
|
|
23
|
+
export declare const toToolIdFromTag: (tagName: string, overrides?: ToolComponentOverrides) => string | undefined;
|
|
24
|
+
//# sourceMappingURL=tool-tag-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-tag-map.d.ts","sourceRoot":"","sources":["../../src/tools/tool-tag-map.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE,mBAAmB,CAAC;CAC7B,KAAK,WAAW,CAAC;AAElB,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;AAE3E,MAAM,WAAW,sBAAsB;IACtC,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IACjC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,sBAAsB,CAAC,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC1D;AAED;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,UAalC,CAAC;AAEF,eAAO,MAAM,cAAc,GAC1B,QAAQ,MAAM,EACd,YAAY,sBAAsB,KAChC,MAIF,CAAC;AAKF,eAAO,MAAM,iBAAiB,GAC7B,QAAQ,MAAM,EACd,SAAS,WAAW,EACpB,SAAS,mBAAmB,EAC5B,YAAY,sBAAsB,KAChC,WAOF,CAAC;AAEF,eAAO,MAAM,eAAe,GAC3B,SAAS,MAAM,EACf,YAAY,sBAAsB,KAChC,MAAM,GAAG,SAIX,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { validateCustomElementTag } from "@pie-players/pie-players-shared/pie/tag-names";
|
|
2
|
+
/**
|
|
3
|
+
* Canonical default web component tag mapping for toolkit tools.
|
|
4
|
+
* Integrators can override any entry via ToolComponentOverrides.
|
|
5
|
+
*/
|
|
6
|
+
export const DEFAULT_TOOL_TAG_MAP = {
|
|
7
|
+
calculator: "pie-tool-calculator",
|
|
8
|
+
textToSpeech: "pie-tool-text-to-speech",
|
|
9
|
+
ruler: "pie-tool-ruler",
|
|
10
|
+
protractor: "pie-tool-protractor",
|
|
11
|
+
answerEliminator: "pie-tool-answer-eliminator",
|
|
12
|
+
highlighter: "pie-tool-annotation-toolbar",
|
|
13
|
+
magnifier: "pie-tool-magnifier",
|
|
14
|
+
lineReader: "pie-tool-line-reader",
|
|
15
|
+
colorScheme: "pie-tool-color-scheme",
|
|
16
|
+
annotationToolbar: "pie-tool-annotation-toolbar",
|
|
17
|
+
graph: "pie-tool-graph",
|
|
18
|
+
periodicTable: "pie-tool-periodic-table",
|
|
19
|
+
};
|
|
20
|
+
export const resolveToolTag = (toolId, overrides) => {
|
|
21
|
+
const mapped = overrides?.toolTagMap?.[toolId] ?? DEFAULT_TOOL_TAG_MAP[toolId] ?? toolId;
|
|
22
|
+
return validateCustomElementTag(mapped, `tool component tag for "${toolId}"`);
|
|
23
|
+
};
|
|
24
|
+
const createDefaultToolElement = (tagName) => document.createElement(tagName);
|
|
25
|
+
export const createToolElement = (toolId, context, options, overrides) => {
|
|
26
|
+
const tagName = resolveToolTag(toolId, overrides);
|
|
27
|
+
const factoryForTool = overrides?.toolComponentFactories?.[toolId];
|
|
28
|
+
const factory = factoryForTool ?? overrides?.toolComponentFactory;
|
|
29
|
+
return factory
|
|
30
|
+
? factory({ toolId, tagName, context, options })
|
|
31
|
+
: createDefaultToolElement(tagName);
|
|
32
|
+
};
|
|
33
|
+
export const toToolIdFromTag = (tagName, overrides) => {
|
|
34
|
+
const validTag = validateCustomElementTag(tagName, "tool component tag");
|
|
35
|
+
const map = { ...DEFAULT_TOOL_TAG_MAP, ...overrides?.toolTagMap };
|
|
36
|
+
return Object.entries(map).find(([, tag]) => tag === validTag)?.[0];
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=tool-tag-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-tag-map.js","sourceRoot":"","sources":["../../src/tools/tool-tag-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,+CAA+C,CAAC;AAqBzF;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAe;IAC/C,UAAU,EAAE,qBAAqB;IACjC,YAAY,EAAE,yBAAyB;IACvC,KAAK,EAAE,gBAAgB;IACvB,UAAU,EAAE,qBAAqB;IACjC,gBAAgB,EAAE,4BAA4B;IAC9C,WAAW,EAAE,6BAA6B;IAC1C,SAAS,EAAE,oBAAoB;IAC/B,UAAU,EAAE,sBAAsB;IAClC,WAAW,EAAE,uBAAuB;IACpC,iBAAiB,EAAE,6BAA6B;IAChD,KAAK,EAAE,gBAAgB;IACvB,aAAa,EAAE,yBAAyB;CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAC7B,MAAc,EACd,SAAkC,EACzB,EAAE;IACX,MAAM,MAAM,GACX,SAAS,EAAE,UAAU,EAAE,CAAC,MAAM,CAAC,IAAI,oBAAoB,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC;IAC3E,OAAO,wBAAwB,CAAC,MAAM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
5
|
"description": "PIE assessment toolkit: composable services + reference implementation for assessment players and tool coordination",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,6 +36,14 @@
|
|
|
36
36
|
"svelte": "./src/components/QuestionToolBar.svelte",
|
|
37
37
|
"import": "./src/components/QuestionToolBar.svelte"
|
|
38
38
|
},
|
|
39
|
+
"./components/PNPProvenanceViewer.svelte": {
|
|
40
|
+
"svelte": "./src/components/PNPProvenanceViewer.svelte",
|
|
41
|
+
"import": "./src/components/PNPProvenanceViewer.svelte"
|
|
42
|
+
},
|
|
43
|
+
"./components/PNPProfileTester.svelte": {
|
|
44
|
+
"svelte": "./src/components/PNPProfileTester.svelte",
|
|
45
|
+
"import": "./src/components/PNPProfileTester.svelte"
|
|
46
|
+
},
|
|
39
47
|
"./services/I18nService": {
|
|
40
48
|
"types": "./dist/services/I18nService.d.ts",
|
|
41
49
|
"import": "./dist/services/I18nService.js"
|
|
@@ -55,14 +63,14 @@
|
|
|
55
63
|
"test": "bun test"
|
|
56
64
|
},
|
|
57
65
|
"dependencies": {
|
|
58
|
-
"@pie-players/pie-calculator": "
|
|
59
|
-
"@pie-players/pie-calculator-desmos": "
|
|
60
|
-
"@pie-players/pie-players-shared": "
|
|
61
|
-
"@pie-players/pie-tts": "
|
|
62
|
-
"@pie-players/tts-client-server": "
|
|
66
|
+
"@pie-players/pie-calculator": "0.1.1",
|
|
67
|
+
"@pie-players/pie-calculator-desmos": "0.1.2",
|
|
68
|
+
"@pie-players/pie-players-shared": "0.2.2",
|
|
69
|
+
"@pie-players/pie-tts": "0.1.1",
|
|
70
|
+
"@pie-players/tts-client-server": "0.2.1"
|
|
63
71
|
},
|
|
64
72
|
"peerDependencies": {
|
|
65
|
-
"svelte": "^5.
|
|
73
|
+
"svelte": "^5.51.0"
|
|
66
74
|
},
|
|
67
75
|
"devDependencies": {
|
|
68
76
|
"@biomejs/biome": "^2.3.10",
|
package/src/README.md
CHANGED
|
@@ -541,21 +541,35 @@ const player = new AssessmentPlayer({ assessment, loadItem });
|
|
|
541
541
|
// Or use PNPToolResolver directly
|
|
542
542
|
const resolver = new PNPToolResolver();
|
|
543
543
|
const tools = resolver.resolveTools(assessment, currentItemRef);
|
|
544
|
-
// Returns: [{ id: '
|
|
544
|
+
// Returns: [{ id: 'textToSpeech', enabled: true, ... }, ...]
|
|
545
545
|
```
|
|
546
546
|
|
|
547
|
-
**Standard PNP Support IDs:**
|
|
547
|
+
**Standard PNP Support IDs -> toolkit tool IDs (semantic):**
|
|
548
548
|
|
|
549
549
|
```typescript
|
|
550
|
-
'textToSpeech' → '
|
|
551
|
-
'calculator' → '
|
|
552
|
-
'ruler' → '
|
|
553
|
-
'protractor' → '
|
|
554
|
-
'highlighter' → '
|
|
555
|
-
'lineReader' → '
|
|
556
|
-
'magnifier' → '
|
|
557
|
-
'colorContrast' → '
|
|
558
|
-
'answerMasking' → '
|
|
550
|
+
'textToSpeech' → 'textToSpeech'
|
|
551
|
+
'calculator' → 'calculator'
|
|
552
|
+
'ruler' → 'ruler'
|
|
553
|
+
'protractor' → 'protractor'
|
|
554
|
+
'highlighter' → 'highlighter'
|
|
555
|
+
'lineReader' → 'lineReader'
|
|
556
|
+
'magnifier' → 'magnifier'
|
|
557
|
+
'colorContrast' → 'colorScheme'
|
|
558
|
+
'answerMasking' → 'answerEliminator'
|
|
559
|
+
```
|
|
560
|
+
|
|
561
|
+
Toolkit tool IDs resolve to default web component tags through `DEFAULT_TOOL_TAG_MAP`
|
|
562
|
+
and can be overridden via `createDefaultToolRegistry(...)`:
|
|
563
|
+
|
|
564
|
+
```typescript
|
|
565
|
+
import { createDefaultToolRegistry } from '@pie-players/pie-assessment-toolkit';
|
|
566
|
+
|
|
567
|
+
const toolRegistry = createDefaultToolRegistry({
|
|
568
|
+
toolTagMap: {
|
|
569
|
+
calculator: 'my-calculator-tool',
|
|
570
|
+
textToSpeech: 'my-tts-tool'
|
|
571
|
+
}
|
|
572
|
+
});
|
|
559
573
|
```
|
|
560
574
|
|
|
561
575
|
### Context Declarations
|