@xema/omni-protocol 0.1.4 → 0.1.6

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.
Files changed (3) hide show
  1. package/README.md +29 -0
  2. package/guide.md +5 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -59,6 +59,35 @@ assignments, break denial and retry, command idempotency, wrap timeout, browser
59
59
  > conforming one. A suite that only asserts "this conforming case does not throw" passes unchanged
60
60
  > if the helper is gutted, so pair every positive case with the violating twin.
61
61
 
62
+ ## Two things TypeScript will not catch for you
63
+
64
+ Both found by adapters against this contract, and both produce a green build over a wrong shape.
65
+
66
+ **Conditional spreads are the blind spot on a task literal.** A key inside
67
+ `...(cond ? { … } : {})` is never checked against the task type, and `satisfies Task<C>` on the
68
+ surrounding literal does not reach it. Put the check on the spread operand itself:
69
+
70
+ ```ts
71
+ const task = {
72
+ id, title, channel: "voice", taskType, capabilities, browsers, phase, completionMode,
73
+ ...(contact ? { contact } satisfies Partial<Task<"voice">> : {}),
74
+ };
75
+ ```
76
+
77
+ **The blind transfer arm is `action?: never`.** Switch on `command.action` with `case undefined`
78
+ for it, never a `default`: a `default` turns a future action into a silent blind transfer, and
79
+ switching on `command.action ?? "blind"` loses the narrowing that lets you read `destination`
80
+ without a cast. Dropping an arm then fails the build — indirectly, as a missing return.
81
+
82
+ ```ts
83
+ switch (command.action) {
84
+ case undefined: return blindTransfer(command.destination);
85
+ case "consult": return consultTransfer(command.destination);
86
+ case "complete": return completeConsultation();
87
+ case "cancel": return cancelConsultation();
88
+ }
89
+ ```
90
+
62
91
  ## Building
63
92
 
64
93
  ```
package/guide.md CHANGED
@@ -1673,7 +1673,7 @@ time. Runtime conformance checks also require the task channel to match its prov
1673
1673
  | `completionAllowance` | Fixed time allowed to complete the task after primary handling ends. For real-time media, it begins after `task-media-ended`. Required under `provider-automatic`, where the provider acts on it. Optional under `agent-command`: omitted says the provider imposes no deadline, and Omni counts nothing down. |
1674
1674
  | `attributes` | Optional ordered, typed `TaskAttribute` entries with keys unique within the task. Each contact or timestamp is a separate array item; new attribute shapes require new union members. |
1675
1675
  | `handlingHistory` | Optional ordered handling history for this currently open task. It is live task data, not a permanent archive. |
1676
- | `consultation` | Voice only. Present while the agent is consulting a transfer destination: who is being consulted, and since when where the provider records it. Its presence is what makes `transfer` `complete` and `cancel` issuable. See **Consult transfer**. |
1676
+ | `consultation` | Voice only. Present while the agent is consulting a transfer destination: who is being consulted, and since when where the provider records it. Its presence is what makes `transfer` `complete` and `cancel` issuable. `label` is a name for the destination -- a person, a queue -- not a phrase; the host supplies the verb. See **Consult transfer**. |
1677
1677
  | `lead` | Voice only. Present from the agent's request for a lead until the lead leaves or the request ends: `requested` while nobody has joined, `joined` with the lead's `leadId` once somebody has. See **Consulting a lead**. |
1678
1678
  | `assisting` | Voice only, on the lead's own task for a call they joined: which member asked, with their note. Its presence is what makes `lead` `take-over` and `leave` issuable. See **Consulting a lead**. |
1679
1679
 
@@ -2630,6 +2630,10 @@ trigger it; but from then on it is an outstanding task the provider counts again
2630
2630
  stated ceiling like any other, nothing more is allocated to the lead while it stands, and a
2631
2631
  provider whose lead is already at the ceiling answers the join `failed`.
2632
2632
 
2633
+ **A lead assists one call at a time.** A `join` from a lead already on a call -- their own or one
2634
+ they joined -- is answered `failed`, whatever their ceiling; the request stands for another lead,
2635
+ or until it is withdrawn or declined.
2636
+
2633
2637
  **On `decline`, or a request the agent withdraws with `{ type: "lead", action: "cancel" }`, the
2634
2638
  provider clears `lead` from the agent's task** and drops the request from every roster. Nothing
2635
2639
  else changes; the agent is still on the call.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xema/omni-protocol",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "The Omni protocol: the contract every provider adapter implements",
5
5
  "type": "module",
6
6
  "license": "MIT",