@exellix/ai-tasks 8.5.2 → 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.
package/CHANGELOG.md CHANGED
@@ -20,21 +20,17 @@ The published **npm version** always matches **`version`** in [`package.json`](p
20
20
 
21
21
  - `setFuncxExecutionStrategyInvoker`, `setResearchPlanQuestionsFuncxInvoker`, direct `@x12i/funcx` dependency.
22
22
 
23
- ## [Unreleased]
23
+ ## [8.5.3] - 2026-06-04
24
24
 
25
- ### Changed (breaking)
26
-
27
- - **`RunTaskRequest.modelConfig` is required** on every `runTask()` call (all three slots). No env-based or hardcoded model defaults (`SYNTHESIS_MODEL`, `AUDIT_MODEL`, `POST_STEP_MODEL`, `"balanced"`, etc.) for model selection.
28
-
29
- ### Fixed
25
+ ### Changed
30
26
 
31
- - **PRE/MAIN model routing:** Root `RunTaskRequest.llmCall` is **MAIN-only** no longer copied into PRE synthesis compile. When `llmCall.model` duplicates `preActionModel` while `skillModel` differs (graph-engine PRE leakage), MAIN uses `skillModel`. Validation warning `MODEL_CONFIG_LLM_CALL_PRE_MAIN_COLLISION`.
27
+ - Bumped **`@exellix/xynthesis`** to **^4.4.5** and **`@exellix/ai-skills`** to **^6.0.2** for Optimixer **max-token retry** on PRE/POST (xynthesis) and MAIN (ai-skills): one automatic re-invoke when output hits the token limit and Optimixer returns **`retryPrediction`** (no host **`maxTokens`** required).
32
28
 
33
- ## [8.4.0] - 2026-06-01
29
+ ### Added
34
30
 
35
- ### Changed (breaking)
31
+ - Unit test **`runPostStepLlmCall.maxTokenRetry.test.ts`** (mock Optimixer + synthesis invoker; no live LLM).
36
32
 
37
- - **`RunTaskRequest.modelConfig`:** **3-slot triplet only** — `preActionModel`, `skillModel`, `postActionModel`. **`xynthesisModel` removed** (validation rejects with `NON_CANONICAL_MODEL_CONFIG`). PRE uses `preActionModel`; POST uses `postActionModel`.
33
+ ## [8.4.0] - 2026-06-01 — `preActionModel`, `skillModel`, `postActionModel`. **`xynthesisModel` removed** (validation rejects with `NON_CANONICAL_MODEL_CONFIG`). PRE uses `preActionModel`; POST uses `postActionModel`.
38
34
  - **`@x12i/ai-profiles` ^2.0.0:** Required `catalogLane` on profile resolution; ai-tasks defaults `"text"` ( `"image"` for `vision` ). Registry source defaults to `auto`.
39
35
  - **`@exellix/xynthesis` ^4.2.1:** Minimum for ai-profiles v2 alignment.
40
36
 
package/README.md CHANGED
@@ -1071,8 +1071,8 @@ Orchestrators send **model** + **sampling** + **`reasoningEffort`** + (for xynth
1071
1071
 
1072
1072
  | Phase | Package | Caller sends | Package owns |
1073
1073
  |-------|---------|--------------|--------------|
1074
- | **MAIN** | `@exellix/ai-skills` ≥6 | `modelConfig` → `{ model, temperature, topP, reasoningEffort, … }` | Optimixer + Catalox skill catalog (`maxTokens` on `ModelConfig` is rejected) |
1075
- | **PRE / POST / scoping / utility** | `@exellix/xynthesis` ≥4.3 | `outputExpectation` (required on every hop), optional `reasoningEffort`, `temperature`, `topP` | `resolveEffectiveMaxTokens` inside `executeXynthesisAction` |
1074
+ | **MAIN** | `@exellix/ai-skills` ≥6 | `modelConfig` → `{ model, temperature, topP, reasoningEffort, … }` | Optimixer + Catalox skill catalog (`maxTokens` on `ModelConfig` is rejected); **one automatic re-invoke** when output hits token limit and Optimixer returns `retryPrediction` |
1075
+ | **PRE / POST / scoping / utility** | `@exellix/xynthesis` ≥4.3 | `outputExpectation` (required on every hop), optional `reasoningEffort`, `temperature`, `topP` | `resolveEffectiveMaxTokens` inside `executeXynthesisAction`; **same one-shot max-token retry** via Optimixer `retryPrediction` |
1076
1076
 
1077
1077
  **Xynthesis `outputExpectation`** is sizing/density **intent** for Optimixer — not a literal token count. ai-tasks resolves a per-stage default when the caller omits it (`resolveOutputExpectation` / `resolveLlmOutputExpectationForXynthesis`).
1078
1078
 
@@ -15,15 +15,19 @@ Use this checklist when **`run(functionId, payload)`** must resolve (custom host
15
15
 
16
16
  Constants in this repo: [`src/execution-strategies/constants.ts`](../src/execution-strategies/constants.ts) — `FUNCX_EXECUTION_PLAN_FUNCTION_ID`, `FUNCX_EXECUTION_EVALUATE_RESULT_FUNCTION_ID`.
17
17
 
18
- ## 2. Optional function ID (web-scope via FuncX)
18
+ ## 2. Research / web-scope function ID
19
19
 
20
- | Capability | Canonical `functionId` |
21
- |------------|----------------------|
22
- | Research / web-scope questions | `research/plan-questions` |
20
+ | Capability | Canonical `functionId` | Registry key @ 4.4.0 |
21
+ |------------|----------------------|----------------------|
22
+ | Research / web-scope questions | `research/plan-questions` | `research-plan-questions` |
23
23
 
24
- Used only when callers run **`runPlanWebScopeQuestions({ backend: "funcx", })`** or when another host calls **`run()`** with the payload from **`buildResearchPlanQuestionsPayload`** (see [`genericExecutionFuncxEnvelope.ts`](../src/execution-strategies/genericExecutionFuncxEnvelope.ts)).
24
+ **@exellix/ai-tasks 8.5** calls **`@exellix/xynthesis`** `plan-web-scope-questions` (not direct `run()`). Use this id for smoke tests, custom hosts, or when xynthesis sets **`XYNTHESIS_FUNCX_SIDEKICK=1`**.
25
25
 
26
- Constant: **`FUNCX_RESEARCH_PLAN_QUESTIONS_FUNCTION_ID`**.
26
+ Payload: **`buildResearchPlanQuestionsPayload`** ([`genericExecutionFuncxEnvelope.ts`](../src/execution-strategies/genericExecutionFuncxEnvelope.ts)). Constant: **`FUNCX_RESEARCH_PLAN_QUESTIONS_FUNCTION_ID`** (re-export from `@x12i/funcx/functions` preferred).
27
+
28
+ ## 2b. Pre/post sidekick ids (not in 4.4.0 registry yet)
29
+
30
+ See [**funcx-pre-post-sidekick-actions.md**](./upstream-feature-requests/funcx-pre-post-sidekick-actions.md) §1 — `pre/synthesize`, `post/audit`, `post/fix`, `post/audit-checklist`, etc. Catalox seeds already reference these ids from xynthesis `sidekickFuncxCatalogMap.ts`.
27
31
 
28
32
  ---
29
33
 
@@ -8,9 +8,9 @@ This package routes **AI scoping** (and any other callers of `runLlmTextCall`) t
8
8
 
9
9
  **Need:** Every internal call used to carry stable `jobId` and `agentId` (and sometimes skill context) so logs and activity backends can tie completions to a task run.
10
10
 
11
- **Update (@x12i/funcx ≥ 3.6):** `AttributionContext` now includes optional **`jobId`**, **`taskId`**, and **`agentId`** (alongside `functionId`, `projectId`, `traceId`, `tags`). OpenRouter attribution can use `formatOpenRouterUserField(attribution)` where applicable.
11
+ **Update (@x12i/funcx ≥ 3.6 / 4.4.0):** `AttributionContext` includes **`jobId`**, **`taskId`**, **`agentId`**. For **`run()`** with generic envelopes, use **`buildAskAttribution(implFunctionId, envelope)`** from `@x12i/funcx/functions` — it merges `attribution` plus `runId` / `subjectId` / `actorId` and `tags` (see [funcx-generic-xynthesis-hosting.md](./upstream-feature-requests/funcx-generic-xynthesis-hosting.md) §1.3).
12
12
 
13
- **Remaining gap for other call sites:** Not every ai-tasks code path sets these fields on `ask()` yet (e.g. narrow scoping helpers may still omit them). Prefer threading identity from `RunTaskRequest` into `AskOptions.attribution` wherever FuncX is invoked directly.
13
+ **Remaining gap:** ai-tasks **scoping** (`runScopingCall`) may still omit full attribution on `ask()`. xynthesis execution/sidekick paths set attribution via envelope builders when FuncX mode is enabled.
14
14
 
15
15
  ## 2. High-level “one completion” helper
16
16
 
@@ -17,10 +17,10 @@ Fix reports filed for sibling packages. Hand these to the package owners; after
17
17
 
18
18
  | Package | Document | Status |
19
19
  |---------|----------|--------|
20
- | `@x12i/funcx` | [**funcx-generic-xynthesis-hosting.md**](./funcx-generic-xynthesis-hosting.md) | **open** — template `args`, post-step/scoping generics, xynthesis should delegate to `run()` |
21
- | `@x12i/funcx` | [**funcx-pre-post-sidekick-actions.md**](./funcx-pre-post-sidekick-actions.md) | **open** — built-ins for `pre/synthesize`, `post/audit`, + Catalox `funcx.functionId` mapping |
22
- | `@exellix/xynthesis` | `src/catalog/sidekickFuncxCatalogMap.ts` | **shipped (mapping)** — enable with `XYNTHESIS_FUNCX_SIDEKICK=1` after FuncX built-ins land |
23
- | `@exellix/ai-tasks` | [funcx-scoping-integration-gaps.md](../funcx-scoping-integration-gaps.md) §6 | **partial** — envelope adapters stable; 8.5+ calls xynthesis actions not `run()` |
20
+ | `@x12i/funcx` **4.4.0** | [**funcx-generic-xynthesis-hosting.md**](./funcx-generic-xynthesis-hosting.md) | **partial** — execution/research envelope + built-ins **shipped**; template-vars helper, `runGenericExecution`, sampling on `RunOptions` **open** |
21
+ | `@x12i/funcx` | [**funcx-pre-post-sidekick-actions.md**](./funcx-pre-post-sidekick-actions.md) | **open** — `pre/synthesize`, `post/*` built-ins; execution wire-only (FR-PRE-POST-6) |
22
+ | `@exellix/xynthesis` | `sidekickFuncxCatalogMap.ts`, `sidekickFuncxEnvelope.ts` | **shipped** — Catalox `funcx.functionId` on seeds; `XYNTHESIS_FUNCX_SIDEKICK=1` gates `run()` (not wired in gateway yet) |
23
+ | `@exellix/ai-tasks` | `auditChecklistFuncxEnvelope.ts`, [funcx-scoping-integration-gaps.md](../funcx-scoping-integration-gaps.md) §6 | **partial** — envelopes + adapters; 8.5+ uses xynthesis actions for execution/web-scope |
24
24
 
25
25
  ## Older / parallel tracks
26
26
 
@@ -1,294 +1,268 @@
1
1
  # `@x12i/funcx` — generic envelope hosting for xynthesis-domain capabilities
2
2
 
3
- **Filed by:** `@exellix/ai-tasks`
4
- **Consumers:** `@exellix/xynthesis` (LLM hops), `@exellix/ai-tasks` (envelope builders + adapters)
5
- **Out of scope:** `@exellix/ai-skills` MAIN gateway prompts (skill templates, `instructions` / `prompt` on `RunTaskRequest`)
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
6
7
 
7
8
  **Related:**
8
9
 
9
- - [`funcx-scoping-integration-gaps.md`](../funcx-scoping-integration-gaps.md) — scoping `ask()` gaps + §6 execution-strategy wire contracts
10
- - [`funcx-catalog-hosting-checklist.md`](../funcx-catalog-hosting-checklist.md) — deploy checklist for `run()` resolution
11
- - [`xynthesis-execution-strategies-option-a.md`](./xynthesis-execution-strategies-option-a.md) — **shipped** xynthesis 4.4 sidekick actions (interim: disk templates + `FuncxInvoker.ask`)
12
- - Envelope builders (stable): [`genericExecutionFuncxEnvelope.ts`](../../src/execution-strategies/genericExecutionFuncxEnvelope.ts)
13
- - Xynthesis templates today (duplicate host): `xynthesis/templates/execution-plan/`, `execution-evaluate-result/`, `plan-web-scope-questions/`
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)
14
15
 
15
16
  ---
16
17
 
17
18
  ## 0. Target architecture
18
19
 
19
- For every **xynthesis-domain** LLM capability (not ai-skills MAIN):
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 |
20
25
 
21
- 1. **Wire:** `GenericExecutionEnvelope` `goal`, `input`, `context`, optional `result`, `args`, `attribution`.
22
- 2. **Prompt host:** FuncX function (built-in or Catalox content) — templates read envelope fields and **`args`** for per-template customization (guidelines, caps, variant keys).
23
- 3. **Orchestration:** `@exellix/xynthesis` owns model resolution, Optimixer / `outputExpectation`, JSON parse, Activix, `InvokeAttemptSummary` — ideally by calling **`run(functionId, envelope, options)`** instead of re-rendering duplicate templates and calling `Client.ask` directly.
24
- 4. **ai-tasks:** Builds envelopes only; merges adapted JSON into `RunTaskRequest` (planner/optimizer/web-scope). No inline system prompts for these paths.
26
+ **Two envelope families** (do not conflate):
25
27
 
26
- **Today (gap):** FuncX already ships built-ins `execution-plan`, `execution-evaluate-result`, `research-plan-questions` with envelope-shaped I/O, but **xynthesis 4.4 re-hosts prompts** under sidekick templates and uses `executeXynthesisAction` + `FuncxInvoker.ask`. **Post-steps and AI scoping** still use **caller-built** `systemPrompt` / `userPrompt` strings in ai-tasks (partially duplicated vs xynthesis `templates/audit`, `templates/fix`).
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).
27
30
 
28
31
  ---
29
32
 
30
- ## 1. Auditwhere instructions live
33
+ ## 1. FuncX 4.4.0 shipped structure (source of truth)
31
34
 
32
- | Capability | Prompt / instructions today | Wire today | Generic envelope? | FuncX `run()`? |
33
- |------------|----------------------------|------------|-------------------|----------------|
34
- | **execution-plan** | `xynthesis/templates/execution-plan/*` + `buildExecutionStrategyPrompts` | xynthesis `RunExecutionPlanRequest` | Yes (ai-tasks builds payload) | Built-in exists; **not used** by xynthesis 4.4 |
35
- | **execution-evaluate-result** | Same pattern | xynthesis request + `result` | Yes | Built-in exists; **not used** |
36
- | **plan-web-scope-questions** | Same pattern | `goal` / `input` / `context` / `args` | Yes | `research-plan-questions` built-in; **not used** |
37
- | **synthesis (PRE)** | xynthesis `templates/synthesis/*` | `SidekickInput` + rendered skill text | **Sidekick envelope** (FR-PRE-POST) | **`pre/synthesize`** — **missing** |
38
- | **post-audit** | **ai-tasks** `loadAuditTemplates` + `DEFAULT_SYSTEM` | Pre-built prompts → `executeXynthesisAction` | **Sidekick envelope** | **`post/audit-checklist`** — **missing** |
39
- | **post-polish** | **ai-tasks** `loadPolishTemplates` + `DEFAULT_SYSTEM` | Pre-built prompts; Optimixer maps stage → `fix` | **Sidekick envelope** | **`post/fix`** — **missing** |
40
- | **ai-scoping** | **Inline** `SCOPING_SYSTEM` in `runScopingCall.ts` | Pre-built prompts; no `sidekickAction` | **No** | **Missing** |
41
- | **audit / fix / pick-best / craft-final** (xynthesis-native) | xynthesis `templates/{audit,fix,...}/*` | `runSidekickGatewayCall` when used | Sidekick envelope | **`post/*`** — **missing** (today: rendrix + `ask`) |
35
+ Reviewed from `@x12i/funcx` **4.4.0** (`dist/functions`, README). Use this when implementing or extending FRs.
42
36
 
43
- **Duplication risk:** xynthesis 4.4 execution-strategy templates and FuncX `content-seed` / Catalox prompts for the same three capabilities can drift unless one is canonical.
37
+ ### 1.1 Call surface
44
38
 
45
- **ai-tasks still correct for:** envelope construction (`buildPlannerGenericPayload`, `buildOptimizerGenericPayload`, `buildResearchPlanQuestionsPayload`) and response adapters (`adaptExecutionPlanResult`, etc.) — keep even when xynthesis calls FuncX internally.
46
-
47
- ---
48
-
49
- ## 2. FuncX feature requests (tracker)
50
-
51
- | FR id | Topic | Priority |
52
- |-------|--------|----------|
53
- | **FR-GEN-1** | Canonical **template context** from `GenericExecutionEnvelope` | P0 |
54
- | **FR-GEN-2** | **`args` → template customization** contract (document + validate) | P0 |
55
- | **FR-GEN-3** | **Output JSON schemas** aligned with ai-tasks adapters | P0 |
56
- | **FR-GEN-4** | **`run()` + `RunOptions`** for model, timeout, `response_format`, attribution | P1 |
57
- | **FR-GEN-5** | **`runGenericExecution`** helper (envelope → ask → parse → usage) for xynthesis | P1 |
58
- | **FR-GEN-6** | **Post-step generic** functions (`post/audit`, `post/polish` or `xynthesis/audit`) | P1 |
59
- | **FR-PRE-POST-*** | **Pre/post sidekick built-ins** + Catalox mapping — see [**funcx-pre-post-sidekick-actions.md**](./funcx-pre-post-sidekick-actions.md) | **P0** |
60
- | **FR-GEN-7** | **AI scoping** generic function (`scoping/run` or `research/scope-content`) | P2 |
61
- | **FR-GEN-8** | **`strategyArgs` vs `args`** on wire (or documented merge rule) | P1 |
62
- | **FR-GEN-9** | **Catalox seed parity** with xynthesis 4.4 templates + CI diff | P1 |
63
- | **FR-GEN-10** | **Deprecate** legacy `ai-tasks-plan-task` / `ai-tasks-optimizer-evaluate` ids | P2 |
64
- | **FR-GEN-11** | **Sidekick-shaped** post-steps via envelope (audit checks in `context`) | P2 |
65
- | **FR-GEN-12** | **Contract tests** package: envelope fixtures → expected adapter output | P1 |
66
-
67
- §6 in [`funcx-scoping-integration-gaps.md`](../funcx-scoping-integration-gaps.md) remains the **adapter-level** contract for execution/research ids; this doc adds **hosting + template** requirements.
68
-
69
- ---
70
-
71
- ### FR-GEN-1 — Canonical template context from envelope
72
-
73
- **Need:** Every generic execution/research built-in must render prompts from a **stable, documented** variable map derived from the envelope — not ad hoc TS string building in each consumer.
74
-
75
- **Require FuncX built-ins / Catalox templates to expose at minimum:**
76
-
77
- | Token / field | Source |
78
- |---------------|--------|
79
- | `goal` | `envelope.goal` (string, trimmed) |
80
- | `input_json` | `JSON.stringify(envelope.input ?? null)` with documented max length + truncation suffix |
81
- | `context_json` | `JSON.stringify(envelope.context ?? {})` — same truncation rules |
82
- | `result_json` | Optimizer / evaluate only — `envelope.result` |
83
- | `args_json` | `JSON.stringify(envelope.args ?? {})` |
84
- | `iteration_index` | `envelope.args.iterationIndex` when present (stringified) |
85
-
86
- **Ask:** Export `buildGenericExecutionTemplateContext(envelope): Record<string, string>` from `@x12i/funcx/functions` (or document it in `docs/migration-generic-execution.md`) so xynthesis can stop duplicating `executionStrategyPromptTemplate.ts` stringification.
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
+ ```
87
52
 
88
- **Acceptance:** xynthesis 4.4 templates and FuncX Catalox seeds use the **same** token names; one integration test compares rendered user prompt hashes for a golden fixture.
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 |
89
59
 
90
- ---
60
+ ### 1.2 `GenericExecutionEnvelope` (shipped)
91
61
 
92
- ### FR-GEN-2 — `args` → template-level customization
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
+ ```
93
73
 
94
- **Need:** Strategy rows and hosts pass opaque knobs in `args` (minus `functionId`) that **templates** read without new function ids — e.g. `customGuidelines`, `maxQuestions`, `allowSkip`, `templateVariant`, `density`.
74
+ **Not on the type today:** `strategyArgs` (xynthesis merges into `args` before `run()` see §2.3).
95
75
 
96
- **Today (ai-tasks / xynthesis):**
76
+ ### 1.3 `buildAskAttribution` (shipped)
97
77
 
98
- - Planner/optimizer: `strategyArgs` forwarded separately in xynthesis; FuncX types only document `args`.
99
- - Audit: `customAuditGuidelines` merged in ai-tasks `renderAuditSystem`, not in envelope.
100
- - Web-scope: `args.maxQuestions`, `args.sourceType`, `args.allowSkip`.
78
+ `buildAskAttribution(implFunctionId, req)` merges:
101
79
 
102
- **Ask:**
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`
103
83
 
104
- 1. Document **reserved vs extension** keys in `args` per function id (JSON Schema `args` sub-schemas in `fx/*/meta.json`).
105
- 2. Support **nested template overrides** via convention, e.g. `args.promptOverrides.systemSuffix`, `args.customGuidelines`, without breaking generic envelope validation.
106
- 3. Optional: `args._templateProfile: "strict" | "lenient"` to select Catalox template variant.
84
+ **xynthesis / ai-tasks today:** `buildSidekickFuncxAttribution` / `buildExecutionStrategyAttribution` set `runId`←jobId, `subjectId`←taskId, `actorId`←agentId compatible with FuncX merge rules.
107
85
 
108
- **Acceptance:** Changing only `args.customGuidelines` in a fixture changes the rendered system prompt in tests; no TypeScript change in consumers.
86
+ ### 1.4 `RunOptions` (shipped partial vs orchestrator needs)
109
87
 
110
- ---
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) |
111
94
 
112
- ### FR-GEN-3 Output JSON schemas aligned with ai-tasks adapters
95
+ ### 1.5 Hosting model (content + router)
113
96
 
114
- **Need:** Built-in outputs must match what [`adaptExecutionPlanResult`](../../src/execution-strategies/genericExecutionFuncxEnvelope.ts), [`adaptEvaluateResultResponse`](../../src/execution-strategies/genericExecutionFuncxEnvelope.ts), and [`adaptResearchPlanQuestionsResult`](../../src/execution-strategies/genericExecutionFuncxEnvelope.ts) expect.
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` |
115
102
 
116
- **Planner (`execution-plan` / `execution/plan`):**
117
- `plan?`, `instructions?`, `steps[]`, `assumptions[]`, `missingInputs[]`, optional `prompt`, `variables`, `templateTokens` (top-level or under `metadata`).
103
+ **Seed bundle:** `content-seed/functions/genericExecutionResearch.seed.json` `npm run content:primitives:sync` (see FuncX README § Catalox merged primitive seeds).
118
104
 
119
- **Optimizer (`execution-evaluate-result`):**
120
- `satisfied` (boolean), `feedback?`, `suggestedChanges[]`, `issues[]`, optional `variables`, `templateTokens`, `metadata`.
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.
121
106
 
122
- **Research (`research-plan-questions`):**
123
- `questions[]` with `question`, optional `reason`, `confidence`; optional `skipped`, `reasonCodes`.
107
+ ### 1.6 Built-in I/O types (shipped — align adapters)
124
108
 
125
- **Ask:** Publish machine-readable schemas next to built-ins; version with semver when fields change. Include **`getRunJsonResult`** normalization examples in docs.
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?` |
126
114
 
127
- **Gap vs xynthesis 4.4 parsers:** If FuncX adds fields, xynthesis `parseExecutionStrategyPayload` should defer to FuncX schema or share one JSON Schema file.
115
+ ai-tasks adapters: `adaptExecutionPlanResult`, `adaptEvaluateResultResponse`, `adaptResearchPlanQuestionsResult`.
128
116
 
129
117
  ---
130
118
 
131
- ### FR-GEN-4 `run()` + `RunOptions` for orchestrator controls
132
-
133
- **Need:** `@exellix/xynthesis` must pass **resolved model**, timeout, temperature, `response_format: json_object`, and merged **attribution** without re-implementing `ask()` options.
134
-
135
- **Ask:**
136
-
137
- - Extend `RunOptions` (or documented overload) with: `model`, `timeoutMs`, `temperature`, `topP`, `reasoningEffort`, `responseFormat`, `maxTokens` / completion cap hint.
138
- - Built-ins call `buildAskAttribution(implFunctionId, envelope)` internally when `attribution` is present.
139
- - Return shape includes **`usage`** and fields xynthesis maps to `InvokeAttemptSummary` (or document mapping table).
140
-
141
- **Acceptance:** xynthesis `invokeExecutionStrategyAction` can replace `executeXynthesisAction` + manual prompts with `run(FUNCX_EXECUTION_PLAN_FUNCTION_ID, payload, options)` while preserving observability parity.
142
-
143
- ---
119
+ ## 2. Consumer prep (shipped in mono-repo)
144
120
 
145
- ### FR-GEN-5 `runGenericExecution` helper for embedders
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` |
146
130
 
147
- **Need:** Thin API for packages that already own parse/Activix but should not fork prompt assembly.
131
+ ### 2.1 `strategyArgs` merge (consumer no FuncX FR)
148
132
 
149
- **Proposed export (`@x12i/funcx/functions`):**
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()`.
150
134
 
151
- ```ts
152
- runGenericExecution(opts: {
153
- functionId: string;
154
- envelope: GenericExecutionEnvelope;
155
- client?: Client;
156
- runOptions?: RunOptions;
157
- }): Promise<{ value: unknown; usage?: Usage; model?: string; raw?: unknown }>;
158
- ```
135
+ ### 2.2 Template token convention (parity gap)
159
136
 
160
- **Behavior:** Resolve content → render templates from FR-GEN-1 context → `ask` / `askJson` → validate against function output schema → return parsed object.
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 |
161
141
 
162
- **Acceptance:** xynthesis deletes duplicate template render path when this ships; tests use `createAskMock` at FuncX boundary only.
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.
163
143
 
164
144
  ---
165
145
 
166
- ### FR-GEN-6Post-step generic functions (audit, polish)
167
-
168
- **Need:** Remove ai-tasks **inline** `DEFAULT_SYSTEM` and duplicate template trees; use envelope + FuncX templates.
169
-
170
- **Proposed ids:**
171
-
172
- | Capability | Suggested `functionId` | Envelope highlights |
173
- |------------|------------------------|---------------------|
174
- | Audit evaluator | `post/audit` or `xynthesis/audit` | `goal`: audit objective; `input`: output under test; `context`: checks, synthesis excerpt, pass metadata; `args`: `customGuidelines`, `passNumber` |
175
- | Polish | `post/polish` or `xynthesis/fix` | `input`: draft output; `context`: checklist, prior pass notes; `args`: `customGuidelines` |
176
-
177
- **Output:** Audit — markdown or structured sections; Polish — JSON `{ polishedOutput, changeNotes }` per current ai-tasks parsers.
146
+ ## 3. Audit instructions vs `run()` (current)
178
147
 
179
- **Acceptance:** `runAuditCall` / `runPolishCall` build envelope + `run()`; xynthesis `executeXynthesisAction` only for transport if still needed, or xynthesis wraps FR-GEN-5.
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** |
180
154
 
181
155
  ---
182
156
 
183
- ### FR-GEN-7 AI scoping generic function
184
-
185
- **Need:** Replace `SCOPING_SYSTEM` constant in [`runScopingCall.ts`](../../src/aiScoping/runScopingCall.ts).
186
-
187
- **Proposed id:** `scoping/run` or `research/scope-content`
188
-
189
- **Envelope:**
190
-
191
- - `goal`: scoping directive (from caller `instructions`)
192
- - `input`: `{ sourceContent: string }` or raw string policy documented
193
- - `args`: `outputExpectation` hints, `maxOutputLength`
194
-
195
- **Output:** Plain text scoped result (no markdown / fences) — document in schema.
196
-
197
- **Acceptance:** No inline system string in ai-tasks; FuncX template owns behavior.
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) |
198
175
 
199
176
  ---
200
177
 
201
- ### FR-GEN-8 `strategyArgs` vs `args` on wire
178
+ ## 5. Open FR details (only what 4.4.0 does not cover)
202
179
 
203
- **Need:** ai-tasks execution strategies pass catalog row `args` (minus `functionId`) while xynthesis 4.4 also accepts `strategyArgs` on the request object.
180
+ ### FR-GEN-1 Template variables from envelope
204
181
 
205
- **Options (pick one in FuncX):**
206
-
207
- 1. **Merge rule:** At `run()` entry, `effectiveArgs = { ...envelope.args, ...envelope.strategyArgs }` if `strategyArgs` is added to `GenericExecutionEnvelope`.
208
- 2. **Document:** Consumers must fold `strategyArgs` into `args` before `run()`; export `mergeStrategyArgs(envelope)` helper.
209
-
210
- **Ask:** Update `GenericExecutionEnvelope` TypeScript type and `genericExecutionEnvelopeJsonSchema` if `strategyArgs` becomes first-class.
211
-
212
- ---
213
-
214
- ### FR-GEN-9 — Catalox seed parity with xynthesis 4.4
215
-
216
- **Need:** Single canonical prompt source.
182
+ **Need:** One function used by content-backed built-ins and xynthesis so Catalox instructions and `xynthesis/templates/*` stay aligned.
217
183
 
218
184
  **Ask:**
219
185
 
220
- 1. Diff `xynthesis/templates/execution-*` and `plan-web-scope-questions` against `content-seed/functions/genericExecutionResearch.seed.json` (or per-function seeds).
221
- 2. CI job fails on drift unless bumping `contentVersion`.
222
- 3. Document sync procedure: xynthesis exports → FuncX seed import (or FuncX seed → xynthesis pull).
186
+ ```ts
187
+ envelopeToTemplateVariables(
188
+ envelope: GenericExecutionEnvelope | SidekickGenericEnvelope
189
+ ): Record<string, string>;
190
+ ```
223
191
 
224
- **Acceptance:** Product can disable xynthesis disk templates when Catalox actions enabled (`isCataloxActionsEnabled`) without behavior change.
192
+ Minimum keys: parity with `buildExecutionStrategyUserVars` **and** nested `input.goal` style for `renderInstructionTemplate`.
225
193
 
226
- ---
194
+ ### FR-GEN-2 — `args` contract
227
195
 
228
- ### FR-GEN-10 Deprecate legacy ai-tasks function ids
196
+ Document reserved keys per `functionId` in `fx/*/meta.json`. Execution/research: `maxQuestions`, `allowSkip`, `sourceType`, `iterationIndex`, `customGuidelines`, `templateMode`, …
229
197
 
230
- **Need:** FuncX registry still lists `ai-tasks-plan-task`, `ai-tasks-optimizer-evaluate` alongside `execution-plan`, `execution-evaluate-result`.
198
+ ### FR-GEN-3 Shared output JSON Schema
231
199
 
232
- **Ask:** Mark legacy ids deprecated in meta; route aliases to generic built-ins; remove from seed catalog after one major.
200
+ Export versioned schemas next to built-ins; xynthesis `parseExecutionStrategyPayload` / sidekick parsers consume same files.
233
201
 
234
- ---
202
+ ### FR-GEN-4 — Orchestrator sampling on `run()`
235
203
 
236
- ### FR-GEN-11 Sidekick-shaped post-steps via envelope (optional)
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()`.
237
205
 
238
- **Need:** Audit today uses rich `SidekickInput` (checks array, material blocks). Migrating to envelope should not lose structure.
206
+ ### FR-GEN-5 `runGenericExecution`
239
207
 
240
- **Ask:** Define `context.audit` sub-schema (checks, outputText, synthesisSummary, …) in FR-GEN-6 meta so templates stay declarative.
208
+ Thin wrapper: resolve content → render → `askJson` `getRunJsonResult` → return `{ value, usage, model }`. Sidekick variant accepts `SidekickGenericEnvelope` (FR-PRE-POST-5).
241
209
 
242
- ---
210
+ ### FR-GEN-9 — Seed parity
243
211
 
244
- ### FR-GEN-12 Contract tests for adapters
212
+ Compare `genericExecutionResearch.seed.json` + deployed `fx/execution-plan/*` to `xynthesis/templates/execution-*` using **FR-GEN-1** normalized variables.
245
213
 
246
- **Need:** Prevent drift between FuncX built-in output and ai-tasks adapters.
214
+ ### FR-GEN-10 Legacy ids
247
215
 
248
- **Ask:** Ship `test/fixtures/generic-execution/*.json` in `@x12i/funcx` run in CI; ai-tasks imports fixtures or duplicates with cross-package version pin.
216
+ Alias `ai-tasks-plan-task` `execution-plan`, `ai-tasks-optimizer-evaluate` `execution-evaluate-result`; mark deprecated in seed meta.
249
217
 
250
218
  ---
251
219
 
252
- ## 3. Recommended convergence path
220
+ ## 6. Convergence path
253
221
 
254
222
  ```mermaid
255
223
  flowchart LR
256
- subgraph ai_tasks
257
- A[buildPlannerGenericPayload]
224
+ subgraph consumers
225
+ AT[ai-tasks envelope builders]
226
+ XY[xynthesis run* / gateway]
258
227
  end
259
- subgraph xynthesis
260
- B[runExecutionPlan]
261
- C{FR-GEN-5 shipped?}
228
+ subgraph funcx44 [FuncX 4.4 shipped]
229
+ RUN[run slash id]
230
+ ATTR[buildAskAttribution]
231
+ SEED[genericExecutionResearch seed]
262
232
  end
263
- subgraph funcx
264
- D[run execution-plan]
265
- E[Catalox templates + args]
233
+ subgraph funcxNext [FuncX next]
234
+ PRE[pre/post built-ins]
235
+ VARS[envelopeToTemplateVariables]
266
236
  end
267
- A --> B
268
- B --> C
269
- C -->|yes| D
270
- C -->|interim 4.4| F[disk templates + ask]
271
- D --> E
272
- F --> E
237
+ AT --> XY
238
+ XY -->|XYNTHESIS_FUNCX_SIDEKICK=1| RUN
239
+ RUN --> ATTR
240
+ RUN --> SEED
241
+ PRE --> RUN
242
+ VARS --> SEED
273
243
  ```
274
244
 
275
- 1. **FuncX:** Implement FR-GEN-1–3, FR-GEN-9 (canonical prompts + schemas).
276
- 2. **FuncX:** FR-GEN-4–5 so xynthesis can call `run()` without duplicate `executionStrategyPromptTemplate.ts`.
277
- 3. **xynthesis:** Follow-up FR (separate doc) — switch `invokeExecutionStrategyAction` to FuncX `run()`; keep parsers/adapters.
278
- 4. **ai-tasks:** FR-GEN-6–7 for audit/polish/scoping; stop shipping `DEFAULT_SYSTEM` strings.
279
- 5. **Docs:** Update [`funcx-catalog-hosting-checklist.md`](../funcx-catalog-hosting-checklist.md) — built-ins are canonical; Catalox overrides via `args`.
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.
280
249
 
281
250
  ---
282
251
 
283
- ## 4. Non-goals
252
+ ## 7. Non-goals
284
253
 
285
- - Changing ai-skills MAIN `instructions` / `prompt` contract.
286
- - Moving synthesis PRE-step template **cores** (`{{core:analysis}}`) into FuncX — cores stay rendrix/ai-skills; FuncX hosts the **synthesis action** via `pre/synthesize` (see [funcx-pre-post-sidekick-actions.md](./funcx-pre-post-sidekick-actions.md)).
287
- - Forcing ai-tasks to call `@x12i/funcx` directly again for execution strategies (xynthesis remains the facade after FR-GEN-5).
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).
288
257
 
