jev-recipes 0.6.0 → 0.6.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/README.md +1 -1
- package/dist/catalog/generated/details/finger-actions.json +95 -0
- package/dist/catalog/generated/loaders.js +1 -0
- package/dist/catalog/generated/metadata.js +23 -0
- package/dist/catalog/generated/names.d.ts +1 -1
- package/dist/catalog/generated/names.js +1 -0
- package/dist/catalog/schema.d.ts +1 -0
- package/dist/cli/schema.d.ts +3 -0
- package/dist/recipes/finger-actions/demo.json +58 -0
- package/dist/recipes/finger-actions/index.d.ts +5 -0
- package/dist/recipes/finger-actions/index.js +7 -0
- package/dist/recipes/finger-actions/schema.d.ts +48 -0
- package/dist/recipes/finger-actions/schema.js +10 -0
- package/dist/src/assignments.d.ts +2 -0
- package/dist/src/assignments.js +47 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.js +1 -0
- package/dist/src/schema.d.ts +70 -0
- package/dist/src/schema.js +27 -0
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
<!-- BEGIN GENERATED: summary -->
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
236 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
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
{
|
|
2
|
+
"inputSchema": {
|
|
3
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
4
|
+
"type": "object",
|
|
5
|
+
"properties": {
|
|
6
|
+
"music": { "type": "string" },
|
|
7
|
+
"beat": { "type": "string" },
|
|
8
|
+
"fingers": {
|
|
9
|
+
"minItems": 1,
|
|
10
|
+
"maxItems": 20,
|
|
11
|
+
"type": "array",
|
|
12
|
+
"items": {
|
|
13
|
+
"type": "object",
|
|
14
|
+
"properties": {
|
|
15
|
+
"id": { "type": "string" },
|
|
16
|
+
"text": { "type": "string" },
|
|
17
|
+
"options": {
|
|
18
|
+
"minItems": 1,
|
|
19
|
+
"maxItems": 50,
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": { "id": { "type": "string" }, "text": { "type": "string" } },
|
|
24
|
+
"required": ["id", "text"]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": ["id", "text", "options"]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"style": { "type": "string" },
|
|
32
|
+
"minConfidence": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
33
|
+
},
|
|
34
|
+
"required": ["music", "beat", "fingers"]
|
|
35
|
+
},
|
|
36
|
+
"resultSchema": {
|
|
37
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
38
|
+
"type": "object",
|
|
39
|
+
"properties": {
|
|
40
|
+
"model": { "type": "string" },
|
|
41
|
+
"usage": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"input_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
|
|
45
|
+
"output_tokens": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
|
|
46
|
+
},
|
|
47
|
+
"required": ["input_tokens", "output_tokens"],
|
|
48
|
+
"additionalProperties": false
|
|
49
|
+
},
|
|
50
|
+
"status": { "type": "string", "enum": ["ready", "review"] },
|
|
51
|
+
"assignments": {
|
|
52
|
+
"minItems": 1,
|
|
53
|
+
"maxItems": 20,
|
|
54
|
+
"type": "array",
|
|
55
|
+
"items": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"properties": {
|
|
58
|
+
"id": { "type": "string" },
|
|
59
|
+
"status": { "type": "string", "enum": ["ready", "review"] },
|
|
60
|
+
"verdict": { "type": "string", "enum": ["chosen", "rest", "ambiguous"] },
|
|
61
|
+
"action": { "type": ["string", "null"] },
|
|
62
|
+
"suggestedAction": { "type": ["string", "null"] },
|
|
63
|
+
"confidence": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
64
|
+
"probabilities": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"properties": {
|
|
67
|
+
"options": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"propertyNames": { "type": "string" },
|
|
70
|
+
"additionalProperties": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
71
|
+
},
|
|
72
|
+
"rest": { "type": "number", "minimum": 0, "maximum": 1 },
|
|
73
|
+
"ambiguous": { "type": "number", "minimum": 0, "maximum": 1 }
|
|
74
|
+
},
|
|
75
|
+
"required": ["options", "rest", "ambiguous"],
|
|
76
|
+
"additionalProperties": false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"required": [
|
|
80
|
+
"id",
|
|
81
|
+
"status",
|
|
82
|
+
"verdict",
|
|
83
|
+
"action",
|
|
84
|
+
"suggestedAction",
|
|
85
|
+
"confidence",
|
|
86
|
+
"probabilities"
|
|
87
|
+
],
|
|
88
|
+
"additionalProperties": false
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"required": ["model", "usage", "status", "assignments"],
|
|
93
|
+
"additionalProperties": false
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -86,6 +86,7 @@ export const recipeLoaders = {
|
|
|
86
86
|
'feedback-kind': () => import('../../recipes/feedback-kind/index.js').then((recipe) => (input, options) => recipe.feedbackKind(recipe.feedbackKindInputSchema.parse(input), options)),
|
|
87
87
|
'field-select': () => import('../../recipes/field-select/index.js').then((recipe) => (input, options) => recipe.fieldSelect(recipe.fieldSelectInputSchema.parse(input), options)),
|
|
88
88
|
'financial-advice-signal': () => import('../../recipes/financial-advice-signal/index.js').then((recipe) => (input, options) => recipe.financialAdviceSignal(recipe.financialAdviceSignalInputSchema.parse(input), options)),
|
|
89
|
+
'finger-actions': () => import('../../recipes/finger-actions/index.js').then((recipe) => (input, options) => recipe.fingerActions(recipe.fingerActionsInputSchema.parse(input), options)),
|
|
89
90
|
'followup-link': () => import('../../recipes/followup-link/index.js').then((recipe) => (input, options) => recipe.followupLink(recipe.followupLinkInputSchema.parse(input), options)),
|
|
90
91
|
'forecast-confidence-wording': () => import('../../recipes/forecast-confidence-wording/index.js').then((recipe) => (input, options) => recipe.forecastConfidenceWording(recipe.forecastConfidenceWordingInputSchema.parse(input), options)),
|
|
91
92
|
'format-fit': () => import('../../recipes/format-fit/index.js').then((recipe) => (input, options) => recipe.formatFit(recipe.formatFitInputSchema.parse(input), options)),
|
|
@@ -1918,6 +1918,29 @@ export const recipeMetadata = [
|
|
|
1918
1918
|
},
|
|
1919
1919
|
],
|
|
1920
1920
|
},
|
|
1921
|
+
{
|
|
1922
|
+
id: 'finger-actions',
|
|
1923
|
+
title: 'Choose an action for every finger',
|
|
1924
|
+
description: 'On beat, which listed option should each finger in fingers take, given music and style, or rest?',
|
|
1925
|
+
category: 'workflow',
|
|
1926
|
+
tags: ['music', 'piano', 'performance', 'fingers', 'assignment', 'live-performance', 'agent'],
|
|
1927
|
+
limitations: [
|
|
1928
|
+
'Each finger is judged as its own question within one request, so two fingers can pick the same key. Resolve collisions and physical reach in code.',
|
|
1929
|
+
'Options are the caller-supplied reachable actions for that finger; the recipe does not invent notes or check key membership.',
|
|
1930
|
+
'Beat timing, note durations, and MIDI output belong in application code.',
|
|
1931
|
+
],
|
|
1932
|
+
useWhen: 'A playing loop advances one subdivision at a time and wants every finger to pick from its own reachable options in a single call.',
|
|
1933
|
+
related: [
|
|
1934
|
+
{
|
|
1935
|
+
id: 'next-note',
|
|
1936
|
+
reason: 'Use next-note when the loop chooses one melodic note rather than an action per finger.',
|
|
1937
|
+
},
|
|
1938
|
+
{
|
|
1939
|
+
id: 'next-chord',
|
|
1940
|
+
reason: 'Use next-chord to pick the harmony first, then let finger-actions voice it.',
|
|
1941
|
+
},
|
|
1942
|
+
],
|
|
1943
|
+
},
|
|
1921
1944
|
{
|
|
1922
1945
|
id: 'followup-link',
|
|
1923
1946
|
title: 'Link a follow-up request',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const recipeNames: readonly ["action-compare", "action-effects", "action-reversibility", "action-scope", "age-appropriateness", "alert-actionability", "answer-consistency", "answer-coverage", "answer-disclosures", "answer-grade", "answer-invalidation", "answer-relevance", "answerability", "appeal-grounds-kind", "appointment-request-kind", "argument-fit", "attempted-step", "attribution-match", "audience-fit", "breaking-change-signal", "budget-fit", "budget-narrative-fit", "bug-report-completeness", "buying-intent", "cache-match", "cancellation-check", "care-urgency-wording", "category-fit", "causal-attribution", "causal-language-strength", "certainty-match", "change-meaning", "change-risk", "change-window-fit", "checkers-move", "choose-action", "citation-match", "citation-needed", "claim-facets", "claim-stance", "clarify", "clause-conflict", "clause-kind", "clickbait-level", "commit-message-fit", "commitment-strength", "comparable-fit", "confirmation-match", "consent-request", "consent-scope-fit", "constraint-strength", "content-facets", "content-freshness-signal", "context-role", "continuation-compare", "correction-target", "corrective-action-fit", "daw-request-kind", "deadline-risk", "defect-report-facets", "delegation-fit", "disclosure-facets", "dispute-kind", "document-role", "draft-compare", "dynamic-change", "eligibility-facets", "emotion-kind", "entity-match", "error-acknowledgment", "escalation-wording", "evaluation-mention", "evidence-conflict", "evidence-independence", "evidence-novelty", "evidence-strength", "exercise-select", "expense-category", "explanation-level", "extraction-fidelity", "fact-stability", "failure-kind", "fair-housing-wording", "feedback-actionability", "feedback-kind", "field-select", "financial-advice-signal", "followup-link", "forecast-confidence-wording", "format-fit", "freshness-needed", "frustration-signal", "funder-fit", "game-action", "game-phase", "goal-drift", "grounding-level", "guest-request-facets", "handoff", "handoff-completeness", "headline-fit", "incident-match", "incident-severity-wording", "injection-signal", "instruction-clarity", "instruction-conflict", "instruction-fit", "instruction-priority", "instruction-readability", "instrument-issue-kind", "instrument-report-facets", "intake-question-fit", "intent-change", "invoice-facets", "issue-impact", "issue-recurrence", "itinerary-feasibility", "job-post-facets", "length-fit", "listener-request-kind", "listing-compare", "listing-fact-consistency", "log-line-kind", "loss-cause-kind", "lyric-mood-fit", "maintenance-hazard-wording", "medication-mention", "memory-relation", "memory-scope", "memory-subject", "memory-value", "message-facets", "methods-facets", "modulation-moment", "mood-match", "mood-request", "motivation-source", "move-explanation-fit", "narrative-consistency", "next-chord", "next-duration", "next-note", "notice-facets", "novelty-claim-level", "objection-kind", "objective-fit", "offer-terms-facets", "outcome-framing", "passage-compare", "passage-difficulty", "passage-duplicate", "passage-mood", "passage-standalone", "performance-feedback-facets", "persuasion-technique", "phrase-complete", "pii-presence", "plan-completeness", "policy-compliance", "policy-severity", "politeness-level", "postmortem-facets", "preference-kind", "priority-compare", "privacy-notice-facets", "product-match", "progress-stall", "promise-check", "proposal-facets", "qualification-evidence", "query-equivalence", "query-specificity", "question-assumption", "question-leading", "question-relevance", "reconciliation-match", "reference-resolve", "repeated-attempt", "repetition-level", "reply-template-match", "report-facets", "requirement-testability", "rerank", "resolution-check", "response-needed", "response-refusal", "result-outcome", "result-plausibility", "result-usefulness", "retrieval-needed", "retry-worthwhile", "review-comment-kind", "review-facets", "review-recommendation-kind", "review-response-fit", "rollback-signal", "root-cause-depth", "route", "rule-compliance", "runbook-fit", "safety-incident-kind", "satisfaction-signal", "search-intent-kind", "sentiment-shift", "settlement-offer-facets", "shipment-issue-kind", "slot-fit", "sound-match", "source-applicability", "spam-signal", "stage-evidence", "step-complete", "step-progress", "style-kind", "summary-coverage", "symptom-facets", "take-turn", "task-complexity", "task-dependency", "task-duplicate", "task-overlap", "tempo-change", "tension-level", "ticket-match", "tone-check", "tool-compare", "tool-fit", "topic-shift", "trip-purpose-kind", "troubleshooting-fit", "turn-intent", "uncertainty-expression", "urgency-signal", "verify", "workaround-fit"];
|
|
1
|
+
export declare const recipeNames: readonly ["action-compare", "action-effects", "action-reversibility", "action-scope", "age-appropriateness", "alert-actionability", "answer-consistency", "answer-coverage", "answer-disclosures", "answer-grade", "answer-invalidation", "answer-relevance", "answerability", "appeal-grounds-kind", "appointment-request-kind", "argument-fit", "attempted-step", "attribution-match", "audience-fit", "breaking-change-signal", "budget-fit", "budget-narrative-fit", "bug-report-completeness", "buying-intent", "cache-match", "cancellation-check", "care-urgency-wording", "category-fit", "causal-attribution", "causal-language-strength", "certainty-match", "change-meaning", "change-risk", "change-window-fit", "checkers-move", "choose-action", "citation-match", "citation-needed", "claim-facets", "claim-stance", "clarify", "clause-conflict", "clause-kind", "clickbait-level", "commit-message-fit", "commitment-strength", "comparable-fit", "confirmation-match", "consent-request", "consent-scope-fit", "constraint-strength", "content-facets", "content-freshness-signal", "context-role", "continuation-compare", "correction-target", "corrective-action-fit", "daw-request-kind", "deadline-risk", "defect-report-facets", "delegation-fit", "disclosure-facets", "dispute-kind", "document-role", "draft-compare", "dynamic-change", "eligibility-facets", "emotion-kind", "entity-match", "error-acknowledgment", "escalation-wording", "evaluation-mention", "evidence-conflict", "evidence-independence", "evidence-novelty", "evidence-strength", "exercise-select", "expense-category", "explanation-level", "extraction-fidelity", "fact-stability", "failure-kind", "fair-housing-wording", "feedback-actionability", "feedback-kind", "field-select", "financial-advice-signal", "finger-actions", "followup-link", "forecast-confidence-wording", "format-fit", "freshness-needed", "frustration-signal", "funder-fit", "game-action", "game-phase", "goal-drift", "grounding-level", "guest-request-facets", "handoff", "handoff-completeness", "headline-fit", "incident-match", "incident-severity-wording", "injection-signal", "instruction-clarity", "instruction-conflict", "instruction-fit", "instruction-priority", "instruction-readability", "instrument-issue-kind", "instrument-report-facets", "intake-question-fit", "intent-change", "invoice-facets", "issue-impact", "issue-recurrence", "itinerary-feasibility", "job-post-facets", "length-fit", "listener-request-kind", "listing-compare", "listing-fact-consistency", "log-line-kind", "loss-cause-kind", "lyric-mood-fit", "maintenance-hazard-wording", "medication-mention", "memory-relation", "memory-scope", "memory-subject", "memory-value", "message-facets", "methods-facets", "modulation-moment", "mood-match", "mood-request", "motivation-source", "move-explanation-fit", "narrative-consistency", "next-chord", "next-duration", "next-note", "notice-facets", "novelty-claim-level", "objection-kind", "objective-fit", "offer-terms-facets", "outcome-framing", "passage-compare", "passage-difficulty", "passage-duplicate", "passage-mood", "passage-standalone", "performance-feedback-facets", "persuasion-technique", "phrase-complete", "pii-presence", "plan-completeness", "policy-compliance", "policy-severity", "politeness-level", "postmortem-facets", "preference-kind", "priority-compare", "privacy-notice-facets", "product-match", "progress-stall", "promise-check", "proposal-facets", "qualification-evidence", "query-equivalence", "query-specificity", "question-assumption", "question-leading", "question-relevance", "reconciliation-match", "reference-resolve", "repeated-attempt", "repetition-level", "reply-template-match", "report-facets", "requirement-testability", "rerank", "resolution-check", "response-needed", "response-refusal", "result-outcome", "result-plausibility", "result-usefulness", "retrieval-needed", "retry-worthwhile", "review-comment-kind", "review-facets", "review-recommendation-kind", "review-response-fit", "rollback-signal", "root-cause-depth", "route", "rule-compliance", "runbook-fit", "safety-incident-kind", "satisfaction-signal", "search-intent-kind", "sentiment-shift", "settlement-offer-facets", "shipment-issue-kind", "slot-fit", "sound-match", "source-applicability", "spam-signal", "stage-evidence", "step-complete", "step-progress", "style-kind", "summary-coverage", "symptom-facets", "take-turn", "task-complexity", "task-dependency", "task-duplicate", "task-overlap", "tempo-change", "tension-level", "ticket-match", "tone-check", "tool-compare", "tool-fit", "topic-shift", "trip-purpose-kind", "troubleshooting-fit", "turn-intent", "uncertainty-expression", "urgency-signal", "verify", "workaround-fit"];
|
package/dist/catalog/schema.d.ts
CHANGED
|
@@ -87,6 +87,7 @@ export declare const recipeNameSchema: z.ZodEnum<{
|
|
|
87
87
|
"feedback-kind": "feedback-kind";
|
|
88
88
|
"field-select": "field-select";
|
|
89
89
|
"financial-advice-signal": "financial-advice-signal";
|
|
90
|
+
"finger-actions": "finger-actions";
|
|
90
91
|
"followup-link": "followup-link";
|
|
91
92
|
"forecast-confidence-wording": "forecast-confidence-wording";
|
|
92
93
|
"format-fit": "format-fit";
|
package/dist/cli/schema.d.ts
CHANGED
|
@@ -90,6 +90,7 @@ export declare const commandArgumentsSchema: z.ZodUnion<readonly [z.ZodTuple<[z.
|
|
|
90
90
|
"feedback-kind": "feedback-kind";
|
|
91
91
|
"field-select": "field-select";
|
|
92
92
|
"financial-advice-signal": "financial-advice-signal";
|
|
93
|
+
"finger-actions": "finger-actions";
|
|
93
94
|
"followup-link": "followup-link";
|
|
94
95
|
"forecast-confidence-wording": "forecast-confidence-wording";
|
|
95
96
|
"format-fit": "format-fit";
|
|
@@ -329,6 +330,7 @@ export declare const commandArgumentsSchema: z.ZodUnion<readonly [z.ZodTuple<[z.
|
|
|
329
330
|
"feedback-kind": "feedback-kind";
|
|
330
331
|
"field-select": "field-select";
|
|
331
332
|
"financial-advice-signal": "financial-advice-signal";
|
|
333
|
+
"finger-actions": "finger-actions";
|
|
332
334
|
"followup-link": "followup-link";
|
|
333
335
|
"forecast-confidence-wording": "forecast-confidence-wording";
|
|
334
336
|
"format-fit": "format-fit";
|
|
@@ -565,6 +567,7 @@ export declare const commandArgumentsSchema: z.ZodUnion<readonly [z.ZodTuple<[z.
|
|
|
565
567
|
"feedback-kind": "feedback-kind";
|
|
566
568
|
"field-select": "field-select";
|
|
567
569
|
"financial-advice-signal": "financial-advice-signal";
|
|
570
|
+
"finger-actions": "finger-actions";
|
|
568
571
|
"followup-link": "followup-link";
|
|
569
572
|
"forecast-confidence-wording": "forecast-confidence-wording";
|
|
570
573
|
"format-fit": "format-fit";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"input": {
|
|
3
|
+
"music": "Key C major, 72 bpm, gentle ballad. Last bar: right hand melody E4 D4 C4 (quarter, quarter, half) over a C major chord held in the left hand. The phrase just ended on the tonic.",
|
|
4
|
+
"beat": "Bar 5, eighth 1, start of a new phrase",
|
|
5
|
+
"fingers": [
|
|
6
|
+
{
|
|
7
|
+
"id": "rh-thumb",
|
|
8
|
+
"text": "Right thumb, resting on C4, free to move",
|
|
9
|
+
"options": [
|
|
10
|
+
{ "id": "c4", "text": "Press C4 to restate the tonic" },
|
|
11
|
+
{ "id": "hold", "text": "Keep C4 sounding from the previous bar" }
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"id": "rh-index",
|
|
16
|
+
"text": "Right index, hovering over D4 and E4",
|
|
17
|
+
"options": [
|
|
18
|
+
{ "id": "e4", "text": "Press E4 to start the melody a third above" },
|
|
19
|
+
{ "id": "d4", "text": "Press D4 to start stepwise" }
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "lh-pinky",
|
|
24
|
+
"text": "Left pinky, on C3 which is currently sounding",
|
|
25
|
+
"options": [
|
|
26
|
+
{ "id": "c3", "text": "Re-strike C3 for a fresh bass note" },
|
|
27
|
+
{ "id": "g2", "text": "Move down to G2 for a dominant pedal" }
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
],
|
|
31
|
+
"style": "Keep the texture sparse; melody on top, single bass notes below.",
|
|
32
|
+
"minConfidence": 0.8
|
|
33
|
+
},
|
|
34
|
+
"response": {
|
|
35
|
+
"model": "demo-fixture",
|
|
36
|
+
"answers": {
|
|
37
|
+
"finger_0": {
|
|
38
|
+
"type": "choice",
|
|
39
|
+
"choice": "rest",
|
|
40
|
+
"confidence": 0.84,
|
|
41
|
+
"probabilities": { "option_0": 0.08, "option_1": 0.06, "rest": 0.84, "ambiguous": 0.02 }
|
|
42
|
+
},
|
|
43
|
+
"finger_1": {
|
|
44
|
+
"type": "choice",
|
|
45
|
+
"choice": "option_0",
|
|
46
|
+
"confidence": 0.86,
|
|
47
|
+
"probabilities": { "option_0": 0.86, "option_1": 0.1, "rest": 0.03, "ambiguous": 0.01 }
|
|
48
|
+
},
|
|
49
|
+
"finger_2": {
|
|
50
|
+
"type": "choice",
|
|
51
|
+
"choice": "option_0",
|
|
52
|
+
"confidence": 0.9,
|
|
53
|
+
"probabilities": { "option_0": 0.9, "option_1": 0.06, "rest": 0.03, "ambiguous": 0.01 }
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"usage": { "input_tokens": 0, "output_tokens": 0 }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RecipeOptions } from '../../src/schema.js';
|
|
2
|
+
import type { FingerActionsInput, FingerActionsResult } from './schema.js';
|
|
3
|
+
export declare function fingerActions(input: FingerActionsInput, options?: RecipeOptions): Promise<FingerActionsResult>;
|
|
4
|
+
export { fingerActionsInputSchema, fingerActionsResultSchema } from './schema.js';
|
|
5
|
+
export type { FingerActionsInput, FingerActionsResult } from './schema.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { evaluateAssignments } from '../../src/assignments.js';
|
|
2
|
+
import { fingerActionsInputSchema } from './schema.js';
|
|
3
|
+
export async function fingerActions(input, options = {}) {
|
|
4
|
+
const { minConfidence = 0.8, ...state } = fingerActionsInputSchema.parse(input);
|
|
5
|
+
return evaluateAssignments(state, state.fingers, (index) => `What should fingers[${index}] (described in fingers[${index}].text) do on beat, given the recent material, key, and tempo in music and any style? Choose one of its listed options so the whole hand plays a coherent, idiomatic voicing with the other fingers' likely actions. Judge only this finger.`, minConfidence, options, 'finger');
|
|
6
|
+
}
|
|
7
|
+
export { fingerActionsInputSchema, fingerActionsResultSchema } from './schema.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const fingerActionsInputSchema: z.ZodObject<{
|
|
3
|
+
music: z.ZodString;
|
|
4
|
+
beat: z.ZodString;
|
|
5
|
+
fingers: z.ZodArray<z.ZodObject<{
|
|
6
|
+
id: z.ZodString;
|
|
7
|
+
text: z.ZodString;
|
|
8
|
+
options: z.ZodArray<z.ZodObject<{
|
|
9
|
+
id: z.ZodString;
|
|
10
|
+
text: z.ZodString;
|
|
11
|
+
}, z.core.$strip>>;
|
|
12
|
+
}, z.core.$strip>>;
|
|
13
|
+
style: z.ZodOptional<z.ZodString>;
|
|
14
|
+
minConfidence: z.ZodOptional<z.ZodNumber>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export declare const fingerActionsResultSchema: z.ZodObject<{
|
|
17
|
+
model: z.ZodString;
|
|
18
|
+
usage: z.ZodObject<{
|
|
19
|
+
input_tokens: z.ZodNumber;
|
|
20
|
+
output_tokens: z.ZodNumber;
|
|
21
|
+
}, z.core.$strip>;
|
|
22
|
+
status: z.ZodEnum<{
|
|
23
|
+
ready: "ready";
|
|
24
|
+
review: "review";
|
|
25
|
+
}>;
|
|
26
|
+
assignments: z.ZodArray<z.ZodObject<{
|
|
27
|
+
id: z.ZodString;
|
|
28
|
+
status: z.ZodEnum<{
|
|
29
|
+
ready: "ready";
|
|
30
|
+
review: "review";
|
|
31
|
+
}>;
|
|
32
|
+
verdict: z.ZodEnum<{
|
|
33
|
+
ambiguous: "ambiguous";
|
|
34
|
+
chosen: "chosen";
|
|
35
|
+
rest: "rest";
|
|
36
|
+
}>;
|
|
37
|
+
action: z.ZodNullable<z.ZodString>;
|
|
38
|
+
suggestedAction: z.ZodNullable<z.ZodString>;
|
|
39
|
+
confidence: z.ZodNumber;
|
|
40
|
+
probabilities: z.ZodObject<{
|
|
41
|
+
options: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
42
|
+
rest: z.ZodNumber;
|
|
43
|
+
ambiguous: z.ZodNumber;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
}, z.core.$strip>>;
|
|
46
|
+
}, z.core.$strip>;
|
|
47
|
+
export type FingerActionsInput = z.infer<typeof fingerActionsInputSchema>;
|
|
48
|
+
export type FingerActionsResult = z.infer<typeof fingerActionsResultSchema>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { assignmentsResultSchema, nonEmptyText, optionSlotsSchema, probability, } from '../../src/schema.js';
|
|
3
|
+
export const fingerActionsInputSchema = z.object({
|
|
4
|
+
music: nonEmptyText,
|
|
5
|
+
beat: nonEmptyText,
|
|
6
|
+
fingers: optionSlotsSchema,
|
|
7
|
+
style: nonEmptyText.optional(),
|
|
8
|
+
minConfidence: probability.optional(),
|
|
9
|
+
});
|
|
10
|
+
export const fingerActionsResultSchema = assignmentsResultSchema;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import type { AssignmentsResult, OptionSlot, RecipeOptions } from './schema.js';
|
|
2
|
+
export declare function evaluateAssignments(state: Record<string, unknown>, slots: OptionSlot[], instruction: (index: number) => string, minConfidence: number, options?: RecipeOptions, questionPrefix?: string): Promise<AssignmentsResult>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { choice } from '@typesafe-ai/sdk';
|
|
2
|
+
import { evaluateWithJev } from './client.js';
|
|
3
|
+
import { parseChoiceAnswer } from './answers.js';
|
|
4
|
+
import { asDecisionInstruction, parseDecisionState } from './decisions.js';
|
|
5
|
+
import { assignmentsResultSchema } from './schema.js';
|
|
6
|
+
export async function evaluateAssignments(state, slots, instruction, minConfidence, options = {}, questionPrefix = 'slot') {
|
|
7
|
+
const criteria = slots.map((slot) => ({
|
|
8
|
+
...Object.fromEntries(slot.options.map((option, index) => [`option_${index}`, option.text])),
|
|
9
|
+
rest: 'No listed option should be taken now; stay silent or release.',
|
|
10
|
+
ambiguous: 'Several listed options fit equally well, or the facts cannot separate them.',
|
|
11
|
+
}));
|
|
12
|
+
const response = await evaluateWithJev({
|
|
13
|
+
state: parseDecisionState(state),
|
|
14
|
+
questions: Object.fromEntries(slots.map((_, index) => [
|
|
15
|
+
`${questionPrefix}_${index}`,
|
|
16
|
+
choice(asDecisionInstruction(`${instruction(index)} Choose rest when no listed option fits. Choose ambiguous when several fit equally well.`), criteria[index]),
|
|
17
|
+
])),
|
|
18
|
+
}, options);
|
|
19
|
+
const assignments = slots.map((slot, index) => {
|
|
20
|
+
const answer = parseChoiceAnswer(response.answers[`${questionPrefix}_${index}`], Object.keys(criteria[index]));
|
|
21
|
+
const chosen = slot.options.find((_, position) => `option_${position}` === answer.choice);
|
|
22
|
+
const suggestedAction = chosen?.id ?? null;
|
|
23
|
+
const requiresReview = answer.confidence < minConfidence || answer.choice === 'ambiguous';
|
|
24
|
+
return {
|
|
25
|
+
id: slot.id,
|
|
26
|
+
status: requiresReview ? 'review' : 'ready',
|
|
27
|
+
verdict: chosen !== undefined ? 'chosen' : answer.choice,
|
|
28
|
+
action: requiresReview ? null : suggestedAction,
|
|
29
|
+
suggestedAction,
|
|
30
|
+
confidence: answer.confidence,
|
|
31
|
+
probabilities: {
|
|
32
|
+
options: Object.fromEntries(slot.options.map((option, position) => [
|
|
33
|
+
option.id,
|
|
34
|
+
answer.probabilities[`option_${position}`],
|
|
35
|
+
])),
|
|
36
|
+
rest: answer.probabilities.rest,
|
|
37
|
+
ambiguous: answer.probabilities.ambiguous,
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
});
|
|
41
|
+
return assignmentsResultSchema.parse({
|
|
42
|
+
status: assignments.some((assignment) => assignment.status === 'review') ? 'review' : 'ready',
|
|
43
|
+
assignments,
|
|
44
|
+
model: response.model,
|
|
45
|
+
usage: response.usage,
|
|
46
|
+
});
|
|
47
|
+
}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -176,6 +176,8 @@ export { fieldSelect, fieldSelectInputSchema, fieldSelectResultSchema, } from '.
|
|
|
176
176
|
export type { FieldSelectInput, FieldSelectResult } from '../recipes/field-select/index.js';
|
|
177
177
|
export { financialAdviceSignal, financialAdviceSignalInputSchema, financialAdviceSignalResultSchema, financialAdviceSignalVerdictSchema, } from '../recipes/financial-advice-signal/index.js';
|
|
178
178
|
export type { FinancialAdviceSignalInput, FinancialAdviceSignalResult, FinancialAdviceSignalVerdict, } from '../recipes/financial-advice-signal/index.js';
|
|
179
|
+
export { fingerActions, fingerActionsInputSchema, fingerActionsResultSchema, } from '../recipes/finger-actions/index.js';
|
|
180
|
+
export type { FingerActionsInput, FingerActionsResult } from '../recipes/finger-actions/index.js';
|
|
179
181
|
export { followupLink, followupLinkInputSchema, followupLinkResultSchema, } from '../recipes/followup-link/index.js';
|
|
180
182
|
export type { FollowupLinkInput, FollowupLinkResult } from '../recipes/followup-link/index.js';
|
|
181
183
|
export { forecastConfidenceWording, forecastConfidenceWordingInputSchema, forecastConfidenceWordingResultSchema, forecastConfidenceWordingVerdictSchema, } from '../recipes/forecast-confidence-wording/index.js';
|
package/dist/src/index.js
CHANGED
|
@@ -88,6 +88,7 @@ export { feedbackActionability, feedbackActionabilityInputSchema, feedbackAction
|
|
|
88
88
|
export { feedbackKind, feedbackKindInputSchema, feedbackKindResultSchema, feedbackKindVerdictSchema, } from '../recipes/feedback-kind/index.js';
|
|
89
89
|
export { fieldSelect, fieldSelectInputSchema, fieldSelectResultSchema, } from '../recipes/field-select/index.js';
|
|
90
90
|
export { financialAdviceSignal, financialAdviceSignalInputSchema, financialAdviceSignalResultSchema, financialAdviceSignalVerdictSchema, } from '../recipes/financial-advice-signal/index.js';
|
|
91
|
+
export { fingerActions, fingerActionsInputSchema, fingerActionsResultSchema, } from '../recipes/finger-actions/index.js';
|
|
91
92
|
export { followupLink, followupLinkInputSchema, followupLinkResultSchema, } from '../recipes/followup-link/index.js';
|
|
92
93
|
export { forecastConfidenceWording, forecastConfidenceWordingInputSchema, forecastConfidenceWordingResultSchema, forecastConfidenceWordingVerdictSchema, } from '../recipes/forecast-confidence-wording/index.js';
|
|
93
94
|
export { formatFit, formatFitInputSchema, formatFitResultSchema, formatFitVerdictSchema, } from '../recipes/format-fit/index.js';
|
package/dist/src/schema.d.ts
CHANGED
|
@@ -236,3 +236,73 @@ export type LabelQuestions = z.infer<typeof labelQuestionsSchema>;
|
|
|
236
236
|
export type LabelVerdict = z.infer<typeof labelVerdictSchema>;
|
|
237
237
|
export type LabelCheck = z.infer<typeof labelCheckSchema>;
|
|
238
238
|
export type LabelsResult = z.infer<typeof labelsResultSchema>;
|
|
239
|
+
export declare const optionSlotSchema: z.ZodObject<{
|
|
240
|
+
id: z.ZodString;
|
|
241
|
+
text: z.ZodString;
|
|
242
|
+
options: z.ZodArray<z.ZodObject<{
|
|
243
|
+
id: z.ZodString;
|
|
244
|
+
text: z.ZodString;
|
|
245
|
+
}, z.core.$strip>>;
|
|
246
|
+
}, z.core.$strip>;
|
|
247
|
+
export declare const optionSlotsSchema: z.ZodArray<z.ZodObject<{
|
|
248
|
+
id: z.ZodString;
|
|
249
|
+
text: z.ZodString;
|
|
250
|
+
options: z.ZodArray<z.ZodObject<{
|
|
251
|
+
id: z.ZodString;
|
|
252
|
+
text: z.ZodString;
|
|
253
|
+
}, z.core.$strip>>;
|
|
254
|
+
}, z.core.$strip>>;
|
|
255
|
+
export declare const assignmentSchema: z.ZodObject<{
|
|
256
|
+
id: z.ZodString;
|
|
257
|
+
status: z.ZodEnum<{
|
|
258
|
+
ready: "ready";
|
|
259
|
+
review: "review";
|
|
260
|
+
}>;
|
|
261
|
+
verdict: z.ZodEnum<{
|
|
262
|
+
ambiguous: "ambiguous";
|
|
263
|
+
chosen: "chosen";
|
|
264
|
+
rest: "rest";
|
|
265
|
+
}>;
|
|
266
|
+
action: z.ZodNullable<z.ZodString>;
|
|
267
|
+
suggestedAction: z.ZodNullable<z.ZodString>;
|
|
268
|
+
confidence: z.ZodNumber;
|
|
269
|
+
probabilities: z.ZodObject<{
|
|
270
|
+
options: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
271
|
+
rest: z.ZodNumber;
|
|
272
|
+
ambiguous: z.ZodNumber;
|
|
273
|
+
}, z.core.$strip>;
|
|
274
|
+
}, z.core.$strip>;
|
|
275
|
+
export declare const assignmentsResultSchema: z.ZodObject<{
|
|
276
|
+
model: z.ZodString;
|
|
277
|
+
usage: z.ZodObject<{
|
|
278
|
+
input_tokens: z.ZodNumber;
|
|
279
|
+
output_tokens: z.ZodNumber;
|
|
280
|
+
}, z.core.$strip>;
|
|
281
|
+
status: z.ZodEnum<{
|
|
282
|
+
ready: "ready";
|
|
283
|
+
review: "review";
|
|
284
|
+
}>;
|
|
285
|
+
assignments: z.ZodArray<z.ZodObject<{
|
|
286
|
+
id: z.ZodString;
|
|
287
|
+
status: z.ZodEnum<{
|
|
288
|
+
ready: "ready";
|
|
289
|
+
review: "review";
|
|
290
|
+
}>;
|
|
291
|
+
verdict: z.ZodEnum<{
|
|
292
|
+
ambiguous: "ambiguous";
|
|
293
|
+
chosen: "chosen";
|
|
294
|
+
rest: "rest";
|
|
295
|
+
}>;
|
|
296
|
+
action: z.ZodNullable<z.ZodString>;
|
|
297
|
+
suggestedAction: z.ZodNullable<z.ZodString>;
|
|
298
|
+
confidence: z.ZodNumber;
|
|
299
|
+
probabilities: z.ZodObject<{
|
|
300
|
+
options: z.ZodRecord<z.ZodString, z.ZodNumber>;
|
|
301
|
+
rest: z.ZodNumber;
|
|
302
|
+
ambiguous: z.ZodNumber;
|
|
303
|
+
}, z.core.$strip>;
|
|
304
|
+
}, z.core.$strip>>;
|
|
305
|
+
}, z.core.$strip>;
|
|
306
|
+
export type OptionSlot = z.infer<typeof optionSlotSchema>;
|
|
307
|
+
export type Assignment = z.infer<typeof assignmentSchema>;
|
|
308
|
+
export type AssignmentsResult = z.infer<typeof assignmentsResultSchema>;
|
package/dist/src/schema.js
CHANGED
|
@@ -111,3 +111,30 @@ export const labelsResultSchema = resultMetadataSchema.extend({
|
|
|
111
111
|
status: decisionStatusSchema,
|
|
112
112
|
detected: z.array(nonEmptyText),
|
|
113
113
|
});
|
|
114
|
+
export const optionSlotSchema = z.object({
|
|
115
|
+
id: nonEmptyText,
|
|
116
|
+
text: nonEmptyText,
|
|
117
|
+
options: textItemsSchema,
|
|
118
|
+
});
|
|
119
|
+
export const optionSlotsSchema = z
|
|
120
|
+
.array(optionSlotSchema)
|
|
121
|
+
.min(1)
|
|
122
|
+
.max(20)
|
|
123
|
+
.refine((slots) => new Set(slots.map((slot) => slot.id)).size === slots.length, 'Slot IDs must be unique.');
|
|
124
|
+
export const assignmentSchema = z.object({
|
|
125
|
+
id: nonEmptyText,
|
|
126
|
+
status: decisionStatusSchema,
|
|
127
|
+
verdict: z.enum(['chosen', 'rest', 'ambiguous']),
|
|
128
|
+
action: nonEmptyText.nullable(),
|
|
129
|
+
suggestedAction: nonEmptyText.nullable(),
|
|
130
|
+
confidence: probability,
|
|
131
|
+
probabilities: z.object({
|
|
132
|
+
options: z.record(nonEmptyText, probability),
|
|
133
|
+
rest: probability,
|
|
134
|
+
ambiguous: probability,
|
|
135
|
+
}),
|
|
136
|
+
});
|
|
137
|
+
export const assignmentsResultSchema = resultMetadataSchema.extend({
|
|
138
|
+
status: decisionStatusSchema,
|
|
139
|
+
assignments: z.array(assignmentSchema).min(1).max(20),
|
|
140
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jev-recipes",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "Small, composable Jev decisions for retrieval, conversations, and agent workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -372,6 +372,10 @@
|
|
|
372
372
|
"types": "./dist/recipes/financial-advice-signal/index.d.ts",
|
|
373
373
|
"import": "./dist/recipes/financial-advice-signal/index.js"
|
|
374
374
|
},
|
|
375
|
+
"./finger-actions": {
|
|
376
|
+
"types": "./dist/recipes/finger-actions/index.d.ts",
|
|
377
|
+
"import": "./dist/recipes/finger-actions/index.js"
|
|
378
|
+
},
|
|
375
379
|
"./followup-link": {
|
|
376
380
|
"types": "./dist/recipes/followup-link/index.d.ts",
|
|
377
381
|
"import": "./dist/recipes/followup-link/index.js"
|