@skill-harness/adapters 0.14.0 → 0.16.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.
@@ -51,6 +51,18 @@ export declare function createTrustLifecycle(directory: string, input: TrustLife
51
51
  tip: string;
52
52
  grantExpansion: false;
53
53
  };
54
+ configuration: () => TrustLifecycleInput;
55
+ previewExposure: (now: number) => {
56
+ mode: "silent" | "ask" | "retire";
57
+ reason: string;
58
+ advisoryOnly: true;
59
+ } | {
60
+ mode: "retire";
61
+ reason: string;
62
+ } | {
63
+ mode: "silent";
64
+ reason: string;
65
+ };
54
66
  history: () => import("./learning-journal.js").LearningEvent[];
55
67
  previewCaseOutcome: (predictionId: string, reference: LearningCaseReference) => {
56
68
  outcome: TrustReferenceOutcome;
@@ -58,10 +70,10 @@ export declare function createTrustLifecycle(directory: string, input: TrustLife
58
70
  digest: string;
59
71
  tip: string;
60
72
  };
61
- linkCaseOutcome(predictionId: string, reference: LearningCaseReference, authorizedDigests: readonly string[]): void;
73
+ linkCaseOutcome(predictionId: string, reference: LearningCaseReference, authorizedDigests: readonly string[], referenceAuthor?: string): void;
62
74
  predict(p: CalibrationPrediction): void;
63
75
  correct(prior: string, p: CalibrationPrediction, reason: string): void;
64
- outcome(value: TrustReferenceOutcome, authorizedReferenceDigests: readonly string[]): void;
76
+ outcome(value: TrustReferenceOutcome, authorizedReferenceDigests: readonly string[], referenceAuthor?: string): void;
65
77
  expose(id: string, now: number): {
66
78
  replayed: boolean;
67
79
  mode: "ask" | "silent" | "retire";
@@ -104,6 +116,18 @@ export declare function openTrustLifecycle(directory: string): {
104
116
  tip: string;
105
117
  grantExpansion: false;
106
118
  };
119
+ configuration: () => TrustLifecycleInput;
120
+ previewExposure: (now: number) => {
121
+ mode: "silent" | "ask" | "retire";
122
+ reason: string;
123
+ advisoryOnly: true;
124
+ } | {
125
+ mode: "retire";
126
+ reason: string;
127
+ } | {
128
+ mode: "silent";
129
+ reason: string;
130
+ };
107
131
  history: () => import("./learning-journal.js").LearningEvent[];
108
132
  previewCaseOutcome: (predictionId: string, reference: LearningCaseReference) => {
109
133
  outcome: TrustReferenceOutcome;
@@ -111,10 +135,10 @@ export declare function openTrustLifecycle(directory: string): {
111
135
  digest: string;
112
136
  tip: string;
113
137
  };
114
- linkCaseOutcome(predictionId: string, reference: LearningCaseReference, authorizedDigests: readonly string[]): void;
138
+ linkCaseOutcome(predictionId: string, reference: LearningCaseReference, authorizedDigests: readonly string[], referenceAuthor?: string): void;
115
139
  predict(p: CalibrationPrediction): void;
116
140
  correct(prior: string, p: CalibrationPrediction, reason: string): void;
117
- outcome(value: TrustReferenceOutcome, authorizedReferenceDigests: readonly string[]): void;
141
+ outcome(value: TrustReferenceOutcome, authorizedReferenceDigests: readonly string[], referenceAuthor?: string): void;
118
142
  expose(id: string, now: number): {
119
143
  replayed: boolean;
120
144
  mode: "ask" | "silent" | "retire";
@@ -136,8 +136,15 @@ export function openTrustLifecycle(directory) {
136
136
  const outcome = { kind: 'prediction', targetId: p.id, value: resolved.current.disposition === 'confirmed_defect', evidenceManifestId: ref.manifestId, referenceId: ref.decisionId };
137
137
  return { outcome, caseReference: ref, digest: learningHash({ outcome, caseReference: ref }), tip: s.tip };
138
138
  };
139
- return { inspect, history: () => journal.read(), previewCaseOutcome,
140
- linkCaseOutcome(predictionId, reference, authorizedDigests) {
139
+ const previewExposure = (now) => {
140
+ const view = inspect(now), policy = input.exposure ? { ...input.exposure, attentionRemaining: Math.max(0, input.exposure.attentionRemaining - view.attentionUsed) } : null;
141
+ const report = view.calibration.reports.find(r => policy && r.kind === policy.kind && r.split === policy.split);
142
+ return view.retired ? { mode: 'retire', reason: 'previously-retired' } : report ? recommendExposure(report, policy, now) : { mode: 'silent', reason: policy ? 'insufficient-independent-evidence' : 'policy-unavailable' };
143
+ };
144
+ return { inspect, configuration: () => learningCopy(input), previewExposure, history: () => journal.read(), previewCaseOutcome,
145
+ linkCaseOutcome(predictionId, reference, authorizedDigests, referenceAuthor) {
146
+ if (referenceAuthor !== undefined && !text(referenceAuthor))
147
+ throw Error('explicit reference author required');
141
148
  const preview = previewCaseOutcome(predictionId, reference);
142
149
  if (!authorizedDigests.includes(preview.digest))
143
150
  throw Error('independent exact reference authority required');
@@ -150,7 +157,7 @@ export function openTrustLifecycle(directory) {
150
157
  throw Error('reference identity conflict');
151
158
  return;
152
159
  }
153
- journal.append(s.tip, { type: 'outcome', outcome: preview.outcome, caseReference: preview.caseReference, authorityDigest: preview.digest });
160
+ journal.append(s.tip, { type: 'outcome', outcome: preview.outcome, caseReference: preview.caseReference, authorityDigest: preview.digest, ...(referenceAuthor === undefined ? {} : { referenceAuthor }) });
154
161
  },
155
162
  predict(p) { const safe = prediction(p), s = replay(); if (s.allIds.has(safe.id)) {
156
163
  if (learningHash(s.predictions.get(safe.id) ?? null) !== learningHash(safe))
@@ -159,7 +166,9 @@ export function openTrustLifecycle(directory) {
159
166
  } journal.append(s.tip, { type: 'prediction', prediction: safe }); },
160
167
  correct(prior, p, reason) { const safe = prediction(p), s = replay(), old = s.predictions.get(prior); if (!old || old.incidentId !== safe.incidentId || s.allIds.has(safe.id) || !text(reason))
161
168
  throw Error('stale or invalid prediction correction'); journal.append(s.tip, { type: 'correction', prior, prediction: safe, reason }); },
162
- outcome(value, authorizedReferenceDigests) {
169
+ outcome(value, authorizedReferenceDigests, referenceAuthor) {
170
+ if (referenceAuthor !== undefined && !text(referenceAuthor))
171
+ throw Error('explicit reference author required');
163
172
  const r = learningCopy(value);
164
173
  if (Object.keys(r).sort().join() !== 'evidenceManifestId,kind,referenceId,targetId,value' || !['prediction', 'unflagged'].includes(r.kind) || !text(r.targetId) || !text(r.referenceId) || typeof r.value !== 'boolean')
165
174
  throw Error('invalid reference outcome');
@@ -176,7 +185,7 @@ export function openTrustLifecycle(directory) {
176
185
  throw Error('reference identity conflict');
177
186
  return;
178
187
  }
179
- journal.append(s.tip, { type: 'outcome', outcome: r, authorityDigest: digest });
188
+ journal.append(s.tip, { type: 'outcome', outcome: r, authorityDigest: digest, ...(referenceAuthor === undefined ? {} : { referenceAuthor }) });
180
189
  },
181
190
  expose(id, now) {
182
191
  if (!text(id))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skill-harness/adapters",
3
- "version": "0.14.0",
3
+ "version": "0.16.0",
4
4
  "description": "skill-harness harness adapters — pi runner + claude-code judge routing (internal API)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -40,7 +40,7 @@
40
40
  "prepack": "node ../../scripts/release-pack.mjs --guard"
41
41
  },
42
42
  "dependencies": {
43
- "@skill-harness/core": "0.14.0",
43
+ "@skill-harness/core": "0.16.0",
44
44
  "typebox": "1.3.4"
45
45
  }
46
46
  }