Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
fix(control-ui): label every order hint the registry accepts
Andy Pavia6ca42103bd48
diff --git a/control-ui/components/HookInstallForm/constants.ts b/control-ui/components/HookInstallForm/constants.tsindex 835d9bc0b..2bc529877 100644--- a/control-ui/components/HookInstallForm/constants.ts+++ b/control-ui/components/HookInstallForm/constants.ts@@ -38,7 +38,8 @@ export const ALL_HOOK_CAPABILITIES: HookCapability[] = HOOK_CAPABILITY_OPTIONS.m// `may_add_context` has no such branch — a hook adds context whether or not it// was granted — so telling an operator its actions are discarded would be// untrue for that one, and would spend the warning's credibility on a case-// where nothing is wrong.+// where nothing is wrong. Tracked in evenfire-ai/evenfire#459; this list moves+// when that lands.export const ENFORCED_HOOK_CAPABILITIES: HookCapability[] = ['may_deny','may_rewrite',@@ -48,9 +49,14 @@ export const ENFORCED_HOOK_CAPABILITIES: HookCapability[] = [// Default installation order applied by the backend when none is supplied.export const DEFAULT_HOOK_ORDER = 100-// `hook_meta.authorDefaults.orderHint` is a word ("early", "late"), while the-// CRD's `order` is an integer. There is no published mapping between them, so-// the hint is shown to the operator rather than silently converted to a number.+// `hook_meta.authorDefaults.orderHint` is one of three words the registry+// accepts — "early", "normal", "late" — while the CRD's `order` is an integer.+// There is no published mapping between them, so the hint is shown to the+// operator rather than silently converted to a number.+//+// All three are labelled, "normal" included: an author who publishes it made a+// choice, and rendering nothing would make that indistinguishable from an+// author who published no hint at all.//// Null-prototype on purpose: the key is a publisher-supplied string off the// registry entry, so an inherited key (`toString`, `constructor`, …) would@@ -59,6 +65,7 @@ export const ORDER_HINT_LABELS: Record<string, string> = Object.assign(Object.create(null) as Record<string, string>,{early: 'The author suggests running this hook early.',+ normal: 'The author has no ordering preference for this hook.',late: 'The author suggests running this hook late.',})diff --git a/control-ui/components/__tests__/HookInstallForm.test.tsx b/control-ui/components/__tests__/HookInstallForm.test.tsxindex 0e1fc5986..c43b06563 100644--- a/control-ui/components/__tests__/HookInstallForm.test.tsx+++ b/control-ui/components/__tests__/HookInstallForm.test.tsx@@ -121,6 +121,21 @@ describe('HookInstallForm — author declarations', () => {expect(await screen.findByLabelText(/^order$/i)).toHaveValue(100)})+ it('shows a hint for every order hint the registry accepts', async () => {+ // "normal" is legal alongside "early"/"late". Rendering nothing for it made+ // an author who chose it look like an author who published no hint.+ render(+ <HookInstallForm+ entry={entryWith({ authorDefaults: { orderHint: 'normal' } })}+ onCancel={noop}+ onInstalled={noop}+ />+ )+ await openAdvanced()+ expect(await screen.findByText(/no ordering preference/i)).toBeInTheDocument()+ expect(await screen.findByLabelText(/^order$/i)).toHaveValue(100)+ })+it('ignores an order hint naming an inherited object key', async () => {// `orderHint: "toString"` used to resolve to Object.prototype.toString off// the label map and render as if it were a real hint.diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex 6a2c37b1d..2ec4fe8e5 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.453",+ "version": "0.1.454","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.453",+ "version": "0.1.454","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/llm-providers": "file:../packages/llm-providers",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 5d0f54fc2..1d989a4b6 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.453",+ "version": "0.1.454","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",