289
258
  ---
290
259
 
291
- ## 5. Version note
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 |
292
267
 
293
- - **@x12i/funcx** **4.2.0** (ai-tasks dep): `FUNCX_*_FUNCTION_ID`, `genericExecutionEnvelopeJsonSchema`, `buildAskAttribution`, `getRunJsonResult`.
294
- - Built-in ids in registry: `execution-plan`, `execution-evaluate-result`, `research-plan-questions` (slash aliases normalize per README).
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.
@@ -1,301 +1,213 @@
1
1
  # `@x12i/funcx` — built-in functions for xynthesis **pre-actions** and **post-actions**
2
2
 
3
3
  **Filed by:** `@exellix/ai-tasks` + `@exellix/xynthesis`
4
- **Blocks:** Catalox-only sidekick path (`runXynthesisAiAction`), ai-tasks audit/polish migration off inline templates
5
- **Related:** [funcx-generic-xynthesis-hosting.md](./funcx-generic-xynthesis-hosting.md), [funcx-catalog-hosting-checklist.md](../funcx-catalog-hosting-checklist.md)
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)
6
7
 
7
8
  ---
8
9
 
9
10
  ## 0. Problem
10
11
 
11
- Today xynthesis **pre-actions** (synthesis) and **post-actions** (audit, fix, pick-best, craft-final) load prompts from:
12
+ **Shipped in FuncX 4.4.0:** `run("execution/plan" | "execution/evaluate-result" | "research/plan-questions", GenericExecutionEnvelope)` with Catalox content under `genericExecutionResearch` seed.
12
13
 
