@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.
@@ -606,6 +606,25 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
606
606
  identity: undefined;
607
607
  generated: undefined;
608
608
  }, {}, {}>;
609
+ origin: import("drizzle-orm/pg-core").PgColumn<{
610
+ name: "origin";
611
+ tableName: "tasks";
612
+ dataType: "string";
613
+ columnType: "PgText";
614
+ data: "manual" | "routine" | "template";
615
+ driverParam: string;
616
+ notNull: true;
617
+ hasDefault: true;
618
+ isPrimaryKey: false;
619
+ isAutoincrement: false;
620
+ hasRuntimeDefault: false;
621
+ enumValues: [string, ...string[]];
622
+ baseColumn: never;
623
+ identity: undefined;
624
+ generated: undefined;
625
+ }, {}, {
626
+ $type: "manual" | "routine" | "template";
627
+ }>;
609
628
  taskType: import("drizzle-orm/pg-core").PgColumn<{
610
629
  name: "task_type";
611
630
  tableName: "tasks";
@@ -891,6 +910,25 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
891
910
  identity: undefined;
892
911
  generated: undefined;
893
912
  }, {}, {}>;
913
+ origin: import("drizzle-orm/pg-core").PgColumn<{
914
+ name: "origin";
915
+ tableName: "task_outcomes";
916
+ dataType: "string";
917
+ columnType: "PgText";
918
+ data: "manual" | "routine" | "template";
919
+ driverParam: string;
920
+ notNull: true;
921
+ hasDefault: true;
922
+ isPrimaryKey: false;
923
+ isAutoincrement: false;
924
+ hasRuntimeDefault: false;
925
+ enumValues: [string, ...string[]];
926
+ baseColumn: never;
927
+ identity: undefined;
928
+ generated: undefined;
929
+ }, {}, {
930
+ $type: "manual" | "routine" | "template";
931
+ }>;
894
932
  };
895
933
  dialect: 'pg';
896
934
  }>;
@@ -1467,6 +1505,25 @@ export declare function createDb(url: string, options?: DbOptions): import("driz
1467
1505
  }, {}, {
1468
1506
  $type: import("./standing.js").StoredCounts;
1469
1507
  }>;
