@xema/omni-protocol 0.1.129 → 0.1.131
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/GLOSSARY.md +2 -2
- package/README.md +6 -8
- package/dist/index.d.ts +145 -94
- package/dist/index.js +27 -12
- package/dist/testing.d.ts +18 -18
- package/dist/testing.js +89 -92
- package/dist/validation.d.ts +23 -23
- package/dist/validation.js +178 -125
- package/guide/agent.md +34 -34
- package/guide/breaks.md +1 -1
- package/guide/lead.md +34 -17
- package/guide/phone.md +22 -22
- package/guide/queue.md +7 -7
- package/guide/voice.md +64 -54
- package/guide.md +168 -148
- package/package.json +1 -1
package/dist/validation.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare function ruleTested(...rules: readonly string[]): void;
|
|
|
18
18
|
export declare function validateContact(contact: unknown, levels: readonly string[], path?: string): ProtocolViolation[];
|
|
19
19
|
export declare function validateScheduledActivity(activity: unknown, levels: readonly string[], path?: string): ProtocolViolation[];
|
|
20
20
|
/**
|
|
21
|
-
* The host's choice of phone for a
|
|
21
|
+
* The host's choice of phone for a session, held to the manifest: one the platform listed, required
|
|
22
22
|
* on voice, absent elsewhere.
|
|
23
23
|
*/
|
|
24
24
|
export declare function validatePhone(value: unknown, manifest: unknown, path?: string): ProtocolViolation[];
|
|
@@ -28,7 +28,7 @@ export declare function validateProviderTimeEstimate(value: unknown, scope: unkn
|
|
|
28
28
|
export declare function validateProviderTimeCheckPolicy(value: unknown, path?: string): ProtocolViolation[];
|
|
29
29
|
export declare function validateProviderTimeCheckRequest(value: unknown, path?: string): ProtocolViolation[];
|
|
30
30
|
/** Checks response shape/correlation, not source-clock accuracy, round-trip delay or freshness. */
|
|
31
|
-
export declare function validateProviderTimeCheckResult(value: unknown, request: unknown,
|
|
31
|
+
export declare function validateProviderTimeCheckResult(value: unknown, request: unknown, sessionId: string, path?: string): ProtocolViolation[];
|
|
32
32
|
export declare function validateManifest(manifest: unknown, path?: string): ProtocolViolation[];
|
|
33
33
|
/** The agent's languages, as a host states them on both contexts: BCP 47 tags, most preferred first, at least one. */
|
|
34
34
|
export declare function validateLanguages(value: unknown, path?: string): ProtocolViolation[];
|
|
@@ -46,7 +46,7 @@ export interface TaskValidationContext {
|
|
|
46
46
|
/** Whether the manifest declares the `calendar` idle capability. A task that may schedule needs it to; absent, the question is not asked. */
|
|
47
47
|
calendarDeclared?: boolean;
|
|
48
48
|
/**
|
|
49
|
-
* The values the queue locked on this
|
|
49
|
+
* The values the queue locked on this session's tasks -- a party's number or email -- as whoever
|
|
50
50
|
* runs the validator knows them. Where a task's party stands locked, no other field of it may
|
|
51
51
|
* carry one of these. Unknown to a host, which never sees the value, and then unchecked.
|
|
52
52
|
*/
|
|
@@ -64,7 +64,7 @@ export declare function validateBreakStatus(state: unknown, tasks: unknown, path
|
|
|
64
64
|
/**
|
|
65
65
|
* Checks a lead command before dispatch, against the current authentication, transport and team
|
|
66
66
|
* member list (`team`) and, for force-break and end-forced-break, the target's full `memberBreak`.
|
|
67
|
-
* The authority is the
|
|
67
|
+
* The authority is the lead capability the command needs, on the session's `lead`; the provider rechecks the target and the state
|
|
68
68
|
* atomically, since a team member list is not authority to act after it has changed.
|
|
69
69
|
*/
|
|
70
70
|
export declare function validateTeamCommand(request: unknown, context: unknown, path?: string): ProtocolViolation[];
|
|
@@ -77,7 +77,7 @@ export type BreakMethod = "requestBreak" | "commitBreak" | "cancelBreak" | "endB
|
|
|
77
77
|
*/
|
|
78
78
|
export declare function validateBreakCommand(method: BreakMethod, request: unknown, state: unknown, context: unknown, path?: string): ProtocolViolation[];
|
|
79
79
|
/**
|
|
80
|
-
* Checks two complete break states within one provider/
|
|
80
|
+
* Checks two complete break states within one provider/session's ordered event stream.
|
|
81
81
|
* Call before replacing accepted state; report violations and reconcile on failure.
|
|
82
82
|
* This is not a freshness check: validate a fresh authoritative snapshot separately and
|
|
83
83
|
* use it as a new baseline, never as an event transition. Source ordering and connection
|
|
@@ -85,8 +85,8 @@ export declare function validateBreakCommand(method: BreakMethod, request: unkno
|
|
|
85
85
|
*/
|
|
86
86
|
export declare function validateBreakTransition(before: unknown, after: unknown, path?: string): ProtocolViolation[];
|
|
87
87
|
/**
|
|
88
|
-
* Who is reading what the adapter published, and what their
|
|
89
|
-
* structure without it; given it, they also hold what the adapter publishes to the
|
|
88
|
+
* Who is reading what the adapter published, and what their capabilities include. The validators check
|
|
89
|
+
* structure without it; given it, they also hold what the adapter publishes to the session.
|
|
90
90
|
*/
|
|
91
91
|
export interface ReaderContext {
|
|
92
92
|
/**
|
|
@@ -95,16 +95,16 @@ export interface ReaderContext {
|
|
|
95
95
|
*/
|
|
96
96
|
self?: UserId;
|
|
97
97
|
/**
|
|
98
|
-
* The
|
|
99
|
-
* snapshot carries a team member list, nobody else's does
|
|
98
|
+
* The user's `AuthenticationState.capabilities`, for the session. They are the permission: a lead's
|
|
99
|
+
* snapshot carries a team member list, and nobody else's does.
|
|
100
100
|
*/
|
|
101
101
|
capabilities?: UserCapabilities;
|
|
102
102
|
/** The level ids the manifest declares. `validateSnapshot` and `validateEventEnvelope` take them from the manifest unless given. */
|
|
103
103
|
levels?: readonly string[];
|
|
104
|
-
/** The
|
|
105
|
-
|
|
104
|
+
/** The session's `sessionId`. A snapshot or event naming another belongs to a session that is gone. */
|
|
105
|
+
sessionId?: string;
|
|
106
106
|
/**
|
|
107
|
-
* The phone the host chose for this
|
|
107
|
+
* The phone the host chose for this session at connect, `ConnectContext.phone`. A phone state
|
|
108
108
|
* naming another is the wrong phone. Unknown to a caller without the context, and then unchecked.
|
|
109
109
|
*/
|
|
110
110
|
phone?: Phone;
|
|
@@ -117,7 +117,7 @@ export interface ReaderContext {
|
|
|
117
117
|
/** The provider's channel, for a member's task that states none. Filled from the manifest by `validateSnapshot` and `validateEventEnvelope`. */
|
|
118
118
|
channel?: Channel;
|
|
119
119
|
/**
|
|
120
|
-
* The values the queue locked on this
|
|
120
|
+
* The values the queue locked on this session's tasks, as whoever runs the validator knows them:
|
|
121
121
|
* a conformance run states them, a host never has them. Where a task's party stands locked, no
|
|
122
122
|
* other field of it may carry one (`task.locked.leak`). Absent, unchecked.
|
|
123
123
|
*/
|
|
@@ -141,14 +141,14 @@ export declare function validateLinedUp(value: unknown, levels: readonly string[
|
|
|
141
141
|
/** The phone as the platform sees it: the agent's device for this provider, whether it can take a call, its own mute where observed. */
|
|
142
142
|
export declare function validatePhoneState(value: unknown, path?: string, context?: ReaderContext): ProtocolViolation[];
|
|
143
143
|
/**
|
|
144
|
-
* What pressing Mute does on this host, stated on a softphone
|
|
144
|
+
* What pressing Mute does on this host, stated on a softphone session and nowhere else: on an agent computer
|
|
145
145
|
* phone the microphone is the phone's, and off voice there is none. Neither the value nor its
|
|
146
146
|
* absence is inferred from what kind of application the host is.
|
|
147
147
|
*/
|
|
148
148
|
/** What the host states as capacity: a whole number, zero or more, zero being host-stopped. */
|
|
149
149
|
export declare function validateCapacity(capacity: unknown, path?: string): ProtocolViolation[];
|
|
150
|
-
/** The
|
|
151
|
-
export declare function
|
|
150
|
+
/** The session's store, which the host provides on every connection: three functions, and nothing else is a store. */
|
|
151
|
+
export declare function validateSessionStore(store: unknown, path?: string): ProtocolViolation[];
|
|
152
152
|
export declare function validateHostMute(mute: unknown, softphone: boolean, path?: string): ProtocolViolation[];
|
|
153
153
|
/**
|
|
154
154
|
* What a host promises. Presence is the guarantee, so a key declared `false` is refused: a
|
|
@@ -194,9 +194,9 @@ export declare function validateTimeZone(value: unknown, path?: string): Protoco
|
|
|
194
194
|
* answers somebody nobody asked about.
|
|
195
195
|
*/
|
|
196
196
|
export declare function validateUserDetails(users: unknown, asked: readonly string[], path?: string): ProtocolViolation[];
|
|
197
|
-
/** What a
|
|
198
|
-
export interface
|
|
199
|
-
/** The level ids the manifest declares, `Manifest.orgLevels`: a level the
|
|
197
|
+
/** What a session is validated against beyond its own shape. */
|
|
198
|
+
export interface SessionValidationContext {
|
|
199
|
+
/** The level ids the manifest declares, `Manifest.orgLevels`: a level the session names must be one of them. */
|
|
200
200
|
levels: readonly string[];
|
|
201
201
|
}
|
|
202
202
|
export declare function validateAuthenticationFailure(failure: unknown, path?: string): ProtocolViolation[];
|
|
@@ -207,12 +207,12 @@ export declare function validateAuthenticationFailure(failure: unknown, path?: s
|
|
|
207
207
|
*/
|
|
208
208
|
export declare function validateRedirectUri(value: unknown, path?: string): ProtocolViolation[];
|
|
209
209
|
/**
|
|
210
|
-
* What `start()` or `complete()` answered: a challenge or a rejection from `start`, a
|
|
211
|
-
* rejection from `complete`. A rejection carries a failure the host can show, and a
|
|
210
|
+
* What `start()` or `complete()` answered: a challenge or a rejection from `start`, a session or a
|
|
211
|
+
* rejection from `complete`. A rejection carries a failure the host can show, and a session is held
|
|
212
212
|
* to the same rules as any `authenticated` state.
|
|
213
213
|
*/
|
|
214
|
-
export declare function validateAuthenticationResult(result: unknown, method: "start" | "complete", path: string, context:
|
|
215
|
-
export declare function validateAuthenticationState(state: unknown, path: string, context:
|
|
214
|
+
export declare function validateAuthenticationResult(result: unknown, method: "start" | "complete", path: string, context: SessionValidationContext): ProtocolViolation[];
|
|
215
|
+
export declare function validateAuthenticationState(state: unknown, path: string, context: SessionValidationContext): ProtocolViolation[];
|
|
216
216
|
/**
|
|
217
217
|
* One recorder's recordings for one task, as published: each with its id, the side it follows,
|
|
218
218
|
* its status, and a reason where it is paused or unknown; ids unique, and at most one recording
|