13
- 1. On-disk `xynthesis/templates/{actionType}/`, or
14
- 2. Catalox catalogs `pre-actions` / `post-actions` (same template bodies, seeded from disk).
14
+ **Not shipped:** Sidekick pre/post capabilities (`pre/synthesize`, `post/audit`, …). Today:
15
15
 
16
- The LLM hop uses **`FuncxInvoker.ask(systemPrompt, userPrompt)`** — a **transport-only** use of FuncX. Prompt text is assembled in xynthesis (`sidekickPromptTemplate.ts` + rendrix), **not** resolved from a FuncX **function id** via `run(functionId, envelope)`.
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`).
17
19
 
18
- **ai-tasks** often bypasses even that path: it loads **its own** audit/polish templates and calls `executeXynthesisAction` with pre-built prompts.
19
-
20
- **Target:** Each sidekick action has a **first-class FuncX function** (like `execution/plan`). xynthesis calls `run(functionId, envelope, runOptions)`; Catalox `pre-actions` / `post-actions` items **reference** the same `functionId` for content overrides, not duplicate template hosting.
20
+ **Target:** Register pre/post built-ins like execution family `run(functionId, SidekickGenericEnvelope, runOptions)`; Catalox items keep `funcx.functionId` for overrides only.
21
21
 
22
22
  ---
23
23
 
24
- ## 1. Canonical mapping (FuncX Catalox ↔ sidekick)
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()`)
25
29
 
