REFERENCE

Technical reference

Current public contract index. The authorship signatures correspond to P2LRNAuthoringWorkspace; Player and Host Adapter with the current web distribution.

Authoring API

P2LRNAuthoringWorkspace.create(root, options)

Create a workspace. Requires title; supports language, description, and force.

P2LRNAuthoringWorkspace.open(packagePath, root, options)

Open a package as an editable project.

P2LRNAuthoringWorkspace.load(root)

Load an existing workspace.

workspace.summary()

Returns versions, projectId, paths, and counters.

workspace.reload()

Reload the project from disk.

workspace.upgrade()

Updates the workspace to the current editable version.

workspace.setCourseMetadata(options)

Edit course title, description, language and revision.

workspace.setEntityText(key, options)

Edit localized text of an entity.

workspace.setChildren(parentKey, children)

Reorders children and rejects duplicate keys.

workspace.setProgression(key, options|null)

Aplica o elimina progression sobre course, unit o activity.

workspace.addUnit(options)

Add a unit.

workspace.addFile(options)

Add file + activity and return resourceKey/activityKey.

workspace.addUrl(options)

Add a URL as a resource/activity.

workspace.addWebContent(options)

Add a web directory with entrypoint.

workspace.addQuestionnaire(options)

Adds native questionnaire and allows requesting renderer/version.

workspace.addComponent(options)

Add a native component.

workspace.addComposite(options)

Add composite sequence/free with completion all/any.

await workspace.reader(source, options)

Extract a document without mutating the project.

workspace.save()

The current workspace persists.

workspace.build(output, options)

Build the .p2lrn; admite strictProfiles.

Progress

required

boolean

gateFollowing

boolean; invalid in root course.

completionRequirement

viewed | completed | passed.

minScore

0..100; only activity.

unlockWhen

A single block all or any.

See complete progression guide →

Player API

P2LRN.mount(target, options)

Monta o reutiliza <p2lrn-player>.

openPackageURL / openPackageBytes

They open remote packets or entire bytes with verification.

createHostAdapter

Normaliza Host Adapter v1.

createCapabilityBroker / createToolCapabilityProvider / createMcpCapabilityProvider

They negotiate semantic trust services without serializing endpoints/credentials in the course.

createOfflineHostAdapter / createOfflineSyncController

Offline status/outbox and opt-in synchronization.

createMemoryPackageCache / createCacheStoragePackageCache

verified course byte cache; cachePackageURL and openCachedPackage complete the flow.

createActivityTracker

Tiempo activo/idle.

createLearningEvent / createLearningEventStream / observeLearningEvents

Ordered and categorized projection of the runtime.

createMemoryResourceLibrary / createCacheStorageResourceLibrary

content-addressed resource library; connects with createResourceLibraryResolver.

createMemoryCollaborationHub / createHttpCollaborationProvider

Reference/local and HTTP implementations of the contract collaboration.room.

configureRuntimeHost / installServiceWorker

They configure runtime host and static resource bridge.

Resource library and cache

resource.library exposes only metadata search/describe/has. The bytes are resolved by digest using a verified resolver. The package cache is independent and retains complete courses after validating them.

ESM / Web SDK
const resources = P2LRN.createCacheStorageResourceLibrary();
const resolver = P2LRN.createResourceLibraryResolver({store: resources});
const cache = P2LRN.createCacheStoragePackageCache();

player.resourceResolver = resolver;
player.packageCache = cache;

Web component

src

Package URL.

node

Entidad inicial opcional.

renderer

Explicit renderer.

runtime-base-url

Optional URL of a managed runtime. SCORM and H5P have automatic isolation if a valid external source is not provided.

player.adapter

Host Adapter o null.

player.runtimeBaseUrl

Propiedad equivalente a runtime-base-url.

await player.reload()

Reload the current package.

Host Adapter v1

loadState(context)

Load the resume snapshot. Returns compatible object or null.

saveState(state, context)

Saves the current snapshot of activity or progression.

reportScore(score, context)

It receives a common score when the runtime can produce it.

emitEvent(event, context)

Receive the canonical envelope runtime-event/1; calls are serialized in order by Adapter.

resolveResourceUrl(request, context)

Returns {url, verified:true, seekable?} o null.

Complete guide to metrics and analytics →

Events

Current public families: p2lrn:ready, p2lrn:activityready, p2lrn:rendered, p2lrn:answer, p2lrn:progress, p2lrn:statechange, p2lrn:timeupdate, p2lrn:timeout, p2lrn:score, p2lrn:complete, p2lrn:progressionchange, p2lrn:xapi, p2lrn:navigation and p2lrn:error. Not all renderers output all families.

Event reference → · Metric extraction →

Toolkit Host

@p2lrn/toolkit/host exports createReferenceAuthoritativeHost(), createMemoryAuthoritativeHostStore() and createJsonFileAuthoritativeHostStore(). The reference requires the server to produce a decision authoritative:true before storing an official note and can deduplicate offline deliveries using offlineDeliveryId.

Studio Web Component

<p2lrn-studio> exposes creation/opening, authoring, preview, export, resource library and offline delivery. Rights fields: author, createdAt, license, copyrightHolder. APIs conectadas: resourceLibrary, materializeSharedResource(), exportOfflineAssignment() and reviewOfflineResult().

@p2lrn/toolkit CLI

p2lrnp2lrn-validatep2lrn-readerp2lrn-document-readerp2lrn-createp2lrn-convertp2lrn-repackp2lrn-multipartp2lrn-inspectp2lrn-extract-sourcep2lrn-deltap2lrn-trust

Creator

Comandos reales
p2lrn-create init|open|upgrade|add-unit|add-file|add-web-content|add-questionnaire|add-component|add-composite|add-url|build|convert|component-catalog|validate-component-authoring|show

Delta

Terminal
p2lrn-delta create <base> <target> <output>
p2lrn-delta apply <base> <delta> <output>
p2lrn-delta inspect <delta>

Trust / Ed25519

Terminal
p2lrn-trust keygen private.pem public.pem
p2lrn-trust sign course.p2lrn private.pem
p2lrn-trust verify course.p2lrn course.p2lrn.sig --trust-key public.pem --require-trusted
p2lrn-trust inspect course.p2lrn.sig
Integrity and trust are different concepts.

SHA-256 detects changes. The Ed25519 signature verifies that the content was signed by a key; --require-trusted It also requires that that key be in the supplied set.

Multipart

These commands summarize the Multipart operation. For the complete tour, including publication and reconstruction, consult the specific guide.

Terminal
p2lrn-multipart <source.p2lrn> <output.p2lrn> [--representation <id>] [--part-size <bytes>]

Default part: 25 MiB. Minimum supported by the implementation: 1 MiB.

CDN routes

Related documentation