@handofclient/embed-js 0.0.0-stage → 0.1.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,36 @@
1
+ /**
2
+ * Wire types for the postMessage embed protocol - see docs/postmessage-protocol.md (task C1) for the
3
+ * normative spec. Shared verbatim between the host-side and plugin-side halves of this package so both
4
+ * sides can never drift on envelope/message shape.
5
+ */
6
+ export const PROTOCOL_VERSION = 1;
7
+ export const MessageType = {
8
+ Hello: "hoc:hello",
9
+ Init: "hoc:init",
10
+ Ready: "hoc:ready",
11
+ Error: "hoc:error",
12
+ Resize: "hoc:resize",
13
+ Navigate: "hoc:navigate",
14
+ TokenRefresh: "hoc:token-refresh",
15
+ ContextChanged: "hoc:context-changed",
16
+ Telemetry: "hoc:telemetry",
17
+ Ui: "hoc:ui",
18
+ };
19
+ export function isEnvelope(data) {
20
+ if (typeof data !== "object" || data === null)
21
+ return false;
22
+ const candidate = data;
23
+ return (candidate.v === PROTOCOL_VERSION &&
24
+ typeof candidate.type === "string" &&
25
+ typeof candidate.msgId === "string" &&
26
+ typeof candidate.payload === "object" &&
27
+ candidate.payload !== null);
28
+ }
29
+ export function makeMsgId() {
30
+ return crypto.randomUUID();
31
+ }
32
+ export function makeEnvelope(type, payload, replyTo) {
33
+ return replyTo === undefined
34
+ ? { v: PROTOCOL_VERSION, type, msgId: makeMsgId(), payload }
35
+ : { v: PROTOCOL_VERSION, type, msgId: makeMsgId(), replyTo, payload };
36
+ }
package/package.json CHANGED
@@ -1,6 +1,39 @@
1
1
  {
2
2
  "name": "@handofclient/embed-js",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "https://github.com/PanglossTechnologies/HandOfClientSDK.git",
7
+ "directory": "sdk/embed-js"
8
+ },
9
+ "publishConfig": {
10
+ "access": "public"
11
+ },
12
+ "description": "HandOfClient postMessage embed protocol SDK (task C1 spec at docs/postmessage-protocol.md): host-side embed.js (drop-in <script> or npm import) plus the plugin-side SDK a plugin author imports inside their own bundle.",
13
+ "license": "Apache-2.0",
14
+ "type": "module",
15
+ "exports": {
16
+ "./host": {
17
+ "types": "./dist/host/index.d.ts",
18
+ "import": "./dist/host/index.js"
19
+ },
20
+ "./plugin": {
21
+ "types": "./dist/plugin/index.d.ts",
22
+ "import": "./dist/plugin/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist"
27
+ ],
28
+ "scripts": {
29
+ "build": "tsc -p tsconfig.json && node build.mjs",
30
+ "typecheck": "tsc -p tsconfig.json --noEmit"
31
+ },
32
+ "dependencies": {
33
+ "@handofclient/api": "^0.1.0"
34
+ },
35
+ "devDependencies": {
36
+ "esbuild": "^0.28.2",
37
+ "typescript": "^5.9.3"
38
+ }
39
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.