jev-recipes 0.9.0 → 0.9.2

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # jev-recipes
2
2
 
3
- **Small, readable decisions for Jev and compatible System One APIs.**
3
+ **Typed AI decisions for agents, RAG, and support flows: route, rerank, gate, grade, compare, and label text with one function call. Plug into Vercel AI SDK or LangChain, or call any recipe directly.**
4
4
 
5
5
  [![npm version](https://img.shields.io/npm/v/jev-recipes)](https://www.npmjs.com/package/jev-recipes)
6
6
  [![CI](https://github.com/agencyenterprise/jev-recipes/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/agencyenterprise/jev-recipes/actions/workflows/ci.yml)
@@ -31,6 +31,10 @@ For example, give `route` a support message and descriptions of your teams. It r
31
31
 
32
32
  Evaluate your own cases with the [installed evaluator](https://github.com/agencyenterprise/jev-recipes/blob/main/docs/evaluation.md), retain model responses, and replay confidence policies offline. The [agent workflow](https://github.com/agencyenterprise/jev-recipes/blob/main/examples/agent-loop/README.md) and [customer queue](https://github.com/agencyenterprise/jev-recipes/blob/main/examples/customer-queue/README.md) show how decisions fit into application code. [Direct and Gateway integrations](https://github.com/agencyenterprise/jev-recipes/blob/main/docs/integrations.md) use the same recipe interface.
33
33
 
34
+ ## Watch Jev play checkers against Jev using the checkers-move recipe
35
+
36
+ [![Jev plays checkers against Jev using the checkers-move recipe](https://raw.githubusercontent.com/agencyenterprise/jev-recipes/main/examples/checkers/jev-vs-jev.gif)](https://www.youtube.com/shorts/Z282rGKysTg)
37
+
34
38
  ## Build a complete support flow
35
39
 
36
40
  The [support conversation starter](https://github.com/agencyenterprise/jev-recipes/blob/main/examples/support-routing/README.md) checks for missing details, asks a configured question, and resumes with the customer's answer. It proposes a queue or requests human review when the conversation remains unresolved.
@@ -55,10 +59,6 @@ Build the searchable static catalog with `npm run site:build`, then preview it w
55
59
 
56
60
  This is a maintainer-built application, not an independent customer adoption claim or a recipe accuracy benchmark.
57
61
 
58
- ## Watch Jev play checkers against Jev using the checkers-move recipe
59
-
60
- [![Jev plays checkers against Jev using the checkers-move recipe](https://raw.githubusercontent.com/agencyenterprise/jev-recipes/main/examples/checkers/jev-vs-jev.gif)](https://www.youtube.com/shorts/Z282rGKysTg)
61
-
62
62
  ## Use a recipe
63
63
 
64
64
  Requires **Node.js 22.9 or newer**, ES modules, and a **[TypeSafe API key](https://console.typesafe.ai/keys)**. Live calls send the supplied input to TypeSafe and use API quota.
@@ -204,6 +204,8 @@ npx jev-recipes run route input.json
204
204
 
205
205
  Read `result.status` and `result.route` in the JSON output. Substitute another recipe's name in both commands to use a different decision. Run `npx jev-recipes --help` for all commands.
206
206
 
207
+ `run` accepts UTF-8 JSON files and stdin, with or without a byte-order mark (BOM), and UTF-16 files or stdin with a BOM. Non-English text and route names are preserved; no file conversion is needed for these encodings.
208
+
207
209
  The CLI reads environment variables; it does not automatically load `.env`. Errors go to stderr with exit code `1`. A review outcome is a completed evaluation, so inspect the result before acting.
208
210
 
209
211
  <a id="understand-the-result"></a>
package/dist/cli/index.js CHANGED
@@ -106,23 +106,46 @@ async function runLiveRecipe(name, source) {
106
106
  name +
107
107
  ' without a key.');
108
108
  }
109
- const inputJson = source === '-' ? await readStandardInput() : await readFile(source, 'utf8');
109
+ const input = await readJsonInput(source);
110
110
  const run = await loadRecipe(name);
111
- const result = await run(JSON.parse(inputJson));
111
+ const result = await run(input);
112
112
  printJson({ mode: 'live', result });
113
113
  }
114
+ async function readJsonInput(source) {
115
+ const inputBytes = source === '-' ? await readStandardInput() : await readFile(source);
116
+ const inputText = decodeInputText(inputBytes);
117
+ return JSON.parse(inputText);
118
+ }
119
+ async function readStandardInput() {
120
+ const chunks = [];
121
+ for await (const chunk of stdin)
122
+ chunks.push(chunk);
123
+ return Buffer.concat(chunks);
124
+ }
125
+ function decodeInputText(bytes) {
126
+ const encoding = detectInputEncoding(bytes);
127
+ try {
128
+ return new TextDecoder(encoding, { fatal: true }).decode(bytes);
129
+ }
130
+ catch {
131
+ throw new Error('Input must be UTF-8 or UTF-16 with a byte-order mark.');
132
+ }
133
+ }
134
+ function detectInputEncoding(bytes) {
135
+ const byteOrderMark = bytes.subarray(0, 2);
136
+ const utf16LittleEndianMark = Buffer.from([0xff, 0xfe]);
137
+ const utf16BigEndianMark = Buffer.from([0xfe, 0xff]);
138
+ if (byteOrderMark.equals(utf16LittleEndianMark))
139
+ return 'utf-16le';
140
+ if (byteOrderMark.equals(utf16BigEndianMark))
141
+ return 'utf-16be';
142
+ return 'utf-8';
143
+ }
114
144
  async function readDemoFixture(name) {
115
145
  const fixturePath = new URL(`../recipes/${name}/demo.json`, import.meta.url);
116
146
  const fixtureJson = await readFile(fixturePath, 'utf8');
117
147
  return demoFixtureSchema.parse(JSON.parse(fixtureJson));
118
148
  }
119
- async function readStandardInput() {
120
- stdin.setEncoding('utf8');
121
- let input = '';
122
- for await (const chunk of stdin)
123
- input += chunk;
124
- return input;
125
- }
126
149
  function printJson(value) {
127
150
  stdout.write(`${JSON.stringify(value, null, 2)}\n`);
128
151
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "jev-recipes",
3
- "version": "0.9.0",
4
- "description": "Small, composable Jev decisions for retrieval, conversations, and agent workflows.",
3
+ "version": "0.9.2",
4
+ "description": "248 small Jev decisions for JavaScript and TypeScript: route, rerank, gate, grade, compare, and label text for agents, RAG, support, code review, and music. Each returns a typed result with explicit uncertainty. Plug into Vercel AI SDK or LangChain agents, import one recipe, or run the CLI with JSON from any language.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -1106,19 +1106,25 @@
1106
1106
  "vite": "6.4.3",
1107
1107
  "vitest": "4.1.11"
1108
1108
  },
1109
- "homepage": "https://github.com/agencyenterprise/jev-recipes#readme",
1109
+ "homepage": "https://jev-recipes.com",
1110
1110
  "bugs": {
1111
1111
  "url": "https://github.com/agencyenterprise/jev-recipes/issues"
1112
1112
  },
1113
1113
  "keywords": [
1114
1114
  "jev",
1115
1115
  "typesafe",
1116
- "recipes",
1117
- "ai",
1116
+ "ai-agents",
1117
+ "agents",
1118
+ "llm",
1119
+ "ai-sdk",
1120
+ "vercel-ai-sdk",
1121
+ "langchain",
1122
+ "guardrails",
1123
+ "tool-calling",
1118
1124
  "routing",
1119
1125
  "reranking",
1120
1126
  "rag",
1121
- "evidence",
1127
+ "classification",
1122
1128
  "typescript",
1123
1129
  "cli"
1124
1130
  ],