@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.
Files changed (252) hide show
  1. package/CHANGELOG.md +34 -4
  2. package/README.md +2 -2
  3. package/RUNTASK_REQUEST.md +32 -17
  4. package/dist/builders/task-request-builder.d.ts.map +1 -1
  5. package/dist/builders/task-request-builder.js +2 -1
  6. package/dist/builders/task-request-builder.js.map +1 -1
  7. package/dist/compile/compileTaskConfiguration.d.ts.map +1 -1
  8. package/dist/compile/compileTaskConfiguration.js +3 -0
  9. package/dist/compile/compileTaskConfiguration.js.map +1 -1
  10. package/dist/core/task-sdk.d.ts.map +1 -1
  11. package/dist/core/task-sdk.js +148 -180
  12. package/dist/core/task-sdk.js.map +1 -1
  13. package/dist/errors/runTaskExecutionError.d.ts.map +1 -1
  14. package/dist/errors/runTaskExecutionError.js +0 -2
  15. package/dist/errors/runTaskExecutionError.js.map +1 -1
  16. package/dist/index.d.ts +0 -4
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +0 -4
  19. package/dist/index.js.map +1 -1
  20. package/dist/invocation/types.d.ts +1 -1
  21. package/dist/narrix/applyWebScopeToRequest.d.ts +9 -0
  22. package/dist/narrix/applyWebScopeToRequest.d.ts.map +1 -0
  23. package/dist/narrix/applyWebScopeToRequest.js +156 -0
  24. package/dist/narrix/applyWebScopeToRequest.js.map +1 -0
  25. package/dist/narrix/narrixUnitExecution.d.ts.map +1 -1
  26. package/dist/narrix/narrixUnitExecution.js +8 -3
  27. package/dist/narrix/narrixUnitExecution.js.map +1 -1
  28. package/dist/node-execution/buildRequestFromNodePlan.d.ts +6 -0
  29. package/dist/node-execution/buildRequestFromNodePlan.d.ts.map +1 -1
  30. package/dist/node-execution/buildRequestFromNodePlan.js +4 -16
  31. package/dist/node-execution/buildRequestFromNodePlan.js.map +1 -1
  32. package/dist/node-execution/compileProfessionalAnswerRequest.d.ts +2 -0
  33. package/dist/node-execution/compileProfessionalAnswerRequest.d.ts.map +1 -0
  34. package/dist/node-execution/compileProfessionalAnswerRequest.js +4 -0
  35. package/dist/node-execution/compileProfessionalAnswerRequest.js.map +1 -0
  36. package/dist/node-execution/createNodeExecutionHost.d.ts.map +1 -1
  37. package/dist/node-execution/createNodeExecutionHost.js +97 -26
  38. package/dist/node-execution/createNodeExecutionHost.js.map +1 -1
  39. package/dist/node-execution/dispatchExecutionUnit.d.ts.map +1 -1
  40. package/dist/node-execution/dispatchExecutionUnit.js +4 -2
  41. package/dist/node-execution/dispatchExecutionUnit.js.map +1 -1
  42. package/dist/node-execution/orchestration/runPostOrchestration.d.ts +11 -0
  43. package/dist/node-execution/orchestration/runPostOrchestration.d.ts.map +1 -0
  44. package/dist/node-execution/orchestration/runPostOrchestration.js +123 -0
  45. package/dist/node-execution/orchestration/runPostOrchestration.js.map +1 -0
  46. package/dist/node-execution/orchestration/runPreOrchestration.d.ts +3 -0
  47. package/dist/node-execution/orchestration/runPreOrchestration.d.ts.map +1 -0
  48. package/dist/node-execution/orchestration/runPreOrchestration.js +110 -0
  49. package/dist/node-execution/orchestration/runPreOrchestration.js.map +1 -0
  50. package/dist/node-execution/orchestration/shardContext.d.ts +12 -0
  51. package/dist/node-execution/orchestration/shardContext.d.ts.map +1 -0
  52. package/dist/node-execution/orchestration/shardContext.js +71 -0
  53. package/dist/node-execution/orchestration/shardContext.js.map +1 -0
  54. package/dist/node-execution/orchestration/types.d.ts +21 -0
  55. package/dist/node-execution/orchestration/types.d.ts.map +1 -0
  56. package/dist/node-execution/orchestration/types.js +2 -0
  57. package/dist/node-execution/orchestration/types.js.map +1 -0
  58. package/dist/node-execution/rejectForbiddenWireFields.d.ts +2 -0
  59. package/dist/node-execution/rejectForbiddenWireFields.d.ts.map +1 -1
  60. package/dist/node-execution/rejectForbiddenWireFields.js +42 -7
  61. package/dist/node-execution/rejectForbiddenWireFields.js.map +1 -1
  62. package/dist/observability/classifyRunTaskFailure.d.ts.map +1 -1
  63. package/dist/observability/classifyRunTaskFailure.js +4 -3
  64. package/dist/observability/classifyRunTaskFailure.js.map +1 -1
  65. package/dist/observability/logRunTaskFailure.d.ts.map +1 -1
  66. package/dist/observability/logRunTaskFailure.js +0 -2
  67. package/dist/observability/logRunTaskFailure.js.map +1 -1
  68. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts +19 -3
  69. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts.map +1 -1
  70. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js +7 -1
  71. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js.map +1 -1
  72. package/dist/post-steps/audit/loadAuditTemplates.d.ts +2 -55
  73. package/dist/post-steps/audit/loadAuditTemplates.d.ts.map +1 -1
  74. package/dist/post-steps/audit/loadAuditTemplates.js +3 -38
  75. package/dist/post-steps/audit/loadAuditTemplates.js.map +1 -1
  76. package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts +8 -0
  77. package/dist/post-steps/audit/parseAuditFuncxOutput.d.ts.map +1 -0
  78. package/dist/post-steps/audit/parseAuditFuncxOutput.js +62 -0
  79. package/dist/post-steps/audit/parseAuditFuncxOutput.js.map +1 -0
  80. package/dist/post-steps/audit/parseAuditOutput.d.ts +2 -0
  81. package/dist/post-steps/audit/parseAuditOutput.d.ts.map +1 -1
  82. package/dist/post-steps/audit/parseAuditOutput.js +56 -0
  83. package/dist/post-steps/audit/parseAuditOutput.js.map +1 -1
  84. package/dist/post-steps/audit/runAudit.d.ts.map +1 -1
  85. package/dist/post-steps/audit/runAudit.js +53 -113
  86. package/dist/post-steps/audit/runAudit.js.map +1 -1
  87. package/dist/post-steps/audit/runAuditFuncxCall.d.ts +18 -0
  88. package/dist/post-steps/audit/runAuditFuncxCall.d.ts.map +1 -0
  89. package/dist/post-steps/audit/runAuditFuncxCall.js +59 -0
  90. package/dist/post-steps/audit/runAuditFuncxCall.js.map +1 -0
  91. package/dist/synthesis/resolveSourceMaterial.d.ts.map +1 -1
  92. package/dist/synthesis/resolveSourceMaterial.js +14 -0
  93. package/dist/synthesis/resolveSourceMaterial.js.map +1 -1
  94. package/dist/synthesis/runStructuredSynthesisRobust.d.ts.map +1 -1
  95. package/dist/synthesis/runStructuredSynthesisRobust.js +24 -4
  96. package/dist/synthesis/runStructuredSynthesisRobust.js.map +1 -1
  97. package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts +3 -0
  98. package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.d.ts.map +1 -1
  99. package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js +28 -4
  100. package/dist/task-strategies/buildTaskStrategyCatalogDescriptor.js.map +1 -1
  101. package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts +4 -4
  102. package/dist/task-strategies/canonicalInputExecutionStrategies.d.ts.map +1 -1
  103. package/dist/task-strategies/canonicalInputExecutionStrategies.js +2 -1
  104. package/dist/task-strategies/canonicalInputExecutionStrategies.js.map +1 -1
  105. package/dist/task-strategies/canonicalOrchestrationStrategies.d.ts +42 -0
  106. package/dist/task-strategies/canonicalOrchestrationStrategies.d.ts.map +1 -0
  107. package/dist/task-strategies/canonicalOrchestrationStrategies.js +47 -0
  108. package/dist/task-strategies/canonicalOrchestrationStrategies.js.map +1 -0
  109. package/dist/task-strategies/canonicalTaskStrategies.d.ts +2 -1
  110. package/dist/task-strategies/canonicalTaskStrategies.d.ts.map +1 -1
  111. package/dist/task-strategies/canonicalTaskStrategies.js +2 -1
  112. package/dist/task-strategies/canonicalTaskStrategies.js.map +1 -1
  113. package/dist/task-strategies/constants.d.ts +9 -1
  114. package/dist/task-strategies/constants.d.ts.map +1 -1
  115. package/dist/task-strategies/constants.js +9 -1
  116. package/dist/task-strategies/constants.js.map +1 -1
  117. package/dist/task-strategies/index.d.ts +5 -3
  118. package/dist/task-strategies/index.d.ts.map +1 -1
  119. package/dist/task-strategies/index.js +4 -3
  120. package/dist/task-strategies/index.js.map +1 -1
  121. package/dist/task-strategies/listAiTaskStrategies.d.ts +10 -1
  122. package/dist/task-strategies/listAiTaskStrategies.d.ts.map +1 -1
  123. package/dist/task-strategies/listAiTaskStrategies.js +17 -2
  124. package/dist/task-strategies/listAiTaskStrategies.js.map +1 -1
  125. package/dist/types/task-types.d.ts +4 -11
  126. package/dist/types/task-types.d.ts.map +1 -1
  127. package/dist/utils/bridgeRunSkillGatewayMemory.d.ts.map +1 -1
  128. package/dist/utils/bridgeRunSkillGatewayMemory.js +1 -0
  129. package/dist/utils/bridgeRunSkillGatewayMemory.js.map +1 -1
  130. package/dist/utils/executionMemoryInputRecord.d.ts +12 -0
  131. package/dist/utils/executionMemoryInputRecord.d.ts.map +1 -0
  132. package/dist/utils/executionMemoryInputRecord.js +28 -0
  133. package/dist/utils/executionMemoryInputRecord.js.map +1 -0
  134. package/dist/utils/resolveAiProfileModel.d.ts +1 -1
  135. package/dist/utils/resolveAiProfileModel.d.ts.map +1 -1
  136. package/dist/utils/resolveRunTaskModelReferences.d.ts.map +1 -1
  137. package/dist/utils/resolveRunTaskModelReferences.js +0 -32
  138. package/dist/utils/resolveRunTaskModelReferences.js.map +1 -1
  139. package/dist/utils/runTaskRequestShape.d.ts.map +1 -1
  140. package/dist/utils/runTaskRequestShape.js +4 -26
  141. package/dist/utils/runTaskRequestShape.js.map +1 -1
  142. package/dist/utils/skillTemplateVariables.d.ts +3 -2
  143. package/dist/utils/skillTemplateVariables.d.ts.map +1 -1
  144. package/dist/utils/skillTemplateVariables.js +3 -2
  145. package/dist/utils/skillTemplateVariables.js.map +1 -1
  146. package/dist/validation/validateProfessionalAnswerContract.d.ts +8 -0
  147. package/dist/validation/validateProfessionalAnswerContract.d.ts.map +1 -0
  148. package/dist/validation/validateProfessionalAnswerContract.js +45 -0
  149. package/dist/validation/validateProfessionalAnswerContract.js.map +1 -0
  150. package/dist/validation/validateRunTaskConfig.d.ts.map +1 -1
  151. package/dist/validation/validateRunTaskConfig.js +3 -66
  152. package/dist/validation/validateRunTaskConfig.js.map +1 -1
  153. package/documenations/record-and-template-variables.md +21 -13
  154. package/documenations/run-task-execution-flow.md +1 -1
  155. package/documenations/skill-orchestration-strategy-cr-fr.md +147 -0
  156. package/documenations/upstream-feature-requests/README.md +9 -5
  157. package/documenations/upstream-feature-requests/ai-skills-orchestrator-invoke-contract-5.9.md +1 -1
  158. package/documenations/upstream-feature-requests/funcx-4.9.13-open-items.md +62 -0
  159. package/documenations/upstream-feature-requests/funcx-gap-analysis-cr-fr.md +401 -0
  160. package/documenations/upstream-feature-requests/funcx-pre-post-sidekick-actions.md +1 -0
  161. package/documenations/upstream-feature-requests/graph-engine-runtask-contract-alignment-investigation.md +370 -0
  162. package/documenations/upstream-feature-requests/xynthesis-ai-profiles-2.1-import-break.md +2 -2
  163. package/documenations/upstream-feature-requests/xynthesis-openrouter-wire-model-double-prefix-bug.md +1 -1
  164. package/documenations/upstream-feature-requests/xynthesis-orchestrator-invoke-contract-4.2.md +1 -1
  165. package/package.json +10 -9
  166. package/.docs/DOWNSTREAM_ENV.md +0 -42
  167. package/.docs/FEEDBACK_TO_CLIENT_DOWNSTREAM_FIXES.md +0 -64
  168. package/.docs/INTERMEDIATE_STEPS.md +0 -82
  169. package/.docs/activity-structure.md +0 -31
  170. package/.docs/ai-task-ai-scoping-spec.md +0 -338
  171. package/.docs/ai-tasks-model-profile-aliases-7x.md +0 -96
  172. package/.docs/blockers-and-issues.md +0 -346
  173. package/.docs/building-runTask-sdk.md +0 -659
  174. package/.docs/building-skill-execution-orchestrator.md +0 -968
  175. package/.docs/code-used-before/run-task.txt +0 -39
  176. package/.docs/code-used-before/task-executor.ts.old +0 -57
  177. package/.docs/code-used-before/test-run-task.ts.old +0 -42
  178. package/.docs/code-used-before/types.txt +0 -23
  179. package/.docs/env-ready-policy.md +0 -40
  180. package/.docs/flow-io/flow-README.md +0 -76
  181. package/.docs/flow-io/narrix.md +0 -124
  182. package/.docs/flow-io/web-scoping.md +0 -135
  183. package/.docs/flow-io/xynthesis-post.md +0 -154
  184. package/.docs/flow-io/xynthesis-pre.md +0 -181
  185. package/.docs/gap-analysis.md +0 -201
  186. package/.docs/integration-facts-ai-tasks.md +0 -109
  187. package/.docs/investigation/ai-skills.md +0 -170
  188. package/.docs/investigation/external-packages-assignments.md +0 -66
  189. package/.docs/investigation/integration-summary.md +0 -20
  190. package/.docs/investigation/narrix-catalox.md +0 -29
  191. package/.docs/investigation/workplan-close-graph-engine-gaps.md +0 -101
  192. package/.docs/logging-stack.md +0 -30
  193. package/.docs/memory-narrix-adapter-developer-guide.md +0 -402
  194. package/.docs/memory-narrix-adapter-requirements.md +0 -112
  195. package/.docs/narrix-context-consumption-gap.md +0 -184
  196. package/.docs/narrix-context-downstream-report.md +0 -30
  197. package/.docs/narrix-ingest-and-packs-library-spec.md +0 -240
  198. package/.docs/narrix-record-input-current-design.md +0 -48
  199. package/.docs/pacakge.md +0 -48
  200. package/.docs/possible-components/README.md +0 -11
  201. package/.docs/possible-components/integration/README.md +0 -10
  202. package/.docs/possible-components/integration/gaps-when-merging.md +0 -16
  203. package/.docs/possible-components/integration/platform.md +0 -54
  204. package/.docs/possible-components/integration/reintegrate-into-ai-tasks.md +0 -26
  205. package/.docs/possible-components/integration/roadmap-and-checklists.md +0 -54
  206. package/.docs/possible-components/post-component/README.md +0 -18
  207. package/.docs/possible-components/post-component/builder-guide.md +0 -175
  208. package/.docs/possible-components/post-component/gaps-and-artifacts.md +0 -52
  209. package/.docs/possible-components/post-component/handler-audit.md +0 -47
  210. package/.docs/possible-components/post-component/handler-polish.md +0 -41
  211. package/.docs/possible-components/post-component/unified-protocol.md +0 -59
  212. package/.docs/possible-components/pre-component/README.md +0 -22
  213. package/.docs/possible-components/pre-component/builder-guide.md +0 -127
  214. package/.docs/possible-components/pre-component/gaps-and-artifacts.md +0 -35
  215. package/.docs/possible-components/pre-component/handler-ai-scoping.md +0 -45
  216. package/.docs/possible-components/pre-component/handler-narrix-preprocessor.md +0 -49
  217. package/.docs/possible-components/pre-component/handler-narrix-system2.md +0 -35
  218. package/.docs/possible-components/pre-component/handler-synthesized-context.md +0 -65
  219. package/.docs/possible-components/pre-component/handler-web-scope.md +0 -29
  220. package/.docs/possible-components/pre-component/unified-protocol.md +0 -89
  221. package/.docs/prefer-openrouter-routing-policy.md +0 -114
  222. package/.docs/questions-for-ai-skills.md +0 -123
  223. package/.docs/realtime-narrixing-gap-analysis.md +0 -40
  224. package/.docs/realtime-narrixing.md +0 -433
  225. package/.docs/run-context-object.md +0 -32
  226. package/.docs/session-id-usage.md +0 -26
  227. package/.docs/skill-library-spec.md +0 -249
  228. package/.docs/synthesized-context-strategy-spec.md +0 -906
  229. package/.docs/upstream-issue/2026-03-21_woroces-ai-tasks_ISSUE-006_web-scope-question-from-cni-entity.md +0 -46
  230. package/.docs/web-scopper-embed.md +0 -93
  231. package/.docs/xynthesis-wiring-and-io.md +0 -12
  232. package/documenations/activix-feature-request-identity.md +0 -123
  233. package/documenations/bug-report-xynthesis-and-synthesis-call.md +0 -217
  234. package/documenations/feature-request-ai-skills-raw-template-access.md +0 -82
  235. package/documenations/feature-request-athenix-core-directive.md +0 -145
  236. package/documenations/feature-request-athenix-token-extraction.md +0 -124
  237. package/documenations/funcx-upstream-github-issues-draft.md +0 -153
  238. package/documenations/identity-metadata-contract.md +0 -165
  239. package/documenations/run-task-single-run-checklist.md +0 -109
  240. package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-1-no-concrete-wire-in-graph-plans.md +0 -93
  241. package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-2-skillModel-profile-only-at-storage.md +0 -88
  242. package/documenations/sessions/2026-06-08-subnets-model-resolution/CR-3-reject-concrete-models-in-catalog-rows.md +0 -76
  243. package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-1-suggested-profile-in-catalogs.md +0 -96
  244. package/documenations/sessions/2026-06-08-subnets-model-resolution/FR-2-graph-engine-failure-phase-attribution.md +0 -92
  245. package/documenations/sessions/2026-06-08-subnets-model-resolution/INVESTIGATION-original-bug.md +0 -182
  246. package/documenations/sessions/2026-06-08-subnets-model-resolution/PROBLEM.md +0 -236
  247. package/documenations/sessions/2026-06-08-subnets-model-resolution/README.md +0 -11
  248. package/documenations/sessions/2026-06-08-subnets-model-resolution/funcx-test-resolveModel.cheapDefaultWireSlug.test.ts +0 -117
  249. package/documenations/upstream-feature-requests/ai-tasks-wrap-up-after-upstream.md +0 -129
  250. package/documenations/upstream-feedback-request-shape-clarification.md +0 -101
  251. package/documenations/web-context-precedence.md +0 -33
  252. package/documenations/xynthesis-activix-telemetry.md +0 -28
