You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v0.8.0 — system stream MVP + appTemplates existingStreamRefs (plan 45)
CollectorRequest: new top-level existingStreamRefs[] (Plan 45 §2.9 mode-3) for
requesting access on pre-existing streams without provisioning. addExistingStreamRef()
validates input. Type ExistingStreamRef exported.
CollectorClient.accept(): processes existingStreamRefs[] — bootstrap-provisions
app-system / app-system-out / app-system-in streams (idempotent), appends requested
permissions to the granted access, surfaces system-stream wiring on
responseContent.system = { streamOut?, streamIn? }.
CollectorInvite: hasSystem getter, systemSettings, systemPostAlert(), systemPollAcks(),
systemEventInfos(). Posts message/system-alert and reads message/system-ack.
Collector.checkInbox(): also propagates responseEvent.content.system to the
operator's invite content (was only copying chat). Without this the operator's
hasSystem stayed false even when the patient's accept flow surfaced the system
wiring — discovered during the smoke test, end-to-end verified programmatically.
Tests: 8 new in apptemplatesRequest.test.js covering existingStreamRefs validation,
serialization, mixed-mode requests.
Requires data-model ≥ 1.6.0.
Copy file name to clipboardExpand all lines: AGENTS.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,7 +97,7 @@ Every value/type intended for external consumption is exported from [`ts/index.t
97
97
98
98
-**`tsc` stale output**: `tsc` may skip re-emitting a `.js` file if it already exists and didn't notice an internal change. After `npm run prepare` / `npm run build:ts`, **verify the relevant file in `js/` actually contains your change** before committing. If not, delete the stale `js/<path>.js` and re-run.
99
99
-**Vite cache in consumer apps**: when you change a public type or export and a consumer app (Vite-based) doesn't pick it up, clear `<consumer>/node_modules/.vite` and restart the dev server.
100
-
-**npm-link traps**: when an HDS app is npm-linked to `hds-lib`, both the app and any nested package (e.g. `hds-forms-js`'s [`src-test-app/`](https://github.com/healthdatasafe/hds-forms-js/tree/main/src-test-app)) must link the **same**`hds-lib` to avoid duplicate singletons (settings, model). If you see "two HDSModels" symptoms (e.g. `getHDSModel()` returning empty), this is the cause. **Run `cd _local && npm run check-links && npm run verify-live-source`** to diagnose. Full methodology: `_macro/_claude-memory/conventions.md § Live cross-repo development — quickstart` + `_plans/49-local-dev-dependency-graph-study/PLAN.md`.
100
+
-**npm-link traps**: when an HDS app is npm-linked to `hds-lib`, both the app and any nested package (e.g. `hds-forms-js`'s [`src-test-app/`](https://github.com/healthdatasafe/hds-forms-js/tree/main/src-test-app)) must link the **same**`hds-lib` to avoid duplicate singletons (settings, model). If you see "two HDSModels" symptoms (e.g. `getHDSModel()` returning empty), this is the cause. **Run `cd _local && npm run check-links && npm run verify-live-source`** to diagnose. Full methodology: `_claude-memory/conventions.md § Live cross-repo development — quickstart` + `_plans/49-local-dev-dependency-graph-done/PLAN.md`.
101
101
-**`exports.import` MUST point at TS source** (`./ts/index.ts` here). Vite resolves the `import` condition in dev mode; pointing at compiled JS causes downstream libs (hds-forms-js, hds-react-timeline) to inline a second copy of `hds-lib` → duplicate-singleton bug. Verify with `cd _local && npm run verify-live-source`.
102
102
-**Initialization order**: in apps that call `initBoiler(name, configDir)` (server side) or `pryv.Browser.AuthController` (client side), do so **before** any `getHDSModel()` / `HDSSettings` lookup.
- New top-level field `existingStreamRefs[]` (Plan 45 §2.9 mode-3): request access on pre-existing streams without provisioning. Each ref carries `{ streamId, permissions: ('read'|'manage'|'contribute')[], purpose? }`.
11
+
- New methods: `addExistingStreamRef(ref)` with input validation (rejects non-string streamId, empty permissions, unknown permission levels) and `existingStreamRefs` getter.
12
+
-`content` getter now serializes `existingStreamRefs[]` when non-empty (omitted otherwise — backwards-compatible).
-`accept()` now processes `requestData.existingStreamRefs[]` after the existing chat-stream block:
17
+
1.**Bootstrap-provision**`app-system` / `app-system-out` / `app-system-in` streams if a ref points at the system pair and the streams don't exist yet. The new streams carry `clientData.hdsSystemFeature` declaring `message/system-alert` (on `out`) and `message/system-ack` (on `in`). Idempotent — `item-already-exists` errors from `streams.create` are tolerated.
18
+
2. Append the requested permissions to the access being granted.
19
+
3. Surface system-stream wiring on `responseContent.system = { streamOut?, streamIn? }` when `app-system-*` refs are present.
- New properties: `hasSystem`, `systemSettings` (returns `{ streamOut?, streamIn? }`).
23
+
- New methods (mirroring `chatPost` / `chatEventInfos`):
24
+
-`systemPostAlert({ level, title, body, ackRequired?, ackId? })` — posts a `message/system-alert` to `streamOut`. Auto-generates a UUID `ackId` when `ackRequired: true` and none supplied.
25
+
-`systemPollAcks({ ackId?, limit? })` — fetches `message/system-ack` events from `streamIn`, optionally filtered by `ackId`. Returns events sorted ascending by creation time.
26
+
-`systemEventInfos(event)` — identifies the source of a system event (`'me'`/`'user'`/`'unknown'`).
-`exports[.].import` switched from `./js/index.js` (compiled JS) to `./ts/index.ts` (TS source). Added wildcard `./js/*` subpath export. `default` still points at compiled JS for non-Vite/CJS consumers.
30
+
- This brings hds-lib in line with `_claude-memory/conventions.md § Package exports: TS source for bundlers` and is the prerequisite for live cross-repo dev (the previous `js/index.js` import path created duplicate-singleton bugs when downstream libs like hds-forms-js re-imported `hds-lib` via `require()`). See `_plans/49-local-dev-dependency-graph-done/PLAN.md` for the full rationale.
31
+
32
+
### Notes
33
+
- The Plan-45 Phase 3a additions are the **MVP slice** of system-stream support. Full Phase 3 work (custom-fields helpers `resolveStreamCustomField` + `streamCustomFieldToVirtualItem`, the appTemplates loader with Ajv schema, sandbox-prefix enforcement) lands in a follow-up commit.
34
+
- Designed to be consumed by:
35
+
-**`doctor-dashboard`** Phase 6a — operator UI calling `invite.systemPostAlert(...)` and `invite.systemPollAcks(...)`.
36
+
-**`hds-webapp`** Phase 7a — patient-side inbox provisioning the `app-system/*` streams at boot (or relying on `CollectorClient`'s bootstrap fallback) and rendering alerts with an Acknowledge button that posts `message/system-ack`.
37
+
- Requires `data-model` ≥ 1.4.0 (the new `message/system-alert` + `message/system-ack` event types).
38
+
- See `_plans/45-custom-fields-appTemplates-paused/spec.md` for the locked design.
39
+
5
40
## [0.7.2] - 2026-04-28
6
41
7
42
### Added — runtime support for `deprecated: true` itemDefs (Plan 50)
@@ -22,7 +57,7 @@ Contract documented in `data-model/AGENTS.md § "deprecated: true on items"`.
22
57
23
58
**Why.** Vite resolves the `import` condition in dev mode. With `import` pointing at compiled JS, live edits to `ts/*.ts` weren't reflected in npm-linked consumers without rebuilding hds-lib-js. Pointing `import` at TS source enables true live cross-repo development. This also avoids the duplicate-singleton bug surfaced by Plan 45 (a downstream lib's pre-built bundle inlining a second copy of `hds-lib`'s `HDSModel`). Production builds and CJS consumers are unaffected (still hit `default`).
24
59
25
-
Brings `hds-lib` in line with `_claude-memory/conventions.md § Package exports: TS source for bundlers`. See `_plans/49-local-dev-dependency-graph-study/PLAN.md` for the full rationale.
60
+
Brings `hds-lib` in line with `_claude-memory/conventions.md § Package exports: TS source for bundlers`. See `_plans/49-local-dev-dependency-graph-done/PLAN.md` for the full rationale.
0 commit comments