26
- | Phase | Sidekick `actionType` | Catalox catalog | Catalox item id | Proposed FuncX `functionId` | Hyphen alias |
27
- |-------|----------------------|-----------------|-----------------|----------------------------|--------------|
28
- | PRE | `synthesis` | `pre-actions` | `synthesis` | `pre/synthesize` | `pre-synthesize` |
29
- | PRE | `execution-plan` | `pre-actions` | `execution-plan` | `execution/plan` | `execution-plan` |
30
- | PRE | `plan-web-scope-questions` | `pre-actions` | `plan-web-scope-questions` | `research/plan-questions` | `research-plan-questions` |
31
- | POST | `audit` | `post-actions` | `audit` | `post/audit` | `post-audit` |
32
- | POST | `fix` | `post-actions` | `fix` | `post/fix` | `post-fix` |
33
- | POST | `pick-best` | `post-actions` | `pick-best` | `post/pick-best` | `post-pick-best` |
34
- | POST | `craft-final` | `post-actions` | `craft-final` | `post/craft-final` | `post-craft-final` |
35
- | POST | `execution-evaluate-result` | `post-actions` | `execution-evaluate-result` | `execution/evaluate-result` | `execution-evaluate-result` |
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** |
36
40
 
37
- **ai-tasks pipeline audit (weighted checks, markdown output)** — separate from sidekick JSON audit until unified:
41
+ **ai-tasks-only POST pipeline** (not `SidekickActionType` today):
38
42
 