@@ -1,31 +0,0 @@
1
- # Activity Structure (Activix)
2
-
3
- Activix activity records follow a layered structure:
4
-
5
- - **Lifecycle-owned fields** (managed by Activix):
6
- - identifiers (primary key / activity id)
7
- - `status` and lifecycle transitions
8
- - timing fields (`startTime`, `endTime`, `duration`)
9
- - error fields (via `failRecord`)
10
- - **Integrator-owned fields** (provided by the caller):
11
- - `runContext` (correlation envelope)
12
- - `outer` (required I/O payload tier)
13
- - optional `inner` (structured sub-steps / nested call payload)
14
-
15
- ## `outer` (required)
16
-
17
- `outer` is the canonical “activity I/O” tier and should include:
18
-
19
- - `input`: domain input payload
20
- - `output`: domain output payload (or omitted/null until completion)
21
- - `metadata`: object for domain tags (type, version, sizes, routing keys, etc.)
22
-
23
- ## `inner` (optional)
24
-
25
- Use `inner` for nested request/response payloads when you want structured visibility into sub-work (e.g. a tool call inside a broader activity).
26
-
27
- ## Ownership rules
28
-
29
- - Do **not** manually set lifecycle-owned fields (`status`, timestamps, ids).
30
- - Avoid duplicating correlation identifiers in multiple places; prefer `runContext`.
31
-
@@ -1,338 +0,0 @@
1
- # AI Task Input Scoping (aiScoping) — Detailed Specification
2
-
3
- ## 1) Purpose
4
-
5
- Add an **optional** pre-processing mode for `runTask` that can scope large memory content into compact, task-focused snippets before the main AI task call.
6
-
7
- The mode introduces a new request field:
8
-
9
- - `aiScoping?: Array<{ source: string; instructions: string; targetToken: string }>`
10
-
11
- Each `aiScoping` item triggers an **internal AI call** (in parallel), which:
12
-
13
- 1. Reads data from memory using `source`.
14
- 2. Applies `instructions` to that source content.
15
- 3. Writes result into `aiScoped` as:
16
- - `{ token: targetToken, scopedInfo: string }`
17
-
18
- The final main AI task then receives `aiScoped` as part of its input/context.
19
-
20
- ---
21
-
22
- ## 2) Goals
23
-
24
- - Reduce prompt bloat when memory has large/irrelevant content.
25
- - Allow targeted extraction/summary/selection from specific memory paths.
26
- - Run scoping calls in parallel to minimize added latency.
27
- - Keep this behavior strictly optional and backward compatible.
28
-
29
- ## 3) Non-goals
30
-
31
- - No changes to existing behavior when `aiScoping` is not provided.
32
- - No mandatory schema migration for existing callers.
33
- - No change to current Narrix flow semantics.
34
- - No implementation in this phase (spec/design only).
35
-
36
- ---
37
-
38
- ## 4) API Contract Changes
39
-
40
- ## 4.1 Request (new optional field)
41
-
42
- Add to `RunTaskRequest`:
43
-
44
- ```ts
45
- type AIScopingInstruction = {
46
- source: string; // path to memory value
47
- instructions: string; // prompt for internal scoping call
48
- targetToken: string; // label for downstream use
49
- };
50
-
51
- interface RunTaskRequest {
52
- // ...existing fields
53
- aiScoping?: AIScopingInstruction[];
54
- }
55
- ```
56
-
57
- ### Field semantics
58
-
59
- - `source`
60
- - Dot-path to a memory value, including nested properties.
61
- - Must resolve to a value in the memory bundle available during execution.
62
- - `instructions`
63
- - Natural-language guidance for the internal scoping call.
64
- - Should describe desired output format/constraints.
65
- - `targetToken`
66
- - Logical name of the scoped result.
67
- - Used in output as `aiScoped[].token`.
68
-
69
- ## 4.2 Derived runtime output (new runtime data)
70
-
71
- During execution (when `aiScoping` is provided), construct:
72
-
73
- ```ts
74
- type AIScopedItem = {
75
- token: string;
76
- scopedInfo: string;
77
- };
78
-
79
- type AIScoped = AIScopedItem[];
80
- ```
81
-
82
- Result is injected into the main task execution input/context as:
83
-
84
- - `input.aiScoped: AIScoped` (preferred canonical location), and/or
85
- - equivalent context markdown section (optional, implementation choice).
86
-
87
- Note: This does **not** require changing external `RunTaskResponse` shape.
88
-
89
- ---
90
-
91
- ## 5) Source Resolution Rules
92
-
93
- `source` must resolve from execution memory roots. Canonical roots:
94
-
95
- - `jobMemory.*`
96
- - `taskMemory.*`
97
- - `executionMemory.*`
98
-
99
- Examples:
100
-
101
- - `jobMemory.customerProfile`
102
- - `jobMemory.records.current.incidents`
103
- - `taskMemory.previousFindings`
104
- - `executionMemory.executionLog.steps`
105
-
106
- ### Resolution behavior
107
-
108
- 1. If `source` is missing/invalid/unresolvable:
109
- - The item is treated as failed scoping item.
110
- - It does not break full task execution (default tolerant mode).
111
- 2. If resolved value is object/array:
112
- - Serialize to deterministic JSON string for internal scoping input.
113
- 3. If resolved value is primitive:
114
- - Convert to string.
115
- 4. If resolved value is empty:
116
- - Proceed with empty content marker or skip item (implementation choice, see error policy).
117
-
118
- ---
119
-
120
- ## 6) Execution Flow (Normative)
121
-
122
- When `aiScoping` exists and has items:
123
-
124
- 1. Build the enriched memory bundle as usual (current behavior unchanged).
125
- 2. For each `aiScoping` item:
126
- - Resolve `source` from memory bundle.
127
- - Build internal AI call input with:
128
- - resolved source content
129
- - item `instructions`
130
- - output requirement: plain text scoped result
131
- 3. Dispatch all internal AI scoping calls **in parallel**.
132
- 4. Collect all fulfilled results into:
133
- - `aiScoped: Array<{ token, scopedInfo }>`
134
- 5. Inject `aiScoped` into main task input/context.
135
- 6. Execute main task call as normal.
136
-
137
- If `aiScoping` is absent or empty:
138
-
139
- - skip all scoping logic;
140
- - execute current pipeline exactly as today.
141
-
142
- ---
143
-
144
- ## 7) Internal AI Scoping Call Contract
145
-
146
- Each internal call should be deterministic and constrained:
147
-
148
- - Input:
149
- - `instructions` (caller-provided)
150
- - `sourceContent` (resolved from memory)
151
- - Expected output:
152
- - single string (scoped information)
153
- - Output post-processing:
154
- - trim surrounding whitespace
155
- - enforce max length safeguards (implementation-configurable)
156
-
157
- Suggested prompt policy for internal calls:
158
-
159
- - "Use only provided source content."
160
- - "Do not invent missing facts."
161
- - "Return concise scoped result for downstream AI task."
162
-
163
- ---
164
-
165
- ## 8) Parallelism and Performance
166
-
167
- ### Parallel execution requirement
168
-
169
- - All scoping items should run concurrently for latency efficiency.
170
-
171
- ### Concurrency limits
172
-
173
- - Use bounded concurrency (recommended) to avoid overload.
174
- - Suggested default: 3–8 concurrent calls (configurable).
175
-
176
- ### Ordering
177
-
178
- - Preserve original `aiScoping` order in final `aiScoped` output.
179
- - If futures resolve out-of-order, reorder results before injection.
180
-
181
- ### Timeouts
182
-
183
- - Apply per-item timeout.
184
- - Timeout should fail only the scoping item, not the main task (default tolerant mode).
185
-
186
- ---
187
-
188
- ## 9) Error Handling Policy
189
-
190
- Default policy: **tolerant** (recommended for backward compatibility and resilience).
191
-
192
- - If one scoping item fails (resolution error, timeout, internal AI error):
193
- - other items continue;
194
- - successful items still populate `aiScoped`;
195
- - main task still executes.
196
-
197
- Failure visibility:
198
-
199
- - Log/metadata should include failed item info (`targetToken`, failure reason).
200
- - Avoid leaking sensitive source data into error logs.
201
-
202
- Optional future extension (not required now):
203
-
204
- - strict mode that aborts task when any scoping item fails.
205
-
206
- ---
207
-
208
- ## 10) Validation Rules
209
-
210
- Before execution, validate `aiScoping` items:
211
-
212
- - `source`: non-empty string
213
- - `instructions`: non-empty string
214
- - `targetToken`: non-empty string
215
- - `targetToken` uniqueness recommended within one request
216
-
217
- If duplicates exist:
218
-
219
- - recommended behavior: last-write-wins **or** reject request; choose one and document in implementation.
220
- - preferred for predictability: reject duplicates with clear error.
221
-
222
- ---
223
-
224
- ## 11) Security and Privacy
225
-
226
- - Treat resolved `source` content as sensitive memory material.
227
- - Do not log raw source payloads in plaintext logs.
228
- - Internal scoping calls must receive only needed source slice (not entire memory bundle).
229
- - Respect existing gateway/client auth and model policies.
230
-
231
- ---
232
-
233
- ## 12) Integration Points (Current Codebase Guidance)
234
-
235
- Expected integration in `runTask` DIRECT path:
236
-
237
- - after memory enrichment (so scoped reads use enriched memory),
238
- - before final executor call (so `aiScoped` is available to main task input/context).
239
-
240
- Natural integration area: logic near `_executeDirect(...)` where enriched bundle and context are built.
241
-
242
- No Narrix-specific branching is required; this feature is generic and optional for any task execution type that reaches DIRECT execution.
243
-
244
- ---
245
-
246
- ## 13) Example Request/Derived Output
247
-
248
- ## 13.1 Example request
249
-
250
- ```json
251
- {
252
- "skillKey": "tasks/example",
253
- "input": {
254
- "goal": "Produce executive incident summary"
255
- },
256
- "jobMemory": {
257
- "incidentDump": {
258
- "tickets": ["...large data..."]
259
- },
260
- "customerContext": {
261
- "name": "Acme",
262
- "tier": "enterprise"
263
- }
264
- },
265
- "aiScoping": [
266
- {
267
- "source": "jobMemory.incidentDump",
268
- "instructions": "Extract only high-severity incidents from last 7 days with one-line impact each.",
269
- "targetToken": "recentCriticalIncidents"
270
- },
271
- {
272
- "source": "jobMemory.customerContext",
273
- "instructions": "Summarize customer profile relevant to incident communication tone.",
274
- "targetToken": "customerCommunicationProfile"
275
- }
276
- ]
277
- }
278
- ```
279
-
280
- ## 13.2 Derived scoped output injected to final task
281
-
282
- ```json
283
- {
284
- "aiScoped": [
285
- {
286
- "token": "recentCriticalIncidents",
287
- "scopedInfo": "..."
288
- },
289
- {
290
- "token": "customerCommunicationProfile",
291
- "scopedInfo": "..."
292
- }
293
- ]
294
- }
295
- ```
296
-
297
- ---
298
-
299
- ## 14) Backward Compatibility
300
-
301
- - If `aiScoping` is omitted: execution remains exactly current behavior.
302
- - Existing clients and builders remain valid.
303
- - Existing tasks do not need modification.
304
- - Feature is opt-in per request.
305
-
306
- ---
307
-
308
- ## 15) Test Plan (for future implementation)
309
-
310
- Unit tests:
311
-
312
- - validation of `aiScoping` items (required fields, duplicate tokens)
313
- - source path resolution (valid, invalid, nested, primitive/object/array)
314
- - deterministic output ordering under parallel completion
315
- - tolerant failure behavior (partial success still runs main task)
316
-
317
- Integration tests:
318
-
319
- - end-to-end DIRECT execution with `aiScoping` and injected `input.aiScoped`
320
- - timeout and internal call failure handling
321
- - no-regression test: request without `aiScoping` matches current behavior
322
-
323
- Performance tests:
324
-
325
- - compare serial vs parallel scoping latency with multiple items
326
- - verify bounded concurrency behavior under high item counts
327
-
328
- ---
329
-
330
- ## 16) Acceptance Criteria
331
-
332
- 1. `RunTaskRequest` accepts optional `aiScoping`.
333
- 2. Each scoping item triggers internal AI scoping based on memory `source` + `instructions`.
334
- 3. Scoping calls execute in parallel (with bounded concurrency).
335
- 4. Results are available to main task as `aiScoped: [{ token, scopedInfo }]`.
336
- 5. Absence of `aiScoping` preserves current behavior with no output/flow regressions.
337
- 6. Failures in individual scoping items do not break the main task by default.
338
-
@@ -1,96 +0,0 @@
1
- # Model profile aliases (graph-engine 7.x+ / ai-tasks 8.4+)
2
-
3
- Wire contract for **`RunTaskRequest.modelConfig`** and per-stage **`llmCall.model`** when using **`@x12i/ai-profiles`** instead of concrete provider ids.
4
-
5
- ## Required triplet (8.4+)
6
-
7
- Every `runTask()` call must set all three slots:
8
-
9
- | Slot | Role | xynthesis vs ai-skills |
10
- |------|------|------------------------|
11
- | `preActionModel` | PRE synthesis / utility | **ai-profiles alias only** → xynthesis |
12
- | `skillModel` | MAIN skill | alias **or** concrete id → ai-skills |
13
- | `postActionModel` | POST audit/polish/scoping | **ai-profiles alias only** → xynthesis |
14
-
15
- ```json
16
- {
17
- "preActionModel": "cheap/default",
18
- "skillModel": "pro/default",
19
- "postActionModel": "cheap/default"
20
- }
21
- ```
22
-
23
- ## Accepted alias shapes
24
-
25
- | Shape | Example | Notes |
26
- |-------|---------|-------|
27
- | `profile/choice` | `cheap/default`, `json/default` | Preferred — sync-checkable via `isKnownProfileChoice` |
28
- | Bare profile | `cheap`, `pro` | Expanded to `profile/default` at invoke (`toStrictAiProfileResolveInput`) |
29
- | `@` form | `cheap@default`, `pro@fast` | Normalized to `profile/choice` before `resolveAIProfile` |
30
-
31
- **List keys:** `listAiTasksProfileChoiceKeys()` / `listAiTasksProfileChoices()` from `@exellix/ai-tasks` (text lane, bundled or remote registry).
32
-
33
- ## Rejected (legacy)
34
-
35
- - Graph-era tiers: `weak`, `strong`
36
- - Deprecated slots: `xynthesisModel`, root `modelConfig.model`
37
- - Host token caps: `maxTokens`, `maxTokensCap` on task payloads
38
- - Removed ai-profiles 2.0 shortcuts: `cheapest`, sync `isKnownProfileOrShortcut`
39
-
40
- Unknown profile keys fail at **`resolveAIProfile`** with a clear error.
41
-
42
- ## Resolution boundaries
43
-
44
- | Path | Fields at ingress (before `resolveRunTaskModelReferences`) | Internal transform |
45
- |------|----------------------------------------------------------|--------------------|
46
- | **PRE / POST (xynthesis)** | `preActionModel`, `postActionModel`, step `llmCall.model` — **ai-profiles alias required** | `resolveModelReferenceForXynthesis` → `profile/choice` keys only |
47
- | **MAIN (ai-skills)** | `skillModel`, root `llmCall.model` — alias **or** concrete provider id | `resolveModelReference` → concrete `provider/model` for gateway |
48
-
49
- Concrete ids (`openrouter/...`, `anthropic/claude-...`, `openai/gpt-5`) pass through on **`skillModel`** only. PRE/POST must stay ai-profiles aliases under `@exellix/xynthesis` ≥ 4.3.1.
50
-
51
- ### Ingress rule for hosts (graph-engine, studio BFF)
52
-
53
- > **Do not** pre-resolve `preActionModel` or `postActionModel` to OpenRouter/OpenAI model ids. Pass through profile keys, `profile/choice`, or shortcut keys (e.g. `cheap`, `cheap/default`).
54
-
55
- > **`skillModel`** may still be a concrete provider id at ingress.
56
-
57
- ### Internal rule (ai-tasks)
58
-
59
- > `resolveRunTaskModelReferences` is the **only** place that transforms aliases on xynthesis paths at `runTask` entry. If a concrete id is detected on a xynthesis slot, ai-tasks fails with stable code **`XYNTHESIS_CONCRETE_MODEL_REJECTED`** (typed `RunTaskModelResolutionError`, not a generic wrapper).
60
-
61
- ### Stable pre-MAIN error codes
62
-
63
- | Condition | `error.code` |
64
- |-----------|--------------|
65
- | Concrete id on xynthesis slot | `XYNTHESIS_CONCRETE_MODEL_REJECTED` |
66
- | Unknown / unresolvable alias | `XYNTHESIS_ALIAS_RESOLUTION_FAILED` |
67
- | PRE synthesis enabled but required paths empty | `SYNTHESIS_INPUT_EMPTY` |
68
-
69
- Failures emit logxer diagnostics with `failureClassification.role: "cause"` and event ids such as `xynthesis_concrete_model_rejected`. Hosts (graph-engine CR-7) should preserve `error.code` and `failureClassification` on attempt records instead of collapsing to `TASK_RUN_FAILED` / `classification: other`.
70
-
71
- ## graph-engine guidance
72
-
73
- - Send the triplet on every node/task compile — no env defaults, no `"balanced"` fallback.
74
- - Prefer explicit **`profile/choice`** keys in compiled payloads; bare profile keys are OK (ai-tasks normalizes before xynthesis).
75
- - **Do not** pre-resolve `preActionModel` / `postActionModel` to concrete provider ids — pass aliases and let ai-tasks normalize at `runTask` entry (see ingress rule above).
76
- - Optional: pre-resolve **`skillModel`** aliases for diagnostics; ai-tasks re-resolves at invoke (idempotent for concrete ids).
77
- - Do **not** npm-override `@x12i/ai-profiles` or pin `<2.1`.
78
-
79
- ## Stack minimums
80
-
81
- | Package | Minimum |
82
- |---------|---------|
83
- | `@exellix/ai-tasks` | 8.4.x |
84
- | `@x12i/ai-profiles` | 2.1.0 |
85
- | `@exellix/xynthesis` | 4.3.1 |
86
- | `@exellix/ai-skills` | 6.0.0 |
87
-
88
- ## Public helpers (`@exellix/ai-tasks`)
89
-
90
- - `toStrictAiProfileResolveInput` — bare profile → `profile/default`
91
- - `resolveModelReference` / `resolveModelReferenceForXynthesis`
92
- - `isResolvableModelAlias` — true for known **`profile/choice`** keys only
93
- - `RunTaskModelResolutionError`, `isRunTaskModelResolutionError` — stable pre-MAIN model slot failures
94
- - `listAiTasksProfileChoices`, `listAiTasksProfiles`, `listAiTasksProfileChoiceKeys`
95
-
96
- See [README — Model profile aliases](../README.md#model-profile-aliases-x12iai-profiles).