jev-recipes 0.5.2 → 0.5.3

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
@@ -11,7 +11,7 @@
11
11
 
12
12
  <!-- BEGIN GENERATED: summary -->
13
13
 
14
- 87 focused recipes for JavaScript and TypeScript. Route messages, check evidence, and label model responses with a function call.
14
+ 88 focused recipes for JavaScript and TypeScript. Route messages, check evidence, and label model responses with a function call.
15
15
 
16
16
  <!-- END GENERATED: summary -->
17
17
 
@@ -138,7 +138,7 @@ npx jev-recipes demo answerability
138
138
 
139
139
  [Browse the complete catalog](https://github.com/agencyenterprise/jev-recipes/blob/main/recipes/README.md). Each guide includes an import, input reference, result behavior, limitations, and related recipes.
140
140
 
141
- For games, the [gameplay guide](https://github.com/agencyenterprise/jev-recipes/blob/main/docs/gameplay.md) starts with a checkers decision using just the board, player, and legal moves. It also covers general action selection and narrative turn eligibility.
141
+ For games, use [game-action](https://github.com/agencyenterprise/jev-recipes/blob/main/recipes/game-action/README.md) with your existing JSON state and actions. It returns the original selected action, preserving your game IDs. [checkers-move](https://github.com/agencyenterprise/jev-recipes/blob/main/recipes/checkers-move/README.md) accepts a structured checkers board and legal moves; the [checkers example](https://github.com/agencyenterprise/jev-recipes/blob/main/examples/checkers/README.md) shows how to run its visual demo locally.
142
142
 
143
143
  For psychology, browse [Psychology & behavior](https://github.com/agencyenterprise/jev-recipes/blob/main/recipes/README.md#psychology--behavior) for gain/loss framing, causal explanations, stated motivation, and related wording annotations. Search with `npx jev-recipes list psychology`.
144
144
 
@@ -185,7 +185,7 @@ The [CI workflow](https://github.com/agencyenterprise/jev-recipes/actions/workfl
185
185
  - **Recipe checks:** validate software behavior using mocked responses, including invalid inputs, confidence boundaries, and malformed answers.
186
186
  - **Model evaluation:** offline tests and demos do not measure Jev's accuracy. Evaluate recipes on your own data for your intended use.
187
187
 
188
- The package contains compiled code, type declarations, catalog data, and offline demo assets. Tests, build tools, and source guides stay out of the npm archive. [Publishing details](https://github.com/agencyenterprise/jev-recipes/blob/main/RELEASING.md).
188
+ The package contains compiled code, type declarations, catalog data, and offline demo assets. Tests, build tools, and source guides stay out of the npm archive. [Publishing details](https://github.com/agencyenterprise/jev-recipes/blob/main/CONTRIBUTING.md#releasing).
189
189
 
190
190
  Direct imports such as `jev-recipes/route` load the selected recipe and its dependencies. Installation downloads one package; it does not selectively download individual recipes.
191
191
 
@@ -193,7 +193,7 @@ Direct imports such as `jev-recipes/route` load the selected recipe and its depe
193
193
 
194
194
  Recipes can serve as candidate annotation tools in controlled experiments. `claim-stance` labels expressed agreement, `verify` checks supplied evidence, and `draft-compare` compares responses under a rubric.
195
195
 
196
- The [research guide](https://github.com/agencyenterprise/jev-recipes/blob/main/docs/ai-alignment-research.md) outlines a controlled agreement study and validation against human annotations. These labels describe observable outputs; they do not establish internal motives or prove that a model is aligned.
196
+ The [research guide](https://github.com/agencyenterprise/jev-recipes/blob/main/docs/ai-alignment-research.md) covers validation against human annotations, handling uncertainty, and recording reproducible results. These labels describe observable outputs; they do not establish internal motives or prove that a model is aligned.
197
197
 
198
198
  <a id="contribute"></a>
199
199
 
@@ -211,7 +211,7 @@ make ci
211
211
 
212
212
  The recipe folder owns its implementation, schemas, metadata, demo, and guide. Exports and catalog entries are generated from those folders. Tests live under `tests/recipe/`.
213
213
 
214
- [Contributing guide](https://github.com/agencyenterprise/jev-recipes/blob/main/CONTRIBUTING.md) | [Roadmap](https://github.com/agencyenterprise/jev-recipes/blob/main/RECIPE_ROADMAP.md) | [Changelog](https://github.com/agencyenterprise/jev-recipes/blob/main/CHANGELOG.md)
214
+ [Contributing guide](https://github.com/agencyenterprise/jev-recipes/blob/main/CONTRIBUTING.md)
215
215
 
216
216
  ## License
217
217
 
@@ -33,7 +33,6 @@
33
33
  },
34
34
  "legalMoves": {
35
35
  "minItems": 1,
36
- "maxItems": 50,
37
36
  "type": "array",
38
37
  "items": {
39
38
  "type": "object",
@@ -72,7 +71,7 @@
72
71
  "required": ["id", "from", "path"],
73
72
  "additionalProperties": false
74
73
  },
75
- "description": "One to fifty complete legal moves from your game, with unique IDs."
74
+ "description": "One or more complete legal moves from your game, with unique IDs."
76
75
  },
77
76
  "minConfidence": { "type": "number", "minimum": 0, "maximum": 1 }
78
77
  },
@@ -21,14 +21,13 @@
21
21
  },
22
22
  "actions": {
23
23
  "minItems": 1,
24
- "maxItems": 50,
25
24
  "type": "array",
26
25
  "items": {
27
26
  "type": "object",
28
27
  "properties": { "id": { "type": "string" }, "text": { "type": "string" } },
29
28
  "required": ["id", "text"]
30
29
  },
31
- "description": "One to fifty candidate actions with unique IDs and concrete action descriptions."
30
+ "description": "One or more candidate actions with unique IDs and concrete action descriptions."
32
31
  },
33
32
  "history": {
34
33
  "maxItems": 100,
@@ -0,0 +1,161 @@
1
+ {
2
+ "inputSchema": {
3
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
4
+ "type": "object",
5
+ "properties": {
6
+ "gameState": {
7
+ "description": "The current game information available for this decision.",
8
+ "$ref": "#/$defs/__schema0"
9
+ },
10
+ "playerState": {
11
+ "description": "Information about the player making this decision.",
12
+ "$ref": "#/$defs/__schema1"
13
+ },
14
+ "legalActions": {
15
+ "type": "array",
16
+ "items": { "$ref": "#/$defs/__schema2" },
17
+ "description": "The available actions the player can choose from."
18
+ },
19
+ "rules": {
20
+ "description": "Game rules and explanations of game-specific information.",
21
+ "$ref": "#/$defs/__schema3"
22
+ },
23
+ "objective": {
24
+ "description": "What the player is trying to accomplish.",
25
+ "$ref": "#/$defs/__schema4"
26
+ }
27
+ },
28
+ "required": ["gameState", "playerState", "legalActions"],
29
+ "$defs": {
30
+ "__schema0": {
31
+ "anyOf": [
32
+ { "type": "string" },
33
+ { "type": "number" },
34
+ { "type": "boolean" },
35
+ { "type": "null" },
36
+ { "type": "array", "items": { "$ref": "#/$defs/__schema0" } },
37
+ {
38
+ "type": "object",
39
+ "propertyNames": { "type": "string" },
40
+ "additionalProperties": { "$ref": "#/$defs/__schema0" }
41
+ }
42
+ ]
43
+ },
44
+ "__schema1": {
45
+ "anyOf": [
46
+ { "type": "string" },
47
+ { "type": "number" },
48
+ { "type": "boolean" },
49
+ { "type": "null" },
50
+ { "type": "array", "items": { "$ref": "#/$defs/__schema1" } },
51
+ {
52
+ "type": "object",
53
+ "propertyNames": { "type": "string" },
54
+ "additionalProperties": { "$ref": "#/$defs/__schema1" }
55
+ }
56
+ ]
57
+ },
58
+ "__schema2": {
59
+ "anyOf": [
60
+ { "type": "string" },
61
+ { "type": "number" },
62
+ { "type": "boolean" },
63
+ { "type": "null" },
64
+ { "type": "array", "items": { "$ref": "#/$defs/__schema2" } },
65
+ {
66
+ "type": "object",
67
+ "propertyNames": { "type": "string" },
68
+ "additionalProperties": { "$ref": "#/$defs/__schema2" }
69
+ }
70
+ ]
71
+ },
72
+ "__schema3": {
73
+ "anyOf": [
74
+ { "type": "string" },
75
+ { "type": "number" },
76
+ { "type": "boolean" },
77
+ { "type": "null" },
78
+ { "type": "array", "items": { "$ref": "#/$defs/__schema3" } },
79
+ {
80
+ "type": "object",
81
+ "propertyNames": { "type": "string" },
82
+ "additionalProperties": { "$ref": "#/$defs/__schema3" }
83
+ }
84
+ ]
85
+ },
86
+ "__schema4": {
87
+ "anyOf": [
88
+ { "type": "string" },
89
+ { "type": "number" },
90
+ { "type": "boolean" },
91
+ { "type": "null" },
92
+ { "type": "array", "items": { "$ref": "#/$defs/__schema4" } },
93
+ {
94
+ "type": "object",
95
+ "propertyNames": { "type": "string" },
96
+ "additionalProperties": { "$ref": "#/$defs/__schema4" }
97
+ }
98
+ ]
99
+ }
100
+ }
101
+ },
102
+ "resultSchema": {
103
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
104
+ "anyOf": [
105
+ {
106
+ "type": "object",
107
+ "properties": {
108
+ "model": { "type": "string" },
109
+ "usage": {
110
+ "type": "object",
111
+ "properties": {
112
+ "input_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
113
+ "output_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
114
+ },
115
+ "required": ["input_tokens", "output_tokens"],
116
+ "additionalProperties": false
117
+ },
118
+ "selection": {
119
+ "type": "string",
120
+ "description": "The internal Choice label associated with the selected action."
121
+ },
122
+ "action": {
123
+ "description": "The original selected action, preserving any existing game ID.",
124
+ "$ref": "#/$defs/__schema0"
125
+ },
126
+ "confidence": {
127
+ "type": "number",
128
+ "minimum": 0,
129
+ "maximum": 1,
130
+ "description": "The confidence returned by Jev."
131
+ },
132
+ "probabilities": {
133
+ "type": "object",
134
+ "propertyNames": { "type": "string" },
135
+ "additionalProperties": { "type": "number", "minimum": 0, "maximum": 1 },
136
+ "description": "Jev's probabilities, keyed by internal Choice label."
137
+ }
138
+ },
139
+ "required": ["model", "usage", "selection", "action", "confidence", "probabilities"],
140
+ "additionalProperties": false
141
+ },
142
+ { "type": "null" }
143
+ ],
144
+ "$defs": {
145
+ "__schema0": {
146
+ "anyOf": [
147
+ { "type": "string" },
148
+ { "type": "number" },
149
+ { "type": "boolean" },
150
+ { "type": "null" },
151
+ { "type": "array", "items": { "$ref": "#/$defs/__schema0" } },
152
+ {
153
+ "type": "object",
154
+ "propertyNames": { "type": "string" },
155
+ "additionalProperties": { "$ref": "#/$defs/__schema0" }
156
+ }
157
+ ]
158
+ }
159
+ }
160
+ }
161
+ }
@@ -37,6 +37,7 @@ export const recipeLoaders = {
37
37
  'followup-link': () => import('../../recipes/followup-link/index.js').then((recipe) => (input, options) => recipe.followupLink(recipe.followupLinkInputSchema.parse(input), options)),
38
38
  'freshness-needed': () => import('../../recipes/freshness-needed/index.js').then((recipe) => (input, options) => recipe.freshnessNeeded(recipe.freshnessNeededInputSchema.parse(input), options)),
39
39
  'frustration-signal': () => import('../../recipes/frustration-signal/index.js').then((recipe) => (input, options) => recipe.frustrationSignal(recipe.frustrationSignalInputSchema.parse(input), options)),
40
+ 'game-action': () => import('../../recipes/game-action/index.js').then((recipe) => (input, options) => recipe.gameAction(recipe.gameActionInputSchema.parse(input), options)),
40
41
  handoff: () => import('../../recipes/handoff/index.js').then((recipe) => (input, options) => recipe.handoff(recipe.handoffInputSchema.parse(input), options)),
41
42
  'incident-match': () => import('../../recipes/incident-match/index.js').then((recipe) => (input, options) => recipe.incidentMatch(recipe.incidentMatchInputSchema.parse(input), options)),
42
43
  'instruction-conflict': () => import('../../recipes/instruction-conflict/index.js').then((recipe) => (input, options) => recipe.instructionConflict(recipe.instructionConflictInputSchema.parse(input), options)),
@@ -784,6 +784,29 @@ export const recipeMetadata = [
784
784
  },
785
785
  ],
786
786
  },
787
+ {
788
+ id: 'game-action',
789
+ title: 'Choose a game action from JSON',
790
+ description: 'Send game state, player state, and available actions as JSON; receive the original selected action with Jev confidence and probabilities.',
791
+ category: 'workflow',
792
+ tags: ['gameplay', 'game', 'agnostic', 'JSON', 'actions', 'automatic IDs', 'simulation'],
793
+ limitations: [
794
+ 'Confidence and probabilities describe the Jev decision, not a measured probability of winning.',
795
+ 'The full action list is sent in one logical request. Provider request limits still apply.',
796
+ 'Internal action labels belong to the current call; existing game IDs remain in the returned action.',
797
+ ],
798
+ useWhen: 'Your game already supplies JSON state and actions, and you want Jev to choose an action without formatting descriptions or assigning IDs.',
799
+ related: [
800
+ {
801
+ id: 'choose-action',
802
+ reason: 'Use choose-action for text-based rules and state, caller-named actions, and confidence-based review handling.',
803
+ },
804
+ {
805
+ id: 'checkers-move',
806
+ reason: 'Use checkers-move for its American/English checkers board format and built-in checkers instructions.',
807
+ },
808
+ ],
809
+ },
787
810
  {
788
811
  id: 'handoff',
789
812
  title: 'Check handoff rules',
@@ -1 +1 @@
1
- export declare const recipeNames: readonly ["action-scope", "answer-consistency", "answer-coverage", "answer-invalidation", "answer-relevance", "answerability", "argument-fit", "attempted-step", "attribution-match", "audience-fit", "cache-match", "cancellation-check", "causal-attribution", "certainty-match", "change-meaning", "checkers-move", "choose-action", "citation-match", "citation-needed", "claim-stance", "clarify", "confirmation-match", "constraint-strength", "context-role", "correction-target", "document-role", "draft-compare", "evaluation-mention", "evidence-conflict", "evidence-independence", "evidence-novelty", "fact-stability", "failure-kind", "feedback-kind", "field-select", "followup-link", "freshness-needed", "frustration-signal", "handoff", "incident-match", "instruction-conflict", "instruction-fit", "intent-change", "issue-impact", "issue-recurrence", "memory-relation", "memory-scope", "memory-subject", "memory-value", "motivation-source", "outcome-framing", "passage-duplicate", "preference-kind", "promise-check", "query-equivalence", "query-specificity", "question-assumption", "question-leading", "reference-resolve", "repeated-attempt", "reply-template-match", "requirement-testability", "rerank", "resolution-check", "response-needed", "response-refusal", "result-outcome", "result-usefulness", "retrieval-needed", "route", "source-applicability", "step-complete", "step-progress", "summary-coverage", "take-turn", "task-dependency", "task-duplicate", "ticket-match", "tone-check", "tool-fit", "topic-shift", "troubleshooting-fit", "turn-intent", "uncertainty-expression", "urgency-signal", "verify", "workaround-fit"];
1
+ export declare const recipeNames: readonly ["action-scope", "answer-consistency", "answer-coverage", "answer-invalidation", "answer-relevance", "answerability", "argument-fit", "attempted-step", "attribution-match", "audience-fit", "cache-match", "cancellation-check", "causal-attribution", "certainty-match", "change-meaning", "checkers-move", "choose-action", "citation-match", "citation-needed", "claim-stance", "clarify", "confirmation-match", "constraint-strength", "context-role", "correction-target", "document-role", "draft-compare", "evaluation-mention", "evidence-conflict", "evidence-independence", "evidence-novelty", "fact-stability", "failure-kind", "feedback-kind", "field-select", "followup-link", "freshness-needed", "frustration-signal", "game-action", "handoff", "incident-match", "instruction-conflict", "instruction-fit", "intent-change", "issue-impact", "issue-recurrence", "memory-relation", "memory-scope", "memory-subject", "memory-value", "motivation-source", "outcome-framing", "passage-duplicate", "preference-kind", "promise-check", "query-equivalence", "query-specificity", "question-assumption", "question-leading", "reference-resolve", "repeated-attempt", "reply-template-match", "requirement-testability", "rerank", "resolution-check", "response-needed", "response-refusal", "result-outcome", "result-usefulness", "retrieval-needed", "route", "source-applicability", "step-complete", "step-progress", "summary-coverage", "take-turn", "task-dependency", "task-duplicate", "ticket-match", "tone-check", "tool-fit", "topic-shift", "troubleshooting-fit", "turn-intent", "uncertainty-expression", "urgency-signal", "verify", "workaround-fit"];
@@ -38,6 +38,7 @@ export const recipeNames = [
38
38
  'followup-link',
39
39
  'freshness-needed',
40
40
  'frustration-signal',
41
+ 'game-action',
41
42
  'handoff',
42
43
  'incident-match',
43
44
  'instruction-conflict',
@@ -38,6 +38,7 @@ export declare const recipeNameSchema: z.ZodEnum<{
38
38
  "followup-link": "followup-link";
39
39
  "freshness-needed": "freshness-needed";
40
40
  "frustration-signal": "frustration-signal";
41
+ "game-action": "game-action";
41
42
  handoff: "handoff";
42
43
  "incident-match": "incident-match";
43
44
  "instruction-conflict": "instruction-conflict";
@@ -41,6 +41,7 @@ export declare const commandArgumentsSchema: z.ZodUnion<readonly [z.ZodTuple<[z.
41
41
  "followup-link": "followup-link";
42
42
  "freshness-needed": "freshness-needed";
43
43
  "frustration-signal": "frustration-signal";
44
+ "game-action": "game-action";
44
45
  handoff: "handoff";
45
46
  "incident-match": "incident-match";
46
47
  "instruction-conflict": "instruction-conflict";
@@ -132,6 +133,7 @@ export declare const commandArgumentsSchema: z.ZodUnion<readonly [z.ZodTuple<[z.
132
133
  "followup-link": "followup-link";
133
134
  "freshness-needed": "freshness-needed";
134
135
  "frustration-signal": "frustration-signal";
136
+ "game-action": "game-action";
135
137
  handoff: "handoff";
136
138
  "incident-match": "incident-match";
137
139
  "instruction-conflict": "instruction-conflict";
@@ -220,6 +222,7 @@ export declare const commandArgumentsSchema: z.ZodUnion<readonly [z.ZodTuple<[z.
220
222
  "followup-link": "followup-link";
221
223
  "freshness-needed": "freshness-needed";
222
224
  "frustration-signal": "frustration-signal";
225
+ "game-action": "game-action";
223
226
  handoff: "handoff";
224
227
  "incident-match": "incident-match";
225
228
  "instruction-conflict": "instruction-conflict";
@@ -43,9 +43,8 @@ export const checkersMoveInputSchema = z
43
43
  legalMoves: z
44
44
  .array(move)
45
45
  .min(1)
46
- .max(50)
47
46
  .refine((moves) => new Set(moves.map((value) => value.id)).size === moves.length, 'Move IDs must be unique.')
48
- .describe('One to fifty complete legal moves from your game, with unique IDs.'),
47
+ .describe('One or more complete legal moves from your game, with unique IDs.'),
49
48
  minConfidence: probability.optional(),
50
49
  })
51
50
  .superRefine((input, context) => {
@@ -1,11 +1,15 @@
1
1
  import { z } from 'zod';
2
- import { nonEmptyText, probability, selectionResultSchema, textItemsSchema, } from '../../src/schema.js';
2
+ import { nonEmptyText, probability, selectionResultSchema, textItemSchema, } from '../../src/schema.js';
3
3
  export const chooseActionInputSchema = z.object({
4
4
  player: nonEmptyText.describe('The player whose next action should be chosen.'),
5
5
  objective: nonEmptyText.describe('The goal or scoring preference used to compare eligible actions.'),
6
6
  rules: nonEmptyText.describe('Applicable game rules, including turn, phase, resource, and action constraints.'),
7
7
  environment: nonEmptyText.describe('The current game snapshot available to the player, after the supplied history.'),
8
- actions: textItemsSchema.describe('One to fifty candidate actions with unique IDs and concrete action descriptions.'),
8
+ actions: z
9
+ .array(textItemSchema)
10
+ .min(1)
11
+ .refine((actions) => new Set(actions.map((action) => action.id)).size === actions.length, 'Action IDs must be unique.')
12
+ .describe('One or more candidate actions with unique IDs and concrete action descriptions.'),
9
13
  history: z
10
14
  .array(z.object({
11
15
  player: nonEmptyText.describe('The player who took the recorded action.'),
@@ -0,0 +1,24 @@
1
+ {
2
+ "input": {
3
+ "gameState": { "actionsRemaining": 1, "opponentScore": 9 },
4
+ "playerState": { "id": "blue", "score": 8, "energy": 1 },
5
+ "legalActions": [
6
+ { "id": "collect-points", "command": "collect", "energyCost": 1, "points": 2 },
7
+ { "command": "rest", "energyGain": 1, "points": 0 }
8
+ ],
9
+ "rules": "The game ends after this action. Highest score wins; unused energy has no value.",
10
+ "objective": "Finish with more points than the opponent."
11
+ },
12
+ "response": {
13
+ "model": "demo-fixture",
14
+ "answers": {
15
+ "decision": {
16
+ "type": "choice",
17
+ "choice": "action_0",
18
+ "confidence": 0.9,
19
+ "probabilities": { "action_0": 0.95, "action_1": 0.05 }
20
+ }
21
+ },
22
+ "usage": { "input_tokens": 0, "output_tokens": 0 }
23
+ }
24
+ }
@@ -0,0 +1,5 @@
1
+ import type { RecipeOptions } from '../../src/schema.js';
2
+ import type { GameActionInput, GameActionResult } from './schema.js';
3
+ export declare function gameAction(input: GameActionInput, options?: RecipeOptions): Promise<GameActionResult>;
4
+ export { gameActionInputSchema, gameActionResultSchema } from './schema.js';
5
+ export type { GameActionInput, GameActionResult } from './schema.js';
@@ -0,0 +1,30 @@
1
+ import { choice } from '@typesafe-ai/sdk';
2
+ import { evaluateWithJev } from '../../src/client.js';
3
+ import { parseChoiceAnswer } from '../../src/answers.js';
4
+ import { parseDecisionState } from '../../src/decisions.js';
5
+ import { gameActionInputSchema, gameActionResultSchema } from './schema.js';
6
+ const instructions = [
7
+ 'Which available action should this player take next, given the supplied game state, player state, rules, and objective?',
8
+ ...Object.entries(gameActionInputSchema.shape).map(([name, schema]) => `${name}: ${schema.description}`),
9
+ ].join('\n');
10
+ export async function gameAction(input, options = {}) {
11
+ const { legalActions, ...state } = gameActionInputSchema.parse(input);
12
+ if (legalActions.length === 0)
13
+ return null;
14
+ const actions = Object.fromEntries(legalActions.map((action, index) => [`action_${index}`, action]));
15
+ const criteria = Object.fromEntries(Object.entries(actions).map(([label, action]) => [label, JSON.stringify(action)]));
16
+ const response = await evaluateWithJev({
17
+ state: parseDecisionState(state),
18
+ questions: { decision: choice(instructions, criteria) },
19
+ }, options);
20
+ const answer = parseChoiceAnswer(response.answers.decision, Object.keys(actions));
21
+ return gameActionResultSchema.parse({
22
+ selection: answer.choice,
23
+ action: actions[answer.choice],
24
+ confidence: answer.confidence,
25
+ probabilities: answer.probabilities,
26
+ model: response.model,
27
+ usage: response.usage,
28
+ });
29
+ }
30
+ export { gameActionInputSchema, gameActionResultSchema } from './schema.js';
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ export declare const gameActionInputSchema: z.ZodObject<{
3
+ gameState: z.ZodJSONSchema;
4
+ playerState: z.ZodJSONSchema;
5
+ legalActions: z.ZodArray<z.ZodJSONSchema>;
6
+ rules: z.ZodOptional<z.ZodJSONSchema>;
7
+ objective: z.ZodOptional<z.ZodJSONSchema>;
8
+ }, z.core.$strip>;
9
+ export declare const gameActionResultSchema: z.ZodNullable<z.ZodObject<{
10
+ model: z.ZodString;
11
+ usage: z.ZodObject<{
12
+ input_tokens: z.ZodNumber;
13
+ output_tokens: z.ZodNumber;
14
+ }, z.core.$strip>;
15
+ selection: z.ZodString;
16
+ action: z.ZodJSONSchema;
17
+ confidence: z.ZodNumber;
18
+ probabilities: z.ZodRecord<z.ZodString, z.ZodNumber>;
19
+ }, z.core.$strip>>;
20
+ export type GameActionInput = z.infer<typeof gameActionInputSchema>;
21
+ export type GameActionResult = z.infer<typeof gameActionResultSchema>;
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import { probability, resultMetadataSchema } from '../../src/schema.js';
3
+ export const gameActionInputSchema = z.object({
4
+ gameState: z.json().describe('The current game information available for this decision.'),
5
+ playerState: z.json().describe('Information about the player making this decision.'),
6
+ legalActions: z.array(z.json()).describe('The available actions the player can choose from.'),
7
+ rules: z.json().optional().describe('Game rules and explanations of game-specific information.'),
8
+ objective: z.json().optional().describe('What the player is trying to accomplish.'),
9
+ });
10
+ export const gameActionResultSchema = resultMetadataSchema
11
+ .extend({
12
+ selection: z
13
+ .string()
14
+ .describe('The internal Choice label associated with the selected action.'),
15
+ action: z.json().describe('The original selected action, preserving any existing game ID.'),
16
+ confidence: probability.describe('The confidence returned by Jev.'),
17
+ probabilities: z
18
+ .record(z.string(), probability)
19
+ .describe("Jev's probabilities, keyed by internal Choice label."),
20
+ })
21
+ .nullable();
@@ -78,6 +78,8 @@ export { freshnessNeeded, freshnessNeededInputSchema, freshnessNeededResultSchem
78
78
  export type { FreshnessNeededInput, FreshnessNeededResult, FreshnessNeededVerdict, } from '../recipes/freshness-needed/index.js';
79
79
  export { frustrationSignal, frustrationSignalInputSchema, frustrationSignalResultSchema, frustrationSignalVerdictSchema, } from '../recipes/frustration-signal/index.js';
80
80
  export type { FrustrationSignalInput, FrustrationSignalResult, FrustrationSignalVerdict, } from '../recipes/frustration-signal/index.js';
81
+ export { gameAction, gameActionInputSchema, gameActionResultSchema, } from '../recipes/game-action/index.js';
82
+ export type { GameActionInput, GameActionResult } from '../recipes/game-action/index.js';
81
83
  export { handoff, handoffInputSchema, handoffResultSchema } from '../recipes/handoff/index.js';
82
84
  export type { HandoffInput, HandoffResult, HandoffRule, HandoffVerdict, } from '../recipes/handoff/index.js';
83
85
  export { incidentMatch, incidentMatchInputSchema, incidentMatchResultSchema, } from '../recipes/incident-match/index.js';
package/dist/src/index.js CHANGED
@@ -39,6 +39,7 @@ export { fieldSelect, fieldSelectInputSchema, fieldSelectResultSchema, } from '.
39
39
  export { followupLink, followupLinkInputSchema, followupLinkResultSchema, } from '../recipes/followup-link/index.js';
40
40
  export { freshnessNeeded, freshnessNeededInputSchema, freshnessNeededResultSchema, freshnessNeededVerdictSchema, } from '../recipes/freshness-needed/index.js';
41
41
  export { frustrationSignal, frustrationSignalInputSchema, frustrationSignalResultSchema, frustrationSignalVerdictSchema, } from '../recipes/frustration-signal/index.js';
42
+ export { gameAction, gameActionInputSchema, gameActionResultSchema, } from '../recipes/game-action/index.js';
42
43
  export { handoff, handoffInputSchema, handoffResultSchema } from '../recipes/handoff/index.js';
43
44
  export { incidentMatch, incidentMatchInputSchema, incidentMatchResultSchema, } from '../recipes/incident-match/index.js';
44
45
  export { instructionConflict, instructionConflictInputSchema, instructionConflictResultSchema, instructionConflictVerdictSchema, } from '../recipes/instruction-conflict/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jev-recipes",
3
- "version": "0.5.2",
3
+ "version": "0.5.3",
4
4
  "description": "Small, composable Jev decisions for retrieval, conversations, and agent workflows.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -176,6 +176,10 @@
176
176
  "types": "./dist/recipes/frustration-signal/index.d.ts",
177
177
  "import": "./dist/recipes/frustration-signal/index.js"
178
178
  },
179
+ "./game-action": {
180
+ "types": "./dist/recipes/game-action/index.d.ts",
181
+ "import": "./dist/recipes/game-action/index.js"
182
+ },
179
183
  "./handoff": {
180
184
  "types": "./dist/recipes/handoff/index.d.ts",
181
185
  "import": "./dist/recipes/handoff/index.js"
@@ -388,7 +392,6 @@
388
392
  "dist/cli/*.d.ts",
389
393
  "dist/recipes/*/demo.json",
390
394
  "README.md",
391
- "CHANGELOG.md",
392
395
  "LICENSE"
393
396
  ],
394
397
  "scripts": {
package/CHANGELOG.md DELETED
@@ -1,50 +0,0 @@
1
- # Changelog
2
-
3
- ## Unreleased
4
-
5
- - Add `outcome-framing`, `causal-attribution`, and `motivation-source`, bringing the source catalog to 87 recipes. Each classifies expressed wording using one logical Jev request, with documented psychology concepts, decision boundaries, and offline tests. No new runtime dependencies.
6
- - Generate a Psychology & behavior catalog subsection from recipe metadata tags, including relevant existing recipes, and add topic search and documentation checks.
7
-
8
- - Add `memory-subject`, `issue-recurrence`, and `question-assumption` to identify whom a memory describes, distinguish persistent and returning issues, and flag a specific assumption in a question. The source catalog now contains 84 recipes. Each uses one logical Jev request with no new runtime dependencies and includes a guide, offline fixture, contract tests, and discovery checks.
9
-
10
- - Add `checkers-move`: supply a structured board, player, and legal moves to receive a move ID in one logical Jev request. Includes American/English checkers instructions, board translation, input checks, and offline tests, bringing the source catalog to 81 recipes. No new runtime dependencies; live speed and playing strength remain unmeasured.
11
-
12
- - Add `take-turn` and `choose-action` for narrative turn eligibility and game action recommendations, with optional ordered player history, offline tests, and a gameplay composition guide. The source catalog now contains 80 recipes.
13
- - Clarify that `.mjs` is a standalone Node quickstart option; existing JavaScript ES module and TypeScript projects can use their normal file types and start commands.
14
-
15
- - Add six annotation recipes: `response-refusal`, `uncertainty-expression`, `evaluation-mention`, `attribution-match`, `question-leading`, and `evidence-independence`, bringing the source catalog to 78 recipes.
16
- - Document their decision boundaries and research limitations; add offline contract, review-policy, discovery, and package checks without new runtime dependencies.
17
- - Fix the package checker to accept both legacy npm archive reports and the npm 12 object format, including dependency archives.
18
-
19
- - Add six focused recipes: `instruction-conflict`, `task-dependency`, `task-duplicate`, `constraint-strength`, `requirement-testability`, and `claim-stance`.
20
- - Add a catalog growth roadmap, an AI alignment research protocol, research discovery tags, and an offline first-use command in the README.
21
-
22
- - Generate exports, catalog data, schema descriptions, and documentation from recipe folders; add authoring checks and a recipe scaffold.
23
- - Add usage guidance and related recipes to the catalog, ranked search, optional search limits, and lazy recipe loading.
24
- - Add Make commands and offline tooling checks, including a 1,000-entry capacity exercise and installation of the actual npm archive.
25
- - Move published offline demo assets under `dist/recipes/` so npm does not automatically include source recipe guides.
26
- - Keep recipe tests under `tests/recipe/`; enforce an npm content allowlist and exclude development files and source guides.
27
- - Remove the standalone support example and its build, CI, and publishing references.
28
-
29
- - Document installed-package imports and CLI commands first; move repository setup into the contributor guide and rename the local CLI script to `jev-recipes`.
30
-
31
- - Add recipe tests under `tests/recipe/`, mocked Jev responses, recipe coverage reports and thresholds, and test checks in CI.
32
-
33
- - Unify recipe execution helpers, result validation, subject registration, and documentation across the catalog.
34
-
35
- - Expand the catalog to 66 focused recipes across answer quality, retrieval, conversation, tools, support, memory, and knowledge maintenance.
36
- - Add shared choice, candidate-selection, and item-check helpers; keep recipe criteria and schemas in their own folders.
37
- - Register every new recipe for root and subpath imports, discovery, CLI input examples, and offline demos.
38
- - Document the complete catalog, explicit internal reuse, and Cool projects that compose small decisions.
39
-
40
- - Add independent `answerability`, `clarify`, and `handoff` recipes with Zod schemas, inferred types, documentation, and offline fixtures.
41
- - Add recipe-owned metadata, a searchable catalog, and CLI `describe` with JSON schemas and example input.
42
- - Add `demo all` for offline recipe illustrations.
43
- - Extend package exports and release checks without adding dependencies.
44
-
45
- ## 0.0.1
46
-
47
- - Initial foundation with route, rerank, and verify recipes.
48
- - TypeScript library with Zod schemas and inferred types.
49
- - CLI with offline demos, editable example input, and live Jev calls.
50
- - Build, formatting, and package checks for manual npm releases.