Skip to content

C26: Inspector field kit and catalog hook - #896

Merged
LinuxDevil merged 1 commit into
mainfrom
fb-c26-inspector-kit
Nov 7, 2026
Merged

LinuxDevil merged 1 commit into
mainfrom
fb-c26-inspector-kit

Conversation

@LinuxDevil

Copy link
Copy Markdown
Owner

What changed

  • src/canvas/useCatalog.ts — useCatalog(kind) fetches GET /catalog/<kind> once per page load through a module-level promise cache shared by every caller; refreshCatalog(kind) drops the entry so a Retry button refetches. Uses the per-kind RuntimeClient methods that already exist (catalogModels, catalogTools, …) rather than adding a generic catalog(kind).
  • src/canvas/fields/ — the shared Inspector controls, one component per file, CSS in fields.css (tokens only):
    • SecretRefField — kind Select (Environment variable / Studio secret / Plain text only with allowPlain) + one Input; env ^[A-Z_][A-Z0-9_]*$ and secret-name validation, plain-mode warning hint, Required when empty + required, undefined on empty.
    • StringListField — chips with aria-label="Remove <item>" buttons; Enter or comma adds, duplicates ignored, last remove → undefined.
    • KeyValueField — draft rows (key + text or SecretRefField-with-allowPlain value + remove), Add appends { '': '' }, duplicate keys → 'Each name must be unique', keyPattern → 'Use capitals, digits and underscores', insertion order preserved, empty → undefined.
    • JsonField — mono Textarea draft; blur parses → check → onChange; 'This is not valid JSON: '; draft kept while invalid; empty → undefined.
    • OptionalNumberField — type=number, range and integer errors, invalid input never emitted, unit suffix.
    • ChoiceField<T> — Select with index-valued options; allowUnset adds a first option (unsetLabel, default 'Default') → undefined.
  • shared/wireTypes.ts — SecretRef, derived from the webhook trigger's secret field (the SDK keeps the type private, so this cannot drift, like McpServerSpecV2).
  • src/__tests__/contrast.test.ts — added the warning/surface pair for the plain-text warning hint. No other new text/background pairs.

How it was tested

  • npm run typecheck --workspace apps/agent-forge — clean (also typechecks e2e tsconfig)
  • npx vitest run in apps/agent-forge — 95 files / 1012 tests pass, incl. 7 new test files (useCatalog, SecretRefField, StringListField, KeyValueField, JsonField, OptionalNumberField, ChoiceField)
  • npm run typecheck:server + npm run test:server --workspace apps/agent-forge — 85 files / 1121 tests pass
  • Root npx tsc --noEmit, npm run lint, Studio npm run lint — clean (0 errors)
  • npm run test:coverage — 7246 pass; the only failures are the 6 src/spec/v2/templates.test.ts README checks caused by CRLF working-tree checkouts (known environmental issue on this machine; git ls-files --eol shows w/crlf). The create-lousho e2e failures disappeared after building that workspace's dist.
  • npm run fallow — no issues
  • npm run docs:ratchet (at baseline), npm run api:check (20/20 up to date), npm run docs:llms:check, npm run size-check (within budgets) — all pass

Acceptance criteria

  • Two components calling useCatalog('models') at once trigger one request — module-level promise cache; test asserts one catalogModels call for two mounted consumers
  • refreshCatalog makes the next mount refetch — covered by test
  • Each field component meets its behaviour column, including undefined on empty — covered per component
  • No colour literals; new text/background token pairs added to src/__tests__/contrast.test.ts — warning/surface added, all CSS uses tokens

Generated with Devin

Shared Inspector controls for the node forms - SecretRefField
({ env }/{ secret }/plain with per-kind name validation), StringListField
(chips), KeyValueField (draft rows with duplicate-key and key-pattern
errors, order kept), JsonField (blur-parse draft), OptionalNumberField
and ChoiceField - plus useCatalog, a module-cached hook over the
GET /catalog/* routes with refreshCatalog for retries. SecretRef joins
shared/wireTypes.ts, derived from the webhook trigger's secret field.

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@LinuxDevil
LinuxDevil merged commit 16e69cf into main Nov 7, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant