@procedures/peer 0.46.0 → 0.47.2

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 CHANGED
@@ -1,5 +1,37 @@
1
1
  # @procedures/peer
2
2
 
3
+ ## 0.47.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [0650616]
8
+ - Updated dependencies [ae1e3fd]
9
+ - Updated dependencies [f1ece74]
10
+ - @procedures/client@0.47.2
11
+
12
+ ## 0.47.1
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [f845c6d]
17
+ - @procedures/client@0.47.1
18
+
19
+ ## 0.47.0
20
+
21
+ ### Patch Changes
22
+
23
+ - e913014: Each module imports zod with `import * as z from "zod"`, not `import { z } from "zod"`. With the old form, an esbuild bundle got each locale of zod: 264 kB of minified code (esbuild metafile of the journey worker of the site). The Vite build of the site gives the same worker files with both forms. The procedure scaffolder writes the new form in `types.ts`. The API and the behavior stay the same.
24
+ - Updated dependencies [c9125a8]
25
+ - Updated dependencies [335728b]
26
+ - Updated dependencies [d987202]
27
+ - Updated dependencies [45a737f]
28
+ - Updated dependencies [d77e9e8]
29
+ - Updated dependencies [e913014]
30
+ - Updated dependencies [2f0c7b0]
31
+ - Updated dependencies [ad70c38]
32
+ - Updated dependencies [47819c6]
33
+ - @procedures/client@0.47.0
34
+
3
35
  ## 0.46.0
4
36
 
5
37
  ### Patch Changes
@@ -177,8 +209,8 @@
177
209
  - A host whose `expose`, policy or limit pattern names such a path in text uses the encoded form, for example `collections.e2e%2Etabs.*`.
178
210
  - An `mcpExclude` entry, an `expose` deny entry or a limit entry in the old raw form, for example `collections.e2e.tabs.drop`, does not match. The check compares the encoded key, so the procedure becomes visible, or the limit does not apply. Write each such entry in the encoded form, for example `collections.e2e%2Etabs.drop`.
179
211
  - A subscriber of a dotted collection uses `collectionChangeTopic(name)`. The raw topic `collections.a.b` is the topic of the partition `b` of `a`.
180
- - Graph: read the collection of a topic with `collectionTopicPartition(topic)`, not with a pattern, for example `/^collections\.([^.]+)\./`.
181
- - The site, MiniMongo and jarvis: no change, if their collection names have no `.` and no `%`.
212
+ - An app: read the collection of a topic with `collectionTopicPartition(topic)`, not with a pattern, for example `/^collections\.([^.]+)\./`.
213
+ - Other apps: no change, if their collection names have no `.` and no `%`.
182
214
 
183
215
  ### Patch Changes
184
216
 
@@ -195,7 +227,7 @@
195
227
 
196
228
  Migration:
197
229
 
198
- - The site, MiniMongo, Graph and jarvis: no change at this time. The deprecated names work until the next MINOR.
230
+ - Apps: no change at this time. The deprecated names work until the next MINOR.
199
231
  - Before the next MINOR, replace `zodAdapter<T>(schema)` with `schema`. To keep the check of a schema against a type, write `const schema: z.ZodType<T> = ...`.
200
232
  - Before the next MINOR, replace `typedAnySchema<T>()` and `outputSchema<T>()` with `typed<T>()`.
201
233
  - A parse-only object (`{ parse }`) in `zodAdapter` becomes a Standard Schema with a `~standard` property.
@@ -400,13 +432,13 @@
400
432
  - A face of your own that gives `mcpFace()` a handler of its own: give the handler `admission: (credentials) => server.admission(credentials)`.
401
433
  - An MCP client that a request hook refuses gets 401 at `initialize`. Give it valid credentials for each HTTP request.
402
434
  - The site: no change. It has no MCP host, and it used no function of `peer/security.ts`.
