@exellix/ai-tasks 9.1.0 → 9.1.1

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.
Files changed (171) hide show
  1. package/CHANGELOG.md +15 -4
  2. package/README.md +2 -2
  3. package/RUNTASK_REQUEST.md +17 -15
  4. package/dist/compile/compileTaskConfiguration.d.ts.map +1 -1
  5. package/dist/compile/compileTaskConfiguration.js +3 -0
  6. package/dist/compile/compileTaskConfiguration.js.map +1 -1
  7. package/dist/core/task-sdk.d.ts.map +1 -1
  8. package/dist/core/task-sdk.js +112 -166
  9. package/dist/core/task-sdk.js.map +1 -1
  10. package/dist/invocation/types.d.ts +1 -1
  11. package/dist/narrix/narrixUnitExecution.js +2 -2
  12. package/dist/narrix/narrixUnitExecution.js.map +1 -1
  13. package/dist/node-execution/buildRequestFromNodePlan.d.ts +4 -0
  14. package/dist/node-execution/buildRequestFromNodePlan.d.ts.map +1 -1
  15. package/dist/node-execution/buildRequestFromNodePlan.js +4 -13
  16. package/dist/node-execution/buildRequestFromNodePlan.js.map +1 -1
  17. package/dist/node-execution/compileProfessionalAnswerRequest.d.ts +2 -0
  18. package/dist/node-execution/compileProfessionalAnswerRequest.d.ts.map +1 -0
  19. package/dist/node-execution/compileProfessionalAnswerRequest.js +4 -0
  20. package/dist/node-execution/compileProfessionalAnswerRequest.js.map +1 -0
  21. package/dist/node-execution/rejectForbiddenWireFields.d.ts +2 -0
  22. package/dist/node-execution/rejectForbiddenWireFields.d.ts.map +1 -1
  23. package/dist/node-execution/rejectForbiddenWireFields.js +42 -7
  24. package/dist/node-execution/rejectForbiddenWireFields.js.map +1 -1
  25. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts +19 -3
  26. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts.map +1 -1
  27. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js +7 -1
  28. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js.map +1 -1
  29. package/dist/post-steps/audit/loadAuditTemplates.d.ts +2 -55
  30. package/dist/post-steps/audit/loadAuditTemplates.d.ts.map +1 -1
  31. package/dist/post-steps/audit/loadAuditTemplates.js +3 -38
  32. package/dist/post-steps/audit/loadAuditTemplates.js.map +1 -1
  33. package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts +8 -0
  34. package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts.map +1 -0
  35. package/dist/post-steps/audit/parseAuditFuncxOutput.js +62 -0
  36. package/dist/post-steps/audit/parseAuditFuncxOutput.js.map +1 -0
  37. package/dist/post-steps/audit/parseAuditOutput.d.ts +2 -0
  38. package/dist/post-steps/audit/parseAuditOutput.d.ts.map +1 -1
  39. package/dist/post-steps/audit/parseAuditOutput.js +56 -0
  40. package/dist/post-steps/audit/parseAuditOutput.js.map +1 -1
  41. package/dist/post-steps/audit/runAudit.d.ts.map +1 -1
  42. package/dist/post-steps/audit/runAudit.js +53 -113
  43. package/dist/post-steps/audit/runAudit.js.map +1 -1
  44. package/dist/post-steps/audit/runAuditFuncxCall.d.ts +18 -0
  45. package/dist/post-steps/audit/runAuditFuncxCall.d.ts.map +1 -0
  46. package/dist/post-steps/audit/runAuditFuncxCall.js +59 -0
  47. package/dist/post-steps/audit/runAuditFuncxCall.js.map +1 -0
  48. package/dist/synthesis/resolveSourceMaterial.d.ts.map +1 -1
  49. package/dist/synthesis/resolveSourceMaterial.js +14 -0
  50. package/dist/synthesis/resolveSourceMaterial.js.map +1 -1
  51. package/dist/types/task-types.d.ts +4 -3
  52. package/dist/types/task-types.d.ts.map +1 -1
  53. package/dist/utils/bridgeRunSkillGatewayMemory.d.ts.map +1 -1
  54. package/dist/utils/bridgeRunSkillGatewayMemory.js +1 -0
  55. package/dist/utils/bridgeRunSkillGatewayMemory.js.map +1 -1
  56. package/dist/utils/executionMemoryInputRecord.d.ts +12 -0
  57. package/dist/utils/executionMemoryInputRecord.d.ts.map +1 -0
  58. package/dist/utils/executionMemoryInputRecord.js +28 -0
  59. package/dist/utils/executionMemoryInputRecord.js.map +1 -0
  60. package/dist/utils/resolveAiProfileModel.d.ts +1 -1
  61. package/dist/utils/resolveAiProfileModel.d.ts.map +1 -1
  62. package/dist/utils/skillTemplateVariables.d.ts +3 -2
  63. package/dist/utils/skillTemplateVariables.d.ts.map +1 -1
  64. package/dist/utils/skillTemplateVariables.js +3 -2
  65. package/dist/utils/skillTemplateVariables.js.map +1 -1
  66. package/dist/validation/validateProfessionalAnswerContract.d.ts +8 -0
  67. package/dist/validation/validateProfessionalAnswerContract.d.ts.map +1 -0
  68. package/dist/validation/validateProfessionalAnswerContract.js +45 -0
  69. package/dist/validation/validateProfessionalAnswerContract.js.map +1 -0
  70. package/dist/validation/validateRunTaskConfig.d.ts.map +1 -1
  71. package/dist/validation/validateRunTaskConfig.js +2 -0
  72. package/dist/validation/validateRunTaskConfig.js.map +1 -1
  73. package/documenations/record-and-template-variables.md +21 -13
  74. package/documenations/run-task-execution-flow.md +1 -1
  75. package/documenations/upstream-feature-requests/README.md +9 -5
  76. package/documenations/upstream-feature-requests/ai-skills-orchestrator-invoke-contract-5.9.md +1 -1
  77. package/documenations/upstream-feature-requests/funcx-4.9.13-open-items.md +62 -0
  78. package/documenations/upstream-feature-requests/funcx-gap-analysis-cr-fr.md +401 -0
  79. package/documenations/upstream-feature-requests/funcx-pre-post-sidekick-actions.md +1 -0
  80. package/documenations/upstream-feature-requests/graph-engine-runtask-contract-alignment-investigation.md +370 -0
  81. package/documenations/upstream-feature-requests/xynthesis-ai-profiles-2.1-import-break.md +2 -2
  82. package/documenations/upstream-feature-requests/xynthesis-openrouter-wire-model-double-prefix-bug.md +1 -1
  83. package/documenations/upstream-feature-requests/xynthesis-orchestrator-invoke-contract-4.2.md +1 -1
  84. package/package.json +10 -9
  85. package/.docs/DOWNSTREAM_ENV.md +0 -42
  86. package/.docs/FEEDBACK_TO_CLIENT_DOWNSTREAM_FIXES.md +0 -64
  87. package/.docs/INTERMEDIATE_STEPS.md +0 -82
  88. package/.docs/activity-structure.md +0 -31
  89. package/.docs/ai-task-ai-scoping-spec.md +0 -338
  90. package/.docs/ai-tasks-model-profile-aliases-7x.md +0 -96
  91. package/.docs/blockers-and-issues.md +0 -346
  92. package/.docs/building-runTask-sdk.md +0 -659
  93. package/.docs/building-skill-execution-orchestrator.md +0 -968
  94. package/.docs/code-used-before/run-task.txt +0 -39
  95. package/.docs/code-used-before/task-executor.ts.old +0 -57
  96. package/.docs/code-used-before/test-run-task.ts.old +0 -42
  97. package/.docs/code-used-before/types.txt +0 -23
  98. package/.docs/env-ready-policy.md +0 -40
  99. package/.docs/flow-io/flow-README.md +0 -76
  100. package/.docs/flow-io/narrix.md +0 -124
  101. package/.docs/flow-io/web-scoping.md +0 -135
  102. package/.docs/flow-io/xynthesis-post.md +0 -154
  103. package/.docs/flow-io/xynthesis-pre.md +0 -181
  104. package/.docs/gap-analysis.md +0 -201
  105. package/.docs/integration-facts-ai-tasks.md +0 -109
  106. package/.docs/investigation/ai-skills.md +0 -170
  107. package/.docs/investigation/external-packages-assignments.md +0 -66
  108. package/.docs/investigation/integration-summary.md +0 -20
  109. package/.docs/investigation/narrix-catalox.md +0 -29
  110. package/.docs/investigation/workplan-close-graph-engine-gaps.md +0 -101
  111. package/.docs/logging-stack.md +0 -30
  112. package/.docs/memory-narrix-adapter-developer-guide.md +0 -402
  113. package/.docs/memory-narrix-adapter-requirements.md +0 -112
  114. package/.docs/narrix-context-consumption-gap.md +0 -184
  115. package/.docs/narrix-context-downstream-report.md +0 -30
  116. package/.docs/narrix-ingest-and-packs-library-spec.md +0 -240
  117. package/.docs/narrix-record-input-current-design.md +0 -48
  118. package/.docs/pacakge.md +0 -48
  119. package/.docs/possible-components/README.md +0 -11
  120. package/.docs/possible-components/integration/README.md +0 -10
  121. package/.docs/possible-components/integration/gaps-when-merging.md +0 -16
  122. package/.docs/possible-components/integration/platform.md +0 -54
  123. package/.docs/possible-components/integration/reintegrate-into-ai-tasks.md +0 -26
  124. package/.docs/possible-components/integration/roadmap-and-checklists.md +0 -54
  125. package/.docs/possible-components/post-component/README.md +0 -18
  126. package/.docs/possible-components/post-component/builder-guide.md +0 -175
  127. package/.docs/possible-components/post-component/gaps-and-artifacts.md +0 -52
  128. package/.docs/possible-components/post-component/handler-audit.md +0 -47
  129. package/.docs/possible-components/post-component/handler-polish.md +0 -41
  130. package/.docs/possible-components/post-component/unified-protocol.md +0 -59
  131. package/.docs/possible-components/pre-component/README.md +0 -22
  132. package/.docs/possible-components/pre-component/builder-guide.md +0 -127
  133. package/.docs/possible-components/pre-component/gaps-and-artifacts.md +0 -35
  134. package/.docs/possible-components/pre-component/handler-ai-scoping.md +0 -45
  135. package/.docs/possible-components/pre-component/handler-narrix-preprocessor.md +0 -49
  136. package/.docs/possible-components/pre-component/handler-narrix-system2.md +0 -35
  137. package/.docs/possible-components/pre-component/handler-synthesized-context.md +0 -65
  138. package/.docs/possible-components/pre-component/handler-web-scope.md +0 -29
  139. package/.docs/possible-components/pre-component/unified-protocol.md +0 -89
  140. package/.docs/prefer-openrouter-routing-policy.md +0 -114
  141. package/.docs/questions-for-ai-skills.md +0 -123
  142. package/.docs/realtime-narrixing-gap-analysis.md +0 -40
  143. package/.docs/realtime-narrixing.md +0 -433
  144. package/.docs/run-context-object.md +0 -32
  145. package/.docs/session-id-usage.md +0 -26
  146. package/.docs/skill-library-spec.md +0 -249
  147. package/.docs/synthesized-context-strategy-spec.md +0 -906
  148. package/.docs/upstream-issue/2026-03-21_woroces-ai-tasks_ISSUE-006_web-scope-question-from-cni-entity.md +0 -46
  149. package/.docs/web-scopper-embed.md +0 -93
  150. package/.docs/xynthesis-wiring-and-io.md +0 -12
  151. package/documenations/activix-feature-request-identity.md +0 -123
  152. package/documenations/bug-report-xynthesis-and-synthesis-call.md +0 -217
  153. package/documenations/feature-request-ai-skills-raw-template-access.md +0 -82
  154. package/documenations/feature-request-athenix-core-directive.md +0 -145
  155. package/documenations/feature-request-athenix-token-extraction.md +0 -124
  156. package/documenations/funcx-upstream-github-issues-draft.md +0 -153
  157. package/documenations/identity-metadata-contract.md +0 -165
  158. package/documenations/run-task-single-run-checklist.md +0 -109
  159. package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-1-no-concrete-wire-in-graph-plans.md +0 -93
  160. package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-2-skillModel-profile-only-at-storage.md +0 -88
  161. package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-3-reject-concrete-models-in-catalog-rows.md +0 -76
  162. package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-1-suggested-profile-in-catalogs.md +0 -96
  163. package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-2-graph-engine-failure-phase-attribution.md +0 -92
  164. package/documenations/sessions/2026-06-08-subnets-model-resolution/INVESTIGATION-original-bug.md +0 -182
  165. package/documenations/sessions/2026-06-08-subnets-model-resolution/PROBLEM.md +0 -236
  166. package/documenations/sessions/2026-06-08-subnets-model-resolution/README.md +0 -11
  167. package/documenations/sessions/2026-06-08-subnets-model-resolution/funcx-test-resolveModel.cheapDefaultWireSlug.test.ts +0 -117
  168. package/documenations/upstream-feature-requests/ai-tasks-wrap-up-after-upstream.md +0 -129
  169. package/documenations/upstream-feedback-request-shape-clarification.md +0 -101
  170. package/documenations/web-context-precedence.md +0 -33
  171. package/documenations/xynthesis-activix-telemetry.md +0 -28
