create-quorum-router 0.1.13 → 0.1.15

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
@@ -13,11 +13,12 @@ cd my-quorum-router-demo
13
13
  deno --version
14
14
  deno task smoke
15
15
  deno task calibration:demo
16
+ deno task calibration:hierarchy-demo
16
17
  deno task intake
17
18
  deno task supabase:status
18
19
  ```
19
20
 
20
- Current package version: `create-quorum-router@0.1.13`. Releases are published
21
+ Current package version: `create-quorum-router@0.1.15`. Releases are published
21
22
  from an immutable Git tag through GitHub Actions OIDC Trusted Publishing.
22
23
 
23
24
  ## What the generated project supports
@@ -26,13 +27,17 @@ from an immutable Git tag through GitHub Actions OIDC Trusted Publishing.
26
27
  API.
27
28
 
28
29
  `deno task calibration:demo` runs the bundled flat calibration-by-task API
29
- against deterministic local observations. For narrower diagnostics, generated
30
- projects also export `aggregateHierarchicalTaskCalibration()` and
30
+ against deterministic local observations. `deno task calibration:hierarchy-demo`
31
+ runs three deterministic scenarios that select at the prompt-pattern level, then
32
+ fall back to task subtype, then task type as narrower sample buckets become
33
+ insufficient. Generated projects also export
34
+ `aggregateHierarchicalTaskCalibration()` and
31
35
  `resolveHierarchicalTaskCalibration()` with
32
36
  `prompt_pattern → task_subtype → task_type` sample-count fallback. Reports are
33
37
  advisory-only and are not connected to routing weights, provider eligibility, or
34
- execution. The command does not call provider APIs; on a new Deno installation,
35
- its first run resolves the pinned Zod dependency before execution.
38
+ execution. Both demos are local-only; the hierarchy demo does not call provider
39
+ APIs. On a new Deno installation, the first run resolves the pinned Zod
40
+ dependency before execution.
36
41
 
37
42
  `deno task intake` is the first real setup command. It detects local provider
38
43
  wrappers, checks OAuth/session status, runs safe list-only model inventory where
@@ -43,6 +48,7 @@ the next command.
43
48
  deno task check
44
49
  deno task smoke
45
50
  deno task calibration:demo
51
+ deno task calibration:hierarchy-demo
46
52
  deno task intake
47
53
  deno task auth:status
48
54
  deno task auth:login
@@ -3,7 +3,7 @@ const fs = require("fs");
3
3
  const path = require("path");
4
4
  const { spawnSync } = require("child_process");
5
5
 
6
- const VERSION = "0.1.13";
6
+ const VERSION = "0.1.15";
7
7
  const SUPPORTED_TEMPLATES = new Set(["basic"]);
8
8
 
9
9
  function usage() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-quorum-router",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "description": "Create a local QuorumRouter project.",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -1,7 +1,7 @@
1
1
  # QuorumRouter generated workspace
2
2
 
3
3
  This generated workspace contains the MIT-licensed QuorumRouter current release.
4
- npm latest targets v0.1.13.
4
+ npm latest targets v0.1.15.
5
5
 
6
6
  QuorumRouter is **MIT**. It is **open source**. Commercial and production use
7
7
  are permitted under the MIT License.
@@ -38,6 +38,7 @@ deno --version
38
38
  ```bash
39
39
  deno task smoke
40
40
  deno task calibration:demo
41
+ deno task calibration:hierarchy-demo
41
42
  deno task intake
42
43
  deno task auth:status
43
44
  deno task models:list
@@ -48,15 +49,18 @@ deno task supabase:status
48
49
  `smoke` proves the local scaffold runs with deterministic fixtures only. It does
49
50
  **not** call a real provider API.
50
51
 
51
- `calibration:demo` exercises the bundled calibration-by-task API with local
52
- fixture observations. Calibration reports are advisory-only: the scaffold does
53
- not use them to change routing weights, ranks, provider eligibility, quorum, or
54
- execution. The command does not call provider APIs; on a new Deno installation,
55
- its first run resolves the pinned Zod dependency before execution.
56
-
57
- For narrower diagnostics, import `aggregateHierarchicalTaskCalibration()` and
58
- `resolveHierarchicalTaskCalibration()` from `src/calibration.ts`. For example,
59
- classify an observation with `task_type: "code_review"`,
52
+ `calibration:demo` exercises the bundled flat calibration-by-task API with local
53
+ fixture observations. `calibration:hierarchy-demo` runs three deterministic
54
+ queries that select a sufficient prompt-pattern group, fall back to task
55
+ subtype, and fall back again to task type. Calibration reports are
56
+ advisory-only: the scaffold does not use them to change routing weights, ranks,
57
+ provider eligibility, quorum, or execution. Both demos are local-only; the
58
+ hierarchy demo does not call provider APIs. On a new Deno installation, the
59
+ first run resolves the pinned Zod dependency before execution.
60
+
61
+ The hierarchical demo uses `aggregateHierarchicalTaskCalibration()` and
62
+ `resolveHierarchicalTaskCalibration()` from `src/calibration.ts`. Its
63
+ observations use caller-defined categories such as `task_type: "code-review"`,
60
64
  `task_subtype: "typescript"`, and `prompt_pattern: "schema-boundary-review"`.
61
65
  Resolution checks `prompt_pattern → task_subtype → task_type`, using the first
62
66
  group that reaches the configured sample threshold. Groups never cross exact
