@healthcloudai/hc-ams 3.9.0 → 3.9.1
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 +25 -0
- package/dist/index.cjs +9 -5
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -395,3 +395,28 @@ is fixed. Callers intentionally overriding authentication must now explicitly
|
|
|
395
395
|
set `authBaseUrlOverride`; selecting another API server leaves the environment's
|
|
396
396
|
auth target unchanged. An API override now also selects the WebSocket origin
|
|
397
397
|
unless an SDK/per-chat WS override is provided. UAT/PROD defaults are unchanged.
|
|
398
|
+
|
|
399
|
+
### Reception-only V2 connections
|
|
400
|
+
|
|
401
|
+
Use `capabilities: { read_only: true, supported_actions: [] }` for an owned-run
|
|
402
|
+
connection that only receives history/events and responds to keepalive pings.
|
|
403
|
+
This is reception only: `sendChat`, `bindPatient`, `sendActionResult` and explicit
|
|
404
|
+
`sendCommand` retries reject before sending. Omitted or `false` preserves ordinary
|
|
405
|
+
command behavior. The capability is copied when the client is constructed.
|
|
406
|
+
|
|
407
|
+
```ts
|
|
408
|
+
const receiver = sdk.connectV2AgentChat({
|
|
409
|
+
agentId, run, identity,
|
|
410
|
+
capabilities: { platform: "web", read_only: true, supported_actions: [] },
|
|
411
|
+
WebSocketImpl,
|
|
412
|
+
});
|
|
413
|
+
receiver.on("history", renderHistory);
|
|
414
|
+
await receiver.connect();
|
|
415
|
+
// Reconnect this same instance after closing; no new run is created implicitly.
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
Tenant, Patient-token and owned-run claim authorization remain enforced by the
|
|
419
|
+
server. Ordinary app sign-in still uses the separate Patient HTTP binding API
|
|
420
|
+
after closing the socket and observing its actual closure. Reception-only support
|
|
421
|
+
does not establish Patient chat/action parity, deployed Origin acceptance or a
|
|
422
|
+
registry release; verify the installed published version before using this option.
|
package/dist/index.cjs
CHANGED
|
@@ -1045,6 +1045,7 @@ function capabilities(value) {
|
|
|
1045
1045
|
if (!record(value) || !onlyKeys(value, [
|
|
1046
1046
|
"platform",
|
|
1047
1047
|
"supported_actions",
|
|
1048
|
+
"read_only",
|
|
1048
1049
|
"patient_flags_confirmation",
|
|
1049
1050
|
"intake_confirmation",
|
|
1050
1051
|
"encounter_confirmation",
|
|
@@ -1053,7 +1054,7 @@ function capabilities(value) {
|
|
|
1053
1054
|
])) return false;
|
|
1054
1055
|
if (value.platform !== void 0 && !["web", "ios", "android", "terminal", "unknown"].includes(value.platform)) return false;
|
|
1055
1056
|
if (value.supported_actions !== void 0 && (!Array.isArray(value.supported_actions) || value.supported_actions.length > 16 || !value.supported_actions.every((action) => ["confirm", "insurance_scan", "vitals_import", "slot_picker", "login", "symptom_save", "telehealth_join"].includes(action)))) return false;
|
|
1056
|
-
for (const key of ["patient_flags_confirmation", "intake_confirmation", "encounter_confirmation"]) {
|
|
1057
|
+
for (const key of ["read_only", "patient_flags_confirmation", "intake_confirmation", "encounter_confirmation"]) {
|
|
1057
1058
|
if (value[key] !== void 0 && typeof value[key] !== "boolean") return false;
|
|
1058
1059
|
}
|
|
1059
1060
|
return ["locale", "time_zone"].every((key) => value[key] === void 0 || typeof value[key] === "string" && value[key].length > 0 && value[key].length <= 128);
|
|
@@ -1368,8 +1369,11 @@ var NativeV2WssClient = class {
|
|
|
1368
1369
|
}
|
|
1369
1370
|
/** Explicit retries resend the caller's original command identity and terms. */
|
|
1370
1371
|
sendCommand(command) {
|
|
1371
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1372
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1372
1373
|
__privateMethod(this, _NativeV2WssClient_instances, requireConnected_fn).call(this);
|
|
1374
|
+
if (((_a = __privateGet(this, _options).capabilities) == null ? void 0 : _a.read_only) === true) {
|
|
1375
|
+
throw invalid("Read-only V2 connections cannot send commands.");
|
|
1376
|
+
}
|
|
1373
1377
|
if (!record(command) || !onlyKeys(command, ["type", "payload"]) || !record(command.payload)) {
|
|
1374
1378
|
throw invalid("Invalid V2 command.");
|
|
1375
1379
|
}
|
|
@@ -1386,15 +1390,15 @@ var NativeV2WssClient = class {
|
|
|
1386
1390
|
if (__privateGet(this, _options).run.protocol !== "dbos_signin_cta_v1" || payload.previous_turn_id === null || !record(choice) || !onlyKeys(choice, ["offer_id", "action", "option_id"]) || typeof choice.offer_id !== "string" || !/^[0-9a-f]{32}$/.test(choice.offer_id) || typeof choice.action !== "string" || !/^[a-z0-9_-]{1,128}$/.test(choice.action) || ![`${choice.offer_id}:yes`, `${choice.offer_id}:no`].includes(choice.option_id)) throw invalid("Invalid V2 CTA confirmation.");
|
|
1387
1391
|
}
|
|
1388
1392
|
} else if (command.type === "bind_patient") {
|
|
1389
|
-
if (!((
|
|
1393
|
+
if (!((_c = (_b = __privateGet(this, _options).capabilities) == null ? void 0 : _b.supported_actions) == null ? void 0 : _c.includes("login"))) throw invalid("V2 login was not advertised.");
|
|
1390
1394
|
if (!onlyKeys(payload, ["action_id", "tenant_id", "patient_id", "token", "run_secret", "identity_proof", "turn_id", "previous_turn_id"]) || !uuid(payload.action_id) || payload.previous_turn_id === null || payload.tenant_id !== __privateGet(this, _options).tenantId || !identity(payload.patient_id) || payload.run_secret !== __privateGet(this, _options).run.run_secret || typeof payload.token !== "string" || !payload.token || payload.token.length > 4096 || typeof payload.identity_proof !== "string" || !payload.identity_proof || payload.identity_proof.length > 2048) throw invalid("Invalid V2 binding command.");
|
|
1391
1395
|
} else if (command.type === "action_result") {
|
|
1392
1396
|
if (!onlyKeys(payload, ["action_id", "status", "data", "operation", "turn_id", "previous_turn_id"]) || !uuid(payload.action_id) || payload.previous_turn_id === null || !["completed", "cancelled", "failed"].includes(payload.status) || !record(payload.data)) throw invalid("Invalid V2 action command.");
|
|
1393
1397
|
const data = payload.data;
|
|
1394
1398
|
if ("proposal_id" in data) {
|
|
1395
|
-
if (!((
|
|
1399
|
+
if (!((_e = (_d = __privateGet(this, _options).capabilities) == null ? void 0 : _d.supported_actions) == null ? void 0 : _e.includes("confirm"))) throw invalid("V2 confirmation was not advertised.");
|
|
1396
1400
|
if (__privateGet(this, _options).run.protocol !== "dbos_signin_booking_v1" || !onlyKeys(data, ["proposal_id", "approved"]) || !uuid(data.proposal_id) || ![void 0, "confirm", "status"].includes(payload.operation) || (payload.operation === "status" ? payload.status !== "completed" || data.approved !== null : typeof data.approved !== "boolean" || payload.status !== "completed" && data.approved)) throw invalid("Invalid V2 booking result.");
|
|
1397
|
-
} else if (!((
|
|
1401
|
+
} else if (!((_g = (_f = __privateGet(this, _options).capabilities) == null ? void 0 : _f.supported_actions) == null ? void 0 : _g.includes("slot_picker")) || !["dbos_signin_actions_v1", "dbos_signin_booking_v1", "dbos_signin_cta_v1"].includes(__privateGet(this, _options).run.protocol) || payload.operation !== void 0 || (payload.status === "completed" ? !onlyKeys(data, ["slot_id"]) || typeof data.slot_id !== "string" || !data.slot_id.length || data.slot_id.length > 256 : Object.keys(data).length > 0)) {
|
|
1398
1402
|
throw invalid("Invalid V2 slot result.");
|
|
1399
1403
|
}
|
|
1400
1404
|
} else throw invalid("Unsupported V2 command.");
|
package/dist/index.d.cts
CHANGED
|
@@ -1029,6 +1029,8 @@ interface V2PatientBindingResult {
|
|
|
1029
1029
|
last_turn_id: string | null;
|
|
1030
1030
|
}
|
|
1031
1031
|
interface V2ClientCapabilities {
|
|
1032
|
+
/** Reception only: permits admission without action handlers; sends no commands. */
|
|
1033
|
+
read_only?: boolean;
|
|
1032
1034
|
platform?: "web" | "ios" | "android" | "terminal" | "unknown";
|
|
1033
1035
|
supported_actions?: Array<"confirm" | "insurance_scan" | "vitals_import" | "slot_picker" | "login" | "symptom_save" | "telehealth_join">;
|
|
1034
1036
|
patient_flags_confirmation?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1029,6 +1029,8 @@ interface V2PatientBindingResult {
|
|
|
1029
1029
|
last_turn_id: string | null;
|
|
1030
1030
|
}
|
|
1031
1031
|
interface V2ClientCapabilities {
|
|
1032
|
+
/** Reception only: permits admission without action handlers; sends no commands. */
|
|
1033
|
+
read_only?: boolean;
|
|
1032
1034
|
platform?: "web" | "ios" | "android" | "terminal" | "unknown";
|
|
1033
1035
|
supported_actions?: Array<"confirm" | "insurance_scan" | "vitals_import" | "slot_picker" | "login" | "symptom_save" | "telehealth_join">;
|
|
1034
1036
|
patient_flags_confirmation?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -997,6 +997,7 @@ function capabilities(value) {
|
|
|
997
997
|
if (!record(value) || !onlyKeys(value, [
|
|
998
998
|
"platform",
|
|
999
999
|
"supported_actions",
|
|
1000
|
+
"read_only",
|
|
1000
1001
|
"patient_flags_confirmation",
|
|
1001
1002
|
"intake_confirmation",
|
|
1002
1003
|
"encounter_confirmation",
|
|
@@ -1005,7 +1006,7 @@ function capabilities(value) {
|
|
|
1005
1006
|
])) return false;
|
|
1006
1007
|
if (value.platform !== void 0 && !["web", "ios", "android", "terminal", "unknown"].includes(value.platform)) return false;
|
|
1007
1008
|
if (value.supported_actions !== void 0 && (!Array.isArray(value.supported_actions) || value.supported_actions.length > 16 || !value.supported_actions.every((action) => ["confirm", "insurance_scan", "vitals_import", "slot_picker", "login", "symptom_save", "telehealth_join"].includes(action)))) return false;
|
|
1008
|
-
for (const key of ["patient_flags_confirmation", "intake_confirmation", "encounter_confirmation"]) {
|
|
1009
|
+
for (const key of ["read_only", "patient_flags_confirmation", "intake_confirmation", "encounter_confirmation"]) {
|
|
1009
1010
|
if (value[key] !== void 0 && typeof value[key] !== "boolean") return false;
|
|
1010
1011
|
}
|
|
1011
1012
|
return ["locale", "time_zone"].every((key) => value[key] === void 0 || typeof value[key] === "string" && value[key].length > 0 && value[key].length <= 128);
|
|
@@ -1320,8 +1321,11 @@ var NativeV2WssClient = class {
|
|
|
1320
1321
|
}
|
|
1321
1322
|
/** Explicit retries resend the caller's original command identity and terms. */
|
|
1322
1323
|
sendCommand(command) {
|
|
1323
|
-
var _a, _b, _c, _d, _e, _f;
|
|
1324
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
1324
1325
|
__privateMethod(this, _NativeV2WssClient_instances, requireConnected_fn).call(this);
|
|
1326
|
+
if (((_a = __privateGet(this, _options).capabilities) == null ? void 0 : _a.read_only) === true) {
|
|
1327
|
+
throw invalid("Read-only V2 connections cannot send commands.");
|
|
1328
|
+
}
|
|
1325
1329
|
if (!record(command) || !onlyKeys(command, ["type", "payload"]) || !record(command.payload)) {
|
|
1326
1330
|
throw invalid("Invalid V2 command.");
|
|
1327
1331
|
}
|
|
@@ -1338,15 +1342,15 @@ var NativeV2WssClient = class {
|
|
|
1338
1342
|
if (__privateGet(this, _options).run.protocol !== "dbos_signin_cta_v1" || payload.previous_turn_id === null || !record(choice) || !onlyKeys(choice, ["offer_id", "action", "option_id"]) || typeof choice.offer_id !== "string" || !/^[0-9a-f]{32}$/.test(choice.offer_id) || typeof choice.action !== "string" || !/^[a-z0-9_-]{1,128}$/.test(choice.action) || ![`${choice.offer_id}:yes`, `${choice.offer_id}:no`].includes(choice.option_id)) throw invalid("Invalid V2 CTA confirmation.");
|
|
1339
1343
|
}
|
|
1340
1344
|
} else if (command.type === "bind_patient") {
|
|
1341
|
-
if (!((
|
|
1345
|
+
if (!((_c = (_b = __privateGet(this, _options).capabilities) == null ? void 0 : _b.supported_actions) == null ? void 0 : _c.includes("login"))) throw invalid("V2 login was not advertised.");
|
|
1342
1346
|
if (!onlyKeys(payload, ["action_id", "tenant_id", "patient_id", "token", "run_secret", "identity_proof", "turn_id", "previous_turn_id"]) || !uuid(payload.action_id) || payload.previous_turn_id === null || payload.tenant_id !== __privateGet(this, _options).tenantId || !identity(payload.patient_id) || payload.run_secret !== __privateGet(this, _options).run.run_secret || typeof payload.token !== "string" || !payload.token || payload.token.length > 4096 || typeof payload.identity_proof !== "string" || !payload.identity_proof || payload.identity_proof.length > 2048) throw invalid("Invalid V2 binding command.");
|
|
1343
1347
|
} else if (command.type === "action_result") {
|
|
1344
1348
|
if (!onlyKeys(payload, ["action_id", "status", "data", "operation", "turn_id", "previous_turn_id"]) || !uuid(payload.action_id) || payload.previous_turn_id === null || !["completed", "cancelled", "failed"].includes(payload.status) || !record(payload.data)) throw invalid("Invalid V2 action command.");
|
|
1345
1349
|
const data = payload.data;
|
|
1346
1350
|
if ("proposal_id" in data) {
|
|
1347
|
-
if (!((
|
|
1351
|
+
if (!((_e = (_d = __privateGet(this, _options).capabilities) == null ? void 0 : _d.supported_actions) == null ? void 0 : _e.includes("confirm"))) throw invalid("V2 confirmation was not advertised.");
|
|
1348
1352
|
if (__privateGet(this, _options).run.protocol !== "dbos_signin_booking_v1" || !onlyKeys(data, ["proposal_id", "approved"]) || !uuid(data.proposal_id) || ![void 0, "confirm", "status"].includes(payload.operation) || (payload.operation === "status" ? payload.status !== "completed" || data.approved !== null : typeof data.approved !== "boolean" || payload.status !== "completed" && data.approved)) throw invalid("Invalid V2 booking result.");
|
|
1349
|
-
} else if (!((
|
|
1353
|
+
} else if (!((_g = (_f = __privateGet(this, _options).capabilities) == null ? void 0 : _f.supported_actions) == null ? void 0 : _g.includes("slot_picker")) || !["dbos_signin_actions_v1", "dbos_signin_booking_v1", "dbos_signin_cta_v1"].includes(__privateGet(this, _options).run.protocol) || payload.operation !== void 0 || (payload.status === "completed" ? !onlyKeys(data, ["slot_id"]) || typeof data.slot_id !== "string" || !data.slot_id.length || data.slot_id.length > 256 : Object.keys(data).length > 0)) {
|
|
1350
1354
|
throw invalid("Invalid V2 slot result.");
|
|
1351
1355
|
}
|
|
1352
1356
|
} else throw invalid("Unsupported V2 command.");
|