@exellix/ai-tasks 8.5.0 → 8.5.3

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 (58) hide show
  1. package/.docs/ai-tasks-model-profile-aliases-7x.md +27 -5
  2. package/CHANGELOG.md +6 -10
  3. package/README.md +7 -6
  4. package/RUNTASK_REQUEST.md +1 -1
  5. package/dist/core/task-sdk.d.ts.map +1 -1
  6. package/dist/core/task-sdk.js +16 -14
  7. package/dist/core/task-sdk.js.map +1 -1
  8. package/dist/errors/runTaskExecutionError.d.ts +1 -1
  9. package/dist/errors/runTaskExecutionError.d.ts.map +1 -1
  10. package/dist/errors/runTaskExecutionError.js +4 -1
  11. package/dist/errors/runTaskExecutionError.js.map +1 -1
  12. package/dist/errors/runTaskModelResolutionError.d.ts +39 -0
  13. package/dist/errors/runTaskModelResolutionError.d.ts.map +1 -0
  14. package/dist/errors/runTaskModelResolutionError.js +92 -0
  15. package/dist/errors/runTaskModelResolutionError.js.map +1 -0
  16. package/dist/index.d.ts +2 -0
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +1 -0
  19. package/dist/index.js.map +1 -1
  20. package/dist/logxer/aiTasksDiagnosticCodes.d.ts +3 -0
  21. package/dist/logxer/aiTasksDiagnosticCodes.d.ts.map +1 -1
  22. package/dist/logxer/aiTasksDiagnosticCodes.js +3 -0
  23. package/dist/logxer/aiTasksDiagnosticCodes.js.map +1 -1
  24. package/dist/observability/classifyRunTaskFailure.d.ts +1 -1
  25. package/dist/observability/classifyRunTaskFailure.d.ts.map +1 -1
  26. package/dist/observability/classifyRunTaskFailure.js +12 -0
  27. package/dist/observability/classifyRunTaskFailure.js.map +1 -1
  28. package/dist/observability/logRunTaskFailure.d.ts.map +1 -1
  29. package/dist/observability/logRunTaskFailure.js +26 -8
  30. package/dist/observability/logRunTaskFailure.js.map +1 -1
  31. package/dist/planWebScopeQuestions/index.d.ts.map +1 -1
  32. package/dist/planWebScopeQuestions/index.js +6 -1
  33. package/dist/planWebScopeQuestions/index.js.map +1 -1
  34. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts +57 -0
  35. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.d.ts.map +1 -0
  36. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js +80 -0
  37. package/dist/post-steps/audit/auditChecklistFuncxEnvelope.js.map +1 -0
  38. package/dist/task-strategies/normalize.d.ts.map +1 -1
  39. package/dist/task-strategies/normalize.js +3 -0
  40. package/dist/task-strategies/normalize.js.map +1 -1
  41. package/dist/utils/concreteModelId.d.ts.map +1 -1
  42. package/dist/utils/concreteModelId.js +4 -1
  43. package/dist/utils/concreteModelId.js.map +1 -1
  44. package/dist/utils/resolveAiProfileModel.d.ts +6 -1
  45. package/dist/utils/resolveAiProfileModel.d.ts.map +1 -1
  46. package/dist/utils/resolveAiProfileModel.js +11 -2
  47. package/dist/utils/resolveAiProfileModel.js.map +1 -1
  48. package/dist/utils/resolveRunTaskModelReferences.d.ts.map +1 -1
  49. package/dist/utils/resolveRunTaskModelReferences.js +93 -30
  50. package/dist/utils/resolveRunTaskModelReferences.js.map +1 -1
  51. package/dist/validation/helpers.js +1 -1
  52. package/dist/validation/helpers.js.map +1 -1
  53. package/documenations/funcx-catalog-hosting-checklist.md +12 -8
  54. package/documenations/funcx-scoping-integration-gaps.md +10 -8
  55. package/documenations/upstream-feature-requests/README.md +9 -0
  56. package/documenations/upstream-feature-requests/funcx-generic-xynthesis-hosting.md +268 -0
  57. package/documenations/upstream-feature-requests/funcx-pre-post-sidekick-actions.md +213 -0
  58. package/package.json +3 -9
