@procedures/client 0.22.1 → 0.24.0
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/CHANGELOG.md +43 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/browser.d.ts +2 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +2 -0
- package/dist/browser.js.map +1 -1
- package/dist/client/client.d.ts +10 -3
- package/dist/client/client.d.ts.map +1 -1
- package/dist/client/client.js +14 -2
- package/dist/client/client.js.map +1 -1
- package/dist/procedures/envelope.d.ts +119 -0
- package/dist/procedures/envelope.d.ts.map +1 -0
- package/dist/procedures/envelope.js +371 -0
- package/dist/procedures/envelope.js.map +1 -0
- package/dist/procedures/index.d.ts +2 -0
- package/dist/procedures/index.d.ts.map +1 -1
- package/dist/procedures/index.js +2 -0
- package/dist/procedures/index.js.map +1 -1
- package/dist/server/procedure-server.d.ts +13 -1
- package/dist/server/procedure-server.d.ts.map +1 -1
- package/dist/server/procedure-server.js +16 -2
- package/dist/server/procedure-server.js.map +1 -1
- package/dist/server/types.d.ts +11 -0
- package/dist/server/types.d.ts.map +1 -1
- package/dist/server/types.js.map +1 -1
- package/package.json +1 -1
- package/src/browser.ts +9 -0
- package/src/client/client.ts +17 -4
- package/src/procedures/envelope.ts +468 -0
- package/src/procedures/index.ts +4 -0
- package/src/server/procedure-server.ts +23 -3
- package/src/server/types.ts +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,48 @@
|
|
|
1
1
|
# @procedures/client
|
|
2
2
|
|
|
3
|
+
## 0.24.0
|
|
4
|
+
|
|
5
|
+
No changes in this release.
|
|
6
|
+
|
|
7
|
+
## 0.23.0
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- f20beb1: The task store of an MCP host gives each client a fair share of its tasks (CLI-69). Before, the sessions of one client could fill the store (CLI-51). Then each other client got `TASKS_FULL` until those tasks ended their time.
|
|
12
|
+
|
|
13
|
+
MINOR: a breaking change before 1.0. Near the limit, the store refuses a client with its share or more, also when the store has free slots. Before, the store refused a task only when it was full (decision D13).
|
|
14
|
+
|
|
15
|
+
Changed:
|
|
16
|
+
|
|
17
|
+
- The key of a task (`shareKey`) tells its client. The default `mcpTaskShareKey` gives the principal of the request, else the session. The principal of the host token is the same for each caller, so a request with only the token gets the key of its session.
|
|
18
|
+
- The share of a client is `maxStored / (k + 1)`. `k` is the number of clients with tasks in the store, the new client included.
|
|
19
|
+
- When `reserve` slots or fewer are free, a client with its share or more gets no more tasks. Its new task replaces the oldest task of its session that ended. Without such a task, the request gets the error `-32600` with the code `TASKS_FULL`, as for a full store.
|
|
20
|
+
- A client below its share gets a task while the store has a free slot. Thus one client keeps at most `maxStored - reserve` tasks, also with many sessions.
|
|
21
|
+
- The total limit (`maxStored`, 1000 by default) and the limit of 100 tasks of a session stay as they are.
|
|
22
|
+
|
|
23
|
+
Added:
|
|
24
|
+
|
|
25
|
+
- The options `reserve`, `shareKey` and `clock` of `McpTaskStore`, and of `tasks` of `createMcpHost()` and `mcpFace()`. The default `reserve` is a tenth of `maxStored`, rounded down: 100 of 1000. `reserve: 0` turns the fair share off.
|
|
26
|
+
- `mcpTaskShareKey`, and the types `McpTaskShareContext` and `McpTaskCaller`. `createTask` of the store takes the caller as its fifth argument.
|
|
27
|
+
- `MCP_TASK_LIMITS.reserveDivisor`: 10.
|
|
28
|
+
- `identify(credentials)` of `ProcedureServer`, and the optional `identify` of `RequestHandler`. It gives the principal of a request before a call, from the checks of each call. The face handler of the procedures host and the narrowed handler of `mcpFace()` give it too. The MCP face uses it for the key of a task. Thus the request hook and the authenticate function run one more time for each new task.
|
|
29
|
+
|
|
30
|
+
Migration:
|
|
31
|
+
|
|
32
|
+
- The site and MiniMongo: no change. They have no MCP host.
|
|
33
|
+
- Graph: no change. Its MCP hosts have no task store.
|
|
34
|
+
- jarvis: no change. Its MCP host has no tasks.
|
|
35
|
+
- polite-crawler-mcp: no change. Each request has the host token, so each session is one client. A session with 100 tasks gets fewer tasks only when ten or more sessions are near the limit. To keep the rule of CLI-51, give `new McpTaskStore({ reserve: 0 })`.
|
|
36
|
+
- A host whose clients each have many sessions under one principal: each client keeps at most `maxStored - reserve` tasks. To keep the rule of CLI-51, give `reserve: 0` in `tasks` of the host or in `new McpTaskStore()`.
|
|
37
|
+
- 71091a5: Added: the envelope form of a program (coeval, decisions D6, D9 and D10, roadmap item M7). A call is `{ "type": ["client", "add"], "value": input }`, and a reference is `{ "type": "ref", "value": ["names", "sum"] }`. The `$proc` form does not change.
|
|
38
|
+
|
|
39
|
+
- `fromEnvelopeProgram()` changes a program in the envelope form into the `$proc` form. `toEnvelopeProgram()` changes a `$proc` program into the envelope form. `isEnvelopeProgram()` tells which form a value has.
|
|
40
|
+
- `client.exec()` and `client.execStream()` accept a program in the envelope form at the root. `client.exec(program, input)` puts the fields of `input` over the input, as for a `$proc` program.
|
|
41
|
+
- The root decides the form. In an envelope program, a `$proc`, `$ref` or `$literal` object is data. In a `$proc` program, an envelope is data, as before.
|
|
42
|
+
- A call with the value `null` has no input. The header `name` gives `$name`. A ref reads only the root `names`, and `["names", "last"]` reads the step before.
|
|
43
|
+
- The envelope form has no `$when`. A program that needs `$when` keeps the `$proc` form.
|
|
44
|
+
- The section "The envelope form" of `PROGRAM-FORMAT.md` gives the mapping and the rules. The section "Open questions and known differences" is now section 12.
|
|
45
|
+
|
|
3
46
|
## 0.22.1
|
|
4
47
|
|
|
5
48
|
### Patch Changes
|