@exellix/ai-tasks 9.1.0 → 10.0.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/CHANGELOG.md +34 -4
- package/README.md +2 -2
- package/RUNTASK_REQUEST.md +32 -17
- package/dist/builders/task-request-builder.d.ts.map +1 -1
- package/dist/builders/task-request-builder.js +2 -1
- package/dist/builders/task-request-builder.js.map +1 -1
- package/dist/compile/compileTaskConfiguration.d.ts.map +1 -1
- package/dist/compile/compileTaskConfiguration.js +3 -0
- package/dist/compile/compileTaskConfiguration.js.map +1 -1
- package/dist/core/task-sdk.d.ts.map +1 -1
- package/dist/core/task-sdk.js +148 -180
- package/dist/core/task-sdk.js.map +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/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/invocation/types.d.ts +1 -1
- package/dist/narrix/applyWebScopeToRequest.d.ts +9 -0
- package/dist/narrix/applyWebScopeToRequest.d.ts.map +1 -0
- package/dist/narrix/applyWebScopeToRequest.js +156 -0
- package/dist/narrix/applyWebScopeToRequest.js.map +1 -0
- package/dist/narrix/narrixUnitExecution.d.ts.map +1 -1
- package/dist/narrix/narrixUnitExecution.js +8 -3
- package/dist/narrix/narrixUnitExecution.js.map +1 -1
- package/dist/node-execution/buildRequestFromNodePlan.d.ts +6 -0
- package/dist/node-execution/buildRequestFromNodePlan.d.ts.map +1 -1
- package/dist/node-execution/buildRequestFromNodePlan.js +4 -16
- package/dist/node-execution/buildRequestFromNodePlan.js.map +1 -1
- package/dist/node-execution/compileProfessionalAnswerRequest.d.ts +2 -0
- package/dist/node-execution/compileProfessionalAnswerRequest.d.ts.map +1 -0
- package/dist/node-execution/compileProfessionalAnswerRequest.js +4 -0
- package/dist/node-execution/compileProfessionalAnswerRequest.js.map +1 -0
- package/dist/node-execution/createNodeExecutionHost.d.ts.map +1 -1
- package/dist/node-execution/createNodeExecutionHost.js +97 -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 +4 -2
- package/dist/node-execution/dispatchExecutionUnit.js.map +1 -1
- package/dist/node-execution/orchestration/runPostOrchestration.d.ts +11 -0
- package/dist/node-execution/orchestration/runPostOrchestration.d.ts.map +1 -0
- package/dist/node-execution/orchestration/runPostOrchestration.js +123 -0
- package/dist/node-execution/orchestration/runPostOrchestration.js.map +1 -0
- package/dist/node-execution/orchestration/runPreOrchestration.d.ts +3 -0
- package/dist/node-execution/orchestration/runPreOrchestration.d.ts.map +1 -0
- package/dist/node-execution/orchestration/runPreOrchestration.js +110 -0
- package/dist/node-execution/orchestration/runPreOrchestration.js.map +1 -0
- package/dist/node-execution/orchestration/shardContext.d.ts +12 -0
- package/dist/node-execution/orchestration/shardContext.d.ts.map +1 -0
- package/dist/node-execution/orchestration/shardContext.js +71 -0
- package/dist/node-execution/orchestration/shardContext.js.map +1 -0
- package/dist/node-execution/orchestration/types.d.ts +21 -0
- package/dist/node-execution/orchestration/types.d.ts.map +1 -0
- package/dist/node-execution/orchestration/types.js +2 -0
- package/dist/node-execution/orchestration/types.js.map +1 -0
- package/dist/node-execution/rejectForbiddenWireFields.d.ts +2 -0
- package/dist/node-execution/rejectForbiddenWireFields.d.ts.map +1 -1
- package/dist/node-execution/rejectForbiddenWireFields.js +42 -7
- package/dist/node-execution/rejectForbiddenWireFields.js.map +1 -1
- package/dist/observability/classifyRunTaskFailure.d.ts.map +1 -1
- package/dist/observability/classifyRunTaskFailure.js +4 -3
- package/dist/observability/classifyRunTaskFailure.js.map +1 -1
- package/dist/observability/logRunTaskFailure.d.ts.map +1 -1
- package/dist/observability/logRunTaskFailure.js +0 -2
- package/dist/observability/logRunTaskFailure.js.map +1 -1
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts +19 -3
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts.map +1 -1
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js +7 -1
- package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js.map +1 -1
- package/dist/post-steps/audit/loadAuditTemplates.d.ts +2 -55
- package/dist/post-steps/audit/loadAuditTemplates.d.ts.map +1 -1
- package/dist/post-steps/audit/loadAuditTemplates.js +3 -38
- package/dist/post-steps/audit/loadAuditTemplates.js.map +1 -1
- package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts +8 -0
- package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts.map +1 -0
- package/dist/post-steps/audit/parseAuditFuncxOutput.js +62 -0
- package/dist/post-steps/audit/parseAuditFuncxOutput.js.map +1 -0
- package/dist/post-steps/audit/parseAuditOutput.d.ts +2 -0
- package/dist/post-steps/audit/parseAuditOutput.d.ts.map +1 -1
- package/dist/post-steps/audit/parseAuditOutput.js +56 -0
- package/dist/post-steps/audit/parseAuditOutput.js.map +1 -1
- package/dist/post-steps/audit/runAudit.d.ts.map +1 -1
- package/dist/post-steps/audit/runAudit.js +53 -113
- package/dist/post-steps/audit/runAudit.js.map +1 -1
- package/dist/post-steps/audit/runAuditFuncxCall.d.ts +18 -0
- package/dist/post-steps/audit/runAuditFuncxCall.d.ts.map +1 -0
- package/dist/post-steps/audit/runAuditFuncxCall.js +59 -0
- package/dist/post-steps/audit/runAuditFuncxCall.js.map +1 -0
- package/dist/synthesis/resolveSourceMaterial.d.ts.map +1 -1
- package/dist/synthesis/resolveSourceMaterial.js +14 -0
- package/dist/synthesis/resolveSourceMaterial.js.map +1 -1
- package/dist/synthesis/runStructuredSynthesisRobust.d.ts.map +1 -1
- package/dist/synthesis/runStructuredSynthesisRobust.js +24 -4
- package/dist/synthesis/runStructuredSynthesisRobust.js.map +1 -1
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts +3 -0
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts.map +1 -1
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js +28 -4
- package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js.map +1 -1
- package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts +4 -4
- package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts.map +1 -1
- package/dist/task-strategies/canonicalInputExecutionStrategies.js +2 -1
- package/dist/task-strategies/canonicalInputExecutionStrategies.js.map +1 -1
- package/dist/task-strategies/canonicalOrchestrationStrategies.d.ts +42 -0
- package/dist/task-strategies/canonicalOrchestrationStrategies.d.ts.map +1 -0
- package/dist/task-strategies/canonicalOrchestrationStrategies.js +47 -0
- package/dist/task-strategies/canonicalOrchestrationStrategies.js.map +1 -0
- package/dist/task-strategies/canonicalTaskStrategies.d.ts +2 -1
- package/dist/task-strategies/canonicalTaskStrategies.d.ts.map +1 -1
- package/dist/task-strategies/canonicalTaskStrategies.js +2 -1
- package/dist/task-strategies/canonicalTaskStrategies.js.map +1 -1
- package/dist/task-strategies/constants.d.ts +9 -1
- package/dist/task-strategies/constants.d.ts.map +1 -1
- package/dist/task-strategies/constants.js +9 -1
- package/dist/task-strategies/constants.js.map +1 -1
- package/dist/task-strategies/index.d.ts +5 -3
- package/dist/task-strategies/index.d.ts.map +1 -1
- package/dist/task-strategies/index.js +4 -3
- package/dist/task-strategies/index.js.map +1 -1
- package/dist/task-strategies/listAiTaskStrategies.d.ts +10 -1
- package/dist/task-strategies/listAiTaskStrategies.d.ts.map +1 -1
- package/dist/task-strategies/listAiTaskStrategies.js +17 -2
- package/dist/task-strategies/listAiTaskStrategies.js.map +1 -1
- package/dist/types/task-types.d.ts +4 -11
- package/dist/types/task-types.d.ts.map +1 -1
- package/dist/utils/bridgeRunSkillGatewayMemory.d.ts.map +1 -1
- package/dist/utils/bridgeRunSkillGatewayMemory.js +1 -0
- package/dist/utils/bridgeRunSkillGatewayMemory.js.map +1 -1
- package/dist/utils/executionMemoryInputRecord.d.ts +12 -0
- package/dist/utils/executionMemoryInputRecord.d.ts.map +1 -0
- package/dist/utils/executionMemoryInputRecord.js +28 -0
- package/dist/utils/executionMemoryInputRecord.js.map +1 -0
- package/dist/utils/resolveAiProfileModel.d.ts +1 -1
- package/dist/utils/resolveAiProfileModel.d.ts.map +1 -1
- package/dist/utils/resolveRunTaskModelReferences.d.ts.map +1 -1
- package/dist/utils/resolveRunTaskModelReferences.js +0 -32
- package/dist/utils/resolveRunTaskModelReferences.js.map +1 -1
- package/dist/utils/runTaskRequestShape.d.ts.map +1 -1
- package/dist/utils/runTaskRequestShape.js +4 -26
- package/dist/utils/runTaskRequestShape.js.map +1 -1
- package/dist/utils/skillTemplateVariables.d.ts +3 -2
- package/dist/utils/skillTemplateVariables.d.ts.map +1 -1
- package/dist/utils/skillTemplateVariables.js +3 -2
- package/dist/utils/skillTemplateVariables.js.map +1 -1
- package/dist/validation/validateProfessionalAnswerContract.d.ts +8 -0
- package/dist/validation/validateProfessionalAnswerContract.d.ts.map +1 -0
- package/dist/validation/validateProfessionalAnswerContract.js +45 -0
- package/dist/validation/validateProfessionalAnswerContract.js.map +1 -0
- package/dist/validation/validateRunTaskConfig.d.ts.map +1 -1
- package/dist/validation/validateRunTaskConfig.js +3 -66
- package/dist/validation/validateRunTaskConfig.js.map +1 -1
- package/documenations/record-and-template-variables.md +21 -13
- package/documenations/run-task-execution-flow.md +1 -1
- package/documenations/skill-orchestration-strategy-cr-fr.md +147 -0
- package/documenations/upstream-feature-requests/README.md +9 -5
- package/documenations/upstream-feature-requests/ai-skills-orchestrator-invoke-contract-5.9.md +1 -1
- package/documenations/upstream-feature-requests/funcx-4.9.13-open-items.md +62 -0
- package/documenations/upstream-feature-requests/funcx-gap-analysis-cr-fr.md +401 -0
- package/documenations/upstream-feature-requests/funcx-pre-post-sidekick-actions.md +1 -0
- package/documenations/upstream-feature-requests/graph-engine-runtask-contract-alignment-investigation.md +370 -0
- package/documenations/upstream-feature-requests/xynthesis-ai-profiles-2.1-import-break.md +2 -2
- package/documenations/upstream-feature-requests/xynthesis-openrouter-wire-model-double-prefix-bug.md +1 -1
- package/documenations/upstream-feature-requests/xynthesis-orchestrator-invoke-contract-4.2.md +1 -1
- package/package.json +10 -9
- package/.docs/DOWNSTREAM_ENV.md +0 -42
- package/.docs/FEEDBACK_TO_CLIENT_DOWNSTREAM_FIXES.md +0 -64
- package/.docs/INTERMEDIATE_STEPS.md +0 -82
- package/.docs/activity-structure.md +0 -31
- package/.docs/ai-task-ai-scoping-spec.md +0 -338
- package/.docs/ai-tasks-model-profile-aliases-7x.md +0 -96
- package/.docs/blockers-and-issues.md +0 -346
- package/.docs/building-runTask-sdk.md +0 -659
- package/.docs/building-skill-execution-orchestrator.md +0 -968
- package/.docs/code-used-before/run-task.txt +0 -39
- package/.docs/code-used-before/task-executor.ts.old +0 -57
- package/.docs/code-used-before/test-run-task.ts.old +0 -42
- package/.docs/code-used-before/types.txt +0 -23
- package/.docs/env-ready-policy.md +0 -40
- package/.docs/flow-io/flow-README.md +0 -76
- package/.docs/flow-io/narrix.md +0 -124
- package/.docs/flow-io/web-scoping.md +0 -135
- package/.docs/flow-io/xynthesis-post.md +0 -154
- package/.docs/flow-io/xynthesis-pre.md +0 -181
- package/.docs/gap-analysis.md +0 -201
- package/.docs/integration-facts-ai-tasks.md +0 -109
- package/.docs/investigation/ai-skills.md +0 -170
- package/.docs/investigation/external-packages-assignments.md +0 -66
- package/.docs/investigation/integration-summary.md +0 -20
- package/.docs/investigation/narrix-catalox.md +0 -29
- package/.docs/investigation/workplan-close-graph-engine-gaps.md +0 -101
- package/.docs/logging-stack.md +0 -30
- package/.docs/memory-narrix-adapter-developer-guide.md +0 -402
- package/.docs/memory-narrix-adapter-requirements.md +0 -112
- package/.docs/narrix-context-consumption-gap.md +0 -184
- package/.docs/narrix-context-downstream-report.md +0 -30
- package/.docs/narrix-ingest-and-packs-library-spec.md +0 -240
- package/.docs/narrix-record-input-current-design.md +0 -48
- package/.docs/pacakge.md +0 -48
- package/.docs/possible-components/README.md +0 -11
- package/.docs/possible-components/integration/README.md +0 -10
- package/.docs/possible-components/integration/gaps-when-merging.md +0 -16
- package/.docs/possible-components/integration/platform.md +0 -54
- package/.docs/possible-components/integration/reintegrate-into-ai-tasks.md +0 -26
- package/.docs/possible-components/integration/roadmap-and-checklists.md +0 -54
- package/.docs/possible-components/post-component/README.md +0 -18
- package/.docs/possible-components/post-component/builder-guide.md +0 -175
- package/.docs/possible-components/post-component/gaps-and-artifacts.md +0 -52
- package/.docs/possible-components/post-component/handler-audit.md +0 -47
- package/.docs/possible-components/post-component/handler-polish.md +0 -41
- package/.docs/possible-components/post-component/unified-protocol.md +0 -59
- package/.docs/possible-components/pre-component/README.md +0 -22
- package/.docs/possible-components/pre-component/builder-guide.md +0 -127
- package/.docs/possible-components/pre-component/gaps-and-artifacts.md +0 -35
- package/.docs/possible-components/pre-component/handler-ai-scoping.md +0 -45
- package/.docs/possible-components/pre-component/handler-narrix-preprocessor.md +0 -49
- package/.docs/possible-components/pre-component/handler-narrix-system2.md +0 -35
- package/.docs/possible-components/pre-component/handler-synthesized-context.md +0 -65
- package/.docs/possible-components/pre-component/handler-web-scope.md +0 -29
- package/.docs/possible-components/pre-component/unified-protocol.md +0 -89
- package/.docs/prefer-openrouter-routing-policy.md +0 -114
- package/.docs/questions-for-ai-skills.md +0 -123
- package/.docs/realtime-narrixing-gap-analysis.md +0 -40
- package/.docs/realtime-narrixing.md +0 -433
- package/.docs/run-context-object.md +0 -32
- package/.docs/session-id-usage.md +0 -26
- package/.docs/skill-library-spec.md +0 -249
- package/.docs/synthesized-context-strategy-spec.md +0 -906
- package/.docs/upstream-issue/2026-03-21_woroces-ai-tasks_ISSUE-006_web-scope-question-from-cni-entity.md +0 -46
- package/.docs/web-scopper-embed.md +0 -93
- package/.docs/xynthesis-wiring-and-io.md +0 -12
- package/documenations/activix-feature-request-identity.md +0 -123
- package/documenations/bug-report-xynthesis-and-synthesis-call.md +0 -217
- package/documenations/feature-request-ai-skills-raw-template-access.md +0 -82
- package/documenations/feature-request-athenix-core-directive.md +0 -145
- package/documenations/feature-request-athenix-token-extraction.md +0 -124
- package/documenations/funcx-upstream-github-issues-draft.md +0 -153
- package/documenations/identity-metadata-contract.md +0 -165
- package/documenations/run-task-single-run-checklist.md +0 -109
- package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-1-no-concrete-wire-in-graph-plans.md +0 -93
- package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-2-skillModel-profile-only-at-storage.md +0 -88
- package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-3-reject-concrete-models-in-catalog-rows.md +0 -76
- package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-1-suggested-profile-in-catalogs.md +0 -96
- package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-2-graph-engine-failure-phase-attribution.md +0 -92
- package/documenations/sessions/2026-06-08-subnets-model-resolution/INVESTIGATION-original-bug.md +0 -182
- package/documenations/sessions/2026-06-08-subnets-model-resolution/PROBLEM.md +0 -236
- package/documenations/sessions/2026-06-08-subnets-model-resolution/README.md +0 -11
- package/documenations/sessions/2026-06-08-subnets-model-resolution/funcx-test-resolveModel.cheapDefaultWireSlug.test.ts +0 -117
- package/documenations/upstream-feature-requests/ai-tasks-wrap-up-after-upstream.md +0 -129
- package/documenations/upstream-feedback-request-shape-clarification.md +0 -101
- package/documenations/web-context-precedence.md +0 -33
- package/documenations/xynthesis-activix-telemetry.md +0 -28
package/dist/core/task-sdk.js
CHANGED
|
@@ -10,6 +10,7 @@ import { buildRunTaskResultMetaFromModelId } from "../invocation/buildRunTaskRes
|
|
|
10
10
|
import { logRunTaskInvocationPlan } from "../observability/logLlmProviderInvocation.js";
|
|
11
11
|
import { registerBuiltInLocalTasks } from "../localTasks/index.js";
|
|
12
12
|
import { getByPath } from "../utils/jsonPaths.js";
|
|
13
|
+
import { readInvokePayloadRecord } from "../utils/executionMemoryInputRecord.js";
|
|
13
14
|
import { passthroughJobTemplateVariables } from "../utils/skillTemplateVariables.js";
|
|
14
15
|
import { emitRunTaskRequestWarnings } from "../utils/runTaskRequestShape.js";
|
|
15
16
|
import { configureFuncxLogging } from "@x12i/funcx";
|
|
@@ -32,14 +33,13 @@ import { getActivixClient } from "../activix/activixClient.js";
|
|
|
32
33
|
import { withPhaseRecord } from "../activix/phaseTracking.js";
|
|
33
34
|
import { activixOuterTier } from "@x12i/activix";
|
|
34
35
|
import { createDebugTraceCollector, traceWrap } from "../observability/debugTrace.js";
|
|
35
|
-
import {
|
|
36
|
+
import { resolveSourceMaterial, resolveSourceMaterialParts, getRenderedTemplates, buildSynthesizedContextMarkdown, resolveSynthesisQuestion, runStructuredSynthesisGatewayCallRobust, getContextSynthesizer, normalizeAndValidateSynthesizedPayload, discoverTemplateCores, } from "../synthesis/index.js";
|
|
36
37
|
import { resolveOutputExpectation as resolveOutputExpectationXynthesis } from "@exellix/xynthesis/ai-actions";
|
|
37
38
|
import { llmCallEnvPrefix, resolveLlmCall } from "../post-steps/resolvePostStepConfig.js";
|
|
38
39
|
import { buildXynthesisWorkScopeIdentity } from "../internal/buildXynthesisWorkScopeIdentity.js";
|
|
39
40
|
import { getPostActionModelFromSlots, prepareMainSkillModelConfigForInvoke, resolvePreActionModel, } from "../utils/routeModelConfigSlots.js";
|
|
40
41
|
import { assertPhaseModelAlias } from "../errors/modelConfigRequiredError.js";
|
|
41
42
|
import { isRunTaskModelResolutionError } from "../errors/runTaskModelResolutionError.js";
|
|
42
|
-
import { runPostStepLlmCall } from "../internal/runPostStepLlmCall.js";
|
|
43
43
|
registerBuiltInLocalTasks();
|
|
44
44
|
const DEFAULT_SYNTH_INPUT_MAX_CHARS = 200_000;
|
|
45
45
|
function maxSynthesizedInputChars() {
|
|
@@ -260,10 +260,13 @@ function coerceTaskMemoryNarrixToAttachment(taskMemoryNarrix) {
|
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
262
|
function resolveSynthesisMode(config) {
|
|
263
|
-
if (config.synthesisMode === "structured"
|
|
264
|
-
return
|
|
263
|
+
if (config.synthesisMode === "structured") {
|
|
264
|
+
return "structured";
|
|
265
265
|
}
|
|
266
|
-
|
|
266
|
+
if (config.synthesisMode === "markdown") {
|
|
267
|
+
return "structured";
|
|
268
|
+
}
|
|
269
|
+
return "structured";
|
|
267
270
|
}
|
|
268
271
|
function detectedTemplateCoresFromExecutionMemory(executionMemory) {
|
|
269
272
|
const artifact = executionMemory?.synthesizedContext;
|
|
@@ -437,6 +440,18 @@ function buildSynthesizerInputMaterial(strategy, resolveOpts) {
|
|
|
437
440
|
const parts = resolveSourceMaterialParts(resolveOpts);
|
|
438
441
|
return { sourceMaterial, parts };
|
|
439
442
|
}
|
|
443
|
+
function buildPreSynthesisGateway(request) {
|
|
444
|
+
return {
|
|
445
|
+
aiRequestId: randomUUID(),
|
|
446
|
+
agentId: typeof request.agentId === "string"
|
|
447
|
+
? request.agentId
|
|
448
|
+
: (request.skillKey ?? "ai-tasks"),
|
|
449
|
+
sessionId: typeof request.taskId === "string" && request.taskId.trim()
|
|
450
|
+
? request.taskId.trim()
|
|
451
|
+
: randomUUID(),
|
|
452
|
+
temperature: 0.7,
|
|
453
|
+
};
|
|
454
|
+
}
|
|
440
455
|
function safeResolveSynthesisQuestion(synthesisRequest, config, renderedPrompt) {
|
|
441
456
|
try {
|
|
442
457
|
const q = resolveSynthesisQuestion(synthesisRequest, config, renderedPrompt);
|
|
@@ -543,7 +558,7 @@ export class WorexClientTasks {
|
|
|
543
558
|
prevNodeId: input.prevNodeId,
|
|
544
559
|
masterSkillId: input.masterSkillId,
|
|
545
560
|
masterSkillActivityId: input.masterSkillActivityId,
|
|
546
|
-
hasPipeline:
|
|
561
|
+
hasPipeline: (input.nodePlan?.executionUnits?.length ?? 0) > 1,
|
|
547
562
|
hasNarrix: !!input.narrix,
|
|
548
563
|
hasNarrixInput: !!input.narrixInput,
|
|
549
564
|
});
|
|
@@ -603,7 +618,7 @@ export class WorexClientTasks {
|
|
|
603
618
|
}
|
|
604
619
|
return result;
|
|
605
620
|
};
|
|
606
|
-
const hasPipeline =
|
|
621
|
+
const hasPipeline = (input.nodePlan?.executionUnits?.length ?? 0) > 1;
|
|
607
622
|
const hasNarrix = !!input.narrix;
|
|
608
623
|
const hasNarrixInput = !!input.narrixInput;
|
|
609
624
|
// Activix 6+: correlation + task identity belong in `runContext`, not a parallel top-level `identity` field.
|
|
@@ -663,13 +678,13 @@ export class WorexClientTasks {
|
|
|
663
678
|
masterSkillId: req.masterSkillId,
|
|
664
679
|
masterSkillActivityId: req.masterSkillActivityId,
|
|
665
680
|
includeContextInPrompt: req.includeContextInPrompt === true,
|
|
666
|
-
hasPipeline:
|
|
681
|
+
hasPipeline: (req.nodePlan?.executionUnits?.length ?? 0) > 1,
|
|
667
682
|
hasNarrix: !!req.narrix,
|
|
668
683
|
hasNarrixInput: !!req.narrixInput,
|
|
669
684
|
input: summarizeForOuter(req.input, 4_000),
|
|
670
685
|
}, null, { phase: "direct" }),
|
|
671
686
|
// pipeline MAIN vs DIRECT is still tracked as the same phase label ("direct")
|
|
672
|
-
hasPipeline:
|
|
687
|
+
hasPipeline: (req.nodePlan?.executionUnits?.length ?? 0) > 1,
|
|
673
688
|
hasNarrix: !!req.narrix,
|
|
674
689
|
hasNarrixInput: !!req.narrixInput,
|
|
675
690
|
overrideContextProvided: options?.overrideContext !== undefined,
|
|
@@ -700,7 +715,7 @@ export class WorexClientTasks {
|
|
|
700
715
|
masterSkillId: req.masterSkillId,
|
|
701
716
|
masterSkillActivityId: req.masterSkillActivityId,
|
|
702
717
|
includeContextInPrompt: req.includeContextInPrompt === true,
|
|
703
|
-
hasPipeline:
|
|
718
|
+
hasPipeline: (req.nodePlan?.executionUnits?.length ?? 0) > 1,
|
|
704
719
|
hasNarrix: !!req.narrix,
|
|
705
720
|
hasNarrixInput: !!req.narrixInput,
|
|
706
721
|
input: summarizeForOuter(req.input, 4_000),
|
|
@@ -988,6 +1003,10 @@ export class WorexClientTasks {
|
|
|
988
1003
|
return { contextMarkdown: "" };
|
|
989
1004
|
throw e;
|
|
990
1005
|
}
|
|
1006
|
+
const skillsClient = this.skillsClient;
|
|
1007
|
+
const resolveRawTemplateAvailable = typeof skillsClient.resolveRawTemplate === "function";
|
|
1008
|
+
const synthesisInputStrategy = config.synthesisInputStrategy ?? "policy";
|
|
1009
|
+
let lastTemplateResolveNote;
|
|
991
1010
|
const resolveRawTemplate = async (key) => {
|
|
992
1011
|
const section = key.endsWith(".instructions") || key.endsWith(".instructions.md")
|
|
993
1012
|
? "instructions"
|
|
@@ -995,17 +1014,33 @@ export class WorexClientTasks {
|
|
|
995
1014
|
? "prompt"
|
|
996
1015
|
: null;
|
|
997
1016
|
const baseSkillKey = request.skillKey;
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1017
|
+
if (!section) {
|
|
1018
|
+
return undefined;
|
|
1019
|
+
}
|
|
1020
|
+
if (!resolveRawTemplateAvailable) {
|
|
1021
|
+
lastTemplateResolveNote =
|
|
1022
|
+
"@exellix/ai-skills resolveRawTemplate() is missing — upgrade ai-skills to 4.1+.";
|
|
1023
|
+
return undefined;
|
|
1024
|
+
}
|
|
1025
|
+
try {
|
|
1026
|
+
const result = await skillsClient.resolveRawTemplate(baseSkillKey, section, {
|
|
1027
|
+
role: "synthesisContext",
|
|
1028
|
+
strategyKey: synthesisInputStrategy,
|
|
1029
|
+
});
|
|
1030
|
+
if (result?.found && typeof result.content === "string" && result.content.length > 0) {
|
|
1031
|
+
return result.content;
|
|
1005
1032
|
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1033
|
+
lastTemplateResolveNote = `resolveRawTemplate(skillKey=${baseSkillKey}, role=synthesisContext, strategyKey=${synthesisInputStrategy}, section=${section}) returned found=${String(result?.found ?? false)}`;
|
|
1034
|
+
}
|
|
1035
|
+
catch (e) {
|
|
1036
|
+
if (e instanceof Error &&
|
|
1037
|
+
(e.name === "CataloxSkillNotFoundError" || /No Catalox catalog item/i.test(e.message))) {
|
|
1038
|
+
throw e;
|
|
1008
1039
|
}
|
|
1040
|
+
lastTemplateResolveNote =
|
|
1041
|
+
e instanceof Error
|
|
1042
|
+
? `${e.name}: ${e.message}`
|
|
1043
|
+
: `resolveRawTemplate threw: ${String(e)}`;
|
|
1009
1044
|
}
|
|
1010
1045
|
return undefined;
|
|
1011
1046
|
};
|
|
@@ -1083,14 +1118,18 @@ export class WorexClientTasks {
|
|
|
1083
1118
|
};
|
|
1084
1119
|
}
|
|
1085
1120
|
const execMem = (enrichedBundle.executionMemory ?? memoryBundle.executionMemory);
|
|
1086
|
-
const recordRaw =
|
|
1121
|
+
const recordRaw = readInvokePayloadRecord(request);
|
|
1087
1122
|
const recordMd = recordRaw !== undefined
|
|
1088
|
-
? `## Record (
|
|
1123
|
+
? `## Record (input)\n\n\`\`\`json\n${truncate(JSON.stringify(recordRaw, null, 2), maxOutputLength ? Math.min(maxOutputLength, 60_000) : 60_000)}\n\`\`\`\n`
|
|
1089
1124
|
: "";
|
|
1090
1125
|
const webContextEntry = execMem?.webContext;
|
|
1091
1126
|
const webMd = buildWebContextEvidenceMarkdown(webContextEntry, config.webEvidence);
|
|
1092
|
-
const {
|
|
1093
|
-
|
|
1127
|
+
const { templateCores } = discoverTemplateCores({
|
|
1128
|
+
templates: [
|
|
1129
|
+
{ name: "instructions", content: rawInstructions },
|
|
1130
|
+
{ name: "prompt", content: rawPrompt },
|
|
1131
|
+
],
|
|
1132
|
+
});
|
|
1094
1133
|
const extractWebEvidence = () => {
|
|
1095
1134
|
if (!isRecord(webContextEntry))
|
|
1096
1135
|
return { webUnavailableReason: "webContext missing" };
|
|
@@ -1153,58 +1192,48 @@ export class WorexClientTasks {
|
|
|
1153
1192
|
if (allowWeb)
|
|
1154
1193
|
materialParts.push(webMd || "## Web sources (primary evidence)\n\n[unavailable]");
|
|
1155
1194
|
const perQuestionMaterial = materialParts.join("\n");
|
|
1156
|
-
const userPrompt = buildSynthesisUserPrompt(renderedInstructions, renderedPrompt, perQuestionMaterial, userTemplate);
|
|
1157
1195
|
let synthesisText;
|
|
1158
1196
|
if (allowWeb && !hasWeb && !allowRecord) {
|
|
1159
1197
|
const reason = webEvidence.webUnavailableReason ?? "web scoping unavailable";
|
|
1160
1198
|
synthesisText = `Unknown — web-derived context unavailable (${reason}).`;
|
|
1161
1199
|
}
|
|
1162
1200
|
else if (allowRecord && !hasRecord && !allowWeb) {
|
|
1163
|
-
synthesisText = `Unknown — record-derived context unavailable (missing executionMemory.input
|
|
1201
|
+
synthesisText = `Unknown — record-derived context unavailable (missing executionMemory.input).`;
|
|
1164
1202
|
}
|
|
1165
1203
|
else if (allowRecord && allowWeb && !hasRecord && !hasWeb) {
|
|
1166
1204
|
const reason = webEvidence.webUnavailableReason ?? "web scoping unavailable";
|
|
1167
1205
|
synthesisText =
|
|
1168
|
-
`Unknown — no inputs available (missing executionMemory.input
|
|
1206
|
+
`Unknown — no inputs available (missing executionMemory.input; web unavailable: ${reason}).`;
|
|
1169
1207
|
}
|
|
1170
1208
|
else {
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1209
|
+
const payload = await runStructuredSynthesisGatewayCallRobust({
|
|
1210
|
+
templateCores,
|
|
1211
|
+
question: question.trim(),
|
|
1212
|
+
localMarkdown: perQuestionMaterial,
|
|
1213
|
+
supportingMarkdown: "",
|
|
1214
|
+
renderedInstructions,
|
|
1215
|
+
renderedPrompt,
|
|
1216
|
+
model,
|
|
1217
|
+
timeoutMs,
|
|
1218
|
+
maxOutputLength,
|
|
1219
|
+
outputExpectation: synthLlmCall.outputExpectation,
|
|
1220
|
+
reasoningEffort: synthLlmCall.reasoningEffort,
|
|
1221
|
+
topP: synthLlmCall.topP,
|
|
1222
|
+
executionMode: traceCollector ? "trace" : undefined,
|
|
1177
1223
|
jobId: request.jobId,
|
|
1178
1224
|
taskId: request.taskId,
|
|
1179
1225
|
agentId: request.agentId,
|
|
1180
|
-
workScopeIdentity,
|
|
1181
|
-
|
|
1182
|
-
traceTask: traceCollector
|
|
1183
|
-
? {
|
|
1184
|
-
taskType: "pre-execution",
|
|
1185
|
-
details: "synthesized-context question call",
|
|
1186
|
-
modelUsed: model ?? null,
|
|
1187
|
-
metadata: {
|
|
1188
|
-
jobId: request.jobId,
|
|
1189
|
-
taskId: request.taskId,
|
|
1190
|
-
skillKey: request.skillKey,
|
|
1191
|
-
phase: "pipeline_pre",
|
|
1192
|
-
preStepType: "synthesized-context",
|
|
1193
|
-
step: { phase: "pre", type: "synthesized-context", stepId: `questionDriven:${id}` },
|
|
1194
|
-
questionId: id,
|
|
1195
|
-
},
|
|
1196
|
-
}
|
|
1197
|
-
: undefined,
|
|
1198
|
-
observationSink: synthObservationSink,
|
|
1226
|
+
identity: workScopeIdentity,
|
|
1227
|
+
gateway: buildPreSynthesisGateway(request),
|
|
1199
1228
|
});
|
|
1200
|
-
synthesisText =
|
|
1229
|
+
synthesisText = buildSynthesizedContextMarkdown(payload);
|
|
1201
1230
|
}
|
|
1202
1231
|
answers[id] = {
|
|
1203
1232
|
question: question.trim(),
|
|
1204
1233
|
source,
|
|
1205
1234
|
synthesis: synthesisText,
|
|
1206
1235
|
evidence: {
|
|
1207
|
-
recordPaths: allowRecord ? ["executionMemory.input
|
|
1236
|
+
recordPaths: allowRecord ? ["executionMemory.input"] : undefined,
|
|
1208
1237
|
webScopeIds: allowWeb ? webEvidence.webScopeIds : undefined,
|
|
1209
1238
|
sources: allowWeb ? webEvidence.sources : undefined,
|
|
1210
1239
|
},
|
|
@@ -1231,148 +1260,87 @@ export class WorexClientTasks {
|
|
|
1231
1260
|
};
|
|
1232
1261
|
}
|
|
1233
1262
|
const synthesisMode = resolveSynthesisMode(config);
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
if (
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
}
|
|
1248
|
-
throw new Error(`structured synthesized-context requires at least one template core token in instructions or prompt. skillKey: ${request.skillKey}`);
|
|
1263
|
+
const parts = sourceMaterialParts;
|
|
1264
|
+
const question = safeResolveSynthesisQuestion(synthesisRequest, config, renderedPrompt);
|
|
1265
|
+
const { templateCores } = discoverTemplateCores({
|
|
1266
|
+
templates: [
|
|
1267
|
+
{ name: "instructions", content: rawInstructions },
|
|
1268
|
+
{ name: "prompt", content: rawPrompt },
|
|
1269
|
+
],
|
|
1270
|
+
});
|
|
1271
|
+
if (templateCores.length === 0) {
|
|
1272
|
+
if (!rawInstructions.trim() && !rawPrompt.trim()) {
|
|
1273
|
+
const hint = resolveRawTemplateAvailable
|
|
1274
|
+
? `Missing synthesisContext templates for strategy "${synthesisInputStrategy}". ${lastTemplateResolveNote ?? "Publish/sync skill support templates to Catalox (ai-skills catalox:sync-skill-templates)."}`
|
|
1275
|
+
: "@exellix/ai-skills resolveRawTemplate() is missing — upgrade ai-skills to 4.1+ and configure Catalox (FIREBASE_PROJECT_ID, GOOGLE_SERVICE_ACCOUNT_BASE64).";
|
|
1276
|
+
throw new Error(`structured synthesized-context could not resolve synthesisContext templates for skillKey: ${request.skillKey}, synthesisInputStrategy: ${synthesisInputStrategy}. ${hint}`);
|
|
1249
1277
|
}
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
templateCores,
|
|
1269
|
-
skillKey: request.skillKey,
|
|
1270
|
-
jobId: request.jobId,
|
|
1271
|
-
taskId: request.taskId,
|
|
1272
|
-
},
|
|
1273
|
-
});
|
|
1274
|
-
payload = normalizeAndValidateSynthesizedPayload(payload, validateOpts);
|
|
1275
|
-
}
|
|
1276
|
-
else {
|
|
1277
|
-
payload = await runStructuredSynthesisGatewayCallRobust({
|
|
1278
|
-
question,
|
|
1279
|
-
localMarkdown: parts.localMarkdown,
|
|
1280
|
-
supportingMarkdown: parts.supportingMarkdown,
|
|
1278
|
+
throw new Error(`structured synthesized-context requires at least one template core token in synthesisContext templates. skillKey: ${request.skillKey}, synthesisInputStrategy: ${synthesisInputStrategy}`);
|
|
1279
|
+
}
|
|
1280
|
+
const validateOpts = {
|
|
1281
|
+
expectedTemplateCores: templateCores,
|
|
1282
|
+
expectedQuestion: question,
|
|
1283
|
+
maxItemsPerSide: config.structuredMaxItemsPerSide,
|
|
1284
|
+
maxItemContentChars: config.structuredMaxItemContentChars,
|
|
1285
|
+
};
|
|
1286
|
+
try {
|
|
1287
|
+
const custom = getContextSynthesizer();
|
|
1288
|
+
let payload;
|
|
1289
|
+
if (custom) {
|
|
1290
|
+
payload = await custom.synthesize({
|
|
1291
|
+
templateCores,
|
|
1292
|
+
question,
|
|
1293
|
+
localRaw: parts.localMarkdown,
|
|
1294
|
+
supportingRaw: parts.supportingMarkdown,
|
|
1295
|
+
metadata: {
|
|
1281
1296
|
renderedInstructions,
|
|
1282
1297
|
renderedPrompt,
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
customSynthesizingGuidelines: config.customSynthesizingGuidelines,
|
|
1286
|
-
model: model,
|
|
1287
|
-
timeoutMs: timeoutMs,
|
|
1288
|
-
maxOutputLength: maxOutputLength,
|
|
1289
|
-
// Caller-supplied outputExpectation overrides the per-action default in the structured-repair path.
|
|
1290
|
-
outputExpectation: synthLlmCall.outputExpectation,
|
|
1291
|
-
reasoningEffort: synthLlmCall.reasoningEffort,
|
|
1292
|
-
topP: synthLlmCall.topP,
|
|
1293
|
-
// Forward trace mode so the structured gateway returns a `debugTrace` (lifted into observations elsewhere).
|
|
1294
|
-
executionMode: traceCollector ? "trace" : undefined,
|
|
1298
|
+
templateCores,
|
|
1299
|
+
skillKey: request.skillKey,
|
|
1295
1300
|
jobId: request.jobId,
|
|
1296
1301
|
taskId: request.taskId,
|
|
1297
|
-
agentId: request.agentId,
|
|
1298
|
-
identity: workScopeIdentity,
|
|
1299
|
-
});
|
|
1300
|
-
}
|
|
1301
|
-
const contextMarkdown = buildSynthesizedContextMarkdown(payload);
|
|
1302
|
-
return {
|
|
1303
|
-
contextMarkdown,
|
|
1304
|
-
artifact: {
|
|
1305
|
-
templateCores,
|
|
1306
|
-
question,
|
|
1307
|
-
mode: synthesisMode,
|
|
1308
|
-
payload,
|
|
1309
|
-
contextMarkdown,
|
|
1310
1302
|
},
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
templateCores,
|
|
1314
|
-
}),
|
|
1315
|
-
synthesizedContextLlmCalls: traceCollector ? synthLlmCalls : undefined,
|
|
1316
|
-
};
|
|
1303
|
+
});
|
|
1304
|
+
payload = normalizeAndValidateSynthesizedPayload(payload, validateOpts);
|
|
1317
1305
|
}
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1306
|
+
else {
|
|
1307
|
+
payload = await runStructuredSynthesisGatewayCallRobust({
|
|
1308
|
+
templateCores,
|
|
1309
|
+
question,
|
|
1310
|
+
localMarkdown: parts.localMarkdown,
|
|
1311
|
+
supportingMarkdown: parts.supportingMarkdown,
|
|
1312
|
+
renderedInstructions,
|
|
1313
|
+
renderedPrompt,
|
|
1314
|
+
templatesBasePath: config.templatesBasePath,
|
|
1315
|
+
synthesisPromptOverride: config.synthesisPromptOverride,
|
|
1316
|
+
customSynthesizingGuidelines: config.customSynthesizingGuidelines,
|
|
1317
|
+
model: model,
|
|
1318
|
+
timeoutMs: timeoutMs,
|
|
1319
|
+
maxOutputLength: maxOutputLength,
|
|
1320
|
+
// Caller-supplied outputExpectation overrides the per-action default in the structured-repair path.
|
|
1321
|
+
outputExpectation: synthLlmCall.outputExpectation,
|
|
1322
|
+
reasoningEffort: synthLlmCall.reasoningEffort,
|
|
1323
|
+
topP: synthLlmCall.topP,
|
|
1324
|
+
// Forward trace mode so the structured gateway returns a `debugTrace` (lifted into observations elsewhere).
|
|
1325
|
+
executionMode: traceCollector ? "trace" : undefined,
|
|
1326
|
+
jobId: request.jobId,
|
|
1327
|
+
taskId: request.taskId,
|
|
1328
|
+
agentId: request.agentId,
|
|
1329
|
+
identity: workScopeIdentity,
|
|
1330
|
+
gateway: buildPreSynthesisGateway(request),
|
|
1331
|
+
});
|
|
1325
1332
|
}
|
|
1326
|
-
|
|
1327
|
-
const { system: systemTemplate, user: userTemplate } = await loadSynthesisTemplates();
|
|
1328
|
-
const systemPrompt = buildSynthesisSystemPrompt(systemTemplate, config.synthesisPromptOverride, config.customSynthesizingGuidelines);
|
|
1329
|
-
const userPrompt = buildSynthesisUserPrompt(renderedInstructions, renderedPrompt, sourceMaterial, userTemplate);
|
|
1330
|
-
try {
|
|
1331
|
-
const { text: contextMarkdown } = await runPostStepLlmCall({
|
|
1332
|
-
systemPrompt,
|
|
1333
|
-
userPrompt,
|
|
1334
|
-
extraMaterial: sourceMaterial,
|
|
1335
|
-
llmCall: synthLlmCall,
|
|
1336
|
-
stage: "pre-synthesis-markdown",
|
|
1337
|
-
jobId: request.jobId,
|
|
1338
|
-
taskId: request.taskId,
|
|
1339
|
-
agentId: request.agentId,
|
|
1340
|
-
workScopeIdentity,
|
|
1341
|
-
traceCollector,
|
|
1342
|
-
traceTask: traceCollector
|
|
1343
|
-
? {
|
|
1344
|
-
taskType: "pre-execution",
|
|
1345
|
-
details: "synthesized-context markdown call",
|
|
1346
|
-
modelUsed: model ?? null,
|
|
1347
|
-
metadata: {
|
|
1348
|
-
jobId: request.jobId,
|
|
1349
|
-
taskId: request.taskId,
|
|
1350
|
-
skillKey: request.skillKey,
|
|
1351
|
-
phase: "pipeline_pre",
|
|
1352
|
-
preStepType: "synthesized-context",
|
|
1353
|
-
step: { phase: "pre", type: "synthesized-context", stepId: "markdown" },
|
|
1354
|
-
},
|
|
1355
|
-
}
|
|
1356
|
-
: undefined,
|
|
1357
|
-
observationSink: synthObservationSink,
|
|
1358
|
-
});
|
|
1359
|
-
const question = safeResolveSynthesisQuestion(synthesisRequest, config, renderedPrompt);
|
|
1360
|
-
const { templateCores } = discoverTemplateCores({
|
|
1361
|
-
templates: [
|
|
1362
|
-
{ name: "instructions", content: rawInstructions },
|
|
1363
|
-
{ name: "prompt", content: rawPrompt },
|
|
1364
|
-
],
|
|
1365
|
-
});
|
|
1333
|
+
const contextMarkdown = buildSynthesizedContextMarkdown(payload);
|
|
1366
1334
|
return {
|
|
1367
1335
|
contextMarkdown,
|
|
1368
1336
|
artifact: {
|
|
1369
1337
|
templateCores,
|
|
1370
1338
|
question,
|
|
1371
|
-
mode:
|
|
1372
|
-
payload
|
|
1339
|
+
mode: synthesisMode,
|
|
1340
|
+
payload,
|
|
1373
1341
|
contextMarkdown,
|
|
1374
1342
|
},
|
|
1375
|
-
synthesizedInput: buildSynthesizedInputArtifact(
|
|
1343
|
+
synthesizedInput: buildSynthesizedInputArtifact(synthesisMode, sourceMaterial, parts, {
|
|
1376
1344
|
question,
|
|
1377
1345
|
templateCores,
|
|
1378
1346
|
}),
|