@happyvertical/smrt-ingestion 0.55.6 → 0.55.8
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/AGENTS.md +13 -3
- package/FEEDBACK.md +156 -0
- package/README.md +15 -3
- package/REVIEW.md +137 -0
- package/dist/chunks/{execution-C6HJvl9e.js → execution-C7sTFXFU.js} +375 -11
- package/dist/chunks/execution-C7sTFXFU.js.map +1 -0
- package/dist/chunks/execution-internal-DWteDHM2.js.map +1 -1
- package/dist/chunks/feedback-C3OHD4sA.js +625 -0
- package/dist/chunks/feedback-C3OHD4sA.js.map +1 -0
- package/dist/chunks/{extraction-bseWZuWN.js → proposal-errors-z24VKWnQ.js} +10 -2
- package/dist/chunks/proposal-errors-z24VKWnQ.js.map +1 -0
- package/dist/dto.d.ts +2 -0
- package/dist/dto.d.ts.map +1 -1
- package/dist/execution-internal.d.ts +3 -1
- package/dist/execution-internal.d.ts.map +1 -1
- package/dist/execution.d.ts +15 -1
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +1 -1
- package/dist/feedback-contracts.d.ts +51 -0
- package/dist/feedback-contracts.d.ts.map +1 -0
- package/dist/feedback-dto.d.ts +106 -0
- package/dist/feedback-dto.d.ts.map +1 -0
- package/dist/feedback-internal.d.ts +19 -0
- package/dist/feedback-internal.d.ts.map +1 -0
- package/dist/feedback.d.ts +54 -0
- package/dist/feedback.d.ts.map +1 -0
- package/dist/manifest.json +34 -1
- package/dist/models.js +1 -1
- package/dist/models.js.map +1 -1
- package/dist/proposal-contracts.d.ts +4 -0
- package/dist/proposal-contracts.d.ts.map +1 -1
- package/dist/proposal-dto.d.ts +4 -0
- package/dist/proposal-dto.d.ts.map +1 -1
- package/dist/proposal-errors.d.ts +5 -0
- package/dist/proposal-errors.d.ts.map +1 -0
- package/dist/proposal-sdk.d.ts.map +1 -1
- package/dist/proposals.d.ts +4 -1
- package/dist/proposals.d.ts.map +1 -1
- package/dist/proposals.js +114 -15
- package/dist/proposals.js.map +1 -1
- package/dist/review-dto.d.ts +115 -0
- package/dist/review-dto.d.ts.map +1 -0
- package/dist/server.d.ts +24 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +146 -54
- package/dist/server.js.map +1 -1
- package/dist/smrt-knowledge.json +97 -14
- package/dist/svelte/components/ActionReview.svelte +232 -0
- package/dist/svelte/components/ActionReview.svelte.d.ts +15 -0
- package/dist/svelte/components/ActionReview.svelte.d.ts.map +1 -0
- package/dist/svelte/components/EvidenceViewer.svelte +31 -0
- package/dist/svelte/components/EvidenceViewer.svelte.d.ts +8 -0
- package/dist/svelte/components/EvidenceViewer.svelte.d.ts.map +1 -0
- package/dist/svelte/components/InboxView.svelte +119 -0
- package/dist/svelte/components/InboxView.svelte.d.ts +9 -0
- package/dist/svelte/components/InboxView.svelte.d.ts.map +1 -0
- package/dist/svelte/components/IntakeInbox.svelte +11 -0
- package/dist/svelte/components/IntakeInbox.svelte.d.ts +10 -0
- package/dist/svelte/components/IntakeInbox.svelte.d.ts.map +1 -0
- package/dist/svelte/components/IntakeReview.svelte +11 -0
- package/dist/svelte/components/IntakeReview.svelte.d.ts +10 -0
- package/dist/svelte/components/IntakeReview.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ReviewView.svelte +243 -0
- package/dist/svelte/components/ReviewView.svelte.d.ts +9 -0
- package/dist/svelte/components/ReviewView.svelte.d.ts.map +1 -0
- package/dist/svelte/i18n.d.ts +72 -0
- package/dist/svelte/i18n.d.ts.map +1 -0
- package/dist/svelte/i18n.js +72 -0
- package/dist/svelte/index.d.ts +5 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +3 -0
- package/dist/svelte/view-utils.d.ts +13 -0
- package/dist/svelte/view-utils.d.ts.map +1 -0
- package/dist/svelte/view-utils.js +96 -0
- package/package.json +49 -22
- package/dist/chunks/execution-C6HJvl9e.js.map +0 -1
- package/dist/chunks/extraction-bseWZuWN.js.map +0 -1
|
@@ -42,6 +42,10 @@ export interface GenerativeProposalInput {
|
|
|
42
42
|
candidates: ProposalCandidate[];
|
|
43
43
|
}>;
|
|
44
44
|
instructions: string;
|
|
45
|
+
/** Bounded, currently eligible examples; neither evidence nor authority. */
|
|
46
|
+
examples?: import('./feedback-dto.js').FeedbackSelection;
|
|
47
|
+
/** Authenticated human correction carried through fresh extraction; never model authority. */
|
|
48
|
+
humanCorrection?: IntakeValues;
|
|
45
49
|
}
|
|
46
50
|
/** Inject only trusted SDK-bound adapters. Generative output is always untrusted. */
|
|
47
51
|
export interface ProposalGenerator {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposal-contracts.d.ts","sourceRoot":"","sources":["../src/proposal-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EACV,iBAAiB,EACjB,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,mFAAmF;AACnF,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IAC9B,kFAAkF;IAClF,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC,CAAC;IAC7D,2EAA2E;IAC3E,UAAU,CAAC,CACT,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,cAAc,EACvB,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,GACtB,OAAO,CAAC;QACT,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC,CAAC;QAC7C,OAAO,EAAE,OAA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dist/proposal-dto.d.ts
CHANGED
|
@@ -82,6 +82,10 @@ export interface GenerationOutput {
|
|
|
82
82
|
candidates: ProposalCandidate[];
|
|
83
83
|
}>;
|
|
84
84
|
provenance: {
|
|
85
|
+
feedback?: {
|
|
86
|
+
query: string;
|
|
87
|
+
selection: import('./feedback-dto.js').FeedbackReferences;
|
|
88
|
+
};
|
|
85
89
|
configurationVersion: string;
|
|
86
90
|
promptVersion: string;
|
|
87
91
|
catalogDigest: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposal-dto.d.ts","sourceRoot":"","sources":["../src/proposal-dto.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAClE,OAAO,KAAK,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;CACxB;AACD,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB;IACpE,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,YAAY,CAAC;IAC5B,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,MAAM,EAAE,cAAc,CAAC;CACxB;AACD,MAAM,WAAW,iBAAiB;IAChC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC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KAAK,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;CACJ;AACD,MAAM,MAAM,gBAAgB,GACxB;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,UAAU,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposal-errors.d.ts","sourceRoot":"","sources":["../src/proposal-errors.ts"],"names":[],"mappings":"AAAA,yFAAyF;AACzF,qBAAa,4BAA6B,SAAQ,KAAK;;CAKtD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposal-sdk.d.ts","sourceRoot":"","sources":["../src/proposal-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,8FAA8F;AAC9F,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACjC,kBAAkB,EAAE,gBAAgB,EACpC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC/C,iBAAiB,
|
|
1
|
+
{"version":3,"file":"proposal-sdk.d.ts","sourceRoot":"","sources":["../src/proposal-sdk.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EAGZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,KAAK,gBAAgB,EAAoB,MAAM,uBAAuB,CAAC;AAChF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,8FAA8F;AAC9F,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,EACjC,kBAAkB,EAAE,gBAAgB,EACpC,MAAM,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC/C,iBAAiB,CAqDnB;AAED,gFAAgF;AAChF,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,iBAAiB,GAAG,QAAQ,CAAC,GACtD,cAAc,CAYhB"}
|
package/dist/proposals.d.ts
CHANGED
|
@@ -20,6 +20,8 @@ export declare class IngestionProposalService {
|
|
|
20
20
|
private allowedProviders;
|
|
21
21
|
private catalog;
|
|
22
22
|
listHandlers(itemId: string): Promise<ProposalCatalogEntry[]>;
|
|
23
|
+
/** Public retrieval derives catalog/candidates and compatibility on the server. */
|
|
24
|
+
retrieveFeedback(input: import('./feedback-dto.js').RetrieveFeedbackInput): Promise<import('./feedback-dto.js').FeedbackSelection>;
|
|
23
25
|
findCandidates(input: {
|
|
24
26
|
itemId: string;
|
|
25
27
|
handlerId: string;
|
|
@@ -30,10 +32,11 @@ export declare class IngestionProposalService {
|
|
|
30
32
|
prepareGeneration(itemId: string, attemptId: string): Promise<GenerationStageConfiguration>;
|
|
31
33
|
private extraction;
|
|
32
34
|
private live;
|
|
35
|
+
private feedbackGate;
|
|
33
36
|
private deadline;
|
|
34
37
|
generate(lease: AnalysisLease): Promise<boolean>;
|
|
35
38
|
private decide;
|
|
36
|
-
[generationSnapshotRead](itemId: string, run: TransactionRunner<CompletedAnalysisSnapshot>, read: (db: DatabaseInterface) => Promise<CompletedAnalysisSnapshot
|
|
39
|
+
[generationSnapshotRead](itemId: string, run: TransactionRunner<CompletedAnalysisSnapshot>, read: (db: DatabaseInterface) => Promise<CompletedAnalysisSnapshot>, afterRead?: (db: DatabaseInterface, snapshot: CompletedAnalysisSnapshot) => Promise<void>, requireReview?: boolean): Promise<CompletedAnalysisSnapshot>;
|
|
37
40
|
/** Internal stage read gate; the foundation owns current snapshot/digest checks. */
|
|
38
41
|
private authorizeCompletedSnapshot;
|
|
39
42
|
preview(input: PreviewGeneratedInput): Promise<GeneratedPreview[]>;
|
package/dist/proposals.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"proposals.d.ts","sourceRoot":"","sources":["../src/proposals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAW5D,OAAO,EAGL,sBAAsB,EACtB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"proposals.d.ts","sourceRoot":"","sources":["../src/proposals.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAW5D,OAAO,EAGL,sBAAsB,EACtB,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,KAAK,EACV,4BAA4B,EAC5B,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EACV,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAGhB,qBAAqB,EAErB,oBAAoB,EACrB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,KAAK,EACV,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EACjB,MAAM,aAAa,CAAC;AAErB,mBAAmB,yBAAyB,CAAC;AAC7C,mBAAmB,mBAAmB,CAAC;AACvC,OAAO,EACL,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,mBAAmB,CAAC;AAiB3B,oFAAoF;AACpF,qBAAa,wBAAwB;I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AE,iBAAiB,KAAK,OAAO,CAAC,yBAAyB,CAAC,EACnE,SAAS,CAAC,EAAE,CACV,EAAE,EAAE,iBAAiB,EACrB,QAAQ,EAAE,yBAAyB,KAChC,OAAO,CAAC,IAAI,CAAC,EAClB,aAAa,UAAQ,GACpB,OAAO,CAAC,yBAAyB,CAAC;IAoCrC,oFAAoF;YACtE,0BAA0B;IA8ClC,OAAO,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC;CA0HzE"}
|
package/dist/proposals.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as __toESM, r as intakeBindingDigest, s as require_ajv, t as IntakeExecutionService } from "./chunks/execution-C7sTFXFU.js";
|
|
2
2
|
import { n as generationSnapshotRead, t as discoveryTransaction } from "./chunks/execution-internal-DWteDHM2.js";
|
|
3
3
|
import { a as providerIdentity } from "./chunks/extraction-providers-C66ADDVe.js";
|
|
4
|
-
import {
|
|
4
|
+
import { i as proposeDocumentSplits, t as GenerationSnapshotStaleError } from "./chunks/proposal-errors-z24VKWnQ.js";
|
|
5
|
+
import { t as IntakeFeedbackService } from "./chunks/feedback-C3OHD4sA.js";
|
|
5
6
|
import { executeDecision } from "@happyvertical/smrt-core";
|
|
6
7
|
//#region src/proposal-validation.ts
|
|
7
8
|
var import_ajv = /* @__PURE__ */ __toESM(require_ajv(), 1);
|
|
@@ -257,7 +258,8 @@ function createSDKProposalGenerator(client, configuredIdentity, limits) {
|
|
|
257
258
|
role: "user",
|
|
258
259
|
content: JSON.stringify({
|
|
259
260
|
evidence: input.evidence,
|
|
260
|
-
offered: input.offered
|
|
261
|
+
offered: input.offered,
|
|
262
|
+
...input.examples ? { examples: input.examples } : {}
|
|
261
263
|
})
|
|
262
264
|
}], {
|
|
263
265
|
model: identity.model,
|
|
@@ -391,7 +393,13 @@ var IngestionProposalService = class {
|
|
|
391
393
|
}
|
|
392
394
|
async catalog(itemId, scope) {
|
|
393
395
|
const evidence = scope?.evidence ?? await this.service.getEvidence(itemId);
|
|
394
|
-
const discover = scope?.authorize ?? ((id, version, work) => this.execution.withDiscoveryContext(itemId, id, version, work)
|
|
396
|
+
const discover = scope?.authorize ?? ((id, version, work) => this.execution.withDiscoveryContext(itemId, id, version, (context) => work(context, (model, targetId) => this.options.execution.assertTarget({
|
|
397
|
+
db: context.db,
|
|
398
|
+
scope: context.scope,
|
|
399
|
+
itemId,
|
|
400
|
+
model,
|
|
401
|
+
id: targetId
|
|
402
|
+
}))));
|
|
395
403
|
const entries = [];
|
|
396
404
|
for (const handler of this.options.execution.handlers) {
|
|
397
405
|
if (!handler.discovery?.mediaTypes.some((type) => evidence.some((entry) => entry.mediaType === type))) continue;
|
|
@@ -410,6 +418,33 @@ var IngestionProposalService = class {
|
|
|
410
418
|
async listHandlers(itemId) {
|
|
411
419
|
return (await this.catalog(itemId)).map(({ handler }) => handler);
|
|
412
420
|
}
|
|
421
|
+
/** Public retrieval derives catalog/candidates and compatibility on the server. */
|
|
422
|
+
async retrieveFeedback(input) {
|
|
423
|
+
if (Object.keys(input).some((key) => !["itemId", "query"].includes(key)) || typeof input.query !== "string" || input.query.length > this.config.limits.maxQueryLength) throw new Error("Feedback query unavailable");
|
|
424
|
+
const catalog = await this.catalog(input.itemId);
|
|
425
|
+
const offered = [];
|
|
426
|
+
for (const { handler } of catalog) {
|
|
427
|
+
const page = await this.findCandidates({
|
|
428
|
+
itemId: input.itemId,
|
|
429
|
+
query: input.query,
|
|
430
|
+
handlerId: handler.id,
|
|
431
|
+
handlerVersion: handler.version
|
|
432
|
+
});
|
|
433
|
+
offered.push({
|
|
434
|
+
handler,
|
|
435
|
+
candidates: page.items
|
|
436
|
+
});
|
|
437
|
+
}
|
|
438
|
+
return new IntakeFeedbackService(this.options, this.execution).retrieve({
|
|
439
|
+
itemId: input.itemId,
|
|
440
|
+
query: input.query,
|
|
441
|
+
offered,
|
|
442
|
+
promptVersion: this.config.promptVersion,
|
|
443
|
+
configurationVersion: this.config.version,
|
|
444
|
+
model: this.identity,
|
|
445
|
+
providers: [this.identity.provider, ...this.decisionIdentity ? [this.decisionIdentity.provider] : []]
|
|
446
|
+
});
|
|
447
|
+
}
|
|
413
448
|
async findCandidates(input) {
|
|
414
449
|
if (typeof input.query !== "string" || input.query.length > this.config.limits.maxQueryLength) throw new Error("Candidate query limit");
|
|
415
450
|
const limit = input.limit ?? this.config.limits.maxCandidates;
|
|
@@ -458,6 +493,7 @@ var IngestionProposalService = class {
|
|
|
458
493
|
if (source.result.provider !== "smrt-ingestion-extraction") throw new Error("Extraction source required");
|
|
459
494
|
return {
|
|
460
495
|
stage: "interpret",
|
|
496
|
+
...source.configuration.humanCorrection ? { humanCorrection: structuredClone(source.configuration.humanCorrection) } : {},
|
|
461
497
|
proposals: {
|
|
462
498
|
source: pin(source),
|
|
463
499
|
configurationVersion: this.config.version,
|
|
@@ -484,7 +520,7 @@ var IngestionProposalService = class {
|
|
|
484
520
|
}
|
|
485
521
|
return results;
|
|
486
522
|
}
|
|
487
|
-
async live(lease, catalogDigest, offered = []) {
|
|
523
|
+
async live(lease, catalogDigest, offered = [], feedback) {
|
|
488
524
|
await this.service.getGenerationInput(lease);
|
|
489
525
|
const catalog = await this.catalog(lease.itemId);
|
|
490
526
|
if (intakeBindingDigest(catalog) !== catalogDigest) throw new Error("Generation catalog changed");
|
|
@@ -494,9 +530,23 @@ var IngestionProposalService = class {
|
|
|
494
530
|
maxInputBytes = Math.min(maxInputBytes, context.policy.maxBytes);
|
|
495
531
|
for (const candidate of entry.candidates) await context.assertTarget(candidate.model, candidate.id, candidate.revision);
|
|
496
532
|
});
|
|
533
|
+
await this.feedbackGate(lease.itemId, offered, feedback);
|
|
497
534
|
await this.service.getAnalysisInput(lease);
|
|
498
535
|
return maxInputBytes;
|
|
499
536
|
}
|
|
537
|
+
async feedbackGate(itemId, offered, feedback, db) {
|
|
538
|
+
if (!feedback) return;
|
|
539
|
+
if (!this.options.feedback) throw new Error("Feedback configuration unavailable");
|
|
540
|
+
await new IntakeFeedbackService(this.options, this.execution).assertSelection({
|
|
541
|
+
itemId,
|
|
542
|
+
query: feedback.query,
|
|
543
|
+
offered,
|
|
544
|
+
promptVersion: this.config.promptVersion,
|
|
545
|
+
configurationVersion: this.config.version,
|
|
546
|
+
model: this.identity,
|
|
547
|
+
providers: [this.identity.provider, ...this.decisionIdentity ? [this.decisionIdentity.provider] : []]
|
|
548
|
+
}, feedback.selection, db);
|
|
549
|
+
}
|
|
500
550
|
async deadline(work) {
|
|
501
551
|
const controller = new AbortController();
|
|
502
552
|
let timer;
|
|
@@ -587,17 +637,45 @@ var IngestionProposalService = class {
|
|
|
587
637
|
candidates: candidates.items
|
|
588
638
|
});
|
|
589
639
|
}
|
|
640
|
+
let feedbackSelection;
|
|
641
|
+
if (this.options.feedback && !generation.configuration.humanCorrection && query.trim() && output.offered.length) {
|
|
642
|
+
const feedbackQuery = query.slice(0, 4096);
|
|
643
|
+
feedbackSelection = await new IntakeFeedbackService(this.options, this.execution).retrieve({
|
|
644
|
+
itemId: lease.itemId,
|
|
645
|
+
query: feedbackQuery,
|
|
646
|
+
offered: output.offered,
|
|
647
|
+
promptVersion: this.config.promptVersion,
|
|
648
|
+
configurationVersion: this.config.version,
|
|
649
|
+
model: this.identity,
|
|
650
|
+
providers: [this.identity.provider, ...this.decisionIdentity ? [this.decisionIdentity.provider] : []]
|
|
651
|
+
});
|
|
652
|
+
output.provenance.feedback = {
|
|
653
|
+
query: feedbackQuery,
|
|
654
|
+
selection: {
|
|
655
|
+
version: feedbackSelection.version,
|
|
656
|
+
configurationDigest: feedbackSelection.configurationDigest,
|
|
657
|
+
examples: feedbackSelection.examples.map(({ feedbackId, digest: digest2 }) => ({
|
|
658
|
+
feedbackId,
|
|
659
|
+
digest: digest2
|
|
660
|
+
}))
|
|
661
|
+
}
|
|
662
|
+
};
|
|
663
|
+
}
|
|
664
|
+
const humanCorrection = generation.configuration.humanCorrection;
|
|
665
|
+
if (intakeBindingDigest(humanCorrection ?? null) !== intakeBindingDigest(source.configuration.humanCorrection ?? null)) throw new StageFailure("integrity");
|
|
590
666
|
const input = {
|
|
591
667
|
evidence,
|
|
592
668
|
offered: output.offered,
|
|
593
|
-
instructions
|
|
669
|
+
instructions,
|
|
670
|
+
...feedbackSelection ? { examples: feedbackSelection } : {},
|
|
671
|
+
...humanCorrection ? { humanCorrection: structuredClone(record(humanCorrection)) } : {}
|
|
594
672
|
};
|
|
595
673
|
if (bytes(input) > Math.min(this.config.limits.maxInputBytes, ...catalog.map((entry) => entry.maxBytes)) || bytes(publication()) > maxBytes) throw new StageFailure("limit");
|
|
596
674
|
if (!catalog.length || !evidence.some((entry) => entry.segments.some((segment) => segment.text.trim()))) {
|
|
597
675
|
output.outcome = "unknown";
|
|
598
676
|
output.warnings.push("no_supported_interpretation");
|
|
599
677
|
} else {
|
|
600
|
-
await this.live(lease, expected.catalogDigest, output.offered);
|
|
678
|
+
if (bytes(input) > await this.live(lease, expected.catalogDigest, output.offered, output.provenance.feedback)) throw new StageFailure("limit");
|
|
601
679
|
const generated = await this.deadline(async (signal) => {
|
|
602
680
|
try {
|
|
603
681
|
return await this.config.generator.generate(structuredClone(input), {
|
|
@@ -608,11 +686,19 @@ var IngestionProposalService = class {
|
|
|
608
686
|
throw new StageFailure("unavailable");
|
|
609
687
|
}
|
|
610
688
|
});
|
|
611
|
-
await this.live(lease, expected.catalogDigest, output.offered);
|
|
689
|
+
await this.live(lease, expected.catalogDigest, output.offered, output.provenance.feedback);
|
|
612
690
|
if (!["complete", "unknown"].includes(generated.completion)) throw new StageFailure("malformed_output");
|
|
613
691
|
if (generated.completion === "unknown") output.warnings.push("generation_completion_unknown");
|
|
614
692
|
if (bytes(generated.output) > maxBytes) throw new StageFailure("limit");
|
|
615
693
|
Object.assign(output, validateSuggestions(generated.output, output.offered, extraction, this.config.limits, generation.revision));
|
|
694
|
+
if (humanCorrection) {
|
|
695
|
+
const correction = record(humanCorrection);
|
|
696
|
+
if (correction.kind !== "logical_split" || !output.splits.some((split) => split.evidenceId === correction.evidenceId && intakeBindingDigest(split.groups) === intakeBindingDigest(correction.groups))) {
|
|
697
|
+
output.outcome = "needs_review";
|
|
698
|
+
output.suggestions = [];
|
|
699
|
+
output.warnings.push("human_split_not_respected");
|
|
700
|
+
}
|
|
701
|
+
}
|
|
616
702
|
output.provenance.usage = safeUsage(generated.usage);
|
|
617
703
|
if (this.config.decision && output.suggestions.length) await this.decide(lease, output, input);
|
|
618
704
|
if (extraction.some((entry) => entry.capabilities.some((capability) => capability.truncation === "unknown"))) output.warnings.push("source_completion_unknown");
|
|
@@ -640,7 +726,7 @@ var IngestionProposalService = class {
|
|
|
640
726
|
output.warnings.push("output_limit");
|
|
641
727
|
if (bytes(publication()) > maxBytes) return this.service.failAnalysis(lease, "limit");
|
|
642
728
|
}
|
|
643
|
-
await this.live(lease, expected.catalogDigest, output.offered);
|
|
729
|
+
await this.live(lease, expected.catalogDigest, output.offered, output.provenance.feedback);
|
|
644
730
|
return this.service.completeAnalysis(lease, publication());
|
|
645
731
|
}
|
|
646
732
|
async decide(lease, output, input) {
|
|
@@ -685,7 +771,7 @@ var IngestionProposalService = class {
|
|
|
685
771
|
};
|
|
686
772
|
const requestBytes = bytes(request);
|
|
687
773
|
const assertRequestBudget = async () => {
|
|
688
|
-
const maxInputBytes = await this.live(lease, output.provenance.catalogDigest, output.offered);
|
|
774
|
+
const maxInputBytes = await this.live(lease, output.provenance.catalogDigest, output.offered, output.provenance.feedback);
|
|
689
775
|
if (requestBytes > maxInputBytes) throw new StageFailure("limit");
|
|
690
776
|
};
|
|
691
777
|
await assertRequestBudget();
|
|
@@ -709,7 +795,7 @@ var IngestionProposalService = class {
|
|
|
709
795
|
model: this.decisionIdentity.model
|
|
710
796
|
});
|
|
711
797
|
});
|
|
712
|
-
await this.live(lease, output.provenance.catalogDigest, output.offered);
|
|
798
|
+
await this.live(lease, output.provenance.catalogDigest, output.offered, output.provenance.feedback);
|
|
713
799
|
if (result.provenance.provider !== this.decisionIdentity.provider || result.provenance.model !== this.decisionIdentity.model) throw new StageFailure("malformed_output");
|
|
714
800
|
const answers = {};
|
|
715
801
|
for (const [key, question] of Object.entries(questions)) {
|
|
@@ -775,12 +861,23 @@ var IngestionProposalService = class {
|
|
|
775
861
|
}
|
|
776
862
|
});
|
|
777
863
|
}
|
|
778
|
-
[generationSnapshotRead](itemId, run, read) {
|
|
864
|
+
[generationSnapshotRead](itemId, run, read, afterRead, requireReview = false) {
|
|
779
865
|
return this.execution[discoveryTransaction](run, itemId, async (db, authorize) => {
|
|
780
866
|
const current = await read(db);
|
|
867
|
+
if (requireReview) {
|
|
868
|
+
const offered = record(current.result.output.proposals).offered;
|
|
869
|
+
if (!Array.isArray(offered) || !offered.length) throw new Error("Review catalogue unavailable");
|
|
870
|
+
}
|
|
781
871
|
await this.authorizeCompletedSnapshot(current, authorize);
|
|
872
|
+
const feedbackOutput = record(current.result.output.proposals);
|
|
873
|
+
await this.feedbackGate(itemId, feedbackOutput.offered, feedbackOutput.provenance.feedback, db);
|
|
874
|
+
if (afterRead) {
|
|
875
|
+
await afterRead(db, current);
|
|
876
|
+
await this.authorizeCompletedSnapshot(current, authorize);
|
|
877
|
+
await this.feedbackGate(itemId, feedbackOutput.offered, feedbackOutput.provenance.feedback, db);
|
|
878
|
+
}
|
|
782
879
|
return current;
|
|
783
|
-
});
|
|
880
|
+
}, requireReview);
|
|
784
881
|
}
|
|
785
882
|
/** Internal stage read gate; the foundation owns current snapshot/digest checks. */
|
|
786
883
|
async authorizeCompletedSnapshot(snapshot, authorize) {
|
|
@@ -791,13 +888,15 @@ var IngestionProposalService = class {
|
|
|
791
888
|
authorize
|
|
792
889
|
});
|
|
793
890
|
if (intakeBindingDigest(catalog) !== output.provenance.catalogDigest || intakeBindingDigest(record(snapshot.configuration.proposals).source) !== intakeBindingDigest(output.source)) throw new Error("Generation visibility changed");
|
|
891
|
+
let stale = false;
|
|
794
892
|
for (const entry of output.offered) {
|
|
795
893
|
if (!catalog.some(({ handler }) => intakeBindingDigest(handler) === intakeBindingDigest(entry.handler))) throw new Error("Handler unavailable");
|
|
796
|
-
await authorize(entry.handler.id, entry.handler.version, async (context) => {
|
|
894
|
+
await authorize(entry.handler.id, entry.handler.version, async (context, currentTarget) => {
|
|
797
895
|
if (!this.allowedProviders(context)) throw new Error("Provider unavailable");
|
|
798
|
-
for (const candidate of entry.candidates) await
|
|
896
|
+
for (const candidate of entry.candidates) if ((await currentTarget(candidate.model, candidate.id)).revision !== candidate.revision) stale = true;
|
|
799
897
|
});
|
|
800
898
|
}
|
|
899
|
+
if (stale) throw new GenerationSnapshotStaleError();
|
|
801
900
|
}
|
|
802
901
|
async preview(input) {
|
|
803
902
|
if (!input.selections.length || input.selections.length > this.config.limits.maxSuggestions || new Set(input.selections.map((selection) => selection.index)).size !== input.selections.length || new Set(input.selections.map((selection) => selection.intentionKey)).size !== input.selections.length) throw new Error("Invalid proposal selection");
|