@holostaff/sdk 0.3.0 → 0.4.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 +27 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/observations.d.ts +53 -0
- package/dist/observations.d.ts.map +1 -0
- package/dist/observations.js +143 -0
- package/dist/observations.js.map +1 -0
- package/dist/transport.d.ts +4 -4
- package/dist/transport.js +4 -4
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# @holostaff/sdk
|
|
2
2
|
|
|
3
|
-
Lifetime identity, stage detection,
|
|
3
|
+
Lifetime identity, stage detection, custom signal probes, and the
|
|
4
|
+
intervention widget for the Holostaff runtime.
|
|
4
5
|
|
|
5
6
|
## Install
|
|
6
7
|
|
|
@@ -19,8 +20,8 @@ holostaff.init({
|
|
|
19
20
|
tenantId: 'your-tenant-id',
|
|
20
21
|
})
|
|
21
22
|
|
|
22
|
-
// At
|
|
23
|
-
holostaff.markStageEntry('
|
|
23
|
+
// At journey-stage boundaries (placed by the deploy PR's agent).
|
|
24
|
+
holostaff.markStageEntry('adoption')
|
|
24
25
|
|
|
25
26
|
// On sign-in completion.
|
|
26
27
|
holostaff.identify(user.id)
|
|
@@ -30,25 +31,39 @@ holostaff.clearIdentity()
|
|
|
30
31
|
|
|
31
32
|
// On host-app events the scan detected as worth observing.
|
|
32
33
|
holostaff.emitSignal('first_resource_created', { kind: 'project' })
|
|
34
|
+
|
|
35
|
+
// Only needed if you render interventions yourself — the built-in
|
|
36
|
+
// widget reports outcomes automatically.
|
|
37
|
+
holostaff.reportOutcome(interventionId, 'engaged')
|
|
33
38
|
```
|
|
34
39
|
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
Calls made before `init()` queue and replay once it runs, so import
|
|
41
|
+
order is not load-bearing. All methods are fail-soft — they never throw
|
|
42
|
+
into your code. Errors route to the optional `onError` callback you
|
|
43
|
+
pass to `init()`.
|
|
37
44
|
|
|
38
45
|
## What this SDK does (and doesn't)
|
|
39
46
|
|
|
40
47
|
**Does**
|
|
41
48
|
- Mint and persist a lifetime device id (localStorage + first-party cookie).
|
|
42
49
|
- Open / close a session bound to page lifecycle.
|
|
43
|
-
- POST identity / stage / signal / outcome events to the
|
|
44
|
-
-
|
|
50
|
+
- POST identity / stage / signal / outcome events to the Holostaff runtime.
|
|
51
|
+
- Track the current SPA route and last-user-activity time, and forward
|
|
52
|
+
them to the runtime on route changes plus a low-frequency heartbeat.
|
|
53
|
+
- **Record the session with rrweb** (DOM, canvas at ~2 fps, media playback
|
|
54
|
+
state, inlined images/fonts) and batch it to the runtime, where the
|
|
55
|
+
vision pipeline watches the session and decides when the copilot should
|
|
56
|
+
step in. Password / email / tel inputs are always masked; mark rendered
|
|
57
|
+
PII with the `holostaff-mask` (text) or `holostaff-block` (region) CSS
|
|
58
|
+
classes; opt out entirely with `init({ observe: { enabled: false } })`.
|
|
59
|
+
- Hold a server-sent-events channel open and render `text` interventions
|
|
60
|
+
as a shadow-DOM pill (dismiss / engage / 30s auto-ignore), reporting
|
|
61
|
+
outcomes back automatically.
|
|
45
62
|
|
|
46
63
|
**Does not (yet)**
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
- Manage idle-pause cadence — runtime-side concern.
|
|
64
|
+
- Render non-text modalities (voice / email / sms / phone /
|
|
65
|
+
screen automation) — those events are surfaced to `onError` and skipped.
|
|
50
66
|
|
|
51
67
|
## References
|
|
52
68
|
|
|
53
|
-
- [
|
|
54
|
-
- [copilot-deploy-design.md](../documents/copilot-deploy-design.md) — how the deploy PR wires `holostaff.init(...)` + the instrumentation calls into customer code.
|
|
69
|
+
- [docs.holostaff.ai](https://docs.holostaff.ai)
|
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,6 @@ export interface HolostaffApi {
|
|
|
36
36
|
_destroy(): void;
|
|
37
37
|
}
|
|
38
38
|
export declare const holostaff: HolostaffApi;
|
|
39
|
-
export type { BowtieStage, InitOptions, InterventionOutcome } from './types.js';
|
|
39
|
+
export type { BowtieStage, InitOptions, InterventionOutcome, ObserveOptions } from './types.js';
|
|
40
40
|
export { BOWTIE_STAGES } from './types.js';
|
|
41
41
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAaH,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAmDxG,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,CAAA;IAC7B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;IAClC,aAAa,IAAI,IAAI,CAAA;IACrB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAA;IACxC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IACjE;;;;;;OAMG;IACH,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAA;IACzE,kCAAkC;IAClC,QAAQ,IAAI,IAAI,CAAA;CACjB;AAED,eAAO,MAAM,SAAS,EAAE,YA4LvB,CAAA;AAED,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import { getOrMintDeviceId, getHostUserId, setHostUserId, clearHostUserId, } fro
|
|
|
21
21
|
import { resolveTransportConfig, postJson, postBeacon, openCommandStream } from './transport.js';
|
|
22
22
|
import { mintSessionId, bindUnload } from './session.js';
|
|
23
23
|
import { startSignals } from './signals.js';
|
|
24
|
+
import { startObservations } from './observations.js';
|
|
24
25
|
import { startWidget } from './widget.js';
|
|
25
26
|
import { BOWTIE_STAGES } from './types.js';
|
|
26
27
|
let state = null;
|
|
@@ -81,6 +82,16 @@ export const holostaff = {
|
|
|
81
82
|
sourceId: opts.sourceId,
|
|
82
83
|
buildBody: () => commonBody(nextState),
|
|
83
84
|
});
|
|
85
|
+
// Vision-reconciliation wave — rrweb capture batched to
|
|
86
|
+
// /observations; the server replays in Browserbase and the Gemini
|
|
87
|
+
// perceive+decide tick runs on what it sees. On by default.
|
|
88
|
+
nextState.observeOpts = opts.observe;
|
|
89
|
+
nextState.observations = startObservations({
|
|
90
|
+
cfg: transport,
|
|
91
|
+
sessionId,
|
|
92
|
+
buildBody: () => commonBody(nextState),
|
|
93
|
+
observe: opts.observe,
|
|
94
|
+
});
|
|
84
95
|
// Wave 3e — widget subscribes to the SSE channel and renders the
|
|
85
96
|
// text pill on `fire_intervention` events. Outcomes flow back to
|
|
86
97
|
// /outcome.
|
|
@@ -149,6 +160,16 @@ export const holostaff = {
|
|
|
149
160
|
sourceId: s.sourceId,
|
|
150
161
|
buildBody: () => commonBody(s),
|
|
151
162
|
});
|
|
163
|
+
// Restart capture too — stopping and re-recording forces a fresh
|
|
164
|
+
// full DOM snapshot, which the new session's replay needs to
|
|
165
|
+
// bootstrap from.
|
|
166
|
+
s.observations?.dispose();
|
|
167
|
+
s.observations = startObservations({
|
|
168
|
+
cfg: s.transport,
|
|
169
|
+
sessionId: s.sessionId,
|
|
170
|
+
buildBody: () => commonBody(s),
|
|
171
|
+
observe: s.observeOpts,
|
|
172
|
+
});
|
|
152
173
|
// Wave 3e — same for the SSE channel + widget. The old session is
|
|
153
174
|
// closed; reopen against the new id so future fire_intervention
|
|
154
175
|
// events reach the correct stream.
|
|
@@ -199,6 +220,7 @@ export const holostaff = {
|
|
|
199
220
|
return;
|
|
200
221
|
state.unload?.dispose();
|
|
201
222
|
state.signals?.dispose();
|
|
223
|
+
state.observations?.dispose();
|
|
202
224
|
state.widget?.dispose();
|
|
203
225
|
state.commands?.close();
|
|
204
226
|
state = null;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,eAAe,GAChB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAA;AACtH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAsB,MAAM,cAAc,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAuB,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,WAAW,EAAsB,MAAM,aAAa,CAAA;AAC7D,OAAO,EAAE,aAAa,EAAgE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,eAAe,GAChB,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,sBAAsB,EAAE,QAAQ,EAAE,UAAU,EAAE,iBAAiB,EAAwB,MAAM,gBAAgB,CAAA;AACtH,OAAO,EAAE,aAAa,EAAE,UAAU,EAAsB,MAAM,cAAc,CAAA;AAC5E,OA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AI,EAAE;gBACtB,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;aAC7B,CAAC,CAAC,CAAA;QACL,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,aAAa,CAAC,cAAc,EAAE,OAAO;QACnC,IAAI,CAAC,cAAc,IAAI,CAAC,OAAO;YAAE,OAAM;QACvC,SAAS,CAAC,CAAC,CAAC,EAAE;YACZ,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAAC,SAAS,UAAU,EAAE,UAAU,CAAC,CAAC,EAAE;gBACvF,cAAc;gBACd,OAAO;aACR,CAAC,CAAC,CAAA;QACL,CAAC,CAAC,CAAA;IACJ,CAAC;IAED,QAAQ;QACN,IAAI,CAAC,KAAK;YAAE,OAAM;QAClB,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,CAAA;QACvB,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CAAA;QACxB,KAAK,CAAC,YAAY,EAAE,OAAO,EAAE,CAAA;QAC7B,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,CAAA;QACvB,KAAK,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAA;QACvB,KAAK,GAAG,IAAI,CAAA;IACd,CAAC;CACF,CAAA;AAGD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observations — rrweb session capture (vision-reconciliation wave,
|
|
3
|
+
* Phase A).
|
|
4
|
+
*
|
|
5
|
+
* Records the visitor's session with rrweb and ships event batches to
|
|
6
|
+
* `POST /api/runtime/sessions/:sessionId/observations`, where the
|
|
7
|
+
* server's vision bridge replays them in Browserbase and screenshots
|
|
8
|
+
* feed the Gemini perceive+decide tick.
|
|
9
|
+
*
|
|
10
|
+
* Capture policy (wave doc §Phase A — "everything the user sees,
|
|
11
|
+
* except PII"):
|
|
12
|
+
* - Full DOM, canvas (sampled at ~2 fps — the VLM only ticks every
|
|
13
|
+
* 2–5s), media playback state, fonts + images inlined so replay
|
|
14
|
+
* doesn't depend on URLs staying reachable.
|
|
15
|
+
* - Typed PII never leaves the page: password / email / tel inputs
|
|
16
|
+
* are masked at the keystroke level. Rendered PII is the
|
|
17
|
+
* customer's to mark: `holostaff-mask` masks text content,
|
|
18
|
+
* `holostaff-block` blanks a region, `holostaff-ignore` skips an
|
|
19
|
+
* input entirely.
|
|
20
|
+
*
|
|
21
|
+
* Version pin: rrweb 2.0.0-alpha.4 — MUST match the server's replay
|
|
22
|
+
* bundle (server/src/bowtie/vision/rrweb.bundle.js); recorder and
|
|
23
|
+
* replayer share the event format.
|
|
24
|
+
*
|
|
25
|
+
* Loading: rrweb is imported dynamically so hosts that disable
|
|
26
|
+
* observation (or render server-side) never evaluate it; a failed
|
|
27
|
+
* import degrades to no-capture and routes to onError, per the SDK's
|
|
28
|
+
* fail-soft contract.
|
|
29
|
+
*
|
|
30
|
+
* Batching:
|
|
31
|
+
* - flush every FLUSH_INTERVAL_MS, or at MAX_BATCH_EVENTS, or when
|
|
32
|
+
* the approximate batch size passes MAX_BATCH_BYTES (full
|
|
33
|
+
* snapshots with inlined images are heavy — don't let them queue).
|
|
34
|
+
* - final flush on dispose goes over sendBeacon (survives unload);
|
|
35
|
+
* beacons cap at ~64KB so an oversized final batch is truncated to
|
|
36
|
+
* the most recent events — replay loses the tail of a dying
|
|
37
|
+
* session, never the session.
|
|
38
|
+
*/
|
|
39
|
+
import { type TransportConfig } from './transport.js';
|
|
40
|
+
import type { ObserveOptions } from './types.js';
|
|
41
|
+
export interface ObservationsBindingDeps {
|
|
42
|
+
cfg: TransportConfig;
|
|
43
|
+
sessionId: string;
|
|
44
|
+
/** Common body fields — tenantId/sourceId/deviceId/hostUserId. */
|
|
45
|
+
buildBody: () => Record<string, unknown>;
|
|
46
|
+
observe?: ObserveOptions;
|
|
47
|
+
}
|
|
48
|
+
export interface ObservationsBinding {
|
|
49
|
+
/** Stop recording, flush the tail via beacon. */
|
|
50
|
+
dispose(): void;
|
|
51
|
+
}
|
|
52
|
+
export declare function startObservations(deps: ObservationsBindingDeps): ObservationsBinding;
|
|
53
|
+
//# sourceMappingURL=observations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"observations.d.ts","sourceRoot":"","sources":["../src/observations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAwB,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAOhD,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,eAAe,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,kEAAkE;IAClE,SAAS,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACxC,OAAO,CAAC,EAAE,cAAc,CAAA;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,OAAO,IAAI,IAAI,CAAA;CAChB;AAID,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,uBAAuB,GAAG,mBAAmB,CAyFpF"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Observations — rrweb session capture (vision-reconciliation wave,
|
|
3
|
+
* Phase A).
|
|
4
|
+
*
|
|
5
|
+
* Records the visitor's session with rrweb and ships event batches to
|
|
6
|
+
* `POST /api/runtime/sessions/:sessionId/observations`, where the
|
|
7
|
+
* server's vision bridge replays them in Browserbase and screenshots
|
|
8
|
+
* feed the Gemini perceive+decide tick.
|
|
9
|
+
*
|
|
10
|
+
* Capture policy (wave doc §Phase A — "everything the user sees,
|
|
11
|
+
* except PII"):
|
|
12
|
+
* - Full DOM, canvas (sampled at ~2 fps — the VLM only ticks every
|
|
13
|
+
* 2–5s), media playback state, fonts + images inlined so replay
|
|
14
|
+
* doesn't depend on URLs staying reachable.
|
|
15
|
+
* - Typed PII never leaves the page: password / email / tel inputs
|
|
16
|
+
* are masked at the keystroke level. Rendered PII is the
|
|
17
|
+
* customer's to mark: `holostaff-mask` masks text content,
|
|
18
|
+
* `holostaff-block` blanks a region, `holostaff-ignore` skips an
|
|
19
|
+
* input entirely.
|
|
20
|
+
*
|
|
21
|
+
* Version pin: rrweb 2.0.0-alpha.4 — MUST match the server's replay
|
|
22
|
+
* bundle (server/src/bowtie/vision/rrweb.bundle.js); recorder and
|
|
23
|
+
* replayer share the event format.
|
|
24
|
+
*
|
|
25
|
+
* Loading: rrweb is imported dynamically so hosts that disable
|
|
26
|
+
* observation (or render server-side) never evaluate it; a failed
|
|
27
|
+
* import degrades to no-capture and routes to onError, per the SDK's
|
|
28
|
+
* fail-soft contract.
|
|
29
|
+
*
|
|
30
|
+
* Batching:
|
|
31
|
+
* - flush every FLUSH_INTERVAL_MS, or at MAX_BATCH_EVENTS, or when
|
|
32
|
+
* the approximate batch size passes MAX_BATCH_BYTES (full
|
|
33
|
+
* snapshots with inlined images are heavy — don't let them queue).
|
|
34
|
+
* - final flush on dispose goes over sendBeacon (survives unload);
|
|
35
|
+
* beacons cap at ~64KB so an oversized final batch is truncated to
|
|
36
|
+
* the most recent events — replay loses the tail of a dying
|
|
37
|
+
* session, never the session.
|
|
38
|
+
*/
|
|
39
|
+
import { postJson, postBeacon } from './transport.js';
|
|
40
|
+
const FLUSH_INTERVAL_MS = 5000;
|
|
41
|
+
const MAX_BATCH_EVENTS = 200;
|
|
42
|
+
const MAX_BATCH_BYTES = 800000;
|
|
43
|
+
const BEACON_SAFE_BYTES = 55000;
|
|
44
|
+
export function startObservations(deps) {
|
|
45
|
+
if (typeof window === 'undefined')
|
|
46
|
+
return { dispose: () => { } };
|
|
47
|
+
if (deps.observe?.enabled === false)
|
|
48
|
+
return { dispose: () => { } };
|
|
49
|
+
let disposed = false;
|
|
50
|
+
let stopRecording = null;
|
|
51
|
+
let buffer = [];
|
|
52
|
+
let bufferBytes = 0;
|
|
53
|
+
let flushTimer = null;
|
|
54
|
+
const path = `/api/runtime/sessions/${deps.sessionId}/observations`;
|
|
55
|
+
const flush = () => {
|
|
56
|
+
if (!buffer.length)
|
|
57
|
+
return;
|
|
58
|
+
const events = buffer;
|
|
59
|
+
buffer = [];
|
|
60
|
+
bufferBytes = 0;
|
|
61
|
+
void postJson(deps.cfg, path, { ...deps.buildBody(), events });
|
|
62
|
+
};
|
|
63
|
+
/** Unload-safe flush. Beacon payloads cap at ~64KB; keep the most
|
|
64
|
+
* recent events if the tail batch is oversized — replay loses the
|
|
65
|
+
* tail of a dying session, never the session. */
|
|
66
|
+
const flushBeacon = () => {
|
|
67
|
+
if (!buffer.length)
|
|
68
|
+
return;
|
|
69
|
+
let events = buffer;
|
|
70
|
+
buffer = [];
|
|
71
|
+
bufferBytes = 0;
|
|
72
|
+
// Size by the events alone (body adds ~200 constant bytes); halving
|
|
73
|
+
// converges in ≤4 rounds from the 800KB batch cap.
|
|
74
|
+
while (events.length > 1 && JSON.stringify(events).length > BEACON_SAFE_BYTES) {
|
|
75
|
+
events = events.slice(Math.ceil(events.length / 2));
|
|
76
|
+
}
|
|
77
|
+
postBeacon(deps.cfg, path, { ...deps.buildBody(), events });
|
|
78
|
+
};
|
|
79
|
+
const push = (event) => {
|
|
80
|
+
if (disposed)
|
|
81
|
+
return;
|
|
82
|
+
buffer.push(event);
|
|
83
|
+
// Approximate sizing — exact enough to keep batches under the cap.
|
|
84
|
+
try {
|
|
85
|
+
bufferBytes += JSON.stringify(event).length;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
bufferBytes += 1000;
|
|
89
|
+
}
|
|
90
|
+
if (buffer.length >= MAX_BATCH_EVENTS || bufferBytes >= MAX_BATCH_BYTES)
|
|
91
|
+
flush();
|
|
92
|
+
};
|
|
93
|
+
// Dynamic import keeps rrweb out of hosts that never observe and
|
|
94
|
+
// makes a missing/incompatible module a soft failure.
|
|
95
|
+
void import('rrweb')
|
|
96
|
+
.then((rrweb) => {
|
|
97
|
+
if (disposed)
|
|
98
|
+
return;
|
|
99
|
+
const record = rrweb.record;
|
|
100
|
+
if (typeof record !== 'function') {
|
|
101
|
+
deps.cfg.onError?.(new Error('rrweb.record unavailable'), { method: 'OBSERVE', path });
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
stopRecording = record({
|
|
105
|
+
emit: (event) => push(event),
|
|
106
|
+
// -- everything the user sees --
|
|
107
|
+
recordCanvas: true,
|
|
108
|
+
sampling: { canvas: 2 },
|
|
109
|
+
inlineImages: true,
|
|
110
|
+
collectFonts: true,
|
|
111
|
+
// -- except PII --
|
|
112
|
+
maskInputOptions: { password: true, email: true, tel: true },
|
|
113
|
+
maskAllInputs: deps.observe?.maskAllInputs ?? false,
|
|
114
|
+
maskTextClass: 'holostaff-mask',
|
|
115
|
+
blockClass: 'holostaff-block',
|
|
116
|
+
ignoreClass: 'holostaff-ignore',
|
|
117
|
+
...(deps.observe?.blockSelector ? { blockSelector: deps.observe.blockSelector } : {}),
|
|
118
|
+
...(deps.observe?.rrweb ?? {}),
|
|
119
|
+
}) ?? null;
|
|
120
|
+
flushTimer = setInterval(flush, FLUSH_INTERVAL_MS);
|
|
121
|
+
})
|
|
122
|
+
.catch((err) => {
|
|
123
|
+
deps.cfg.onError?.(err instanceof Error ? err : new Error(String(err)), { method: 'OBSERVE', path });
|
|
124
|
+
});
|
|
125
|
+
return {
|
|
126
|
+
dispose() {
|
|
127
|
+
if (disposed)
|
|
128
|
+
return;
|
|
129
|
+
disposed = true;
|
|
130
|
+
if (flushTimer != null) {
|
|
131
|
+
clearInterval(flushTimer);
|
|
132
|
+
flushTimer = null;
|
|
133
|
+
}
|
|
134
|
+
try {
|
|
135
|
+
stopRecording?.();
|
|
136
|
+
}
|
|
137
|
+
catch { /* recorder already gone */ }
|
|
138
|
+
stopRecording = null;
|
|
139
|
+
flushBeacon();
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|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C,CAAC,EACnD,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,CAC5B,CAAA;IACH,CAAC,CAAC,CAAA;IAEJ,OAAO;QACL,OAAO;YACL,IAAI,QAAQ;gBAAE,OAAM;YACpB,QAAQ,GAAG,IAAI,CAAA;YACf,IAAI,UAAU,IAAI,IAAI,EAAE,CAAC;gBAAC,aAAa,CAAC,UAAU,CAAC,CAAC;gBAAC,UAAU,GAAG,IAAI,CAAA;YAAC,CAAC;YACxE,IAAI,CAAC;gBAAC,aAAa,EAAE,EAAE,CAAA;YAAC,CAAC;YAAC,MAAM,CAAC,CAAC,2BAA2B,CAAC,CAAC;YAC/D,aAAa,GAAG,IAAI,CAAA;YACpB,WAAW,EAAE,CAAA;QACf,CAAC;KACF,CAAA;AACH,CAAC"}
|
package/dist/transport.d.ts
CHANGED
|
@@ -31,10 +31,10 @@ export declare function postBeacon(cfg: TransportConfig, path: string, body: Rec
|
|
|
31
31
|
* Open an SSE channel for intervention commands. Returns the
|
|
32
32
|
* EventSource so the caller can attach listeners + close it.
|
|
33
33
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
34
|
+
* The server pushes `fire_intervention` events on this channel when a
|
|
35
|
+
* monitoring-agent decision passes suppression (Wave 3e). The widget
|
|
36
|
+
* subsystem subscribes and renders text interventions; other
|
|
37
|
+
* modalities are ignored client-side for now.
|
|
38
38
|
*/
|
|
39
39
|
export declare function openCommandStream(cfg: TransportConfig, sessionId: string, tenantId: string, sourceId: string): EventSource | null;
|
|
40
40
|
//# sourceMappingURL=transport.d.ts.map
|
package/dist/transport.js
CHANGED
|
@@ -89,10 +89,10 @@ export function postBeacon(cfg, path, body) {
|
|
|
89
89
|
* Open an SSE channel for intervention commands. Returns the
|
|
90
90
|
* EventSource so the caller can attach listeners + close it.
|
|
91
91
|
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
92
|
+
* The server pushes `fire_intervention` events on this channel when a
|
|
93
|
+
* monitoring-agent decision passes suppression (Wave 3e). The widget
|
|
94
|
+
* subsystem subscribes and renders text interventions; other
|
|
95
|
+
* modalities are ignored client-side for now.
|
|
96
96
|
*/
|
|
97
97
|
export function openCommandStream(cfg, sessionId, tenantId, sourceId) {
|
|
98
98
|
if (typeof EventSource === 'undefined')
|
package/dist/types.d.ts
CHANGED
|
@@ -8,7 +8,28 @@
|
|
|
8
8
|
*/
|
|
9
9
|
export type BowtieStage = 'awareness' | 'education' | 'selection' | 'mutual_commit' | 'onboarding' | 'adoption' | 'expansion';
|
|
10
10
|
export declare const BOWTIE_STAGES: readonly BowtieStage[];
|
|
11
|
+
export interface ObserveOptions {
|
|
12
|
+
/** Master switch. Default true — vision-first runtime needs eyes. */
|
|
13
|
+
enabled?: boolean;
|
|
14
|
+
/** Mask every input, not just PII types. Default false. */
|
|
15
|
+
maskAllInputs?: boolean;
|
|
16
|
+
/** Extra CSS selector to block (region blanked in capture). */
|
|
17
|
+
blockSelector?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Escape hatch: merged last into the rrweb record() options, so a
|
|
20
|
+
* customer can override anything (e.g. recordCanvas: false).
|
|
21
|
+
*/
|
|
22
|
+
rrweb?: Record<string, unknown>;
|
|
23
|
+
}
|
|
11
24
|
export interface InitOptions {
|
|
25
|
+
/**
|
|
26
|
+
* rrweb session-capture options. Capture is ON by default — the
|
|
27
|
+
* runtime is vision-first and decides from what it sees. Password /
|
|
28
|
+
* email / tel inputs are always masked; mark rendered PII with the
|
|
29
|
+
* `holostaff-mask` / `holostaff-block` CSS classes. Set
|
|
30
|
+
* `observe: { enabled: false }` to opt a host out entirely.
|
|
31
|
+
*/
|
|
32
|
+
observe?: ObserveOptions;
|
|
12
33
|
/** The knowledge source id (e.g. 'cli-source-abc'). Provided by the deploy PR. */
|
|
13
34
|
sourceId: string;
|
|
14
35
|
/**
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,WAAW,GACnB,WAAW,GACX,WAAW,GACX,WAAW,GACX,eAAe,GACf,YAAY,GACZ,UAAU,GACV,WAAW,CAAA;AAEf,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAQtC,CAAA;AAEV,MAAM,WAAW,WAAW;IAC1B,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE;AAED,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,WAAW,GACX,SAAS,GACT,YAAY,GACZ,SAAS,GACT,SAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,WAAW,GACnB,WAAW,GACX,WAAW,GACX,WAAW,GACX,eAAe,GACf,YAAY,GACZ,UAAU,GACV,WAAW,CAAA;AAEf,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAQtC,CAAA;AAEV,MAAM,WAAW,cAAc;IAC7B,qEAAqE;IACrE,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,2DAA2D;IAC3D,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAChC;AAED,MAAM,WAAW,WAAW;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAA;IAChB,+EAA+E;IAC/E,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;CACtE;AAED,MAAM,MAAM,mBAAmB,GAC3B,SAAS,GACT,WAAW,GACX,SAAS,GACT,YAAY,GACZ,SAAS,GACT,SAAS,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@holostaff/sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Holostaff SDK — lifetime identity, stage detection,
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "Holostaff SDK — lifetime identity, stage detection, custom signal probes, and the intervention widget for the Holostaff runtime.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"homepage": "https://docs.holostaff.ai",
|
|
5
7
|
"type": "module",
|
|
6
8
|
"main": "./dist/index.js",
|
|
7
9
|
"module": "./dist/index.js",
|
|
@@ -36,5 +38,8 @@
|
|
|
36
38
|
},
|
|
37
39
|
"devDependencies": {
|
|
38
40
|
"typescript": "^5.4.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"rrweb": "^2.0.0-alpha.4"
|
|
39
44
|
}
|
|
40
45
|
}
|