@happyvertical/smrt-ingestion 0.55.5 → 0.55.6
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 +2 -0
- package/PROPOSALS.md +173 -0
- package/README.md +3 -0
- package/agents/execution.md +132 -0
- package/dist/chunks/execution-C6HJvl9e.js +7667 -0
- package/dist/chunks/execution-C6HJvl9e.js.map +1 -0
- package/dist/chunks/execution-internal-DWteDHM2.js +7 -0
- package/dist/chunks/execution-internal-DWteDHM2.js.map +1 -0
- package/dist/chunks/extraction-bseWZuWN.js +293 -0
- package/dist/chunks/extraction-bseWZuWN.js.map +1 -0
- package/dist/dto.d.ts +1 -0
- package/dist/dto.d.ts.map +1 -1
- package/dist/execution-contracts.d.ts +3 -0
- package/dist/execution-contracts.d.ts.map +1 -1
- package/dist/execution-internal.d.ts +7 -0
- package/dist/execution-internal.d.ts.map +1 -0
- package/dist/execution.d.ts +9 -1
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +1 -7614
- package/dist/extraction.d.ts.map +1 -1
- package/dist/manifest.json +1 -1
- package/dist/models.js +1 -1
- package/dist/models.js.map +1 -1
- package/dist/proposal-contracts.d.ts +85 -0
- package/dist/proposal-contracts.d.ts.map +1 -0
- package/dist/proposal-dto.d.ts +120 -0
- package/dist/proposal-dto.d.ts.map +1 -0
- package/dist/proposal-sdk.d.ts +12 -0
- package/dist/proposal-sdk.d.ts.map +1 -0
- package/dist/proposal-validation.d.ts +188 -0
- package/dist/proposal-validation.d.ts.map +1 -0
- package/dist/proposals.d.ts +41 -0
- package/dist/proposals.d.ts.map +1 -0
- package/dist/proposals.js +865 -0
- package/dist/proposals.js.map +1 -0
- package/dist/server.d.ts +32 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +119 -289
- package/dist/server.js.map +1 -1
- package/dist/smrt-knowledge.json +24 -8
- package/package.json +19 -13
- package/dist/execution.js.map +0 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { DecisionClient } from '@happyvertical/smrt-core';
|
|
2
|
+
import type { HandlerContext } from './execution-contracts.js';
|
|
3
|
+
import type { IntakeValues } from './execution-dto.js';
|
|
4
|
+
import type { EvidenceLocation, ProviderIdentity } from './extraction-types.js';
|
|
5
|
+
import type { ProposalCandidate, ProposalCatalogEntry, ProposalReferenceField } from './proposal-dto.js';
|
|
6
|
+
/** Optional discovery capability on the existing application execution handler. */
|
|
7
|
+
export interface HandlerDiscovery {
|
|
8
|
+
mediaTypes: readonly string[];
|
|
9
|
+
/** Every existing-record argument exposed to generation must be declared here. */
|
|
10
|
+
references: Readonly<Record<string, ProposalReferenceField>>;
|
|
11
|
+
/** Database reads only; filter in the query before ranking/summarizing. */
|
|
12
|
+
candidates?(query: string, context: HandlerContext, page: {
|
|
13
|
+
limit: number;
|
|
14
|
+
}): Promise<{
|
|
15
|
+
items: Array<Omit<ProposalCandidate, 'key'>>;
|
|
16
|
+
hasMore: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
}
|
|
19
|
+
export interface GenerationLimits {
|
|
20
|
+
maxHandlers: number;
|
|
21
|
+
maxCandidates: number;
|
|
22
|
+
maxSuggestions: number;
|
|
23
|
+
maxInputBytes: number;
|
|
24
|
+
maxOutputBytes: number;
|
|
25
|
+
maxQueryLength: number;
|
|
26
|
+
timeoutMs: number;
|
|
27
|
+
}
|
|
28
|
+
export interface GenerativeProposalInput {
|
|
29
|
+
evidence: Array<{
|
|
30
|
+
evidenceId: string;
|
|
31
|
+
partId: string;
|
|
32
|
+
parentEvidenceId: string | null;
|
|
33
|
+
mediaType: string;
|
|
34
|
+
contentHash: string;
|
|
35
|
+
segments: Array<{
|
|
36
|
+
text: string;
|
|
37
|
+
location: EvidenceLocation;
|
|
38
|
+
}>;
|
|
39
|
+
}>;
|
|
40
|
+
offered: Array<{
|
|
41
|
+
handler: ProposalCatalogEntry;
|
|
42
|
+
candidates: ProposalCandidate[];
|
|
43
|
+
}>;
|
|
44
|
+
instructions: string;
|
|
45
|
+
}
|
|
46
|
+
/** Inject only trusted SDK-bound adapters. Generative output is always untrusted. */
|
|
47
|
+
export interface ProposalGenerator {
|
|
48
|
+
identity: ProviderIdentity;
|
|
49
|
+
generate(input: GenerativeProposalInput, options: {
|
|
50
|
+
signal: AbortSignal;
|
|
51
|
+
maxOutputBytes: number;
|
|
52
|
+
}): Promise<{
|
|
53
|
+
output: unknown;
|
|
54
|
+
completion: 'complete' | 'unknown';
|
|
55
|
+
usage?: Record<string, number>;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
export interface ProposalConfiguration {
|
|
59
|
+
version: string;
|
|
60
|
+
promptVersion: string;
|
|
61
|
+
generator: ProposalGenerator;
|
|
62
|
+
/** Absent means the normal unconfigured decision path, never fake probability. */
|
|
63
|
+
decision?: {
|
|
64
|
+
client: DecisionClient;
|
|
65
|
+
identity: ProviderIdentity;
|
|
66
|
+
};
|
|
67
|
+
minimumDecisionProbability?: number;
|
|
68
|
+
tieMargin?: number;
|
|
69
|
+
limits: GenerationLimits;
|
|
70
|
+
}
|
|
71
|
+
export interface GenerationStageConfiguration extends IntakeValues {
|
|
72
|
+
stage: 'interpret';
|
|
73
|
+
proposals: {
|
|
74
|
+
source: import('./proposal-dto.js').GenerationSourcePin;
|
|
75
|
+
configurationVersion: string;
|
|
76
|
+
promptVersion: string;
|
|
77
|
+
catalogDigest: string;
|
|
78
|
+
generator: ProviderIdentity;
|
|
79
|
+
decision: ProviderIdentity | null;
|
|
80
|
+
limits: GenerationLimits;
|
|
81
|
+
minimumDecisionProbability: number;
|
|
82
|
+
tieMargin: number;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=proposal-contracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposal-contracts.d.ts","sourceRoot":"","sources":["../src/proposal-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA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tB,SAAS,EAAE,gBAAgB,CAAC;QAC5B,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAAC;QAClC,MAAM,EAAE,gBAAgB,CAAC;QACzB,0BAA0B,EAAE,MAAM,CAAC;QACnC,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
/** Browser-safe proposal messages. No callbacks or authority-bearing context. */
|
|
2
|
+
import type { CapabilityDeclaration } from '@happyvertical/smrt-types';
|
|
3
|
+
import type { AnalysisOutput, IntakeEvidenceDTO } from './dto.js';
|
|
4
|
+
import type { IntakeValues, PlanReview, ProposalReview } from './execution-dto.js';
|
|
5
|
+
import type { EvidenceLocation, ProviderIdentity } from './extraction-types.js';
|
|
6
|
+
export interface GenerationSourcePin {
|
|
7
|
+
attemptId: string;
|
|
8
|
+
revision: number;
|
|
9
|
+
inputDigest: string;
|
|
10
|
+
outputDigest: string;
|
|
11
|
+
evidenceDigest: string;
|
|
12
|
+
}
|
|
13
|
+
export interface CompletedAnalysisSnapshot extends GenerationSourcePin {
|
|
14
|
+
itemId: string;
|
|
15
|
+
configuration: IntakeValues;
|
|
16
|
+
evidence: IntakeEvidenceDTO[];
|
|
17
|
+
result: AnalysisOutput;
|
|
18
|
+
}
|
|
19
|
+
export interface ProposalCandidate {
|
|
20
|
+
key: string;
|
|
21
|
+
model: string;
|
|
22
|
+
id: string;
|
|
23
|
+
revision: string;
|
|
24
|
+
label: string;
|
|
25
|
+
}
|
|
26
|
+
export interface CandidatePage {
|
|
27
|
+
items: ProposalCandidate[];
|
|
28
|
+
truncated: boolean;
|
|
29
|
+
}
|
|
30
|
+
export type ProposalReferenceField = {
|
|
31
|
+
kind: 'candidate';
|
|
32
|
+
model: string;
|
|
33
|
+
} | {
|
|
34
|
+
kind: 'evidence';
|
|
35
|
+
};
|
|
36
|
+
export interface ProposalCatalogEntry {
|
|
37
|
+
id: string;
|
|
38
|
+
version: string;
|
|
39
|
+
description: string;
|
|
40
|
+
kind: 'operation' | 'plan';
|
|
41
|
+
/** A plan has no invented aggregate classification; its ordered definition is pinned. */
|
|
42
|
+
capability: CapabilityDeclaration | null;
|
|
43
|
+
argsSchema: IntakeValues;
|
|
44
|
+
references: Record<string, ProposalReferenceField>;
|
|
45
|
+
operation: {
|
|
46
|
+
model: string;
|
|
47
|
+
action: string;
|
|
48
|
+
version: string;
|
|
49
|
+
} | {
|
|
50
|
+
playbookKey: string;
|
|
51
|
+
definitionHash: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export interface ProposalEvidenceReference {
|
|
55
|
+
evidenceId: string;
|
|
56
|
+
location: EvidenceLocation;
|
|
57
|
+
}
|
|
58
|
+
export interface GeneratedSuggestion {
|
|
59
|
+
handlerId: string;
|
|
60
|
+
handlerVersion: string;
|
|
61
|
+
args: IntakeValues;
|
|
62
|
+
evidence: ProposalEvidenceReference[];
|
|
63
|
+
alternatives: string[];
|
|
64
|
+
missingFields: string[];
|
|
65
|
+
explanation: string;
|
|
66
|
+
disposition: 'ready_for_review' | 'needs_review';
|
|
67
|
+
}
|
|
68
|
+
export interface GenerationOutput {
|
|
69
|
+
version: 1;
|
|
70
|
+
outcome: 'proposals' | 'unknown' | 'ambiguous' | 'no_action' | 'needs_review' | 'provider_error';
|
|
71
|
+
suggestions: GeneratedSuggestion[];
|
|
72
|
+
splits: Array<{
|
|
73
|
+
evidenceId: string;
|
|
74
|
+
groups: number[][];
|
|
75
|
+
digest: string;
|
|
76
|
+
}>;
|
|
77
|
+
warnings: string[];
|
|
78
|
+
omittedSuggestions: number;
|
|
79
|
+
source: GenerationSourcePin;
|
|
80
|
+
offered: Array<{
|
|
81
|
+
handler: ProposalCatalogEntry;
|
|
82
|
+
candidates: ProposalCandidate[];
|
|
83
|
+
}>;
|
|
84
|
+
provenance: {
|
|
85
|
+
configurationVersion: string;
|
|
86
|
+
promptVersion: string;
|
|
87
|
+
catalogDigest: string;
|
|
88
|
+
policyVersions: string[];
|
|
89
|
+
generative: ProviderIdentity;
|
|
90
|
+
decision: {
|
|
91
|
+
configured: boolean;
|
|
92
|
+
provider?: string;
|
|
93
|
+
model?: string;
|
|
94
|
+
version?: string;
|
|
95
|
+
answers?: IntakeValues;
|
|
96
|
+
usage?: Record<string, number>;
|
|
97
|
+
};
|
|
98
|
+
usage: Record<string, number>;
|
|
99
|
+
};
|
|
100
|
+
automaticActionEligible: false;
|
|
101
|
+
}
|
|
102
|
+
export interface PreviewGeneratedInput {
|
|
103
|
+
itemId: string;
|
|
104
|
+
attemptId: string;
|
|
105
|
+
/** Explicit stable business intentions supplied by the host, never the model. */
|
|
106
|
+
selections: Array<{
|
|
107
|
+
index: number;
|
|
108
|
+
intentionKey: string;
|
|
109
|
+
expectedRevision: number;
|
|
110
|
+
requestId: string;
|
|
111
|
+
}>;
|
|
112
|
+
}
|
|
113
|
+
export type GeneratedPreview = {
|
|
114
|
+
kind: 'operation';
|
|
115
|
+
review: ProposalReview;
|
|
116
|
+
} | {
|
|
117
|
+
kind: 'plan';
|
|
118
|
+
review: PlanReview;
|
|
119
|
+
};
|
|
120
|
+
//# sourceMappingURL=proposal-dto.d.ts.map
|
|
@@ -0,0 +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,MAA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AAE,MAAM,CAAC;YACjB,OAAO,CAAC,EAAE,YAAY,CAAC;YACvB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;SAChC,CAAC;QACF,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/B,CAAC;IACF,uBAAuB,EAAE,KAAK,CAAC;CAChC;AACD,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,UAAU,EAAE,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,12 @@
|
|
|
1
|
+
import type { AIInterface } from '@happyvertical/ai';
|
|
2
|
+
import type { DecisionClient } from '@happyvertical/smrt-core';
|
|
3
|
+
import { type ProviderIdentity } from './extraction-types.js';
|
|
4
|
+
import type { ProposalGenerator } from './proposal-contracts.js';
|
|
5
|
+
/** Use an existing SDK client; credentials/configuration never enter persisted provenance. */
|
|
6
|
+
export declare function createSDKProposalGenerator(client: Pick<AIInterface, 'chat'>, configuredIdentity: ProviderIdentity, limits: {
|
|
7
|
+
maxTokens: number;
|
|
8
|
+
timeoutMs: number;
|
|
9
|
+
}): ProposalGenerator;
|
|
10
|
+
/** Adapt the SDK's optional capability to core's injected decision boundary. */
|
|
11
|
+
export declare function createSDKProposalDecisionClient(client: Pick<AIInterface, 'getCapabilities' | 'decide'>): DecisionClient;
|
|
12
|
+
//# sourceMappingURL=proposal-sdk.d.ts.map
|
|
@@ -0,0 +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,CAoDnB;AAED,gFAAgF;AAChF,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,iBAAiB,GAAG,QAAQ,CAAC,GACtD,cAAc,CAYhB"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import type { IntakeValues } from './execution-dto.js';
|
|
2
|
+
import type { ExtractionResult } from './extraction-types.js';
|
|
3
|
+
import type { GenerationLimits } from './proposal-contracts.js';
|
|
4
|
+
import type { GenerationOutput } from './proposal-dto.js';
|
|
5
|
+
export declare function record(value: unknown): IntakeValues;
|
|
6
|
+
export declare function text(value: unknown, max?: number): string;
|
|
7
|
+
export declare function safeUsage(value: unknown): Record<string, number>;
|
|
8
|
+
export declare function suggestionSchema(limits: GenerationLimits): {
|
|
9
|
+
type: string;
|
|
10
|
+
additionalProperties: boolean;
|
|
11
|
+
required: string[];
|
|
12
|
+
properties: {
|
|
13
|
+
outcome: {
|
|
14
|
+
enum: string[];
|
|
15
|
+
};
|
|
16
|
+
suggestions: {
|
|
17
|
+
type: string;
|
|
18
|
+
maxItems: number;
|
|
19
|
+
items: {
|
|
20
|
+
type: string;
|
|
21
|
+
additionalProperties: boolean;
|
|
22
|
+
required: string[];
|
|
23
|
+
properties: {
|
|
24
|
+
handlerId: {
|
|
25
|
+
type: string;
|
|
26
|
+
minLength: number;
|
|
27
|
+
maxLength: number;
|
|
28
|
+
};
|
|
29
|
+
handlerVersion: {
|
|
30
|
+
type: string;
|
|
31
|
+
minLength: number;
|
|
32
|
+
maxLength: number;
|
|
33
|
+
};
|
|
34
|
+
args: {
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
evidence: {
|
|
38
|
+
type: string;
|
|
39
|
+
minItems: number;
|
|
40
|
+
maxItems: number;
|
|
41
|
+
items: {
|
|
42
|
+
type: string;
|
|
43
|
+
additionalProperties: boolean;
|
|
44
|
+
required: string[];
|
|
45
|
+
properties: {
|
|
46
|
+
evidenceId: {
|
|
47
|
+
type: string;
|
|
48
|
+
minLength: number;
|
|
49
|
+
maxLength: number;
|
|
50
|
+
};
|
|
51
|
+
location: {
|
|
52
|
+
oneOf: ({
|
|
53
|
+
type: string;
|
|
54
|
+
additionalProperties: boolean;
|
|
55
|
+
required: string[];
|
|
56
|
+
properties: {
|
|
57
|
+
kind: {
|
|
58
|
+
const: string;
|
|
59
|
+
};
|
|
60
|
+
page?: undefined;
|
|
61
|
+
startPage?: undefined;
|
|
62
|
+
endPage?: undefined;
|
|
63
|
+
startMs?: undefined;
|
|
64
|
+
endMs?: undefined;
|
|
65
|
+
};
|
|
66
|
+
} | {
|
|
67
|
+
type: string;
|
|
68
|
+
additionalProperties: boolean;
|
|
69
|
+
required: string[];
|
|
70
|
+
properties: {
|
|
71
|
+
kind: {
|
|
72
|
+
const: string;
|
|
73
|
+
};
|
|
74
|
+
page: {
|
|
75
|
+
type: string;
|
|
76
|
+
minimum: number;
|
|
77
|
+
};
|
|
78
|
+
startPage?: undefined;
|
|
79
|
+
endPage?: undefined;
|
|
80
|
+
startMs?: undefined;
|
|
81
|
+
endMs?: undefined;
|
|
82
|
+
};
|
|
83
|
+
} | {
|
|
84
|
+
type: string;
|
|
85
|
+
additionalProperties: boolean;
|
|
86
|
+
required: string[];
|
|
87
|
+
properties: {
|
|
88
|
+
kind: {
|
|
89
|
+
const: string;
|
|
90
|
+
};
|
|
91
|
+
startPage: {
|
|
92
|
+
type: string;
|
|
93
|
+
minimum: number;
|
|
94
|
+
};
|
|
95
|
+
endPage: {
|
|
96
|
+
type: string;
|
|
97
|
+
minimum: number;
|
|
98
|
+
};
|
|
99
|
+
page?: undefined;
|
|
100
|
+
startMs?: undefined;
|
|
101
|
+
endMs?: undefined;
|
|
102
|
+
};
|
|
103
|
+
} | {
|
|
104
|
+
type: string;
|
|
105
|
+
additionalProperties: boolean;
|
|
106
|
+
required: string[];
|
|
107
|
+
properties: {
|
|
108
|
+
kind: {
|
|
109
|
+
const: string;
|
|
110
|
+
};
|
|
111
|
+
startMs: {
|
|
112
|
+
type: string;
|
|
113
|
+
minimum: number;
|
|
114
|
+
};
|
|
115
|
+
endMs: {
|
|
116
|
+
type: string;
|
|
117
|
+
minimum: number;
|
|
118
|
+
};
|
|
119
|
+
page?: undefined;
|
|
120
|
+
startPage?: undefined;
|
|
121
|
+
endPage?: undefined;
|
|
122
|
+
};
|
|
123
|
+
})[];
|
|
124
|
+
};
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
alternatives: {
|
|
129
|
+
type: string;
|
|
130
|
+
uniqueItems: boolean;
|
|
131
|
+
maxItems: number;
|
|
132
|
+
items: {
|
|
133
|
+
type: string;
|
|
134
|
+
minLength: number;
|
|
135
|
+
maxLength: number;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
missingFields: {
|
|
139
|
+
type: string;
|
|
140
|
+
uniqueItems: boolean;
|
|
141
|
+
maxItems: number;
|
|
142
|
+
items: {
|
|
143
|
+
type: string;
|
|
144
|
+
minLength: number;
|
|
145
|
+
maxLength: number;
|
|
146
|
+
};
|
|
147
|
+
};
|
|
148
|
+
explanation: {
|
|
149
|
+
type: string;
|
|
150
|
+
maxLength: number;
|
|
151
|
+
};
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
splits: {
|
|
156
|
+
type: string;
|
|
157
|
+
maxItems: number;
|
|
158
|
+
items: {
|
|
159
|
+
type: string;
|
|
160
|
+
additionalProperties: boolean;
|
|
161
|
+
required: string[];
|
|
162
|
+
properties: {
|
|
163
|
+
evidenceId: {
|
|
164
|
+
type: string;
|
|
165
|
+
minLength: number;
|
|
166
|
+
maxLength: number;
|
|
167
|
+
};
|
|
168
|
+
groups: {
|
|
169
|
+
type: string;
|
|
170
|
+
minItems: number;
|
|
171
|
+
maxItems: number;
|
|
172
|
+
items: {
|
|
173
|
+
type: string;
|
|
174
|
+
minItems: number;
|
|
175
|
+
maxItems: number;
|
|
176
|
+
items: {
|
|
177
|
+
type: string;
|
|
178
|
+
minimum: number;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
};
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
};
|
|
187
|
+
export declare function validateSuggestions(raw: unknown, offered: GenerationOutput['offered'], extraction: ExtractionResult[], limits: GenerationLimits, revision: number): Pick<GenerationOutput, 'outcome' | 'suggestions' | 'splits'>;
|
|
188
|
+
//# sourceMappingURL=proposal-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposal-validation.d.ts","sourceRoot":"","sources":["../src/proposal-validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAEV,gBAAgB,EAEjB,MAAM,mBAAmB,CAAC;AAE3B,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CAInD;AACD,wBAAgB,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,SAAM,GAAG,MAAM,CAItD;AACD,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAehE;AAwCD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuFxD;AACD,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,OAAO,EACZ,OAAO,EAAE,gBAAgB,CAAC,SAAS,CAAC,EACpC,UAAU,EAAE,gBAAgB,EAAE,EAC9B,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,MAAM,GACf,IAAI,CAAC,gBAAgB,EAAE,SAAS,GAAG,aAAa,GAAG,QAAQ,CAAC,CAkG9D"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { DatabaseInterface } from '@happyvertical/sql';
|
|
2
|
+
import { generationSnapshotRead, type TransactionRunner } from './execution-internal.js';
|
|
3
|
+
import type { GenerationStageConfiguration, ProposalConfiguration } from './proposal-contracts.js';
|
|
4
|
+
import type { CandidatePage, CompletedAnalysisSnapshot, GeneratedPreview, PreviewGeneratedInput, ProposalCatalogEntry } from './proposal-dto.js';
|
|
5
|
+
import type { AnalysisLease, IngestionOptions, IngestionService } from './server.js';
|
|
6
|
+
export type * from './proposal-contracts.js';
|
|
7
|
+
export type * from './proposal-dto.js';
|
|
8
|
+
export { createSDKProposalDecisionClient, createSDKProposalGenerator, } from './proposal-sdk.js';
|
|
9
|
+
/** Server-only interpretation. This service cannot approve or execute an action. */
|
|
10
|
+
export declare class IngestionProposalService {
|
|
11
|
+
private readonly service;
|
|
12
|
+
private readonly options;
|
|
13
|
+
private readonly config;
|
|
14
|
+
private readonly execution;
|
|
15
|
+
private readonly identity;
|
|
16
|
+
private readonly decisionIdentity;
|
|
17
|
+
constructor(service: IngestionService, options: IngestionOptions, config: ProposalConfiguration);
|
|
18
|
+
private handler;
|
|
19
|
+
private entry;
|
|
20
|
+
private allowedProviders;
|
|
21
|
+
private catalog;
|
|
22
|
+
listHandlers(itemId: string): Promise<ProposalCatalogEntry[]>;
|
|
23
|
+
findCandidates(input: {
|
|
24
|
+
itemId: string;
|
|
25
|
+
handlerId: string;
|
|
26
|
+
handlerVersion: string;
|
|
27
|
+
query: string;
|
|
28
|
+
limit?: number;
|
|
29
|
+
}): Promise<CandidatePage>;
|
|
30
|
+
prepareGeneration(itemId: string, attemptId: string): Promise<GenerationStageConfiguration>;
|
|
31
|
+
private extraction;
|
|
32
|
+
private live;
|
|
33
|
+
private deadline;
|
|
34
|
+
generate(lease: AnalysisLease): Promise<boolean>;
|
|
35
|
+
private decide;
|
|
36
|
+
[generationSnapshotRead](itemId: string, run: TransactionRunner<CompletedAnalysisSnapshot>, read: (db: DatabaseInterface) => Promise<CompletedAnalysisSnapshot>): Promise<CompletedAnalysisSnapshot>;
|
|
37
|
+
/** Internal stage read gate; the foundation owns current snapshot/digest checks. */
|
|
38
|
+
private authorizeCompletedSnapshot;
|
|
39
|
+
preview(input: PreviewGeneratedInput): Promise<GeneratedPreview[]>;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=proposals.d.ts.map
|
|
@@ -0,0 +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,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