@procedures/peer 0.47.1 → 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,14 @@
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
+
3
12
  ## 0.47.1
4
13
 
5
14
  ### Patch Changes
@@ -200,8 +209,8 @@
200
209
  - A host whose `expose`, policy or limit pattern names such a path in text uses the encoded form, for example `collections.e2e%2Etabs.*`.
201
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`.
202
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`.
203
- - Graph: read the collection of a topic with `collectionTopicPartition(topic)`, not with a pattern, for example `/^collections\.([^.]+)\./`.
204
- - 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 `%`.
205
214
 
206
215
  ### Patch Changes
207
216
 
@@ -218,7 +227,7 @@
218
227
 
219
228
  Migration:
220
229
 
221
- - 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.
222
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> = ...`.
223
232
  - Before the next MINOR, replace `typedAnySchema<T>()` and `outputSchema<T>()` with `typed<T>()`.
224
233
  - A parse-only object (`{ parse }`) in `zodAdapter` becomes a Standard Schema with a `~standard` property.
@@ -423,13 +432,13 @@
423
432
  - A face of your own that gives `mcpFace()` a handler of its own: give the handler `admission: (credentials) => server.admission(credentials)`.
424
433
  - An MCP client that a request hook refuses gets 401 at `initialize`. Give it valid credentials for each HTTP request.
425
434
  - The site: no change. It has no MCP host, and it used no function of `peer/security.ts`.
426
- - MiniMongo: no change. Its dev host has only the HTTP and WebSocket faces of `createProcedureHost()`. Each request of these faces had one check before.
427
- - 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`.
428
- - 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`.
429
- - 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.
430
- - 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.
431
- - Graph: to keep only the own origin on the MCP face, give `mcpFace({ allowedOrigins: [] })`. Its MCP host over stdio has no change.
432
- - 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.
433
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.
434
443
 
435
444
  ### Patch Changes
@@ -508,9 +517,9 @@
508
517
  - A script that starts `mark server create` as a server in the foreground: start `mark --server` or `procedure-server` in its place.
509
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.
510
519
  - The site: no change. It does not start `mark`.
511
- - MiniMongo: no change. Its dev host starts through `runProcedureHost()`, not through `mark`.
512
- - Graph: no change. It does not start `mark`.
513
- - 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.
514
523
  - @procedures/client@0.24.0
515
524
 
516
525
  ## 0.23.0
@@ -538,9 +547,9 @@
538
547
 
539
548
  Migration:
540
549
 
541
- - The site and MiniMongo: no change. They have no MCP host.
542
- - Graph: no change. Its MCP hosts have no task store.
543
- - 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.
544
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 })`.
545
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()`.
546
555
  - Updated dependencies [f20beb1]
@@ -622,7 +631,7 @@
622
631
 
623
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.
624
633
 
625
- 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.
626
635
  - @procedures/client@0.17.3
627
636
 
628
637
  ## 0.17.2
@@ -680,7 +689,7 @@
680
689
  principalOf,
681
690
  limits: [
682
691
  {
683
- name: "graph.writes",
692
+ name: "app.writes",
684
693
  key: { claim: "tenant" },
685
694
  covers: { writes: true },
686
695
  policy: { type: "sliding-window", limit: { value: 120, unit: "count" }, window: { value: 1, unit: "min" } },
@@ -757,9 +766,9 @@
757
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.
758
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.
759
768
  - The site: no change is necessary. Its code does not read the code of a cut, or the HTTP status 503.
760
- - MiniMongo: no change is necessary. Its code does not read `INTERNAL_ERROR`, `UNAVAILABLE` or the severity of an error.
761
- - 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.
762
- - 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`.
763
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`.
764
773
 
765
774
  ### Patch Changes
@@ -805,10 +814,10 @@
805
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.
806
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.
807
816
  - The site: no change is necessary. Its servers have no expose rule.
808
- - 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.
809
818
  - The `mark` CLI and `procedure-server`: no change is necessary. They serve no collection, and `--expose` keeps `host.*` and `events.subscribe` on.
810
- - jarvis: no change is necessary. Its host has no expose rule.
811
- - 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.
812
821
 
813
822
  ### Patch Changes
814
823
 
@@ -827,7 +836,7 @@
827
836
 
828
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.
829
838
 
830
- jarvis needs this option: its procedure calls need its world store.
839
+ An app needs this option: its procedure calls need its world store.
831
840
  - Updated dependencies [b89e3fe]
832
841
  - @procedures/client@0.12.1
833
842
 
@@ -856,7 +865,7 @@
856
865
 
857
866
  Migration steps:
858
867
 
859
- - 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.
860
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.
861
870
  - A program that embeds the server outside a service: use `startServer()`, which starts it as a peer, and `peer.stop()`.
862
871
 
@@ -897,9 +906,9 @@
897
906
 
898
907
  Migration steps:
899
908
 
900
- - The site and MiniMongo: no change is necessary, unless they read `/health` of a peer. Then call `host.info` with the token.
901
- - The MCP host of Graph: no change is necessary. To share the port of the Graph host, mount `mcpFace()` on its listener.
902
- - 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.
903
912
  - A caller of `createPeer()` with a different token for each transport: give one token.
904
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.
905
914
  - A test that read `/health` of a peer: call `host.info` with the token, or check the status 404.
@@ -982,7 +991,7 @@
982
991
 
983
992
  ### Patch Changes
984
993
 
985
- - 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.
986
995
  - Updated dependencies [841d083]
987
996
  - Updated dependencies [389b054]
988
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,