@@ -7,6 +7,7 @@
7
7
  "check": "deno check main.ts src/*.ts",
8
8
  "smoke": "deno run main.ts",
9
9
  "calibration:demo": "deno run src/calibration_demo.ts",
10
+ "calibration:hierarchy-demo": "deno run src/hierarchical_calibration_demo.ts",
10
11
  "intake": "deno run --allow-read --allow-write --allow-env --allow-net --allow-run=grok,codex,claude,gemini,devin src/cli.ts intake",
11
12
  "auth:status": "deno run --allow-read --allow-env --allow-run=grok,codex,claude,gemini,devin src/cli.ts auth:status",
12
13
  "auth:login": "deno run src/cli.ts auth:login",
@@ -0,0 +1,132 @@
1
+ import {
2
+ aggregateHierarchicalTaskCalibration,
3
+ resolveHierarchicalTaskCalibration,
4
+ } from "./calibration.ts";
5
+
6
+ const evaluated_at = "2026-07-14T00:00:00Z";
7
+ const source = { provider: "OpenAI", model: "example-model" } as const;
8
+ const observations = [
9
+ {
10
+ observation_id: "hierarchy-demo-pattern-1",
11
+ task_type: "code-review",
12
+ task_subtype: "typescript",
13
+ prompt_pattern: "schema-boundary-review",
14
+ source,
15
+ evaluation_basis: "caller_attested_external_ground_truth",
16
+ correct: true,
17
+ confidence: 0.9,
18
+ evaluated_at,
19
+ },
20
+ {
21
+ observation_id: "hierarchy-demo-pattern-2",
22
+ task_type: "code-review",
23
+ task_subtype: "typescript",
24
+ prompt_pattern: "schema-boundary-review",
25
+ source,
26
+ evaluation_basis: "caller_attested_external_ground_truth",
27
+ correct: true,
28
+ confidence: 0.8,
29
+ evaluated_at,
30
+ },
31
+ {
32
+ observation_id: "hierarchy-demo-pattern-3",
33
+ task_type: "code-review",
34
+ task_subtype: "typescript",
35
+ prompt_pattern: "schema-boundary-review",
36
+ source,
37
+ evaluation_basis: "caller_attested_external_ground_truth",
38
+ correct: false,
39
+ confidence: 0.7,
40
+ evaluated_at,
41
+ },
42
+ {
43
+ observation_id: "hierarchy-demo-subtype-1",
44
+ task_type: "code-review",
45
+ task_subtype: "typescript",
46
+ prompt_pattern: "concurrency-review",
47
+ source,
48
+ evaluation_basis: "caller_attested_external_ground_truth",
49
+ correct: true,
50
+ confidence: 0.8,
51
+ evaluated_at,
52
+ },
53
+ {
54
+ observation_id: "hierarchy-demo-parent-1",
55
+ task_type: "code-review",
56
+ task_subtype: "rust",
57
+ prompt_pattern: "unsafe-boundary-review",
58
+ source,
59
+ evaluation_basis: "caller_attested_external_ground_truth",
60
+ correct: true,
61
+ confidence: 0.7,
62
+ evaluated_at,
63
+ },
64
+ {
65
+ observation_id: "hierarchy-demo-foreign-1",
66
+ task_type: "code-review",
67
+ task_subtype: "typescript",
68
+ prompt_pattern: "schema-boundary-review",
69
+ source: { provider: "Anthropic", model: "example-model" },
70
+ evaluation_basis: "caller_attested_external_ground_truth",
71
+ correct: true,
72
+ confidence: 0.75,
73
+ evaluated_at,
74
+ },
75
+ ];
76
+
77
+ const report = aggregateHierarchicalTaskCalibration(observations, {
78
+ minimum_sample_count: 3,
79
+ });
80
+ const scenarios = [
81
+ {
82
+ name: "pattern-sufficient",
83
+ query: {
84
+ task_type: "code-review",
85
+ task_subtype: "typescript",
86
+ prompt_pattern: "schema-boundary-review",
87
+ source,
88
+ },
89
+ },
90
+ {
91
+ name: "fallback-to-subtype",
92
+ query: {
93
+ task_type: "code-review",
94
+ task_subtype: "typescript",
95
+ prompt_pattern: "concurrency-review",
96
+ source,
97
+ },
98
+ },
99
+ {
100
+ name: "fallback-to-task",
101
+ query: {
102
+ task_type: "code-review",
103
+ task_subtype: "rust",
104
+ prompt_pattern: "unsafe-boundary-review",
105
+ source,
106
+ },
107
+ },
108
+ ].map(({ name, query }) => {
109
+ const selection = resolveHierarchicalTaskCalibration(report, query);
110
+ return {
111
+ name,
112
+ query,
113
+ candidates: selection.candidates,
114
+ resolution_status: selection.resolution_status,
115
+ selected_scope: selection.selected_scope,
116
+ selected_sample_count: selection.selected_group?.sample_count ?? null,
117
+ };
118
+ });
119
+
120
+ console.log(JSON.stringify(
121
+ {
122
+ schema_version: "quorum-router.hierarchical-demo.v1",
123
+ advisory_only: true,
124
+ provider_request_sent: false,
125
+ fallback_order: ["prompt_pattern", "task_subtype", "task_type"],
126
+ minimum_sample_count: report.minimum_sample_count,
127
+ observation_count: observations.length,
128
+ scenarios,
129
+ },
130
+ null,
131
+ 2,
132
+ ));