eyeling 1.22.2 → 1.22.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/arcling/README.md +37 -168
- package/package.json +2 -3
- package/examples/arcling/calidor/calidor.data.json +0 -79
- package/examples/arcling/calidor/calidor.expected.json +0 -94
- package/examples/arcling/calidor/calidor.model.go +0 -612
- package/examples/arcling/calidor/calidor.spec.md +0 -166
- package/examples/arcling/delfour/delfour.data.json +0 -67
- package/examples/arcling/delfour/delfour.expected.json +0 -88
- package/examples/arcling/delfour/delfour.model.go +0 -564
- package/examples/arcling/delfour/delfour.spec.md +0 -117
- package/examples/arcling/flandor/flandor.data.json +0 -106
- package/examples/arcling/flandor/flandor.expected.json +0 -98
- package/examples/arcling/flandor/flandor.model.go +0 -655
- package/examples/arcling/flandor/flandor.spec.md +0 -155
- package/examples/arcling/medior/medior.data.json +0 -96
- package/examples/arcling/medior/medior.expected.json +0 -100
- package/examples/arcling/medior/medior.model.go +0 -652
- package/examples/arcling/medior/medior.spec.md +0 -157
- package/test/arcling.test.js +0 -191
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
# Calidor — ARC Specification
|
|
2
|
-
|
|
3
|
-
## Status
|
|
4
|
-
|
|
5
|
-
This document is the normative specification for the Calidor case. The file `calidor.model.go` is the reference Go implementation of these clauses. The file `calidor.data.json` is the instance evaluated in this bundle. The file `calidor.expected.json` is the conformance vector for that instance.
|
|
6
|
-
|
|
7
|
-
## Insight Economy context
|
|
8
|
-
|
|
9
|
-
This case models municipal heatwave support. A household gateway observes local indoor heat stress, local vulnerability signals, and local prepaid-energy stress. Those raw details remain local. The system shares only a narrow, expiring insight that the household qualifies for priority cooling support during the current heat-alert window.
|
|
10
|
-
|
|
11
|
-
The city may use that insight for heatwave response. It may not reuse it for unrelated purposes such as tenant screening.
|
|
12
|
-
|
|
13
|
-
## Conventions
|
|
14
|
-
|
|
15
|
-
- “iff” means “if and only if”.
|
|
16
|
-
- A clause identifier such as `R1` or `G2` is normative.
|
|
17
|
-
- A conforming implementation may be written in any language, but it shall produce the same derived values and pass/fail outcomes for the supplied instance.
|
|
18
|
-
- The reference implementation in this bundle is written in Go.
|
|
19
|
-
- Input validation is part of the reference model. A malformed instance shall fail before evaluation.
|
|
20
|
-
|
|
21
|
-
## Vocabulary
|
|
22
|
-
|
|
23
|
-
**V1. Heat alert** is the municipal emergency context.
|
|
24
|
-
|
|
25
|
-
**V2. Unsafe indoor heat** is sustained indoor temperature at or above the configured threshold.
|
|
26
|
-
|
|
27
|
-
**V3. Vulnerability presence** is the existence of at least one local heat-sensitivity or mobility-related flag.
|
|
28
|
-
|
|
29
|
-
**V4. Energy constraint** is insufficient prepaid energy credit to sustain cooling use.
|
|
30
|
-
|
|
31
|
-
**V5. Support package** is a municipal assistance option with a cost and a set of capabilities.
|
|
32
|
-
|
|
33
|
-
**V6. Insight envelope** is the ordered pair `(insight, policy)` together with integrity metadata.
|
|
34
|
-
|
|
35
|
-
## Input instance
|
|
36
|
-
|
|
37
|
-
**I1.** The municipality is `Calidor`.
|
|
38
|
-
|
|
39
|
-
**I2.** The current heat alert level is `4`.
|
|
40
|
-
|
|
41
|
-
**I3.** The alert threshold is `3`.
|
|
42
|
-
|
|
43
|
-
**I4.** The current indoor temperature is `31.4` °C.
|
|
44
|
-
|
|
45
|
-
**I5.** Unsafe indoor heat requires at least `30.0` °C for at least `6` hours.
|
|
46
|
-
|
|
47
|
-
**I6.** The household has local vulnerability flags.
|
|
48
|
-
|
|
49
|
-
**I7.** Remaining prepaid energy credit is `3.2` EUR.
|
|
50
|
-
|
|
51
|
-
**I8.** Energy constraint holds at or below `5.0` EUR.
|
|
52
|
-
|
|
53
|
-
**I9.** Priority cooling support requires at least `3` active needs.
|
|
54
|
-
|
|
55
|
-
**I10.** The support catalog is the one listed in `calidor.data.json`.
|
|
56
|
-
|
|
57
|
-
## Derivation clauses
|
|
58
|
-
|
|
59
|
-
**R1. HeatAlertActive.** `HeatAlertActive` holds iff `currentAlertLevel ≥ alertLevelAtLeast`.
|
|
60
|
-
|
|
61
|
-
**R2. UnsafeIndoorHeat.** `UnsafeIndoorHeat` holds iff:
|
|
62
|
-
|
|
63
|
-
1. `currentIndoorTempC ≥ indoorTempCAtLeast`; and
|
|
64
|
-
2. `hoursAtOrAboveThreshold ≥ hoursAtOrAboveThresholdAtLeast`.
|
|
65
|
-
|
|
66
|
-
**R3. VulnerabilityPresent.** `VulnerabilityPresent` holds iff the local vulnerability flag list is non-empty.
|
|
67
|
-
|
|
68
|
-
**R4. EnergyConstraint.** `EnergyConstraint` holds iff `remainingPrepaidCreditEur ≤ energyCreditEurAtMost`.
|
|
69
|
-
|
|
70
|
-
**R5. ActiveNeedCount.** `ActiveNeedCount` is the number of true predicates among:
|
|
71
|
-
|
|
72
|
-
- `HeatAlertActive`
|
|
73
|
-
- `UnsafeIndoorHeat`
|
|
74
|
-
- `VulnerabilityPresent`
|
|
75
|
-
- `EnergyConstraint`
|
|
76
|
-
|
|
77
|
-
**R6. PriorityCoolingSupportNeeded.** `PriorityCoolingSupportNeeded` holds iff `ActiveNeedCount ≥ minimumActiveNeedCount`.
|
|
78
|
-
|
|
79
|
-
**R7. RequiredCapabilities.** The required capability set is formed as follows:
|
|
80
|
-
|
|
81
|
-
1. if `HeatAlertActive` and `UnsafeIndoorHeat`, include `cooling_kit`;
|
|
82
|
-
2. if `VulnerabilityPresent`, include `welfare_check` and `transport`;
|
|
83
|
-
3. if `EnergyConstraint`, include `bill_credit`.
|
|
84
|
-
|
|
85
|
-
The resulting set is sorted lexically for reporting.
|
|
86
|
-
|
|
87
|
-
**R8. EligiblePackage(p).** For a package `p`, `EligiblePackage(p)` holds iff:
|
|
88
|
-
|
|
89
|
-
1. `p.costEur ≤ maxPackageCostEur`; and
|
|
90
|
-
2. `p.capabilities` cover every entry in `RequiredCapabilities`.
|
|
91
|
-
|
|
92
|
-
**R9. RecommendedPackage.** `RecommendedPackage` is the eligible package with minimum `costEur`, breaking ties lexically by `id`.
|
|
93
|
-
|
|
94
|
-
## Governance clauses
|
|
95
|
-
|
|
96
|
-
**G1. AuthorizedUse.** `AuthorizedUse` holds iff:
|
|
97
|
-
|
|
98
|
-
1. the requested action is `odrl:use`;
|
|
99
|
-
2. the requested purpose is `heatwave_response`; and
|
|
100
|
-
3. the authorization time is not later than the expiry time.
|
|
101
|
-
|
|
102
|
-
**G2. TenantScreeningProhibited.** `TenantScreeningProhibited` holds iff the policy prohibits distribution for purpose `tenant_screening`.
|
|
103
|
-
|
|
104
|
-
**G3. DutyTimely.** `DutyTimely` holds iff the duty-performance time is not later than the expiry time.
|
|
105
|
-
|
|
106
|
-
## Integrity and minimization clauses
|
|
107
|
-
|
|
108
|
-
**M1. CanonicalEnvelope.** The canonical envelope string is the JSON serialization of the ordered pair `(insight, policy)` with keys emitted in this exact sequence:
|
|
109
|
-
|
|
110
|
-
- insight: `createdAt`, `expiresAt`, `id`, `metric`, `municipality`, `scopeDevice`, `scopeEvent`, `supportPolicy`, `threshold`, `type`
|
|
111
|
-
- policy: `duty`, `permission`, `profile`, `prohibition`, `type`
|
|
112
|
-
|
|
113
|
-
For this case, `threshold` is serialized lexically as `3.0` rather than `3`, because the integrity vector is defined over those exact envelope bytes.
|
|
114
|
-
|
|
115
|
-
**M2. PayloadHashMatches.** `PayloadHashMatches` holds iff the model-computed SHA-256 of `CanonicalEnvelope` equals the expected SHA-256 value recorded in the conformance vector.
|
|
116
|
-
|
|
117
|
-
**M3. SignatureVerifies.** `SignatureVerifies` holds iff the model-computed HMAC-SHA-256 of `CanonicalEnvelope` equals the expected HMAC value recorded in the conformance vector.
|
|
118
|
-
|
|
119
|
-
**M4. MinimizationRespected.** `MinimizationRespected` holds iff the serialized insight contains none of the forbidden terms:
|
|
120
|
-
|
|
121
|
-
- `heat_sensitive_condition`
|
|
122
|
-
- `mobility_limitation`
|
|
123
|
-
- `credit`
|
|
124
|
-
- `meter_trace`
|
|
125
|
-
|
|
126
|
-
**M5. ScopeComplete.** `ScopeComplete` holds iff the insight contains `scopeDevice`, `scopeEvent`, and `expiresAt`.
|
|
127
|
-
|
|
128
|
-
## Output contract
|
|
129
|
-
|
|
130
|
-
**O1. Answer.** A conforming renderer shall expose:
|
|
131
|
-
|
|
132
|
-
- the main recommendation sentence
|
|
133
|
-
- recommended package
|
|
134
|
-
- required capabilities
|
|
135
|
-
- payload hash
|
|
136
|
-
- envelope HMAC
|
|
137
|
-
|
|
138
|
-
**O2. Reason Why.** A conforming renderer shall explain that raw household heat, vulnerability, and prepaid-energy details remain local and that only a narrow heatwave-response insight is shared.
|
|
139
|
-
|
|
140
|
-
**O3. Check.** A conforming renderer shall expose a named yes/no or PASS/FAIL outcome for each of:
|
|
141
|
-
|
|
142
|
-
- `signatureVerifies`
|
|
143
|
-
- `payloadHashMatches`
|
|
144
|
-
- `minimizationRespected`
|
|
145
|
-
- `scopeComplete`
|
|
146
|
-
- `authorizationAllowed`
|
|
147
|
-
- `heatAlertActive`
|
|
148
|
-
- `unsafeIndoorHeat`
|
|
149
|
-
- `priorityCoolingSupportNeeded`
|
|
150
|
-
- `recommendedPackageEligible`
|
|
151
|
-
- `dutyTimingConsistent`
|
|
152
|
-
- `tenantScreeningProhibited`
|
|
153
|
-
|
|
154
|
-
## Reference outcome for this instance
|
|
155
|
-
|
|
156
|
-
For the supplied instance:
|
|
157
|
-
|
|
158
|
-
- `HeatAlertActive = true`
|
|
159
|
-
- `UnsafeIndoorHeat = true`
|
|
160
|
-
- `VulnerabilityPresent = true`
|
|
161
|
-
- `EnergyConstraint = true`
|
|
162
|
-
- `ActiveNeedCount = 4`
|
|
163
|
-
- `PriorityCoolingSupportNeeded = true`
|
|
164
|
-
- `RecommendedPackage = "Calidor Priority Cooling Bundle"`
|
|
165
|
-
|
|
166
|
-
The expected ARC report and integrity values are recorded in `calidor.expected.json`.
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"caseName": "Delfour",
|
|
3
|
-
"retailer": "Delfour",
|
|
4
|
-
"question": "Is the Delfour self-scanner allowed to use a neutral shopping insight for shopping assistance, and if so what lower-sugar alternative should it suggest?",
|
|
5
|
-
"timestamps": {
|
|
6
|
-
"createdAt": "2025-10-05T20:33:48.907163+00:00",
|
|
7
|
-
"expiresAt": "2025-10-05T22:33:48.907185+00:00",
|
|
8
|
-
"authorizedAt": "2025-10-05T20:35:48.907163+00:00",
|
|
9
|
-
"dutyPerformedAt": "2025-10-05T20:37:48.907163+00:00"
|
|
10
|
-
},
|
|
11
|
-
"evaluationContext": {
|
|
12
|
-
"scopeDevice": "self-scanner",
|
|
13
|
-
"scopeEvent": "pick_up_scanner",
|
|
14
|
-
"purpose": "shopping_assist",
|
|
15
|
-
"prohibitedReusePurpose": "marketing",
|
|
16
|
-
"requestAction": "odrl:use"
|
|
17
|
-
},
|
|
18
|
-
"thresholds": {
|
|
19
|
-
"sugarPerServingGAtLeast": 10.0
|
|
20
|
-
},
|
|
21
|
-
"householdProfile": {
|
|
22
|
-
"condition": "Diabetes"
|
|
23
|
-
},
|
|
24
|
-
"catalog": [
|
|
25
|
-
{
|
|
26
|
-
"id": "prod:BIS_001",
|
|
27
|
-
"name": "Classic Tea Biscuits",
|
|
28
|
-
"sugarTenths": 120,
|
|
29
|
-
"sugarPerServing": 12.0
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"id": "prod:BIS_101",
|
|
33
|
-
"name": "Low-Sugar Tea Biscuits",
|
|
34
|
-
"sugarTenths": 30,
|
|
35
|
-
"sugarPerServing": 3.0
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"id": "prod:CHOC_050",
|
|
39
|
-
"name": "Milk Chocolate Bar",
|
|
40
|
-
"sugarTenths": 150,
|
|
41
|
-
"sugarPerServing": 15.0
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
"id": "prod:CHOC_150",
|
|
45
|
-
"name": "85% Dark Chocolate",
|
|
46
|
-
"sugarTenths": 60,
|
|
47
|
-
"sugarPerServing": 6.0
|
|
48
|
-
}
|
|
49
|
-
],
|
|
50
|
-
"scan": {
|
|
51
|
-
"scannedProductId": "prod:BIS_001"
|
|
52
|
-
},
|
|
53
|
-
"insightPolicy": {
|
|
54
|
-
"id": "https://example.org/insight/delfour",
|
|
55
|
-
"metric": "sugar_g_per_serving",
|
|
56
|
-
"type": "ins:Insight",
|
|
57
|
-
"suggestionPolicy": "lower_metric_first_higher_price_ok",
|
|
58
|
-
"policyType": "odrl:Policy",
|
|
59
|
-
"policyProfile": "Delfour-Insight-Policy"
|
|
60
|
-
},
|
|
61
|
-
"integrity": {
|
|
62
|
-
"hashAlgorithm": "SHA-256",
|
|
63
|
-
"macAlgorithm": "HMAC-SHA-256",
|
|
64
|
-
"secret": "neutral-insight-demo-shared-secret",
|
|
65
|
-
"verificationMode": "trustedPrecomputedInput"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"caseName": "Delfour",
|
|
3
|
-
"derived": {
|
|
4
|
-
"needsLowSugar": true,
|
|
5
|
-
"highSugarScanned": true,
|
|
6
|
-
"lowerSugarCandidateIds": ["prod:BIS_101", "prod:CHOC_150"],
|
|
7
|
-
"recommendedAlternativeId": "prod:BIS_101",
|
|
8
|
-
"recommendedAlternativeName": "Low-Sugar Tea Biscuits",
|
|
9
|
-
"alternativeLowersSugar": true
|
|
10
|
-
},
|
|
11
|
-
"envelope": {
|
|
12
|
-
"insight": {
|
|
13
|
-
"createdAt": "2025-10-05T20:33:48.907163+00:00",
|
|
14
|
-
"expiresAt": "2025-10-05T22:33:48.907185+00:00",
|
|
15
|
-
"id": "https://example.org/insight/delfour",
|
|
16
|
-
"metric": "sugar_g_per_serving",
|
|
17
|
-
"retailer": "Delfour",
|
|
18
|
-
"scopeDevice": "self-scanner",
|
|
19
|
-
"scopeEvent": "pick_up_scanner",
|
|
20
|
-
"suggestionPolicy": "lower_metric_first_higher_price_ok",
|
|
21
|
-
"threshold": 10,
|
|
22
|
-
"type": "ins:Insight"
|
|
23
|
-
},
|
|
24
|
-
"policy": {
|
|
25
|
-
"duty": {
|
|
26
|
-
"action": "odrl:delete",
|
|
27
|
-
"constraint": {
|
|
28
|
-
"leftOperand": "odrl:dateTime",
|
|
29
|
-
"operator": "odrl:eq",
|
|
30
|
-
"rightOperand": "2025-10-05T22:33:48.907185+00:00"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
"permission": {
|
|
34
|
-
"action": "odrl:use",
|
|
35
|
-
"constraint": {
|
|
36
|
-
"leftOperand": "odrl:purpose",
|
|
37
|
-
"operator": "odrl:eq",
|
|
38
|
-
"rightOperand": "shopping_assist"
|
|
39
|
-
},
|
|
40
|
-
"target": "https://example.org/insight/delfour"
|
|
41
|
-
},
|
|
42
|
-
"profile": "Delfour-Insight-Policy",
|
|
43
|
-
"prohibition": {
|
|
44
|
-
"action": "odrl:distribute",
|
|
45
|
-
"constraint": {
|
|
46
|
-
"leftOperand": "odrl:purpose",
|
|
47
|
-
"operator": "odrl:eq",
|
|
48
|
-
"rightOperand": "marketing"
|
|
49
|
-
},
|
|
50
|
-
"target": "https://example.org/insight/delfour"
|
|
51
|
-
},
|
|
52
|
-
"type": "odrl:Policy"
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
"integrity": {
|
|
56
|
-
"canonicalEnvelope": "{\"insight\":{\"createdAt\":\"2025-10-05T20:33:48.907163+00:00\",\"expiresAt\":\"2025-10-05T22:33:48.907185+00:00\",\"id\":\"https://example.org/insight/delfour\",\"metric\":\"sugar_g_per_serving\",\"retailer\":\"Delfour\",\"scopeDevice\":\"self-scanner\",\"scopeEvent\":\"pick_up_scanner\",\"suggestionPolicy\":\"lower_metric_first_higher_price_ok\",\"threshold\":10.0,\"type\":\"ins:Insight\"},\"policy\":{\"duty\":{\"action\":\"odrl:delete\",\"constraint\":{\"leftOperand\":\"odrl:dateTime\",\"operator\":\"odrl:eq\",\"rightOperand\":\"2025-10-05T22:33:48.907185+00:00\"}},\"permission\":{\"action\":\"odrl:use\",\"constraint\":{\"leftOperand\":\"odrl:purpose\",\"operator\":\"odrl:eq\",\"rightOperand\":\"shopping_assist\"},\"target\":\"https://example.org/insight/delfour\"},\"profile\":\"Delfour-Insight-Policy\",\"prohibition\":{\"action\":\"odrl:distribute\",\"constraint\":{\"leftOperand\":\"odrl:purpose\",\"operator\":\"odrl:eq\",\"rightOperand\":\"marketing\"},\"target\":\"https://example.org/insight/delfour\"},\"type\":\"odrl:Policy\"}}",
|
|
57
|
-
"payloadHashSHA256": "e1ad69852c98ca7697a164dbc6f0ca28f873508a6676865dba37b81faa66ebcb",
|
|
58
|
-
"envelopeHmacSHA256": "518a84185e2975928c6c935dae6e251a071766078c6e9e70d6f583a1147728db",
|
|
59
|
-
"verificationMode": "trustedPrecomputedInput"
|
|
60
|
-
},
|
|
61
|
-
"answer": {
|
|
62
|
-
"sentence": "The scanner is allowed to use a neutral shopping insight and recommends Low-Sugar Tea Biscuits instead of Classic Tea Biscuits.",
|
|
63
|
-
"scannedProduct": "Classic Tea Biscuits",
|
|
64
|
-
"suggestedAlternative": "Low-Sugar Tea Biscuits",
|
|
65
|
-
"payloadHashSHA256": "e1ad69852c98ca7697a164dbc6f0ca28f873508a6676865dba37b81faa66ebcb",
|
|
66
|
-
"envelopeHmacSHA256": "518a84185e2975928c6c935dae6e251a071766078c6e9e70d6f583a1147728db"
|
|
67
|
-
},
|
|
68
|
-
"reasonWhy": [
|
|
69
|
-
"The phone desensitizes a diabetes-related household condition into a scoped low-sugar need, wraps it in an expiring Insight+Policy envelope, and signs it.",
|
|
70
|
-
"scanned product : Classic Tea Biscuits",
|
|
71
|
-
"suggested alternative: Low-Sugar Tea Biscuits",
|
|
72
|
-
"payload SHA-256 : e1ad69852c98ca7697a164dbc6f0ca28f873508a6676865dba37b81faa66ebcb",
|
|
73
|
-
"HMAC-SHA256 : 518a84185e2975928c6c935dae6e251a071766078c6e9e70d6f583a1147728db"
|
|
74
|
-
],
|
|
75
|
-
"checks": {
|
|
76
|
-
"signatureVerifies": true,
|
|
77
|
-
"payloadHashMatches": true,
|
|
78
|
-
"minimizationRespected": true,
|
|
79
|
-
"scopeComplete": true,
|
|
80
|
-
"authorizationAllowed": true,
|
|
81
|
-
"highSugarBanner": true,
|
|
82
|
-
"alternativeLowersSugar": true,
|
|
83
|
-
"dutyTimingConsistent": true,
|
|
84
|
-
"marketingProhibited": true
|
|
85
|
-
},
|
|
86
|
-
"allChecksPass": true,
|
|
87
|
-
"arcText": "=== Answer ===\nThe scanner is allowed to use a neutral shopping insight and recommends Low-Sugar Tea Biscuits instead of Classic Tea Biscuits.\n\n=== Reason Why ===\nThe phone desensitizes a diabetes-related household condition into a scoped low-sugar need, wraps it in an expiring Insight+Policy envelope, and signs it.\nscanned product : Classic Tea Biscuits\nsuggested alternative: Low-Sugar Tea Biscuits\npayload SHA-256 : e1ad69852c98ca7697a164dbc6f0ca28f873508a6676865dba37b81faa66ebcb\nHMAC-SHA256 : 518a84185e2975928c6c935dae6e251a071766078c6e9e70d6f583a1147728db\n\n=== Check ===\nsignature verifies : yes\npayload hash matches : yes\nminimization strips sensitive terms: yes\nscope complete : yes\nauthorization allowed : yes\nhigh-sugar banner : yes\nalternative lowers sugar : yes\nduty timing consistent : yes\nmarketing prohibited : yes"
|
|
88
|
-
}
|