@xema/omni-protocol 0.1.64 → 0.1.65
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/dist/testing.js +15 -0
- package/guide.md +1 -1
- package/package.json +1 -1
package/dist/testing.js
CHANGED
|
@@ -1026,14 +1026,26 @@ async function driveOneCall(drive) {
|
|
|
1026
1026
|
// A task's keys are gone with the task. A task-scoped key carries the task id, so the watched
|
|
1027
1027
|
// store says which keys were the task's; one still held after task-ended is a key about to be
|
|
1028
1028
|
// inherited by the next offer of the same id, since a platform retires an id minutes after closing it.
|
|
1029
|
+
let retainedAtEnd;
|
|
1029
1030
|
const storeReleased = async () => {
|
|
1030
1031
|
await Promise.resolve();
|
|
1031
1032
|
await Promise.resolve();
|
|
1032
1033
|
const retained = [...drive.held].filter(key => key.includes(taskId));
|
|
1034
|
+
retainedAtEnd = new Set(retained);
|
|
1033
1035
|
if (retained.length > 0) {
|
|
1034
1036
|
refuse("drive.store.retained", "drive.store", `${taskId} has ended and the login's store still holds ${retained.join(", ")}: a task's keys go with the task, or the next offer of the same id inherits them`);
|
|
1035
1037
|
}
|
|
1036
1038
|
};
|
|
1039
|
+
// A key written about the task after its end -- a persist hung off a timer, a late command -- is the
|
|
1040
|
+
// same hazard arriving later, so the store is read once more when the drive is done.
|
|
1041
|
+
const nothingLate = () => {
|
|
1042
|
+
if (retainedAtEnd === undefined)
|
|
1043
|
+
return;
|
|
1044
|
+
const late = [...drive.held].filter(key => key.includes(taskId) && !retainedAtEnd.has(key));
|
|
1045
|
+
if (late.length > 0) {
|
|
1046
|
+
refuse("drive.store.late", "drive.store", `${taskId} had ended with its keys gone, and the login's store now holds ${late.join(", ")}: something wrote about the task after its end`);
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1037
1049
|
// The task, as first seen: on the snapshot, or on the first offer.
|
|
1038
1050
|
let cursor = 0;
|
|
1039
1051
|
let task = isRecord(drive.snapshot) && Array.isArray(drive.snapshot.tasks) ? drive.snapshot.tasks.find(isTask) : undefined;
|
|
@@ -1260,6 +1272,9 @@ async function driveOneCall(drive) {
|
|
|
1260
1272
|
}
|
|
1261
1273
|
}
|
|
1262
1274
|
}
|
|
1275
|
+
// A timer fires after the microtasks: one turn of the loop is what a late persist needs to show itself.
|
|
1276
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
1277
|
+
nothingLate();
|
|
1263
1278
|
return found;
|
|
1264
1279
|
}
|
|
1265
1280
|
// A request goes not-requested -> awaiting-decision | granted; a commit goes granted ->
|
package/guide.md
CHANGED
|
@@ -1946,7 +1946,7 @@ Creates one live provider connection for the signed-in agent.
|
|
|
1946
1946
|
| `autoAcceptTasks` | Agent provisioning policy relayed to the provider at login. Treated as `true` when omitted. When `true`, a pending task states its `acceptance`; when `false`, every task requires agent acceptance. Fixed for this connection, like everything else here: the provider states or omits `acceptance` by the value it was sent, and Omni validates by that same value, not by a policy that has since moved — a change reaches the provider through a fresh `connect()`. |
|
|
1947
1947
|
| `timeZone` | The same value passed as `AuthenticationContext.timeZone`. The provider stores it on the agent and carries it on the identity. See **The agent's day**. |
|
|
1948
1948
|
| `phone` | The same value passed as `AuthenticationContext.phone`: how this login hears its calls. The type ties `host.mute` to it: a `softphone` login's host states what its Mute does, and a desk-phone or conversation login's host cannot, so the omission is a compile error rather than a live seat's discovery. See **The station is the host's**. |
|
|
1949
|
-
| `store` | The login's operational store, kept by the host for the life of the login, across a reload of the host, and cleared at sign-out: where an adapter that composes a record keeps what its platform cannot hold for it, such as the handling legs a host reported. Three functions, by key. Never for anything sensitive, which is `AuthenticationContext.secrets`, a store a host may clear aggressively. **A task's keys carry the task id and go with the task**: a key written about a task names the task's id in the key, and is deleted before the task's end is published, because a platform retires a task id minutes after closing it and a requeue takes seconds, so a key that outlives its task is inherited by the next offer of the same id -- a record with legs the host never reported against it. A login-scoped key carries no task id and outlives any task. The harness requires the store of every connection (`store.shape`, `store.get`, `.set`, `.delete`), watches the one it hands over, and names a task's key still held after `task-ended` (`drive.store.retained`); an adapter that names no task in its keys gets no cleanup check, which is a gap rather than a pass, never an exemption: the obligation is that nothing of a closed task survives its ending, and an adapter that keeps every open task in one login-scoped value owes exactly that inside the value, where the harness cannot look. One key per task, named for it, is the shape the harness can hold, and the shape to reach for. The store lists nothing, so an adapter that needs to find its tasks keeps a login-scoped index of ids beside them; at the task's end it deletes the body first and reindexes after, since a crash between the two then leaves an index naming a task with no body, which a reader skips, where the other order leaves a body for a task that has ended, which is the hazard itself. A reader of the index tolerates an id with no body as an ending that was underway, not as corruption. |
|
|
1949
|
+
| `store` | The login's operational store, kept by the host for the life of the login, across a reload of the host, and cleared at sign-out: where an adapter that composes a record keeps what its platform cannot hold for it, such as the handling legs a host reported. Three functions, by key. Never for anything sensitive, which is `AuthenticationContext.secrets`, a store a host may clear aggressively. **A task's keys carry the task id and go with the task**: a key written about a task names the task's id in the key, and is deleted before the task's end is published, because a platform retires a task id minutes after closing it and a requeue takes seconds, so a key that outlives its task is inherited by the next offer of the same id -- a record with legs the host never reported against it. A login-scoped key carries no task id and outlives any task. The harness requires the store of every connection (`store.shape`, `store.get`, `.set`, `.delete`), watches the one it hands over, and names a task's key still held after `task-ended` (`drive.store.retained`) or written about the task after its end -- a persist hung off a timer that saw the task as it was (`drive.store.late`). The ordinary late write is the host's, not the adapter's: a host reports a leg without waiting for the answer, so an unmute can follow `complete` by a tick, and the adapter answers a report about a task that has ended `failed` with `omni.task-not-found` and writes nothing -- the host ends its own open legs at the task's end, so such a report is the host's error to see, never a record to keep; an adapter that names no task in its keys gets no cleanup check, which is a gap rather than a pass, never an exemption: the obligation is that nothing of a closed task survives its ending, and an adapter that keeps every open task in one login-scoped value owes exactly that inside the value, where the harness cannot look. One key per task, named for it, is the shape the harness can hold, and the shape to reach for. The store lists nothing, so an adapter that needs to find its tasks keeps a login-scoped index of ids beside them; at the task's end it deletes the body first and reindexes after, since a crash between the two then leaves an index naming a task with no body, which a reader skips, where the other order leaves a body for a task that has ended, which is the hazard itself. A reader of the index tolerates an id with no body as an ending that was underway, not as corruption. |
|
|
1950
1950
|
| `host` | The host's report of the agent's station — devices, permissions, network — to consult before declaring the agent ready to the platform, and on every change. See **The host reports, the adapter decides**. |
|
|
1951
1951
|
| `signal` | Optional cancellation signal. Stop startup promptly when aborted and do not begin new work. |
|
|
1952
1952
|
| `log` | Optional structured logging callback. Never include credentials, tokens, or sensitive contact data. |
|