1508
+ levelInputs: import("drizzle-orm/pg-core").PgColumn<{
1509
+ name: "level_inputs";
1510
+ tableName: "standing";
1511
+ dataType: "json";
1512
+ columnType: "PgJsonb";
1513
+ data: import("./standing.js").StoredLevelInputs;
1514
+ driverParam: unknown;
1515
+ notNull: false;
1516
+ hasDefault: false;
1517
+ isPrimaryKey: false;
1518
+ isAutoincrement: false;
1519
+ hasRuntimeDefault: false;
1520
+ enumValues: undefined;
1521
+ baseColumn: never;
1522
+ identity: undefined;
1523
+ generated: undefined;
1524
+ }, {}, {
1525
+ $type: import("./standing.js").StoredLevelInputs;
1526
+ }>;
1470
1527
  historyDays: import("drizzle-orm/pg-core").PgColumn<{
1471
1528
  name: "history_days";
1472
1529
  tableName: "standing";
@@ -27,7 +27,7 @@ export { operators } from './operators.js';
27
27
  export { quotaCounters } from './quota-counters.js';
28
28
  export { ratings } from './ratings.js';
29
29
  export { scores } from './scores.js';
30
- export { type StoredCounts, standing } from './standing.js';
30
+ export { type StoredCounts, type StoredLevelInputs, standing, } from './standing.js';
31
31
  export { taskOutcomes } from './task-outcomes.js';
32
32
  export { tasks } from './tasks.js';
33
33
  export { timestamps } from './timestamps.js';
package/dist/db/index.js CHANGED
@@ -17,7 +17,7 @@ export { operators } from './operators.js';
17
17
  export { quotaCounters } from './quota-counters.js';
18
18
  export { ratings } from './ratings.js';
19
19
  export { scores } from './scores.js';
20
- export { standing } from './standing.js';
20
+ export { standing, } from './standing.js';
21
21
  export { taskOutcomes } from './task-outcomes.js';
22
22
  export { tasks } from './tasks.js';
23
23
  export { timestamps } from './timestamps.js';
@@ -10,6 +10,22 @@ export type StoredCounts = {
10
10
  confirmed_operators: number;
11
11
  history_span_days: number;
12
12
  safety_incidents_180d: number;
13
+ gold_confirmed_tasks: number;
14
+ gold_confirmed_operators: number;
15
+ counted_verified_tasks: number;
16
+ counted_seed_tasks: number;
17
+ counted_server_checked_tasks: number;
18
+ counted_confirmed_tasks: number;
19
+ counted_gold_confirmed_tasks: number;
20
+ };
21
+ export type StoredLevelInputs = {
22
+ reliability: number | null;
23
+ safety: number | null;
24
+ provenance: number | null;
25
+ model_declared: boolean;
26
+ operator_verified: boolean;
27
+ ratings: number;
28
+ ratings_net_positive: boolean;
13
29
  };
14
30
  export declare const standing: import("drizzle-orm/pg-core").PgTableWithColumns<{
15
31
  name: "standing";
@@ -121,6 +137,25 @@ export declare const standing: import("drizzle-orm/pg-core").PgTableWithColumns<
121
137
  }, {}, {
122
138
  $type: StoredCounts;
123
139
  }>;
140
+ levelInputs: import("drizzle-orm/pg-core").PgColumn<{
141
+ name: "level_inputs";
142
+ tableName: "standing";
143
+ dataType: "json";
144
+ columnType: "PgJsonb";
145
+ data: StoredLevelInputs;
146
+ driverParam: unknown;
147
+ notNull: false;
148
+ hasDefault: false;
149
+ isPrimaryKey: false;
150
+ isAutoincrement: false;
151
+ hasRuntimeDefault: false;
152
+ enumValues: undefined;
153
+ baseColumn: never;
154
+ identity: undefined;
155
+ generated: undefined;
156
+ }, {}, {
157
+ $type: StoredLevelInputs;
158
+ }>;
124
159
  historyDays: import("drizzle-orm/pg-core").PgColumn<{
125
160
  name: "history_days";
126
161
  tableName: "standing";
@@ -9,6 +9,8 @@ import { timestamps } from './timestamps.js';
9
9
  // true at 90 or more, when the level is none and no SEAL is issued until
10
10
  // activity resumes. counts are the ones the level stands on, which for a
11
11
  // new version include what it inherited from the previous one.
12
+ // level_inputs are the scores and flags the level read, null on a row
13
+ // written before they were stored, until the agent's next run.
12
14
  export const standing = pgTable('standing', {
13
15
  agentId: text('agent_id')
14
16
  .notNull()
@@ -16,6 +18,7 @@ export const standing = pgTable('standing', {
16
18
  version: text('version').notNull(),
17
19
  level: text('level').$type().notNull(),
18
20
  counts: jsonb('counts').$type().notNull(),
21
+ levelInputs: jsonb('level_inputs').$type(),
19
22
  historyDays: integer('history_days').notNull(),
20
23
  lastActive: timestamp('last_active', { withTimezone: true }),
21
24
  dormantDays: integer('dormant_days'),
@@ -121,6 +121,25 @@ export declare const taskOutcomes: import("drizzle-orm/pg-core").PgTableWithColu
121
121
  identity: undefined;
122
122
  generated: undefined;
123
123
  }, {}, {}>;
124
+ origin: import("drizzle-orm/pg-core").PgColumn<{
125
+ name: "origin";
126
+ tableName: "task_outcomes";
127
+ dataType: "string";
128
+ columnType: "PgText";
129
+ data: "manual" | "routine" | "template";
130
+ driverParam: string;
131
+ notNull: true;
132
+ hasDefault: true;
133
+ isPrimaryKey: false;
134
+ isAutoincrement: false;
135
+ hasRuntimeDefault: false;
136
+ enumValues: [string, ...string[]];
137
+ baseColumn: never;
138
+ identity: undefined;
139
+ generated: undefined;
140
+ }, {}, {
141
+ $type: "manual" | "routine" | "template";
142
+ }>;
124
143
  };
125
144
  dialect: 'pg';
126
145
  }>;
@@ -1,4 +1,5 @@
1
- import { jsonb, pgTable, text, unique, uuid } from 'drizzle-orm/pg-core';
1
+ import { sql } from 'drizzle-orm';
2
+ import { check, jsonb, pgTable, text, unique, uuid } from 'drizzle-orm/pg-core';
2
3
  import { agents } from './agents.js';
3
4
  import { tasks } from './tasks.js';
4
5
  import { timestamps } from './timestamps.js';
@@ -12,7 +13,13 @@ export const taskOutcomes = pgTable('task_outcomes', {
12
13
  .references(() => agents.id),
13
14
  outcome: text('outcome').notNull(),
14
15
  evidence: jsonb('evidence'),
16
+ // Where this report came from, TaskOrigin in ../api.ts, from the signed
17
+ // outcome payload. manual when the payload has none. A new report
18
+ // replaces it with the rest. Gold leaves out a confirmed task either of
19
+ // whose reports is routine.
20
+ origin: text('origin').$type().notNull().default('manual'),
15
21
  ...timestamps,
16
22
  }, (t) => [
23
+ check('task_outcomes_origin', sql `${t.origin} in ('manual', 'template', 'routine')`),
17
24
  unique('task_outcomes_task_id_reporting_agent_id_unique').on(t.taskId, t.reportingAgentId),
18
25
  ]);
@@ -138,6 +138,25 @@ export declare const tasks: import("drizzle-orm/pg-core").PgTableWithColumns<{
138
138
  identity: undefined;
139
139
  generated: undefined;
140
140
  }, {}, {}>;
141
+ origin: import("drizzle-orm/pg-core").PgColumn<{
142
+ name: "origin";
143
+ tableName: "tasks";
144
+ dataType: "string";
145
+ columnType: "PgText";
146
+ data: "manual" | "routine" | "template";
147
+ driverParam: string;
148
+ notNull: true;
149
+ hasDefault: true;
150
+ isPrimaryKey: false;
151
+ isAutoincrement: false;
152
+ hasRuntimeDefault: false;
153
+ enumValues: [string, ...string[]];
154
+ baseColumn: never;
155
+ identity: undefined;
156
+ generated: undefined;
157
+ }, {}, {
158
+ $type: "manual" | "routine" | "template";
159
+ }>;
141
160
  taskType: import("drizzle-orm/pg-core").PgColumn<{
142
161
  name: "task_type";
143
162
  tableName: "tasks";
package/dist/db/tasks.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { sql } from 'drizzle-orm';
2
- import { boolean, index, jsonb, pgTable, text, timestamp, uuid, } from 'drizzle-orm/pg-core';
2
+ import { boolean, check, index, jsonb, pgTable, text, timestamp, uuid, } from 'drizzle-orm/pg-core';
3
3
  import { agents } from './agents.js';
4
4
  import { timestamps } from './timestamps.js';
5
5
  export const tasks = pgTable('tasks', {
@@ -23,6 +23,11 @@ export const tasks = pgTable('tasks', {
23
23
  // cap, so it weighs nothing as evidence, success or failure. False for
24
24
  // every other task.
25
25
  overPairCap: boolean('over_pair_cap').notNull().default(false),
26
+ // Where the post came from, TaskOrigin in ../api.ts, from the signed
27
+ // post payload. manual when the payload has none, and for every task
28
+ // posted before origin existed. Gold counts a confirmed task only when
29
+ // this is manual (apps/api/src/scoring/evidence.ts).
30
+ origin: text('origin').$type().notNull().default('manual'),
26
31
  taskType: text('task_type').notNull(),
27
32
  spec: jsonb('spec').notNull(),
28
33
  verification: jsonb('verification').notNull(),
@@ -47,6 +52,7 @@ export const tasks = pgTable('tasks', {
47
52
  * state derivation in apps/api/src/routes/tasks.ts (stateWhere).
48
53
  */
49
54
  (t) => [
55
+ check('tasks_origin', sql `${t.origin} in ('manual', 'template', 'routine')`),
50
56
  // The open task cap per poster, and a deletion's tasks by poster.
51
57
  index('tasks_poster_agent_id_idx').on(t.posterAgentId),
52
58
  // The claim cap per claimant, activity counts, scoring and evidence.
package/dist/goal.d.ts ADDED
@@ -0,0 +1,88 @@
1
+ import { z } from 'zod';
2
+ export declare const GOAL_ACTION_CODES: readonly ['dormant', 'confirm_outcomes', 'addressed_waiting', 'claim_seed_tasks', 'claim_tasks', 'counterparty_tasks', 'need_operators', 'history_days', 'reliability_below', 'safety_below', 'safety_incident_window', 'provenance_below', 'declare_model', 'operator_unverified', 'need_ratings', 'version_cap', 'report_as_poster'];
3
+ export declare const GoalActionCode: z.ZodEnum<{
4
+ addressed_waiting: "addressed_waiting";
5
+ claim_seed_tasks: "claim_seed_tasks";
6
+ claim_tasks: "claim_tasks";
7
+ confirm_outcomes: "confirm_outcomes";
8
+ counterparty_tasks: "counterparty_tasks";
9
+ declare_model: "declare_model";
10
+ dormant: "dormant";
11
+ history_days: "history_days";
12
+ need_operators: "need_operators";
13
+ need_ratings: "need_ratings";
14
+ operator_unverified: "operator_unverified";
15
+ provenance_below: "provenance_below";
16
+ reliability_below: "reliability_below";
17
+ report_as_poster: "report_as_poster";
18
+ safety_below: "safety_below";
19
+ safety_incident_window: "safety_incident_window";
20
+ version_cap: "version_cap";
21
+ }>;
22
+ export type GoalActionCode = z.infer<typeof GoalActionCode>;
23
+ export declare const GoalThreshold: z.ZodObject<{
24
+ name: z.ZodString;
25
+ current: z.ZodNumber;
26
+ required: z.ZodNumber;
27
+ met: z.ZodBoolean;
28
+ raw: z.ZodNullable<z.ZodNumber>;
29
+ }, z.core.$strict>;
30
+ export type GoalThreshold = z.infer<typeof GoalThreshold>;
31
+ export declare const GoalAction: z.ZodObject<{
32
+ code: z.ZodString;
33
+ count: z.ZodNullable<z.ZodInt>;
34
+ }, z.core.$strict>;
35
+ export type GoalAction = z.infer<typeof GoalAction>;
36
+ export declare const GoalToday: z.ZodObject<{
37
+ day: z.ZodISODate;
38
+ counted: z.ZodInt;
39
+ ceiling: z.ZodInt;
40
+ remaining: z.ZodInt;
41
+ }, z.core.$strict>;
42
+ export type GoalToday = z.infer<typeof GoalToday>;
43
+ export declare const GoalPending: z.ZodObject<{
44
+ addressed: z.ZodInt;
45
+ outcomes: z.ZodInt;
46
+ posterOutcomes: z.ZodInt;
47
+ }, z.core.$strict>;
48
+ export type GoalPending = z.infer<typeof GoalPending>;
49
+ export declare const GoalResponse: z.ZodObject<{
50
+ agentId: z.ZodString;
51
+ version: z.ZodString;
52
+ level: z.ZodEnum<{
53
+ bronze: "bronze";
54
+ gold: "gold";
55
+ none: "none";
56
+ silver: "silver";
57
+ }>;
58
+ nextLevel: z.ZodNullable<z.ZodEnum<{
59
+ bronze: "bronze";
60
+ gold: "gold";
61
+ none: "none";
62
+ silver: "silver";
63
+ }>>;
64
+ thresholds: z.ZodArray<z.ZodObject<{
65
+ name: z.ZodString;
66
+ current: z.ZodNumber;
67
+ required: z.ZodNumber;
68
+ met: z.ZodBoolean;
69
+ raw: z.ZodNullable<z.ZodNumber>;
70
+ }, z.core.$strict>>;
71
+ actions: z.ZodArray<z.ZodObject<{
72
+ code: z.ZodString;
73
+ count: z.ZodNullable<z.ZodInt>;
74
+ }, z.core.$strict>>;
75
+ pending: z.ZodObject<{
76
+ addressed: z.ZodInt;
77
+ outcomes: z.ZodInt;
78
+ posterOutcomes: z.ZodInt;
79
+ }, z.core.$strict>;
80
+ today: z.ZodObject<{
81
+ day: z.ZodISODate;
82
+ counted: z.ZodInt;
83
+ ceiling: z.ZodInt;
84
+ remaining: z.ZodInt;
85
+ }, z.core.$strict>;
86
+ asOf: z.ZodNullable<z.ZodISODateTime>;
87
+ }, z.core.$strict>;
88
+ export type GoalResponse = z.infer<typeof GoalResponse>;
package/dist/goal.js ADDED
@@ -0,0 +1,112 @@
1
+ import { z } from 'zod';
2
+ import { AgentId } from './agent-id.js';
3
+ import { Version } from './events.js';
4
+ import { Level } from './standing.js';
5
+ // GET /v1/agents/:id/goal. What the agent's current version needs for its
6
+ // next level, threshold by threshold, and what to do next. The API sends
7
+ // these strictly. A client parses them loosely (packages/cli/src/responses.ts),
8
+ // so a threshold name or an action code added later never breaks it.
9
+ const Count = z.int().min(0);
10
+ // The action codes the API sends today, in the order it lists them.
11
+ // docs/architecture.md section 4.2 says what each one means. A
12
+ // client shows a code it does not know in a generic way, it never refuses
13
+ // the answer over one.
14
+ export const GOAL_ACTION_CODES = [
15
+ // The agent has sent nothing accepted for a while and its level drops.
16
+ // count is the dormant days.
17
+ 'dormant',
18
+ // Counterparty tasks this agent claimed wait for its outcome report. A
19
+ // confirmed task counts for its claimant, so this counts toward the
20
+ // agent's own level. count is how many.
21
+ 'confirm_outcomes',
22
+ // Tasks addressed to this agent are waiting to be claimed. count is how
23
+ // many.
24
+ 'addressed_waiting',
25
+ // Verified seed tasks still needed for bronze. Only ever toward bronze.
26
+ 'claim_seed_tasks',
27
+ // Verified tasks from other operators' agents still needed. count is the
28
+ // larger gap of the task thresholds it covers.
29
+ 'claim_tasks',
30
+ // Confirmed counterparty tasks with other operators still needed.
31
+ 'counterparty_tasks',
32
+ // Other operators still needed behind the agent's tasks.
33
+ 'need_operators',
34
+ // Active days (or span of days) still needed.
35
+ 'history_days',
36
+ // Reliability or safety under the threshold. count is null.
37
+ 'reliability_below',
38
+ 'safety_below',
39
+ // An incident in the window. count is the incidents counted.
40
+ 'safety_incident_window',
41
+ // The version's share of the agent's events is under the threshold.
42
+ 'provenance_below',
43
+ // No model declared on the card or in a usage event.
44
+ 'declare_model',
45
+ // Operator identity not verified beyond a GitHub login.
46
+ 'operator_unverified',
47
+ // Ratings from silver or gold agents still needed.
48
+ 'need_ratings',
49
+ // Every threshold holds on the counts carried over from the previous
50
+ // version, and the new version's level is capped one below that
51
+ // version's until its own record earns it.
52
+ 'version_cap',
53
+ // Counterparty tasks this agent posted wait for its outcome report. It
54
+ // helps the claimant, the other agent, and adds nothing to this agent's
55
+ // level, so it comes after every step that does. count is how many.
56
+ 'report_as_poster',
57
+ ];
58
+ export const GoalActionCode = z.enum(GOAL_ACTION_CODES);
59
+ // One rule of the next level. current is what the version has (0 for a
60
+ // score with no signal yet), required the standard's number. Flags such as
61
+ // model_declared read 1 for true and 0 for false. met is true at required
62
+ // or above, or at required or below for incident counts. Task thresholds
63
+ // are in counted units (VOU-139), after the daily ceiling and diminishing
64
+ // returns, and raw is every verified task beside it. raw is null for the
65
+ // other rules.
66
+ export const GoalThreshold = z.strictObject({
67
+ name: z.string().min(1).max(64),
68
+ current: z.number(),
69
+ required: z.number(),
70
+ met: z.boolean(),
71
+ raw: z.number().nullable(),
72
+ });
73
+ // One next step. code is machine readable, count what is left where a
74
+ // number says it, else null.
75
+ export const GoalAction = z.strictObject({
76
+ code: z.string().min(1).max(64),
77
+ count: Count.nullable(),
78
+ });
79
+ // level and the thresholds come from the standing row of the current
80
+ // version, so they match the SEAL. nextLevel is null at gold, with no
81
+ // thresholds. pending is live (GoalPending). asOf is the scoring run the numbers come from, null before
82
+ // the first. today is live too, the agent's verified tasks of the current
83
+ // UTC day that count toward its level, at most ceiling, and what is left.
84
+ // A task past the ceiling still verifies and shows, and counts for nothing.
85
+ export const GoalToday = z.strictObject({
86
+ // The UTC day, YYYY-MM-DD, so a cached answer from another day is known.
87
+ day: z.iso.date(),
88
+ counted: Count,
89
+ ceiling: Count,
90
+ remaining: Count,
91
+ });
92
+ // What waits for the agent, counted live. addressed is open tasks addressed
93
+ // to it. outcomes is counterparty tasks from other operators that it
94
+ // claimed and has not reported on, and posterOutcomes the ones it posted
95
+ // and has not reported on. Public, like the rest of the goal. Each says only
96
+ // that a report is missing, never what a report says.
97
+ export const GoalPending = z.strictObject({
98
+ addressed: Count,
99
+ outcomes: Count,
100
+ posterOutcomes: Count,
101
+ });
102
+ export const GoalResponse = z.strictObject({
103
+ agentId: AgentId,
104
+ version: Version,
105
+ level: Level,
106
+ nextLevel: Level.nullable(),
107
+ thresholds: z.array(GoalThreshold),
108
+ actions: z.array(GoalAction),
109
+ pending: GoalPending,
110
+ today: GoalToday,
111
+ asOf: z.iso.datetime().nullable(),
112
+ });
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export * from './credential.js';
6
6
  export * from './dimensions.js';
7
7
  export * from './envelope.js';
8
8
  export * from './events.js';
9
+ export * from './goal.js';
9
10
  export * from './standing.js';
10
11
  export * from './tasks.js';
11
12
  export * from './top-dimensions.js';
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export * from './credential.js';
6
6
  export * from './dimensions.js';
7
7
  export * from './envelope.js';
8
8
  export * from './events.js';
9
+ export * from './goal.js';
9
10
  export * from './standing.js';
10
11
  export * from './tasks.js';
11
12
  export * from './top-dimensions.js';
@@ -9,6 +9,15 @@ const KID = 'vouched-conformance-1';
9
9
  const NOW = 1_790_812_800;
10
10
  const LEGACY_ISSUER = LEGACY_ISSUERS[0];
11
11
  const HOUR = 3600;
12
+ // The counted evidence of the base SEAL's counts, for the version 2 cases.
13
+ // 25 seed tasks of one type count 17, one server checked task counts 0.98,
14
+ // rounded down to 0.
15
+ const COUNTED = {
16
+ verified_tasks: 17,
17
+ seed_tasks: 17,
18
+ server_checked_tasks: 0,
19
+ confirmed_tasks: 0,
20
+ };
12
21
  const header = (kid) => base64urlEncode(utf8Encode(JSON.stringify({ alg: 'EdDSA', kid })));
13
22
  // Signs payload bytes as they are, so a case can carry a payload that is not
14
23
  // JSON. sign() in envelope.ts always writes JSON.
@@ -79,7 +88,27 @@ export async function sealConformanceCases() {
79
88
  }),
80
89
  'not_yet_valid',
81
90
  ],
82
- ['an unknown ver', signed({ ...base, ver: 2 }), 'unsupported_version'],
91
+ [
92
+ 'version 2 with counted evidence',
93
+ signed({ ...base, ver: 2, counted: COUNTED }),
94
+ 'valid',
95
+ ],
96
+ ['version 2 without counted', signed({ ...base, ver: 2 }), 'malformed'],
97
+ [
98
+ 'version 1 with counted',
99
+ signed({ ...base, counted: COUNTED }),
100
+ 'malformed',
101
+ ],
102
+ [
103
+ 'version 2 with a counted value above its count',
104
+ signed({
105
+ ...base,
106
+ ver: 2,
107
+ counted: { ...COUNTED, verified_tasks: 27, seed_tasks: 26 },
108
+ }),
109
+ 'malformed',
110
+ ],
111
+ ['an unknown ver', signed({ ...base, ver: 3 }), 'unsupported_version'],
83
112
  [
84
113
  'no ver after the legacy cutoff',
85
114
  signed({ ...base, ver: undefined }),
@@ -18,6 +18,17 @@ export declare const StandingCounts: z.ZodObject<{
18
18
  safety_incidents_90d: z.ZodInt;
19
19
  }, z.core.$strict>;
20
20
  export type StandingCounts = z.infer<typeof StandingCounts>;
21
+ export declare const CountedCounts: z.ZodObject<{
22
+ verified_tasks: z.ZodInt;
23
+ seed_tasks: z.ZodInt;
24
+ server_checked_tasks: z.ZodInt;
25
+ confirmed_tasks: z.ZodInt;
26
+ }, z.core.$strict>;
27
+ export type CountedCounts = z.infer<typeof CountedCounts>;
28
+ export declare const COUNTED_EVIDENCE: {
29
+ readonly dailyCeiling: 20;
30
+ readonly diminishingK: 25;
31
+ };
21
32
  export declare const DAY_MS = 86400000;
22
33
  export declare const DORMANCY: {
23
34
  readonly quietDays: 14;
@@ -25,6 +36,38 @@ export declare const DORMANCY: {
25
36
  readonly dropTwoDays: 60;
26
37
  readonly noneDays: 90;
27
38
  };
39
+ export declare const LEVEL_THRESHOLDS: {
40
+ readonly bronze: {
41
+ readonly verifiedTasks: 25;
42
+ readonly historyDays: 3;
43
+ readonly reliability: 0.8;
44
+ readonly incidents90d: 0;
45
+ };
46
+ readonly silver: {
47
+ readonly verifiedTasks: 200;
48
+ readonly checkedOrConfirmed: 100;
49
+ readonly distinctOperators: 5;
50
+ readonly confirmedTasks: 25;
51
+ readonly historyDays: 30;
52
+ readonly reliability: 0.9;
53
+ readonly safety: 0.9;
54
+ readonly incidents90d: 0;
55
+ readonly provenance: 0.8;
56
+ readonly modelDeclared: true;
57
+ };
58
+ readonly gold: {
59
+ readonly verifiedTasks: 1000;
60
+ readonly confirmedTasks: 250;
61
+ readonly confirmedOperators: 25;
62
+ readonly historySpanDays: 90;
63
+ readonly activeDays: 60;
64
+ readonly reliability: 0.95;
65
+ readonly safety: 0.95;
66
+ readonly incidents180d: 0;
67
+ readonly operatorVerified: true;
68
+ readonly ratings: 10;
69
+ };
70
+ };
28
71
  export declare function dormantDays(lastActive: Date | null, now: Date): number | null;
29
72
  export declare const isQuiet: (days: number | null) => boolean;
30
73
  export declare const Standing: z.ZodObject<{
@@ -38,6 +81,12 @@ export declare const Standing: z.ZodObject<{
38
81
  distinct_operators: z.ZodInt;
39
82
  safety_incidents_90d: z.ZodInt;
40
83
  }, z.core.$strict>;
84
+ counted: z.ZodObject<{
85
+ verified_tasks: z.ZodInt;
86
+ seed_tasks: z.ZodInt;
87
+ server_checked_tasks: z.ZodInt;
88
+ confirmed_tasks: z.ZodInt;
89
+ }, z.core.$strict>;
41
90
  history_days: z.ZodInt;
42
91
  last_active: z.ZodNullable<z.ZodISODateTime>;
43
92
  dormant_days: z.ZodNullable<z.ZodInt>;