@@ -0,0 +1,268 @@
1
+ # `@x12i/funcx` — generic envelope hosting for xynthesis-domain capabilities
2
+
3
+ **Filed by:** `@exellix/ai-tasks` + `@exellix/xynthesis`
4
+ **Baseline reviewed:** `@x12i/funcx` **4.4.0** (npm; `xynthesis` dependency `^4.4.0`)
5
+ **Consumers:** `@exellix/xynthesis` 4.4+ (LLM orchestration), `@exellix/ai-tasks` 8.5+ (envelope builders + adapters)
6
+ **Out of scope:** `@exellix/ai-skills` MAIN gateway prompts
7
+
8
+ **Related:**
9
+
10
+ - [**funcx-pre-post-sidekick-actions.md**](./funcx-pre-post-sidekick-actions.md) — pre/post sidekick built-ins + `SidekickGenericEnvelope`
11
+ - [`funcx-scoping-integration-gaps.md`](../funcx-scoping-integration-gaps.md) §6 — execution-strategy adapter contracts
12
+ - [`funcx-catalog-hosting-checklist.md`](../funcx-catalog-hosting-checklist.md) — deploy / smoke-test checklist
13
+ - Consumer map: `xynthesis/src/catalog/sidekickFuncxCatalogMap.ts`, `xynthesis/src/sidekickFuncxEnvelope.ts`
14
+ - Envelope builders: [`genericExecutionFuncxEnvelope.ts`](../../src/execution-strategies/genericExecutionFuncxEnvelope.ts), [`auditChecklistFuncxEnvelope.ts`](../../src/post-steps/audit/auditChecklistFuncxEnvelope.ts)
15
+
16
+ ---
17
+
18
+ ## 0. Target architecture
19
+
20
+ | Layer | Responsibility |
21
+ |-------|----------------|
22
+ | **FuncX** | Host prompts (Catalox `fx/*` content + `content:primitives:sync`), validate I/O, `run(functionId, envelope, runOptions)` |
23
+ | **xynthesis** | Model resolve, Optimixer / `outputExpectation`, JSON parse, Activix, `InvokeAttemptSummary`; gate FuncX prompts with `XYNTHESIS_FUNCX_SIDEKICK=1` |
24
+ | **ai-tasks** | Build envelopes; merge adapted JSON into `RunTaskRequest`; no inline `DEFAULT_SYSTEM` for migrated steps |
25
+
26
+ **Two envelope families** (do not conflate):
27
+
28
+ 1. **`GenericExecutionEnvelope`** — `@x12i/funcx/functions` type for **execution / research** built-ins (`execution/plan`, `execution/evaluate-result`, `research/plan-questions`, …).
29
+ 2. **`SidekickGenericEnvelope`** — defined in **xynthesis** (`sidekickFuncxEnvelope.ts`) for **pre/post sidekick** built-ins (`pre/synthesize`, `post/audit`, …). FuncX should accept the same *shape* at `run()` time; a dedicated exported type is optional (FR-PRE-POST-8).
30
+
31
+ ---
32
+
33
+ ## 1. FuncX 4.4.0 — shipped structure (source of truth)
34
+
35
+ Reviewed from `@x12i/funcx` **4.4.0** (`dist/functions`, README). Use this when implementing or extending FRs.
36
+
37
+ ### 1.1 Call surface
38
+
39
+ ```ts
40
+ import { run, getRunJsonResult, buildAskAttribution } from "@x12i/funcx/functions";
41
+ import type { GenericExecutionEnvelope } from "@x12i/funcx/functions";
42
+
43
+ const raw = await run("execution/plan", envelope, {
44
+ client,
45
+ model: resolvedSlug,
46
+ timeoutMs: 60_000,
47
+ responseFormat: { kind: "json_object" },
48
+ includeUsage: true,
49
+ });
50
+ const json = getRunJsonResult(raw);
51
+ ```
52
+
53
+ | Mechanism | Behavior |
54
+ |-----------|----------|
55
+ | **Id normalization** | Slash ids in constants (`execution/plan`) → hyphen registry keys (`execution-plan`) inside router |
56
+ | **Constants** | `FUNCX_EXECUTION_PLAN_FUNCTION_ID`, `FUNCX_EXECUTION_EVALUATE_RESULT_FUNCTION_ID`, `FUNCX_RESEARCH_PLAN_QUESTIONS_FUNCTION_ID` |
57
+ | **Schema** | `genericExecutionEnvelopeJsonSchema` (draft Ajv object; `goal` required at runtime for built-ins) |
58
+ | **Unwrap** | `getRunJsonResult` / `isHttpRunSuccessBody` — HTTP `{ result, usage }` vs in-process plain object |
59
+
60
+ ### 1.2 `GenericExecutionEnvelope` (shipped)
61
+
62
+ ```ts
63
+ type GenericExecutionEnvelope = {
64
+ goal?: unknown; // runtime: non-empty string for execution/research built-ins
65
+ input?: unknown;
66
+ context?: unknown;
67
+ result?: unknown; // optimizer / evaluate-result
68
+ args?: Record<string, unknown>;
69
+ attribution?: Record<string, unknown>;
70
+ client?: Client; // in-process only; omit on HTTP
71
+ };
72
+ ```
73
+
74
+ **Not on the type today:** `strategyArgs` (xynthesis merges into `args` before `run()` — see §2.3).
75
+
76
+ ### 1.3 `buildAskAttribution` (shipped)
77
+
78
+ `buildAskAttribution(implFunctionId, req)` merges:
79
+
80
+ - Top-level / `attribution.*`: `projectId`, `traceId`, `jobId`, `taskId`, `agentId`, `runId`, `parentRunId`, `actorId`, `subjectId`
81
+ - `attribution.tags` and top-level `tags`
82
+ - Preserves implementing `functionId`; stores caller `attribution.functionId` in `tags.callerFunctionId`
83
+
84
+ **xynthesis / ai-tasks today:** `buildSidekickFuncxAttribution` / `buildExecutionStrategyAttribution` set `runId`←jobId, `subjectId`←taskId, `actorId`←agentId — compatible with FuncX merge rules.
85
+
86
+ ### 1.4 `RunOptions` (shipped — partial vs orchestrator needs)
87
+
88
+ | Field | Shipped in 4.4.0 |
89
+ |-------|------------------|
90
+ | `client`, `model`, `backend`, `timeoutMs`, `signal` | Yes |
91
+ | `responseFormat` (`json_object` / text) | Yes |
92
+ | `includeUsage`, `validateOutput`, `profile` (race) | Yes |
93
+ | `temperature`, `topP`, `reasoningEffort` | **No** on `RunOptions` (still use `Client.ask` / xynthesis `FuncxInvoker` for sampling) |
94
+
95
+ ### 1.5 Hosting model (content + router)
96
+
97
+ | Class | Examples | How prompts run |
98
+ |-------|----------|-----------------|
99
+ | **Content-backed** | `execution-plan`, `execution-evaluate-result`, `research-plan-questions`, `research-plan-web-search`, `research-plan-scoped-questions` | Catalox `fx/{id}/` via `executeFuncxFromContent`; instructions rendered with `renderInstructionTemplate(instructions, { input: request, variables })` where **`request` is the full envelope** passed to `run()` |
100
+ | **Code-bound router** | Primitives, runx.*, repair JSON, … | TS handlers; generic execution family delegates to `run("execution-plan", …)` |
101
+ | **Legacy (deprecate)** | `ai-tasks-plan-task`, `ai-tasks-optimizer-evaluate` | Hyphen ids; same envelope family; superseded by `execution-plan` / `execution-evaluate-result` |
102
+
103
+ **Seed bundle:** `content-seed/functions/genericExecutionResearch.seed.json` → `npm run content:primitives:sync` (see FuncX README § Catalox merged primitive seeds).
104
+
105
+ **Executor primitives (all functions):** `executeFuncx` → `callAI` with `buildFuncxUserPrompt(buildPrompt(request))` — user message is JSON (or prefixed JSON body), not xynthesis-style pre-rendered system+user strings.
106
+
107
+ ### 1.6 Built-in I/O types (shipped — align adapters)
108
+
109
+ | Registry id | `run()` alias | Input highlights | Output highlights |
110
+ |-------------|---------------|------------------|-------------------|
111
+ | `execution-plan` | `execution/plan` | `goal`, `input?`, `context?`, `args?`, `attribution?` | `plan?`, `instructions?`, `steps[]`, `assumptions[]`, `missingInputs[]`, `metadata?` |
112
+ | `execution-evaluate-result` | `execution/evaluate-result` | + required `result` | `satisfied`, `feedback?`, `suggestedChanges[]`, `issues[]`, `metadata?` |
113
+ | `research-plan-questions` | `research/plan-questions` | same envelope | `questions[]`, `skipped?`, `reasonCodes?`, `confidence?` |
114
+
115
+ ai-tasks adapters: `adaptExecutionPlanResult`, `adaptEvaluateResultResponse`, `adaptResearchPlanQuestionsResult`.
116
+
117
+ ---
118
+
119
+ ## 2. Consumer prep (shipped in mono-repo)
120
+
121
+ | Artifact | Package | Status |
122
+ |----------|---------|--------|
123
+ | `sidekickFuncxCatalogMap.ts` | xynthesis | **Shipped** — actionType ↔ `funcxFunctionId` ↔ Catalox catalog |
124
+ | `sidekickFuncxEnvelope.ts` | xynthesis | **Shipped** — `buildSidekickGenericEnvelope`, `buildExecutionStrategyGenericEnvelope` |
125
+ | `ENV_SIDEKICK_FUNCX` (`XYNTHESIS_FUNCX_SIDEKICK=1`) | xynthesis | **Shipped** — gate; no `run()` wiring in gateway yet |
126
+ | Catalox `XynthesisActionItem.funcx` | xynthesis seed | **Shipped** — `functionId` + `contentVersion: "0.0.0-pending-funcx"` |
127
+ | `auditChecklistFuncxEnvelope.ts` | ai-tasks | **Shipped** — `post/audit-checklist`, `post/audit-merge` envelopes |
128
+ | Execution via xynthesis actions | ai-tasks 8.5+ | **Shipped** — not direct `run()` from ai-tasks |
129
+ | `runExecutionStrategyViaXynthesis` | ai-tasks | **Shipped** — still uses xynthesis disk templates + `FuncxInvoker.ask` |
130
+
131
+ ### 2.1 `strategyArgs` merge (consumer — no FuncX FR)
132
+
133
+ `buildExecutionStrategyGenericEnvelope` folds `req.strategyArgs` into **`args`** (and sets `args.iterationIndex` for optimizer). **Do not** wait for a FuncX type extension; hosts must merge before `run()`.
134
+
135
+ ### 2.2 Template token convention (parity gap)
136
+
137
+ | Source | User-prompt tokens |
138
+ |--------|-------------------|
139
+ | **xynthesis disk** (`executionStrategyPromptTemplate.ts`) | `goal`, `input_json`, `context_json`, `result_json`, `args_json`, `strategy_args_json`, `iteration_index` |
140
+ | **FuncX content render** (envelope = `request`) | Typically `{{input.goal}}`, `{{input.context}}`, … via rendrix `input` = full envelope |
141
+
142
+ **FR-GEN-1** (revised): FuncX should export **`envelopeToTemplateVariables(envelope)`** that produces **both** conventions (or document Catalox seeds must use `input.*` paths). Until then, FR-GEN-9 parity diffs must compare normalized renders, not raw file text.
143
+
144
+ ---
145
+
146
+ ## 3. Audit — instructions vs `run()` (current)
147
+
148
+ | Capability | Prompt host today | Envelope | FuncX built-in 4.4.0 |
149
+ |------------|-------------------|----------|----------------------|
150
+ | execution-plan / optimizer / web-scope | xynthesis templates + `ask` | `GenericExecution*` via builders | **Yes** — not called from xynthesis yet |
151
+ | synthesis, audit, fix, pick-best, craft-final | xynthesis disk / Catalox + `ask` | `SidekickGenericEnvelope` when wired | **No** — see [funcx-pre-post-sidekick-actions.md](./funcx-pre-post-sidekick-actions.md) |
152
+ | ai-tasks checklist audit / merge | ai-tasks Handlebars | `auditChecklistFuncxEnvelope` | **No** (`post/audit-checklist`, `post/audit-merge`) |
153
+ | ai-scoping | inline `SCOPING_SYSTEM` | none | **No** |
154
+
155
+ ---
156
+
157
+ ## 4. Feature request tracker (aligned to 4.4.0)
158
+
159
+ | FR id | Topic | Status @ 4.4.0 |
160
+ |-------|--------|----------------|
161
+ | **FR-GEN-0** | Baseline: envelope, constants, `buildAskAttribution`, `getRunJsonResult`, execution/research built-ins, `genericExecutionResearch` seed | **Shipped** |
162
+ | **FR-GEN-1** | `envelopeToTemplateVariables` (+ document `input.*` vs `*_json` tokens) | **Open** |
163
+ | **FR-GEN-2** | Per-function `args` JSON Schema + template knobs (`customGuidelines`, …) | **Open** (partially by convention) |
164
+ | **FR-GEN-3** | Published output schemas shared with xynthesis parsers | **Open** (TS types exist; no shared JSON Schema artifact) |
165
+ | **FR-GEN-4** | `RunOptions`: `temperature`, `topP`, `reasoningEffort` | **Open** (partial: model, timeout, responseFormat shipped) |
166
+ | **FR-GEN-5** | `runGenericExecution({ functionId, envelope, runOptions })` embedder helper | **Open** |
167
+ | **FR-GEN-6** | Post-step checklist / merge built-ins | **Open** → FR-PRE-POST-2 |
168
+ | **FR-GEN-7** | AI scoping built-in | **Open** |
169
+ | **FR-GEN-8** | `strategyArgs` on wire | **Closed (consumer)** — merge into `args` in xynthesis |
170
+ | **FR-GEN-9** | Catalox seed ↔ xynthesis template parity CI | **Open** |
171
+ | **FR-GEN-10** | Deprecate `ai-tasks-plan-task` / `ai-tasks-optimizer-evaluate` | **Open** |
172
+ | **FR-GEN-11** | Rich audit `context` sub-schema on envelope | **Open** (checklist envelope shipped in ai-tasks) |
173
+ | **FR-GEN-12** | Golden fixtures package | **Open** |
174
+ | **FR-PRE-POST-*** | Pre/post sidekick built-ins | **Open** — [funcx-pre-post-sidekick-actions.md](./funcx-pre-post-sidekick-actions.md) |
175
+
176
+ ---
177
+
178
+ ## 5. Open FR details (only what 4.4.0 does not cover)
179
+
180
+ ### FR-GEN-1 — Template variables from envelope
181
+
182
+ **Need:** One function used by content-backed built-ins and xynthesis so Catalox instructions and `xynthesis/templates/*` stay aligned.
183
+
184
+ **Ask:**
185
+
186
+ ```ts
187
+ envelopeToTemplateVariables(
188
+ envelope: GenericExecutionEnvelope | SidekickGenericEnvelope
189
+ ): Record<string, string>;
190
+ ```
191
+
192
+ Minimum keys: parity with `buildExecutionStrategyUserVars` **and** nested `input.goal` style for `renderInstructionTemplate`.
193
+
194
+ ### FR-GEN-2 — `args` contract
195
+
196
+ Document reserved keys per `functionId` in `fx/*/meta.json`. Execution/research: `maxQuestions`, `allowSkip`, `sourceType`, `iterationIndex`, `customGuidelines`, `templateMode`, …
197
+
198
+ ### FR-GEN-3 — Shared output JSON Schema
199
+
200
+ Export versioned schemas next to built-ins; xynthesis `parseExecutionStrategyPayload` / sidekick parsers consume same files.
201
+
202
+ ### FR-GEN-4 — Orchestrator sampling on `run()`
203
+
204
+ Add optional `temperature`, `topP`, `reasoningEffort` to `RunOptions` (or document that embedders must use `executeFuncxFromContent` + custom `callAI` until then). xynthesis today passes sampling via **`FuncxInvoker.ask`**, not `run()`.
205
+
206
+ ### FR-GEN-5 — `runGenericExecution`
207
+
208
+ Thin wrapper: resolve content → render → `askJson` → `getRunJsonResult` → return `{ value, usage, model }`. Sidekick variant accepts `SidekickGenericEnvelope` (FR-PRE-POST-5).
209
+
210
+ ### FR-GEN-9 — Seed parity
211
+
212
+ Compare `genericExecutionResearch.seed.json` + deployed `fx/execution-plan/*` to `xynthesis/templates/execution-*` using **FR-GEN-1** normalized variables.
213
+
214
+ ### FR-GEN-10 — Legacy ids
215
+
216
+ Alias `ai-tasks-plan-task` → `execution-plan`, `ai-tasks-optimizer-evaluate` → `execution-evaluate-result`; mark deprecated in seed meta.
217
+
218
+ ---
219
+
220
+ ## 6. Convergence path
221
+
222
+ ```mermaid
223
+ flowchart LR
224
+ subgraph consumers
225
+ AT[ai-tasks envelope builders]
226
+ XY[xynthesis run* / gateway]
227
+ end
228
+ subgraph funcx44 [FuncX 4.4 shipped]
229
+ RUN[run slash id]
230
+ ATTR[buildAskAttribution]
231
+ SEED[genericExecutionResearch seed]
232
+ end
233
+ subgraph funcxNext [FuncX next]
234
+ PRE[pre/post built-ins]
235
+ VARS[envelopeToTemplateVariables]
236
+ end
237
+ AT --> XY
238
+ XY -->|XYNTHESIS_FUNCX_SIDEKICK=1| RUN
239
+ RUN --> ATTR
240
+ RUN --> SEED
241
+ PRE --> RUN
242
+ VARS --> SEED
243
+ ```
244
+
245
+ 1. **Done:** execution/research envelopes + built-ins + attribution (4.4.0).
246
+ 2. **Next FuncX:** FR-GEN-1, FR-PRE-POST-1..4, FR-GEN-9 (before xynthesis deletes duplicate renderers).
247
+ 3. **xynthesis:** Wire `invokeExecutionStrategyAction` / gateway to `run(resolveSidekickFuncxFunctionId(...), envelope, opts)` behind `XYNTHESIS_FUNCX_SIDEKICK=1`.
248
+ 4. **ai-tasks:** Switch audit/polish/scoping to envelope + `run()` after post built-ins land.
249
+
250
+ ---
251
+
252
+ ## 7. Non-goals
253
+
254
+ - ai-skills MAIN `instructions` / `prompt`.
255
+ - Template **cores** (`{{core:analysis}}`) inside FuncX — stay rendrix/ai-skills; `pre/synthesize` envelope carries **pre-rendered** downstream blocks in `input`.
256
+ - Forcing ai-tasks to call `@x12i/funcx` directly for execution strategies (xynthesis remains facade).
257
+
258
+ ---
259
+
260
+ ## 8. Version note
261
+
262
+ | Package | Version | Notes |
263
+ |---------|---------|-------|
264
+ | `@x12i/funcx` | **4.4.0** (npm latest reviewed) | Baseline for §1 |
265
+ | `@exellix/xynthesis` | **4.4.3** | FuncX map + envelopes; execution hop still disk+ask |
266
+ | `@exellix/ai-tasks` | **8.5.2** | xynthesis actions; checklist envelopes ready |
267
+
268
+ When FuncX ships pre/post built-ins, bump `contentVersion` on Catalox items from `0.0.0-pending-funcx` and enable `XYNTHESIS_FUNCX_SIDEKICK=1` in CI.
@@ -0,0 +1,213 @@
1
+ # `@x12i/funcx` — built-in functions for xynthesis **pre-actions** and **post-actions**
2
+
3
+ **Filed by:** `@exellix/ai-tasks` + `@exellix/xynthesis`
4
+ **Baseline:** `@x12i/funcx` **4.4.0** — execution/research generics **shipped**; pre/post ids below are **not** in registry yet
5
+ **Blocks:** `XYNTHESIS_FUNCX_SIDEKICK=1` production use, ai-tasks audit/polish off Handlebars
6
+ **Related:** [funcx-generic-xynthesis-hosting.md](./funcx-generic-xynthesis-hosting.md) (4.4.0 baseline + execution FRs)
7
+
8
+ ---
9
+
10
+ ## 0. Problem
11
+
12
+ **Shipped in FuncX 4.4.0:** `run("execution/plan" | "execution/evaluate-result" | "research/plan-questions", GenericExecutionEnvelope)` with Catalox content under `genericExecutionResearch` seed.
13
+
14
+ **Not shipped:** Sidekick pre/post capabilities (`pre/synthesize`, `post/audit`, …). Today:
15
+
16
+ 1. xynthesis loads `xynthesis/templates/{actionType}/` or Catalox `pre-actions` / `post-actions` (same bodies).
17
+ 2. LLM hop = **`FuncxInvoker.ask(systemPrompt, userPrompt)`** (transport only).
18
+ 3. ai-tasks often builds its **own** audit/polish prompts (`loadAuditTemplates`, `DEFAULT_SYSTEM`).
19
+
20
+ **Target:** Register pre/post built-ins like execution family → `run(functionId, SidekickGenericEnvelope, runOptions)`; Catalox items keep `funcx.functionId` for overrides only.
21
+
22
+ ---
23
+
24
+ ## 1. Consumer mapping (shipped in xynthesis)
25
+
26
+ **Source:** `xynthesis/src/catalog/sidekickFuncxCatalogMap.ts`
27
+ **Envelopes:** `xynthesis/src/sidekickFuncxEnvelope.ts`
28
+ **Flag:** `XYNTHESIS_FUNCX_SIDEKICK=1` (`isSidekickFuncxEnabled()`)
29
+
30
+ | Phase | Sidekick `actionType` | Catalox catalog | Item id | FuncX `functionId` | Hyphen alias (router) | In FuncX 4.4 registry? |
31
+ |-------|----------------------|-----------------|---------|-------------------|----------------------|-------------------------|
32
+ | PRE | `synthesis` | `pre-actions` | `synthesis` | `pre/synthesize` | `pre-synthesize` | **No** |
33
+ | PRE | `execution-plan` | `pre-actions` | `execution-plan` | `execution/plan` | `execution-plan` | **Yes** |
34
+ | PRE | `plan-web-scope-questions` | `pre-actions` | `plan-web-scope-questions` | `research/plan-questions` | `research-plan-questions` | **Yes** |
35
+ | POST | `audit` | `post-actions` | `audit` | `post/audit` | `post-audit` | **No** |
36
+ | POST | `fix` | `post-actions` | `fix` | `post/fix` | `post-fix` | **No** |
37
+ | POST | `pick-best` | `post-actions` | `pick-best` | `post/pick-best` | `post-pick-best` | **No** |
38
+ | POST | `craft-final` | `post-actions` | `craft-final` | `post/craft-final` | `post-craft-final` | **No** |
39
+ | POST | `execution-evaluate-result` | `post-actions` | `execution-evaluate-result` | `execution/evaluate-result` | `execution-evaluate-result` | **Yes** |
40
+
41
+ **ai-tasks-only POST pipeline** (not `SidekickActionType` today):
42
+
43
+ | Capability | FuncX id | Catalox item | Envelope builder | In registry? |
44
+ |------------|----------|--------------|------------------|--------------|
45
+ | Checklist audit | `post/audit-checklist` | `audit-checklist` | `ai-tasks/.../auditChecklistFuncxEnvelope.ts` | **No** |
46
+ | Audit merge | `post/audit-merge` | `audit-merge` | same module | **No** |
47
+
48
+ Catalox seed writes `funcx: { functionId, contentVersion: "0.0.0-pending-funcx" }` on every mapped sidekick item (`buildXynthesisSeedPayloads.ts`).
49
+
50
+ ---
51
+
52
+ ## 2. Wire contract — `SidekickGenericEnvelope`
53
+
54
+ **Defined in xynthesis** (not exported from `@x12i/funcx` 4.4.0). FuncX `run()` should accept this object as the **request** body (same as passing `GenericExecutionEnvelope` for execution ids).
55
+
56
+ ```ts
57
+ type SidekickGenericEnvelope = {
58
+ goal: string; // SidekickInput.task
59
+ input: Record<string, unknown>; // action-specific (§3)
60
+ context: {
61
+ templateCores: string[];
62
+ taskType?: string;
63
+ metadata?: Record<string, unknown>;
64
+ result?: unknown; // optimizer context when needed
65
+ iterationIndex?: number;
66
+ identity?: ActivityRunContext;
67
+ };
68
+ args?: Record<string, unknown>; // templateMode, customGuidelines, …
69
+ attribution?: SidekickFuncxAttribution;
70
+ };
71
+ ```
72
+
73
+ **Builders (shipped):**
74
+
75
+ - `buildSidekickGenericEnvelope(input, options?)` — synthesis, audit, fix, pick-best, craft-final
76
+ - `buildExecutionStrategyGenericEnvelope(req)` — planner / optimizer / web-scope (merges `strategyArgs` → `args`)
77
+
78
+ **Attribution:** `buildSidekickFuncxAttribution({ funcxFunctionId, jobId, taskId, agentId })` — align with FuncX `buildAskAttribution(implId, envelope)`.
79
+
80
+ ### 2.1 Template tokens (for Catalox instructions)
81
+
82
+ FuncX 4.4 renders instructions with `input` = **full envelope**. For parity with xynthesis rendrix disk templates, implement **FR-GEN-1** `envelopeToTemplateVariables` (see generic hosting doc).
83
+
84
+ | xynthesis rendrix (disk) | FuncX / rendrix on envelope (`input` = envelope) |
85
+ |--------------------------|--------------------------------------------------|
86
+ | `goal` | `input.goal` |
87
+ | `task`, `question` | `input.goal` (aliases in sidekick templates) |
88
+ | `local_raw`, `supporting_raw` | `input.local_raw`, `input.supporting_raw` (strings; builders stringify) |
89
+ | `rendered_downstream_instructions` | `input.renderedInstructions` |
90
+ | `rendered_downstream_prompt` | `input.renderedPrompt` |
91
+ | `ai_output` | `input.aiOutput` |
92
+ | `used_instructions`, `used_prompt` | `input.usedInstructions`, `input.usedPrompt` |
93
+ | `prior_audit_json` | stringify `input.priorAudit` |
94
+ | `candidates_json` | stringify `input.candidates` |
95
+ | `metadata_json` | stringify `context.metadata` |
96
+ | `template_cores_json` | stringify `context.templateCores` |
97
+ | `goal`, `input_json`, `context_json`, `args_json` | execution family (§3.6) |
98
+
99
+ ---
100
+
101
+ ## 3. Per-function specifications (to implement in FuncX)
102
+
103
+ Register in router + `content-seed/functions/` (new bundle or extend `genericExecutionResearch` / dedicated `xynthesisSidekick.seed.json`). Follow **4.4.0 patterns**: `meta.json`, IO schemas, `executeFuncxFromContent`, `buildAskAttribution`, `responseFormat: json_object` where noted.
104
+
105
+ ### FR-PRE-POST-1 — `pre/synthesize` (P0)
106
+
107
+ **Canonical content:** `xynthesis/templates/synthesis/system-structured.md`, `user-structured.md` (+ markdown pair).
108
+
109
+ **`input`:** `localRaw`, `supportingRaw`, `renderedInstructions`, `renderedPrompt`, plus string mirrors `local_raw`, `supporting_raw`.
110
+
111
+ **Output:** matches `parseAndValidateSynthesizedPromptPayload` / `SynthesisPayload` (`templateCores`, `task`, `synthesized`, `notes`, `unknowns`, `assumptions`).
112
+
113
+ **`args`:** `templateMode`, `customGuidelines`, `synthesisPromptOverride`, `maxItemsPerSide`, `maxItemContentChars`.
114
+
115
+ ### FR-PRE-POST-2 — `post/audit-checklist` + `post/audit-merge` (P1)
116
+
117
+ **Checklist** — migrate ai-tasks `templates/post-steps/audit/`:
118
+
119
+ **`input`:** `candidateOutput`, `originalInput`, `promptContext`, `mustChecks`, `shouldChecks`, `previousFeedback`, `previousCycle` (see `buildAuditChecklistFuncxEnvelope`).
120
+
121
+ **Output:** markdown `### Checks` / `### Overall feedback` until JSON schema exists.
122
+
123
+ **`args`:** `customAuditGuidelines`, `passNumber`, `cycle`, `maxCycles`.
124
+
125
+ **Merge** — `buildAuditMergeFuncxEnvelope`: `input.candidateA`, `input.candidateB`, `context.task`.
126
+
127
+ ### FR-PRE-POST-3 — `post/audit` (P0)
128
+
129
+ **Content:** `xynthesis/templates/audit/*`. **`input`:** `aiOutput`, `usedInstructions?`, `usedPrompt?`. **Output:** `parseAuditPayload` shape (`verdict`, `findings[]`, …).
130
+
131
+ ### FR-PRE-POST-4 — `post/fix` (P0)
132
+
133
+ **Note:** sidekick action is **`fix`** (polish), not `post/polish`. **Content:** `xynthesis/templates/fix/*`. **Output:** `parseFixPayload` (`fixes[]`).
134
+
135
+ ### FR-PRE-POST-5 — `post/pick-best`, `post/craft-final` (P0)
136
+
137
+ Per `parsePickBestPayload` / `parseCraftFinalPayload` and existing disk templates.
138
+
139
+ ### FR-PRE-POST-6 — Execution ids (P0 — wire only)
140
+
141
+ **Already in FuncX 4.4.0.** Remaining work:
142
+
143
+ - [ ] xynthesis: stop `buildExecutionStrategyPrompts` + `ask` when `XYNTHESIS_FUNCX_SIDEKICK=1`
144
+ - [ ] Call `run(resolveSidekickFuncxFunctionId(action), buildExecutionStrategyGenericEnvelope(req), runOptions)`
145
+ - [ ] Catalox `contentVersion` ≥ seed version after parity (FR-GEN-9)
146
+
147
+ No new FuncX function definitions required if `fx/execution-plan/*` matches xynthesis templates.
148
+
149
+ ---
150
+
151
+ ## 4. Catalox catalog shape (consumer — shipped)
152
+
153
+ ```ts
154
+ // XynthesisActionItem (cataloxXynthesisBootstrap.ts)
155
+ funcx?: {
156
+ functionId: string; // slash form from sidekickFuncxCatalogMap
157
+ contentVersion?: string; // "0.0.0-pending-funcx" until FuncX seed synced
158
+ };
159
+ ```
160
+
161
+ **Resolution order (target):**
162
+
163
+ 1. `XYNTHESIS_FUNCX_SIDEKICK=1` → `run(item.funcx.functionId, envelope, runOptions)` — prompts from FuncX/Catalox only.
164
+ 2. `XYNTHESIS_CATALOX_ACTIONS=1` → Catalox templates + rendrix (**today**).
165
+ 3. Else → disk templates (dev/tests).
166
+
167
+ When (1) is on, Catalox `templates` are **fallback overrides** only if FuncX resolver supports content overrides (same as other `fx/*` functions).
168
+
169
+ ---
170
+
171
+ ## 5. FuncX package tracker (pre/post only)
172
+
173
+ Depends on [funcx-generic-xynthesis-hosting.md](./funcx-generic-xynthesis-hosting.md) **FR-GEN-1, FR-GEN-4, FR-GEN-5** for shared template + `run()` ergonomics.
174
+
175
+ | FR id | Topic | Status @ 4.4.0 |
176
+ |-------|--------|----------------|
177
+ | **FR-PRE-POST-1** | `pre/synthesize` built-in + seed | **Open** |
178
+ | **FR-PRE-POST-2** | `post/audit-checklist`, `post/audit-merge` | **Open** (envelope **shipped** in ai-tasks) |
179
+ | **FR-PRE-POST-3** | `post/audit` | **Open** |
180
+ | **FR-PRE-POST-4** | `post/fix` | **Open** |
181
+ | **FR-PRE-POST-5** | `post/pick-best`, `post/craft-final` | **Open** |
182
+ | **FR-PRE-POST-6** | Wire execution/* + research/plan-questions from xynthesis | **Open** (built-ins **shipped**) |
183
+ | **FR-PRE-POST-7** | `buildSidekickTemplateContext` or FR-GEN-1 covering sidekick | **Open** |
184
+ | **FR-PRE-POST-8** | Export `SidekickGenericEnvelope` type from `@x12i/funcx/functions` (optional) | **Open** |
185
+
186
+ ---
187
+
188
+ ## 6. Acceptance criteria
189
+
190
+ - [ ] `XYNTHESIS_FUNCX_SIDEKICK=1` → `runSidekickGatewayCall` / `runExecutionPlan` use `run()`, not `loadSidekickTemplates`.
191
+ - [ ] Catalox items keep `funcx.functionId`; validator fails if missing when FuncX mode required.
192
+ - [ ] ai-tasks `runAuditPostStep` uses `post/audit-checklist` envelope (no `loadAuditTemplates` / `DEFAULT_SYSTEM`).
193
+ - [ ] Golden: FR-GEN-1 normalized prompt hash matches current xynthesis rendrix output.
194
+ - [ ] `InvokeAttemptSummary` / Activix record FuncX `functionId`, not only transport `xynthesis/synthesis` on `ask`.
195
+
196
+ ---
197
+
198
+ ## 7. Non-goals
199
+
200
+ - ai-skills MAIN gateway.
201
+ - FuncX ownership of template **cores** — cores stay rendrix; synthesis `input` may include pre-rendered downstream text only.
202
+
203
+ ---
204
+
205
+ ## 8. Version note
206
+
207
+ | Package | Version |
208
+ |---------|---------|
209
+ | `@x12i/funcx` | **4.4.0** — implement FR-PRE-POST-1..5 in **4.5.x** (suggested) |
210
+ | `@exellix/xynthesis` | **4.4.3** — map + envelopes shipped; gateway wiring pending |
211
+ | `@exellix/ai-tasks` | **8.5.2** — checklist envelopes shipped |
212
+
213
+ Implement **pre/post content** in FuncX *after* reading §1 of [funcx-generic-xynthesis-hosting.md](./funcx-generic-xynthesis-hosting.md) (do not re-invent envelope / attribution / `getRunJsonResult`).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exellix/ai-tasks",
3
- "version": "8.5.0",
3
+ "version": "8.5.3",
4
4
  "description": "Task orchestration for the Exellix stack: runTask() with local handlers or LLM-backed execution, task-scoped memory/context enrichment, and executor dispatch via @exellix/ai-skills. ERC-compliant.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -59,14 +59,8 @@
59
59
  "engines": {
60
60
  "node": ">=20"
61
61
  },
62
- "overrides": {
63
- "@x12i/activix": "$@x12i/activix",
64
- "@x12i/ai-profiles": "$@x12i/ai-profiles",
65
- "@x12i/catalox": "$@x12i/catalox",
66
- "@x12i/logxer": "$@x12i/logxer"
67
- },
68
62
  "dependencies": {
69
- "@exellix/ai-skills": "^6.0.0",
63
+ "@exellix/ai-skills": "^6.0.2",
70
64
  "@exellix/memorix-narrix-adapter": "^2.0.0",
71
65
  "@exellix/narrix-adapter-chat": "^2.0.0",
72
66
  "@exellix/narrix-adapter-docs": "^2.0.0",
@@ -78,7 +72,7 @@
78
72
  "@exellix/narrix-ingest": "^2.0.0",
79
73
  "@exellix/narrix-runner": "^2.0.0",
80
74
  "@exellix/narrix-web-scoper": "^2.0.0",
81
- "@exellix/xynthesis": "^4.4.0",
75
+ "@exellix/xynthesis": "^4.4.5",
82
76
  "@x12i/activix": "^8.5.0",
83
77
  "@x12i/ai-profiles": "^2.1.0",
84
78
  "@x12i/catalox": "^5.1.3",