@happyvertical/smrt-ingestion 0.57.20 → 0.57.22
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/FEEDBACK.md +137 -0
- package/PROPOSALS.md +146 -5
- package/README.md +168 -2
- package/REVIEW.md +611 -7
- package/agents/execution.md +87 -0
- package/dist/chunks/{execution-NoDh3pjs.js → execution-BzVQax0n.js} +528 -42
- package/dist/chunks/execution-BzVQax0n.js.map +1 -0
- package/dist/chunks/{feedback-CJB900iG.js → feedback-D3UTF8fm.js} +175 -36
- package/dist/chunks/feedback-D3UTF8fm.js.map +1 -0
- package/dist/chunks/{proposal-errors-VxcTU6Db.js → proposal-contracts-77Uo1B1j.js} +38 -44
- package/dist/chunks/proposal-contracts-77Uo1B1j.js.map +1 -0
- package/dist/chunks/reviewer-instruction-CEc3AOuU.js +33 -0
- package/dist/chunks/reviewer-instruction-CEc3AOuU.js.map +1 -0
- package/dist/dto.d.ts +75 -0
- package/dist/dto.d.ts.map +1 -1
- package/dist/execution-contracts.d.ts +4 -1
- package/dist/execution-contracts.d.ts.map +1 -1
- package/dist/execution-dto.d.ts +16 -0
- package/dist/execution-dto.d.ts.map +1 -1
- package/dist/execution-internal.d.ts +2 -0
- package/dist/execution-internal.d.ts.map +1 -1
- package/dist/execution.d.ts +101 -4
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +2 -2
- package/dist/feedback-dto.d.ts +18 -4
- package/dist/feedback-dto.d.ts.map +1 -1
- package/dist/feedback-internal.d.ts +9 -0
- package/dist/feedback-internal.d.ts.map +1 -1
- package/dist/feedback.d.ts +10 -0
- package/dist/feedback.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/manifest.json +339 -3
- package/dist/models.d.ts +15 -0
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +82 -2
- package/dist/models.js.map +1 -1
- package/dist/policy.d.ts +3 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/presented-filename.d.ts +11 -0
- package/dist/presented-filename.d.ts.map +1 -0
- package/dist/proposal-contracts.d.ts +31 -6
- package/dist/proposal-contracts.d.ts.map +1 -1
- package/dist/proposal-dto.d.ts +17 -0
- package/dist/proposal-dto.d.ts.map +1 -1
- package/dist/proposal-errors.d.ts +20 -0
- package/dist/proposal-errors.d.ts.map +1 -1
- package/dist/proposal-validation.d.ts +26 -0
- package/dist/proposal-validation.d.ts.map +1 -1
- package/dist/proposals.d.ts +6 -1
- package/dist/proposals.d.ts.map +1 -1
- package/dist/proposals.js +268 -71
- package/dist/proposals.js.map +1 -1
- package/dist/redaction.d.ts +9 -0
- package/dist/redaction.d.ts.map +1 -0
- package/dist/review-dto.d.ts +108 -5
- package/dist/review-dto.d.ts.map +1 -1
- package/dist/review-host.d.ts +52 -3
- package/dist/review-host.d.ts.map +1 -1
- package/dist/review-instruction-view.d.ts +12 -0
- package/dist/review-instruction-view.d.ts.map +1 -0
- package/dist/review-summary.d.ts.map +1 -1
- package/dist/reviewer-instruction.d.ts +20 -0
- package/dist/reviewer-instruction.d.ts.map +1 -0
- package/dist/server.d.ts +252 -13
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1190 -85
- package/dist/server.js.map +1 -1
- package/dist/smrt-knowledge.json +137 -23
- package/dist/sources/common.d.ts +11 -0
- package/dist/sources/common.d.ts.map +1 -1
- package/dist/sources/email.d.ts.map +1 -1
- package/dist/sources/http.d.ts.map +1 -1
- package/dist/sources/watch-folder.d.ts.map +1 -1
- package/dist/svelte/components/ActionReview.svelte +54 -55
- package/dist/svelte/components/ActionReview.svelte.d.ts +8 -1
- package/dist/svelte/components/ActionReview.svelte.d.ts.map +1 -1
- package/dist/svelte/components/CandidatePicker.svelte +72 -0
- package/dist/svelte/components/CandidatePicker.svelte.d.ts +15 -0
- package/dist/svelte/components/CandidatePicker.svelte.d.ts.map +1 -0
- package/dist/svelte/components/EvidenceViewer.svelte +60 -4
- package/dist/svelte/components/EvidenceViewer.svelte.d.ts +12 -1
- package/dist/svelte/components/EvidenceViewer.svelte.d.ts.map +1 -1
- package/dist/svelte/components/InboxView.svelte +172 -19
- package/dist/svelte/components/InboxView.svelte.d.ts +36 -2
- package/dist/svelte/components/InboxView.svelte.d.ts.map +1 -1
- package/dist/svelte/components/IntakeInbox.svelte +6 -3
- package/dist/svelte/components/IntakeInbox.svelte.d.ts +4 -1
- package/dist/svelte/components/IntakeInbox.svelte.d.ts.map +1 -1
- package/dist/svelte/components/IntakeReview.svelte +4 -2
- package/dist/svelte/components/IntakeReview.svelte.d.ts +2 -0
- package/dist/svelte/components/IntakeReview.svelte.d.ts.map +1 -1
- package/dist/svelte/components/IntakeWorkspace.svelte +27 -0
- package/dist/svelte/components/IntakeWorkspace.svelte.d.ts +19 -0
- package/dist/svelte/components/IntakeWorkspace.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ReviewView.svelte +653 -71
- package/dist/svelte/components/ReviewView.svelte.d.ts +20 -1
- package/dist/svelte/components/ReviewView.svelte.d.ts.map +1 -1
- package/dist/svelte/components/TriageView.svelte +669 -0
- package/dist/svelte/components/TriageView.svelte.d.ts +16 -0
- package/dist/svelte/components/TriageView.svelte.d.ts.map +1 -0
- package/dist/svelte/i18n.d.ts +56 -0
- package/dist/svelte/i18n.d.ts.map +1 -1
- package/dist/svelte/i18n.js +56 -0
- package/dist/svelte/index.d.ts +2 -1
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +1 -0
- package/dist/svelte/view-utils.d.ts +67 -0
- package/dist/svelte/view-utils.d.ts.map +1 -1
- package/dist/svelte/view-utils.js +157 -0
- package/package.json +13 -13
- package/dist/chunks/execution-NoDh3pjs.js.map +0 -1
- package/dist/chunks/execution-internal-DWteDHM2.js +0 -7
- package/dist/chunks/execution-internal-DWteDHM2.js.map +0 -1
- package/dist/chunks/feedback-CJB900iG.js.map +0 -1
- package/dist/chunks/proposal-errors-VxcTU6Db.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proposal-contracts-77Uo1B1j.js","names":[],"sources":["../../src/extraction.ts","../../src/proposal-limits.ts","../../src/proposal-contracts.ts"],"sourcesContent":["import { fork } from 'node:child_process';\nimport { createHash } from 'node:crypto';\nimport { dirname, join } from 'node:path';\nimport { fileURLToPath } from 'node:url';\nimport type { GetAIOptions } from '@happyvertical/ai';\nimport type { PDFReaderOptions } from '@happyvertical/pdf';\nimport type { GetTranscriberOptions } from '@happyvertical/speech';\nimport type { AnalysisOutput } from './dto.js';\nimport {\n ExtractionFailure,\n emptyExtraction,\n validateExtractionRequest,\n} from './extraction-providers.js';\nimport type {\n ExtractionAdapter,\n ExtractionRequest,\n ExtractionResult,\n ProviderIdentity,\n} from './extraction-types.js';\nimport { providerIdentity } from './extraction-types.js';\nimport type { AnalysisLease, IngestionService } from './server.js';\n\nexport type * from './extraction-types.js';\n\n/** Trusted server configuration. Credentials never enter analysis provenance. */\nexport interface ExtractionSDKConfiguration {\n pdf?: {\n provider: NonNullable<PDFReaderOptions['provider']>;\n identity: ProviderIdentity;\n };\n ocr?: { identity: ProviderIdentity; options?: Record<string, unknown> };\n speech?: { identity: ProviderIdentity; options: GetTranscriberOptions };\n vision?: { identity: ProviderIdentity; options: GetAIOptions };\n imageMode?: 'ocr' | 'vision';\n /** Maximum concurrent child processes for this adapter instance (default 1). */\n maxConcurrentProcesses?: number;\n /** The deployment enforces a native-memory ceiling outside Node (e.g. container).\n * Required for native decoders: Node's heap cap does not bound native allocation. */\n nativeMemoryIsolation: 'host-enforced';\n}\n\n/** Production adapter: bounded per-evidence child, terminated on deadline/abort. */\nexport function createSDKExtractionAdapter(\n configuration: ExtractionSDKConfiguration,\n): ExtractionAdapter {\n try {\n configuration = structuredClone(configuration);\n } catch {\n throw new Error('Serializable SDK configuration required');\n }\n const maximum = configuration.maxConcurrentProcesses ?? 1;\n if (!Number.isSafeInteger(maximum) || maximum < 1 || maximum > 32)\n throw new Error('Invalid extraction concurrency');\n let running = 0;\n if (configuration.nativeMemoryIsolation !== 'host-enforced')\n throw new Error('Native memory isolation is required');\n for (const provider of [\n configuration.pdf,\n configuration.ocr,\n configuration.speech,\n configuration.vision,\n ]) {\n if (provider) provider.identity = providerIdentity(provider.identity);\n }\n if (\n configuration.pdf?.provider === 'auto' ||\n configuration.ocr?.identity.provider === 'auto'\n )\n throw new Error('Pin extraction providers');\n return {\n async extract(request) {\n let latest = emptyExtraction(request);\n try {\n validateExtractionRequest(request);\n } catch (caught) {\n if (!(caught instanceof ExtractionFailure)) throw caught;\n latest.errors.push({\n category: caught.category,\n location: { kind: 'source' },\n });\n return latest;\n }\n if (request.evidence.mediaType.toLowerCase().startsWith('video/')) {\n latest.status = 'unsupported';\n latest.errors.push({\n category: 'unsupported_type',\n location: { kind: 'source' },\n });\n return latest;\n }\n if (request.signal?.aborted) {\n latest.errors.push({\n category: 'cancelled',\n location: { kind: 'source' },\n });\n return latest;\n }\n if (running >= maximum) {\n latest.errors.push({ category: 'limit', location: { kind: 'source' } });\n return latest;\n }\n running++;\n return new Promise<ExtractionResult>((resolve) => {\n // A public entry can move shared code into chunks; resolve without loading it.\n const child = fork(\n join(\n dirname(\n fileURLToPath(\n import.meta.resolve('@happyvertical/smrt-ingestion/server'),\n ),\n ),\n 'extraction-worker.js',\n ),\n [],\n {\n serialization: 'advanced',\n stdio: ['ignore', 'ignore', 'ignore', 'ipc'],\n execArgv: [`--max-old-space-size=${request.limits.workerHeapMb}`],\n detached: process.platform !== 'win32',\n },\n );\n let done = false;\n const stop = () => {\n try {\n if (process.platform !== 'win32' && child.pid)\n process.kill(-child.pid, 'SIGKILL');\n else child.kill('SIGKILL');\n } catch {\n child.kill('SIGKILL');\n }\n };\n const finish = (\n category?: 'timeout' | 'cancelled' | 'unavailable' | 'limit',\n ) => {\n if (done) return;\n done = true;\n running--;\n clearTimeout(timer);\n request.signal?.removeEventListener('abort', abort);\n stop();\n if (category) {\n latest.errors.push({ category, location: { kind: 'source' } });\n latest.status = latest.segments.length ? 'partial' : 'failed';\n latest.truncated = true;\n latest.omitted.push({ kind: 'source' });\n }\n resolve(latest);\n };\n const abort = () => finish('cancelled');\n const timer = setTimeout(\n () => finish('timeout'),\n request.limits.timeoutMs,\n );\n request.signal?.addEventListener('abort', abort, { once: true });\n child.on('error', () => finish('unavailable'));\n child.on('exit', () => {\n if (!done) finish('unavailable');\n });\n child.on(\n 'message',\n async (message: {\n kind: string;\n id?: number;\n result?: ExtractionResult;\n }) => {\n if (done) return;\n if (\n message.kind === 'authorize' &&\n Number.isSafeInteger(message.id)\n ) {\n try {\n await request.beforeProviderCall?.();\n if (!done) child.send({ kind: 'authorized', id: message.id });\n } catch {\n finish('cancelled');\n }\n return;\n }\n if (\n (message.kind === 'progress' || message.kind === 'result') &&\n message.result\n ) {\n // The child is our trusted normalizer; bound serialized IPC output as well.\n if (\n Buffer.byteLength(JSON.stringify(message.result)) >\n request.limits.maxOutputBytes + 65536\n )\n return finish('limit');\n latest = message.result;\n if (message.kind === 'result') finish();\n } else finish('unavailable');\n },\n );\n const {\n signal: _signal,\n beforeProviderCall: _authorize,\n ...wireRequest\n } = request;\n child.send({ request: wireRequest, configuration }, (error) => {\n if (error) finish('unavailable');\n });\n if (request.signal?.aborted) abort();\n });\n },\n };\n}\n\nfunction validateAndNormalizeExtractionOutput(\n result: ExtractionResult,\n request: ExtractionRequest,\n): void {\n const numeric = (value: number) => Number.isFinite(value) && value >= 0;\n const location = (\n value: ExtractionResult['segments'][number]['location'],\n ) => {\n if (!value || typeof value !== 'object') return false;\n if (value.kind === 'source') return true;\n if (value.kind === 'page')\n return Number.isSafeInteger(value.page) && value.page > 0;\n if (value.kind === 'pages')\n return (\n Number.isSafeInteger(value.startPage) &&\n value.startPage > 0 &&\n Number.isSafeInteger(value.endPage) &&\n value.endPage >= value.startPage\n );\n return (\n value.kind === 'time' &&\n numeric(value.startMs) &&\n numeric(value.endMs) &&\n value.endMs >= value.startMs\n );\n };\n if (\n !result ||\n !['complete', 'partial', 'failed', 'unsupported'].includes(result.status) ||\n result.automaticActionEligible !== false ||\n result.configurationRevision !== request.configurationRevision ||\n !result.evidence ||\n Object.entries(request.evidence).some(\n ([key, value]) =>\n result.evidence[key as keyof typeof result.evidence] !== value,\n ) ||\n typeof result.truncated !== 'boolean' ||\n !Array.isArray(result.capabilities) ||\n result.capabilities.some(\n (capability) =>\n !capability ||\n typeof capability.confidence !== 'boolean' ||\n typeof capability.boxes !== 'boolean' ||\n !['source', 'page', 'time'].includes(capability.location) ||\n !['unknown', 'reported'].includes(capability.truncation) ||\n !['unknown', 'reported'].includes(capability.usage),\n ) ||\n !result.limits ||\n Object.entries(request.limits).some(\n ([key, value]) =>\n result.limits[key as keyof typeof result.limits] !== value,\n ) ||\n !Array.isArray(result.segments) ||\n !Array.isArray(result.errors) ||\n !Array.isArray(result.omitted) ||\n (result.status === 'complete' &&\n (result.truncated ||\n result.errors.length > 0 ||\n result.omitted.length > 0)) ||\n result.omitted.some((value) => !location(value)) ||\n result.segments.some(\n (segment) =>\n typeof segment.text !== 'string' ||\n !location(segment.location) ||\n segment.location.kind === 'pages' ||\n (segment.provenance?.provider === 'unlimited-ocr' &&\n (segment.confidence !== null || segment.boxes !== null)) ||\n !segment.provenance ||\n [\n segment.provenance.provider,\n segment.provenance.model,\n segment.provenance.version,\n ].some((value) => typeof value !== 'string' || !value) ||\n (segment.confidence !== null &&\n (!segment.confidence ||\n !numeric(segment.confidence.value) ||\n segment.confidence.value > 1 ||\n segment.confidence.scale !== '0-1' ||\n segment.confidence.calibration !== 'unknown')) ||\n (segment.boxes !== null &&\n (!Array.isArray(segment.boxes) ||\n segment.boxes.some(\n (box) =>\n typeof box.text !== 'string' ||\n ![box.x, box.y, box.width, box.height].every(numeric),\n ))),\n ) ||\n result.errors.some(\n (error) =>\n ![\n 'unsupported_type',\n 'malformed_output',\n 'limit',\n 'timeout',\n 'unavailable',\n 'authentication',\n 'cancelled',\n 'integrity',\n ].includes(error.category) || !location(error.location),\n ) ||\n !result.usage ||\n Object.values(result.usage).some((value) => !numeric(value))\n )\n throw new Error('Invalid extraction output');\n // Structural typing permits extra host fields. Never persist them as identity.\n for (const segment of result.segments)\n segment.provenance = providerIdentity(segment.provenance);\n result.capabilities = result.capabilities.map((capability) => ({\n ...providerIdentity(capability),\n confidence: capability.confidence,\n boxes: capability.boxes,\n location: capability.location,\n truncation: capability.truncation,\n usage: capability.usage,\n }));\n}\n\n/** Current access is rechecked on read and fenced publication by the foundation.\n * The host already allocated the immutable input/config revision and lease. */\nexport async function extractAnalysis(\n service: IngestionService,\n lease: AnalysisLease,\n adapter: ExtractionAdapter,\n options: Pick<\n ExtractionRequest,\n 'limits' | 'configurationRevision' | 'signal'\n >,\n): Promise<boolean> {\n const snapshot = await service.getAnalysisInput(lease);\n const persisted = snapshot.configuration.extraction as\n | { configurationRevision?: unknown; limits?: Record<string, unknown> }\n | undefined;\n if (\n !persisted ||\n persisted.configurationRevision !== options.configurationRevision ||\n !persisted.limits ||\n Object.keys(options.limits).some(\n (key) =>\n persisted.limits?.[key] !==\n options.limits[key as keyof typeof options.limits],\n ) ||\n Object.keys(persisted.limits).length !== Object.keys(options.limits).length\n )\n throw new Error('Extraction configuration mismatch');\n const evidence = snapshot.evidence;\n const boundOptions = { ...options, limits: structuredClone(options.limits) };\n const results: ExtractionResult[] = [];\n let limited = false;\n const publication = (reserve = false): AnalysisOutput => {\n const allComplete =\n !limited &&\n results.length === evidence.length &&\n results.every((result) => result.status === 'complete');\n const firstError =\n limited || reserve\n ? 'limit'\n : results.flatMap((result) => result.errors)[0]?.category;\n return {\n status: reserve\n ? 'needs_attention'\n : allComplete\n ? 'completed'\n : results.some((result) => result.segments.length)\n ? 'partial'\n : 'needs_attention',\n provider: 'smrt-ingestion-extraction',\n model: 'none',\n version: '1',\n output: {\n configurationRevision: options.configurationRevision,\n results,\n ...(limited || reserve\n ? {\n truncated: true,\n omittedEvidenceCount: evidence.length - results.length,\n }\n : {}),\n },\n usage: {},\n ...(firstError ? { error: firstError } : {}),\n };\n };\n // Canonical persistence sorts keys but uses identical JSON value encoding/size.\n const fits = (output: AnalysisOutput) =>\n Buffer.byteLength(JSON.stringify(output)) <= snapshot.maxOutputBytes;\n const minimum: AnalysisOutput = {\n status: 'needs_attention',\n provider: 'smrt-ingestion-extraction',\n model: 'none',\n version: '1',\n output: {},\n usage: {},\n error: 'limit',\n };\n if (!fits(minimum)) return service.failAnalysis(lease, 'limit');\n if (!fits(publication(true))) return service.completeAnalysis(lease, minimum);\n for (const part of evidence) {\n await service.getAnalysisInput(lease);\n const bytes = await service.readEvidence(lease.itemId, part.id);\n await service.getAnalysisInput(lease);\n const request = { ...boundOptions, evidence: part, bytes };\n const result = await adapter.extract({\n ...request,\n evidence: { ...part },\n limits: { ...request.limits },\n bytes: bytes.slice(),\n beforeProviderCall: async () => {\n await service.getAnalysisInput(lease);\n },\n });\n validateAndNormalizeExtractionOutput(result, request);\n results.push(result);\n if (!fits(publication(true))) {\n limited = true;\n // Preserve earlier parts and the largest prefix of complete segments that fits.\n result.status = 'partial';\n result.truncated = true;\n result.errors.push({ category: 'limit', location: { kind: 'source' } });\n while (result.segments.length && !fits(publication(true))) {\n const removed = result.segments.pop();\n if (removed) result.omitted.push(removed.location);\n }\n // Diagnostics are indivisible: omit this result rather than erase known gaps.\n if (!fits(publication(true))) results.pop();\n }\n // Revalidation after an external call prevents returning/publishing revoked evidence.\n await service.getAnalysisInput(lease);\n if (limited || options.signal?.aborted) break;\n }\n return service.completeAnalysis(lease, publication());\n}\n\n/** Side-effect-free, versioned split proposal. Original evidence is not replaced. */\nexport function proposeDocumentSplits(\n result: ExtractionResult,\n revision: number,\n groups: number[][],\n) {\n if (!Number.isSafeInteger(revision) || revision < 1 || !groups.length)\n throw new Error('Invalid split revision');\n const available = new Set(\n result.segments.flatMap((segment) =>\n segment.location.kind === 'page' ? [segment.location.page] : [],\n ),\n );\n const seen = new Set<number>();\n for (const group of groups) {\n if (!group.length) throw new Error('Empty split');\n for (const page of group) {\n if (!Number.isSafeInteger(page) || !available.has(page) || seen.has(page))\n throw new Error('Invalid split page');\n seen.add(page);\n }\n if (group.some((page, index) => index > 0 && page <= group[index - 1]))\n throw new Error('Unordered split');\n }\n const proposal = {\n revision,\n evidenceId: result.evidence.id,\n inputHash: result.evidence.contentHash,\n configurationRevision: result.configurationRevision,\n groups: groups.map((pages) => ({ pages: [...pages] })),\n status: 'proposed' as const,\n };\n return {\n ...proposal,\n digest: createHash('sha256').update(JSON.stringify(proposal)).digest('hex'),\n };\n}\n","import type { ProposalConfiguration } from './proposal-contracts.js';\n\n/** Validate deployment limits before any item is interpreted. */\nexport function assertProposalLimits(\n limits: ProposalConfiguration['limits'],\n): void {\n if (\n !limits ||\n [\n 'maxHandlers',\n 'maxCandidates',\n 'maxSuggestions',\n 'maxInputBytes',\n 'maxOutputBytes',\n 'maxQueryLength',\n 'timeoutMs',\n ].some(\n (key) =>\n !Number.isSafeInteger(limits[key as keyof typeof limits]) ||\n limits[key as keyof typeof limits] <= 0,\n ) ||\n limits.maxHandlers > 20 ||\n limits.maxCandidates > 20 ||\n limits.maxSuggestions > 20 ||\n limits.timeoutMs > 2_147_483_647\n )\n throw new Error('Invalid proposal limits');\n}\n","import type { DecisionClient } from '@happyvertical/smrt-core';\nimport type { HandlerContext } from './execution-contracts.js';\nimport type { IntakeValues } from './execution-dto.js';\nimport {\n type EvidenceLocation,\n type ProviderIdentity,\n providerIdentity,\n} from './extraction-types.js';\nimport type {\n ProposalCandidate,\n ProposalCatalogEntry,\n ProposalReferenceField,\n} from './proposal-dto.js';\n\n/** Optional discovery capability on the existing application execution handler. */\nexport interface HandlerDiscovery {\n mediaTypes: readonly string[];\n /** Every existing-record argument exposed to generation must be declared here. */\n references: Readonly<Record<string, ProposalReferenceField>>;\n /** Database reads only; filter in the query before ranking/summarizing. */\n candidates?(\n query: string,\n context: HandlerContext,\n page: { limit: number },\n ): Promise<{\n items: Array<Omit<ProposalCandidate, 'key'>>;\n hasMore: boolean;\n }>;\n}\nexport interface GenerationLimits {\n maxHandlers: number;\n maxCandidates: number;\n maxSuggestions: number;\n maxInputBytes: number;\n maxOutputBytes: number;\n maxQueryLength: number;\n timeoutMs: number;\n}\nexport interface GenerativeProposalInput {\n evidence: Array<{\n evidenceId: string;\n partId: string;\n parentEvidenceId: string | null;\n mediaType: string;\n contentHash: string;\n segments: Array<{ text: string; location: EvidenceLocation }>;\n }>;\n offered: Array<{\n handler: ProposalCatalogEntry;\n candidates: ProposalCandidate[];\n }>;\n instructions: string;\n /** Bounded, currently eligible examples; neither evidence nor authority. */\n examples?: import('./feedback-dto.js').FeedbackSelection;\n /** Authenticated human correction carried through fresh extraction; never model authority. */\n humanCorrection?: IntakeValues;\n /** Authenticated reviewer guidance; trusted steering only, never catalog or approval authority. */\n reviewerInstruction?: { id: string; text: string };\n}\n/** Inject only trusted SDK-bound adapters. Generative output is always untrusted. */\nexport interface ProposalGenerator {\n identity: ProviderIdentity;\n generate(\n input: GenerativeProposalInput,\n options: { signal: AbortSignal; maxOutputBytes: number },\n ): Promise<{\n output: unknown;\n completion: 'complete' | 'unknown';\n usage?: Record<string, number>;\n /** Provider-reported immutable model revision, when it safely resolves a configured alias. */\n responseModel?: string;\n }>;\n}\n/**\n * How validated decision answers affect readiness. `gate` (default) sends a\n * suggestion to `needs_review` when the thresholds are not met; `record` still\n * runs and persists the same answers but leaves outcome/disposition to the\n * validator. Neither mode makes any action automation-eligible.\n */\nexport type DecisionReadiness = 'gate' | 'record';\n/** Public decision settings shared by generation and read configuration. */\nexport interface DecisionSettings {\n minimumDecisionProbability?: number;\n tieMargin?: number;\n /**\n * Per-request token window forwarded to the decision client as `maxLen`\n * (the SDK Laya provider option). Absent keeps the client/checkpoint default.\n */\n decisionMaxLen?: number;\n decisionReadiness?: DecisionReadiness;\n}\nexport interface ProposalConfiguration extends DecisionSettings {\n version: string;\n promptVersion: string;\n generator: ProposalGenerator;\n /** Absent means the normal unconfigured decision path, never fake probability. */\n decision?: { client: DecisionClient; identity: ProviderIdentity };\n limits: GenerationLimits;\n}\n/** Credential-free configuration for validating persisted proposal snapshots. */\nexport interface ProposalReadConfiguration extends DecisionSettings {\n version: string;\n promptVersion: string;\n generator: ProviderIdentity;\n decision?: ProviderIdentity;\n limits: GenerationLimits;\n}\n/** Remove generation capability while preserving the public persisted configuration. */\nexport function proposalReadConfiguration(\n config: ProposalConfiguration | ProposalReadConfiguration,\n): ProposalReadConfiguration {\n const generator = providerIdentity(\n 'identity' in config.generator\n ? config.generator.identity\n : config.generator,\n );\n return {\n version: config.version,\n promptVersion: config.promptVersion,\n generator,\n ...(config.decision\n ? {\n decision: providerIdentity(\n 'identity' in config.decision\n ? config.decision.identity\n : config.decision,\n ),\n }\n : {}),\n ...(config.minimumDecisionProbability === undefined\n ? {}\n : { minimumDecisionProbability: config.minimumDecisionProbability }),\n ...(config.tieMargin === undefined ? {} : { tieMargin: config.tieMargin }),\n ...(config.decisionMaxLen === undefined\n ? {}\n : { decisionMaxLen: config.decisionMaxLen }),\n ...(config.decisionReadiness === undefined\n ? {}\n : { decisionReadiness: config.decisionReadiness }),\n limits: {\n maxHandlers: config.limits.maxHandlers,\n maxCandidates: config.limits.maxCandidates,\n maxSuggestions: config.limits.maxSuggestions,\n maxInputBytes: config.limits.maxInputBytes,\n maxOutputBytes: config.limits.maxOutputBytes,\n maxQueryLength: config.limits.maxQueryLength,\n timeoutMs: config.limits.timeoutMs,\n },\n };\n}\nexport interface GenerationStageConfiguration extends IntakeValues {\n stage: 'interpret';\n /** Copied from the pinned extraction source; verified against it before provider disclosure. */\n reviewerInstruction?: IntakeValues;\n proposals: {\n source: import('./proposal-dto.js').GenerationSourcePin;\n configurationVersion: string;\n promptVersion: string;\n catalogDigest: string;\n generator: ProviderIdentity;\n decision: ProviderIdentity | null;\n limits: GenerationLimits;\n minimumDecisionProbability: number;\n tieMargin: number;\n /** Present only when configured, so default digests stay stable. */\n decisionMaxLen?: number;\n /** Present only for `record`; `gate` is the default. */\n decisionReadiness?: 'record';\n };\n}\n"],"mappings":";;;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AI,OAAO,mBAAmB,KAAA,IAC1B,CAAC,IACD,EAAE,gBAAgB,OAAO,eAAe;EAC5C,GAAI,OAAO,sBAAsB,KAAA,IAC7B,CAAC,IACD,EAAE,mBAAmB,OAAO,kBAAkB;EAClD,QAAQ;GACN,aAAa,OAAO,OAAO;GAC3B,eAAe,OAAO,OAAO;GAC7B,gBAAgB,OAAO,OAAO;GAC9B,eAAe,OAAO,OAAO;GAC7B,gBAAgB,OAAO,OAAO;GAC9B,gBAAgB,OAAO,OAAO;GAC9B,WAAW,OAAO,OAAO;EAC3B;CACF;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { i as intakeBindingDigest } from "./execution-BzVQax0n.js";
|
|
2
|
+
//#region src/reviewer-instruction.ts
|
|
3
|
+
var REVIEWER_INSTRUCTION_MAX_LENGTH = 4e3;
|
|
4
|
+
var ReviewerInstructionInvalidError = class extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super("Invalid reviewer instruction");
|
|
7
|
+
this.name = "ReviewerInstructionInvalidError";
|
|
8
|
+
}
|
|
9
|
+
};
|
|
10
|
+
var ReviewerInstructionStaleError = class extends Error {
|
|
11
|
+
constructor() {
|
|
12
|
+
super("Stale reviewer instruction");
|
|
13
|
+
this.name = "ReviewerInstructionStaleError";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
function reviewerInstructionView(value) {
|
|
17
|
+
const parsed = typeof value === "string" ? JSON.parse(value) : value;
|
|
18
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Reviewer instruction integrity");
|
|
19
|
+
const { digest: stored, ...body } = parsed;
|
|
20
|
+
if (body.kind !== "reviewer_instruction" || typeof stored !== "string" || typeof body.id !== "string" || typeof body.text !== "string" || typeof body.actorId !== "string" || typeof body.recordedAt !== "string" || body.supersedesId !== null && typeof body.supersedesId !== "string" || intakeBindingDigest(body) !== stored) throw new Error("Reviewer instruction integrity");
|
|
21
|
+
return {
|
|
22
|
+
id: body.id,
|
|
23
|
+
text: body.text,
|
|
24
|
+
actorId: body.actorId,
|
|
25
|
+
recordedAt: body.recordedAt,
|
|
26
|
+
supersedesId: body.supersedesId,
|
|
27
|
+
digest: stored
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { reviewerInstructionView as i, ReviewerInstructionInvalidError as n, ReviewerInstructionStaleError as r, REVIEWER_INSTRUCTION_MAX_LENGTH as t };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=reviewer-instruction-CEc3AOuU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reviewer-instruction-CEc3AOuU.js","names":[],"sources":["../../src/reviewer-instruction.ts"],"sourcesContent":["/** Shared server-side projection of the persisted reviewer instruction record. */\nimport { intakeBindingDigest as digest } from './execution.js';\nimport type { ReviewerInstruction } from './review-dto.js';\n\n/** Reviewer instruction text ceiling; the prompt input budget still applies. */\nexport const REVIEWER_INSTRUCTION_MAX_LENGTH = 4000;\n\n/**\n * Instruction text is empty, whitespace-only or longer than the ceiling. Hosts\n * surface it inline as a validation result, never as an access denial.\n */\nexport class ReviewerInstructionInvalidError extends Error {\n constructor() {\n super('Invalid reviewer instruction');\n this.name = 'ReviewerInstructionInvalidError';\n }\n}\n\n/**\n * The anchor generation is superseded or a reinterpretation is still in flight.\n * Hosts surface it as a refresh-and-retry signal, never as an access denial.\n */\nexport class ReviewerInstructionStaleError extends Error {\n constructor() {\n super('Stale reviewer instruction');\n this.name = 'ReviewerInstructionStaleError';\n }\n}\n\n/** Verify the record's own digest and project its browser-safe shape. */\nexport function reviewerInstructionView(value: unknown): ReviewerInstruction {\n const parsed: unknown = typeof value === 'string' ? JSON.parse(value) : value;\n if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))\n throw new Error('Reviewer instruction integrity');\n const { digest: stored, ...body } = parsed as Record<string, unknown>;\n if (\n body.kind !== 'reviewer_instruction' ||\n typeof stored !== 'string' ||\n typeof body.id !== 'string' ||\n typeof body.text !== 'string' ||\n typeof body.actorId !== 'string' ||\n typeof body.recordedAt !== 'string' ||\n (body.supersedesId !== null && typeof body.supersedesId !== 'string') ||\n digest(body) !== stored\n )\n throw new Error('Reviewer instruction integrity');\n return {\n id: body.id,\n text: body.text,\n actorId: body.actorId,\n recordedAt: body.recordedAt,\n supersedesId: body.supersedesId,\n digest: stored,\n };\n}\n"],"mappings":";;AAKO,IAAM,kCAAkC;AAMxC,IAAM,kCAAN,cAA8C,MAAM;CACzD,cAAc;EACZ,MAAM,8BAA8B;EACpC,KAAK,OAAO;CACd;AACF;AAMO,IAAM,gCAAN,cAA4C,MAAM;CACvD,cAAc;EACZ,MAAM,4BAA4B;EAClC,KAAK,OAAO;CACd;AACF;AAGO,SAAS,wBAAwB,OAAqC;CAC3E,MAAM,SAAkB,OAAO,UAAU,WAAW,KAAK,MAAM,KAAK,IAAI;CACxE,IAAI,CAAC,UAAU,OAAO,WAAW,YAAY,MAAM,QAAQ,MAAM,GAC/D,MAAM,IAAI,MAAM,gCAAgC;CAClD,MAAM,EAAE,QAAQ,QAAQ,GAAG,SAAS;CACpC,IACE,KAAK,SAAS,0BACd,OAAO,WAAW,YAClB,OAAO,KAAK,OAAO,YACnB,OAAO,KAAK,SAAS,YACrB,OAAO,KAAK,YAAY,YACxB,OAAO,KAAK,eAAe,YAC1B,KAAK,iBAAiB,QAAQ,OAAO,KAAK,iBAAiB,YAC5D,oBAAO,IAAI,MAAM,QAEjB,MAAM,IAAI,MAAM,gCAAgC;CAClD,OAAO;EACL,IAAI,KAAK;EACT,MAAM,KAAK;EACX,SAAS,KAAK;EACd,YAAY,KAAK;EACjB,cAAc,KAAK;EACnB,QAAQ;CACV;AACF"}
|
package/dist/dto.d.ts
CHANGED
|
@@ -19,6 +19,25 @@ export interface IntakeItemDTO {
|
|
|
19
19
|
analysisRevision: number;
|
|
20
20
|
cancelled: boolean;
|
|
21
21
|
traceId: string;
|
|
22
|
+
/**
|
|
23
|
+
* Present once a reviewer closed the item without an action; terminal. Item
|
|
24
|
+
* readers see only the state and time; the reviewer and reason are returned
|
|
25
|
+
* by review surfaces (`getItemDisposition`, `ItemReviewView.disposition`).
|
|
26
|
+
*/
|
|
27
|
+
disposition?: ItemDispositionState;
|
|
28
|
+
}
|
|
29
|
+
/** Item-level projection of a terminal disposition; carries no reviewer content. */
|
|
30
|
+
export interface ItemDispositionState {
|
|
31
|
+
state: 'resolved';
|
|
32
|
+
/** When the disposition was recorded (ISO 8601). */
|
|
33
|
+
at: string;
|
|
34
|
+
}
|
|
35
|
+
/** Reviewer-owned terminal disposition; redaction keeps only the kind. */
|
|
36
|
+
export interface ItemDisposition {
|
|
37
|
+
kind: 'resolved_no_action';
|
|
38
|
+
reviewer: string;
|
|
39
|
+
reason: string;
|
|
40
|
+
decidedAt: string;
|
|
22
41
|
}
|
|
23
42
|
/** Authorized evidence metadata; bytes are served by the service separately. */
|
|
24
43
|
export interface IntakeEvidenceDTO {
|
|
@@ -28,6 +47,12 @@ export interface IntakeEvidenceDTO {
|
|
|
28
47
|
mediaType: string;
|
|
29
48
|
contentHash: string;
|
|
30
49
|
byteLength: number;
|
|
50
|
+
/**
|
|
51
|
+
* Original name supplied by the source (upload, attachment, folder), with
|
|
52
|
+
* control, bidi and zero-width characters removed. Still untrusted text:
|
|
53
|
+
* render it as text, never as markup or a path.
|
|
54
|
+
*/
|
|
55
|
+
filename?: string;
|
|
31
56
|
}
|
|
32
57
|
/** Explicit resource limits captured with each receipt. */
|
|
33
58
|
export interface IntakeLimits {
|
|
@@ -50,6 +75,56 @@ export interface AnalysisOutput {
|
|
|
50
75
|
error?: IntakeFailure;
|
|
51
76
|
confidence?: number;
|
|
52
77
|
}
|
|
78
|
+
/** Host-selected extraction settings for an inline receipt; the same shape
|
|
79
|
+
* the job path persists in its `stage: 'extract'` configuration. */
|
|
80
|
+
export interface InlineInterpretationInput {
|
|
81
|
+
/** Stable per receipt: retries replay the same immutable revisions. */
|
|
82
|
+
requestId: string;
|
|
83
|
+
extraction: {
|
|
84
|
+
configurationRevision: string;
|
|
85
|
+
limits: {
|
|
86
|
+
maxBytes: number;
|
|
87
|
+
maxPages: number;
|
|
88
|
+
maxPixels: number;
|
|
89
|
+
maxOutputBytes: number;
|
|
90
|
+
timeoutMs: number;
|
|
91
|
+
maxTokens: number;
|
|
92
|
+
workerHeapMb: number;
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/** Terminal projection of one in-process stage; identical ledger semantics to a job. */
|
|
97
|
+
export interface InlineStageResult {
|
|
98
|
+
analysisId: string;
|
|
99
|
+
revision: number;
|
|
100
|
+
attemptId: string;
|
|
101
|
+
state: 'completed' | 'partial' | 'needs_attention' | 'failed';
|
|
102
|
+
error: IntakeFailure | null;
|
|
103
|
+
}
|
|
104
|
+
export interface InlineInterpretation {
|
|
105
|
+
itemId: string;
|
|
106
|
+
extraction: InlineStageResult;
|
|
107
|
+
/** Absent when extraction did not complete or partially complete. */
|
|
108
|
+
generation?: InlineStageResult;
|
|
109
|
+
/** The authorized, catalog-live generation snapshot when generation completed. */
|
|
110
|
+
analysis?: import('./proposal-dto.js').CompletedAnalysisSnapshot;
|
|
111
|
+
}
|
|
112
|
+
/** Bounded own-submission listing; the cursor is an opaque item identifier. */
|
|
113
|
+
export interface OwnProposalsInput {
|
|
114
|
+
cursor?: string;
|
|
115
|
+
limit?: number;
|
|
116
|
+
}
|
|
117
|
+
export interface OwnProposalsPage {
|
|
118
|
+
items: Array<{
|
|
119
|
+
item: IntakeItemDTO;
|
|
120
|
+
/** Null when the readable submission's reviews are denied; unreadable
|
|
121
|
+
* submissions are omitted from the page entirely. */
|
|
122
|
+
reviews: import('./review-dto.js').ReviewPage | null;
|
|
123
|
+
/** Set without a reason: nothing about the denied target is disclosed. */
|
|
124
|
+
unavailable?: true;
|
|
125
|
+
}>;
|
|
126
|
+
nextCursor?: string;
|
|
127
|
+
}
|
|
53
128
|
export type * from './feedback-dto.js';
|
|
54
129
|
export type * from './proposal-dto.js';
|
|
55
130
|
export type * from './review-dto.js';
|
package/dist/dto.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dto.d.ts","sourceRoot":"","sources":["../src/dto.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,oFAAoF;AACpF,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,GAC1E;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,aAAa,CAAA;CAAE,GACnD;IACE,IAAI,EAAE,UAAU,CAAC;IACjB,QAAQ,EAAE,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;CACxD,CAAC;AAEN,kCAAkC;AAClC,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"dto.d.ts","sourceRoot":"","sources":["../src/dto.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAE5B,oFAAoF;AACpF,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,UAAU,GAAG,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,CA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AG,IAAI,CAAC;CAC7B;AACD,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,iBAAiB,CAAC;IAC9B,qEAAqE;IACrE,UAAU,CAAC,EAAE,iBAAiB,CAAC;IAC/B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,OAAO,mBAAmB,EAAE,yBAAyB,CAAC;CAClE;AACD,+EAA+E;AAC/E,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AACD,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,KAAK,CAAC;QACX,IAAI,EAAE,aAAa,CAAC;QACpB;6DACqD;QACrD,OAAO,EAAE,OAAO,iBAAiB,EAAE,UAAU,GAAG,IAAI,CAAC;QACrD,0EAA0E;QAC1E,WAAW,CAAC,EAAE,IAAI,CAAC;KACpB,CAAC,CAAC;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,mBAAmB,CAAC;AACvC,mBAAmB,iBAAiB,CAAC"}
|
|
@@ -86,7 +86,8 @@ export interface ExecutionAccessInput {
|
|
|
86
86
|
scope: Readonly<IngestionScope>;
|
|
87
87
|
itemId: string;
|
|
88
88
|
capturedCeiling: Readonly<ExecutionCeiling>;
|
|
89
|
-
|
|
89
|
+
/** `review_own`: the recorded submitter decides their own proposal. */
|
|
90
|
+
operation: 'preview' | 'review' | 'review_own' | 'execute' | 'read' | 'reconcile';
|
|
90
91
|
handlerId: string;
|
|
91
92
|
}
|
|
92
93
|
/** Every callback is server configuration. It must never be deserialized from input. */
|
|
@@ -96,6 +97,8 @@ export interface IntakeExecutionOptions {
|
|
|
96
97
|
authorize(input: ExecutionAccessInput): Promise<{
|
|
97
98
|
allowed: boolean;
|
|
98
99
|
reviewer: boolean;
|
|
100
|
+
/** Live grant for `review_own`; absent or false denies submitter decisions. */
|
|
101
|
+
submitter?: boolean;
|
|
99
102
|
principalId: string;
|
|
100
103
|
permissions: string[];
|
|
101
104
|
policy: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-contracts.d.ts","sourceRoot":"","sources":["../src/execution-contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,mBAAmB,oBAAoB,CAAC;AACxC,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,iBAAiB,CAAC;IACtB,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC/B,oFAAoF;IACpF,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3E;AACD,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,YAAY,CAAC;IACtB,cAAc,EAAE,YAAY,CAAC;IAC7B,mBAAmB,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;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MAAM,CAAC;KACnB,CAAC,CAAC;IACH,yFAAyF;IACzF,YAAY,CAAC,KAAK,EAAE;QAClB,EAAE,EAAE,iBAAiB,CAAC;QACtB,KAAK,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC;QAChC,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,EAAE,MAAM,CAAC;QACd,EAAE,EAAE,MAAM,CAAC;QACX,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnC"}
|
package/dist/execution-dto.d.ts
CHANGED
|
@@ -43,6 +43,22 @@ export interface ReviewInput {
|
|
|
43
43
|
reason?: string;
|
|
44
44
|
correctedArgs?: IntakeValues;
|
|
45
45
|
}
|
|
46
|
+
/** Reviewer-chosen handler for any item; previewed and approved like a generated proposal. */
|
|
47
|
+
export interface StartActionInput {
|
|
48
|
+
itemId: string;
|
|
49
|
+
handlerId: string;
|
|
50
|
+
handlerVersion: string;
|
|
51
|
+
args: IntakeValues;
|
|
52
|
+
requestId: string;
|
|
53
|
+
reason?: string;
|
|
54
|
+
}
|
|
55
|
+
/** Close an item as handled without an action; distinct from rejecting a proposal. */
|
|
56
|
+
export interface ResolveItemInput {
|
|
57
|
+
itemId: string;
|
|
58
|
+
disposition: 'resolve_no_action';
|
|
59
|
+
requestId: string;
|
|
60
|
+
reason?: string;
|
|
61
|
+
}
|
|
46
62
|
export interface ActionResult {
|
|
47
63
|
state: 'succeeded' | 'failed' | 'outcome_unknown' | 'executing' | 'waiting_review';
|
|
48
64
|
actionId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-dto.d.ts","sourceRoot":"","sources":["../src/execution-dto.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AACnD,2EAA2E;AAC3E,MAAM,WAAW,gBAA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S,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AACD,MAAM,WAAW,YAAY;IAC3B,KAAK,EACD,WAAW,GACX,QAAQ,GACR,iBAAiB,GACjB,WAAW,GACX,gBAAgB,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,IAAI,EAAE,YAAY,CAAC;CACpB;AACD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,cAAc,EAAE,CAAC;CACzB"}
|
|
@@ -2,6 +2,8 @@ import type { DatabaseInterface } from '@happyvertical/sql';
|
|
|
2
2
|
import type { HandlerContext } from './execution-contracts.js';
|
|
3
3
|
export declare const discoveryTransaction: unique symbol;
|
|
4
4
|
export declare const generationSnapshotRead: unique symbol;
|
|
5
|
+
/** The read-only list gate the service applies per (item, handler); not public. */
|
|
6
|
+
export declare const listReadGate: unique symbol;
|
|
5
7
|
export type TransactionRunner<T> = (work: (db: DatabaseInterface) => Promise<T>) => Promise<T>;
|
|
6
8
|
export type DiscoveryGate = <T>(handlerId: string, handlerVersion: string, work: (context: HandlerContext, currentTarget: (model: string, id: string) => Promise<{
|
|
7
9
|
revision: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-internal.d.ts","sourceRoot":"","sources":["../src/execution-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,eAAO,MAAM,oBAAoB,eAA2C,CAAC;AAC7E,eAAO,MAAM,sBAAsB,eAElC,CAAC;AACF,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CACjC,IAAI,EAAE,CAAC,EAAE,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,KACxC,OAAO,CAAC,CAAC,CAAC,CAAC;AAChB,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,EAC5B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,CACJ,OAAO,EAAE,cAAc,EACvB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,KACxE,OAAO,CAAC,CAAC,CAAC,KACZ,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"execution-internal.d.ts","sourceRoot":"","sources":["../src/execution-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAG/D,eAAO,MAAM,oBAAoB,eAA2C,CAAC;AAC7E,eAAO,MAAM,sBAAsB,eAElC,CAAC;AACF,mFAAmF;AACnF,eAAO,MAAM,YAAY,eAAmC,CAAC;AAC7D,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CACjC,IAAI,EAAE,CAAC,EAAE,EAAE,iBAAiB,KAAK,OAAO,CAAC,CAAC,CAAC,KACxC,OAAO,CAAC,CAAC,CAAC,CAAC;AAChB,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,EAC5B,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,CACJ,OAAO,EAAE,cAAc,EACvB,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,KACxE,OAAO,CAAC,CAAC,CAAC,KACZ,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
package/dist/execution.d.ts
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import type { JobExecutionContext } from '@happyvertical/smrt-jobs';
|
|
2
2
|
import type { DatabaseInterface } from '@happyvertical/sql';
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
3
|
+
import type { ItemDisposition, OwnProposalsInput, OwnProposalsPage } from './dto.js';
|
|
4
|
+
import type { ActionResult, HandlerContext, IntakeExecutionOptions, PlanReview, PreviewPlanInput, PreviewProposalInput, ProposalReview, ResolveItemInput, ReviewInput, StartActionInput } from './execution-contracts.js';
|
|
5
|
+
import { type DiscoveryGate, discoveryTransaction, listReadGate, type TransactionRunner } from './execution-internal.js';
|
|
5
6
|
import { type FeedbackActionContext, feedbackActionTransaction, feedbackDiscoveryContext } from './feedback-internal.js';
|
|
6
7
|
import type { ReviewPage } from './review-dto.js';
|
|
7
8
|
import type { IngestionOptions } from './server.js';
|
|
8
9
|
export type * from './execution-contracts.js';
|
|
9
10
|
export type { IntakePolicy, IntakePolicyLayer } from './policy.js';
|
|
10
11
|
export { resolveIntakePolicy } from './policy.js';
|
|
12
|
+
/** Uniform no-disclosure denial (missing, foreign, revoked or inactive).
|
|
13
|
+
* Integrity, validation and database errors are never this type. */
|
|
14
|
+
export declare class IntakeAccessDeniedError extends Error {
|
|
15
|
+
constructor();
|
|
16
|
+
}
|
|
17
|
+
type Row = Record<string, unknown>;
|
|
11
18
|
export declare function intakeBindingDigest(value: unknown): string;
|
|
12
19
|
/** Server-only authoritative review/apply. Construct only from authenticated host options. */
|
|
13
20
|
export declare class IntakeExecutionService {
|
|
@@ -30,7 +37,20 @@ export declare class IntakeExecutionService {
|
|
|
30
37
|
private ceiling;
|
|
31
38
|
private handler;
|
|
32
39
|
private operation;
|
|
40
|
+
/**
|
|
41
|
+
* `arguments` marks arguments being previewed (operation preview, which
|
|
42
|
+
* also carries corrections, and plan preview): only their schema refusal is
|
|
43
|
+
* the correctable `HandlerArgumentsInvalidError`. Apply-time and
|
|
44
|
+
* external-send revalidation and result-schema checks keep the plain error.
|
|
45
|
+
*/
|
|
33
46
|
private validate;
|
|
47
|
+
/**
|
|
48
|
+
* The read-only half of `access`: current host authority, policy and
|
|
49
|
+
* ceiling allowlists and the retention deadline they imply. It writes
|
|
50
|
+
* nothing, so a listing may call it per (item, handler) without opening a
|
|
51
|
+
* transaction per row.
|
|
52
|
+
*/
|
|
53
|
+
private authority;
|
|
34
54
|
private access;
|
|
35
55
|
private principal;
|
|
36
56
|
/** Current discovery authority. Trusted callbacks use context.db for bounded reads. */
|
|
@@ -39,11 +59,40 @@ export declare class IntakeExecutionService {
|
|
|
39
59
|
[discoveryTransaction]<T>(run: TransactionRunner<T>, itemId: string, work: (db: DatabaseInterface, authorize: DiscoveryGate) => Promise<T>, requireReview?: boolean): Promise<T>;
|
|
40
60
|
private discoveryContext;
|
|
41
61
|
private bound;
|
|
62
|
+
/**
|
|
63
|
+
* Read authority for one handler binding of a listed item, read-only. It
|
|
64
|
+
* applies the handler checks `listReviews` applies before projecting an
|
|
65
|
+
* action: the bound handler must resolve to a single operation whose
|
|
66
|
+
* operation and capability still match the saved binding (no version
|
|
67
|
+
* drift), and the execution read gate (host authority, policy and ceiling
|
|
68
|
+
* handler/operation allowlists, `policy.access`, principal) must pass, but
|
|
69
|
+
* without the retention write; an item past the deadline `access` would
|
|
70
|
+
* narrow to is not listable, and neither is a cancelled item, which
|
|
71
|
+
* `listReviews` refuses once it binds an action. Per-action target,
|
|
72
|
+
* evidence and plan gates are not evaluated here; `load` still enforces
|
|
73
|
+
* them. A refusal or any other failed check answers false and the list
|
|
74
|
+
* discloses nothing about why; a host `authorize` that throws propagates,
|
|
75
|
+
* as it does from `load`, so the page is rejected. Package-internal:
|
|
76
|
+
* reachable only through a symbol the service holds,
|
|
77
|
+
* so callers cannot hand it an unscoped row.
|
|
78
|
+
*/
|
|
79
|
+
[listReadGate](item: Row, binding: {
|
|
80
|
+
handlerId: string;
|
|
81
|
+
handlerVersion: string;
|
|
82
|
+
operation: unknown;
|
|
83
|
+
capability: unknown;
|
|
84
|
+
}): Promise<boolean>;
|
|
42
85
|
private review;
|
|
43
86
|
/** Same-executor current review/evidence/target gate for the owning feedback ledger. */
|
|
44
87
|
/** Join an existing owning transaction; its outer boundary restores retention after rollback. */
|
|
45
88
|
[feedbackDiscoveryContext]<T>(db: DatabaseInterface | undefined, itemId: string, handlerId: string, handlerVersion: string, work: (context: HandlerContext) => Promise<T>, revalidate?: (context: HandlerContext) => Promise<void>): Promise<T>;
|
|
46
|
-
[feedbackActionTransaction]<T>(actionId: string, reviewer: boolean, work: (value: FeedbackActionContext) => Promise<T>, executor?: DatabaseInterface, requiredProviders?: string[], proposalId?: string
|
|
89
|
+
[feedbackActionTransaction]<T>(actionId: string, reviewer: boolean, work: (value: FeedbackActionContext) => Promise<T>, executor?: DatabaseInterface, requiredProviders?: string[], proposalId?: string,
|
|
90
|
+
/**
|
|
91
|
+
* Compare target revisions (default). A lineage re-check of a reviewer
|
|
92
|
+
* routing choice passes false: its meaning is the handler choice, so later
|
|
93
|
+
* writes to the target only need the target to remain accessible.
|
|
94
|
+
*/
|
|
95
|
+
targetRevisions?: boolean): Promise<T>;
|
|
47
96
|
private feedbackLineage;
|
|
48
97
|
getAction(actionId: string): Promise<ProposalReview>;
|
|
49
98
|
/** Bounded reload discovery. The cursor is an opaque action ID, never authority. */
|
|
@@ -51,12 +100,23 @@ export declare class IntakeExecutionService {
|
|
|
51
100
|
cursor?: string;
|
|
52
101
|
limit?: number;
|
|
53
102
|
}): Promise<ReviewPage>;
|
|
103
|
+
/**
|
|
104
|
+
* `reviewed` marks arguments a reviewer is previewing or correcting: only
|
|
105
|
+
* then is a refusal the typed `HandlerArgumentsInvalidError`. Apply-time
|
|
106
|
+
* verification and plan step expansion keep the plain error.
|
|
107
|
+
*/
|
|
54
108
|
private buildBinding;
|
|
55
109
|
private publish;
|
|
56
110
|
previewProposal(input: PreviewProposalInput): Promise<ProposalReview>;
|
|
111
|
+
/**
|
|
112
|
+
* A reviewer-selected action records a human routing choice: re-previewing it
|
|
113
|
+
* needs the reviewer grant (not just `preview`) and keeps its handler fixed,
|
|
114
|
+
* so only the arguments can be corrected.
|
|
115
|
+
*/
|
|
116
|
+
private assertReviewerRevision;
|
|
57
117
|
/** Capture owner facts in the same transaction; these are never correctness labels. */
|
|
58
118
|
private feedbackEvent;
|
|
59
|
-
submitDecision(input: ReviewInput): Promise<ProposalReview>;
|
|
119
|
+
submitDecision(input: ReviewInput, mode?: 'review' | 'review_own'): Promise<ProposalReview>;
|
|
60
120
|
private verifyEvidence;
|
|
61
121
|
private approved;
|
|
62
122
|
private arguments;
|
|
@@ -67,8 +127,45 @@ export declare class IntakeExecutionService {
|
|
|
67
127
|
reconcileAction(actionId: string): Promise<ActionResult>;
|
|
68
128
|
/** Machine authorization is separate provenance, never a fabricated human decision. */
|
|
69
129
|
authorizeAutomatic(actionId: string): Promise<ProposalReview>;
|
|
130
|
+
/**
|
|
131
|
+
* Whether an `authorized` action still holds an unexpired approval for its
|
|
132
|
+
* current review version. An expired one can be neither applied nor rejected,
|
|
133
|
+
* so it must not keep the item open; `approved()` refuses resolved items.
|
|
134
|
+
*/
|
|
135
|
+
private approvalLive;
|
|
136
|
+
/** Current terminal reviewer disposition, if any. */
|
|
137
|
+
private disposition;
|
|
138
|
+
private dispositionDTO;
|
|
139
|
+
/** The current revision's completed/partial attempt; failed revisions need reprocessing. */
|
|
140
|
+
private currentAttempt;
|
|
141
|
+
/** Reviewer authority under a handler this item's captured ceiling offers; no new grant. */
|
|
142
|
+
private reviewerAccess;
|
|
143
|
+
/** Extracted text for routing examples: the attempt's own results or its pinned extraction. */
|
|
144
|
+
private extractedQuery;
|
|
145
|
+
/** Optional explicit routing projection; the reviewer's action or disposition stays authoritative. */
|
|
146
|
+
private routingFeedback;
|
|
147
|
+
/** Human-chosen handler for any item. Same preview/approval path; never automation-eligible. */
|
|
148
|
+
startAction(input: StartActionInput): Promise<ProposalReview>;
|
|
149
|
+
/** The full disposition (reviewer, reason) under the current reviewer authority. */
|
|
150
|
+
getItemDisposition(itemId: string): Promise<ItemDisposition | undefined>;
|
|
151
|
+
/** Close an item as handled without an action. Terminal; replay returns the same disposition. */
|
|
152
|
+
resolveItem(input: ResolveItemInput): Promise<ItemDisposition>;
|
|
70
153
|
previewPlan(input: PreviewPlanInput): Promise<PlanReview>;
|
|
71
154
|
applyPlan(planId: string): Promise<ActionResult[]>;
|
|
155
|
+
/** The recorded submitter decides their own proposal under `review_own`
|
|
156
|
+
* authority. Apply remains the ordinary once-only path under live grants. */
|
|
157
|
+
submitOwnDecision(input: ReviewInput): Promise<ProposalReview>;
|
|
158
|
+
/** Bounded listing of this actor's own active submissions with their saved
|
|
159
|
+
* reviews. The submitter column is the authenticated receipt actor recorded by
|
|
160
|
+
* the server; every page reloads current item/handler/target authority. */
|
|
161
|
+
listOwnProposals(input?: OwnProposalsInput): Promise<OwnProposalsPage>;
|
|
162
|
+
/** Once a privacy-redacted item has no external action left to reconcile,
|
|
163
|
+
* drop the principal that redaction had to retain for it. Caller holds the
|
|
164
|
+
* item lock. */
|
|
165
|
+
private releaseRedactedPrincipal;
|
|
166
|
+
/** Only an explicit denial hides a row; a failing grant store propagates
|
|
167
|
+
* instead of silently shrinking the list. */
|
|
168
|
+
private readableOwn;
|
|
72
169
|
}
|
|
73
170
|
/** A jobs answer only wakes execution; the ledger's authoritative decision still gates apply. */
|
|
74
171
|
export declare function continueIntakeReview(service: {
|
package/dist/execution.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EACV,YAAY,EAGZ,cAAc,EACd,sBAAsB,EAItB,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAEpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,OAAO,KAAK,EAEV,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,EACV,YAAY,EAGZ,cAAc,EACd,sBAAsB,EAItB,UAAU,EACV,gBAAgB,EAChB,oBAAoB,EACpB,cAAc,EACd,gBAAgB,EAEhB,WAAW,EACX,gBAAgB,EACjB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,KAAK,aAAa,EAClB,oBAAoB,EACpB,YAAY,EACZ,KAAK,iBAAiB,EACvB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACL,KAAK,qBAAqB,EAC1B,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,wBAAwB,CAAC;AAIhC,OAAO,KAAK,EAAgB,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,mBAAmB,0BAA0B,CAAC;AAC9C,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,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,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAgRzD,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC;IAsCxD;iFAC6E;IACvE,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAGpE;;+EAE2E;IACrE,gBAAgB,CACpB,KAAK,GAAE,iBAAsB,GAC5B,OAAO,CAAC,gBAAgB,CAAC;IAsF5B;;oBAEgB;YACF,wBAAwB;IAyBtC;iDAC6C;YAC/B,WAAW;CAgB1B;AAED,iGAAiG;AACjG,wBAAsB,oBAAoB,CACxC,OAAO,EAAE;IACP,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CAChD,EACD,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,WAAW,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,GAC7C,OAAO,CAAC,YAAY,CAAC,CA6BvB"}
|
package/dist/execution.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { IntakeExecutionService, continueIntakeReview, intakeBindingDigest, resolveIntakePolicy };
|
|
1
|
+
import { a as resolveIntakePolicy, i as intakeBindingDigest, n as IntakeExecutionService, r as continueIntakeReview, t as IntakeAccessDeniedError } from "./chunks/execution-BzVQax0n.js";
|
|
2
|
+
export { IntakeAccessDeniedError, IntakeExecutionService, continueIntakeReview, intakeBindingDigest, resolveIntakePolicy };
|
package/dist/feedback-dto.d.ts
CHANGED
|
@@ -28,18 +28,32 @@ export interface FeedbackExample {
|
|
|
28
28
|
judgment: 'correct' | 'incorrect';
|
|
29
29
|
query: string;
|
|
30
30
|
args: IntakeValues;
|
|
31
|
-
|
|
31
|
+
/** Generation context of an interpretation judgment; absent for reviewer routing. */
|
|
32
|
+
model?: {
|
|
32
33
|
provider: string;
|
|
33
34
|
model: string;
|
|
34
35
|
version: string;
|
|
35
36
|
};
|
|
36
|
-
promptVersion
|
|
37
|
-
configurationVersion
|
|
37
|
+
promptVersion?: string;
|
|
38
|
+
configurationVersion?: string;
|
|
39
|
+
/** Absent means an interpretation judgment on a model suggestion. */
|
|
40
|
+
kind?: 'reviewer_routing';
|
|
41
|
+
/** Reviewer routing only: `none` closed the item without an action (handlerId `none`). */
|
|
42
|
+
routing?: {
|
|
43
|
+
choice: 'handler' | 'none';
|
|
44
|
+
reason: string;
|
|
45
|
+
};
|
|
46
|
+
/** Reviewer guidance the judged suggestion was produced under; an example, never authority. */
|
|
47
|
+
instruction?: {
|
|
48
|
+
id: string;
|
|
49
|
+
digest: string;
|
|
50
|
+
text: string;
|
|
51
|
+
};
|
|
38
52
|
}
|
|
39
53
|
export interface FeedbackReceipt {
|
|
40
54
|
id: string;
|
|
41
55
|
digest: string;
|
|
42
|
-
kind: 'interpretation' | 'action_decision' | 'downstream_outcome';
|
|
56
|
+
kind: 'interpretation' | 'action_decision' | 'downstream_outcome' | 'reviewer_routing';
|
|
43
57
|
}
|
|
44
58
|
export interface FeedbackReferences {
|
|
45
59
|
version: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-dto.d.ts","sourceRoot":"","sources":["../src/feedback-dto.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,WAAW,mBAAoB,SAAQ,eAAe;IAC1D,QAAQ,EAAE,SAAS,GAAG,WAAW,CAAC;IAClC,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AAC;IAC9B,SAAS,EAAE,MAAM,CAAC;CACnB;AACD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,uBAAuB,EAAE,KAAK,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -14,6 +14,15 @@ export interface FeedbackActionContext {
|
|
|
14
14
|
result: IntakeValues;
|
|
15
15
|
handlerId: string;
|
|
16
16
|
handlerVersion: string;
|
|
17
|
+
/** `intake_actions.data.origin`, e.g. `generated-proposal` or `reviewer-selected`. */
|
|
18
|
+
origin: string;
|
|
19
|
+
/**
|
|
20
|
+
* The action is approved and still effective: applied (`executing`,
|
|
21
|
+
* `succeeded`) or `authorized` with an unexpired approval, on an unresolved
|
|
22
|
+
* item. Evaluated only when an example or rule support is first selected;
|
|
23
|
+
* lineage re-checks of an earlier selection never consult it.
|
|
24
|
+
*/
|
|
25
|
+
settled: boolean;
|
|
17
26
|
}
|
|
18
27
|
export declare const feedbackDiscoveryContext: unique symbol;
|
|
19
28
|
//# sourceMappingURL=feedback-internal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-internal.d.ts","sourceRoot":"","sources":["../src/feedback-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,eAErC,CAAC;AACF,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,iBAAiB,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"feedback-internal.d.ts","sourceRoot":"","sources":["../src/feedback-internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACvE,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,eAErC,CAAC;AACF,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,iBAAiB,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,MAAM,EAAE,cAAc,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,YAAY,CAAC;IACnB,QAAQ,EAAE,YAAY,CAAC;IACvB,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,sFAAsF;IACtF,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,eAAO,MAAM,wBAAwB,eAEpC,CAAC"}
|
package/dist/feedback.d.ts
CHANGED
|
@@ -38,13 +38,23 @@ export declare class IntakeFeedbackService {
|
|
|
38
38
|
private checkBinding;
|
|
39
39
|
private insert;
|
|
40
40
|
private receipt;
|
|
41
|
+
/** Source text, pin and (when a model suggestion exists) generation versions. */
|
|
41
42
|
private provenance;
|
|
43
|
+
/** The example exactly as retrieval returns it; shared by the write-time size check. */
|
|
44
|
+
private exampleOf;
|
|
45
|
+
/**
|
|
46
|
+
* The verified reviewer instruction the action's generation ran under: the
|
|
47
|
+
* authenticated extraction record must match the generation's provenance.
|
|
48
|
+
*/
|
|
49
|
+
private instructionFor;
|
|
42
50
|
/** Internal saved-action gate; the execution owner supplies its transaction. */
|
|
43
51
|
assertActionLineage(actionId: string, db: DatabaseInterface, proposalId: string): Promise<void>;
|
|
44
52
|
record(input: RecordFeedbackInput): Promise<FeedbackReceipt>;
|
|
45
53
|
/** Consume a durable owner event idempotently. Never derive correctness from these signals. */
|
|
46
54
|
observe(input: ObserveFeedbackInput): Promise<FeedbackReceipt>;
|
|
47
55
|
private example;
|
|
56
|
+
/** Reviewer routing choice, reusable without a model suggestion; fails closed like `example`. */
|
|
57
|
+
private routingExample;
|
|
48
58
|
private receivingContext;
|
|
49
59
|
retrieve(input: RetrieveFeedbackInput, executor?: DatabaseInterface): Promise<FeedbackSelection>;
|
|
50
60
|
assertSelection(input: RetrieveFeedbackInput, selection: FeedbackReferences, executor?: DatabaseInterface): Promise<void>;
|