@exellix/ai-tasks 10.0.9 → 10.0.11
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/CHANGELOG.md +25 -0
- package/README.md +32 -35
- package/RUNTASK_REQUEST.md +4 -4
- package/dist/activix/phaseTracking.d.ts +1 -1
- package/dist/activix/phaseTracking.d.ts.map +1 -1
- package/dist/activix/phaseTracking.js.map +1 -1
- package/dist/builders/task-request-builder.d.ts +1 -54
- package/dist/builders/task-request-builder.d.ts.map +1 -1
- package/dist/builders/task-request-builder.js +1 -180
- package/dist/builders/task-request-builder.js.map +1 -1
- package/dist/core/task-sdk.d.ts +4 -10
- package/dist/core/task-sdk.d.ts.map +1 -1
- package/dist/core/task-sdk.js +35 -117
- package/dist/core/task-sdk.js.map +1 -1
- package/dist/errors/runTaskExecutionError.d.ts +1 -1
- package/dist/errors/runTaskExecutionError.d.ts.map +1 -1
- package/dist/errors/runTaskExecutionError.js +0 -2
- package/dist/errors/runTaskExecutionError.js.map +1 -1
- package/dist/errors/smartInputValidationError.d.ts +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/resolveRunTaskRuntimeKnobs.d.ts +2 -5
- package/dist/internal/resolveRunTaskRuntimeKnobs.d.ts.map +1 -1
- package/dist/internal/resolveRunTaskRuntimeKnobs.js +3 -36
- package/dist/internal/resolveRunTaskRuntimeKnobs.js.map +1 -1
- package/dist/localTasks/collectEvidence.d.ts.map +1 -1
- package/dist/localTasks/collectEvidence.js +13 -23
- package/dist/localTasks/collectEvidence.js.map +1 -1
- package/dist/localTasks/decideWebScope.js +1 -1
- package/dist/localTasks/decideWebScope.js.map +1 -1
- package/dist/localTasks/index.d.ts +0 -1
- package/dist/localTasks/index.d.ts.map +1 -1
- package/dist/localTasks/index.js +2 -4
- package/dist/localTasks/index.js.map +1 -1
- package/dist/localTasks/playgroundSeedMain.d.ts +4 -0
- package/dist/localTasks/playgroundSeedMain.d.ts.map +1 -0
- package/dist/localTasks/playgroundSeedMain.js +26 -0
- package/dist/localTasks/playgroundSeedMain.js.map +1 -0
- package/dist/logxer/aiTasksDiagnosticCodes.d.ts +1 -1
- package/dist/logxer/aiTasksDiagnosticCodes.js +1 -1
- package/dist/logxer/aiTasksDiagnosticCodes.js.map +1 -1
- package/dist/narrix/narrixUnitExecution.d.ts.map +1 -1
- package/dist/narrix/narrixUnitExecution.js +1 -6
- package/dist/narrix/narrixUnitExecution.js.map +1 -1
- package/dist/narrix/webContextMarkdown.d.ts +2 -25
- package/dist/narrix/webContextMarkdown.d.ts.map +1 -1
- package/dist/narrix/webContextMarkdown.js +33 -57
- package/dist/narrix/webContextMarkdown.js.map +1 -1
- package/dist/node-execution/buildRequestFromNodePlan.d.ts.map +1 -1
- package/dist/node-execution/buildRequestFromNodePlan.js +0 -12
- package/dist/node-execution/buildRequestFromNodePlan.js.map +1 -1
- package/dist/node-execution/createNodeExecutionHost.d.ts.map +1 -1
- package/dist/node-execution/createNodeExecutionHost.js +1 -26
- package/dist/node-execution/createNodeExecutionHost.js.map +1 -1
- package/dist/node-execution/dispatchExecutionUnit.d.ts.map +1 -1
- package/dist/node-execution/dispatchExecutionUnit.js +0 -15
- package/dist/node-execution/dispatchExecutionUnit.js.map +1 -1
- package/dist/node-execution/executeNodeFromPlan.d.ts.map +1 -1
- package/dist/node-execution/executeNodeFromPlan.js +0 -15
- package/dist/node-execution/executeNodeFromPlan.js.map +1 -1
- package/dist/node-execution/executePlaygroundElement.d.ts +23 -0
- package/dist/node-execution/executePlaygroundElement.d.ts.map +1 -0
- package/dist/node-execution/executePlaygroundElement.js +80 -0
- package/dist/node-execution/executePlaygroundElement.js.map +1 -0
- package/dist/node-execution/index.d.ts +2 -0
- package/dist/node-execution/index.d.ts.map +1 -1
- package/dist/node-execution/index.js +1 -0
- package/dist/node-execution/index.js.map +1 -1
- package/dist/node-execution/types.d.ts +0 -2
- package/dist/node-execution/types.d.ts.map +1 -1
- package/dist/observability/classifyRunTaskFailure.d.ts +1 -1
- package/dist/observability/classifyRunTaskFailure.d.ts.map +1 -1
- package/dist/observability/classifyRunTaskFailure.js +0 -3
- package/dist/observability/classifyRunTaskFailure.js.map +1 -1
- package/dist/observability/extractAiTasksObservability.d.ts.map +1 -1
- package/dist/observability/extractAiTasksObservability.js +0 -8
- package/dist/observability/extractAiTasksObservability.js.map +1 -1
- package/dist/planWebScopeQuestions/index.d.ts +1 -1
- package/dist/planWebScopeQuestions/index.js +1 -1
- package/dist/rendrixUpstreamExports.d.ts +1 -1
- package/dist/rendrixUpstreamExports.d.ts.map +1 -1
- package/dist/rendrixUpstreamExports.js +1 -1
- package/dist/rendrixUpstreamExports.js.map +1 -1
- package/dist/synthesis/index.d.ts +1 -1
- package/dist/synthesis/index.js +1 -1
- package/dist/synthesis/resolveSourceMaterial.d.ts +3 -7
- package/dist/synthesis/resolveSourceMaterial.d.ts.map +1 -1
- package/dist/synthesis/resolveSourceMaterial.js +15 -78
- package/dist/synthesis/resolveSourceMaterial.js.map +1 -1
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts +0 -1
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts.map +1 -1
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js +1 -9
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js.map +1 -1
- package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts +3 -4
- package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts.map +1 -1
- package/dist/task-strategies/canonicalInputExecutionStrategies.js +3 -4
- package/dist/task-strategies/canonicalInputExecutionStrategies.js.map +1 -1
- package/dist/task-strategies/canonicalTaskStrategies.d.ts +2 -2
- package/dist/task-strategies/canonicalTaskStrategies.js +1 -1
- package/dist/task-strategies/canonicalTaskStrategies.js.map +1 -1
- package/dist/task-strategies/cataloxCatalogViews.d.ts +2 -5
- package/dist/task-strategies/cataloxCatalogViews.d.ts.map +1 -1
- package/dist/task-strategies/cataloxCatalogViews.js +3 -6
- package/dist/task-strategies/cataloxCatalogViews.js.map +1 -1
- package/dist/task-strategies/constants.d.ts +0 -4
- package/dist/task-strategies/constants.d.ts.map +1 -1
- package/dist/task-strategies/constants.js +0 -4
- package/dist/task-strategies/constants.js.map +1 -1
- package/dist/task-strategies/index.d.ts +4 -6
- package/dist/task-strategies/index.d.ts.map +1 -1
- package/dist/task-strategies/index.js +4 -5
- package/dist/task-strategies/index.js.map +1 -1
- package/dist/task-strategies/listAiTaskStrategies.d.ts +0 -2
- package/dist/task-strategies/listAiTaskStrategies.d.ts.map +1 -1
- package/dist/task-strategies/listAiTaskStrategies.js +1 -5
- package/dist/task-strategies/listAiTaskStrategies.js.map +1 -1
- package/dist/types/index.d.ts +1 -4
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +0 -1
- package/dist/types/index.js.map +1 -1
- package/dist/types/task-types.d.ts +9 -133
- package/dist/types/task-types.d.ts.map +1 -1
- package/dist/types/task-types.js +0 -4
- package/dist/types/task-types.js.map +1 -1
- package/dist/types/web-scope-types.d.ts +20 -0
- package/dist/types/web-scope-types.d.ts.map +1 -0
- package/dist/types/web-scope-types.js +2 -0
- package/dist/types/web-scope-types.js.map +1 -0
- package/dist/utils/runTaskRequestShape.d.ts +1 -5
- package/dist/utils/runTaskRequestShape.d.ts.map +1 -1
- package/dist/utils/runTaskRequestShape.js +0 -26
- package/dist/utils/runTaskRequestShape.js.map +1 -1
- package/dist/utils/templateContext.d.ts +16 -0
- package/dist/utils/templateContext.d.ts.map +1 -0
- package/dist/utils/templateContext.js +35 -0
- package/dist/utils/templateContext.js.map +1 -0
- package/dist/validation/helpers.d.ts.map +1 -1
- package/dist/validation/helpers.js +3 -22
- package/dist/validation/helpers.js.map +1 -1
- package/dist/validation/validateRunTaskConfig.d.ts.map +1 -1
- package/dist/validation/validateRunTaskConfig.js +2 -0
- package/dist/validation/validateRunTaskConfig.js.map +1 -1
- package/dist/validation/validateRunTaskInvoke.d.ts.map +1 -1
- package/dist/validation/validateRunTaskInvoke.js +2 -0
- package/dist/validation/validateRunTaskInvoke.js.map +1 -1
- package/dist/validation/validateWebScopeUnit.d.ts +16 -0
- package/dist/validation/validateWebScopeUnit.d.ts.map +1 -0
- package/dist/validation/validateWebScopeUnit.js +107 -0
- package/dist/validation/validateWebScopeUnit.js.map +1 -0
- package/dist/web-scope/applyWebScopeToRequest.d.ts +11 -0
- package/dist/web-scope/applyWebScopeToRequest.d.ts.map +1 -0
- package/dist/web-scope/applyWebScopeToRequest.js +42 -0
- package/dist/web-scope/applyWebScopeToRequest.js.map +1 -0
- package/dist/web-scope/buildSearchInput.d.ts +22 -0
- package/dist/web-scope/buildSearchInput.d.ts.map +1 -0
- package/dist/web-scope/buildSearchInput.js +108 -0
- package/dist/web-scope/buildSearchInput.js.map +1 -0
- package/dist/web-scope/client.d.ts +12 -0
- package/dist/web-scope/client.d.ts.map +1 -0
- package/dist/web-scope/client.js +72 -0
- package/dist/web-scope/client.js.map +1 -0
- package/dist/web-scope/renderWebQueryTemplate.d.ts +14 -0
- package/dist/web-scope/renderWebQueryTemplate.d.ts.map +1 -0
- package/dist/web-scope/renderWebQueryTemplate.js +44 -0
- package/dist/web-scope/renderWebQueryTemplate.js.map +1 -0
- package/dist/web-scope/webContextMarkdown.d.ts +22 -0
- package/dist/web-scope/webContextMarkdown.d.ts.map +1 -0
- package/dist/web-scope/webContextMarkdown.js +163 -0
- package/dist/web-scope/webContextMarkdown.js.map +1 -0
- package/documenations/run-task-execution-flow.md +3 -7
- package/documenations/web-scoping-in-ai-tasks.md +88 -428
- package/package.json +16 -33
- package/dist/narrix/applyWebScopeToRequest.d.ts +0 -9
- package/dist/narrix/applyWebScopeToRequest.d.ts.map +0 -1
- package/dist/narrix/applyWebScopeToRequest.js +0 -156
- package/dist/narrix/applyWebScopeToRequest.js.map +0 -1
- package/dist/narrix/buildWebScopeScopeInput.d.ts +0 -39
- package/dist/narrix/buildWebScopeScopeInput.d.ts.map +0 -1
- package/dist/narrix/buildWebScopeScopeInput.js +0 -193
- package/dist/narrix/buildWebScopeScopeInput.js.map +0 -1
- package/dist/narrix/webScoper.d.ts +0 -43
- package/dist/narrix/webScoper.d.ts.map +0 -1
- package/dist/narrix/webScoper.js +0 -144
- package/dist/narrix/webScoper.js.map +0 -1
- package/documenations/activix.md +0 -187
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exellix/ai-tasks",
|
|
3
|
-
"version": "10.0.
|
|
3
|
+
"version": "10.0.11",
|
|
4
4
|
"description": "Task orchestration for the Exellix stack: runTask() with local handlers or LLM-backed execution, task-scoped memory/context enrichment, and executor dispatch via @exellix/ai-skills. ERC-compliant.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,21 +21,14 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc",
|
|
23
23
|
"dev": "ts-node src/index.ts",
|
|
24
|
-
"prepublishOnly": "npm run build && node scripts/ensure-nx-content-md-variants.mjs",
|
|
24
|
+
"prepublishOnly": "node scripts/assert-publishable-deps.mjs && npm run build && node scripts/ensure-nx-content-md-variants.mjs",
|
|
25
25
|
"deps:latest": "npx npm-check-updates -u && npm install",
|
|
26
|
-
"test": "node scripts/ensure-xynthesis-dist.mjs && node scripts/ensure-ai-skills-dist.mjs && node scripts/clean-dist-test.mjs && tsc -p tsconfig.test.json && node scripts/copy-test-fixtures.mjs && node --test --test-force-exit --test-concurrency=1 dist-test/test/node-execution/**/*.js dist-test/test/
|
|
27
|
-
"test:with-narrix-ingest": "node scripts/run-npm-test-with-narrix-ingest.mjs",
|
|
26
|
+
"test": "node scripts/ensure-xynthesis-dist.mjs && node scripts/ensure-ai-skills-dist.mjs && node scripts/clean-dist-test.mjs && tsc -p tsconfig.test.json && node scripts/copy-test-fixtures.mjs && node --test --test-force-exit --test-concurrency=1 dist-test/test/node-execution/**/*.js dist-test/test/aiScoping/*.js dist-test/test/intermediateSteps/*.js dist-test/test/post-steps/**/*.js dist-test/test/planWebScopeQuestions/*.js dist-test/test/synthesis/*.js dist-test/test/fact-guard/*.js dist-test/test/utils/*.js dist-test/test/errors/*.js dist-test/test/validation/*.js dist-test/test/web-scope/*.js dist-test/test/task-strategies/*.js dist-test/test/observability/*.js dist-test/test/run-task/*.js dist-test/test/internal/*.js dist-test/test/execution-strategies/*.js dist-test/test/invocation/*.js dist-test/test/e2e/*.js",
|
|
28
27
|
"test:e2e:intermediateSteps": "node scripts/run-with-env.mjs RUN_INTERMEDIATE_STEPS_E2E=1 npm run test",
|
|
29
28
|
"test:e2e:synthesis": "node scripts/run-synthesis-e2e.mjs",
|
|
30
29
|
"test:e2e:webScope": "node scripts/run-web-scope-e2e.mjs",
|
|
31
30
|
"test:fact-guard": "node scripts/ensure-xynthesis-dist.mjs && node scripts/clean-dist-test.mjs && tsc -p tsconfig.test.json && node --test --test-force-exit dist-test/test/fact-guard/*.js dist-test/test/post-steps/runPostStepLlmCall.factGuard.test.js",
|
|
32
31
|
"test:live": "node scripts/run-live-ai-e2e.mjs",
|
|
33
|
-
"test:narrix:live": "node scripts/check-narrix-archive.mjs && node scripts/run-npm-test-with-narrix-ingest.mjs",
|
|
34
|
-
"local:narrix:subnets": "node dist/localTasks/narrixSubnetPlayground.js",
|
|
35
|
-
"local:narrix:assets": "node dist/localTasks/narrixAssetPlayground.js",
|
|
36
|
-
"local:narrix:vuln-groups": "node dist/localTasks/narrixVulnGroupPlayground.js",
|
|
37
|
-
"local:narrix:vuln-instances": "node dist/localTasks/narrixVulnInstancePlayground.js",
|
|
38
|
-
"local:narrix:all": "npm run local:narrix:subnets && npm run local:narrix:assets && npm run local:narrix:vuln-groups && npm run local:narrix:vuln-instances",
|
|
39
32
|
"publish:task-strategies": "tsx scripts/publish-ai-task-strategies-catalog.ts"
|
|
40
33
|
},
|
|
41
34
|
"keywords": [
|
|
@@ -65,46 +58,36 @@
|
|
|
65
58
|
"@x12i/catalox-contracts": "^5.9.7"
|
|
66
59
|
},
|
|
67
60
|
"dependencies": {
|
|
68
|
-
"@exellix/ai-skills": "^6.12.
|
|
69
|
-
"@exellix/memorix-narrix-adapter": "^2.0.0",
|
|
70
|
-
"@exellix/narrix-adapter-chat": "^2.0.0",
|
|
71
|
-
"@exellix/narrix-adapter-docs": "^2.0.0",
|
|
72
|
-
"@exellix/narrix-adapter-records": "^2.0.0",
|
|
73
|
-
"@exellix/narrix-adapter-text": "^2.0.0",
|
|
74
|
-
"@exellix/narrix-adapters-core": "^2.0.0",
|
|
75
|
-
"@exellix/narrix-catalox": "^2.0.0",
|
|
76
|
-
"@exellix/narrix-cni": "^2.0.0",
|
|
77
|
-
"@exellix/narrix-ingest": "^2.0.0",
|
|
78
|
-
"@exellix/narrix-runner": "^2.0.0",
|
|
79
|
-
"@exellix/narrix-web-scoper": "^2.0.0",
|
|
80
|
-
"@exellix/xynthesis": "^4.8.4",
|
|
81
|
-
"@x12i/activix": "^8.6.3",
|
|
82
|
-
"@x12i/ai-profiles": "^3.4.0",
|
|
83
|
-
"@x12i/catalox": "^5.9.7",
|
|
61
|
+
"@exellix/ai-skills": "^6.12.4",
|
|
84
62
|
"@exellix/fact-guard-adapters": "^1.0.1",
|
|
85
63
|
"@exellix/fact-guard-enrichment": "^1.0.1",
|
|
86
64
|
"@exellix/fact-guard-policies": "^1.0.1",
|
|
87
65
|
"@exellix/fact-guard-types": "^1.0.1",
|
|
88
66
|
"@exellix/fact-guard-validation": "^1.0.1",
|
|
67
|
+
"@exellix/xynthesis": "^4.8.4",
|
|
68
|
+
"@x12i/activix": "^8.6.3",
|
|
69
|
+
"@x12i/ai-profiles": "^3.4.0",
|
|
70
|
+
"@x12i/catalox": "^5.9.7",
|
|
89
71
|
"@x12i/execution-memory-manager": "^1.2.0",
|
|
90
72
|
"@x12i/funcx": "^4.9.13",
|
|
91
|
-
"@x12i/graphenix-core": "^2.7.
|
|
92
|
-
"@x12i/graphenix-executable-contracts": "^2.7.
|
|
93
|
-
"@x12i/graphenix-plan-format": "^2.7.
|
|
94
|
-
"@x12i/graphenix-trace-format": "^2.7.
|
|
73
|
+
"@x12i/graphenix-core": "^2.7.2",
|
|
74
|
+
"@x12i/graphenix-executable-contracts": "^2.7.2",
|
|
75
|
+
"@x12i/graphenix-plan-format": "^2.7.2",
|
|
76
|
+
"@x12i/graphenix-trace-format": "^2.7.2",
|
|
95
77
|
"@x12i/logxer": "^4.6.0",
|
|
96
78
|
"@x12i/optimixer": "^3.5.2",
|
|
97
79
|
"@x12i/rendrix": "^4.3.0",
|
|
98
80
|
"@x12i/search-adapter": "^1.5.1",
|
|
81
|
+
"@x12i/web-scoper": "^1.1.1",
|
|
99
82
|
"handlebars": "^4.7.8",
|
|
100
83
|
"nx-cache": "^1.0.2"
|
|
101
84
|
},
|
|
102
85
|
"devDependencies": {
|
|
103
86
|
"@types/node": "^18.0.0 || ^20.0.0",
|
|
104
87
|
"@x12i/catalox-contracts": "^5.9.7",
|
|
105
|
-
"@x12i/graphenix-authoring-format": "^2.7.
|
|
106
|
-
"@x12i/graphenix-plan-compiler": "^2.7.
|
|
107
|
-
"@x12i/graphenix-task-node-format": "^2.7.
|
|
88
|
+
"@x12i/graphenix-authoring-format": "^2.7.2",
|
|
89
|
+
"@x12i/graphenix-plan-compiler": "^2.7.2",
|
|
90
|
+
"@x12i/graphenix-task-node-format": "^2.7.2",
|
|
108
91
|
"dotenv": "^16.0.0",
|
|
109
92
|
"ts-node": "^10.9.0",
|
|
110
93
|
"tsx": "^4.0.0",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { NarrixPreProcessorConfig, RunTaskRequest } from "../types/task-types.js";
|
|
2
|
-
import type { NarrixRunOutputSuccess } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* Run web scoping and merge `executionMemory.webContext` (lenient — always sets webContext when enabled).
|
|
5
|
-
*/
|
|
6
|
-
export declare function applyWebScopeToRequest(request: RunTaskRequest, narrix: NarrixPreProcessorConfig, narrixSuccess?: NarrixRunOutputSuccess): Promise<RunTaskRequest>;
|
|
7
|
-
/** Standalone Layer-1 web-scope unit (no Narrix preprocessor required). */
|
|
8
|
-
export declare function applyStandaloneWebScopeUnit(request: RunTaskRequest, unitParams?: Record<string, unknown>): Promise<RunTaskRequest>;
|
|
9
|
-
//# sourceMappingURL=applyWebScopeToRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applyWebScopeToRequest.d.ts","sourceRoot":"","sources":["../../src/narrix/applyWebScopeToRequest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAMvF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AA0FzD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,wBAAwB,EAChC,aAAa,CAAC,EAAE,sBAAsB,GACrC,OAAO,CAAC,cAAc,CAAC,CA4CzB;AAED,2EAA2E;AAC3E,wBAAsB,2BAA2B,CAC/C,OAAO,EAAE,cAAc,EACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC,OAAO,CAAC,cAAc,CAAC,CAiCzB"}
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { resolveWebScopeQuestionAndTemplates, } from "./buildWebScopeScopeInput.js";
|
|
2
|
-
import { runWebScope, runWebScopeQuestionPack, webScopeActivixCorrelationPatch } from "./webScoper.js";
|
|
3
|
-
function isRecord(v) {
|
|
4
|
-
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
5
|
-
}
|
|
6
|
-
function readRecordInput(request) {
|
|
7
|
-
const em = request.executionMemory;
|
|
8
|
-
const emInput = em?.input;
|
|
9
|
-
if (isRecord(emInput) && isRecord(emInput.raw)) {
|
|
10
|
-
return emInput.raw;
|
|
11
|
-
}
|
|
12
|
-
if (isRecord(emInput))
|
|
13
|
-
return emInput;
|
|
14
|
-
return request.input;
|
|
15
|
-
}
|
|
16
|
-
function shouldSkipWebScope(request, narrix) {
|
|
17
|
-
if (narrix.skipWebScopeWhenExternalWebMarkdownPresent !== true)
|
|
18
|
-
return false;
|
|
19
|
-
const em = request.executionMemory;
|
|
20
|
-
const md = em?.webContextMarkdown;
|
|
21
|
-
return typeof md === "string" && md.trim().length > 0;
|
|
22
|
-
}
|
|
23
|
-
function buildScopeInputBase(request, narrix, narrixSuccess) {
|
|
24
|
-
const correlation = webScopeActivixCorrelationPatch({
|
|
25
|
-
jobId: request.jobId,
|
|
26
|
-
taskId: request.taskId,
|
|
27
|
-
sessionId: request.taskId,
|
|
28
|
-
});
|
|
29
|
-
if (narrixSuccess) {
|
|
30
|
-
const entity = narrixSuccess.entity;
|
|
31
|
-
const cni = narrixSuccess.cni !== undefined && narrixSuccess.cni !== null
|
|
32
|
-
? narrixSuccess.cni
|
|
33
|
-
: undefined;
|
|
34
|
-
return {
|
|
35
|
-
datasetId: narrixSuccess.meta.datasetId ?? narrix.datasetId,
|
|
36
|
-
subjectId: entity.entityId ?? entity.entityKey,
|
|
37
|
-
entityKind: entity.entityKind,
|
|
38
|
-
...(cni !== undefined ? { cni } : {}),
|
|
39
|
-
...correlation,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const record = readRecordInput(request);
|
|
43
|
-
const entityKind = typeof narrix.datasetId === "string" && narrix.datasetId.trim()
|
|
44
|
-
? narrix.datasetId.split(".").pop() ?? "generic"
|
|
45
|
-
: "generic";
|
|
46
|
-
return {
|
|
47
|
-
datasetId: narrix.datasetId,
|
|
48
|
-
subjectId: request.taskId ??
|
|
49
|
-
request.jobId ??
|
|
50
|
-
(isRecord(record) && typeof record.id === "string" ? record.id : "web-scope"),
|
|
51
|
-
entityKind,
|
|
52
|
-
...correlation,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
function applyResolvedFieldsToScopeInput(base, resolved) {
|
|
56
|
-
if (resolved.webScopeTemplates?.length) {
|
|
57
|
-
return {
|
|
58
|
-
...base,
|
|
59
|
-
webScopeTemplates: resolved.webScopeTemplates,
|
|
60
|
-
webScopeObjects: resolved.webScopeObjects,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
if (resolved.packQuestions?.length) {
|
|
64
|
-
const pack = {
|
|
65
|
-
datasetId: base.datasetId,
|
|
66
|
-
subjectId: base.subjectId,
|
|
67
|
-
entityKind: base.entityKind,
|
|
68
|
-
questions: resolved.packQuestions,
|
|
69
|
-
...(base.cni !== undefined ? { cni: base.cni } : {}),
|
|
70
|
-
};
|
|
71
|
-
return pack;
|
|
72
|
-
}
|
|
73
|
-
if (resolved.question) {
|
|
74
|
-
return { ...base, question: resolved.question };
|
|
75
|
-
}
|
|
76
|
-
return base;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Run web scoping and merge `executionMemory.webContext` (lenient — always sets webContext when enabled).
|
|
80
|
-
*/
|
|
81
|
-
export async function applyWebScopeToRequest(request, narrix, narrixSuccess) {
|
|
82
|
-
if (!narrix.enableWebScope)
|
|
83
|
-
return request;
|
|
84
|
-
if (shouldSkipWebScope(request, narrix))
|
|
85
|
-
return request;
|
|
86
|
-
const record = readRecordInput(request);
|
|
87
|
-
const entity = narrixSuccess
|
|
88
|
-
? readRecordInput(request)
|
|
89
|
-
: isRecord(record)
|
|
90
|
-
? record
|
|
91
|
-
: undefined;
|
|
92
|
-
const resolvedFields = resolveWebScopeQuestionAndTemplates({
|
|
93
|
-
narrix,
|
|
94
|
-
requestInput: request.input,
|
|
95
|
-
successResult: narrixSuccess ??
|
|
96
|
-
{
|
|
97
|
-
ok: true,
|
|
98
|
-
entity: { entityKind: "generic", entityKey: request.taskId ?? "web-scope" },
|
|
99
|
-
signals: [],
|
|
100
|
-
stories: [],
|
|
101
|
-
meta: { datasetId: narrix.datasetId, packId: "standalone", entityKind: "generic" },
|
|
102
|
-
},
|
|
103
|
-
entity,
|
|
104
|
-
});
|
|
105
|
-
const base = buildScopeInputBase(request, narrix, narrixSuccess);
|
|
106
|
-
const scopeInput = applyResolvedFieldsToScopeInput(base, resolvedFields);
|
|
107
|
-
const scoping = narrix.webScoping;
|
|
108
|
-
let webContext;
|
|
109
|
-
if ("questions" in scopeInput && Array.isArray(scopeInput.questions)) {
|
|
110
|
-
webContext = await runWebScopeQuestionPack(scopeInput, { scoping });
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
webContext = await runWebScope(scopeInput, { scoping });
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
...request,
|
|
117
|
-
executionMemory: {
|
|
118
|
-
...(request.executionMemory ?? {}),
|
|
119
|
-
webContext,
|
|
120
|
-
},
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
/** Standalone Layer-1 web-scope unit (no Narrix preprocessor required). */
|
|
124
|
-
export async function applyStandaloneWebScopeUnit(request, unitParams) {
|
|
125
|
-
const narrixFromRequest = request.narrix;
|
|
126
|
-
const datasetId = typeof unitParams?.datasetId === "string" && unitParams.datasetId.trim()
|
|
127
|
-
? unitParams.datasetId
|
|
128
|
-
: narrixFromRequest?.datasetId ?? "web-scope";
|
|
129
|
-
const narrix = {
|
|
130
|
-
...(narrixFromRequest ?? {}),
|
|
131
|
-
datasetId,
|
|
132
|
-
enableWebScope: true,
|
|
133
|
-
...(unitParams?.webScopeTemplates !== undefined
|
|
134
|
-
? { webScopeTemplates: unitParams.webScopeTemplates }
|
|
135
|
-
: {}),
|
|
136
|
-
...(unitParams?.webScopeObjects !== undefined
|
|
137
|
-
? { webScopeObjects: unitParams.webScopeObjects }
|
|
138
|
-
: {}),
|
|
139
|
-
...(unitParams?.webScopeQuestionTemplate !== undefined
|
|
140
|
-
? { webScopeQuestionTemplate: unitParams.webScopeQuestionTemplate }
|
|
141
|
-
: {}),
|
|
142
|
-
...(unitParams?.webScopeQuestions !== undefined
|
|
143
|
-
? { webScopeQuestions: unitParams.webScopeQuestions }
|
|
144
|
-
: {}),
|
|
145
|
-
...(unitParams?.webScoping !== undefined
|
|
146
|
-
? { webScoping: unitParams.webScoping }
|
|
147
|
-
: {}),
|
|
148
|
-
...(unitParams?.skipWebScopeWhenExternalWebMarkdownPresent !== undefined
|
|
149
|
-
? {
|
|
150
|
-
skipWebScopeWhenExternalWebMarkdownPresent: unitParams.skipWebScopeWhenExternalWebMarkdownPresent,
|
|
151
|
-
}
|
|
152
|
-
: {}),
|
|
153
|
-
};
|
|
154
|
-
return applyWebScopeToRequest(request, narrix);
|
|
155
|
-
}
|
|
156
|
-
//# sourceMappingURL=applyWebScopeToRequest.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"applyWebScopeToRequest.js","sourceRoot":"","sources":["../../src/narrix/applyWebScopeToRequest.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mCAAmC,GAEpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,MAAM,gBAAgB,CAAC;AAGvG,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,eAAe,CAAC,OAAuB;IAC9C,MAAM,EAAE,GAAG,OAAO,CAAC,eAAsD,CAAC;IAC1E,MAAM,OAAO,GAAG,EAAE,EAAE,KAAK,CAAC;IAC1B,IAAI,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAE,OAA6B,CAAC,GAAG,CAAC,EAAE,CAAC;QACtE,OAAQ,OAA4C,CAAC,GAAG,CAAC;IAC3D,CAAC;IACD,IAAI,QAAQ,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IACtC,OAAO,OAAO,CAAC,KAA4D,CAAC;AAC9E,CAAC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ACP,GAAG,CAAC,UAAU,EAAE,iBAAiB,KAAK,SAAS;YAC7C,CAAC,CAAC,EAAE,iBAAiB,EAAE,UAAU,CAAC,iBAAkE,EAAE;YACtG,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,UAAU,EAAE,UAAU,KAAK,SAAS;YACtC,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,UAAoD,EAAE;YACjF,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,UAAU,EAAE,0CAA0C,KAAK,SAAS;YACtE,CAAC,CAAC;gBACE,0CAA0C,EACxC,UAAU,CAAC,0CAAqD;aACnE;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;IACF,OAAO,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AACjD,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { NarrixCniLike, WebScopePackInput } from "@exellix/narrix-web-scoper";
|
|
2
|
-
type WebScopeQuestion = WebScopePackInput["questions"][number];
|
|
3
|
-
import type { NarrixPreProcessorConfig, NarrixWebScopeQuestion } from "../types/task-types.js";
|
|
4
|
-
import type { NarrixRunOutputSuccess } from "./types.js";
|
|
5
|
-
export type BuildWebScopeTemplateContextArgs = {
|
|
6
|
-
cni?: NarrixCniLike;
|
|
7
|
-
entity?: Record<string, unknown>;
|
|
8
|
-
baseQuestion?: string;
|
|
9
|
-
entityKey?: string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* Flatten CNI knownFacts, common graphized entity paths, and question aliases for web scope templates / Handlebars.
|
|
13
|
-
*/
|
|
14
|
-
export declare function buildWebScopeTemplateContext(args: BuildWebScopeTemplateContextArgs): Record<string, unknown>;
|
|
15
|
-
export type ResolveWebScopeQuestionAndTemplatesArgs = {
|
|
16
|
-
narrix: NarrixPreProcessorConfig;
|
|
17
|
-
requestInput: Record<string, unknown> | string | null | undefined;
|
|
18
|
-
successResult: NarrixRunOutputSuccess;
|
|
19
|
-
entity?: Record<string, unknown>;
|
|
20
|
-
};
|
|
21
|
-
/** Fields merged into `scopeGeneric` or into `scopeQuestionPack` base input. */
|
|
22
|
-
export type ResolvedWebScopeScopeFields = {
|
|
23
|
-
question?: string;
|
|
24
|
-
webScopeTemplates?: string[];
|
|
25
|
-
webScopeObjects?: Record<string, unknown>;
|
|
26
|
-
/** When non-empty, task-sdk uses `scopeQuestionPack` instead of `scopeGeneric`. */
|
|
27
|
-
packQuestions?: WebScopeQuestion[];
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Normalize `narrix.webScopeQuestions` into `@exellix/narrix-web-scoper` `WebScopeQuestion[]`
|
|
31
|
-
* (stable `id`, trimmed `question`, optional `purpose` from `source`).
|
|
32
|
-
*/
|
|
33
|
-
export declare function normalizeNarrixWebScopeQuestions(entries: NarrixWebScopeQuestion[] | undefined): WebScopeQuestion[];
|
|
34
|
-
/**
|
|
35
|
-
* Resolves ScopeInput fields for web scoping: optional athenix templates + objects, or enriched question (Handlebars or default append).
|
|
36
|
-
*/
|
|
37
|
-
export declare function resolveWebScopeQuestionAndTemplates(args: ResolveWebScopeQuestionAndTemplatesArgs): ResolvedWebScopeScopeFields;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=buildWebScopeScopeInput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildWebScopeScopeInput.d.ts","sourceRoot":"","sources":["../../src/narrix/buildWebScopeScopeInput.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAEnF,KAAK,gBAAgB,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAC/D,OAAO,KAAK,EAAE,wBAAwB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAC/F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AA2BzD,MAAM,MAAM,gCAAgC,GAAG;IAC7C,GAAG,CAAC,EAAE,aAAa,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,gCAAgC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAsD5G;AA2BD,MAAM,MAAM,uCAAuC,GAAG;IACpD,MAAM,EAAE,wBAAwB,CAAC;IACjC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAClE,aAAa,EAAE,sBAAsB,CAAC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,2BAA2B,GAAG;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC1C,mFAAmF;IACnF,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACpC,CAAC;AAEF;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,sBAAsB,EAAE,GAAG,SAAS,GAC5C,gBAAgB,EAAE,CAkBpB;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CACjD,IAAI,EAAE,uCAAuC,GAC5C,2BAA2B,CA6D7B"}
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import Handlebars from "handlebars";
|
|
3
|
-
function isRecord(v) {
|
|
4
|
-
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
5
|
-
}
|
|
6
|
-
function digGraphized(entity, path) {
|
|
7
|
-
if (!entity)
|
|
8
|
-
return undefined;
|
|
9
|
-
const g = entity.graphized;
|
|
10
|
-
if (!isRecord(g))
|
|
11
|
-
return undefined;
|
|
12
|
-
let cur = g;
|
|
13
|
-
for (const key of path) {
|
|
14
|
-
if (!isRecord(cur))
|
|
15
|
-
return undefined;
|
|
16
|
-
cur = cur[key];
|
|
17
|
-
}
|
|
18
|
-
return cur;
|
|
19
|
-
}
|
|
20
|
-
function pickScalarString(obj, keys) {
|
|
21
|
-
for (const k of keys) {
|
|
22
|
-
const v = obj[k];
|
|
23
|
-
if (typeof v === "string" && v.trim())
|
|
24
|
-
return v.trim();
|
|
25
|
-
if (v != null && typeof v !== "object" && String(v).trim())
|
|
26
|
-
return String(v).trim();
|
|
27
|
-
}
|
|
28
|
-
return undefined;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* Flatten CNI knownFacts, common graphized entity paths, and question aliases for web scope templates / Handlebars.
|
|
32
|
-
*/
|
|
33
|
-
export function buildWebScopeTemplateContext(args) {
|
|
34
|
-
const out = {};
|
|
35
|
-
const { cni, entity, baseQuestion, entityKey } = args;
|
|
36
|
-
if (baseQuestion !== undefined && baseQuestion !== "") {
|
|
37
|
-
out.question = baseQuestion;
|
|
38
|
-
out.baseQuestion = baseQuestion;
|
|
39
|
-
}
|
|
40
|
-
if (entityKey !== undefined && entityKey !== "") {
|
|
41
|
-
out.label = entityKey;
|
|
42
|
-
out.entityKey = entityKey;
|
|
43
|
-
}
|
|
44
|
-
const facts = cni?.knownFacts;
|
|
45
|
-
if (Array.isArray(facts)) {
|
|
46
|
-
for (const f of facts) {
|
|
47
|
-
if (!isRecord(f))
|
|
48
|
-
continue;
|
|
49
|
-
const key = f.key;
|
|
50
|
-
if (typeof key !== "string" || !key.trim())
|
|
51
|
-
continue;
|
|
52
|
-
const value = f.value;
|
|
53
|
-
if (value !== undefined)
|
|
54
|
-
out[key.trim()] = value;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
if (entity) {
|
|
58
|
-
const cveId = pickScalarString(out, ["cveId", "CVE_ID", "cve", "CVE"]) ??
|
|
59
|
-
(() => {
|
|
60
|
-
const v = digGraphized(entity, ["vulnerability", "cveId"]);
|
|
61
|
-
if (typeof v === "string" && v.trim())
|
|
62
|
-
return v.trim();
|
|
63
|
-
const v2 = digGraphized(entity, ["vulnerability", "cve"]);
|
|
64
|
-
if (typeof v2 === "string" && v2.trim())
|
|
65
|
-
return v2.trim();
|
|
66
|
-
return undefined;
|
|
67
|
-
})();
|
|
68
|
-
if (cveId && out.cveId === undefined)
|
|
69
|
-
out.cveId = cveId;
|
|
70
|
-
const vendor = pickScalarString(out, ["vendor", "Vendor"]) ??
|
|
71
|
-
(() => {
|
|
72
|
-
const v = digGraphized(entity, ["vulnerability", "vendor"]);
|
|
73
|
-
return typeof v === "string" && v.trim() ? v.trim() : undefined;
|
|
74
|
-
})();
|
|
75
|
-
if (vendor && out.vendor === undefined)
|
|
76
|
-
out.vendor = vendor;
|
|
77
|
-
const product = pickScalarString(out, ["product", "Product"]) ??
|
|
78
|
-
(() => {
|
|
79
|
-
const v = digGraphized(entity, ["vulnerability", "product"]);
|
|
80
|
-
return typeof v === "string" && v.trim() ? v.trim() : undefined;
|
|
81
|
-
})();
|
|
82
|
-
if (product && out.product === undefined)
|
|
83
|
-
out.product = product;
|
|
84
|
-
}
|
|
85
|
-
return out;
|
|
86
|
-
}
|
|
87
|
-
function tokenNotInBase(base, token) {
|
|
88
|
-
if (!token)
|
|
89
|
-
return false;
|
|
90
|
-
return !base.toLowerCase().includes(token.toLowerCase());
|
|
91
|
-
}
|
|
92
|
-
function defaultEnrichQuestion(baseQuestion, ctx) {
|
|
93
|
-
const cveId = pickScalarString(ctx, ["cveId", "CVE_ID", "cve", "CVE"]);
|
|
94
|
-
const vendor = pickScalarString(ctx, ["vendor", "Vendor"]);
|
|
95
|
-
const product = pickScalarString(ctx, ["product", "Product"]);
|
|
96
|
-
const extras = [];
|
|
97
|
-
const base = baseQuestion?.trim() ?? "";
|
|
98
|
-
for (const t of [cveId, vendor, product]) {
|
|
99
|
-
if (t && (!base || tokenNotInBase(base, t)))
|
|
100
|
-
extras.push(t);
|
|
101
|
-
}
|
|
102
|
-
const suffix = extras.join(" ").trim();
|
|
103
|
-
if (!base && !suffix)
|
|
104
|
-
return undefined;
|
|
105
|
-
if (!suffix)
|
|
106
|
-
return base || undefined;
|
|
107
|
-
if (!base)
|
|
108
|
-
return suffix;
|
|
109
|
-
return `${base} ${suffix}`.trim();
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Normalize `narrix.webScopeQuestions` into `@exellix/narrix-web-scoper` `WebScopeQuestion[]`
|
|
113
|
-
* (stable `id`, trimmed `question`, optional `purpose` from `source`).
|
|
114
|
-
*/
|
|
115
|
-
export function normalizeNarrixWebScopeQuestions(entries) {
|
|
116
|
-
if (!Array.isArray(entries))
|
|
117
|
-
return [];
|
|
118
|
-
const out = [];
|
|
119
|
-
for (const e of entries) {
|
|
120
|
-
if (!e || typeof e !== "object")
|
|
121
|
-
continue;
|
|
122
|
-
const q = typeof e.question === "string" ? e.question.trim() : "";
|
|
123
|
-
if (!q)
|
|
124
|
-
continue;
|
|
125
|
-
const id = typeof e.id === "string" && e.id.trim()
|
|
126
|
-
? e.id.trim()
|
|
127
|
-
: randomUUID();
|
|
128
|
-
const purpose = e.source === "manual" || e.source === "ai-driven"
|
|
129
|
-
? `source:${e.source}`
|
|
130
|
-
: undefined;
|
|
131
|
-
out.push({ id, question: q, ...(purpose ? { purpose } : {}) });
|
|
132
|
-
}
|
|
133
|
-
return out;
|
|
134
|
-
}
|
|
135
|
-
/**
|
|
136
|
-
* Resolves ScopeInput fields for web scoping: optional athenix templates + objects, or enriched question (Handlebars or default append).
|
|
137
|
-
*/
|
|
138
|
-
export function resolveWebScopeQuestionAndTemplates(args) {
|
|
139
|
-
const { narrix, requestInput, successResult, entity } = args;
|
|
140
|
-
const baseQuestion = typeof requestInput === "string"
|
|
141
|
-
? requestInput.trim() || undefined
|
|
142
|
-
: requestInput && typeof requestInput === "object" && typeof requestInput.question === "string"
|
|
143
|
-
? requestInput.question.trim() || undefined
|
|
144
|
-
: undefined;
|
|
145
|
-
const cni = successResult.cni;
|
|
146
|
-
const autoContext = buildWebScopeTemplateContext({
|
|
147
|
-
cni,
|
|
148
|
-
entity,
|
|
149
|
-
baseQuestion,
|
|
150
|
-
entityKey: successResult.entity.entityKey,
|
|
151
|
-
});
|
|
152
|
-
const templates = narrix.webScopeTemplates?.filter((t) => typeof t === "string" && t.trim());
|
|
153
|
-
if (templates?.length) {
|
|
154
|
-
const webScopeObjects = {
|
|
155
|
-
...autoContext,
|
|
156
|
-
...(narrix.webScopeObjects ?? {}),
|
|
157
|
-
};
|
|
158
|
-
return {
|
|
159
|
-
webScopeTemplates: templates.map((t) => t.trim()),
|
|
160
|
-
webScopeObjects,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
const packQuestions = normalizeNarrixWebScopeQuestions(narrix.webScopeQuestions);
|
|
164
|
-
if (packQuestions.length > 0) {
|
|
165
|
-
return { packQuestions };
|
|
166
|
-
}
|
|
167
|
-
const mergedForHandlebars = {
|
|
168
|
-
...autoContext,
|
|
169
|
-
...(narrix.webScopeObjects ?? {}),
|
|
170
|
-
input: requestInput ?? {},
|
|
171
|
-
};
|
|
172
|
-
const hbTpl = narrix.webScopeQuestionTemplate?.trim();
|
|
173
|
-
if (hbTpl) {
|
|
174
|
-
try {
|
|
175
|
-
const compiled = Handlebars.compile(hbTpl);
|
|
176
|
-
const rendered = compiled(mergedForHandlebars).trim().replace(/\s+/g, " ");
|
|
177
|
-
if (rendered) {
|
|
178
|
-
return { question: rendered };
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
catch {
|
|
182
|
-
// fall through to default enrichment
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
const ctxForDefault = mergedForHandlebars;
|
|
186
|
-
const enriched = defaultEnrichQuestion(baseQuestion, ctxForDefault);
|
|
187
|
-
const finalQ = enriched ?? baseQuestion;
|
|
188
|
-
if (finalQ !== undefined && finalQ !== "") {
|
|
189
|
-
return { question: finalQ };
|
|
190
|
-
}
|
|
191
|
-
return {};
|
|
192
|
-
}
|
|
193
|
-
//# sourceMappingURL=buildWebScopeScopeInput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildWebScopeScopeInput.js","sourceRoot":"","sources":["../../src/narrix/buildWebScopeScopeInput.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AAOpC,SAAS,QAAQ,CAAC,CAAU;IAC1B,OAAO,CAAC,KAAK,IAAI,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED,SAAS,YAAY,CAAC,MAA2C,EAAE,IAAc;IAC/E,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC;IAC3B,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACnC,IAAI,GAAG,GAAY,CAAC,CAAC;IACrB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,OAAO,SAAS,CAAC;QACrC,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,gBAAgB,CAAC,GAA4B,EAAE,IAAc;IACpE,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACjB,IAAI,OAAO,CAAC,KAAK,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AK,EAAE,EAAE,CAAC;QAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { NarrixWebScoper, WebScoperConfig, WebScoperResult, ScopeInput, WebScopePackInput, WebScopePackResult } from "@exellix/narrix-web-scoper";
|
|
2
|
-
/** Returns (and lazily creates) the shared NarrixWebScoper instance (default @exellix/narrix-web-scoper config). */
|
|
3
|
-
export declare function getWebScoper(): NarrixWebScoper;
|
|
4
|
-
/** Reset singletons (test helper). */
|
|
5
|
-
export declare function resetWebScoperSingleton(): void;
|
|
6
|
-
/** Override singleton with a mock (test helper). */
|
|
7
|
-
export declare function setWebScoperForTesting(mock: NarrixWebScoper): void;
|
|
8
|
-
export type RunWebScopeOptions = {
|
|
9
|
-
/** Per-request slice of @exellix/narrix-web-scoper `WebScoperConfig.scoping` (snippets, caps, raw content). */
|
|
10
|
-
scoping?: WebScoperConfig["scoping"];
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Map `scopeQuestionPack` output to the legacy `WebScoperResult` shape stored in `executionMemory.webContext`
|
|
14
|
-
* so `buildWebContextEvidenceMarkdown` and synthesis paths stay compatible.
|
|
15
|
-
*/
|
|
16
|
-
export declare function mapWebScopePackResultToWebScoperResult(pack: WebScopePackResult): WebScoperResult;
|
|
17
|
-
/**
|
|
18
|
-
* Optional fields merged into {@link ScopeInput} so `@exellix/narrix-web-scoper` Activix wrapping
|
|
19
|
-
* (`extractRunIds`) can correlate web-scope activities with the surrounding task run.
|
|
20
|
-
*
|
|
21
|
-
* Matches task-sdk `runContext.sessionId` when `sessionId` is set to the same value as `taskId`.
|
|
22
|
-
*/
|
|
23
|
-
export type WebScopeActivixCorrelationFields = {
|
|
24
|
-
jobId?: string;
|
|
25
|
-
taskId?: string;
|
|
26
|
-
sessionId?: string;
|
|
27
|
-
};
|
|
28
|
-
/** Non-empty trimmed strings only; omits unset/blank ids. */
|
|
29
|
-
export declare function webScopeActivixCorrelationPatch(parts: {
|
|
30
|
-
jobId?: string | null | undefined;
|
|
31
|
-
taskId?: string | null | undefined;
|
|
32
|
-
sessionId?: string | null | undefined;
|
|
33
|
-
}): WebScopeActivixCorrelationFields;
|
|
34
|
-
/**
|
|
35
|
-
* Run scopeGeneric and return the result. On any thrown error, returns an available:false result
|
|
36
|
-
* so callers can apply lenient fallback without try/catch boilerplate.
|
|
37
|
-
*/
|
|
38
|
-
export declare function runWebScope(input: ScopeInput, options?: RunWebScopeOptions): Promise<WebScoperResult>;
|
|
39
|
-
/**
|
|
40
|
-
* Run `scopeQuestionPack` and normalize to {@link WebScoperResult} for `executionMemory.webContext`.
|
|
41
|
-
*/
|
|
42
|
-
export declare function runWebScopeQuestionPack(input: WebScopePackInput, options?: RunWebScopeOptions): Promise<WebScoperResult>;
|
|
43
|
-
//# sourceMappingURL=webScoper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"webScoper.d.ts","sourceRoot":"","sources":["../../src/narrix/webScoper.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,eAAe,EACf,UAAU,EAEV,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,4BAA4B,CAAC;AAkBpC,oHAAoH;AACpH,wBAAgB,YAAY,IAAI,eAAe,CAM9C;AAED,sCAAsC;AACtC,wBAAgB,uBAAuB,IAAI,IAAI,CAI9C;AAED,oDAAoD;AACpD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAElE;AAmBD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,+GAA+G;IAC/G,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAQF;;;GAGG;AACH,wBAAgB,sCAAsC,CAAC,IAAI,EAAE,kBAAkB,GAAG,eAAe,CAyChG;AAED;;;;;GAKG;AACH,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