@raybase/create 0.3.25 → 0.3.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raybase/create",
3
- "version": "0.3.25",
3
+ "version": "0.3.27",
4
4
  "description": "Scaffold secure internal apps powered by Raybase.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -353,9 +353,10 @@ Repeatable handlers must be safe when they run late or more than once:
353
353
  and schedule visibility before handing off.
354
354
  - Each failed attempt, and each run that ends failed without one (its lease
355
355
  expired, or it was denied), also logs `console.error("raybase.job.failed",
356
- { job, runId, organizationId, attempt, maxAttempts, retry, partitionKey })`
357
- for the Worker's logs and a host's tail events (`organizationId` is the
358
- run's scope, `"default"` in Core; `partitionKey` is the run's host
356
+ { job, runId, organizationId, reason, attempt, maxAttempts, retry,
357
+ partitionKey })` for the Worker's logs and a host's tail events (`reason`
358
+ is `threw`, `denied` or `lease_expired`; `organizationId` is the run's
359
+ scope, `"default"` in Core; `partitionKey` is the run's host
359
360
  partition, null for app-level work). It never includes the input; set
360
361
  `appConfig.jobs.logFailureMessages: true` only if the error messages hold
361
362
  nothing private, since that adds them as `error`.
@@ -662,15 +663,18 @@ export const jobs = {
662
663
  reaches the dead-letter queue.
663
664
  - A run counts toward its limits while its lease is live. The lease is the
664
665
  job's `leaseDuration`, else `appConfig.jobs.leaseDuration`, else `5 minutes`.
665
- When a worker dies mid-run, the slot frees as soon as the lease expires: the
666
- sweep fails the run and wakes the next waiter. A handler that outlives its
667
- lease stops counting toward the limit, is failed by the sweep, and has its
668
- completion refused.
669
- - Choose `leaseDuration` from the job's slowest handler. Use about twice its
670
- worst observed duration, and never less than its own timeouts, such as a
671
- model call's. A shorter lease gives a crashed run's slot back sooner. Give a
672
- seconds-long crawl job a lease of a minute or two, and give a minutes-long
673
- inference job its own longer lease rather than raising the app-wide default.
666
+ A running run renews its lease every third of it while its invocation
667
+ lives, so a handler may run longer than its lease. When a worker dies
668
+ mid-run, the renewals stop and the slot frees as soon as the lease expires:
669
+ the sweep fails the run (`raybase.job.failed` with `reason:
670
+ "lease_expired"`) and wakes the next waiter.
671
+ - So `leaseDuration` is how long a dead run's slot stays held, not how long a
672
+ run may take. A shorter lease frees a crashed run's slot sooner and renews
673
+ more often; the default suits most jobs. What bounds a run is its
674
+ invocation: Cloudflare ends a queue consumer invocation at its wall-time
675
+ limit (15 minutes at the time of writing), and then the run's lease lapses
676
+ and the sweep fails it. Split work longer than that into batches or
677
+ continuations (`ctx.jobs.enqueue` from the handler).
674
678
  - Cancelling a run frees its slot at once, but its handler keeps running to
675
679
  the end and its result is discarded. The next waiter can therefore start
676
680
  while the cancelled handler is still finishing, and until it finishes the
@@ -184,7 +184,8 @@ ctx)` in the worker entry, ahead of the framework, as the templates have it;
184
184
  `raybase doctor` warns (`host-routing`) when it is missing. Each failed job
185
185
  attempt, and each run that ends failed without one (lease expired, denied),
186
186
  logs `console.error("raybase.job.failed", { job, runId, organizationId,
187
- attempt, maxAttempts, retry, partitionKey })` (`organizationId` the run's
187
+ reason, attempt, maxAttempts, retry, partitionKey })` (`reason` `threw`,
188
+ `denied` or `lease_expired`) (`organizationId` the run's
188
189
  scope, `"default"` in Core; `partitionKey` null for app-level work), never with the input, and with the error's message only under
189
190
  `appConfig.jobs.logFailureMessages: true`. See the
190
191
  hosting guide (`docs/hosting.md` on the Raybase site) for the full contract.
@@ -74,9 +74,12 @@ app's connector, and what the app controls:
74
74
  and its colours are `--rb-consent-*` custom properties. For a page of the
75
75
  app's own, set `mcp.consent.path`: consent is sent there with the request's
76
76
  query, the page reads `GET /api/auth/oauth/consent` with the same query
77
- (client and connector names, scopes, a description, an optional `choice`,
78
- and the `fields` to post) and posts the fields plus `decision=approve` or
79
- `deny` to `/api/auth/oauth/authorize`. Unsigned visitors get 401 with
77
+ (client and connector names, scopes, a description, `returnsTo`, an
78
+ optional `choice`, and the `fields` to post) and posts the fields plus
79
+ `decision=approve` or `deny` to `/api/auth/oauth/authorize`. `returnsTo` is
80
+ where the sign-in code goes (the redirect URI's scheme, host and port, in
81
+ full, since a loopback redirect matches any port): the built-in page names
82
+ it, and an app's own page should too. Unsigned visitors get 401 with
80
83
  `signIn`, the address to send them to.
81
84
  - **Standing instructions.** `mcp.instructions` is returned from
82
85
  `initialize`. Products keep only the start (512 to 4,096 characters), so
@@ -111,7 +114,13 @@ export const appConfig = {
111
114
  ```
112
115
 
113
116
  Use hostnames, not full redirect URLs. Include only clients the owner intends
114
- to trust. For internal apps that should not accept new OAuth clients at
117
+ to trust. Whatever the list (`["*"]` included), a client's metadata document
118
+ and its `client_uri`, `logo_uri`, `tos_uri` and `policy_uri` must not be at a
119
+ private address: they are judged as every outbound fetch is
120
+ (`validateOutboundHttpsUrl`: localhost, metadata names, and every loopback,
121
+ private, link-local and special-purpose literal, IPv6 and mapped IPv4
122
+ included). Workers cannot see what a name resolves to, so the list is the
123
+ only guard against a public name that points somewhere private. For internal apps that should not accept new OAuth clients at
115
124
  runtime, disable Dynamic Client Registration instead:
116
125
 
117
126
  ```ts
@@ -300,6 +309,11 @@ the `io.modelcontextprotocol/ui` extension and accept
300
309
  (and `raybase dev` at startup) warns with `mcp-tool-scopes`. For a tool a
301
310
  person's agent should use, declare no scopes or only `mcp:read`/`mcp:write`;
302
311
  for one kept for the app's own services, declare only the app's own scopes.
312
+ - In an app whose every tool is meant for agents people approve (a
313
+ platform's store apps, say), set `mcp: { appOnlyTools: false }`. Doctor
314
+ then fails (`mcp-tool-scopes`, error) on any tool no person's agent can
315
+ reach, including one that declares only an app-only scope such as
316
+ `mcp:shopify:products:read`.
303
317
  - Operator scopes must stay on Operator MCP. App MCP grants must never request
304
318
  `operator:*` scopes.
305
319