diff --git a/.github/workflows/quality-line.yml b/.github/workflows/quality-line.yml index ff82a60..862b1de 100644 --- a/.github/workflows/quality-line.yml +++ b/.github/workflows/quality-line.yml @@ -5,8 +5,7 @@ name: Quality line # its answer no longer matches the spec Flyspace ships. A red run is the # signal to fix the spec before a person's block breaks. # -# Keys are optional repository secrets (FRED_API_KEY, ALPHA_VANTAGE_API_KEY, -# NEWSAPI_KEY, METACULUS_API_KEY). Without one, that API's keyed operations +# ALPHA_VANTAGE_API_KEY is an optional repository secret. Without it, that API's keyed operations # are reported as skipped, not failed. The report is kept as an artifact; # committing public/curated-quality.json stays a person's step. @@ -28,10 +27,7 @@ jobs: runs-on: ubuntu-24.04 timeout-minutes: 15 env: - FRED_API_KEY: ${{ secrets.FRED_API_KEY }} ALPHA_VANTAGE_API_KEY: ${{ secrets.ALPHA_VANTAGE_API_KEY }} - NEWSAPI_KEY: ${{ secrets.NEWSAPI_KEY }} - METACULUS_API_KEY: ${{ secrets.METACULUS_API_KEY }} steps: - uses: actions/checkout@v7.0.1 - uses: actions/setup-node@v7.1.0 diff --git a/APEX_PLAN.md b/APEX_PLAN.md index e78beee..05c672a 100644 --- a/APEX_PLAN.md +++ b/APEX_PLAN.md @@ -108,8 +108,9 @@ database, so everything behind those facts went. Last present at `8a21350`: engine, kernel, crystallize, run lineage, the Think result modal, markdown rendering of answers. A turn now commits the preview's refusal. - Postgres, migrations, the inference ledger, hosted OIDC auth. -- The capability broker's server side and data plant (house keys). A brokered - block still runs and shows the broker's 503. +- The capability broker and data plant (house keys), and the curated APIs that + need them because they refuse browser calls: FRED, NewsAPI, Metaculus. Keyed + APIs that accept browser calls keep working with a visitor's own key. - OAuth sign-in. A Google block still says sign-in is not set up. - Remote speech (OpenAI Realtime). The browser recognizer remains. - Jev and Kev persona suggestions and meaning search. Keyword search remains. diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index 0388738..3892fc5 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -20,10 +20,10 @@ browser's IndexedDB unless the visitor saves an account backup (below). | `GET /api/polymarket` | Polymarket markets | | `POST /api/llm`, `POST /api/jev-persona`, `POST /api/capability-broker`, `POST /api/registry-intent`, `GET /api/inference-runs` | always 503 | -The 503 routes are one-line stubs. They stay because +The 503 routes are one-line stubs that no client calls. They stay only because `.github/workflows/deploy-preview.yml` asserts those answers after every deploy -and rolls back otherwise; the client calls only the capability broker one. Remove -a stub only together with its check in that workflow. +and rolls back otherwise. Remove a stub only together with its check in that +workflow. ## Deploying the preview @@ -83,7 +83,7 @@ Every push and PR, three jobs (`.github/workflows/ci.yml`): | **Dependency audit** | Production dependencies block on `high`; dev-only advisories are reported, not blocking | The bundle scan does not grep for variable *names* - a name proves nothing, and -CI has no real keys. It builds with `FRED_API_KEY=OMNI-CANARY-FRED_API_KEY-` +CI has no real keys. It builds with `ALPHA_VANTAGE_API_KEY=OMNI-CANARY-ALPHA_VANTAGE_API_KEY-` and friends, then looks for those exact values in what a browser is served. Run it locally against your own `.env`: diff --git a/package.json b/package.json index c40e786..c53f907 100644 --- a/package.json +++ b/package.json @@ -17,8 +17,6 @@ "test:watch": "vitest", "test:e2e": "playwright test", "scan:bundle": "npx tsx scripts/scan-client-bundle.ts", - "dev:vinext": "vinext dev --port 3001", - "build:vinext": "npm run build", "start:vinext": "wrangler dev --config dist/server/wrangler.json", "deploy:vinext": "vinext-cloudflare deploy --config dist/server/wrangler.json", "catalog:build": "tsx scripts/build-api-index.ts", diff --git a/public/curated-quality.json b/public/curated-quality.json index 4ab13e9..f761a21 100644 --- a/public/curated-quality.json +++ b/public/curated-quality.json @@ -3,27 +3,6 @@ "version": 1, "checkedAt": "2026-10-12T21:31:53.965Z", "results": [ - { - "api": "omni:fred", - "operationId": "getSeriesObservations", - "title": "Values of an economic series over time", - "status": "skipped", - "detail": "no key (set FRED_API_KEY)" - }, - { - "api": "omni:fred", - "operationId": "searchSeries", - "title": "Find economic series by keyword", - "status": "skipped", - "detail": "no key (set FRED_API_KEY)" - }, - { - "api": "omni:fred", - "operationId": "getSeries", - "title": "Describe one economic series", - "status": "skipped", - "detail": "no key (set FRED_API_KEY)" - }, { "api": "omni:bls", "operationId": "getSeries", @@ -38,27 +17,6 @@ "title": "Stock quote or price history", "status": "skipped", "detail": "no key (set ALPHA_VANTAGE_API_KEY)" - }, - { - "api": "omni:newsapi", - "operationId": "topHeadlines", - "title": "Top headlines now", - "status": "skipped", - "detail": "no key (set NEWSAPI_KEY)" - }, - { - "api": "omni:newsapi", - "operationId": "everything", - "title": "Search news articles", - "status": "skipped", - "detail": "no key (set NEWSAPI_KEY)" - }, - { - "api": "omni:metaculus", - "operationId": "listPosts", - "title": "Forecasting questions", - "status": "skipped", - "detail": "no key (set METACULUS_API_KEY)" } ] } diff --git a/scripts/lib/verifySpec.ts b/scripts/lib/verifySpec.ts index a636311..23e79fd 100644 --- a/scripts/lib/verifySpec.ts +++ b/scripts/lib/verifySpec.ts @@ -34,8 +34,7 @@ function sampleInput(manifest: CapabilityManifest): { ok: true; input: Record { const results: QualityResult[] = []; diff --git a/scripts/verify-curated.ts b/scripts/verify-curated.ts index 1cdc390..485ae0c 100644 --- a/scripts/verify-curated.ts +++ b/scripts/verify-curated.ts @@ -12,9 +12,7 @@ // no example is reported as untestable rather than guessed at. // // Keys come from the environment (each curated entry's `keyEnv`); without -// one, a keyed operation is "skipped", never "failed". In Node there is no -// CORS, so a broker-routed API is called directly here: this verifies the -// provider and the spec, not the broker. +// one, a keyed operation is "skipped", never "failed". // // Exit 1 when any operation failed. Nothing is written without --write. // ============================================ diff --git a/src/blocks/capability/CapabilityBlock.tsx b/src/blocks/capability/CapabilityBlock.tsx index 8c10575..78b78ca 100644 --- a/src/blocks/capability/CapabilityBlock.tsx +++ b/src/blocks/capability/CapabilityBlock.tsx @@ -16,8 +16,6 @@ import { KeyField, keySlotOf, useHasKey } from '@/components/apis/KeyField'; import { useRememberingKeys } from '@/components/apis/RememberKeys'; import { SignInPrompt } from '@/components/apis/SignIn'; import { signInSlotOf } from '@/core/capabilities/connect'; -import { ProviderAttribution } from '@/components/apis/ProviderAttribution'; -import { attributionFor } from '@/core/capabilities/curatedApis'; import { argumentsFrom, CapabilityInputs, constantOf, inputSummaryOf, missingInputs } from './CapabilityInputs'; import { CapabilityResult } from './CapabilityResult'; @@ -48,7 +46,7 @@ function isUnboundKeyError(error: string): boolean { /** * An API that may be saying no to the credential: worth offering to change - * the key. Some report a bad key as 400 (FRED does), not 401 or 403. + * the key. Some report a bad key as 400, not 401 or 403. */ function isRefusal(error: string): boolean { return /\bHTTP (400|401|403)\b/.test(error); @@ -97,8 +95,6 @@ export function CapabilityBlockView({ instanceId }: { instanceId: string }) { const signIn = signInSlotOf(manifest); const needsSignIn = signIn !== null; const needsCredential = needsKey || needsSignIn; - // A provider whose terms require a notice on every app screen that uses it (FRED). - const attribution = attributionFor(manifest); const sideEffect = manifest?.effect === 'write' || manifest?.effect === 'destructive'; const params = isPlainParams(block?.params) ? block.params : {}; @@ -185,9 +181,6 @@ export function CapabilityBlockView({ instanceId }: { instanceId: string }) {
{manifest ? : not installed} {destination ? {destination} : null} - {manifest?.transport.kind === 'http' && manifest.transport.access === 'server_broker' ? ( - via server - ) : null} {sideEffect ? ( {manifest?.approval === 'approved' ? 'approved' : 'needs approval'} ) : null} @@ -260,7 +253,6 @@ export function CapabilityBlockView({ instanceId }: { instanceId: string }) {

) : null}
- {attribution ? : null} {previewError ? (

{previewError}

) : null} diff --git a/src/blocks/capability/CapabilityInputs.tsx b/src/blocks/capability/CapabilityInputs.tsx index a69bd60..9e65eaa 100644 --- a/src/blocks/capability/CapabilityInputs.tsx +++ b/src/blocks/capability/CapabilityInputs.tsx @@ -83,8 +83,8 @@ export function coerceInput(input: CapabilityInput, draft: unknown): unknown { } /** - * A required input with exactly one allowed value is not a choice: FRED's - * `file_type` must be `json`. It is sent without a field. + * A required input with exactly one allowed value is not a choice. It is + * sent without a field. */ export function constantOf(input: CapabilityInput): { value: unknown } | null { const options = input.schema.enum; diff --git a/src/blocks/capability/CapabilityResult.tsx b/src/blocks/capability/CapabilityResult.tsx index 60f2dbf..6cb5177 100644 --- a/src/blocks/capability/CapabilityResult.tsx +++ b/src/blocks/capability/CapabilityResult.tsx @@ -196,7 +196,7 @@ function rowsOf(value: unknown): unknown[] | null { /** * The one list a response carries, found through wrappers: a record holding - * exactly one list (FRED's `observations`, a search's `results`), a + * exactly one list (a search's `results`), a * one-element array around a record (BLS's `series`), or a map of rows. * Plain values and flat records beside it are kept as details. */ diff --git a/src/blocks/capability/ProviderAttribution.component.test.tsx b/src/blocks/capability/ProviderAttribution.component.test.tsx deleted file mode 100644 index 0a052e7..0000000 --- a/src/blocks/capability/ProviderAttribution.component.test.tsx +++ /dev/null @@ -1,51 +0,0 @@ -// @vitest-environment happy-dom -import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { render, screen } from '@testing-library/react'; -import { CapabilityBlockView } from './CapabilityBlock'; -import { attributionFor, curatedApi } from '@/core/capabilities/curatedApis'; -import { compileOpenApi } from '@/core/capabilities/openapi'; -import { clearCapabilities, installProposal } from '@/core/capabilities/registry'; -import { blockRegistry } from '@/core/registry/BlockRegistry'; -import { useBlockStore, useWireStore } from '@/core/stores'; - -const NOTICE = 'This product uses the FRED® API but is not endorsed or certified by the Federal Reserve Bank of St. Louis.'; - -function fredManifests() { - const fred = curatedApi('omni:fred')!; - return compileOpenApi(fred.spec, { sourceLocator: fred.entry.specUrl, brokerOrigins: fred.brokerOrigins }).manifests; -} - -beforeEach(() => { - clearCapabilities(); - useBlockStore.setState({ blocks: [], activeShellId: 'root' }); - useWireStore.setState({ wires: [] }); -}); -afterEach(() => { - clearCapabilities(); - useBlockStore.setState({ blocks: [] }); -}); - -describe('FRED attribution', () => { - it('applies to every FRED operation, by its origin, however it was installed', () => { - for (const manifest of fredManifests()) expect(attributionFor(manifest)?.notice).toBe(NOTICE); - const pasted = compileOpenApi(curatedApi('omni:fred')!.spec).manifests[0]; - expect(attributionFor(pasted)?.notice).toBe(NOTICE); - }); - - it('does not apply to other APIs', () => { - const metaculus = curatedApi('omni:metaculus')!; - const [manifest] = compileOpenApi(metaculus.spec, { brokerOrigins: metaculus.brokerOrigins }).manifests; - expect(attributionFor(manifest)).toBeNull(); - }); - - it('shows the notice and the terms link on a FRED block, before any run', () => { - const [manifest] = fredManifests(); - expect(installProposal(manifest).ok).toBe(true); - const instanceId = useBlockStore.getState().addBlock(blockRegistry.get(manifest.id)!, { x: 0, y: 0 }); - render(); - expect(screen.getByTestId('provider-attribution').textContent).toContain(NOTICE); - const link = screen.getByRole('link', { name: 'FRED® API Terms of Use' }) as HTMLAnchorElement; - expect(link.href).toBe('https://fred.stlouisfed.org/docs/api/terms_of_use.html'); - expect(link.rel).toContain('noopener'); - }); -}); diff --git a/src/components/ShellPanel.tsx b/src/components/ShellPanel.tsx index cc73caf..09dbeb8 100644 --- a/src/components/ShellPanel.tsx +++ b/src/components/ShellPanel.tsx @@ -9,7 +9,7 @@ import { useState, useEffect, useId, useRef } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { useShellStore, useBlockStore } from '@/core/stores'; import { ShellConfig } from '@/core/schemas/shell.schema'; -import { SHELL_TEMPLATES, keyedProvidersForTemplate, type ShellTemplate } from '@/core/shells/templates'; +import { SHELL_TEMPLATES, type ShellTemplate } from '@/core/shells/templates'; interface ShellPanelProps { isOpen: boolean; @@ -257,7 +257,7 @@ export function ShellPanel({ isOpen, onClose }: ShellPanelProps) { {template.description}

- {keyedProvidersLine(template)} + Works without API keys

@@ -408,13 +408,6 @@ export function ShellPanel({ isOpen, onClose }: ShellPanelProps) { ); } -function keyedProvidersLine(template: ShellTemplate): string { - const keyed = keyedProvidersForTemplate(template); - if (keyed.length === 0) return 'Works without API keys'; - const names = keyed.map(p => p.envVar).filter((name): name is string => Boolean(name)); - return `Needs ${names.join(', ')}`; -} - // ============================================ // SHELL SECTION COMPONENT // ============================================ diff --git a/src/components/apis/AddApiDialog.component.test.tsx b/src/components/apis/AddApiDialog.component.test.tsx index 1ea8e6e..f22ffa5 100644 --- a/src/components/apis/AddApiDialog.component.test.tsx +++ b/src/components/apis/AddApiDialog.component.test.tsx @@ -104,36 +104,33 @@ afterEach(() => { // Find → review → install & place // ============================================ -describe('AddApiDialog: a curated API (FRED)', () => { - it('finds FRED beside the directory, says its calls go through Flyspace, and installs it as broker reads', async () => { +describe('AddApiDialog: a curated API (Alpha Vantage)', () => { + it('finds Alpha Vantage beside the directory, says its calls go to the provider, and installs it as a browser read', async () => { render(); - fireEvent.change(await screen.findByLabelText('Search APIs'), { target: { value: 'unemployment inflation' } }); - const fred = screen.getByRole('button', { name: 'Review FRED Economic Data' }); - expect(fred.textContent).toContain('· curated by Flyspace'); - fireEvent.click(fred); + fireEvent.change(await screen.findByLabelText('Search APIs'), { target: { value: 'stock quotes' } }); + const alpha = screen.getByRole('button', { name: 'Review Alpha Vantage Stocks' }); + expect(alpha.textContent).toContain('· curated by Flyspace'); + fireEvent.click(alpha); expect(await screen.findByText(/Spec written by Flyspace from the provider/)).toBeTruthy(); - expect(screen.getByText(/Sends requests to/).textContent).toContain('https://api.stlouisfed.org through Flyspace’s own server'); - expect(screen.getByText(/refuses calls from a browser/)).toBeTruthy(); - // FRED's terms: its notice and terms link, shown before installing. - expect(screen.getByTestId('provider-attribution').textContent).toContain('is not endorsed or certified by the Federal Reserve Bank of St. Louis'); - // Where to get the key, from FRED's own pages, and the documented format checked on paste. + expect(screen.getByText(/Sends requests to/).textContent).toContain('https://www.alphavantage.co'); + // Where to get the key, from Alpha Vantage's own pages. const guide = screen.getByTestId('key-guide'); - expect(guide.textContent).toContain('Get a key at fredaccount.stlouisfed.org/apikeys'); - expect(guide.textContent).toContain('A free FRED account'); + expect(guide.textContent).toContain('Get a key at www.alphavantage.co/support'); + expect(guide.textContent).toContain('what describes you, your organization, and your email'); expect(guide.querySelector('a')!.getAttribute('rel')).toBe('noopener noreferrer'); - fireEvent.change(screen.getByLabelText('Key for https://api.stlouisfed.org'), { target: { value: 'abc123' } }); - expect(screen.getByText(/does not look like the documented key format \(32 lowercase letters and digits\)/)).toBeTruthy(); + fireEvent.change(screen.getByLabelText('Key for https://www.alphavantage.co'), { target: { value: 'abc123' } }); fireEvent.click(screen.getByRole('button', { name: 'Install & place' })); - const installed = allCapabilities().filter(m => m.source.locator === 'omni:curated/fred'); - expect(installed).toHaveLength(3); - for (const manifest of installed) expect(manifest.transport.kind === 'http' && manifest.transport.access).toBe('server_broker'); - expect(placedCapabilityBlocks()[0].schema.display_name).toBe('Values of an economic series over time'); - expect(calls().some(url => url.includes('stlouisfed'))).toBe(false); // nothing fetched for the spec + const installed = allCapabilities().filter(m => m.source.locator === 'omni:curated/alpha-vantage'); + expect(installed).toHaveLength(1); + for (const manifest of installed) expect(manifest.transport.kind === 'http' && manifest.transport.access).toBe('browser_direct'); + expect(placedCapabilityBlocks()[0].schema.display_name).toBe('Stock quote or price history'); + expect(calls().some(url => url.includes('alphavantage'))).toBe(false); // nothing fetched for the spec + }); + }); -}); describe('AddApiDialog: from search to the canvas', () => { it('opens on search, and reviews nothing until an API is chosen', async () => { diff --git a/src/components/apis/AddApiDialog.tsx b/src/components/apis/AddApiDialog.tsx index 3782db5..1648de2 100644 --- a/src/components/apis/AddApiDialog.tsx +++ b/src/components/apis/AddApiDialog.tsx @@ -5,8 +5,8 @@ import { X } from 'lucide-react'; import { ApiSearch } from '@/components/ApiSearch'; import type { ApiIndexEntry } from '@/core/capabilities/apiIndex'; import { compileOpenApi } from '@/core/capabilities/openapi'; -import { attributionFor, curatedApi } from '@/core/capabilities/curatedApis'; -import { checkKeyFormat, keyGuideFor } from '@/core/capabilities/keyGuide'; +import { curatedApi } from '@/core/capabilities/curatedApis'; +import { keyGuideFor } from '@/core/capabilities/keyGuide'; import { KeyGuideNote } from './KeyGuideNote'; import { useKeyKeepingNote } from './RememberKeys'; import { fetchCatalogSpec, RegistryFetchError } from '@/core/capabilities/registrySearch'; @@ -18,7 +18,6 @@ import { spatialSession } from '@/core/interaction/session'; import { useUIStore } from '@/core/stores/uiStore'; import { ApiReview, destinationOf } from './ApiReview'; import { isUserInstalled, YourApis } from './YourApis'; -import { ProviderAttribution } from './ProviderAttribution'; /** A capability block's default footprint, used to center it on the canvas. */ const BLOCK_SIZE = { width: 320, height: 240 }; @@ -109,8 +108,8 @@ export function AddApiDialog({ open, onClose }: AddApiDialogProps) { if (!open) return null; - const showProposals = (document: unknown, title: string, subtitle: string, locator?: string, brokerOrigins?: readonly string[]) => { - const result = compileOpenApi(document, { ...(locator ? { sourceLocator: locator } : {}), ...(brokerOrigins ? { brokerOrigins } : {}) }); + const showProposals = (document: unknown, title: string, subtitle: string, locator?: string) => { + const result = compileOpenApi(document, locator ? { sourceLocator: locator } : {}); setInstall(Object.fromEntries(result.manifests.map(m => [m.id, true]))); setPlaceId(defaultPlacement(result.manifests)); setSecrets({}); @@ -137,7 +136,7 @@ export function AddApiDialog({ open, onClose }: AddApiDialogProps) { const subtitle = curated ? `Spec written by Flyspace from the provider's docs · ${entry.updated}` : entry.updated ? `Spec updated ${entry.updated} · ${entry.id}` : entry.id; - showProposals(document, entry.title, subtitle, entry.specUrl, curated?.brokerOrigins); + showProposals(document, entry.title, subtitle, entry.specUrl); } catch (err) { if (abort.signal.aborted) return; setReview({ state: 'failed', message: err instanceof RegistryFetchError ? err.message : `${entry.title}: the spec could not be fetched` }); @@ -310,10 +309,6 @@ export function AddApiDialog({ open, onClose }: AddApiDialogProps) {
    {review.issues.map(issue =>
  • {issue}
  • )}
) : null} - {(() => { - const attribution = proposals.map(attributionFor).find(Boolean); - return attribution ? : null; - })()} {proposals.some(manifest => install[manifest.id] && manifest.auth.kind === 'oauth') ? (

These operations read your own account, so they need a sign-in with read-only access. Place them, then sign in from the block. @@ -325,7 +320,6 @@ export function AddApiDialog({ open, onClose }: AddApiDialogProps) { {[...secretSlots].map(([ref, manifest]) => { const destination = destinationOf(manifest); const guide = keyGuideFor(manifest); - const formatWarning = checkKeyFormat(guide, secrets[ref] ?? ''); return (