@@ -1,39 +0,0 @@
1
- taken from client.ts
2
-
3
-
4
-
5
- /**
6
- * Executes a task with a specific execution strategy.
7
- *
8
- * WHY: Allows for more complex execution logic (e.g. multi-step,
9
- * tool-calling, direct pass-through) while maintaining a consistent API.
10
- * Now includes two-step context enrichment: memory scoping + context generation.
11
- */
12
- async runTask<TParsed = any>(input: RunTaskRequest): Promise<RunSkillResponse<TParsed>> {
13
- // Extract taskId from skillKey (remove "tasks/" prefix if present, or use skillKey as-is)
14
- const taskId = input.skillKey.replace(/^tasks\//, '');
15
-
16
- // Build memory bundle
17
- const memoryBundle = {
18
- jobMemory: input.jobMemory,
19
- taskMemory: input.taskMemory
20
- };
21
-
22
- // Step 1: Enrich memories with scoping data
23
- const enrichedBundle = await this.enrichMemoriesWithScoping(taskId, 'task', memoryBundle);
24
-
25
- // Step 2: Generate context markdown
26
- const contextMarkdown = await this.generateContextMarkdown(taskId, 'task', enrichedBundle);
27
-
28
- // Create enriched input
29
- const enrichedInput: RunTaskRequest = {
30
- ...input,
31
- jobMemory: enrichedBundle.jobMemory,
32
- taskMemory: enrichedBundle.taskMemory,
33
- context: contextMarkdown
34
- };
35
-
36
- return this.taskExecutor.execute<TParsed>(enrichedInput, async (key) => {
37
- await this.registry.diagnose(key);
38
- });
39
- }
@@ -1,57 +0,0 @@
1
- import { BaseClient } from "./base-client";
2
- import { SkillExecutor } from "./skill-executor";
3
- import { ExecutionType, RunTaskRequest, RunSkillResponse } from "../types";
4
-
5
- /**
6
- * TaskExecutor
7
- *
8
- * WHY: This class handles the "orchestration" of tasks which can have
9
- * different execution strategies (ExecutionType). It currently supports
10
- * 'direct' execution which simply delegates to the SkillExecutor.
11
- */
12
- export class TaskExecutor extends BaseClient {
13
- private skillExecutor: SkillExecutor;
14
-
15
- constructor(gateway: any, logger: any, skillExecutor: SkillExecutor) {
16
- super(gateway, logger);
17
- this.skillExecutor = skillExecutor;
18
- }
19
-
20
- /**
21
- * Executes a task based on its execution type.
22
- *
23
- * WHY: Centralized entry point for task-based execution.
24
- */
25
- async execute<TParsed = any>(
26
- taskRequest: RunTaskRequest,
27
- onNotFound?: (skillKey: string) => Promise<void>
28
- ): Promise<RunSkillResponse<TParsed>> {
29
- const { executionType, taskMemory, jobMemory, ...rest } = taskRequest;
30
-
31
- this.logger.info("[AI-SKILLS] runTask() entry", {
32
- skillKey: taskRequest.skillKey,
33
- executionType,
34
- jobId: taskRequest.jobId,
35
- identity: "runTask execute"
36
- });
37
-
38
- switch (executionType) {
39
- case ExecutionType.DIRECT:
40
- this.logger.info("[AI-SKILLS] Executing direct task (pass-through to skill)", {
41
- skillKey: taskRequest.skillKey,
42
- identity: "runTask direct"
43
- });
44
-
45
- return this.skillExecutor.execute<TParsed>({
46
- ...rest,
47
- taskMemory,
48
- jobMemory
49
- }, onNotFound);
50
-
51
- default:
52
- const errorMsg = `[AI-SKILLS] Unsupported execution type: ${executionType}`;
53
- this.logger.error(errorMsg, { identity: "runTask execute" });
54
- throw new Error(errorMsg);
55
- }
56
- }
57
- }
@@ -1,42 +0,0 @@
1
- import { XeonoxSkillsClient } from "./src/client";
2
- import { ExecutionType } from "./src/types";
3
- import * as dotenv from "dotenv";
4
-
5
- dotenv.config();
6
-
7
- async function testRunTask() {
8
- console.log("Starting runTask verification...");
9
-
10
- const client = new XeonoxSkillsClient({
11
- packageName: "TEST-TASK",
12
- enableContentRegistry: true,
13
- contentRegistryLocalPath: ".metadata"
14
- });
15
-
16
- try {
17
- console.log("Calling runTask with ExecutionType.DIRECT...");
18
- const response = await client.runTask({
19
- skillKey: "skills/professional-answer",
20
- executionType: ExecutionType.DIRECT,
21
- input: {
22
- question: "What is the capital of France?"
23
- },
24
- variables: {
25
- orgName: "TestOrg"
26
- }
27
- });
28
-
29
- console.log("Response received:");
30
- console.log(JSON.stringify(response, null, 2));
31
-
32
- if (response.skillKey === "skills/professional-answer") {
33
- console.log("SUCCESS: runTask returned the correct skillKey.");
34
- } else {
35
- console.log("FAILURE: runTask returned an incorrect skillKey.");
36
- }
37
- } catch (error) {
38
- console.error("Error during runTask execution:", error);
39
- }
40
- }
41
-
42
- testRunTask();
@@ -1,23 +0,0 @@
1
-
2
- export interface RunTaskRequest {
3
- skillKey: string; // "skills/professional-answer"
4
- input: Record<string, any> | string;
5
- /**
6
- * WHY: Alias for 'memory'. Contextual variables for the skill (e.g. orgName, tone).
7
- * Aligns with SkillMetadata concepts of required/optional variables.
8
- */
9
- variables?: Record<string, any>;
10
- context?: Record<string, any> | string;
11
- knowledge?: Record<string, any>;
12
- jobMemory?: JobHistory; // the history of all the tasks results so far from previous steps up to this task being executed ---> to the short term memory of the skill called
13
- taskMemory?: TaskHistory; // the skills that were exuectuted up to this task---> to the temporary memory of the skill called
14
-
15
- jobId?: string;
16
- agentId?: string;
17
- skillId?: string;
18
- masterSkillId?: string;
19
- masterSkillActivityId?: string;
20
- timeoutMs?: number;
21
- executionType: ExecutionType;
22
-
23
- }
@@ -1,40 +0,0 @@
1
- # Standard: Env-Ready Component (ERC)
2
-
3
- **Version**: 1.0.0
4
- **Drafting Agency**: Xeonox Architecture Team
5
- **Goal**: Zero-Config "Plug & Play" across the entire AI ecosystem.
6
-
7
- ## 1. Philosophy: "Plug & Play" (Zero-Config)
8
-
9
- Every component (SDK, Gateway, Provider) must be operational immediately upon installation if the host environment provides the necessary configuration. Explicit code-based configuration is the **Advanced Mode** fallback.
10
-
11
- ## 2. Mandatory Internal Behaviors
12
-
13
- ### 2.1 Auto-Discovery
14
- - Constructors **MUST** attempt to resolve state from `process.env` when no explicit configuration object is passed.
15
- - **Example**: `new AIGateway()` should find its own keys, database URIs, and registry settings without being told where they are in code.
16
-
17
- ### 2.2 Transitive Configuration (The Sum Principle)
18
- - A component's environment requirement is the **UNION** of its own required variables and the required variables of all components it utilizes.
19
- - **Example**: If `@xeonoces/ai-skills` uses `@athenices/ai-gateway`, the `ai-skills` `.env.example` must include all `GITHUB_*` keys (from gateway) AND its own unique keys.
20
-
21
- ### 2.3 Built-in Validation
22
- - Components **MUST** validate their configuration (whether from object or env) during initialization.
23
- - If a mandatory requirement is missing, it must throw a named error:
24
- - `[NAME] ERC_VALIDATION_ERROR: Missing [VARIABLE_NAME].`
25
-
26
- ## 3. Mandatory Documentation
27
-
28
- ### 3.1 The `.env.example` Standard
29
- Every repository **MUST** maintain a `.env.example` root file following this structure:
30
- - **Marker**: `[REQUIRED]` or `[OPTIONAL]`.
31
- - **Purpose**: Short description of the variable's impact.
32
- - **Source**: If the variable is required by a *dependency*, note which one (e.g., `[REQUIRED by AI-GATEWAY]`).
33
-
34
- ### 3.2 The README "Env-Ready" Badge
35
- READMEs must explicitly claim compliance:
36
- > 🚀 **Env-Ready (ERC)**: This component supports automatic zero-config initialization via environment variables.
37
-
38
- ## 4. Compliance Check (The "Bug" Rule)
39
-
40
- Failure of a component to auto-initialize when `.env` is correctly populated is no longer a "feature gap"—it is a **High-Priority Bug** (ERC Policy Violation). Reports should be filed with the `erc-violation` label.
@@ -1,76 +0,0 @@
1
- # `runTask` architecture (ai-tasks)
2
-
3
- High-level map only. Details live in the linked docs below.
4
-
5
- **Component:** [`@exellix/xynthesis`](https://www.npmjs.com/package/@exellix/xynthesis) is the LLM package ai-tasks calls for PRE/POST pipeline steps. It is **not** the same as the request field `xynthesized` (graph memory buckets).
6
-
7
- ---
8
-
9
- ## Block diagram
10
-
11
- ```
12
- RunTaskRequest
13
-
14
-
15
- ┌─────────────────┐
16
- │ runTask() │
17
- └────────┬────────┘
18
-
19
- ┌────┴────┐
20
- │ │
21
- ▼ ▼
22
- local continue
23
- task (LLM path)
24
- │ │
25
- │ ┌────┴────────────────────────────────────┐
26
- │ │ │
27
- │ ▼ │
28
- │ NARRIX pre-processor (optional) │ → [narrix.md](./narrix.md)
29
- │ │ may include web scoping │ → [web-scoping.md](./web-scoping.md)
30
- │ ▼ │
31
- │ executionPipeline PRE (optional) │
32
- │ └─ synthesized-context │ → [xynthesis-pre.md](./xynthesis-pre.md)
33
- │ calls @exellix/xynthesis │
34
- │ ▼ │
35
- │ MAIN — @exellix/ai-skills runSkill │ (not documented here)
36
- │ ▼ │
37
- │ executionPipeline POST (optional) │
38
- │ └─ audit / polish │ → [xynthesis-post.md](./xynthesis-post.md)
39
- │ calls @exellix/xynthesis │
40
- │ ▼ │
41
- └────┴─────────────────────────────────────────┘
42
-
43
-
44
- RunTaskResponse
45
- ```
46
-
47
- ---
48
-
49
- ## Focused documentation
50
-
51
- | Doc | Scope |
52
- |-----|--------|
53
- | [xynthesis-pre.md](./xynthesis-pre.md) | PRE `synthesized-context` — how ai-tasks calls **xynthesis** before MAIN |
54
- | [xynthesis-post.md](./xynthesis-post.md) | POST `audit` / `polish` — how ai-tasks calls **xynthesis** after MAIN |
55
- | [narrix.md](./narrix.md) | NARRIX pre-processor — ingest, runner, `_narrix` attachment (no xynthesis) |
56
- | [web-scoping.md](./web-scoping.md) | Web scoper — `executionMemory.webContext` (no xynthesis) |
57
-
58
- ---
59
-
60
- ## Graph-engine authoring (model vs runtime)
61
-
62
- Each flow doc ends with two sections:
63
-
64
- | Section | Contract |
65
- |---------|----------|
66
- | **TaskNode model** | Static `TaskNode` / `taskConfiguration` fields graph-engine compiles into `RunTaskRequest` |
67
- | **TaskNode runtime** | Per-run `GraphRuntimeObject.nodes[nodeId]` and run-scoped memory that affect that step |
68
-
69
- Full graph contracts (graph-engine repo): **Task Node Model Object Format**, **Task Node Runtime Object Format**.
70
-
71
- ---
72
-
73
- ## Normative contracts (outside `.docs`)
74
-
75
- - [RUNTASK_REQUEST.md](../../RUNTASK_REQUEST.md) — request/response wire shape
76
- - [documenations/synthesized-context-guide.md](../../documenations/synthesized-context-guide.md) — PRE step config reference
@@ -1,124 +0,0 @@
1
- # NARRIX pre-processor
2
-
3
- How `@exellix/ai-tasks` runs **NARRIX** before MAIN. This path does **not** call **xynthesis**.
4
-
5
- For web enrichment after NARRIX, see [web-scoping.md](./web-scoping.md).
6
-
7
- ---
8
-
9
- ## When it runs
10
-
11
- - `RunTaskRequest.narrix` is set (`NarrixPreProcessorConfig`)
12
- - Runs early in `runTask()`, before local-task check’s LLM path and before pipeline PRE
13
- - Separate path: `narrixMode: "handler"` + `narrixInput` (structured handler, not the same as `request.narrix` pre-processor)
14
-
15
- ---
16
-
17
- ## Request
18
-
19
- ```typescript
20
- narrix?: {
21
- datasetId: string; // required
22
- attachToField?: string; // default "_narrix"
23
- enableWebScope?: boolean; // default false → see web-scoping.md
24
- deterministicSort?: boolean;
25
- // web scope templates / questions when enableWebScope: true
26
- }
27
- ```
28
-
29
- Record source: adapted from `jobMemory` / `executionMemory` / `input` via `@exellix/xmemory-narrix-adapter`.
30
-
31
- ---
32
-
33
- ## Execution flow
34
-
35
- ```
36
- runTask()
37
- → adaptMemoryToNarrixInput(...)
38
- → narrixRunHandler({ input, ctx })
39
- → @exellix/narrix-ingest (CNI)
40
- → @exellix/narrix-runner
41
- → buildNarrixAttachment(result)
42
- → executionMemory[attachToField] = attachment
43
- → jobMemory._narrix = attachment (mirror)
44
- → optional web scoping → executionMemory.webContext
45
- → continue with same RunTaskRequest
46
- ```
47
-
48
- Implementation: `src/core/task-sdk.ts` (NARRIX block), `src/narrix/task.ts`, `src/narrix/buildNarrixAttachment.ts`.
49
-
50
- ---
51
-
52
- ## Context passed to handler
53
-
54
- `ctx` includes: `skillKey`, memories, `variables`, `xynthesized`, `smartInput`, graph ids — same top-level fields as the request (no xynthesis).
55
-
56
- ---
57
-
58
- ## Downstream use
59
-
60
- | Consumer | Uses NARRIX output |
61
- |----------|-------------------|
62
- | MAIN context generation | `buildNarrixPreProcessorContextMarkdown` from `executionMemory._narrix` when `includeContextInPrompt` |
63
- | PRE xynthesis | Narrix markdown in `resolveSourceMaterial*` when `contextSourcePolicy` includes narrix — [xynthesis-pre.md](./xynthesis-pre.md) |
64
- | `taskMemory.narrix` | Handler mode / legacy narrix-then-direct |
65
-
66
- ---
67
-
68
- ## Failure
69
-
70
- NARRIX pre-processor failure **throws** (task does not continue). Web scoping failure is **non-fatal** (see [web-scoping.md](./web-scoping.md)).
71
-
72
- ---
73
-
74
- ## Packages (not xynthesis)
75
-
76
- - `@exellix/narrix-ingest`, `@exellix/narrix-runner`, `@exellix/narrix-cni`
77
- - `@exellix/xmemory-narrix-adapter`
78
-
79
- ---
80
-
81
- ## TaskNode model (graph authoring)
82
-
83
- NARRIX config belongs on **`taskConfiguration`**, not `metadata`.
84
-
85
- | TaskNode field | Role for NARRIX |
86
- |----------------|-----------------|
87
- | `taskConfiguration.narrix` | **`RunTaskRequest.narrix`**: `datasetId`, `attachToField`, `enableWebScope`, web scope templates/questions, `deterministicSort`, … |
88
- | `taskConfiguration.narrixMode` | `"preprocessor"` (default path: `request.narrix`) vs `"handler"` (`narrixInput` + handler pipeline). |
89
- | `taskConfiguration.narrixInput` | Handler mode structured input (may use `$path` into `jobMemory`). |
90
- | `taskConfiguration.aiTaskProfile.webScoping` | Canonical authoring intent for web; graph-engine forwards into resolved `narrix` payload (see [web-scoping.md](./web-scoping.md)). |
91
- | `node.inputsConfig` | Binds runtime payload paths (e.g. `executionMemoryPath: "input.raw"`) that the adapter prefers when locating a record. |
92
- | `node.taskVariable` | May supply `question` / literals compiled into `RunTaskRequest.input` for web question templates. |
93
- | `node.taskKnowledge` | Static refs → outbound `taskMemory.knowledge` copy for this node (not NARRIX ingest itself). |
94
- | `node.memory` | Rare per-node memory override on the model; forwarded if graph-engine maps it. |
95
-
96
- **Forbidden:** `metadata.narrix` — use `taskConfiguration.narrix`.
97
-
98
- NARRIX does **not** read `node.executionPipeline` or `modelConfig` (no LLM in the ingest/runner path).
99
-
100
- ---
101
-
102
- ## TaskNode runtime (per-run overrides)
103
-
104
- | Runtime field | Role for NARRIX |
105
- |---------------|-----------------|
106
- | `runtime.jobMemory` | Record discovery via `@exellix/xmemory-narrix-adapter` (`jobMemory.record`, `currentRecord`, …). |
107
- | `runtime.taskMemory` | Handler / legacy paths; may hold prior `narrix` entries. |
108
- | `runtime.executionMemory` | **Written by ai-tasks:** `executionMemory[attachToField]` (`_narrix`), optional `webContext`. **Read:** `input`, `inputs`, paths from `inputsConfig`. |
109
- | `runtime.input` / `runtime.inputs` | Mirrored into `executionMemory` before the pre-processor runs. |
110
- | `runtime.nodes[nodeId].modelConfig` | **Does not affect NARRIX** (ingest/runner are deterministic; no xynthesis call). |
111
-
112
- **Not on node runtime:** `datasetId`, `enableWebScope`, or attach field — those are model/`taskConfiguration` only.
113
-
114
- ---
115
-
116
- ## Source files
117
-
118
- | File | Role |
119
- |------|------|
120
- | `src/core/task-sdk.ts` | Pre-processor orchestration |
121
- | `src/narrix/task.ts` | `narrixRunHandler` |
122
- | `src/narrix/narrixContextMarkdown.ts` | Context markdown for MAIN / synthesis |
123
- | `src/narrix/buildNarrixAttachment.ts` | Attachment shape |
124
- | `src/types/task-types.ts` | `NarrixPreProcessorConfig` |
@@ -1,135 +0,0 @@
1
- # Web scoping
2
-
3
- How `@exellix/ai-tasks` fills **`executionMemory.webContext`** using **`@exellix/narrix-web-scoper`**. This path does **not** call **xynthesis**.
4
-
5
- For how web markdown is consumed in PRE synthesis, see [xynthesis-pre.md](./xynthesis-pre.md).
6
-
7
- ---
8
-
9
- ## When it runs
10
-
11
- - Inside the **NARRIX pre-processor** path (`request.narrix` set)
12
- - `narrix.enableWebScope === true`
13
- - After NARRIX runner succeeds (CNI + entity)
14
- - Requires **`TAVILY_API_KEY`** (via `@x12i/search-adapter`)
15
-
16
- Skipped when:
17
-
18
- - `enableWebScope` is false or omitted
19
- - `skipWebScopeWhenExternalWebMarkdownPresent === true` and caller already set `executionMemory.webContextMarkdown`
20
-
21
- ---
22
-
23
- ## Request knobs
24
-
25
- On `RunTaskRequest.narrix`:
26
-
27
- | Field | Role |
28
- |-------|------|
29
- | `enableWebScope` | Opt-in boolean |
30
- | `webScoping` | Per-request scoper config (snippets, caps) |
31
- | `webScopeTemplates` | Template-driven scope |
32
- | `webScopeQuestionTemplate` | Question template for AI-driven questions |
33
- | `webScopeObjects` | Scope targets |
34
- | `webScopeQuestions` | Explicit question-pack mode |
35
-
36
- ---
37
-
38
- ## Execution flow
39
-
40
- ```
41
- NARRIX success
42
- → resolveWebScopeQuestionAndTemplates(...)
43
- → runWebScope / runWebScopeQuestionPack (src/narrix/webScoper.ts)
44
- → createWebScoper({ searchAdapter: Tavily })
45
- → @exellix/narrix-web-scoper
46
- → executionMemory.webContext = WebScoperResult
47
- ```
48
-
49
- Implementation: `src/core/task-sdk.ts`, `src/narrix/webScoper.ts`, `src/narrix/buildWebScopeScopeInput.ts`.
50
-
51
- ---
52
-
53
- ## Result shape
54
-
55
- Stored at **`executionMemory.webContext`**:
56
-
57
- - `available: true` → `context` with `sources`, `findings`, `scopes`, …
58
- - `available: false` → `reason` / `error` (task still continues)
59
-
60
- Always written when scoping was attempted (lenient — NARRIX attachment is kept).
61
-
62
- ---
63
-
64
- ## Downstream consumers
65
-
66
- | Consumer | Behavior |
67
- |----------|----------|
68
- | MAIN context | `buildWebContextEvidenceMarkdown` appended when web hit |
69
- | PRE xynthesis | Web section in `resolveSourceMaterial` / question-driven `web` source |
70
- | Question-driven PRE | Per-question `source: "web"` reads `executionMemory.webContext` |
71
-
72
- Raw `webContext` JSON is **not** dumped into memory JSON for synthesis; it is rendered to markdown excerpts (`SynthesisConfig.webEvidence` caps dedupe/clean text).
73
-
74
- ---
75
-
76
- ## Activix
77
-
78
- `webScopeActivixCorrelationPatch` links scoping to `jobId` / `taskId` for telemetry.
79
-
80
- ---
81
-
82
- ## Failure stance
83
-
84
- Web scoping errors are logged; NARRIX output and task execution continue. Synthesis may record `webUnavailableReason` in question-driven answers.
85
-
86
- ---
87
-
88
- ## TaskNode model (graph authoring)
89
-
90
- Web scoping is configured on the **NARRIX** block graph-engine forwards to `RunTaskRequest.narrix`.
91
-
92
- | TaskNode field | Role for web scoping |
93
- |----------------|----------------------|
94
- | `taskConfiguration.aiTaskProfile.webScoping` | **Canonical** authoring path for web intent; engine merges into outbound `narrix` / scoping options. |
95
- | `taskConfiguration.narrix.enableWebScope` | Opt-in boolean on the forwarded `RunTaskRequest.narrix` (default false). |
96
- | `taskConfiguration.narrix.webScoping` | Per-request scoper caps/snippets (`WebScoperConfig.scoping`). |
97
- | `taskConfiguration.narrix.webScopeTemplates` | Template-driven scope when set. |
98
- | `taskConfiguration.narrix.webScopeQuestionTemplate` | AI-driven question generation template. |
99
- | `taskConfiguration.narrix.webScopeObjects` | Scope targets for the scoper. |
100
- | `taskConfiguration.narrix.webScopeQuestions` | Explicit question-pack mode (`{ id?, question, source? }[]`). |
101
- | `node.taskVariable.question` | Feeds scope question resolution when templates reference the task question. |
102
- | `taskConfiguration.narrix.skipWebScopeWhenExternalWebMarkdownPresent` | Skip scoper when caller already supplies external web markdown at runtime. |
103
-
104
- Requires `taskConfiguration.narrix` (or equivalent forwarded `request.narrix`) with NARRIX pre-processor enabled — web scoping does not run standalone.
105
-
106
- **Forbidden:** `metadata.webScoping` — use `taskConfiguration.aiTaskProfile.webScoping` / `taskConfiguration.narrix`.
107
-
108
- ---
109
-
110
- ## TaskNode runtime (per-run overrides)
111
-
112
- | Runtime field | Role for web scoping |
113
- |---------------|------------------------|
114
- | `runtime.executionMemory.webContext` | **Output** of the scoper for this run (`WebScoperResult`: `available`, `context` \| `reason`). |
115
- | `runtime.executionMemory.webContextMarkdown` | Caller-provided markdown; when set + `skipWebScopeWhenExternalWebMarkdownPresent`, scoper may be skipped. |
116
- | `runtime.executionMemory` (entity context) | NARRIX entity/CNI from prior step in the same `runTask` — scoper input after NARRIX success. |
117
- | `runtime.input` | Question/entity hints via `resolveWebScopeQuestionAndTemplates`. |
118
- | `runtime.nodes[nodeId].modelConfig` | **Does not affect** web scoping (Tavily search + scoper, no xynthesis). |
119
-
120
- **Not on node runtime:** `enableWebScope`, templates, or question packs — model only.
121
-
122
- Host must supply **`TAVILY_API_KEY`** in the environment; not a TaskNode field.
123
-
124
- ---
125
-
126
- ## Source files
127
-
128
- | File | Role |
129
- |------|------|
130
- | `src/narrix/webScoper.ts` | Scoper singleton, `runWebScope*` |
131
- | `src/narrix/webContextMarkdown.ts` | Markdown for context / synthesis |
132
- | `src/narrix/buildWebScopeScopeInput.ts` | Question/template resolution |
133
- | `src/synthesis/resolveSourceMaterial.ts` | Policy includes web markdown |
134
-
135
- Extended reference: [documenations/web-scoping-in-ai-tasks.md](../documenations/web-scoping-in-ai-tasks.md).