403
- - MiniMongo: no change. Its dev host has only the HTTP and WebSocket faces of `createProcedureHost()`. Each request of these faces had one check before.
404
- - Graph: its `mcpFace()` on the procedures host uses `graphPrincipalOf` for each HTTP request. In the accounts mode, a request without a session gets `ANONYMOUS`. Thus an MCP client without a session gets no 401 at `initialize`.
405
- - Graph: in the mode `on` (`AUTH_MODE=on`), a request without a tenant token gets 401 at `initialize`. Before, the client opened a session and listed the tools, and each tool call got `UNAUTHORIZED`.
406
- - Graph: accounts that are not ready (the error `UNAVAILABLE` of the hook) give 401 at `initialize`, with `WWW-Authenticate: Bearer`. Before, `initialize` passed, and each tool call got `UNAUTHORIZED`. An MCP client can start its OAuth discovery on this 401.
407
- - Graph: outside the accounts mode, the policy has `allowedOrigins: "*"`. The MCP face takes it, as the HTTP face does. A request with a cookie still needs a named origin. With the default `ambientCredentials: "always"` of its request hook, `"*"` permits no other origin.
408
- - Graph: to keep only the own origin on the MCP face, give `mcpFace({ allowedOrigins: [] })`. Its MCP host over stdio has no change.
409
- - jarvis: no change. Its procedures host has only the HTTP face, and its MCP host has only stdio and SDK faces.
435
+ - An app: no change. Its dev host has only the HTTP and WebSocket faces of `createProcedureHost()`. Each request of these faces had one check before.
436
+ - An app: its `mcpFace()` on the procedures host uses a session hook for each HTTP request. In the accounts mode, a request without a session gets `ANONYMOUS`. Thus an MCP client without a session gets no 401 at `initialize`.
437
+ - An app: in the mode `on` (`AUTH_MODE=on`), a request without a tenant token gets 401 at `initialize`. Before, the client opened a session and listed the tools, and each tool call got `UNAUTHORIZED`.
438
+ - An app: accounts that are not ready (the error `UNAVAILABLE` of the hook) give 401 at `initialize`, with `WWW-Authenticate: Bearer`. Before, `initialize` passed, and each tool call got `UNAUTHORIZED`. An MCP client can start its OAuth discovery on this 401.
439
+ - An app: outside the accounts mode, the policy has `allowedOrigins: "*"`. The MCP face takes it, as the HTTP face does. A request with a cookie still needs a named origin. With the default `ambientCredentials: "always"` of its request hook, `"*"` permits no other origin.
440
+ - An app: to keep only the own origin on the MCP face, give `mcpFace({ allowedOrigins: [] })`. Its MCP host over stdio has no change.
441
+ - An app: no change. Its procedures host has only the HTTP face, and its MCP host has only stdio and SDK faces.
410
442
  - `mark mcp --http --token` and `@procedures/mcp-dev-tools`: no change for a client. The token is the token of the server, and the server checks each HTTP request one time.
411
443
 
412
444
  ### Patch Changes
@@ -485,9 +517,9 @@
485
517
  - A script that starts `mark server create` as a server in the foreground: start `mark --server` or `procedure-server` in its place.
486
518
  - A program that calls `run()`, `main()` or `executeArgs()` of `@procedures/mark`: no change. It keeps its process. Give `ownsProcess: true` to give the process to the runner, as the bin does.
487
519
  - The site: no change. It does not start `mark`.
488
- - MiniMongo: no change. Its dev host starts through `runProcedureHost()`, not through `mark`.
489
- - Graph: no change. It does not start `mark`.
490
- - jarvis: no change, unless a script of jarvis reads the exit code of an interrupted `mark` command. Then apply the first step.
520
+ - An app: no change. Its dev host starts through `runProcedureHost()`, not through `mark`.
521
+ - An app: no change. It does not start `mark`.
522
+ - An app: no change, unless one of its scripts reads the exit code of an interrupted `mark` command. Then apply the first step.
491
523
  - @procedures/client@0.24.0
492
524
 
493
525
  ## 0.23.0
@@ -515,9 +547,9 @@
515
547
 
516
548
  Migration:
517
549
 
518
- - The site and MiniMongo: no change. They have no MCP host.
519
- - Graph: no change. Its MCP hosts have no task store.
520
- - jarvis: no change. Its MCP host has no tasks.
550
+ - The site and an app: no change. They have no MCP host.
551
+ - An app: no change. Its MCP hosts have no task store.
552
+ - An app: no change. Its MCP host has no tasks.
521
553
  - 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 })`.
522
554
  - 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()`.
523
555
  - Updated dependencies [f20beb1]
@@ -599,7 +631,7 @@
599
631
 
600
632
  Deprecated: at the timeout of 15 s, `server.start` gives `success: true` with the message "still loading" while the process still starts. From the next MINOR of the client group, a start that is not ready at the timeout gives `success: false`, with the PID of the process that still starts. Read the readiness probe or `mark server status` for the state.
