@sealkeeper/schema 0.4.3 → 0.4.4

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/dist/standing.js CHANGED
@@ -44,6 +44,39 @@ export const StandingCounts = z
44
44
  message: 'verified_tasks must equal seed_tasks + server_checked_tasks + confirmed_tasks',
45
45
  path: ['verified_tasks'],
46
46
  });
47
+ // The counted evidence (VOU-139), what the levels read. The same verified
48
+ // tasks as the counts after the daily ceiling (at most 20 per agent per UTC
49
+ // day count, the most valuable first) and diminishing returns (within a
50
+ // seed task type, or another operator's tasks, n tasks count 25 * ln(1 +
51
+ // n / 25)), each kind rounded down. The counts stay the raw facts.
52
+ //
53
+ // verified_tasks seed_tasks + server_checked_tasks + confirmed_tasks
54
+ // seed_tasks counted seed tasks
55
+ // server_checked_tasks counted server checked tasks
56
+ // confirmed_tasks counted confirmed tasks
57
+ //
58
+ // Each is at most its raw count, and verified_tasks is always the sum.
59
+ export const CountedCounts = z
60
+ .strictObject({
61
+ verified_tasks: Count,
62
+ seed_tasks: Count,
63
+ server_checked_tasks: Count,
64
+ confirmed_tasks: Count,
65
+ })
66
+ .refine((c) => c.verified_tasks ===
67
+ c.seed_tasks + c.server_checked_tasks + c.confirmed_tasks, {
68
+ message: 'verified_tasks must equal seed_tasks + server_checked_tasks + confirmed_tasks',
69
+ path: ['verified_tasks'],
70
+ });
71
+ // The two numbers of counted evidence (VOU-139), starting values set on 26
72
+ // September 2026. At most dailyCeiling verified tasks per agent per UTC day
73
+ // count, and n tasks of one category count diminishingK * ln(1 + n /
74
+ // diminishingK). The scoring job applies them (SCORING in the API) and the
75
+ // CLI explains them, so they live here.
76
+ export const COUNTED_EVIDENCE = {
77
+ dailyCeiling: 20,
78
+ diminishingK: 25,
79
+ };
47
80
  export const DAY_MS = 86_400_000;
48
81
  // The dormancy ladder of the SEAL standard, section 5, in whole days since
49
82
  // the agent's last accepted event. At quietDays the badge shows quiet and
@@ -56,6 +89,59 @@ export const DORMANCY = {
56
89
  dropTwoDays: 60,
57
90
  noneDays: 90,
58
91
  };
92
+ // SEAL standard levels, version 1 thresholds, section 5. Every one is a
93
+ // minimum and all of a level's must hold. The scoring job applies them
94
+ // (SCORING.levels in the API) and the CLI explains them, so they live here.
95
+ // Seed tasks count in verifiedTasks and nowhere else, so they can carry an
96
+ // agent to bronze and never to silver or gold on their own. Task counts
97
+ // are counted evidence (CountedCounts), recalibrated on 26 September 2026
98
+ // (VOU-139) from the simulation in apps/api/src/scoring/simulation.ts.
99
+ // Silver was 250 verified, gold 2500 verified and 500 confirmed, in raw
100
+ // tasks.
101
+ export const LEVEL_THRESHOLDS = {
102
+ bronze: {
103
+ verifiedTasks: 25,
104
+ historyDays: 3,
105
+ reliability: 0.8,
106
+ // Confirmed incidents in the last 90 days, at most.
107
+ incidents90d: 0,
108
+ },
109
+ silver: {
110
+ verifiedTasks: 200,
111
+ // Server checked plus confirmed tasks, from at least distinctOperators.
112
+ checkedOrConfirmed: 100,
113
+ distinctOperators: 5,
114
+ confirmedTasks: 25,
115
+ historyDays: 30,
116
+ reliability: 0.9,
117
+ safety: 0.9,
118
+ incidents90d: 0,
119
+ // Provenance of at least this, meaning the share of the agent's events
120
+ // in the window, received since this version was first seen, that carry
121
+ // this version. Measured from first seen, so an agent that ships often
122
+ // and cuts over cleanly still passes.
123
+ provenance: 0.8,
124
+ // A declared model, meaning the card names one or the agent sent a
125
+ // usage event with a model in the window.
126
+ modelDeclared: true,
127
+ },
128
+ gold: {
129
+ verifiedTasks: 1000,
130
+ // Confirmed tasks, from at least confirmedOperators.
131
+ confirmedTasks: 250,
132
+ confirmedOperators: 25,
133
+ // Span from the first accepted event in the window, with activity on at
134
+ // least activeDays of those days.
135
+ historySpanDays: 90,
136
+ activeDays: 60,
137
+ reliability: 0.95,
138
+ safety: 0.95,
139
+ incidents180d: 0,
140
+ operatorVerified: true,
141
+ // Ratings from silver or gold agents, net positive, at least this many.
142
+ ratings: 10,
143
+ },
144
+ };
59
145
  // Whole days from lastActive to now, never below zero. null when the agent
60
146
  // has sent no accepted event. The one place dormancy is counted.
61
147
  export function dormantDays(lastActive, now) {
@@ -66,12 +152,15 @@ export function dormantDays(lastActive, now) {
66
152
  // True at quietDays or more. Never active is not quiet.
67
153
  export const isQuiet = (days) => days !== null && days >= DORMANCY.quietDays;
68
154
  // What the agent answers carry beside level, read from the standing table
69
- // for the current version. last_active is the newest accepted event of the
155
+ // for the current version. counts are the raw facts and counted what the
156
+ // level read. last_active is the newest accepted event of the
70
157
  // agent on any version, null when it has sent none. dormant_days is whole
71
158
  // days since last_active at the time of the answer, null with it. quiet is
72
159
  // true when dormant_days is at DORMANCY.quietDays or more.
73
160
  export const Standing = z.strictObject({
74
161
  counts: StandingCounts,
162
+ // The counted evidence the level stands on (VOU-139).
163
+ counted: CountedCounts,
75
164
  history_days: Count,
76
165
  last_active: z.iso.datetime().nullable(),
77
166
  dormant_days: Count.nullable(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sealkeeper/schema",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "private": false,
5
5
  "description": "Zod schemas, event taxonomy and signing helpers for SealKeeper.",
6
6
  "license": "Apache-2.0",