@actuarial-ts/agents 0.6.0 → 0.7.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/README.md +7 -5
- package/dist/diagnostics.d.ts +32 -27
- package/dist/diagnostics.d.ts.map +1 -1
- package/dist/diagnostics.js +604 -41
- package/dist/diagnostics.js.map +1 -1
- package/dist/divergence.d.ts.map +1 -1
- package/dist/divergence.js +30 -10
- package/dist/divergence.js.map +1 -1
- package/dist/judgment.d.ts +75 -2
- package/dist/judgment.d.ts.map +1 -1
- package/dist/judgment.js +28 -10
- package/dist/judgment.js.map +1 -1
- package/dist/remote.d.ts +5 -5
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +27 -11
- package/dist/tools.js.map +1 -1
- package/package.json +7 -6
- package/src/diagnostics.ts +819 -57
- package/src/divergence.ts +73 -29
- package/src/judgment.ts +56 -20
- package/src/tools.ts +211 -38
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Mastra tools and human-gated workflows for actuarial-ts. It is an orchestration boundary around the other four packages, not an autonomous actuary.
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
|
-
npm install @actuarial-ts/agents@0.
|
|
6
|
+
npm install @actuarial-ts/agents@0.7.0 @actuarial-ts/core@0.7.0 @actuarial-ts/data@0.7.0 @actuarial-ts/interchange@0.7.0 @actuarial-ts/compliance@0.7.0 @mastra/core@^1.51.0 @mastra/mcp@^1.14.0 zod@^3.25.76
|
|
7
7
|
```
|
|
8
8
|
|
|
9
9
|
Requires Node 22.13+. Peer ranges are `@mastra/core >=1.51.0 <2`, `@mastra/mcp >=1.14.0 <2`, and Zod `^3.25.76`.
|
|
@@ -17,11 +17,11 @@ import { createDiagnosticSelectionTool } from "@actuarial-ts/agents";
|
|
|
17
17
|
|
|
18
18
|
const tool = createDiagnosticSelectionTool({
|
|
19
19
|
definition: compiledDefinition,
|
|
20
|
-
|
|
20
|
+
runPresets: [{
|
|
21
21
|
id: "annual-review-v1",
|
|
22
22
|
definitionIntegrity: compiledDefinition.definitionIntegrity,
|
|
23
23
|
allowedInstanceIds: ["casualty/count/reported-frequency"],
|
|
24
|
-
execute: ({
|
|
24
|
+
execute: ({ tenantId, instanceIds }) => runApprovedPreset({ tenantId, instanceIds }),
|
|
25
25
|
}],
|
|
26
26
|
});
|
|
27
27
|
```
|
|
@@ -38,7 +38,9 @@ type DiagnosticAgentToolInput = {
|
|
|
38
38
|
|
|
39
39
|
It cannot contain formulas, measures, count populations, amount/exposure bases, missingness, period axes, arbitrary filters, provenance, or project/tenant IDs. The executor must return owner-authenticated `VerifiedDiagnosticRunProvenance` stamped for the exact definition, preset, and sorted selection; a cached superset is rejected rather than display-filtered into an apparent run.
|
|
40
40
|
|
|
41
|
-
Success returns formula/calculation/definition identities, run/result/binding fingerprints, the full review receipt (including triggered and not-evaluated rules), and one explicitly display-only projection.
|
|
41
|
+
Success returns `{ success: true, data: { ... } }`. The `data` object contains formula/calculation/definition identities, run/result/binding fingerprints, the full review receipt (including triggered and not-evaluated rules), and one explicitly display-only projection. `data.display.points` holds emergence or latest-diagonal points; `data.display.triangles` holds the triangle view. Display points retain reviewed metric evaluations and findings while omitting the raw aggregate `components` field. Failures remain `{ success: false, error: { code, message } }`.
|
|
42
|
+
|
|
43
|
+
The v0.6.1 correction uses `runPresets` in the host catalog and `tenantId` in the host executor input. Migrate the earlier `presets`, `tenant`, flattened success fields, and `display.value` names to the contract above. There is no definition-editing path; changing a basis or rule requires a separate human-governed workflow.
|
|
42
44
|
|
|
43
45
|
## Tool boundary
|
|
44
46
|
|
|
@@ -52,7 +54,7 @@ In 0.6 the public `DefinedActuarialTool<TInput, TOutput>` execute accepts raw `z
|
|
|
52
54
|
|
|
53
55
|
The package’s offline test suite covers trusted catalog selection, direct/Mastra-shaped execution, tenant failure, once-only transforms, provenance coherence, judgment gates, remote sidecar behavior, promotion, and golden-prompt tool selection.
|
|
54
56
|
|
|
55
|
-
See the [formula catalog](https://github.com/yerromnitsuj/actng/blob/v0.
|
|
57
|
+
See the [formula catalog](https://github.com/yerromnitsuj/actng/blob/v0.7.0/docs/reference/diagnostic-formulas.md) and [migration guide](https://github.com/yerromnitsuj/actng/blob/v0.7.0/docs/migrations/0.6-generalized-diagnostics.md).
|
|
56
58
|
|
|
57
59
|
## License
|
|
58
60
|
|
package/dist/diagnostics.d.ts
CHANGED
|
@@ -3,58 +3,63 @@ import { type VerifiedDiagnosticRunProvenance } from "@actuarial-ts/compliance";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { type DefinedActuarialTool, type ToolEnvelopeFailure } from "./tools.js";
|
|
5
5
|
export declare const diagnosticAgentToolInputSchema: z.ZodObject<{
|
|
6
|
-
runPresetId: z.ZodString
|
|
7
|
-
instanceIds: z.
|
|
6
|
+
runPresetId: z.ZodEffects<z.ZodString, string, string>;
|
|
7
|
+
instanceIds: z.ZodType<readonly string[], z.ZodTypeDef, readonly string[]>;
|
|
8
8
|
view: z.ZodEnum<["emergence", "triangles", "latest-diagonal"]>;
|
|
9
9
|
}, "strict", z.ZodTypeAny, {
|
|
10
10
|
runPresetId: string;
|
|
11
|
-
instanceIds: string[];
|
|
11
|
+
instanceIds: readonly string[];
|
|
12
12
|
view: "emergence" | "triangles" | "latest-diagonal";
|
|
13
13
|
}, {
|
|
14
14
|
runPresetId: string;
|
|
15
|
-
instanceIds: string[];
|
|
15
|
+
instanceIds: readonly string[];
|
|
16
16
|
view: "emergence" | "triangles" | "latest-diagonal";
|
|
17
17
|
}>;
|
|
18
|
-
export type
|
|
18
|
+
export type DiagnosticAgentView = "emergence" | "triangles" | "latest-diagonal";
|
|
19
|
+
export interface DiagnosticAgentToolInput {
|
|
20
|
+
readonly runPresetId: string;
|
|
21
|
+
readonly instanceIds: readonly string[];
|
|
22
|
+
readonly view: DiagnosticAgentView;
|
|
23
|
+
}
|
|
24
|
+
export interface DiagnosticAgentPresetExecutionInput {
|
|
25
|
+
readonly tenantId: string;
|
|
26
|
+
readonly instanceIds: readonly string[];
|
|
27
|
+
}
|
|
19
28
|
export interface DiagnosticAgentRunPreset {
|
|
20
29
|
readonly id: string;
|
|
21
30
|
readonly definitionIntegrity: string;
|
|
22
31
|
readonly allowedInstanceIds: readonly string[];
|
|
23
|
-
readonly execute: (input:
|
|
24
|
-
readonly tenant: string;
|
|
25
|
-
readonly instanceIds: readonly string[];
|
|
26
|
-
}) => Promise<VerifiedDiagnosticRunProvenance>;
|
|
32
|
+
readonly execute: (input: DiagnosticAgentPresetExecutionInput) => Promise<VerifiedDiagnosticRunProvenance>;
|
|
27
33
|
}
|
|
28
34
|
export interface CreateDiagnosticSelectionToolInput {
|
|
29
35
|
readonly definition: CompiledDiagnosticDefinition;
|
|
30
|
-
readonly
|
|
36
|
+
readonly runPresets: readonly DiagnosticAgentRunPreset[];
|
|
31
37
|
readonly id?: string;
|
|
32
38
|
readonly description?: string;
|
|
33
39
|
readonly tenantContextKey?: string;
|
|
34
40
|
}
|
|
35
41
|
export type DiagnosticAgentDisplayProjection = {
|
|
36
|
-
readonly view: "emergence";
|
|
37
|
-
readonly
|
|
42
|
+
readonly view: "emergence" | "latest-diagonal";
|
|
43
|
+
readonly points: readonly DiagnosticAgentDisplayPoint[];
|
|
38
44
|
} | {
|
|
39
45
|
readonly view: "triangles";
|
|
40
|
-
readonly
|
|
41
|
-
} | {
|
|
42
|
-
readonly view: "latest-diagonal";
|
|
43
|
-
readonly value: VerifiedDiagnosticRunProvenance["result"]["latestDiagonal"];
|
|
46
|
+
readonly triangles: VerifiedDiagnosticRunProvenance["result"]["triangles"];
|
|
44
47
|
};
|
|
45
|
-
export type DiagnosticAgentDisplayPoint = VerifiedDiagnosticRunProvenance["result"]["emergence"][number]
|
|
48
|
+
export type DiagnosticAgentDisplayPoint = Omit<VerifiedDiagnosticRunProvenance["result"]["emergence"][number], "components">;
|
|
46
49
|
export interface DiagnosticAgentToolSuccess {
|
|
47
50
|
readonly success: true;
|
|
48
|
-
readonly
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
51
|
+
readonly data: {
|
|
52
|
+
readonly runPresetId: string;
|
|
53
|
+
readonly instanceIds: readonly string[];
|
|
54
|
+
readonly definitionIntegrity: string;
|
|
55
|
+
readonly formulaFingerprints: Readonly<Record<string, string>>;
|
|
56
|
+
readonly calculationFingerprints: Readonly<Record<string, string>>;
|
|
57
|
+
readonly runFingerprint: string;
|
|
58
|
+
readonly resultFingerprint: string;
|
|
59
|
+
readonly runResultFingerprint: string;
|
|
60
|
+
readonly review: VerifiedDiagnosticRunProvenance["review"];
|
|
61
|
+
readonly display: DiagnosticAgentDisplayProjection;
|
|
62
|
+
};
|
|
58
63
|
}
|
|
59
64
|
export type DiagnosticAgentToolResult = DiagnosticDeepReadonly<DiagnosticAgentToolSuccess> | ToolEnvelopeFailure;
|
|
60
65
|
/** Strict model-visible output schema, including the wrapper's failure branch. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC5B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,+BAA+B,EACrC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAEL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,YAAY,CAAC;AAMpB,eAAO,MAAM,8BAA8B;;;;;;;;;;;;EAMhC,CAAC;AACZ,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAEhF,MAAM,WA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