39
- | Capability | Proposed FuncX id | Catalox (optional) |
40
- |------------|-------------------|-------------------|
41
- | Checklist audit evaluator | `post/audit-checklist` | `post-actions` item `audit-checklist` |
42
- | Audit-cycle synthesis merge | `post/audit-merge` | `post-actions` item `audit-merge` or reuse `pre/synthesize` with `args.profile: "audit-merge"` |
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** |
43
47
 
44
- Constants and envelope builders live in xynthesis: `src/catalog/sidekickFuncxCatalogMap.ts`, `src/sidekickFuncxEnvelope.ts`.
48
+ Catalox seed writes `funcx: { functionId, contentVersion: "0.0.0-pending-funcx" }` on every mapped sidekick item (`buildXynthesisSeedPayloads.ts`).
45
49
 
46
50
  ---
47
51
 
48
- ## 2. Wire contract — sidekick generic envelope
52
+ ## 2. Wire contract — `SidekickGenericEnvelope`
49
53
 
50
- Extend (or sibling-type) **`GenericExecutionEnvelope`** for sidekick actions:
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).
51
55
 
52
56
  ```ts
53
57
  type SidekickGenericEnvelope = {
54
- /** Directive: question / objective / instruction (maps to SidekickInput.task). */
55
- goal: string;
56
- /** Action-specific payload (see §3 per function). */
57
- input: Record<string, unknown>;
58
- /** Shared sidekick context. */
58
+ goal: string; // SidekickInput.task
59
+ input: Record<string, unknown>; // action-specific (§3)
59
60
  context: {
60
61
  templateCores: string[];
61
62
  taskType?: string;
62
63
  metadata?: Record<string, unknown>;
63
- /** Optimizer-only / evaluate-only fields when applicable. */
64
- result?: unknown;
64
+ result?: unknown; // optimizer context when needed
65
65
  iterationIndex?: number;
66
+ identity?: ActivityRunContext;
66
67
  };
67
- /** Template customization NOT merged into LLM attribution tags by default. */
68
- args?: {
69
- templateMode?: "structured" | "markdown";
70
- customGuidelines?: string;
71
- synthesisPromptOverride?: string;
72
- /** Checklist audit: passNumber, cycle, maxCycles, … */
73
- [key: string]: unknown;
74
- };
75
- attribution?: GenericFuncxAttribution;
68
+ args?: Record<string, unknown>; // templateMode, customGuidelines,
69
+ attribution?: SidekickFuncxAttribution;
76
70
  };
77
71
  ```
