@principles/core 1.288.1 → 1.289.1
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/runtime-v2/bridge-result-shaper.d.ts +8 -0
- package/dist/runtime-v2/bridge-result-shaper.d.ts.map +1 -1
- package/dist/runtime-v2/bridge-result-shaper.js +61 -3
- package/dist/runtime-v2/bridge-result-shaper.js.map +1 -1
- package/dist/runtime-v2/candidate-intake-service.d.ts +62 -2
- package/dist/runtime-v2/candidate-intake-service.d.ts.map +1 -1
- package/dist/runtime-v2/candidate-intake-service.js +234 -77
- package/dist/runtime-v2/candidate-intake-service.js.map +1 -1
- package/dist/runtime-v2/index.d.ts +2 -0
- package/dist/runtime-v2/index.d.ts.map +1 -1
- package/dist/runtime-v2/index.js +5 -0
- package/dist/runtime-v2/index.js.map +1 -1
- package/dist/runtime-v2/pain-signal-bridge.d.ts +28 -0
- package/dist/runtime-v2/pain-signal-bridge.d.ts.map +1 -1
- package/dist/runtime-v2/pain-signal-bridge.js +144 -1
- package/dist/runtime-v2/pain-signal-bridge.js.map +1 -1
- package/dist/runtime-v2/pain-signal-runtime-factory.d.ts +35 -6
- package/dist/runtime-v2/pain-signal-runtime-factory.d.ts.map +1 -1
- package/dist/runtime-v2/pain-signal-runtime-factory.js +162 -14
- package/dist/runtime-v2/pain-signal-runtime-factory.js.map +1 -1
- package/dist/runtime-v2/pain-to-principle-service.d.ts +10 -0
- package/dist/runtime-v2/pain-to-principle-service.d.ts.map +1 -1
- package/dist/runtime-v2/pain-to-principle-service.js +11 -1
- package/dist/runtime-v2/pain-to-principle-service.js.map +1 -1
- package/dist/telemetry-event.d.ts +2 -2
- package/dist/telemetry-event.d.ts.map +1 -1
- package/dist/telemetry-event.js +5 -0
- package/dist/telemetry-event.js.map +1 -1
- package/package.json +1 -1
|
@@ -40,6 +40,14 @@ interface ShapeBridgeResultBase {
|
|
|
40
40
|
* reported as routed / not_internalizable rather than as a failed run.
|
|
41
41
|
*/
|
|
42
42
|
ledgerEligibleCandidateCount: number;
|
|
43
|
+
/**
|
|
44
|
+
* PRI-917 v0.3.3 — candidateIds parked by the Reuse Review Gate (suspected
|
|
45
|
+
* duplicates awaiting the Owner). A parked ledger-eligible candidate has NO
|
|
46
|
+
* ledger entry BY DESIGN, so a batch whose ledger-eligible candidates are
|
|
47
|
+
* ALL parked is a degraded "waiting for the Owner" outcome, not the intake
|
|
48
|
+
* failure this branch used to report.
|
|
49
|
+
*/
|
|
50
|
+
reuseReviewRequiredCandidateIds?: string[];
|
|
43
51
|
/** PRI-539: candidates admitted+ledgered but not internalizable (MVP-disabled channel). */
|
|
44
52
|
notInternalizable?: NotInternalizableCandidate[];
|
|
45
53
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-result-shaper.d.ts","sourceRoot":"","sources":["../../src/runtime-v2/bridge-result-shaper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,sBAAsB,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAClG,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAC;AAEpE,2DAA2D;AAC3D,UAAU,qBAAqB;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;;;;;;;;;OAUG;IACH,4BAA4B,EAAE,MAAM,CAAC;IACrC,2FAA2F;IAC3F,iBAAiB,CAAC,EAAE,0BAA0B,EAAE,CAAC;CAClD;AAED,2EAA2E;AAC3E,MAAM,WAAW,2BAA4B,SAAQ,qBAAqB;IACxE,IAAI,EAAE,OAAO,CAAC;IACd,gBAAg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+E;AAC/E,MAAM,WAAW,8BAA+B,SAAQ,qBAAqB;IAC3E,IAAI,EAAE,UAAU,CAAC;CAClB;AAED,MAAM,MAAM,sBAAsB,GAC9B,2BAA2B,GAC3B,8BAA8B,CAAC;AAEnC;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,sBAAsB,CA4LvF"}
|
|
@@ -37,12 +37,37 @@ export function shapeBridgeResult(input) {
|
|
|
37
37
|
const notInternalizableNote = notInternalizable.length > 0
|
|
38
38
|
? `not_internalizable:${notInternalizable.map((n) => `${n.candidateId}=${n.reason}`).join(',')}`
|
|
39
39
|
: '';
|
|
40
|
+
// PRI-917 v0.3.3 review fix (P2-2): parked candidates must stay visible in
|
|
41
|
+
// MIXED batches too. Previously only a fully-parked batch surfaced the
|
|
42
|
+
// review requirement; a batch with one ledgered and one parked candidate
|
|
43
|
+
// reported plain succeeded and hid the pending item from the Owner.
|
|
44
|
+
const parked = input.reuseReviewRequiredCandidateIds ?? [];
|
|
45
|
+
const parkedNote = parked.length > 0
|
|
46
|
+
? `reuse_review_required:${parked.join(',')} — suspected duplicates parked for Owner review; nextAction: pd candidate review --candidate-id <id> --decide reuse|create`
|
|
47
|
+
: '';
|
|
40
48
|
const admittedCount = admissionResults.filter((a) => a.admission.decision === 'admitted').length;
|
|
41
49
|
const nonAdmittedCount = admissionResults.length - admittedCount;
|
|
42
50
|
// Admitted LEDGER-ELIGIBLE candidates exist but intake produced no ledger
|
|
43
51
|
// entries. Non-principle kinds are excluded here: the Principle Ledger write
|
|
44
52
|
// boundary refuses them by design (Phase 1 / PR1), which is not a failure.
|
|
53
|
+
// PRI-917 v0.3.3: candidates parked by the Reuse Review Gate also have no
|
|
54
|
+
// ledger entry BY DESIGN — when EVERY ledger-eligible candidate is parked,
|
|
55
|
+
// the run is a degraded "awaiting the Owner" outcome (rc-9), not a failure.
|
|
45
56
|
if (autoIntakeEnabled && input.ledgerEligibleCandidateCount > 0 && ledgerEntryIds.length === 0) {
|
|
57
|
+
if (parked.length > 0 && parked.length >= input.ledgerEligibleCandidateCount) {
|
|
58
|
+
return {
|
|
59
|
+
status: 'degraded',
|
|
60
|
+
painId,
|
|
61
|
+
taskId,
|
|
62
|
+
runId,
|
|
63
|
+
artifactId,
|
|
64
|
+
candidateIds,
|
|
65
|
+
ledgerEntryIds,
|
|
66
|
+
admissionResults,
|
|
67
|
+
notInternalizable: input.notInternalizable,
|
|
68
|
+
message: parkedNote,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
46
71
|
return {
|
|
47
72
|
status: 'failed',
|
|
48
73
|
painId,
|
|
@@ -83,11 +108,12 @@ export function shapeBridgeResult(input) {
|
|
|
83
108
|
ledgerEntryIds,
|
|
84
109
|
admissionResults,
|
|
85
110
|
notInternalizable: input.notInternalizable,
|
|
86
|
-
message: `partial_admission:${admittedCount}_admitted_${nonAdmittedCount}_gated${seedFailureNote ? `; ${seedFailureNote}` : ''}${notInternalizableNote ? `; ${notInternalizableNote}` : ''}`,
|
|
111
|
+
message: `partial_admission:${admittedCount}_admitted_${nonAdmittedCount}_gated${seedFailureNote ? `; ${seedFailureNote}` : ''}${notInternalizableNote ? `; ${notInternalizableNote}` : ''}${parkedNote ? `; ${parkedNote}` : ''}`,
|
|
87
112
|
};
|
|
88
113
|
}
|
|
89
|
-
// Success (or degraded when seed failed
|
|
90
|
-
|
|
114
|
+
// Success (or degraded when seed failed, a candidate was not internalizable,
|
|
115
|
+
// or a candidate is parked awaiting the Owner — P2-2)
|
|
116
|
+
const combinedNote = [notInternalizableNote, seedFailureNote, parkedNote].filter(Boolean).join('; ');
|
|
91
117
|
return {
|
|
92
118
|
status: combinedNote ? 'degraded' : 'succeeded',
|
|
93
119
|
painId,
|
|
@@ -104,7 +130,25 @@ export function shapeBridgeResult(input) {
|
|
|
104
130
|
// Existing path: no admission results, simpler decision tree.
|
|
105
131
|
// Phase 1 / PR1: same reasoning as the fresh path — only ledger-eligible
|
|
106
132
|
// candidates can be legitimately "missing" a ledger entry.
|
|
133
|
+
// The caller passes candidates whose replay admission and read-only reuse
|
|
134
|
+
// review confirmed a current reuse recommendation. Pending alone proves
|
|
135
|
+
// neither admission nor reuse.
|
|
136
|
+
// A replay of a parked task used to flip from the fresh path's
|
|
137
|
+
// review_required outcome into a bare intake failure here.
|
|
138
|
+
const parked = input.reuseReviewRequiredCandidateIds ?? [];
|
|
107
139
|
if (autoIntakeEnabled && input.ledgerEligibleCandidateCount > 0 && ledgerEntryIds.length === 0) {
|
|
140
|
+
if (parked.length > 0 && parked.length >= input.ledgerEligibleCandidateCount) {
|
|
141
|
+
return {
|
|
142
|
+
status: 'degraded',
|
|
143
|
+
painId,
|
|
144
|
+
taskId,
|
|
145
|
+
runId,
|
|
146
|
+
artifactId,
|
|
147
|
+
candidateIds,
|
|
148
|
+
ledgerEntryIds,
|
|
149
|
+
message: `reuse_review_required:${parked.join(',')} — suspected duplicates confirmed by read-only reuse review; nextAction: pd candidate review --candidate-id <id> --decide reuse|create`,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
108
152
|
return {
|
|
109
153
|
status: 'failed',
|
|
110
154
|
painId,
|
|
@@ -116,6 +160,20 @@ export function shapeBridgeResult(input) {
|
|
|
116
160
|
message: 'Candidate intake did not produce a ledger entry — treating as failed',
|
|
117
161
|
};
|
|
118
162
|
}
|
|
163
|
+
// P2-2/F3: a replayed batch that ledgered SOME candidates while others are
|
|
164
|
+
// still pending keeps the same review_required visibility as the fresh path.
|
|
165
|
+
if (autoIntakeEnabled && parked.length > 0) {
|
|
166
|
+
return {
|
|
167
|
+
status: 'degraded',
|
|
168
|
+
painId,
|
|
169
|
+
taskId,
|
|
170
|
+
runId,
|
|
171
|
+
artifactId,
|
|
172
|
+
candidateIds,
|
|
173
|
+
ledgerEntryIds,
|
|
174
|
+
message: `Task already succeeded; reuse_review_required:${parked.join(',')} — pending candidates await Owner review; nextAction: pd candidate review --candidate-id <id> --decide reuse|create`,
|
|
175
|
+
};
|
|
176
|
+
}
|
|
119
177
|
return {
|
|
120
178
|
status: 'succeeded',
|
|
121
179
|
painId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge-result-shaper.js","sourceRoot":"","sources":["../../src/runtime-v2/bridge-result-shaper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bridge-result-shaper.js","sourceRoot":"","sources":["../../src/runtime-v2/bridge-result-shaper.ts"],"names":[],"mappings":"AAwEA;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC;IAErG,2DAA2D;IAC3D,IAAI,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC9B,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC3B,OAAO;gBACL,MAAM,EAAE,QAAQ;gBAChB,MAAM;gBACN,MAAM;gBACN,KAAK;gBACL,YAAY;gBACZ,cAAc;gBACd,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;gBACxC,OAAO,EAAE,8DAA8D;aACxE,CAAC;QACJ,CAAC;QACD,OAAO;YACL,MAAM,EAAE,QAAQ;YAChB,MAAM;YACN,MAAM;YACN,KAAK;YACL,YAAY;YACZ,cAAc;YACd,OAAO,EAAE,uDAAuD;SACjE,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC3B,MAAM,EAAE,gBAAgB,EAAE,eAAe,EAAE,GAAG,KAAK,CAAC;QACpD,MAAM,iBAAiB,GAAG,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC;QACxD,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC;YACxD,CAAC,CAAC,sBAAsB,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE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,EAAE,sEAAsE;SAChF,CAAC;IACJ,CAAC;IAED,2EAA2E;IAC3E,6EAA6E;IAC7E,IAAI,iBAAiB,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3C,OAAO;YACL,MAAM,EAAE,UAAU;YAClB,MAAM;YACN,MAAM;YACN,KAAK;YACL,UAAU;YACV,YAAY;YACZ,cAAc;YACd,OAAO,EAAE,iDAAiD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,qHAAqH;SAChM,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM,EAAE,WAAW;QACnB,MAAM;QACN,MAAM;QACN,KAAK;QACL,UAAU;QACV,YAAY;QACZ,cAAc;QACd,OAAO,EAAE,wBAAwB;KAClC,CAAC;AACJ,CAAC"}
|
|
@@ -45,6 +45,8 @@ import type { LedgerAdapter, LedgerPrincipleEntry, Recommendation } from './cand
|
|
|
45
45
|
import { CandidateIntakeError } from './candidate-intake.js';
|
|
46
46
|
import type { RuntimeStateManager } from './store/runtime-state-manager.js';
|
|
47
47
|
import type { ReuseDecision, ReuseProposal } from './principle-reuse/reuse-proposal.js';
|
|
48
|
+
import type { ReuseEvaluationOutputV1 } from './principle-reuse/reuse-evaluation-output.js';
|
|
49
|
+
import type { ReuseCandidateInput } from './principle-reuse/reuse-domain.js';
|
|
48
50
|
import type { ReuseEvidenceEntry } from './types/principle-schema.js';
|
|
49
51
|
/**
|
|
50
52
|
* Why the Principle Ledger write boundary refused a candidate (Phase 1 / PR1).
|
|
@@ -72,8 +74,15 @@ import type { ReuseEvidenceEntry } from './types/principle-schema.js';
|
|
|
72
74
|
* yet, so this cannot surface today; but any consumer that renders
|
|
73
75
|
* refusal-specific operator messages MUST branch on
|
|
74
76
|
* `reason === 'reuse_selected'` BEFORE production reuse is enabled.
|
|
77
|
+
* - `reuse_pending_owner` (PRI-917 v0.3.3, OD-PRI917-05) — the Reuse Review
|
|
78
|
+
* Gate ran the semantic evaluation on the AUTO path (no Owner decision
|
|
79
|
+
* function present) and the recommendation was `reuse` with a selection
|
|
80
|
+
* inside the proposal. No Principle is created, NO evidence is written, and
|
|
81
|
+
* the candidate stays PENDING for the Owner. Consumers MUST branch on this
|
|
82
|
+
* reason: unlike every other refusal, the candidate is intentionally kept
|
|
83
|
+
* pending — do not mark it consumed and do not seed internalization for it.
|
|
75
84
|
*/
|
|
76
|
-
export type LedgerRefusalReason = 'non_principle_kind' | 'unknown_kind' | 'reuse_selected';
|
|
85
|
+
export type LedgerRefusalReason = 'non_principle_kind' | 'unknown_kind' | 'reuse_selected' | 'reuse_pending_owner';
|
|
77
86
|
/**
|
|
78
87
|
* Explicit disposition returned by {@link CandidateIntakeService.intake}.
|
|
79
88
|
*
|
|
@@ -91,6 +100,16 @@ export type CandidateIntakeResult = {
|
|
|
91
100
|
* Optional so every existing producer of this variant stays valid.
|
|
92
101
|
*/
|
|
93
102
|
readonly reuseCheck?: ReuseCheckOutcome;
|
|
103
|
+
/**
|
|
104
|
+
* PRI-939 Option A — present ONLY when the auto-path recommendation hook
|
|
105
|
+
* ran and the write proceeded under Rules 2-4 (reuseCheck
|
|
106
|
+
* `recommended_create`): `unavailable` is the observable degradation
|
|
107
|
+
* (evaluation failed — Owner can see why no duplicate protection ran),
|
|
108
|
+
* `recommended` means the hook answered create/uncertain. The park shape
|
|
109
|
+
* carries its own outcome on the refused variant; a recorded reuse
|
|
110
|
+
* resolution (replay) never runs the hook and stays undefined.
|
|
111
|
+
*/
|
|
112
|
+
readonly reuseRecommendation?: ReuseRecommendationOutcome;
|
|
94
113
|
} | {
|
|
95
114
|
readonly outcome: 'refused';
|
|
96
115
|
readonly reason: LedgerRefusalReason;
|
|
@@ -109,6 +128,26 @@ export type CandidateIntakeResult = {
|
|
|
109
128
|
* resolved into `selectedPrincipleId` instead of creating a Principle.
|
|
110
129
|
*/
|
|
111
130
|
readonly reuseEvidence?: ReuseEvidenceEntry;
|
|
131
|
+
/**
|
|
132
|
+
* PRI-917 v0.3.3 — present only when `reason === 'reuse_pending_owner'`:
|
|
133
|
+
* the semantic recommendation that triggered the park. NEVER persisted —
|
|
134
|
+
* the Owner re-evaluates via `pd candidate review` (T7: proposal output
|
|
135
|
+
* cannot mutate ledger/evidence; the park itself writes nothing).
|
|
136
|
+
*/
|
|
137
|
+
readonly reuseRecommendation?: ReuseRecommendationOutcome;
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* PRI-917 v0.3.3 — outcome of the auto-path Reuse Review Gate's evaluation
|
|
141
|
+
* hook. `recommended` wraps the validated `reuse-evaluation-output-v1` payload
|
|
142
|
+
* (a RECOMMENDATION — never a decision); `unavailable` is the observable
|
|
143
|
+
* degradation that lets CREATE proceed (SPEC v0.3.3 Rule 4: evaluation failure
|
|
144
|
+
* must never block learning).
|
|
145
|
+
*/
|
|
146
|
+
export type ReuseRecommendationOutcome = ({
|
|
147
|
+
status: 'recommended';
|
|
148
|
+
} & ReuseEvaluationOutputV1) | {
|
|
149
|
+
status: 'unavailable';
|
|
150
|
+
reason: string;
|
|
112
151
|
};
|
|
113
152
|
/**
|
|
114
153
|
* PRI-917 Slice 2 — what the reuse gate did before a ledger write.
|
|
@@ -119,8 +158,12 @@ export type CandidateIntakeResult = {
|
|
|
119
158
|
* - `no_candidates` — the gate ran and found nothing credible.
|
|
120
159
|
* - `create_decided` — the gate found candidates and the decision function
|
|
121
160
|
* answered `create`; the write proceeded exactly as before.
|
|
161
|
+
* - `recommended_create` (PRI-917 v0.3.3) — the auto-path recommendation hook
|
|
162
|
+
* ran and did NOT answer reuse (create / uncertain / unavailable / selection
|
|
163
|
+
* outside the proposal); the write proceeded per Rules 2-4. Never emitted
|
|
164
|
+
* when only an Owner decision function is configured.
|
|
122
165
|
*/
|
|
123
|
-
export type ReuseCheckOutcome = 'not_configured' | 'no_candidates' | 'create_decided';
|
|
166
|
+
export type ReuseCheckOutcome = 'not_configured' | 'no_candidates' | 'create_decided' | 'recommended_create';
|
|
124
167
|
export interface CandidateIntakeServiceOptions {
|
|
125
168
|
stateManager: RuntimeStateManager;
|
|
126
169
|
ledgerAdapter: LedgerAdapter;
|
|
@@ -132,12 +175,25 @@ export interface CandidateIntakeServiceOptions {
|
|
|
132
175
|
* `reuseCheck: 'not_configured'` so "no gate" is never mistaken for "no
|
|
133
176
|
* duplicate found".
|
|
134
177
|
*
|
|
178
|
+
* Mutually exclusive with reuseRecommendation; supplying both fails at construction.
|
|
135
179
|
* When provided, it receives the bounded proposal and MUST answer `reuse`
|
|
136
180
|
* or `create` — there is no automatic option and no default.
|
|
137
181
|
*/
|
|
138
182
|
reuseDecision?: (proposal: ReuseProposal) => ReuseDecision;
|
|
139
183
|
/** Workspace state dir used for read-only reuse retrieval. */
|
|
140
184
|
reuseStateDir?: string;
|
|
185
|
+
/**
|
|
186
|
+
* PRI-917 v0.3.3 (OD-PRI917-05) — optional auto-path Reuse Review Gate
|
|
187
|
+
* recommendation hook. When injected (WITHOUT `reuseDecision`), the gate
|
|
188
|
+
* runs the semantic evaluation for every candidate with a credible proposal
|
|
189
|
+
* and parks the candidate (`refused/reuse_pending_owner`) when the
|
|
190
|
+
* recommendation is `reuse` with a selection inside the proposal. Any other
|
|
191
|
+
* outcome (create / uncertain / unavailable / throw) degrades to CREATE —
|
|
192
|
+
* evaluation failure must never block learning (Rule 4). The hook is a
|
|
193
|
+
* RECOMMENDATION channel only: it can never write, and it is never injected
|
|
194
|
+
* together with an Owner decision function by production callers.
|
|
195
|
+
*/
|
|
196
|
+
reuseRecommendation?: (claim: ReuseCandidateInput, proposal: ReuseProposal) => Promise<ReuseRecommendationOutcome>;
|
|
141
197
|
}
|
|
142
198
|
/**
|
|
143
199
|
* PRI-917 PR3A (surface audit C4): the candidate-semantics extraction shared
|
|
@@ -189,5 +245,9 @@ export declare class CandidateIntakeService {
|
|
|
189
245
|
* - LEDGER_WRITE_FAILED when ledger write fails
|
|
190
246
|
*/
|
|
191
247
|
intake(candidateId: string): Promise<CandidateIntakeResult>;
|
|
248
|
+
/** Whether the automatic recommendation channel is configured for read-only review. */
|
|
249
|
+
get reuseReviewEnabled(): boolean;
|
|
250
|
+
/** Uses the same input validation and gate as intake, but never writes. */
|
|
251
|
+
reviewReuse(candidateId: string): Promise<CandidateIntakeResult | null>;
|
|
192
252
|
}
|
|
193
253
|
//# sourceMappingURL=candidate-intake-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candidate-intake-service.d.ts","sourceRoot":"","sources":["../../src/runtime-v2/candidate-intake-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAwD,MAAM,uBAAuB,CAAC;AACnH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAQ5E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"candidate-intake-service.d.ts","sourceRoot":"","sources":["../../src/runtime-v2/candidate-intake-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACjG,OAAO,EAAE,oBAAoB,EAAwD,MAAM,uBAAuB,CAAC;AACnH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAQ5E,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AAC5F,OAAO,KAAK,EAA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