@happyvertical/smrt-prompts 0.75.1 → 0.76.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +3 -1
- package/README.md +135 -0
- package/dist/i18n/catalog.generated.d.ts.map +1 -1
- package/dist/i18n/catalog.js +172 -1
- package/dist/i18n/catalog.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +617 -68
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/prompt-arena-transports.d.ts +64 -0
- package/dist/prompt-arena-transports.d.ts.map +1 -0
- package/dist/prompt-arena.d.ts +127 -0
- package/dist/prompt-arena.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +16 -5
- package/dist/svelte/arena-types.d.ts +53 -0
- package/dist/svelte/arena-types.d.ts.map +1 -0
- package/dist/svelte/arena-types.js +1 -0
- package/dist/svelte/arena.messages.d.ts +37 -0
- package/dist/svelte/arena.messages.d.ts.map +1 -0
- package/dist/svelte/arena.messages.js +37 -0
- package/dist/svelte/components/PromptArenaPanel.svelte +223 -0
- package/dist/svelte/components/PromptArenaPanel.svelte.d.ts +17 -0
- package/dist/svelte/components/PromptArenaPanel.svelte.d.ts.map +1 -0
- package/dist/svelte/index.d.ts +2 -0
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +1 -0
- package/package.json +7 -7
package/AGENTS.md
CHANGED
|
@@ -10,7 +10,9 @@ SMRT prompt registry and tenant-aware prompt override package. Code defines defa
|
|
|
10
10
|
- `PromptOverrideCollection` — collection API, plus `setTemplateOverride()` / `removeOverride()` / `findByScope()` / `getOverrideMapForKeys()` for the write and enumeration paths below
|
|
11
11
|
- `PromptOverrideService` — the only write path a host should use directly; asks a host-supplied authorizer before every write and fails closed (mirrors `FeatureOverrideService`, #3013); before authorizing it rejects any scope the resolver never reads (`InvalidPromptScopeError`: unknown type, app id other than `__app__`, blank/untrimmed/`__app__` tenant id), so a malformed tenant write cannot reach the app-wide row
|
|
12
12
|
- `PromptSettingsService` — read/write helper for a management screen: `listPromptSettings()` returns one `PromptSettingsRow` per registered key (the effective template, `appTemplate`/`tenantTemplate` for the raw override at each scope, `appDefaultTemplate`/`inheritedTemplate` for what reverting each scope produces, and `supplyingLevel`); `setPromptOverride()` refuses unknown keys and fields the definition marks not editable, then delegates to `PromptOverrideService` (#3053)
|
|
13
|
-
-
|
|
13
|
+
- `PromptArenaService` — opt-in process-local developer comparison runner; registered real host operations, scoped templates, fixed injected model settings, exact tracked run ids, blind pair judgements, transaction-bound evaluations, per-experiment metrics, and authorized winner promotion. Server integration: [README](README.md#developer-prompt-arena), [example](examples/arena-host.ts). Requires root DB outside transactions; host authentication and request-local tenant context.
|
|
14
|
+
- `createPromptArenaTransports()` — six bounded REST Request handlers and six MCP registrations via core `SmrtMCPServer.addTool`, sharing one typed dispatcher and mandatory host `assertOperationPermission()`; caller identity comes from server context. The browser example calls those REST handlers. See [transport integration](README.md#matching-rest-mcp-and-ui-adapters).
|
|
15
|
+
- `./svelte` subpath — `PromptSettingsPanel` and `PromptArenaPanel`, presentational management/arena panels (#3053)
|
|
14
16
|
|
|
15
17
|
## Resolution layers (priority low → high)
|
|
16
18
|
|
package/README.md
CHANGED
|
@@ -197,3 +197,138 @@ key as immutable once shipped. A rename needs a data migration that rewrites
|
|
|
197
197
|
- See [`AGENTS.md`](./AGENTS.md) for package-internal patterns
|
|
198
198
|
- See [`docs/content/standards.md`](../../docs/content/standards.md) for monorepo conventions
|
|
199
199
|
- See related: [`@happyvertical/smrt-languages`](../languages) (mirrors this package for language strings), [`@happyvertical/smrt-features`](../features) (feature flags — same management-UI treatment, #3052)
|
|
200
|
+
|
|
201
|
+
## Developer prompt arena
|
|
202
|
+
|
|
203
|
+
`PromptArenaService` runs one current resolved template and one edited draft
|
|
204
|
+
through a host-registered **in-process application operation**. It is opt-in:
|
|
205
|
+
construct it with `enabled: true` only on a development deployment and enable
|
|
206
|
+
`packages.prompts.allowScopedOverrides` in configuration. Keep one instance per
|
|
207
|
+
host database. There are no generated arena HTTP, CLI or MCP endpoints.
|
|
208
|
+
|
|
209
|
+
The [server integration example](examples/arena-host.ts) shows registration,
|
|
210
|
+
fixtures, input validation, request-local authorization and handler adapters.
|
|
211
|
+
The host authenticates requests, establishes the active tenant, protects writes
|
|
212
|
+
against CSRF, and bounds request bodies. Actor/tenant values come from the host
|
|
213
|
+
session; never accept them from request JSON. Every operation calls the host
|
|
214
|
+
`authorize` function and fails closed; reads and writes also enforce the active
|
|
215
|
+
tenant and the experiment's tenant. App/global scope is explicit `null`, never
|
|
216
|
+
an omitted tenant filter. Promotion additionally passes through the existing
|
|
217
|
+
`PromptSettingsService` authorizer and editable-template guard.
|
|
218
|
+
|
|
219
|
+
The registered runner validates JSON input, then invokes the **same application
|
|
220
|
+
method** used by ordinary traffic with the supplied tracked AI client. That
|
|
221
|
+
method resolves its prompt normally. The arena opens a scoped override per
|
|
222
|
+
variant and injects a client with one fixed host provider configuration and the
|
|
223
|
+
baseline resolved model/parameters/effort. It deliberately bypasses inference
|
|
224
|
+
tier routing, so a live binding or tier fallback cannot change the comparison's
|
|
225
|
+
model. Model options (including tool/schema options, when needed) must live in
|
|
226
|
+
the prompt's AI params: the injected client replaces call-site options with
|
|
227
|
+
this snapshot, preserving only cancellation signals. A supplied client can set
|
|
228
|
+
`label` for correct provider/model cost attribution, as in core's tracked client.
|
|
229
|
+
Runners must await their model calls and use the injected client; detached
|
|
230
|
+
work, job queues and runners that secretly call another client are unsupported.
|
|
231
|
+
The two variants receive independent copies of equivalent JSON input. The host
|
|
232
|
+
runner is trusted server code and must not embed template identity in outputs.
|
|
233
|
+
|
|
234
|
+
Each pair retains its exact original JSON input, and each input/variant gets
|
|
235
|
+
its own service-owned tracked run. Usage is read through
|
|
236
|
+
core's public `listAiUsage` with that exact run id and explicit tenant; another
|
|
237
|
+
experiment or ordinary call with the same prompt/model/hash never enters the
|
|
238
|
+
scoreboard. An execution failure is visible and an incomplete pair cannot be
|
|
239
|
+
judged. Blind responses expose only opaque pair ids, sides A/B and output text;
|
|
240
|
+
run ids, usage ids and current/draft identities are revealed only after judgement.
|
|
241
|
+
`results()` returns an empty array until every completed pair has been judged:
|
|
242
|
+
per-variant token totals could otherwise reveal identity from output length.
|
|
243
|
+
After judging it reports wins, judged-pair count, win rate, summed usage duration,
|
|
244
|
+
tokens and estimated USD cost per variant, with an explicit uncosted-call count.
|
|
245
|
+
Ties count as judged pairs and award neither variant a win. Promotion requires
|
|
246
|
+
a strict winner by wins and can target the app or the experiment's tenant.
|
|
247
|
+
|
|
248
|
+
Judging uses core's current `recordAiEvaluation` API (the successor to
|
|
249
|
+
`recordAiUsageOutcome`), targeting each exact run with the metric
|
|
250
|
+
`prompt-arena.preference`. Both evaluations commit on the same transaction
|
|
251
|
+
executor. Duplicate/concurrent votes replay the first decision; conflicting
|
|
252
|
+
votes return 409. A failed second write rolls back the first and permits retry.
|
|
253
|
+
The service requires a **root connection outside caller-owned transactions**.
|
|
254
|
+
It refuses SDK transaction handles, registered transaction handles and active
|
|
255
|
+
framework transactions that share an embedded root connection. Hosts using
|
|
256
|
+
opaque transaction wrappers must never supply those wrappers to the arena.
|
|
257
|
+
|
|
258
|
+
Experiments, outputs, metrics snapshots and idempotency are **process-local**.
|
|
259
|
+
Restarting the host loses them; persisted usage/evaluations remain. This first
|
|
260
|
+
release is a single-process developer tool: it provides no shared sessions,
|
|
261
|
+
retention policy or cross-worker routing. Hosts should restrict fixture size and
|
|
262
|
+
restart/discard the service when finished. Transcript replay, job runners,
|
|
263
|
+
model-setting variants and more than two variants are deferred.
|
|
264
|
+
|
|
265
|
+
## Matching REST, MCP and UI adapters
|
|
266
|
+
|
|
267
|
+
`createPromptArenaTransports()` exports real host-mountable Request handlers and
|
|
268
|
+
MCP registrations over one typed operation dispatcher. The
|
|
269
|
+
[server integration example](examples/arena-host.ts) returns `{ api, registerMcp }`.
|
|
270
|
+
Mount the six handlers at host-owned routes, for example:
|
|
271
|
+
|
|
272
|
+
| Handler | Method and example route | Parameters |
|
|
273
|
+
|---|---|---|
|
|
274
|
+
| `api.list` | `GET /api/prompt-arena/list` | none |
|
|
275
|
+
| `api.execute` | `POST /api/prompt-arena/execute` | JSON `{ key, draft, inputs }` |
|
|
276
|
+
| `api.read` | `GET /api/prompt-arena/read?id=...` | query `id` |
|
|
277
|
+
| `api.judge` | `POST /api/prompt-arena/judge` | JSON `{ id, pairId, decision: 'A' \| 'B' \| 'tie' }` |
|
|
278
|
+
| `api.results` | `GET /api/prompt-arena/results?id=...` | query `id` |
|
|
279
|
+
| `api.promote` | `POST /api/prompt-arena/promote` | JSON `{ id, scopeType: 'app' \| 'tenant' }` |
|
|
280
|
+
|
|
281
|
+
At host MCP startup call `registerMcp(mcpServer)` with core's `SmrtMCPServer`
|
|
282
|
+
(or an adapter implementing its existing `addTool(tool, handler)` interface).
|
|
283
|
+
It registers `prompt_arena_list`, `prompt_arena_execute`, `prompt_arena_read`,
|
|
284
|
+
`prompt_arena_judge`, `prompt_arena_results` and `prompt_arena_promote`, with the
|
|
285
|
+
same parameter schemas and the same service instance as REST. For a SvelteKit
|
|
286
|
+
route, exporting `const POST = ({ request }) => host.api.execute(request)`
|
|
287
|
+
mounts the execute adapter; GET handlers mount the same way. Neither surface
|
|
288
|
+
opens generated CRUD access to prompt-override authorization state.
|
|
289
|
+
|
|
290
|
+
The dispatcher obtains actor and tenant from `currentCaller()`, then invokes
|
|
291
|
+
its mandatory host-bound `assertOperationPermission()` before calling the arena
|
|
292
|
+
service. UI actions call the REST adapters; they share the exact same host
|
|
293
|
+
permission gate as MCP. For a host using `smrt-users`, bind its real operation
|
|
294
|
+
guard to the request-local authenticated session and permission catalog:
|
|
295
|
+
|
|
296
|
+
```typescript
|
|
297
|
+
import { assertOperationPermission } from '@happyvertical/smrt-users';
|
|
298
|
+
|
|
299
|
+
// Inside createArenaHost options. The host registers the prompt_arena actions
|
|
300
|
+
// in its permission catalog; smrt-users normalizes list/read to the read slug.
|
|
301
|
+
assertOperationPermission: ({ operation, caller }) =>
|
|
302
|
+
assertOperationPermission({
|
|
303
|
+
db,
|
|
304
|
+
collection: 'prompt_arena',
|
|
305
|
+
action: operation,
|
|
306
|
+
userId: caller.actorId,
|
|
307
|
+
tenantId: caller.tenantId,
|
|
308
|
+
catalog: hostPermissionCatalog,
|
|
309
|
+
permissionSet: currentSession().permissions,
|
|
310
|
+
allowSystemContextBypass: false,
|
|
311
|
+
allowSuperAdminBypass: false,
|
|
312
|
+
}),
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
The host owns authentication, tenant context, route URLs, CSRF protection and
|
|
316
|
+
MCP session setup. Operation parameters cannot supply actor/tenant/provider
|
|
317
|
+
configuration: unknown properties, invalid enums and malformed input fail
|
|
318
|
+
closed. Request bodies are bounded; REST responses use `Cache-Control: no-store`.
|
|
319
|
+
The original arena authorizer and the independent override-write authorizer
|
|
320
|
+
remain mandatory. The judgement operation returns only the updated experiment;
|
|
321
|
+
fetching its scoreboard invokes the separate results permission.
|
|
322
|
+
|
|
323
|
+
The optional `PromptArenaPanel` from `@happyvertical/smrt-prompts/svelte` stays
|
|
324
|
+
presentational. The [browser integration example](examples/arena-ui.svelte)
|
|
325
|
+
shows callbacks using `fetch()` against the six REST adapters: execute posts an
|
|
326
|
+
experiment, judge posts the decision then gets results, and promote posts the
|
|
327
|
+
winning scope. `runners` comes from the list API via an authenticated host load.
|
|
328
|
+
Pass a stable user/tenant `contextKey` so the panel clears old drafts and results
|
|
329
|
+
and ignores responses from the previous context. The host chooses promotion
|
|
330
|
+
buttons; server authorization applies independently to every surface.
|
|
331
|
+
The panel reads `prompts.arena.*` messages from the host's i18n context
|
|
332
|
+
and falls back to its registered English defaults. Use
|
|
333
|
+
`@happyvertical/smrt-prompts/i18n/catalog` to include these messages in the
|
|
334
|
+
host's application catalog.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.generated.d.ts","sourceRoot":"","sources":["../../src/i18n/catalog.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,eAAO,MAAM,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"catalog.generated.d.ts","sourceRoot":"","sources":["../../src/i18n/catalog.generated.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACrF,eAAO,MAAM,cAAc,EAAE,yBA8K5B,CAAC"}
|
package/dist/i18n/catalog.js
CHANGED
|
@@ -1,7 +1,178 @@
|
|
|
1
1
|
//#region src/i18n/catalog.generated.ts
|
|
2
2
|
var messageCatalog = {
|
|
3
3
|
packageName: "@happyvertical/smrt-prompts",
|
|
4
|
-
messages: [
|
|
4
|
+
messages: [
|
|
5
|
+
{
|
|
6
|
+
key: "prompts.arena.ad_hoc_json",
|
|
7
|
+
locale: "en",
|
|
8
|
+
template: "Ad hoc JSON"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
key: "prompts.arena.alternative_template",
|
|
12
|
+
locale: "en",
|
|
13
|
+
template: "Alternative template"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
key: "prompts.arena.application_input",
|
|
17
|
+
locale: "en",
|
|
18
|
+
template: "Application input"
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
key: "prompts.arena.application_input_json",
|
|
22
|
+
locale: "en",
|
|
23
|
+
template: "Application input (JSON)"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
key: "prompts.arena.choose_prompt",
|
|
27
|
+
locale: "en",
|
|
28
|
+
template: "Choose a prompt"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
key: "prompts.arena.cost",
|
|
32
|
+
locale: "en",
|
|
33
|
+
template: "Cost (USD)"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
key: "prompts.arena.current_variant",
|
|
37
|
+
locale: "en",
|
|
38
|
+
template: "current"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
key: "prompts.arena.draft_variant",
|
|
42
|
+
locale: "en",
|
|
43
|
+
template: "draft"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
key: "prompts.arena.empty",
|
|
47
|
+
locale: "en",
|
|
48
|
+
template: "No runnable prompts are available."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
key: "prompts.arena.execution_failed",
|
|
52
|
+
locale: "en",
|
|
53
|
+
template: "Execution failed. This pair cannot be judged."
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
key: "prompts.arena.heading",
|
|
57
|
+
locale: "en",
|
|
58
|
+
template: "Prompt arena"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
key: "prompts.arena.input",
|
|
62
|
+
locale: "en",
|
|
63
|
+
template: "Input"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
key: "prompts.arena.judge_outputs",
|
|
67
|
+
locale: "en",
|
|
68
|
+
template: "Judge outputs"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
key: "prompts.arena.judgement",
|
|
72
|
+
locale: "en",
|
|
73
|
+
template: "Judgement: {decision}"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
key: "prompts.arena.latency",
|
|
77
|
+
locale: "en",
|
|
78
|
+
template: "Latency (ms)"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
key: "prompts.arena.output",
|
|
82
|
+
locale: "en",
|
|
83
|
+
template: "Output {side}"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
key: "prompts.arena.output_comparison",
|
|
87
|
+
locale: "en",
|
|
88
|
+
template: "Output comparison"
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
key: "prompts.arena.prefer",
|
|
92
|
+
locale: "en",
|
|
93
|
+
template: "Prefer {side}"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
key: "prompts.arena.promote_app",
|
|
97
|
+
locale: "en",
|
|
98
|
+
template: "Promote winner to app"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
key: "prompts.arena.promote_tenant",
|
|
102
|
+
locale: "en",
|
|
103
|
+
template: "Promote winner to tenant"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
key: "prompts.arena.promoted_app",
|
|
107
|
+
locale: "en",
|
|
108
|
+
template: "Winning template promoted to app scope."
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
key: "prompts.arena.promoted_tenant",
|
|
112
|
+
locale: "en",
|
|
113
|
+
template: "Winning template promoted to tenant scope."
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
key: "prompts.arena.prompt",
|
|
117
|
+
locale: "en",
|
|
118
|
+
template: "Prompt"
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
key: "prompts.arena.request_failed",
|
|
122
|
+
locale: "en",
|
|
123
|
+
template: "Arena request failed"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
key: "prompts.arena.run",
|
|
127
|
+
locale: "en",
|
|
128
|
+
template: "Run comparison"
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
key: "prompts.arena.scoreboard",
|
|
132
|
+
locale: "en",
|
|
133
|
+
template: "Experiment scoreboard"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
key: "prompts.arena.tie",
|
|
137
|
+
locale: "en",
|
|
138
|
+
template: "Tie"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
key: "prompts.arena.tie_result",
|
|
142
|
+
locale: "en",
|
|
143
|
+
template: "tie"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
key: "prompts.arena.tokens",
|
|
147
|
+
locale: "en",
|
|
148
|
+
template: "Tokens"
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
key: "prompts.arena.uncosted",
|
|
152
|
+
locale: "en",
|
|
153
|
+
template: " ({calls} uncosted)"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
key: "prompts.arena.variant",
|
|
157
|
+
locale: "en",
|
|
158
|
+
template: "Variant"
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
key: "prompts.arena.win_rate",
|
|
162
|
+
locale: "en",
|
|
163
|
+
template: "Win rate"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
key: "prompts.arena.wins_judged",
|
|
167
|
+
locale: "en",
|
|
168
|
+
template: "Wins / judged"
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
key: "prompts.arena.working",
|
|
172
|
+
locale: "en",
|
|
173
|
+
template: "Working…"
|
|
174
|
+
}
|
|
175
|
+
]
|
|
5
176
|
};
|
|
6
177
|
//#endregion
|
|
7
178
|
export { messageCatalog };
|
package/dist/i18n/catalog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","names":[],"sources":["../../src/i18n/catalog.generated.ts"],"sourcesContent":["// Generated by scripts/generate-message-catalogs.mjs. Do not edit.\nimport type { ApplicationMessageCatalog } from '@happyvertical/smrt-ui/i18n/catalog';\nexport const messageCatalog: ApplicationMessageCatalog = {\n packageName: '@happyvertical/smrt-prompts',\n messages: [],\n};\n"],"mappings":";AAEO,IAAM,iBAA4C;CACvD,aAAa;CACb,UAAU,
|
|
1
|
+
{"version":3,"file":"catalog.js","names":[],"sources":["../../src/i18n/catalog.generated.ts"],"sourcesContent":["// Generated by scripts/generate-message-catalogs.mjs. Do not edit.\nimport type { ApplicationMessageCatalog } from '@happyvertical/smrt-ui/i18n/catalog';\nexport const messageCatalog: ApplicationMessageCatalog = {\n packageName: '@happyvertical/smrt-prompts',\n messages: [\n {\n key: 'prompts.arena.ad_hoc_json',\n locale: 'en',\n template: 'Ad hoc JSON',\n },\n {\n key: 'prompts.arena.alternative_template',\n locale: 'en',\n template: 'Alternative template',\n },\n {\n key: 'prompts.arena.application_input',\n locale: 'en',\n template: 'Application input',\n },\n {\n key: 'prompts.arena.application_input_json',\n locale: 'en',\n template: 'Application input (JSON)',\n },\n {\n key: 'prompts.arena.choose_prompt',\n locale: 'en',\n template: 'Choose a prompt',\n },\n {\n key: 'prompts.arena.cost',\n locale: 'en',\n template: 'Cost (USD)',\n },\n {\n key: 'prompts.arena.current_variant',\n locale: 'en',\n template: 'current',\n },\n {\n key: 'prompts.arena.draft_variant',\n locale: 'en',\n template: 'draft',\n },\n {\n key: 'prompts.arena.empty',\n locale: 'en',\n template: 'No runnable prompts are available.',\n },\n {\n key: 'prompts.arena.execution_failed',\n locale: 'en',\n template: 'Execution failed. This pair cannot be judged.',\n },\n {\n key: 'prompts.arena.heading',\n locale: 'en',\n template: 'Prompt arena',\n },\n {\n key: 'prompts.arena.input',\n locale: 'en',\n template: 'Input',\n },\n {\n key: 'prompts.arena.judge_outputs',\n locale: 'en',\n template: 'Judge outputs',\n },\n {\n key: 'prompts.arena.judgement',\n locale: 'en',\n template: 'Judgement: {decision}',\n },\n {\n key: 'prompts.arena.latency',\n locale: 'en',\n template: 'Latency (ms)',\n },\n {\n key: 'prompts.arena.output',\n locale: 'en',\n template: 'Output {side}',\n },\n {\n key: 'prompts.arena.output_comparison',\n locale: 'en',\n template: 'Output comparison',\n },\n {\n key: 'prompts.arena.prefer',\n locale: 'en',\n template: 'Prefer {side}',\n },\n {\n key: 'prompts.arena.promote_app',\n locale: 'en',\n template: 'Promote winner to app',\n },\n {\n key: 'prompts.arena.promote_tenant',\n locale: 'en',\n template: 'Promote winner to tenant',\n },\n {\n key: 'prompts.arena.promoted_app',\n locale: 'en',\n template: 'Winning template promoted to app scope.',\n },\n {\n key: 'prompts.arena.promoted_tenant',\n locale: 'en',\n template: 'Winning template promoted to tenant scope.',\n },\n {\n key: 'prompts.arena.prompt',\n locale: 'en',\n template: 'Prompt',\n },\n {\n key: 'prompts.arena.request_failed',\n locale: 'en',\n template: 'Arena request failed',\n },\n {\n key: 'prompts.arena.run',\n locale: 'en',\n template: 'Run comparison',\n },\n {\n key: 'prompts.arena.scoreboard',\n locale: 'en',\n template: 'Experiment scoreboard',\n },\n {\n key: 'prompts.arena.tie',\n locale: 'en',\n template: 'Tie',\n },\n {\n key: 'prompts.arena.tie_result',\n locale: 'en',\n template: 'tie',\n },\n {\n key: 'prompts.arena.tokens',\n locale: 'en',\n template: 'Tokens',\n },\n {\n key: 'prompts.arena.uncosted',\n locale: 'en',\n template: ' ({calls} uncosted)',\n },\n {\n key: 'prompts.arena.variant',\n locale: 'en',\n template: 'Variant',\n },\n {\n key: 'prompts.arena.win_rate',\n locale: 'en',\n template: 'Win rate',\n },\n {\n key: 'prompts.arena.wins_judged',\n locale: 'en',\n template: 'Wins / judged',\n },\n {\n key: 'prompts.arena.working',\n locale: 'en',\n template: 'Working…',\n },\n ],\n};\n"],"mappings":";AAEO,IAAM,iBAA4C;CACvD,aAAa;CACb,UAAU;EACR;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;EACA;GACE,KAAK;GACL,QAAQ;GACR,UAAU;EACZ;CACF;AACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ import './__smrt-register__.js';
|
|
|
10
10
|
export { clearPromptCache, getPromptCacheTtlMs } from './cache.js';
|
|
11
11
|
export { PromptOverrideCollection } from './collections/PromptOverrideCollection.js';
|
|
12
12
|
export { PromptOverride, type PromptOverrideOptions, } from './models/PromptOverride.js';
|
|
13
|
+
export * from './prompt-arena.js';
|
|
14
|
+
export * from './prompt-arena-transports.js';
|
|
13
15
|
export { InvalidPromptScopeError, PromptOverrideAuthorizationError, type PromptOverrideAuthorizer, PromptOverrideService, type PromptOverrideWriteRequest, } from './prompt-override-service.js';
|
|
14
16
|
export { definePrompt, PromptRegistry } from './prompt-registry.js';
|
|
15
17
|
export { resolvePrompt, withPromptOverrides } from './prompt-resolver.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EACL,KAAK,yBAAyB,EAC9B,2BAA2B,EAC3B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,gBAAgB;AAChB,eAAO,MAAM,2BAA2B,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,KAAK,wBAAwB,EAC7B,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC1E,OAAO,EACL,KAAK,yBAAyB,EAC9B,2BAA2B,EAC3B,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,wBAAwB,EAC7B,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,YAAY,EACV,kBAAkB,EAClB,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,uBAAuB,EACvB,mBAAmB,EACnB,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,yBAAyB,EAC9B,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,YAAY,CAAC;AAEpB,gBAAgB;AAChB,eAAO,MAAM,2BAA2B,OAAO,CAAC"}
|