601
633
 
602
- The site, MiniMongo, Graph and jarvis: no change. A host with a listener now also answers the paths under `/_probes`. Before, these paths got 404.
634
+ Apps: no change. A host with a listener now also answers the paths under `/_probes`. Before, these paths got 404.
603
635
  - @procedures/client@0.17.3
604
636
 
605
637
  ## 0.17.2
@@ -657,7 +689,7 @@
657
689
  principalOf,
658
690
  limits: [
659
691
  {
660
- name: "graph.writes",
692
+ name: "app.writes",
661
693
  key: { claim: "tenant" },
662
694
  covers: { writes: true },
663
695
  policy: { type: "sliding-window", limit: { value: 120, unit: "count" }, window: { value: 1, unit: "min" } },
@@ -734,9 +766,9 @@
734
766
  - A caller that finds a cut by the code `INTERNAL_ERROR`: look for `UNAVAILABLE` in its place. Do not retry the call when `retryable` is false.
735
767
  - A handler that throws `UNAVAILABLE` with `retryable: false`: its HTTP status is 500 in place of 503. Without the flag, the error is retryable and gets 503. A retry middleware then sends the call again, so give `retryable: false` when the call can have had its effect.
736
768
  - The site: no change is necessary. Its code does not read the code of a cut, or the HTTP status 503.
737
- - MiniMongo: no change is necessary. Its code does not read `INTERNAL_ERROR`, `UNAVAILABLE` or the severity of an error.
738
- - The procedures host of Graph (GRAPH-11): no change is necessary. Its code does not read `INTERNAL_ERROR`. Its error "the server has no AGENT_TOKEN" is `UNAVAILABLE` with `retryable: false`, so its HTTP status is 500 in place of 503. No code of Graph reads that status.
739
- - jarvis: no change is necessary. Its drain test already expects `UNAVAILABLE` with `retryable: false` for a cut procedure call (S6 A12). Its code reads only `NOT_FOUND` and `FORBIDDEN`.
769
+ - An app: no change is necessary. Its code does not read `INTERNAL_ERROR`, `UNAVAILABLE` or the severity of an error.
770
+ - The procedures host of an app (APP-11): no change is necessary. Its code does not read `INTERNAL_ERROR`. Its error "the server has no AGENT_TOKEN" is `UNAVAILABLE` with `retryable: false`, so its HTTP status is 500 in place of 503. No code of the app reads that status.
771
+ - An app: no change is necessary. Its drain test already expects `UNAVAILABLE` with `retryable: false` for a cut procedure call (S6 A12). Its code reads only `NOT_FOUND` and `FORBIDDEN`.
740
772
  - The `mark` CLI and `procedure-server`: no change is necessary. The lifecycle test of CI-2 expects `UNAVAILABLE` for the cut of `lifecycle.ticksOnce`.
741
773
 
742
774
  ### Patch Changes
@@ -782,10 +814,10 @@
782
814
  - A host with an `expose` rule must list the collection procedures that it serves, for example `collections.notes.*`. `host.*` and `events.subscribe` stay always on.
783
815
  - An app that pins its own procedures with `registerProcedures()` on a server with an expose rule: list them in the rule. Give `{ alwaysOn: true }` only to a procedure of the host itself.
784
816
  - The site: no change is necessary. Its servers have no expose rule.
785
- - MiniMongo: no change is necessary. Its server has an expose rule, but it pins no procedure and serves no collection.
817
+ - An app: no change is necessary. Its server has an expose rule, but it pins no procedure and serves no collection.
786
818
  - The `mark` CLI and `procedure-server`: no change is necessary. They serve no collection, and `--expose` keeps `host.*` and `events.subscribe` on.
787
- - jarvis: no change is necessary. Its host has no expose rule.
788
- - The procedures host of Graph (GRAPH-11): no change is necessary. Its rule `["collections.*", "graph.*"]` lists the collection procedures. To hide `clear`, an `exclude` of the policy now has an effect.
819
+ - An app: no change is necessary. Its host has no expose rule.
820
+ - The procedures host of an app (APP-11): no change is necessary. Its rule `["collections.*", "app.*"]` lists the collection procedures. To hide `clear`, an `exclude` of the policy now has an effect.
789
821
 
790
822
  ### Patch Changes
791
823
 
@@ -804,7 +836,7 @@
804
836
 
805
837
  - 9fccd90: `createProcedureHost()` has the new option `controller` (server stack CLI-45). `controller.requires` names the dependencies of the service that each call of the host needs. `host.controllers` gives them, and `host.declare(svc)` declares them on the controller of the host. While a check of one of them fails readiness, the service refuses each call with `UNAVAILABLE`, which a caller can send again. Without the option, the controller needs no dependency, as before.
806
838
 
807
- jarvis needs this option: its procedure calls need its world store.
839
+ An app needs this option: its procedure calls need its world store.
808
840
  - Updated dependencies [b89e3fe]
809
841
  - @procedures/client@0.12.1
810
842
 
@@ -833,7 +865,7 @@
833
865
 
834
866
  Migration steps:
835
867
 
836
- - The site, MiniMongo, Graph and jarvis: no change is necessary. They do not start these entries.
868
+ - Apps: no change is necessary. They do not start these entries.
837
869
  - A script that starts `procedure-server` or `mark serve` and stops it with a signal: no change is necessary. Wait for the exit, in 10 s at most.
838
870
  - A program that embeds the server outside a service: use `startServer()`, which starts it as a peer, and `peer.stop()`.
839
871
 
@@ -874,9 +906,9 @@
874
906
 
875
907
  Migration steps:
876
908
 
877
- - The site and MiniMongo: no change is necessary, unless they read `/health` of a peer. Then call `host.info` with the token.
878
- - The MCP host of Graph: no change is necessary. To share the port of the Graph host, mount `mcpFace()` on its listener.
879
- - jarvis and Graph under `run()`: build the procedures with `createProcedureHost()`, and call `host.declare(svc)` in the service of the process. Give `listen` for a port of the host, or mount `host.handler` and `host.upgrade` on the listener of the app.
909
+ - The site and an app: no change is necessary, unless they read `/health` of a peer. Then call `host.info` with the token.
910
+ - The MCP host of an app: no change is necessary. To share the port of its procedures host, mount `mcpFace()` on its listener.
911
+ - Apps under `run()`: build the procedures with `createProcedureHost()`, and call `host.declare(svc)` in the service of the process. Give `listen` for a port of the host, or mount `host.handler` and `host.upgrade` on the listener of the app.
880
912
  - A caller of `createPeer()` with a different token for each transport: give one token.
881
913
  - A Docker `HEALTHCHECK` or a probe of Kubernetes that read `/health` of a peer: use the probes of the service. Give the service `probeServer({ port, server_retry_after })` on a port of its own, or mount `probeHandler(health, { prefix: "/health" })` on the port of the app. Both come from `@mark1russell7/service/http`, and they answer `/health/startup`, `/health/readiness` and `/health/liveness`. The lockfile check of a client calls `host.info` with the token of the lockfile.
882
914
  - A test that read `/health` of a peer: call `host.info` with the token, or check the status 404.
@@ -959,7 +991,7 @@
959
991
 
960
992
  ### Patch Changes
961
993
 
962
- - 389b054: A token check no longer tells the length of the token through its time. The peer compares the SHA-256 digests of the two tokens with `timingSafeEqual`. The `tokenMatches` of the client, which runs in a browser too, compares each character of the expected token for each presented token. Before, a token of another length returned at once. The re-audit of jarvis found it.
994
+ - 389b054: A token check no longer tells the length of the token through its time. The peer compares the SHA-256 digests of the two tokens with `timingSafeEqual`. The `tokenMatches` of the client, which runs in a browser too, compares each character of the expected token for each presented token. Before, a token of another length returned at once. A re-audit found it.
963
995
  - Updated dependencies [841d083]
964
996
  - Updated dependencies [389b054]
965
997
  - @procedures/client@0.7.0
package/README.md CHANGED
@@ -174,7 +174,7 @@ import { createProcedureHost, httpFace, wsFace, LOCAL_LISTENER_KNOBS } from "@pr
174
174
 
175
175
  const read = {
176
176
  narrowing: { effects: { writes: [] } },
177
- expose: ["programs.list", "programs.get", "procedure.get", "client.trace", "graphapi.*"],
177
+ expose: ["programs.list", "programs.get", "procedure.get", "client.trace", "api.*"],
178
178
  };
179
179
  const host = createProcedureHost({
180
180
  registry,