78
72
 
79
- **Template context tokens** (FR-GEN-1 superset) — FuncX must render from envelope, matching xynthesis rendrix vars today:
80
-
81
- | Token | Envelope source |
82
- |-------|-----------------|
83
- | `task`, `question` | `goal` (both aliases for synthesis compat) |
84
- | `local_raw` | `input.localRaw` stringified |
85
- | `supporting_raw` | `input.supportingRaw` stringified |
86
- | `rendered_downstream_instructions` | `input.renderedInstructions` |
87
- | `rendered_downstream_prompt` | `input.renderedPrompt` |
88
- | `ai_output` | `input.aiOutput` |
89
- | `used_instructions` | `input.usedInstructions` |
90
- | `used_prompt` | `input.usedPrompt` |
91
- | `prior_audit_json` | `JSON.stringify(input.priorAudit)` |
92
- | `candidates_json` | `JSON.stringify(input.candidates)` |
93
- | `prior_context` | `input.priorContext` |
94
- | `metadata_json` | `JSON.stringify(context.metadata ?? {})` |
95
- | `template_cores_json` | `JSON.stringify(context.templateCores)` |
96
- | `goal`, `input_json`, `context_json`, `args_json` | FR-GEN-1 generic tokens (execution-strategy family) |
97
-
98
- **Ask (FuncX):** export `buildSidekickTemplateContext(envelope): Record<string, string>` alongside `buildGenericExecutionTemplateContext`.
99
-
100
- ---
101
-
102
- ## 3. Per-function specifications
103
-
104
- ### FR-PRE-1 — `pre/synthesize` (PRE synthesis)
105
-
106
- **Canonical content:** `xynthesis/templates/synthesis/system-structured.md` + `user-structured.md` (and markdown variants).
107
-
108
- **Envelope `input`:**
73
+ **Builders (shipped):**
109
74
 
