jev-recipes 0.3.0 → 0.4.0
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/CHANGELOG.md +3 -0
- package/README.md +18 -2
- package/dist/catalog/generated/details/claim-stance.json +55 -0
- package/dist/catalog/generated/details/constraint-strength.json +48 -0
- package/dist/catalog/generated/details/instruction-conflict.json +52 -0
- package/dist/catalog/generated/details/requirement-testability.json +45 -0
- package/dist/catalog/generated/details/task-dependency.json +61 -0
- package/dist/catalog/generated/details/task-duplicate.json +49 -0
- package/dist/catalog/generated/loaders.js +6 -0
- package/dist/catalog/generated/metadata.js +176 -5
- package/dist/catalog/generated/names.d.ts +1 -1
- package/dist/catalog/generated/names.js +6 -0
- package/dist/catalog/schema.d.ts +6 -0
- package/dist/cli/schema.d.ts +18 -0
- package/dist/recipes/claim-stance/demo.json +27 -0
- package/dist/recipes/claim-stance/index.d.ts +5 -0
- package/dist/recipes/claim-stance/index.js +17 -0
- package/dist/recipes/claim-stance/schema.d.ts +43 -0
- package/dist/recipes/claim-stance/schema.js +23 -0
- package/dist/recipes/constraint-strength/demo.json +25 -0
- package/dist/recipes/constraint-strength/index.d.ts +5 -0
- package/dist/recipes/constraint-strength/index.js +16 -0
- package/dist/recipes/constraint-strength/schema.d.ts +39 -0
- package/dist/recipes/constraint-strength/schema.js +21 -0
- package/dist/recipes/evidence-conflict/schema.d.ts +3 -3
- package/dist/recipes/instruction-conflict/demo.json +27 -0
- package/dist/recipes/instruction-conflict/index.d.ts +5 -0
- package/dist/recipes/instruction-conflict/index.js +16 -0
- package/dist/recipes/instruction-conflict/schema.d.ts +40 -0
- package/dist/recipes/instruction-conflict/schema.js +22 -0
- package/dist/recipes/preference-kind/schema.d.ts +3 -3
- package/dist/recipes/requirement-testability/demo.json +24 -0
- package/dist/recipes/requirement-testability/index.d.ts +5 -0
- package/dist/recipes/requirement-testability/index.js +15 -0
- package/dist/recipes/requirement-testability/schema.d.ts +36 -0
- package/dist/recipes/requirement-testability/schema.js +16 -0
- package/dist/recipes/task-dependency/demo.json +28 -0
- package/dist/recipes/task-dependency/index.d.ts +5 -0
- package/dist/recipes/task-dependency/index.js +17 -0
- package/dist/recipes/task-dependency/schema.d.ts +43 -0
- package/dist/recipes/task-dependency/schema.js +23 -0
- package/dist/recipes/task-duplicate/demo.json +27 -0
- package/dist/recipes/task-duplicate/index.d.ts +5 -0
- package/dist/recipes/task-duplicate/index.js +16 -0
- package/dist/recipes/task-duplicate/schema.d.ts +40 -0
- package/dist/recipes/task-duplicate/schema.js +22 -0
- package/dist/recipes/topic-shift/schema.d.ts +3 -3
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.js +6 -0
- package/package.json +25 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { decisionStatusSchema, nonEmptyText, probability, resultMetadataSchema, } from '../../src/schema.js';
|
|
3
|
+
export const constraintStrengthVerdictSchema = z.enum([
|
|
4
|
+
'required',
|
|
5
|
+
'preferred',
|
|
6
|
+
'optional',
|
|
7
|
+
'unclear',
|
|
8
|
+
]);
|
|
9
|
+
export const constraintStrengthInputSchema = z.object({
|
|
10
|
+
statement: nonEmptyText.describe('One constraint or preference to interpret.'),
|
|
11
|
+
context: nonEmptyText
|
|
12
|
+
.describe('The surrounding request and any qualifications that clarify its force.')
|
|
13
|
+
.optional(),
|
|
14
|
+
minConfidence: probability.optional(),
|
|
15
|
+
});
|
|
16
|
+
export const constraintStrengthResultSchema = resultMetadataSchema.extend({
|
|
17
|
+
status: decisionStatusSchema,
|
|
18
|
+
verdict: constraintStrengthVerdictSchema,
|
|
19
|
+
confidence: probability,
|
|
20
|
+
probabilities: z.record(constraintStrengthVerdictSchema, probability),
|
|
21
|
+
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const evidenceConflictVerdictSchema: z.ZodEnum<{
|
|
3
|
+
compatible: "compatible";
|
|
3
4
|
unclear: "unclear";
|
|
4
5
|
conflicting: "conflicting";
|
|
5
|
-
compatible: "compatible";
|
|
6
6
|
different_scope: "different_scope";
|
|
7
7
|
}>;
|
|
8
8
|
export declare const evidenceConflictInputSchema: z.ZodObject<{
|
|
@@ -22,16 +22,16 @@ export declare const evidenceConflictResultSchema: z.ZodObject<{
|
|
|
22
22
|
review: "review";
|
|
23
23
|
}>;
|
|
24
24
|
verdict: z.ZodEnum<{
|
|
25
|
+
compatible: "compatible";
|
|
25
26
|
unclear: "unclear";
|
|
26
27
|
conflicting: "conflicting";
|
|
27
|
-
compatible: "compatible";
|
|
28
28
|
different_scope: "different_scope";
|
|
29
29
|
}>;
|
|
30
30
|
confidence: z.ZodNumber;
|
|
31
31
|
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
32
|
+
compatible: "compatible";
|
|
32
33
|
unclear: "unclear";
|
|
33
34
|
conflicting: "conflicting";
|
|
34
|
-
compatible: "compatible";
|
|
35
35
|
different_scope: "different_scope";
|
|
36
36
|
}>, z.ZodNumber>;
|
|
37
37
|
}, z.core.$strip>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"input": {
|
|
3
|
+
"firstInstruction": "Send the report as a PDF attachment.",
|
|
4
|
+
"secondInstruction": "Send the report only as plain text in the email body; do not attach any files.",
|
|
5
|
+
"context": "Both instructions apply to the same outgoing report email."
|
|
6
|
+
},
|
|
7
|
+
"response": {
|
|
8
|
+
"model": "demo-fixture",
|
|
9
|
+
"usage": {
|
|
10
|
+
"input_tokens": 0,
|
|
11
|
+
"output_tokens": 0
|
|
12
|
+
},
|
|
13
|
+
"answers": {
|
|
14
|
+
"decision": {
|
|
15
|
+
"type": "choice",
|
|
16
|
+
"choice": "conflicting",
|
|
17
|
+
"confidence": 0.96,
|
|
18
|
+
"probabilities": {
|
|
19
|
+
"compatible": 0.013333333333333334,
|
|
20
|
+
"conflicting": 0.96,
|
|
21
|
+
"different_scope": 0.013333333333333334,
|
|
22
|
+
"unclear": 0.013333333333333334
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RecipeOptions } from '../../src/schema.js';
|
|
2
|
+
import type { InstructionConflictInput, InstructionConflictResult } from './schema.js';
|
|
3
|
+
export declare function instructionConflict(input: InstructionConflictInput, options?: RecipeOptions): Promise<InstructionConflictResult>;
|
|
4
|
+
export { instructionConflictInputSchema, instructionConflictResultSchema, instructionConflictVerdictSchema, } from './schema.js';
|
|
5
|
+
export type { InstructionConflictInput, InstructionConflictResult, InstructionConflictVerdict, } from './schema.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { evaluateChoice } from '../../src/decisions.js';
|
|
2
|
+
import { instructionConflictInputSchema, instructionConflictResultSchema } from './schema.js';
|
|
3
|
+
export async function instructionConflict(input, options = {}) {
|
|
4
|
+
const { minConfidence = 0.8, ...state } = instructionConflictInputSchema.parse(input);
|
|
5
|
+
const decision = await evaluateChoice(state, 'Can firstInstruction and secondInstruction both be followed in context? Compare their required behavior, including prohibitions, conditions, and exceptions. A preference is not a mandatory requirement. Different wording is not a conflict. Choose conflicting only when applicable requirements cannot both be followed under the same supplied circumstances. Do not choose which instruction wins or infer authority from its wording. If their applicable scope is unresolved, choose unclear.', {
|
|
6
|
+
compatible: 'The instructions share an applicable scope and their requirements can both be followed.',
|
|
7
|
+
conflicting: 'Both instructions apply under the same supplied circumstances and require mutually incompatible behavior.',
|
|
8
|
+
different_scope: 'The instructions explicitly apply to separate circumstances, so their requirements do not compete.',
|
|
9
|
+
unclear: 'Their meaning, scope, or conditions leave it unresolved whether both can be followed.',
|
|
10
|
+
}, options);
|
|
11
|
+
return instructionConflictResultSchema.parse({
|
|
12
|
+
...decision,
|
|
13
|
+
status: decision.confidence < minConfidence || decision.verdict === 'unclear' ? 'review' : 'ready',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export { instructionConflictInputSchema, instructionConflictResultSchema, instructionConflictVerdictSchema, } from './schema.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const instructionConflictVerdictSchema: z.ZodEnum<{
|
|
3
|
+
compatible: "compatible";
|
|
4
|
+
unclear: "unclear";
|
|
5
|
+
conflicting: "conflicting";
|
|
6
|
+
different_scope: "different_scope";
|
|
7
|
+
}>;
|
|
8
|
+
export declare const instructionConflictInputSchema: z.ZodObject<{
|
|
9
|
+
firstInstruction: z.ZodString;
|
|
10
|
+
secondInstruction: z.ZodString;
|
|
11
|
+
context: z.ZodOptional<z.ZodString>;
|
|
12
|
+
minConfidence: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const instructionConflictResultSchema: z.ZodObject<{
|
|
15
|
+
model: z.ZodString;
|
|
16
|
+
usage: z.ZodObject<{
|
|
17
|
+
input_tokens: z.ZodNumber;
|
|
18
|
+
output_tokens: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
status: z.ZodEnum<{
|
|
21
|
+
ready: "ready";
|
|
22
|
+
review: "review";
|
|
23
|
+
}>;
|
|
24
|
+
verdict: z.ZodEnum<{
|
|
25
|
+
compatible: "compatible";
|
|
26
|
+
unclear: "unclear";
|
|
27
|
+
conflicting: "conflicting";
|
|
28
|
+
different_scope: "different_scope";
|
|
29
|
+
}>;
|
|
30
|
+
confidence: z.ZodNumber;
|
|
31
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
32
|
+
compatible: "compatible";
|
|
33
|
+
unclear: "unclear";
|
|
34
|
+
conflicting: "conflicting";
|
|
35
|
+
different_scope: "different_scope";
|
|
36
|
+
}>, z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export type InstructionConflictInput = z.infer<typeof instructionConflictInputSchema>;
|
|
39
|
+
export type InstructionConflictResult = z.infer<typeof instructionConflictResultSchema>;
|
|
40
|
+
export type InstructionConflictVerdict = z.infer<typeof instructionConflictVerdictSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { decisionStatusSchema, nonEmptyText, probability, resultMetadataSchema, } from '../../src/schema.js';
|
|
3
|
+
export const instructionConflictVerdictSchema = z.enum([
|
|
4
|
+
'compatible',
|
|
5
|
+
'conflicting',
|
|
6
|
+
'different_scope',
|
|
7
|
+
'unclear',
|
|
8
|
+
]);
|
|
9
|
+
export const instructionConflictInputSchema = z.object({
|
|
10
|
+
firstInstruction: nonEmptyText.describe('The first instruction to compare.'),
|
|
11
|
+
secondInstruction: nonEmptyText.describe('The second instruction to compare.'),
|
|
12
|
+
context: nonEmptyText
|
|
13
|
+
.describe('The task and circumstances in which the instructions may apply.')
|
|
14
|
+
.optional(),
|
|
15
|
+
minConfidence: probability.optional(),
|
|
16
|
+
});
|
|
17
|
+
export const instructionConflictResultSchema = resultMetadataSchema.extend({
|
|
18
|
+
status: decisionStatusSchema,
|
|
19
|
+
verdict: instructionConflictVerdictSchema,
|
|
20
|
+
confidence: probability,
|
|
21
|
+
probabilities: z.record(instructionConflictVerdictSchema, probability),
|
|
22
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const preferenceKindVerdictSchema: z.ZodEnum<{
|
|
3
|
-
fact: "fact";
|
|
4
3
|
preference: "preference";
|
|
4
|
+
fact: "fact";
|
|
5
5
|
unclear: "unclear";
|
|
6
6
|
temporary_request: "temporary_request";
|
|
7
7
|
}>;
|
|
@@ -21,15 +21,15 @@ export declare const preferenceKindResultSchema: z.ZodObject<{
|
|
|
21
21
|
review: "review";
|
|
22
22
|
}>;
|
|
23
23
|
verdict: z.ZodEnum<{
|
|
24
|
-
fact: "fact";
|
|
25
24
|
preference: "preference";
|
|
25
|
+
fact: "fact";
|
|
26
26
|
unclear: "unclear";
|
|
27
27
|
temporary_request: "temporary_request";
|
|
28
28
|
}>;
|
|
29
29
|
confidence: z.ZodNumber;
|
|
30
30
|
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
31
|
-
fact: "fact";
|
|
32
31
|
preference: "preference";
|
|
32
|
+
fact: "fact";
|
|
33
33
|
unclear: "unclear";
|
|
34
34
|
temporary_request: "temporary_request";
|
|
35
35
|
}>, z.ZodNumber>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"input": {
|
|
3
|
+
"requirement": "The dashboard should load quickly."
|
|
4
|
+
},
|
|
5
|
+
"response": {
|
|
6
|
+
"model": "demo-fixture",
|
|
7
|
+
"usage": {
|
|
8
|
+
"input_tokens": 0,
|
|
9
|
+
"output_tokens": 0
|
|
10
|
+
},
|
|
11
|
+
"answers": {
|
|
12
|
+
"decision": {
|
|
13
|
+
"type": "choice",
|
|
14
|
+
"choice": "not_testable",
|
|
15
|
+
"confidence": 0.96,
|
|
16
|
+
"probabilities": {
|
|
17
|
+
"testable": 0.02,
|
|
18
|
+
"not_testable": 0.96,
|
|
19
|
+
"unclear": 0.02
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RecipeOptions } from '../../src/schema.js';
|
|
2
|
+
import type { RequirementTestabilityInput, RequirementTestabilityResult } from './schema.js';
|
|
3
|
+
export declare function requirementTestability(input: RequirementTestabilityInput, options?: RecipeOptions): Promise<RequirementTestabilityResult>;
|
|
4
|
+
export { requirementTestabilityInputSchema, requirementTestabilityResultSchema, requirementTestabilityVerdictSchema, } from './schema.js';
|
|
5
|
+
export type { RequirementTestabilityInput, RequirementTestabilityResult, RequirementTestabilityVerdict, } from './schema.js';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { evaluateChoice } from '../../src/decisions.js';
|
|
2
|
+
import { requirementTestabilityInputSchema, requirementTestabilityResultSchema } from './schema.js';
|
|
3
|
+
export async function requirementTestability(input, options = {}) {
|
|
4
|
+
const { minConfidence = 0.8, ...state } = requirementTestabilityInputSchema.parse(input);
|
|
5
|
+
const decision = await evaluateChoice(state, 'Do requirement and context define an observable way to distinguish meeting this requirement from failing it? Judge the stated acceptance criteria, not feasibility, current implementation, or whether it already passes. A criterion can be qualitative if the supplied definitions make the expected observation clear. Do not invent thresholds, measurement conditions, definitions, or a test procedure. Choose not_testable when the intended requirement is understandable but its completion criteria remain subjective or unbounded; choose unclear when the requirement itself or a reference cannot be interpreted.', {
|
|
6
|
+
testable: 'The supplied requirement and definitions establish observable conditions for distinguishing pass from fail.',
|
|
7
|
+
not_testable: 'The intended requirement is understandable, but the supplied criteria do not define an observable pass/fail boundary.',
|
|
8
|
+
unclear: 'The requirement or its references are too ambiguous to determine what would need to be observed.',
|
|
9
|
+
}, options);
|
|
10
|
+
return requirementTestabilityResultSchema.parse({
|
|
11
|
+
...decision,
|
|
12
|
+
status: decision.confidence < minConfidence || decision.verdict === 'unclear' ? 'review' : 'ready',
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
export { requirementTestabilityInputSchema, requirementTestabilityResultSchema, requirementTestabilityVerdictSchema, } from './schema.js';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const requirementTestabilityVerdictSchema: z.ZodEnum<{
|
|
3
|
+
testable: "testable";
|
|
4
|
+
unclear: "unclear";
|
|
5
|
+
not_testable: "not_testable";
|
|
6
|
+
}>;
|
|
7
|
+
export declare const requirementTestabilityInputSchema: z.ZodObject<{
|
|
8
|
+
requirement: z.ZodString;
|
|
9
|
+
context: z.ZodOptional<z.ZodString>;
|
|
10
|
+
minConfidence: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, z.core.$strip>;
|
|
12
|
+
export declare const requirementTestabilityResultSchema: z.ZodObject<{
|
|
13
|
+
model: z.ZodString;
|
|
14
|
+
usage: z.ZodObject<{
|
|
15
|
+
input_tokens: z.ZodNumber;
|
|
16
|
+
output_tokens: z.ZodNumber;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
status: z.ZodEnum<{
|
|
19
|
+
ready: "ready";
|
|
20
|
+
review: "review";
|
|
21
|
+
}>;
|
|
22
|
+
verdict: z.ZodEnum<{
|
|
23
|
+
testable: "testable";
|
|
24
|
+
unclear: "unclear";
|
|
25
|
+
not_testable: "not_testable";
|
|
26
|
+
}>;
|
|
27
|
+
confidence: z.ZodNumber;
|
|
28
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
29
|
+
testable: "testable";
|
|
30
|
+
unclear: "unclear";
|
|
31
|
+
not_testable: "not_testable";
|
|
32
|
+
}>, z.ZodNumber>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type RequirementTestabilityInput = z.infer<typeof requirementTestabilityInputSchema>;
|
|
35
|
+
export type RequirementTestabilityResult = z.infer<typeof requirementTestabilityResultSchema>;
|
|
36
|
+
export type RequirementTestabilityVerdict = z.infer<typeof requirementTestabilityVerdictSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { decisionStatusSchema, nonEmptyText, probability, resultMetadataSchema, } from '../../src/schema.js';
|
|
3
|
+
export const requirementTestabilityVerdictSchema = z.enum(['testable', 'not_testable', 'unclear']);
|
|
4
|
+
export const requirementTestabilityInputSchema = z.object({
|
|
5
|
+
requirement: nonEmptyText.describe('One requirement whose completion criteria need review.'),
|
|
6
|
+
context: nonEmptyText
|
|
7
|
+
.describe('Supplied definitions, acceptance criteria, and observation conditions.')
|
|
8
|
+
.optional(),
|
|
9
|
+
minConfidence: probability.optional(),
|
|
10
|
+
});
|
|
11
|
+
export const requirementTestabilityResultSchema = resultMetadataSchema.extend({
|
|
12
|
+
status: decisionStatusSchema,
|
|
13
|
+
verdict: requirementTestabilityVerdictSchema,
|
|
14
|
+
confidence: probability,
|
|
15
|
+
probabilities: z.record(requirementTestabilityVerdictSchema, probability),
|
|
16
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"input": {
|
|
3
|
+
"firstTask": "Build the release archive from the source code.",
|
|
4
|
+
"secondTask": "Upload the completed release archive to the artifact store.",
|
|
5
|
+
"context": "The source code is available. No release archive exists yet, and uploading requires the completed archive."
|
|
6
|
+
},
|
|
7
|
+
"response": {
|
|
8
|
+
"model": "demo-fixture",
|
|
9
|
+
"usage": {
|
|
10
|
+
"input_tokens": 0,
|
|
11
|
+
"output_tokens": 0
|
|
12
|
+
},
|
|
13
|
+
"answers": {
|
|
14
|
+
"decision": {
|
|
15
|
+
"type": "choice",
|
|
16
|
+
"choice": "first_before_second",
|
|
17
|
+
"confidence": 0.96,
|
|
18
|
+
"probabilities": {
|
|
19
|
+
"first_before_second": 0.96,
|
|
20
|
+
"second_before_first": 0.01,
|
|
21
|
+
"independent": 0.01,
|
|
22
|
+
"cyclic": 0.01,
|
|
23
|
+
"unclear": 0.01
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RecipeOptions } from '../../src/schema.js';
|
|
2
|
+
import type { TaskDependencyInput, TaskDependencyResult } from './schema.js';
|
|
3
|
+
export declare function taskDependency(input: TaskDependencyInput, options?: RecipeOptions): Promise<TaskDependencyResult>;
|
|
4
|
+
export { taskDependencyInputSchema, taskDependencyResultSchema, taskDependencyVerdictSchema, } from './schema.js';
|
|
5
|
+
export type { TaskDependencyInput, TaskDependencyResult, TaskDependencyVerdict } from './schema.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { evaluateChoice } from '../../src/decisions.js';
|
|
2
|
+
import { taskDependencyInputSchema, taskDependencyResultSchema } from './schema.js';
|
|
3
|
+
export async function taskDependency(input, options = {}) {
|
|
4
|
+
const { minConfidence = 0.8, ...state } = taskDependencyInputSchema.parse(input);
|
|
5
|
+
const decision = await evaluateChoice(state, 'Does either of firstTask and secondTask require the other to finish before it can start, using only their descriptions and context? Judge necessary prerequisites, not a preferred or convenient order. Never infer a dependency from the order in which tasks are supplied. Shared subject matter or duplicate work alone does not establish a dependency. Choose independent only when the supplied facts establish that both can start without the other finishing. Missing prerequisite information is unclear, not independence.', {
|
|
6
|
+
first_before_second: 'The second task needs the first task to finish, and the first does not need the second to finish.',
|
|
7
|
+
second_before_first: 'The first task needs the second task to finish, and the second does not need the first to finish.',
|
|
8
|
+
independent: 'Neither task needs the other to finish before it can start under the supplied conditions.',
|
|
9
|
+
cyclic: 'Each task requires the other to finish before it can start.',
|
|
10
|
+
unclear: 'The supplied descriptions do not establish the prerequisite relationship.',
|
|
11
|
+
}, options);
|
|
12
|
+
return taskDependencyResultSchema.parse({
|
|
13
|
+
...decision,
|
|
14
|
+
status: decision.confidence < minConfidence || decision.verdict === 'unclear' ? 'review' : 'ready',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
export { taskDependencyInputSchema, taskDependencyResultSchema, taskDependencyVerdictSchema, } from './schema.js';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const taskDependencyVerdictSchema: z.ZodEnum<{
|
|
3
|
+
unclear: "unclear";
|
|
4
|
+
first_before_second: "first_before_second";
|
|
5
|
+
second_before_first: "second_before_first";
|
|
6
|
+
independent: "independent";
|
|
7
|
+
cyclic: "cyclic";
|
|
8
|
+
}>;
|
|
9
|
+
export declare const taskDependencyInputSchema: z.ZodObject<{
|
|
10
|
+
firstTask: z.ZodString;
|
|
11
|
+
secondTask: z.ZodString;
|
|
12
|
+
context: z.ZodOptional<z.ZodString>;
|
|
13
|
+
minConfidence: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare const taskDependencyResultSchema: z.ZodObject<{
|
|
16
|
+
model: z.ZodString;
|
|
17
|
+
usage: z.ZodObject<{
|
|
18
|
+
input_tokens: z.ZodNumber;
|
|
19
|
+
output_tokens: z.ZodNumber;
|
|
20
|
+
}, z.core.$strip>;
|
|
21
|
+
status: z.ZodEnum<{
|
|
22
|
+
ready: "ready";
|
|
23
|
+
review: "review";
|
|
24
|
+
}>;
|
|
25
|
+
verdict: z.ZodEnum<{
|
|
26
|
+
unclear: "unclear";
|
|
27
|
+
first_before_second: "first_before_second";
|
|
28
|
+
second_before_first: "second_before_first";
|
|
29
|
+
independent: "independent";
|
|
30
|
+
cyclic: "cyclic";
|
|
31
|
+
}>;
|
|
32
|
+
confidence: z.ZodNumber;
|
|
33
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
34
|
+
unclear: "unclear";
|
|
35
|
+
first_before_second: "first_before_second";
|
|
36
|
+
second_before_first: "second_before_first";
|
|
37
|
+
independent: "independent";
|
|
38
|
+
cyclic: "cyclic";
|
|
39
|
+
}>, z.ZodNumber>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type TaskDependencyInput = z.infer<typeof taskDependencyInputSchema>;
|
|
42
|
+
export type TaskDependencyResult = z.infer<typeof taskDependencyResultSchema>;
|
|
43
|
+
export type TaskDependencyVerdict = z.infer<typeof taskDependencyVerdictSchema>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { decisionStatusSchema, nonEmptyText, probability, resultMetadataSchema, } from '../../src/schema.js';
|
|
3
|
+
export const taskDependencyVerdictSchema = z.enum([
|
|
4
|
+
'first_before_second',
|
|
5
|
+
'second_before_first',
|
|
6
|
+
'independent',
|
|
7
|
+
'cyclic',
|
|
8
|
+
'unclear',
|
|
9
|
+
]);
|
|
10
|
+
export const taskDependencyInputSchema = z.object({
|
|
11
|
+
firstTask: nonEmptyText.describe('The first task, including its inputs and output when known.'),
|
|
12
|
+
secondTask: nonEmptyText.describe('The second task, including its inputs and output when known.'),
|
|
13
|
+
context: nonEmptyText
|
|
14
|
+
.describe('Known prerequisites, available inputs, and relevant workflow conditions.')
|
|
15
|
+
.optional(),
|
|
16
|
+
minConfidence: probability.optional(),
|
|
17
|
+
});
|
|
18
|
+
export const taskDependencyResultSchema = resultMetadataSchema.extend({
|
|
19
|
+
status: decisionStatusSchema,
|
|
20
|
+
verdict: taskDependencyVerdictSchema,
|
|
21
|
+
confidence: probability,
|
|
22
|
+
probabilities: z.record(taskDependencyVerdictSchema, probability),
|
|
23
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"input": {
|
|
3
|
+
"firstTask": "Write a summary of the supplied onboarding guide for new hires.",
|
|
4
|
+
"secondTask": "Summarize the same supplied onboarding guide for new hires and translate the summary into Spanish.",
|
|
5
|
+
"context": "Both tasks require the same English summary; only the second also requires a Spanish translation."
|
|
6
|
+
},
|
|
7
|
+
"response": {
|
|
8
|
+
"model": "demo-fixture",
|
|
9
|
+
"usage": {
|
|
10
|
+
"input_tokens": 0,
|
|
11
|
+
"output_tokens": 0
|
|
12
|
+
},
|
|
13
|
+
"answers": {
|
|
14
|
+
"decision": {
|
|
15
|
+
"type": "choice",
|
|
16
|
+
"choice": "overlapping",
|
|
17
|
+
"confidence": 0.96,
|
|
18
|
+
"probabilities": {
|
|
19
|
+
"duplicate": 0.013333333333333334,
|
|
20
|
+
"overlapping": 0.96,
|
|
21
|
+
"distinct": 0.013333333333333334,
|
|
22
|
+
"unclear": 0.013333333333333334
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RecipeOptions } from '../../src/schema.js';
|
|
2
|
+
import type { TaskDuplicateInput, TaskDuplicateResult } from './schema.js';
|
|
3
|
+
export declare function taskDuplicate(input: TaskDuplicateInput, options?: RecipeOptions): Promise<TaskDuplicateResult>;
|
|
4
|
+
export { taskDuplicateInputSchema, taskDuplicateResultSchema, taskDuplicateVerdictSchema, } from './schema.js';
|
|
5
|
+
export type { TaskDuplicateInput, TaskDuplicateResult, TaskDuplicateVerdict } from './schema.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { evaluateChoice } from '../../src/decisions.js';
|
|
2
|
+
import { taskDuplicateInputSchema, taskDuplicateResultSchema } from './schema.js';
|
|
3
|
+
export async function taskDuplicate(input, options = {}) {
|
|
4
|
+
const { minConfidence = 0.8, ...state } = taskDuplicateInputSchema.parse(input);
|
|
5
|
+
const decision = await evaluateChoice(state, 'Do firstTask and secondTask request the same completed outcome under the same scope in context? Compare targets, deliverables, time periods, and constraints, not just wording or methods. Different methods can produce the same requested outcome. The same method applied to different targets is not duplicate work. Choose duplicate only when completing either task would fully satisfy the other; use overlapping when shared requested work leaves a material requirement unique to at least one task. Do not assume that matching titles identify the same task.', {
|
|
6
|
+
duplicate: 'Completing either task would fully satisfy the other under the same scope and constraints.',
|
|
7
|
+
overlapping: 'The tasks share requested work, but at least one includes material work the other does not.',
|
|
8
|
+
distinct: 'The tasks have separate requested outcomes or incompatible scopes with no shared requested work.',
|
|
9
|
+
unclear: 'Their targets, scope, or intended outcomes cannot be compared from the supplied information.',
|
|
10
|
+
}, options);
|
|
11
|
+
return taskDuplicateResultSchema.parse({
|
|
12
|
+
...decision,
|
|
13
|
+
status: decision.confidence < minConfidence || decision.verdict === 'unclear' ? 'review' : 'ready',
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
export { taskDuplicateInputSchema, taskDuplicateResultSchema, taskDuplicateVerdictSchema, } from './schema.js';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const taskDuplicateVerdictSchema: z.ZodEnum<{
|
|
3
|
+
duplicate: "duplicate";
|
|
4
|
+
unclear: "unclear";
|
|
5
|
+
overlapping: "overlapping";
|
|
6
|
+
distinct: "distinct";
|
|
7
|
+
}>;
|
|
8
|
+
export declare const taskDuplicateInputSchema: z.ZodObject<{
|
|
9
|
+
firstTask: z.ZodString;
|
|
10
|
+
secondTask: z.ZodString;
|
|
11
|
+
context: z.ZodOptional<z.ZodString>;
|
|
12
|
+
minConfidence: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export declare const taskDuplicateResultSchema: z.ZodObject<{
|
|
15
|
+
model: z.ZodString;
|
|
16
|
+
usage: z.ZodObject<{
|
|
17
|
+
input_tokens: z.ZodNumber;
|
|
18
|
+
output_tokens: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>;
|
|
20
|
+
status: z.ZodEnum<{
|
|
21
|
+
ready: "ready";
|
|
22
|
+
review: "review";
|
|
23
|
+
}>;
|
|
24
|
+
verdict: z.ZodEnum<{
|
|
25
|
+
duplicate: "duplicate";
|
|
26
|
+
unclear: "unclear";
|
|
27
|
+
overlapping: "overlapping";
|
|
28
|
+
distinct: "distinct";
|
|
29
|
+
}>;
|
|
30
|
+
confidence: z.ZodNumber;
|
|
31
|
+
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
32
|
+
duplicate: "duplicate";
|
|
33
|
+
unclear: "unclear";
|
|
34
|
+
overlapping: "overlapping";
|
|
35
|
+
distinct: "distinct";
|
|
36
|
+
}>, z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
export type TaskDuplicateInput = z.infer<typeof taskDuplicateInputSchema>;
|
|
39
|
+
export type TaskDuplicateResult = z.infer<typeof taskDuplicateResultSchema>;
|
|
40
|
+
export type TaskDuplicateVerdict = z.infer<typeof taskDuplicateVerdictSchema>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { decisionStatusSchema, nonEmptyText, probability, resultMetadataSchema, } from '../../src/schema.js';
|
|
3
|
+
export const taskDuplicateVerdictSchema = z.enum([
|
|
4
|
+
'duplicate',
|
|
5
|
+
'overlapping',
|
|
6
|
+
'distinct',
|
|
7
|
+
'unclear',
|
|
8
|
+
]);
|
|
9
|
+
export const taskDuplicateInputSchema = z.object({
|
|
10
|
+
firstTask: nonEmptyText.describe('The first task and its intended outcome.'),
|
|
11
|
+
secondTask: nonEmptyText.describe('The second task and its intended outcome.'),
|
|
12
|
+
context: nonEmptyText
|
|
13
|
+
.describe('Relevant targets, scope, time periods, and constraints for the comparison.')
|
|
14
|
+
.optional(),
|
|
15
|
+
minConfidence: probability.optional(),
|
|
16
|
+
});
|
|
17
|
+
export const taskDuplicateResultSchema = resultMetadataSchema.extend({
|
|
18
|
+
status: decisionStatusSchema,
|
|
19
|
+
verdict: taskDuplicateVerdictSchema,
|
|
20
|
+
confidence: probability,
|
|
21
|
+
probabilities: z.record(taskDuplicateVerdictSchema, probability),
|
|
22
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const topicShiftVerdictSchema: z.ZodEnum<{
|
|
3
3
|
unclear: "unclear";
|
|
4
|
+
mixed: "mixed";
|
|
4
5
|
same_topic: "same_topic";
|
|
5
6
|
new_topic: "new_topic";
|
|
6
|
-
mixed: "mixed";
|
|
7
7
|
}>;
|
|
8
8
|
export declare const topicShiftInputSchema: z.ZodObject<{
|
|
9
9
|
currentTopic: z.ZodString;
|
|
@@ -23,16 +23,16 @@ export declare const topicShiftResultSchema: z.ZodObject<{
|
|
|
23
23
|
}>;
|
|
24
24
|
verdict: z.ZodEnum<{
|
|
25
25
|
unclear: "unclear";
|
|
26
|
+
mixed: "mixed";
|
|
26
27
|
same_topic: "same_topic";
|
|
27
28
|
new_topic: "new_topic";
|
|
28
|
-
mixed: "mixed";
|
|
29
29
|
}>;
|
|
30
30
|
confidence: z.ZodNumber;
|
|
31
31
|
probabilities: z.ZodRecord<z.ZodEnum<{
|
|
32
32
|
unclear: "unclear";
|
|
33
|
+
mixed: "mixed";
|
|
33
34
|
same_topic: "same_topic";
|
|
34
35
|
new_topic: "new_topic";
|
|
35
|
-
mixed: "mixed";
|
|
36
36
|
}>, z.ZodNumber>;
|
|
37
37
|
}, z.core.$strip>;
|
|
38
38
|
export type TopicShiftInput = z.infer<typeof topicShiftInputSchema>;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -32,10 +32,14 @@ export { citationMatch, citationMatchInputSchema, citationMatchResultSchema, } f
|
|
|
32
32
|
export type { CitationMatchInput, CitationMatchResult } from '../recipes/citation-match/index.js';
|
|
33
33
|
export { citationNeeded, citationNeededInputSchema, citationNeededResultSchema, citationNeededVerdictSchema, } from '../recipes/citation-needed/index.js';
|
|
34
34
|
export type { CitationNeededInput, CitationNeededResult, CitationNeededVerdict, } from '../recipes/citation-needed/index.js';
|
|
35
|
+
export { claimStance, claimStanceInputSchema, claimStanceResultSchema, claimStanceVerdictSchema, } from '../recipes/claim-stance/index.js';
|
|
36
|
+
export type { ClaimStanceInput, ClaimStanceResult, ClaimStanceVerdict, } from '../recipes/claim-stance/index.js';
|
|
35
37
|
export { clarify, clarifyInputSchema, clarifyResultSchema } from '../recipes/clarify/index.js';
|
|
36
38
|
export type { ClarifyInput, ClarifyRequirement, ClarifyResult, RequirementVerdict, } from '../recipes/clarify/index.js';
|
|
37
39
|
export { confirmationMatch, confirmationMatchInputSchema, confirmationMatchResultSchema, confirmationMatchVerdictSchema, } from '../recipes/confirmation-match/index.js';
|
|
38
40
|
export type { ConfirmationMatchInput, ConfirmationMatchResult, ConfirmationMatchVerdict, } from '../recipes/confirmation-match/index.js';
|
|
41
|
+
export { constraintStrength, constraintStrengthInputSchema, constraintStrengthResultSchema, constraintStrengthVerdictSchema, } from '../recipes/constraint-strength/index.js';
|
|
42
|
+
export type { ConstraintStrengthInput, ConstraintStrengthResult, ConstraintStrengthVerdict, } from '../recipes/constraint-strength/index.js';
|
|
39
43
|
export { contextRole, contextRoleInputSchema, contextRoleResultSchema, contextRoleVerdictSchema, } from '../recipes/context-role/index.js';
|
|
40
44
|
export type { ContextRoleInput, ContextRoleResult, ContextRoleVerdict, } from '../recipes/context-role/index.js';
|
|
41
45
|
export { correctionTarget, correctionTargetInputSchema, correctionTargetResultSchema, } from '../recipes/correction-target/index.js';
|
|
@@ -66,6 +70,8 @@ export { handoff, handoffInputSchema, handoffResultSchema } from '../recipes/han
|
|
|
66
70
|
export type { HandoffInput, HandoffResult, HandoffRule, HandoffVerdict, } from '../recipes/handoff/index.js';
|
|
67
71
|
export { incidentMatch, incidentMatchInputSchema, incidentMatchResultSchema, } from '../recipes/incident-match/index.js';
|
|
68
72
|
export type { IncidentMatchInput, IncidentMatchResult } from '../recipes/incident-match/index.js';
|
|
73
|
+
export { instructionConflict, instructionConflictInputSchema, instructionConflictResultSchema, instructionConflictVerdictSchema, } from '../recipes/instruction-conflict/index.js';
|
|
74
|
+
export type { InstructionConflictInput, InstructionConflictResult, InstructionConflictVerdict, } from '../recipes/instruction-conflict/index.js';
|
|
69
75
|
export { instructionFit, instructionFitInputSchema, instructionFitResultSchema, instructionFitVerdictSchema, } from '../recipes/instruction-fit/index.js';
|
|
70
76
|
export type { InstructionFitInput, InstructionFitResult, InstructionFitVerdict, } from '../recipes/instruction-fit/index.js';
|
|
71
77
|
export { intentChange, intentChangeInputSchema, intentChangeResultSchema, intentChangeVerdictSchema, } from '../recipes/intent-change/index.js';
|
|
@@ -94,6 +100,8 @@ export { repeatedAttempt, repeatedAttemptInputSchema, repeatedAttemptResultSchem
|
|
|
94
100
|
export type { RepeatedAttemptInput, RepeatedAttemptResult, RepeatedAttemptVerdict, } from '../recipes/repeated-attempt/index.js';
|
|
95
101
|
export { replyTemplateMatch, replyTemplateMatchInputSchema, replyTemplateMatchResultSchema, } from '../recipes/reply-template-match/index.js';
|
|
96
102
|
export type { ReplyTemplateMatchInput, ReplyTemplateMatchResult, } from '../recipes/reply-template-match/index.js';
|
|
103
|
+
export { requirementTestability, requirementTestabilityInputSchema, requirementTestabilityResultSchema, requirementTestabilityVerdictSchema, } from '../recipes/requirement-testability/index.js';
|
|
104
|
+
export type { RequirementTestabilityInput, RequirementTestabilityResult, RequirementTestabilityVerdict, } from '../recipes/requirement-testability/index.js';
|
|
97
105
|
export { rerank, rerankInputSchema, rerankResultSchema } from '../recipes/rerank/index.js';
|
|
98
106
|
export type { RerankInput, RerankItem, RerankResult } from '../recipes/rerank/index.js';
|
|
99
107
|
export { resolutionCheck, resolutionCheckInputSchema, resolutionCheckResultSchema, resolutionCheckVerdictSchema, } from '../recipes/resolution-check/index.js';
|
|
@@ -116,6 +124,10 @@ export { stepProgress, stepProgressInputSchema, stepProgressResultSchema, stepPr
|
|
|
116
124
|
export type { StepProgressInput, StepProgressResult, StepProgressVerdict, } from '../recipes/step-progress/index.js';
|
|
117
125
|
export { summaryCoverage, summaryCoverageInputSchema, summaryCoverageResultSchema, summaryCoverageVerdictSchema, } from '../recipes/summary-coverage/index.js';
|
|
118
126
|
export type { SummaryCoverageInput, SummaryCoverageResult, SummaryCoverageVerdict, } from '../recipes/summary-coverage/index.js';
|
|
127
|
+
export { taskDependency, taskDependencyInputSchema, taskDependencyResultSchema, taskDependencyVerdictSchema, } from '../recipes/task-dependency/index.js';
|
|
128
|
+
export type { TaskDependencyInput, TaskDependencyResult, TaskDependencyVerdict, } from '../recipes/task-dependency/index.js';
|
|
129
|
+
export { taskDuplicate, taskDuplicateInputSchema, taskDuplicateResultSchema, taskDuplicateVerdictSchema, } from '../recipes/task-duplicate/index.js';
|
|
130
|
+
export type { TaskDuplicateInput, TaskDuplicateResult, TaskDuplicateVerdict, } from '../recipes/task-duplicate/index.js';
|
|
119
131
|
export { ticketMatch, ticketMatchInputSchema, ticketMatchResultSchema, ticketMatchVerdictSchema, } from '../recipes/ticket-match/index.js';
|
|
120
132
|
export type { TicketMatchInput, TicketMatchResult, TicketMatchVerdict, } from '../recipes/ticket-match/index.js';
|
|
121
133
|
export { toneCheck, toneCheckInputSchema, toneCheckResultSchema, toneCheckVerdictSchema, } from '../recipes/tone-check/index.js';
|