@happyvertical/smrt-ingestion 0.57.14 → 0.57.16
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/PROPOSALS.md +8 -0
- package/dist/chunks/execution-NoDh3pjs.js.map +1 -1
- package/dist/chunks/{proposal-errors-BQjFXSOt.js → proposal-errors-VxcTU6Db.js} +24 -2
- package/dist/chunks/proposal-errors-VxcTU6Db.js.map +1 -0
- 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 +13 -1
- package/dist/proposal-contracts.d.ts.map +1 -1
- package/dist/proposal-errors.d.ts +1 -1
- package/dist/proposal-errors.d.ts.map +1 -1
- package/dist/proposals.d.ts +8 -3
- package/dist/proposals.d.ts.map +1 -1
- package/dist/proposals.js +41 -25
- package/dist/proposals.js.map +1 -1
- package/dist/server.d.ts +4 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +15 -5
- package/dist/server.js.map +1 -1
- package/dist/smrt-knowledge.json +11 -11
- package/package.json +14 -14
- package/dist/chunks/proposal-errors-BQjFXSOt.js.map +0 -1
package/dist/smrt-knowledge.json
CHANGED
|
@@ -3,21 +3,21 @@
|
|
|
3
3
|
"sensitiveFieldsExcluded": true,
|
|
4
4
|
"generatedAt": "1970-01-01T00:00:00.000Z",
|
|
5
5
|
"packageName": "@happyvertical/smrt-ingestion",
|
|
6
|
-
"packageVersion": "0.57.
|
|
6
|
+
"packageVersion": "0.57.16",
|
|
7
7
|
"sourceManifestPath": "dist/manifest.json",
|
|
8
8
|
"agentDocPath": "AGENTS.md",
|
|
9
9
|
"sourceHashes": {
|
|
10
|
-
"manifest": "
|
|
11
|
-
"packageJson": "
|
|
10
|
+
"manifest": "a6f525951d3d4f8f2b4e1114cc80073243099a5bc0156d8c30072e099d87a9ad",
|
|
11
|
+
"packageJson": "f749f65d3838840961823ea7334f863b6f4b548b1d30d59116eb7f39d2aa649f",
|
|
12
12
|
"agents": "dea14442054ec1de798cba9be1fbdd955f44b0e4672639cbf3db8101d290c1fb",
|
|
13
13
|
"moduleDoc:agents/execution.md": "b9ce254892a5dbd44c762b6f8b718d2f2705779d67b893418fc8fcc5677e2179",
|
|
14
14
|
"moduleDoc:README.md": "75ad0e22d27c1cc8b18cd0666f1928a510f45403aeb3be8e5decef8d756b4846",
|
|
15
15
|
"moduleDoc:EXTRACTION.md": "b735a25a7be75f3a13f3f9e92b0c25834c1394835c16ccd73a076d5720c14243",
|
|
16
|
-
"moduleDoc:PROPOSALS.md": "
|
|
16
|
+
"moduleDoc:PROPOSALS.md": "5478b20c7d32a31e0c74500c978c4148cff1939b50c078ec9179556f8e4f810c",
|
|
17
17
|
"moduleDoc:FEEDBACK.md": "1da3dcf033d60aaf3e67c9813efcfe58cb69d3c238aa4526c33edaa884357f06",
|
|
18
18
|
"moduleDoc:REVIEW.md": "dc7514212b58191a4b9ea77d665340cb6e9c8bb18458098cf7b231c45b87f3d1",
|
|
19
19
|
"agentSurface:src/test-support/execution.ts": "1df56aaf1a692d822ed45ecb7e50df7d6806977ff3c03f9eeaf171c64f496865",
|
|
20
|
-
"agentSurface:src/test-support/proposals.ts": "
|
|
20
|
+
"agentSurface:src/test-support/proposals.ts": "e9fa6aadf355aa315a90dd876f06fe65704ef51f343bb9f93f9a7e2c01b2e6ae"
|
|
21
21
|
},
|
|
22
22
|
"exports": [
|
|
23
23
|
".",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@happyvertical/smrt-vitest": "workspace:*",
|
|
50
50
|
"@types/node": "24.13.6",
|
|
51
51
|
"typescript": "6.0.3",
|
|
52
|
-
"vite": "8.1.
|
|
52
|
+
"vite": "8.1.6",
|
|
53
53
|
"vitest": "4.1.10",
|
|
54
54
|
"@happyvertical/smrt-content": "workspace:*",
|
|
55
55
|
"@happyvertical/smrt-messages": "workspace:*",
|
|
@@ -1614,7 +1614,7 @@
|
|
|
1614
1614
|
{
|
|
1615
1615
|
"path": "PROPOSALS.md",
|
|
1616
1616
|
"module": "PROPOSALS",
|
|
1617
|
-
"content": "# Application-aware proposal generation\n\n`@happyvertical/smrt-ingestion/proposals` is server-only. Configure\n`IngestionOptions.proposals` and the existing `execution.handlers` catalog.\nHandlers opt into discovery with `discovery.mediaTypes`, `references`, and an\noptional `candidates` callback. There is one catalog: the same operation or\nordered playbook adapter is discovered, validated, previewed, and later applied\nby the execution service. Generation never approves or applies.\n\n## Discovery and authority\n\n`listHandlers(itemId)` returns a bounded detached catalog. The owning execution\nservice checks the current principal, captured permissions/handler/operation\nceiling, policy, confidential scope, public registered operation facts, and\nordered playbook definition. Every configured provider must occur in the current\npolicy's `providers` allowlist. Missing grants remove handlers before model input.\nAn authorized catalog larger than the configured bound is rejected; the host must\nnarrow it explicitly instead of relying on silent truncation.\n\n`findCandidates({itemId,handlerId,handlerVersion,query,limit})` returns\n`{items,truncated}`. Its trusted handler callback receives `HandlerContext` with\nthe authorized transaction executor. Query by tenant and confidential scope\n**before** selecting, ranking, or building labels. Use a bounded query (often\n`limit + 1`) and report `hasMore`. The service projects candidate identity, model,\nrevision and label, then checks every target with the owning execution callback.\nThere are no hidden counts or pagination tokens. Truncated discovery forces\n`needs_review` and cannot enter generated preview.\n\nCompleted generation reload checks process authority, the current attempt, and\nowner/candidate visibility in the same final transaction. Database-backed grant\ncallbacks must use the supplied executor. The owning retention lifecycle encloses\nthat transaction so a denied read cannot roll back an authorized shorter privacy\nceiling; restoration starts only after the outer transaction has rolled back.\n\nCandidate callbacks perform bounded database reads only: no provider I/O, network,\nor domain mutations. Target locks and existing retention enforcement remain\nowned by execution. Hosts configure their database's statement deadlines; an\narbitrary trusted callback is not a sandbox. Each existing-record argument must\nbe a declared top-level `references` field of kind `candidate` with its qualified\nmodel, or `evidence`. Closed JSON argument schemas are required. The host owns\nthat declaration and its target authorization semantics.\n\n## Durable stages\n\n1. Complete extraction through the existing analysis ledger.\n2. Call `prepareGeneration(itemId, extractionAttemptId)`. It reads the current\n completed/partial immutable extraction and returns configuration with\n `stage: 'interpret'`, pinned source attempt/revision/input/output/evidence\n digests, prompt/configuration/catalog/provider versions, limits and thresholds.\n3. Pass that configuration to `analyze(itemId, configuration, requestKey)` and\n claim its new revision with `claimAnalysis`.\n4. The host's existing job callback routes on the frozen `configuration.stage`:\n extraction invokes `extractAnalysis`; interpretation invokes\n `generateProposals(lease)`.\n5. Reload the current completed generation using `getCompletedAnalysis(itemId)`,\n or pass an explicit attempt ID to additionally reject stale client state.\n Queued/running revisions never return an older completed attempt.\n\nA generation revision does not rewrite terminal extraction. Reprocessing starts\nwith a new extraction revision, followed by interpretation, while the host keeps\nthe same business intention keys. An interrupted still-current generation lease\ncan be retried; terminal generation output remains immutable. `getGenerationInput`\nreads historical extraction only through the current generation lease and its\nfrozen source pin. It verifies same-item scope, immutable hashes, durable evidence,\nand current process permission before returning detached data. The source must be\nthe immediately preceding revision, so an intervening reprocess invalidates a\nprepared generation. Completed generation reads additionally recheck current\ncatalog and target visibility before disclosing persisted candidate labels.\nExpired, cancelled, revoked, retried or superseded workers cannot read or publish late output. The\ncurrent lease and each offered handler/candidate are rechecked immediately before\neach outbound generative/decision boundary and before publication.\n\n## Providers and validation\n\n`createSDKProposalGenerator(client, identity, {maxTokens,timeoutMs})` uses an\nexisting AI SDK `chat` client. It sends a fixed system instruction and separate\nJSON evidence/catalog data, requests JSON, supplies cancellation and bounds, uses\nno tools or continuation, and rejects known truncation or tool calls,\nunexpected models, malformed JSON and oversized output. Configure SDK clients\nwithout automatic retry that would bypass application boundary checks. The\nadapter's public identity is exactly provider/model/version; credentials and raw\nprovider errors are never provenance.\n\nA trusted custom `ProposalGenerator` must likewise honor cancellation, bound its\nresponse, and explicitly declare validated `complete` or `unknown` completion.\nThe SDK currently normalizes missing/unknown finish reasons to `stop`\n([owning SDK follow-up](https://github.com/happyvertical/sdk/issues/1381)), so its\nadapter conservatively declares `unknown`, persisted as\n`generation_completion_unknown`. Otherwise valid suggestions remain available\nfor human preview; automatic eligibility always remains false. The service\ndeadline aborts requests and prevents late publication; it does not claim to terminate computation at a remote\nprovider or isolate native allocations. Extractor process limits remain separate.\n\nModel output can contain only offered handler versions, schema-valid arguments,\nretained evidence locations and offered alternative handler/candidate keys.\nCandidate IDs must occur in the offered set, and evidence IDs in retained source\nresults. Unknown enums, invented IDs, extra authority/tool/approval fields and\nmalformed structures fail closed. Missing required top-level fields are retained\nas `missingFields`, with `needs_review`; values are never invented to satisfy a\nschema. Observed page/time/source granularity is preserved. Logical scan splits\nuse `proposeDocumentSplits`; originals and hashes remain intact.\n\n`createSDKProposalDecisionClient(client)` adapts an existing SDK client’s optional\ncapability without changing its errors or protocol. Optional `decision` uses public core `executeDecision` and the existing SDK\npredicate, choice, score and batch contracts. Supported-effect predicates,\nhandler classification, candidate entity matching, and action ambiguity/risk\nare distinct questions. Their validated probabilities and provenance are stored\nseparately from generative provenance and unknown OCR certainty. The complete\nserialized decision request, including suggestions and questions, must fit the\nminimum configured/current policy byte ceiling before capability probing and\nagain before deciding. A policy change between these boundaries fails closed.\nTies, support probability or selected-handler confidence below\n`minimumDecisionProbability`, and actually incomplete extraction require review.\nUnknown provider\ncompletion metadata is preserved as `source_completion_unknown`; it does not\nblock otherwise schema-valid **human** preview or imply completeness. Automatic\naction eligibility remains false. An unconfigured decision path\nis recorded explicitly. Configured errors produce a durable safe failure outcome;\nthey never silently switch to a generative decision fallback.\n\nOutput records zero, one or multiple suggestions, alternatives, missing fields,\nsource links, proposed splits, versions, allowlisted usage, warnings and explicit\n`unknown`, `ambiguous`, `no_action`, `needs_review` or `provider_error` outcomes.\n`automaticActionEligible` is always false. Provider input/output and the complete\nserialized persisted envelope are bounded by configuration, live policy and the\nreceipt ceiling. Oversized output becomes a bounded review/limit result; when\nno safe envelope fits, the owning service records fixed `failAnalysis` metadata\noutside the provider payload budget without retaining provider output.\n\n## Explicit preview and stable intentions\n\nThe host chooses persisted suggestion indexes and calls:\n\n```ts\nawait service.previewGeneratedProposals({\n itemId,\n attemptId: generationAttemptId,\n selections: [{\n index: 0,\n intentionKey: 'document:meeting-2026-10-09',\n expectedRevision: 0,\n requestId: 'review-request-1',\n }],\n});\n```\n\n`intentionKey` is the host's stable business-intention identity across generation\nrevisions. Never derive a fresh key from model output, suggestion order or a retry.\nSelections must reference current persisted validated `ready_for_review` output.\nEach batch requires distinct suggestion indexes and intention keys; duplicate\nindexes are rejected before any operation or plan preview is written.\nThe service rechecks current catalog/schema/target/source provenance, then calls\nthe existing operation or plan preview. Each result still requires the ordinary\nhuman review and execution APIs. Reprocessing creates no new business identity;\nsuccessful-action replay protection stays with execution.\n\n## Evidence and limits\n\nThe test matrix is `docs/test-matrix/3673-ingestion-proposals.md`. SQLite and real\nPostgreSQL suites exercise authority, revisions, abstention, hostile output,\ncompound proposals, split provenance and reviewed domain effects. The upload\nreference composes authenticated multipart delivery of a generated embedded-text\nPDF through the actual packaged PDF child, durable interpretation, and the existing\nordered ContentDocument draft/retained-asset plan. It checks duplicate delivery,\nunauthenticated and foreign-tenant denial, explicit approval of both steps,\nidempotent execution replay, page provenance, and unchanged original bytes.\nThe compound-email case uses a declared messages-owner snapshot fixture.\n\nLocal HTTP fixtures execute the actual AI SDK transport and cancellation contract.\nGenerative responses and the separate injected PDF split boundaries establish\ndeterministic orchestration, not model accuracy or OCR quality. No held-out routing\nevaluation or automatic approval is claimed. Missing/unknown AI completion remains\nexplicit under [SDK #1381](https://github.com/happyvertical/sdk/issues/1381).\n\nProposal limits are checked at `IngestionService` construction: positive safe\nintegers, at most 20 handlers/candidates/suggestions and 2147483647 ms timeout.\nInterpretation output uses the exported `GenerationAnalysisOutput` wrapper at\n`analysis.result.output.proposals`; the published review host unwraps it.\nAn explicit feedback `retrieve` denial omits optional examples and feedback\nprovenance and continues generation. Item/execution denials, unexpected failures,\nand revocation after examples were selected still fail closed before disclosure.\n"
|
|
1617
|
+
"content": "# Application-aware proposal generation\n\n`@happyvertical/smrt-ingestion/proposals` is server-only. Configure\n`IngestionOptions.proposals` and the existing `execution.handlers` catalog.\nHandlers opt into discovery with `discovery.mediaTypes`, `references`, and an\noptional `candidates` callback. There is one catalog: the same operation or\nordered playbook adapter is discovered, validated, previewed, and later applied\nby the execution service. Generation never approves or applies.\n\nCredential-free review hosts may configure `IngestionOptions.proposalRead` with\n`ProposalReadConfiguration`: public generator/decision identities, version,\nprompt version, limits and thresholds only. It reads completed proposals,\npreserves current authority and snapshot validation, and permits human preview;\nit never accepts a generator or provider client. If a process supplies both\nsettings, their public configuration must match exactly. Preparing or generating\nproposals still requires `proposals` with a real generator.\n\n## Discovery and authority\n\n`listHandlers(itemId)` returns a bounded detached catalog. The owning execution\nservice checks the current principal, captured permissions/handler/operation\nceiling, policy, confidential scope, public registered operation facts, and\nordered playbook definition. Every configured provider must occur in the current\npolicy's `providers` allowlist. Missing grants remove handlers before model input.\nAn authorized catalog larger than the configured bound is rejected; the host must\nnarrow it explicitly instead of relying on silent truncation.\n\n`findCandidates({itemId,handlerId,handlerVersion,query,limit})` returns\n`{items,truncated}`. Its trusted handler callback receives `HandlerContext` with\nthe authorized transaction executor. Query by tenant and confidential scope\n**before** selecting, ranking, or building labels. Use a bounded query (often\n`limit + 1`) and report `hasMore`. The service projects candidate identity, model,\nrevision and label, then checks every target with the owning execution callback.\nThere are no hidden counts or pagination tokens. Truncated discovery forces\n`needs_review` and cannot enter generated preview.\n\nCompleted generation reload checks process authority, the current attempt, and\nowner/candidate visibility in the same final transaction. Database-backed grant\ncallbacks must use the supplied executor. The owning retention lifecycle encloses\nthat transaction so a denied read cannot roll back an authorized shorter privacy\nceiling; restoration starts only after the outer transaction has rolled back.\n\nCandidate callbacks perform bounded database reads only: no provider I/O, network,\nor domain mutations. Target locks and existing retention enforcement remain\nowned by execution. Hosts configure their database's statement deadlines; an\narbitrary trusted callback is not a sandbox. Each existing-record argument must\nbe a declared top-level `references` field of kind `candidate` with its qualified\nmodel, or `evidence`. Closed JSON argument schemas are required. The host owns\nthat declaration and its target authorization semantics.\n\n## Durable stages\n\n1. Complete extraction through the existing analysis ledger.\n2. Call `prepareGeneration(itemId, extractionAttemptId)`. It reads the current\n completed/partial immutable extraction and returns configuration with\n `stage: 'interpret'`, pinned source attempt/revision/input/output/evidence\n digests, prompt/configuration/catalog/provider versions, limits and thresholds.\n3. Pass that configuration to `analyze(itemId, configuration, requestKey)` and\n claim its new revision with `claimAnalysis`.\n4. The host's existing job callback routes on the frozen `configuration.stage`:\n extraction invokes `extractAnalysis`; interpretation invokes\n `generateProposals(lease)`.\n5. Reload the current completed generation using `getCompletedAnalysis(itemId)`,\n or pass an explicit attempt ID to additionally reject stale client state.\n Queued/running revisions never return an older completed attempt.\n\nA generation revision does not rewrite terminal extraction. Reprocessing starts\nwith a new extraction revision, followed by interpretation, while the host keeps\nthe same business intention keys. An interrupted still-current generation lease\ncan be retried; terminal generation output remains immutable. `getGenerationInput`\nreads historical extraction only through the current generation lease and its\nfrozen source pin. It verifies same-item scope, immutable hashes, durable evidence,\nand current process permission before returning detached data. The source must be\nthe immediately preceding revision, so an intervening reprocess invalidates a\nprepared generation. Completed generation reads additionally recheck current\ncatalog and target visibility before disclosing persisted candidate labels.\nExpired, cancelled, revoked, retried or superseded workers cannot read or publish late output. The\ncurrent lease and each offered handler/candidate are rechecked immediately before\neach outbound generative/decision boundary and before publication.\n\n## Providers and validation\n\n`createSDKProposalGenerator(client, identity, {maxTokens,timeoutMs})` uses an\nexisting AI SDK `chat` client. It sends a fixed system instruction and separate\nJSON evidence/catalog data, requests JSON, supplies cancellation and bounds, uses\nno tools or continuation, and rejects known truncation or tool calls,\nunexpected models, malformed JSON and oversized output. Configure SDK clients\nwithout automatic retry that would bypass application boundary checks. The\nadapter's public identity is exactly provider/model/version; credentials and raw\nprovider errors are never provenance.\n\nA trusted custom `ProposalGenerator` must likewise honor cancellation, bound its\nresponse, and explicitly declare validated `complete` or `unknown` completion.\nThe SDK currently normalizes missing/unknown finish reasons to `stop`\n([owning SDK follow-up](https://github.com/happyvertical/sdk/issues/1381)), so its\nadapter conservatively declares `unknown`, persisted as\n`generation_completion_unknown`. Otherwise valid suggestions remain available\nfor human preview; automatic eligibility always remains false. The service\ndeadline aborts requests and prevents late publication; it does not claim to terminate computation at a remote\nprovider or isolate native allocations. Extractor process limits remain separate.\n\nModel output can contain only offered handler versions, schema-valid arguments,\nretained evidence locations and offered alternative handler/candidate keys.\nCandidate IDs must occur in the offered set, and evidence IDs in retained source\nresults. Unknown enums, invented IDs, extra authority/tool/approval fields and\nmalformed structures fail closed. Missing required top-level fields are retained\nas `missingFields`, with `needs_review`; values are never invented to satisfy a\nschema. Observed page/time/source granularity is preserved. Logical scan splits\nuse `proposeDocumentSplits`; originals and hashes remain intact.\n\n`createSDKProposalDecisionClient(client)` adapts an existing SDK client’s optional\ncapability without changing its errors or protocol. Optional `decision` uses public core `executeDecision` and the existing SDK\npredicate, choice, score and batch contracts. Supported-effect predicates,\nhandler classification, candidate entity matching, and action ambiguity/risk\nare distinct questions. Their validated probabilities and provenance are stored\nseparately from generative provenance and unknown OCR certainty. The complete\nserialized decision request, including suggestions and questions, must fit the\nminimum configured/current policy byte ceiling before capability probing and\nagain before deciding. A policy change between these boundaries fails closed.\nTies, support probability or selected-handler confidence below\n`minimumDecisionProbability`, and actually incomplete extraction require review.\nUnknown provider\ncompletion metadata is preserved as `source_completion_unknown`; it does not\nblock otherwise schema-valid **human** preview or imply completeness. Automatic\naction eligibility remains false. An unconfigured decision path\nis recorded explicitly. Configured errors produce a durable safe failure outcome;\nthey never silently switch to a generative decision fallback.\n\nOutput records zero, one or multiple suggestions, alternatives, missing fields,\nsource links, proposed splits, versions, allowlisted usage, warnings and explicit\n`unknown`, `ambiguous`, `no_action`, `needs_review` or `provider_error` outcomes.\n`automaticActionEligible` is always false. Provider input/output and the complete\nserialized persisted envelope are bounded by configuration, live policy and the\nreceipt ceiling. Oversized output becomes a bounded review/limit result; when\nno safe envelope fits, the owning service records fixed `failAnalysis` metadata\noutside the provider payload budget without retaining provider output.\n\n## Explicit preview and stable intentions\n\nThe host chooses persisted suggestion indexes and calls:\n\n```ts\nawait service.previewGeneratedProposals({\n itemId,\n attemptId: generationAttemptId,\n selections: [{\n index: 0,\n intentionKey: 'document:meeting-2026-10-09',\n expectedRevision: 0,\n requestId: 'review-request-1',\n }],\n});\n```\n\n`intentionKey` is the host's stable business-intention identity across generation\nrevisions. Never derive a fresh key from model output, suggestion order or a retry.\nSelections must reference current persisted validated `ready_for_review` output.\nEach batch requires distinct suggestion indexes and intention keys; duplicate\nindexes are rejected before any operation or plan preview is written.\nThe service rechecks current catalog/schema/target/source provenance, then calls\nthe existing operation or plan preview. Each result still requires the ordinary\nhuman review and execution APIs. Reprocessing creates no new business identity;\nsuccessful-action replay protection stays with execution.\n\n## Evidence and limits\n\nThe test matrix is `docs/test-matrix/3673-ingestion-proposals.md`. SQLite and real\nPostgreSQL suites exercise authority, revisions, abstention, hostile output,\ncompound proposals, split provenance and reviewed domain effects. The upload\nreference composes authenticated multipart delivery of a generated embedded-text\nPDF through the actual packaged PDF child, durable interpretation, and the existing\nordered ContentDocument draft/retained-asset plan. It checks duplicate delivery,\nunauthenticated and foreign-tenant denial, explicit approval of both steps,\nidempotent execution replay, page provenance, and unchanged original bytes.\nThe compound-email case uses a declared messages-owner snapshot fixture.\n\nLocal HTTP fixtures execute the actual AI SDK transport and cancellation contract.\nGenerative responses and the separate injected PDF split boundaries establish\ndeterministic orchestration, not model accuracy or OCR quality. No held-out routing\nevaluation or automatic approval is claimed. Missing/unknown AI completion remains\nexplicit under [SDK #1381](https://github.com/happyvertical/sdk/issues/1381).\n\nProposal limits are checked at `IngestionService` construction: positive safe\nintegers, at most 20 handlers/candidates/suggestions and 2147483647 ms timeout.\nInterpretation output uses the exported `GenerationAnalysisOutput` wrapper at\n`analysis.result.output.proposals`; the published review host unwraps it.\nAn explicit feedback `retrieve` denial omits optional examples and feedback\nprovenance and continues generation. Item/execution denials, unexpected failures,\nand revocation after examples were selected still fail closed before disclosure.\n"
|
|
1618
1618
|
},
|
|
1619
1619
|
{
|
|
1620
1620
|
"path": "FEEDBACK.md",
|
|
@@ -1651,7 +1651,7 @@
|
|
|
1651
1651
|
"code": "not-module-scope",
|
|
1652
1652
|
"helper": "definePlaybook",
|
|
1653
1653
|
"message": "`definePlaybook()` must be called at module scope to be emitted into the manifest and knowledge graph. A declaration the scanner cannot read without evaluating it is not emittable — use `useWebMcpTool` for a tool set derived from computed or fetched data.",
|
|
1654
|
-
"line":
|
|
1654
|
+
"line": 1118,
|
|
1655
1655
|
"column": 9,
|
|
1656
1656
|
"sourceFile": "src/test-support/proposals.ts"
|
|
1657
1657
|
},
|
|
@@ -1659,7 +1659,7 @@
|
|
|
1659
1659
|
"code": "not-module-scope",
|
|
1660
1660
|
"helper": "definePlaybook",
|
|
1661
1661
|
"message": "`definePlaybook()` must be called at module scope to be emitted into the manifest and knowledge graph. A declaration the scanner cannot read without evaluating it is not emittable — use `useWebMcpTool` for a tool set derived from computed or fetched data.",
|
|
1662
|
-
"line":
|
|
1662
|
+
"line": 1690,
|
|
1663
1663
|
"column": 9,
|
|
1664
1664
|
"sourceFile": "src/test-support/proposals.ts"
|
|
1665
1665
|
},
|
|
@@ -1667,7 +1667,7 @@
|
|
|
1667
1667
|
"code": "not-module-scope",
|
|
1668
1668
|
"helper": "definePlaybook",
|
|
1669
1669
|
"message": "`definePlaybook()` must be called at module scope to be emitted into the manifest and knowledge graph. A declaration the scanner cannot read without evaluating it is not emittable — use `useWebMcpTool` for a tool set derived from computed or fetched data.",
|
|
1670
|
-
"line":
|
|
1670
|
+
"line": 4111,
|
|
1671
1671
|
"column": 9,
|
|
1672
1672
|
"sourceFile": "src/test-support/proposals.ts"
|
|
1673
1673
|
},
|
|
@@ -1675,7 +1675,7 @@
|
|
|
1675
1675
|
"code": "not-module-scope",
|
|
1676
1676
|
"helper": "definePlaybook",
|
|
1677
1677
|
"message": "`definePlaybook()` must be called at module scope to be emitted into the manifest and knowledge graph. A declaration the scanner cannot read without evaluating it is not emittable — use `useWebMcpTool` for a tool set derived from computed or fetched data.",
|
|
1678
|
-
"line":
|
|
1678
|
+
"line": 4736,
|
|
1679
1679
|
"column": 7,
|
|
1680
1680
|
"sourceFile": "src/test-support/proposals.ts"
|
|
1681
1681
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-ingestion",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.16",
|
|
4
4
|
"description": "Durable tenant-scoped intake and evidence foundations",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -50,32 +50,32 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@happyvertical/smrt-core": "0.57.
|
|
54
|
-
"@happyvertical/smrt-types": "0.57.
|
|
55
|
-
"@happyvertical/smrt-tenancy": "0.57.
|
|
56
|
-
"@happyvertical/smrt-assets": "0.57.
|
|
57
|
-
"@happyvertical/smrt-jobs": "0.57.
|
|
53
|
+
"@happyvertical/smrt-core": "0.57.16",
|
|
54
|
+
"@happyvertical/smrt-types": "0.57.16",
|
|
55
|
+
"@happyvertical/smrt-tenancy": "0.57.16",
|
|
56
|
+
"@happyvertical/smrt-assets": "0.57.16",
|
|
57
|
+
"@happyvertical/smrt-jobs": "0.57.16",
|
|
58
58
|
"@happyvertical/sql": "^0.105.5",
|
|
59
59
|
"@happyvertical/pdf": "^0.65.9",
|
|
60
60
|
"@happyvertical/ocr": "^0.62.1",
|
|
61
61
|
"@happyvertical/speech": "^0.105.5",
|
|
62
62
|
"@happyvertical/ai": "^0.105.5",
|
|
63
63
|
"sharp": "^0.35.5",
|
|
64
|
-
"@happyvertical/smrt-agents": "0.57.
|
|
65
|
-
"@happyvertical/smrt-playbooks": "0.57.
|
|
64
|
+
"@happyvertical/smrt-agents": "0.57.16",
|
|
65
|
+
"@happyvertical/smrt-playbooks": "0.57.16",
|
|
66
66
|
"ajv": "8.20.0",
|
|
67
|
-
"@happyvertical/smrt-ui": "0.57.
|
|
67
|
+
"@happyvertical/smrt-ui": "0.57.16"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@happyvertical/smrt-vitest": "0.57.
|
|
70
|
+
"@happyvertical/smrt-vitest": "0.57.16",
|
|
71
71
|
"@types/node": "24.13.6",
|
|
72
72
|
"typescript": "6.0.3",
|
|
73
|
-
"vite": "8.1.
|
|
73
|
+
"vite": "8.1.6",
|
|
74
74
|
"vitest": "4.1.10",
|
|
75
|
-
"@happyvertical/smrt-content": "0.57.
|
|
76
|
-
"@happyvertical/smrt-messages": "0.57.
|
|
75
|
+
"@happyvertical/smrt-content": "0.57.16",
|
|
76
|
+
"@happyvertical/smrt-messages": "0.57.16",
|
|
77
77
|
"@happyvertical/email": "^0.105.5",
|
|
78
|
-
"@happyvertical/smrt-users": "0.57.
|
|
78
|
+
"@happyvertical/smrt-users": "0.57.16",
|
|
79
79
|
"@sveltejs/package": "^2.5.8",
|
|
80
80
|
"@sveltejs/vite-plugin-svelte": "^7.3.0",
|
|
81
81
|
"svelte": "^5.57.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"proposal-errors-BQjFXSOt.js","names":[],"sources":["../../src/proposal-limits.ts","../../src/extraction.ts","../../src/proposal-errors.ts"],"sourcesContent":["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 { 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","/** Current generation is authorized, but its immutable candidate revisions are stale. */\nexport class GenerationSnapshotStaleError extends Error {\n constructor() {\n super('Generation snapshot stale');\n this.name = 'GenerationSnapshotStaleError';\n }\n}\n"],"mappings":";;;;;;AAGO,SAAS,qBACd,QACM;CACN,IACE,CAAC,UACD;EACE;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAA,CAAE,MACC,QACC,CAAC,OAAO,cAAc,OAAO,IAA2B,KACxD,OAAO,QAA+B,CAC1C,KACA,OAAO,cAAc,MACrB,OAAO,gBAAgB,MACvB,OAAO,iBAAiB,MACxB,OAAO,YAAY,YAEnB,MAAM,IAAI,MAAM,yBAAyB;AAC7C;;;ACeO,SAAS,2BACd,eACmB;CACnB,IAAI;EACF,gBAAgB,gBAAgB,aAAa;CAC/C,QAAQ;EACN,MAAM,IAAI,MAAM,yCAAyC;CAC3D;CACA,MAAM,UAAU,cAAc,0BAA0B;CACxD,IAAI,CAAC,OAAO,cAAc,OAAO,KAAK,UAAU,KAAK,UAAU,IAC7D,MAAM,IAAI,MAAM,gCAAgC;CAClD,IAAI,UAAU;CACd,IAAI,cAAc,0BAA0B,iBAC1C,MAAM,IAAI,MAAM,qCAAqC;CACvD,KAAA,MAAW,YAAY;EACrB,cAAc;EACd,cAAc;EACd,cAAc;EACd,cAAc;CAChB,GACE,IAAI,UAAU,SAAS,WAAW,iBAAiB,SAAS,QAAQ;CAEtE,IACE,cAAc,KAAK,aAAa,UAChC,cAAc,KAAK,SAAS,aAAa,QAEzC,MAAM,IAAI,MAAM,0BAA0B;CAC5C,OAAO,EACL,MAAM,Q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