110
- | Field | Type | Required |
111
- |-------|------|----------|
112
- | `localRaw` | any | no |
113
- | `supportingRaw` | any | no |
114
- | `renderedInstructions` | string | no |
115
- | `renderedPrompt` | string | no |
75
+ - `buildSidekickGenericEnvelope(input, options?)` synthesis, audit, fix, pick-best, craft-final
76
+ - `buildExecutionStrategyGenericEnvelope(req)` — planner / optimizer / web-scope (merges `strategyArgs` → `args`)
116
77
 
117
- **Output JSON** (matches `parseAndValidateSynthesizedPromptPayload` / `SynthesisPayload`):
78
+ **Attribution:** `buildSidekickFuncxAttribution({ funcxFunctionId, jobId, taskId, agentId })` align with FuncX `buildAskAttribution(implId, envelope)`.
118
79
 
119
- - `templateCores`, `task`, `synthesized` (`SynthesizedContext`), optional `notes`, `unknowns`, `assumptions`
80
+ ### 2.1 Template tokens (for Catalox instructions)
120
81
 
121
- **`args`:** `templateMode`, `customGuidelines`, `synthesisPromptOverride`, `maxItemsPerSide`, `maxItemContentChars`
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).
122
83
 
123
- **Response format:** `json_object`
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) |
124
98
 
125
99
  ---
126
100
 
127
- ### FR-POST-1 `post/audit` (sidekick JSON audit)
128
-
129
- **Canonical content:** `xynthesis/templates/audit/*`
101
+ ## 3. Per-function specifications (to implement in FuncX)
130
102
 
131
- **Envelope `input`:**
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.
132
104
 
133
- | Field | Type | Required |
134
- |-------|------|----------|
135
- | `aiOutput` | string | yes |
136
- | `usedInstructions` | string | no |
137
- | `usedPrompt` | string | no |
105
+ ### FR-PRE-POST-1 `pre/synthesize` (P0)
138
106
 
139
- **Output JSON** (matches `parseAuditPayload`):
107
+ **Canonical content:** `xynthesis/templates/synthesis/system-structured.md`, `user-structured.md` (+ markdown pair).
140
108
 
141
- - `verdict`: `"pass" | "fail" | "mixed"`
142
- - `findings[]`: `{ id, label, content, severity? }`
143
- - plus sidekick base fields (`notes`, `unknowns`, `assumptions`, …)
109
+ **`input`:** `localRaw`, `supportingRaw`, `renderedInstructions`, `renderedPrompt`, plus string mirrors `local_raw`, `supporting_raw`.
144
110
 
145
- ---
111
+ **Output:** matches `parseAndValidateSynthesizedPromptPayload` / `SynthesisPayload` (`templateCores`, `task`, `synthesized`, `notes`, `unknowns`, `assumptions`).
146
112
 
147
- ### FR-POST-2 `post/audit-checklist` (ai-tasks weighted audit)
113
+ **`args`:** `templateMode`, `customGuidelines`, `synthesisPromptOverride`, `maxItemsPerSide`, `maxItemContentChars`.
148
114
 
149
- **Canonical content:** migrate from ai-tasks `templates/post-steps/audit/` (Handlebars → FuncX templates with same variables).
115
+ ### FR-PRE-POST-2 `post/audit-checklist` + `post/audit-merge` (P1)
150
116
 
151
- **Envelope `input`:**
117
+ **Checklist** — migrate ai-tasks `templates/post-steps/audit/`:
152
118
 
153
- | Field | Type | Required |
154
- |-------|------|----------|
155
- | `candidateOutput` | string | yes |
156
- | `originalInput` | string | yes |
157
- | `promptContext` | string | no |
158
- | `mustChecks` | `{ check, weight }[]` | yes |
159
- | `shouldChecks` | `{ check, weight }[]` | yes |
160
- | `previousFeedback` | string | no |
119
+ **`input`:** `candidateOutput`, `originalInput`, `promptContext`, `mustChecks`, `shouldChecks`, `previousFeedback`, `previousCycle` (see `buildAuditChecklistFuncxEnvelope`).
161
120
 
162
- **Output:** structured markdown (`### Checks`, `### Overall feedback`) — parsed by ai-tasks `parseAuditOutputFromMarkdown` until FuncX ships JSON schema variant.
121
+ **Output:** markdown `### Checks` / `### Overall feedback` until JSON schema exists.
163
122
 
164
- **`args`:** `customAuditGuidelines`, `passNumber`, `cycle`, `maxCycles`
123
+ **`args`:** `customAuditGuidelines`, `passNumber`, `cycle`, `maxCycles`.
165
124
 
166
- ---
125
+ **Merge** — `buildAuditMergeFuncxEnvelope`: `input.candidateA`, `input.candidateB`, `context.task`.
167
126
 
168
- ### FR-POST-3 — `post/fix` (polish / fix)
127
+ ### FR-PRE-POST-3 — `post/audit` (P0)
169
128
 
170
- **Canonical content:** `xynthesis/templates/fix/*`
129
+ **Content:** `xynthesis/templates/audit/*`. **`input`:** `aiOutput`, `usedInstructions?`, `usedPrompt?`. **Output:** `parseAuditPayload` shape (`verdict`, `findings[]`, …).
171
130
 
172
- **Envelope `input`:** `aiOutput`, `usedInstructions?`, `usedPrompt?`, `priorAudit?` (AuditPayload)
131
+ ### FR-PRE-POST-4 `post/fix` (P0)
173
132
 
174
- **Output JSON:** `fixes[]` with `{ id, label, corrected, rationale? }` per `parseFixPayload`
133
+ **Note:** sidekick action is **`fix`** (polish), not `post/polish`. **Content:** `xynthesis/templates/fix/*`. **Output:** `parseFixPayload` (`fixes[]`).
175
134
 
176
- ---
135
+ ### FR-PRE-POST-5 — `post/pick-best`, `post/craft-final` (P0)
177
136
 
178
- ### FR-POST-4 `post/pick-best`
137
+ Per `parsePickBestPayload` / `parseCraftFinalPayload` and existing disk templates.
179
138
 
180
- **Envelope `input`:** `candidates[]` (`{ id, content }`), `usedInstructions?`
139
+ ### FR-PRE-POST-6 Execution ids (P0 wire only)
181
140
 
182
- **Output JSON:** `selected`, `rankings[]` per `parsePickBestPayload`
183
-
184
- ---
141
+ **Already in FuncX 4.4.0.** Remaining work:
185
142
 
186
- ### FR-POST-5 `post/craft-final`
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)
187
146
 
188
- **Envelope `input`:** `aiOutput`, `usedInstructions?`, `usedPrompt?`, `priorContext?`
189
-
190
- **Output JSON:** per `parseCraftFinalPayload` (`finalOutput`, `rationale?`, …)
147
+ No new FuncX function definitions required if `fx/execution-plan/*` matches xynthesis templates.
191
148
 
192
149
  ---
193
150
 
194
- ### FR-PRE-POST-6 Execution-strategy ids (already exist wire only)
195
-
196
- **No new FuncX content required** if seeds match xynthesis templates (FR-GEN-9). xynthesis must **stop** re-rendering `executionStrategyPromptTemplate.ts` and call:
197
-
198
- - `run("execution/plan", envelope)`
199
- - `run("execution/evaluate-result", envelope)`
200
- - `run("research/plan-questions", envelope)`
201
-
202
- Catalox `pre-actions` / `post-actions` items for these actions gain `funcx.functionId` pointing at built-ins; templates in Catalox become **overrides** only.
151
+ ## 4. Catalox catalog shape (consumershipped)
203
152
 
