diff --git a/VENDORED.md b/VENDORED.md index c7ef88b6cc..6ba14bd750 100644 --- a/VENDORED.md +++ b/VENDORED.md @@ -22,24 +22,25 @@ never a convenience. ## Ledger -| Vendored path | What was copied | Upstream repo @ commit | Why not a published package | Owner | Kill date | Kill-date test | -| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------ | ---------- | ----------------- | -| `apps/sidecar` | Derived from upstream's own `apps/sidecar`: six modules byte-identical (`default-harness.ts`, `signing-keypair.ts`, `source-asset-delivery.ts`, `workflow-closure-apply.ts`, `workflow-probe-handler.ts`, `workflow-run-pack-restore.ts`), three near-verbatim (`atomic-write.ts` differs only by the repo-wide logger namespace), the rest (`index.ts`, `config.ts`, `tool-materialization.ts`, `step-agent-tools.ts`, `workflow-host-wiring/`, `workflow-substrate-factory/`, …) substantially rewritten, plus workbench-only modules. A living fork, not a frozen copy, so this row carries no tree hash. | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | An app is never npm-published, so no publish can cover the execution host; retired by consuming an upstream-published host, or by renewing this row deliberately | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/agent` | `@intx/agent` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the operator-configurable doom-loop threshold (`afd0c82b`, `c421c092`) the re-vendored `workflow-host` configures; one local delta (CL-7190): `ToolBundle.beforeToolExtension` (`tool.ts`) and its composition into `ResolvedTools.beforeToolExtensions` (`agent.ts`), so a tool package can contribute its own suspend-capable extension without the reactor or director special-casing it by name; retired by the next `@intx/agent` publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/db` | `@intx/db` source (`src/`, `migrations/`, drizzle config, manifest, tsconfigs) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `c1b5bb73` (origin/main, 2026-09-06) | npm 0.3.0 covers the base package but not the `wire_projection` column/loader delta (CL-6324) or the `workflow_definition.origin` column separating a definition from the per-run record of one folded run's deploy (CL-6452), shipped as migrations `0089`/`0090` behind upstream's `0088`, plus `0091` rewriting the retired `onBodyFailure: "continue"` literal to upstream's `"tolerate"` in stored wire projections, plus `0092` adding `workflow_definition.schedule_claimed_minute` for the hub's native ScheduleTrigger poller (CL-4455); the pin also carries upstream's unpublished per-principal signing-key series (`principal_key` migration renumbered to `0093`, the principal/principal-key stores, and the backfill), which npm 0.3.0 lacks; retired when upstream absorbs the deltas or publishes the signing-key series | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/harness` | `@intx/harness` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the connector reply drain (`driveConnectorReplies`, `ConnectorReplyDrain`, `AgentEventStream`; `11590e66`) the sidecar's warm mail loop drives; no local delta; retired by the next `@intx/harness` publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/hub-agent` | `@intx/hub-agent` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the `agentDir` path export (`927556de`) the sidecar's deploy-tree lookup uses, and its own `@intx/mail-memory`/`@intx/harness` pins must resolve the vendored copies; one local delta (CL-6396): `SessionEventSink` / `publishWorkflowInferenceEvent` stamp optional `childRunId` on `agent.event`; retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/hub-api` | `@intx/hub-api` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `c1b5bb73` (origin/main, 2026-09-06) | npm 0.3.0 covers the base package but not the null-principal `resolveApproval` for policy-resolved decisions (CL-6345), the bearer-authenticated workflow-deploy mirror (`middleware/workflow-run-deploy-auth.ts`, CL-workflow-deploy-bearer), or the upstream per-principal signing-key seam this pin re-vendors (`principalKeyStore` threaded through the tenant/invite/run/workflow routes, the grant materializer, and `createApp`); retired when upstream absorbs the deltas or publishes the signing-key series | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/hub-sessions` | `@intx/hub-sessions` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 covers the base package but not the pack-acceptance fixes (`ownsWorkflowRunRepo`, `anchorAddressForPackSource`, `decideTerminalRunFlip`), the wire-projection writer (CL-6324), malformed tool-call-name sanitization (CL-6478), the sealed-run terminal-status backfill (CL-6595), the CL-7190 `registerSignalCorrelation` approval-only guard (fails loud on a future `SignalKind` this RPC has no persistence for, rather than silently mis-persisting one), or the CL-6396 `childRunId` forward on `agent.event`; retired when upstream absorbs the deltas | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/inference` | `@intx/inference` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates doom-loop detection (`8da4c827`, `afd0c82b`, `c421c092`); local deltas: `providers/google-genai-files.ts` builds its upload body as `new Uint8Array(bytes)` because TS 6's lib.dom `BodyInit` rejects `Uint8Array` (upstream compiles ESNext-only under TS 5.9); and CL-7190's `message_response` resume branch in `reactor.ts`'s `resumePendingOperation`/`timeoutMessageFor`, plus its `reactor.test.ts`/`testing/fakes.ts` regression harness (this package previously had zero tests); retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/mail-memory` | `@intx/mail-memory` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the `@intx/mailbox` extraction (`af03bb90`), on-demand body reads (`54f7c239`) and `expunge` returning the swept uids (`bcabb1f8`) that the re-vendored `workflow-host` binds against; no local delta; retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/mailbox` | `@intx/mailbox` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | Never published: a new package at the target pin (`af03bb90`) that `workflow-host`'s substrate mailbox store and supervisor-backed transport import; no local delta; retired by its first publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/mime` | `@intx/mime` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the non-RFC message-id guard `isMessageId` (`d97e1832`), the full `References` chain (`65c6fe70`) and the lossless `decodeMail` decoder (`3b6d06b2`) that `mailbox`/`mail-memory` at the same pin import; no local delta; retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/types` | `@intx/types` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `c1b5bb73` (origin/main, 2026-09-06) | npm 0.3.0 predates the type surface the re-vendored trees compile against: `expunge` returning `expungedUids` (`bcabb1f8`), plain-string `PackRejectReason` (`7b42f405`), the run authorization/approvals REST types (`71ad6c08`), the decoded-mail `Mail`/`MailPartReader` model (`3b6d06b2`) and the `interchange.actions`/`loops` package-json refs (`3bd5b837`, `1ea2f39b`); one local delta (CL-7190): `"message_response"` added to `signals.ts`'s `signalKinds`, alongside `signalKindToGateType`; another (CL-6396): optional `childRunId` on `AgentEventFrame`; the pin also carries the unpublished `signer-identity` contract and `principalKeyAad` domain separator from the signing-key series; retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/hub-common` | `@intx/hub-common` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `c1b5bb73` (origin/main, 2026-09-06) | npm 0.3.0 predates `generateId`'s `pky_` principal-key prefix from the signing-key series, which the re-vendored `db`/`hub-api` import; no local delta; retired by the next `@intx/hub-common` publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/workflow` | `@intx/workflow` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | No local delta: npm 0.3.0 predates the `onBodyFailure: "tolerate"` section policy (`b977ade6`) that `@corbits/agent-runtime` authors and the action/loop primitives (`3bd5b837`, `1ea2f39b`) the re-vendored `workflow-host` runs; retired by the next `@intx/workflow` publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/workflow-deploy` | `@intx/workflow-deploy` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | No local delta: npm 0.3.0 predates `inertLoopBody` and the loop-body source pin (`1ea2f39b`) that the re-vendored `hub-sessions` imports; retired by the next `@intx/workflow-deploy` publish | sawyer | 2026-11-03 | `check:killdates` | -| `vendor/intx/workflow-host` | `@intx/workflow-host` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 covers the base package but not the body-spawn authorize/mail-part-reader threading and grants head-collapse (CL-6448) -- the credential thread is retired at this pin, upstream now passing the run's live credential-material cell into every body spawn natively -- that let the fork run tool-bearing onTrigger bodies, or the CL-6396 event-channel `childRunId` stamp so overlapping turns HMAC-bind the occurrence they belong to; retired when upstream absorbs the deltas | sawyer | 2026-11-03 | `check:killdates` | +| Vendored path | What was copied | Upstream repo @ commit | Why not a published package | Owner | Kill date | Kill-date test | +| ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------- | ----------------- | +| `apps/sidecar` | Derived from upstream's own `apps/sidecar`: six modules byte-identical (`default-harness.ts`, `signing-keypair.ts`, `source-asset-delivery.ts`, `workflow-closure-apply.ts`, `workflow-probe-handler.ts`, `workflow-run-pack-restore.ts`), three near-verbatim (`atomic-write.ts` differs only by the repo-wide logger namespace), the rest (`index.ts`, `config.ts`, `tool-materialization.ts`, `step-agent-tools.ts`, `workflow-host-wiring/`, `workflow-substrate-factory/`, …) substantially rewritten, plus workbench-only modules. A living fork, not a frozen copy, so this row carries no tree hash. | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | An app is never npm-published, so no publish can cover the execution host; retired by consuming an upstream-published host, or by renewing this row deliberately | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/agent` | `@intx/agent` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the operator-configurable doom-loop threshold (`afd0c82b`, `c421c092`) the re-vendored `workflow-host` configures; one local delta (CL-7190): `ToolBundle.beforeToolExtension` (`tool.ts`) and its composition into `ResolvedTools.beforeToolExtensions` (`agent.ts`), so a tool package can contribute its own suspend-capable extension without the reactor or director special-casing it by name; retired by the next `@intx/agent` publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/db` | `@intx/db` source (`src/`, `migrations/`, drizzle config, manifest, tsconfigs) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `c1b5bb73` (origin/main, 2026-09-06) | npm 0.3.0 covers the base package but not the `wire_projection` column/loader delta (CL-6324) or the `workflow_definition.origin` column separating a definition from the per-run record of one folded run's deploy (CL-6452), shipped as migrations `0089`/`0090` behind upstream's `0088`, plus `0091` rewriting the retired `onBodyFailure: "continue"` literal to upstream's `"tolerate"` in stored wire projections, plus `0092` adding `workflow_definition.schedule_claimed_minute` for the hub's native ScheduleTrigger poller (CL-4455); the pin also carries upstream's unpublished per-principal signing-key series (`principal_key` migration renumbered to `0093`, the principal/principal-key stores, and the backfill), which npm 0.3.0 lacks; and a CL-7505 serving-time refresh delta (`model-source-resolution.ts`: `buildSource`/`resolveModelSources`/`resolveInstanceModelSources` accept an optional `servingRefresh` hook, exposing `buildSource`, with a new `credential_needs_reauth` skip so an unrefreshable `oauth_token` credential is never served); retired when upstream absorbs the deltas or publishes the signing-key series | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/harness` | `@intx/harness` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the connector reply drain (`driveConnectorReplies`, `ConnectorReplyDrain`, `AgentEventStream`; `11590e66`) the sidecar's warm mail loop drives; no local delta; retired by the next `@intx/harness` publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/hub-agent` | `@intx/hub-agent` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the `agentDir` path export (`927556de`) the sidecar's deploy-tree lookup uses, and its own `@intx/mail-memory`/`@intx/harness` pins must resolve the vendored copies; one local delta (CL-6396): `SessionEventSink` / `publishWorkflowInferenceEvent` stamp optional `childRunId` on `agent.event`; retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/hub-api` | `@intx/hub-api` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `c1b5bb73` (origin/main, 2026-09-06) | npm 0.3.0 covers the base package but not the null-principal `resolveApproval` for policy-resolved decisions (CL-6345), the bearer-authenticated workflow-deploy mirror (`middleware/workflow-run-deploy-auth.ts`, CL-workflow-deploy-bearer), or the upstream per-principal signing-key seam this pin re-vendors (`principalKeyStore` threaded through the tenant/invite/run/workflow routes, the grant materializer, and `createApp`); and a CL-7505 serving-time refresh delta (`run-source-resolution.ts`: `resolveDefinitionSources` accepts and threads an optional `servingRefresh` hook); retired when upstream absorbs the deltas or publishes the signing-key series | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/hub-sessions` | `@intx/hub-sessions` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 covers the base package but not the pack-acceptance fixes (`ownsWorkflowRunRepo`, `anchorAddressForPackSource`, `decideTerminalRunFlip`), the wire-projection writer (CL-6324), malformed tool-call-name sanitization (CL-6478), the sealed-run terminal-status backfill (CL-6595), the CL-7190 `registerSignalCorrelation` approval-only guard (fails loud on a future `SignalKind` this RPC has no persistence for, rather than silently mis-persisting one), or the CL-6396 `childRunId` forward on `agent.event`; and a CL-7505 serving-time refresh delta (`credential-push.ts`: `pushInstanceSourceUpdate`/`pushSourceUpdates`/`pushSourceUpdatesSubtree` accept and thread an optional `servingRefresh` hook); retired when upstream absorbs the deltas | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/inference` | `@intx/inference` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates doom-loop detection (`8da4c827`, `afd0c82b`, `c421c092`); local deltas: `providers/google-genai-files.ts` builds its upload body as `new Uint8Array(bytes)` because TS 6's lib.dom `BodyInit` rejects `Uint8Array` (upstream compiles ESNext-only under TS 5.9); and CL-7190's `message_response` resume branch in `reactor.ts`'s `resumePendingOperation`/`timeoutMessageFor`, plus its `reactor.test.ts`/`testing/fakes.ts` regression harness (this package previously had zero tests); retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/mail-memory` | `@intx/mail-memory` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the `@intx/mailbox` extraction (`af03bb90`), on-demand body reads (`54f7c239`) and `expunge` returning the swept uids (`bcabb1f8`) that the re-vendored `workflow-host` binds against; no local delta; retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/mailbox` | `@intx/mailbox` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | Never published: a new package at the target pin (`af03bb90`) that `workflow-host`'s substrate mailbox store and supervisor-backed transport import; no local delta; retired by its first publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/oauth-core` | `@corbits/oauth-core` source (`src/`, manifest, README, LICENSE) with workbench-convention tsconfigs replacing upstream's | [corbitsdev/corbits-oauth-core](https://github.com/corbitsdev/corbits-oauth-core) @ `dcac0826` (initial release, 2026-07-07) | Never published: the provider-agnostic OAuth token layer (`BaseTokens`, `isTokenExpired` skew check, `createTokenSession` with in-process refresh coalescing, `refreshTokenRequest`) that `packages/connections`' serving-time token session composes over credential rows (CL-7505); no source delta; retired by its first publish or deliberately renewed | sawyer | 2026-10-07 | `check:killdates` | +| `vendor/intx/mime` | `@intx/mime` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 predates the non-RFC message-id guard `isMessageId` (`d97e1832`), the full `References` chain (`65c6fe70`) and the lossless `decodeMail` decoder (`3b6d06b2`) that `mailbox`/`mail-memory` at the same pin import; no local delta; retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/types` | `@intx/types` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `c1b5bb73` (origin/main, 2026-09-06) | npm 0.3.0 predates the type surface the re-vendored trees compile against: `expunge` returning `expungedUids` (`bcabb1f8`), plain-string `PackRejectReason` (`7b42f405`), the run authorization/approvals REST types (`71ad6c08`), the decoded-mail `Mail`/`MailPartReader` model (`3b6d06b2`) and the `interchange.actions`/`loops` package-json refs (`3bd5b837`, `1ea2f39b`); one local delta (CL-7190): `"message_response"` added to `signals.ts`'s `signalKinds`, alongside `signalKindToGateType`; another (CL-6396): optional `childRunId` on `AgentEventFrame`; the pin also carries the unpublished `signer-identity` contract and `principalKeyAad` domain separator from the signing-key series; retired by the next publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/hub-common` | `@intx/hub-common` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `c1b5bb73` (origin/main, 2026-09-06) | npm 0.3.0 predates `generateId`'s `pky_` principal-key prefix from the signing-key series, which the re-vendored `db`/`hub-api` import; no local delta; retired by the next `@intx/hub-common` publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/workflow` | `@intx/workflow` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | No local delta: npm 0.3.0 predates the `onBodyFailure: "tolerate"` section policy (`b977ade6`) that `@corbits/agent-runtime` authors and the action/loop primitives (`3bd5b837`, `1ea2f39b`) the re-vendored `workflow-host` runs; retired by the next `@intx/workflow` publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/workflow-deploy` | `@intx/workflow-deploy` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | No local delta: npm 0.3.0 predates `inertLoopBody` and the loop-body source pin (`1ea2f39b`) that the re-vendored `hub-sessions` imports; retired by the next `@intx/workflow-deploy` publish | sawyer | 2026-11-03 | `check:killdates` | +| `vendor/intx/workflow-host` | `@intx/workflow-host` source (`src/`, manifest, tsconfig) | [faremeter/interchange](https://github.com/faremeter/interchange) @ `692c3106` (origin/main, 2026-09-03) | npm 0.3.0 covers the base package but not the body-spawn authorize/mail-part-reader threading and grants head-collapse (CL-6448) -- the credential thread is retired at this pin, upstream now passing the run's live credential-material cell into every body spawn natively -- that let the fork run tool-bearing onTrigger bodies, or the CL-6396 event-channel `childRunId` stamp so overlapping turns HMAC-bind the occurrence they belong to; retired when upstream absorbs the deltas | sawyer | 2026-11-03 | `check:killdates` | The pin is `692c3106` (upstream `origin/main`, 2026-09-03), 90 commits past the `v0.3.0` release tag `b5580a02`. npm is still `0.3.0`, so every tree a diff --git a/apps/hub/src/credential-material-refresh.test.ts b/apps/hub/src/credential-material-refresh.test.ts new file mode 100644 index 0000000000..fd3c17884c --- /dev/null +++ b/apps/hub/src/credential-material-refresh.test.ts @@ -0,0 +1,207 @@ +import { describe, expect, test } from "bun:test"; + +import { + createServingRefresh, + type ServingRefreshGrantArgs, + type ServingRefreshStore, +} from "./credential-material-refresh"; + +// Times sit just outside/inside the 60s skew lead so "not expiring" and +// "expiring now" are unambiguous. +const NOW = 1_000_000_000; +const LATER = NOW + 10 * 60 * 1000; + +type Row = + Parameters extends [string] + ? Awaited> + : never; + +function store(initial: NonNullable) { + let row: NonNullable | null = initial; + const calls = { + refreshedTokens: [] as Awaited< + ReturnType + > extends never + ? never + : Parameters[1][], + marked: [] as string[], + pushes: [] as string[], + grantArgs: [] as ServingRefreshGrantArgs[], + }; + const s: ServingRefreshStore = { + loadRow: async () => row, + applyRefreshedTokens: async (id, tokens) => { + calls.refreshedTokens.push(tokens); + if (row !== null && row.id === id) { + row = { + ...row, + secret: `enc:${tokens.secret}`, + refreshSecret: + tokens.refreshSecret === undefined + ? row.refreshSecret + : `enc:${tokens.refreshSecret}`, + expiresAt: tokens.expiresAt, + status: "active", + }; + } + return true; + }, + markReauthRequired: async (id) => { + calls.marked.push(id); + if (row !== null && row.id === id) row = { ...row, status: "error" }; + }, + pushUpdates: async (tenantId) => { + calls.pushes.push(tenantId); + }, + decrypt: async (_id, _column, value) => `plain:${value}`, + loadDueRows: async () => [], + }; + return { store: s, row: () => row, calls }; +} + +function row(overrides: Partial> = {}) { + return { + id: "cred_1", + tenantId: "ten_1", + type: "oauth_token", + status: "active", + secret: "enc:access-1", + refreshSecret: "enc:refresh-1", + expiresAt: new Date(LATER), + providerName: "mcp:example", + apiBaseUrl: "https://mcp.example", + metadata: { url: "https://mcp.example" }, + ...overrides, + } as NonNullable; +} + +function harness( + initial: NonNullable, + grant?: (args: ServingRefreshGrantArgs) => Promise<{ + accessToken: string; + refreshToken?: string; + expiresIn?: number; + }>, +) { + const d = store(initial); + const refresh = createServingRefresh({ + store: d.store, + hubUrl: "https://hub.example", + ...(grant === undefined ? {} : { grant }), + now: () => NOW, + }); + return { ...d, refresh }; +} + +describe("createServingRefresh", () => { + test("an api_key credential passes through untouched — never refreshed, never pushed", async () => { + const h = harness( + row({ type: "api_key", refreshSecret: null, expiresAt: null }), + ); + const result = await h.refresh(servingOf(h)); + expect(result).toEqual({ ok: true }); + expect(h.calls.grantArgs).toHaveLength(0); + expect(h.calls.refreshedTokens).toHaveLength(0); + expect(h.calls.pushes).toHaveLength(0); + }); + + test("a well-before-expiry oauth_token is served without a refresh", async () => { + const h = harness(row()); + const result = await h.refresh(servingOf(h)); + expect(result).toEqual({ ok: true }); + expect(h.calls.refreshedTokens).toHaveLength(0); + expect(h.calls.pushes).toHaveLength(0); + }); + + test("an expiring oauth_token refreshes, persists, and pushes the updated frame", async () => { + const h = harness( + row({ expiresAt: new Date(NOW + 1000) }), + async (args) => ({ + accessToken: `fresh:${args.refreshToken}`, + refreshToken: "rotated-refresh", + expiresIn: 3600, + }), + ); + const result = await h.refresh(servingOf(h)); + expect(result).toEqual({ ok: true }); + expect(h.calls.refreshedTokens).toHaveLength(1); + expect(h.calls.refreshedTokens[0]?.secret).toBe( + "fresh:plain:enc:refresh-1", + ); + expect(h.calls.refreshedTokens[0]?.refreshSecret).toBe("rotated-refresh"); + expect(h.calls.pushes).toEqual(["ten_1"]); + }); + + test("a failed refresh marks the credential re-auth-required, pushes, and skips the offering", async () => { + const h = harness(row({ expiresAt: new Date(NOW + 1000) }), async () => { + throw new Error("grant rejected"); + }); + const result = await h.refresh(servingOf(h)); + expect(result.ok).toBe(false); + expect(h.calls.marked).toEqual(["cred_1"]); + expect(h.row()?.status).toBe("error"); + expect(h.calls.pushes).toEqual(["ten_1"]); + // The marked credential is never retried: a second serving skips + // without another doomed grant. + const second = await h.refresh(servingOf(h, "error")); + expect(second.ok).toBe(false); + expect(h.calls.marked).toEqual(["cred_1"]); + }); + + test("a grant that states no expires_in persists a NULL expiry — the row never re-enters the due set", async () => { + const h = harness( + row({ expiresAt: new Date(NOW + 1000) }), + async (args) => ({ + accessToken: `fresh:${args.refreshToken}`, + refreshToken: "rotated-refresh", + // no expiresIn: provider stated no lifetime + }), + ); + const result = await h.refresh(servingOf(h)); + expect(result).toEqual({ ok: true }); + expect(h.row()?.expiresAt).toBeNull(); + // Subsequent servings see a non-due row: no further grant, no push. + const again = await h.refresh(servingOf(h)); + expect(again).toEqual({ ok: true }); + expect(h.calls.refreshedTokens).toHaveLength(1); + expect(h.calls.pushes).toEqual(["ten_1"]); + }); + + test("a lost apply race (row claimed elsewhere) suppresses the push without erroring", async () => { + const d = store(row({ expiresAt: new Date(NOW + 1000) })); + d.store.applyRefreshedTokens = async () => false; + let grants = 0; + const refresh = createServingRefresh({ + store: d.store, + hubUrl: "https://hub.example", + grant: async () => { + grants += 1; + return { accessToken: "fresh", expiresIn: 3600 }; + }, + now: () => NOW, + }); + const result = await refresh(servingOf(d)); + expect(result).toEqual({ ok: true }); + expect(grants).toBe(1); + expect(d.calls.pushes).toEqual([]); + }); +}); + +function servingOf( + h: { + row: () => NonNullable< + Awaited> + > | null; + }, + status: string = "active", +): Parameters>[0] { + const current = h.row(); + return { + id: current?.id ?? "cred_1", + tenantId: current?.tenantId ?? "ten_1", + type: current?.type ?? "oauth_token", + status, + refreshSecret: current?.refreshSecret ?? null, + expiresAt: current?.expiresAt ?? null, + }; +} diff --git a/apps/hub/src/credential-material-refresh.ts b/apps/hub/src/credential-material-refresh.ts new file mode 100644 index 0000000000..8c09da0b86 --- /dev/null +++ b/apps/hub/src/credential-material-refresh.ts @@ -0,0 +1,407 @@ +// Serving-time credential refresh for inference `oauth_token` credentials +// (CL-7505). +// +// The live serving-time trigger is the chat platform's `sendMail` choke +// point: ahead of every send, `createTenantServingRefresh` refreshes each +// due `oauth_token` credential in the tenant — via the connections token +// session (`@corbits/connections`'s `createCredentialTokenSession`, over +// the vendored `@corbits/oauth-core`), coalesced and skew-aware — and the +// refreshed material reaches running deployments through the existing +// `credentials-updated` push (`pushSourceUpdates` → `sendCredentialsUpdate`). +// The existing MCP expiry sweep keeps running as the background backstop +// and reconnect-nudge path. +// +// The vendored material-resolution seam (`@intx/db`'s `buildSource`, +// threaded through `resolveModelSources` / `resolveInstanceModelSources` / +// `resolveDefinitionSources` / the hub-sessions push path as the recorded +// CL-7505 delta) also accepts this hook, but no production caller supplies +// it yet — it is reserved for launch-time resolution on the CL-7505 +// umbrella; do not cite it as a live trigger. +// +// On a failed refresh the credential is marked `status: "error"` — the +// Connections card reads any non-`active` status as needs-attention — and +// the hook reports `ok: false`, which makes the serving seam SKIP the +// offering: an unauthenticated dial is never served. The expiry sweep's +// mail nudge remains the human backstop for the same dead credential. +import { and, eq, isNotNull, lte } from "drizzle-orm"; +import { type } from "arktype"; +import { credential, provider } from "@intx/db/schema"; +import type { DB } from "@intx/db"; +import type { ServingRefresh } from "@intx/db"; +import { getLogger } from "@intx/log"; +import { + createCredentialTokenSession, + type CredentialTokenRow, + type RefreshedTokens, +} from "@corbits/connections/token-session"; +import { pushSourceUpdates, type SidecarRouter } from "@intx/hub-sessions"; +import { credentialAad, type CredentialCipher } from "@intx/types"; +import { mcpSlugOf, refreshMcpOAuthTokens } from "@corbits/connections"; +import type { + OAuthClientInformationMixed, + OAuthTokens, +} from "@modelcontextprotocol/sdk/shared/auth.js"; + +const log = getLogger(["hub", "credential-material-refresh"]); + +// Re-check this far ahead of the stored `expiresAt`: inside the lead the +// token is treated as expiring and refreshed, so a dial that starts now +// still lands on a live token after its round trip. Matches the token +// session's own default skew lead. +const SKEW_LEAD_MS = 60 * 1000; + +const CredentialMetadata = type({ + url: "string", + "name?": "string", + "clientInformation?": "unknown", +}); + +/** The row shape the serving seam hands the hook (a `credential` row + * subset; `refreshSecret` still ciphertext). */ +export type ServingCredentialRow = { + readonly id: string; + readonly tenantId: string; + readonly type: string; + readonly status: string; + readonly refreshSecret: string | null; + readonly expiresAt: Date | null; +}; + +/** Everything the refresh needs from persistence and delivery, behind a + * store seam so the orchestration is testable without a live Postgres. */ +export type ServingRefreshStore = { + /** The full current row for a credential id (still-encrypted secrets), + * or null when it is gone. */ + loadRow(credentialId: string): Promise< + | (ServingCredentialRow & { + readonly secret: string; + readonly providerName: string; + readonly apiBaseUrl: string | null; + readonly metadata: unknown; + }) + | null + >; + /** Persists a successful refresh (encrypting the new pair) — only an + * `active` row is updated; false means it was claimed meanwhile. */ + applyRefreshedTokens( + credentialId: string, + tokens: RefreshedTokens, + ): Promise; + /** Marks the credential re-auth-required: visible to the settings + * Connections card as needs-attention. */ + markReauthRequired(credentialId: string, reason: string): Promise; + /** Re-resolves and pushes `credentials-updated` frames for the tenant's + * running instances, so sidecars pick the new material up live. */ + pushUpdates(tenantId: string): Promise; + /** Decrypts a stored secret column for the grant. */ + decrypt( + credentialId: string, + column: "secret" | "refreshSecret", + value: string, + ): Promise; + /** Every `active` `oauth_token` credential in the tenant whose stored + * `expiresAt` is at or before `cutoff` — the tenant-wide serving-time + * sweep `refreshTenantServingCredentials` runs ahead of a dial. */ + loadDueRows(tenantId: string, cutoff: Date): Promise; +}; + +export type ServingRefreshGrantArgs = { + readonly credentialId: string; + readonly tenantId: string; + readonly providerName: string; + readonly serverUrl: string; + readonly accessToken: string; + readonly refreshToken: string; + readonly clientInformation?: OAuthClientInformationMixed; +}; + +export type ServingRefreshDeps = { + store: ServingRefreshStore; + hubUrl: string; + /** The provider-pluggable refresh grant. Defaults to the generalized + * MCP `auth()` refresh (any provider whose metadata carries the server + * URL / registered client); a different credential class supplies its + * own grant here without touching this module. */ + grant?: (args: ServingRefreshGrantArgs) => Promise<{ + accessToken: string; + refreshToken?: string; + /** Lifetime in seconds, per RFC 6749 §5.1 `expires_in`. */ + expiresIn?: number; + }>; + now?: () => number; +}; + +export function createServingRefresh(deps: ServingRefreshDeps): ServingRefresh { + const now = deps.now ?? Date.now; + const grant = + deps.grant ?? + (async (args: ServingRefreshGrantArgs) => { + const tokens: OAuthTokens = { + access_token: args.accessToken, + token_type: "bearer", + refresh_token: args.refreshToken, + }; + const result = await refreshMcpOAuthTokens({ + serverUrl: args.serverUrl, + tokens, + ...(args.clientInformation === undefined + ? {} + : { clientInformation: args.clientInformation }), + callbackUrl: new URL( + `/api/tenants/${args.tenantId}/mcp-servers/oauth/${mcpSlugOf(args.providerName)}/callback`, + deps.hubUrl, + ).toString(), + clientName: "Corbits Workbench", + }); + if (!result.ok) throw new Error(result.message); + return { + accessToken: result.tokens.access_token, + ...(result.tokens.refresh_token === undefined + ? {} + : { refreshToken: result.tokens.refresh_token }), + ...(result.tokens.expires_in === undefined + ? {} + : { expiresIn: result.tokens.expires_in }), + }; + }); + + const sessions = new Map>(); + let lastApplyWon = true; + + function buildSession() { + return createCredentialTokenSession({ + now, + skewLeadMs: SKEW_LEAD_MS, + loadProfile: async (credentialId) => { + const row = await deps.store.loadRow(credentialId); + if (row === null) return null; + return { + id: row.id, + type: row.type, + secret: await deps.store.decrypt(row.id, "secret", row.secret), + refreshSecret: + row.refreshSecret === null + ? null + : await deps.store.decrypt( + row.id, + "refreshSecret", + row.refreshSecret, + ), + expiresAt: row.expiresAt, + } satisfies CredentialTokenRow; + }, + updateTokens: async (credentialId, tokens) => { + // False = another writer claimed the row (claimed-elsewhere): a + // lost race, not an error — skip the follow-up push and let the + // next resolution re-read whatever was persisted. + const applied = await deps.store.applyRefreshedTokens( + credentialId, + tokens, + ); + lastApplyWon = applied; + }, + refresh: async (row) => { + const full = await deps.store.loadRow(row.id); + if (full === null || row.refreshSecret === null) { + throw new Error(`credential ${row.id} lost its refresh secret`); + } + const parsed = CredentialMetadata(full.metadata ?? {}); + const serverUrl = + full.apiBaseUrl ?? + (parsed instanceof type.errors ? undefined : parsed.url); + if (serverUrl === undefined) { + throw new Error( + `credential ${row.id} has neither a provider API base URL nor a metadata URL to refresh against`, + ); + } + const refreshed = await grant({ + credentialId: row.id, + tenantId: full.tenantId, + providerName: full.providerName, + serverUrl, + accessToken: row.secret, + refreshToken: row.refreshSecret, + ...(parsed instanceof type.errors || + parsed.clientInformation === undefined + ? {} + : { + clientInformation: + parsed.clientInformation as OAuthClientInformationMixed, + }), + }); + return { + secret: refreshed.accessToken, + ...(refreshed.refreshToken === undefined + ? {} + : { refreshSecret: refreshed.refreshToken }), + // No `expires_in` stated: persist a NULL expiry — non-due, per + // the vendored oauth-core stance. Never a short artificial + // timer that would re-refresh on every dial. + expiresAt: + refreshed.expiresIn === undefined + ? null + : new Date(now() + refreshed.expiresIn * 1000), + }; + }, + }); + } + + return async (serving: ServingCredentialRow) => { + // Only `oauth_token` rows refresh; an `api_key` (or any other class) + // takes its exact prior path, untouched. + if (serving.type !== "oauth_token") return { ok: true }; + // An already-marked credential is past saving: skip it without another + // doomed grant, until a human reconnects. + if (serving.status !== "active") { + return { + ok: false, + message: `credential ${serving.id} is ${serving.status} — re-authorization required`, + }; + } + // No stored expiry (or no refresh grant stored): the column says the + // token is not expiring, so serve as before. + if (serving.expiresAt === null) return { ok: true }; + if (serving.expiresAt.getTime() - SKEW_LEAD_MS > now()) return { ok: true }; + + lastApplyWon = true; + let session = sessions.get(serving.id); + if (session === undefined) { + session = buildSession(); + sessions.set(serving.id, session); + } + const result = await session.getValidToken(serving.id); + if (result.ok) { + if (result.refreshed && lastApplyWon) { + // Deliver the fresh material to every running instance in the + // tenant via the existing credentials-updated push. A lost + // apply race (another writer claimed the row) already persisted + // someone else's tokens — skip the redundant push. + await deps.store.pushUpdates(serving.tenantId); + } + return { ok: true }; + } + if (result.reauthRequired) { + await deps.store.markReauthRequired(serving.id, result.message); + await deps.store.pushUpdates(serving.tenantId); + log.warn`credential ${serving.id} needs re-authorization: ${result.message}`; + } + return { ok: false, message: result.message }; + }; +} + +export function createDrizzleServingRefreshStore( + db: DB["db"], + credentialCipher: CredentialCipher, + sidecarRouter: SidecarRouter, +): ServingRefreshStore { + return { + async loadRow(credentialId) { + const rows = await db + .select({ + id: credential.id, + tenantId: credential.tenantId, + type: credential.type, + status: credential.status, + secret: credential.secret, + refreshSecret: credential.refreshSecret, + expiresAt: credential.expiresAt, + providerName: provider.name, + apiBaseUrl: provider.apiBaseUrl, + metadata: credential.metadata, + }) + .from(credential) + .innerJoin(provider, eq(provider.id, credential.providerId)) + .where(eq(credential.id, credentialId)) + .limit(1); + return rows[0] ?? null; + }, + async applyRefreshedTokens(credentialId, tokens) { + const now = new Date(); + const encryptedSecret = await credentialCipher.encrypt( + tokens.secret, + credentialAad(credentialId, "secret"), + ); + const encryptedRefreshSecret = + tokens.refreshSecret === undefined + ? undefined + : await credentialCipher.encrypt( + tokens.refreshSecret, + credentialAad(credentialId, "refreshSecret"), + ); + // Only an `active` row is updated: a row a racing writer already + // claimed as expired/re-auth-required must not be resurrected with + // fresh tokens — the false return is the caller's lost-race signal. + const updated = await db + .update(credential) + .set({ + secret: encryptedSecret, + ...(encryptedRefreshSecret !== undefined + ? { refreshSecret: encryptedRefreshSecret } + : {}), + expiresAt: tokens.expiresAt, + updatedAt: now, + }) + .where( + and(eq(credential.id, credentialId), eq(credential.status, "active")), + ) + .returning({ id: credential.id }); + return updated.length > 0; + }, + async markReauthRequired(credentialId, _reason) { + await db + .update(credential) + .set({ + status: "error", + updatedAt: new Date(), + }) + .where(eq(credential.id, credentialId)); + }, + pushUpdates: (tenantId) => + pushSourceUpdates(db, sidecarRouter, tenantId, credentialCipher), + decrypt: (credentialId, column, value) => + credentialCipher.decrypt(value, credentialAad(credentialId, column)), + async loadDueRows(tenantId, cutoff) { + return db + .select({ + id: credential.id, + tenantId: credential.tenantId, + type: credential.type, + status: credential.status, + refreshSecret: credential.refreshSecret, + expiresAt: credential.expiresAt, + }) + .from(credential) + .where( + and( + eq(credential.tenantId, tenantId), + eq(credential.type, "oauth_token"), + eq(credential.status, "active"), + isNotNull(credential.expiresAt), + lte(credential.expiresAt, cutoff), + ), + ); + }, + }; +} + +/** + * The tenant-wide serving-time trigger: refresh every due `oauth_token` + * credential in the tenant, then (per credential, inside the hook) push the + * updated frames. Runs best-effort ahead of a serving dial — the chat + * platform calls it at `sendMail` — never rejecting, so a refresh failure + * only marks the credential and lets the dial fail over to a live source. + */ +export function createTenantServingRefresh( + deps: ServingRefreshDeps & { skewLeadMs?: number }, +): (tenantId: string) => Promise { + const refresh = createServingRefresh(deps); + const skewLeadMs = deps.skewLeadMs ?? 60 * 1000; + const now = deps.now ?? Date.now; + return async (tenantId: string) => { + const due = await deps.store.loadDueRows( + tenantId, + new Date(now() + skewLeadMs), + ); + await Promise.all(due.map((row) => refresh(row))); + }; +} diff --git a/apps/hub/src/index.ts b/apps/hub/src/index.ts index 1ef79d6731..00bdb34ca9 100644 --- a/apps/hub/src/index.ts +++ b/apps/hub/src/index.ts @@ -337,6 +337,10 @@ import { createCredentialExpirySweep, createDrizzleCredentialExpirySweepStore, } from "./credential-expiry-sweep"; +import { + createDrizzleServingRefreshStore, + createTenantServingRefresh, +} from "./credential-material-refresh"; import { createDrizzleInboxUnsnoozeSweepStore, createInboxUnsnoozeSweep, @@ -1560,6 +1564,18 @@ export async function createHub(config: HubConfig) { toolGrantsForPins, cryptoProviders, workflowAllocationService, + // CL-7505: serving-time token refresh — every outbound mail refreshes + // the tenant's due oauth_token credentials first and pushes the + // refreshed frames, so the run dials on a live token or fails over + // past a credential that just went re-auth-required. + refreshServingCredentials: createTenantServingRefresh({ + store: createDrizzleServingRefreshStore( + db, + credentialCipher, + sidecarRouter, + ), + hubUrl: config.baseUrl, + }), // Chat residents are undeployed on idle again (see the comment above // this function): `chatIdleReapMs` (env-overridable via // `WORKBENCH_CHAT_IDLE_REAP_MS`, default 30 minutes) is diff --git a/bun.lock b/bun.lock index dd09e690a6..6c785a3269 100644 --- a/bun.lock +++ b/bun.lock @@ -209,7 +209,7 @@ }, "packages/access-tools": { "name": "@corbits/access-tools", - "version": "0.0.1", + "version": "0.0.2", "dependencies": { "@corbits/error-sink": "workspace:*", "@intx/agent": "workspace:*", @@ -433,7 +433,7 @@ }, "packages/catalog-tools": { "name": "@corbits/catalog-tools", - "version": "0.0.4", + "version": "0.0.5", "dependencies": { "@corbits/error-sink": "workspace:*", "@intx/agent": "workspace:*", @@ -590,6 +590,7 @@ "@corbits/hub-api-client": "workspace:*", "@corbits/inference-settings": "workspace:*", "@corbits/mcp-tools": "workspace:*", + "@corbits/oauth-core": "workspace:*", "@corbits/seeding": "workspace:*", "@intx/crypto": "0.3.0", "@intx/db": "workspace:*", @@ -873,7 +874,7 @@ }, "packages/interaction-tools": { "name": "@corbits/interaction-tools", - "version": "0.0.7", + "version": "0.0.8", "dependencies": { "@corbits/error-sink": "workspace:*", "@intx/agent": "workspace:*", @@ -1453,7 +1454,7 @@ }, "packages/workflow-authoring-tools": { "name": "@corbits/workflow-authoring-tools", - "version": "0.0.4", + "version": "0.0.5", "dependencies": { "@corbits/workflows": "workspace:*", "@intx/agent": "workspace:*", @@ -1704,6 +1705,22 @@ "typescript": "catalog:", }, }, + "vendor/intx/oauth-core": { + "name": "@corbits/oauth-core", + "version": "0.1.0", + "dependencies": { + "arktype": "2.2.3", + }, + "devDependencies": { + "@eslint/js": "9.34.0", + "@types/bun": "1.3.9", + "eslint": "9.34.0", + "jiti": "2.5.1", + "prettier": "3.6.2", + "typescript": "5.9.3", + "typescript-eslint": "8.42.0", + }, + }, "vendor/intx/types": { "name": "@intx/types", "version": "0.3.0", @@ -2226,6 +2243,8 @@ "@corbits/notify": ["@corbits/notify@workspace:packages/notify"], + "@corbits/oauth-core": ["@corbits/oauth-core@workspace:vendor/intx/oauth-core"], + "@corbits/ollama-adapter": ["@corbits/ollama-adapter@workspace:packages/ollama-adapter"], "@corbits/pain-point-collateral-workflow": ["@corbits/pain-point-collateral-workflow@workspace:workflows/pain-point-collateral"], @@ -2358,6 +2377,8 @@ "@eslint/core": ["@eslint/core@1.2.1", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ=="], + "@eslint/eslintrc": ["@eslint/eslintrc@3.3.7", "", { "dependencies": { "ajv": "^6.14.0", "debug": "^4.3.2", "espree": "^10.0.1", "globals": "^14.0.0", "ignore": "^5.2.0", "import-fresh": "^3.2.1", "js-yaml": "^4.3.2", "minimatch": "^3.1.5", "strip-json-comments": "^3.1.1" } }, "sha512-F42g89Qd5oAWtp0k0nnSrjziAKza7w8SVT4mStc18LZMaRb4J1HQAHLCalEtDCxrTuksx7NU9qsmeLwpOfPqWw=="], + "@eslint/js": ["@eslint/js@10.0.1", "", { "peerDependencies": { "eslint": "^10.0.0" }, "optionalPeers": ["eslint"] }, "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA=="], "@eslint/object-schema": ["@eslint/object-schema@3.0.5", "", {}, "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw=="], @@ -2466,6 +2487,12 @@ "@noble/hashes": ["@noble/hashes@2.4.0", "", {}, "sha512-X5XaVWZIBCT7HHZGm5I7ZQXDwLG+bGXuSrMQAW+7Zvl87h1kmc1ZB1VSRJcpUfoUrGQp4Fkoxm5kZ+Ms+aW+eA=="], + "@nodelib/fs.scandir": ["@nodelib/fs.scandir@2.1.5", "", { "dependencies": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" } }, "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g=="], + + "@nodelib/fs.stat": ["@nodelib/fs.stat@2.0.5", "", {}, "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A=="], + + "@nodelib/fs.walk": ["@nodelib/fs.walk@1.2.8", "", { "dependencies": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" } }, "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg=="], + "@npmcli/agent": ["@npmcli/agent@4.0.2", "", { "dependencies": { "agent-base": "^7.1.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.1", "lru-cache": "^11.2.1", "socks-proxy-agent": "^8.0.3" } }, "sha512-EUEuWAxnL07Sp5/iC/1X6Xj+XThUvnbei9zfRWZdEXa7lss9RTHMhAHBeg+MZ5To9s/gGaSI+UwZTPdYMvKSeg=="], "@npmcli/fs": ["@npmcli/fs@5.0.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-7OsC1gNORBEawOa5+j2pXN9vsicaIOH5cPXxoR6fJOmH6/EXpJB2CajXOu1fPRFun2m1lktEFX11+P89hqO/og=="], @@ -2744,7 +2771,9 @@ "ansi-regex": ["ansi-regex@6.3.0", "", {}, "sha512-WpDfL7NO6j7tH88IDBNVdUJxDh9nmCteAVW9dsep846XdwF4naCBK+/tGLX3KJgcpgMRXCFlTM2hKGoK9FsdrQ=="], - "ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], + "ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "^2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="], + + "argparse": ["argparse@2.0.1", "", {}, "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q=="], "aria-hidden": ["aria-hidden@1.2.6", "", { "dependencies": { "tslib": "^2.0.0" } }, "sha512-ik3ZgC9dY/lYVVM++OISsaYDeg1tb0VtP5uL3ouh1koGOaUMDPpbFIei4JkFimWUFPn90sbMNMXQAIVOlnYKJA=="], @@ -2776,6 +2805,8 @@ "brace-expansion": ["brace-expansion@5.0.9", "", { "dependencies": { "balanced-match": "^4.0.2" } }, "sha512-ScQ4IuvIEF1TMlP7Zt+vjJ//9zlPb2SDcxWxM3bk8s6t6GGdJ7KO1dCcTidOPJKePW30LE/2cT7wCyPho9/Wxg=="], + "braces": ["braces@3.0.3", "", { "dependencies": { "fill-range": "^7.1.1" } }, "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA=="], + "browserslist": ["browserslist@4.28.9", "", { "dependencies": { "baseline-browser-mapping": "^2.11.20", "caniuse-lite": "^1.0.30001810", "electron-to-chromium": "^1.5.420", "node-releases": "^2.0.54", "update-browserslist-db": "^1.3.2" }, "bin": { "browserslist": "cli.js" } }, "sha512-EWazOblFYUvlGZcfGhPUPmYh3nikUxBVb+y9MJun5f3hBi812X+8MSQTujLBtgK3cf51fJWbWfOjyeO954d+Eg=="], "buffer": ["buffer@6.0.3", "", { "dependencies": { "base64-js": "^1.3.1", "ieee754": "^1.2.1" } }, "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA=="], @@ -2798,6 +2829,8 @@ "call-bound": ["call-bound@1.0.4", "", { "dependencies": { "call-bind-apply-helpers": "^1.0.2", "get-intrinsic": "^1.3.0" } }, "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg=="], + "callsites": ["callsites@3.1.0", "", {}, "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="], + "caniuse-lite": ["caniuse-lite@1.0.30001810", "", {}, "sha512-TITQPUkaz+aVk5GL6NhOdwk1aEaNTSDPsGFWrTuhKGtjTF70jL/Oht2W4c6rXUe5fu7Ie19VIahAXHIIiWWNeg=="], "ccount": ["ccount@2.0.1", "", {}, "sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg=="], @@ -2820,10 +2853,16 @@ "clsx": ["clsx@2.1.1", "", {}, "sha512-eYm0QWBtUrBWZWG0d386OGAw16Z995PiOVo2B7bjWSbHedGl5e0ZWaq65kOGgUSNesEIDkB9ISbTg/JK9dhCZA=="], + "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "~1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="], + + "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="], + "combined-stream": ["combined-stream@1.0.8", "", { "dependencies": { "delayed-stream": "~1.0.0" } }, "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="], "compare-versions": ["compare-versions@6.1.1", "", {}, "sha512-4hm4VPpIecmlg59CHXnRDnqGplJFrbLG4aFEl5vl6cK1u76ws3LLvX7ikFnTDl5vo39sjWD6AaDPYodJp/NNHg=="], + "concat-map": ["concat-map@0.0.1", "", {}, "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="], + "content-disposition": ["content-disposition@1.1.0", "", {}, "sha512-5jRCH9Z/+DRP7rkvY83B+yGIGX96OYdJmzngqnw2SBSxqCFPd0w2km3s5iawpGX8krnwSGmF0FW5Nhr0Hfai3g=="], "content-type": ["content-type@1.0.5", "", {}, "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA=="], @@ -2948,6 +2987,8 @@ "fast-deep-equal": ["fast-deep-equal@3.1.3", "", {}, "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q=="], + "fast-glob": ["fast-glob@3.3.3", "", { "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", "glob-parent": "^5.1.2", "merge2": "^1.3.0", "micromatch": "^4.0.8" } }, "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg=="], + "fast-json-stable-stringify": ["fast-json-stable-stringify@2.1.0", "", {}, "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw=="], "fast-levenshtein": ["fast-levenshtein@2.0.6", "", {}, "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw=="], @@ -2956,10 +2997,14 @@ "fast-uri": ["fast-uri@3.1.7", "", {}, "sha512-dOvZVzjdZdz7phd9v6jCbwxrBW3fK6n8Rc0CtdmM4bumzMnxywBYhuph6J819RRw/ku+rLbelwfMunktuzVVHg=="], + "fastq": ["fastq@1.20.3", "", { "dependencies": { "reusify": "^1.0.4" } }, "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw=="], + "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="], "file-entry-cache": ["file-entry-cache@11.1.5", "", { "dependencies": { "flat-cache": "^6.1.23" } }, "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q=="], + "fill-range": ["fill-range@7.1.1", "", { "dependencies": { "to-regex-range": "^5.0.1" } }, "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg=="], + "finalhandler": ["finalhandler@2.1.1", "", { "dependencies": { "debug": "^4.4.0", "encodeurl": "^2.0.0", "escape-html": "^1.0.3", "on-finished": "^2.4.1", "parseurl": "^1.3.3", "statuses": "^2.0.1" } }, "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA=="], "find-up": ["find-up@5.0.0", "", { "dependencies": { "locate-path": "^6.0.0", "path-exists": "^4.0.0" } }, "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng=="], @@ -3002,12 +3047,18 @@ "glob-parent": ["glob-parent@6.0.2", "", { "dependencies": { "is-glob": "^4.0.3" } }, "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A=="], + "globals": ["globals@14.0.0", "", {}, "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ=="], + "gopd": ["gopd@1.2.0", "", {}, "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg=="], "graceful-fs": ["graceful-fs@4.2.11", "", {}, "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ=="], + "graphemer": ["graphemer@1.4.0", "", {}, "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag=="], + "happy-dom": ["happy-dom@20.14.0", "", { "dependencies": { "@types/node": ">=20.0.0", "@types/whatwg-mimetype": "^3.0.2", "@types/ws": "^8.18.1", "buffer-image-size": "^0.6.4", "entities": "^7.0.1", "whatwg-mimetype": "^3.0.0", "ws": "^8.21.0" } }, "sha512-4bRh1KzRvKDnFNTlLhzT1RZTpkKhQbQDl9j+7GXszWsvuspYdo29k6OHRf4PwiM6oLb8r/pMWeYiJjkfod5AvQ=="], + "has-flag": ["has-flag@4.0.0", "", {}, "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="], + "has-property-descriptors": ["has-property-descriptors@1.0.2", "", { "dependencies": { "es-define-property": "^1.0.0" } }, "sha512-55JNKuIW+vq4Ke1BjOTjM2YctQIvCT7GFzHwmfZPGo5wnrgkid0YQtnAleFSqumZm4az3n2BS+erby5ipJdgrg=="], "has-symbols": ["has-symbols@1.1.0", "", {}, "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ=="], @@ -3040,6 +3091,8 @@ "ignore": ["ignore@5.3.2", "", {}, "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g=="], + "import-fresh": ["import-fresh@3.3.1", "", { "dependencies": { "parent-module": "^1.0.0", "resolve-from": "^4.0.0" } }, "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ=="], + "imurmurhash": ["imurmurhash@0.1.4", "", {}, "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA=="], "inherits": ["inherits@2.0.4", "", {}, "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="], @@ -3056,6 +3109,8 @@ "is-glob": ["is-glob@4.0.3", "", { "dependencies": { "is-extglob": "^2.1.1" } }, "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg=="], + "is-number": ["is-number@7.0.0", "", {}, "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng=="], + "is-plain-obj": ["is-plain-obj@4.1.0", "", {}, "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg=="], "is-promise": ["is-promise@4.0.0", "", {}, "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ=="], @@ -3080,8 +3135,12 @@ "js-tokens": ["js-tokens@4.0.0", "", {}, "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ=="], + "js-yaml": ["js-yaml@4.3.2", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-SFNOvSJ+Dgf/9An904Yx+CgSlIPCkIpao4qo51lpee25TIRejdH3rhR4EZMGoNx3/TP3O+wzWuiTFl4sqbltzA=="], + "jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="], + "json-buffer": ["json-buffer@3.0.1", "", {}, "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ=="], + "json-schema-traverse": ["json-schema-traverse@0.4.1", "", {}, "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="], "json-schema-typed": ["json-schema-typed@8.0.2", "", {}, "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA=="], @@ -3096,7 +3155,7 @@ "just-once": ["just-once@1.1.0", "", {}, "sha512-+rZVpl+6VyTilK7vB/svlMPil4pxqIJZkbnN7DKZTOzyXfun6ZiFeq2Pk4EtCEHZ0VU4EkdFzG8ZK5F3PErcDw=="], - "keyv": ["keyv@5.6.0", "", { "dependencies": { "@keyv/serialize": "^1.1.1" } }, "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw=="], + "keyv": ["keyv@4.5.4", "", { "dependencies": { "json-buffer": "3.0.1" } }, "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw=="], "kysely": ["kysely@0.29.5", "", {}, "sha512-ooa+eSbBNPTo3MycPEuW5jdrxQdQwdtB3LC3h43FiXQbIry5tR0C5lDG7eealK0E4D7XjrnOP5DIUg/LyjRMYQ=="], @@ -3130,6 +3189,8 @@ "locate-path": ["locate-path@6.0.0", "", { "dependencies": { "p-locate": "^5.0.0" } }, "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw=="], + "lodash.merge": ["lodash.merge@4.6.2", "", {}, "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ=="], + "longest-streak": ["longest-streak@3.1.0", "", {}, "sha512-9Ri+o0JYgehTaVBBDoMqIl8GXtbWg711O3srftcHhZ0dqnETqLaoIK0x17fUw9rFSlK/0NlsKe0Ahhyl5pXE2g=="], "lru-cache": ["lru-cache@11.5.2", "", {}, "sha512-4pfM1Ff0x50o0tQwb5ucw/RzNyD0/YJME6IVcStalZuMWxdt3sR3huStTtxz4PUmvZfRguvDejasvQ2kifR11g=="], @@ -3170,6 +3231,8 @@ "merge-descriptors": ["merge-descriptors@2.0.0", "", {}, "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g=="], + "merge2": ["merge2@1.4.1", "", {}, "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="], + "micromark": ["micromark@4.0.2", "", { "dependencies": { "@types/debug": "^4.0.0", "debug": "^4.0.0", "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-core-commonmark": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-combine-extensions": "^2.0.0", "micromark-util-decode-numeric-character-reference": "^2.0.0", "micromark-util-encode": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-sanitize-uri": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-zpe98Q6kvavpCr1NPVSCMebCKfD7CA2NqZ+rykeNhONIJBpc1tFKt9hucLGwha3jNTNI8lHpctWJWoimVF4PfA=="], "micromark-core-commonmark": ["micromark-core-commonmark@2.0.3", "", { "dependencies": { "decode-named-character-reference": "^1.0.0", "devlop": "^1.0.0", "micromark-factory-destination": "^2.0.0", "micromark-factory-label": "^2.0.0", "micromark-factory-space": "^2.0.0", "micromark-factory-title": "^2.0.0", "micromark-factory-whitespace": "^2.0.0", "micromark-util-character": "^2.0.0", "micromark-util-chunked": "^2.0.0", "micromark-util-classify-character": "^2.0.0", "micromark-util-html-tag-name": "^2.0.0", "micromark-util-normalize-identifier": "^2.0.0", "micromark-util-resolve-all": "^2.0.0", "micromark-util-subtokenize": "^2.0.0", "micromark-util-symbol": "^2.0.0", "micromark-util-types": "^2.0.0" } }, "sha512-RDBrHEMSxVFLg6xvnXmb1Ayr2WzLAWjeSATAoxwKYJV94TeNavgoIdA0a9ytzDSVzBy2YKFK+emCPOEibLeCrg=="], @@ -3226,6 +3289,8 @@ "micromark-util-types": ["micromark-util-types@2.0.2", "", {}, "sha512-Yw0ECSpJoViF1qTU4DC6NwtC4aWGt1EkzaQB8KPPyCRR8z9TWeV0HbEFGTO+ZY1wB22zmxnJqhPyTpOVCpeHTA=="], + "micromatch": ["micromatch@4.0.8", "", { "dependencies": { "braces": "^3.0.3", "picomatch": "^2.3.1" } }, "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA=="], + "mime-db": ["mime-db@1.54.0", "", {}, "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ=="], "mime-types": ["mime-types@3.0.2", "", { "dependencies": { "mime-db": "^1.54.0" } }, "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A=="], @@ -3310,6 +3375,8 @@ "pako": ["pako@1.0.11", "", {}, "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw=="], + "parent-module": ["parent-module@1.0.1", "", { "dependencies": { "callsites": "^3.0.0" } }, "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g=="], + "parseurl": ["parseurl@1.3.3", "", {}, "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="], "path-exists": ["path-exists@4.0.0", "", {}, "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="], @@ -3358,6 +3425,8 @@ "quansync": ["quansync@0.2.11", "", {}, "sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA=="], + "queue-microtask": ["queue-microtask@1.2.3", "", {}, "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A=="], + "range-parser": ["range-parser@1.3.0", "", {}, "sha512-hek2mFQpPuI4E1BBKrSto+BU3e3x4xuarsbiwr3+lf7p44juvFMV0XFWQAP3xUyqXA4RrXLIoaSUGbSt056ZMw=="], "raw-body": ["raw-body@3.0.2", "", { "dependencies": { "bytes": "~3.1.2", "http-errors": "~2.0.1", "iconv-lite": "~0.7.0", "unpipe": "~1.0.0" } }, "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA=="], @@ -3386,16 +3455,22 @@ "require-from-string": ["require-from-string@2.0.2", "", {}, "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw=="], + "resolve-from": ["resolve-from@4.0.0", "", {}, "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g=="], + "resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="], "retry": ["retry@0.13.1", "", {}, "sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg=="], + "reusify": ["reusify@1.1.0", "", {}, "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw=="], + "rollup": ["rollup@4.63.1", "", { "dependencies": { "@types/estree": "1.0.9" }, "optionalDependencies": { "@napi-rs/lzma-linux-x64-gnu": "1.5.1", "@rollup/rollup-android-arm-eabi": "4.63.1", "@rollup/rollup-android-arm64": "4.63.1", "@rollup/rollup-darwin-arm64": "4.63.1", "@rollup/rollup-darwin-x64": "4.63.1", "@rollup/rollup-freebsd-arm64": "4.63.1", "@rollup/rollup-freebsd-x64": "4.63.1", "@rollup/rollup-linux-arm-gnueabihf": "4.63.1", "@rollup/rollup-linux-arm-musleabihf": "4.63.1", "@rollup/rollup-linux-arm64-gnu": "4.63.1", "@rollup/rollup-linux-arm64-musl": "4.63.1", "@rollup/rollup-linux-loong64-gnu": "4.63.1", "@rollup/rollup-linux-loong64-musl": "4.63.1", "@rollup/rollup-linux-ppc64-gnu": "4.63.1", "@rollup/rollup-linux-ppc64-musl": "4.63.1", "@rollup/rollup-linux-riscv64-gnu": "4.63.1", "@rollup/rollup-linux-riscv64-musl": "4.63.1", "@rollup/rollup-linux-s390x-gnu": "4.63.1", "@rollup/rollup-linux-x64-gnu": "4.63.1", "@rollup/rollup-linux-x64-musl": "4.63.1", "@rollup/rollup-openbsd-x64": "4.63.1", "@rollup/rollup-openharmony-arm64": "4.63.1", "@rollup/rollup-win32-arm64-msvc": "4.63.1", "@rollup/rollup-win32-ia32-msvc": "4.63.1", "@rollup/rollup-win32-x64-gnu": "4.63.1", "@rollup/rollup-win32-x64-msvc": "4.63.1", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-3Df9jsstwhccuEfmAMi9l8XUh/GOkVObmFTU7CCVBysEbcOZLl84jCtaAZMcPiMz2EGKsATzQcU+Xr3n/wU6cg=="], "rou3": ["rou3@0.9.2", "", {}, "sha512-3SOzvaAg8rkHrXtRjpCvCvbyO5to9oOO27Z/XqHEYXfMRVSw/qMIVdmaOk9W2lcRLtR6dlqTjo9hDeJk70QBYQ=="], "router": ["router@2.2.0", "", { "dependencies": { "debug": "^4.4.0", "depd": "^2.0.0", "is-promise": "^4.0.0", "parseurl": "^1.3.3", "path-to-regexp": "^8.0.0" } }, "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ=="], + "run-parallel": ["run-parallel@1.2.0", "", { "dependencies": { "queue-microtask": "^1.2.2" } }, "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA=="], + "safe-buffer": ["safe-buffer@5.2.1", "", {}, "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="], "safer-buffer": ["safer-buffer@2.1.2", "", {}, "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="], @@ -3458,6 +3533,10 @@ "strip-ansi": ["strip-ansi@7.2.0", "", { "dependencies": { "ansi-regex": "^6.2.2" } }, "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w=="], + "strip-json-comments": ["strip-json-comments@3.1.1", "", {}, "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig=="], + + "supports-color": ["supports-color@7.2.0", "", { "dependencies": { "has-flag": "^4.0.0" } }, "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw=="], + "tailwind-merge": ["tailwind-merge@3.6.0", "", {}, "sha512-uxL7qAVQriqRQPAyK3pj66VqskWqoZ37PW94jwOTwNfq/z9oyu1V+eqrZqtR2+fCiXdYOZe/Modt8GtvqNzu+w=="], "tailwindcss": ["tailwindcss@4.3.3", "", {}, "sha512-gOhV3P7ufE62QDGg1zVaTgCR+EtPv92k2nIhVcVKcLmxT1sUBsQGhnZj175j+MqRt4zLF7ic+sCYjfhxMxj7YQ=="], @@ -3470,6 +3549,8 @@ "to-buffer": ["to-buffer@1.2.2", "", { "dependencies": { "isarray": "^2.0.5", "safe-buffer": "^5.2.1", "typed-array-buffer": "^1.0.3" } }, "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw=="], + "to-regex-range": ["to-regex-range@5.0.1", "", { "dependencies": { "is-number": "^7.0.0" } }, "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ=="], + "toidentifier": ["toidentifier@1.0.1", "", {}, "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="], "trough": ["trough@2.2.0", "", {}, "sha512-tmMpK00BjZiUyVyvrBK7knerNgmgvcV/KLVyuma/SC+TQN167GrMRciANTz09+k3zW8L8t60jWO1GpfkZdjTaw=="], @@ -3574,22 +3655,40 @@ "@babel/helper-compilation-targets/semver": ["semver@6.3.1", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA=="], - "@corbits/artifacts-hub/@corbits/artifacts": ["@corbits/artifacts@github:corbitsdev/corbits-artifacts#dc435ba", { "dependencies": { "@hono/standard-validator": "^0.2.3" }, "peerDependencies": { "@intx/hub-api": "^0.2.2", "@intx/types": "^0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.2", "hono": "^4.12.32", "hono-openapi": "^1.2.0", "postgres": "^3.4.9" } }, "corbitsdev-corbits-artifacts-dc435ba", "sha512-VksIyrrJY9nRke0QyjgqGdW3gLD73Bi3+CzpJWG+l8vRJKdUxVi7ms2Mp95NmJXr4TpVX6i1z4odufX/QBxnSw=="], + "@cacheable/memory/keyv": ["keyv@5.6.0", "", { "dependencies": { "@keyv/serialize": "^1.1.1" } }, "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw=="], - "@corbits/chat-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "@cacheable/utils/keyv": ["keyv@5.6.0", "", { "dependencies": { "@keyv/serialize": "^1.1.1" } }, "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw=="], - "@corbits/context-menu/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "@corbits/inbox/@corbits/mailbox": ["@corbits/mailbox@github:corbitsdev/corbits-mailbox#118a2cd", { "dependencies": { "@hono/standard-validator": "0.2.3", "@standard-community/standard-json": "0.3.5", "@standard-community/standard-openapi": "0.2.9", "arktype": "2.1.29", "hono-openapi": "1.3.1" }, "peerDependencies": { "@intx/log": "^0.2.2", "@intx/mime": "^0.2.2", "@intx/types": "^0.2.2", "drizzle-orm": "^0.45.2", "hono": "^4.12.0", "postgres": "^3.4.0" } }, "corbitsdev-corbits-mailbox-118a2cd", "sha512-jVRl6/IH34JBPVUz7mqWyBm1w7uJxvYAI27gjw7zL1dFO4L+D0E5q/8b+mpwKMNOKKlGXU6UF5pdHnY8ilYx8g=="], "@corbits/mailbox/hono-openapi": ["hono-openapi@1.3.1", "", { "peerDependencies": { "@hono/standard-validator": "^0.2.0", "@standard-community/standard-json": "^0.3.5", "@standard-community/standard-openapi": "^0.2.9", "@types/json-schema": "^7.0.15", "hono": "^4.11.2", "openapi-types": "^12.1.3" }, "optionalPeers": ["@hono/standard-validator", "hono"] }, "sha512-NLVeVkhKZ3drmQNEIPac8HX8Y54uf1hJAgIM/7MfDsaeVVmB+QILWQxx5x3R3NvRHgedcbEbOCGY2uR7WQYyMw=="], - "@corbits/plugins-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "@corbits/memory-hub/@corbits/memory": ["@corbits/memory@github:corbitsdev/corbits-memory#9e6f213", { "dependencies": { "@intx/agent": "0.2.2", "@intx/authz": "0.2.2", "@intx/hub-api": "0.2.2", "@intx/log": "0.2.2", "@intx/workflow": "0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.1", "hono": "^4.9.0", "hono-openapi": "^1.3.1", "postgres": "^3.4.7" } }, "corbitsdev-corbits-memory-9e6f213", "sha512-utnM4ZT2zmslcPXYWAAqxlDNLcpGsXFiTOtj8h7+OXnhCP0Eaw8yl25+yCTyHpvt3jcdeG4h5uFsSj7ou0BZCA=="], + + "@corbits/oauth-core/@eslint/js": ["@eslint/js@9.34.0", "", {}, "sha512-EoyvqQnBNsV1CWaEJ559rxXL4c8V92gxirbawSmVUOWXlsRxxQXl6LmCpdUblgxgSkDIqKnhzba2SjRTI/A5Rw=="], + + "@corbits/oauth-core/@types/bun": ["@types/bun@1.3.9", "", { "dependencies": { "bun-types": "1.3.9" } }, "sha512-KQ571yULOdWJiMH+RIWIOZ7B2RXQGpL1YQrBtLIV3FqDcCu6FsbFUBwhdKUlCKUpS3PJDsHlJ1QKlpxoVR+xtw=="], + + "@corbits/oauth-core/eslint": ["eslint@9.34.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", "@eslint/config-array": "^0.21.0", "@eslint/config-helpers": "^0.3.1", "@eslint/core": "^0.15.2", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "9.34.0", "@eslint/plugin-kit": "^0.3.5", "@humanfs/node": "^0.16.6", "@humanwhocodes/module-importer": "^1.0.1", "@humanwhocodes/retry": "^0.4.2", "@types/estree": "^1.0.6", "@types/json-schema": "^7.0.15", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.6", "debug": "^4.3.2", "escape-string-regexp": "^4.0.0", "eslint-scope": "^8.4.0", "eslint-visitor-keys": "^4.2.1", "espree": "^10.4.0", "esquery": "^1.5.0", "esutils": "^2.0.2", "fast-deep-equal": "^3.1.3", "file-entry-cache": "^8.0.0", "find-up": "^5.0.0", "glob-parent": "^6.0.2", "ignore": "^5.2.0", "imurmurhash": "^0.1.4", "is-glob": "^4.0.0", "json-stable-stringify-without-jsonify": "^1.0.1", "lodash.merge": "^4.6.2", "minimatch": "^3.1.2", "natural-compare": "^1.4.0", "optionator": "^0.9.3" }, "peerDependencies": { "jiti": "*" }, "optionalPeers": ["jiti"], "bin": { "eslint": "bin/eslint.js" } }, "sha512-RNCHRX5EwdrESy3Jc9o8ie8Bog+PeYvvSR8sDGoZxNFTvZ4dlxUB3WzQ3bQMztFrSRODGrLLj8g6OFuGY/aiQg=="], + + "@corbits/oauth-core/jiti": ["jiti@2.5.1", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-twQoecYPiVA5K/h6SxtORw/Bs3ar+mLUtoPSc7iMXzQzK8d7eJ/R09wmTwAjiamETn1cXYPGfNnu7DMoHgu12w=="], - "@corbits/settings-ui/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "@corbits/oauth-core/prettier": ["prettier@3.6.2", "", { "bin": { "prettier": "bin/prettier.cjs" } }, "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ=="], + + "@corbits/oauth-core/typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="], + + "@corbits/oauth-core/typescript-eslint": ["typescript-eslint@8.42.0", "", { "dependencies": { "@typescript-eslint/eslint-plugin": "8.42.0", "@typescript-eslint/parser": "8.42.0", "@typescript-eslint/typescript-estree": "8.42.0", "@typescript-eslint/utils": "8.42.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-ozR/rQn+aQXQxh1YgbCzQWDFrsi9mcg+1PM3l/z5o1+20P7suOIaNg515bpr/OYt6FObz/NHcBstydDLHWeEKg=="], "@esbuild-kit/core-utils/esbuild": ["esbuild@0.18.20", "", { "optionalDependencies": { "@esbuild/android-arm": "0.18.20", "@esbuild/android-arm64": "0.18.20", "@esbuild/android-x64": "0.18.20", "@esbuild/darwin-arm64": "0.18.20", "@esbuild/darwin-x64": "0.18.20", "@esbuild/freebsd-arm64": "0.18.20", "@esbuild/freebsd-x64": "0.18.20", "@esbuild/linux-arm": "0.18.20", "@esbuild/linux-arm64": "0.18.20", "@esbuild/linux-ia32": "0.18.20", "@esbuild/linux-loong64": "0.18.20", "@esbuild/linux-mips64el": "0.18.20", "@esbuild/linux-ppc64": "0.18.20", "@esbuild/linux-riscv64": "0.18.20", "@esbuild/linux-s390x": "0.18.20", "@esbuild/linux-x64": "0.18.20", "@esbuild/netbsd-x64": "0.18.20", "@esbuild/openbsd-x64": "0.18.20", "@esbuild/sunos-x64": "0.18.20", "@esbuild/win32-arm64": "0.18.20", "@esbuild/win32-ia32": "0.18.20", "@esbuild/win32-x64": "0.18.20" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA=="], "@eslint-community/eslint-utils/eslint-visitor-keys": ["eslint-visitor-keys@3.4.3", "", {}, "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag=="], + "@eslint/eslintrc/espree": ["espree@10.4.0", "", { "dependencies": { "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^4.2.1" } }, "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ=="], + + "@eslint/eslintrc/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], + + "@keyv/bigmap/keyv": ["keyv@5.6.0", "", { "dependencies": { "@keyv/serialize": "^1.1.1" } }, "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw=="], + "@modelcontextprotocol/sdk/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="], "@npmcli/agent/https-proxy-agent": ["https-proxy-agent@7.0.6", "", { "dependencies": { "agent-base": "^7.1.2", "debug": "4" } }, "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw=="], @@ -3608,9 +3707,9 @@ "@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.8", "", {}, "sha512-YYNsSlXBjMk92SKnkwvB5LOVSa6OznlFUGcsvrFgNJbJCd0M1XKeFVRc8ZByeCqz32FivYNHJVooLmdqrmvp/Q=="], - "@workbench/hub/@corbits/artifacts": ["@corbits/artifacts@github:corbitsdev/corbits-artifacts#dc435ba", { "dependencies": { "@hono/standard-validator": "^0.2.3" }, "peerDependencies": { "@intx/hub-api": "^0.2.2", "@intx/types": "^0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.2", "hono": "^4.12.32", "hono-openapi": "^1.2.0", "postgres": "^3.4.9" } }, "corbitsdev-corbits-artifacts-dc435ba", "sha512-VksIyrrJY9nRke0QyjgqGdW3gLD73Bi3+CzpJWG+l8vRJKdUxVi7ms2Mp95NmJXr4TpVX6i1z4odufX/QBxnSw=="], + "@workbench/hub/@corbits/mailbox": ["@corbits/mailbox@github:corbitsdev/corbits-mailbox#118a2cd", { "dependencies": { "@hono/standard-validator": "0.2.3", "@standard-community/standard-json": "0.3.5", "@standard-community/standard-openapi": "0.2.9", "arktype": "2.1.29", "hono-openapi": "1.3.1" }, "peerDependencies": { "@intx/log": "^0.2.2", "@intx/mime": "^0.2.2", "@intx/types": "^0.2.2", "drizzle-orm": "^0.45.2", "hono": "^4.12.0", "postgres": "^3.4.0" } }, "corbitsdev-corbits-mailbox-118a2cd", "sha512-jVRl6/IH34JBPVUz7mqWyBm1w7uJxvYAI27gjw7zL1dFO4L+D0E5q/8b+mpwKMNOKKlGXU6UF5pdHnY8ilYx8g=="], - "@workbench/web/@corbits/react-ui": ["@corbits/react-ui@github:corbitsdev/react-ui#3b12281", { "dependencies": { "class-variance-authority": "^0.7.1", "clsx": "^2.1.1", "tailwind-merge": "^3.3.1" }, "peerDependencies": { "@radix-ui/react-dialog": "^1.1.15", "@radix-ui/react-dropdown-menu": "^2.1.16", "@radix-ui/react-slot": "^1.2.3", "@radix-ui/react-tooltip": "^1.2.8", "@tanstack/react-query": "^5.90.2", "lucide-react": "^0.545.0 || ^1.0.0", "react": "^18.2.0 || ^19.0.0", "react-dom": "^18.2.0 || ^19.0.0", "sonner": "^2.0.7" }, "optionalPeers": ["@tanstack/react-query"] }, "corbitsdev-react-ui-3b12281", "sha512-Abvm/DO0Gqg0ITHGT9355ZxyKRPMVJLSSQSjpd3a8qt4JPrSMOLIOS4sX8ZMNNaArIbnY9F+VKrOWkUJUyO4Nw=="], + "@workbench/hub/@corbits/memory": ["@corbits/memory@github:corbitsdev/corbits-memory#9e6f213", { "dependencies": { "@intx/agent": "0.2.2", "@intx/authz": "0.2.2", "@intx/hub-api": "0.2.2", "@intx/log": "0.2.2", "@intx/workflow": "0.2.2", "arktype": "^2.1.29", "drizzle-orm": "^0.45.1", "hono": "^4.9.0", "hono-openapi": "^1.3.1", "postgres": "^3.4.7" } }, "corbitsdev-corbits-memory-9e6f213", "sha512-utnM4ZT2zmslcPXYWAAqxlDNLcpGsXFiTOtj8h7+OXnhCP0Eaw8yl25+yCTyHpvt3jcdeG4h5uFsSj7ou0BZCA=="], "ajv-formats/ajv": ["ajv@8.20.0", "", { "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", "json-schema-traverse": "^1.0.0", "require-from-string": "^2.0.2" } }, "sha512-Thbli+OlOj+iMPYFBVBfJ3OmCAnaSyNn4M1vz9T6Gka5Jt9ba/HIR56joy65tY6kx/FCF5VXNB819Y7/GUrBGA=="], @@ -3620,10 +3719,14 @@ "cacache/ssri": ["ssri@13.0.1", "", { "dependencies": { "minipass": "^7.0.3" } }, "sha512-QUiRf1+u9wPTL/76GTYlKttDEBWV1ga9ZXW8BG6kfdeyyM8LGPix9gROyg9V2+P0xNyF3X2Go526xKFdMZrHSQ=="], + "cacheable/keyv": ["keyv@5.6.0", "", { "dependencies": { "@keyv/serialize": "^1.1.1" } }, "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw=="], + "chromium-bidi/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="], "cliui/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], + "fast-glob/glob-parent": ["glob-parent@5.1.2", "", { "dependencies": { "is-glob": "^4.0.1" } }, "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow=="], + "form-data/mime-types": ["mime-types@2.1.35", "", { "dependencies": { "mime-db": "1.52.0" } }, "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw=="], "hono-openapi/@hono/standard-validator": ["@hono/standard-validator@0.4.0", "", { "peerDependencies": { "@standard-schema/spec": "^1.0.0", "hono": ">=4.11.2" } }, "sha512-MxOm1asDh9j7c1D0KiWwppSbFgAQxTRO4YEhjMrJn3lF1BIcXenPdgjSGKDRfQmZdaTaMA8slQLETgVOKyJxFw=="], @@ -3642,6 +3745,8 @@ "mdast-util-find-and-replace/escape-string-regexp": ["escape-string-regexp@5.0.0", "", {}, "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw=="], + "micromatch/picomatch": ["picomatch@2.3.2", "", {}, "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA=="], + "minipass-flush/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], "minipass-pipeline/minipass": ["minipass@3.3.6", "", { "dependencies": { "yallist": "^4.0.0" } }, "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw=="], @@ -3662,10 +3767,44 @@ "vite/esbuild": ["esbuild@0.28.2", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.28.2", "@esbuild/android-arm": "0.28.2", "@esbuild/android-arm64": "0.28.2", "@esbuild/android-x64": "0.28.2", "@esbuild/darwin-arm64": "0.28.2", "@esbuild/darwin-x64": "0.28.2", "@esbuild/freebsd-arm64": "0.28.2", "@esbuild/freebsd-x64": "0.28.2", "@esbuild/linux-arm": "0.28.2", "@esbuild/linux-arm64": "0.28.2", "@esbuild/linux-ia32": "0.28.2", "@esbuild/linux-loong64": "0.28.2", "@esbuild/linux-mips64el": "0.28.2", "@esbuild/linux-ppc64": "0.28.2", "@esbuild/linux-riscv64": "0.28.2", "@esbuild/linux-s390x": "0.28.2", "@esbuild/linux-x64": "0.28.2", "@esbuild/netbsd-arm64": "0.28.2", "@esbuild/netbsd-x64": "0.28.2", "@esbuild/openbsd-arm64": "0.28.2", "@esbuild/openbsd-x64": "0.28.2", "@esbuild/openharmony-arm64": "0.28.2", "@esbuild/sunos-x64": "0.28.2", "@esbuild/win32-arm64": "0.28.2", "@esbuild/win32-ia32": "0.28.2", "@esbuild/win32-x64": "0.28.2" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA=="], + "wrap-ansi/ansi-styles": ["ansi-styles@6.2.3", "", {}, "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg=="], + "wrap-ansi/string-width": ["string-width@7.2.0", "", { "dependencies": { "emoji-regex": "^10.3.0", "get-east-asian-width": "^1.0.0", "strip-ansi": "^7.1.0" } }, "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ=="], "@babel/helper-compilation-targets/lru-cache/yallist": ["yallist@3.1.1", "", {}, "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g=="], + "@corbits/inbox/@corbits/mailbox/hono-openapi": ["hono-openapi@1.3.1", "", { "peerDependencies": { "@hono/standard-validator": "^0.2.0", "@standard-community/standard-json": "^0.3.5", "@standard-community/standard-openapi": "^0.2.9", "@types/json-schema": "^7.0.15", "hono": "^4.11.2", "openapi-types": "^12.1.3" }, "optionalPeers": ["@hono/standard-validator", "hono"] }, "sha512-NLVeVkhKZ3drmQNEIPac8HX8Y54uf1hJAgIM/7MfDsaeVVmB+QILWQxx5x3R3NvRHgedcbEbOCGY2uR7WQYyMw=="], + + "@corbits/oauth-core/@types/bun/bun-types": ["bun-types@1.3.9", "", { "dependencies": { "@types/node": "*" } }, "sha512-+UBWWOakIP4Tswh0Bt0QD0alpTY8cb5hvgiYeWCMet9YukHbzuruIEeXC2D7nMJPB12kbh8C7XJykSexEqGKJg=="], + + "@corbits/oauth-core/eslint/@eslint/config-array": ["@eslint/config-array@0.21.2", "", { "dependencies": { "@eslint/object-schema": "^2.1.7", "debug": "^4.3.1", "minimatch": "^3.1.5" } }, "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw=="], + + "@corbits/oauth-core/eslint/@eslint/config-helpers": ["@eslint/config-helpers@0.3.1", "", {}, "sha512-xR93k9WhrDYpXHORXpxVL5oHj3Era7wo6k/Wd8/IsQNnZUTzkGS29lyn3nAT05v6ltUuTFVCCYDEGfy2Or/sPA=="], + + "@corbits/oauth-core/eslint/@eslint/core": ["@eslint/core@0.15.2", "", { "dependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-78Md3/Rrxh83gCxoUc0EiciuOHsIITzLy53m3d9UyiW8y9Dj2D29FeETqyKA+BRK76tnTp6RXWb3pCay8Oyomg=="], + + "@corbits/oauth-core/eslint/@eslint/plugin-kit": ["@eslint/plugin-kit@0.3.5", "", { "dependencies": { "@eslint/core": "^0.15.2", "levn": "^0.4.1" } }, "sha512-Z5kJ+wU3oA7MMIqVR9tyZRtjYPr4OC004Q4Rw7pgOKUOKkJfZ3O24nz3WYfGRpMDNmcOi3TwQOmgm7B7Tpii0w=="], + + "@corbits/oauth-core/eslint/chalk": ["chalk@4.1.2", "", { "dependencies": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" } }, "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA=="], + + "@corbits/oauth-core/eslint/eslint-scope": ["eslint-scope@8.4.0", "", { "dependencies": { "esrecurse": "^4.3.0", "estraverse": "^5.2.0" } }, "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg=="], + + "@corbits/oauth-core/eslint/eslint-visitor-keys": ["eslint-visitor-keys@4.2.1", "", {}, "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="], + + "@corbits/oauth-core/eslint/espree": ["espree@10.4.0", "", { "dependencies": { "acorn": "^8.15.0", "acorn-jsx": "^5.3.2", "eslint-visitor-keys": "^4.2.1" } }, "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ=="], + + "@corbits/oauth-core/eslint/file-entry-cache": ["file-entry-cache@8.0.0", "", { "dependencies": { "flat-cache": "^4.0.0" } }, "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ=="], + + "@corbits/oauth-core/eslint/minimatch": ["minimatch@3.1.5", "", { "dependencies": { "brace-expansion": "^1.1.7" } }, "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/eslint-plugin": ["@typescript-eslint/eslint-plugin@8.42.0", "", { "dependencies": { "@eslint-community/regexpp": "^4.10.0", "@typescript-eslint/scope-manager": "8.42.0", "@typescript-eslint/type-utils": "8.42.0", "@typescript-eslint/utils": "8.42.0", "@typescript-eslint/visitor-keys": "8.42.0", "graphemer": "^1.4.0", "ignore": "^7.0.0", "natural-compare": "^1.4.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "@typescript-eslint/parser": "^8.42.0", "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-Aq2dPqsQkxHOLfb2OPv43RnIvfj05nw8v/6n3B2NABIPpHnjQnaLo9QGMTvml+tv4korl/Cjfrb/BYhoL8UUTQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/parser": ["@typescript-eslint/parser@8.42.0", "", { "dependencies": { "@typescript-eslint/scope-manager": "8.42.0", "@typescript-eslint/types": "8.42.0", "@typescript-eslint/typescript-estree": "8.42.0", "@typescript-eslint/visitor-keys": "8.42.0", "debug": "^4.3.4" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-r1XG74QgShUgXph1BYseJ+KZd17bKQib/yF3SR+demvytiRXrwd12Blnz5eYGm8tXaeRdd4x88MlfwldHoudGg=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree": ["@typescript-eslint/typescript-estree@8.42.0", "", { "dependencies": { "@typescript-eslint/project-service": "8.42.0", "@typescript-eslint/tsconfig-utils": "8.42.0", "@typescript-eslint/types": "8.42.0", "@typescript-eslint/visitor-keys": "8.42.0", "debug": "^4.3.4", "fast-glob": "^3.3.2", "is-glob": "^4.0.3", "minimatch": "^9.0.4", "semver": "^7.6.0", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-ku/uYtT4QXY8sl9EDJETD27o3Ewdi72hcXg1ah/kkUgBvAYHLwj2ofswFFNXS+FL5G+AGkxBtvGt8pFBHKlHsQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/utils": ["@typescript-eslint/utils@8.42.0", "", { "dependencies": { "@eslint-community/eslint-utils": "^4.7.0", "@typescript-eslint/scope-manager": "8.42.0", "@typescript-eslint/types": "8.42.0", "@typescript-eslint/typescript-estree": "8.42.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-JnIzu7H3RH5BrKC4NoZqRfmjqCIS1u3hGZltDYJgkVdqAezl4L9d1ZLw+36huCujtSBSAirGINF/S4UxOcR+/g=="], + "@esbuild-kit/core-utils/esbuild/@esbuild/android-arm": ["@esbuild/android-arm@0.18.20", "", { "os": "android", "cpu": "arm" }, "sha512-fyi7TDI/ijKKNZTUJAQqiG5T7YjJXgnzkURqmGj13C6dCqckZBLdl4h7bkhHt/t0WP+zO9/zwroDvANaOqO5Sw=="], "@esbuild-kit/core-utils/esbuild/@esbuild/android-arm64": ["@esbuild/android-arm64@0.18.20", "", { "os": "android", "cpu": "arm64" }, "sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ=="], @@ -3710,8 +3849,14 @@ "@esbuild-kit/core-utils/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.18.20", "", { "os": "win32", "cpu": "x64" }, "sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ=="], + "@eslint/eslintrc/espree/eslint-visitor-keys": ["eslint-visitor-keys@4.2.1", "", {}, "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="], + + "@eslint/eslintrc/minimatch/brace-expansion": ["brace-expansion@1.1.18", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw=="], + "@modelcontextprotocol/sdk/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], + "@workbench/hub/@corbits/mailbox/hono-openapi": ["hono-openapi@1.3.1", "", { "peerDependencies": { "@hono/standard-validator": "^0.2.0", "@standard-community/standard-json": "^0.3.5", "@standard-community/standard-openapi": "^0.2.9", "@types/json-schema": "^7.0.15", "hono": "^4.11.2", "openapi-types": "^12.1.3" }, "optionalPeers": ["@hono/standard-validator", "hono"] }, "sha512-NLVeVkhKZ3drmQNEIPac8HX8Y54uf1hJAgIM/7MfDsaeVVmB+QILWQxx5x3R3NvRHgedcbEbOCGY2uR7WQYyMw=="], + "ajv-formats/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="], "form-data/mime-types/mime-db": ["mime-db@1.52.0", "", {}, "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg=="], @@ -3827,5 +3972,67 @@ "vite/esbuild/@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.28.2", "", { "os": "win32", "cpu": "ia32" }, "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA=="], "vite/esbuild/@esbuild/win32-x64": ["@esbuild/win32-x64@0.28.2", "", { "os": "win32", "cpu": "x64" }, "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g=="], + + "@corbits/oauth-core/eslint/@eslint/config-array/@eslint/object-schema": ["@eslint/object-schema@2.1.7", "", {}, "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA=="], + + "@corbits/oauth-core/eslint/file-entry-cache/flat-cache": ["flat-cache@4.0.1", "", { "dependencies": { "flatted": "^3.2.9", "keyv": "^4.5.4" } }, "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw=="], + + "@corbits/oauth-core/eslint/minimatch/brace-expansion": ["brace-expansion@1.1.18", "", { "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "sha512-Edep/X9fGqVNmzKBVsDYIOtD+z1tuezV70LBjdCst9Tqu76lsnvRiZ6oTic1n+/BIwX6QDGAO94PN4N2SADvtw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.42.0", "", { "dependencies": { "@typescript-eslint/types": "8.42.0", "@typescript-eslint/visitor-keys": "8.42.0" } }, "sha512-51+x9o78NBAVgQzOPd17DkNTnIzJ8T/O2dmMBLoK9qbY0Gm52XJcdJcCl18ExBMiHo6jPMErUQWUv5RLE51zJw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/type-utils": ["@typescript-eslint/type-utils@8.42.0", "", { "dependencies": { "@typescript-eslint/types": "8.42.0", "@typescript-eslint/typescript-estree": "8.42.0", "@typescript-eslint/utils": "8.42.0", "debug": "^4.3.4", "ts-api-utils": "^2.1.0" }, "peerDependencies": { "eslint": "^8.57.0 || ^9.0.0", "typescript": ">=4.8.4 <6.0.0" } }, "sha512-9KChw92sbPTYVFw3JLRH1ockhyR3zqqn9lQXol3/YbI6jVxzWoGcT3AsAW0mu1MY0gYtsXnUGV/AKpkAj5tVlQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.42.0", "", { "dependencies": { "@typescript-eslint/types": "8.42.0", "eslint-visitor-keys": "^4.2.1" } }, "sha512-3WbiuzoEowaEn8RSnhJBrxSwX8ULYE9CXaPepS2C2W3NSA5NNIvBaslpBSBElPq0UGr0xVJlXFWOAKIkyylydQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/eslint-plugin/ignore": ["ignore@7.0.8", "", {}, "sha512-YYNsSlXBjMk92SKnkwvB5LOVSa6OznlFUGcsvrFgNJbJCd0M1XKeFVRc8ZByeCqz32FivYNHJVooLmdqrmvp/Q=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/parser/@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.42.0", "", { "dependencies": { "@typescript-eslint/types": "8.42.0", "@typescript-eslint/visitor-keys": "8.42.0" } }, "sha512-51+x9o78NBAVgQzOPd17DkNTnIzJ8T/O2dmMBLoK9qbY0Gm52XJcdJcCl18ExBMiHo6jPMErUQWUv5RLE51zJw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/parser/@typescript-eslint/types": ["@typescript-eslint/types@8.42.0", "", {}, "sha512-LdtAWMiFmbRLNP7JNeY0SqEtJvGMYSzfiWBSmx+VSZ1CH+1zyl8Mmw1TT39OrtsRvIYShjJWzTDMPWZJCpwBlw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/parser/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.42.0", "", { "dependencies": { "@typescript-eslint/types": "8.42.0", "eslint-visitor-keys": "^4.2.1" } }, "sha512-3WbiuzoEowaEn8RSnhJBrxSwX8ULYE9CXaPepS2C2W3NSA5NNIvBaslpBSBElPq0UGr0xVJlXFWOAKIkyylydQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/project-service": ["@typescript-eslint/project-service@8.42.0", "", { "dependencies": { "@typescript-eslint/tsconfig-utils": "^8.42.0", "@typescript-eslint/types": "^8.42.0", "debug": "^4.3.4" }, "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-vfVpLHAhbPjilrabtOSNcUDmBboQNrJUiNAGoImkZKnMjs2TIcWG33s4Ds0wY3/50aZmTMqJa6PiwkwezaAklg=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.42.0", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.0.0" } }, "sha512-kHeFUOdwAJfUmYKjR3CLgZSglGHjbNTi1H8sTYRYV2xX6eNz4RyJ2LIgsDLKf8Yi0/GL1WZAC/DgZBeBft8QAQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/types": ["@typescript-eslint/types@8.42.0", "", {}, "sha512-LdtAWMiFmbRLNP7JNeY0SqEtJvGMYSzfiWBSmx+VSZ1CH+1zyl8Mmw1TT39OrtsRvIYShjJWzTDMPWZJCpwBlw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.42.0", "", { "dependencies": { "@typescript-eslint/types": "8.42.0", "eslint-visitor-keys": "^4.2.1" } }, "sha512-3WbiuzoEowaEn8RSnhJBrxSwX8ULYE9CXaPepS2C2W3NSA5NNIvBaslpBSBElPq0UGr0xVJlXFWOAKIkyylydQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/minimatch": ["minimatch@9.0.9", "", { "dependencies": { "brace-expansion": "^2.0.2" } }, "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/utils/@typescript-eslint/scope-manager": ["@typescript-eslint/scope-manager@8.42.0", "", { "dependencies": { "@typescript-eslint/types": "8.42.0", "@typescript-eslint/visitor-keys": "8.42.0" } }, "sha512-51+x9o78NBAVgQzOPd17DkNTnIzJ8T/O2dmMBLoK9qbY0Gm52XJcdJcCl18ExBMiHo6jPMErUQWUv5RLE51zJw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/utils/@typescript-eslint/types": ["@typescript-eslint/types@8.42.0", "", {}, "sha512-LdtAWMiFmbRLNP7JNeY0SqEtJvGMYSzfiWBSmx+VSZ1CH+1zyl8Mmw1TT39OrtsRvIYShjJWzTDMPWZJCpwBlw=="], + + "@eslint/eslintrc/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + + "@corbits/oauth-core/eslint/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/scope-manager/@typescript-eslint/types": ["@typescript-eslint/types@8.42.0", "", {}, "sha512-LdtAWMiFmbRLNP7JNeY0SqEtJvGMYSzfiWBSmx+VSZ1CH+1zyl8Mmw1TT39OrtsRvIYShjJWzTDMPWZJCpwBlw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/type-utils/@typescript-eslint/types": ["@typescript-eslint/types@8.42.0", "", {}, "sha512-LdtAWMiFmbRLNP7JNeY0SqEtJvGMYSzfiWBSmx+VSZ1CH+1zyl8Mmw1TT39OrtsRvIYShjJWzTDMPWZJCpwBlw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/visitor-keys/@typescript-eslint/types": ["@typescript-eslint/types@8.42.0", "", {}, "sha512-LdtAWMiFmbRLNP7JNeY0SqEtJvGMYSzfiWBSmx+VSZ1CH+1zyl8Mmw1TT39OrtsRvIYShjJWzTDMPWZJCpwBlw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/eslint-plugin/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@4.2.1", "", {}, "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/parser/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@4.2.1", "", {}, "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/project-service/@typescript-eslint/tsconfig-utils": ["@typescript-eslint/tsconfig-utils@8.69.0", "", { "peerDependencies": { "typescript": ">=4.8.4 <6.1.0" } }, "sha512-xNqK7YTDZsLniQMV/4rpFR8Z5JlqeRvVjuG1YgF/mdPVH84HSD19L8CczMA0qg2RfwEV231GHH3VnToJDo4MfQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/project-service/@typescript-eslint/types": ["@typescript-eslint/types@8.69.0", "", {}, "sha512-K3VrubUPhlo9VDBS6QdI8YB5j7ClpqLRdefcz6PFrhnwicehBweqQ9Evhl4l+FYz0HdDmMqIiSX0aldGRYtDCA=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@4.2.1", "", {}, "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/minimatch/brace-expansion": ["brace-expansion@2.1.4", "", { "dependencies": { "balanced-match": "^1.0.0" } }, "sha512-hGfVzPxthbf3+2yjg/RBs60cB0FhqBS/zvdV/4wn4/BmN0bNMMHPc4V/BbFieqf1TKAGGAHnY4eSjajCl0f2Xg=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/utils/@typescript-eslint/scope-manager/@typescript-eslint/visitor-keys": ["@typescript-eslint/visitor-keys@8.42.0", "", { "dependencies": { "@typescript-eslint/types": "8.42.0", "eslint-visitor-keys": "^4.2.1" } }, "sha512-3WbiuzoEowaEn8RSnhJBrxSwX8ULYE9CXaPepS2C2W3NSA5NNIvBaslpBSBElPq0UGr0xVJlXFWOAKIkyylydQ=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/typescript-estree/minimatch/brace-expansion/balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="], + + "@corbits/oauth-core/typescript-eslint/@typescript-eslint/utils/@typescript-eslint/scope-manager/@typescript-eslint/visitor-keys/eslint-visitor-keys": ["eslint-visitor-keys@4.2.1", "", {}, "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ=="], } } diff --git a/packages/chat/src/platform-adapter.ts b/packages/chat/src/platform-adapter.ts index 5809b292c8..a927d5656b 100644 --- a/packages/chat/src/platform-adapter.ts +++ b/packages/chat/src/platform-adapter.ts @@ -138,6 +138,14 @@ export type CreateHubChatPlatformDeps = { * older `generateId("instance")`). */ cryptoProviders: CryptoProviderCache; + /** + * CL-7505 serving-time token refresh: run before the wake in `sendMail`, + * this refreshes every due `oauth_token` credential in the tenant and + * pushes the refreshed frames, so the dial that follows serves a live + * token (or fails over past a credential that just went re-auth-required). + * Best-effort: absent or throwing, mail proceeds exactly as before. + */ + refreshServingCredentials?: (tenantId: string) => Promise; /** * Opt-in idle-sleep for every launched instance: absent here, the adapter keeps today's * behavior exactly (nothing ever sleeps, no interval runs). When @@ -1374,6 +1382,23 @@ export function createHubChatPlatform( } else if (!isRoutable(liveAddress)) { await wakeByAddressBounded(liveAddress); } + // CL-7505: serve on a live token. Any `oauth_token` credential the + // tenant's inference chain is about to dial that is at/near expiry + // refreshes here — with the refreshed frame pushed — so the run + // serves a live secret; a credential the grant cannot save is marked + // re-auth-required and the dial fails over past it. Best-effort: an + // unrefreshable token only skips the refresh, never the mail. + if (deps.refreshServingCredentials !== undefined) { + try { + await deps.refreshServingCredentials(input.tenantId); + } catch (cause) { + // report-error-ignore: best-effort by contract — an unrefreshable + // token must never block the mail; the hook itself reports the + // per-credential failure to the error sink already. + const logger = getLogger(["chat", "platform"]); + logger.warn`serving-time credential refresh failed (mail proceeding): ${String(cause)}`; + } + } // CL-6588: `lifecycle.ensureAwake` returns immediately for an // address that is already routable — routability is the only // thing it checks — so an already-live-but-stale run would never diff --git a/packages/connections/package.json b/packages/connections/package.json index 13244673d3..313abfd9d0 100644 --- a/packages/connections/package.json +++ b/packages/connections/package.json @@ -16,6 +16,7 @@ "./connect-github-setup": "./src/connect-github-setup.ts", "./reconcile-duplicate-repo-grants": "./src/reconcile-duplicate-repo-grants.ts", "./credential-test": "./src/credential-test.ts", + "./token-session": "./src/token-session.ts", "./model-capability": "./src/model-capability.ts", "./template-settings": "./src/template-settings.ts", "./probes": "./src/probes.ts", @@ -30,6 +31,7 @@ }, "dependencies": { "@corbits/code-review": "workspace:*", + "@corbits/oauth-core": "workspace:*", "@corbits/credential-providers": "workspace:*", "@corbits/error-sink": "workspace:*", "@corbits/github-tools": "workspace:*", diff --git a/packages/connections/src/token-session.test.ts b/packages/connections/src/token-session.test.ts new file mode 100644 index 0000000000..5ce6a6b079 --- /dev/null +++ b/packages/connections/src/token-session.test.ts @@ -0,0 +1,227 @@ +import { describe, expect, test } from "bun:test"; + +import { + createCredentialTokenSession, + type CredentialTokenRow, + type RefreshedTokens, +} from "./token-session"; + +// Times are epoch-ms values far above the 60s default skew lead, so +// "unexpired" and "expiring" rows are unambiguous. +const T0 = 1_000_000_000; +const DEFAULT_EXPIRES_AT = T0 + 10 * 60 * 1000; +const REFRESHED_EXPIRES_AT = T0 + 60 * 60 * 1000; + +function row(overrides: Partial = {}): CredentialTokenRow { + return { + id: "cred_1", + type: "oauth_token", + secret: "access-1", + refreshSecret: "refresh-1", + expiresAt: new Date(DEFAULT_EXPIRES_AT), + ...overrides, + }; +} + +function deps( + overrides: { + loadProfile?: (id: string) => Promise; + updateTokens?: (id: string, tokens: RefreshedTokens) => Promise; + refresh?: (row: CredentialTokenRow) => Promise; + now?: () => number; + } = {}, +) { + let current: CredentialTokenRow | null = row(); + const grantCalls: CredentialTokenRow[] = []; + const updates: RefreshedTokens[] = []; + const session = createCredentialTokenSession({ + loadProfile: overrides.loadProfile ?? (async () => current), + updateTokens: async (id, tokens) => { + updates.push(tokens); + current = + current === null + ? null + : { + ...current, + secret: tokens.secret, + refreshSecret: tokens.refreshSecret ?? current.refreshSecret, + expiresAt: tokens.expiresAt, + }; + await overrides.updateTokens?.(id, tokens); + }, + refresh: async (r) => { + grantCalls.push(r); + return overrides.refresh + ? await overrides.refresh(r) + : { secret: "access-2", expiresAt: new Date(REFRESHED_EXPIRES_AT) }; + }, + now: overrides.now ?? (() => T0), + }); + return { + session, + grantCalls, + updates, + setCurrent: (r: CredentialTokenRow | null) => { + current = r; + }, + }; +} + +describe("createCredentialTokenSession", () => { + test("serves an api_key credential's secret untouched and never refreshes", async () => { + const d = deps(); + d.setCurrent( + row({ type: "api_key", refreshSecret: null, expiresAt: null }), + ); + const result = await d.session.getValidToken("cred_1"); + expect(result).toEqual({ ok: true, secret: "access-1", refreshed: false }); + expect(d.grantCalls).toHaveLength(0); + expect(d.updates).toHaveLength(0); + }); + + test("serves an unexpired oauth_token without a refresh grant", async () => { + const d = deps(); + const result = await d.session.getValidToken("cred_1"); + expect(result).toEqual({ ok: true, secret: "access-1", refreshed: false }); + expect(d.grantCalls).toHaveLength(0); + }); + + test("refreshes an expiring oauth_token through the skew lead and persists the new pair", async () => { + const d = deps({ now: () => T0 + 9 * 60 * 1000 + 59 * 1000 }); + const result = await d.session.getValidToken("cred_1"); + expect(result).toEqual({ ok: true, secret: "access-2", refreshed: true }); + expect(d.grantCalls).toHaveLength(1); + expect(d.updates).toEqual([ + { secret: "access-2", expiresAt: new Date(REFRESHED_EXPIRES_AT) }, + ]); + }); + + test("coalesces concurrent refreshes into exactly one refresh grant", async () => { + const loadGate: { + resolve: (r: CredentialTokenRow) => void; + promise: Promise; + } = { + resolve: () => undefined, + promise: Promise.resolve(row({ expiresAt: new Date(T0 + 1000) })), + }; + loadGate.promise = new Promise((resolve) => { + loadGate.resolve = resolve; + }); + const d = deps({ + loadProfile: () => loadGate.promise, + refresh: async () => { + await new Promise((resolve) => setTimeout(resolve, 10)); + return { + secret: "access-2", + refreshSecret: "refresh-2", + expiresAt: new Date(REFRESHED_EXPIRES_AT), + }; + }, + }); + loadGate.resolve(row({ expiresAt: new Date(T0 + 1000) })); + const results = await Promise.all([ + d.session.getValidToken("cred_1"), + d.session.getValidToken("cred_1"), + d.session.getValidToken("cred_1"), + d.session.getValidToken("cred_1"), + d.session.getValidToken("cred_1"), + ]); + for (const result of results) { + expect(result).toEqual({ ok: true, secret: "access-2", refreshed: true }); + } + expect(d.grantCalls).toHaveLength(1); + expect(d.updates).toHaveLength(1); + expect(d.updates[0]?.refreshSecret).toBe("refresh-2"); + }); + + test("each grant call sees the CURRENT persisted row (rotated refresh secret)", async () => { + // A rotating server: every refresh invalidates the prior refresh + // token and mints the next one. The grant must therefore receive the + // row AS PERSISTED NOW, not the row captured when the session was + // first built — a stale capture sends a dead refresh secret on the + // second refresh and the provider answers invalid_grant. + let current: CredentialTokenRow = row(); + let generation = 0; + const grantRows: CredentialTokenRow[] = []; + const session = createCredentialTokenSession({ + loadProfile: async () => current, + updateTokens: async (_id, tokens) => { + current = { + ...current, + secret: tokens.secret, + refreshSecret: tokens.refreshSecret ?? current.refreshSecret, + expiresAt: tokens.expiresAt, + }; + }, + refresh: async (seen) => { + generation += 1; + grantRows.push(seen); + return { + secret: `rotated-access-${generation}`, + refreshSecret: `refresh-${generation + 1}`, + expiresAt: new Date(T0 + generation * 60 * 60 * 1000), + }; + }, + now: () => T0, + }); + + // First expiry: refreshes against the original pair. + current = { ...current, expiresAt: new Date(T0 + 1000) }; + const first = await session.getValidToken("cred_1"); + expect(first).toEqual({ + ok: true, + secret: "rotated-access-1", + refreshed: true, + }); + // Second expiry: the stored refresh secret is now "refresh-2"; the + // second grant call must see exactly that. + current = { ...current, expiresAt: new Date(T0 + 1000) }; + const second = await session.getValidToken("cred_1"); + expect(second).toEqual({ + ok: true, + secret: "rotated-access-2", + refreshed: true, + }); + expect(grantRows).toHaveLength(2); + expect(grantRows[1]?.refreshSecret).toBe("refresh-2"); + expect(grantRows[1]?.secret).toBe("rotated-access-1"); + }); + + test("reports re-auth-required when the refresh grant fails and persists nothing", async () => { + const d = deps({ + now: () => T0 + 10 * 60 * 1000 - 1000, + refresh: async () => { + throw new Error("refresh_token revoked"); + }, + }); + const result = await d.session.getValidToken("cred_1"); + expect(result).toEqual({ + ok: false, + reauthRequired: true, + message: "refresh_token revoked", + }); + expect(d.updates).toHaveLength(0); + }); + + test("reports re-auth-required for an expired oauth_token with no refresh secret", async () => { + const d = deps(); + d.setCurrent(row({ refreshSecret: null, expiresAt: new Date(T0 - 1000) })); + const result = await d.session.getValidToken("cred_1"); + expect(result.ok).toBe(false); + if (result.ok) throw new Error("expected failure"); + expect(result.reauthRequired).toBe(true); + expect(result.message).toContain("no refresh secret"); + expect(d.grantCalls).toHaveLength(0); + }); + + test("fails closed when the credential row is gone", async () => { + const d = deps(); + d.setCurrent(null); + const result = await d.session.getValidToken("cred_1"); + expect(result).toEqual({ + ok: false, + reauthRequired: false, + message: "credential cred_1 not found", + }); + }); +}); diff --git a/packages/connections/src/token-session.ts b/packages/connections/src/token-session.ts new file mode 100644 index 0000000000..dd82af5ccb --- /dev/null +++ b/packages/connections/src/token-session.ts @@ -0,0 +1,202 @@ +// Serving-time token session over a credential row (CL-7505). +// +// Inference `oauth_token` credentials go stale mid-use: the only refresh +// the hub ran before CL-7505 was the background MCP expiry sweep, and a +// still-valid-at-connect access token expires while a run is serving. +// This module adapts the vendored `@corbits/oauth-core` token session +// (`createTokenSession` — skew-aware expiry, in-process coalescing of +// concurrent refreshes) onto the shape the hub actually stores: the +// `credential` row's `secret` / `refreshSecret` / `expiresAt` columns. +// +// The refresh grant itself is pluggable — the hub supplies the grant per +// credential class (the MCP `refreshMcpOAuthTokens` flow is the first +// implementation), this module only decides WHEN a row needs refreshing +// and folds the result back through `updateTokens`. Failure never throws: +// the caller gets `{ ok: false, reauthRequired: true }` and owns marking +// the credential re-auth-required. An `api_key` (or any non-oauth_token) +// row takes the exact pass-through path it always took — no refresh +// machinery touches it. +import { + createTokenSession, + type BaseTokens, + OAuthProfileNotFoundError, + OAuthRefreshFailedError, +} from "@corbits/oauth-core"; +import { reportError } from "@corbits/error-sink"; + +/** The slice of the credential row the token session reads and writes. */ +export type CredentialTokenRow = { + readonly id: string; + readonly type: string; + readonly secret: string; + readonly refreshSecret: string | null; + readonly expiresAt: Date | null; +}; + +/** The fresh token pair a refresh grant produced for a credential. */ +export type RefreshedTokens = { + readonly secret: string; + /** Omitted when the grant carried the prior refresh token forward. */ + readonly refreshSecret?: string; + /** `null` when the grant stated no lifetime: the row is stored + * non-due (the vendored oauth-core stance — missing expiry + * information is never treated as a short timer). */ + readonly expiresAt: Date | null; +}; + +export type RefreshGrant = ( + credential: CredentialTokenRow, +) => Promise; + +export type CredentialTokenSessionDeps = { + loadProfile: (credentialId: string) => Promise; + updateTokens: ( + credentialId: string, + tokens: RefreshedTokens, + ) => Promise; + refresh: RefreshGrant; + /** Epoch-ms clock; defaults to `Date.now`. Injectable for tests. */ + now?: () => number; + /** How far ahead of `expiresAt` a token counts as expiring. + * Defaults to 60s — one dial round-trip must still land on a live + * token after the check. */ + skewLeadMs?: number; +}; + +export type TokenResolution = + | { readonly ok: true; readonly secret: string; readonly refreshed: boolean } + | { + readonly ok: false; + /** True when the row is past saving: the grant failed or the + * credential has no usable refresh secret. The caller should mark + * the credential re-auth-required rather than retry. */ + readonly reauthRequired: boolean; + readonly message: string; + }; + +const DEFAULT_SKEW_LEAD_MS = 60 * 1000; + +export function createCredentialTokenSession( + deps: CredentialTokenSessionDeps, +): { getValidToken(credentialId: string): Promise } { + const now = deps.now ?? Date.now; + const skewLeadMs = deps.skewLeadMs ?? DEFAULT_SKEW_LEAD_MS; + + // The vendored session keys its in-flight refresh map by profile name — + // the credential id, so concurrent calls for one credential coalesce + // into exactly one grant while different credentials refresh in + // parallel. + const sessions = new Map< + string, + ReturnType> + >(); + + function sessionFor(credentialId: string) { + const existing = sessions.get(credentialId); + if (existing !== undefined) return existing; + const session = createTokenSession({ + skewMs: skewLeadMs, + loadProfile: async (id) => { + const row = await deps.loadProfile(id); + if (row === null || row.refreshSecret === null) return undefined; + const expiresAt = row.expiresAt?.getTime(); + return { + tokens: { + access: row.secret, + refresh: row.refreshSecret, + ...(expiresAt === undefined ? {} : { expiresAt }), + }, + }; + }, + updateTokens: async (id, tokens) => { + // A grant that carried the prior refresh token forward re-sends + // it; don't rewrite the column when nothing changed. + const prior = await deps.loadProfile(id); + const changedRefresh = + prior === null || + tokens.refresh === undefined || + tokens.refresh !== prior.refreshSecret; + await deps.updateTokens(id, { + secret: tokens.access, + ...(tokens.refresh !== undefined && changedRefresh + ? { refreshSecret: tokens.refresh } + : {}), + expiresAt: + tokens.expiresAt === undefined ? null : new Date(tokens.expiresAt), + }); + }, + refreshTokens: async (refreshToken) => { + // The grant must see the row AS PERSISTED NOW — a rotating server + // invalidates the prior refresh secret at every grant, so a row + // captured earlier would exchange a dead secret. Reload it fresh; + // only the id comes from the cached session. + const current = await deps.loadProfile(credentialId); + if (current === null || current.refreshSecret === null) { + throw new Error(`credential ${credentialId} lost its refresh secret`); + } + const refreshed = await deps.refresh(current); + return { + access: refreshed.secret, + refresh: refreshed.refreshSecret ?? refreshToken, + ...(refreshed.expiresAt === null + ? {} + : { expiresAt: refreshed.expiresAt.getTime() }), + }; + }, + toAccess: (tokens) => tokens.access, + }); + sessions.set(credentialId, session); + return session; + } + + return { + async getValidToken(credentialId: string): Promise { + const row = await deps.loadProfile(credentialId); + if (row === null) { + return { + ok: false, + reauthRequired: false, + message: `credential ${credentialId} not found`, + }; + } + if (row.type !== "oauth_token") { + return { ok: true, secret: row.secret, refreshed: false }; + } + if (row.refreshSecret === null) { + const expired = + row.expiresAt !== null && + now() >= row.expiresAt.getTime() - skewLeadMs; + if (!expired) { + return { ok: true, secret: row.secret, refreshed: false }; + } + return { + ok: false, + reauthRequired: true, + message: `credential ${credentialId} is expired and has no refresh secret — reconnect required`, + }; + } + try { + const secret = await sessionFor(credentialId).getValidToken( + credentialId, + now(), + ); + return { ok: true, secret, refreshed: secret !== row.secret }; + } catch (cause) { + reportError(cause, { + operation: "credential_token_refresh", + extra: { credentialId }, + }); + const message = + cause instanceof OAuthRefreshFailedError || + cause instanceof OAuthProfileNotFoundError + ? cause.cause instanceof Error + ? cause.cause.message + : cause.message + : cause instanceof Error + ? cause.message + : String(cause); + return { ok: false, reauthRequired: true, message }; + } + }, + }; +} diff --git a/scripts/checks/kill-dates.txt b/scripts/checks/kill-dates.txt index 313cf3277d..a3834a7998 100644 --- a/scripts/checks/kill-dates.txt +++ b/scripts/checks/kill-dates.txt @@ -15,15 +15,16 @@ # package's VENDORED-FROM delta line in the same change. apps/sidecar | sawyer | 2026-11-03 vendor/intx/agent | sawyer | 2026-11-03 | 9dd132fda8d7aef9d70395de2d289abeb0361416b18a5079f219372df69d81a0 -vendor/intx/db | sawyer | 2026-11-03 | e09d9ce7ade4dd28a1ef60be86578d94194864b318420e93a3b3845e7c5d296b +vendor/intx/db | sawyer | 2026-11-03 | 360b03bd28eaa6c24092db15d63d3445f79d56bd3dbfc2968420d8a27abff57d vendor/intx/harness | sawyer | 2026-11-03 | 399b4e8b3b18e8969e815427625e1bfc6746f31e791fb92cdbc2aaf2c5080dbf vendor/intx/hub-agent | sawyer | 2026-11-03 | 0a24a0cf85cc0483dbeee815d89847440e2fbd1242fdfd992941379a9acc2a4a -vendor/intx/hub-api | sawyer | 2026-11-03 | 64438be924e874555dc8742d0cbeef167af42e7d79eae512e2d212e12e4ca29b +vendor/intx/hub-api | sawyer | 2026-11-03 | 90aa5cddef828d77b62adb63186dcf82b5465926cafea1ab6b64bca263031b57 vendor/intx/hub-common | sawyer | 2026-11-03 | 2fe74684593083f422023b2d6b337e414b5b319c6bfe02c7fa157130d7162e41 -vendor/intx/hub-sessions | sawyer | 2026-11-03 | d31e093ef24edcd13ba410ad5a3fa4ba30ff8d7086bb692a8405000b1b0031e0 +vendor/intx/hub-sessions | sawyer | 2026-11-03 | 40f873fb8059a4e9488411f2eac4428b822692dc2d969dc14c09b3609ca1c79e vendor/intx/inference | sawyer | 2026-11-03 | 81e1b31947cd8e6cac4e336d21d8a87ba063b638e0ac4ada1b0f375ec6861bf5 vendor/intx/mail-memory | sawyer | 2026-11-03 | e281498352adbc2face631744ce9a02cb838c60a6c318961022904f0fd05d192 vendor/intx/mailbox | sawyer | 2026-11-03 | 926bfef1b60a4ba7e600252e9ad6e37c17d387a200f79c2cbc0b3ceb612000ea +vendor/intx/oauth-core | sawyer | 2026-10-07 | 030e27dadc9551563f74de93254eb0bdbd0558d9801b909b6c98cda88513b768 vendor/intx/mime | sawyer | 2026-11-03 | ddf7e626172350c6a447890affc6c746b7938e04ee53af8f1d9c8cffd97d1954 vendor/intx/types | sawyer | 2026-11-03 | 71bd6493ae6df31abd9be8ff3d2feb79260d2aae3a29a5e275945dc92ea16a12 vendor/intx/workflow | sawyer | 2026-11-03 | c8f3a7a40d4ef429b58ba913c2faa27a5e7e98baf433dc57f864e12c907eb47a diff --git a/tsconfig.build.json b/tsconfig.build.json index 148b54417c..79172fa8a9 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -211,6 +211,9 @@ { "path": "./vendor/intx/mime/tsconfig.src.json" }, + { + "path": "./vendor/intx/oauth-core/tsconfig.src.json" + }, { "path": "./vendor/intx/types/tsconfig.src.json" }, diff --git a/vendor/intx/db/src/index.ts b/vendor/intx/db/src/index.ts index a085d231c1..f4d236aab7 100644 --- a/vendor/intx/db/src/index.ts +++ b/vendor/intx/db/src/index.ts @@ -127,6 +127,7 @@ export { type ResolvedOffering, } from "./catalog-resolution"; export { + buildSource, resolveModelSources, resolveInferencePreferences, resolveInstanceModelSources, @@ -134,6 +135,9 @@ export { type CatalogSourceResolution, type OfferingSourceResolution, type SourceSkip, + type ServingRefresh, + type ServingRefreshResult, + type ModelSourceResolutionOpts, } from "./model-source-resolution"; export { parseGrantRow, diff --git a/vendor/intx/db/src/model-source-resolution.test.ts b/vendor/intx/db/src/model-source-resolution.test.ts new file mode 100644 index 0000000000..c0a94220b6 --- /dev/null +++ b/vendor/intx/db/src/model-source-resolution.test.ts @@ -0,0 +1,123 @@ +// CL-7505 local delta: the serving-time refresh seam in `buildSource`. A +// provider-backed `oauth_token` credential is offered to the caller's +// `servingRefresh` hook before its secret is served: a hook that refreshed +// it in place re-reads the row and serves the fresh secret; a hook that +// reports the credential past saving skips the offering outright (never a +// dead secret in the material cell); an `api_key` credential never reaches +// the hook at all — its path is byte-for-byte what it was before the delta. +import { describe, expect, mock, test } from "bun:test"; +import type { CredentialCipher } from "@intx/types"; + +const resolvedRows: Record< + string, + { + id: string; + tenantId: string; + providerId: string; + principalId: string | null; + type: string; + status: string; + secret: string; + refreshSecret: string | null; + expiresAt: Date | null; + } +> = {}; + +mock.module("./credential-resolution", () => ({ + resolveCredentialById: async (_db: unknown, _tenantId: string, id: string) => + resolvedRows[id] ?? null, +})); + +mock.module("./parse-row", () => ({ + parseModelOfferingRow: (row: Record) => ({ + ...row, + capabilities: [], + quirks: null, + }), +})); + +import { buildSource, type ServingRefresh } from "./model-source-resolution"; + +const offering = { + offering: { + id: "off_1", + priority: 0, + capabilities: [], + }, + provider: { + id: "prov_1", + name: "test-provider", + plugin: "test-plugin", + baseURL: "https://inference.invalid", + credentialId: "cred_1", + walletId: null, + }, + model: { canonicalName: "test-model" }, +} as unknown as Parameters[2]; + +const cipher = { + decrypt: async (secret: string) => `plain:${secret}`, +} as unknown as CredentialCipher; + +function row(type: string) { + return { + id: "cred_1", + tenantId: "ten_1", + providerId: "prov_1", + principalId: null, + type, + status: "active", + secret: "enc:old", + refreshSecret: type === "oauth_token" ? "enc:refresh" : null, + expiresAt: type === "oauth_token" ? new Date(0) : null, + }; +} + +describe("buildSource servingRefresh seam (CL-7505)", () => { + test("an expiring oauth_token is refreshed and the fresh secret served", async () => { + resolvedRows["cred_1"] = row("oauth_token"); + const hook: ServingRefresh = async () => { + resolvedRows["cred_1"] = { + ...resolvedRows["cred_1"]!, + secret: "enc:new", + expiresAt: new Date(9_999), + }; + return { ok: true }; + }; + const built = await buildSource({} as never, "ten_1", offering, cipher, { + servingRefresh: hook, + }); + expect(built.ok).toBe(true); + if (built.ok) expect(built.material.secret).toBe("plain:enc:new"); + }); + + test("a credential the hook cannot save is skipped, never served", async () => { + resolvedRows["cred_1"] = row("oauth_token"); + const hook: ServingRefresh = async () => ({ + ok: false, + message: "refresh_token revoked", + }); + const built = await buildSource({} as never, "ten_1", offering, cipher, { + servingRefresh: hook, + }); + expect(built.ok).toBe(false); + if (!built.ok) { + expect(built.skip.reason).toBe("credential_needs_reauth"); + } + }); + + test("an api_key credential never reaches the hook and serves as before", async () => { + resolvedRows["cred_1"] = row("api_key"); + let hookCalls = 0; + const hook: ServingRefresh = async () => { + hookCalls += 1; + return { ok: true }; + }; + const built = await buildSource({} as never, "ten_1", offering, cipher, { + servingRefresh: hook, + }); + expect(hookCalls).toBe(0); + expect(built.ok).toBe(true); + if (built.ok) expect(built.material.secret).toBe("plain:enc:old"); + }); +}); diff --git a/vendor/intx/db/src/model-source-resolution.ts b/vendor/intx/db/src/model-source-resolution.ts index 5d0606b47b..3060497aa2 100644 --- a/vendor/intx/db/src/model-source-resolution.ts +++ b/vendor/intx/db/src/model-source-resolution.ts @@ -29,8 +29,34 @@ export type SourceSkip = | { reason: "wallet_backed"; provider: string } | { reason: "credential_unresolved"; provider: string } | { reason: "credential_unauthorized"; provider: string } + | { reason: "credential_needs_reauth"; provider: string } | { reason: "provider_misconfigured"; provider: string }; +/** + * CL-7505 serving-time refresh seam. Before an expiring `oauth_token` + * credential's secret is served, the caller-supplied hook may refresh it in + * place (the hub composes the connections token session). `ok: false` means + * the credential is past saving (refresh failed / re-auth required): the + * offering is skipped, never served with a dead secret. + */ +export type ServingRefreshResult = + | { readonly ok: true } + | { readonly ok: false; readonly message: string }; + +export type ServingRefresh = (credential: { + readonly id: string; + readonly tenantId: string; + readonly type: string; + readonly status: string; + readonly refreshSecret: string | null; + readonly expiresAt: Date | null; +}) => Promise; + +export type ModelSourceResolutionOpts = { + invokerPreferences?: Record; + servingRefresh?: ServingRefresh; +}; + /** * Outcome of resolving an agent's model requirements to an ordered set of * inference sources. The order is the routing order: the head is the @@ -117,11 +143,12 @@ function applyPreference( return preference.mode === "pin" ? named : [...named, ...rest]; } -async function buildSource( +export async function buildSource( db: DB["db"], tenantId: string, resolved: ResolvedOffering, credentialCipher: CredentialCipher, + opts?: { servingRefresh?: ServingRefresh }, ): Promise< | { ok: true; source: InferenceSource; material: CredentialMaterialEntry } | { ok: false; skip: SourceSkip } @@ -147,17 +174,18 @@ async function buildSource( // Resolve the secret through the tenant-scoped credential resolver so a // provider row referencing a credential outside the tenant's ancestor // chain cannot leak that secret (the chain is the authority). - const credential = await resolveCredentialById( + const credentialFound = await resolveCredentialById( db, tenantId, provider.credentialId, ); - if (credential === null) { + if (credentialFound === null) { return { ok: false, skip: { reason: "credential_unresolved", provider: provider.name }, }; } + let credential = credentialFound; // Authority to use a credential through a catalog provider is ownership // within the tenant hierarchy -- the same rule the tool-binding path resolves @@ -175,6 +203,41 @@ async function buildSource( }; } + // CL-7505 local delta: serving-time refresh. An expiring `oauth_token` + // credential gets one chance to refresh in place before its secret is + // served; a credential the hook cannot save (grant failed, re-auth + // required) is skipped outright — never served unauthenticated. The hook + // itself owns the expiry decision, so a credential that is not near + // expiry no-ops through it cheaply. + if (opts?.servingRefresh !== undefined && credential.type === "oauth_token") { + const refreshed = await opts.servingRefresh({ + id: credential.id, + tenantId: credential.tenantId, + type: credential.type, + status: credential.status, + refreshSecret: credential.refreshSecret, + expiresAt: credential.expiresAt, + }); + if (!refreshed.ok) { + return { + ok: false, + skip: { reason: "credential_needs_reauth", provider: provider.name }, + }; + } + const reread = await resolveCredentialById( + db, + tenantId, + provider.credentialId, + ); + if (reread === null) { + return { + ok: false, + skip: { reason: "credential_unresolved", provider: provider.name }, + }; + } + credential = reread; + } + // Validate the row once at this DB-to-runtime boundary. This narrows the // jsonb `quirks` from `unknown` to a `Record | null` and checks // `capabilities` against the curated enum. `quirks` is spread in only when @@ -275,9 +338,7 @@ export async function resolveModelSources( // noop fallback for a keyless composition is resolved once at that edge // (`resolveCredentialCipher` in the hub app), never defaulted here. credentialCipher: CredentialCipher, - opts?: { - invokerPreferences?: Record; - }, + opts?: ModelSourceResolutionOpts, ): Promise { if (requirements.length === 0) { return { ok: false, reason: "no_requirements" }; @@ -311,12 +372,11 @@ export async function resolveModelSources( const modelSources: InferenceSource[] = []; const modelMaterials: CredentialMaterialEntry[] = []; for (const candidate of candidates) { - const built = await buildSource( - db, - tenantId, - candidate, - credentialCipher, - ); + const built = await buildSource(db, tenantId, candidate, credentialCipher, { + ...(opts?.servingRefresh !== undefined + ? { servingRefresh: opts.servingRefresh } + : {}), + }); if (built.ok) { modelSources.push(built.source); modelMaterials.push(built.material); @@ -431,6 +491,7 @@ export async function resolveInstanceModelSources( tenantId: string, instance: { definitionId: string; modelPreferences: unknown }, credentialCipher: CredentialCipher, + opts?: { servingRefresh?: ServingRefresh }, ): Promise { // Resolve from the run's own definition by primary key. This is the SAME row // the launch resolves its requirements from, so a rotation or catalog edit @@ -469,5 +530,8 @@ export async function resolveInstanceModelSources( return resolveModelSources(db, tenantId, requirements, credentialCipher, { invokerPreferences, + ...(opts?.servingRefresh !== undefined + ? { servingRefresh: opts.servingRefresh } + : {}), }); } diff --git a/vendor/intx/hub-api/src/run-source-resolution.ts b/vendor/intx/hub-api/src/run-source-resolution.ts index 52b2cb1ab3..1c6e1bf278 100644 --- a/vendor/intx/hub-api/src/run-source-resolution.ts +++ b/vendor/intx/hub-api/src/run-source-resolution.ts @@ -6,7 +6,11 @@ // credential-bearing source chain a run launches against, so the launch route // and (later) the unified multi-step path cannot drift. -import { resolveModelSources, type DB } from "@intx/db"; +import { + resolveModelSources, + type DB, + type ServingRefresh, +} from "@intx/db"; import type { CredentialCipher, ModelRequirement, @@ -49,6 +53,10 @@ export async function resolveDefinitionSources(args: { // real cipher (resolved to a noop only at that edge for a keyless dev/test // composition). credentialCipher: CredentialCipher; + // CL-7505 local delta: optional serving-time refresh hook, threaded to + // buildSource so an expiring `oauth_token` credential refreshes in place + // (or the offering is skipped) before its secret is served. + servingRefresh?: ServingRefresh; }): Promise { const requirements: ModelRequirement[] = args.modelRequirements !== null @@ -62,7 +70,12 @@ export async function resolveDefinitionSources(args: { args.tenantId, requirements, args.credentialCipher, - { invokerPreferences: args.invokerPreferences }, + { + invokerPreferences: args.invokerPreferences, + ...(args.servingRefresh !== undefined + ? { servingRefresh: args.servingRefresh } + : {}), + }, ); if (!resolution.ok) { const message = diff --git a/vendor/intx/hub-sessions/src/credential-push.ts b/vendor/intx/hub-sessions/src/credential-push.ts index c13d7814d8..d17e21daa0 100644 --- a/vendor/intx/hub-sessions/src/credential-push.ts +++ b/vendor/intx/hub-sessions/src/credential-push.ts @@ -19,6 +19,7 @@ import { resolveInstanceModelSources, getDescendantTenants, reresolveCurrentMaterials, + type ServingRefresh, } from "@intx/db"; import type { DB } from "@intx/db"; import type { CredentialCipher } from "@intx/types"; @@ -51,12 +52,17 @@ export async function pushInstanceSourceUpdate( modelPreferences: unknown; }, credentialCipher: CredentialCipher, + // CL-7505 local delta: optional serving-time refresh hook threaded to + // `resolveInstanceModelSources`, so an expiring `oauth_token` credential + // refreshes in place before this push delivers its material. + servingRefresh?: ServingRefresh, ): Promise { const resolution = await resolveInstanceModelSources( db, instance.tenantId, instance, credentialCipher, + ...(servingRefresh !== undefined ? [{ servingRefresh }] : []), ); if (!resolution.ok) return; const [head] = resolution.sources; @@ -95,6 +101,7 @@ async function pushSourceUpdatesToTenants( sidecarRouter: SidecarRouter, tenantIds: string[], credentialCipher: CredentialCipher, + servingRefresh?: ServingRefresh, ): Promise { if (tenantIds.length === 0) return; @@ -145,6 +152,7 @@ async function pushSourceUpdatesToTenants( modelPreferences: instance.modelPreferences, }, credentialCipher, + servingRefresh, ); }), ); @@ -170,12 +178,14 @@ export async function pushSourceUpdates( sidecarRouter: SidecarRouter, tenantId: string, credentialCipher: CredentialCipher, + servingRefresh?: ServingRefresh, ): Promise { await pushSourceUpdatesToTenants( db, sidecarRouter, [tenantId], credentialCipher, + servingRefresh, ); } @@ -190,6 +200,7 @@ export async function pushSourceUpdatesSubtree( sidecarRouter: SidecarRouter, tenantId: string, credentialCipher: CredentialCipher, + servingRefresh?: ServingRefresh, ): Promise { let tenants: string[]; try { @@ -203,6 +214,7 @@ export async function pushSourceUpdatesSubtree( sidecarRouter, tenants, credentialCipher, + servingRefresh, ); } diff --git a/vendor/intx/oauth-core/LICENSE b/vendor/intx/oauth-core/LICENSE new file mode 100644 index 0000000000..c6487f4fdf --- /dev/null +++ b/vendor/intx/oauth-core/LICENSE @@ -0,0 +1,176 @@ +GNU LESSER GENERAL PUBLIC LICENSE + +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. + +This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. + +When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. + +To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. + +We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. + +Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. + +Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. + +When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. + +We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. + +For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. + +The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. + +GNU LESSER GENERAL PUBLIC LICENSE +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". + +A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. + +(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. + +However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. + +When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. + +If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: + + a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. + + e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. + +For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. + + b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. + +8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Libraries + +If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). + +To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + one line to give the library's name and an idea of what it does. + Copyright (C) year name of author + + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: + +Yoyodyne, Inc., hereby disclaims all copyright interest in +the library `Frob' (a library for tweaking knobs) written +by James Random Hacker. + +signature of Ty Coon, 1 April 1990 +Ty Coon, President of Vice +That's all there is to it! diff --git a/vendor/intx/oauth-core/README.md b/vendor/intx/oauth-core/README.md new file mode 100644 index 0000000000..58a7fbf863 --- /dev/null +++ b/vendor/intx/oauth-core/README.md @@ -0,0 +1,125 @@ +# @corbits/oauth-core + +PKCE + loopback OAuth for an Interchange host: mint an access token the +harness injects as `InferenceSource.apiKey`. A loopback callback server, +token exchange/refresh, and an expiring-token session that refreshes ahead +of expiry and coalesces concurrent refreshes. It is not a credential vault +and it is not a client for any particular issuer — endpoints and client id +come from the caller (typically `@corbits/xai-provider` or +`@corbits/codex-provider`). One flow shape: public client, PKCE S256, +fixed-port loopback, no client secret. + +## Install + +```sh +bun add github:corbitsdev/corbits-oauth-core +``` + +The package ships TypeScript source and needs no build step; Bun consumes it +directly. + +## Usage + +```ts +import { + baseTokensFromResponse, + buildAuthorizeUrl, + createTokenSession, + exchangeCode, + refreshTokenRequest, + startCallbackServer, + startOAuthLogin, + type BaseTokens, + type OAuthClientConfig, +} from "@corbits/oauth-core"; + +const config: OAuthClientConfig = { + clientId: "my-client-id", + authorizeUrl: "https://provider.example.com/oauth/authorize", + tokenUrl: "https://provider.example.com/oauth/token", + redirectUri: "http://127.0.0.1:8765/callback", + scopes: ["profile"], + tokenTimeoutMs: 10_000, +}; + +// `persist`, `load`, and `update` below are the host's storage layer — write +// an Interchange `oauth_token` credential or use the OS vault. This package +// never stores. +const handle = await startOAuthLogin( + { profile: "default", signal: new AbortController().signal }, + { + startCallbackServer: (state) => + startCallbackServer(state, { + port: 8765, + path: "/callback", + doneHtml: + "Signed in — you can close this tab.", + failedHtml: (reason) => + `Sign-in failed: ${reason}`, + }), + buildAuthorizeUrl: (pkce, state) => buildAuthorizeUrl(config, pkce, state), + exchangeCode: async (code, verifier, now) => + baseTokensFromResponse( + await exchangeCode(config, code, verifier), + now, + undefined, + ), + // Host: Interchange `oauth_token` or the OS vault. This package does not store. + saveProfile: persist, + }, +); + +const staged = await handle.completed; +await staged.commit(); + +const session = createTokenSession({ + skewMs: 30_000, + loadProfile: load, + updateTokens: update, + refreshTokens: async (refreshToken, now) => + baseTokensFromResponse( + await refreshTokenRequest(config, refreshToken), + now, + refreshToken, + ), + toAccess: (tokens) => tokens.access, +}); + +const accessToken = await session.getValidToken("default"); +// Host: put `accessToken` on InferenceSource.apiKey. The harness injects it at send. +``` + +See `src/index.ts` for the full export surface. + +## Design notes + +- Nothing here names a provider, product, or default client id — config and + callback HTML are caller-supplied. Persistence is the host's callback. +- `expiresAt` on `BaseTokens` is optional: RFC 6749 §5.1 makes `expires_in` + RECOMMENDED, not required, and this package never guesses a lifetime the + server didn't send. +- `startOAuthLogin` stages the exchanged profile behind a `commit()` the + caller controls, so persistence can be gated on the host's own setup + succeeding first. +- The token session coalesces concurrent refreshes for the same profile + into one in-flight request, since a provider that rotates refresh tokens + would otherwise invalidate a racing second attempt. Interchange's harness + injects `apiKey` at send; it does not refresh provider tokens. +- `fetch`, `now`, and refresh skew are all injectable, so login and refresh + paths are testable without patching globals. + +## Not supported + +- No credential persistence — the host writes an Interchange `oauth_token` + or the OS vault. +- No device-code flow — loopback redirect only. +- No confidential client / client secret support — public clients (PKCE) + only. +- No token revocation endpoint call. +- Fixed-port loopback only, no dynamic port selection: authorization + servers only accept the registered `redirect_uri` for the client, so a + randomly chosen port would be rejected. + +## License + +LGPL-2.1-or-later. diff --git a/vendor/intx/oauth-core/package.json b/vendor/intx/oauth-core/package.json new file mode 100644 index 0000000000..e6eb366807 --- /dev/null +++ b/vendor/intx/oauth-core/package.json @@ -0,0 +1,48 @@ +{ + "name": "@corbits/oauth-core", + "version": "0.1.0", + "description": "Provider-agnostic OAuth 2.0 authorization-code + PKCE login for desktop/CLI hosts.", + "license": "LGPL-2.1-or-later", + "author": "Sawyer Cutler ", + "type": "module", + "sideEffects": false, + "files": [ + "src", + "!src/**/*.test.ts", + "README.md", + "LICENSE" + ], + "publishConfig": { + "access": "public" + }, + "exports": { + ".": "./src/index.ts" + }, + "scripts": { + "typecheck": "tsc --noEmit", + "lint": "eslint .", + "format": "prettier --write .", + "format:check": "prettier --check .", + "test": "bun test", + "check": "bun run typecheck && bun run lint && bun run format:check && bun run test" + }, + "dependencies": { + "arktype": "2.2.3" + }, + "devDependencies": { + "@eslint/js": "9.34.0", + "@types/bun": "1.3.9", + "eslint": "9.34.0", + "jiti": "2.5.1", + "prettier": "3.6.2", + "typescript": "5.9.3", + "typescript-eslint": "8.42.0" + }, + "engines": { + "bun": ">=1.2.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/corbitsdev/corbits-oauth-core.git" + } +} diff --git a/vendor/intx/oauth-core/src/browser.ts b/vendor/intx/oauth-core/src/browser.ts new file mode 100644 index 0000000000..30cca67c30 --- /dev/null +++ b/vendor/intx/oauth-core/src/browser.ts @@ -0,0 +1,32 @@ +import { spawn } from "node:child_process"; +import { platform } from "node:os"; + +/** + * Best-effort: open a URL in the user's default browser. Never throws — a + * headless host or missing opener just means the caller's surfaced link is + * the fallback. Detached and unref'd so the opener cannot keep the process + * alive. + */ +export function openInBrowser(url: string): void { + // `url` carries attacker-influenced query params (the authorize URL + // includes caller-supplied scopes/params). `cmd /c start` on win32 is a + // shell command line that re-splits its argument on `&`, so a scope or + // state value containing `&` would be reinterpreted as a second command; + // `rundll32 url.dll,FileProtocolHandler ` is a real executable + // invoked via argv, never a shell, on every platform here. + const command = + platform() === "darwin" + ? "open" + : platform() === "win32" + ? "rundll32" + : "xdg-open"; + const args = + platform() === "win32" ? ["url.dll,FileProtocolHandler", url] : [url]; + try { + const child = spawn(command, args, { stdio: "ignore", detached: true }); + child.on("error", () => undefined); + child.unref(); + } catch { + // Opening the browser is a convenience; the copyable link is the fallback. + } +} diff --git a/vendor/intx/oauth-core/src/callback-server.test.ts b/vendor/intx/oauth-core/src/callback-server.test.ts new file mode 100644 index 0000000000..6cb0de2531 --- /dev/null +++ b/vendor/intx/oauth-core/src/callback-server.test.ts @@ -0,0 +1,27 @@ +import { describe, expect, test } from "bun:test"; + +import { startCallbackServer } from "./index"; + +describe("Callback server startCallbackServer — state validation", () => { + test("rejects a redirect whose state does not match, without trusting the code", async () => { + // Load-bearing: the state check is what stops a redirect from an + // unrelated flow (or an attacker's crafted link) from being accepted as + // this login's authorization code. + const server = await startCallbackServer("expected-state", { + port: 18234, + path: "/callback", + doneHtml: "done", + failedHtml: (reason) => `failed: ${reason}`, + }); + try { + const waiting = server.waitForCode(new AbortController().signal); + const resPromise = fetch( + `http://127.0.0.1:18234/callback?code=some-code&state=wrong-state`, + ); + await expect(waiting).rejects.toThrow(/state did not match/); + expect((await resPromise).status).toBe(400); + } finally { + server.close(); + } + }); +}); diff --git a/vendor/intx/oauth-core/src/callback-server.ts b/vendor/intx/oauth-core/src/callback-server.ts new file mode 100644 index 0000000000..c6441ec0db --- /dev/null +++ b/vendor/intx/oauth-core/src/callback-server.ts @@ -0,0 +1,141 @@ +import { createServer, type Server } from "node:http"; + +function isNonEmptyCode(value: string | null): value is string { + return typeof value === "string" && value.length > 0; +} + +export type CallbackServer = { + waitForCode: (signal: AbortSignal) => Promise; + close: () => void; +}; + +export type CallbackServerConfig = { + port: number; + path: string; + doneHtml: string; + failedHtml: (reason: string) => string; +}; + +export class OAuthCallbackError extends Error { + constructor(message: string) { + super(message); + this.name = "OAuthCallbackError"; + } +} + +export class OAuthCallbackPortInUseError extends Error { + readonly port: number; + + constructor(port: number) { + super(`Port ${String(port)} is already in use by another process.`); + this.name = "OAuthCallbackPortInUseError"; + this.port = port; + } +} + +/** + * Start a fixed-port loopback server that receives an OAuth redirect. The + * port is fixed because authorization servers only accept the registered + * redirect_uri for the client. A bind failure means the port is already in + * use (e.g. a concurrent login), not a cue to pick another port. + * + * `expectedState` is bound before listen so a redirect that arrives the + * instant the socket opens is CSRF-checked. The outcome is buffered: no + * Promise is created until `waitForCode`, so an early failed redirect + * cannot become an unhandled rejection. + */ +export async function startCallbackServer( + expectedState: string, + config: CallbackServerConfig, +): Promise { + let outcome: { code: string } | { error: Error } | undefined; + let waiter: + | { resolve: (code: string) => void; reject: (err: Error) => void } + | undefined; + let wait: Promise | undefined; + let settled = false; + + const finish = (next: { code: string } | { error: Error }): void => { + if (settled) return; + settled = true; + outcome = next; + if (waiter === undefined) return; + if ("error" in next) waiter.reject(next.error); + else waiter.resolve(next.code); + }; + + const server: Server = createServer((req, res) => { + const url = new URL( + req.url ?? "/", + `http://127.0.0.1:${String(config.port)}`, + ); + if (url.pathname !== config.path) { + res.statusCode = 404; + res.end("Not found"); + return; + } + const code = url.searchParams.get("code"); + const error = url.searchParams.get("error"); + const state = url.searchParams.get("state"); + + if (state !== expectedState) { + res.statusCode = 400; + res.setHeader("content-type", "text/html; charset=utf-8"); + res.end(config.failedHtml("state mismatch")); + finish({ + error: new OAuthCallbackError( + "Authorization state did not match; possible CSRF - login aborted.", + ), + }); + return; + } + + const reason = + error ?? (isNonEmptyCode(code) ? undefined : "no code returned"); + res.statusCode = reason === undefined ? 200 : 400; + res.setHeader("content-type", "text/html; charset=utf-8"); + res.end(reason === undefined ? config.doneHtml : config.failedHtml(reason)); + + if (reason !== undefined || !isNonEmptyCode(code)) { + finish({ + error: new OAuthCallbackError( + `Authorization failed: ${reason ?? "no code returned"}`, + ), + }); + } else { + finish({ code }); + } + }); + + await new Promise((resolve, reject) => { + server.once("error", (err: NodeJS.ErrnoException) => { + if (err.code === "EADDRINUSE") + reject(new OAuthCallbackPortInUseError(config.port)); + else reject(err); + }); + server.listen(config.port, "127.0.0.1", resolve); + }); + + return { + waitForCode: (signal: AbortSignal) => { + if (signal.aborted) finish({ error: new OAuthCallbackError("aborted") }); + else + signal.addEventListener( + "abort", + () => finish({ error: new OAuthCallbackError("aborted") }), + { once: true }, + ); + if (wait !== undefined) return wait; + wait = new Promise((resolve, reject) => { + if (outcome !== undefined) { + if ("error" in outcome) reject(outcome.error); + else resolve(outcome.code); + return; + } + waiter = { resolve, reject }; + }); + return wait; + }, + close: () => server.close(), + }; +} diff --git a/vendor/intx/oauth-core/src/client.test.ts b/vendor/intx/oauth-core/src/client.test.ts new file mode 100644 index 0000000000..031ff47390 --- /dev/null +++ b/vendor/intx/oauth-core/src/client.test.ts @@ -0,0 +1,72 @@ +import { describe, expect, test } from "bun:test"; + +import { + baseTokensFromResponse, + exchangeCode, + OAuthTokenResponseSchemaError, + type FetchLike, + type OAuthClientConfig, +} from "./index"; + +const config: OAuthClientConfig = { + clientId: "client-id", + authorizeUrl: "https://auth.example.com/authorize", + tokenUrl: "https://auth.example.com/token", + redirectUri: "http://127.0.0.1:1455/callback", + scopes: ["openid"], + tokenTimeoutMs: 1_000, +}; + +function fakeFetch(payload: unknown, status = 200): FetchLike { + const impl: FetchLike = async (_input, _init) => + new Response(JSON.stringify(payload), { + status, + headers: { "content-type": "application/json" }, + }); + impl.preconnect = () => undefined; + return impl; +} + +describe("OAuth client — hostile token responses", () => { + test("rejects a malformed expires_in instead of letting a NaN expiry through", async () => { + // Load-bearing: checking only that access_token is a string lets + // `expires_in: "soon"` survive into a NaN expiry that never compares as + // expired, so a session would hold a token that can never refresh. + await expect( + exchangeCode( + config, + "auth-code", + "verifier", + fakeFetch({ + access_token: "tok", + refresh_token: "ref", + expires_in: "soon", + }), + ), + ).rejects.toThrow(OAuthTokenResponseSchemaError); + }); + + test("carries the prior refresh token forward when a refresh response omits one", () => { + // Load-bearing: providers may or may not rotate refresh tokens on + // refresh; dropping the prior one whenever a response omits it would + // strand the session with no way to refresh again. + const tokens = baseTokensFromResponse( + { access_token: "a" }, + 0, + "prior-refresh", + ); + expect(tokens.refresh).toBe("prior-refresh"); + }); + + test("leaves expiresAt unset when the server omits expires_in, rather than guessing a lifetime", () => { + // Load-bearing: RFC 6749 §5.1 makes expires_in RECOMMENDED, not + // required. Falling back to a made-up lifetime would let a session + // treat a token as fresh well past whatever the server actually issued. + const tokens = baseTokensFromResponse( + { access_token: "a", refresh_token: "r" }, + 1_000, + undefined, + ); + expect(tokens.expiresAt).toBeUndefined(); + }); +}); diff --git a/vendor/intx/oauth-core/src/client.ts b/vendor/intx/oauth-core/src/client.ts new file mode 100644 index 0000000000..de5a102b2d --- /dev/null +++ b/vendor/intx/oauth-core/src/client.ts @@ -0,0 +1,192 @@ +import { type } from "arktype"; + +import type { Pkce } from "./pkce"; +import type { BaseTokens } from "./tokens"; + +// Provider-agnostic OAuth client config. Endpoints, client id, scopes, and +// timeouts are supplied by the caller; this module owns only the shared +// request shape. +export type OAuthClientConfig = { + clientId: string; + authorizeUrl: string; + tokenUrl: string; + redirectUri: string; + scopes: readonly string[]; + // Extra authorize-request params a provider requires. + extraAuthorizeParams?: Record; + tokenTimeoutMs: number; +}; + +/** + * Build the authorization URL the user opens to grant access. The challenge + * binds this request to the PKCE verifier held locally; `state` is the CSRF + * nonce the redirect must echo back unchanged. + */ +export function buildAuthorizeUrl( + config: OAuthClientConfig, + pkce: Pkce, + state: string, +): string { + const url = new URL(config.authorizeUrl); + url.searchParams.set("response_type", "code"); + url.searchParams.set("client_id", config.clientId); + url.searchParams.set("redirect_uri", config.redirectUri); + url.searchParams.set("scope", config.scopes.join(" ")); + url.searchParams.set("code_challenge", pkce.challenge); + url.searchParams.set("code_challenge_method", pkce.method); + url.searchParams.set("state", state); + if (config.extraAuthorizeParams !== undefined) { + for (const [key, value] of Object.entries(config.extraAuthorizeParams)) { + url.searchParams.set(key, value); + } + } + return url.toString(); +} + +// Validate the whole token response, not just access_token: a malformed +// expires_in (e.g. the string "soon") would otherwise survive and compute a +// NaN expiry, which never compares as expired, so the token would never +// refresh. +const TokenResponse = type({ + access_token: "string", + "refresh_token?": "string", + "expires_in?": "number", + "id_token?": "string", +}); +export type TokenResponse = typeof TokenResponse.infer; + +// The token endpoint responded with a non-2xx status. +export class OAuthTokenEndpointError extends Error { + readonly status: number; + readonly detail: string; + + constructor(status: number, detail: string) { + super( + `OAuth token endpoint returned ${String(status)}${detail ? `: ${detail}` : ""}`, + ); + this.name = "OAuthTokenEndpointError"; + this.status = status; + this.detail = detail; + } +} + +// The token endpoint responded 2xx with a payload that failed validation. +export class OAuthTokenResponseSchemaError extends Error { + constructor(summary: string) { + super(`OAuth token endpoint returned an unexpected payload: ${summary}`); + this.name = "OAuthTokenResponseSchemaError"; + } +} + +// No refresh token was present in the response or carried forward from a prior one. +export class OAuthMissingRefreshTokenError extends Error { + constructor() { + super( + "OAuth token response carried no refresh_token and none was previously stored.", + ); + this.name = "OAuthMissingRefreshTokenError"; + } +} + +/** + * Convert a token response to the shared base token fields. `now` is + * injectable so callers (and tests) control the expiry baseline; + * `previousRefresh` is carried forward when a refresh response omits a new + * refresh_token (servers may rotate or not). + * + * `expires_in` is RECOMMENDED, not required, on a token response (RFC 6749 + * §5.1). When a server omits it there is no spec-defined lifetime to fall + * back to, so `expiresAt` is left absent rather than guessed — a caller that + * needs a concrete expiry for such a token must supply its own policy. + */ +export function baseTokensFromResponse( + response: TokenResponse, + now: number, + previousRefresh: string | undefined, +): BaseTokens { + const refresh = response.refresh_token ?? previousRefresh; + if (refresh === undefined) throw new OAuthMissingRefreshTokenError(); + return { + access: response.access_token, + refresh, + ...(response.expires_in !== undefined + ? { expiresAt: now + response.expires_in * 1000 } + : {}), + }; +} + +// `fetch` implementation to use for token requests; injectable for tests. +export type FetchLike = typeof fetch; + +// `fetchImpl` is a required parameter here, not defaulted to the global — +// only the exported entry points (exchangeCode, refreshTokenRequest) default +// to the real `fetch`; an internal helper reaching for the global itself +// would make that default impossible to override consistently from one place. +async function postToken( + config: OAuthClientConfig, + body: URLSearchParams, + fetchImpl: FetchLike, +): Promise { + // Refresh can run on a hot path outside any surrounding timer, so the + // token request must abort within the bounded timeout rather than hang + // the caller forever when the endpoint stalls. + const res = await fetchImpl(config.tokenUrl, { + method: "POST", + headers: { + "content-type": "application/x-www-form-urlencoded", + accept: "application/json", + }, + body: body.toString(), + signal: AbortSignal.timeout(config.tokenTimeoutMs), + }); + if (!res.ok) { + let detail = ""; + try { + detail = await res.text(); + } catch { + // Non-2xx is the error; the body is optional detail. + } + throw new OAuthTokenEndpointError(res.status, detail); + } + const json = TokenResponse(await res.json()); + if (json instanceof type.errors) + throw new OAuthTokenResponseSchemaError(json.summary); + return json; +} + +/** + * Exchange an authorization code for a raw token response. Callers map the + * response onto their stored token shape (account id, id_token, ...). + */ +export async function exchangeCode( + config: OAuthClientConfig, + code: string, + verifier: string, + fetchImpl: FetchLike = fetch, +): Promise { + const body = new URLSearchParams({ + grant_type: "authorization_code", + code, + client_id: config.clientId, + redirect_uri: config.redirectUri, + code_verifier: verifier, + }); + return postToken(config, body, fetchImpl); +} + +/** + * Mint a fresh access token from a refresh token. Returns the raw response; + * callers map it and carry the prior refresh token forward when omitted. + */ +export async function refreshTokenRequest( + config: OAuthClientConfig, + refreshToken: string, + fetchImpl: FetchLike = fetch, +): Promise { + const body = new URLSearchParams({ + grant_type: "refresh_token", + refresh_token: refreshToken, + client_id: config.clientId, + }); + return postToken(config, body, fetchImpl); +} diff --git a/vendor/intx/oauth-core/src/index.ts b/vendor/intx/oauth-core/src/index.ts new file mode 100644 index 0000000000..59939f27a2 --- /dev/null +++ b/vendor/intx/oauth-core/src/index.ts @@ -0,0 +1,42 @@ +export { generatePkce, generateState, type Pkce } from "./pkce"; + +export { openInBrowser } from "./browser"; + +export { + startCallbackServer, + OAuthCallbackError, + OAuthCallbackPortInUseError, + type CallbackServer, + type CallbackServerConfig, +} from "./callback-server"; + +export type { AuthProfile, BaseTokens } from "./tokens"; +export { + buildAuthorizeUrl, + baseTokensFromResponse, + exchangeCode, + refreshTokenRequest, + OAuthTokenEndpointError, + OAuthTokenResponseSchemaError, + OAuthMissingRefreshTokenError, + type FetchLike, + type OAuthClientConfig, + type TokenResponse, +} from "./client"; + +export { + startOAuthLogin, + type OAuthLoginDeps, + type OAuthLoginHandle, + type StagedOAuthProfile, + type StartOAuthLoginOptions, +} from "./login"; + +export { + createTokenSession, + isTokenExpired, + OAuthProfileNotFoundError, + OAuthRefreshFailedError, + type TokenSession, + type TokenSessionDeps, +} from "./session"; diff --git a/vendor/intx/oauth-core/src/login.test.ts b/vendor/intx/oauth-core/src/login.test.ts new file mode 100644 index 0000000000..1112a01581 --- /dev/null +++ b/vendor/intx/oauth-core/src/login.test.ts @@ -0,0 +1,64 @@ +import { describe, expect, test } from "bun:test"; + +import { startOAuthLogin, type BaseTokens, type CallbackServer } from "./index"; + +function fakeCallbackServer(code: string): CallbackServer & { closed: number } { + const server = { + closed: 0, + waitForCode: async () => code, + close: () => { + server.closed += 1; + }, + }; + return server; +} + +describe("OAuth login startOAuthLogin — staging and commit", () => { + test("does not persist until commit, and coalesces a second commit into the same write", async () => { + // Load-bearing: the host must be able to show the staged profile and let + // the user cancel without writing tokens. Persisting inside `completed` + // would make cancel a no-op after the browser round-trip. A second + // commit() sharing the in-flight write is what stops a double-click from + // racing two saves against a store that is not idempotent. + const saves: { + name: string; + tokens: BaseTokens; + createdAt: number; + }[] = []; + const server = fakeCallbackServer("auth-code"); + const tokens: BaseTokens = { + access: "access-1", + refresh: "refresh-1", + expiresAt: 10_000, + }; + + const handle = await startOAuthLogin( + { + profile: "acct", + signal: new AbortController().signal, + now: () => 1234, + }, + { + startCallbackServer: async () => server, + buildAuthorizeUrl: () => "https://auth.example.com/authorize", + exchangeCode: async () => tokens, + saveProfile: async (profile) => { + saves.push(profile); + }, + openInBrowser: () => undefined, + }, + ); + + const staged = await handle.completed; + expect(saves).toEqual([]); + expect(server.closed).toBe(1); + expect(staged.profile).toEqual({ + name: "acct", + tokens, + createdAt: 1234, + }); + + await Promise.all([staged.commit(), staged.commit()]); + expect(saves).toEqual([{ name: "acct", tokens, createdAt: 1234 }]); + }); +}); diff --git a/vendor/intx/oauth-core/src/login.ts b/vendor/intx/oauth-core/src/login.ts new file mode 100644 index 0000000000..720684931b --- /dev/null +++ b/vendor/intx/oauth-core/src/login.ts @@ -0,0 +1,94 @@ +import { openInBrowser } from "./browser"; +import type { CallbackServer } from "./callback-server"; +import { generatePkce, generateState, type Pkce } from "./pkce"; +import type { AuthProfile, BaseTokens } from "./tokens"; + +export type StagedOAuthProfile = { + readonly profile: AuthProfile; + readonly commit: () => Promise; +}; + +export type OAuthLoginHandle = { + authorizeUrl: string; + completed: Promise>; + cancel: () => void; +}; + +export type StartOAuthLoginOptions = { + profile: string; + signal: AbortSignal; + now?: () => number; +}; + +export type OAuthLoginDeps = { + startCallbackServer: (expectedState: string) => Promise; + buildAuthorizeUrl: (pkce: Pkce, state: string) => string; + exchangeCode: ( + code: string, + verifier: string, + now: number, + ) => Promise; + saveProfile: (profile: { + name: string; + tokens: TTokens; + createdAt: number; + }) => Promise; + openInBrowser?: (url: string) => void; +}; + +/** + * Drive the loopback PKCE login: start the callback server, build the + * authorize URL, and return a handle. `completed` is lazy — the wait and + * exchange start when the caller first observes it, so a rejection cannot + * land as unhandled before anyone is listening. The server is closed when + * that work finishes, fails, or is aborted. + */ +export async function startOAuthLogin( + opts: StartOAuthLoginOptions, + deps: OAuthLoginDeps, +): Promise> { + const now = opts.now ?? Date.now; + const open = deps.openInBrowser ?? openInBrowser; + const pkce = generatePkce(); + const state = generateState(); + const server = await deps.startCallbackServer(state); + const authorizeUrl = deps.buildAuthorizeUrl(pkce, state); + + async function completeLogin(): Promise> { + try { + const code = await server.waitForCode(opts.signal); + const tokens = await deps.exchangeCode(code, pkce.verifier, now()); + const profile = { name: opts.profile, tokens, createdAt: now() }; + let committed: Promise | undefined; + return { + profile, + commit: () => { + if (committed !== undefined) return committed; + const attempt = deps.saveProfile(profile); + committed = attempt; + attempt.then( + () => undefined, + () => { + if (committed === attempt) committed = undefined; + }, + ); + return attempt; + }, + }; + } finally { + server.close(); + } + } + + let completed: Promise> | undefined; + open(authorizeUrl); + + return { + authorizeUrl, + get completed(): Promise> { + completed ??= completeLogin(); + return completed; + }, + cancel: () => server.close(), + }; +} diff --git a/vendor/intx/oauth-core/src/pkce.test.ts b/vendor/intx/oauth-core/src/pkce.test.ts new file mode 100644 index 0000000000..c0539b414a --- /dev/null +++ b/vendor/intx/oauth-core/src/pkce.test.ts @@ -0,0 +1,21 @@ +import { createHash } from "node:crypto"; +import { describe, expect, test } from "bun:test"; + +import { generatePkce } from "./index"; + +function base64urlDecode(value: string): Buffer { + return Buffer.from(value.replace(/-/g, "+").replace(/_/g, "/"), "base64"); +} + +describe("PKCE generatePkce — challenge derivation", () => { + test("the challenge is the base64url SHA-256 digest of the verifier", () => { + // Load-bearing: an authorization server recomputes this exact transform + // to check the verifier at token exchange. A wrong encoding (padding, + // charset) is rejected by every real provider, not just this package. + const { verifier, challenge, method } = generatePkce(); + expect(method).toBe("S256"); + expect(challenge).not.toMatch(/[+/=]/); + const expected = createHash("sha256").update(verifier).digest(); + expect(base64urlDecode(challenge)).toEqual(expected); + }); +}); diff --git a/vendor/intx/oauth-core/src/pkce.ts b/vendor/intx/oauth-core/src/pkce.ts new file mode 100644 index 0000000000..eeaa1c9817 --- /dev/null +++ b/vendor/intx/oauth-core/src/pkce.ts @@ -0,0 +1,38 @@ +import { createHash, randomBytes } from "node:crypto"; + +// PKCE (RFC 7636) and CSRF state generation for loopback OAuth flows. The +// verifier is a high-entropy random string; the challenge is its SHA-256 +// digest, base64url-encoded. The authorization server stores the challenge and +// later verifies the verifier presented at token exchange, which is what stops +// an intercepted authorization code from being redeemed by anyone else. + +function base64url(buffer: Buffer): string { + return buffer + .toString("base64") + .replace(/\+/g, "-") + .replace(/\//g, "_") + .replace(/=+$/, ""); +} + +// A PKCE verifier/challenge pair for one authorization attempt. +export type Pkce = { + verifier: string; + challenge: string; + method: "S256"; +}; + +/** Generate a fresh PKCE verifier and its S256 challenge. */ +export function generatePkce(): Pkce { + // 32 random bytes -> 43-char base64url string, within the RFC's 43-128 range. + const verifier = base64url(randomBytes(32)); + const challenge = base64url(createHash("sha256").update(verifier).digest()); + return { verifier, challenge, method: "S256" }; +} + +/** + * Generate an opaque CSRF nonce, echoed back on the redirect and checked for + * an exact match before the authorization code is trusted. + */ +export function generateState(): string { + return base64url(randomBytes(32)); +} diff --git a/vendor/intx/oauth-core/src/session.test.ts b/vendor/intx/oauth-core/src/session.test.ts new file mode 100644 index 0000000000..e751246d4a --- /dev/null +++ b/vendor/intx/oauth-core/src/session.test.ts @@ -0,0 +1,36 @@ +import { describe, expect, test } from "bun:test"; + +import { createTokenSession, type BaseTokens } from "./index"; + +describe("Token session createTokenSession — refresh coalescing", () => { + test("coalesces concurrent refreshes for the same profile into one request", async () => { + // Load-bearing: two callers racing a refresh against a provider that + // rotates refresh tokens would otherwise invalidate one attempt. + let release: (() => void) | undefined; + const gate = new Promise((resolve) => { + release = resolve; + }); + let refreshCount = 0; + const stored: { tokens: BaseTokens } = { + tokens: { access: "old", refresh: "ref", expiresAt: 1_000 }, + }; + const session = createTokenSession({ + skewMs: 100, + loadProfile: async () => stored, + updateTokens: async (_name, tokens) => { + stored.tokens = tokens; + }, + refreshTokens: async () => { + refreshCount += 1; + await gate; + return { access: "new", refresh: "ref2", expiresAt: 10_000 }; + }, + toAccess: (tokens) => tokens.access, + }); + const first = session.getValidToken("p", 2_000); + const second = session.getValidToken("p", 2_000); + release?.(); + expect(await Promise.all([first, second])).toEqual(["new", "new"]); + expect(refreshCount).toBe(1); + }); +}); diff --git a/vendor/intx/oauth-core/src/session.ts b/vendor/intx/oauth-core/src/session.ts new file mode 100644 index 0000000000..b6b6f1f188 --- /dev/null +++ b/vendor/intx/oauth-core/src/session.ts @@ -0,0 +1,119 @@ +import type { BaseTokens } from "./tokens"; + +/** + * Whether `tokens` is at or within `skewMs` of its expiry at `now`. + * + * `expiresAt` is absent when the token endpoint omitted `expires_in` (RFC + * 6749 §5.1 makes it RECOMMENDED, not required). With no stated lifetime, a + * token of unknown age is treated as not expired: it is used until the + * server rejects it. Refreshing eagerly instead would rotate the refresh + * token (on a provider that rotates it every use) on every single call. + */ +export function isTokenExpired( + tokens: BaseTokens, + now: number, + skewMs: number, +): boolean { + return tokens.expiresAt !== undefined && now >= tokens.expiresAt - skewMs; +} + +// A named profile had no tokens. +export class OAuthProfileNotFoundError extends Error { + constructor(name: string) { + super(`No OAuth profile named "${name}".`); + this.name = "OAuthProfileNotFoundError"; + } +} + +// A stored refresh token failed to mint a new access token. +export class OAuthRefreshFailedError extends Error { + constructor(name: string, cause: unknown) { + super(`Refreshing the OAuth profile "${name}" failed.`, { cause }); + this.name = "OAuthRefreshFailedError"; + } +} + +// Dependencies for createTokenSession, all injectable for testing. +export type TokenSessionDeps = { + skewMs: number; + loadProfile: (name: string) => Promise<{ tokens: TTokens } | undefined>; + updateTokens: (name: string, tokens: TTokens) => Promise; + refreshTokens: (refreshToken: string, now: number) => Promise; + // Project stored tokens into the access shape returned to callers. + toAccess: (tokens: TTokens) => TAccess; + // Merge when a refresh response omits fields the caller wants carried forward. + mergeRefreshed?: (refreshed: TTokens, previous: TTokens) => TTokens; +}; + +export type TokenSession = { + isExpired: (tokens: TTokens, now: number) => boolean; + getValidToken: (name: string, now?: number) => Promise; +}; + +/** + * Resolve a valid access token for a named profile, refreshing transparently + * when the stored token is at or near expiry. Multiple concurrent calls for + * the same profile coalesce into a single refresh; the rest observe the + * result of that one call rather than racing the authorization server's + * refresh-token rotation policy. + */ +export function createTokenSession( + deps: TokenSessionDeps, +): TokenSession { + const inflightRefresh = new Map>(); + + const isExpired = (tokens: TTokens, now: number): boolean => + isTokenExpired(tokens, now, deps.skewMs); + + async function doRefresh(name: string, now: number): Promise { + const profile = await deps.loadProfile(name); + if (profile === undefined) throw new OAuthProfileNotFoundError(name); + // Re-check expiry after the I/O; another caller may have refreshed already. + if (!isExpired(profile.tokens, now)) return deps.toAccess(profile.tokens); + let refreshed: TTokens; + try { + refreshed = await deps.refreshTokens(profile.tokens.refresh, now); + } catch (err) { + throw new OAuthRefreshFailedError(name, err); + } + const merged = + deps.mergeRefreshed !== undefined + ? deps.mergeRefreshed(refreshed, profile.tokens) + : refreshed; + await deps.updateTokens(name, merged); + return deps.toAccess(merged); + } + + async function getValidToken( + name: string, + now: number = Date.now(), + ): Promise { + const existingProfile = await deps.loadProfile(name); + if (existingProfile === undefined) + throw new OAuthProfileNotFoundError(name); + if (!isExpired(existingProfile.tokens, now)) + return deps.toAccess(existingProfile.tokens); + + // Deduplicate via the in-flight map so concurrent callers share the same + // refresh rather than racing. + const pending = inflightRefresh.get(name); + if (pending !== undefined) return pending; + + const refreshPromise = doRefresh(name, now); + inflightRefresh.set(name, refreshPromise); + // Clean up regardless of outcome so a subsequent call after a failure + // can retry rather than returning the cached error. .then(cleanup, + // cleanup) instead of .finally() avoids an abandoned promise chain + // whose pass-through rejection could become an unhandled rejection — + // callers catch the original refreshPromise. + const cleanup = (): void => { + if (inflightRefresh.get(name) === refreshPromise) + inflightRefresh.delete(name); + }; + refreshPromise.then(cleanup, cleanup); + + return refreshPromise; + } + + return { isExpired, getValidToken }; +} diff --git a/vendor/intx/oauth-core/src/tokens.ts b/vendor/intx/oauth-core/src/tokens.ts new file mode 100644 index 0000000000..72d3f8e823 --- /dev/null +++ b/vendor/intx/oauth-core/src/tokens.ts @@ -0,0 +1,19 @@ +// Token shape the exchange returns. Persistence is the host's job +// (Interchange `oauth_token` credential, OS vault, or otherwise). +// +// `expiresAt` is optional because RFC 6749 §5.1 makes `expires_in` RECOMMENDED, +// not required — a token endpoint may omit it, and this package refuses to +// guess a lifetime on the caller's behalf (see `client.ts`). `undefined` +// means "the server did not say"; `session.ts`'s `isTokenExpired` treats such +// a token as not expired until the server rejects it (see there for why). +export type BaseTokens = { + access: string; + refresh: string; + expiresAt?: number; +}; + +export type AuthProfile = { + name: string; + tokens: TTokens; + createdAt: number; +}; diff --git a/vendor/intx/oauth-core/tsconfig.json b/vendor/intx/oauth-core/tsconfig.json new file mode 100644 index 0000000000..5d7f67e4c9 --- /dev/null +++ b/vendor/intx/oauth-core/tsconfig.json @@ -0,0 +1,17 @@ +{ + "extends": "./tsconfig.src.json", + "compilerOptions": { + "composite": false, + "noEmit": true, + "disableSourceOfProjectReferenceRedirect": true, + "declaration": false, + "declarationMap": false, + "emitDeclarationOnly": false, + "tsBuildInfoFile": "tsconfig.tsbuildinfo", + "rootDir": "../../.." + }, + "include": [ + "src" + ], + "exclude": [] +} diff --git a/vendor/intx/oauth-core/tsconfig.src.json b/vendor/intx/oauth-core/tsconfig.src.json new file mode 100644 index 0000000000..eecaae27ec --- /dev/null +++ b/vendor/intx/oauth-core/tsconfig.src.json @@ -0,0 +1,39 @@ +{ + "extends": "../../../tsconfig.base.json", + "include": [ + "src", + "package.json", + "src/**/*.json" + ], + "exclude": [ + "src/**/*.test.ts", + "src/**/*.test.tsx" + ], + "compilerOptions": { + "esModuleInterop": true, + "skipLibCheck": true, + "target": "ESNext", + "allowJs": true, + "resolveJsonModule": true, + "moduleDetection": "force", + "isolatedModules": true, + "verbatimModuleSyntax": true, + "moduleResolution": "bundler", + "strict": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + "exactOptionalPropertyTypes": true, + "module": "ESNext", + "noEmit": true, + "lib": [ + "ESNext" + ], + "types": [ + "bun" + ], + "composite": true, + "emitDeclarationOnly": true, + "outDir": "dist", + "tsBuildInfoFile": "dist/tsconfig.tsbuildinfo" + } +}