@exellix/ai-tasks 7.8.0
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/.env.example +3 -0
- package/.metadata/instructions-builders/create-expected-output-instructions.md +195 -0
- package/.metadata/readme.md +48 -0
- package/.metadata/shared/audit.md +29 -0
- package/.metadata/skills/professional-answer +32 -0
- package/.metadata/skills/professional-answer.compressed.md +11 -0
- package/.metadata/skills/professional-answer.instructions +33 -0
- package/.metadata/skills/professional-answer.instructions.md +33 -0
- package/.metadata/skills/professional-answer.l2.md +28 -0
- package/.metadata/skills/professional-answer.md +32 -0
- package/.metadata/skills/professional-answer.prompt +1 -0
- package/.metadata/skills/professional-answer.prompt.md +1 -0
- package/.metadata/skills/professional-decision.md +26 -0
- package/BREAKING-CHANGES.md +43 -0
- package/CHANGELOG.md +147 -0
- package/README.md +2497 -0
- package/RUNTASK_REQUEST.md +369 -0
- package/dist/activix/activixClient.d.ts +6 -0
- package/dist/activix/activixClient.d.ts.map +1 -0
- package/dist/activix/activixClient.js +131 -0
- package/dist/activix/activixClient.js.map +1 -0
- package/dist/activix/getTaskActivities.d.ts +10 -0
- package/dist/activix/getTaskActivities.d.ts.map +1 -0
- package/dist/activix/getTaskActivities.js +17 -0
- package/dist/activix/getTaskActivities.js.map +1 -0
- package/dist/activix/phaseTracking.d.ts +17 -0
- package/dist/activix/phaseTracking.d.ts.map +1 -0
- package/dist/activix/phaseTracking.js +85 -0
- package/dist/activix/phaseTracking.js.map +1 -0
- package/dist/aiScoping/index.d.ts +6 -0
- package/dist/aiScoping/index.d.ts.map +1 -0
- package/dist/aiScoping/index.js +4 -0
- package/dist/aiScoping/index.js.map +1 -0
- package/dist/aiScoping/runAiScoping.d.ts +36 -0
- package/dist/aiScoping/runAiScoping.d.ts.map +1 -0
- package/dist/aiScoping/runAiScoping.js +100 -0
- package/dist/aiScoping/runAiScoping.js.map +1 -0
- package/dist/aiScoping/runScopingCall.d.ts +23 -0
- package/dist/aiScoping/runScopingCall.d.ts.map +1 -0
- package/dist/aiScoping/runScopingCall.js +50 -0
- package/dist/aiScoping/runScopingCall.js.map +1 -0
- package/dist/aiScoping/validateAiScoping.d.ts +7 -0
- package/dist/aiScoping/validateAiScoping.d.ts.map +1 -0
- package/dist/aiScoping/validateAiScoping.js +33 -0
- package/dist/aiScoping/validateAiScoping.js.map +1 -0
- package/dist/aiSkillsUpstreamExports.d.ts +13 -0
- package/dist/aiSkillsUpstreamExports.d.ts.map +1 -0
- package/dist/aiSkillsUpstreamExports.js +12 -0
- package/dist/aiSkillsUpstreamExports.js.map +1 -0
- package/dist/analysis/analyzeRunTaskRequest.d.ts +29 -0
- package/dist/analysis/analyzeRunTaskRequest.d.ts.map +1 -0
- package/dist/analysis/analyzeRunTaskRequest.js +85 -0
- package/dist/analysis/analyzeRunTaskRequest.js.map +1 -0
- package/dist/analysis/index.d.ts +3 -0
- package/dist/analysis/index.d.ts.map +1 -0
- package/dist/analysis/index.js +2 -0
- package/dist/analysis/index.js.map +1 -0
- package/dist/builders/task-request-builder.d.ts +310 -0
- package/dist/builders/task-request-builder.d.ts.map +1 -0
- package/dist/builders/task-request-builder.js +581 -0
- package/dist/builders/task-request-builder.js.map +1 -0
- package/dist/compile/compileTaskConfiguration.d.ts +15 -0
- package/dist/compile/compileTaskConfiguration.d.ts.map +1 -0
- package/dist/compile/compileTaskConfiguration.js +184 -0
- package/dist/compile/compileTaskConfiguration.js.map +1 -0
- package/dist/compile/index.d.ts +2 -0
- package/dist/compile/index.d.ts.map +1 -0
- package/dist/compile/index.js +2 -0
- package/dist/compile/index.js.map +1 -0
- package/dist/core/task-sdk.d.ts +36 -0
- package/dist/core/task-sdk.d.ts.map +1 -0
- package/dist/core/task-sdk.js +2432 -0
- package/dist/core/task-sdk.js.map +1 -0
- package/dist/errors/smartInputValidationError.d.ts +39 -0
- package/dist/errors/smartInputValidationError.d.ts.map +1 -0
- package/dist/errors/smartInputValidationError.js +97 -0
- package/dist/errors/smartInputValidationError.js.map +1 -0
- package/dist/errors/taskConfigurationCompileError.d.ts +16 -0
- package/dist/errors/taskConfigurationCompileError.d.ts.map +1 -0
- package/dist/errors/taskConfigurationCompileError.js +20 -0
- package/dist/errors/taskConfigurationCompileError.js.map +1 -0
- package/dist/execution-strategies/applyExecutionStrategyOutputs.d.ts +17 -0
- package/dist/execution-strategies/applyExecutionStrategyOutputs.d.ts.map +1 -0
- package/dist/execution-strategies/applyExecutionStrategyOutputs.js +63 -0
- package/dist/execution-strategies/applyExecutionStrategyOutputs.js.map +1 -0
- package/dist/execution-strategies/constants.d.ts +14 -0
- package/dist/execution-strategies/constants.d.ts.map +1 -0
- package/dist/execution-strategies/constants.js +13 -0
- package/dist/execution-strategies/constants.js.map +1 -0
- package/dist/execution-strategies/executionStrategyCatalogMetadata.d.ts +9 -0
- package/dist/execution-strategies/executionStrategyCatalogMetadata.d.ts.map +1 -0
- package/dist/execution-strategies/executionStrategyCatalogMetadata.js +37 -0
- package/dist/execution-strategies/executionStrategyCatalogMetadata.js.map +1 -0
- package/dist/execution-strategies/genericExecutionFuncxEnvelope.d.ts +94 -0
- package/dist/execution-strategies/genericExecutionFuncxEnvelope.d.ts.map +1 -0
- package/dist/execution-strategies/genericExecutionFuncxEnvelope.js +306 -0
- package/dist/execution-strategies/genericExecutionFuncxEnvelope.js.map +1 -0
- package/dist/execution-strategies/resolveExecutionStrategies.d.ts +14 -0
- package/dist/execution-strategies/resolveExecutionStrategies.d.ts.map +1 -0
- package/dist/execution-strategies/resolveExecutionStrategies.js +108 -0
- package/dist/execution-strategies/resolveExecutionStrategies.js.map +1 -0
- package/dist/execution-strategies/runFuncxExecutionStrategy.d.ts +37 -0
- package/dist/execution-strategies/runFuncxExecutionStrategy.d.ts.map +1 -0
- package/dist/execution-strategies/runFuncxExecutionStrategy.js +72 -0
- package/dist/execution-strategies/runFuncxExecutionStrategy.js.map +1 -0
- package/dist/index.d.ts +99 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/resolveLlmCallForXynthesis.d.ts +52 -0
- package/dist/internal/resolveLlmCallForXynthesis.d.ts.map +1 -0
- package/dist/internal/resolveLlmCallForXynthesis.js +81 -0
- package/dist/internal/resolveLlmCallForXynthesis.js.map +1 -0
- package/dist/internal/resolveRunTaskRuntimeKnobs.d.ts +19 -0
- package/dist/internal/resolveRunTaskRuntimeKnobs.d.ts.map +1 -0
- package/dist/internal/resolveRunTaskRuntimeKnobs.js +52 -0
- package/dist/internal/resolveRunTaskRuntimeKnobs.js.map +1 -0
- package/dist/internal/runPostStepLlmCall.d.ts +52 -0
- package/dist/internal/runPostStepLlmCall.d.ts.map +1 -0
- package/dist/internal/runPostStepLlmCall.js +170 -0
- package/dist/internal/runPostStepLlmCall.js.map +1 -0
- package/dist/localTasks/collectEvidence.d.ts +3 -0
- package/dist/localTasks/collectEvidence.d.ts.map +1 -0
- package/dist/localTasks/collectEvidence.js +364 -0
- package/dist/localTasks/collectEvidence.js.map +1 -0
- package/dist/localTasks/decideWebScope.d.ts +3 -0
- package/dist/localTasks/decideWebScope.d.ts.map +1 -0
- package/dist/localTasks/decideWebScope.js +56 -0
- package/dist/localTasks/decideWebScope.js.map +1 -0
- package/dist/localTasks/index.d.ts +5 -0
- package/dist/localTasks/index.d.ts.map +1 -0
- package/dist/localTasks/index.js +19 -0
- package/dist/localTasks/index.js.map +1 -0
- package/dist/localTasks/narrixAssetPlayground.d.ts +13 -0
- package/dist/localTasks/narrixAssetPlayground.d.ts.map +1 -0
- package/dist/localTasks/narrixAssetPlayground.js +161 -0
- package/dist/localTasks/narrixAssetPlayground.js.map +1 -0
- package/dist/localTasks/narrixSubnetPlayground.d.ts +14 -0
- package/dist/localTasks/narrixSubnetPlayground.d.ts.map +1 -0
- package/dist/localTasks/narrixSubnetPlayground.js +168 -0
- package/dist/localTasks/narrixSubnetPlayground.js.map +1 -0
- package/dist/localTasks/narrixVulnGroupPlayground.d.ts +13 -0
- package/dist/localTasks/narrixVulnGroupPlayground.d.ts.map +1 -0
- package/dist/localTasks/narrixVulnGroupPlayground.js +161 -0
- package/dist/localTasks/narrixVulnGroupPlayground.js.map +1 -0
- package/dist/localTasks/narrixVulnInstancePlayground.d.ts +13 -0
- package/dist/localTasks/narrixVulnInstancePlayground.d.ts.map +1 -0
- package/dist/localTasks/narrixVulnInstancePlayground.js +165 -0
- package/dist/localTasks/narrixVulnInstancePlayground.js.map +1 -0
- package/dist/localTasks/nodeCallExport.d.ts +6 -0
- package/dist/localTasks/nodeCallExport.d.ts.map +1 -0
- package/dist/localTasks/nodeCallExport.js +99 -0
- package/dist/localTasks/nodeCallExport.js.map +1 -0
- package/dist/localTasks/nodeCallExportBatch.d.ts +3 -0
- package/dist/localTasks/nodeCallExportBatch.d.ts.map +1 -0
- package/dist/localTasks/nodeCallExportBatch.js +52 -0
- package/dist/localTasks/nodeCallExportBatch.js.map +1 -0
- package/dist/localTasks/normalizeNarrixResult.d.ts +3 -0
- package/dist/localTasks/normalizeNarrixResult.d.ts.map +1 -0
- package/dist/localTasks/normalizeNarrixResult.js +106 -0
- package/dist/localTasks/normalizeNarrixResult.js.map +1 -0
- package/dist/localTasks/registry.d.ts +4 -0
- package/dist/localTasks/registry.d.ts.map +1 -0
- package/dist/localTasks/registry.js +8 -0
- package/dist/localTasks/registry.js.map +1 -0
- package/dist/localTasks/types.d.ts +28 -0
- package/dist/localTasks/types.d.ts.map +1 -0
- package/dist/localTasks/types.js +2 -0
- package/dist/localTasks/types.js.map +1 -0
- package/dist/localTasks/validateInput.d.ts +3 -0
- package/dist/localTasks/validateInput.d.ts.map +1 -0
- package/dist/localTasks/validateInput.js +66 -0
- package/dist/localTasks/validateInput.js.map +1 -0
- package/dist/methods/convenience-methods.d.ts +45 -0
- package/dist/methods/convenience-methods.d.ts.map +1 -0
- package/dist/methods/convenience-methods.js +39 -0
- package/dist/methods/convenience-methods.js.map +1 -0
- package/dist/narrix/applyNarrixScope.d.ts +10 -0
- package/dist/narrix/applyNarrixScope.d.ts.map +1 -0
- package/dist/narrix/applyNarrixScope.js +69 -0
- package/dist/narrix/applyNarrixScope.js.map +1 -0
- package/dist/narrix/buildNarrixAttachment.d.ts +9 -0
- package/dist/narrix/buildNarrixAttachment.d.ts.map +1 -0
- package/dist/narrix/buildNarrixAttachment.js +29 -0
- package/dist/narrix/buildNarrixAttachment.js.map +1 -0
- package/dist/narrix/buildWebScopeScopeInput.d.ts +39 -0
- package/dist/narrix/buildWebScopeScopeInput.d.ts.map +1 -0
- package/dist/narrix/buildWebScopeScopeInput.js +193 -0
- package/dist/narrix/buildWebScopeScopeInput.js.map +1 -0
- package/dist/narrix/flags.d.ts +4 -0
- package/dist/narrix/flags.d.ts.map +1 -0
- package/dist/narrix/flags.js +4 -0
- package/dist/narrix/flags.js.map +1 -0
- package/dist/narrix/index.d.ts +11 -0
- package/dist/narrix/index.d.ts.map +1 -0
- package/dist/narrix/index.js +14 -0
- package/dist/narrix/index.js.map +1 -0
- package/dist/narrix/narrixClient.d.ts +9 -0
- package/dist/narrix/narrixClient.d.ts.map +1 -0
- package/dist/narrix/narrixClient.js +46 -0
- package/dist/narrix/narrixClient.js.map +1 -0
- package/dist/narrix/narrixContextMarkdown.d.ts +15 -0
- package/dist/narrix/narrixContextMarkdown.d.ts.map +1 -0
- package/dist/narrix/narrixContextMarkdown.js +98 -0
- package/dist/narrix/narrixContextMarkdown.js.map +1 -0
- package/dist/narrix/narrixRunnerModule.d.ts +11 -0
- package/dist/narrix/narrixRunnerModule.d.ts.map +1 -0
- package/dist/narrix/narrixRunnerModule.js +17 -0
- package/dist/narrix/narrixRunnerModule.js.map +1 -0
- package/dist/narrix/runNarrixForChat.d.ts +3 -0
- package/dist/narrix/runNarrixForChat.d.ts.map +1 -0
- package/dist/narrix/runNarrixForChat.js +51 -0
- package/dist/narrix/runNarrixForChat.js.map +1 -0
- package/dist/narrix/runNarrixForDocs.d.ts +3 -0
- package/dist/narrix/runNarrixForDocs.d.ts.map +1 -0
- package/dist/narrix/runNarrixForDocs.js +50 -0
- package/dist/narrix/runNarrixForDocs.js.map +1 -0
- package/dist/narrix/runNarrixForRecord.d.ts +3 -0
- package/dist/narrix/runNarrixForRecord.d.ts.map +1 -0
- package/dist/narrix/runNarrixForRecord.js +47 -0
- package/dist/narrix/runNarrixForRecord.js.map +1 -0
- package/dist/narrix/runNarrixForText.d.ts +3 -0
- package/dist/narrix/runNarrixForText.d.ts.map +1 -0
- package/dist/narrix/runNarrixForText.js +49 -0
- package/dist/narrix/runNarrixForText.js.map +1 -0
- package/dist/narrix/runnerDispatch.d.ts +12 -0
- package/dist/narrix/runnerDispatch.d.ts.map +1 -0
- package/dist/narrix/runnerDispatch.js +19 -0
- package/dist/narrix/runnerDispatch.js.map +1 -0
- package/dist/narrix/seedBundleRouting.d.ts +15 -0
- package/dist/narrix/seedBundleRouting.d.ts.map +1 -0
- package/dist/narrix/seedBundleRouting.js +46 -0
- package/dist/narrix/seedBundleRouting.js.map +1 -0
- package/dist/narrix/task.d.ts +4 -0
- package/dist/narrix/task.d.ts.map +1 -0
- package/dist/narrix/task.js +143 -0
- package/dist/narrix/task.js.map +1 -0
- package/dist/narrix/types.d.ts +104 -0
- package/dist/narrix/types.d.ts.map +1 -0
- package/dist/narrix/types.js +3 -0
- package/dist/narrix/types.js.map +1 -0
- package/dist/narrix/webContextMarkdown.d.ts +54 -0
- package/dist/narrix/webContextMarkdown.d.ts.map +1 -0
- package/dist/narrix/webContextMarkdown.js +206 -0
- package/dist/narrix/webContextMarkdown.js.map +1 -0
- package/dist/narrix/webScoper.d.ts +43 -0
- package/dist/narrix/webScoper.d.ts.map +1 -0
- package/dist/narrix/webScoper.js +144 -0
- package/dist/narrix/webScoper.js.map +1 -0
- package/dist/observability/debugTrace.d.ts +31 -0
- package/dist/observability/debugTrace.d.ts.map +1 -0
- package/dist/observability/debugTrace.js +117 -0
- package/dist/observability/debugTrace.js.map +1 -0
- package/dist/observability/extractAiTasksObservability.d.ts +7 -0
- package/dist/observability/extractAiTasksObservability.d.ts.map +1 -0
- package/dist/observability/extractAiTasksObservability.js +98 -0
- package/dist/observability/extractAiTasksObservability.js.map +1 -0
- package/dist/observability/graphExecutionRunLogContract.d.ts +19 -0
- package/dist/observability/graphExecutionRunLogContract.d.ts.map +1 -0
- package/dist/observability/graphExecutionRunLogContract.js +11 -0
- package/dist/observability/graphExecutionRunLogContract.js.map +1 -0
- package/dist/packaged-tasks-client.d.ts +66 -0
- package/dist/packaged-tasks-client.d.ts.map +1 -0
- package/dist/packaged-tasks-client.js +100 -0
- package/dist/packaged-tasks-client.js.map +1 -0
- package/dist/planWebScopeQuestions/index.d.ts +78 -0
- package/dist/planWebScopeQuestions/index.d.ts.map +1 -0
- package/dist/planWebScopeQuestions/index.js +282 -0
- package/dist/planWebScopeQuestions/index.js.map +1 -0
- package/dist/planWebScopeQuestions/runResearchPlanQuestionsFuncx.d.ts +18 -0
- package/dist/planWebScopeQuestions/runResearchPlanQuestionsFuncx.d.ts.map +1 -0
- package/dist/planWebScopeQuestions/runResearchPlanQuestionsFuncx.js +42 -0
- package/dist/planWebScopeQuestions/runResearchPlanQuestionsFuncx.js.map +1 -0
- package/dist/post-steps/audit/loadAuditTemplates.d.ts +72 -0
- package/dist/post-steps/audit/loadAuditTemplates.d.ts.map +1 -0
- package/dist/post-steps/audit/loadAuditTemplates.js +62 -0
- package/dist/post-steps/audit/loadAuditTemplates.js.map +1 -0
- package/dist/post-steps/audit/parseAuditOutput.d.ts +11 -0
- package/dist/post-steps/audit/parseAuditOutput.d.ts.map +1 -0
- package/dist/post-steps/audit/parseAuditOutput.js +50 -0
- package/dist/post-steps/audit/parseAuditOutput.js.map +1 -0
- package/dist/post-steps/audit/runAudit.d.ts +22 -0
- package/dist/post-steps/audit/runAudit.d.ts.map +1 -0
- package/dist/post-steps/audit/runAudit.js +406 -0
- package/dist/post-steps/audit/runAudit.js.map +1 -0
- package/dist/post-steps/audit/runAuditCall.d.ts +23 -0
- package/dist/post-steps/audit/runAuditCall.d.ts.map +1 -0
- package/dist/post-steps/audit/runAuditCall.js +32 -0
- package/dist/post-steps/audit/runAuditCall.js.map +1 -0
- package/dist/post-steps/polish/loadPolishTemplates.d.ts +35 -0
- package/dist/post-steps/polish/loadPolishTemplates.d.ts.map +1 -0
- package/dist/post-steps/polish/loadPolishTemplates.js +38 -0
- package/dist/post-steps/polish/loadPolishTemplates.js.map +1 -0
- package/dist/post-steps/polish/parsePolishOutput.d.ts +6 -0
- package/dist/post-steps/polish/parsePolishOutput.d.ts.map +1 -0
- package/dist/post-steps/polish/parsePolishOutput.js +47 -0
- package/dist/post-steps/polish/parsePolishOutput.js.map +1 -0
- package/dist/post-steps/polish/runPolish.d.ts +24 -0
- package/dist/post-steps/polish/runPolish.d.ts.map +1 -0
- package/dist/post-steps/polish/runPolish.js +147 -0
- package/dist/post-steps/polish/runPolish.js.map +1 -0
- package/dist/post-steps/polish/runPolishCall.d.ts +22 -0
- package/dist/post-steps/polish/runPolishCall.d.ts.map +1 -0
- package/dist/post-steps/polish/runPolishCall.js +32 -0
- package/dist/post-steps/polish/runPolishCall.js.map +1 -0
- package/dist/post-steps/resolvePostStepConfig.d.ts +58 -0
- package/dist/post-steps/resolvePostStepConfig.d.ts.map +1 -0
- package/dist/post-steps/resolvePostStepConfig.js +105 -0
- package/dist/post-steps/resolvePostStepConfig.js.map +1 -0
- package/dist/rendrixUpstreamExports.d.ts +7 -0
- package/dist/rendrixUpstreamExports.d.ts.map +1 -0
- package/dist/rendrixUpstreamExports.js +6 -0
- package/dist/rendrixUpstreamExports.js.map +1 -0
- package/dist/skillCatalogExports.d.ts +8 -0
- package/dist/skillCatalogExports.d.ts.map +1 -0
- package/dist/skillCatalogExports.js +8 -0
- package/dist/skillCatalogExports.js.map +1 -0
- package/dist/strategies/direct-execution-strategy.d.ts +31 -0
- package/dist/strategies/direct-execution-strategy.d.ts.map +1 -0
- package/dist/strategies/direct-execution-strategy.js +107 -0
- package/dist/strategies/direct-execution-strategy.js.map +1 -0
- package/dist/strategies/execution-strategy.interface.d.ts +31 -0
- package/dist/strategies/execution-strategy.interface.d.ts.map +1 -0
- package/dist/strategies/execution-strategy.interface.js +2 -0
- package/dist/strategies/execution-strategy.interface.js.map +1 -0
- package/dist/strategies/index.d.ts +9 -0
- package/dist/strategies/index.d.ts.map +1 -0
- package/dist/strategies/index.js +8 -0
- package/dist/strategies/index.js.map +1 -0
- package/dist/strategies/strategy-factory.d.ts +45 -0
- package/dist/strategies/strategy-factory.d.ts.map +1 -0
- package/dist/strategies/strategy-factory.js +59 -0
- package/dist/strategies/strategy-factory.js.map +1 -0
- package/dist/synthesis/index.d.ts +9 -0
- package/dist/synthesis/index.d.ts.map +1 -0
- package/dist/synthesis/index.js +8 -0
- package/dist/synthesis/index.js.map +1 -0
- package/dist/synthesis/resolveSourceMaterial.d.ts +35 -0
- package/dist/synthesis/resolveSourceMaterial.d.ts.map +1 -0
- package/dist/synthesis/resolveSourceMaterial.js +152 -0
- package/dist/synthesis/resolveSourceMaterial.js.map +1 -0
- package/dist/synthesis/runStructuredSynthesisRobust.d.ts +42 -0
- package/dist/synthesis/runStructuredSynthesisRobust.d.ts.map +1 -0
- package/dist/synthesis/runStructuredSynthesisRobust.js +303 -0
- package/dist/synthesis/runStructuredSynthesisRobust.js.map +1 -0
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts +19 -0
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts.map +1 -0
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js +242 -0
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js.map +1 -0
- package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts +171 -0
- package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts.map +1 -0
- package/dist/task-strategies/canonicalInputExecutionStrategies.js +117 -0
- package/dist/task-strategies/canonicalInputExecutionStrategies.js.map +1 -0
- package/dist/task-strategies/canonicalNarrixModes.d.ts +31 -0
- package/dist/task-strategies/canonicalNarrixModes.d.ts.map +1 -0
- package/dist/task-strategies/canonicalNarrixModes.js +35 -0
- package/dist/task-strategies/canonicalNarrixModes.js.map +1 -0
- package/dist/task-strategies/canonicalTaskStrategies.d.ts +104 -0
- package/dist/task-strategies/canonicalTaskStrategies.d.ts.map +1 -0
- package/dist/task-strategies/canonicalTaskStrategies.js +77 -0
- package/dist/task-strategies/canonicalTaskStrategies.js.map +1 -0
- package/dist/task-strategies/cataloxCatalogViews.d.ts +55 -0
- package/dist/task-strategies/cataloxCatalogViews.d.ts.map +1 -0
- package/dist/task-strategies/cataloxCatalogViews.js +65 -0
- package/dist/task-strategies/cataloxCatalogViews.js.map +1 -0
- package/dist/task-strategies/constants.d.ts +49 -0
- package/dist/task-strategies/constants.d.ts.map +1 -0
- package/dist/task-strategies/constants.js +49 -0
- package/dist/task-strategies/constants.js.map +1 -0
- package/dist/task-strategies/index.d.ts +22 -0
- package/dist/task-strategies/index.d.ts.map +1 -0
- package/dist/task-strategies/index.js +13 -0
- package/dist/task-strategies/index.js.map +1 -0
- package/dist/task-strategies/listAiTaskStrategies.d.ts +43 -0
- package/dist/task-strategies/listAiTaskStrategies.d.ts.map +1 -0
- package/dist/task-strategies/listAiTaskStrategies.js +74 -0
- package/dist/task-strategies/listAiTaskStrategies.js.map +1 -0
- package/dist/task-strategies/normalize.d.ts +7 -0
- package/dist/task-strategies/normalize.d.ts.map +1 -0
- package/dist/task-strategies/normalize.js +44 -0
- package/dist/task-strategies/normalize.js.map +1 -0
- package/dist/task-strategies/types.d.ts +37 -0
- package/dist/task-strategies/types.d.ts.map +1 -0
- package/dist/task-strategies/types.js +2 -0
- package/dist/task-strategies/types.js.map +1 -0
- package/dist/types/decision-contracts.d.ts +31 -0
- package/dist/types/decision-contracts.d.ts.map +1 -0
- package/dist/types/decision-contracts.js +23 -0
- package/dist/types/decision-contracts.js.map +1 -0
- package/dist/types/evidence-types.d.ts +108 -0
- package/dist/types/evidence-types.d.ts.map +1 -0
- package/dist/types/evidence-types.js +9 -0
- package/dist/types/evidence-types.js.map +1 -0
- package/dist/types/executionType.d.ts +9 -0
- package/dist/types/executionType.d.ts.map +1 -0
- package/dist/types/executionType.js +8 -0
- package/dist/types/executionType.js.map +1 -0
- package/dist/types/index.d.ts +28 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +12 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/llmCall.d.ts +121 -0
- package/dist/types/llmCall.d.ts.map +1 -0
- package/dist/types/llmCall.js +39 -0
- package/dist/types/llmCall.js.map +1 -0
- package/dist/types/task-configuration.d.ts +60 -0
- package/dist/types/task-configuration.d.ts.map +1 -0
- package/dist/types/task-configuration.js +3 -0
- package/dist/types/task-configuration.js.map +1 -0
- package/dist/types/task-types.d.ts +887 -0
- package/dist/types/task-types.d.ts.map +1 -0
- package/dist/types/task-types.js +21 -0
- package/dist/types/task-types.js.map +1 -0
- package/dist/utilities/runUtility.d.ts +3 -0
- package/dist/utilities/runUtility.d.ts.map +1 -0
- package/dist/utilities/runUtility.js +204 -0
- package/dist/utilities/runUtility.js.map +1 -0
- package/dist/utils/assertRequiredRunSkillCorrelation.d.ts +7 -0
- package/dist/utils/assertRequiredRunSkillCorrelation.d.ts.map +1 -0
- package/dist/utils/assertRequiredRunSkillCorrelation.js +17 -0
- package/dist/utils/assertRequiredRunSkillCorrelation.js.map +1 -0
- package/dist/utils/assertValidSmartInputConfig.d.ts +5 -0
- package/dist/utils/assertValidSmartInputConfig.d.ts.map +1 -0
- package/dist/utils/assertValidSmartInputConfig.js +71 -0
- package/dist/utils/assertValidSmartInputConfig.js.map +1 -0
- package/dist/utils/bridgeRunSkillGatewayMemory.d.ts +13 -0
- package/dist/utils/bridgeRunSkillGatewayMemory.d.ts.map +1 -0
- package/dist/utils/bridgeRunSkillGatewayMemory.js +65 -0
- package/dist/utils/bridgeRunSkillGatewayMemory.js.map +1 -0
- package/dist/utils/extractSmartInputRenderResult.d.ts +7 -0
- package/dist/utils/extractSmartInputRenderResult.d.ts.map +1 -0
- package/dist/utils/extractSmartInputRenderResult.js +30 -0
- package/dist/utils/extractSmartInputRenderResult.js.map +1 -0
- package/dist/utils/jsonPaths.d.ts +6 -0
- package/dist/utils/jsonPaths.d.ts.map +1 -0
- package/dist/utils/jsonPaths.js +32 -0
- package/dist/utils/jsonPaths.js.map +1 -0
- package/dist/utils/normalizeSmartInputConfig.d.ts +5 -0
- package/dist/utils/normalizeSmartInputConfig.d.ts.map +1 -0
- package/dist/utils/normalizeSmartInputConfig.js +30 -0
- package/dist/utils/normalizeSmartInputConfig.js.map +1 -0
- package/dist/utils/outputValidation.d.ts +19 -0
- package/dist/utils/outputValidation.d.ts.map +1 -0
- package/dist/utils/outputValidation.js +75 -0
- package/dist/utils/outputValidation.js.map +1 -0
- package/dist/utils/runTaskRequestShape.d.ts +16 -0
- package/dist/utils/runTaskRequestShape.d.ts.map +1 -0
- package/dist/utils/runTaskRequestShape.js +80 -0
- package/dist/utils/runTaskRequestShape.js.map +1 -0
- package/dist/utils/skillTemplateVariables.d.ts +20 -0
- package/dist/utils/skillTemplateVariables.d.ts.map +1 -0
- package/dist/utils/skillTemplateVariables.js +63 -0
- package/dist/utils/skillTemplateVariables.js.map +1 -0
- package/dist/utils/xynthesizedSmartInputPaths.d.ts +16 -0
- package/dist/utils/xynthesizedSmartInputPaths.d.ts.map +1 -0
- package/dist/utils/xynthesizedSmartInputPaths.js +56 -0
- package/dist/utils/xynthesizedSmartInputPaths.js.map +1 -0
- package/dist/utils/xynthesizedWrite.d.ts +10 -0
- package/dist/utils/xynthesizedWrite.d.ts.map +1 -0
- package/dist/utils/xynthesizedWrite.js +61 -0
- package/dist/utils/xynthesizedWrite.js.map +1 -0
- package/dist/validation/analyzeExpectedRunTaskInput.d.ts +41 -0
- package/dist/validation/analyzeExpectedRunTaskInput.d.ts.map +1 -0
- package/dist/validation/analyzeExpectedRunTaskInput.js +133 -0
- package/dist/validation/analyzeExpectedRunTaskInput.js.map +1 -0
- package/dist/validation/collectSmartInputValidationIssues.d.ts +6 -0
- package/dist/validation/collectSmartInputValidationIssues.d.ts.map +1 -0
- package/dist/validation/collectSmartInputValidationIssues.js +38 -0
- package/dist/validation/collectSmartInputValidationIssues.js.map +1 -0
- package/dist/validation/helpers.d.ts +15 -0
- package/dist/validation/helpers.d.ts.map +1 -0
- package/dist/validation/helpers.js +184 -0
- package/dist/validation/helpers.js.map +1 -0
- package/dist/validation/index.d.ts +9 -0
- package/dist/validation/index.d.ts.map +1 -0
- package/dist/validation/index.js +6 -0
- package/dist/validation/index.js.map +1 -0
- package/dist/validation/types.d.ts +51 -0
- package/dist/validation/types.d.ts.map +1 -0
- package/dist/validation/types.js +5 -0
- package/dist/validation/types.js.map +1 -0
- package/dist/validation/validateRunTaskConfig.d.ts +8 -0
- package/dist/validation/validateRunTaskConfig.d.ts.map +1 -0
- package/dist/validation/validateRunTaskConfig.js +158 -0
- package/dist/validation/validateRunTaskConfig.js.map +1 -0
- package/dist/validation/validateRunTaskInvoke.d.ts +30 -0
- package/dist/validation/validateRunTaskInvoke.d.ts.map +1 -0
- package/dist/validation/validateRunTaskInvoke.js +108 -0
- package/dist/validation/validateRunTaskInvoke.js.map +1 -0
- package/documenations/activix-feature-request-identity.md +123 -0
- package/documenations/activix.md +175 -0
- package/documenations/bug-report-xynthesis-and-synthesis-call.md +217 -0
- package/documenations/core-runtime-tokens-and-strategies.md +123 -0
- package/documenations/downstream-environment.md +48 -0
- package/documenations/downstream-test-runtime-teardown-cleanup.md +73 -0
- package/documenations/examples/xynthesis-run-task-request.example.json +170 -0
- package/documenations/feature-request-ai-skills-raw-template-access.md +82 -0
- package/documenations/feature-request-athenix-core-directive.md +145 -0
- package/documenations/feature-request-athenix-token-extraction.md +124 -0
- package/documenations/funcx-catalog-hosting-checklist.md +107 -0
- package/documenations/funcx-scoping-integration-gaps.md +120 -0
- package/documenations/funcx-upstream-github-issues-draft.md +153 -0
- package/documenations/identity-metadata-contract.md +165 -0
- package/documenations/intermediate-steps.md +33 -0
- package/documenations/record-and-template-variables.md +32 -0
- package/documenations/run-task-execution-flow.md +153 -0
- package/documenations/run-task-single-run-checklist.md +109 -0
- package/documenations/schemas/README.md +40 -0
- package/documenations/schemas/openapi-3.1-components.yaml +24 -0
- package/documenations/schemas/v1/output-schema.json +55 -0
- package/documenations/schemas/v1/output-validation-result.json +41 -0
- package/documenations/schemas/v1/run-task-request.json +219 -0
- package/documenations/schemas/v1/synthesized-artifacts.json +133 -0
- package/documenations/synthesis-invocation-notes.md +26 -0
- package/documenations/synthesized-context-guide.md +84 -0
- package/documenations/task-core-and-core-aware-synthesis.md +58 -0
- package/documenations/upstream-feature-requests/ai-skills-llm-observability.md +129 -0
- package/documenations/upstream-feature-requests/xynthesis-llm-observability.md +125 -0
- package/documenations/upstream-feedback-request-shape-clarification.md +101 -0
- package/documenations/web-context-precedence.md +33 -0
- package/documenations/web-scoping-in-ai-tasks.md +503 -0
- package/documenations/xynthesis-activix-telemetry.md +28 -0
- package/documenations/xynthesis-upstream-fixes-checklist.md +71 -0
- package/package.json +92 -0
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI-driven planning of explicit web-scope questions (Studio → `narrix.webScopeQuestions`).
|
|
3
|
+
* FuncX **`research/plan-questions`** uses the generic envelope (see `runResearchPlanQuestionsViaFuncx`).
|
|
4
|
+
*/
|
|
5
|
+
import { setResearchPlanQuestionsFuncxInvoker } from "./runResearchPlanQuestionsFuncx.js";
|
|
6
|
+
export { setResearchPlanQuestionsFuncxInvoker };
|
|
7
|
+
import type { DebugTraceCollector } from "../observability/debugTrace.js";
|
|
8
|
+
import type { DebugTraceTask } from "../types/task-types.js";
|
|
9
|
+
import type { LlmCallConfig, LlmCallObservation } from "../types/llmCall.js";
|
|
10
|
+
/** Stable machine reason codes for `PlanWebScopeQuestionsOutput.reasonCodes`. */
|
|
11
|
+
export declare const PlanWebScopeQuestionsReasonCode: {
|
|
12
|
+
readonly OUTPUT_INVALID: "OUTPUT_INVALID";
|
|
13
|
+
readonly PARSE_FAILED: "PARSE_FAILED";
|
|
14
|
+
readonly LLM_ERROR: "LLM_ERROR";
|
|
15
|
+
readonly INPUT_TOO_THIN: "INPUT_TOO_THIN";
|
|
16
|
+
};
|
|
17
|
+
export type PlanWebScopeQuestionsReasonCode = (typeof PlanWebScopeQuestionsReasonCode)[keyof typeof PlanWebScopeQuestionsReasonCode];
|
|
18
|
+
export type PlanWebScopeQuestionsMemorySummary = {
|
|
19
|
+
jobMemory?: unknown;
|
|
20
|
+
taskMemory?: unknown;
|
|
21
|
+
executionMemory?: unknown;
|
|
22
|
+
};
|
|
23
|
+
export type PlanWebScopeQuestionsInput = {
|
|
24
|
+
nodeQuestion: string;
|
|
25
|
+
nodeInput?: unknown;
|
|
26
|
+
rawRecord?: unknown;
|
|
27
|
+
memorySummary?: PlanWebScopeQuestionsMemorySummary;
|
|
28
|
+
xynthesized?: {
|
|
29
|
+
job?: unknown;
|
|
30
|
+
task?: unknown;
|
|
31
|
+
};
|
|
32
|
+
maxQuestions: number;
|
|
33
|
+
};
|
|
34
|
+
export type PlanWebScopeQuestionItem = {
|
|
35
|
+
id: string;
|
|
36
|
+
question: string;
|
|
37
|
+
reason: string;
|
|
38
|
+
source: "ai-driven";
|
|
39
|
+
};
|
|
40
|
+
export type PlanWebScopeQuestionsOutput = {
|
|
41
|
+
questions: PlanWebScopeQuestionItem[];
|
|
42
|
+
confidence: number;
|
|
43
|
+
skipped?: boolean;
|
|
44
|
+
reasonCodes?: string[];
|
|
45
|
+
};
|
|
46
|
+
export type ParsePlanWebScopeQuestionsResult = {
|
|
47
|
+
ok: true;
|
|
48
|
+
value: PlanWebScopeQuestionsOutput;
|
|
49
|
+
} | {
|
|
50
|
+
ok: false;
|
|
51
|
+
errors: string[];
|
|
52
|
+
};
|
|
53
|
+
/**
|
|
54
|
+
* Parse and validate model JSON for plan-web-scope-questions. `maxQuestions` is clamped to 1–20 before checking counts.
|
|
55
|
+
*/
|
|
56
|
+
export declare function parseAndValidatePlanWebScopeQuestionsOutput(rawText: string, maxQuestions: number): ParsePlanWebScopeQuestionsResult;
|
|
57
|
+
export declare function buildPlanWebScopeQuestionsUserPrompt(input: PlanWebScopeQuestionsInput): string;
|
|
58
|
+
export type RunPlanWebScopeQuestionsParams = {
|
|
59
|
+
input: PlanWebScopeQuestionsInput;
|
|
60
|
+
/** `xynthesis`: local gateway via `@exellix/xynthesis` (default). `funcx`: `research/plan-questions` generic envelope. */
|
|
61
|
+
backend?: "xynthesis" | "funcx";
|
|
62
|
+
/** Override FuncX function id when `backend` is `funcx` (must use the same generic request shape). */
|
|
63
|
+
funcxFunctionId?: string;
|
|
64
|
+
llmCall?: LlmCallConfig;
|
|
65
|
+
jobId?: string;
|
|
66
|
+
taskId?: string;
|
|
67
|
+
agentId?: string;
|
|
68
|
+
traceCollector?: DebugTraceCollector | null;
|
|
69
|
+
traceTask?: Omit<DebugTraceTask, "metadata"> & {
|
|
70
|
+
metadata?: Record<string, unknown>;
|
|
71
|
+
};
|
|
72
|
+
observationSink?: (obs: LlmCallObservation) => void;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Plans web-scope questions via Xynthesis (default) or FuncX `research/plan-questions`.
|
|
76
|
+
*/
|
|
77
|
+
export declare function runPlanWebScopeQuestions(params: RunPlanWebScopeQuestionsParams): Promise<PlanWebScopeQuestionsOutput>;
|
|
78
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/planWebScopeQuestions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAGL,oCAAoC,EACrC,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,oCAAoC,EAAE,CAAC;AAChD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CA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AAE,CAAA;CAAE,CAAC;AAEpC;;GAEG;AACH,wBAAgB,2CAA2C,CACzD,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB,gCAAgC,CA8FlC;AAkBD,wBAAgB,oCAAoC,CAAC,KAAK,EAAE,0BAA0B,GAAG,MAAM,CAsB9F;AAED,MAAM,MAAM,8BAA8B,GAAG;IAC3C,KAAK,EAAE,0BAA0B,CAAC;IAClC,0HAA0H;IAC1H,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;IAChC,sGAAsG;IACtG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC5C,SAAS,CAAC,EAAE,IAAI,CAAC,cAAc,EAAE,UAAU,CAAC,GAAG;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAC;IACtF,eAAe,CAAC,EAAE,CAAC,GAAG,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACrD,CAAC;AAEF;;GAEG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,8BAA8B,GACrC,OAAO,CAAC,2BAA2B,CAAC,CAqGtC"}
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI-driven planning of explicit web-scope questions (Studio → `narrix.webScopeQuestions`).
|
|
3
|
+
* FuncX **`research/plan-questions`** uses the generic envelope (see `runResearchPlanQuestionsViaFuncx`).
|
|
4
|
+
*/
|
|
5
|
+
import { randomUUID } from "node:crypto";
|
|
6
|
+
import { runPostStepLlmCall } from "../internal/runPostStepLlmCall.js";
|
|
7
|
+
import { adaptFuncxResearchPlanToOutput, runResearchPlanQuestionsViaFuncx, setResearchPlanQuestionsFuncxInvoker, } from "./runResearchPlanQuestionsFuncx.js";
|
|
8
|
+
export { setResearchPlanQuestionsFuncxInvoker };
|
|
9
|
+
/** Stable machine reason codes for `PlanWebScopeQuestionsOutput.reasonCodes`. */
|
|
10
|
+
export const PlanWebScopeQuestionsReasonCode = {
|
|
11
|
+
OUTPUT_INVALID: "OUTPUT_INVALID",
|
|
12
|
+
PARSE_FAILED: "PARSE_FAILED",
|
|
13
|
+
LLM_ERROR: "LLM_ERROR",
|
|
14
|
+
INPUT_TOO_THIN: "INPUT_TOO_THIN",
|
|
15
|
+
};
|
|
16
|
+
const MAX_JSON_SNIPPET = 24_000;
|
|
17
|
+
function clampInt(n, lo, hi) {
|
|
18
|
+
if (!Number.isFinite(n))
|
|
19
|
+
return lo;
|
|
20
|
+
return Math.min(hi, Math.max(lo, Math.floor(n)));
|
|
21
|
+
}
|
|
22
|
+
function jsonSnippet(label, value) {
|
|
23
|
+
try {
|
|
24
|
+
const s = JSON.stringify(value, null, 0);
|
|
25
|
+
if (s.length <= MAX_JSON_SNIPPET)
|
|
26
|
+
return `${label}:\n${s}`;
|
|
27
|
+
return `${label}:\n${s.slice(0, MAX_JSON_SNIPPET)}\n…(truncated)`;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return `${label}:\n<unserializable>`;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function stripJsonFences(s) {
|
|
34
|
+
let t = s.trim();
|
|
35
|
+
if (t.startsWith("```")) {
|
|
36
|
+
t = t.replace(/^```(?:json)?\s*/i, "").replace(/\s*```\s*$/i, "");
|
|
37
|
+
}
|
|
38
|
+
return t.trim();
|
|
39
|
+
}
|
|
40
|
+
function extractJsonObject(raw) {
|
|
41
|
+
const t = stripJsonFences(raw);
|
|
42
|
+
const start = t.indexOf("{");
|
|
43
|
+
const end = t.lastIndexOf("}");
|
|
44
|
+
if (start < 0 || end <= start)
|
|
45
|
+
return null;
|
|
46
|
+
try {
|
|
47
|
+
return JSON.parse(t.slice(start, end + 1));
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
function isRecord(v) {
|
|
54
|
+
return v !== null && typeof v === "object" && !Array.isArray(v);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Parse and validate model JSON for plan-web-scope-questions. `maxQuestions` is clamped to 1–20 before checking counts.
|
|
58
|
+
*/
|
|
59
|
+
export function parseAndValidatePlanWebScopeQuestionsOutput(rawText, maxQuestions) {
|
|
60
|
+
const errors = [];
|
|
61
|
+
const maxQ = clampInt(maxQuestions, 1, 20);
|
|
62
|
+
const parsed = extractJsonObject(rawText);
|
|
63
|
+
if (parsed == null) {
|
|
64
|
+
errors.push("Could not parse JSON object from model output");
|
|
65
|
+
return { ok: false, errors };
|
|
66
|
+
}
|
|
67
|
+
if (!isRecord(parsed)) {
|
|
68
|
+
errors.push("Root must be a JSON object");
|
|
69
|
+
return { ok: false, errors };
|
|
70
|
+
}
|
|
71
|
+
let confidence = 0;
|
|
72
|
+
const confidenceRaw = parsed.confidence;
|
|
73
|
+
if (typeof confidenceRaw !== "number" || !Number.isFinite(confidenceRaw)) {
|
|
74
|
+
errors.push("confidence must be a finite number");
|
|
75
|
+
}
|
|
76
|
+
else if (confidenceRaw < 0 || confidenceRaw > 1) {
|
|
77
|
+
errors.push("confidence must be between 0 and 1 inclusive");
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
confidence = confidenceRaw;
|
|
81
|
+
}
|
|
82
|
+
const questionsRaw = parsed.questions;
|
|
83
|
+
let questionsIn = [];
|
|
84
|
+
if (!Array.isArray(questionsRaw)) {
|
|
85
|
+
errors.push("questions must be an array");
|
|
86
|
+
}
|
|
87
|
+
else if (questionsRaw.length > maxQ) {
|
|
88
|
+
errors.push(`questions length ${questionsRaw.length} exceeds maxQuestions (${maxQ})`);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
questionsIn = questionsRaw;
|
|
92
|
+
for (let i = 0; i < questionsRaw.length; i++) {
|
|
93
|
+
const q = questionsRaw[i];
|
|
94
|
+
if (!isRecord(q)) {
|
|
95
|
+
errors.push(`questions[${i}] must be an object`);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (typeof q.question !== "string" || !q.question.trim()) {
|
|
99
|
+
errors.push(`questions[${i}].question must be a non-empty string`);
|
|
100
|
+
}
|
|
101
|
+
if (typeof q.reason !== "string" || !q.reason.trim()) {
|
|
102
|
+
errors.push(`questions[${i}].reason must be a non-empty string`);
|
|
103
|
+
}
|
|
104
|
+
if (q.source !== undefined && q.source !== "ai-driven") {
|
|
105
|
+
errors.push(`questions[${i}].source must be "ai-driven" when set`);
|
|
106
|
+
}
|
|
107
|
+
if (q.id !== undefined && typeof q.id !== "string") {
|
|
108
|
+
errors.push(`questions[${i}].id must be a string when set`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const skipped = parsed.skipped === true;
|
|
113
|
+
const reasonCodesRaw = parsed.reasonCodes;
|
|
114
|
+
if (reasonCodesRaw !== undefined && !Array.isArray(reasonCodesRaw)) {
|
|
115
|
+
errors.push("reasonCodes must be an array of strings when set");
|
|
116
|
+
}
|
|
117
|
+
else if (Array.isArray(reasonCodesRaw)) {
|
|
118
|
+
for (let i = 0; i < reasonCodesRaw.length; i++) {
|
|
119
|
+
if (typeof reasonCodesRaw[i] !== "string") {
|
|
120
|
+
errors.push(`reasonCodes[${i}] must be a string`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (errors.length)
|
|
125
|
+
return { ok: false, errors };
|
|
126
|
+
const questions = questionsIn.map((q) => {
|
|
127
|
+
const o = q;
|
|
128
|
+
const id = typeof o.id === "string" && o.id.trim()
|
|
129
|
+
? o.id.trim()
|
|
130
|
+
: randomUUID();
|
|
131
|
+
return {
|
|
132
|
+
id,
|
|
133
|
+
question: String(o.question).trim(),
|
|
134
|
+
reason: String(o.reason).trim(),
|
|
135
|
+
source: "ai-driven",
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
const reasonCodes = Array.isArray(reasonCodesRaw) && reasonCodesRaw.length
|
|
139
|
+
? reasonCodesRaw.map(String)
|
|
140
|
+
: undefined;
|
|
141
|
+
return {
|
|
142
|
+
ok: true,
|
|
143
|
+
value: {
|
|
144
|
+
questions,
|
|
145
|
+
confidence,
|
|
146
|
+
...(skipped ? { skipped: true } : {}),
|
|
147
|
+
...(reasonCodes ? { reasonCodes } : {}),
|
|
148
|
+
},
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
const PLAN_WEB_SCOPE_SYSTEM = `You are a planning assistant for web evidence collection.
|
|
152
|
+
Return ONLY a single JSON object (no markdown fences, no prose) with this exact shape:
|
|
153
|
+
{
|
|
154
|
+
"questions": Array<{ "id"?: string, "question": string, "reason": string, "source": "ai-driven" }>,
|
|
155
|
+
"confidence": number,
|
|
156
|
+
"skipped"?: boolean,
|
|
157
|
+
"reasonCodes"?: string[]
|
|
158
|
+
}
|
|
159
|
+
Rules:
|
|
160
|
+
- "confidence" is a number from 0 to 1.
|
|
161
|
+
- Each "question" must be a concrete web search or research question (non-empty string).
|
|
162
|
+
- Each "reason" briefly explains why that question helps (non-empty string).
|
|
163
|
+
- "source" must be the literal string "ai-driven" for every question entry.
|
|
164
|
+
- Produce at most the requested maxQuestions items in "questions".
|
|
165
|
+
- If you cannot propose useful questions, set "skipped": true, "questions": [], "confidence" <= 0.5, and include "reasonCodes" such as ["INPUT_TOO_THIN"].`;
|
|
166
|
+
export function buildPlanWebScopeQuestionsUserPrompt(input) {
|
|
167
|
+
const maxQ = clampInt(input.maxQuestions, 1, 20);
|
|
168
|
+
const nq = typeof input.nodeQuestion === "string" ? input.nodeQuestion.trim() : "";
|
|
169
|
+
const lines = [
|
|
170
|
+
`maxQuestions: ${maxQ}`,
|
|
171
|
+
"",
|
|
172
|
+
"nodeQuestion:",
|
|
173
|
+
nq || "(empty)",
|
|
174
|
+
"",
|
|
175
|
+
"nodeInput:",
|
|
176
|
+
jsonSnippet("nodeInput", input.nodeInput ?? null),
|
|
177
|
+
];
|
|
178
|
+
if (input.rawRecord !== undefined) {
|
|
179
|
+
lines.push("", "rawRecord:", jsonSnippet("rawRecord", input.rawRecord));
|
|
180
|
+
}
|
|
181
|
+
if (input.memorySummary !== undefined) {
|
|
182
|
+
lines.push("", "memorySummary:", jsonSnippet("memorySummary", input.memorySummary));
|
|
183
|
+
}
|
|
184
|
+
if (input.xynthesized !== undefined) {
|
|
185
|
+
lines.push("", "xynthesized:", jsonSnippet("xynthesized", input.xynthesized));
|
|
186
|
+
}
|
|
187
|
+
return lines.join("\n");
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Plans web-scope questions via Xynthesis (default) or FuncX `research/plan-questions`.
|
|
191
|
+
*/
|
|
192
|
+
export async function runPlanWebScopeQuestions(params) {
|
|
193
|
+
const { input, backend = "xynthesis", funcxFunctionId, llmCall, jobId, taskId, agentId, traceCollector, traceTask, observationSink, } = params;
|
|
194
|
+
const nq = typeof input.nodeQuestion === "string" ? input.nodeQuestion.trim() : "";
|
|
195
|
+
const maxQ = clampInt(input.maxQuestions, 1, 20);
|
|
196
|
+
if (!nq) {
|
|
197
|
+
return {
|
|
198
|
+
questions: [],
|
|
199
|
+
confidence: 0,
|
|
200
|
+
skipped: true,
|
|
201
|
+
reasonCodes: [PlanWebScopeQuestionsReasonCode.INPUT_TOO_THIN],
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
if (backend === "funcx") {
|
|
205
|
+
try {
|
|
206
|
+
const raw = await runResearchPlanQuestionsViaFuncx({
|
|
207
|
+
input: { ...input, nodeQuestion: nq, maxQuestions: maxQ },
|
|
208
|
+
jobId,
|
|
209
|
+
taskId,
|
|
210
|
+
agentId,
|
|
211
|
+
funcxFunctionId,
|
|
212
|
+
});
|
|
213
|
+
const adapted = adaptFuncxResearchPlanToOutput(raw);
|
|
214
|
+
const maxAllowed = maxQ;
|
|
215
|
+
if (adapted.questions.length > maxAllowed) {
|
|
216
|
+
return {
|
|
217
|
+
questions: [],
|
|
218
|
+
confidence: 0,
|
|
219
|
+
skipped: true,
|
|
220
|
+
reasonCodes: [PlanWebScopeQuestionsReasonCode.OUTPUT_INVALID],
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
if (adapted.questions.length === 0 && adapted.skipped !== true) {
|
|
224
|
+
return {
|
|
225
|
+
questions: [],
|
|
226
|
+
confidence: 0,
|
|
227
|
+
skipped: true,
|
|
228
|
+
reasonCodes: [PlanWebScopeQuestionsReasonCode.OUTPUT_INVALID],
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
return {
|
|
232
|
+
questions: adapted.questions,
|
|
233
|
+
confidence: adapted.confidence,
|
|
234
|
+
...(adapted.skipped ? { skipped: true } : {}),
|
|
235
|
+
...(adapted.reasonCodes?.length ? { reasonCodes: adapted.reasonCodes } : {}),
|
|
236
|
+
};
|
|
237
|
+
}
|
|
238
|
+
catch {
|
|
239
|
+
return {
|
|
240
|
+
questions: [],
|
|
241
|
+
confidence: 0,
|
|
242
|
+
skipped: true,
|
|
243
|
+
reasonCodes: [PlanWebScopeQuestionsReasonCode.LLM_ERROR],
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const userPrompt = buildPlanWebScopeQuestionsUserPrompt({ ...input, nodeQuestion: nq, maxQuestions: maxQ });
|
|
248
|
+
try {
|
|
249
|
+
const { text } = await runPostStepLlmCall({
|
|
250
|
+
systemPrompt: PLAN_WEB_SCOPE_SYSTEM,
|
|
251
|
+
userPrompt,
|
|
252
|
+
llmCall,
|
|
253
|
+
stage: "plan-web-scope-questions",
|
|
254
|
+
structuredOutput: true,
|
|
255
|
+
jobId: jobId ?? "plan-web-scope-questions",
|
|
256
|
+
taskId,
|
|
257
|
+
agentId: agentId ?? "plan-web-scope-questions",
|
|
258
|
+
traceCollector,
|
|
259
|
+
traceTask,
|
|
260
|
+
observationSink,
|
|
261
|
+
});
|
|
262
|
+
const parsed = parseAndValidatePlanWebScopeQuestionsOutput(text, maxQ);
|
|
263
|
+
if (!parsed.ok) {
|
|
264
|
+
return {
|
|
265
|
+
questions: [],
|
|
266
|
+
confidence: 0,
|
|
267
|
+
skipped: true,
|
|
268
|
+
reasonCodes: [PlanWebScopeQuestionsReasonCode.OUTPUT_INVALID],
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
return parsed.value;
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
return {
|
|
275
|
+
questions: [],
|
|
276
|
+
confidence: 0,
|
|
277
|
+
skipped: true,
|
|
278
|
+
reasonCodes: [PlanWebScopeQuestionsReasonCode.LLM_ERROR],
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/planWebScopeQuestions/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EACL,8BAA8B,EAC9B,gCAAgC,EAChC,oCAAoC,GACrC,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,oCAAoC,EAAE,CAAC;AAKhD,iFAAiF;AACjF,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,SAAS,EAAE,WAAW;IACtB,cAAc,EAAE,gBAAgB;CACxB,CAAC;AAkCX,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC,SAAS,QAAQ,CAAC,CAAS,EAAE,EAAU,EAAE,EAAU;IACjD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAA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AC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { adaptResearchPlanQuestionsResult, type ResearchPlanQuestionsInputShape } from "../execution-strategies/genericExecutionFuncxEnvelope.js";
|
|
2
|
+
export type ResearchPlanQuestionsFuncxInvokeContext = {
|
|
3
|
+
functionId: string;
|
|
4
|
+
payload: unknown;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Test-only override for FuncX `research/plan-questions` calls from {@link runPlanWebScopeQuestions} when `backend: "funcx"`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function setResearchPlanQuestionsFuncxInvoker(fn: ((ctx: ResearchPlanQuestionsFuncxInvokeContext) => Promise<unknown>) | null): void;
|
|
10
|
+
export declare function runResearchPlanQuestionsViaFuncx(params: {
|
|
11
|
+
input: ResearchPlanQuestionsInputShape;
|
|
12
|
+
jobId?: string;
|
|
13
|
+
taskId?: string;
|
|
14
|
+
agentId?: string;
|
|
15
|
+
funcxFunctionId?: string;
|
|
16
|
+
}): Promise<unknown>;
|
|
17
|
+
export declare function adaptFuncxResearchPlanToOutput(raw: unknown): ReturnType<typeof adaptResearchPlanQuestionsResult>;
|
|
18
|
+
//# sourceMappingURL=runResearchPlanQuestionsFuncx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runResearchPlanQuestionsFuncx.d.ts","sourceRoot":"","sources":["../../src/planWebScopeQuestions/runResearchPlanQuestionsFuncx.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,gCAAgC,EAGhC,KAAK,+BAA+B,EACrC,MAAM,0DAA0D,CAAC;AAElE,MAAM,MAAM,uCAAuC,GAAG;IACpD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAIF;;GAEG;AACH,wBAAgB,oCAAoC,CAClD,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,uCAAuC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI,GAC9E,IAAI,CAEN;AAgBD,wBAAsB,gCAAgC,CAAC,MAAM,EAAE;IAC7D,KAAK,EAAE,+BAA+B,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GAAG,OAAO,CAAC,OAAO,CAAC,CAgBnB;AAED,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,OAAO,GAAG,UAAU,CAAC,OAAO,gCAAgC,CAAC,CAEhH"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { createClient } from "@x12i/funcx";
|
|
2
|
+
import { run } from "@x12i/funcx/functions";
|
|
3
|
+
import { FUNCX_RESEARCH_PLAN_QUESTIONS_FUNCTION_ID } from "../execution-strategies/constants.js";
|
|
4
|
+
import { adaptResearchPlanQuestionsResult, buildResearchPlanQuestionsPayload, unwrapFuncxRunValue, } from "../execution-strategies/genericExecutionFuncxEnvelope.js";
|
|
5
|
+
let injectedInvoker = null;
|
|
6
|
+
/**
|
|
7
|
+
* Test-only override for FuncX `research/plan-questions` calls from {@link runPlanWebScopeQuestions} when `backend: "funcx"`.
|
|
8
|
+
*/
|
|
9
|
+
export function setResearchPlanQuestionsFuncxInvoker(fn) {
|
|
10
|
+
injectedInvoker = fn;
|
|
11
|
+
}
|
|
12
|
+
let cachedClient = null;
|
|
13
|
+
function defaultOpenRouterClient() {
|
|
14
|
+
if (!cachedClient) {
|
|
15
|
+
cachedClient = createClient({ backend: "openrouter" });
|
|
16
|
+
}
|
|
17
|
+
return cachedClient;
|
|
18
|
+
}
|
|
19
|
+
function pickFunctionId(explicit) {
|
|
20
|
+
if (typeof explicit === "string" && explicit.trim())
|
|
21
|
+
return explicit.trim();
|
|
22
|
+
return FUNCX_RESEARCH_PLAN_QUESTIONS_FUNCTION_ID;
|
|
23
|
+
}
|
|
24
|
+
export async function runResearchPlanQuestionsViaFuncx(params) {
|
|
25
|
+
const functionId = pickFunctionId(params.funcxFunctionId);
|
|
26
|
+
const payload = buildResearchPlanQuestionsPayload({
|
|
27
|
+
input: params.input,
|
|
28
|
+
jobId: params.jobId,
|
|
29
|
+
taskId: params.taskId,
|
|
30
|
+
agentId: params.agentId,
|
|
31
|
+
});
|
|
32
|
+
if (injectedInvoker) {
|
|
33
|
+
return injectedInvoker({ functionId, payload });
|
|
34
|
+
}
|
|
35
|
+
const client = defaultOpenRouterClient();
|
|
36
|
+
const raw = await run(functionId, payload, { client });
|
|
37
|
+
return unwrapFuncxRunValue(raw);
|
|
38
|
+
}
|
|
39
|
+
export function adaptFuncxResearchPlanToOutput(raw) {
|
|
40
|
+
return adaptResearchPlanQuestionsResult(raw);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=runResearchPlanQuestionsFuncx.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runResearchPlanQuestionsFuncx.js","sourceRoot":"","sources":["../../src/planWebScopeQuestions/runResearchPlanQuestionsFuncx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAe,MAAM,aAAa,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,yCAAyC,EAAE,MAAM,sCAAsC,CAAC;AACjG,OAAO,EACL,gCAAgC,EAChC,iCAAiC,EACjC,mBAAmB,GAEpB,MAAM,0DAA0D,CAAC;AAOlE,IAAI,eAAe,GAAgF,IAAI,CAAC;AAExG;;GAEG;AACH,MAAM,UAAU,oCAAoC,CAClD,EAA+E;IAE/E,eAAe,GAAG,EAAE,CAAC;AACvB,CAAC;AAED,IAAI,YAAY,GAAkB,IAAI,CAAC;AAEvC,SAAS,uBAAuB;IAC9B,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,YAAY,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,cAAc,CAAC,QAAiB;IACvC,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE;QAAE,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC5E,OAAO,yCAAyC,CAAC;AACnD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC,CAAC,MAMtD;IACC,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,iCAAiC,CAAC;QAChD,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,OAAO,EAAE,MAAM,CAAC,OAAO;KACxB,CAAC,CAAC;IAEH,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC,CAAC;IAClD,CAAC;IAED,MAAM,MAAM,GAAG,uBAAuB,EAAE,CAAC;IACzC,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACvD,OAAO,mBAAmB,CAAC,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,GAAY;IACzD,OAAO,gCAAgC,CAAC,GAAG,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load audit POST step templates from disk. Base path = AUDIT_TEMPLATES_PATH or cwd/templates/post-steps/audit.
|
|
3
|
+
*/
|
|
4
|
+
export type AuditTemplates = {
|
|
5
|
+
system: string;
|
|
6
|
+
user: string;
|
|
7
|
+
feedbackInjection: string;
|
|
8
|
+
synthesis: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function loadAuditTemplates(): Promise<AuditTemplates>;
|
|
11
|
+
export declare function renderAuditSystem(template: string, data: {
|
|
12
|
+
customGuidelines?: string;
|
|
13
|
+
}): string;
|
|
14
|
+
export declare function renderAuditUser(template: string, data: {
|
|
15
|
+
originalInput: string;
|
|
16
|
+
promptContext: string;
|
|
17
|
+
candidateOutput: string;
|
|
18
|
+
mustChecks: {
|
|
19
|
+
check: string;
|
|
20
|
+
weight: number;
|
|
21
|
+
}[];
|
|
22
|
+
shouldChecks: {
|
|
23
|
+
check: string;
|
|
24
|
+
weight: number;
|
|
25
|
+
}[];
|
|
26
|
+
previousFeedback?: string;
|
|
27
|
+
previousCycle?: number;
|
|
28
|
+
}): string;
|
|
29
|
+
export declare function renderFeedbackInjection(template: string, data: {
|
|
30
|
+
cycle: number;
|
|
31
|
+
maxCycles: number;
|
|
32
|
+
failedChecks: {
|
|
33
|
+
kind: string;
|
|
34
|
+
check: string;
|
|
35
|
+
feedback: string;
|
|
36
|
+
}[];
|
|
37
|
+
overallFeedback: string;
|
|
38
|
+
}): string;
|
|
39
|
+
export declare function renderSynthesis(template: string, data: {
|
|
40
|
+
originalInput: string;
|
|
41
|
+
promptContext: string;
|
|
42
|
+
candidateA: {
|
|
43
|
+
cycle: number;
|
|
44
|
+
score: number;
|
|
45
|
+
output: string;
|
|
46
|
+
failedChecks: {
|
|
47
|
+
kind: string;
|
|
48
|
+
check: string;
|
|
49
|
+
feedback: string;
|
|
50
|
+
}[];
|
|
51
|
+
passedChecks: {
|
|
52
|
+
kind: string;
|
|
53
|
+
check: string;
|
|
54
|
+
}[];
|
|
55
|
+
};
|
|
56
|
+
candidateB: {
|
|
57
|
+
cycle: number;
|
|
58
|
+
score: number;
|
|
59
|
+
output: string;
|
|
60
|
+
failedChecks: {
|
|
61
|
+
kind: string;
|
|
62
|
+
check: string;
|
|
63
|
+
feedback: string;
|
|
64
|
+
}[];
|
|
65
|
+
passedChecks: {
|
|
66
|
+
kind: string;
|
|
67
|
+
check: string;
|
|
68
|
+
}[];
|
|
69
|
+
};
|
|
70
|
+
customSynthesisGuidelines?: string;
|
|
71
|
+
}): string;
|
|
72
|
+
//# sourceMappingURL=loadAuditTemplates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadAuditTemplates.d.ts","sourceRoot":"","sources":["../../../src/post-steps/audit/loadAuditTemplates.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAMF,wBAAsB,kBAAkB,IAAI,OAAO,CAAC,cAAc,CAAC,CA2BlE;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAG/F;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAChD,YAAY,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,MAAM,CAGT;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAClE,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,MAAM,CAGT;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAAC,YAAY,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;IACjL,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,EAAE,CAAC;QAAC,YAAY,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,KAAK,EAAE,MAAM,CAAA;SAAE,EAAE,CAAA;KAAE,CAAC;IACjL,yBAAyB,CAAC,EAAE,MAAM,CAAC;CACpC,GAAG,MAAM,CAGT"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Load audit POST step templates from disk. Base path = AUDIT_TEMPLATES_PATH or cwd/templates/post-steps/audit.
|
|
3
|
+
*/
|
|
4
|
+
import { readFile } from "fs/promises";
|
|
5
|
+
import { join } from "path";
|
|
6
|
+
import Handlebars from "handlebars";
|
|
7
|
+
const DEFAULT_SYSTEM = `You are a strict quality auditor. Evaluate every check, output structured markdown with "### Checks" and "### Overall feedback" sections.`;
|
|
8
|
+
const DEFAULT_USER = `Original input: {{originalInput}}\n\nContext: {{promptContext}}\n\nCandidate: {{candidateOutput}}\n\nMust: {{mustChecks}}\nShould: {{shouldChecks}}`;
|
|
9
|
+
const DEFAULT_FEEDBACK = `## Audit Feedback (cycle {{cycle}} of {{maxCycles}})\n\n{{overallFeedback}}\n\nFailed: {{failedChecks}}`;
|
|
10
|
+
const DEFAULT_SYNTHESIS = `Merge the best of two candidates. Output only the merged task output.`;
|
|
11
|
+
function getBasePath() {
|
|
12
|
+
return process.env.AUDIT_TEMPLATES_PATH ?? process.cwd();
|
|
13
|
+
}
|
|
14
|
+
export async function loadAuditTemplates() {
|
|
15
|
+
const base = join(getBasePath(), "templates", "post-steps", "audit");
|
|
16
|
+
let system = DEFAULT_SYSTEM;
|
|
17
|
+
let user = DEFAULT_USER;
|
|
18
|
+
let feedbackInjection = DEFAULT_FEEDBACK;
|
|
19
|
+
let synthesis = DEFAULT_SYNTHESIS;
|
|
20
|
+
try {
|
|
21
|
+
system = await readFile(join(base, "system.md"), "utf-8");
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
/* use default */
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
user = await readFile(join(base, "user.txt"), "utf-8");
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
/* use default */
|
|
31
|
+
}
|
|
32
|
+
try {
|
|
33
|
+
feedbackInjection = await readFile(join(base, "feedback-injection.md"), "utf-8");
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
/* use default */
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
synthesis = await readFile(join(base, "synthesis.md"), "utf-8");
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
/* use default */
|
|
43
|
+
}
|
|
44
|
+
return { system, user, feedbackInjection, synthesis };
|
|
45
|
+
}
|
|
46
|
+
export function renderAuditSystem(template, data) {
|
|
47
|
+
const t = Handlebars.compile(template);
|
|
48
|
+
return t(data);
|
|
49
|
+
}
|
|
50
|
+
export function renderAuditUser(template, data) {
|
|
51
|
+
const t = Handlebars.compile(template);
|
|
52
|
+
return t(data);
|
|
53
|
+
}
|
|
54
|
+
export function renderFeedbackInjection(template, data) {
|
|
55
|
+
const t = Handlebars.compile(template);
|
|
56
|
+
return t(data);
|
|
57
|
+
}
|
|
58
|
+
export function renderSynthesis(template, data) {
|
|
59
|
+
const t = Handlebars.compile(template);
|
|
60
|
+
return t(data);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=loadAuditTemplates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loadAuditTemplates.js","sourceRoot":"","sources":["../../../src/post-steps/audit/loadAuditTemplates.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,MAAM,cAAc,GAAG,2IAA2I,CAAC;AACnK,MAAM,YAAY,GAAG,qJAAqJ,CAAC;AAC3K,MAAM,gBAAgB,GAAG,yGAAyG,CAAC;AACnI,MAAM,iBAAiB,GAAG,uEAAuE,CAAC;AASlG,SAAS,WAAW;IAClB,OAAO,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;AAC3D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB;IACtC,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACrE,IAAI,MAAM,GAAG,cAAc,CAAC;IAC5B,IAAI,IAAI,GAAG,YAAY,CAAC;IACxB,IAAI,iBAAiB,GAAG,gBAAgB,CAAC;IACzC,IAAI,S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,QAAQ,CAAC,CAAC;IACvC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB,EAAE,IAMjD;IACC,MAAM,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse audit LLM output (structured markdown / Flex-MD style) into AuditLLMOutput.
|
|
3
|
+
* Fallback: section-based markdown parser when Flex-MD is not used or parse fails.
|
|
4
|
+
*/
|
|
5
|
+
import type { AuditLLMOutput } from "../../types/task-types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Parse structured markdown from audit model into checks and overall feedback.
|
|
8
|
+
* Expects sections: "### Checks" with blocks of Check/Kind/Passed/Feedback, then "### Overall feedback".
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseAuditOutputFromMarkdown(text: string): AuditLLMOutput;
|
|
11
|
+
//# sourceMappingURL=parseAuditOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parseAuditOutput.d.ts","sourceRoot":"","sources":["../../../src/post-steps/audit/parseAuditOutput.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAElF;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CA2CzE"}
|