@pie-players/pie-assessment-toolkit 0.3.75 → 1.0.0-beta.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 +449 -541
- package/custom-elements.json +1315 -0
- package/dist/attempt/TestSession.d.ts +0 -1
- package/dist/attempt/TestSession.js +10 -5
- package/dist/components/ItemScope.custom-element.js +1 -1
- package/dist/components/ItemToolBar.custom-element.js +1 -1
- package/dist/components/PieAssessmentToolkit.custom-element.js +8 -8
- package/dist/components/SectionToolBar.custom-element.js +1 -1
- package/dist/components/chunks/{ItemToolBar-7tt7v2xp.js → ItemToolBar-3zrc4p3d.js} +4 -4
- package/dist/components/chunks/{ItemToolBar-jx38w99s.js → ItemToolBar-66hcwmfw.js} +2 -2
- package/dist/components/chunks/ItemToolBar-9gqhfxtn.js +40 -0
- package/dist/components/chunks/ItemToolBar-hzc5wyjp.js +2 -0
- package/dist/components/chunks/{ItemToolBar-97hx60z4.js → ItemToolBar-kkj69ptr.js} +1 -1
- package/dist/components/chunks/sre-engine-bj997w4b.js +1 -0
- package/dist/context/assessment-toolkit-context.d.ts +6 -0
- package/dist/index.d.ts +7 -7
- package/dist/index.js +4 -10
- package/dist/policy/core/PolicySource.d.ts +1 -1
- package/dist/policy/core/ToolPolicyEngine.d.ts +46 -7
- package/dist/policy/core/ToolPolicyEngine.js +73 -16
- package/dist/policy/core/compose-decision.d.ts +3 -3
- package/dist/policy/core/compose-decision.js +30 -30
- package/dist/policy/core/decision-types.d.ts +44 -32
- package/dist/policy/core/feature-decision.d.ts +17 -15
- package/dist/policy/core/feature-decision.js +11 -13
- package/dist/policy/core/pnp-policy-inputs.d.ts +5 -2
- package/dist/policy/core/pnp-policy-inputs.js +12 -32
- package/dist/policy/core/provenance.d.ts +1 -1
- package/dist/policy/core/tool-parameters.d.ts +11 -0
- package/dist/policy/core/tool-parameters.js +15 -0
- package/dist/policy/engine.d.ts +1 -1
- package/dist/policy/sources/PnpPolicySource.d.ts +14 -22
- package/dist/policy/sources/PnpPolicySource.js +30 -28
- package/dist/runtime/SectionControllerBinding.d.ts +6 -2
- package/dist/runtime/SectionControllerBinding.js +21 -15
- package/dist/runtime/adapter/subscriber-fanout.d.ts +0 -1
- package/dist/runtime/adapter/subscriber-fanout.js +1 -4
- package/dist/runtime/composition-emit-scheduler.d.ts +3 -3
- package/dist/runtime/composition-emit-scheduler.js +1 -1
- package/dist/runtime/content-region.d.ts +0 -4
- package/dist/runtime/content-region.js +2 -2
- package/dist/runtime/core/SectionEngineCore.d.ts +0 -2
- package/dist/runtime/core/SectionEngineCore.js +0 -4
- package/dist/runtime/core/cohort.d.ts +0 -5
- package/dist/runtime/core/cohort.js +0 -9
- package/dist/runtime/core/engine-output.d.ts +3 -2
- package/dist/runtime/core/engine-transition.js +3 -2
- package/dist/runtime/registration-events.d.ts +11 -14
- package/dist/runtime/runtime-id.d.ts +1 -1
- package/dist/runtime/runtime-id.js +1 -1
- package/dist/runtime/shell-scope.d.ts +4 -4
- package/dist/runtime/shell-scope.js +15 -9
- package/dist/runtime/tool-host-contract.d.ts +0 -4
- package/dist/runtime/tool-host-contract.js +1 -1
- package/dist/services/AccessibilityCatalogResolver.d.ts +21 -31
- package/dist/services/AccessibilityCatalogResolver.js +29 -42
- package/dist/services/ElementToolStateStore.d.ts +32 -61
- package/dist/services/ElementToolStateStore.js +37 -67
- package/dist/services/HighlightCoordinator.d.ts +9 -21
- package/dist/services/HighlightCoordinator.js +52 -80
- package/dist/services/RangeSerializer.d.ts +4 -35
- package/dist/services/RangeSerializer.js +4 -48
- package/dist/services/SSMLExtractor.d.ts +8 -31
- package/dist/services/SSMLExtractor.js +18 -40
- package/dist/services/TTSService.d.ts +49 -56
- package/dist/services/TTSService.js +308 -283
- package/dist/services/ToolCoordinator.d.ts +6 -49
- package/dist/services/ToolCoordinator.js +25 -61
- package/dist/services/ToolRegistry.d.ts +82 -80
- package/dist/services/ToolRegistry.js +91 -67
- package/dist/services/ToolkitCoordinator.d.ts +83 -81
- package/dist/services/ToolkitCoordinator.js +186 -174
- package/dist/services/framework-error.d.ts +30 -7
- package/dist/services/framework-error.js +10 -13
- package/dist/services/interfaces.d.ts +47 -71
- package/dist/services/section-controller-types.d.ts +7 -7
- package/dist/services/section-session-assignment.js +6 -8
- package/dist/services/spoken-audio-cards.d.ts +2 -4
- package/dist/services/spoken-audio-cards.js +2 -4
- package/dist/services/tool-config-validation.d.ts +5 -7
- package/dist/services/tool-config-validation.js +11 -26
- package/dist/services/tool-context.d.ts +7 -23
- package/dist/services/tool-context.js +99 -53
- package/dist/services/tool-failure.d.ts +30 -0
- package/dist/services/tool-failure.js +11 -0
- package/dist/services/tool-icons.d.ts +1 -2
- package/dist/services/tool-icons.js +2 -2
- package/dist/services/tool-instance-id.d.ts +8 -6
- package/dist/services/tool-instance-id.js +12 -18
- package/dist/services/tool-providers/TTSToolProvider.d.ts +6 -43
- package/dist/services/tool-providers/TTSToolProvider.js +7 -63
- package/dist/services/tool-providers/ToolProviderApi.d.ts +0 -7
- package/dist/services/tool-providers/ToolProviderRegistry.d.ts +7 -42
- package/dist/services/tool-providers/ToolProviderRegistry.js +21 -63
- package/dist/services/tool-request.d.ts +4 -0
- package/dist/services/tool-request.js +7 -2
- package/dist/services/toolbar-decided-tools.d.ts +1 -0
- package/dist/services/toolbar-decided-tools.js +1 -0
- package/dist/services/toolbar-items.js +2 -5
- package/dist/services/tools-config-normalizer.d.ts +18 -9
- package/dist/services/tools-config-normalizer.js +25 -19
- package/dist/services/tts/browser-provider.d.ts +2 -5
- package/dist/services/tts/browser-provider.js +4 -20
- package/dist/services/tts/catalog-span-alignment.js +14 -7
- package/dist/services/tts/flat-tree.d.ts +0 -7
- package/dist/services/tts/flat-tree.js +2 -2
- package/dist/services/tts/generated-speech/dom/to-chunk-inputs.d.ts +2 -2
- package/dist/services/tts/generated-speech/index.d.ts +1 -1
- package/dist/services/tts/generated-speech/index.js +1 -1
- package/dist/services/tts/generated-speech/types.d.ts +1 -1
- package/dist/services/tts/generated-speech/types.js +1 -1
- package/dist/services/tts/highlight-pipeline/create-highlight-plan.js +10 -12
- package/dist/services/tts/highlight-target-resolver.d.ts +12 -0
- package/dist/services/tts/math-aware-text-processing.js +10 -29
- package/dist/services/tts/math-speech.d.ts +1 -1
- package/dist/services/tts/math-speech.js +3 -0
- package/dist/services/tts/mathml-sanitization.d.ts +7 -0
- package/dist/services/tts/mathml-sanitization.js +9 -1
- package/dist/services/tts/provider-options.d.ts +12 -1
- package/dist/services/tts/ssml/spoken-text.js +1 -1
- package/dist/services/tts/start-failure.d.ts +0 -7
- package/dist/services/tts/start-failure.js +1 -1
- package/dist/services/tts/text-segmentation.d.ts +5 -0
- package/dist/services/tts/text-segmentation.js +13 -10
- package/dist/services/tts-runtime-config.d.ts +32 -12
- package/dist/services/tts-runtime-config.js +14 -20
- package/dist/tools/content-capability-resolution.d.ts +2 -2
- package/dist/tools/registration.d.ts +6 -5
- package/dist/tools/registration.js +10 -9
- package/dist/tools/registrations/toolbar-registration-helpers.d.ts +6 -0
- package/dist/tools/registrations/toolbar-registration-helpers.js +6 -0
- package/dist/tools/tool-surface-host.js +1 -8
- package/package.json +8 -6
- package/dist/components/chunks/ItemToolBar-bxwyhr5p.js +0 -2
- package/dist/components/chunks/ItemToolBar-rd2bb4p6.js +0 -40
- package/dist/components/chunks/sre-engine-jd8cc08x.js +0 -1
- package/dist/services/ContextVariableStore.d.ts +0 -113
- package/dist/services/ContextVariableStore.js +0 -206
- package/dist/services/tts-control-events.d.ts +0 -13
- package/dist/services/tts-control-events.js +0 -7
- package/dist/utils/logger.d.ts +0 -6
- package/dist/utils/logger.js +0 -10
|
@@ -2,6 +2,15 @@ const TEST_ATTEMPT_SESSION_VERSION = 1;
|
|
|
2
2
|
function nowIso() {
|
|
3
3
|
return new Date().toISOString();
|
|
4
4
|
}
|
|
5
|
+
/** A PIE session id other than the one recorded starts another attempt. */
|
|
6
|
+
function nextAttemptCount(existing, pieSessionId) {
|
|
7
|
+
if (!existing)
|
|
8
|
+
return 1;
|
|
9
|
+
if (existing.pieSessionId && existing.pieSessionId !== pieSessionId) {
|
|
10
|
+
return existing.attemptCount + 1;
|
|
11
|
+
}
|
|
12
|
+
return existing.attemptCount;
|
|
13
|
+
}
|
|
5
14
|
export function createNewTestAttemptSession(args) {
|
|
6
15
|
const startedAt = nowIso();
|
|
7
16
|
return {
|
|
@@ -50,11 +59,7 @@ export function upsertItemSessionFromPieSessionChange(session, args) {
|
|
|
50
59
|
return session;
|
|
51
60
|
const now = nowIso();
|
|
52
61
|
const existing = session.itemSessions[itemIdentifier];
|
|
53
|
-
const attemptCount = existing
|
|
54
|
-
? existing.attemptCount + 1
|
|
55
|
-
: existing
|
|
56
|
-
? existing.attemptCount
|
|
57
|
-
: 1;
|
|
62
|
+
const attemptCount = nextAttemptCount(existing, pieSessionId);
|
|
58
63
|
const completed = !!(isCompleted ?? existing?.isCompleted);
|
|
59
64
|
const next = {
|
|
60
65
|
itemIdentifier,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as b,b as m,c as y,d as v,e as D,f as $,k as T}from"./chunks/ItemToolBar-vdkyn9f3.js";import{$ as YJ,A as e,D as JJ,F as QJ,G as I,I as H,M as ZJ,O as XJ,U as qJ,V as WJ,aa as L,ba as UJ,ea as d,fa as o,ga as C,ja as _,ka as g,la as MJ,ma as u,v as n,w as a,x as i,y as k,z as t}from"./chunks/ItemToolBar-3zrc4p3d.js";import"./chunks/ItemToolBar-kkj69ptr.js";import{commitPendingSessions as zJ,createPieLogger as KJ,normalizeItemSessionChange as xJ}from"@pie-players/pie-players-shared";function OJ(Q){let J=Q&&typeof Q==="object"?{...Q}:Q;if(J&&typeof J==="object")delete J.timestamp,delete J.sourceRuntimeId;try{return JSON.stringify(J)}catch{return String(J)}}var wJ=(Q)=>Boolean(Q&&typeof Q==="object"&&Q.sessionCommitReason);function h(Q){let{host:J,kind:Z,identity:W,mode:j,send:Y}=Q,U=KJ(J.localName||"pie-shell",()=>!1),z="",x=(B)=>{let{itemId:M,canonicalItemId:K}=W();if(!M)return;Y(y,{itemId:M,session:B});let X=xJ({itemId:M,sessionDetail:B});if(X.intent==="metadata-only"||!X.session)return;let q={itemId:M,canonicalItemId:K||M,session:X.session,...X.sessionCommitReason?{sessionCommitReason:X.sessionCommitReason}:{}};C(J,v,q)},O=(B)=>{if(j()!=="section")return;if(B.stopPropagation(),Z!=="item")return;let M=B.detail,K=OJ(M);if(!wJ(M)&&K===z)return;z=K,x(M)},w=(B)=>{if(j()==="section")B.stopPropagation();let{itemId:M,canonicalItemId:K,contentKind:G}=W();if(!M)return;let X={itemId:M,canonicalItemId:K||M,contentKind:G,detail:B.detail};Y(D,X)},A=(B)=>{if(j()==="section")B.stopPropagation();let{itemId:M,canonicalItemId:K,contentKind:G}=W();if(!M)return;let X={itemId:M,canonicalItemId:K||M,contentKind:G,error:B.detail};Y($,X)};return J.addEventListener("session-changed",O),J.addEventListener("load-complete",w),J.addEventListener("player-error",A),{disconnect:()=>{try{if(Z==="item"&&j()==="section")zJ(J,{reason:"teardown",logger:U})}finally{J.removeEventListener("session-changed",O),J.removeEventListener("load-complete",w),J.removeEventListener("player-error",A)}}}}import{ContextProvider as GJ}from"@pie-players/pie-context";function AJ(Q,J){return Q.kind===J.kind&&Q.host===J.host&&Q.itemId===J.itemId&&Q.canonicalItemId===J.canonicalItemId&&Q.contentKind===J.contentKind&&u(Q.settings,J.settings)}function p(Q){return T(Q.item,Q.kind)}function E(Q,J){return Q.isConnected||!J?Q:J.eventTarget}function N(Q,J,Z){let W={kind:J.kind,itemId:J.itemId,canonicalItemId:J.canonicalItemId,contentKind:J.contentKind,item:J.item,...J.settings?{settings:J.settings}:{},element:J.host,...Z?{runtimeId:Z.runtimeId}:{}};C(E(J.host,Z),Q,W)}function c(){let Q=null,J=null,Z;function W(){let Y=Q;if(!Y)return;let U=Z;Q=null,J=null,Z=void 0,N(m,Y,U)}function j(Y,U){if(!Y){W();return}if(Q&&Z?.runtimeId!==U?.runtimeId)W();if(Q&&AJ(Q,Y)){if(Q.item===Y.item)return;let z=p(Y);if(z!==null&&z===J){Q=Y;return}Q=Y,J=z,N(b,Y,U);return}Q=Y,J=p(Y),Z=U,N(b,Y,U)}return{sync:j,retire:W}}var fJ=50;function l(Q,J,Z){let W=new GJ(Q,{context:J,initialValue:Z});return W.connect(),{provider:W,value:Z}}function r(Q,J,Z){if(Z(Q.value,J))return;Q.value=J,Q.provider.setValue(J)}var kJ=(Q,J,Z)=>{if(Q===J)return!0;if(!Q||!J)return!1;if(Q.id!==J.id)return!1;let W=T(Q,Z);return W!==null&&W===T(J,Z)},LJ=(Q,J)=>Q.kind===J.kind&&Q.itemId===J.itemId&&Q.canonicalItemId===J.canonicalItemId&&Q.contentKind===J.contentKind&&Q.regionPolicy===J.regionPolicy&&Q.scopeElement===J.scopeElement&&kJ(Q.item,J.item,Q.kind),FJ=(Q,J)=>Q.scopeElement===J.scopeElement&&Q.ttsHighlightTargetResolver===J.ttsHighlightTargetResolver,S=(Q,J,Z)=>{if(Q.getAttribute(J)!==Z)Q.setAttribute(J,Z)};function s(){let Q=c(),J=Date.now(),Z=null,W=null,j=null,Y=null,U=null,z=null,x=[],O=null,w=()=>{if(U!==null)Q.sync(z,U)},A=(X,q)=>X.isConnected&&q.eventTarget.isConnected===!1;function B(X,q){if(X===D)O=q;if(Z&&U!==null&&!A(Z,U)){C(E(Z,U),X,{...q,runtimeId:U.runtimeId});return}if(x.push({type:X,detail:q}),x.length>fJ)x.shift()}function M(X){let q=U!==null&&X.runtimeId!==U.runtimeId;if(X.runtimeId!==U?.runtimeId)U={runtimeId:X.runtimeId,eventTarget:X.eventTarget},w();let F=x;x=[];for(let f of F)B(f.type,f.detail);let V=F.some((f)=>f.type===D);if(q&&O&&!V)B(D,O)}function K(){for(let X of[W,j])X?.provider.disconnect();Y?.(),Y=null,U=null,x=[],O=null,z=null,W=null,j=null,Z=null}function G(X){if(!X){Q.sync(null),K();return}if(X.host!==Z)K();Z=X.host;let q=X.canonicalItemId||X.itemId,F=X.regionPolicy||"default",V=X.scopeElement||X.host,f={kind:X.kind,itemId:X.itemId,canonicalItemId:q,contentKind:X.contentKind,regionPolicy:F,scopeElement:V,item:X.item??null,contextVersion:J};if(W)r(W,f,LJ);else W=l(Z,d,f);let R={scopeElement:V,ttsHighlightTargetResolver:X.ttsHighlightTargetResolver??null};if(j)r(j,R,FJ);else j=l(Z,o,R);S(Z,"data-item-id",X.itemId),S(Z,"data-canonical-item-id",q),S(Z,"data-pie-shell-root",X.kind),S(Z,"data-region-policy",F);let P=z;if(z=X.itemId?{kind:X.kind,host:Z,itemId:X.itemId,canonicalItemId:q,contentKind:X.contentKind,item:X.item??null,settings:X.settings??null}:null,P&&(P.itemId!==z?.itemId||P.canonicalItemId!==z?.canonicalItemId))O=null;Y??=_(Z,M),w()}return{publish:G,retire:Q.retire,disconnect:K,send:B}}var VJ=(Q,J)=>{if(customElements.get(Q))return;try{customElements.define(Q,J)}catch(Z){if(!(Z instanceof DOMException&&Z.name==="NotSupportedError"||Z&&typeof Z==="object"&&Z.name==="NotSupportedError")||!customElements.get(Q))throw Z}},HJ=ZJ('<div class="pie-item-scope-anchor svelte-980v5l" aria-hidden="true"></div> <!>',1),CJ={hash:"svelte-980v5l",code:".pie-item-scope-anchor.svelte-980v5l {display:none;}"};function BJ(Q,J){n(J,!0),WJ(Q,CJ);let Z=L(J,"itemId",7,""),W=L(J,"canonicalItemId",7,""),j=L(J,"contentKind",7,"assessment-item"),Y=L(J,"regionPolicy",7,"default"),U=L(J,"scopeElement",7,null),z=L(J,"ttsHighlightTargetResolver",7,null),x=L(J,"item",7,null),O=L(J,"settings",7,null),w=t(null),A=i(()=>{let q=H(w)?.getRootNode();return q instanceof ShadowRoot?q.host:null}),B=s();I(()=>{if(!H(A))return;let q=H(A),F=!1,V=!1,f=_(q,(jJ)=>{V=!0,F=jJ.sectionBound===!0}),R=setTimeout(()=>{if(V||!q.isConnected)return;MJ(q.ownerDocument,"itemScopeWithoutToolkit",`[pie-item-scope] No <pie-assessment-toolkit> has answered item "${Z()}" after ${g/1000} s, so the item is not registered and the tools inside the scope have no runtime. Place the scope inside the toolkit element; it keeps waiting for one. Reported once per page.`)},g),P=h({host:q,kind:"item",identity:()=>({itemId:Z(),canonicalItemId:W(),contentKind:j()}),mode:()=>F?"section":"plain",send:B.send});return()=>{clearTimeout(R);try{P.disconnect()}finally{f(),B.retire(),B.disconnect()}}}),I(()=>{B.publish(H(A)?{host:H(A),kind:"item",itemId:Z(),canonicalItemId:W(),contentKind:j(),regionPolicy:Y(),scopeElement:U(),ttsHighlightTargetResolver:z(),item:x(),settings:O()}:null)});var M={get itemId(){return Z()},set itemId(q){Z(q),k()},get canonicalItemId(){return W()},set canonicalItemId(q){W(q),k()},get contentKind(){return j()},set contentKind(q){j(q),k()},get regionPolicy(){return Y()},set regionPolicy(q){Y(q),k()},get scopeElement(){return U()},set scopeElement(q){U(q),k()},get ttsHighlightTargetResolver(){return z()},set ttsHighlightTargetResolver(q){z(q),k()},get item(){return x()},set item(q){x(q),k()},get settings(){return O()},set settings(q){O(q),k()}},K=HJ(),G=JJ(K);YJ(G,(q)=>e(w,q),()=>H(w));var X=QJ(G,2);return qJ(X,J,"default",{},null),XJ(Q,K),a(M)}VJ("pie-item-scope",UJ(BJ,{itemId:{attribute:"item-id",type:"String"},canonicalItemId:{attribute:"canonical-item-id",type:"String"},contentKind:{attribute:"content-kind",type:"String"},regionPolicy:{attribute:"region-policy",type:"String"},scopeElement:{type:"Object"},ttsHighlightTargetResolver:{type:"Object"},item:{type:"Object"},settings:{type:"Object"}},["default"],[],{mode:"open"}));export{BJ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as a}from"./chunks/ItemToolBar-
|
|
1
|
+
import{l as a}from"./chunks/ItemToolBar-9gqhfxtn.js";import"./chunks/ItemToolBar-hzc5wyjp.js";import"./chunks/ItemToolBar-3zrc4p3d.js";import"./chunks/ItemToolBar-kkj69ptr.js";export{a as default};
|