204
- ---
205
-
206
- ## 4. Catalox catalog shape (consumer-side, after FuncX ships)
207
-
208
- Each `XynthesisActionItem` in `pre-actions` / `post-actions` should include:
209
-
210
- ```json
211
- {
212
- "actionType": "audit",
213
- "funcx": {
214
- "functionId": "post/audit",
215
- "contentVersion": "1.0.0"
216
- },
217
- "templates": { "structured": { "system": "...", "user": "..." } },
218
- "actionOutputDefaults": { ... },
219
- "outputIntent": { ... }
220
- }
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
+ };
221
159
  ```
222
160
 
223
- **Resolution order (xynthesis):**
161
+ **Resolution order (target):**
224
162
 
225
- 1. If `XYNTHESIS_FUNCX_SIDEKICK=1` (new flag): `run(item.funcx.functionId, buildSidekickGenericEnvelope(input), runOptions)`.
226
- 2. Else if `XYNTHESIS_CATALOX_ACTIONS=1`: Catalox templates + rendrix (today).
227
- 3. Else: disk templates (dev/tests).
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).
228
166
 
229
- When (1) is active, Catalox `templates` are **ignored for prompt text** unless FuncX catalog points at Catalox-hosted function content (FuncX content-seed parity).
167
+ When (1) is on, Catalox `templates` are **fallback overrides** only if FuncX resolver supports content overrides (same as other `fx/*` functions).
230
168
 
231
169
  ---
232
170
 
233
- ## 5. FuncX package asks (summary tracker)
171
+ ## 5. FuncX package tracker (pre/post only)
234
172
 
235
- | FR id | Topic | Priority |
236
- |-------|--------|----------|
237
- | **FR-PRE-POST-1** | Register **`pre/synthesize`**, **`post/audit`**, **`post/fix`**, **`post/pick-best`**, **`post/craft-final`** built-ins | **P0** |
238
- | **FR-PRE-POST-2** | Register **`post/audit-checklist`**, **`post/audit-merge`** for ai-tasks POST pipeline | **P1** |
239
- | **FR-PRE-POST-3** | **`buildSidekickTemplateContext(envelope)`** export | **P0** |
240
- | **FR-PRE-POST-4** | Output JSON schemas = xynthesis parser contracts (§3) | **P0** |
241
- | **FR-PRE-POST-5** | `runSidekickGeneric(opts)` or extend FR-GEN-5 `runGenericExecution` for sidekick envelope | **P1** |
242
- | **FR-PRE-POST-6** | Content-seed from `xynthesis/templates/{synthesis,audit,fix,...}` + CI drift vs Catalox | **P1** |
243
- | **FR-PRE-POST-7** | Wire existing **`execution/*`** + **`research/plan-questions`** as canonical for pre/post catalog items (deprecate xynthesis duplicate render path) | **P0** |
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.
244
174
 
245
- Depends on [funcx-generic-xynthesis-hosting.md](./funcx-generic-xynthesis-hosting.md) **FR-GEN-1–5** for `RunOptions`, usage return shape, and generic template context.
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** |
246
185
 
247
186
  ---
248
187
 
249
- ## 6. Acceptance criteria (end-to-end)
188
+ ## 6. Acceptance criteria
250
189
 
251
- - [ ] With `XYNTHESIS_FUNCX_SIDEKICK=1`, `runSidekickGatewayCall` never calls `loadSidekickTemplates` for registered actions; prompts come from FuncX `run()`.
252
- - [ ] Catalox `pre-actions` / `post-actions` items include `funcx.functionId`; validation fails if missing when FuncX mode enabled.
253
- - [ ] ai-tasks `runAuditPostStep` builds `post/audit-checklist` envelope no `loadAuditTemplates` / `DEFAULT_SYSTEM`.
254
- - [ ] ai-tasks PRE structured synthesis uses `pre/synthesize` via xynthesis (not local template load + `executeXynthesisAction`).
255
- - [ ] Golden fixture: same envelope FuncX rendered prompts hash-equal to current xynthesis rendrix output (FR-GEN-9 parity).
256
- - [ ] `sidekickAction` on Activix / `InvokeAttemptSummary` records FuncX `functionId`, not only transport `ask`.
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`.
257
195
 
258
196
  ---
259
197
 
260
- ## 7. Convergence (mermaid)
261
-
262
- ```mermaid
263
- flowchart TB
264
- subgraph ai_tasks
265
- AT[buildSidekick envelope data]
266
- end
267
- subgraph xynthesis
268
- XY[runSidekickGatewayCall / runXynthesisAiAction]
269
- MAP[sidekickFuncxCatalogMap]
270
- ENV[buildSidekickGenericEnvelope]
271
- end
272
- subgraph funcx
273
- RUN["run(functionId, envelope)"]
274
- TPL[Catalox / content-seed templates]
275
- end
276
- subgraph catalox
277
- PRE[pre-actions catalog]
278
- POST[post-actions catalog]
279
- end
280
- AT --> XY
281
- XY --> MAP
282
- MAP --> ENV
283
- ENV --> RUN
284
- RUN --> TPL
285
- PRE -.->|funcx.functionId + optional override| MAP
286
- POST -.->|funcx.functionId + optional override| MAP
287
- ```
198
+ ## 7. Non-goals
288
199
 
289
- ---
290
-
291
- ## 8. Non-goals
292
-
293
- - ai-skills MAIN gateway (`instructions` / `prompt` on `RunTaskRequest`).
294
- - Moving template **cores** (`{{core:analysis}}`) into FuncX — still rendrix/ai-skills concern; synthesis **input** may include pre-rendered downstream blocks only.
200
+ - ai-skills MAIN gateway.
201
+ - FuncX ownership of template **cores** — cores stay rendrix; synthesis `input` may include pre-rendered downstream text only.
295
202
 
296
203
  ---
297
204
 
298
- ## 9. Version note
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 |
299
212
 
300
- - **@x12i/funcx** **4.4.0** (xynthesis dep): `run`, `getRunJsonResult`, `GenericExecutionEnvelope`, `Client.ask`.
301
- - New built-ins require FuncX release + content-seed; xynthesis gates behind **`XYNTHESIS_FUNCX_SIDEKICK=1`** until parity tests pass.
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.2",
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",
@@ -60,7 +60,7 @@
60
60
  "node": ">=20"
61
61
  },
62
62
  "dependencies": {
63
- "@exellix/ai-skills": "^6.0.0",
63
+ "@exellix/ai-skills": "^6.0.2",
64
64
  "@exellix/memorix-narrix-adapter": "^2.0.0",
65
65
  "@exellix/narrix-adapter-chat": "^2.0.0",
66
66
  "@exellix/narrix-adapter-docs": "^2.0.0",
@@ -72,7 +72,7 @@
72
72
  "@exellix/narrix-ingest": "^2.0.0",
73
73
  "@exellix/narrix-runner": "^2.0.0",
74
74
  "@exellix/narrix-web-scoper": "^2.0.0",
75
- "@exellix/xynthesis": "^4.4.3",
75
+ "@exellix/xynthesis": "^4.4.5",
76
76
  "@x12i/activix": "^8.5.0",
77
77
  "@x12i/ai-profiles": "^2.1.0",
78
78
  "@x12i/catalox": "^5.1.3",